Modified to use StringType functions.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@343 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
60abd72960
commit
7ecba53a9b
1 changed files with 48 additions and 48 deletions
|
|
@ -717,7 +717,7 @@ tm_tail : COMMA tm_parm tm_tail {
|
||||||
tm_parm : type tm_name {
|
tm_parm : type tm_name {
|
||||||
$$ = NewHash();
|
$$ = NewHash();
|
||||||
if ($2.array) {
|
if ($2.array) {
|
||||||
SwigType_push($1,$2.array);
|
StringType_push($1,$2.array);
|
||||||
}
|
}
|
||||||
Setattr($$,ATTR_TYPE,$1);
|
Setattr($$,ATTR_TYPE,$1);
|
||||||
if ($2.name)
|
if ($2.name)
|
||||||
|
|
@ -727,9 +727,9 @@ tm_parm : type tm_name {
|
||||||
}
|
}
|
||||||
| type stars tm_name {
|
| type stars tm_name {
|
||||||
$$ = NewHash();
|
$$ = NewHash();
|
||||||
SwigType_push($1,$2);
|
StringType_push($1,$2);
|
||||||
if ($3.array) {
|
if ($3.array) {
|
||||||
SwigType_push($1,$3.array);
|
StringType_push($1,$3.array);
|
||||||
}
|
}
|
||||||
Setattr($$,ATTR_TYPE,$1);
|
Setattr($$,ATTR_TYPE,$1);
|
||||||
if ($3.name)
|
if ($3.name)
|
||||||
|
|
@ -739,9 +739,9 @@ tm_parm : type tm_name {
|
||||||
}
|
}
|
||||||
| type AND tm_name {
|
| type AND tm_name {
|
||||||
$$ = NewHash();
|
$$ = NewHash();
|
||||||
SwigType_add_reference($1);
|
StringType_add_reference($1);
|
||||||
if ($3.array) {
|
if ($3.array) {
|
||||||
SwigType_push($1,$3.array);
|
StringType_push($1,$3.array);
|
||||||
}
|
}
|
||||||
Setattr($$,ATTR_TYPE,$1);
|
Setattr($$,ATTR_TYPE,$1);
|
||||||
if ($3.name)
|
if ($3.name)
|
||||||
|
|
@ -801,8 +801,8 @@ variable_decl : storage_spec type declaration array2 def_args stail {
|
||||||
DOH *o, *t;
|
DOH *o, *t;
|
||||||
$$ = new_node(TAG_VARIABLE,Getfile($3.id),Getline($3.id));
|
$$ = new_node(TAG_VARIABLE,Getfile($3.id),Getline($3.id));
|
||||||
t = Copy($2);
|
t = Copy($2);
|
||||||
SwigType_push(t,$3.decl);
|
StringType_push(t,$3.decl);
|
||||||
SwigType_push(t,$4);
|
StringType_push(t,$4);
|
||||||
Setattr($$,ATTR_NAME,$3.id);
|
Setattr($$,ATTR_NAME,$3.id);
|
||||||
Setattr($$,ATTR_TYPE,t);
|
Setattr($$,ATTR_TYPE,t);
|
||||||
if ($1.ivalue) {
|
if ($1.ivalue) {
|
||||||
|
|
@ -816,7 +816,7 @@ variable_decl : storage_spec type declaration array2 def_args stail {
|
||||||
o = $6;
|
o = $6;
|
||||||
while (o) {
|
while (o) {
|
||||||
t = Copy($2);
|
t = Copy($2);
|
||||||
SwigType_push(t,Getattr(o,ATTR_TYPE));
|
StringType_push(t,Getattr(o,ATTR_TYPE));
|
||||||
Setattr(o,ATTR_TYPE,t);
|
Setattr(o,ATTR_TYPE,t);
|
||||||
if ($1.ivalue) {
|
if ($1.ivalue) {
|
||||||
Setattr(o,ATTR_STORAGE,$1.text);
|
Setattr(o,ATTR_STORAGE,$1.text);
|
||||||
|
|
@ -841,7 +841,7 @@ variable_decl : storage_spec type declaration array2 def_args stail {
|
||||||
function_decl : storage_spec type declaration LPAREN parms RPAREN cpp_const stail {
|
function_decl : storage_spec type declaration LPAREN parms RPAREN cpp_const stail {
|
||||||
DOH *o, *t;
|
DOH *o, *t;
|
||||||
t = Copy($2);
|
t = Copy($2);
|
||||||
SwigType_push(t,$3.decl);
|
StringType_push(t,$3.decl);
|
||||||
$$ = new_node(TAG_FUNCTION,Getfile($3.id),Getline($3.id));
|
$$ = new_node(TAG_FUNCTION,Getfile($3.id),Getline($3.id));
|
||||||
Setattr($$,ATTR_NAME,$3.id);
|
Setattr($$,ATTR_NAME,$3.id);
|
||||||
Setattr($$,ATTR_TYPE,t);
|
Setattr($$,ATTR_TYPE,t);
|
||||||
|
|
@ -854,7 +854,7 @@ function_decl : storage_spec type declaration LPAREN parms RPAREN cpp_const sta
|
||||||
o = $8;
|
o = $8;
|
||||||
while (o) {
|
while (o) {
|
||||||
t = Copy($2);
|
t = Copy($2);
|
||||||
SwigType_push(t,Getattr(o,ATTR_TYPE));
|
StringType_push(t,Getattr(o,ATTR_TYPE));
|
||||||
Setattr(o,ATTR_TYPE,t);
|
Setattr(o,ATTR_TYPE,t);
|
||||||
if ($1.ivalue) {
|
if ($1.ivalue) {
|
||||||
Setattr(o,ATTR_STORAGE,$1.text);
|
Setattr(o,ATTR_STORAGE,$1.text);
|
||||||
|
|
@ -867,7 +867,7 @@ function_decl : storage_spec type declaration LPAREN parms RPAREN cpp_const sta
|
||||||
/* A function declaration with code after it */
|
/* A function declaration with code after it */
|
||||||
|
|
||||||
| storage_spec type declaration LPAREN parms RPAREN cpp_end {
|
| storage_spec type declaration LPAREN parms RPAREN cpp_end {
|
||||||
SwigType_push($2,$3.decl);
|
StringType_push($2,$3.decl);
|
||||||
$$ = new_node(TAG_FUNCTION,Getfile($3.id),Getline($3.id));
|
$$ = new_node(TAG_FUNCTION,Getfile($3.id),Getline($3.id));
|
||||||
Setattr($$,ATTR_NAME,$3.id);
|
Setattr($$,ATTR_NAME,$3.id);
|
||||||
Setattr($$,ATTR_TYPE,$2);
|
Setattr($$,ATTR_TYPE,$2);
|
||||||
|
|
@ -914,8 +914,8 @@ function_decl : storage_spec type declaration LPAREN parms RPAREN cpp_const sta
|
||||||
stail : SEMI { $$ = 0; }
|
stail : SEMI { $$ = 0; }
|
||||||
| COMMA declaration array2 def_args stail {
|
| COMMA declaration array2 def_args stail {
|
||||||
DOH *t = NewString("");
|
DOH *t = NewString("");
|
||||||
SwigType_push(t,$2.decl);
|
StringType_push(t,$2.decl);
|
||||||
SwigType_push(t,$3);
|
StringType_push(t,$3);
|
||||||
$$ = new_node(TAG_VARIABLE, Getfile($2.id),Getline($2.id));
|
$$ = new_node(TAG_VARIABLE, Getfile($2.id),Getline($2.id));
|
||||||
Setattr($$,ATTR_NAME,$2.id);
|
Setattr($$,ATTR_NAME,$2.id);
|
||||||
Setattr($$,ATTR_TYPE,t);
|
Setattr($$,ATTR_TYPE,t);
|
||||||
|
|
@ -926,7 +926,7 @@ stail : SEMI { $$ = 0; }
|
||||||
}
|
}
|
||||||
| COMMA declaration LPAREN parms RPAREN stail {
|
| COMMA declaration LPAREN parms RPAREN stail {
|
||||||
DOH *t = NewString("");
|
DOH *t = NewString("");
|
||||||
SwigType_push(t,$2.decl);
|
StringType_push(t,$2.decl);
|
||||||
$$ = new_node(TAG_FUNCTION, Getfile($2.id), Getline($2.id));
|
$$ = new_node(TAG_FUNCTION, Getfile($2.id), Getline($2.id));
|
||||||
Setattr($$,ATTR_NAME,$2.id);
|
Setattr($$,ATTR_NAME,$2.id);
|
||||||
Setattr($$,ATTR_PARMS,$4);
|
Setattr($$,ATTR_PARMS,$4);
|
||||||
|
|
@ -1035,8 +1035,8 @@ typedef_decl : TYPEDEF type declaration array2 typedeflist SEMI {
|
||||||
int i;
|
int i;
|
||||||
$$ = new_node("typedef", $1.filename,$1.line);
|
$$ = new_node("typedef", $1.filename,$1.line);
|
||||||
t = Copy($2);
|
t = Copy($2);
|
||||||
SwigType_push($2,$3.decl);
|
StringType_push($2,$3.decl);
|
||||||
if ($4) SwigType_push($2,$4);
|
if ($4) StringType_push($2,$4);
|
||||||
Setattr($$,ATTR_NAME,$3.id);
|
Setattr($$,ATTR_NAME,$3.id);
|
||||||
Setattr($$,ATTR_TYPE,$2);
|
Setattr($$,ATTR_TYPE,$2);
|
||||||
/* Go create more typedefs */
|
/* Go create more typedefs */
|
||||||
|
|
@ -1046,8 +1046,8 @@ typedef_decl : TYPEDEF type declaration array2 typedeflist SEMI {
|
||||||
d = Getitem($5,i);
|
d = Getitem($5,i);
|
||||||
o = new_node("typedef",$1.filename,$1.line);
|
o = new_node("typedef",$1.filename,$1.line);
|
||||||
ty = Copy(t);
|
ty = Copy(t);
|
||||||
SwigType_push(ty,Getattr(d,"decl"));
|
StringType_push(ty,Getattr(d,"decl"));
|
||||||
SwigType_push(ty,Getattr(d,"array"));
|
StringType_push(ty,Getattr(d,"array"));
|
||||||
Setattr(o,ATTR_TYPE,ty);
|
Setattr(o,ATTR_TYPE,ty);
|
||||||
Setattr(o,ATTR_NAME,Getattr(d,ATTR_NAME));
|
Setattr(o,ATTR_NAME,Getattr(d,ATTR_NAME));
|
||||||
Setattr(prev,ATTR_SIBLING,o);
|
Setattr(prev,ATTR_SIBLING,o);
|
||||||
|
|
@ -1060,10 +1060,10 @@ typedef_decl : TYPEDEF type declaration array2 typedeflist SEMI {
|
||||||
|
|
||||||
| TYPEDEF type LPAREN stars pname RPAREN LPAREN parms RPAREN SEMI {
|
| TYPEDEF type LPAREN stars pname RPAREN LPAREN parms RPAREN SEMI {
|
||||||
$$ = new_node("typedef", $1.filename,$1.line);
|
$$ = new_node("typedef", $1.filename,$1.line);
|
||||||
SwigType_push($2,parmstotype($8));
|
StringType_push($2,parmstotype($8));
|
||||||
SwigType_push($2,$4);
|
StringType_push($2,$4);
|
||||||
if ($5.array)
|
if ($5.array)
|
||||||
SwigType_push($2,$5.array);
|
StringType_push($2,$5.array);
|
||||||
Setattr($$,ATTR_NAME,$5.name);
|
Setattr($$,ATTR_NAME,$5.name);
|
||||||
Setattr($$,ATTR_TYPE,$2);
|
Setattr($$,ATTR_TYPE,$2);
|
||||||
}
|
}
|
||||||
|
|
@ -1072,11 +1072,11 @@ typedef_decl : TYPEDEF type declaration array2 typedeflist SEMI {
|
||||||
|
|
||||||
| TYPEDEF type stars LPAREN stars pname RPAREN LPAREN parms RPAREN SEMI {
|
| TYPEDEF type stars LPAREN stars pname RPAREN LPAREN parms RPAREN SEMI {
|
||||||
$$ = new_node("typedef", $1.filename,$1.line);
|
$$ = new_node("typedef", $1.filename,$1.line);
|
||||||
SwigType_push($2,$3);
|
StringType_push($2,$3);
|
||||||
SwigType_push($2,parmstotype($9));
|
StringType_push($2,parmstotype($9));
|
||||||
SwigType_push($2,$5);
|
StringType_push($2,$5);
|
||||||
if ($6.array)
|
if ($6.array)
|
||||||
SwigType_push($2,$6.array);
|
StringType_push($2,$6.array);
|
||||||
Setattr($$,ATTR_NAME,$6.name);
|
Setattr($$,ATTR_NAME,$6.name);
|
||||||
Setattr($$,ATTR_TYPE,$2);
|
Setattr($$,ATTR_TYPE,$2);
|
||||||
}
|
}
|
||||||
|
|
@ -1160,7 +1160,7 @@ cpp_class : storage_spec cpptype ID inherit LBRACE interface RBRACE opt_id S
|
||||||
o = new_node("typedef",$3.filename,$3.line);
|
o = new_node("typedef",$3.filename,$3.line);
|
||||||
Setattr(o,ATTR_NAME,$8.id);
|
Setattr(o,ATTR_NAME,$8.id);
|
||||||
t = Copy($3.text);
|
t = Copy($3.text);
|
||||||
SwigType_push(t,$8.decl);
|
StringType_push(t,$8.decl);
|
||||||
Setattr(o,ATTR_TYPE,t);
|
Setattr(o,ATTR_TYPE,t);
|
||||||
Setattr($$,ATTR_SIBLING,o);
|
Setattr($$,ATTR_SIBLING,o);
|
||||||
prev = o;
|
prev = o;
|
||||||
|
|
@ -1168,8 +1168,8 @@ cpp_class : storage_spec cpptype ID inherit LBRACE interface RBRACE opt_id S
|
||||||
d = Getitem($9,i);
|
d = Getitem($9,i);
|
||||||
o = new_node("typedef",$3.filename,$3.line);
|
o = new_node("typedef",$3.filename,$3.line);
|
||||||
t = Copy($3.text);
|
t = Copy($3.text);
|
||||||
SwigType_push(t,Getattr(d,"decl"));
|
StringType_push(t,Getattr(d,"decl"));
|
||||||
SwigType_push(t,Getattr(d,"array"));
|
StringType_push(t,Getattr(d,"array"));
|
||||||
Setattr(o,ATTR_TYPE,t);
|
Setattr(o,ATTR_TYPE,t);
|
||||||
Setattr(o,ATTR_NAME,Getattr(d,ATTR_NAME));
|
Setattr(o,ATTR_NAME,Getattr(d,ATTR_NAME));
|
||||||
Setattr(prev,ATTR_SIBLING,o);
|
Setattr(prev,ATTR_SIBLING,o);
|
||||||
|
|
@ -1336,7 +1336,7 @@ ptail : COMMA parm ptail {
|
||||||
parm : type pname {
|
parm : type pname {
|
||||||
$$ = new_node("parm",Getfile($2.name),Getline($2.name));
|
$$ = new_node("parm",Getfile($2.name),Getline($2.name));
|
||||||
Setattr($$,ATTR_NAME,$2.name);
|
Setattr($$,ATTR_NAME,$2.name);
|
||||||
SwigType_push($1,$2.array);
|
StringType_push($1,$2.array);
|
||||||
if ($2.value)
|
if ($2.value)
|
||||||
Setattr($$,ATTR_VALUE,$2.value);
|
Setattr($$,ATTR_VALUE,$2.value);
|
||||||
Setattr($$,ATTR_TYPE,$1);
|
Setattr($$,ATTR_TYPE,$1);
|
||||||
|
|
@ -1344,8 +1344,8 @@ parm : type pname {
|
||||||
| type stars pname {
|
| type stars pname {
|
||||||
$$ = new_node("parm",Getfile($3.name),Getline($3.name));
|
$$ = new_node("parm",Getfile($3.name),Getline($3.name));
|
||||||
Setattr($$,ATTR_NAME,$3.name);
|
Setattr($$,ATTR_NAME,$3.name);
|
||||||
SwigType_push($1,$2);
|
StringType_push($1,$2);
|
||||||
SwigType_push($1,$3.array);
|
StringType_push($1,$3.array);
|
||||||
if ($3.value) {
|
if ($3.value) {
|
||||||
Setattr($$,ATTR_VALUE,$3.value);
|
Setattr($$,ATTR_VALUE,$3.value);
|
||||||
}
|
}
|
||||||
|
|
@ -1353,8 +1353,8 @@ parm : type pname {
|
||||||
}
|
}
|
||||||
| type AND pname {
|
| type AND pname {
|
||||||
$$ = new_node("parm",Getfile($3.name),Getline($3.name));
|
$$ = new_node("parm",Getfile($3.name),Getline($3.name));
|
||||||
SwigType_add_reference($1);
|
StringType_add_reference($1);
|
||||||
SwigType_push($1,$3.array);
|
StringType_push($1,$3.array);
|
||||||
Setattr($$,ATTR_NAME,$3.name);
|
Setattr($$,ATTR_NAME,$3.name);
|
||||||
if ($3.value) {
|
if ($3.value) {
|
||||||
Setattr($$,ATTR_VALUE,$3.value);
|
Setattr($$,ATTR_VALUE,$3.value);
|
||||||
|
|
@ -1363,10 +1363,10 @@ parm : type pname {
|
||||||
}
|
}
|
||||||
| type LPAREN stars pname RPAREN LPAREN parms RPAREN {
|
| type LPAREN stars pname RPAREN LPAREN parms RPAREN {
|
||||||
$$ = new_node("parm",$2.filename, $2.line);
|
$$ = new_node("parm",$2.filename, $2.line);
|
||||||
SwigType_push($1,parmstotype($7));
|
StringType_push($1,parmstotype($7));
|
||||||
SwigType_push($1,$3);
|
StringType_push($1,$3);
|
||||||
if ($4.array)
|
if ($4.array)
|
||||||
SwigType_push($1,$4.array);
|
StringType_push($1,$4.array);
|
||||||
Setattr($$,ATTR_NAME,$4.name);
|
Setattr($$,ATTR_NAME,$4.name);
|
||||||
if ($4.value)
|
if ($4.value)
|
||||||
Setattr($$,ATTR_VALUE,$4.value);
|
Setattr($$,ATTR_VALUE,$4.value);
|
||||||
|
|
@ -1374,11 +1374,11 @@ parm : type pname {
|
||||||
}
|
}
|
||||||
| type stars LPAREN stars pname RPAREN LPAREN parms RPAREN {
|
| type stars LPAREN stars pname RPAREN LPAREN parms RPAREN {
|
||||||
$$ = new_node("parm",$3.filename, $3.line);
|
$$ = new_node("parm",$3.filename, $3.line);
|
||||||
SwigType_push($1,$2);
|
StringType_push($1,$2);
|
||||||
SwigType_push($1,parmstotype($8));
|
StringType_push($1,parmstotype($8));
|
||||||
SwigType_push($1,$4);
|
StringType_push($1,$4);
|
||||||
if ($5.array)
|
if ($5.array)
|
||||||
SwigType_push($1,$5.array);
|
StringType_push($1,$5.array);
|
||||||
Setattr($$,ATTR_NAME,$5.name);
|
Setattr($$,ATTR_NAME,$5.name);
|
||||||
if ($5.value)
|
if ($5.value)
|
||||||
Setattr($$,ATTR_VALUE,$5.value);
|
Setattr($$,ATTR_VALUE,$5.value);
|
||||||
|
|
@ -1447,32 +1447,32 @@ declaration : ID {
|
||||||
| AND ID {
|
| AND ID {
|
||||||
$$.id = $2.text;
|
$$.id = $2.text;
|
||||||
$$.decl = NewString("");
|
$$.decl = NewString("");
|
||||||
SwigType_add_reference($$.decl);
|
StringType_add_reference($$.decl);
|
||||||
}
|
}
|
||||||
| AND stars ID {
|
| AND stars ID {
|
||||||
$$.id = $3.text;
|
$$.id = $3.text;
|
||||||
$$.decl = $2;
|
$$.decl = $2;
|
||||||
SwigType_add_reference($$.decl);
|
StringType_add_reference($$.decl);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
stars : STAR empty {
|
stars : STAR empty {
|
||||||
$$ = NewString("");
|
$$ = NewString("");
|
||||||
SwigType_add_pointer($$);
|
StringType_add_pointer($$);
|
||||||
}
|
}
|
||||||
| STAR stars {
|
| STAR stars {
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
SwigType_add_pointer($$);
|
StringType_add_pointer($$);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
array : LBRACKET RBRACKET array2 {
|
array : LBRACKET RBRACKET array2 {
|
||||||
$$ = $3;
|
$$ = $3;
|
||||||
SwigType_add_array($$,"");
|
StringType_add_array($$,"");
|
||||||
}
|
}
|
||||||
| LBRACKET expr RBRACKET array2 {
|
| LBRACKET expr RBRACKET array2 {
|
||||||
$$ = $4;
|
$$ = $4;
|
||||||
SwigType_add_array($$,$2.text);
|
StringType_add_array($$,$2.text);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
array2 : array {
|
array2 : array {
|
||||||
|
|
@ -1509,7 +1509,7 @@ type : TYPE_INT { $$ = NewString("int"); }
|
||||||
$$ = NewString($1.text);
|
$$ = NewString($1.text);
|
||||||
}
|
}
|
||||||
| CONST type {
|
| CONST type {
|
||||||
SwigType_add_qualifier($2,"const");
|
StringType_add_qualifier($2,"const");
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
}
|
}
|
||||||
| cpptype ID {
|
| cpptype ID {
|
||||||
|
|
@ -1557,7 +1557,7 @@ strict_type : TYPE_INT { $$ = NewString("int"); }
|
||||||
}
|
}
|
||||||
| CONST type {
|
| CONST type {
|
||||||
$$ = $2;
|
$$ = $2;
|
||||||
SwigType_add_qualifier($$,"const");
|
StringType_add_qualifier($$,"const");
|
||||||
}
|
}
|
||||||
| cpptype ID {
|
| cpptype ID {
|
||||||
$$ = NewStringf("%s %s", $1.text, $2.text);
|
$$ = NewStringf("%s %s", $1.text, $2.text);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue