Additions to %types so that a user can specify the code to go into the casting / conversion function

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10222 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-01-31 22:45:59 +00:00
commit 629aae375c
5 changed files with 76 additions and 13 deletions

View file

@ -1804,10 +1804,6 @@ except_directive : EXCEPT LPAREN ID RPAREN LBRACE {
}
;
/* ------------------------------------------------------------
%fragment(name,location) { ... }
------------------------------------------------------------ */
/* fragment keyword arguments */
stringtype : string LBRACE parm RBRACE {
$$ = NewHash();
@ -1825,6 +1821,14 @@ fname : string {
}
;
/* ------------------------------------------------------------
%fragment(name, section) %{ ... %}
%fragment("name" {type}, "section") %{ ... %}
%fragment("name", "section", fragment="fragment1", fragment="fragment2") %{ ... %}
Also as above but using { ... }
%fragment("name");
------------------------------------------------------------ */
fragment_directive: FRAGMENT LPAREN fname COMMA kwargs RPAREN HBLOCK {
Hash *p = $5;
$$ = new_node("fragment");
@ -2502,11 +2506,14 @@ typemap_parm : type typemap_parameter_declarator {
/* ------------------------------------------------------------
%types(parmlist);
%types(parmlist) %{ ... %}
------------------------------------------------------------ */
types_directive : TYPES LPAREN parms RPAREN SEMI {
types_directive : TYPES LPAREN parms RPAREN stringbracesemi {
$$ = new_node("types");
Setattr($$,"parms",$3);
if ($5)
Setattr($$,"convcode",NewString($5));
}
;