enforce consistency in wrap:action wrt line spacing

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10411 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2008-05-01 21:47:23 +00:00
commit 46a0db50fe
8 changed files with 21 additions and 20 deletions

View file

@ -907,7 +907,7 @@ public:
// below based on Swig_VargetToFunction()
SwigType *ty = Swig_wrapped_var_type(Getattr(n, "type"), use_naturalvar_mode(n));
Setattr(n, "wrap:action", NewStringf("result = (%s) %s;\n", SwigType_lstr(ty, 0), Getattr(n, "value")));
Setattr(n, "wrap:action", NewStringf("result = (%s) %s;", SwigType_lstr(ty, 0), Getattr(n, "value")));
}
// Now write code to make the function call
if (!native_function_flag)

View file

@ -334,12 +334,12 @@ static void replace_contract_args(Parm *cp, Parm *rp, String *s) {
/* -----------------------------------------------------------------------------
* int emit_action()
*
* Emits action code for a wrapper and checks for exception handling
* Emits action code for a wrapper. Adds in exception handling code (%exception).
* ----------------------------------------------------------------------------- */
int emit_action_code(Node *n, Wrapper *f, String *eaction) {
assert(Getattr(n, "wrap:name"));
/* Look for except feature */
/* Look for except feature (%exception) */
String *tm = GetFlagAttr(n, "feature:except");
if (tm)
tm = Copy(tm);
@ -410,6 +410,7 @@ void emit_action(Node *n, Wrapper *f) {
}
Setattr(n, "wrap:code:done", f_code);
}
action = Getattr(n, "feature:action");
if (!action)
action = Getattr(n, "wrap:action");

View file

@ -986,7 +986,7 @@ public:
// below based on Swig_VargetToFunction()
SwigType *ty = Swig_wrapped_var_type(Getattr(n, "type"), use_naturalvar_mode(n));
Setattr(n, "wrap:action", NewStringf("result = (%s) %s;\n", SwigType_lstr(ty, 0), Getattr(n, "value")));
Setattr(n, "wrap:action", NewStringf("result = (%s) %s;", SwigType_lstr(ty, 0), Getattr(n, "value")));
}
// Now write code to make the function call
if (!native_function_flag) {

View file

@ -919,7 +919,7 @@ public:
Printv(f_wrappers, "static void swig_delete_", class_name, "(void *obj) {\n", NIL);
if (destructor_action) {
Printv(f_wrappers, SwigType_str(rt, "arg1"), " = (", SwigType_str(rt, 0), ") obj;\n", NIL);
Printv(f_wrappers, destructor_action, NIL);
Printv(f_wrappers, destructor_action, "\n", NIL);
} else {
if (CPlusPlus) {
Printv(f_wrappers, " delete (", SwigType_str(rt, 0), ") obj;\n", NIL);

View file

@ -1413,7 +1413,7 @@ MODULA3():
// below based on Swig_VargetToFunction()
SwigType *ty = Swig_wrapped_var_type(Getattr(n, "type"), use_naturalvar_mode(n));
Setattr(n, "wrap:action", NewStringf("result = (%s) %s;\n", SwigType_lstr(ty, 0), Getattr(n, "value")));
Setattr(n, "wrap:action", NewStringf("result = (%s) %s;", SwigType_lstr(ty, 0), Getattr(n, "value")));
}
Setattr(n, "wrap:name", wname);

View file

@ -1759,9 +1759,9 @@ public:
Wrapper_add_local(f, "classname", classname);
}
if (action) {
Append(action, "DATA_PTR(self) = result;\n");
Append(action, "\nDATA_PTR(self) = result;");
if (GetFlag(pn, "feature:trackobjects")) {
Append(action, "SWIG_RubyAddTracking(result, self);\n");
Append(action, "\nSWIG_RubyAddTracking(result, self);");
}
}
}
@ -2654,11 +2654,11 @@ public:
Printv(f_wrappers, wrap, NIL);
}
/* Printv(freebody, Swig_name_destroy(name), "(", pname0, ")", NIL); */
Printv(freebody, Getattr(n, "wrap:action"), NIL);
Printv(freebody, Getattr(n, "wrap:action"), "\n", NIL);
} else {
String *action = Getattr(n, "wrap:action");
if (action) {
Printv(freebody, action, NIL);
Printv(freebody, action, "\n", NIL);
} else {
/* In the case swig emits no destroy function. */
if (CPlusPlus)

View file

@ -782,7 +782,7 @@ public:
Printv(f_wrappers, "SWIGINTERN void swig_delete_", class_name, "(void *obj) {\n", NIL);
if (destructor_action) {
Printv(f_wrappers, SwigType_str(rt, "arg1"), " = (", SwigType_str(rt, 0), ") obj;\n", NIL);
Printv(f_wrappers, destructor_action, NIL);
Printv(f_wrappers, destructor_action, "\n", NIL);
} else {
if (CPlusPlus) {
Printv(f_wrappers, " delete (", SwigType_str(rt, 0), ") obj;\n", NIL);

View file

@ -658,7 +658,7 @@ String *Swig_cdestructor_call(Node *n) {
*
* Creates a string that calls a C destructor function.
*
* delete arg0;
* delete arg1;
* ----------------------------------------------------------------------------- */
String *Swig_cppdestructor_call(Node *n) {
@ -1175,7 +1175,7 @@ int Swig_DestructorToFunction(Node *n, String *classname, int cplus, int flags)
Swig_add_extension_code(n, mangled, p, type, code, cparse_cplusplus, "self");
}
call = Swig_cfunction_call(mangled, p);
cres = NewStringf("%s;\n", call);
cres = NewStringf("%s;", call);
Setattr(n, "wrap:action", cres);
Delete(membername);
Delete(mangled);
@ -1184,13 +1184,13 @@ int Swig_DestructorToFunction(Node *n, String *classname, int cplus, int flags)
} else {
if (cplus) {
String *call = Swig_cppdestructor_call(n);
String *cres = NewStringf("%s\n", call);
String *cres = NewStringf("%s", call);
Setattr(n, "wrap:action", cres);
Delete(call);
Delete(cres);
} else {
String *call = Swig_cdestructor_call(n);
String *cres = NewStringf("%s\n", call);
String *cres = NewStringf("%s", call);
Setattr(n, "wrap:action", cres);
Delete(call);
Delete(cres);
@ -1265,13 +1265,13 @@ int Swig_MembersetToFunction(Node *n, String *classname, int flags) {
Swig_add_extension_code(n, mangled, parms, void_type, code, cparse_cplusplus, "self");
}
call = Swig_cfunction_call(mangled, parms);
cres = NewStringf("%s;\n", call);
cres = NewStringf("%s;", call);
Setattr(n, "wrap:action", cres);
Delete(call);
Delete(cres);
} else {
String *call = Swig_cmemberset_call(name, type, self, varcref);
String *cres = NewStringf("%s;\n", call);
String *cres = NewStringf("%s;", call);
Setattr(n, "wrap:action", cres);
Delete(call);
Delete(cres);
@ -1391,7 +1391,7 @@ int Swig_VarsetToFunction(Node *n, int flags) {
String *sname = Swig_name_set(name);
String *mangled = Swig_name_mangle(sname);
String *call = Swig_cfunction_call(mangled, parms);
String *cres = NewStringf("%s;\n", call);
String *cres = NewStringf("%s;", call);
Setattr(n, "wrap:action", cres);
Delete(cres);
Delete(call);
@ -1401,14 +1401,14 @@ int Swig_VarsetToFunction(Node *n, int flags) {
if (!Strstr(type, "enum $unnamed")) {
String *pname = Swig_cparm_name(0, 0);
String *dref = Swig_wrapped_var_deref(type, pname, varcref);
String *call = NewStringf("%s = %s;\n", nname, dref);
String *call = NewStringf("%s = %s;", nname, dref);
Setattr(n, "wrap:action", call);
Delete(call);
Delete(dref);
Delete(pname);
} else {
String *pname = Swig_cparm_name(0, 0);
String *call = NewStringf("if (sizeof(int) == sizeof(%s)) *(int*)(void*)&(%s) = %s;\n", nname, nname, pname);
String *call = NewStringf("if (sizeof(int) == sizeof(%s)) *(int*)(void*)&(%s) = %s;", nname, nname, pname);
Setattr(n, "wrap:action", call);
Delete(pname);
Delete(call);