Merge branch 'master' into doxygen
Merge 3.0.12 release changes from master.
This commit is contained in:
commit
294ab27b90
254 changed files with 4158 additions and 2457 deletions
|
|
@ -57,6 +57,7 @@ static Node *currentOuterClass = 0; /* for nested classes */
|
|||
static const char *last_cpptype = 0;
|
||||
static int inherit_list = 0;
|
||||
static Parm *template_parameters = 0;
|
||||
static int parsing_template_declaration = 0;
|
||||
static int extendmode = 0;
|
||||
static int compact_default_args = 0;
|
||||
static int template_reduce = 0;
|
||||
|
|
@ -310,6 +311,7 @@ static String *add_oldname = 0;
|
|||
|
||||
|
||||
static String *make_name(Node *n, String *name,SwigType *decl) {
|
||||
String *made_name = 0;
|
||||
int destructor = name && (*(Char(name)) == '~');
|
||||
|
||||
if (yyrename) {
|
||||
|
|
@ -323,7 +325,13 @@ static String *make_name(Node *n, String *name,SwigType *decl) {
|
|||
}
|
||||
|
||||
if (!name) return 0;
|
||||
return Swig_name_make(n,Namespaceprefix,name,decl,add_oldname);
|
||||
|
||||
if (parsing_template_declaration)
|
||||
SetFlag(n, "parsing_template_declaration");
|
||||
made_name = Swig_name_make(n, Namespaceprefix, name, decl, add_oldname);
|
||||
Delattr(n, "parsing_template_declaration");
|
||||
|
||||
return made_name;
|
||||
}
|
||||
|
||||
/* Generate an unnamed identifier */
|
||||
|
|
@ -412,7 +420,8 @@ static void add_symbols(Node *n) {
|
|||
}
|
||||
|
||||
if (extendmode) {
|
||||
Setattr(n,"isextendmember","1");
|
||||
if (!Getattr(n, "template"))
|
||||
SetFlag(n,"isextendmember");
|
||||
}
|
||||
|
||||
if (!isfriend && inclass) {
|
||||
|
|
@ -488,7 +497,10 @@ static void add_symbols(Node *n) {
|
|||
symname = Copy(Getattr(n,"unnamed"));
|
||||
}
|
||||
if (symname) {
|
||||
if (parsing_template_declaration)
|
||||
SetFlag(n, "parsing_template_declaration");
|
||||
wrn = Swig_name_warning(n, Namespaceprefix, symname,0);
|
||||
Delattr(n, "parsing_template_declaration");
|
||||
}
|
||||
} else {
|
||||
String *name = Getattr(n,"name");
|
||||
|
|
@ -501,7 +513,10 @@ static void add_symbols(Node *n) {
|
|||
Swig_features_get(Swig_cparse_features(),Namespaceprefix,name,fun,n);
|
||||
|
||||
symname = make_name(n, name,fun);
|
||||
if (parsing_template_declaration)
|
||||
SetFlag(n, "parsing_template_declaration");
|
||||
wrn = Swig_name_warning(n, Namespaceprefix,symname,fun);
|
||||
Delattr(n, "parsing_template_declaration");
|
||||
|
||||
Delete(fdecl);
|
||||
Delete(fun);
|
||||
|
|
@ -1513,7 +1528,7 @@ static void mark_nodes_as_extend(Node *n) {
|
|||
%type <p> parm_no_dox parm valparm rawvalparms valparms valptail ;
|
||||
%type <p> typemap_parm tm_list tm_tail ;
|
||||
%type <p> templateparameter ;
|
||||
%type <id> templcpptype cpptype access_specifier;
|
||||
%type <id> templcpptype cpptype classkey classkeyopt access_specifier;
|
||||
%type <node> base_specifier;
|
||||
%type <str> ellipsis variadic;
|
||||
%type <type> type rawtype type_right anon_bitfield_type decltype ;
|
||||
|
|
@ -1678,14 +1693,14 @@ swig_directive : extend_directive { $$ = $1; }
|
|||
%extend classname { ... }
|
||||
------------------------------------------------------------ */
|
||||
|
||||
extend_directive : EXTEND options idcolon LBRACE {
|
||||
extend_directive : EXTEND options classkeyopt idcolon LBRACE {
|
||||
Node *cls;
|
||||
String *clsname;
|
||||
extendmode = 1;
|
||||
cplus_mode = CPLUS_PUBLIC;
|
||||
if (!classes) classes = NewHash();
|
||||
if (!classes_typedefs) classes_typedefs = NewHash();
|
||||
clsname = make_class_name($3);
|
||||
clsname = make_class_name($4);
|
||||
cls = Getattr(classes,clsname);
|
||||
if (!cls) {
|
||||
cls = Getattr(classes_typedefs, clsname);
|
||||
|
|
@ -1694,7 +1709,7 @@ extend_directive : EXTEND options idcolon LBRACE {
|
|||
Node *am = Getattr(Swig_extend_hash(),clsname);
|
||||
if (!am) {
|
||||
Swig_symbol_newscope();
|
||||
Swig_symbol_setscopename($3);
|
||||
Swig_symbol_setscopename($4);
|
||||
prev_symtab = 0;
|
||||
} else {
|
||||
prev_symtab = Swig_symbol_setscope(Getattr(am,"symtab"));
|
||||
|
|
@ -1707,7 +1722,7 @@ extend_directive : EXTEND options idcolon LBRACE {
|
|||
prev_symtab = Swig_symbol_setscope(Getattr(cls, "symtab"));
|
||||
current_class = cls;
|
||||
SWIG_WARN_NODE_BEGIN(cls);
|
||||
Swig_warning(WARN_PARSE_EXTEND_NAME, cparse_file, cparse_line, "Deprecated %%extend name used - the %s name '%s' should be used instead of the typedef name '%s'.\n", Getattr(cls, "kind"), SwigType_namestr(Getattr(cls, "name")), $3);
|
||||
Swig_warning(WARN_PARSE_EXTEND_NAME, cparse_file, cparse_line, "Deprecated %%extend name used - the %s name '%s' should be used instead of the typedef name '%s'.\n", Getattr(cls, "kind"), SwigType_namestr(Getattr(cls, "name")), $4);
|
||||
SWIG_WARN_NODE_END(cls);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -1715,7 +1730,7 @@ extend_directive : EXTEND options idcolon LBRACE {
|
|||
prev_symtab = Swig_symbol_setscope(Getattr(cls,"symtab"));
|
||||
current_class = cls;
|
||||
}
|
||||
Classprefix = NewString($3);
|
||||
Classprefix = NewString($4);
|
||||
Namespaceprefix= Swig_symbol_qualifiedscopename(0);
|
||||
Delete(clsname);
|
||||
} cpp_members RBRACE {
|
||||
|
|
@ -1727,22 +1742,22 @@ extend_directive : EXTEND options idcolon LBRACE {
|
|||
Swig_symbol_setscope(prev_symtab);
|
||||
}
|
||||
Namespaceprefix = Swig_symbol_qualifiedscopename(0);
|
||||
clsname = make_class_name($3);
|
||||
clsname = make_class_name($4);
|
||||
Setattr($$,"name",clsname);
|
||||
|
||||
mark_nodes_as_extend($6);
|
||||
mark_nodes_as_extend($7);
|
||||
if (current_class) {
|
||||
/* We add the extension to the previously defined class */
|
||||
appendChild($$,$6);
|
||||
appendChild($$, $7);
|
||||
appendChild(current_class,$$);
|
||||
} else {
|
||||
/* We store the extensions in the extensions hash */
|
||||
Node *am = Getattr(Swig_extend_hash(),clsname);
|
||||
if (am) {
|
||||
/* Append the members to the previous extend methods */
|
||||
appendChild(am,$6);
|
||||
appendChild(am, $7);
|
||||
} else {
|
||||
appendChild($$,$6);
|
||||
appendChild($$, $7);
|
||||
Setattr(Swig_extend_hash(),clsname,$$);
|
||||
}
|
||||
}
|
||||
|
|
@ -3915,9 +3930,10 @@ cpp_forward_class_decl : storage_class cpptype idcolon SEMI {
|
|||
------------------------------------------------------------ */
|
||||
|
||||
cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN {
|
||||
if (currentOuterClass)
|
||||
Setattr(currentOuterClass, "template_parameters", template_parameters);
|
||||
if (currentOuterClass)
|
||||
Setattr(currentOuterClass, "template_parameters", template_parameters);
|
||||
template_parameters = $3;
|
||||
parsing_template_declaration = 1;
|
||||
} cpp_temp_possible {
|
||||
String *tname = 0;
|
||||
int error = 0;
|
||||
|
|
@ -4170,6 +4186,7 @@ cpp_template_decl : TEMPLATE LESSTHAN template_parms GREATERTHAN {
|
|||
template_parameters = Getattr(currentOuterClass, "template_parameters");
|
||||
else
|
||||
template_parameters = 0;
|
||||
parsing_template_declaration = 0;
|
||||
}
|
||||
|
||||
/* Explicit template instantiation */
|
||||
|
|
@ -6437,7 +6454,6 @@ access_specifier : PUBLIC { $$ = (char*)"public"; }
|
|||
| PROTECTED { $$ = (char*)"protected"; }
|
||||
;
|
||||
|
||||
|
||||
templcpptype : CLASS {
|
||||
$$ = (char*)"class";
|
||||
if (!inherit_list) last_cpptype = $$;
|
||||
|
|
@ -6469,6 +6485,28 @@ cpptype : templcpptype {
|
|||
}
|
||||
;
|
||||
|
||||
classkey : CLASS {
|
||||
$$ = (char*)"class";
|
||||
if (!inherit_list) last_cpptype = $$;
|
||||
}
|
||||
| STRUCT {
|
||||
$$ = (char*)"struct";
|
||||
if (!inherit_list) last_cpptype = $$;
|
||||
}
|
||||
| UNION {
|
||||
$$ = (char*)"union";
|
||||
if (!inherit_list) last_cpptype = $$;
|
||||
}
|
||||
;
|
||||
|
||||
classkeyopt : classkey {
|
||||
$$ = $1;
|
||||
}
|
||||
| empty {
|
||||
$$ = 0;
|
||||
}
|
||||
;
|
||||
|
||||
opt_virtual : VIRTUAL
|
||||
| empty
|
||||
;
|
||||
|
|
|
|||
|
|
@ -197,15 +197,17 @@ class Allocate:public Dispatcher {
|
|||
// Found a polymorphic method.
|
||||
// Mark the polymorphic method, in case the virtual keyword was not used.
|
||||
Setattr(n, "storage", "virtual");
|
||||
|
||||
if (both_have_public_access || both_have_protected_access) {
|
||||
if (!is_non_public_base(inclass, b))
|
||||
Setattr(n, "override", base); // Note C# definition of override, ie access must be the same
|
||||
} else if (!both_have_private_access) {
|
||||
// Different access
|
||||
if (this_wrapping_protected_members || base_wrapping_protected_members)
|
||||
if (!Getattr(b, "feature:interface")) { // interface implementation neither hides nor overrides
|
||||
if (both_have_public_access || both_have_protected_access) {
|
||||
if (!is_non_public_base(inclass, b))
|
||||
Setattr(n, "hides", base); // Note C# definition of hiding, ie hidden if access is different
|
||||
Setattr(n, "override", base); // Note C# definition of override, ie access must be the same
|
||||
}
|
||||
else if (!both_have_private_access) {
|
||||
// Different access
|
||||
if (this_wrapping_protected_members || base_wrapping_protected_members)
|
||||
if (!is_non_public_base(inclass, b))
|
||||
Setattr(n, "hides", base); // Note C# definition of hiding, ie hidden if access is different
|
||||
}
|
||||
}
|
||||
// Try and find the most base's covariant return type
|
||||
SwigType *most_base_covariant_type = Getattr(base, "covariant");
|
||||
|
|
|
|||
|
|
@ -683,7 +683,7 @@ public:
|
|||
String *filen = NewStringf("%s%s.cs", dir, name);
|
||||
File *f = NewFile(filen, "w", SWIG_output_files());
|
||||
if (!f) {
|
||||
FileErrorDisplay(f);
|
||||
FileErrorDisplay(filen);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
Append(filenames_list, Copy(filen));
|
||||
|
|
@ -1584,11 +1584,23 @@ public:
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
virtual int insertDirective(Node *n) {
|
||||
int ret = SWIG_OK;
|
||||
String *code = Getattr(n, "code");
|
||||
String *section = Getattr(n, "section");
|
||||
Replaceall(code, "$module", module_class_name);
|
||||
Replaceall(code, "$imclassname", imclass_name);
|
||||
Replaceall(code, "$dllimport", dllimport);
|
||||
return Language::insertDirective(n);
|
||||
|
||||
if (!ImportMode && (Cmp(section, "proxycode") == 0)) {
|
||||
if (proxy_class_code) {
|
||||
Swig_typemap_replace_embedded_typemap(code, n);
|
||||
int offset = Len(code) > 0 && *Char(code) == '\n' ? 1 : 0;
|
||||
Printv(proxy_class_code, Char(code) + offset, "\n", NIL);
|
||||
}
|
||||
} else {
|
||||
ret = Language::insertDirective(n);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
@ -2044,34 +2056,6 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* calculateDirectBase()
|
||||
* ---------------------------------------------------------------------- */
|
||||
|
||||
void calculateDirectBase(Node* n) {
|
||||
Node* direct_base = 0;
|
||||
// C++ inheritance
|
||||
Node *attributes = NewHash();
|
||||
SwigType *typemap_lookup_type = Getattr(n, "classtypeobj");
|
||||
const String *pure_baseclass = typemapLookup(n, "csbase", typemap_lookup_type, WARN_NONE, attributes);
|
||||
bool purebase_replace = GetFlag(attributes, "tmap:csbase:replace") ? true : false;
|
||||
bool purebase_notderived = GetFlag(attributes, "tmap:csbase:notderived") ? true : false;
|
||||
Delete(attributes);
|
||||
if (!purebase_replace) {
|
||||
if (List *baselist = Getattr(n, "bases")) {
|
||||
Iterator base = First(baselist);
|
||||
while (base.item && (GetFlag(base.item, "feature:ignore") || Getattr(base.item, "feature:interface")))
|
||||
base = Next(base);
|
||||
direct_base = base.item;
|
||||
}
|
||||
if (!direct_base && purebase_notderived)
|
||||
direct_base = symbolLookup(const_cast<String*>(pure_baseclass));
|
||||
} else {
|
||||
direct_base = symbolLookup(const_cast<String*>(pure_baseclass));
|
||||
}
|
||||
Setattr(n, "direct_base", direct_base);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
* classHandler()
|
||||
* ---------------------------------------------------------------------- */
|
||||
|
|
@ -2157,7 +2141,6 @@ public:
|
|||
emitInterfaceDeclaration(n, interface_name, interface_class_code);
|
||||
Delete(output_directory);
|
||||
}
|
||||
calculateDirectBase(n);
|
||||
}
|
||||
|
||||
Language::classHandler(n);
|
||||
|
|
@ -2426,21 +2409,8 @@ public:
|
|||
Printf(function_code, " %s ", methodmods);
|
||||
if (!is_smart_pointer()) {
|
||||
// Smart pointer classes do not mirror the inheritance hierarchy of the underlying pointer type, so no virtual/override/new required.
|
||||
if (Node *base_ovr = Getattr(n, "override")) {
|
||||
if (GetFlag(n, "isextendmember"))
|
||||
if (Getattr(n, "override"))
|
||||
Printf(function_code, "override ");
|
||||
else {
|
||||
Node* base = parentNode(base_ovr);
|
||||
bool ovr = false;
|
||||
for (Node* direct_base = Getattr(parentNode(n), "direct_base"); direct_base; direct_base = Getattr(direct_base, "direct_base")) {
|
||||
if (direct_base == base) { // "override" only applies if the base was not discarded (e.g. in case of multiple inheritance or via "ignore")
|
||||
ovr = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Printf(function_code, ovr ? "override " : "virtual ");
|
||||
}
|
||||
}
|
||||
else if (checkAttribute(n, "storage", "virtual"))
|
||||
Printf(function_code, "virtual ");
|
||||
if (Getattr(n, "hides"))
|
||||
|
|
@ -3917,8 +3887,12 @@ public:
|
|||
}
|
||||
|
||||
Printf(callback_def, " private %s SwigDirector%s(", tm, overloaded_name);
|
||||
if (!ignored_method)
|
||||
Printf(director_delegate_definitions, " public delegate %s", tm);
|
||||
if (!ignored_method) {
|
||||
const String *csdirectordelegatemodifiers = Getattr(n, "feature:csdirectordelegatemodifiers");
|
||||
String *modifiers = (csdirectordelegatemodifiers ? NewStringf("%s%s", csdirectordelegatemodifiers, Len(csdirectordelegatemodifiers) > 0 ? " " : "") : NewStringf("public "));
|
||||
Printf(director_delegate_definitions, " %sdelegate %s", modifiers, tm);
|
||||
Delete(modifiers);
|
||||
}
|
||||
} else {
|
||||
Swig_warning(WARN_CSHARP_TYPEMAP_CSTYPE_UNDEF, input_file, line_number, "No imtype typemap defined for %s\n", SwigType_str(returntype, 0));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -717,9 +717,20 @@ public:
|
|||
* D::insertDirective()
|
||||
* --------------------------------------------------------------------------- */
|
||||
virtual int insertDirective(Node *n) {
|
||||
int ret = SWIG_OK;
|
||||
String *code = Getattr(n, "code");
|
||||
String *section = Getattr(n, "section");
|
||||
replaceModuleVariables(code);
|
||||
return Language::insertDirective(n);
|
||||
|
||||
if (!ImportMode && (Cmp(section, "proxycode") == 0)) {
|
||||
if (proxy_class_body_code) {
|
||||
Swig_typemap_replace_embedded_typemap(code, n);
|
||||
Printv(proxy_class_body_code, code, NIL);
|
||||
}
|
||||
} else {
|
||||
ret = Language::insertDirective(n);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -1708,10 +1708,22 @@ public:
|
|||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
virtual int insertDirective(Node *n) {
|
||||
int ret = SWIG_OK;
|
||||
String *code = Getattr(n, "code");
|
||||
String *section = Getattr(n, "section");
|
||||
Replaceall(code, "$module", module_class_name);
|
||||
Replaceall(code, "$imclassname", imclass_name);
|
||||
return Language::insertDirective(n);
|
||||
|
||||
if (!ImportMode && (Cmp(section, "proxycode") == 0)) {
|
||||
if (proxy_class_code) {
|
||||
Swig_typemap_replace_embedded_typemap(code, n);
|
||||
int offset = Len(code) > 0 && *Char(code) == '\n' ? 1 : 0;
|
||||
Printv(proxy_class_code, Char(code) + offset, "\n", NIL);
|
||||
}
|
||||
} else {
|
||||
ret = Language::insertDirective(n);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
|
|
@ -4522,7 +4534,7 @@ public:
|
|||
for (p = l; p;) {
|
||||
if ((tm = Getattr(p, "tmap:directorargout"))) {
|
||||
addThrows(n, "tmap:directorargout", p);
|
||||
Replaceall(tm, "$result", "jresult");
|
||||
Replaceall(tm, "$result", makeParameterName(n, p, i, false));
|
||||
Replaceall(tm, "$input", Getattr(p, "emit:directorinput"));
|
||||
Printv(w->code, tm, "\n", NIL);
|
||||
p = Getattr(p, "tmap:directorargout:next");
|
||||
|
|
|
|||
|
|
@ -1148,7 +1148,9 @@ int Language::globalfunctionHandler(Node *n) {
|
|||
Delete(cbname);
|
||||
}
|
||||
Setattr(n, "parms", nonvoid_parms(parms));
|
||||
String *call = Swig_cfunction_call(name, parms);
|
||||
|
||||
String *extendname = Getattr(n, "extendname");
|
||||
String *call = Swig_cfunction_call(extendname ? extendname : name, parms);
|
||||
String *cres = Swig_cresult(type, Swig_cresult_name(), call);
|
||||
Setattr(n, "wrap:action", cres);
|
||||
Delete(cres);
|
||||
|
|
@ -1270,8 +1272,9 @@ int Language::memberfunctionHandler(Node *n) {
|
|||
if (GetFlag(n, "explicitcall"))
|
||||
DirectorExtraCall = CWRAP_DIRECTOR_ONE_CALL;
|
||||
|
||||
Swig_MethodToFunction(n, NSpace, ClassType, Getattr(n, "template") ? SmartPointer : Extend | SmartPointer | DirectorExtraCall, director_type,
|
||||
is_member_director(CurrentClass, n));
|
||||
int extendmember = GetFlag(n, "isextendmember") ? Extend : 0;
|
||||
int flags = Getattr(n, "template") ? extendmember | SmartPointer : Extend | SmartPointer | DirectorExtraCall;
|
||||
Swig_MethodToFunction(n, NSpace, ClassType, flags, director_type, is_member_director(CurrentClass, n));
|
||||
Setattr(n, "sym:name", fname);
|
||||
|
||||
functionWrapper(n);
|
||||
|
|
@ -1324,7 +1327,10 @@ int Language::staticmemberfunctionHandler(Node *n) {
|
|||
|
||||
if (!defaultargs && code) {
|
||||
/* Hmmm. An added static member. We have to create a little wrapper for this */
|
||||
Swig_add_extension_code(n, cname, parms, type, code, CPlusPlus, 0);
|
||||
String *mangled_cname = Swig_name_mangle(cname);
|
||||
Swig_add_extension_code(n, mangled_cname, parms, type, code, CPlusPlus, 0);
|
||||
Setattr(n, "extendname", mangled_cname);
|
||||
Delete(mangled_cname);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2788,7 +2794,9 @@ int Language::constructorHandler(Node *n) {
|
|||
Setattr(n, "handled_as_constructor", "1");
|
||||
}
|
||||
|
||||
Swig_ConstructorToFunction(n, NSpace, ClassType, none_comparison, director_ctor, CPlusPlus, Getattr(n, "template") ? 0 : Extend, DirectorClassName);
|
||||
int extendmember = GetFlag(n, "isextendmember") ? Extend : 0;
|
||||
int flags = Getattr(n, "template") ? extendmember : Extend;
|
||||
Swig_ConstructorToFunction(n, NSpace, ClassType, none_comparison, director_ctor, CPlusPlus, flags, DirectorClassName);
|
||||
Setattr(n, "sym:name", mrename);
|
||||
functionWrapper(n);
|
||||
Delete(mrename);
|
||||
|
|
|
|||
|
|
@ -262,14 +262,14 @@ public:
|
|||
f_runtime = NewStringEmpty();
|
||||
|
||||
/* sections of the output file */
|
||||
s_init = NewString("/* init section */\n");
|
||||
r_init = NewString("/* rinit section */\n");
|
||||
s_shutdown = NewString("/* shutdown section */\n");
|
||||
r_shutdown = NewString("/* rshutdown section */\n");
|
||||
s_init = NewStringEmpty();
|
||||
r_init = NewStringEmpty();
|
||||
s_shutdown = NewStringEmpty();
|
||||
r_shutdown = NewStringEmpty();
|
||||
s_header = NewString("/* header section */\n");
|
||||
s_wrappers = NewString("/* wrapper section */\n");
|
||||
/* subsections of the init section */
|
||||
s_vinit = NewString("/* vinit subsection */\n");
|
||||
s_vinit = NewStringEmpty();
|
||||
s_vdecl = NewString("/* vdecl subsection */\n");
|
||||
s_cinit = NewString("/* cinit subsection */\n");
|
||||
s_oinit = NewString("/* oinit subsection */\n");
|
||||
|
|
@ -362,7 +362,7 @@ public:
|
|||
|
||||
/* Initialize the rest of the module */
|
||||
|
||||
Printf(s_oinit, "ZEND_INIT_MODULE_GLOBALS(%s, %s_init_globals, %s_destroy_globals);\n", module, module, module);
|
||||
Printf(s_oinit, "ZEND_INIT_MODULE_GLOBALS(%s, %s_init_globals, NULL);\n", module, module);
|
||||
|
||||
/* start the header section */
|
||||
Printf(s_header, "ZEND_BEGIN_MODULE_GLOBALS(%s)\n", module);
|
||||
|
|
@ -370,13 +370,8 @@ public:
|
|||
Printf(s_header, "int error_code;\n");
|
||||
Printf(s_header, "ZEND_END_MODULE_GLOBALS(%s)\n", module);
|
||||
Printf(s_header, "ZEND_DECLARE_MODULE_GLOBALS(%s)\n", module);
|
||||
Printf(s_header, "#ifdef ZTS\n");
|
||||
Printf(s_header, "#define SWIG_ErrorMsg() TSRMG(%s_globals_id, zend_%s_globals *, error_msg )\n", module, module);
|
||||
Printf(s_header, "#define SWIG_ErrorCode() TSRMG(%s_globals_id, zend_%s_globals *, error_code )\n", module, module);
|
||||
Printf(s_header, "#else\n");
|
||||
Printf(s_header, "#define SWIG_ErrorMsg() (%s_globals.error_msg)\n", module);
|
||||
Printf(s_header, "#define SWIG_ErrorCode() (%s_globals.error_code)\n", module);
|
||||
Printf(s_header, "#endif\n\n");
|
||||
|
||||
/* The following can't go in Lib/php/phprun.swg as it uses SWIG_ErrorMsg(), etc
|
||||
* which has to be dynamically generated as it depends on the module name.
|
||||
|
|
@ -397,9 +392,6 @@ public:
|
|||
Printf(s_header, " globals->error_code = default_error_code;\n");
|
||||
Printf(s_header, "}\n");
|
||||
|
||||
Printf(s_header, "static void %s_destroy_globals(zend_%s_globals * globals) { (void)globals; }\n", module, module);
|
||||
|
||||
Printf(s_header, "\n");
|
||||
Printf(s_header, "static void SWIG_ResetError(void) {\n");
|
||||
Printf(s_header, " SWIG_ErrorMsg() = default_error_msg;\n");
|
||||
Printf(s_header, " SWIG_ErrorCode() = default_error_code;\n");
|
||||
|
|
@ -474,14 +466,6 @@ public:
|
|||
Printf(f_h, "#else\n");
|
||||
Printf(f_h, "# define PHP_%s_API\n", cap_module);
|
||||
Printf(f_h, "#endif\n\n");
|
||||
Printf(f_h, "#ifdef ZTS\n");
|
||||
Printf(f_h, "#include \"TSRM.h\"\n");
|
||||
Printf(f_h, "#endif\n\n");
|
||||
Printf(f_h, "PHP_MINIT_FUNCTION(%s);\n", module);
|
||||
Printf(f_h, "PHP_MSHUTDOWN_FUNCTION(%s);\n", module);
|
||||
Printf(f_h, "PHP_RINIT_FUNCTION(%s);\n", module);
|
||||
Printf(f_h, "PHP_RSHUTDOWN_FUNCTION(%s);\n", module);
|
||||
Printf(f_h, "PHP_MINFO_FUNCTION(%s);\n\n", module);
|
||||
|
||||
/* start the arginfo section */
|
||||
s_arginfo = NewString("/* arginfo subsection */\n");
|
||||
|
|
@ -497,45 +481,66 @@ public:
|
|||
Printf(s_entry, "/* Every non-class user visible function must have an entry here */\n");
|
||||
Printf(s_entry, "static zend_function_entry %s_functions[] = {\n", module);
|
||||
|
||||
/* start the init section */
|
||||
Append(s_init, "#if ZEND_MODULE_API_NO <= 20090626\n");
|
||||
Append(s_init, "#undef ZEND_MODULE_BUILD_ID\n");
|
||||
Append(s_init, "#define ZEND_MODULE_BUILD_ID (char*)\"API\" ZEND_TOSTR(ZEND_MODULE_API_NO) ZEND_BUILD_TS ZEND_BUILD_DEBUG ZEND_BUILD_SYSTEM ZEND_BUILD_EXTRA\n");
|
||||
Append(s_init, "#endif\n");
|
||||
Printv(s_init, "zend_module_entry ", module, "_module_entry = {\n", NIL);
|
||||
Printf(s_init, " STANDARD_MODULE_HEADER,\n");
|
||||
Printf(s_init, " \"%s\",\n", module);
|
||||
Printf(s_init, " %s_functions,\n", module);
|
||||
Printf(s_init, " PHP_MINIT(%s),\n", module);
|
||||
Printf(s_init, " PHP_MSHUTDOWN(%s),\n", module);
|
||||
Printf(s_init, " PHP_RINIT(%s),\n", module);
|
||||
Printf(s_init, " PHP_RSHUTDOWN(%s),\n", module);
|
||||
Printf(s_init, " PHP_MINFO(%s),\n", module);
|
||||
Printf(s_init, " NO_VERSION_YET,\n");
|
||||
Printf(s_init, " STANDARD_MODULE_PROPERTIES\n");
|
||||
Printf(s_init, "};\n");
|
||||
Printf(s_init, "zend_module_entry* SWIG_module_entry = &%s_module_entry;\n\n", module);
|
||||
/* Emit all of the code */
|
||||
Language::top(n);
|
||||
|
||||
Printf(s_init, "#ifdef __cplusplus\n");
|
||||
Printf(s_init, "extern \"C\" {\n");
|
||||
Printf(s_init, "#endif\n");
|
||||
// We want to write "SWIGEXPORT ZEND_GET_MODULE(%s)" but ZEND_GET_MODULE
|
||||
// in PHP5 has "extern "C" { ... }" around it so we can't do that.
|
||||
Printf(s_init, "SWIGEXPORT zend_module_entry *get_module(void) { return &%s_module_entry; }\n", module);
|
||||
Printf(s_init, "#ifdef __cplusplus\n");
|
||||
Printf(s_init, "}\n");
|
||||
Printf(s_init, "#endif\n\n");
|
||||
SwigPHP_emit_resource_registrations();
|
||||
|
||||
/* start the init section */
|
||||
{
|
||||
String * s_init_old = s_init;
|
||||
s_init = NewString("/* init section */\n");
|
||||
Printv(s_init, "zend_module_entry ", module, "_module_entry = {\n", NIL);
|
||||
Printf(s_init, " STANDARD_MODULE_HEADER,\n");
|
||||
Printf(s_init, " \"%s\",\n", module);
|
||||
Printf(s_init, " %s_functions,\n", module);
|
||||
Printf(s_init, " PHP_MINIT(%s),\n", module);
|
||||
if (Len(s_shutdown) > 0) {
|
||||
Printf(s_init, " PHP_MSHUTDOWN(%s),\n", module);
|
||||
} else {
|
||||
Printf(s_init, " NULL, /* No MSHUTDOWN code */\n");
|
||||
}
|
||||
if (Len(r_init) > 0 || Len(s_vinit) > 0) {
|
||||
Printf(s_init, " PHP_RINIT(%s),\n", module);
|
||||
} else {
|
||||
Printf(s_init, " NULL, /* No RINIT code */\n");
|
||||
}
|
||||
if (Len(r_shutdown) > 0) {
|
||||
Printf(s_init, " PHP_RSHUTDOWN(%s),\n", module);
|
||||
} else {
|
||||
Printf(s_init, " NULL, /* No RSHUTDOWN code */\n");
|
||||
}
|
||||
if (Len(pragma_phpinfo) > 0) {
|
||||
Printf(s_init, " PHP_MINFO(%s),\n", module);
|
||||
} else {
|
||||
Printf(s_init, " NULL, /* No MINFO code */\n");
|
||||
}
|
||||
Printf(s_init, " NO_VERSION_YET,\n");
|
||||
Printf(s_init, " STANDARD_MODULE_PROPERTIES\n");
|
||||
Printf(s_init, "};\n");
|
||||
Printf(s_init, "zend_module_entry* SWIG_module_entry = &%s_module_entry;\n\n", module);
|
||||
|
||||
Printf(s_init, "#ifdef __cplusplus\n");
|
||||
Printf(s_init, "extern \"C\" {\n");
|
||||
Printf(s_init, "#endif\n");
|
||||
// We want to write "SWIGEXPORT ZEND_GET_MODULE(%s)" but ZEND_GET_MODULE
|
||||
// in PHP5 has "extern "C" { ... }" around it so we can't do that.
|
||||
Printf(s_init, "SWIGEXPORT zend_module_entry *get_module(void) { return &%s_module_entry; }\n", module);
|
||||
Printf(s_init, "#ifdef __cplusplus\n");
|
||||
Printf(s_init, "}\n");
|
||||
Printf(s_init, "#endif\n\n");
|
||||
|
||||
Printf(s_init, "#define SWIG_php_minit PHP_MINIT_FUNCTION(%s)\n\n", module);
|
||||
|
||||
Printv(s_init, s_init_old, NIL);
|
||||
Delete(s_init_old);
|
||||
}
|
||||
|
||||
/* We have to register the constants before they are (possibly) used
|
||||
* by the pointer typemaps. This all needs re-arranging really as
|
||||
* things are being called in the wrong order
|
||||
*/
|
||||
Printf(s_init, "#define SWIG_php_minit PHP_MINIT_FUNCTION(%s)\n", module);
|
||||
|
||||
/* Emit all of the code */
|
||||
Language::top(n);
|
||||
|
||||
SwigPHP_emit_resource_registrations();
|
||||
// Printv(s_init,s_resourcetypes,NIL);
|
||||
/* We need this after all classes written out by ::top */
|
||||
Printf(s_oinit, "CG(active_class_entry) = NULL;\n");
|
||||
|
|
@ -552,38 +557,66 @@ public:
|
|||
Printf(s_init, "}\n\n");
|
||||
|
||||
// Now do REQUEST init which holds any user specified %rinit, and also vinit
|
||||
Printf(s_init, "PHP_RINIT_FUNCTION(%s)\n{\n", module);
|
||||
Printf(s_init, "%s\n", r_init);
|
||||
if (Len(r_init) > 0 || Len(s_vinit) > 0) {
|
||||
Printf(f_h, "PHP_RINIT_FUNCTION(%s);\n", module);
|
||||
|
||||
/* finish our init section which will have been used by class wrappers */
|
||||
Printf(s_vinit, "/* end vinit subsection */\n");
|
||||
Printf(s_init, "%s\n", s_vinit);
|
||||
Clear(s_vinit);
|
||||
Delete(s_vinit);
|
||||
Printf(s_init, "PHP_RINIT_FUNCTION(%s)\n{\n", module);
|
||||
if (Len(r_init) > 0) {
|
||||
Printv(s_init,
|
||||
"/* rinit section */\n",
|
||||
r_init, "\n",
|
||||
NIL);
|
||||
}
|
||||
|
||||
Printf(s_init, " return SUCCESS;\n");
|
||||
Printf(s_init, "}\n\n");
|
||||
if (Len(s_vinit) > 0) {
|
||||
/* finish our init section which will have been used by class wrappers */
|
||||
Printv(s_init,
|
||||
"/* vinit subsection */\n",
|
||||
s_vinit, "\n"
|
||||
"/* end vinit subsection */\n",
|
||||
NIL);
|
||||
Clear(s_vinit);
|
||||
}
|
||||
Delete(s_vinit);
|
||||
|
||||
Printv(s_init, "PHP_MSHUTDOWN_FUNCTION(", module, ")\n"
|
||||
"{\n",
|
||||
s_shutdown,
|
||||
"#ifdef ZTS\n"
|
||||
" ts_free_id(", module, "_globals_id);\n"
|
||||
"#endif\n"
|
||||
" return SUCCESS;\n"
|
||||
"}\n\n", NIL);
|
||||
Printf(s_init, " return SUCCESS;\n");
|
||||
Printf(s_init, "}\n\n");
|
||||
}
|
||||
|
||||
Printf(s_init, "PHP_RSHUTDOWN_FUNCTION(%s)\n{\n", module);
|
||||
Printf(s_init, "%s\n", r_shutdown);
|
||||
Printf(s_init, " return SUCCESS;\n");
|
||||
Printf(s_init, "}\n\n");
|
||||
Printf(f_h, "PHP_MINIT_FUNCTION(%s);\n", module);
|
||||
|
||||
if (Len(s_shutdown) > 0) {
|
||||
Printf(f_h, "PHP_MSHUTDOWN_FUNCTION(%s);\n", module);
|
||||
|
||||
Printv(s_init, "PHP_MSHUTDOWN_FUNCTION(", module, ")\n"
|
||||
"/* shutdown section */\n"
|
||||
"{\n",
|
||||
s_shutdown,
|
||||
" return SUCCESS;\n"
|
||||
"}\n\n", NIL);
|
||||
}
|
||||
|
||||
if (Len(r_shutdown) > 0) {
|
||||
Printf(f_h, "PHP_RSHUTDOWN_FUNCTION(%s);\n", module);
|
||||
|
||||
Printf(s_init, "PHP_RSHUTDOWN_FUNCTION(%s)\n{\n", module);
|
||||
Printf(s_init, "/* rshutdown section */\n");
|
||||
Printf(s_init, "%s\n", r_shutdown);
|
||||
Printf(s_init, " return SUCCESS;\n");
|
||||
Printf(s_init, "}\n\n");
|
||||
}
|
||||
|
||||
if (Len(pragma_phpinfo) > 0) {
|
||||
Printf(f_h, "PHP_MINFO_FUNCTION(%s);\n", module);
|
||||
|
||||
Printf(s_init, "PHP_MINFO_FUNCTION(%s)\n{\n", module);
|
||||
Printf(s_init, "%s", pragma_phpinfo);
|
||||
Printf(s_init, "}\n");
|
||||
}
|
||||
|
||||
Printf(s_init, "PHP_MINFO_FUNCTION(%s)\n{\n", module);
|
||||
Printf(s_init, "%s", pragma_phpinfo);
|
||||
Printf(s_init, "}\n");
|
||||
Printf(s_init, "/* end init section */\n");
|
||||
|
||||
Printf(f_h, "#endif /* PHP_%s_H */\n", cap_module);
|
||||
Printf(f_h, "\n#endif /* PHP_%s_H */\n", cap_module);
|
||||
|
||||
Delete(f_h);
|
||||
|
||||
|
|
@ -1478,6 +1511,9 @@ public:
|
|||
Replaceall(value, "$", "\\$");
|
||||
}
|
||||
Printf(args, "$%s=%s", arg_names[i], value);
|
||||
} else if (constructor && i >= 1 && i < min_num_of_arguments) {
|
||||
// We need to be able to call __construct($resource).
|
||||
Printf(args, "$%s=null", arg_names[i]);
|
||||
} else {
|
||||
Printf(args, "$%s", arg_names[i]);
|
||||
}
|
||||
|
|
@ -1498,6 +1534,15 @@ public:
|
|||
Printf(invoke_args, ",");
|
||||
}
|
||||
Printf(invoke_args, "%s", args);
|
||||
if (constructor && min_num_of_arguments > 1) {
|
||||
// We need to be able to call __construct($resource).
|
||||
Clear(args);
|
||||
Printf(args, "$%s", arg_names[0]);
|
||||
for (i = 1; i < min_num_of_arguments; ++i) {
|
||||
Printf(args, ",");
|
||||
Printf(args, "$%s=null", arg_names[i]);
|
||||
}
|
||||
}
|
||||
bool had_a_case = false;
|
||||
int last_handled_i = i - 1;
|
||||
for (; i < max_num_of_arguments; ++i) {
|
||||
|
|
@ -2629,7 +2674,7 @@ done:
|
|||
// variable named after the result of Swig_cresult_name(), so that can't
|
||||
// be a zval - make it a pointer to one instead.
|
||||
Printf(w->code, "zval swig_zval_result, swig_funcname;\n", Swig_cresult_name());
|
||||
Printf(w->code, "zval *%s = &swig_zval_result;\n", Swig_cresult_name());
|
||||
Printf(w->code, "zval * SWIGUNUSED %s = &swig_zval_result;\n", Swig_cresult_name());
|
||||
const char * funcname = GetChar(n, "sym:name");
|
||||
Printf(w->code, "ZVAL_STRINGL(&swig_funcname, \"%s\", %d);\n", funcname, strlen(funcname));
|
||||
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ public:
|
|||
|
||||
/* Initialize the rest of the module */
|
||||
|
||||
Printf(s_oinit, "ZEND_INIT_MODULE_GLOBALS(%s, %s_init_globals, %s_destroy_globals);\n", module, module, module);
|
||||
Printf(s_oinit, "ZEND_INIT_MODULE_GLOBALS(%s, %s_init_globals, NULL);\n", module, module);
|
||||
|
||||
/* start the header section */
|
||||
Printf(s_header, "ZEND_BEGIN_MODULE_GLOBALS(%s)\n", module);
|
||||
|
|
@ -429,9 +429,6 @@ public:
|
|||
Printf(s_header, " globals->error_code = default_error_code;\n");
|
||||
Printf(s_header, "}\n");
|
||||
|
||||
Printf(s_header, "static void %s_destroy_globals(zend_%s_globals * globals) { (void)globals; }\n", module, module);
|
||||
|
||||
Printf(s_header, "\n");
|
||||
Printf(s_header, "static void SWIG_ResetError(TSRMLS_D) {\n");
|
||||
Printf(s_header, " SWIG_ErrorMsg() = default_error_msg;\n");
|
||||
Printf(s_header, " SWIG_ErrorCode() = default_error_code;\n");
|
||||
|
|
|
|||
|
|
@ -261,10 +261,9 @@ public:
|
|||
rename = strip(name);
|
||||
Printf(f_classInit, "ADD_FUNCTION(\"%s\", %s, tFunc(%s), 0);\n", rename, function, description);
|
||||
break;
|
||||
case CLASS_CONST:
|
||||
assert(false); // shouldn't have gotten here for CLASS_CONST nodes
|
||||
default:
|
||||
assert(false); // what is this?
|
||||
case CLASS_CONST: // shouldn't have gotten here for CLASS_CONST nodes
|
||||
default: // what is this?
|
||||
assert(false);
|
||||
}
|
||||
Delete(rename);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -974,7 +974,9 @@ int R::OutputClassMemberTable(Hash *tb, File *out) {
|
|||
String *key;
|
||||
int i, n = Len(keys);
|
||||
/* Loop over all the <Class>_set and <Class>_get entries in the table. */
|
||||
|
||||
/* This function checks for names ending in _set - perhaps it should */
|
||||
/* use attributes of some other form, as it potentially clashes with */
|
||||
/* methods ending in _set */
|
||||
if(n && outputNamespaceInfo) {
|
||||
Printf(s_namespace, "exportClasses(");
|
||||
}
|
||||
|
|
@ -984,9 +986,13 @@ int R::OutputClassMemberTable(Hash *tb, File *out) {
|
|||
|
||||
String *className = Getitem(el, 0);
|
||||
char *ptr = Char(key);
|
||||
ptr = &ptr[Len(key) - 3];
|
||||
int isSet = strcmp(ptr, "set") == 0;
|
||||
|
||||
int klen = Len(key);
|
||||
int isSet = 0;
|
||||
if (klen > 4) {
|
||||
ptr = &ptr[klen - 4];
|
||||
isSet = strcmp(ptr, "_set") == 0;
|
||||
}
|
||||
|
||||
// OutputArrayMethod(className, el, out);
|
||||
OutputMemberReferenceMethod(className, isSet, el, out);
|
||||
|
||||
|
|
@ -1273,7 +1279,9 @@ void R::addAccessor(String *memberName, Wrapper *wrapper, String *name,
|
|||
if(isSet < 0) {
|
||||
int n = Len(name);
|
||||
char *ptr = Char(name);
|
||||
isSet = Strcmp(NewString(&ptr[n-3]), "set") == 0;
|
||||
if (n>4) {
|
||||
isSet = Strcmp(NewString(&ptr[n-4]), "_set") == 0;
|
||||
}
|
||||
}
|
||||
|
||||
List *l = isSet ? class_member_set_functions : class_member_functions;
|
||||
|
|
@ -1753,7 +1761,8 @@ int R::functionWrapper(Node *n) {
|
|||
|
||||
int n = Len(iname);
|
||||
char *ptr = Char(iname);
|
||||
bool isSet(Strcmp(NewString(&ptr[n-3]), "set") == 0);
|
||||
bool isSet(0);
|
||||
if (n > 4) isSet = Strcmp(NewString(&ptr[n-4]), "_set") == 0;
|
||||
|
||||
|
||||
String *tmp = NewString("");
|
||||
|
|
|
|||
|
|
@ -1419,9 +1419,8 @@ public:
|
|||
case DESTRUCTOR:
|
||||
case CLASS_CONST:
|
||||
case STATIC_VAR:
|
||||
assert(false); // Should not have gotten here for these types
|
||||
default:
|
||||
assert(false);
|
||||
assert(false); // Should not have gotten here for these types
|
||||
}
|
||||
|
||||
defineAliases(n, iname);
|
||||
|
|
@ -3288,7 +3287,7 @@ public:
|
|||
}
|
||||
|
||||
/* declare Ruby return value */
|
||||
String *value_result = NewStringf("VALUE %s", Swig_cresult_name());
|
||||
String *value_result = NewStringf("VALUE SWIGUNUSED %s", Swig_cresult_name());
|
||||
Wrapper_add_local(w, Swig_cresult_name(), value_result);
|
||||
Delete(value_result);
|
||||
|
||||
|
|
|
|||
|
|
@ -1459,7 +1459,7 @@ String *Preprocessor_parse(String *s) {
|
|||
break;
|
||||
}
|
||||
state = 43;
|
||||
/* no break intended here */
|
||||
/* FALL THRU */
|
||||
|
||||
case 43:
|
||||
/* Get preprocessor value */
|
||||
|
|
|
|||
|
|
@ -799,6 +799,8 @@ static int need_name_warning(Node *n) {
|
|||
need = 0;
|
||||
} else if (Getattr(n, "templatetype")) {
|
||||
need = 0;
|
||||
} else if (GetFlag(n, "parsing_template_declaration")) {
|
||||
need = 0;
|
||||
}
|
||||
return need;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -402,6 +402,7 @@ extern int ParmList_is_compactdefargs(ParmList *p);
|
|||
extern void Swig_typemap_clear(const_String_or_char_ptr tmap_method, ParmList *pattern);
|
||||
extern int Swig_typemap_apply(ParmList *srcpat, ParmList *destpat);
|
||||
extern void Swig_typemap_clear_apply(ParmList *pattern);
|
||||
extern void Swig_typemap_replace_embedded_typemap(String *s, Node *file_line_node);
|
||||
extern void Swig_typemap_debug(void);
|
||||
extern void Swig_typemap_search_debug_set(void);
|
||||
extern void Swig_typemap_used_debug_set(void);
|
||||
|
|
|
|||
|
|
@ -518,7 +518,6 @@ void Swig_symbol_inherit(Symtab *s) {
|
|||
|
||||
void Swig_symbol_cadd(const_String_or_char_ptr name, Node *n) {
|
||||
Node *append = 0;
|
||||
|
||||
Node *cn;
|
||||
/* There are a few options for weak symbols. A "weak" symbol
|
||||
is any symbol that can be replaced by another symbol in the C symbol
|
||||
|
|
@ -1907,19 +1906,37 @@ SwigType *Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) {
|
|||
int len = Len(elements);
|
||||
int i;
|
||||
#ifdef SWIG_TEMPLATE_DEFTYPE_CACHE
|
||||
static Hash *deftype_cache = 0;
|
||||
String *scopetype = tscope ? NewStringf("%s::%s", Getattr(tscope, "name"), type)
|
||||
static Hash *s_cache = 0;
|
||||
Hash *scope_cache;
|
||||
/* The lookup depends on the current scope and potential namespace qualification.
|
||||
Looking up x in namespace y is not the same as looking up x::y in outer scope.
|
||||
-> we use a 2-level hash: first scope and then symbol. */
|
||||
String *scope_name = tscope
|
||||
? Swig_symbol_qualifiedscopename(tscope)
|
||||
: Swig_symbol_qualifiedscopename(current_symtab);
|
||||
String *type_name = tscope
|
||||
? NewStringf("%s::%s", Getattr(tscope, "name"), type)
|
||||
: NewStringf("%s::%s", Swig_symbol_getscopename(), type);
|
||||
if (!deftype_cache) {
|
||||
deftype_cache = NewHash();
|
||||
if (!scope_name) scope_name = NewString("::");
|
||||
if (!s_cache) {
|
||||
s_cache = NewHash();
|
||||
}
|
||||
if (scopetype) {
|
||||
String *cres = Getattr(deftype_cache, scopetype);
|
||||
scope_cache = Getattr(s_cache, scope_name);
|
||||
if (scope_cache) {
|
||||
String *cres = Getattr(scope_cache, type_name);
|
||||
if (cres) {
|
||||
Append(result, cres);
|
||||
Delete(scopetype);
|
||||
#ifdef SWIG_DEBUG
|
||||
Printf(stderr, "cached deftype %s(%s) -> %s\n", type, scope_name, result);
|
||||
#endif
|
||||
Delete(type_name);
|
||||
Delete(scope_name);
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
scope_cache = NewHash();
|
||||
Setattr(s_cache, scope_name, scope_cache);
|
||||
Delete(scope_name);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -2019,8 +2036,8 @@ SwigType *Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) {
|
|||
}
|
||||
Delete(elements);
|
||||
#ifdef SWIG_TEMPLATE_DEFTYPE_CACHE
|
||||
Setattr(deftype_cache, scopetype, result);
|
||||
Delete(scopetype);
|
||||
Setattr(scope_cache, type_name, result);
|
||||
Delete(type_name);
|
||||
#endif
|
||||
|
||||
return result;
|
||||
|
|
|
|||
|
|
@ -1876,6 +1876,21 @@ static List *split_embedded_typemap(String *s) {
|
|||
return args;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_typemap_replace_embedded_typemap()
|
||||
*
|
||||
* For special variable macro $typemap(...) expansion outside of typemaps.
|
||||
* Only limited usage works as most typemap special variables ($1, $input etc)
|
||||
* are not expanded correctly outside of typemaps.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void Swig_typemap_replace_embedded_typemap(String *s, Node *file_line_node) {
|
||||
Setfile(s, Getfile(file_line_node));
|
||||
Setline(s, Getline(file_line_node));
|
||||
Replaceall(s, "$typemap", "$TYPEMAP");
|
||||
replace_embedded_typemap(s, 0, 0, file_line_node);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* replace_embedded_typemap()
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue