{"action":"opened","number":439,"pull_request":{"url":"https://api.github.com/repos/swig/swig/pulls/439","id":37733150,"html_url":"https://github.com/swig/swig/pull/439","diff_url":"https://github.com/swig/swig/pull/439.diff","patch_url":"https://github.com/swig/swig/pull/439.patch","issue_url":"https://api.github.com/repos/swig/swig/issues/439","number":439,"state":"open","locked":false,"title":"Enable variable and typemap substitution in typemap kwargs","user":{"login":"LindleyF","id":6224264,"avatar_url":"https://avatars.githubusercontent.com/u/6224264?v=3","gravatar_id":"","url":"https://api.github.com/users/LindleyF","html_url":"https://github.com/LindleyF","followers_url":"https://api.github.com/users/LindleyF/followers","following_url":"https://api.github.com/users/LindleyF/following{/other_user}","gists_url":"https://api.github.com/users/LindleyF/gists{/gist_id}","starred_url":"https://api.github.com/users/LindleyF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LindleyF/subscriptions","organizations_url":"https://api.github.com/users/LindleyF/orgs","repos_url":"https://api.github.com/users/LindleyF/repos","events_url":"https://api.github.com/users/LindleyF/events{/privacy}","received_events_url":"https://api.github.com/users/LindleyF/received_events","type":"User","site_admin":false},"body":"Typemap substitution in typemap kwargs may be needed whenever $javaclassname is not the right type for the directorin JNI descriptor, and the necessary type cannot be hard-coded (such as in a macro).\r\n\r\nkwargs are processed in both Swig_typemap_lookup_impl (for director method return types) and Swig_typemap_attach_parms (for director method parameters). The latter method calls a helper function typemap_attach_kwargs; the former does not call this method. I feel like it should, but there are some slight differences in handling of the 'type' attribute for reasons I don't understand, so I left them separate and instead updated both code blocks with equivalent changes.\r\n\r\nThe call to replace_embedded_typemap() is where the magic happens. Most of the rest is just getting parameters for typemap_replace_vars(), and I'm honestly not certain how many of them are really needed. It seems like the only necessary line in typemap_replace_vars() is:\r\nReplaceall(s, \"$typemap\", \"$TYPEMAP\");\r\nsince this is a prerequisite for replace_embedded_typemap. I call the entire method for the sake of consistency and because it should make other common substitutions work too, although I don't have a good use-case for anything else right now.\r\n\r\nI've added a new test that verifies this works for directorin:descriptor. It's based on the idea that it should be possible to write typemaps to make pointer-like classes convert to Java references to the underlying type.","created_at":"2015-06-15T20:42:22Z","updated_at":"2015-06-15T20:42:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/swig/swig/pulls/439/commits","review_comments_url":"https://api.github.com/repos/swig/swig/pulls/439/comments","review_comment_url":"https://api.github.com/repos/swig/swig/pulls/comments{/number}","comments_url":"https://api.github.com/repos/swig/swig/issues/439/comments","statuses_url":"https://api.github.com/repos/swig/swig/statuses/7cfdcb0d36e60f4c6f433939590cd2f05a71df0f","head":{"label":"LindleyF:typemap-in-descriptor","ref":"typemap-in-descriptor","sha":"7cfdcb0d36e60f4c6f433939590cd2f05a71df0f","user":{"login":"LindleyF","id":6224264,"avatar_url":"https://avatars.githubusercontent.com/u/6224264?v=3","gravatar_id":"","url":"https://api.github.com/users/LindleyF","html_url":"https://github.com/LindleyF","followers_url":"https://api.github.com/users/LindleyF/followers","following_url":"https://api.github.com/users/LindleyF/following{/other_user}","gists_url":"https://api.github.com/users/LindleyF/gists{/gist_id}","starred_url":"https://api.github.com/users/LindleyF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LindleyF/subscriptions","organizations_url":"https://api.github.com/users/LindleyF/orgs","repos_url":"https://api.github.com/users/LindleyF/repos","events_url":"https://api.github.com/users/LindleyF/events{/privacy}","received_events_url":"https://api.github.com/users/LindleyF/received_events","type":"User","site_admin":false},"repo":{"id":34888983,"name":"swig","full_name":"LindleyF/swig","owner":{"login":"LindleyF","id":6224264,"avatar_url":"https://avatars.githubusercontent.com/u/6224264?v=3","gravatar_id":"","url":"https://api.github.com/users/LindleyF","html_url":"https://github.com/LindleyF","followers_url":"https://api.github.com/users/LindleyF/followers","following_url":"https://api.github.com/users/LindleyF/following{/other_user}","gists_url":"https://api.github.com/users/LindleyF/gists{/gist_id}","starred_url":"https://api.github.com/users/LindleyF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/LindleyF/subscriptions","organizations_url":"https://api.github.com/users/LindleyF/orgs","repos_url":"https://api.github.com/users/LindleyF/repos","events_url":"https://api.github.com/users/LindleyF/events{/privacy}","received_events_url":"https://api.github.com/users/LindleyF/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/LindleyF/swig","description":"SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages.","fork":true,"url":"https://api.github.com/repos/LindleyF/swig","forks_url":"https://api.github.com/repos/LindleyF/swig/forks","keys_url":"https://api.github.com/repos/LindleyF/swig/keys{/key_id}","collaborators_url":"https://api.github.com/repos/LindleyF/swig/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/LindleyF/swig/teams","hooks_url":"https://api.github.com/repos/LindleyF/swig/hooks","issue_events_url":"https://api.github.com/repos/LindleyF/swig/issues/events{/number}","events_url":"https://api.github.com/repos/LindleyF/swig/events","assignees_url":"https://api.github.com/repos/LindleyF/swig/assignees{/user}","branches_url":"https://api.github.com/repos/LindleyF/swig/branches{/branch}","tags_url":"https://api.github.com/repos/LindleyF/swig/tags","blobs_url":"https://api.github.com/repos/LindleyF/swig/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/LindleyF/swig/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/LindleyF/swig/git/refs{/sha}","trees_url":"https://api.github.com/repos/LindleyF/swig/git/trees{/sha}","statuses_url":"https://api.github.com/repos/LindleyF/swig/statuses/{sha}","languages_url":"https://api.github.com/repos/LindleyF/swig/languages","stargazers_url":"https://api.github.com/repos/LindleyF/swig/stargazers","contributors_url":"https://api.github.com/repos/LindleyF/swig/contributors","subscribers_url":"https://api.github.com/repos/LindleyF/swig/subscribers","subscription_url":"https://api.github.com/repos/LindleyF/swig/subscription","commits_url":"https://api.github.com/repos/LindleyF/swig/commits{/sha}","git_commits_url":"https://api.github.com/repos/LindleyF/swig/git/commits{/sha}","comments_url":"https://api.github.com/repos/LindleyF/swig/comments{/number}","issue_comment_url":"https://api.github.com/repos/LindleyF/swig/issues/comments{/number}","contents_url":"https://api.github.com/repos/LindleyF/swig/contents/{+path}","compare_url":"https://api.github.com/repos/LindleyF/swig/compare/{base}...{head}","merges_url":"https://api.github.com/repos/LindleyF/swig/merges","archive_url":"https://api.github.com/repos/LindleyF/swig/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/LindleyF/swig/downloads","issues_url":"https://api.github.com/repos/LindleyF/swig/issues{/number}","pulls_url":"https://api.github.com/repos/LindleyF/swig/pulls{/number}","milestones_url":"https://api.github.com/repos/LindleyF/swig/milestones{/number}","notifications_url":"https://api.github.com/repos/LindleyF/swig/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/LindleyF/swig/labels{/name}","releases_url":"https://api.github.com/repos/LindleyF/swig/releases{/id}","created_at":"2015-05-01T04:03:16Z","updated_at":"2015-05-07T18:30:03Z","pushed_at":"2015-06-15T20:26:29Z","git_url":"git://github.com/LindleyF/swig.git","ssh_url":"git@github.com:LindleyF/swig.git","clone_url":"https://github.com/LindleyF/swig.git","svn_url":"https://github.com/LindleyF/swig","homepage":"http://www.swig.org","size":53637,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"swig:master","ref":"master","sha":"b1f2d0749e6db99cba94eaec606d3a6ae986415f","user":{"login":"swig","id":1565046,"avatar_url":"https://avatars.githubusercontent.com/u/1565046?v=3","gravatar_id":"","url":"https://api.github.com/users/swig","html_url":"https://github.com/swig","followers_url":"https://api.github.com/users/swig/followers","following_url":"https://api.github.com/users/swig/following{/other_user}","gists_url":"https://api.github.com/users/swig/gists{/gist_id}","starred_url":"https://api.github.com/users/swig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swig/subscriptions","organizations_url":"https://api.github.com/users/swig/orgs","repos_url":"https://api.github.com/users/swig/repos","events_url":"https://api.github.com/users/swig/events{/privacy}","received_events_url":"https://api.github.com/users/swig/received_events","type":"Organization","site_admin":false},"repo":{"id":7372528,"name":"swig","full_name":"swig/swig","owner":{"login":"swig","id":1565046,"avatar_url":"https://avatars.githubusercontent.com/u/1565046?v=3","gravatar_id":"","url":"https://api.github.com/users/swig","html_url":"https://github.com/swig","followers_url":"https://api.github.com/users/swig/followers","following_url":"https://api.github.com/users/swig/following{/other_user}","gists_url":"https://api.github.com/users/swig/gists{/gist_id}","starred_url":"https://api.github.com/users/swig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/swig/subscriptions","organizations_url":"https://api.github.com/users/swig/orgs","repos_url":"https://api.github.com/users/swig/repos","events_url":"https://api.github.com/users/swig/events{/privacy}","received_events_url":"https://api.github.com/users/swig/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/swig/swig","description":"SWIG is a software development tool that connects programs written in C and C++ with a variety of high-level programming languages.","fork":false,"url":"https://api.github.com/repos/swig/swig","forks_url":"https://api.github.com/repos/swig/swig/forks","keys_url":"https://api.github.com/repos/swig/swig/keys{/key_id}","collaborators_url":"https://api.github.com/repos/swig/swig/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/swig/swig/teams","hooks_url":"https://api.github.com/repos/swig/swig/hooks","issue_events_url":"https://api.github.com/repos/swig/swig/issues/events{/number}","events_url":"https://api.github.com/repos/swig/swig/events","assignees_url":"https://api.github.com/repos/swig/swig/assignees{/user}","branches_url":"https://api.github.com/repos/swig/swig/branches{/branch}","tags_url":"https://api.github.com/repos/swig/swig/tags","blobs_url":"https://api.github.com/repos/swig/swig/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/swig/swig/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/swig/swig/git/refs{/sha}","trees_url":"https://api.github.com/repos/swig/swig/git/trees{/sha}","statuses_url":"https://api.github.com/repos/swig/swig/statuses/{sha}","languages_url":"https://api.github.com/repos/swig/swig/languages","stargazers_url":"https://api.github.com/repos/swig/swig/stargazers","contributors_url":"https://api.github.com/repos/swig/swig/contributors","subscribers_url":"https://api.github.com/repos/swig/swig/subscribers","subscription_url":"https://api.github.com/repos/swig/swig/subscription","commits_url":"https://api.github.com/repos/swig/swig/commits{/sha}","git_commits_url":"https://api.github.com/repos/swig/swig/git/commits{/sha}","comments_url":"https://api.github.com/repos/swig/swig/comments{/number}","issue_comment_url":"https://api.github.com/repos/swig/swig/issues/comments{/number}","contents_url":"https://api.github.com/repos/swig/swig/contents/{+path}","compare_url":"https://api.github.com/repos/swig/swig/compare/{base}...{head}","merges_url":"https://api.github.com/repos/swig/swig/merges","archive_url":"https://api.github.com/repos/swig/swig/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/swig/swig/downloads","issues_url":"https://api.github.com/repos/swig/swig/issues{/number}","pulls_url":"https://api.github.com/repos/swig/swig/pulls{/number}","milestones_url":"https://api.github.com/repos/swig/swig/milestones{/number}","notifications_url":"https://api.github.com/repos/swig/swig/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/swig/swig/labels{/name}","releases_url":"https://api.github.com/repos/swig/swig/releases{/id}","created_at":"2012-12-30T02:04:38Z","updated_at":"2015-06-15T12:58:00Z","pushed_at":"2015-06-15T16:03:07Z","git_url":"git://github.com/swig/swig.git","ssh_url":"git@github.com:swig/swig.git","clone_url":"https://github.com/swig/swig.git","svn_url":"https://github.com/swig/swig","homepage":"http://www.swig.org","size":262555,"stargazers_count":629,"watchers_count":629,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":236,"mirror_url":null,"open_issues_count":123,"forks":236,"open_issues":123,"watchers":629,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/swig/swig/pulls/439"},"html":{"href":"https://github.com/swig/swig/pull/439"},"issue":{"href":"https://api.github.com/repos/swig/swig/issues/439"},"comments":{"href":"https://api.github.com/repos/swig/swig/issues/439/comments"},"review_comments":{"href":"https://api.github.com/repos/swig/swig/pulls/439/comments"},"review_comment":{"href":"https://api.github.com/repos/swig/swig/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/swig/swig/pulls/439/commits"},"statuses":{"href":"https://api.github.com/repos/swig/swig/statuses/7cfdcb0d36e60f4c6f433939590cd2f05a71df0f"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":184,"deletions":2,"changed_files":4}}