diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index d80b7d970..437b3c329 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -1591,7 +1591,7 @@ constant_directive : CONSTANT ID EQUAL definetype SEMI { Setattr($$,"value",$4.val); if ($4.rawval) Setattr($$,"rawval", $4.rawval); Setattr($$,"storage","%constant"); - Setattr($$,"feature:immutable","1"); + SetFlag($$,"feature:immutable"); add_symbols($$); } else { if ($4.type == T_ERROR) { @@ -1615,7 +1615,7 @@ constant_directive : CONSTANT ID EQUAL definetype SEMI { Setattr($$,"value",$4.val); if ($4.rawval) Setattr($$,"rawval", $4.rawval); Setattr($$,"storage","%constant"); - Setattr($$,"feature:immutable","1"); + SetFlag($$,"feature:immutable"); add_symbols($$); } else { if ($4.type == T_ERROR) { @@ -4927,7 +4927,7 @@ edecl : ID { $$ = new_node("enumitem"); Setattr($$,"name",$1); Setattr($$,"type",NewSwigType(T_INT)); - Setattr($$,"feature:immutable","1"); + SetFlag($$,"feature:immutable"); } | ID EQUAL etype { $$ = new_node("enumitem"); @@ -4940,7 +4940,7 @@ edecl : ID { Setattr($$,"value",$1); Setattr($$,"type",NewSwigType(T_INT)); } - Setattr($$,"feature:immutable","1"); + SetFlag($$,"feature:immutable"); } | empty { $$ = 0; } ; diff --git a/Source/Modules/chicken.cxx b/Source/Modules/chicken.cxx index dc62905f1..98a67242e 100644 --- a/Source/Modules/chicken.cxx +++ b/Source/Modules/chicken.cxx @@ -771,7 +771,7 @@ CHICKEN::variableWrapper(Node *n) { Printf(f->code, "if (argc!=2 && argc!=3) C_bad_argc(argc,2);\n"); /* Check for a setting of the variable value */ - if (!Getattr(n,"feature:immutable")) { + if (!GetFlag(n,"feature:immutable")) { Printf(f->code, "if (argc > 2) {\n"); if ((tm = Swig_typemap_lookup_new("varin",n,name,0))) { Replaceall(tm,"$source","value"); @@ -1232,7 +1232,7 @@ CHICKEN::membervariableHandler(Node *n) Printv(clos_class_defines," (list '", proc, " ':swig-virtual ':swig-get ", chickenPrimitiveName(getfunc), NIL); - if (!Getattr(n,"feature:immutable")) { + if (!GetFlag(n,"feature:immutable")) { if (class_node) { Printv(clos_class_defines, " ':swig-set (lambda (x y) (", chickenPrimitiveName(setfunc), " x (slot-ref y 'swig-this))))\n", NIL); } else { diff --git a/Source/Modules/guile.cxx b/Source/Modules/guile.cxx index 83f1a9feb..570125041 100644 --- a/Source/Modules/guile.cxx +++ b/Source/Modules/guile.cxx @@ -1254,7 +1254,7 @@ public: Wrapper_add_local (f, "gswig_result", "SCM gswig_result"); - if (!Getattr(n,"feature:immutable")) { + if (!GetFlag(n,"feature:immutable")) { /* Check for a setting of the variable value */ Printf (f->code, "if (s_0 != SCM_UNDEFINED) {\n"); if ((tm = Swig_typemap_lookup_new("varin",n,name,0))) { @@ -1290,16 +1290,16 @@ public: // Now add symbol to the Guile interpreter if (!emit_setters - || Getattr(n,"feature:immutable")) { + || GetFlag(n,"feature:immutable")) { /* Read-only variables become a simple procedure returning the value; read-write variables become a simple procedure with an optional argument. */ if (use_scm_interface) { Printf(f_init, "scm_c_define_gsubr(\"%s\", 0, %d, 0, (swig_guile_proc) %s);\n", - proc_name, Getattr(n, "feature:immutable") ? 0 : 1, var_name); + proc_name, !GetFlag(n, "feature:immutable"), var_name); } else { Printf (f_init, "\t gh_new_procedure(\"%s\", (swig_guile_proc) %s, 0, %d, 0);\n", - proc_name, var_name, Getattr(n,"feature:immutable") ? 0 : 1); + proc_name, var_name, !GetFlag(n,"feature:immutable")); } } else { @@ -1341,7 +1341,7 @@ public: String *signature2 = NULL; String *doc = NewString(""); - if (Getattr(n,"feature:immutable")) { + if (GetFlag(n,"feature:immutable")) { Printv(signature, proc_name, NIL); Printv(doc, "Returns constant ", NIL); if ((tm = Getattr(n,"tmap:varout:doc"))) { @@ -1472,7 +1472,7 @@ public: Setattr(n,"name",var_name); Setattr(n,"sym:name",iname); Setattr(n,"type", nctype); - Setattr(n,"feature:immutable", "1"); + SetFlag(n,"feature:immutable"); variableWrapper(n); Delete(n); } @@ -1651,7 +1651,7 @@ public: Printv(goopscode, "\n #:slot-ref (lambda (obj) (", primRenamer ? "primitive:" : "", short_class_name, "-", proc, "-get", " obj))", NIL); - if (!Getattr(n,"feature:immutable")) { + if (!GetFlag(n,"feature:immutable")) { Printv(goopscode, "\n #:slot-set! (lambda (obj value) (", primRenamer ? "primitive:" : "", short_class_name, "-", proc, "-set", " obj value))", NIL); @@ -1659,7 +1659,7 @@ public: Printf(goopscode, "\n #:slot-set! (lambda (obj value) (error \"Immutable slot\"))"); } if (emit_slot_accessors) { - if (Getattr(n, "feature:immutable")) { + if (GetFlag(n, "feature:immutable")) { Printv(goopscode, "\n #:getter ", goops_name, NIL); } else { Printv(goopscode, "\n #:accessor ", goops_name, NIL); diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx index 10d31548c..d5d702b3b 100644 --- a/Source/Modules/lang.cxx +++ b/Source/Modules/lang.cxx @@ -857,7 +857,7 @@ int Language::cDeclaration(Node *n) { } else { /* Some kind of variable declaration */ Delattr(n,"decl"); - if (Getattr(n,"nested")) Setattr(n,"feature:immutable","1"); + if (Getattr(n,"nested")) SetFlag(n,"feature:immutable"); if (!CurrentClass) { if ((Cmp(storage,"extern") == 0) || ForceExtern) { f_header = Swig_filebyname("header"); @@ -871,13 +871,13 @@ int Language::cDeclaration(Node *n) { } } if (!SwigType_ismutable(ty)) { - Setattr(n,"feature:immutable","1"); + SetFlag(n,"feature:immutable"); } /* If an array and elements are const, then read-only */ if (SwigType_isarray(ty)) { SwigType *tya = SwigType_array_type(ty); if (SwigType_isconst(tya)) { - Setattr(n,"feature:immutable","1"); + SetFlag(n,"feature:immutable"); } Delete(tya); } @@ -1151,7 +1151,7 @@ Language::variableHandler(Node *n) { if (SmartPointer) { /* If a smart-pointer and it's a constant access, we have to set immutable */ if (Getattr(CurrentClass,"allocate:smartpointerconst")) { - Setattr(n,"feature:immutable","1"); + SetFlag(n,"feature:immutable"); } } if ((Cmp(storage,"static") == 0) @@ -1265,7 +1265,7 @@ Language::membervariableHandler(Node *n) { Setattr(n,"sym:name", mrename_set); functionWrapper(n); } else { - Setattr(n,"feature:immutable","1"); + SetFlag(n,"feature:immutable"); } /* Restore parameters */ Setattr(n,"type",type); @@ -1310,7 +1310,7 @@ Language::membervariableHandler(Node *n) { Delete(cname); } Delete(gname); - if (!Getattr(n,"feature:immutable")) { + if (!GetFlag(n,"feature:immutable")) { gname = NewStringf(AttributeFunctionSet,symname); vty = NewString("void"); if (!Extend) { @@ -2913,7 +2913,7 @@ void Language::setOverloadResolutionTemplates(String *argc, String *argv) { int Language::is_assignable(Node *n) { - if (Getattr(n,"feature:immutable")) return 0; + if (GetFlag(n,"feature:immutable")) return 0; SwigType *type = Getattr(n,"type"); Node *cn = 0; SwigType *ftd = SwigType_typedef_resolve_all(type); @@ -2922,7 +2922,7 @@ int Language::is_assignable(Node *n) if ((cn = Swig_symbol_clookup(td,0))) { if ((Strcmp(nodeType(cn),"class") == 0)) { if (Getattr(cn,"allocate:noassign")) { - Setattr(n,"feature:immutable","1"); + SetFlag(n,"feature:immutable"); Delete(ftd); Delete(td); return 0; diff --git a/Source/Modules/lua.cxx b/Source/Modules/lua.cxx index 3e67f8050..79ad6655e 100644 --- a/Source/Modules/lua.cxx +++ b/Source/Modules/lua.cxx @@ -664,7 +664,7 @@ NEW LANGUAGE NOTE:END ************************************************/ // Swig_warning(WARN_TYPEMAP_IN_UNDEF, input_file, line_number, // "variableWrapper %s : %s : %s \n",iname,Swig_name_set(iname),Swig_name_get(iname)); int result=Language::variableWrapper(n); - if (!Getattr(n,"feature:immutable")) { + if (!GetFlag(n,"feature:immutable")) { Printv(s_var_tab, tab4, "{ \"", iname, "\", ", Swig_name_wrapper(Swig_name_get(iname)), ", ", Swig_name_wrapper(Swig_name_set(iname)),"},\n", NIL); } @@ -971,7 +971,7 @@ NEW LANGUAGE NOTE:END ************************************************/ rname = Swig_name_wrapper(Swig_name_get(Swig_name_member(class_name,symname))); Printv(s_attr_tab, rname, ", ", NIL); Delete(rname); - if (!Getattr(n,"feature:immutable")) { + if (!GetFlag(n,"feature:immutable")) { rname = Swig_name_wrapper(Swig_name_set(Swig_name_member(class_name,symname))); Printv(s_attr_tab, rname, "},\n",NIL); Delete(rname); diff --git a/Source/Modules/mzscheme.cxx b/Source/Modules/mzscheme.cxx index 738ea7c36..1685354bd 100644 --- a/Source/Modules/mzscheme.cxx +++ b/Source/Modules/mzscheme.cxx @@ -499,7 +499,7 @@ public: Wrapper_add_local (f, "swig_result", "Scheme_Object *swig_result"); - if (!Getattr(n,"feature:immutable")) { + if (!GetFlag(n,"feature:immutable")) { /* Check for a setting of the variable value */ Printf (f->code, "if (argc) {\n"); if ((tm = Swig_typemap_lookup_new("varin",n,name,0))) { diff --git a/Source/Modules/ocaml.cxx b/Source/Modules/ocaml.cxx index a5be7f582..a02abe604 100755 --- a/Source/Modules/ocaml.cxx +++ b/Source/Modules/ocaml.cxx @@ -521,7 +521,7 @@ public: if( strstr( Char(mangled_name), "__get__" ) ) { String *set_name = Copy(mangled_name); - if( !Getattr(n,"feature:immutable") ) { + if( !GetFlag(n,"feature:immutable") ) { Replaceall(set_name,"__get__","__set__"); Printf(f_class_ctors, " \"%s\", (fun args -> " @@ -879,7 +879,7 @@ public: Wrapper_add_local (f, "swig_result", "CAML_VALUE swig_result"); - if (!Getattr(n,"feature:immutable")) { + if (!GetFlag(n,"feature:immutable")) { /* Check for a setting of the variable value */ Printf (f->code, "if (args != Val_int(0)) {\n"); if ((tm = Swig_typemap_lookup_new("varin",n,name,0))) { @@ -923,7 +923,7 @@ public: // Now add symbol to the Ocaml interpreter - if( Getattr( n, "feature:immutable" ) ) { + if( GetFlag( n, "feature:immutable" ) ) { Printf( f_mlbody, "external _%s : c_obj -> Swig.c_obj = \"%s\" \n", mname, var_name ); @@ -1015,7 +1015,7 @@ public: Printf (f_header, "%s;\n", value); } - Setattr(n,"feature:immutable","1"); + SetFlag(n,"feature:immutable"); variableWrapper(n); return SWIG_OK; } @@ -1358,7 +1358,7 @@ public: if( const_enum && name && !Getattr(seen_enumvalues,name) ) { Setattr(seen_enumvalues,name,"true"); - Setattr(n,"feature:immutable","1"); + SetFlag(n,"feature:immutable"); Setattr(n,"feature:enumvalue","1"); if( qvalue ) diff --git a/Source/Modules/perl5.cxx b/Source/Modules/perl5.cxx index 10006ffdd..3bc09084a 100644 --- a/Source/Modules/perl5.cxx +++ b/Source/Modules/perl5.cxx @@ -784,7 +784,7 @@ public: /* Create a Perl function for setting the variable value */ - if (!Getattr(n,"feature:immutable")) { + if (!GetFlag(n,"feature:immutable")) { Printf(setf->def,"SWIGCLASS_STATIC int %s(pTHX_ SV* sv, MAGIC *mg) {\n", set_name); Printv(setf->code, tab4, "MAGIC_PPERL\n", @@ -850,7 +850,7 @@ public: tt = (String *) "0"; } /* Now add symbol to the PERL interpreter */ - if (Getattr(n,"feature:immutable")) { + if (GetFlag(n,"feature:immutable")) { Printv(variable_tab, tab4, "{ \"", cmodule, "::", iname, "\", MAGIC_CLASS swig_magic_readonly, MAGIC_CLASS ", val_name,",", tt, " },\n",NIL); } else { diff --git a/Source/Modules/php4.cxx b/Source/Modules/php4.cxx index 989f046f2..a214e57cf 100644 --- a/Source/Modules/php4.cxx +++ b/Source/Modules/php4.cxx @@ -1281,7 +1281,7 @@ public: */ /* Now generate C -> PHP sync blocks */ /* - if(!Getattr(n,"feature:immutable")) { + if(!GetFlag(n,"feature:immutable")) { tm = Swig_typemap_lookup_new("varout", n, name, 0); if(tm) { diff --git a/Source/Modules/pike.cxx b/Source/Modules/pike.cxx index 9e940af8e..a47360b9a 100644 --- a/Source/Modules/pike.cxx +++ b/Source/Modules/pike.cxx @@ -728,7 +728,7 @@ public: need_setter = false; i = First(membervariables); while (i.item) { - if (!Getattr(i.item, "feature:immutable")) { + if (!GetFlag(i.item, "feature:immutable")) { need_setter = true; break; } @@ -745,7 +745,7 @@ public: i = First(membervariables); while (i.item) { - if (!Getattr(i.item, "feature:immutable")) { + if (!GetFlag(i.item, "feature:immutable")) { name = Getattr(i.item, "name"); funcname = Swig_name_wrapper(Swig_name_set(Swig_name_member(getClassPrefix(), name))); Printf(wrapper->code, "if (!strcmp(name, \"%s\")) {\n", name); diff --git a/Source/Modules/ruby.cxx b/Source/Modules/ruby.cxx index e6e83b4d1..687052569 100644 --- a/Source/Modules/ruby.cxx +++ b/Source/Modules/ruby.cxx @@ -1456,7 +1456,7 @@ public: Printv(getf->code, tab4, "return _val;\n}\n", NIL); Wrapper_print(getf,f_wrappers); - if (Getattr(n,"feature:immutable")) { + if (GetFlag(n,"feature:immutable")) { setfname = NewString("NULL"); } else { /* create setter */ @@ -1495,7 +1495,7 @@ public: tab4, "rb_define_singleton_method(", klass->vname, ", \"", klass->strip(iname), "\", ", getfname, ", 0);\n", NIL); - if (!Getattr(n,"feature:immutable")) { + if (!GetFlag(n,"feature:immutable")) { Printv(s, tab4, "rb_define_singleton_method(", klass->vname, ", \"", klass->strip(iname), "=\", ", setfname, ", 1);\n", @@ -1512,7 +1512,7 @@ public: tab4, "rb_define_singleton_method(", modvar, ", \"", iname, "\", ", getfname, ", 0);\n", NIL); - if (!Getattr(n,"feature:immutable")) { + if (!GetFlag(n,"feature:immutable")) { Printv(s, tab4, "rb_define_singleton_method(", modvar, ", \"", iname, "=\", ", setfname, ", 1);\n", @@ -1523,7 +1523,7 @@ public: tab4, "rb_define_global_method(\"", iname, "\", ", getfname, ", 0);\n", NIL); - if (!Getattr(n,"feature:immutable")) { + if (!GetFlag(n,"feature:immutable")) { Printv(s, tab4, "rb_define_global_method(\"", iname, "=\", ", setfname, ", 1);\n", diff --git a/Source/Modules/tcl8.cxx b/Source/Modules/tcl8.cxx index f3c5488ed..6045d7a53 100644 --- a/Source/Modules/tcl8.cxx +++ b/Source/Modules/tcl8.cxx @@ -565,7 +565,7 @@ public: DelWrapper(getf); /* Try to create a function setting a variable */ - if (!Getattr(n,"feature:immutable")) { + if (!GetFlag(n,"feature:immutable")) { setf = NewWrapper(); setname = Swig_name_wrapper(Swig_name_set(iname)); Printv(setf->def,"static char *",setname, "(ClientData clientData, Tcl_Interp *interp, char *name1, char *name2, int flags) {",NIL); @@ -593,7 +593,7 @@ public: } Printv(var_tab, tab4,"{ SWIG_prefix \"", iname, "\", 0, (swig_variable_func) ", getname, ",", NIL); - if (readonly || Getattr(n,"feature:immutable")) { + if (readonly || GetFlag(n,"feature:immutable")) { static int readonlywrap = 0; if (!readonlywrap) { Wrapper *ro = NewWrapper(); @@ -1038,7 +1038,7 @@ public: rname = Swig_name_wrapper(Swig_name_get(Swig_name_member(class_name,symname))); Printv(attr_tab, rname, ", ", NIL); Delete(rname); - if (!Getattr(n,"feature:immutable")) { + if (!GetFlag(n,"feature:immutable")) { rname = Swig_name_wrapper(Swig_name_set(Swig_name_member(class_name,symname))); Printv(attr_tab, rname, "},\n",NIL); Delete(rname);