pretty print the nested structs generated as global structs

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@11754 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2009-11-18 20:37:23 +00:00
commit aa6712e3f2

View file

@ -1021,6 +1021,7 @@ static void add_nested(Nested *n) {
* ----------------------------------------------------------------------------- */
static void nested_new_struct(Node *cpp_opt_declarators, const char *kind, String *struct_code) {
String *new_struct_decl;
String *name;
String *decl;
@ -1030,8 +1031,13 @@ static void nested_new_struct(Node *cpp_opt_declarators, const char *kind, Strin
name = Getattr(cpp_opt_declarators, "name");
decl = Getattr(cpp_opt_declarators, "decl");
n->code = NewStringEmpty();
Printv(n->code, "typedef ", kind, " ", struct_code, " $classname_", name, ";\n", NIL);
new_struct_decl = NewStringEmpty();
Printv(new_struct_decl, "typedef ", kind, " ", struct_code, " $classname_", name, ";\n", NIL);
Wrapper_pretty_print(new_struct_decl, n->code);
Delete(new_struct_decl);
n->name = Swig_copy_string(Char(name));
n->line = cparse_start_line;
n->type = NewStringEmpty();
@ -1049,8 +1055,13 @@ static void nested_new_struct(Node *cpp_opt_declarators, const char *kind, Strin
name = Getattr(p, "name");
decl = Getattr(p, "decl");
new_struct_decl = NewStringEmpty();
nn->code = NewStringEmpty();
Printv(nn->code, "typedef ", kind, " ", struct_code, " $classname_", name, ";\n", NIL);
Printv(new_struct_decl, "typedef ", kind, " ", struct_code, " $classname_", name, ";\n", NIL);
Wrapper_pretty_print(new_struct_decl, n->code);
Delete(new_struct_decl);
nn->name = Swig_copy_string(Char(name));
nn->line = cparse_start_line;
nn->type = NewStringEmpty();