merge revisions 11243-11872 from trunk to gsoc2009-matevz
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@12162 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
commit
ab1cd03979
387 changed files with 12383 additions and 4412 deletions
|
|
@ -212,7 +212,11 @@ int Swig_cargs(Wrapper *w, ParmList *p) {
|
|||
String *type = Getattr(p, "type");
|
||||
/* default values only emitted if in compact default args mode */
|
||||
String *pvalue = (compactdefargs) ? Getattr(p, "value") : 0;
|
||||
SwigType *altty = SwigType_alttype(type, 0);
|
||||
|
||||
/* When using compactdefaultargs, the code generated initialises a variable via a constructor call that accepts the
|
||||
* default value as a parameter. The default constructor is not called and therefore SwigValueWrapper is not needed. */
|
||||
SwigType *altty = pvalue ? 0 : SwigType_alttype(type, 0);
|
||||
|
||||
int tycode = SwigType_type(type);
|
||||
if (tycode == T_REFERENCE) {
|
||||
if (pvalue) {
|
||||
|
|
@ -851,7 +855,7 @@ int Swig_MethodToFunction(Node *n, String *classname, int flags, SwigType *direc
|
|||
SwigType_push(type, qualifier);
|
||||
}
|
||||
SwigType_add_pointer(type);
|
||||
p = NewParm(type, "self");
|
||||
p = NewParm(type, "self", n);
|
||||
Setattr(p, "self", "1");
|
||||
Setattr(p, "hidden","1");
|
||||
/*
|
||||
|
|
@ -1203,7 +1207,7 @@ int Swig_DestructorToFunction(Node *n, String *classname, int cplus, int flags)
|
|||
|
||||
type = NewString(classname);
|
||||
SwigType_add_pointer(type);
|
||||
p = NewParm(type, "self");
|
||||
p = NewParm(type, "self", n);
|
||||
Setattr(p, "self", "1");
|
||||
Setattr(p, "hidden", "1");
|
||||
Setattr(p, "wrap:disown", "1");
|
||||
|
|
@ -1255,7 +1259,7 @@ int Swig_DestructorToFunction(Node *n, String *classname, int cplus, int flags)
|
|||
* This function creates a C wrapper for setting a structure member.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
int Swig_MembersetToFunction(Node *n, String *classname, int flags, String **call) {
|
||||
int Swig_MembersetToFunction(Node *n, String *classname, int flags) {
|
||||
String *name;
|
||||
ParmList *parms;
|
||||
Parm *p;
|
||||
|
|
@ -1286,13 +1290,13 @@ int Swig_MembersetToFunction(Node *n, String *classname, int flags, String **cal
|
|||
|
||||
t = NewString(classname);
|
||||
SwigType_add_pointer(t);
|
||||
parms = NewParm(t, "self");
|
||||
parms = NewParm(t, "self", n);
|
||||
Setattr(parms, "self", "1");
|
||||
Setattr(parms, "hidden","1");
|
||||
Delete(t);
|
||||
|
||||
ty = Swig_wrapped_member_var_type(type, varcref);
|
||||
p = NewParm(ty, name);
|
||||
p = NewParm(ty, name, n);
|
||||
Setattr(parms, "hidden", "1");
|
||||
set_nextSibling(parms, p);
|
||||
|
||||
|
|
@ -1303,21 +1307,23 @@ int Swig_MembersetToFunction(Node *n, String *classname, int flags, String **cal
|
|||
Delete(p);
|
||||
|
||||
if (flags & CWRAP_EXTEND) {
|
||||
String *call;
|
||||
String *cres;
|
||||
String *code = Getattr(n, "code");
|
||||
if (code) {
|
||||
/* I don't think this ever gets run - WSF */
|
||||
Swig_add_extension_code(n, mangled, parms, void_type, code, cparse_cplusplus, "self");
|
||||
}
|
||||
*call = Swig_cfunction_call(mangled, parms);
|
||||
cres = NewStringf("%s;", *call);
|
||||
call = Swig_cfunction_call(mangled, parms);
|
||||
cres = NewStringf("%s;", call);
|
||||
Setattr(n, "wrap:action", cres);
|
||||
Delete(call);
|
||||
Delete(cres);
|
||||
} else {
|
||||
String *cres;
|
||||
*call = Swig_cmemberset_call(name, type, self, varcref);
|
||||
cres = NewStringf("%s;", *call);
|
||||
String *call = Swig_cmemberset_call(name, type, self, varcref);
|
||||
String *cres = NewStringf("%s;", call);
|
||||
Setattr(n, "wrap:action", cres);
|
||||
Delete(call);
|
||||
Delete(cres);
|
||||
}
|
||||
Setattr(n, "type", void_type);
|
||||
|
|
@ -1373,7 +1379,7 @@ int Swig_MembergetToFunction(Node *n, String *classname, int flags) {
|
|||
|
||||
t = NewString(classname);
|
||||
SwigType_add_pointer(t);
|
||||
parms = NewParm(t, "self");
|
||||
parms = NewParm(t, "self", n);
|
||||
Setattr(parms, "self", "1");
|
||||
Setattr(parms, "hidden","1");
|
||||
Delete(t);
|
||||
|
|
@ -1429,7 +1435,7 @@ int Swig_VarsetToFunction(Node *n, int flags) {
|
|||
type = Getattr(n, "type");
|
||||
nname = SwigType_namestr(name);
|
||||
ty = Swig_wrapped_var_type(type, varcref);
|
||||
parms = NewParm(ty, name);
|
||||
parms = NewParm(ty, name, n);
|
||||
|
||||
if (flags & CWRAP_EXTEND) {
|
||||
String *sname = Swig_name_set(name);
|
||||
|
|
|
|||
|
|
@ -53,13 +53,15 @@ static char wrn_wnum_fmt[64];
|
|||
static char wrn_nnum_fmt[64];
|
||||
static char err_line_fmt[64];
|
||||
static char err_eof_fmt[64];
|
||||
static char diag_line_fmt[64];
|
||||
static char diag_eof_fmt[64];
|
||||
|
||||
static String *format_filename(const_String_or_char_ptr filename);
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_warning()
|
||||
*
|
||||
* Issue a warning message
|
||||
* Issue a warning message on stderr.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void Swig_warning(int wnum, const_String_or_char_ptr filename, int line, const char *fmt, ...) {
|
||||
|
|
@ -122,7 +124,7 @@ void Swig_warning(int wnum, const_String_or_char_ptr filename, int line, const c
|
|||
/* -----------------------------------------------------------------------------
|
||||
* Swig_error()
|
||||
*
|
||||
* Issue an error message
|
||||
* Issue an error message on stderr.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void Swig_error(const_String_or_char_ptr filename, int line, const char *fmt, ...) {
|
||||
|
|
@ -249,8 +251,8 @@ void Swig_error_msg_format(ErrorMessageFormat format) {
|
|||
by now a switch is used to translated into one. */
|
||||
switch (format) {
|
||||
case EMF_MICROSOFT:
|
||||
fmt_line = "%s(%d)";
|
||||
fmt_eof = "%s(999999)"; /* Is there a special character for EOF? Just use a large number. */
|
||||
fmt_line = "%s(%d) ";
|
||||
fmt_eof = "%s(999999) "; /* Is there a special character for EOF? Just use a large number. */
|
||||
break;
|
||||
case EMF_STANDARD:
|
||||
default:
|
||||
|
|
@ -258,10 +260,12 @@ void Swig_error_msg_format(ErrorMessageFormat format) {
|
|||
fmt_eof = "%s:EOF";
|
||||
}
|
||||
|
||||
sprintf(wrn_wnum_fmt, "%s: %s(%%d): ", fmt_line, warning);
|
||||
sprintf(wrn_wnum_fmt, "%s: %s %%d: ", fmt_line, warning);
|
||||
sprintf(wrn_nnum_fmt, "%s: %s: ", fmt_line, warning);
|
||||
sprintf(err_line_fmt, "%s: %s: ", fmt_line, error);
|
||||
sprintf(err_eof_fmt, "%s: %s: ", fmt_eof, error);
|
||||
sprintf(diag_line_fmt, "%s: ", fmt_line);
|
||||
sprintf(diag_eof_fmt, "%s: ", fmt_eof);
|
||||
|
||||
msg_format = format;
|
||||
init_fmt = 1;
|
||||
|
|
@ -279,3 +283,29 @@ static String *format_filename(const_String_or_char_ptr filename) {
|
|||
#endif
|
||||
return formatted_filename;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_diagnostic()
|
||||
*
|
||||
* Issue a diagnostic message on stdout.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void Swig_diagnostic(const_String_or_char_ptr filename, int line, const char *fmt, ...) {
|
||||
va_list ap;
|
||||
String *formatted_filename = NULL;
|
||||
|
||||
if (!init_fmt)
|
||||
Swig_error_msg_format(DEFAULT_ERROR_MSG_FORMAT);
|
||||
|
||||
va_start(ap, fmt);
|
||||
formatted_filename = format_filename(filename);
|
||||
if (line > 0) {
|
||||
Printf(stdout, diag_line_fmt, formatted_filename, line);
|
||||
} else {
|
||||
Printf(stdout, diag_eof_fmt, formatted_filename);
|
||||
}
|
||||
vPrintf(stdout, fmt, ap);
|
||||
va_end(ap);
|
||||
Delete(formatted_filename);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -188,9 +188,8 @@ static FILE *Swig_open_file(const_String_or_char_ptr name, int sysfile, int use_
|
|||
}
|
||||
if (f) {
|
||||
Delete(lastpath);
|
||||
lastpath = Swig_filename_escape(filename);
|
||||
lastpath = filename;
|
||||
}
|
||||
Delete(filename);
|
||||
return f;
|
||||
}
|
||||
|
||||
|
|
@ -248,7 +247,7 @@ static String *Swig_include_any(const_String_or_char_ptr name, int sysfile) {
|
|||
str = Swig_read_file(f);
|
||||
fclose(f);
|
||||
Seek(str, 0, SEEK_SET);
|
||||
file = Copy(lastpath);
|
||||
file = Copy(Swig_last_file());
|
||||
Setfile(str, file);
|
||||
Delete(file);
|
||||
Setline(str, 1);
|
||||
|
|
|
|||
|
|
@ -92,8 +92,8 @@ void Swig_banner_target_lang(File *f, const_String_or_char_ptr commentchar) {
|
|||
/* -----------------------------------------------------------------------------
|
||||
* Swig_strip_c_comments()
|
||||
*
|
||||
* Return a new string with C comments stripped from the input string. Null is
|
||||
* returned if there aren't any.
|
||||
* Return a new string with C comments stripped from the input string. NULL is
|
||||
* returned if there aren't any comments.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
String *Swig_strip_c_comments(const String *s) {
|
||||
|
|
@ -111,9 +111,10 @@ String *Swig_strip_c_comments(const String *s) {
|
|||
comment_begin = c-1;
|
||||
} else if (comment_begin && !comment_end && *c == '*') {
|
||||
++c;
|
||||
if (*c == '/')
|
||||
if (*c == '/') {
|
||||
comment_end = c;
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
++c;
|
||||
}
|
||||
|
|
@ -162,12 +163,25 @@ void Swig_filename_correct(String *filename) {
|
|||
String *Swig_filename_escape(String *filename) {
|
||||
String *adjusted_filename = Copy(filename);
|
||||
#if defined(_WIN32) /* Note not on Cygwin else filename is displayed with double '/' */
|
||||
Replaceall(adjusted_filename, "\\\\", "\\"); /* remove double '\' in case any already present */
|
||||
Replaceall(adjusted_filename, "\\", "\\\\");
|
||||
Replaceall(adjusted_filename, "\\\\", "\\"); /* remove double '\' in case any already present */
|
||||
Replaceall(adjusted_filename, "\\", "\\\\");
|
||||
#endif
|
||||
return adjusted_filename;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_filename_unescape()
|
||||
*
|
||||
* Remove double backslash escaping in filename - for Windows
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void Swig_filename_unescape(String *filename) {
|
||||
(void)filename;
|
||||
#if defined(_WIN32)
|
||||
Replaceall(filename, "\\\\", "\\");
|
||||
#endif
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_string_escape()
|
||||
*
|
||||
|
|
@ -896,7 +910,11 @@ String *Swig_scopename_suffix(const String *s) {
|
|||
/* -----------------------------------------------------------------------------
|
||||
* Swig_scopename_check()
|
||||
*
|
||||
* Checks to see if a name is qualified with a scope name
|
||||
* Checks to see if a name is qualified with a scope name, examples:
|
||||
* foo -> 0
|
||||
* ::foo -> 1
|
||||
* foo::bar -> 1
|
||||
* foo< ::bar > -> 0
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
int Swig_scopename_check(const String *s) {
|
||||
|
|
|
|||
|
|
@ -478,25 +478,12 @@ DOH *Swig_name_object_get(Hash *namehash, String *prefix, String *name, SwigType
|
|||
Delete(cls);
|
||||
}
|
||||
/* A template-based class lookup, check name first */
|
||||
if (!rn && SwigType_istemplate(name)) {
|
||||
String *t_name = SwigType_templateprefix(name);
|
||||
if (!Equal(t_name, name)) {
|
||||
if (!rn) {
|
||||
String *t_name = SwigType_istemplate_templateprefix(name);
|
||||
if (t_name)
|
||||
rn = Swig_name_object_get(namehash, prefix, t_name, decl);
|
||||
}
|
||||
Delete(t_name);
|
||||
}
|
||||
/* A template-based class lookup */
|
||||
/*
|
||||
if (!rn && SwigType_istemplate(prefix)) {
|
||||
String *t_prefix = SwigType_templateprefix(prefix);
|
||||
if (Strcmp(t_prefix, prefix) != 0) {
|
||||
String *t_name = SwigType_templateprefix(name);
|
||||
rn = Swig_name_object_get(namehash, t_prefix, t_name, decl);
|
||||
Delete(t_name);
|
||||
}
|
||||
Delete(t_prefix);
|
||||
}
|
||||
*/
|
||||
}
|
||||
/* A wildcard-based class lookup */
|
||||
if (!rn) {
|
||||
|
|
@ -667,10 +654,9 @@ void Swig_features_get(Hash *features, String *prefix, String *name, SwigType *d
|
|||
if (name) {
|
||||
String *tname = NewStringEmpty();
|
||||
/* add features for 'root' template */
|
||||
if (SwigType_istemplate(name)) {
|
||||
String *dname = SwigType_templateprefix(name);
|
||||
String *dname = SwigType_istemplate_templateprefix(name);
|
||||
if (dname) {
|
||||
features_get(features, dname, decl, ncdecl, node);
|
||||
Delete(dname);
|
||||
}
|
||||
/* Catch-all */
|
||||
features_get(features, name, decl, ncdecl, node);
|
||||
|
|
@ -688,16 +674,16 @@ void Swig_features_get(Hash *features, String *prefix, String *name, SwigType *d
|
|||
/* A specific class lookup */
|
||||
if (Len(prefix)) {
|
||||
/* A template-based class lookup */
|
||||
if (SwigType_istemplate(prefix)) {
|
||||
String *tprefix = SwigType_templateprefix(prefix);
|
||||
String *tprefix = SwigType_istemplate_templateprefix(prefix);
|
||||
if (tprefix) {
|
||||
Clear(tname);
|
||||
Printf(tname, "%s::%s", tprefix, name);
|
||||
features_get(features, tname, decl, ncdecl, node);
|
||||
Delete(tprefix);
|
||||
}
|
||||
Clear(tname);
|
||||
Printf(tname, "%s::%s", prefix, name);
|
||||
features_get(features, tname, decl, ncdecl, node);
|
||||
Delete(tprefix);
|
||||
}
|
||||
} else {
|
||||
/* Lookup in the global namespace only */
|
||||
|
|
@ -706,6 +692,7 @@ void Swig_features_get(Hash *features, String *prefix, String *name, SwigType *d
|
|||
features_get(features, tname, decl, ncdecl, node);
|
||||
}
|
||||
Delete(tname);
|
||||
Delete(dname);
|
||||
}
|
||||
if (name && SwigType_istemplate(name)) {
|
||||
/* add features for complete template type */
|
||||
|
|
@ -1615,7 +1602,7 @@ String *Swig_name_decl(Node *n) {
|
|||
qname = NewString("");
|
||||
if (qualifier && Len(qualifier) > 0)
|
||||
Printf(qname, "%s::", qualifier);
|
||||
Printf(qname, "%s", name);
|
||||
Printf(qname, "%s", SwigType_str(name, 0));
|
||||
|
||||
decl = NewStringf("%s(%s)%s", qname, ParmList_errorstr(Getattr(n, "parms")), SwigType_isconst(Getattr(n, "decl")) ? " const" : "");
|
||||
|
||||
|
|
|
|||
|
|
@ -18,10 +18,25 @@ char cvsroot_parms_c[] = "$Id$";
|
|||
/* ------------------------------------------------------------------------
|
||||
* NewParm()
|
||||
*
|
||||
* Create a new parameter from datatype 'type' and name 'name'.
|
||||
* Create a new parameter from datatype 'type' and name 'name' copying
|
||||
* the file and line number from the Node file_line_node.
|
||||
* ------------------------------------------------------------------------ */
|
||||
|
||||
Parm *NewParm(SwigType *type, const_String_or_char_ptr name) {
|
||||
Parm *NewParm(SwigType *type, const_String_or_char_ptr name, Node *file_line_node) {
|
||||
Parm *p = NewParmWithoutFileLineInfo(type, name);
|
||||
Setfile(p, Getfile(file_line_node));
|
||||
Setline(p, Getline(file_line_node));
|
||||
return p;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------------------
|
||||
* NewParmWithoutFileLineInfo()
|
||||
*
|
||||
* Create a new parameter from datatype 'type' and name 'name' without any
|
||||
* file / line numbering information.
|
||||
* ------------------------------------------------------------------------ */
|
||||
|
||||
Parm *NewParmWithoutFileLineInfo(SwigType *type, const_String_or_char_ptr name) {
|
||||
Parm *p = NewHash();
|
||||
set_nodeType(p, "parm");
|
||||
if (type) {
|
||||
|
|
@ -118,6 +133,14 @@ int ParmList_len(ParmList *p) {
|
|||
return i;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* get_empty_type()
|
||||
* ---------------------------------------------------------------------- */
|
||||
|
||||
static SwigType *get_empty_type() {
|
||||
return NewStringEmpty();
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* ParmList_str()
|
||||
*
|
||||
|
|
@ -127,7 +150,8 @@ int ParmList_len(ParmList *p) {
|
|||
String *ParmList_str(ParmList *p) {
|
||||
String *out = NewStringEmpty();
|
||||
while (p) {
|
||||
String *pstr = SwigType_str(Getattr(p, "type"), Getattr(p, "name"));
|
||||
String *type = Getattr(p, "type");
|
||||
String *pstr = SwigType_str(type ? type : get_empty_type(), Getattr(p, "name"));
|
||||
Append(out, pstr);
|
||||
p = nextSibling(p);
|
||||
if (p) {
|
||||
|
|
@ -148,7 +172,8 @@ String *ParmList_str_defaultargs(ParmList *p) {
|
|||
String *out = NewStringEmpty();
|
||||
while (p) {
|
||||
String *value = Getattr(p, "value");
|
||||
String *pstr = SwigType_str(Getattr(p, "type"), Getattr(p, "name"));
|
||||
String *type = Getattr(p, "type");
|
||||
String *pstr = SwigType_str(type ? type : get_empty_type(), Getattr(p, "name"));
|
||||
Append(out, pstr);
|
||||
if (value) {
|
||||
Printf(out, "=%s", value);
|
||||
|
|
@ -162,6 +187,24 @@ String *ParmList_str_defaultargs(ParmList *p) {
|
|||
return out;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* ParmList_str_multibrackets()
|
||||
*
|
||||
* Generates a string of parameters including default arguments adding brackets
|
||||
* if more than one parameter
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
String *ParmList_str_multibrackets(ParmList *p) {
|
||||
String *out;
|
||||
String *parm_str = ParmList_str_defaultargs(p);
|
||||
if (ParmList_len(p) > 1)
|
||||
out = NewStringf("(%s)", parm_str);
|
||||
else
|
||||
out = NewStringf("%s", parm_str);
|
||||
Delete(parm_str);
|
||||
return out;
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------
|
||||
* ParmList_protostr()
|
||||
*
|
||||
|
|
@ -171,7 +214,8 @@ String *ParmList_str_defaultargs(ParmList *p) {
|
|||
String *ParmList_protostr(ParmList *p) {
|
||||
String *out = NewStringEmpty();
|
||||
while (p) {
|
||||
String *pstr = SwigType_str(Getattr(p, "type"), 0);
|
||||
String *type = Getattr(p, "type");
|
||||
String *pstr = SwigType_str(type ? type : get_empty_type(), 0);
|
||||
Append(out, pstr);
|
||||
p = nextSibling(p);
|
||||
if (p) {
|
||||
|
|
|
|||
|
|
@ -20,7 +20,8 @@ char cvsroot_scanner_c[] = "$Id$";
|
|||
#include <ctype.h>
|
||||
|
||||
extern String *cparse_file;
|
||||
extern int cparse_start_line;
|
||||
extern int cparse_cplusplus;
|
||||
extern int cparse_start_line;
|
||||
|
||||
struct Scanner {
|
||||
String *text; /* Current token value */
|
||||
|
|
@ -97,6 +98,7 @@ void Scanner_clear(Scanner * s) {
|
|||
Clear(s->scanobjs);
|
||||
Scanner_clear_brackets(s);
|
||||
Delete(s->error);
|
||||
s->str = 0;
|
||||
s->error = 0;
|
||||
s->line = 1;
|
||||
s->nexttoken = -1;
|
||||
|
|
@ -864,7 +866,7 @@ static int look(Scanner * s) {
|
|||
}
|
||||
break;
|
||||
|
||||
case 7: /* Identifier or unicode/custom delimiter string */
|
||||
case 7: /* Identifier or true/false or unicode/custom delimiter string */
|
||||
if (c=='R') { /* Possibly CUSTOM DELIMITER string */
|
||||
state = 72;
|
||||
break;
|
||||
|
|
@ -875,7 +877,7 @@ static int look(Scanner * s) {
|
|||
}
|
||||
|
||||
if ((c = nextchar(s)) == 0) {
|
||||
return SWIG_TOKEN_ID;
|
||||
state = 76;
|
||||
}
|
||||
else if (c=='\"') { /* Definitely u, U or L string */
|
||||
retract(s, 1);
|
||||
|
|
@ -895,20 +897,20 @@ static int look(Scanner * s) {
|
|||
|
||||
case 70: /* Identifier */
|
||||
if ((c = nextchar(s)) == 0)
|
||||
return SWIG_TOKEN_ID;
|
||||
if (isalnum(c) || (c == '_') || (c == '$')) {
|
||||
state = 76;
|
||||
else if (isalnum(c) || (c == '_') || (c == '$')) {
|
||||
state = 70;
|
||||
} else {
|
||||
retract(s, 1);
|
||||
return SWIG_TOKEN_ID;
|
||||
state = 76;
|
||||
}
|
||||
break;
|
||||
|
||||
case 71: /* Possibly u8 string */
|
||||
if ((c = nextchar(s)) == 0) {
|
||||
return SWIG_TOKEN_ID;
|
||||
state = 76;
|
||||
}
|
||||
if (c=='\"') {
|
||||
else if (c=='\"') {
|
||||
retract(s, 1); /* Definitely u8 string */
|
||||
state = 1000;
|
||||
}
|
||||
|
|
@ -926,9 +928,9 @@ static int look(Scanner * s) {
|
|||
case 73:
|
||||
case 74:
|
||||
if ((c = nextchar(s)) == 0) {
|
||||
return SWIG_TOKEN_ID;
|
||||
state = 76;
|
||||
}
|
||||
if (c=='\"') {
|
||||
else if (c=='\"') {
|
||||
retract(s, 1); /* Definitely custom delimiter u, U or L string */
|
||||
str_delimiter = NewStringEmpty();
|
||||
state = 1000;
|
||||
|
|
@ -956,10 +958,20 @@ static int look(Scanner * s) {
|
|||
} else {
|
||||
retract(s,1);
|
||||
if (Len(s->text) == 1) return SWIG_TOKEN_DOLLAR;
|
||||
return SWIG_TOKEN_ID;
|
||||
state = 76;
|
||||
}
|
||||
break;
|
||||
|
||||
case 76: /* Identifier or true/false */
|
||||
if (cparse_cplusplus) {
|
||||
if (Strcmp(s->text, "true") == 0)
|
||||
return SWIG_TOKEN_BOOL;
|
||||
else if (Strcmp(s->text, "false") == 0)
|
||||
return SWIG_TOKEN_BOOL;
|
||||
}
|
||||
return SWIG_TOKEN_ID;
|
||||
break;
|
||||
|
||||
case 8: /* A numerical digit */
|
||||
if ((c = nextchar(s)) == 0)
|
||||
return SWIG_TOKEN_INT;
|
||||
|
|
|
|||
|
|
@ -543,7 +543,13 @@ String *SwigType_namestr(const SwigType *t) {
|
|||
Putc(' ', r);
|
||||
Putc('>', r);
|
||||
suffix = SwigType_templatesuffix(t);
|
||||
Append(r, suffix);
|
||||
if (Len(suffix) > 0) {
|
||||
String *suffix_namestr = SwigType_namestr(suffix);
|
||||
Append(r, suffix_namestr);
|
||||
Delete(suffix_namestr);
|
||||
} else {
|
||||
Append(r, suffix);
|
||||
}
|
||||
Delete(suffix);
|
||||
Delete(p);
|
||||
return r;
|
||||
|
|
@ -562,7 +568,10 @@ String *SwigType_str(SwigType *s, const_String_or_char_ptr id) {
|
|||
int nelements, i;
|
||||
|
||||
if (id) {
|
||||
result = NewString(id);
|
||||
/* stringify the id expanding templates, for example when the id is a fully qualified templated class name */
|
||||
String *id_str = NewString(id); /* unfortunate copy due to current const limitations */
|
||||
result = SwigType_str(id_str, 0);
|
||||
Delete(id_str);
|
||||
} else {
|
||||
result = NewStringEmpty();
|
||||
}
|
||||
|
|
@ -1134,6 +1143,25 @@ void SwigType_typename_replace(SwigType *t, String *pat, String *rep) {
|
|||
Delete(elem);
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SwigType_remove_global_scope_prefix()
|
||||
*
|
||||
* Removes the unary scope operator (::) prefix indicating global scope in all
|
||||
* components of the type
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
SwigType *SwigType_remove_global_scope_prefix(const SwigType *t) {
|
||||
SwigType *result;
|
||||
const char *type = Char(t);
|
||||
if (strncmp(type, "::", 2) == 0)
|
||||
type += 2;
|
||||
result = NewString(type);
|
||||
Replaceall(result, ".::", ".");
|
||||
Replaceall(result, "(::", "(");
|
||||
Replaceall(result, "enum ::", "enum ");
|
||||
return result;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SwigType_check_decl()
|
||||
*
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@ extern "C" {
|
|||
extern SwigType *SwigType_add_function(SwigType *t, ParmList *parms);
|
||||
extern SwigType *SwigType_add_template(SwigType *t, ParmList *parms);
|
||||
extern SwigType *SwigType_pop_function(SwigType *t);
|
||||
extern ParmList *SwigType_function_parms(SwigType *t);
|
||||
extern ParmList *SwigType_function_parms(SwigType *t, Node *file_line_node);
|
||||
extern List *SwigType_split(const SwigType *t);
|
||||
extern String *SwigType_pop(SwigType *t);
|
||||
extern void SwigType_push(SwigType *t, SwigType *s);
|
||||
|
|
@ -167,6 +167,7 @@ extern "C" {
|
|||
extern String *SwigType_namestr(const SwigType *t);
|
||||
extern String *SwigType_templateprefix(const SwigType *t);
|
||||
extern String *SwigType_templatesuffix(const SwigType *t);
|
||||
extern String *SwigType_istemplate_templateprefix(const SwigType *t);
|
||||
extern String *SwigType_templateargs(const SwigType *t);
|
||||
extern String *SwigType_prefix(const SwigType *t);
|
||||
extern int SwigType_array_ndim(SwigType *t);
|
||||
|
|
@ -175,6 +176,7 @@ extern "C" {
|
|||
extern SwigType *SwigType_array_type(SwigType *t);
|
||||
extern String *SwigType_default(SwigType *t);
|
||||
extern void SwigType_typename_replace(SwigType *t, String *pat, String *rep);
|
||||
extern SwigType *SwigType_remove_global_scope_prefix(const SwigType *t);
|
||||
extern SwigType *SwigType_alttype(SwigType *t, int ltmap);
|
||||
|
||||
extern void SwigType_template_defargs(Parm *parms, Parm *targs, Symtab *tscope, Symtab *tsdecl);
|
||||
|
|
@ -209,6 +211,10 @@ extern "C" {
|
|||
|
||||
/* --- Symbol table module --- */
|
||||
|
||||
extern void Swig_symbol_print_tables(Symtab *symtab);
|
||||
extern void Swig_symbol_print_tables_summary(void);
|
||||
extern void Swig_symbol_print_symbols(void);
|
||||
extern void Swig_symbol_print_csymbols(void);
|
||||
extern void Swig_symbol_init(void);
|
||||
extern void Swig_symbol_setscopename(const_String_or_char_ptr name);
|
||||
extern String *Swig_symbol_getscopename(void);
|
||||
|
|
@ -216,6 +222,7 @@ extern "C" {
|
|||
extern Symtab *Swig_symbol_newscope(void);
|
||||
extern Symtab *Swig_symbol_setscope(Symtab *);
|
||||
extern Symtab *Swig_symbol_getscope(const_String_or_char_ptr symname);
|
||||
extern Symtab *Swig_symbol_global_scope(void);
|
||||
extern Symtab *Swig_symbol_current(void);
|
||||
extern Symtab *Swig_symbol_popscope(void);
|
||||
extern Node *Swig_symbol_add(const_String_or_char_ptr symname, Node *node);
|
||||
|
|
@ -296,8 +303,9 @@ extern int ParmList_is_compactdefargs(ParmList *p);
|
|||
extern void Swig_banner(File *f);
|
||||
extern void Swig_banner_target_lang(File *f, const_String_or_char_ptr commentchar);
|
||||
extern String *Swig_strip_c_comments(const String *s);
|
||||
extern String *Swig_filename_escape(String *filename);
|
||||
extern void Swig_filename_correct(String *filename);
|
||||
extern String *Swig_filename_escape(String *filename);
|
||||
extern void Swig_filename_unescape(String *filename);
|
||||
extern String *Swig_string_escape(String *s);
|
||||
extern String *Swig_string_mangle(const String *s);
|
||||
extern void Swig_scopename_split(const String *s, String **prefix, String **last);
|
||||
|
|
@ -311,13 +319,8 @@ extern int ParmList_is_compactdefargs(ParmList *p);
|
|||
extern String *Swig_string_title(String *s);
|
||||
|
||||
extern void Swig_init(void);
|
||||
extern void Swig_warn(const char *filename, int line, const char *msg);
|
||||
|
||||
extern int Swig_value_wrapper_mode(int mode);
|
||||
|
||||
|
||||
#define WARNING(msg) Swig_warn(__FILE__,__LINE__,msg)
|
||||
|
||||
typedef enum { EMF_STANDARD, EMF_MICROSOFT } ErrorMessageFormat;
|
||||
|
||||
extern void Swig_warning(int num, const_String_or_char_ptr filename, int line, const char *fmt, ...);
|
||||
|
|
@ -328,6 +331,7 @@ extern int ParmList_is_compactdefargs(ParmList *p);
|
|||
extern void Swig_warnall(void);
|
||||
extern int Swig_warn_count(void);
|
||||
extern void Swig_error_msg_format(ErrorMessageFormat format);
|
||||
extern void Swig_diagnostic(const_String_or_char_ptr filename, int line, const char *fmt, ...);
|
||||
|
||||
/* --- C Wrappers --- */
|
||||
extern String *Swig_cparm_name(Parm *p, int i);
|
||||
|
|
@ -352,7 +356,7 @@ extern int ParmList_is_compactdefargs(ParmList *p);
|
|||
extern int Swig_MethodToFunction(Node *n, String *classname, int flags, SwigType *director_type, int is_director);
|
||||
extern int Swig_ConstructorToFunction(Node *n, String *classname, String *none_comparison, String *director_ctor, int cplus, int flags);
|
||||
extern int Swig_DestructorToFunction(Node *n, String *classname, int cplus, int flags);
|
||||
extern int Swig_MembersetToFunction(Node *n, String *classname, int flags, String **call);
|
||||
extern int Swig_MembersetToFunction(Node *n, String *classname, int flags);
|
||||
extern int Swig_MembergetToFunction(Node *n, String *classname, int flags);
|
||||
extern int Swig_VargetToFunction(Node *n, int flags);
|
||||
extern int Swig_VarsetToFunction(Node *n, int flags);
|
||||
|
|
@ -372,22 +376,21 @@ extern int ParmList_is_compactdefargs(ParmList *p);
|
|||
/* --- Legacy Typemap API (somewhat simplified, ha!) --- */
|
||||
|
||||
extern void Swig_typemap_init(void);
|
||||
extern void Swig_typemap_register(const_String_or_char_ptr op, ParmList *pattern, const_String_or_char_ptr code, ParmList *locals, ParmList *kwargs);
|
||||
extern int Swig_typemap_copy(const_String_or_char_ptr op, ParmList *srcpattern, ParmList *pattern);
|
||||
extern void Swig_typemap_clear(const_String_or_char_ptr op, ParmList *pattern);
|
||||
extern void Swig_typemap_register(const_String_or_char_ptr tmap_method, ParmList *pattern, const_String_or_char_ptr code, ParmList *locals, ParmList *kwargs);
|
||||
extern int Swig_typemap_copy(const_String_or_char_ptr tmap_method, ParmList *srcpattern, ParmList *pattern);
|
||||
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_debug(void);
|
||||
extern void Swig_typemap_search_debug_set(void);
|
||||
extern void Swig_typemap_used_debug_set(void);
|
||||
|
||||
extern Hash *Swig_typemap_search(const_String_or_char_ptr op, SwigType *type, const_String_or_char_ptr pname, SwigType **matchtype);
|
||||
extern Hash *Swig_typemap_search_multi(const_String_or_char_ptr op, ParmList *parms, int *nmatch);
|
||||
extern String *Swig_typemap_lookup(const_String_or_char_ptr op, Node *n, const_String_or_char_ptr lname, Wrapper *f);
|
||||
extern String *Swig_typemap_lookup_out(const_String_or_char_ptr op, Node *n, const_String_or_char_ptr lname, Wrapper *f, String *actioncode);
|
||||
extern void Swig_typemap_attach_kwargs(Hash *tm, const_String_or_char_ptr op, Parm *p);
|
||||
extern String *Swig_typemap_lookup(const_String_or_char_ptr tmap_method, Node *n, const_String_or_char_ptr lname, Wrapper *f);
|
||||
extern String *Swig_typemap_lookup_out(const_String_or_char_ptr tmap_method, Node *n, const_String_or_char_ptr lname, Wrapper *f, String *actioncode);
|
||||
extern void Swig_typemap_new_scope(void);
|
||||
extern Hash *Swig_typemap_pop_scope(void);
|
||||
|
||||
extern void Swig_typemap_attach_parms(const_String_or_char_ptr op, ParmList *parms, Wrapper *f);
|
||||
extern void Swig_typemap_attach_parms(const_String_or_char_ptr tmap_method, ParmList *parms, Wrapper *f);
|
||||
|
||||
/* --- Code fragment support --- */
|
||||
|
||||
|
|
@ -402,6 +405,7 @@ extern int ParmList_is_compactdefargs(ParmList *p);
|
|||
extern void Wrapper_director_mode_set(int);
|
||||
extern void Wrapper_director_protected_mode_set(int);
|
||||
extern void Wrapper_all_protected_mode_set(int);
|
||||
extern void Language_replace_special_variables(String *method, String *tm, Parm *parm);
|
||||
|
||||
|
||||
/* -- template init -- */
|
||||
|
|
|
|||
|
|
@ -15,7 +15,8 @@
|
|||
/* $Id: swig.h 9629 2006-12-30 18:27:47Z beazley $ */
|
||||
|
||||
/* Individual parameters */
|
||||
extern Parm *NewParm(SwigType *type, const_String_or_char_ptr name);
|
||||
extern Parm *NewParm(SwigType *type, const_String_or_char_ptr name, Node *file_line_node);
|
||||
extern Parm *NewParmWithoutFileLineInfo(SwigType *type, const_String_or_char_ptr name);
|
||||
extern Parm *CopyParm(Parm *p);
|
||||
|
||||
/* Parameter lists */
|
||||
|
|
@ -28,6 +29,7 @@ extern int ParmList_has_defaultargs(ParmList *p);
|
|||
/* Output functions */
|
||||
extern String *ParmList_str(ParmList *);
|
||||
extern String *ParmList_str_defaultargs(ParmList *);
|
||||
extern String *ParmList_str_multibrackets(ParmList *);
|
||||
extern String *ParmList_protostr(ParmList *);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ extern void Scanner_freeze_line(Scanner *s, int val);
|
|||
#define SWIG_TOKEN_ULONGLONG 29 /* 314ULL */
|
||||
#define SWIG_TOKEN_QUESTION 30 /* ? */
|
||||
#define SWIG_TOKEN_COMMENT 31 /* C or C++ comment */
|
||||
#define SWIG_TOKEN_BOOL 32 /* true or false */
|
||||
#define SWIG_TOKEN_ILLEGAL 99
|
||||
#define SWIG_TOKEN_ERROR -1
|
||||
|
||||
|
|
|
|||
|
|
@ -179,20 +179,80 @@ static Hash *global_scope = 0; /* Global scope */
|
|||
/* common attribute keys, to avoid calling find_key all the times */
|
||||
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_symbol_print_tables()
|
||||
*
|
||||
* Debug display of symbol tables
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
#if 0
|
||||
void Swig_symbol_dump_symtable() {
|
||||
Printf(stdout, "DUMPING SYMTABLE start =======================================\n");
|
||||
{
|
||||
Hash *cst = Getattr(current_symtab, "csymtab");
|
||||
Swig_print_tree(cst);
|
||||
/*
|
||||
Swig_print_tree(Getattr(cst, "NumSpace"));
|
||||
*/
|
||||
}
|
||||
Printf(stdout, "DUMPING SYMTABLE end =======================================\n");
|
||||
void Swig_symbol_print_tables(Symtab *symtab) {
|
||||
if (!symtab)
|
||||
symtab = current_symtab;
|
||||
|
||||
Printf(stdout, "SYMBOL TABLES start =======================================\n");
|
||||
Swig_print_tree(symtab);
|
||||
Printf(stdout, "SYMBOL TABLES finish =======================================\n");
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_symbol_print_tables_summary()
|
||||
*
|
||||
* Debug summary display of all symbol tables by fully-qualified name
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void Swig_symbol_print_tables_summary(void) {
|
||||
Printf(stdout, "SYMBOL TABLES SUMMARY start =======================================\n");
|
||||
Swig_print_node(symtabs);
|
||||
Printf(stdout, "SYMBOL TABLES SUMMARY finish =======================================\n");
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* symbol_print_symbols()
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
static void symbol_print_symbols(const char *symboltabletype) {
|
||||
Node *table = symtabs;
|
||||
Iterator ki = First(table);
|
||||
while (ki.key) {
|
||||
String *k = ki.key;
|
||||
Printf(stdout, "===================================================\n");
|
||||
Printf(stdout, "%s -\n", k);
|
||||
{
|
||||
Symtab *symtab = Getattr(Getattr(table, k), symboltabletype);
|
||||
Iterator it = First(symtab);
|
||||
while (it.key) {
|
||||
String *symname = it.key;
|
||||
Printf(stdout, " %s\n", symname);
|
||||
it = Next(it);
|
||||
}
|
||||
}
|
||||
ki = Next(ki);
|
||||
}
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_symbol_print_symbols()
|
||||
*
|
||||
* Debug display of all the target language symbols
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void Swig_symbol_print_symbols(void) {
|
||||
Printf(stdout, "SYMBOLS start =======================================\n");
|
||||
symbol_print_symbols("symtab");
|
||||
Printf(stdout, "SYMBOLS finish =======================================\n");
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_symbol_print_csymbols()
|
||||
*
|
||||
* Debug display of all the C symbols
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void Swig_symbol_print_csymbols(void) {
|
||||
Printf(stdout, "CSYMBOLS start =======================================\n");
|
||||
symbol_print_symbols("csymtab");
|
||||
Printf(stdout, "CSYMBOLS finish =======================================\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_symbol_init()
|
||||
|
|
@ -200,7 +260,7 @@ void Swig_symbol_dump_symtable() {
|
|||
* Create a new symbol table object
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
void Swig_symbol_init() {
|
||||
void Swig_symbol_init(void) {
|
||||
|
||||
current = NewHash();
|
||||
current_symtab = NewHash();
|
||||
|
|
@ -244,7 +304,7 @@ void Swig_symbol_setscopename(const_String_or_char_ptr name) {
|
|||
* Get the C scopename of the current symbol table
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
String *Swig_symbol_getscopename() {
|
||||
String *Swig_symbol_getscopename(void) {
|
||||
return Getattr(current_symtab, "name");
|
||||
}
|
||||
|
||||
|
|
@ -299,7 +359,7 @@ String *Swig_symbol_qualifiedscopename(Symtab *symtab) {
|
|||
* Create a new scope. Returns the newly created scope.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
Symtab *Swig_symbol_newscope() {
|
||||
Symtab *Swig_symbol_newscope(void) {
|
||||
Hash *n;
|
||||
Hash *hsyms, *h;
|
||||
|
||||
|
|
@ -350,7 +410,7 @@ Symtab *Swig_symbol_setscope(Symtab *sym) {
|
|||
* scope to the parent scope.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
Symtab *Swig_symbol_popscope() {
|
||||
Symtab *Swig_symbol_popscope(void) {
|
||||
Hash *h = current_symtab;
|
||||
current_symtab = Getattr(current_symtab, "parentNode");
|
||||
assert(current_symtab);
|
||||
|
|
@ -361,13 +421,23 @@ Symtab *Swig_symbol_popscope() {
|
|||
return h;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_symbol_global_scope()
|
||||
*
|
||||
* Return the symbol table for the global scope.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
Symtab *Swig_symbol_global_scope(void) {
|
||||
return global_scope;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* Swig_symbol_current()
|
||||
*
|
||||
* Return the current symbol table.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
Symtab *Swig_symbol_current() {
|
||||
Symtab *Swig_symbol_current(void) {
|
||||
return current_symtab;
|
||||
}
|
||||
|
||||
|
|
@ -1002,6 +1072,8 @@ Node *Swig_symbol_clookup(const_String_or_char_ptr name, Symtab *n) {
|
|||
String *nname = NewString(cname + 2);
|
||||
if (Swig_scopename_check(nname)) {
|
||||
s = symbol_lookup_qualified(nname, global_scope, 0, 0, 0);
|
||||
} else {
|
||||
s = symbol_lookup(nname, global_scope, 0);
|
||||
}
|
||||
Delete(nname);
|
||||
} else {
|
||||
|
|
@ -1074,6 +1146,8 @@ Node *Swig_symbol_clookup_check(const_String_or_char_ptr name, Symtab *n, int (*
|
|||
String *nname = NewString(cname + 2);
|
||||
if (Swig_scopename_check(nname)) {
|
||||
s = symbol_lookup_qualified(nname, global_scope, 0, 0, checkfunc);
|
||||
} else {
|
||||
s = symbol_lookup(nname, global_scope, checkfunc);
|
||||
}
|
||||
Delete(nname);
|
||||
} else {
|
||||
|
|
@ -1138,6 +1212,8 @@ Node *Swig_symbol_clookup_local(const_String_or_char_ptr name, Symtab *n) {
|
|||
String *nname = NewString(cname + 2);
|
||||
if (Swig_scopename_check(nname)) {
|
||||
s = symbol_lookup_qualified(nname, global_scope, 0, 0, 0);
|
||||
} else {
|
||||
s = symbol_lookup(nname, global_scope, 0);
|
||||
}
|
||||
Delete(nname);
|
||||
} else {
|
||||
|
|
@ -1186,6 +1262,8 @@ Node *Swig_symbol_clookup_local_check(const_String_or_char_ptr name, Symtab *n,
|
|||
String *nname = NewString(cname + 2);
|
||||
if (Swig_scopename_check(nname)) {
|
||||
s = symbol_lookup_qualified(nname, global_scope, 0, 0, checkfunc);
|
||||
} else {
|
||||
s = symbol_lookup(nname, global_scope, checkfunc);
|
||||
}
|
||||
Delete(nname);
|
||||
} else {
|
||||
|
|
@ -1257,7 +1335,8 @@ void Swig_symbol_remove(Node *n) {
|
|||
Setattr(symtab, symname, symnext);
|
||||
fixovername = symnext; /* fix as symbol to remove is at head of linked list */
|
||||
} else {
|
||||
Delattr(symtab, symname);
|
||||
if (symname)
|
||||
Delattr(symtab, symname);
|
||||
}
|
||||
}
|
||||
if (symnext) {
|
||||
|
|
@ -1732,7 +1811,7 @@ ParmList *Swig_symbol_template_defargs(Parm *parms, Parm *targs, Symtab *tscope,
|
|||
ntq = ty;
|
||||
}
|
||||
/* Printf(stderr,"value %s %s %s\n",value,ntr,ntq); */
|
||||
cp = NewParm(ntq, 0);
|
||||
cp = NewParmWithoutFileLineInfo(ntq, 0);
|
||||
if (lp)
|
||||
set_nextSibling(lp, cp);
|
||||
else
|
||||
|
|
@ -1809,7 +1888,7 @@ SwigType *Swig_symbol_template_deftype(const SwigType *type, Symtab *tscope) {
|
|||
String *tprefix = SwigType_templateprefix(base);
|
||||
String *targs = SwigType_templateargs(base);
|
||||
String *tsuffix = SwigType_templatesuffix(base);
|
||||
ParmList *tparms = SwigType_function_parms(targs);
|
||||
ParmList *tparms = SwigType_function_parms(targs, 0);
|
||||
Node *tempn = Swig_symbol_clookup_local(tprefix, tscope);
|
||||
if (!tempn && tsuffix && Len(tsuffix)) {
|
||||
tempn = Swig_symbol_clookup(tprefix, 0);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ void Swig_print_tags(DOH *obj, DOH *root) {
|
|||
croot = root;
|
||||
|
||||
while (obj) {
|
||||
Printf(stdout, "%s . %s (%s:%d)\n", croot, nodeType(obj), Getfile(obj), Getline(obj));
|
||||
Swig_diagnostic(Getfile(obj), Getline(obj), "%s . %s\n", croot, nodeType(obj));
|
||||
cobj = firstChild(obj);
|
||||
if (cobj) {
|
||||
newroot = NewStringf("%s . %s", croot, nodeType(obj));
|
||||
|
|
@ -272,7 +272,7 @@ void Swig_require(const char *ns, Node *n, ...) {
|
|||
}
|
||||
obj = Getattr(n, name);
|
||||
if (!opt && !obj) {
|
||||
Printf(stderr, "%s:%d. Fatal error (Swig_require). Missing attribute '%s' in node '%s'.\n", Getfile(n), Getline(n), name, nodeType(n));
|
||||
Swig_error(Getfile(n), Getline(n), "Fatal error (Swig_require). Missing attribute '%s' in node '%s'.\n", name, nodeType(n));
|
||||
assert(obj);
|
||||
}
|
||||
if (!obj)
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -824,13 +824,15 @@ int SwigType_isfunction(SwigType *t) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
ParmList *SwigType_function_parms(SwigType *t) {
|
||||
/* Create a list of parameters from the type t, using the file_line_node Node for
|
||||
* file and line numbering for the parameters */
|
||||
ParmList *SwigType_function_parms(SwigType *t, Node *file_line_node) {
|
||||
List *l = SwigType_parmlist(t);
|
||||
Hash *p, *pp = 0, *firstp = 0;
|
||||
Iterator o;
|
||||
|
||||
for (o = First(l); o.item; o = Next(o)) {
|
||||
p = NewParm(o.item, 0);
|
||||
p = file_line_node ? NewParm(o.item, 0, file_line_node) : NewParmWithoutFileLineInfo(o.item, 0);
|
||||
if (!firstp)
|
||||
firstp = p;
|
||||
if (pp) {
|
||||
|
|
@ -893,11 +895,12 @@ SwigType *SwigType_add_template(SwigType *t, ParmList *parms) {
|
|||
* SwigType_templateprefix()
|
||||
*
|
||||
* Returns the prefix before the first template definition.
|
||||
* Returns the type unmodified if not a template.
|
||||
* For example:
|
||||
*
|
||||
* Foo<(p.int)>::bar
|
||||
*
|
||||
* returns "Foo"
|
||||
* Foo<(p.int)>::bar => Foo
|
||||
* r.q(const).Foo<(p.int)>::bar => r.q(const).Foo
|
||||
* Foo => Foo
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
String *SwigType_templateprefix(const SwigType *t) {
|
||||
|
|
@ -938,6 +941,25 @@ String *SwigType_templatesuffix(const SwigType *t) {
|
|||
return NewStringEmpty();
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SwigType_istemplate_templateprefix()
|
||||
*
|
||||
* Combines SwigType_istemplate and SwigType_templateprefix efficiently into one function.
|
||||
* Returns the prefix before the first template definition.
|
||||
* Returns NULL if not a template.
|
||||
* For example:
|
||||
*
|
||||
* Foo<(p.int)>::bar => Foo
|
||||
* r.q(const).Foo<(p.int)>::bar => r.q(const).Foo
|
||||
* Foo => NULL
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
String *SwigType_istemplate_templateprefix(const SwigType *t) {
|
||||
const char *s = Char(t);
|
||||
const char *c = strstr(s, "<(");
|
||||
return c ? NewStringWithSize(s, c - s) : 0;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------------------------------
|
||||
* SwigType_templateargs()
|
||||
*
|
||||
|
|
|
|||
|
|
@ -844,7 +844,8 @@ SwigType *SwigType_typedef_resolve_all(SwigType *t) {
|
|||
*
|
||||
* Given a type declaration, this function tries to fully qualify it according to
|
||||
* typedef scope rules.
|
||||
* Inconsistency to be fixed: ::Foo returns ::Foo, whereas ::Foo * returns Foo *
|
||||
* If the unary scope operator (::) is used as a prefix to the type to denote global
|
||||
* scope, it is left in place.
|
||||
* ----------------------------------------------------------------------------- */
|
||||
|
||||
SwigType *SwigType_typedef_qualified(SwigType *t) {
|
||||
|
|
@ -852,10 +853,6 @@ SwigType *SwigType_typedef_qualified(SwigType *t) {
|
|||
String *result;
|
||||
int i, len;
|
||||
|
||||
if (strncmp(Char(t), "::", 2) == 0) {
|
||||
return Copy(t);
|
||||
}
|
||||
|
||||
if (!typedef_qualified_cache)
|
||||
typedef_qualified_cache = NewHash();
|
||||
result = Getattr(typedef_qualified_cache, t);
|
||||
|
|
@ -1003,10 +1000,6 @@ SwigType *SwigType_typedef_qualified(SwigType *t) {
|
|||
Delete(qprefix);
|
||||
Delete(parms);
|
||||
}
|
||||
if (strncmp(Char(e), "::", 2) == 0) {
|
||||
Delitem(e, 0);
|
||||
Delitem(e, 0);
|
||||
}
|
||||
Append(result, e);
|
||||
Delete(ty);
|
||||
} else if (SwigType_isfunction(e)) {
|
||||
|
|
@ -1124,11 +1117,13 @@ int SwigType_typedef_using(const_String_or_char_ptr name) {
|
|||
/* Figure out the scope the using directive refers to */
|
||||
{
|
||||
prefix = Swig_scopename_prefix(name);
|
||||
s = SwigType_find_scope(current_scope, prefix);
|
||||
if (s) {
|
||||
Hash *ttab = Getattr(s, "typetab");
|
||||
if (!Getattr(ttab, base) && defined_name) {
|
||||
Setattr(ttab, base, defined_name);
|
||||
if (prefix) {
|
||||
s = SwigType_find_scope(current_scope, prefix);
|
||||
if (s) {
|
||||
Hash *ttab = Getattr(s, "typetab");
|
||||
if (!Getattr(ttab, base) && defined_name) {
|
||||
Setattr(ttab, base, defined_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1170,9 +1165,9 @@ int SwigType_isclass(SwigType *t) {
|
|||
isclass = 1;
|
||||
}
|
||||
/* Hmmm. Not a class. If a template, it might be uninstantiated */
|
||||
if (!isclass && SwigType_istemplate(qtys)) {
|
||||
String *tp = SwigType_templateprefix(qtys);
|
||||
if (Strcmp(tp, t) != 0) {
|
||||
if (!isclass) {
|
||||
String *tp = SwigType_istemplate_templateprefix(qtys);
|
||||
if (tp && Strcmp(tp, t) != 0) {
|
||||
isclass = SwigType_isclass(tp);
|
||||
}
|
||||
Delete(tp);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue