Revert rev 11187 "Merged with recent changes from trunk."

This reverts commit c595e4d90ebfd63eb55430c735bb121cf690bd59.

Conflicts:

	Source/Modules/c.cxx

From: William S Fulton <wsf@fultondesigns.co.uk>

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2008-maciekd@13033 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2012-05-06 01:13:16 +00:00
commit d6b81eb831
703 changed files with 9266 additions and 21128 deletions

View file

@ -34,18 +34,16 @@ extern "C" {
extern void scanner_ignore_typedef(void);
extern void scanner_last_id(int);
extern void scanner_clear_rename(void);
extern void scanner_set_location(String *file, int line);
extern void scanner_set_main_input_file(String *file);
extern String *scanner_get_main_input_file();
extern void scanner_set_location(String_or_char *, int line);
extern void Swig_cparse_follow_locators(int);
extern void start_inline(char *, int);
extern String *scanner_ccode;
extern int yylex(void);
extern int yylex();
/* parser.y */
extern SwigType *Swig_cparse_type(String *);
extern Node *Swig_cparse(File *);
extern Hash *Swig_cparse_features(void);
extern Hash *Swig_cparse_features();
extern void SWIG_cparse_set_compact_default_args(int defargs);
extern int SWIG_cparse_template_reduce(int treduce);

View file

@ -22,10 +22,7 @@ char cvsroot_cscanner_c[] = "$Id$";
static Scanner *scan = 0;
/* Global string containing C code. Used by the parser to grab code blocks */
String *scanner_ccode = 0;
/* The main file being parsed */
static String *main_input_file = 0;
DOHString *scanner_ccode = 0;
/* Error reporting/location information */
int cparse_line = 1;
@ -264,8 +261,10 @@ int yylook(void) {
while (1) {
if ((tok = Scanner_token(scan)) == 0)
return 0;
if (tok == SWIG_TOKEN_ERROR)
return 0;
if (tok == SWIG_TOKEN_ERROR) {
Swig_error(Scanner_file(scan), Scanner_errline(scan), Scanner_errmsg(scan));
continue;
}
cparse_start_line = Scanner_start_line(scan);
cparse_line = Scanner_line(scan);
cparse_file = Scanner_file(scan);
@ -442,7 +441,7 @@ int yylook(void) {
static int check_typedef = 0;
void scanner_set_location(String *file, int line) {
void scanner_set_location(String_or_char *file, int line) {
Scanner_set_location(scan,file,line-1);
}
@ -468,14 +467,6 @@ void scanner_next_token(int tok) {
next_token = tok;
}
void scanner_set_main_input_file(String *file) {
main_input_file = file;
}
String *scanner_get_main_input_file() {
return main_input_file;
}
/* ----------------------------------------------------------------------------
* int yylex()
*
@ -699,22 +690,10 @@ int yylex(void) {
termtoken = SWIG_TOKEN_LPAREN;
termvalue = "(";
break;
} else if (nexttok == SWIG_TOKEN_CODEBLOCK) {
termtoken = SWIG_TOKEN_CODEBLOCK;
termvalue = Char(Scanner_text(scan));
break;
} else if (nexttok == SWIG_TOKEN_LBRACE) {
termtoken = SWIG_TOKEN_LBRACE;
termvalue = "{";
break;
} else if (nexttok == SWIG_TOKEN_SEMI) {
} else if (nexttok == SWIG_TOKEN_SEMI) {
termtoken = SWIG_TOKEN_SEMI;
termvalue = ";";
break;
} else if (nexttok == SWIG_TOKEN_STRING) {
termtoken = SWIG_TOKEN_STRING;
termvalue = Swig_copy_string(Char(Scanner_text(scan)));
break;
} else if (nexttok == SWIG_TOKEN_ID) {
if (needspace) {
Append(s," ");
@ -880,14 +859,8 @@ int yylex(void) {
return (INLINE);
if (strcmp(yytext, "%typemap") == 0)
return (TYPEMAP);
if (strcmp(yytext, "%feature") == 0) {
/* The rename_active indicates we don't need the information of the
* following function's return type. This applied for %rename, so do
* %feature.
*/
rename_active = 1;
if (strcmp(yytext, "%feature") == 0)
return (FEATURE);
}
if (strcmp(yytext, "%except") == 0)
return (EXCEPT);
if (strcmp(yytext, "%importfile") == 0)

View file

@ -66,7 +66,7 @@ static void yyerror (const char *e) {
(void)e;
}
static Node *new_node(const_String_or_char_ptr tag) {
static Node *new_node(const String_or_char *tag) {
Node *n = NewHash();
set_nodeType(n,tag);
Setfile(n,cparse_file);
@ -203,7 +203,7 @@ static String *yyrename = 0;
static String *resolve_node_scope(String *cname);
Hash *Swig_cparse_features(void) {
Hash *Swig_cparse_features() {
static Hash *features_hash = 0;
if (!features_hash) features_hash = NewHash();
return features_hash;
@ -1002,68 +1002,6 @@ static void add_nested(Nested *n) {
}
}
/* Strips C-style and C++-style comments from string in-place. */
static void strip_comments(char *string) {
int state = 0; /*
* 0 - not in comment
* 1 - in c-style comment
* 2 - in c++-style comment
* 3 - in string
* 4 - after reading / not in comments
* 5 - after reading * in c-style comments
* 6 - after reading \ in strings
*/
char * c = string;
while (*c) {
switch (state) {
case 0:
if (*c == '\"')
state = 3;
else if (*c == '/')
state = 4;
break;
case 1:
if (*c == '*')
state = 5;
*c = ' ';
break;
case 2:
if (*c == '\n')
state = 0;
else
*c = ' ';
break;
case 3:
if (*c == '\"')
state = 0;
else if (*c == '\\')
state = 6;
break;
case 4:
if (*c == '/') {
*(c-1) = ' ';
*c = ' ';
state = 2;
} else if (*c == '*') {
*(c-1) = ' ';
*c = ' ';
state = 1;
} else
state = 0;
break;
case 5:
if (*c == '/')
state = 0;
*c = ' ';
break;
case 6:
state = 3;
break;
}
++c;
}
}
/* Dump all of the nested class declarations to the inline processor
* However. We need to do a few name replacements and other munging
* first. This function must be called before closing a class! */
@ -1115,9 +1053,6 @@ static Node *dump_nested(const char *parent) {
ret = retx;
*/
/* Strip comments - further code may break in presence of comments. */
strip_comments(Char(n->code));
/* Make all SWIG created typedef structs/unions/classes unnamed else
redefinition errors occur - nasty hack alert.*/
@ -1425,7 +1360,7 @@ static void default_arguments(Node *n) {
* Used by the parser to mark subtypes with extra information.
* ----------------------------------------------------------------------------- */
static void tag_nodes(Node *n, const_String_or_char_ptr attrname, DOH *value) {
static void tag_nodes(Node *n, const String_or_char *attrname, DOH *value) {
while (n) {
Setattr(n, attrname, value);
tag_nodes(firstChild(n), attrname, value);
@ -1951,19 +1886,14 @@ fragment_directive: FRAGMENT LPAREN fname COMMA kwargs RPAREN HBLOCK {
;
/* ------------------------------------------------------------
%includefile "filename" [option1="xyz", ...] [ declarations ]
%importfile "filename" [option1="xyz", ...] [ declarations ]
%includefile "filename" [ declarations ]
%importfile "filename" [ declarations ]
------------------------------------------------------------ */
include_directive: includetype options string LBRACKET {
$1.filename = Copy(cparse_file);
$1.line = cparse_line;
scanner_set_location(NewString($3),1);
if ($2) {
String *maininput = Getattr($2, "maininput");
if (maininput)
scanner_set_main_input_file(NewString(maininput));
}
} interface RBRACKET {
String *mname = 0;
$$ = $6;
@ -2360,25 +2290,21 @@ feature_directive : FEATURE LPAREN idstring RPAREN declarator cpp_const stringbr
String *val = $7 ? NewString($7) : NewString("1");
new_feature($3, val, 0, $5.id, $5.type, $5.parms, $6.qualifier);
$$ = 0;
scanner_clear_rename();
}
| FEATURE LPAREN idstring COMMA stringnum RPAREN declarator cpp_const SEMI {
String *val = Len($5) ? NewString($5) : 0;
new_feature($3, val, 0, $7.id, $7.type, $7.parms, $8.qualifier);
$$ = 0;
scanner_clear_rename();
}
| FEATURE LPAREN idstring featattr RPAREN declarator cpp_const stringbracesemi {
String *val = $8 ? NewString($8) : NewString("1");
new_feature($3, val, $4, $6.id, $6.type, $6.parms, $7.qualifier);
$$ = 0;
scanner_clear_rename();
}
| FEATURE LPAREN idstring COMMA stringnum featattr RPAREN declarator cpp_const SEMI {
String *val = Len($5) ? NewString($5) : 0;
new_feature($3, val, $6, $8.id, $8.type, $8.parms, $9.qualifier);
$$ = 0;
scanner_clear_rename();
}
/* Global feature */
@ -2386,25 +2312,21 @@ feature_directive : FEATURE LPAREN idstring RPAREN declarator cpp_const stringbr
String *val = $5 ? NewString($5) : NewString("1");
new_feature($3, val, 0, 0, 0, 0, 0);
$$ = 0;
scanner_clear_rename();
}
| FEATURE LPAREN idstring COMMA stringnum RPAREN SEMI {
String *val = Len($5) ? NewString($5) : 0;
new_feature($3, val, 0, 0, 0, 0, 0);
$$ = 0;
scanner_clear_rename();
}
| FEATURE LPAREN idstring featattr RPAREN stringbracesemi {
String *val = $6 ? NewString($6) : NewString("1");
new_feature($3, val, $4, 0, 0, 0, 0);
$$ = 0;
scanner_clear_rename();
}
| FEATURE LPAREN idstring COMMA stringnum featattr RPAREN SEMI {
String *val = Len($5) ? NewString($5) : 0;
new_feature($3, val, $6, 0, 0, 0, 0);
$$ = 0;
scanner_clear_rename();
}
;
@ -3230,15 +3152,15 @@ cpp_class_decl :
storage_class cpptype idcolon inherit LBRACE {
List *bases = 0;
Node *scope = 0;
$<node>$ = new_node("class");
Setline($<node>$,cparse_start_line);
Setattr($<node>$,"kind",$2);
$$ = new_node("class");
Setline($$,cparse_start_line);
Setattr($$,"kind",$2);
if ($4) {
Setattr($<node>$,"baselist", Getattr($4,"public"));
Setattr($<node>$,"protectedbaselist", Getattr($4,"protected"));
Setattr($<node>$,"privatebaselist", Getattr($4,"private"));
Setattr($$,"baselist", Getattr($4,"public"));
Setattr($$,"protectedbaselist", Getattr($4,"protected"));
Setattr($$,"privatebaselist", Getattr($4,"private"));
}
Setattr($<node>$,"allows_typedef","1");
Setattr($$,"allows_typedef","1");
/* preserve the current scope */
prev_symtab = Swig_symbol_current();
@ -3267,10 +3189,10 @@ cpp_class_decl :
nscope_inner = 0;
}
}
Setattr($<node>$,"name",$3);
Setattr($$,"name",$3);
Delete(class_rename);
class_rename = make_name($<node>$,$3,0);
class_rename = make_name($$,$3,0);
Classprefix = NewString($3);
/* Deal with inheritance */
if ($4) {
@ -3334,12 +3256,12 @@ cpp_class_decl :
} else {
max_class_levels *= 2;
}
class_decl = (Node**) realloc(class_decl, sizeof(Node*) * max_class_levels);
class_decl = realloc(class_decl, sizeof(Node*) * max_class_levels);
if (!class_decl) {
Swig_error(cparse_file, cparse_line, "realloc() failed\n");
}
}
class_decl[class_level++] = $<node>$;
class_decl[class_level++] = $$;
inclass = 1;
} cpp_members RBRACE cpp_opt_declarators {
Node *p;
@ -3462,14 +3384,14 @@ cpp_class_decl :
| storage_class cpptype LBRACE {
String *unnamed;
unnamed = make_unnamed();
$<node>$ = new_node("class");
Setline($<node>$,cparse_start_line);
Setattr($<node>$,"kind",$2);
Setattr($<node>$,"storage",$1);
Setattr($<node>$,"unnamed",unnamed);
Setattr($<node>$,"allows_typedef","1");
$$ = new_node("class");
Setline($$,cparse_start_line);
Setattr($$,"kind",$2);
Setattr($$,"storage",$1);
Setattr($$,"unnamed",unnamed);
Setattr($$,"allows_typedef","1");
Delete(class_rename);
class_rename = make_name($<node>$,0,0);
class_rename = make_name($$,0,0);
if (strcmp($2,"class") == 0) {
cplus_mode = CPLUS_PRIVATE;
} else {
@ -3483,12 +3405,12 @@ cpp_class_decl :
} else {
max_class_levels *= 2;
}
class_decl = (Node**) realloc(class_decl, sizeof(Node*) * max_class_levels);
class_decl = realloc(class_decl, sizeof(Node*) * max_class_levels);
if (!class_decl) {
Swig_error(cparse_file, cparse_line, "realloc() failed\n");
}
}
class_decl[class_level++] = $<node>$;
class_decl[class_level++] = $$;
inclass = 1;
Classprefix = NewStringEmpty();
Delete(Namespaceprefix);
@ -5492,18 +5414,7 @@ valexpr : exprnum { $$ = $1; }
| LPAREN expr RPAREN expr %prec CAST {
$$ = $4;
if ($4.type != T_STRING) {
switch ($2.type) {
case T_FLOAT:
case T_DOUBLE:
case T_LONGDOUBLE:
case T_FLTCPLX:
case T_DBLCPLX:
$$.val = NewStringf("(%s)%s", $2.val, $4.val); /* SwigType_str and decimal points don't mix! */
break;
default:
$$.val = NewStringf("(%s) %s", SwigType_str($2.val,0), $4.val);
break;
}
$$.val = NewStringf("(%s) %s", SwigType_str($2.val,0), $4.val);
}
}
| LPAREN expr pointer RPAREN expr %prec CAST {

View file

@ -15,7 +15,7 @@ char cvsroot_templ_c[] = "$Id$";
static int template_debug = 0;
const char *baselists[3];
String *baselists[3];
void SwigType_template_init() {
baselists[0] = "baselist";
@ -167,21 +167,18 @@ static int cparse_template_expand(Node *n, String *tname, String *rname, String
add_parms(Getattr(n, "throws"), cpatchlist, typelist);
} else if (Equal(nodeType, "destructor")) {
String *name = Getattr(n, "name");
if (name) {
if (strchr(Char(name), '<'))
Append(patchlist, Getattr(n, "name"));
else
Append(name, templateargs);
if (name && strchr(Char(name), '<')) {
Append(patchlist, Getattr(n, "name"));
} else {
Append(name, templateargs);
}
name = Getattr(n, "sym:name");
if (name) {
if (strchr(Char(name), '<')) {
String *sn = Copy(tname);
Setattr(n, "sym:name", sn);
Delete(sn);
} else {
Replace(name, tname, rname, DOH_REPLACE_ANY);
}
if (name && strchr(Char(name), '<')) {
String *sn = Copy(tname);
Setattr(n, "sym:name", sn);
Delete(sn);
} else {
Replace(name, tname, rname, DOH_REPLACE_ANY);
}
/* Setattr(n,"sym:name",name); */
Append(cpatchlist, Getattr(n, "code"));

View file

@ -92,12 +92,12 @@ DohEncoding(name, fn) Register a format encoding for Printf
Currently Available datatypes
------------------------------
NewString(char *initial) Strings
NewHash() Hash
NewList() List
NewVoid(void *ptr, void (*del)(void *)) Void
NewFile(char *filename, char *mode, List *newfiles) File
NewCallable(DOH *(*func)(DOH *, DOH *)) Callable object
NewString(char *initial) Strings
NewHash() Hash
NewList() List
NewVoid(void *ptr, void (*del)(void *)) Void
NewFile(char *file, char *mode) File
NewCallable(DOH *(*func)(DOH *, DOH *)) Callable object
Odds and ends:

View file

@ -827,7 +827,7 @@ void DohSetfile(DOH *ho, DOH *file) {
/* -----------------------------------------------------------------------------
* DohGetFile()
* ----------------------------------------------------------------------------- */
DOH *DohGetfile(const DOH *ho) {
DOH *DohGetfile(DOH *ho) {
DohBase *h = (DohBase *) ho;
DohObjInfo *objinfo;
if (!h)
@ -854,7 +854,7 @@ void DohSetline(DOH *ho, int l) {
/* -----------------------------------------------------------------------------
* DohGetLine()
* ----------------------------------------------------------------------------- */
int DohGetline(const DOH *ho) {
int DohGetline(DOH *ho) {
DohBase *h = (DohBase *) ho;
DohObjInfo *objinfo;
if (!h)

View file

@ -144,9 +144,6 @@ typedef void DOH;
#define DOHString_or_char DOH
#define DOHObj_or_char DOH
typedef const DOHString_or_char * const_String_or_char_ptr;
typedef const DOHString_or_char * DOHconst_String_or_char_ptr;
#define DOH_BEGIN -1
#define DOH_END -2
#define DOH_CUR -3
@ -237,9 +234,9 @@ extern DohIterator DohNext(DohIterator x);
/* Positional */
extern int DohGetline(const DOH *obj);
extern int DohGetline(DOH *obj);
extern void DohSetline(DOH *obj, int line);
extern DOH *DohGetfile(const DOH *obj);
extern DOH *DohGetfile(DOH *obj);
extern void DohSetfile(DOH *obj, DOH *file);
/* String Methods */
@ -274,7 +271,7 @@ extern int DohGetmark(DOH *obj);
* Strings.
* ----------------------------------------------------------------------------- */
extern DOHString *DohNewStringEmpty(void);
extern DOHString *DohNewStringEmpty();
extern DOHString *DohNewString(const DOH *c);
extern DOHString *DohNewStringWithSize(const DOH *c, int len);
extern DOHString *DohNewStringf(const DOH *fmt, ...);
@ -300,7 +297,7 @@ extern char *DohStrchr(const DOHString_or_char *s1, int ch);
* Files
* ----------------------------------------------------------------------------- */
extern DOHFile *DohNewFile(DOH *filename, const char *mode, DOHList *outfiles);
extern DOHFile *DohNewFile(DOH *file, const char *mode);
extern DOHFile *DohNewFileFromFile(FILE *f);
extern DOHFile *DohNewFileFromFd(int fd);
extern void DohFileErrorDisplay(DOHString * filename);
@ -312,14 +309,14 @@ extern int DohCopyto(DOHFile * input, DOHFile * output);
* List
* ----------------------------------------------------------------------------- */
extern DOHList *DohNewList(void);
extern DOHList *DohNewList();
extern void DohSortList(DOH *lo, int (*cmp) (const DOH *, const DOH *));
/* -----------------------------------------------------------------------------
* Hash
* ----------------------------------------------------------------------------- */
extern DOHHash *DohNewHash(void);
extern DOHHash *DohNewHash();
/* -----------------------------------------------------------------------------
* Void

View file

@ -228,16 +228,15 @@ static DohObjInfo DohFileType = {
* NewFile()
*
* Create a new file from a given filename and mode.
* If newfiles is non-zero, the filename is added to the list of new files.
* ----------------------------------------------------------------------------- */
DOH *DohNewFile(DOH *filename, const char *mode, DOHList *newfiles) {
DOH *DohNewFile(DOH *fn, const char *mode) {
DohFile *f;
FILE *file;
char *filen;
char *filename;
filen = Char(filename);
file = fopen(filen, mode);
filename = Char(fn);
file = fopen(filename, mode);
if (!file)
return 0;
@ -246,8 +245,6 @@ DOH *DohNewFile(DOH *filename, const char *mode, DOHList *newfiles) {
fclose(file);
return 0;
}
if (newfiles)
Append(newfiles, filename);
f->filep = file;
f->fd = 0;
f->closeondel = 1;

View file

@ -535,7 +535,7 @@ DohObjInfo DohHashType = {
* Create a new hash table.
* ----------------------------------------------------------------------------- */
DOH *DohNewHash(void) {
DOH *DohNewHash() {
Hash *h;
int i;
h = (Hash *) DohMalloc(sizeof(Hash));

View file

@ -345,7 +345,7 @@ DohObjInfo DohListType = {
#define MAXLISTITEMS 8
DOH *DohNewList(void) {
DOH *DohNewList() {
List *l;
int i;
l = (List *) DohMalloc(sizeof(List));

View file

@ -1056,7 +1056,7 @@ DOHString *DohNewString(const DOH *so) {
* NewStringEmpty() - Create a new string
* ----------------------------------------------------------------------------- */
DOHString *DohNewStringEmpty(void) {
DOHString *DohNewStringEmpty() {
int max = INIT_MAXSIZE;
String *str = (String *) DohMalloc(sizeof(String));
str->hashkey = 0;

View file

@ -49,7 +49,6 @@
#define WARN_DEPRECATED_NOEXTERN 122
#define WARN_DEPRECATED_NODEFAULT 123
#define WARN_DEPRECATED_TYPEMAP_LANG 124
#define WARN_DEPRECATED_INPUT_FILE 125
/* -- Preprocessor -- */
@ -248,21 +247,15 @@
/* please leave 850-869 free for Modula 3 */
/* These are needed for backward compatibility, but you don't need to add
* PHP4 versions of new warnings since existing user interface files can't
* be using them.
*/
#define WARN_PHP_MULTIPLE_INHERITANCE 870
#define WARN_PHP_UNKNOWN_PRAGMA 871
#define WARN_PHP4_MULTIPLE_INHERITANCE 870
#define WARN_PHP4_UNKNOWN_PRAGMA 871
#define WARN_PHP_MULTIPLE_INHERITANCE 870
#define WARN_PHP_UNKNOWN_PRAGMA 871
/* please leave 870-889 free for Php */
/* please leave 870-889 free for PHP */
#define WARN_C_TYPEMAP_CTYPE_UNDEF 890
/* please leave 890-909 free for C */
#define WARN_C_TYPEMAP_CTYPE_UNDEF 890
/* Feel free to claim any number in this space that's not currently being used. Just make sure you
add an entry here */

View file

@ -38,11 +38,11 @@ eswig_SOURCES = CParse/cscanner.c \
Modules/allegrocl.cxx \
Modules/allocate.cxx \
Modules/browser.cxx \
Modules/c.cxx \
Modules/cffi.cxx \
Modules/chicken.cxx \
Modules/clisp.cxx \
Modules/contract.cxx \
Modules/c.cxx \
Modules/csharp.cxx \
Modules/directors.cxx \
Modules/emit.cxx \
@ -58,7 +58,7 @@ eswig_SOURCES = CParse/cscanner.c \
Modules/octave.cxx \
Modules/overload.cxx \
Modules/perl5.cxx \
Modules/php.cxx \
Modules/php4.cxx \
Modules/pike.cxx \
Modules/python.cxx \
Modules/r.cxx \

View file

@ -21,8 +21,7 @@ char cvsroot_allegrocl_cxx[] = "$Id$";
static File *f_cl = 0;
String *f_clhead = NewString("");
String *f_clwrap = NewString("(swig-in-package ())\n\n");
static File *f_begin;
static File *f_runtime;
static File *f_cxx;
static File *f_cxx_header = 0;
static File *f_cxx_wrapper = 0;
@ -35,8 +34,6 @@ static bool CWrap = true; // generate wrapper file for C code by default. most c
static bool Generate_Wrapper = false;
static bool unique_swig_package = false;
static SwigType *fwdref_ffi_type = NewString("__SWIGACL_FwdReference");
static String *current_namespace = NewString("");
static String *current_package = NewString("");
static Hash *defined_namespace_packages = NewHash();
@ -171,7 +168,6 @@ static String *namespace_of(String *str) {
void add_linked_type(Node *n) {
#ifdef ALLEGROCL_CLASS_DEBUG
Printf(stderr, "Adding linked node of type: %s(%s) %s(%x)\n\n", nodeType(n), Getattr(n, "storage"), Getattr(n, "name"), n);
// Swig_print_node(n);
#endif
if (!first_linked_type) {
first_linked_type = n;
@ -301,8 +297,7 @@ void add_forward_referenced_type(Node *n, int overwrite = 0) {
}
}
void add_defined_foreign_type(Node *n, int overwrite = 0, String *k = 0,
String *name = 0, String *ns = current_namespace) {
void add_defined_foreign_type(Node *n, int overwrite = 0, String *k = 0, String *name = 0, String *ns = current_namespace) {
String *val;
String *ns_list = listify_namespace(ns);
@ -326,34 +321,22 @@ void add_defined_foreign_type(Node *n, int overwrite = 0, String *k = 0,
/*
For typedefs of the form:
typedef struct __xxx { ... } xxx;
typedef __xxx { ... } xxx;
behavior differs between C mode and C++ mode.
C Mode:
add_defined_foreign_type will be called once via classHandler
to define the type for 'struct __xxx' and add the mapping from
'struct __xxx' -> 'xxx'
to define the type for 'struct __xxx', and once via typedefHandler
to associate xxx with 'struct __xxx'.
It will also be called once via typedefHandler to add the
mapping 'xxx' -> 'xxx'
We create the following type to identifier mappings:
C++ Mode:
add_defined_foreign_type will be called once via classHandler
to define the type for 'xxx'. it also adds the mapping from
'xxx' -> 'xxx' and also for 'struct xxx' -> 'xxx'
struct __xxx -> (swig-insert-id "xxx") via classHand
xxx -> (swig-insert-id "xxx") via typedefHand
In typedefHandler, we again try to add the mapping from
'xxx' -> 'xxx', which already exists. This second mapping
is ignored.
and all references to this typedef'd struct will appear in
generated code as 'xxx'. For non-typedef'd structs, the
classHand mapping will be
Both modes:
All references to this typedef'd struct will appear in
generated lisp code as an objectd of type 'xxx'. For
non-typedef'd structs, the classHand mapping will be
struct __xxx -> (swig-insert-id "__xxx")
struct __xxx -> (swig-insert-id "__xxx")
*/
// Swig_print_node(n);
String *unnamed = Getattr(n, "unnamed");
@ -602,11 +585,7 @@ void add_defined_foreign_type(Node *n, int overwrite = 0, String *k = 0,
Delete(mangled_name_gen);
Delete(mangled_lname_gen);
} else {
if (!CPlusPlus || Strcmp(Getattr(n,"kind"),"typedef")) {
Swig_warning(WARN_TYPE_REDEFINED, Getfile(n), Getline(n),
"Attempting to store a foreign type that exists: %s (%s)\n",
k, val);
}
Swig_warning(WARN_TYPE_REDEFINED, Getfile(n), Getline(n), "Attempting to store a foreign type that exists: %s (%s)\n", k, val);
}
Delete(ns_list);
@ -626,7 +605,7 @@ void note_implicit_template_instantiation(SwigType *t) {
add_defined_foreign_type(0, 0, t, t, implicit_ns ? implicit_ns : current_namespace);
}
String *get_ffi_type(SwigType *ty, const_String_or_char_ptr name) {
String *get_ffi_type(SwigType *ty, const String_or_char *name) {
/* lookup defined foreign type.
if it exists, it will return a form suitable for placing
into lisp code to generate the def-foreign-type name */
@ -641,8 +620,7 @@ String *get_ffi_type(SwigType *ty, const_String_or_char_ptr name) {
#ifdef ALLEGROCL_TYPE_DEBUG
Printf(stderr, "found_type '%s'\n", found_type);
#endif
return (Strcmp(found_type, "forward-reference") ? Copy(found_type) :
get_ffi_type(fwdref_ffi_type, ""));
return (Strcmp(found_type, "forward-reference") ? Copy(found_type) : NewString(":void"));
} else {
Hash *typemap = Swig_typemap_search("ffitype", ty, name, 0);
@ -729,39 +707,25 @@ String *internal_compose_foreign_type(SwigType *ty) {
if (res)
Printf(ffiType, "%s", res);
}
// while(resolved_type) {
// // the resolved_type may expand into something like p.NS1::NS2::SomeType
// // for which get_ffi_type will not find any match (due to the p.).
// // Printf(stderr, "\n in resolved type loop on '%s'\n", resolved_type);
// res = get_ffi_type(resolved_type, "");
// if (res) {
// Printf(ffiType, "%s", res);
// break;
// } else {
// resolved_type = SwigType_typedef_resolve(resolved_type);
// }
// }
if (!res) {
String *is_struct = 0;
String *tok_remove_text = 0;
String *tok_name = Copy(tok);
String *tok_key = SwigType_str(tok,0);
if ((is_struct = Strstr(tok_key, "struct ")) || Strstr(tok_key, "union ")) {
tok_remove_text = NewString(is_struct ? "struct " : "union ");
if (Strstr(tok, "struct ")) {
Swig_warning(WARN_TYPE_UNDEFINED_CLASS, Getfile(tok), Getline(tok), "Unable to find definition of '%s', assuming forward reference.\n", tok);
} else {
Printf(stderr, "Unable to compose foreign type of: '%s'\n", tok);
}
/* be more permissive of opaque types. This is the swig way.
compiles will notice if these types are ultimately not
present. */
if(tok_remove_text) {
Replaceall(tok_name,tok_remove_text,"");
}
tok_name = strip_namespaces(tok_name);
Delete(tok_remove_text);
// Swig_warning(WARN_TYPE_UNDEFINED_CLASS, Getfile(tok), Getline(tok), "Unable to find definition of '%s', assuming forward reference.\n", tok);
#ifdef ALLEGROCL_TYPE_DEBUG
Printf(stderr, "i-c-f-t: adding forward reference for unknown type '%s'. mapping: %s -> %s\n", tok, tok_key, tok_name);
#endif
Node *nn = NewHash();
Setattr(nn,"nodeType","classforward");
Setattr(nn,"kind","class");
Setattr(nn,"sym:name",tok_name);
Setattr(nn,"name",tok_key);
Setattr(nn,"allegrocl:package",current_namespace);
add_forward_referenced_type(nn, 0);
Printf(ffiType, "%s", get_ffi_type(tok, ""), tok_name);
Printf(ffiType, "(* :void)");
}
}
}
@ -769,36 +733,24 @@ String *internal_compose_foreign_type(SwigType *ty) {
return ffiType;
}
String *compose_foreign_type(SwigType *ty, String * /*id*/ = 0) {
/* Hash *lookup_res = Swig_typemap_search("ffitype", ty, id, 0); */
String *compose_foreign_type(SwigType *ty, String *id = 0) {
Hash *lookup_res = Swig_typemap_search("ffitype", ty, id, 0);
#ifdef ALLEGROCL_TYPE_DEBUG
Printf(stderr, "compose_foreign_type: ENTER (%s)...\n ", ty);
// Printf(stderr, "compose_foreign_type: ENTER (%s)(%s)...\n ", ty, (id ? id : 0));
/* String *id_ref = SwigType_str(ty, id);
String *id_ref = SwigType_str(ty, id);
Printf(stderr, "looking up typemap for %s, found '%s'(%x)\n",
id_ref, lookup_res ? Getattr(lookup_res, "code") : 0, lookup_res);
if (lookup_res) Swig_print_node(lookup_res);
*/
#endif
/* should we allow named lookups in the typemap here? YES! */
/* unnamed lookups should be found in get_ffi_type, called
by internal_compose_foreign_type(), below. */
/* I'm reverting to 'no' for the question above. I can no longer
remember why I needed it. If a user needed it, I'll find out
as soon as they upgrade. Sigh. -mutandiz 9/16/2008. */
/*
if(id && lookup_res) {
#ifdef ALLEGROCL_TYPE_DEBUG
Printf(stderr, "compose_foreign_type: EXIT-1 (%s)\n ", Getattr(lookup_res, "code"));
#endif
return NewString(Getattr(lookup_res, "code"));
}
*/
SwigType *temp = SwigType_strip_qualifiers(ty);
String *res = internal_compose_foreign_type(temp);
@ -876,10 +828,6 @@ String *strip_parens(String *string) {
}
int ALLEGROCL::validIdentifier(String *s) {
#ifdef ALLEGROCL_DEBUG
Printf(stderr, "validIdentifier %s\n", s);
#endif
char *c = Char(s);
bool got_dot = false;
@ -1006,7 +954,6 @@ String *convert_literal(String *literal, String *type, bool try_to_split) {
Delete(num);
num = 0;
}
Delete(lisp_exp);
} else {
String *id = NewStringf("#.(swig-insert-id \"%s\" %s :type :constant)",
num, ns);
@ -1137,8 +1084,7 @@ void emit_synonym(Node *synonym) {
of_ltype = lookup_defined_foreign_ltype(of_name);
// Printf(f_clhead,";; from emit-synonym\n");
if( of_ltype )
Printf(f_clhead, "(swig-def-synonym-type %s\n %s\n %s)\n", syn_ltype, of_ltype, syn_type);
Printf(f_clhead, "(swig-def-synonym-type %s\n %s\n %s)\n", syn_ltype, of_ltype, syn_type);
Delete(synonym_ns);
Delete(of_ns_list);
@ -1338,6 +1284,7 @@ void emit_typedef(Node *n) {
// leave these in for now. might want to change these to def-foreign-class at some point.
// Printf(f_clhead, ";; %s\n", SwigType_typedef_resolve_all(lisp_type));
// Swig_print_node(n);
Printf(f_clhead, "(swig-def-foreign-type \"%s\"\n %s)\n", name, lisp_type);
Delete(name);
@ -1521,7 +1468,6 @@ extern "C" Language *swig_allegrocl(void) {
void ALLEGROCL::main(int argc, char *argv[]) {
int i;
Preprocessor_define("SWIGALLEGROCL 1", 0);
SWIG_library_directory("allegrocl");
SWIG_config_file("allegrocl.swg");
@ -1569,10 +1515,7 @@ void ALLEGROCL::main(int argc, char *argv[]) {
"\tcalled to convert identifiers to symbols.\n"
"\n"
" -[no]cwrap\n"
"\tTurn on or turn off generation of an intermediate C file when\n" "\tcreating a C interface. By default this is only done for C++ code.\n"
" -isolate\n"
"Define all SWIG helper functions in a package unique to this module. Avoids redefinition warnings when loading multiple SWIGged modules\n"
"into the same running Allegro CL image.\n");
"\tTurn on or turn off generation of an intermediate C file when\n" "\tcreating a C interface. By default this is only done for C++ code.\n");
}
@ -1588,9 +1531,9 @@ int ALLEGROCL::top(Node *n) {
swig_package = unique_swig_package ? NewStringf("swig.%s", module_name) : NewString("swig");
Printf(cl_filename, "%s%s.cl", SWIG_output_directory(), module_name);
Printf(cl_filename, "%s%s.cl", SWIG_output_directory(), Swig_file_basename(Getattr(n,"infile")));
f_cl = NewFile(cl_filename, "w", SWIG_output_files());
f_cl = NewFile(cl_filename, "w");
if (!f_cl) {
Printf(stderr, "Unable to open %s for writing\n", cl_filename);
SWIG_exit(EXIT_FAILURE);
@ -1599,42 +1542,33 @@ int ALLEGROCL::top(Node *n) {
Generate_Wrapper = CPlusPlus || CWrap;
if (Generate_Wrapper) {
f_begin = NewFile(cxx_filename, "w", SWIG_output_files());
if (!f_begin) {
f_cxx = NewFile(cxx_filename, "w");
if (!f_cxx) {
Close(f_cl);
Delete(f_cl);
Printf(stderr, "Unable to open %s for writing\n", cxx_filename);
SWIG_exit(EXIT_FAILURE);
}
} else
f_begin = NewString("");
f_cxx = NewString("");
f_runtime = NewString("");
f_cxx_header = f_runtime;
f_cxx_header = f_cxx;
f_cxx_wrapper = NewString("");
Swig_register_filebyname("header", f_cxx_header);
Swig_register_filebyname("wrapper", f_cxx_wrapper);
Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("runtime", f_runtime);
Swig_register_filebyname("runtime", f_cxx);
Swig_register_filebyname("lisp", f_clwrap);
Swig_register_filebyname("lisphead", f_cl);
Swig_banner(f_begin);
Printf(f_runtime, "\n");
Printf(f_runtime, "#define SWIGALLEGROCL\n");
Printf(f_runtime, "\n");
Swig_banner_target_lang(f_cl, ";;");
Printf(f_cl, "\n"
Printf(f_cl, ";; This is an automatically generated file. Make changes in\n"
";; the definition file, not here.\n\n"
"(defpackage :%s\n"
" (:use :common-lisp :ff :excl)\n"
" (:export #:*swig-identifier-converter* #:*swig-module-name*\n"
" #:*void* #:*swig-export-list*))\n"
"(in-package :%s)\n\n"
"(eval-when (:compile-toplevel :load-toplevel :execute)\n"
"(eval-when (compile load eval)\n"
" (defparameter *swig-identifier-converter* '%s)\n"
" (defparameter *swig-module-name* :%s))\n\n", swig_package, swig_package, identifier_converter, module_name);
Printf(f_cl, "(defpackage :%s\n" " (:use :common-lisp :%s :ff :excl))\n\n", module_name, swig_package);
@ -1645,7 +1579,7 @@ int ALLEGROCL::top(Node *n) {
Language::top(n);
// SwigType_emit_type_table(f_runtime,f_cxx_wrapper);
// SwigType_emit_type_table(f_cxx,f_cxx_wrapper);
// Swig_print_tree(n);
#ifdef ALLEGROCL_TYPE_DEBUG
@ -1668,12 +1602,8 @@ int ALLEGROCL::top(Node *n) {
Delete(f_clhead);
Delete(f_clwrap);
Dump(f_runtime, f_begin);
Printf(f_begin, "%s\n", f_cxx_wrapper);
Close(f_begin);
Delete(f_runtime);
Delete(f_begin);
Close(f_cxx);
Delete(f_cxx);
Delete(f_cxx_wrapper);
// Swig_print_tree(n);
@ -1968,7 +1898,7 @@ int any_varargs(ParmList *pl) {
return 0;
}
String *get_lisp_type(SwigType *ty, const_String_or_char_ptr name) {
String *get_lisp_type(SwigType *ty, const String_or_char *name) {
Hash *typemap = Swig_typemap_search("lisptype", ty, name, 0);
if (typemap) {
String *typespec = Getattr(typemap, "code");
@ -2154,9 +2084,7 @@ struct IDargs {
String *arity;
IDargs():name(0), type(0), klass(0), arity(0) {
}
String *full_quoted_str() {
} String *full_quoted_str() {
String *result = no_others_quoted_str();
if (arity)
Printf(result, " :arity %s", arity);
@ -2407,24 +2335,41 @@ int ALLEGROCL::emit_defun(Node *n, File *fcl) {
for (p = pl; p; p = nextSibling(p), argnum++, largnum++) {
// SwigType *argtype=Getattr(p, "type");
SwigType *argtype = Swig_cparse_type(Getattr(p, "tmap:ctype"));
SwigType *parmtype = Getattr(p,"type");
if (!first) {
Printf(fcl, "\n ");
}
/* by default, skip varargs */
if (!SwigType_isvarargs(parmtype)) {
if (SwigType_isvarargs(argtype)) {
Printf(stderr, "Function %s (line %d) contains varargs, which is not directly supported. Use %%varargs instead.\n", Getattr(n, "name"), Getline(n));
} else {
String *argname = NewStringf("PARM%d_%s", largnum, Getattr(p, "name"));
// Swig_print_node(p);
// Printf(stderr,"%s\n", Getattr(p,"tmap:lin"));
String *ffitype = compose_foreign_type(argtype, Getattr(p,"name"));
String *deref_ffitype = dereference_ffitype(ffitype);
String *lisptype = get_lisp_type(parmtype, Getattr(p, "name"));
String *deref_ffitype;
deref_ffitype = dereference_ffitype(ffitype);
/*
String *temp = Copy(argtype);
if (SwigType_ispointer(temp)) {
SwigType_pop(temp);
deref_ffitype = compose_foreign_type(temp);
} else {
deref_ffitype = Copy(ffitype);
}
Delete(temp);
*/
// String *lisptype=get_lisp_type(argtype, argname);
String *lisptype = get_lisp_type(Getattr(p, "type"), Getattr(p, "name"));
#ifdef ALLEGROCL_DEBUG
Printf(stderr, "lisptype of '%s' '%s' = '%s'\n", parmtype,
Getattr(p, "name"), lisptype);
Printf(stderr, "lisptype of '%s' '%s' = '%s'\n",
Getattr(p, "type"), Getattr(p, "name"), lisptype);
#endif
// while we're walking the parameters, generating LIN
@ -2455,9 +2400,7 @@ int ALLEGROCL::emit_defun(Node *n, File *fcl) {
first = 0;
}
Delete(argname);
Delete(ffitype);
Delete(deref_ffitype);
Delete(lisptype);
}
}
@ -2495,6 +2438,11 @@ int ALLEGROCL::emit_defun(Node *n, File *fcl) {
lclass = lookup_defined_foreign_ltype(cl_t);
isPtrReturn = 1;
}
// if (SwigType_ispointer(cl_t)) {
// isPtrReturn = 1;
// SwigType_pop(cl_t);
// lclass = lookup_defined_foreign_ltype(cl_t);
// }
int ff_foreign_ptr = 0;
if (!lclass) {
@ -2567,16 +2515,9 @@ int ALLEGROCL::emit_defun(Node *n, File *fcl) {
}
int ALLEGROCL::functionWrapper(Node *n) {
#ifdef ALLEGROCL_DEBUG
Printf(stderr, "functionWrapper %s\n", Getattr(n,"name"));
Swig_print_node(n);
#endif
ParmList *parms = CopyParmList(Getattr(n, "parms"));
Wrapper *f = NewWrapper();
SwigType *t = Getattr(n, "type");
String *name = Getattr(n, "name");
String *raw_return_type = Swig_typemap_lookup("ctype", n, "", 0);
SwigType *return_type = Swig_cparse_type(raw_return_type);
@ -2586,13 +2527,11 @@ int ALLEGROCL::functionWrapper(Node *n) {
Delete(resolved);
if (!is_void_return) {
String *lresult_init =
NewStringf("= (%s)0",
SwigType_str(SwigType_strip_qualifiers(return_type),0));
Wrapper_add_localv(f, "lresult",
SwigType_lstr(SwigType_ltype(return_type), "lresult"),
lresult_init, NIL);
Delete(lresult_init);
String *lresult_init = NewStringf("= (%s)0", raw_return_type);
Wrapper_add_localv(f, "lresult",
SwigType_lstr(SwigType_ltype(return_type), "lresult"),
lresult_init, NIL);
Delete(lresult_init);
}
// Emit all of the local variables for holding arguments.
emit_parameter_variables(parms, f);
@ -2617,7 +2556,7 @@ int ALLEGROCL::functionWrapper(Node *n) {
if (Getattr(n, "overload:ignore")) {
// if we're the last overload, make sure to force the emit
// of the rest of the overloads before we leave.
Printf(stderr, "ignored overload %s(%x)\n", name, Getattr(n, "sym:nextSibling"));
Printf(stderr, "ignored overload %s(%x)\n", Getattr(n, "name"), Getattr(n, "sym:nextSibling"));
if (!Getattr(n, "sym:nextSibling")) {
update_package_if_needed(n);
emit_buffered_defuns(n);
@ -2632,7 +2571,7 @@ int ALLEGROCL::functionWrapper(Node *n) {
int gencomma = 0;
#ifdef ALLEGROCL_DEBUG
Printf(stderr, "Walking parameters for %s '%s'\n", Getattr(n, "allegrocl:kind"), name);
Printf(stderr, "Walking parameters for %s '%s'\n", Getattr(n, "allegrocl:kind"), Getattr(n, "name"));
#endif
// Now walk the function parameter list and generate code to get arguments
String *name_and_parms = NewStringf("%s (", mangled);
@ -2686,34 +2625,24 @@ int ALLEGROCL::functionWrapper(Node *n) {
String *actioncode = emit_action(n);
String *tm = Swig_typemap_lookup_out("out", n, "result", f, actioncode);
if (!is_void_return && tm) {
if (tm) {
Replaceall(tm, "$result", "lresult");
Printf(f->code, "%s\n", tm);
Printf(f->code, " return lresult;\n");
Delete(tm);
} else {
Swig_warning(WARN_TYPEMAP_OUT_UNDEF, input_file, line_number,
"Unable to use return type %s in function %s.\n",
SwigType_str(t, 0), name);
}
}
emit_return_variable(n, t, f);
String *result_convert = Swig_typemap_lookup_out("out", n, "result", f, actioncode);
Replaceall(result_convert, "$result", "lresult");
Printf(f->code, "%s\n", result_convert);
Printf(f->code, " return lresult;\n");
Delete(result_convert);
emit_return_variable(n, Getattr(n, "type"), f);
if (CPlusPlus) {
Printf(f->code, " } catch (...) {\n");
if (!is_void_return)
Printf(f->code, " return (%s)0;\n",
SwigType_str(SwigType_strip_qualifiers(return_type),0));
Printf(f->code, " return (%s)0;\n", raw_return_type);
Printf(f->code, " }\n");
}
Printf(f->code, "}\n");
/* print this when in C mode? make this a command-line arg? */
if (Generate_Wrapper)
Wrapper_print(f, f_cxx_wrapper);
Wrapper_print(f, f_cxx);
String *f_buffer = NewString("");
@ -2735,15 +2664,13 @@ int ALLEGROCL::functionWrapper(Node *n) {
}
int ALLEGROCL::namespaceDeclaration(Node *n) {
// Empty namespaces are not worth DEFPACKAGEing.
// Swig_print_node(n);
#ifdef ALLEGROCL_DEBUG
Printf(stderr, "namespaceDecl: '%s'(0x%x) (fc=0x%x)\n", Getattr(n, "sym:name"), n, firstChild(n));
#endif
/* don't wrap a namespace with no contents. package bloat.
also, test-suite/namespace_class.i claims an unnamed namespace
is 'private' and should not be wrapped. Complying...
*/
if (Getattr(n,"unnamed") || !firstChild(n))
if (!firstChild(n))
return SWIG_OK;
String *name = Getattr(n, "sym:name");
@ -2770,7 +2697,7 @@ int ALLEGROCL::namespaceDeclaration(Node *n) {
int ALLEGROCL::constructorHandler(Node *n) {
#ifdef ALLEGROCL_DEBUG
Printf(stderr, "constructorHandler %s\n", Getattr(n, "name"));
Printf(stderr, "constructor %s\n", Getattr(n, "name"));
#endif
// Swig_print_node(n);
Setattr(n, "allegrocl:kind", "constructor");
@ -2782,7 +2709,7 @@ int ALLEGROCL::constructorHandler(Node *n) {
int ALLEGROCL::destructorHandler(Node *n) {
#ifdef ALLEGROCL_DEBUG
Printf(stderr, "destructorHandler %s\n", Getattr(n, "name"));
Printf(stderr, "destructor %s\n", Getattr(n, "name"));
#endif
Setattr(n, "allegrocl:kind", "destructor");
@ -2793,8 +2720,9 @@ int ALLEGROCL::destructorHandler(Node *n) {
}
int ALLEGROCL::constantWrapper(Node *n) {
#ifdef ALLEGROCL_DEBUG
Printf(stderr, "constantWrapper %s\n", Getattr(n, "name"));
Printf(stderr, "constant %s\n", Getattr(n, "name"));
#endif
if (Generate_Wrapper) {
@ -2813,10 +2741,10 @@ int ALLEGROCL::constantWrapper(Node *n) {
}
SwigType_add_qualifier(const_type, "const");
SwigType_add_qualifier(const_type, "static");
String *ppcname = NewStringf("ACLppc_%s", Getattr(n, "sym:name"));
// Printf(f_runtime, "static const %s = %s;\n", SwigType_lstr(const_type, ppcname), const_val);
Printf(f_runtime, "static %s = %s;\n", SwigType_lstr(const_type, ppcname), const_val);
String *ppcname = NewStringf("ACLppc_%s", Getattr(n, "name"));
Printf(f_cxx, "static const %s = %s;\n", SwigType_lstr(const_type, ppcname), const_val);
Setattr(n, "name", ppcname);
SetFlag(n, "feature:immutable");
@ -2850,10 +2778,6 @@ int ALLEGROCL::constantWrapper(Node *n) {
}
int ALLEGROCL::globalvariableHandler(Node *n) {
#ifdef ALLEGROCL_DEBUG
Printf(stderr, "globalvariableHandler %s\n", Getattr(n, "name"));
#endif
if (Generate_Wrapper)
return Language::globalvariableHandler(n);
@ -2873,7 +2797,7 @@ int ALLEGROCL::globalvariableHandler(Node *n) {
ctype = SwigType_str(type, 0);
// EXPORT <SwigType_str> <mangled_name>;
// <SwigType_str> <mangled_name> = <name>;
// Printf(f_runtime, "EXPORT %s %s;\n%s %s = %s%s;\n", ctype, mangled_name,
// Printf(f_cxx, "EXPORT %s %s;\n%s %s = %s%s;\n", ctype, mangled_name,
// ctype, mangled_name, (pointer_added ? "&" : ""), name);
Printf(f_clwrap, "(swig-defvar \"%s\" \"%s\" :type %s)\n",
@ -2884,7 +2808,7 @@ int ALLEGROCL::globalvariableHandler(Node *n) {
int ALLEGROCL::variableWrapper(Node *n) {
#ifdef ALLEGROCL_DEBUG
Printf(stderr, "variableWrapper %s\n", Getattr(n, "name"));
Printf(stderr, "variable %s\n", Getattr(n, "name"));
#endif
Setattr(n, "allegrocl:kind", "variable");
Setattr(n, "allegrocl:old-sym:name", Getattr(n, "sym:name"));
@ -2909,30 +2833,24 @@ int ALLEGROCL::variableWrapper(Node *n) {
}
ctype = SwigType_str(type, 0);
// EXPORT <SwigType_str> <mangled_name>;
// <SwigType_str> <mangled_name> = <name>;
Printf(f_runtime, "EXPORT %s %s;\n%s %s = %s%s;\n", ctype, mangled_name, ctype, mangled_name, (pointer_added ? "&" : ""), name);
Printf(f_cxx, "EXPORT %s %s;\n%s %s = %s%s;\n", ctype, mangled_name, ctype, mangled_name, (pointer_added ? "&" : ""), name);
Printf(f_cl, "(swig-defvar \"%s\" :type %s)\n", mangled_name, ((SwigType_isconst(type)) ? ":constant" : ":variable"));
/*
Printf(f_runtime, "// swigtype: %s\n", SwigType_typedef_resolve_all(Getattr(n,"type")));
Printf(f_runtime, "// vwrap: %s\n", compose_foreign_type(SwigType_strip_qualifiers(Copy(rtype))));
Printf(f_cxx, "// swigtype: %s\n", SwigType_typedef_resolve_all(Getattr(n,"type")));
Printf(f_cxx, "// vwrap: %s\n", compose_foreign_type(SwigType_strip_qualifiers(Copy(rtype))));
*/
Printf(stderr,"***\n");
Delete(mangled_name);
#ifdef ALLEGROCL_DEBUG
Printf(stderr, "DONE variable %s\n", Getattr(n, "name"));
#endif
return SWIG_OK;
}
int ALLEGROCL::memberfunctionHandler(Node *n) {
#ifdef ALLEGROCL_DEBUG
Printf(stderr, "memberfunctionHandler %s::%s\n", Getattr(parent_node_skipping_extends(n), "name"), Getattr(n, "name"));
Printf(stderr, "member function %s::%s\n", Getattr(parent_node_skipping_extends(n), "name"), Getattr(n, "name"));
#endif
Setattr(n, "allegrocl:kind", "member function");
Setattr(n, "allegrocl:old-sym:name", Getattr(n, "sym:name"));
@ -2943,7 +2861,7 @@ int ALLEGROCL::memberfunctionHandler(Node *n) {
int ALLEGROCL::membervariableHandler(Node *n) {
#ifdef ALLEGROCL_DEBUG
Printf(stderr, "membervariableHandler %s::%s\n", Getattr(parent_node_skipping_extends(n), "name"), Getattr(n, "name"));
Printf(stderr, "member variable %s::%s\n", Getattr(parent_node_skipping_extends(n), "name"), Getattr(n, "name"));
#endif
Setattr(n, "allegrocl:kind", "member variable");
Setattr(n, "allegrocl:old-sym:name", Getattr(n, "sym:name"));
@ -2953,8 +2871,10 @@ int ALLEGROCL::membervariableHandler(Node *n) {
}
int ALLEGROCL::typedefHandler(Node *n) {
#ifdef ALLEGROCL_TYPE_DEBUG
Printf(stderr, "In typedefHandler\n");
Printf(stderr, "In typedefHAND\n");
// Swig_print_node(n);
#endif
SwigType *typedef_type = Getattr(n,"type");
@ -2972,7 +2892,9 @@ int ALLEGROCL::typedefHandler(Node *n) {
Printf(stderr, " typedef in class '%s'(%x)\n", Getattr(in_class, "sym:name"), in_class);
#endif
Setattr(n, "allegrocl:typedef:in-class", in_class);
}
if (in_class) {
String *class_name = Getattr(in_class, "name");
name = NewStringf("%s__%s", class_name, sym_name);
type_ref = NewStringf("%s::%s", class_name, sym_name);
@ -2986,19 +2908,14 @@ int ALLEGROCL::typedefHandler(Node *n) {
String *lookup = lookup_defined_foreign_type(typedef_type);
#ifdef ALLEGROCL_TYPE_DEBUG
Printf(stderr, "** lookup='%s'(%x), typedef_type='%s', strcmp = '%d' strstr = '%d'\n", lookup, lookup, typedef_type, Strcmp(typedef_type,"void"), Strstr(ff_type,"__SWIGACL_FwdReference"));
#endif
// Printf(stderr, "** lookup='%s'(%x), ff_type='%s', strstr = '%d'\n", lookup, lookup, ff_type, !Strstr(ff_type,"void"));
if(lookup || (!lookup && Strcmp(typedef_type,"void")) ||
(!lookup && Strstr(ff_type,"__SWIGACL_FwdReference"))) {
if(lookup || (!lookup && !Strstr(ff_type,"void")))
add_defined_foreign_type(n, 0, type_ref, name);
} else {
add_forward_referenced_type(n);
}
else add_forward_referenced_type(n);
#ifdef ALLEGROCL_TYPE_DEBUG
Printf(stderr, "Out typedefHandler\n");
Printf(stderr, "Out typedefHAND\n");
#endif
Delete(ff_type);
@ -3008,33 +2925,22 @@ int ALLEGROCL::typedefHandler(Node *n) {
// forward referenced classes are added specially to defined_foreign_types
int ALLEGROCL::classforwardDeclaration(Node *n) {
#ifdef ALLEGROCL_DEBUG
Printf(stderr, "classforwardDeclaration %s\n", Getattr(n, "name"));
#endif
add_forward_referenced_type(n);
return SWIG_OK;
}
int ALLEGROCL::classHandler(Node *n) {
#ifdef ALLEGROCL_DEBUG
Printf(stderr, "classHandler %s::%s\n", current_namespace, Getattr(n, "sym:name"));
Printf(stderr, "class %s::%s\n", current_namespace, Getattr(n, "sym:name"));
#endif
int result;
if (Generate_Wrapper)
result = cppClassHandler(n);
return cppClassHandler(n);
else
result = cClassHandler(n);
return result;
return cClassHandler(n);
}
int ALLEGROCL::cClassHandler(Node *n) {
#ifdef ALLEGROCL_TYPE_DEBUG
Printf(stderr, "In cClassHandler\n");
#endif
// String *cDeclName = Getattr(n,"classDeclaration:name");
// String *name= Getattr(n, "sym:name");
// String *kind = Getattr(n,"kind");
@ -3044,21 +2950,22 @@ int ALLEGROCL::cClassHandler(Node *n) {
// Printf(stderr, "Adding %s foreign type\n", name);
String *ns = listify_namespace(current_namespace);
#ifdef ALLEGROCL_TYPE_DEBUG
Printf(stderr, "In cClassHAND\n");
#endif
add_defined_foreign_type(n);
Delete(ns);
#ifdef ALLEGROCL_TYPE_DEBUG
Printf(stderr, "Out cClassHandler\n");
Printf(stderr, "Out cClassHAND\n");
#endif
return SWIG_OK;
}
int ALLEGROCL::cppClassHandler(Node *n) {
#ifdef ALLEGROCL_DEBUG
Printf(stderr, "cppClassHandler %s\n", Getattr(n, "name"));
#endif
// String *name=Getattr(n, "sym:name");
// String *kind = Getattr(n,"kind");
@ -3117,9 +3024,6 @@ int ALLEGROCL::cppClassHandler(Node *n) {
// so their types can be added to the linked_type_list.
SwigType *childType = NewStringf("%s%s", Getattr(c, "decl"),
Getattr(c, "type"));
#ifdef ALLEGROCL_CLASS_DEBUG
Printf(stderr, "looking at child '%x' of type '%s'\n", c, childType);
#endif
if (!SwigType_isfunction(childType))
Delete(compose_foreign_type(childType));
@ -3160,9 +3064,6 @@ int ALLEGROCL::emit_one(Node *n) {
}
int ALLEGROCL::enumDeclaration(Node *n) {
#ifdef ALLEGROCL_DEBUG
Printf(stderr, "enumDeclaration %s\n", Getattr(n, "name"));
#endif
if (Getattr(n, "sym:name")) {
add_defined_foreign_type(n);
@ -3179,34 +3080,21 @@ int ALLEGROCL::enumDeclaration(Node *n) {
int ALLEGROCL::enumvalueDeclaration(Node *n) {
#ifdef ALLEGROCL_DEBUG
Printf(stderr, "enumvalueDeclaration %s\n", Getattr(n, "name"));
#endif
/* print this when in C mode? make this a command-line arg? */
if (Generate_Wrapper) {
SwigType *enum_type = Copy(Getattr(n,"type"));
String *mangled_name =
mangle_name(n, "ACL_ENUM",
in_class ? Getattr(in_class,"name") :
current_namespace);
SwigType_add_qualifier(enum_type,"const");
String *enum_decl = SwigType_str(enum_type, mangled_name);
Printf(f_cxx_wrapper, "EXPORT %s;\n", enum_decl);
Printf(f_cxx_wrapper, "%s = %s;\n", enum_decl, Getattr(n, "value"));
/* print this when in C mode? make this a command-line arg? */
if (Generate_Wrapper) {
String *mangled_name = mangle_name(n, "ACL_ENUM");
Printf(f_cxx, "EXPORT const %s %s = %s;\n", Getattr(n, "type"), mangled_name, Getattr(n, "value"));
Delete(mangled_name);
Delete(enum_type);
Delete(enum_decl);
}
return SWIG_OK;
}
int ALLEGROCL::templateDeclaration(Node *n) {
#ifdef ALLEGROCL_DEBUG
Printf(stderr, "templateDeclaration %s\n", Getattr(n, "name"));
#endif
String *type = Getattr(n, "templatetype");

View file

@ -12,22 +12,6 @@ char cvsroot_c_cxx[] = "$Id: c.cxx 11186 2009-04-11 10:46:13Z maciekd $";
#include <ctype.h>
#include "swigmod.h"
int SwigType_isbuiltin(SwigType *t) {
const char* builtins[] = { "void", "short", "int", "long", "char", "float", "double", "bool",
"unsigned short", "unsigned int", "unsigned long", "unsigned char", "signed char",
"long long", "unsigned long long", 0 };
int i = 0;
char *c = Char(t);
if (!t)
return 0;
while (builtins[i]) {
if (strcmp(c, builtins[i]) == 0)
return 1;
i++;
}
return 0;
}
class C:public Language {
static const char *usage;
@ -166,8 +150,8 @@ public:
String *outfile = Getattr(n, "outfile");
// initialize I/O
f_begin = NewFile(outfile, "w", SWIG_output_files());
if (!f_begin) {
f_runtime = NewFile(outfile, "w");
if (!f_runtime) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
}
@ -186,13 +170,13 @@ public:
// create proxy files with appropriate name
String *proxy_code_filename = NewStringf("%s%s_proxy.c", SWIG_output_directory(), Char(module));
if ((f_proxy_c = NewFile(proxy_code_filename, "w", SWIG_output_files())) == 0) {
if ((f_proxy_c = NewFile(proxy_code_filename, "w")) == 0) {
FileErrorDisplay(proxy_code_filename);
SWIG_exit(EXIT_FAILURE);
}
String *proxy_header_filename = NewStringf("%s%s_proxy.h", SWIG_output_directory(), Char(module));
if ((f_proxy_h = NewFile(proxy_header_filename, "w", SWIG_output_files())) == 0) {
if ((f_proxy_h = NewFile(proxy_header_filename, "w")) == 0) {
FileErrorDisplay(proxy_header_filename);
SWIG_exit(EXIT_FAILURE);
}

View file

@ -22,8 +22,7 @@ public:
String *f_clhead;
String *f_clwrap;
bool CWrap; // generate wrapper file for C code?
File *f_begin;
File *f_runtime;
File *f_cxx;
File *f_cxx_header;
File *f_cxx_wrapper;
File *f_clos;
@ -68,7 +67,6 @@ private:
void CFFI::main(int argc, char *argv[]) {
int i;
Preprocessor_define("SWIGCFFI 1", 0);
SWIG_library_directory("cffi");
SWIG_config_file("cffi.swg");
generate_typedef_flag = 0;
@ -121,15 +119,16 @@ int CFFI::top(Node *n) {
Printf(lisp_filename, "%s%s.lisp", SWIG_output_directory(), module);
File *f_lisp = NewFile(lisp_filename, "w", SWIG_output_files());
File *f_lisp = NewFile(lisp_filename, "w");
NewFile(lisp_filename, "w");
if (!f_lisp) {
FileErrorDisplay(lisp_filename);
SWIG_exit(EXIT_FAILURE);
}
if (CPlusPlus || CWrap) {
f_begin = NewFile(cxx_filename, "w", SWIG_output_files());
if (!f_begin) {
f_cxx = NewFile(cxx_filename, "w");
if (!f_cxx) {
Close(f_lisp);
Delete(f_lisp);
Printf(stderr, "Unable to open %s for writing\n", cxx_filename);
@ -138,7 +137,7 @@ int CFFI::top(Node *n) {
String *clos_filename = NewString("");
Printf(clos_filename, "%s%s-clos.lisp", SWIG_output_directory(), module);
f_clos = NewFile(clos_filename, "w", SWIG_output_files());
f_clos = NewFile(clos_filename, "w");
if (!f_clos) {
Close(f_lisp);
Delete(f_lisp);
@ -146,32 +145,22 @@ int CFFI::top(Node *n) {
SWIG_exit(EXIT_FAILURE);
}
} else {
f_begin = NewString("");
f_cxx = NewString("");
f_clos = NewString("");
}
f_runtime = NewString("");
f_cxx_header = f_runtime;
f_cxx_header = f_cxx;
f_cxx_wrapper = NewString("");
Swig_register_filebyname("header", f_cxx_header);
Swig_register_filebyname("wrapper", f_cxx_wrapper);
Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("runtime", f_runtime);
Swig_register_filebyname("runtime", f_cxx);
Swig_register_filebyname("lisphead", f_clhead);
if (!no_swig_lisp)
Swig_register_filebyname("swiglisp", f_cl);
else
Swig_register_filebyname("swiglisp", f_null);
Swig_banner(f_begin);
Printf(f_runtime, "\n");
Printf(f_runtime, "#define SWIGCFFI\n");
Printf(f_runtime, "\n");
Swig_banner_target_lang(f_lisp, ";;;");
Language::top(n);
Printf(f_lisp, "%s\n", f_clhead);
Printf(f_lisp, "%s\n", f_cl);
@ -182,10 +171,8 @@ int CFFI::top(Node *n) {
Delete(f_cl);
Delete(f_clhead);
Delete(f_clwrap);
Dump(f_runtime, f_begin);
Close(f_begin);
Delete(f_runtime);
Delete(f_begin);
Close(f_cxx);
Delete(f_cxx);
Delete(f_cxx_wrapper);
Delete(f_null);
@ -245,7 +232,7 @@ void CFFI::emit_defmethod(Node *n) {
ParmList *pl = Getattr(n, "parms");
int argnum = 0;
Node *parent = getCurrentClass();
Node *parent = parentNode(n);
bool first = 0;
for (Parm *p = pl; p; p = nextSibling(p), argnum++) {
@ -300,7 +287,7 @@ void CFFI::emit_initialize_instance(Node *n) {
ParmList *pl = Getattr(n, "parms");
int argnum = 0;
Node *parent = getCurrentClass();
Node *parent = parentNode(n);
for (Parm *p = pl; p; p = nextSibling(p), argnum++) {
String *argname = Getattr(p, "name");
@ -337,18 +324,18 @@ void CFFI::emit_initialize_instance(Node *n) {
}
void CFFI::emit_setter(Node *n) {
Node *parent = getCurrentClass();
Node *p = parentNode(n);
Printf(f_clos, "(cl:defmethod (cl:setf %s) (arg0 (obj %s))\n (%s (ff-pointer obj) arg0))\n\n",
lispify_name(n, Getattr(n, "name"), "'method"),
lispify_name(parent, lispy_name(Char(Getattr(parent, "sym:name"))), "'class"), lispify_name(n, Getattr(n, "sym:name"), "'function"));
lispify_name(p, lispy_name(Char(Getattr(p, "sym:name"))), "'class"), lispify_name(n, Getattr(n, "sym:name"), "'function"));
}
void CFFI::emit_getter(Node *n) {
Node *parent = getCurrentClass();
Node *p = parentNode(n);
Printf(f_clos, "(cl:defmethod %s ((obj %s))\n (%s (ff-pointer obj)))\n\n",
lispify_name(n, Getattr(n, "name"), "'method"),
lispify_name(parent, lispy_name(Char(Getattr(parent, "sym:name"))), "'class"), lispify_name(n, Getattr(n, "sym:name"), "'function"));
lispify_name(p, lispy_name(Char(Getattr(p, "sym:name"))), "'class"), lispify_name(n, Getattr(n, "sym:name"), "'function"));
}
int CFFI::memberfunctionHandler(Node *n) {
@ -468,7 +455,7 @@ int CFFI::functionWrapper(Node *n) {
Printf(f->code, "}\n");
if (CPlusPlus)
Wrapper_print(f, f_runtime);
Wrapper_print(f, f_cxx);
if (CPlusPlus) {
emit_defun(n, wname);
@ -643,7 +630,7 @@ int CFFI::enumDeclaration(Node *n) {
else {
String *type = Getattr(c, "type");
String *converted_value = convert_literal(value, type);
Printf(f_cl, "\n\t(%s #.%s)", slot_name, converted_value);
Printf(f_cl, "\n\t(%s %s)", slot_name, converted_value);
Delete(converted_value);
}
Delete(value);

View file

@ -30,7 +30,6 @@ static char *module = 0;
static char *chicken_path = (char *) "chicken";
static int num_methods = 0;
static File *f_begin = 0;
static File *f_runtime = 0;
static File *f_header = 0;
static File *f_wrappers = 0;
@ -102,12 +101,12 @@ protected:
int isPointer(SwigType *t);
void dispatchFunction(Node *n);
String *chickenNameMapping(String *, const_String_or_char_ptr );
String *chickenNameMapping(String *, String_or_char *);
String *chickenPrimitiveName(String *);
String *runtimeCode();
String *defaultExternalRuntimeFilename();
String *buildClosFunctionCall(List *types, const_String_or_char_ptr closname, const_String_or_char_ptr funcname);
String *buildClosFunctionCall(List *types, String_or_char *closname, String_or_char *funcname);
};
/* -----------------------------------------------------------------------
@ -189,12 +188,11 @@ int CHICKEN::top(Node *n) {
/* Initialize all of the output files */
String *outfile = Getattr(n, "outfile");
f_begin = NewFile(outfile, "w", SWIG_output_files());
if (!f_begin) {
f_runtime = NewFile(outfile, "w");
if (!f_runtime) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
}
f_runtime = NewString("");
f_init = NewString("");
f_header = NewString("");
f_wrappers = NewString("");
@ -207,7 +205,6 @@ int CHICKEN::top(Node *n) {
/* Register file targets with the SWIG file handler */
Swig_register_filebyname("header", f_header);
Swig_register_filebyname("wrapper", f_wrappers);
Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("runtime", f_runtime);
Swig_register_filebyname("init", f_init);
@ -218,16 +215,14 @@ int CHICKEN::top(Node *n) {
clos_methods = NewString("");
scm_const_defs = NewString("");
Swig_banner(f_begin);
Printf(f_runtime, "/* -*- buffer-read-only: t -*- vi: set ro: */\n");
Swig_banner(f_runtime);
Printf(f_runtime, "\n");
Printf(f_runtime, "#define SWIGCHICKEN\n");
Printf(f_runtime, "/* Implementation : CHICKEN */\n\n");
if (no_collection)
Printf(f_runtime, "#define SWIG_CHICKEN_NO_COLLECTION 1\n");
Printf(f_runtime, "\n");
/* Set module name */
module = Swig_copy_string(Char(Getattr(n, "name")));
scmmodule = NewString(module);
@ -256,14 +251,14 @@ int CHICKEN::top(Node *n) {
Printf(f_init, "#endif\n");
Printf(chicken_filename, "%s%s.scm", SWIG_output_directory(), module);
if ((f_scm = NewFile(chicken_filename, "w", SWIG_output_files())) == 0) {
if ((f_scm = NewFile(chicken_filename, "w")) == 0) {
FileErrorDisplay(chicken_filename);
SWIG_exit(EXIT_FAILURE);
}
Swig_banner_target_lang(f_scm, ";;");
Printf(f_scm, "\n");
Printv(f_scm,
";; -*- buffer-read-only: t -*- vi: set ro:\n",
";; This file was created automatically by SWIG.\n", ";; Don't modify this file, modify the SWIG interface instead.\n", NIL);
if (declare_unit)
Printv(f_scm, "(declare (unit ", scmmodule, "))\n\n", NIL);
Printv(f_scm, "(declare \n",
@ -312,17 +307,15 @@ int CHICKEN::top(Node *n) {
/* Close all of the files */
Delete(primitive_names);
Delete(scmmodule);
Dump(f_runtime, f_begin);
Dump(f_header, f_begin);
Dump(f_wrappers, f_begin);
Wrapper_pretty_print(f_init, f_begin);
Dump(f_header, f_runtime);
Dump(f_wrappers, f_runtime);
Wrapper_pretty_print(f_init, f_runtime);
Delete(f_header);
Delete(f_wrappers);
Delete(f_sym_size);
Delete(f_init);
Close(f_begin);
Close(f_runtime);
Delete(f_runtime);
Delete(f_begin);
return SWIG_OK;
}
@ -1240,7 +1233,7 @@ int CHICKEN::importDirective(Node *n) {
return Language::importDirective(n);
}
String *CHICKEN::buildClosFunctionCall(List *types, const_String_or_char_ptr closname, const_String_or_char_ptr funcname) {
String *CHICKEN::buildClosFunctionCall(List *types, String_or_char *closname, String_or_char *funcname) {
String *method_signature = NewString("");
String *func_args = NewString("");
String *func_call = NewString("");
@ -1514,7 +1507,7 @@ int CHICKEN::validIdentifier(String *s) {
* If class_name = "" that means the mapping is for a function or
* variable not attached to any class.
* ------------------------------------------------------------ */
String *CHICKEN::chickenNameMapping(String *name, const_String_or_char_ptr class_name) {
String *CHICKEN::chickenNameMapping(String *name, String_or_char *class_name) {
String *n = NewString("");
if (Strcmp(class_name, "") == 0) {

View file

@ -36,7 +36,6 @@ private:
void CLISP::main(int argc, char *argv[]) {
int i;
Preprocessor_define("SWIGCLISP 1", 0);
SWIG_library_directory("clisp");
SWIG_config_file("clisp.swg");
generate_typedef_flag = 0;
@ -80,22 +79,20 @@ int CLISP::top(Node *n) {
Printf(output_filename, "%s%s.lisp", SWIG_output_directory(), module);
}
f_cl = NewFile(output_filename, "w+", SWIG_output_files());
f_cl = NewFile(output_filename, "w+");
if (!f_cl) {
FileErrorDisplay(output_filename);
SWIG_exit(EXIT_FAILURE);
}
Swig_register_filebyname("header", f_null);
Swig_register_filebyname("begin", f_null);
Swig_register_filebyname("runtime", f_null);
Swig_register_filebyname("wrapper", f_null);
String *header = NewString("");
Swig_banner_target_lang(header, ";;");
Printf(header, "\n(defpackage :%s\n (:use :common-lisp :ffi)", module);
String *header =
NewStringf
(";; This is an automatically generated file. \n;;Make changes as you feel are necessary (but remember if you try to regenerate this file, your changes will be lost). \n\n(defpackage :%s\n (:use :common-lisp :ffi)",
module);
Language::top(n);

View file

@ -46,7 +46,6 @@ public:
int extendDirective(Node *n);
int importDirective(Node *n);
int includeDirective(Node *n);
int namespaceDeclaration(Node *n);
int classDeclaration(Node *n);
virtual int top(Node *n);
};
@ -321,23 +320,16 @@ int Contracts::constructorDeclaration(Node *n) {
int Contracts::externDeclaration(Node *n) {
return emit_children(n);
}
int Contracts::extendDirective(Node *n) {
return emit_children(n);
}
int Contracts::importDirective(Node *n) {
return emit_children(n);
}
int Contracts::includeDirective(Node *n) {
return emit_children(n);
}
int Contracts::namespaceDeclaration(Node *n) {
return emit_children(n);
}
int Contracts::classDeclaration(Node *n) {
int ret = SWIG_OK;
InClass = 1;

View file

@ -24,7 +24,6 @@ class CSHARP:public Language {
const String *protected_string;
Hash *swig_types_hash;
File *f_begin;
File *f_runtime;
File *f_runtime_h;
File *f_header;
@ -86,7 +85,7 @@ class CSHARP:public Language {
enum EnumFeature { SimpleEnum, TypeunsafeEnum, TypesafeEnum, ProperEnum };
static Parm *NewParmFromNode(SwigType *type, const_String_or_char_ptr name, Node *n) {
static Parm *NewParmFromNode(SwigType *type, const String_or_char *name, Node *n) {
Parm *p = NewParm(type, name);
Setfile(p, Getfile(n));
Setline(p, Getline(n));
@ -103,7 +102,6 @@ public:
public_string(NewString("public")),
protected_string(NewString("protected")),
swig_types_hash(NULL),
f_begin(NULL),
f_runtime(NULL),
f_runtime_h(NULL),
f_header(NULL),
@ -288,8 +286,8 @@ public:
SWIG_exit(EXIT_FAILURE);
}
f_begin = NewFile(outfile, "w", SWIG_output_files());
if (!f_begin) {
f_runtime = NewFile(outfile, "w");
if (!f_runtime) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
}
@ -299,14 +297,13 @@ public:
Printf(stderr, "Unable to determine outfile_h\n");
SWIG_exit(EXIT_FAILURE);
}
f_runtime_h = NewFile(outfile_h, "w", SWIG_output_files());
f_runtime_h = NewFile(outfile_h, "w");
if (!f_runtime_h) {
FileErrorDisplay(outfile_h);
SWIG_exit(EXIT_FAILURE);
}
}
f_runtime = NewString("");
f_init = NewString("");
f_header = NewString("");
f_wrappers = NewString("");
@ -316,7 +313,6 @@ public:
/* Register file targets with the SWIG file handler */
Swig_register_filebyname("header", f_header);
Swig_register_filebyname("wrapper", f_wrappers);
Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("runtime", f_runtime);
Swig_register_filebyname("init", f_init);
Swig_register_filebyname("director", f_directors);
@ -362,17 +358,13 @@ public:
if (!dllimport)
dllimport = Copy(module_class_name);
Swig_banner(f_begin);
Printf(f_runtime, "\n");
Printf(f_runtime, "#define SWIGCSHARP\n");
Swig_banner(f_runtime); // Print the SWIG banner message
if (directorsEnabled()) {
Printf(f_runtime, "#define SWIG_DIRECTORS\n");
/* Emit initial director header and director code: */
Swig_banner(f_directors_h);
Printf(f_directors_h, "\n");
Printf(f_directors_h, "#ifndef SWIG_%s_WRAP_H_\n", module_class_name);
Printf(f_directors_h, "#define SWIG_%s_WRAP_H_\n\n", module_class_name);
@ -384,8 +376,6 @@ public:
Printf(f_directors, "#include \"%s\"\n\n", Swig_file_filename(outfile_h));
}
Printf(f_runtime, "\n");
Swig_name_register((char *) "wrapper", (char *) "CSharp_%f");
if (old_variable_names) {
Swig_name_register((char *) "set", (char *) "set_%v");
@ -406,7 +396,7 @@ public:
// Generate the intermediary class
{
String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), imclass_name);
File *f_im = NewFile(filen, "w", SWIG_output_files());
File *f_im = NewFile(filen, "w");
if (!f_im) {
FileErrorDisplay(filen);
SWIG_exit(EXIT_FAILURE);
@ -450,7 +440,7 @@ public:
// Generate the C# module class
{
String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), module_class_name);
File *f_module = NewFile(filen, "w", SWIG_output_files());
File *f_module = NewFile(filen, "w");
if (!f_module) {
FileErrorDisplay(filen);
SWIG_exit(EXIT_FAILURE);
@ -577,11 +567,10 @@ public:
n_dmethods = 0;
/* Close all of the files */
Dump(f_runtime, f_begin);
Dump(f_header, f_begin);
Dump(f_header, f_runtime);
if (directorsEnabled()) {
Dump(f_directors, f_begin);
Dump(f_directors, f_runtime);
Dump(f_directors_h, f_runtime_h);
Printf(f_runtime_h, "\n");
@ -596,14 +585,13 @@ public:
f_directors_h = NULL;
}
Dump(f_wrappers, f_begin);
Wrapper_pretty_print(f_init, f_begin);
Dump(f_wrappers, f_runtime);
Wrapper_pretty_print(f_init, f_runtime);
Delete(f_header);
Delete(f_wrappers);
Delete(f_init);
Close(f_begin);
Close(f_runtime);
Delete(f_runtime);
Delete(f_begin);
return SWIG_OK;
}
@ -613,7 +601,11 @@ public:
void emitBanner(File *f) {
Printf(f, "/* ----------------------------------------------------------------------------\n");
Swig_banner_target_lang(f, " *");
Printf(f, " * This file was automatically generated by SWIG (http://www.swig.org).\n");
Printf(f, " * Version %s\n", Swig_package_version());
Printf(f, " *\n");
Printf(f, " * Do not make changes to this file unless you know what you are doing--modify\n");
Printf(f, " * the SWIG interface file instead.\n");
Printf(f, " * ----------------------------------------------------------------------------- */\n\n");
}
@ -1163,7 +1155,7 @@ public:
} else {
// Global enums are defined in their own file
String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), symname);
File *f_enum = NewFile(filen, "w", SWIG_output_files());
File *f_enum = NewFile(filen, "w");
if (!f_enum) {
FileErrorDisplay(filen);
SWIG_exit(EXIT_FAILURE);
@ -1742,7 +1734,7 @@ public:
}
String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), proxy_class_name);
f_proxy = NewFile(filen, "w", SWIG_output_files());
f_proxy = NewFile(filen, "w");
if (!f_proxy) {
FileErrorDisplay(filen);
SWIG_exit(EXIT_FAILURE);
@ -1895,7 +1887,6 @@ public:
bool setter_flag = false;
String *pre_code = NewString("");
String *post_code = NewString("");
String *terminator_code = NewString("");
if (!proxy_flag)
return;
@ -2007,8 +1998,7 @@ public:
if (!(variable_wrapper_flag && i == 0)) {
SwigType *pt = Getattr(p, "type");
String *param_type = NewString("");
if (setter_flag)
last_parm = p;
last_parm = p;
/* Get the C# parameter type */
if ((tm = Getattr(p, "tmap:cstype"))) {
@ -2044,14 +2034,6 @@ public:
Printf(post_code, "\n");
Printv(post_code, post, NIL);
}
String *terminator = Getattr(p, "tmap:csin:terminator");
if (terminator) {
substituteClassname(pt, terminator);
Replaceall(terminator, "$csinput", arg);
if (Len(terminator_code) > 0)
Insert(terminator_code, 0, "\n");
Insert(terminator_code, 0, terminator);
}
Printv(imcall, tm, NIL);
} else {
Swig_warning(WARN_CSHARP_TYPEMAP_CSIN_UNDEF, input_file, line_number, "No csin typemap defined for %s\n", SwigType_str(pt, 0));
@ -2077,8 +2059,7 @@ public:
excodeSubstitute(n, tm, "csout", n);
bool is_pre_code = Len(pre_code) > 0;
bool is_post_code = Len(post_code) > 0;
bool is_terminator_code = Len(terminator_code) > 0;
if (is_pre_code || is_post_code || is_terminator_code) {
if (is_pre_code || is_post_code) {
Replaceall(tm, "\n ", "\n "); // add extra indentation to code in typemap
if (is_post_code) {
Insert(tm, 0, "\n try ");
@ -2090,9 +2071,6 @@ public:
Insert(tm, 0, pre_code);
Insert(tm, 0, "\n");
}
if (is_terminator_code) {
Printv(tm, "\n", terminator_code, NIL);
}
Insert(tm, 0, "{");
Printf(tm, "\n }");
}
@ -2192,7 +2170,6 @@ public:
Delete(pre_code);
Delete(post_code);
Delete(terminator_code);
Delete(function_code);
Delete(return_type);
Delete(imcall);
@ -2213,7 +2190,6 @@ public:
String *helper_args = NewString("");
String *pre_code = NewString("");
String *post_code = NewString("");
String *terminator_code = NewString("");
String *im_return_type = NewString("");
bool feature_director = (parentNode(n) && Swig_directorclass(n));
@ -2309,14 +2285,6 @@ public:
Printf(post_code, "\n");
Printv(post_code, post, NIL);
}
String *terminator = Getattr(p, "tmap:csin:terminator");
if (terminator) {
substituteClassname(pt, terminator);
Replaceall(terminator, "$csinput", arg);
if (Len(terminator_code) > 0)
Insert(terminator_code, 0, "\n");
Insert(terminator_code, 0, terminator);
}
cshin = Getattr(p, "tmap:csin:cshin");
if (cshin)
Replaceall(cshin, "$csinput", arg);
@ -2373,8 +2341,7 @@ public:
bool is_pre_code = Len(pre_code) > 0;
bool is_post_code = Len(post_code) > 0;
bool is_terminator_code = Len(terminator_code) > 0;
if (is_pre_code || is_post_code || is_terminator_code) {
if (is_pre_code || is_post_code) {
Printf(helper_code, " {\n");
if (is_pre_code) {
Printv(helper_code, pre_code, "\n", NIL);
@ -2386,9 +2353,6 @@ public:
} else {
Printv(helper_code, " return ", imcall, ";", NIL);
}
if (is_terminator_code) {
Printv(helper_code, "\n", terminator_code, NIL);
}
Printf(helper_code, "\n }\n");
String *helper_name = NewStringf("%s.SwigConstruct%s(%s)", proxy_class_name, proxy_class_name, helper_args);
String *im_outattributes = Getattr(n, "tmap:imtype:outattributes");
@ -2407,7 +2371,6 @@ public:
Delete(im_return_type);
Delete(pre_code);
Delete(post_code);
Delete(terminator_code);
Delete(construct_tm);
Delete(attributes);
Delete(overloaded_name);
@ -2525,7 +2488,6 @@ public:
bool setter_flag = false;
String *pre_code = NewString("");
String *post_code = NewString("");
String *terminator_code = NewString("");
if (l) {
if (SwigType_type(Getattr(l, "type")) == T_VOID) {
@ -2630,14 +2592,6 @@ public:
Printf(post_code, "\n");
Printv(post_code, post, NIL);
}
String *terminator = Getattr(p, "tmap:csin:terminator");
if (terminator) {
substituteClassname(pt, terminator);
Replaceall(terminator, "$csinput", arg);
if (Len(terminator_code) > 0)
Insert(terminator_code, 0, "\n");
Insert(terminator_code, 0, terminator);
}
Printv(imcall, tm, NIL);
} else {
Swig_warning(WARN_CSHARP_TYPEMAP_CSIN_UNDEF, input_file, line_number, "No csin typemap defined for %s\n", SwigType_str(pt, 0));
@ -2662,8 +2616,7 @@ public:
excodeSubstitute(n, tm, "csout", n);
bool is_pre_code = Len(pre_code) > 0;
bool is_post_code = Len(post_code) > 0;
bool is_terminator_code = Len(terminator_code) > 0;
if (is_pre_code || is_post_code || is_terminator_code) {
if (is_pre_code || is_post_code) {
Replaceall(tm, "\n ", "\n "); // add extra indentation to code in typemap
if (is_post_code) {
Insert(tm, 0, "\n try ");
@ -2675,9 +2628,6 @@ public:
Insert(tm, 0, pre_code);
Insert(tm, 0, "\n");
}
if (is_terminator_code) {
Printv(tm, "\n", terminator_code, NIL);
}
Insert(tm, 0, "{");
Printf(tm, "\n }");
}
@ -2753,7 +2703,6 @@ public:
Delete(pre_code);
Delete(post_code);
Delete(terminator_code);
Delete(function_code);
Delete(return_type);
Delete(imcall);
@ -2968,7 +2917,7 @@ public:
void emitTypeWrapperClass(String *classname, SwigType *type) {
String *swigtype = NewString("");
String *filen = NewStringf("%s%s.cs", SWIG_output_directory(), classname);
File *f_swigtype = NewFile(filen, "w", SWIG_output_files());
File *f_swigtype = NewFile(filen, "w");
if (!f_swigtype) {
FileErrorDisplay(filen);
SWIG_exit(EXIT_FAILURE);

View file

@ -84,7 +84,7 @@ String *Swig_director_declaration(Node *n) {
}
String *Swig_method_call(const_String_or_char_ptr name, ParmList *parms) {
String *Swig_method_call(String_or_char *name, ParmList *parms) {
String *func;
int i = 0;
int comma = 0;
@ -128,7 +128,7 @@ String *Swig_method_call(const_String_or_char_ptr name, ParmList *parms) {
*
*/
String *Swig_method_decl(SwigType *returntype, SwigType *decl, const_String_or_char_ptr id, List *args, int strip, int values) {
String *Swig_method_decl(SwigType *returntype, SwigType *decl, const String_or_char *id, List *args, int strip, int values) {
String *result;
List *elements;
String *element = 0, *nextelement;

View file

@ -47,7 +47,6 @@ Guile Options (available with -guile)\n\
-exportprimitive - Add the (export ...) code from scmstub into the\n\
GOOPS file.\n";
static File *f_begin = 0;
static File *f_runtime = 0;
static File *f_header = 0;
static File *f_wrappers = 0;
@ -175,7 +174,7 @@ public:
}
} else if (strcmp(argv[i], "-procdoc") == 0) {
if (argv[i + 1]) {
procdoc = NewFile(argv[i + 1], "w", SWIG_output_files());
procdoc = NewFile(argv[i + 1], (char *) "w");
if (!procdoc) {
FileErrorDisplay(argv[i + 1]);
SWIG_exit(EXIT_FAILURE);
@ -300,12 +299,11 @@ public:
/* Initialize all of the output files */
String *outfile = Getattr(n, "outfile");
f_begin = NewFile(outfile, "w", SWIG_output_files());
if (!f_begin) {
f_runtime = NewFile(outfile, "w");
if (!f_runtime) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
}
f_runtime = NewString("");
f_init = NewString("");
f_header = NewString("");
f_wrappers = NewString("");
@ -313,7 +311,6 @@ public:
/* Register file targets with the SWIG file handler */
Swig_register_filebyname("header", f_header);
Swig_register_filebyname("wrapper", f_wrappers);
Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("runtime", f_runtime);
Swig_register_filebyname("init", f_init);
@ -325,10 +322,10 @@ public:
goopscode = NewString("");
goopsexport = NewString("");
Swig_banner(f_begin);
Printf(f_runtime, "/* -*- buffer-read-only: t -*- vi: set ro: */\n");
Swig_banner(f_runtime);
Printf(f_runtime, "\n");
Printf(f_runtime, "#define SWIGGUILE\n");
Printf(f_runtime, "/* Implementation : GUILE */\n\n");
if (!use_scm_interface) {
if (SwigRuntime == 1)
@ -361,8 +358,6 @@ public:
Printf(f_runtime, "\n}\n");
}
Printf(f_runtime, "\n");
Language::top(n);
/* Close module */
@ -397,16 +392,14 @@ public:
Delete(goopstext);
/* Close all of the files */
Dump(f_runtime, f_begin);
Dump(f_header, f_begin);
Dump(f_wrappers, f_begin);
Wrapper_pretty_print(f_init, f_begin);
Dump(f_header, f_runtime);
Dump(f_wrappers, f_runtime);
Wrapper_pretty_print(f_init, f_runtime);
Delete(f_header);
Delete(f_wrappers);
Delete(f_init);
Close(f_begin);
Close(f_runtime);
Delete(f_runtime);
Delete(f_begin);
return SWIG_OK;
}
@ -506,15 +499,15 @@ public:
SWIG_output_directory(),
primitive_name);
Delete(primitive_name);
File *scmstubfile = NewFile(fname, "w", SWIG_output_files());
File *scmstubfile = NewFile(fname, (char *) "w");
if (!scmstubfile) {
FileErrorDisplay(fname);
SWIG_exit(EXIT_FAILURE);
}
Delete(fname);
Swig_banner_target_lang(scmstubfile, ";;;");
Printf(scmstubfile, "\n");
Printf(scmstubfile, ";;; -*- buffer-read-only: t -*- vi: set ro: */\n");
Printf(scmstubfile, ";;; Automatically generated by SWIG; do not edit.\n\n");
if (linkage == GUILE_LSTYLE_SIMPLE || linkage == GUILE_LSTYLE_PASSIVE)
Printf(scmstubfile, "(define-module (%s))\n\n", mod);
Delete(mod);
@ -537,14 +530,14 @@ public:
String *fname = NewStringf("%s%s.scm", SWIG_output_directory(),
module_name);
File *goopsfile = NewFile(fname, "w", SWIG_output_files());
File *goopsfile = NewFile(fname, (char *) "w");
if (!goopsfile) {
FileErrorDisplay(fname);
SWIG_exit(EXIT_FAILURE);
}
Delete(fname);
Swig_banner_target_lang(goopsfile, ";;;");
Printf(goopsfile, "\n");
Printf(goopsfile, ";;; -*- buffer-read-only: t -*- vi: set ro: */\n");
Printf(goopsfile, ";;; Automatically generated by SWIG; do not edit.\n\n");
Printf(goopsfile, "(define-module (%s))\n", mod);
Printf(goopsfile, "%s\n", goopstext);
Printf(goopsfile, "(use-modules (oop goops) (Swig common))\n");
@ -1660,7 +1653,7 @@ public:
* If class_name = "" that means the mapping is for a function or
* variable not attached to any class.
* ------------------------------------------------------------ */
String *goopsNameMapping(String *name, const_String_or_char_ptr class_name) {
String *goopsNameMapping(String *name, String_or_char *class_name) {
String *n = NewString("");
if (Strcmp(class_name, "") == 0) {

View file

@ -24,7 +24,6 @@ class JAVA:public Language {
const String *protected_string;
Hash *swig_types_hash;
File *f_begin;
File *f_runtime;
File *f_runtime_h;
File *f_header;
@ -71,7 +70,6 @@ class JAVA:public Language {
String *imclass_cppcasts_code; //C++ casts up inheritance hierarchies intermediary class code
String *imclass_directors; // Intermediate class director code
String *destructor_call; //C++ destructor call if any
String *destructor_throws_clause; //C++ destructor throws clause if any
// Director method stuff:
List *dmethods_seq;
@ -83,7 +81,7 @@ class JAVA:public Language {
enum EnumFeature { SimpleEnum, TypeunsafeEnum, TypesafeEnum, ProperEnum };
static Parm *NewParmFromNode(SwigType *type, const_String_or_char_ptr name, Node *n) {
static Parm *NewParmFromNode(SwigType *type, const String_or_char *name, Node *n) {
Parm *p = NewParm(type, name);
Setfile(p, Getfile(n));
Setline(p, Getline(n));
@ -100,7 +98,6 @@ public:
public_string(NewString("public")),
protected_string(NewString("protected")),
swig_types_hash(NULL),
f_begin(NULL),
f_runtime(NULL),
f_runtime_h(NULL),
f_header(NULL),
@ -144,7 +141,6 @@ public:
imclass_cppcasts_code(NULL),
imclass_directors(NULL),
destructor_call(NULL),
destructor_throws_clause(NULL),
dmethods_seq(NULL),
dmethods_table(NULL),
n_dmethods(0),
@ -297,8 +293,8 @@ public:
SWIG_exit(EXIT_FAILURE);
}
f_begin = NewFile(outfile, "w", SWIG_output_files());
if (!f_begin) {
f_runtime = NewFile(outfile, "w");
if (!f_runtime) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
}
@ -308,14 +304,13 @@ public:
Printf(stderr, "Unable to determine outfile_h\n");
SWIG_exit(EXIT_FAILURE);
}
f_runtime_h = NewFile(outfile_h, "w", SWIG_output_files());
f_runtime_h = NewFile(outfile_h, "w");
if (!f_runtime_h) {
FileErrorDisplay(outfile_h);
SWIG_exit(EXIT_FAILURE);
}
}
f_runtime = NewString("");
f_init = NewString("");
f_header = NewString("");
f_wrappers = NewString("");
@ -323,7 +318,6 @@ public:
f_directors = NewString("");
/* Register file targets with the SWIG file handler */
Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("header", f_header);
Swig_register_filebyname("wrapper", f_wrappers);
Swig_register_filebyname("runtime", f_runtime);
@ -371,16 +365,13 @@ public:
jnipackage = NewString("");
package_path = NewString("");
Swig_banner(f_begin);
Printf(f_runtime, "\n#define SWIGJAVA\n");
Swig_banner(f_runtime); // Print the SWIG banner message
if (directorsEnabled()) {
Printf(f_runtime, "#define SWIG_DIRECTORS\n");
/* Emit initial director header and director code: */
Swig_banner(f_directors_h);
Printf(f_directors_h, "\n");
Printf(f_directors_h, "#ifndef SWIG_%s_WRAP_H_\n", module_class_name);
Printf(f_directors_h, "#define SWIG_%s_WRAP_H_\n\n", module_class_name);
@ -392,8 +383,6 @@ public:
Printf(f_directors, "#include \"%s\"\n\n", Swig_file_filename(outfile_h));
}
Printf(f_runtime, "\n");
String *wrapper_name = NewString("");
if (Len(package)) {
@ -431,7 +420,7 @@ public:
// Generate the intermediary class
{
String *filen = NewStringf("%s%s.java", SWIG_output_directory(), imclass_name);
File *f_im = NewFile(filen, "w", SWIG_output_files());
File *f_im = NewFile(filen, "w");
if (!f_im) {
FileErrorDisplay(filen);
SWIG_exit(EXIT_FAILURE);
@ -482,7 +471,7 @@ public:
// Generate the Java module class
{
String *filen = NewStringf("%s%s.java", SWIG_output_directory(), module_class_name);
File *f_module = NewFile(filen, "w", SWIG_output_files());
File *f_module = NewFile(filen, "w");
if (!f_module) {
FileErrorDisplay(filen);
SWIG_exit(EXIT_FAILURE);
@ -534,7 +523,7 @@ public:
// Generate the Java constants interface
if (Len(module_class_constants_code) != 0) {
String *filen = NewStringf("%s%sConstants.java", SWIG_output_directory(), module_class_name);
File *f_module = NewFile(filen, "w", SWIG_output_files());
File *f_module = NewFile(filen, "w");
if (!f_module) {
FileErrorDisplay(filen);
SWIG_exit(EXIT_FAILURE);
@ -671,10 +660,8 @@ public:
Delete(f_header);
Delete(f_wrappers);
Delete(f_init);
Dump(f_runtime, f_begin);
Close(f_runtime);
Delete(f_runtime);
Close(f_begin);
Delete(f_begin);
return SWIG_OK;
}
@ -684,7 +671,11 @@ public:
void emitBanner(File *f) {
Printf(f, "/* ----------------------------------------------------------------------------\n");
Swig_banner_target_lang(f, " *");
Printf(f, " * This file was automatically generated by SWIG (http://www.swig.org).\n");
Printf(f, " * Version %s\n", Swig_package_version());
Printf(f, " *\n");
Printf(f, " * Do not make changes to this file unless you know what you are doing--modify\n");
Printf(f, " * the SWIG interface file instead.\n");
Printf(f, " * ----------------------------------------------------------------------------- */\n\n");
}
@ -1219,7 +1210,7 @@ public:
} else {
// Global enums are defined in their own file
String *filen = NewStringf("%s%s.java", SWIG_output_directory(), symname);
File *f_enum = NewFile(filen, "w", SWIG_output_files());
File *f_enum = NewFile(filen, "w");
if (!f_enum) {
FileErrorDisplay(filen);
SWIG_exit(EXIT_FAILURE);
@ -1663,7 +1654,7 @@ public:
else
Replaceall(destruct, "$jnicall", "throw new UnsupportedOperationException(\"C++ destructor does not have public access\")");
if (*Char(destruct))
Printv(proxy_class_def, "\n ", destruct_methodmodifiers, " void ", destruct_methodname, "()", destructor_throws_clause, " ", destruct, "\n", NIL);
Printv(proxy_class_def, "\n ", destruct_methodmodifiers, " void ", destruct_methodname, "() ", destruct, "\n", NIL);
}
/* Insert directordisconnect typemap, if this class has directors enabled */
@ -1751,7 +1742,7 @@ public:
}
String *filen = NewStringf("%s%s.java", SWIG_output_directory(), proxy_class_name);
f_proxy = NewFile(filen, "w", SWIG_output_files());
f_proxy = NewFile(filen, "w");
if (!f_proxy) {
FileErrorDisplay(filen);
SWIG_exit(EXIT_FAILURE);
@ -1770,7 +1761,6 @@ public:
Clear(proxy_class_code);
destructor_call = NewString("");
destructor_throws_clause = NewString("");
proxy_class_constants_code = NewString("");
}
@ -1829,8 +1819,6 @@ public:
proxy_class_name = NULL;
Delete(destructor_call);
destructor_call = NULL;
Delete(destructor_throws_clause);
destructor_throws_clause = NULL;
Delete(proxy_class_constants_code);
proxy_class_constants_code = NULL;
}
@ -2348,7 +2336,6 @@ public:
if (proxy_flag) {
Printv(destructor_call, imclass_name, ".", Swig_name_destroy(symname), "(swigCPtr)", NIL);
generateThrowsClause(n, destructor_throws_clause);
}
return SWIG_OK;
}
@ -2811,7 +2798,7 @@ public:
void emitTypeWrapperClass(String *classname, SwigType *type) {
String *swigtype = NewString("");
String *filen = NewStringf("%s%s.java", SWIG_output_directory(), classname);
File *f_swigtype = NewFile(filen, "w", SWIG_output_files());
File *f_swigtype = NewFile(filen, "w");
if (!f_swigtype) {
FileErrorDisplay(filen);
SWIG_exit(EXIT_FAILURE);
@ -2883,7 +2870,7 @@ public:
String *throws_attribute = NewStringf("%s:throws", attribute);
String *throws = Getattr(parameter, throws_attribute);
if (throws && Len(throws) > 0) {
if (throws) {
String *throws_list = Getattr(n, "java:throwslist");
if (!throws_list) {
throws_list = NewList();

View file

@ -61,7 +61,7 @@ static String *AttributeFunctionGet = 0;
static String *AttributeFunctionSet = 0;
static Node *CurrentClass = 0;
int line_number = 0;
String *input_file = 0;
char *input_file = 0;
int SmartPointer = 0;
static Hash *classhash;
@ -352,7 +352,7 @@ int Language::emit_one(Node *n) {
Extend = 1;
line_number = Getline(n);
input_file = Getfile(n);
input_file = Char(Getfile(n));
/*
symtab = Getattr(n,"symtab");
@ -830,8 +830,9 @@ int Language::cDeclaration(Node *n) {
if (!(directorsEnabled() && ((is_member_director(CurrentClass, n) && need_nonpublic_member(n)) || is_non_virtual_protected_access(n)))) {
return SWIG_NOWRAP;
}
// Prevent wrapping protected overloaded director methods more than once -
// This bit of code is only needed due to the cDeclaration call in classHandler()
#if 0
// I don't see why this is needed - WSF
/* prevent wrapping the method twice due to overload */
String *wrapname = NewStringf("nonpublic_%s%s", symname, Getattr(n, "sym:overname"));
if (Getattr(CurrentClass, wrapname)) {
Delete(wrapname);
@ -839,6 +840,7 @@ int Language::cDeclaration(Node *n) {
}
SetFlag(CurrentClass, wrapname);
Delete(wrapname);
#endif
}
}
@ -1422,39 +1424,36 @@ int Language::membervariableHandler(Node *n) {
target = NewStringf("%s->%s", pname, name);
Delete(pname);
}
} else {
target = NewStringf("$extendgetcall"); // member variable access expanded later
tm = Swig_typemap_lookup("memberin", n, target, 0);
}
tm = Swig_typemap_lookup("memberin", n, target, 0);
int flags = Extend | SmartPointer | use_naturalvar_mode(n);
if (is_non_virtual_protected_access(n))
flags = flags | CWRAP_ALL_PROTECTED_ACCESS;
String *call = 0;
Swig_MembersetToFunction(n, ClassType, flags, &call);
Swig_MembersetToFunction(n, ClassType, flags);
Setattr(n, "memberset", "1");
if (!Extend) {
/* Check for a member in typemap here */
if (!tm) {
if (SwigType_isarray(type)) {
Swig_warning(WARN_TYPEMAP_VARIN_UNDEF, input_file, line_number, "Unable to set variable of type %s.\n", SwigType_str(type, 0));
make_set_wrapper = 0;
if (!tm) {
if (SwigType_isarray(type)) {
Swig_warning(WARN_TYPEMAP_VARIN_UNDEF, input_file, line_number, "Unable to set variable of type %s.\n", SwigType_str(type, 0));
make_set_wrapper = 0;
}
} else {
String *pname0 = Swig_cparm_name(0, 0);
String *pname1 = Swig_cparm_name(0, 1);
Replace(tm, "$source", pname1, DOH_REPLACE_ANY);
Replace(tm, "$target", target, DOH_REPLACE_ANY);
Replace(tm, "$input", pname1, DOH_REPLACE_ANY);
Replace(tm, "$self", pname0, DOH_REPLACE_ANY);
Setattr(n, "wrap:action", tm);
Delete(tm);
Delete(pname0);
Delete(pname1);
}
} else {
String *pname0 = Swig_cparm_name(0, 0);
String *pname1 = Swig_cparm_name(0, 1);
Replace(tm, "$source", pname1, DOH_REPLACE_ANY);
Replace(tm, "$target", target, DOH_REPLACE_ANY);
Replace(tm, "$input", pname1, DOH_REPLACE_ANY);
Replace(tm, "$self", pname0, DOH_REPLACE_ANY);
Replace(tm, "$extendgetcall", call, DOH_REPLACE_ANY);
Setattr(n, "wrap:action", tm);
Delete(tm);
Delete(pname0);
Delete(pname1);
Delete(target);
}
Delete(call);
Delete(target);
if (make_set_wrapper) {
Setattr(n, "sym:name", mrename_set);
functionWrapper(n);
@ -2477,13 +2476,6 @@ int Language::classHandler(Node *n) {
Node *m = Copy(method);
Setattr(m, "director", "1");
Setattr(m, "parentNode", n);
/*
* There is a bug that needs fixing still...
* This area of code is creating methods which have not been overidden in a derived class (director methods that are protected in the base)
* If the method is overloaded, then Swig_overload_dispatch() incorrectly generates a call to the base wrapper, _wrap_xxx method
* See director_protected_overloaded.i - Possibly sym:overname needs correcting here.
Printf(stdout, "new method: %s::%s(%s)\n", Getattr(parentNode(m), "name"), Getattr(m, "name"), ParmList_str_defaultargs(Getattr(m, "parms")));
*/
cDeclaration(m);
Delete(m);
}
@ -2963,9 +2955,14 @@ Node *Language::classLookup(SwigType *s) {
n = Getattr(classtypes, s);
if (!n) {
Symtab *stab = 0;
// SwigType *lt = SwigType_ltype(s);
// SwigType *ty1 = SwigType_typedef_resolve_all(lt);
SwigType *ty1 = SwigType_typedef_resolve_all(s);
SwigType *ty2 = SwigType_strip_qualifiers(ty1);
// Printf(stdout, " stages... ty1: %s ty2: %s\n", ty1, ty2);
// Delete(lt);
Delete(ty1);
// lt = 0;
ty1 = 0;
String *base = SwigType_base(ty2);
@ -2974,12 +2971,6 @@ Node *Language::classLookup(SwigType *s) {
Replaceall(base, "struct ", "");
Replaceall(base, "union ", "");
if (strncmp(Char(base), "::", 2) == 0) {
String *oldbase = base;
base = NewString(Char(base) + 2);
Delete(oldbase);
}
String *prefix = SwigType_prefix(ty2);
/* Do a symbol table search on the base type */
@ -3053,12 +3044,6 @@ Node *Language::enumLookup(SwigType *s) {
Replaceall(base, "enum ", "");
String *prefix = SwigType_prefix(ty2);
if (strncmp(Char(base), "::", 2) == 0) {
String *oldbase = base;
base = NewString(Char(base) + 2);
Delete(oldbase);
}
/* Look for type in symbol table */
while (!n) {
Hash *nstab;

View file

@ -92,7 +92,6 @@ NEW LANGUAGE NOTE:END ************************************************/
class LUA:public Language {
private:
File *f_begin;
File *f_runtime;
File *f_header;
File *f_wrappers;
@ -133,7 +132,6 @@ public:
* --------------------------------------------------------------------- */
LUA() {
f_begin = 0;
f_runtime = 0;
f_header = 0;
f_wrappers = 0;
@ -215,12 +213,11 @@ public:
String *outfile = Getattr(n, "outfile");
/* Open the output file */
f_begin = NewFile(outfile, "w", SWIG_output_files());
if (!f_begin) {
f_runtime = NewFile(outfile, "w");
if (!f_runtime) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
}
f_runtime = NewString("");
f_init = NewString("");
f_header = NewString("");
f_wrappers = NewString("");
@ -229,7 +226,6 @@ public:
/* Register file targets with the SWIG file handler */
Swig_register_filebyname("header", f_header);
Swig_register_filebyname("wrapper", f_wrappers);
Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("runtime", f_runtime);
Swig_register_filebyname("init", f_init);
Swig_register_filebyname("initbeforefunc", f_initbeforefunc);
@ -253,17 +249,11 @@ public:
current=NO_CPP;
/* Standard stuff for the SWIG runtime section */
Swig_banner(f_begin);
Printf(f_runtime, "\n");
Printf(f_runtime, "#define SWIGLUA\n");
Swig_banner(f_runtime);
// if (NoInclude) {
// Printf(f_runtime, "#define SWIG_NOINCLUDE\n");
// }
Printf(f_runtime, "\n");
//String *init_name = NewStringf("%(title)s_Init", module);
//Printf(f_header, "#define SWIG_init %s\n", init_name);
//Printf(f_header, "#define SWIG_name \"%s\"\n", module);
@ -298,14 +288,13 @@ public:
this basically combines several of the strings together
and then writes it all to a file
NEW LANGUAGE NOTE:END ************************************************/
Dump(f_runtime, f_begin);
Dump(f_header, f_begin);
Dump(f_wrappers, f_begin);
Dump(f_initbeforefunc, f_begin);
Dump(f_header, f_runtime);
Dump(f_wrappers, f_runtime);
Dump(f_initbeforefunc, f_runtime);
/* for the Lua code it needs to be properly excaped to be added into the C/C++ code */
EscapeCode(s_luacode);
Printf(f_begin, "const char* SWIG_LUACODE=\n \"%s\";\n\n",s_luacode);
Wrapper_pretty_print(f_init, f_begin);
Printf(f_runtime, "const char* SWIG_LUACODE=\n \"%s\";\n\n",s_luacode);
Wrapper_pretty_print(f_init, f_runtime);
/* Close all of the files */
Delete(s_luacode);
Delete(s_cmd_tab);
@ -315,9 +304,8 @@ public:
Delete(f_wrappers);
Delete(f_init);
Delete(f_initbeforefunc);
Close(f_begin);
Close(f_runtime);
Delete(f_runtime);
Delete(f_begin);
/* Done */
return SWIG_OK;

View file

@ -117,8 +117,7 @@ static const char *usage3 = (const char *) "\
-fastdispatch -fvirtual \n\
-o <outfile> - Set name of the output file to <outfile>\n\
-oh <headfile> - Set name of the output header file to <headfile>\n\
-outcurrentdir - Set default output dir to current dir instead of input file's path\n\
-outdir <dir> - Set language specific files output directory to <dir>\n\
-outdir <dir> - Set language specific files output directory <dir>\n\
-small - Compile in virtual elimination & compact mode\n\
-swiglib - Report location of SWIG library and exit\n\
-templatereduce - Reduce all the typedefs in templates\n\
@ -154,7 +153,6 @@ static char *cpp_extension = (char *) "cxx";
static char *depends_extension = (char *) "d";
static String *outdir = 0;
static String *xmlout = 0;
static int outcurrentdir = 0;
static int help = 0;
static int checkout = 0;
static int cpp_only = 0;
@ -182,16 +180,14 @@ static String *dependencies_target = 0;
static int external_runtime = 0;
static String *external_runtime_name = 0;
enum { STAGE1=1, STAGE2=2, STAGE3=4, STAGE4=8, STAGEOVERFLOW=16 };
static List *all_output_files = 0;
// -----------------------------------------------------------------------------
// check_suffix()
// check_suffix(char *name)
//
// Checks the suffix of a file to see if we should emit extern declarations.
// -----------------------------------------------------------------------------
static int check_suffix(String *filename) {
const char *name = Char(filename);
static int check_suffix(const char *name) {
const char *c;
if (!name)
return 0;
@ -285,7 +281,7 @@ static void set_outdir(const String *c_wrapper_file_dir) {
}
/* This function sets the name of the configuration file */
void SWIG_config_file(const_String_or_char_ptr filename) {
void SWIG_config_file(const String_or_char *filename) {
lang_config = NewString(filename);
}
@ -304,11 +300,6 @@ void SWIG_config_cppext(const char *ext) {
cpp_extension = (char *) ext;
}
List *SWIG_output_files() {
assert(all_output_files);
return all_output_files;
}
void SWIG_setfeature(const char *cfeature, const char *cvalue) {
Hash *features_hash = Swig_cparse_features();
String *name = NewString("");
@ -372,14 +363,13 @@ static void SWIG_dump_runtime() {
}
}
runtime = NewFile(outfile, "w", SWIG_output_files());
runtime = NewFile(outfile, "w");
if (!runtime) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
}
Swig_banner(runtime);
Printf(runtime, "\n");
s = Swig_include_sys("swiglabels.swg");
if (!s) {
@ -698,9 +688,6 @@ void SWIG_getoptions(int argc, char *argv[]) {
} else {
Swig_arg_error();
}
} else if (strcmp(argv[i], "-outcurrentdir") == 0) {
Swig_mark_arg(i);
outcurrentdir = 1;
} else if (strcmp(argv[i], "-Wall") == 0) {
Swig_mark_arg(i);
Swig_warnall();
@ -880,7 +867,6 @@ int SWIG_main(int argc, char *argv[], Language *l) {
}
libfiles = NewList();
all_output_files = NewList();
/* Check for SWIG_FEATURES environment variable */
@ -938,13 +924,12 @@ int SWIG_main(int argc, char *argv[], Language *l) {
// If we made it this far, looks good. go for it....
input_file = NewString(argv[argc - 1]);
Swig_filename_correct(input_file);
input_file = argv[argc - 1];
// If the user has requested to check out a file, handle that
if (checkout) {
DOH *s;
char *outfile = Char(input_file);
char *outfile = input_file;
if (outfile_name)
outfile = outfile_name;
@ -953,26 +938,30 @@ int SWIG_main(int argc, char *argv[], Language *l) {
s = Swig_include(input_file);
if (!s) {
Printf(stderr, "Unable to locate '%s' in the SWIG library.\n", input_file);
fprintf(stderr, "Unable to locate '%s' in the SWIG library.\n", input_file);
} else {
FILE *f = Swig_open(outfile);
FILE *f = fopen(outfile, "r");
if (f) {
fclose(f);
Printf(stderr, "File '%s' already exists. Checkout aborted.\n", outfile);
fprintf(stderr, "File '%s' already exists. Checkout aborted.\n", outfile);
} else {
File *f_outfile = NewFile(outfile, "w", SWIG_output_files());
if (!f_outfile) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
} else {
if (Verbose)
Printf(stdout, "'%s' checked out from the SWIG library.\n", outfile);
Printv(f_outfile, s, NIL);
Close(f_outfile);
}
f = fopen(outfile, "w");
if (!f) {
fprintf(stderr, "Unable to create file '%s'\n", outfile);
} else {
if (Verbose)
fprintf(stdout, "'%s' checked out from the SWIG library.\n", input_file);
fputs(Char(s), f);
fclose(f);
}
}
}
} else {
// Check the suffix for a .c file. If so, we're going to
// declare everything we see as "extern"
ForceExtern = check_suffix(input_file);
// Run the preprocessor
if (Verbose)
printf("Preprocessing...\n");
@ -982,22 +971,17 @@ int SWIG_main(int argc, char *argv[], Language *l) {
String *fs = NewString("");
FILE *df = Swig_open(input_file);
if (!df) {
df = Swig_include_open(input_file);
if (!df) {
char *cfile = Char(input_file);
if (cfile && cfile[0] == '-') {
Printf(stderr, "Unable to find option or file '%s', ", input_file);
Printf(stderr, "use 'swig -help' for more information.\n");
} else {
Printf(stderr, "Unable to find file '%s'.\n", input_file);
}
SWIG_exit(EXIT_FAILURE);
char *cfile = Char(input_file);
if (cfile && cfile[0] == '-') {
Printf(stderr, "Unable to find option or file '%s', ", input_file);
Printf(stderr, "use 'swig -help' for more information.\n");
} else {
Swig_warning(WARN_DEPRECATED_INPUT_FILE, "SWIG", 1, "Use of the include path to find the input file is deprecated and will not work with ccache. Please include the path when specifying the input file.\n"); // so that behaviour is like c/c++ compilers
Printf(stderr, "Unable to find file '%s'.\n", input_file);
}
SWIG_exit(EXIT_FAILURE);
}
fclose(df);
if (!no_cpp) {
fclose(df);
Printf(fs, "%%include <swig.swg>\n");
if (allkw) {
Printf(fs, "%%include <allkw.swg>\n");
@ -1005,7 +989,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
if (lang_config) {
Printf(fs, "\n%%include <%s>\n", lang_config);
}
Printf(fs, "%%include(maininput=\"%s\") \"%s\"\n", Swig_filename_escape(input_file), Swig_last_file());
Printf(fs, "%%include \"%s\"\n", Swig_last_file());
for (i = 0; i < Len(libfiles); i++) {
Printf(fs, "\n%%include \"%s\"\n", Getitem(libfiles, i));
}
@ -1013,8 +997,8 @@ int SWIG_main(int argc, char *argv[], Language *l) {
cpps = Preprocessor_parse(fs);
Delete(fs);
} else {
cpps = Swig_read_file(df);
fclose(df);
df = Swig_open(input_file);
cpps = NewFileFromFile(df);
}
if (Swig_error_count()) {
SWIG_exit(EXIT_FAILURE);
@ -1024,55 +1008,47 @@ int SWIG_main(int argc, char *argv[], Language *l) {
SWIG_exit(EXIT_SUCCESS);
}
if (depend) {
if (!no_cpp) {
String *outfile;
char *basename = Swig_file_basename(outcurrentdir ? Swig_file_filename(input_file): Char(input_file));
if (!outfile_name) {
if (CPlusPlus || lang->cplus_runtime_mode()) {
outfile = NewStringf("%s_wrap.%s", basename, cpp_extension);
} else {
outfile = NewStringf("%s_wrap.c", basename);
}
String *outfile;
if (!outfile_name) {
if (CPlusPlus || lang->cplus_runtime_mode()) {
outfile = NewStringf("%s_wrap.%s", Swig_file_basename(input_file), cpp_extension);
} else {
outfile = NewString(outfile_name);
outfile = NewStringf("%s_wrap.c", Swig_file_basename(input_file));
}
if (dependencies_file && Len(dependencies_file) != 0) {
f_dependencies_file = NewFile(dependencies_file, "w", SWIG_output_files());
if (!f_dependencies_file) {
FileErrorDisplay(dependencies_file);
SWIG_exit(EXIT_FAILURE);
}
} else if (!depend_only) {
String *filename = NewStringf("%s_wrap.%s", basename, depends_extension);
f_dependencies_file = NewFile(filename, "w", SWIG_output_files());
if (!f_dependencies_file) {
FileErrorDisplay(filename);
SWIG_exit(EXIT_FAILURE);
}
} else
f_dependencies_file = stdout;
if (dependencies_target) {
Printf(f_dependencies_file, "%s: ", dependencies_target);
} else {
Printf(f_dependencies_file, "%s: ", outfile);
}
List *files = Preprocessor_depend();
for (int i = 0; i < Len(files); i++) {
if ((depend != 2) || ((depend == 2) && (Strncmp(Getitem(files, i), SwigLib, Len(SwigLib)) != 0))) {
Printf(f_dependencies_file, "\\\n %s ", Getitem(files, i));
}
}
Printf(f_dependencies_file, "\n");
if (f_dependencies_file != stdout)
Close(f_dependencies_file);
if (depend_only)
SWIG_exit(EXIT_SUCCESS);
} else {
Printf(stderr, "Cannot generate dependencies with -nopreprocess\n");
// Actually we could but it would be inefficient when just generating dependencies, as it would be done after Swig_cparse
SWIG_exit(EXIT_FAILURE);
outfile = NewString(outfile_name);
}
if (dependencies_file && Len(dependencies_file) != 0) {
f_dependencies_file = NewFile(dependencies_file, "w");
if (!f_dependencies_file) {
FileErrorDisplay(dependencies_file);
SWIG_exit(EXIT_FAILURE);
}
} else if (!depend_only) {
String *filename = NewStringf("%s_wrap.%s", Swig_file_basename(input_file), depends_extension);
f_dependencies_file = NewFile(filename, "w");
if (!f_dependencies_file) {
FileErrorDisplay(filename);
SWIG_exit(EXIT_FAILURE);
}
} else
f_dependencies_file = stdout;
if (dependencies_target) {
Printf(f_dependencies_file, "%s: ", dependencies_target);
} else {
Printf(f_dependencies_file, "%s: ", outfile);
}
List *files = Preprocessor_depend();
for (int i = 0; i < Len(files); i++) {
if ((depend != 2) || ((depend == 2) && (Strncmp(Getitem(files, i), SwigLib, Len(SwigLib)) != 0))) {
Printf(f_dependencies_file, "\\\n %s ", Getitem(files, i));
}
}
Printf(f_dependencies_file, "\n");
if (f_dependencies_file != stdout)
Close(f_dependencies_file);
if (depend_only)
SWIG_exit(EXIT_SUCCESS);
}
Seek(cpps, 0, SEEK_SET);
}
@ -1150,30 +1126,22 @@ int SWIG_main(int argc, char *argv[], Language *l) {
}
if (top) {
if (!Getattr(top, "name")) {
Printf(stderr, "No module name specified using %%module or -module.\n");
Printf(stderr, "*** No module name specified using %%module or -module.\n");
SWIG_exit(EXIT_FAILURE);
} else {
/* Set some filename information on the object */
String *infile = scanner_get_main_input_file();
if (!infile) {
Printf(stderr, "Missing input file in preprocessed output.\n");
SWIG_exit(EXIT_FAILURE);
}
Setattr(top, "infile", infile); // Note: if nopreprocess then infile is the original input file, otherwise input_file
Setattr(top, "inputfile", input_file);
char *basename = Swig_file_basename(outcurrentdir ? Swig_file_filename(infile): Char(infile));
Setattr(top, "infile", input_file);
if (!outfile_name) {
if (CPlusPlus || lang->cplus_runtime_mode()) {
Setattr(top, "outfile", NewStringf("%s_wrap.%s", basename, cpp_extension));
Setattr(top, "outfile", NewStringf("%s_wrap.%s", Swig_file_basename(input_file), cpp_extension));
} else {
Setattr(top, "outfile", NewStringf("%s_wrap.c", basename));
Setattr(top, "outfile", NewStringf("%s_wrap.c", Swig_file_basename(input_file)));
}
} else {
Setattr(top, "outfile", outfile_name);
}
if (!outfile_name_h) {
Setattr(top, "outfile_h", NewStringf("%s_wrap.%s", basename, hpp_extension));
Setattr(top, "outfile_h", NewStringf("%s_wrap.%s", Swig_file_basename(input_file), hpp_extension));
} else {
Setattr(top, "outfile_h", outfile_name_h);
}
@ -1181,12 +1149,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
if (Swig_contract_mode_get()) {
Swig_contracts(top);
}
// Check the suffix for a c/c++ file. If so, we're going to declare everything we see as "extern"
ForceExtern = check_suffix(input_file);
lang->top(top);
if (browse) {
Swig_browser(top, 0);
}
@ -1210,21 +1173,6 @@ int SWIG_main(int argc, char *argv[], Language *l) {
if (memory_debug)
DohMemoryDebug();
char *outfiles = getenv("CCACHE_OUTFILES");
if (outfiles) {
File *f_outfiles = NewFile(outfiles, "w", 0);
if (!f_outfiles) {
Printf(stderr, "Failed to write list of output files to the filename '%s' specified in CCACHE_OUTFILES environment variable - ", outfiles);
FileErrorDisplay(outfiles);
SWIG_exit(EXIT_FAILURE);
} else {
int i;
for (i = 0; i < Len(all_output_files); i++)
Printf(f_outfiles, "%s\n", Getitem(all_output_files, i));
Close(f_outfiles);
}
}
// Deletes
Delete(libfiles);
Preprocessor_delete();

View file

@ -127,7 +127,7 @@ char cvsroot_modula3_cxx[] = "$Id$";
#include <limits.h> // for INT_MAX
#include <ctype.h>
#define USAGE_ARG_DIR "m3wrapargdir typemap expect values: in, out, inout\n"
const char usageArgDir[] = "m3wrapargdir typemap expect values: in, out, inout\n";
class MODULA3:public Language {
public:
@ -172,7 +172,6 @@ private:
const String *empty_string;
Hash *swig_types_hash;
File *f_begin;
File *f_runtime;
File *f_header;
File *f_wrappers;
@ -238,7 +237,6 @@ public:
MODULA3():
empty_string(NewString("")),
swig_types_hash(NULL),
f_begin(NULL),
f_runtime(NULL),
f_header(NULL),
f_wrappers(NULL),
@ -376,7 +374,7 @@ MODULA3():
} else if (Strcmp(dir, "out") == 0) {
return false;
} else {
printf("%s", USAGE_ARG_DIR);
printf(usageArgDir);
return false;
}
}
@ -388,7 +386,7 @@ MODULA3():
} else if ((Strcmp(dir, "out") == 0) || (Strcmp(dir, "inout") == 0)) {
return true;
} else {
printf("%s", USAGE_ARG_DIR);
printf(usageArgDir);
return false;
}
}
@ -544,7 +542,7 @@ MODULA3():
* ----------------------------------------------------------------------------- */
File *openWriteFile(String *name) {
File *file = NewFile(name, "w", SWIG_output_files());
File *file = NewFile(name, "w");
if (!file) {
FileErrorDisplay(name);
SWIG_exit(EXIT_FAILURE);
@ -904,12 +902,11 @@ MODULA3():
/* Initialize all of the output files */
outfile = Getattr(n, "outfile");
f_begin = NewFile(outfile, "w", SWIG_output_files());
if (!f_begin) {
f_runtime = NewFile(outfile, "w");
if (!f_runtime) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
}
f_runtime = NewString("");
f_init = NewString("");
f_header = NewString("");
f_wrappers = NewString("");
@ -919,7 +916,6 @@ MODULA3():
/* Register file targets with the SWIG file handler */
Swig_register_filebyname("header", f_header);
Swig_register_filebyname("wrapper", f_wrappers);
Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("runtime", f_runtime);
Swig_register_filebyname("init", f_init);
@ -960,11 +956,7 @@ MODULA3():
module_imports = NewString("");
upcasts_code = NewString("");
Swig_banner(f_begin);
Printf(f_runtime, "\n");
Printf(f_runtime, "#define SWIGMODULA3\n");
Printf(f_runtime, "\n");
Swig_banner(f_runtime); // Print the SWIG banner message
Swig_name_register((char *) "wrapper", (char *) "Modula3_%f");
if (old_variable_names) {
@ -1151,16 +1143,14 @@ MODULA3():
typemapfilename = NULL;
/* Close all of the files */
Dump(f_runtime, f_begin);
Dump(f_header, f_begin);
Dump(f_wrappers, f_begin);
Wrapper_pretty_print(f_init, f_begin);
Dump(f_header, f_runtime);
Dump(f_wrappers, f_runtime);
Wrapper_pretty_print(f_init, f_runtime);
Delete(f_header);
Delete(f_wrappers);
Delete(f_init);
Close(f_begin);
Close(f_runtime);
Delete(f_runtime);
Delete(f_begin);
return SWIG_OK;
}
@ -1169,9 +1159,14 @@ MODULA3():
* ----------------------------------------------------------------------------- */
void emitBanner(File *f) {
Printf(f, "(*******************************************************************************\n");
Swig_banner_target_lang(f, " *");
Printf(f, "*******************************************************************************)\n\n");
Printf(f, "\
(*******************************************************************************\n\
* This file was automatically generated by SWIG (http://www.swig.org/).\n\
* Version %s\n\
*\n\
* Do not make changes to this file unless you know what you are doing --\n\
* modify the SWIG interface file instead.\n\
*******************************************************************************)\n\n", Swig_package_version());
}
/* ----------------------------------------------------------------------
@ -2387,7 +2382,7 @@ MODULA3():
}
String *filen = NewStringf("%s%s.m3", Swig_file_dirname(outfile), proxy_class_name);
f_proxy = NewFile(filen, "w", SWIG_output_files());
f_proxy = NewFile(filen, "w");
if (!f_proxy) {
FileErrorDisplay(filen);
SWIG_exit(EXIT_FAILURE);
@ -3179,7 +3174,8 @@ MODULA3():
Clear(result_m3wraptype);
Printv(result_m3wraptype, tm, NIL);
} else {
Swig_warning(WARN_MODULA3_TYPEMAP_MULTIPLE_RETURN, input_file, line_number,
Swig_warning(WARN_MODULA3_TYPEMAP_MULTIPLE_RETURN,
input_file, line_number,
"Typemap m3wrapargdir set to 'out' for %s implies a RETURN value, but the routine %s has already one.\nUse %%multiretval feature.\n",
SwigType_str(Getattr(p, "type"), 0), raw_name);
}
@ -3766,7 +3762,7 @@ MODULA3():
void emitTypeWrapperClass(String *classname, SwigType *type) {
String *filen = NewStringf("%s%s.m3", Swig_file_dirname(outfile), classname);
File *f_swigtype = NewFile(filen, "w", SWIG_output_files());
File *f_swigtype = NewFile(filen, "w");
if (!f_swigtype) {
FileErrorDisplay(filen);
SWIG_exit(EXIT_FAILURE);

View file

@ -39,7 +39,6 @@ static String *module = 0;
static char *mzscheme_path = (char *) "mzscheme";
static String *init_func_def = 0;
static File *f_begin = 0;
static File *f_runtime = 0;
static File *f_header = 0;
static File *f_wrappers = 0;
@ -130,12 +129,11 @@ public:
/* Initialize all of the output files */
String *outfile = Getattr(n, "outfile");
f_begin = NewFile(outfile, "w", SWIG_output_files());
if (!f_begin) {
f_runtime = NewFile(outfile, "w");
if (!f_runtime) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
}
f_runtime = NewString("");
f_init = NewString("");
f_header = NewString("");
f_wrappers = NewString("");
@ -143,17 +141,13 @@ public:
/* Register file targets with the SWIG file handler */
Swig_register_filebyname("header", f_header);
Swig_register_filebyname("wrapper", f_wrappers);
Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("runtime", f_runtime);
init_func_def = NewString("");
Swig_register_filebyname("init", init_func_def);
Swig_banner(f_begin);
Printf(f_runtime, "\n");
Printf(f_runtime, "#define SWIGMZSCHEME\n");
Printf(f_runtime, "\n");
Printf(f_runtime, "/* -*- buffer-read-only: t -*- vi: set ro: */\n");
Swig_banner(f_runtime);
module = Getattr(n, "name");
@ -192,16 +186,14 @@ public:
}
/* Close all of the files */
Dump(f_runtime, f_begin);
Dump(f_header, f_begin);
Dump(f_wrappers, f_begin);
Wrapper_pretty_print(f_init, f_begin);
Dump(f_header, f_runtime);
Dump(f_wrappers, f_runtime);
Wrapper_pretty_print(f_init, f_runtime);
Delete(f_header);
Delete(f_wrappers);
Delete(f_init);
Close(f_begin);
Close(f_runtime);
Delete(f_runtime);
Delete(f_begin);
return SWIG_OK;
}

112
Source/Modules/ocaml.cxx Normal file → Executable file
View file

@ -38,7 +38,6 @@ static Hash *seen_enumvalues = 0;
static Hash *seen_constructors = 0;
static File *f_header = 0;
static File *f_begin = 0;
static File *f_runtime = 0;
static File *f_wrappers = 0;
static File *f_directors = 0;
@ -215,12 +214,11 @@ public:
/* Initialize all of the output files */
String *outfile = Getattr(n, "outfile");
f_begin = NewFile(outfile, "w", SWIG_output_files());
if (!f_begin) {
f_runtime = NewFile(outfile, "w");
if (!f_runtime) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
}
f_runtime = NewString("");
f_init = NewString("");
f_header = NewString("");
f_wrappers = NewString("");
@ -249,7 +247,6 @@ public:
Swig_register_filebyname("init", init_func_def);
Swig_register_filebyname("header", f_header);
Swig_register_filebyname("wrapper", f_wrappers);
Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("runtime", f_runtime);
Swig_register_filebyname("mli", f_mlibody);
Swig_register_filebyname("ml", f_mlbody);
@ -265,10 +262,7 @@ public:
Swig_name_register("get", "%v__get__");
}
Swig_banner(f_begin);
Printf(f_runtime, "\n");
Printf(f_runtime, "#define SWIGOCAML\n");
Printf(f_runtime, "/* -*- buffer-read-only: t -*- vi: set ro: */\n");
Printf(f_runtime, "#define SWIG_MODULE \"%s\"\n", module);
/* Module name */
Printf(f_mlbody, "let module_name = \"%s\"\n", module);
@ -282,12 +276,12 @@ public:
Printf(f_int_to_enum, "let int_to_enum x y =\n" " match (x : c_enum_type) with\n" " `unknown -> C_enum (`Int y)\n");
Swig_banner(f_runtime);
if (directorsEnabled()) {
Printf(f_runtime, "#define SWIG_DIRECTORS\n");
}
Printf(f_runtime, "\n");
/* Produce the enum_to_int and int_to_enum functions */
Printf(f_enumtypes_type, "open Swig\n" "type c_enum_type = [ \n `unknown\n");
@ -299,12 +293,12 @@ public:
Printv(mlifile, module, ".mli", NIL);
String *mlfilen = NewStringf("%s%s", SWIG_output_directory(), mlfile);
if ((f_mlout = NewFile(mlfilen, "w", SWIG_output_files())) == 0) {
if ((f_mlout = NewFile(mlfilen, "w")) == 0) {
FileErrorDisplay(mlfilen);
SWIG_exit(EXIT_FAILURE);
}
String *mlifilen = NewStringf("%s%s", SWIG_output_directory(), mlifile);
if ((f_mliout = NewFile(mlifilen, "w", SWIG_output_files())) == 0) {
if ((f_mliout = NewFile(mlifilen, "w")) == 0) {
FileErrorDisplay(mlifilen);
SWIG_exit(EXIT_FAILURE);
}
@ -328,18 +322,16 @@ public:
SwigType_emit_type_table(f_runtime, f_wrappers);
/* Close all of the files */
Dump(f_runtime, f_begin);
Dump(f_directors_h, f_header);
Dump(f_header, f_begin);
Dump(f_header, f_runtime);
Dump(f_directors, f_wrappers);
Dump(f_wrappers, f_begin);
Wrapper_pretty_print(f_init, f_begin);
Dump(f_wrappers, f_runtime);
Wrapper_pretty_print(f_init, f_runtime);
Delete(f_header);
Delete(f_wrappers);
Delete(f_init);
Close(f_begin);
Close(f_runtime);
Delete(f_runtime);
Delete(f_begin);
Dump(f_enumtypes_type, f_mlout);
Dump(f_enumtypes_value, f_mlout);
@ -1300,50 +1292,56 @@ public:
* which means looking up and registering by typedef and enum name. */
int enumDeclaration(Node *n) {
String *name = Getattr(n, "name");
if (name) {
String *oname = NewString(name);
/* name is now fully qualified */
String *fully_qualified_name = NewString(name);
bool seen_enum = false;
if (name_qualifier)
Delete(name_qualifier);
char *strip_position;
name_qualifier = fully_qualify_enum_name(n, NewString(""));
String *oname = name ? NewString(name) : NULL;
/* name is now fully qualified */
String *fully_qualified_name = NewString(name);
bool seen_enum = false;
if (name_qualifier)
Delete(name_qualifier);
char *strip_position;
name_qualifier = fully_qualify_enum_name(n, NewString(""));
/* Recent changes have distrubed enum and template naming again.
* Will try to keep it consistent by can't guarantee much given
* that these things move around a lot.
*
* I need to figure out a way to isolate this module better.
*/
if (oname) {
strip_position = strstr(Char(oname), "::");
while (strip_position) {
strip_position += 2;
oname = NewString(strip_position);
strip_position = strstr(Char(oname), "::");
strip_position += 2;
oname = NewString(strip_position);
strip_position = strstr(Char(oname), "::");
}
}
seen_enum = oname ? (Getattr(seen_enums, fully_qualified_name) ? true : false) : false;
if (oname && !seen_enum) {
const_enum = true;
Printf(f_enum_to_int, "| `%s -> (match y with\n", oname);
Printf(f_int_to_enum, "| `%s -> C_enum (\n", oname);
/* * * * A note about enum name resolution * * * *
* This code should now work, but I think we can do a bit better.
* The problem I'm having is that swig isn't very precise about
* typedef name resolution. My opinion is that SwigType_typedef
* resolve_all should *always* return the enum tag if one exists,
* rather than the admittedly friendlier enclosing typedef.
*
* This would make one of the cases below unnecessary.
* * * */
Printf(f_mlbody, "let _ = Callback.register \"%s_marker\" (`%s)\n", fully_qualified_name, oname);
if (!strncmp(Char(fully_qualified_name), "enum ", 5)) {
String *fq_noenum = NewString(Char(fully_qualified_name) + 5);
Printf(f_mlbody,
"let _ = Callback.register \"%s_marker\" (`%s)\n" "let _ = Callback.register \"%s_marker\" (`%s)\n", fq_noenum, oname, fq_noenum, name);
}
seen_enum = (Getattr(seen_enums, fully_qualified_name) ? true : false);
if (!seen_enum) {
const_enum = true;
Printf(f_enum_to_int, "| `%s -> (match y with\n", oname);
Printf(f_int_to_enum, "| `%s -> C_enum (\n", oname);
/* * * * A note about enum name resolution * * * *
* This code should now work, but I think we can do a bit better.
* The problem I'm having is that swig isn't very precise about
* typedef name resolution. My opinion is that SwigType_typedef
* resolve_all should *always* return the enum tag if one exists,
* rather than the admittedly friendlier enclosing typedef.
*
* This would make one of the cases below unnecessary.
* * * */
Printf(f_mlbody, "let _ = Callback.register \"%s_marker\" (`%s)\n", fully_qualified_name, oname);
if (!strncmp(Char(fully_qualified_name), "enum ", 5)) {
String *fq_noenum = NewString(Char(fully_qualified_name) + 5);
Printf(f_mlbody,
"let _ = Callback.register \"%s_marker\" (`%s)\n" "let _ = Callback.register \"%s_marker\" (`%s)\n", fq_noenum, oname, fq_noenum, name);
}
Printf(f_enumtypes_type, "| `%s\n", oname);
Insert(fully_qualified_name, 0, "enum ");
Setattr(seen_enums, fully_qualified_name, n);
}
Printf(f_enumtypes_type, "| `%s\n", oname);
Insert(fully_qualified_name, 0, "enum ");
Setattr(seen_enums, fully_qualified_name, n);
}
int ret = Language::enumDeclaration(n);

View file

@ -7,7 +7,7 @@
* Octave language module for SWIG.
* ----------------------------------------------------------------------------- */
char cvsroot_octave_cxx[] = "$Id: octave.cxx 10538 2008-06-21 14:51:02Z maciekd $";
char cvsroot_octave_cxx[] = "$Id$";
#include "swigmod.h"
@ -18,7 +18,6 @@ Octave Options (available with -octave)\n\
class OCTAVE:public Language {
private:
File *f_begin;
File *f_runtime;
File *f_header;
File *f_doc;
@ -38,16 +37,9 @@ private:
Hash *docs;
public:
OCTAVE():f_begin(0), f_runtime(0), f_header(0), f_doc(0), f_wrappers(0),
OCTAVE():f_runtime(0), f_header(0), f_doc(0), f_wrappers(0),
f_init(0), f_initbeforefunc(0), f_directors(0), f_directors_h(0),
s_global_tab(0), s_members_tab(0), class_name(0) {
/* Add code to manage protected constructors and directors */
director_prot_ctor_code = NewString("");
Printv(director_prot_ctor_code,
"if ( $comparison ) { /* subclassed */\n",
" $director_new \n",
"} else {\n", " error(\"accessing abstract class or protected constructor\"); \n", " SWIG_fail;\n", "}\n", NIL);
enable_cplus_runtime_mode();
allow_overloading();
director_multiple_inheritance = 1;
@ -95,12 +87,11 @@ public:
String *module = Getattr(n, "name");
String *outfile = Getattr(n, "outfile");
f_begin = NewFile(outfile, "w", SWIG_output_files());
if (!f_begin) {
f_runtime = NewFile(outfile, "w");
if (!f_runtime) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
}
f_runtime = NewString("");
f_header = NewString("");
f_doc = NewString("");
f_wrappers = NewString("");
@ -109,7 +100,6 @@ public:
f_directors_h = NewString("");
f_directors = NewString("");
s_global_tab = NewString("");
Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("runtime", f_runtime);
Swig_register_filebyname("header", f_header);
Swig_register_filebyname("doc", f_doc);
@ -118,16 +108,11 @@ public:
Swig_register_filebyname("initbeforefunc", f_initbeforefunc);
Swig_register_filebyname("director", f_directors);
Swig_register_filebyname("director_h", f_directors_h);
Swig_banner(f_begin);
Printf(f_runtime, "\n");
Printf(f_runtime, "#define SWIGOCTAVE\n");
Swig_banner(f_runtime);
Printf(f_runtime, "#define SWIG_name_d \"%s\"\n", module);
Printf(f_runtime, "#define SWIG_name %s\n", module);
if (directorsEnabled()) {
Printf(f_runtime, "#define SWIG_DIRECTORS\n");
Swig_banner(f_directors_h);
if (dirprot_mode()) {
// Printf(f_directors_h, "#include <map>\n");
@ -135,7 +120,6 @@ public:
}
}
Printf(f_runtime, "\n");
Printf(s_global_tab, "\nstatic const struct swig_octave_member swig_globals[] = {\n");
Printf(f_init, "static void SWIG_init_user(octave_swig_type* module_ns)\n{\n");
@ -159,16 +143,15 @@ public:
Printv(f_wrappers, s_global_tab, NIL);
SwigType_emit_type_table(f_runtime, f_wrappers);
Dump(f_runtime, f_begin);
Dump(f_header, f_begin);
Dump(f_doc, f_begin);
Dump(f_header, f_runtime);
Dump(f_doc, f_runtime);
if (directorsEnabled()) {
Dump(f_directors_h, f_begin);
Dump(f_directors, f_begin);
Dump(f_directors_h, f_runtime);
Dump(f_directors, f_runtime);
}
Dump(f_wrappers, f_begin);
Dump(f_initbeforefunc, f_begin);
Wrapper_pretty_print(f_init, f_begin);
Dump(f_wrappers, f_runtime);
Dump(f_initbeforefunc, f_runtime);
Wrapper_pretty_print(f_init, f_runtime);
Delete(s_global_tab);
Delete(f_initbeforefunc);
@ -178,9 +161,8 @@ public:
Delete(f_header);
Delete(f_directors);
Delete(f_directors_h);
Close(f_begin);
Close(f_runtime);
Delete(f_runtime);
Delete(f_begin);
return SWIG_OK;
}

View file

@ -316,7 +316,7 @@ static bool print_typecheck(String *f, int j, Parm *pj) {
* ReplaceFormat()
* ----------------------------------------------------------------------------- */
static String *ReplaceFormat(const_String_or_char_ptr fmt, int j) {
static String *ReplaceFormat(const String_or_char *fmt, int j) {
String *lfmt = NewString(fmt);
char buf[50];
sprintf(buf, "%d", j);
@ -352,7 +352,7 @@ static String *ReplaceFormat(const_String_or_char_ptr fmt, int j) {
/*
Cast dispatch mechanism.
*/
String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *maxargs) {
String *Swig_overload_dispatch_cast(Node *n, const String_or_char *fmt, int *maxargs) {
int i, j;
*maxargs = 1;
@ -536,7 +536,7 @@ String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *
/*
Fast dispatch mechanism, provided by Salvador Fandi~no Garc'ia (#930586).
*/
String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *maxargs) {
String *Swig_overload_dispatch_fast(Node *n, const String_or_char *fmt, int *maxargs) {
int i, j;
*maxargs = 1;
@ -695,7 +695,7 @@ String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *
return f;
}
String *Swig_overload_dispatch(Node *n, const_String_or_char_ptr fmt, int *maxargs) {
String *Swig_overload_dispatch(Node *n, const String_or_char *fmt, int *maxargs) {
if (fast_dispatch_mode || GetFlag(n, "feature:fastdispatch")) {
return Swig_overload_dispatch_fast(n, fmt, maxargs);

View file

@ -78,7 +78,6 @@ static String *command_tab = 0;
static String *constant_tab = 0;
static String *variable_tab = 0;
static File *f_begin = 0;
static File *f_runtime = 0;
static File *f_header = 0;
static File *f_wrappers = 0;
@ -208,7 +207,6 @@ public:
}
Preprocessor_define("SWIGPERL 1", 0);
// SWIGPERL5 is deprecated, and no longer documented.
Preprocessor_define("SWIGPERL5 1", 0);
SWIG_typemap_lang("perl5");
SWIG_config_file("perl5.swg");
@ -224,12 +222,11 @@ public:
/* Initialize all of the output files */
String *outfile = Getattr(n, "outfile");
f_begin = NewFile(outfile, "w", SWIG_output_files());
if (!f_begin) {
f_runtime = NewFile(outfile, "w");
if (!f_runtime) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
}
f_runtime = NewString("");
f_init = NewString("");
f_header = NewString("");
f_wrappers = NewString("");
@ -237,7 +234,6 @@ public:
/* Register file targets with the SWIG file handler */
Swig_register_filebyname("header", f_header);
Swig_register_filebyname("wrapper", f_wrappers);
Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("runtime", f_runtime);
Swig_register_filebyname("init", f_init);
@ -256,12 +252,11 @@ public:
constant_tab = NewString("static swig_constant_info swig_constants[] = {\n");
variable_tab = NewString("static swig_variable_info swig_variables[] = {\n");
Swig_banner(f_begin);
Swig_banner(f_runtime);
Printf(f_runtime, "\n");
Printf(f_runtime, "#define SWIGPERL\n");
Printf(f_runtime, "#define SWIG_CASTRANK_MODE\n");
Printf(f_runtime, "\n");
// Is the imported module in another package? (IOW, does it use the
// %module(package="name") option and it's different than the package
@ -320,7 +315,7 @@ public:
pmfile = NewStringf("%s.pm", m);
}
String *filen = NewStringf("%s%s", SWIG_output_directory(), pmfile);
if ((f_pm = NewFile(filen, "w", SWIG_output_files())) == 0) {
if ((f_pm = NewFile(filen, "w")) == 0) {
FileErrorDisplay(filen);
SWIG_exit(EXIT_FAILURE);
}
@ -337,7 +332,10 @@ public:
Delete(boot_name);
}
Swig_banner_target_lang(f_pm, "#");
Printf(f_pm, "# This file was automatically generated by SWIG (http://www.swig.org).\n");
Printf(f_pm, "# Version %s\n", Swig_package_version());
Printf(f_pm, "#\n");
Printf(f_pm, "# Don't modify this file, modify the SWIG interface instead.\n");
Printf(f_pm, "\n");
Printf(f_pm, "package %s;\n", module);
@ -526,16 +524,14 @@ public:
Delete(underscore_module);
/* Close all of the files */
Dump(f_runtime, f_begin);
Dump(f_header, f_begin);
Dump(f_wrappers, f_begin);
Wrapper_pretty_print(f_init, f_begin);
Dump(f_header, f_runtime);
Dump(f_wrappers, f_runtime);
Wrapper_pretty_print(f_init, f_runtime);
Delete(f_header);
Delete(f_wrappers);
Delete(f_init);
Close(f_begin);
Close(f_runtime);
Delete(f_runtime);
Delete(f_begin);
return SWIG_OK;
}
@ -1145,9 +1141,8 @@ public:
/* Do some work on the class name */
if (verbose > 0) {
String *modulename = Getattr(clsmodule, "name");
fprintf(stdout, "setclassname: Found sym:name: %s\n", Char(symname));
fprintf(stdout, "setclassname: Found module: %s\n", Char(modulename));
fprintf(stdout, "setclassname: Found module: %s\n", Char(clsmodule));
fprintf(stdout, "setclassname: No package found\n");
}
@ -1629,7 +1624,7 @@ public:
} else if (Strcmp(code, "include") == 0) {
/* Include a file into the .pm file */
if (value) {
FILE *f = Swig_include_open(value);
FILE *f = Swig_open(value);
if (!f) {
Printf(stderr, "%s : Line %d. Unable to locate file %s\n", input_file, line_number, value);
} else {

File diff suppressed because it is too large Load diff

View file

@ -39,7 +39,6 @@ Pike Options (available with -pike)\n\
class PIKE:public Language {
private:
File *f_begin;
File *f_runtime;
File *f_header;
File *f_wrappers;
@ -70,7 +69,6 @@ public:
* --------------------------------------------------------------------- */
PIKE() {
f_begin = 0;
f_runtime = 0;
f_header = 0;
f_wrappers = 0;
@ -125,12 +123,11 @@ public:
String *outfile = Getattr(n, "outfile");
/* Open the output file */
f_begin = NewFile(outfile, "w", SWIG_output_files());
if (!f_begin) {
f_runtime = NewFile(outfile, "w");
if (!f_runtime) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
}
f_runtime = NewString("");
f_init = NewString("");
f_classInit = NewString("");
f_header = NewString("");
@ -139,17 +136,12 @@ public:
/* Register file targets with the SWIG file handler */
Swig_register_filebyname("header", f_header);
Swig_register_filebyname("wrapper", f_wrappers);
Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("runtime", f_runtime);
Swig_register_filebyname("init", f_init);
Swig_register_filebyname("classInit", f_classInit);
/* Standard stuff for the SWIG runtime section */
Swig_banner(f_begin);
Printf(f_runtime, "\n");
Printf(f_runtime, "#define SWIGPIKE\n");
Printf(f_runtime, "\n");
Swig_banner(f_runtime);
Printf(f_header, "#define SWIG_init pike_module_init\n");
Printf(f_header, "#define SWIG_name \"%s\"\n\n", module);
@ -169,19 +161,17 @@ public:
SwigType_emit_type_table(f_runtime, f_wrappers);
/* Close all of the files */
Dump(f_runtime, f_begin);
Dump(f_header, f_begin);
Dump(f_wrappers, f_begin);
Wrapper_pretty_print(f_init, f_begin);
Dump(f_header, f_runtime);
Dump(f_wrappers, f_runtime);
Wrapper_pretty_print(f_init, f_runtime);
Delete(f_header);
Delete(f_wrappers);
Delete(f_init);
Delete(f_classInit);
Close(f_begin);
Close(f_runtime);
Delete(f_runtime);
Delete(f_begin);
/* Done */
return SWIG_OK;
@ -231,7 +221,7 @@ public:
* name (i.e. "enum_test").
* ------------------------------------------------------------ */
String *strip(const DOHconst_String_or_char_ptr name) {
String *strip(const DOHString_or_char *name) {
String *s = Copy(name);
if (Strncmp(name, PrefixPlusUnderscore, Len(PrefixPlusUnderscore)) != 0) {
return s;
@ -244,7 +234,7 @@ public:
* add_method()
* ------------------------------------------------------------ */
void add_method(const DOHconst_String_or_char_ptr name, const DOHconst_String_or_char_ptr function, const DOHconst_String_or_char_ptr description) {
void add_method(const DOHString_or_char *name, const DOHString_or_char *function, const DOHString_or_char *description) {
String *rename = NULL;
switch (current) {
case NO_CPP:

File diff suppressed because it is too large Load diff

View file

@ -424,7 +424,6 @@ protected:
String *sfile;
String *f_init;
String *s_classes;
String *f_begin;
String *f_runtime;
String *f_wrapper;
String *s_header;
@ -488,7 +487,6 @@ R::R() :
sfile(0),
f_init(0),
s_classes(0),
f_begin(0),
f_runtime(0),
f_wrapper(0),
s_header(0),
@ -769,7 +767,6 @@ void R::init() {
sfile = NewString("");
f_init = NewString("");
s_header = NewString("");
f_begin = NewString("");
f_runtime = NewString("");
f_wrapper = NewString("");
s_classes = NewString("");
@ -814,22 +811,16 @@ int R::top(Node *n) {
Swig_register_filebyname("sinit", s_init);
Swig_register_filebyname("sinitroutine", s_init_routine);
Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("runtime", f_runtime);
Swig_register_filebyname("init", f_init);
Swig_register_filebyname("header", s_header);
Swig_register_filebyname("wrapper", f_wrapper);
Swig_register_filebyname("s", sfile);
Swig_register_filebyname("sclasses", s_classes);
Swig_banner(f_begin);
Printf(f_runtime, "\n");
Printf(f_runtime, "#define SWIGR\n");
Printf(f_runtime, "\n");
Swig_banner_target_lang(s_init, "#");
Printf(s_init, "# This is an automatically generated file by the R module for SWIG.\n\n");
outputCommandLineArguments(s_init);
Printf(f_wrapper, "#ifdef __cplusplus\n");
@ -867,9 +858,7 @@ int R::top(Node *n) {
Delete(f_init);
Delete(s_header);
Close(f_begin);
Delete(f_runtime);
Delete(f_begin);
return SWIG_OK;
}
@ -889,7 +878,7 @@ int R::DumpCode(Node *n) {
Printf(stderr, "Writing S code to %s\n", output_filename);
#endif
File *scode = NewFile(output_filename, "w", SWIG_output_files());
File *scode = NewFile(output_filename, "w");
if (!scode) {
FileErrorDisplay(output_filename);
SWIG_exit(EXIT_FAILURE);
@ -904,16 +893,25 @@ int R::DumpCode(Node *n) {
Close(scode);
// Delete(scode);
String *outfile = Getattr(n,"outfile");
File *runtime = NewFile(outfile,"w", SWIG_output_files());
File *runtime = NewFile(outfile,"w");
if (!runtime) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
}
Printf(runtime, "%s", f_begin);
Swig_banner(runtime);
Printf(runtime, "/* Runtime */\n");
Printf(runtime, "%s\n", f_runtime);
Printf(runtime, "/* Header */\n");
Printf(runtime, "%s\n", s_header);
Printf(runtime, "/* Wrapper */\n");
Printf(runtime, "%s\n", f_wrapper);
Printf(runtime, "/* Init code */\n");
Printf(runtime, "%s\n", f_init);
Close(runtime);
@ -922,7 +920,7 @@ int R::DumpCode(Node *n) {
if(outputNamespaceInfo) {
output_filename = NewString("");
Printf(output_filename, "%sNAMESPACE", SWIG_output_directory());
File *ns = NewFile(output_filename, "w", SWIG_output_files());
File *ns = NewFile(output_filename, "w");
if (!ns) {
FileErrorDisplay(output_filename);
SWIG_exit(EXIT_FAILURE);
@ -2576,9 +2574,9 @@ String * R::runtimeCode() {
void R::main(int argc, char *argv[]) {
bool cppcast = true;
init();
Preprocessor_define("SWIGR 1", 0);
SWIG_library_directory("r");
SWIG_config_file("r.swg");
Preprocessor_define("SWIGR 1", 0);
debugMode = false;
copyStruct = true;
memoryProfile = false;
@ -2661,7 +2659,7 @@ int R::outputCommandLineArguments(File *out)
if(Argc < 1 || !Argv || !Argv[0])
return(-1);
Printf(out, "\n## Generated via the command line invocation:\n##\t");
Printf(out, "## Generated via the command line invocation:\n##\t");
for(int i = 0; i < Argc ; i++) {
Printf(out, " %s", Argv[i]);
}

View file

@ -30,7 +30,7 @@ public:
/**
* The C variable name used in the SWIG-generated wrapper code to refer to
* this class; usually it is of the form "SwigClassXXX.klass", where SwigClassXXX
* this class; usually it is of the form "cClassName.klass", where cClassName
* is a swig_class struct instance and klass is a member of that struct.
*/
String *vname;
@ -39,7 +39,7 @@ public:
* The C variable name used in the SWIG-generated wrapper code to refer to
* the module that implements this class's methods (when we're trying to
* support C++ multiple inheritance). Usually it is of the form
* "SwigClassClassName.mImpl", where SwigClassXXX is a swig_class struct instance
* "cClassName.mImpl", where cClassName is a swig_class struct instance
* and mImpl is a member of that struct.
*/
String *mImpl;
@ -78,7 +78,7 @@ public:
Delete(temp);
}
void set_name(const_String_or_char_ptr cn, const_String_or_char_ptr rn, const_String_or_char_ptr valn) {
void set_name(const String_or_char *cn, const String_or_char *rn, const String_or_char *valn) {
/* Original C/C++ class (or struct) name */
Clear(cname);
Append(cname, cn);
@ -93,18 +93,18 @@ public:
/* Variable name for the VALUE that refers to the Ruby Class object */
Clear(vname);
Printf(vname, "SwigClass%s.klass", name);
Printf(vname, "c%s.klass", name);
/* Variable name for the VALUE that refers to the Ruby Class object */
Clear(mImpl);
Printf(mImpl, "SwigClass%s.mImpl", name);
Printf(mImpl, "c%s.mImpl", name);
/* Prefix */
Clear(prefix);
Printv(prefix, (rn ? rn : cn), "_", NIL);
}
char *strip(const_String_or_char_ptr s) {
char *strip(const String_or_char *s) {
Clear(temp);
Append(temp, s);
if (Strncmp(s, prefix, Len(prefix)) == 0) {
@ -158,7 +158,6 @@ private:
File *f_directors;
File *f_directors_h;
File *f_directors_helpers;
File *f_begin;
File *f_runtime;
File *f_runtime_h;
File *f_header;
@ -763,7 +762,6 @@ public:
classes = 0;
klass = 0;
special_methods = 0;
f_begin = 0;
f_runtime = 0;
f_header = 0;
f_wrappers = 0;
@ -994,13 +992,24 @@ public:
SWIG_exit(EXIT_FAILURE);
}
f_begin = NewFile(outfile, "w", SWIG_output_files());
if (!f_begin) {
f_runtime = NewFile(outfile, "w");
if (!f_runtime) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
}
f_runtime = NewString("");
if (directorsEnabled()) {
if (!outfile_h) {
Printf(stderr, "Unable to determine outfile_h\n");
SWIG_exit(EXIT_FAILURE);
}
f_runtime_h = NewFile(outfile_h, "w");
if (!f_runtime_h) {
FileErrorDisplay(outfile_h);
SWIG_exit(EXIT_FAILURE);
}
}
f_init = NewString("");
f_header = NewString("");
f_wrappers = NewString("");
@ -1009,22 +1018,9 @@ public:
f_directors_helpers = NewString("");
f_initbeforefunc = NewString("");
if (directorsEnabled()) {
if (!outfile_h) {
Printf(stderr, "Unable to determine outfile_h\n");
SWIG_exit(EXIT_FAILURE);
}
f_runtime_h = NewFile(outfile_h, "w", SWIG_output_files());
if (!f_runtime_h) {
FileErrorDisplay(outfile_h);
SWIG_exit(EXIT_FAILURE);
}
}
/* Register file targets with the SWIG file handler */
Swig_register_filebyname("header", f_header);
Swig_register_filebyname("wrapper", f_wrappers);
Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("runtime", f_runtime);
Swig_register_filebyname("init", f_init);
Swig_register_filebyname("director", f_directors);
@ -1039,17 +1035,14 @@ public:
registerMagicMethods();
Swig_banner(f_begin);
Swig_banner(f_runtime);
Printf(f_runtime, "\n");
Printf(f_runtime, "#define SWIGRUBY\n");
if (directorsEnabled()) {
Printf(f_runtime, "#define SWIG_DIRECTORS\n");
}
Printf(f_runtime, "\n");
/* typedef void *VALUE */
SwigType *value = NewSwigType(T_VOID);
SwigType_add_pointer(value);
@ -1065,7 +1058,6 @@ public:
Replaceall(module_macro, "::", "__");
Swig_banner(f_directors_h);
Printf(f_directors_h, "\n");
Printf(f_directors_h, "#ifndef SWIG_%s_WRAP_H_\n", module_macro);
Printf(f_directors_h, "#define SWIG_%s_WRAP_H_\n\n", module_macro);
Printf(f_directors_h, "namespace Swig {\n");
@ -1118,29 +1110,27 @@ public:
SwigType_emit_type_table(f_runtime, f_wrappers);
/* Close all of the files */
Dump(f_runtime, f_begin);
Dump(f_header, f_begin);
Dump(f_header, f_runtime);
if (directorsEnabled()) {
Dump(f_directors_helpers, f_begin);
Dump(f_directors, f_begin);
Dump(f_directors_helpers, f_runtime);
Dump(f_directors, f_runtime);
Dump(f_directors_h, f_runtime_h);
Printf(f_runtime_h, "\n");
Printf(f_runtime_h, "#endif\n");
Close(f_runtime_h);
}
Dump(f_wrappers, f_begin);
Dump(f_initbeforefunc, f_begin);
Wrapper_pretty_print(f_init, f_begin);
Dump(f_wrappers, f_runtime);
Dump(f_initbeforefunc, f_runtime);
Wrapper_pretty_print(f_init, f_runtime);
Delete(f_header);
Delete(f_wrappers);
Delete(f_init);
Delete(f_initbeforefunc);
Close(f_begin);
Close(f_runtime);
Delete(f_runtime);
Delete(f_begin);
return SWIG_OK;
}
@ -1236,7 +1226,7 @@ public:
/**
* Process the comma-separated list of aliases (if any).
*/
void defineAliases(Node *n, const_String_or_char_ptr iname) {
void defineAliases(Node *n, const String_or_char *iname) {
String *aliasv = Getattr(n, "feature:alias");
if (aliasv) {
List *aliases = Split(aliasv, ',', INT_MAX);
@ -1270,7 +1260,7 @@ public:
* as another instance of the same class.
* --------------------------------------------------------------------- */
void create_command(Node *n, const_String_or_char_ptr iname) {
void create_command(Node *n, const String_or_char *iname) {
String *alloc_func = Swig_name_wrapper(iname);
String *wname = Swig_name_wrapper(iname);
@ -2402,9 +2392,9 @@ public:
void handleMarkFuncDirective(Node *n) {
String *markfunc = Getattr(n, "feature:markfunc");
if (markfunc) {
Printf(klass->init, "SwigClass%s.mark = (void (*)(void *)) %s;\n", klass->name, markfunc);
Printf(klass->init, "c%s.mark = (void (*)(void *)) %s;\n", klass->name, markfunc);
} else {
Printf(klass->init, "SwigClass%s.mark = 0;\n", klass->name);
Printf(klass->init, "c%s.mark = 0;\n", klass->name);
}
}
@ -2414,10 +2404,10 @@ public:
void handleFreeFuncDirective(Node *n) {
String *freefunc = Getattr(n, "feature:freefunc");
if (freefunc) {
Printf(klass->init, "SwigClass%s.destroy = (void (*)(void *)) %s;\n", klass->name, freefunc);
Printf(klass->init, "c%s.destroy = (void (*)(void *)) %s;\n", klass->name, freefunc);
} else {
if (klass->destructor_defined) {
Printf(klass->init, "SwigClass%s.destroy = (void (*)(void *)) free_%s;\n", klass->name, klass->mname);
Printf(klass->init, "c%s.destroy = (void (*)(void *)) free_%s;\n", klass->name, klass->mname);
}
}
}
@ -2428,9 +2418,9 @@ public:
void handleTrackDirective(Node *n) {
int trackObjects = GetFlag(n, "feature:trackobjects");
if (trackObjects) {
Printf(klass->init, "SwigClass%s.trackObjects = 1;\n", klass->name);
Printf(klass->init, "c%s.trackObjects = 1;\n", klass->name);
} else {
Printf(klass->init, "SwigClass%s.trackObjects = 0;\n", klass->name);
Printf(klass->init, "c%s.trackObjects = 0;\n", klass->name);
}
}
@ -2455,7 +2445,7 @@ public:
Clear(klass->type);
Printv(klass->type, Getattr(n, "classtype"), NIL);
Printv(f_wrappers, "swig_class SwigClass", valid_name, ";\n\n", NIL);
Printv(f_wrappers, "swig_class c", valid_name, ";\n\n", NIL);
Printv(klass->init, "\n", tab4, NIL);
if (!useGlobalModule) {
@ -2473,7 +2463,7 @@ public:
SwigType_add_pointer(tt);
SwigType_remember(tt);
String *tm = SwigType_manglestr(tt);
Printf(klass->init, "SWIG_TypeClientData(SWIGTYPE%s, (void *) &SwigClass%s);\n", tm, valid_name);
Printf(klass->init, "SWIG_TypeClientData(SWIGTYPE%s, (void *) &c%s);\n", tm, valid_name);
Delete(tm);
Delete(tt);
Delete(valid_name);
@ -2574,7 +2564,7 @@ public:
/* First wrap the allocate method */
current = CONSTRUCTOR_ALLOCATE;
Swig_name_register((const_String_or_char_ptr ) "construct", (const_String_or_char_ptr ) "%c_allocate");
Swig_name_register((String_or_char *) "construct", (String_or_char *) "%c_allocate");
Language::constructorHandler(n);
@ -2609,7 +2599,7 @@ public:
Delete(docs);
current = CONSTRUCTOR_INITIALIZE;
Swig_name_register((const_String_or_char_ptr ) "construct", (const_String_or_char_ptr ) "new_%c");
Swig_name_register((String_or_char *) "construct", (String_or_char *) "new_%c");
Language::constructorHandler(n);
/* Restore original parameter list */
@ -2617,7 +2607,7 @@ public:
Swig_restore(n);
/* Done */
Swig_name_unregister((const_String_or_char_ptr ) "construct");
Swig_name_unregister((String_or_char *) "construct");
current = NO_CPP;
klass->constructor_defined = 1;
return SWIG_OK;
@ -2631,7 +2621,7 @@ public:
/* First wrap the allocate method */
current = CONSTRUCTOR_ALLOCATE;
Swig_name_register((const_String_or_char_ptr ) "construct", (const_String_or_char_ptr ) "%c_allocate");
Swig_name_register((String_or_char *) "construct", (String_or_char *) "%c_allocate");
return Language::copyconstructorHandler(n);
}

View file

@ -29,9 +29,6 @@ public:
}
virtual void main(int argc, char *argv[]) {
// Add a symbol to the parser for conditional compilation
Preprocessor_define("SWIGSEXP 1", 0);
SWIG_typemap_lang("sexp");
for (int iX = 0; iX < argc; iX++) {
if (strcmp(argv[iX], "-typemaplang") == 0) {
@ -45,6 +42,9 @@ public:
fputs(usage, stdout);
}
}
// Add a symbol to the parser for conditional compilation
Preprocessor_define("SWIGSEXP 1", 0);
}
DOHHash *print_circle_hash;
@ -59,7 +59,7 @@ public:
String *outfile = Getattr(n, "outfile");
Replaceall(outfile, "_wrap.cxx", ".lisp");
Replaceall(outfile, "_wrap.c", ".lisp");
out = NewFile(outfile, "w", SWIG_output_files());
out = NewFile(outfile, "w");
if (!out) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
@ -68,14 +68,10 @@ public:
String *f_sink = NewString("");
Swig_register_filebyname("header", f_sink);
Swig_register_filebyname("wrapper", f_sink);
Swig_register_filebyname("begin", f_sink);
Swig_register_filebyname("runtime", f_sink);
Swig_register_filebyname("init", f_sink);
Swig_banner_target_lang(out, ";;;");
Language::top(n);
Printf(out, "\n");
Printf(out, ";;; Lisp parse tree produced by SWIG\n");
print_circle_hash = DohNewHash();
print_circle_count = 0;

View file

@ -32,8 +32,8 @@ extern "C" {
Language *swig_modula3(void);
Language *swig_mzscheme(void);
Language *swig_java(void);
Language *swig_php(void);
Language *swig_php4(void);
Language *swig_php5(void);
Language *swig_ocaml(void);
Language *swig_octave(void);
Language *swig_pike(void);
@ -76,9 +76,9 @@ static swig_module modules[] = {
{"-octave", swig_octave, "Octave"},
{"-perl", swig_perl5, "Perl"},
{"-perl5", swig_perl5, 0},
{"-php", swig_php, "PHP"},
{"-php4", swig_php4, 0},
{"-php5", swig_php, 0},
{"-php", swig_php4, 0},
{"-php4", swig_php4, "PHP4"},
{"-php5", swig_php5, "PHP5"},
{"-pike", swig_pike, "Pike"},
{"-python", swig_python, "Python"},
{"-r", swig_r, "R (aka GNU S)"},

View file

@ -26,7 +26,7 @@ typedef int bool;
#define PLAIN_VIRTUAL 1
#define PURE_VIRTUAL 2
extern String *input_file;
extern char *input_file;
extern int line_number;
extern int start_line;
extern int CPlusPlus; // C++ mode
@ -114,8 +114,8 @@ protected:
class Language:public Dispatcher {
public:
Language();
virtual ~Language();
Language ();
virtual ~ Language ();
virtual int emit_one(Node *n);
/* Parse command line options */
@ -313,13 +313,10 @@ int SWIG_main(int, char **, Language *);
void emit_parameter_variables(ParmList *l, Wrapper *f);
void emit_return_variable(Node *n, SwigType *rt, Wrapper *f);
void SWIG_exit(int); /* use EXIT_{SUCCESS,FAILURE} */
void SWIG_config_file(const_String_or_char_ptr );
void SWIG_config_file(const String_or_char *);
const String *SWIG_output_directory();
void SWIG_config_cppext(const char *ext);
/* get the list of generated files */
List *SWIG_output_files();
void SWIG_library_directory(const char *);
int emit_num_arguments(ParmList *);
int emit_num_required(ParmList *);
@ -329,17 +326,17 @@ void emit_mark_varargs(ParmList *l);
String *emit_action(Node *n);
int emit_action_code(Node *n, String *wrappercode, String *action);
void Swig_overload_check(Node *n);
String *Swig_overload_dispatch(Node *n, const_String_or_char_ptr fmt, int *);
String *Swig_overload_dispatch_cast(Node *n, const_String_or_char_ptr fmt, int *);
String *Swig_overload_dispatch_fast(Node *n, const_String_or_char_ptr fmt, int *);
String *Swig_overload_dispatch(Node *n, const String_or_char *fmt, int *);
String *Swig_overload_dispatch_cast(Node *n, const String_or_char *fmt, int *);
String *Swig_overload_dispatch_fast(Node *n, const String_or_char *fmt, int *);
SwigType *cplus_value_type(SwigType *t);
/* directors.cxx start */
String *Swig_csuperclass_call(String *base, String *method, ParmList *l);
String *Swig_class_declaration(Node *n, String *name);
String *Swig_class_name(Node *n);
String *Swig_method_call(const_String_or_char_ptr name, ParmList *parms);
String *Swig_method_decl(SwigType *rtype, SwigType *decl, const_String_or_char_ptr id, List *args, int strip, int values);
String *Swig_method_call(String_or_char *name, ParmList *parms);
String *Swig_method_decl(SwigType *rtype, SwigType *decl, const String_or_char *id, List *args, int strip, int values);
String *Swig_director_declaration(Node *n);
void Swig_director_emit_dynamic_cast(Node *n, Wrapper *f);
/* directors.cxx end */

View file

@ -46,7 +46,6 @@ static int nosafe = 0;
static File *f_header = 0;
static File *f_wrappers = 0;
static File *f_init = 0;
static File *f_begin = 0;
static File *f_runtime = 0;
@ -122,7 +121,6 @@ public:
}
Preprocessor_define("SWIGTCL 1", 0);
// SWIGTCL8 is deprecated, and no longer documented.
Preprocessor_define("SWIGTCL8 1", 0);
SWIG_typemap_lang("tcl8");
SWIG_config_file("tcl8.swg");
@ -138,12 +136,11 @@ public:
/* Initialize all of the output files */
String *outfile = Getattr(n, "outfile");
f_begin = NewFile(outfile, "w", SWIG_output_files());
if (!f_begin) {
f_runtime = NewFile(outfile, "w");
if (!f_runtime) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
}
f_runtime = NewString("");
f_init = NewString("");
f_header = NewString("");
f_wrappers = NewString("");
@ -151,7 +148,6 @@ public:
/* Register file targets with the SWIG file handler */
Swig_register_filebyname("header", f_header);
Swig_register_filebyname("wrapper", f_wrappers);
Swig_register_filebyname("begin", f_begin);
Swig_register_filebyname("runtime", f_runtime);
Swig_register_filebyname("init", f_init);
@ -162,11 +158,7 @@ public:
methods_tab = NewString("");
const_tab = NewString("");
Swig_banner(f_begin);
Printf(f_runtime, "\n");
Printf(f_runtime, "#define SWIGTCL\n");
Printf(f_runtime, "\n");
Swig_banner(f_runtime);
/* Set the module name, namespace, and prefix */
@ -185,7 +177,7 @@ public:
Insert(module, 0, "_");
if ((f_shadow = NewFile(filen, "w", SWIG_output_files())) == 0) {
if ((f_shadow = NewFile(filen, "w")) == 0) {
FileErrorDisplay(filen);
SWIG_exit(EXIT_FAILURE);
}
@ -194,7 +186,10 @@ public:
Swig_register_filebyname("shadow", f_shadow);
Swig_register_filebyname("itcl", f_shadow);
Swig_banner_target_lang(f_shadow, "#");
Printf(f_shadow, "# This file was automatically generated by SWIG (http://www.swig.org).\n");
Printf(f_shadow, "# Version %s\n", Swig_package_version());
Printf(f_shadow, "#\n");
Printf(f_shadow, "# Don't modify this file, modify the SWIG interface instead.\n");
Printv(f_shadow, "\npackage require Itcl\n\n", NIL);
Delete(filen);
@ -249,15 +244,12 @@ public:
}
/* Close all of the files */
Dump(f_runtime, f_begin);
Printv(f_begin, f_header, f_wrappers, NIL);
Wrapper_pretty_print(f_init, f_begin);
Printv(f_runtime, f_header, f_wrappers, NIL);
Wrapper_pretty_print(f_init, f_runtime);
Delete(f_header);
Delete(f_wrappers);
Delete(f_init);
Close(f_begin);
Delete(f_runtime);
Delete(f_begin);
Close(f_runtime);
return SWIG_OK;
}

View file

@ -26,6 +26,7 @@ public:
};
static File *f_cl = 0;
static File *f_null = 0;
static struct {
int count;
@ -131,7 +132,7 @@ static void add_defined_foreign_type(String *type) {
}
static String *get_ffi_type(SwigType *ty, const_String_or_char_ptr name) {
static String *get_ffi_type(SwigType *ty, const String_or_char *name) {
Hash *typemap = Swig_typemap_search("ffitype", ty, name, 0);
if (typemap) {
String *typespec = Getattr(typemap, "code");
@ -167,7 +168,7 @@ static String *get_ffi_type(SwigType *ty, const_String_or_char_ptr name) {
return 0;
}
static String *get_lisp_type(SwigType *ty, const_String_or_char_ptr name) {
static String *get_lisp_type(SwigType *ty, const String_or_char *name) {
Hash *typemap = Swig_typemap_search("lisptype", ty, name, 0);
if (typemap) {
String *typespec = Getattr(typemap, "code");
@ -180,7 +181,6 @@ static String *get_lisp_type(SwigType *ty, const_String_or_char_ptr name) {
void UFFI::main(int argc, char *argv[]) {
int i;
Preprocessor_define("SWIGUFFI 1", 0);
SWIG_library_directory("uffi");
SWIG_config_file("uffi.swg");
@ -225,26 +225,31 @@ void UFFI::main(int argc, char *argv[]) {
int UFFI::top(Node *n) {
String *module = Getattr(n, "name");
String *output_filename = NewString("");
File *f_null = NewString("");
String *devnull = NewString("/dev/null");
f_null = NewFile(devnull, "w+");
if (!f_null) {
FileErrorDisplay(devnull);
SWIG_exit(EXIT_FAILURE);
}
Delete(devnull);
Printf(output_filename, "%s%s.cl", SWIG_output_directory(), module);
f_cl = NewFile(output_filename, "w", SWIG_output_files());
f_cl = NewFile(output_filename, "w");
if (!f_cl) {
FileErrorDisplay(output_filename);
SWIG_exit(EXIT_FAILURE);
}
Swig_register_filebyname("header", f_null);
Swig_register_filebyname("begin", f_null);
Swig_register_filebyname("runtime", f_null);
Swig_register_filebyname("wrapper", f_cl);
Swig_banner_target_lang(f_cl, ";;");
Printf(f_cl, "\n"
";; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; package: %s -*-\n\n(defpackage :%s\n (:use :common-lisp :uffi))\n\n(in-package :%s)\n",
Printf(f_cl,
";; -*- Mode: Lisp; Syntax: ANSI-Common-Lisp; Base: 10; package: %s -*-\n;; This is an automatically generated file. Make changes in\n;; the definition file, not here.\n\n(defpackage :%s\n (:use :common-lisp :uffi))\n\n(in-package :%s)\n",
module, module, module);
Printf(f_cl, "(eval-when (compile load eval)\n (defparameter *swig-identifier-converter* '%s))\n", identifier_converter);

View file

@ -47,7 +47,7 @@ public:
iX++;
Swig_mark_arg(iX);
String *outfile = NewString(argv[iX]);
out = NewFile(outfile, "w", SWIG_output_files());
out = NewFile(outfile, "w");
if (!out) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
@ -82,7 +82,7 @@ public:
Replaceall(outfile, ".cxx", ".xml");
Replaceall(outfile, ".cpp", ".xml");
Replaceall(outfile, ".c", ".xml");
out = NewFile(outfile, "w", SWIG_output_files());
out = NewFile(outfile, "w");
if (!out) {
FileErrorDisplay(outfile);
SWIG_exit(EXIT_FAILURE);
@ -301,7 +301,7 @@ void Swig_print_xml(DOH *obj, String *filename) {
if (!filename) {
out = stdout;
} else {
out = NewFile(filename, "w", SWIG_output_files());
out = NewFile(filename, "w");
if (!out) {
FileErrorDisplay(filename);
SWIG_exit(EXIT_FAILURE);

View file

@ -74,7 +74,7 @@ static void copy_location(const DOH *s1, DOH *s2) {
Setline(s2, Getline((DOH *) s1));
}
static String *cpp_include(const_String_or_char_ptr fn, int sysfile) {
static String *cpp_include(String_or_char *fn, int sysfile) {
String *s = sysfile ? Swig_include_sys(fn) : Swig_include(fn);
if (s && single_include) {
String *file = Getfile(s);
@ -85,8 +85,7 @@ static String *cpp_include(const_String_or_char_ptr fn, int sysfile) {
Setattr(included_files, file, file);
}
if (!s) {
/* XXX(bhy) may not need the seek */
/* Seek(fn, 0, SEEK_SET); */
Seek(fn, 0, SEEK_SET);
if (ignore_missing) {
Swig_warning(WARN_PP_MISSING_FILE, Getfile(fn), Getline(fn), "Unable to find '%s'\n", fn);
} else {
@ -262,9 +261,8 @@ void Preprocessor_error_as_warning(int a) {
* ----------------------------------------------------------------------------- */
String *Macro_vararg_name(const_String_or_char_ptr str, const_String_or_char_ptr line) {
String *argname;
String *varargname;
String_or_char *Macro_vararg_name(String_or_char *str, String_or_char *line) {
String_or_char *argname, *varargname;
char *s, *dots;
argname = Copy(str);
@ -290,24 +288,24 @@ String *Macro_vararg_name(const_String_or_char_ptr str, const_String_or_char_ptr
return varargname;
}
Hash *Preprocessor_define(const_String_or_char_ptr _str, int swigmacro) {
Hash *Preprocessor_define(const String_or_char *_str, int swigmacro) {
String *macroname = 0, *argstr = 0, *macrovalue = 0, *file = 0, *s = 0;
Hash *macro = 0, *symbols = 0, *m1;
List *arglist = 0;
int c, line;
int varargs = 0;
String *str;
String_or_char *str = (String_or_char *) _str;
assert(cpp);
assert(_str);
assert(str);
/* First make sure that string is actually a string */
if (DohCheck(_str)) {
s = Copy(_str);
copy_location(_str, s);
if (DohCheck(str)) {
s = Copy(str);
copy_location(str, s);
str = s;
} else {
str = NewString((char *) _str);
str = NewString((char *) str);
}
Seek(str, 0, SEEK_SET);
line = Getline(str);
@ -534,7 +532,7 @@ macro_error:
*
* Undefines a macro.
* ----------------------------------------------------------------------------- */
void Preprocessor_undef(const_String_or_char_ptr str) {
void Preprocessor_undef(const String_or_char *str) {
Hash *symbols;
assert(cpp);
symbols = Getattr(cpp, kpp_symbols);
@ -652,7 +650,14 @@ static String *get_filename(String *str, int *sysfile) {
if (isspace(c))
Ungetc(c, str);
}
Swig_filename_correct(fn);
#if defined(_WIN32) || defined(MACSWIG)
/* accept Unix path separator on non-Unix systems */
Replaceall(fn, "/", SWIG_FILE_DELIMITER);
#endif
#if defined(__CYGWIN__)
/* accept Windows path separator in addition to Unix path separator */
Replaceall(fn, "\\", SWIG_FILE_DELIMITER);
#endif
Seek(fn, 0, SEEK_SET);
return fn;
}

View file

@ -19,8 +19,8 @@ extern "C" {
#endif
extern int Preprocessor_expr(String *s, int *error);
extern char *Preprocessor_expr_error(void);
extern Hash *Preprocessor_define(const_String_or_char_ptr str, int swigmacro);
extern void Preprocessor_undef(const_String_or_char_ptr name);
extern Hash *Preprocessor_define(const String_or_char *str, int swigmacro);
extern void Preprocessor_undef(const String_or_char *name);
extern void Preprocessor_init(void);
extern void Preprocessor_delete(void);
extern String *Preprocessor_parse(String *s);

View file

@ -1,5 +1,9 @@
SWIG Source directory
This directory currently contains a mix of legacy SWIG1.1 code and
recent development work. As a result, it's still a little messy.
Here is a rough breakdown of the directories:
Source/DOH - A core set of basic datatypes including
strings, lists, hashes, and files. Used
extensively by the rest of SWIG.
@ -12,9 +16,8 @@ SWIG Source directory
Source/Modules - Language modules.
Source/Include - Include files.
Historic directories which may be in CVS, but have been removed:
The following directories may be in CVS, but are largely deprecated:
Source/Modules1.1 - Old SWIG-1.1 modules. Empty.
@ -23,3 +26,5 @@ Historic directories which may be in CVS, but have been removed:
Source/SWIG1.1 - Old SWIG1.1 core. Completely empty now.

View file

@ -45,7 +45,7 @@ String *Swig_cparm_name(Parm *p, int i) {
* and user defined types to pointers.
* ----------------------------------------------------------------------------- */
static String *Swig_clocal(SwigType *t, const_String_or_char_ptr name, const_String_or_char_ptr value) {
static String *Swig_clocal(SwigType *t, const String_or_char *name, const String_or_char *value) {
String *decl;
decl = NewStringEmpty();
@ -147,7 +147,7 @@ String *Swig_wrapped_member_var_type(SwigType *t, int varcref) {
}
static String *Swig_wrapped_var_deref(SwigType *t, const_String_or_char_ptr name, int varcref) {
static String *Swig_wrapped_var_deref(SwigType *t, String_or_char *name, int varcref) {
if (SwigType_isclass(t)) {
if (varcref) {
if (cparse_cplusplus) {
@ -163,7 +163,7 @@ static String *Swig_wrapped_var_deref(SwigType *t, const_String_or_char_ptr name
}
}
static String *Swig_wrapped_var_assign(SwigType *t, const_String_or_char_ptr name, int varcref) {
static String *Swig_wrapped_var_assign(SwigType *t, const String_or_char *name, int varcref) {
if (SwigType_isclass(t)) {
if (varcref) {
return NewStringf("%s", name);
@ -251,7 +251,7 @@ int Swig_cargs(Wrapper *w, ParmList *p) {
* function call.
* ----------------------------------------------------------------------------- */
String *Swig_cresult(SwigType *t, const_String_or_char_ptr name, const_String_or_char_ptr decl) {
String *Swig_cresult(SwigType *t, const String_or_char *name, const String_or_char *decl) {
String *fcall;
fcall = NewStringEmpty();
@ -260,9 +260,10 @@ String *Swig_cresult(SwigType *t, const_String_or_char_ptr name, const_String_or
break;
case T_REFERENCE:
{
String *lstr = SwigType_lstr(t, 0);
Printf(fcall, "%s = (%s) &", name, lstr);
Delete(lstr);
String *str = SwigType_str(t, "_result_ref");
Printf(fcall, "{\n");
Printf(fcall, "%s = ", str);
Delete(str);
}
break;
case T_USER:
@ -289,6 +290,12 @@ String *Swig_cresult(SwigType *t, const_String_or_char_ptr name, const_String_or
Append(fcall, ";");
}
if (SwigType_type(t) == T_REFERENCE) {
String *lstr = SwigType_lstr(t, 0);
Printf(fcall, "\n%s = (%s) &_result_ref;\n", name, lstr);
Append(fcall, "}");
Delete(lstr);
}
return fcall;
}
@ -302,7 +309,7 @@ String *Swig_cresult(SwigType *t, const_String_or_char_ptr name, const_String_or
*
* ----------------------------------------------------------------------------- */
String *Swig_cfunction_call(const_String_or_char_ptr name, ParmList *parms) {
String *Swig_cfunction_call(String_or_char *name, ParmList *parms) {
String *func;
int i = 0;
int comma = 0;
@ -369,7 +376,7 @@ String *Swig_cfunction_call(const_String_or_char_ptr name, ParmList *parms) {
* set to "(*this)->" or some similar sequence.
* ----------------------------------------------------------------------------- */
static String *Swig_cmethod_call(const_String_or_char_ptr name, ParmList *parms, const_String_or_char_ptr self, String *explicit_qualifier, SwigType *director_type) {
static String *Swig_cmethod_call(String_or_char *name, ParmList *parms, String_or_char *self, String *explicit_qualifier, SwigType *director_type) {
String *func, *nname;
int i = 0;
Parm *p = parms;
@ -461,7 +468,7 @@ static String *Swig_cmethod_call(const_String_or_char_ptr name, ParmList *parms,
* calloc(1,sizeof(name));
* ----------------------------------------------------------------------------- */
String *Swig_cconstructor_call(const_String_or_char_ptr name) {
String *Swig_cconstructor_call(String_or_char *name) {
DOH *func;
func = NewStringEmpty();
@ -480,7 +487,7 @@ String *Swig_cconstructor_call(const_String_or_char_ptr name) {
*
* ----------------------------------------------------------------------------- */
String *Swig_cppconstructor_base_call(const_String_or_char_ptr name, ParmList *parms, int skip_self) {
String *Swig_cppconstructor_base_call(String_or_char *name, ParmList *parms, int skip_self) {
String *func;
String *nname;
int i = 0;
@ -525,15 +532,15 @@ String *Swig_cppconstructor_base_call(const_String_or_char_ptr name, ParmList *p
return func;
}
String *Swig_cppconstructor_call(const_String_or_char_ptr name, ParmList *parms) {
String *Swig_cppconstructor_call(String_or_char *name, ParmList *parms) {
return Swig_cppconstructor_base_call(name, parms, 0);
}
String *Swig_cppconstructor_nodirector_call(const_String_or_char_ptr name, ParmList *parms) {
String *Swig_cppconstructor_nodirector_call(String_or_char *name, ParmList *parms) {
return Swig_cppconstructor_base_call(name, parms, 1);
}
String *Swig_cppconstructor_director_call(const_String_or_char_ptr name, ParmList *parms) {
String *Swig_cppconstructor_director_call(String_or_char *name, ParmList *parms) {
return Swig_cppconstructor_base_call(name, parms, 0);
}
@ -676,7 +683,7 @@ String *Swig_cppdestructor_call(Node *n) {
*
* ----------------------------------------------------------------------------- */
String *Swig_cmemberset_call(const_String_or_char_ptr name, SwigType *type, String *self, int varcref) {
String *Swig_cmemberset_call(String_or_char *name, SwigType *type, String_or_char *self, int varcref) {
String *func;
String *pname0 = Swig_cparm_name(0, 0);
String *pname1 = Swig_cparm_name(0, 1);
@ -711,7 +718,7 @@ String *Swig_cmemberset_call(const_String_or_char_ptr name, SwigType *type, Stri
*
* ----------------------------------------------------------------------------- */
String *Swig_cmemberget_call(const_String_or_char_ptr name, SwigType *t, String *self, int varcref) {
String *Swig_cmemberget_call(const String_or_char *name, SwigType *t, String_or_char *self, int varcref) {
String *func;
String *call;
String *pname0 = Swig_cparm_name(0, 0);
@ -1203,7 +1210,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;
@ -1251,21 +1258,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);

View file

@ -50,7 +50,7 @@ static char wrn_nnum_fmt[64];
static char err_line_fmt[64];
static char err_eof_fmt[64];
static String *format_filename(const_String_or_char_ptr filename);
static String *format_filename(const String_or_char *filename);
/* -----------------------------------------------------------------------------
* Swig_warning()
@ -58,7 +58,7 @@ static String *format_filename(const_String_or_char_ptr filename);
* Issue a warning message
* ----------------------------------------------------------------------------- */
void Swig_warning(int wnum, const_String_or_char_ptr filename, int line, const char *fmt, ...) {
void Swig_warning(int wnum, const String_or_char *filename, int line, const char *fmt, ...) {
String *out;
char *msg;
int wrn = 1;
@ -121,7 +121,7 @@ void Swig_warning(int wnum, const_String_or_char_ptr filename, int line, const c
* Issue an error message
* ----------------------------------------------------------------------------- */
void Swig_error(const_String_or_char_ptr filename, int line, const char *fmt, ...) {
void Swig_error(const String_or_char *filename, int line, const char *fmt, ...) {
va_list ap;
String *formatted_filename = NULL;
@ -170,7 +170,7 @@ void Swig_error_silent(int s) {
* Takes a comma separate list of warning numbers and puts in the filter.
* ----------------------------------------------------------------------------- */
void Swig_warnfilter(const_String_or_char_ptr wlist, int add) {
void Swig_warnfilter(const String_or_char *wlist, int add) {
char *c;
char *cw;
String *s;
@ -268,7 +268,7 @@ void Swig_error_msg_format(ErrorMessageFormat format) {
*
* Remove double backslashes in Windows filename paths for display
* ----------------------------------------------------------------------------- */
static String *format_filename(const_String_or_char_ptr filename) {
static String *format_filename(const String_or_char *filename) {
String *formatted_filename = NewString(filename);
#if defined(_WIN32)
Replaceall(formatted_filename, "\\\\", "\\");

View file

@ -100,7 +100,7 @@ void Swig_check_options(int check_input) {
* Generates a generic error message and exits.
* ----------------------------------------------------------------------------- */
void Swig_arg_error(void) {
void Swig_arg_error() {
Printf(stderr, "SWIG : Unable to parse command line options.\n");
Printf(stderr, "Use 'swig -help' for available options.\n");
exit(1);

View file

@ -33,7 +33,7 @@ int Swig_get_push_dir(void) {
* Adds a directory to the SWIG search path.
* ----------------------------------------------------------------------------- */
List *Swig_add_directory(const_String_or_char_ptr dirname) {
List *Swig_add_directory(const String_or_char *dirname) {
String *adirname;
if (!directories)
directories = NewList();
@ -53,7 +53,7 @@ List *Swig_add_directory(const_String_or_char_ptr dirname) {
* the preprocessor to grab files in the same directory as other included files.
* ----------------------------------------------------------------------------- */
void Swig_push_directory(const_String_or_char_ptr dirname) {
void Swig_push_directory(const String_or_char *dirname) {
String *pdirname;
if (!Swig_get_push_dir())
return;
@ -73,7 +73,7 @@ void Swig_push_directory(const_String_or_char_ptr dirname) {
* the preprocessor.
* ----------------------------------------------------------------------------- */
void Swig_pop_directory(void) {
void Swig_pop_directory() {
if (!Swig_get_push_dir())
return;
if (!pdirectories)
@ -87,13 +87,13 @@ void Swig_pop_directory(void) {
* Returns the full pathname of the last file opened.
* ----------------------------------------------------------------------------- */
String *Swig_last_file(void) {
String *Swig_last_file() {
assert(lastpath);
return lastpath;
}
/* -----------------------------------------------------------------------------
* Swig_search_path_any()
* Swig_search_path()
*
* Returns a list of the current search paths.
* ----------------------------------------------------------------------------- */
@ -151,11 +151,10 @@ List *Swig_search_path() {
/* -----------------------------------------------------------------------------
* Swig_open()
*
* open a file, optionally looking for it in the include path. Returns an open
* FILE * on success.
* Looks for a file and open it. Returns an open FILE * on success.
* ----------------------------------------------------------------------------- */
static FILE *Swig_open_file(const_String_or_char_ptr name, int sysfile, int use_include_path) {
static FILE *Swig_open_any(const String_or_char *name, int sysfile) {
FILE *f;
String *filename;
List *spath = 0;
@ -170,7 +169,7 @@ static FILE *Swig_open_file(const_String_or_char_ptr name, int sysfile, int use_
filename = NewString(cname);
assert(filename);
f = fopen(Char(filename), "r");
if (!f && use_include_path) {
if (!f) {
spath = Swig_search_path_any(sysfile);
ilen = Len(spath);
for (i = 0; i < ilen; i++) {
@ -183,21 +182,19 @@ static FILE *Swig_open_file(const_String_or_char_ptr name, int sysfile, int use_
Delete(spath);
}
if (f) {
#if defined(_WIN32) /* Note not on Cygwin else filename is displayed with double '/' */
Replaceall(filename, "\\\\", "\\"); /* remove double '\' in case any already present */
Replaceall(filename, "\\", "\\\\");
#endif
Delete(lastpath);
lastpath = Swig_filename_escape(filename);
lastpath = Copy(filename);
}
Delete(filename);
return f;
}
/* Open a file - searching the include paths to find it */
FILE *Swig_include_open(const_String_or_char_ptr name) {
return Swig_open_file(name, 0, 1);
}
/* Open a file - does not use include paths to find it */
FILE *Swig_open(const_String_or_char_ptr name) {
return Swig_open_file(name, 0, 0);
FILE *Swig_open(const String_or_char *name) {
return Swig_open_any(name, 0);
}
@ -233,12 +230,12 @@ String *Swig_read_file(FILE *f) {
* Opens a file and returns it as a string.
* ----------------------------------------------------------------------------- */
static String *Swig_include_any(const_String_or_char_ptr name, int sysfile) {
static String *Swig_include_any(const String_or_char *name, int sysfile) {
FILE *f;
String *str;
String *file;
f = Swig_open_file(name, sysfile, 1);
f = Swig_open_any(name, sysfile);
if (!f)
return 0;
str = Swig_read_file(f);
@ -251,11 +248,11 @@ static String *Swig_include_any(const_String_or_char_ptr name, int sysfile) {
return str;
}
String *Swig_include(const_String_or_char_ptr name) {
String *Swig_include(const String_or_char *name) {
return Swig_include_any(name, 0);
}
String *Swig_include_sys(const_String_or_char_ptr name) {
String *Swig_include_sys(const String_or_char *name) {
return Swig_include_any(name, 1);
}
@ -265,10 +262,10 @@ String *Swig_include_sys(const_String_or_char_ptr name) {
* Copies the contents of a file into another file
* ----------------------------------------------------------------------------- */
int Swig_insert_file(const_String_or_char_ptr filename, File *outfile) {
int Swig_insert_file(const String_or_char *filename, File *outfile) {
char buffer[4096];
int nbytes;
FILE *f = Swig_include_open(filename);
FILE *f = Swig_open(filename);
if (!f)
return -1;
@ -289,7 +286,7 @@ int Swig_insert_file(const_String_or_char_ptr filename, File *outfile) {
static Hash *named_files = 0;
void Swig_register_filebyname(const_String_or_char_ptr filename, File *outfile) {
void Swig_register_filebyname(const String_or_char *filename, File *outfile) {
if (!named_files)
named_files = NewHash();
Setattr(named_files, filename, outfile);
@ -301,7 +298,7 @@ void Swig_register_filebyname(const_String_or_char_ptr filename, File *outfile)
* Get a named file
* ----------------------------------------------------------------------------- */
File *Swig_filebyname(const_String_or_char_ptr filename) {
File *Swig_filebyname(const String_or_char *filename) {
if (!named_files)
return 0;
return Getattr(named_files, filename);
@ -313,7 +310,7 @@ File *Swig_filebyname(const_String_or_char_ptr filename) {
* Returns the suffix of a file
* ----------------------------------------------------------------------------- */
char *Swig_file_suffix(const_String_or_char_ptr filename) {
char *Swig_file_suffix(const String_or_char *filename) {
char *d;
char *c = Char(filename);
int len = Len(filename);
@ -335,7 +332,7 @@ char *Swig_file_suffix(const_String_or_char_ptr filename) {
* Returns the filename with no suffix attached.
* ----------------------------------------------------------------------------- */
char *Swig_file_basename(const_String_or_char_ptr filename) {
char *Swig_file_basename(const String_or_char *filename) {
static char tmp[1024];
char *c;
strcpy(tmp, Char(filename));
@ -349,7 +346,7 @@ char *Swig_file_basename(const_String_or_char_ptr filename) {
*
* Return the file with any leading path stripped off
* ----------------------------------------------------------------------------- */
char *Swig_file_filename(const_String_or_char_ptr filename) {
char *Swig_file_filename(const String_or_char *filename) {
static char tmp[1024];
const char *delim = SWIG_FILE_DELIMITER;
char *c;
@ -367,7 +364,7 @@ char *Swig_file_filename(const_String_or_char_ptr filename) {
*
* Return the name of the directory associated with a file
* ----------------------------------------------------------------------------- */
char *Swig_file_dirname(const_String_or_char_ptr filename) {
char *Swig_file_dirname(const String_or_char *filename) {
static char tmp[1024];
const char *delim = SWIG_FILE_DELIMITER;
char *c;

View file

@ -54,7 +54,7 @@ const char *Swig_package_version(void) {
/* -----------------------------------------------------------------------------
* Swig_banner()
*
* Emits the SWIG identifying banner for the C/C++ wrapper file.
* Emits the SWIG identifying banner.
* ----------------------------------------------------------------------------- */
void Swig_banner(File *f) {
@ -67,24 +67,10 @@ void Swig_banner(File *f) {
* changes to this file unless you know what you are doing--modify the SWIG \n\
* interface file instead. \n", Swig_package_version());
/* String too long for ISO compliance */
Printf(f, " * ----------------------------------------------------------------------------- */\n");
Printf(f, " * ----------------------------------------------------------------------------- */\n\n");
}
/* -----------------------------------------------------------------------------
* Swig_banner_target_lang()
*
* Emits a SWIG identifying banner in the target language
* ----------------------------------------------------------------------------- */
void Swig_banner_target_lang(File *f, const_String_or_char_ptr commentchar) {
Printf(f, "%s This file was automatically generated by SWIG (http://www.swig.org).\n", commentchar);
Printf(f, "%s Version %s\n", commentchar, Swig_package_version());
Printf(f, "%s\n", commentchar);
Printf(f, "%s Do not make changes to this file unless you know what you are doing--modify\n", commentchar);
Printf(f, "%s the SWIG interface file instead.\n", commentchar);
}
/* -----------------------------------------------------------------------------
* Swig_strip_c_comments()
*
@ -131,39 +117,6 @@ String *Swig_strip_c_comments(const String *s) {
}
/* -----------------------------------------------------------------------------
* Swig_filename_correct()
*
* Corrects filenames on non-unix systems
* ----------------------------------------------------------------------------- */
void Swig_filename_correct(String *filename) {
(void)filename;
#if defined(_WIN32) || defined(MACSWIG)
/* accept Unix path separator on non-Unix systems */
Replaceall(filename, "/", SWIG_FILE_DELIMITER);
#endif
#if defined(__CYGWIN__)
/* accept Windows path separator in addition to Unix path separator */
Replaceall(filename, "\\", SWIG_FILE_DELIMITER);
#endif
}
/* -----------------------------------------------------------------------------
* Swig_filename_escape()
*
* Escapes backslashes in filename - for Windows
* ----------------------------------------------------------------------------- */
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, "\\", "\\\\");
#endif
return adjusted_filename;
}
/* -----------------------------------------------------------------------------
* Swig_string_escape()
*
@ -651,7 +604,7 @@ String *Swig_string_emangle(String *s) {
* In this case, "A::B". Returns NULL if there is no base.
* ----------------------------------------------------------------------------- */
void Swig_scopename_split(const String *s, String **rprefix, String **rlast) {
void Swig_scopename_split(String *s, String **rprefix, String **rlast) {
char *tmp = Char(s);
char *c = tmp;
char *cc = c;
@ -705,7 +658,7 @@ void Swig_scopename_split(const String *s, String **rprefix, String **rlast) {
}
String *Swig_scopename_prefix(const String *s) {
String *Swig_scopename_prefix(String *s) {
char *tmp = Char(s);
char *c = tmp;
char *cc = c;
@ -757,7 +710,7 @@ String *Swig_scopename_prefix(const String *s) {
* case, "C".
* ----------------------------------------------------------------------------- */
String *Swig_scopename_last(const String *s) {
String *Swig_scopename_last(String *s) {
char *tmp = Char(s);
char *c = tmp;
char *cc = c;
@ -801,7 +754,7 @@ String *Swig_scopename_last(const String *s) {
* In this case, "A". Returns NULL if there is no base.
* ----------------------------------------------------------------------------- */
String *Swig_scopename_first(const String *s) {
String *Swig_scopename_first(String *s) {
char *tmp = Char(s);
char *c = tmp;
char *co = 0;
@ -851,7 +804,7 @@ String *Swig_scopename_first(const String *s) {
* In this case, "B::C". Returns NULL if there is no suffix.
* ----------------------------------------------------------------------------- */
String *Swig_scopename_suffix(const String *s) {
String *Swig_scopename_suffix(String *s) {
char *tmp = Char(s);
char *c = tmp;
char *co = 0;
@ -895,7 +848,7 @@ String *Swig_scopename_suffix(const String *s) {
* Checks to see if a name is qualified with a scope name
* ----------------------------------------------------------------------------- */
int Swig_scopename_check(const String *s) {
int Swig_scopename_check(String *s) {
char *c = Char(s);
char *co = strstr(c, "operator ");
@ -973,37 +926,6 @@ String *Swig_string_command(String *s) {
}
/* -----------------------------------------------------------------------------
* Swig_string_strip()
*
* Strip given prefix from identifiers
*
* Printf(stderr,"%(strip:[wx])s","wxHello") -> Hello
* ----------------------------------------------------------------------------- */
String *Swig_string_strip(String *s) {
String *ns;
if (!Len(s)) {
ns = NewString(s);
} else {
const char *cs = Char(s);
const char *ce = Strchr(cs, ']');
if (*cs != '[' || ce == NULL) {
ns = NewString(s);
} else {
String *fmt = NewStringf("%%.%ds", ce-cs-1);
String *prefix = NewStringf(fmt, cs+1);
if (0 == Strncmp(ce+1, prefix, Len(prefix))) {
ns = NewString(ce+1+Len(prefix));
} else {
ns = NewString(ce+1);
}
}
}
return ns;
}
/* -----------------------------------------------------------------------------
* Swig_string_rxspencer()
*
@ -1131,7 +1053,6 @@ void Swig_init() {
DohEncoding("command", Swig_string_command);
DohEncoding("rxspencer", Swig_string_rxspencer);
DohEncoding("schemify", Swig_string_schemify);
DohEncoding("strip", Swig_string_strip);
/* aliases for the case encoders */
DohEncoding("uppercase", Swig_string_upper);

View file

@ -27,13 +27,13 @@ static Hash *naming_hash = 0;
* Register a new naming format.
* ----------------------------------------------------------------------------- */
void Swig_name_register(const_String_or_char_ptr method, const_String_or_char_ptr format) {
void Swig_name_register(const String_or_char *method, const String_or_char *format) {
if (!naming_hash)
naming_hash = NewHash();
Setattr(naming_hash, method, format);
}
void Swig_name_unregister(const_String_or_char_ptr method) {
void Swig_name_unregister(const String_or_char *method) {
if (naming_hash) {
Delattr(naming_hash, method);
}
@ -127,7 +127,7 @@ static int name_mangle(String *r) {
* Converts all of the non-identifier characters of a string to underscores.
* ----------------------------------------------------------------------------- */
String *Swig_name_mangle(const_String_or_char_ptr s) {
String *Swig_name_mangle(const String_or_char *s) {
#if 0
String *r = NewString(s);
name_mangle(r);
@ -143,7 +143,7 @@ String *Swig_name_mangle(const_String_or_char_ptr s) {
* Returns the name of a wrapper function.
* ----------------------------------------------------------------------------- */
String *Swig_name_wrapper(const_String_or_char_ptr fname) {
String *Swig_name_wrapper(const String_or_char *fname) {
String *r;
String *f;
@ -168,7 +168,7 @@ String *Swig_name_wrapper(const_String_or_char_ptr fname) {
* Returns the name of a class method.
* ----------------------------------------------------------------------------- */
String *Swig_name_member(const_String_or_char_ptr classname, const_String_or_char_ptr mname) {
String *Swig_name_member(const String_or_char *classname, const String_or_char *mname) {
String *r;
String *f;
String *rclassname;
@ -201,7 +201,7 @@ String *Swig_name_member(const_String_or_char_ptr classname, const_String_or_cha
* Returns the name of the accessor function used to get a variable.
* ----------------------------------------------------------------------------- */
String *Swig_name_get(const_String_or_char_ptr vname) {
String *Swig_name_get(const String_or_char *vname) {
String *r;
String *f;
@ -229,7 +229,7 @@ String *Swig_name_get(const_String_or_char_ptr vname) {
* Returns the name of the accessor function used to set a variable.
* ----------------------------------------------------------------------------- */
String *Swig_name_set(const_String_or_char_ptr vname) {
String *Swig_name_set(const String_or_char *vname) {
String *r;
String *f;
@ -253,7 +253,7 @@ String *Swig_name_set(const_String_or_char_ptr vname) {
* Returns the name of the accessor function used to create an object.
* ----------------------------------------------------------------------------- */
String *Swig_name_construct(const_String_or_char_ptr classname) {
String *Swig_name_construct(const String_or_char *classname) {
String *r;
String *f;
String *rclassname;
@ -286,7 +286,7 @@ String *Swig_name_construct(const_String_or_char_ptr classname) {
* Returns the name of the accessor function used to copy an object.
* ----------------------------------------------------------------------------- */
String *Swig_name_copyconstructor(const_String_or_char_ptr classname) {
String *Swig_name_copyconstructor(const String_or_char *classname) {
String *r;
String *f;
String *rclassname;
@ -319,7 +319,7 @@ String *Swig_name_copyconstructor(const_String_or_char_ptr classname) {
* Returns the name of the accessor function used to destroy an object.
* ----------------------------------------------------------------------------- */
String *Swig_name_destroy(const_String_or_char_ptr classname) {
String *Swig_name_destroy(const String_or_char *classname) {
String *r;
String *f;
String *rclassname;
@ -351,7 +351,7 @@ String *Swig_name_destroy(const_String_or_char_ptr classname) {
* Returns the name of the accessor function used to disown an object.
* ----------------------------------------------------------------------------- */
String *Swig_name_disown(const_String_or_char_ptr classname) {
String *Swig_name_disown(const String_or_char *classname) {
String *r;
String *f;
String *rclassname;
@ -600,7 +600,7 @@ static void merge_features(Hash *features, Node *n) {
* ----------------------------------------------------------------------------- */
static
void features_get(Hash *features, const String *tname, SwigType *decl, SwigType *ncdecl, Node *node) {
void features_get(Hash *features, String *tname, SwigType *decl, SwigType *ncdecl, Node *node) {
Node *n = Getattr(features, tname);
#ifdef SWIG_DEBUG
Printf(stdout, " features_get: %s\n", tname);
@ -655,7 +655,7 @@ void Swig_features_get(Hash *features, String *prefix, String *name, SwigType *d
}
#ifdef SWIG_DEBUG
Printf(stdout, "Swig_features_get: '%s' '%s' '%s'\n", prefix, name, decl);
Printf(stdout, "Swig_features_get: %s %s %s\n", prefix, name, decl);
#endif
/* Global features */
@ -727,12 +727,12 @@ void Swig_features_get(Hash *features, String *prefix, String *name, SwigType *d
* concatenating the feature name plus ':' plus the attribute name.
* ----------------------------------------------------------------------------- */
void Swig_feature_set(Hash *features, const_String_or_char_ptr name, SwigType *decl, const_String_or_char_ptr featurename, String *value, Hash *featureattribs) {
void Swig_feature_set(Hash *features, const String_or_char *name, SwigType *decl, const String_or_char *featurename, String *value, Hash *featureattribs) {
Hash *n;
Hash *fhash;
#ifdef SWIG_DEBUG
Printf(stdout, "Swig_feature_set: '%s' '%s' '%s' '%s'\n", name, decl, featurename, value);
Printf(stdout, "Swig_feature_set: %s %s %s %s\n", name, decl, featurename, value);
#endif
n = Getattr(features, name);
@ -1436,7 +1436,7 @@ static String *apply_rename(String *newname, int fullname, String *prefix, Strin
*
* ----------------------------------------------------------------------------- */
String *Swig_name_make(Node *n, String *prefix, const_String_or_char_ptr cname, SwigType *decl, String *oldname) {
String *Swig_name_make(Node *n, String *prefix, String_or_char *cname, SwigType *decl, String *oldname) {
String *nname = 0;
String *result = 0;
String *name = NewString(cname);

View file

@ -17,7 +17,7 @@ char cvsroot_parms_c[] = "$Id$";
* Create a new parameter from datatype 'type' and name 'name'.
* ------------------------------------------------------------------------ */
Parm *NewParm(SwigType *type, const_String_or_char_ptr name) {
Parm *NewParm(SwigType *type, const String_or_char *name) {
Parm *p = NewHash();
set_nodeType(p, "parm");
if (type) {

View file

@ -15,9 +15,6 @@ char cvsroot_scanner_c[] = "$Id$";
#include "swig.h"
#include <ctype.h>
extern String *cparse_file;
extern int cparse_start_line;
struct Scanner {
String *text; /* Current token value */
List *scanobjs; /* Objects being scanned */
@ -39,7 +36,7 @@ struct Scanner {
* Create a new scanner object
* ----------------------------------------------------------------------------- */
Scanner *NewScanner(void) {
Scanner *NewScanner() {
Scanner *s;
s = (Scanner *) malloc(sizeof(Scanner));
s->line = 1;
@ -118,11 +115,11 @@ void Scanner_push(Scanner * s, String *txt) {
* call to Scanner_token().
* ----------------------------------------------------------------------------- */
void Scanner_pushtoken(Scanner * s, int nt, const_String_or_char_ptr val) {
void Scanner_pushtoken(Scanner * s, int nt, const String_or_char *val) {
assert(s);
assert((nt >= 0) && (nt < SWIG_MAXTOKENS));
s->nexttoken = nt;
if ( Char(val) != Char(s->text) ) {
if (val != s->text) {
Clear(s->text);
Append(s->text,val);
}
@ -212,7 +209,7 @@ static char nextchar(Scanner * s) {
* Sets error information on the scanner.
* ----------------------------------------------------------------------------- */
static void set_error(Scanner *s, int line, const_String_or_char_ptr msg) {
static void set_error(Scanner *s, int line, String_or_char *msg) {
s->error_line = line;
s->error = NewString(msg);
}
@ -539,7 +536,7 @@ static int look(Scanner * s) {
break;
case 10: /* C++ style comment */
if ((c = nextchar(s)) == 0) {
Swig_error(cparse_file, cparse_start_line, "Unterminated comment\n");
set_error(s,s->start_line,"Unterminated comment");
return SWIG_TOKEN_ERROR;
}
if (c == '\n') {
@ -551,7 +548,7 @@ static int look(Scanner * s) {
break;
case 11: /* C style comment block */
if ((c = nextchar(s)) == 0) {
Swig_error(cparse_file, cparse_start_line, "Unterminated comment\n");
set_error(s,s->start_line,"Unterminated comment");
return SWIG_TOKEN_ERROR;
}
if (c == '*') {
@ -562,7 +559,7 @@ static int look(Scanner * s) {
break;
case 12: /* Still in C style comment */
if ((c = nextchar(s)) == 0) {
Swig_error(cparse_file, cparse_start_line, "Unterminated comment\n");
set_error(s,s->start_line,"Unterminated comment");
return SWIG_TOKEN_ERROR;
}
if (c == '*') {
@ -576,7 +573,7 @@ static int look(Scanner * s) {
case 2: /* Processing a string */
if ((c = nextchar(s)) == 0) {
Swig_error(cparse_file, cparse_start_line, "Unterminated string\n");
set_error(s,s->start_line, "Unterminated string");
return SWIG_TOKEN_ERROR;
}
if (c == '\"') {
@ -659,7 +656,7 @@ static int look(Scanner * s) {
case 40: /* Process an include block */
if ((c = nextchar(s)) == 0) {
Swig_error(cparse_file, cparse_start_line, "Unterminated block\n");
set_error(s,s->start_line,"Unterminated code block");
return SWIG_TOKEN_ERROR;
}
if (c == '%')
@ -936,7 +933,7 @@ static int look(Scanner * s) {
/* A character constant */
case 9:
if ((c = nextchar(s)) == 0) {
Swig_error(cparse_file, cparse_start_line, "Unterminated character constant\n");
set_error(s,s->start_line,"Unterminated character constant");
return SWIG_TOKEN_ERROR;
}
if (c == '\'') {
@ -1051,7 +1048,7 @@ static int look(Scanner * s) {
/* Reverse string */
case 900:
if ((c = nextchar(s)) == 0) {
Swig_error(cparse_file, cparse_start_line, "Unterminated character constant\n");
set_error(s,s->start_line,"Unterminated character constant");
return SWIG_TOKEN_ERROR;
}
if (c == '`') {

View file

@ -270,6 +270,20 @@ int SwigType_issimple(SwigType *t) {
return 1;
}
int SwigType_isbuiltin(SwigType *t) {
const char* builtins[] = { "void", "short", "int", "long", "char", "float", "double", "bool", 0 };
int i = 0;
char *c = Char(t);
if (!t)
return 0;
while (builtins[i]) {
if (strcmp(c, builtins[i]) == 0)
return 1;
i++;
}
return 0;
}
/* -----------------------------------------------------------------------------
* SwigType_default()
*
@ -537,7 +551,7 @@ String *SwigType_namestr(const SwigType *t) {
* Create a C string representation of a datatype.
* ----------------------------------------------------------------------------- */
String *SwigType_str(SwigType *s, const_String_or_char_ptr id) {
String *SwigType_str(SwigType *s, const String_or_char *id) {
String *result;
String *element = 0, *nextelement;
List *elements;
@ -732,7 +746,7 @@ SwigType *SwigType_ltype(SwigType *s) {
* with an equivalent assignable version.
* -------------------------------------------------------------------- */
String *SwigType_lstr(SwigType *s, const_String_or_char_ptr id) {
String *SwigType_lstr(SwigType *s, const String_or_char *id) {
String *result;
SwigType *tc;
@ -749,7 +763,7 @@ String *SwigType_lstr(SwigType *s, const_String_or_char_ptr id) {
* datatype printed by str().
* ----------------------------------------------------------------------------- */
String *SwigType_rcaststr(SwigType *s, const_String_or_char_ptr name) {
String *SwigType_rcaststr(SwigType *s, const String_or_char *name) {
String *result, *cast;
String *element = 0, *nextelement;
SwigType *td, *rs, *tc = 0;
@ -892,7 +906,7 @@ String *SwigType_rcaststr(SwigType *s, const_String_or_char_ptr name) {
* Casts a variable from the real type to the local datatype.
* ----------------------------------------------------------------------------- */
String *SwigType_lcaststr(SwigType *s, const_String_or_char_ptr name) {
String *SwigType_lcaststr(SwigType *s, const String_or_char *name) {
String *result;
result = NewStringEmpty();

View file

@ -110,15 +110,15 @@ extern "C" {
extern SwigType *NewSwigType(int typecode);
extern SwigType *SwigType_del_element(SwigType *t);
extern SwigType *SwigType_add_pointer(SwigType *t);
extern SwigType *SwigType_add_memberpointer(SwigType *t, const_String_or_char_ptr qual);
extern SwigType *SwigType_add_memberpointer(SwigType *t, const String_or_char *qual);
extern SwigType *SwigType_del_memberpointer(SwigType *t);
extern SwigType *SwigType_del_pointer(SwigType *t);
extern SwigType *SwigType_add_array(SwigType *t, const_String_or_char_ptr size);
extern SwigType *SwigType_add_array(SwigType *t, const String_or_char *size);
extern SwigType *SwigType_del_array(SwigType *t);
extern SwigType *SwigType_pop_arrays(SwigType *t);
extern SwigType *SwigType_add_reference(SwigType *t);
extern SwigType *SwigType_del_reference(SwigType *t);
extern SwigType *SwigType_add_qualifier(SwigType *t, const_String_or_char_ptr qual);
extern SwigType *SwigType_add_qualifier(SwigType *t, const String_or_char *qual);
extern SwigType *SwigType_del_qualifier(SwigType *t);
extern SwigType *SwigType_add_function(SwigType *t, ParmList *parms);
extern SwigType *SwigType_add_template(SwigType *t, ParmList *parms);
@ -129,10 +129,10 @@ extern "C" {
extern void SwigType_push(SwigType *t, SwigType *s);
extern List *SwigType_parmlist(const SwigType *p);
extern String *SwigType_parm(String *p);
extern String *SwigType_str(SwigType *s, const_String_or_char_ptr id);
extern String *SwigType_lstr(SwigType *s, const_String_or_char_ptr id);
extern String *SwigType_rcaststr(SwigType *s, const_String_or_char_ptr id);
extern String *SwigType_lcaststr(SwigType *s, const_String_or_char_ptr id);
extern String *SwigType_str(SwigType *s, const String_or_char *id);
extern String *SwigType_lstr(SwigType *s, const String_or_char *id);
extern String *SwigType_rcaststr(SwigType *s, const String_or_char *id);
extern String *SwigType_lcaststr(SwigType *s, const String_or_char *id);
extern String *SwigType_manglestr(SwigType *t);
extern SwigType *SwigType_ltype(SwigType *t);
extern int SwigType_ispointer(SwigType *t);
@ -151,7 +151,8 @@ extern "C" {
extern int SwigType_isvarargs(const SwigType *t);
extern int SwigType_istemplate(const SwigType *t);
extern int SwigType_isenum(SwigType *t);
extern int SwigType_check_decl(SwigType *t, const_String_or_char_ptr decl);
extern int SwigType_isbuiltin(SwigType *t);
extern int SwigType_check_decl(SwigType *t, const String_or_char *decl);
extern SwigType *SwigType_strip_qualifiers(SwigType *t);
extern SwigType *SwigType_functionpointer_decompose(SwigType *t);
extern String *SwigType_base(const SwigType *t);
@ -162,7 +163,7 @@ extern "C" {
extern String *SwigType_prefix(const SwigType *t);
extern int SwigType_array_ndim(SwigType *t);
extern String *SwigType_array_getdim(SwigType *t, int n);
extern void SwigType_array_setdim(SwigType *t, int n, const_String_or_char_ptr rep);
extern void SwigType_array_setdim(SwigType *t, int n, const String_or_char *rep);
extern SwigType *SwigType_array_type(SwigType *t);
extern String *SwigType_default(SwigType *t);
extern void SwigType_typename_replace(SwigType *t, String *pat, String *rep);
@ -173,27 +174,27 @@ extern "C" {
/* --- Type-system managment --- */
extern void SwigType_typesystem_init(void);
extern int SwigType_typedef(SwigType *type, const_String_or_char_ptr name);
extern int SwigType_typedef_class(const_String_or_char_ptr name);
extern int SwigType_typedef_using(const_String_or_char_ptr qname);
extern int SwigType_typedef(SwigType *type, String_or_char *name);
extern int SwigType_typedef_class(String_or_char *name);
extern int SwigType_typedef_using(String_or_char *qname);
extern void SwigType_inherit(String *subclass, String *baseclass, String *cast, String *conversioncode);
extern int SwigType_issubtype(SwigType *subtype, SwigType *basetype);
extern void SwigType_scope_alias(String *aliasname, Typetab *t);
extern void SwigType_using_scope(Typetab *t);
extern void SwigType_new_scope(const_String_or_char_ptr name);
extern void SwigType_new_scope(const String_or_char *name);
extern void SwigType_inherit_scope(Typetab *scope);
extern Typetab *SwigType_pop_scope(void);
extern Typetab *SwigType_set_scope(Typetab *h);
extern void SwigType_print_scope(Typetab *t);
extern SwigType *SwigType_typedef_resolve(const SwigType *t);
extern SwigType *SwigType_typedef_resolve(SwigType *t);
extern SwigType *SwigType_typedef_resolve_all(SwigType *t);
extern SwigType *SwigType_typedef_qualified(SwigType *t);
extern int SwigType_istypedef(SwigType *t);
extern int SwigType_isclass(SwigType *t);
extern void SwigType_attach_symtab(Symtab *syms);
extern void SwigType_remember(SwigType *t);
extern void SwigType_remember_clientdata(SwigType *t, const_String_or_char_ptr clientdata);
extern void SwigType_remember_mangleddata(String *mangled, const_String_or_char_ptr clientdata);
extern void SwigType_remember_clientdata(SwigType *t, const String_or_char *clientdata);
extern void SwigType_remember_mangleddata(String *mangled, const String_or_char *clientdata);
extern void (*SwigType_remember_trace(void (*tf) (SwigType *, String *, String *))) (SwigType *, String *, String *);
extern void SwigType_emit_type_table(File *f_headers, File *f_table);
extern int SwigType_type(SwigType *t);
@ -201,25 +202,25 @@ extern "C" {
/* --- Symbol table module --- */
extern void Swig_symbol_init(void);
extern void Swig_symbol_setscopename(const_String_or_char_ptr name);
extern void Swig_symbol_setscopename(const String_or_char *name);
extern String *Swig_symbol_getscopename(void);
extern String *Swig_symbol_qualifiedscopename(Symtab *symtab);
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_getscope(const String_or_char *symname);
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);
extern void Swig_symbol_cadd(const_String_or_char_ptr symname, Node *node);
extern Node *Swig_symbol_clookup(const_String_or_char_ptr symname, Symtab *tab);
extern Node *Swig_symbol_clookup_check(const_String_or_char_ptr symname, Symtab *tab, int (*check) (Node *));
extern Symtab *Swig_symbol_cscope(const_String_or_char_ptr symname, Symtab *tab);
extern Node *Swig_symbol_clookup_local(const_String_or_char_ptr symname, Symtab *tab);
extern Node *Swig_symbol_clookup_local_check(const_String_or_char_ptr symname, Symtab *tab, int (*check) (Node *));
extern Node *Swig_symbol_add(String_or_char *symname, Node *node);
extern void Swig_symbol_cadd(String_or_char *symname, Node *node);
extern Node *Swig_symbol_clookup(String_or_char *symname, Symtab *tab);
extern Node *Swig_symbol_clookup_check(String_or_char *symname, Symtab *tab, int (*check) (Node *));
extern Symtab *Swig_symbol_cscope(String_or_char *symname, Symtab *tab);
extern Node *Swig_symbol_clookup_local(String_or_char *symname, Symtab *tab);
extern Node *Swig_symbol_clookup_local_check(String_or_char *symname, Symtab *tab, int (*check) (Node *));
extern String *Swig_symbol_qualified(Node *node);
extern Node *Swig_symbol_isoverloaded(Node *node);
extern void Swig_symbol_remove(Node *node);
extern void Swig_symbol_alias(const_String_or_char_ptr aliasname, Symtab *tab);
extern void Swig_symbol_alias(String_or_char *aliasname, Symtab *tab);
extern void Swig_symbol_inherit(Symtab *tab);
extern SwigType *Swig_symbol_type_qualify(const SwigType *ty, Symtab *tab);
extern String *Swig_symbol_string_qualify(String *s, Symtab *tab);
@ -246,17 +247,17 @@ extern int ParmList_is_compactdefargs(ParmList *p);
/* --- Naming functions --- */
extern void Swig_name_register(const_String_or_char_ptr method, const_String_or_char_ptr format);
extern void Swig_name_unregister(const_String_or_char_ptr method);
extern String *Swig_name_mangle(const_String_or_char_ptr s);
extern String *Swig_name_wrapper(const_String_or_char_ptr fname);
extern String *Swig_name_member(const_String_or_char_ptr classname, const_String_or_char_ptr mname);
extern String *Swig_name_get(const_String_or_char_ptr vname);
extern String *Swig_name_set(const_String_or_char_ptr vname);
extern String *Swig_name_construct(const_String_or_char_ptr classname);
extern String *Swig_name_copyconstructor(const_String_or_char_ptr classname);
extern String *Swig_name_destroy(const_String_or_char_ptr classname);
extern String *Swig_name_disown(const_String_or_char_ptr classname);
extern void Swig_name_register(const String_or_char *method, const String_or_char *format);
extern void Swig_name_unregister(const String_or_char *method);
extern String *Swig_name_mangle(const String_or_char *s);
extern String *Swig_name_wrapper(const String_or_char *fname);
extern String *Swig_name_member(const String_or_char *classname, const String_or_char *mname);
extern String *Swig_name_get(const String_or_char *vname);
extern String *Swig_name_set(const String_or_char *vname);
extern String *Swig_name_construct(const String_or_char *classname);
extern String *Swig_name_copyconstructor(const String_or_char *classname);
extern String *Swig_name_destroy(const String_or_char *classname);
extern String *Swig_name_disown(const String_or_char *classname);
extern void Swig_naming_init(void);
extern void Swig_name_namewarn_add(String *prefix, String *name, SwigType *decl, Hash *namewrn);
@ -267,36 +268,33 @@ extern int ParmList_is_compactdefargs(ParmList *p);
extern int Swig_need_name_warning(Node *n);
extern int Swig_need_redefined_warn(Node *a, Node *b, int InClass);
extern String *Swig_name_make(Node *n, String *prefix, const_String_or_char_ptr cname, SwigType *decl, String *oldname);
extern String *Swig_name_make(Node *n, String *prefix, String_or_char *cname, SwigType *decl, String *oldname);
extern String *Swig_name_warning(Node *n, String *prefix, String *name, SwigType *decl);
extern String *Swig_name_decl(Node *n);
extern String *Swig_name_fulldecl(Node *n);
/* --- parameterized rename functions --- */
extern void Swig_name_object_set(Hash *namehash, String *name, SwigType *decl, DOH *object);
extern DOH *Swig_name_object_get(Hash *namehash, String *prefix, String *name, SwigType *decl);
extern void Swig_name_object_set(Hash *namehash, String_or_char *name, SwigType *decl, DOH *object);
extern DOH *Swig_name_object_get(Hash *namehash, String_or_char *prefix, String_or_char *name, SwigType *decl);
extern void Swig_name_object_inherit(Hash *namehash, String *base, String *derived);
extern void Swig_features_get(Hash *features, String *prefix, String *name, SwigType *decl, Node *n);
extern void Swig_feature_set(Hash *features, const_String_or_char_ptr name, SwigType *decl, const_String_or_char_ptr featurename, String *value, Hash *featureattribs);
extern void Swig_features_get(Hash *features, String_or_char *prefix, String_or_char *name, SwigType *decl, Node *n);
extern void Swig_feature_set(Hash *features, const String_or_char *name, SwigType *decl, const String_or_char *featurename, String *value, Hash *featureattribs);
/* --- Misc --- */
extern char *Swig_copy_string(const char *c);
extern void Swig_set_fakeversion(const char *version);
extern const char *Swig_package_version(void);
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_string_escape(String *s);
extern String *Swig_string_mangle(const String *s);
extern void Swig_scopename_split(const String *s, String **prefix, String **last);
extern String *Swig_scopename_prefix(const String *s);
extern String *Swig_scopename_last(const String *s);
extern String *Swig_scopename_first(const String *s);
extern String *Swig_scopename_suffix(const String *s);
extern int Swig_scopename_check(const String *s);
extern void Swig_scopename_split(String *s, String **prefix, String **last);
extern String *Swig_scopename_prefix(String *s);
extern String *Swig_scopename_last(String *s);
extern String *Swig_scopename_first(String *s);
extern String *Swig_scopename_suffix(String *s);
extern int Swig_scopename_check(String *s);
extern String *Swig_string_lower(String *s);
extern String *Swig_string_upper(String *s);
extern String *Swig_string_title(String *s);
@ -311,11 +309,11 @@ extern int ParmList_is_compactdefargs(ParmList *p);
typedef enum { EMF_STANDARD, EMF_MICROSOFT } ErrorMessageFormat;
extern void Swig_warning(int num, const_String_or_char_ptr filename, int line, const char *fmt, ...);
extern void Swig_error(const_String_or_char_ptr filename, int line, const char *fmt, ...);
extern void Swig_warning(int num, const String_or_char *filename, int line, const char *fmt, ...);
extern void Swig_error(const String_or_char *filename, int line, const char *fmt, ...);
extern int Swig_error_count(void);
extern void Swig_error_silent(int s);
extern void Swig_warnfilter(const_String_or_char_ptr wlist, int val);
extern void Swig_warnfilter(const String_or_char *wlist, int val);
extern void Swig_warnall(void);
extern int Swig_warn_count(void);
extern void Swig_error_msg_format(ErrorMessageFormat format);
@ -324,17 +322,17 @@ extern int ParmList_is_compactdefargs(ParmList *p);
extern String *Swig_cparm_name(Parm *p, int i);
extern String *Swig_wrapped_var_type(SwigType *t, int varcref);
extern int Swig_cargs(Wrapper *w, ParmList *l);
extern String *Swig_cresult(SwigType *t, const_String_or_char_ptr name, const_String_or_char_ptr decl);
extern String *Swig_cresult(SwigType *t, const String_or_char *name, const String_or_char *decl);
extern String *Swig_cfunction_call(const_String_or_char_ptr name, ParmList *parms);
extern String *Swig_cconstructor_call(const_String_or_char_ptr name);
extern String *Swig_cppconstructor_call(const_String_or_char_ptr name, ParmList *parms);
extern String *Swig_cfunction_call(String_or_char *name, ParmList *parms);
extern String *Swig_cconstructor_call(String_or_char *name);
extern String *Swig_cppconstructor_call(String_or_char *name, ParmList *parms);
extern String *Swig_unref_call(Node *n);
extern String *Swig_ref_call(Node *n, const String *lname);
extern String *Swig_cdestructor_call(Node *n);
extern String *Swig_cppdestructor_call(Node *n);
extern String *Swig_cmemberset_call(const_String_or_char_ptr name, SwigType *type, String *self, int varcref);
extern String *Swig_cmemberget_call(const_String_or_char_ptr name, SwigType *t, String *self, int varcref);
extern String *Swig_cmemberset_call(String_or_char *name, SwigType *type, String_or_char *self, int varcref);
extern String *Swig_cmemberget_call(const String_or_char *name, SwigType *t, String_or_char *self, int varcref);
extern int Swig_add_extension_code(Node *n, const String *function_name, ParmList *parms, SwigType *return_type, const String *code, int cplusplus, const String *self);
@ -343,7 +341,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);
@ -363,22 +361,22 @@ 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 *op, ParmList *pattern, String_or_char *code, ParmList *locals, ParmList *kwargs);
extern int Swig_typemap_copy(const String_or_char *op, ParmList *srcpattern, ParmList *pattern);
extern void Swig_typemap_clear(const String_or_char *op, 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 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 Hash *Swig_typemap_search(const String_or_char *op, SwigType *type, const String_or_char *pname, SwigType **matchtype);
extern Hash *Swig_typemap_search_multi(const String_or_char *op, ParmList *parms, int *nmatch);
extern String *Swig_typemap_lookup(const String_or_char *op, Node *n, const String_or_char *lname, Wrapper *f);
extern String *Swig_typemap_lookup_out(const String_or_char *op, Node *n, const String_or_char *lname, Wrapper *f, String *actioncode);
extern void Swig_typemap_attach_kwargs(Hash *tm, const String_or_char *op, Parm *p);
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 *op, ParmList *parms, Wrapper *f);
/* --- Code fragment support --- */

View file

@ -9,25 +9,24 @@
/* $Id: swig.h 9603 2006-12-05 21:47:01Z beazley $ */
extern List *Swig_add_directory(const_String_or_char_ptr dirname);
extern void Swig_push_directory(const_String_or_char_ptr dirname);
extern void Swig_pop_directory(void);
extern String *Swig_last_file(void);
extern List *Swig_search_path(void);
extern FILE *Swig_include_open(const_String_or_char_ptr name);
extern FILE *Swig_open(const_String_or_char_ptr name);
extern List *Swig_add_directory(const String_or_char *dirname);
extern void Swig_push_directory(const String_or_char *dirname);
extern void Swig_pop_directory();
extern String *Swig_last_file();
extern List *Swig_search_path();
extern FILE *Swig_open(const String_or_char *name);
extern String *Swig_read_file(FILE *f);
extern String *Swig_include(const_String_or_char_ptr name);
extern String *Swig_include_sys(const_String_or_char_ptr name);
extern int Swig_insert_file(const_String_or_char_ptr name, File *outfile);
extern String *Swig_include(const String_or_char *name);
extern String *Swig_include_sys(const String_or_char *name);
extern int Swig_insert_file(const String_or_char *name, File *outfile);
extern void Swig_set_push_dir(int dopush);
extern int Swig_get_push_dir(void);
extern void Swig_register_filebyname(const_String_or_char_ptr filename, File *outfile);
extern File *Swig_filebyname(const_String_or_char_ptr filename);
extern char *Swig_file_suffix(const_String_or_char_ptr filename);
extern char *Swig_file_basename(const_String_or_char_ptr filename);
extern char *Swig_file_filename(const_String_or_char_ptr filename);
extern char *Swig_file_dirname(const_String_or_char_ptr filename);
extern void Swig_register_filebyname(const String_or_char *filename, File *outfile);
extern File *Swig_filebyname(const String_or_char *filename);
extern char *Swig_file_suffix(const String_or_char *filename);
extern char *Swig_file_basename(const String_or_char *filename);
extern char *Swig_file_filename(const String_or_char *filename);
extern char *Swig_file_dirname(const String_or_char *filename);
/* Delimiter used in accessing files and directories */

View file

@ -13,4 +13,4 @@
extern void Swig_mark_arg(int n);
extern int Swig_check_marked(int n);
extern void Swig_check_options(int check_input);
extern void Swig_arg_error(void);
extern void Swig_arg_error();

View file

@ -11,7 +11,7 @@
/* $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 *name);
extern Parm *CopyParm(Parm *p);
/* Parameter lists */

View file

@ -11,11 +11,11 @@
typedef struct Scanner Scanner;
extern Scanner *NewScanner(void);
extern Scanner *NewScanner();
extern void DelScanner(Scanner *);
extern void Scanner_clear(Scanner *);
extern void Scanner_push(Scanner *, String *);
extern void Scanner_pushtoken(Scanner *, int, const_String_or_char_ptr value);
extern void Scanner_pushtoken(Scanner *, int, const String_or_char *value);
extern int Scanner_token(Scanner *);
extern String *Scanner_text(Scanner *);
extern void Scanner_skip_line(Scanner *);

View file

@ -31,7 +31,7 @@
/* Utility functions */
extern int checkAttribute(Node *obj, const_String_or_char_ptr name, const_String_or_char_ptr value);
extern int checkAttribute(Node *obj, const String_or_char *name, const String_or_char *value);
extern void appendChild(Node *node, Node *child);
extern void prependChild(Node *node, Node *child);
extern void removeNode(Node *node);

View file

@ -16,14 +16,14 @@ typedef struct Wrapper {
String *code;
} Wrapper;
extern Wrapper *NewWrapper(void);
extern Wrapper *NewWrapper();
extern void DelWrapper(Wrapper *w);
extern void Wrapper_compact_print_mode_set(int flag);
extern void Wrapper_pretty_print(String *str, File *f);
extern void Wrapper_compact_print(String *str, File *f);
extern void Wrapper_print(Wrapper *w, File *f);
extern int Wrapper_add_local(Wrapper *w, const_String_or_char_ptr name, const_String_or_char_ptr decl);
extern int Wrapper_add_localv(Wrapper *w, const_String_or_char_ptr name, ...);
extern int Wrapper_check_local(Wrapper *w, const_String_or_char_ptr name);
extern char *Wrapper_new_local(Wrapper *w, const_String_or_char_ptr name, const_String_or_char_ptr decl);
extern char *Wrapper_new_localv(Wrapper *w, const_String_or_char_ptr name, ...);
extern int Wrapper_add_local(Wrapper *w, const String_or_char *name, const String_or_char *decl);
extern int Wrapper_add_localv(Wrapper *w, const String_or_char *name, ...);
extern int Wrapper_check_local(Wrapper *w, const String_or_char *name);
extern char *Wrapper_new_local(Wrapper *w, const String_or_char *name, const String_or_char *decl);
extern char *Wrapper_new_localv(Wrapper *w, const String_or_char *name, ...);

View file

@ -220,7 +220,7 @@ void Swig_symbol_init() {
* Set the C scopename of the current symbol table.
* ----------------------------------------------------------------------------- */
void Swig_symbol_setscopename(const_String_or_char_ptr name) {
void Swig_symbol_setscopename(const String_or_char *name) {
String *qname;
/* assert(!Getattr(current_symtab,"name")); */
Setattr(current_symtab, "name", name);
@ -250,10 +250,10 @@ String *Swig_symbol_getscopename() {
* Given a fully qualified C scopename, this function returns a symbol table
* ----------------------------------------------------------------------------- */
Symtab *Swig_symbol_getscope(const_String_or_char_ptr name) {
Symtab *Swig_symbol_getscope(const String_or_char *name) {
if (!symtabs)
return 0;
if (Equal("::", (const_String_or_char_ptr ) name))
if (Equal("::", (String_or_char *) name))
name = "";
return Getattr(symtabs, name);
}
@ -373,7 +373,7 @@ Symtab *Swig_symbol_current() {
* Makes an alias for a symbol in the global symbol table.
* ----------------------------------------------------------------------------- */
void Swig_symbol_alias(const_String_or_char_ptr aliasname, Symtab *s) {
void Swig_symbol_alias(String_or_char *aliasname, Symtab *s) {
String *qname = Swig_symbol_qualifiedscopename(current_symtab);
if (qname) {
Printf(qname, "::%s", aliasname);
@ -421,7 +421,7 @@ void Swig_symbol_inherit(Symtab *s) {
* Adds a node to the C symbol table only.
* ----------------------------------------------------------------------------- */
void Swig_symbol_cadd(const_String_or_char_ptr name, Node *n) {
void Swig_symbol_cadd(String_or_char *name, Node *n) {
Node *append = 0;
Node *cn;
@ -594,7 +594,7 @@ void Swig_symbol_cadd(const_String_or_char_ptr name, Node *n) {
* for namespace support, type resolution, and other issues.
* ----------------------------------------------------------------------------- */
Node *Swig_symbol_add(const_String_or_char_ptr symname, Node *n) {
Node *Swig_symbol_add(String_or_char *symname, Node *n) {
Hash *c, *cn, *cl = 0;
SwigType *decl, *ndecl;
String *cstorage, *nstorage;
@ -827,7 +827,7 @@ Node *Swig_symbol_add(const_String_or_char_ptr symname, Node *n) {
* verifying that a class hierarchy implements all pure virtual methods.
* ----------------------------------------------------------------------------- */
static Node *_symbol_lookup(const String *name, Symtab *symtab, int (*check) (Node *n)) {
static Node *_symbol_lookup(String *name, Symtab *symtab, int (*check) (Node *n)) {
Node *n;
List *inherit;
Hash *sym = Getattr(symtab, "csymtab");
@ -890,7 +890,7 @@ static Node *_symbol_lookup(const String *name, Symtab *symtab, int (*check) (No
return 0;
}
static Node *symbol_lookup(const_String_or_char_ptr name, Symtab *symtab, int (*check) (Node *n)) {
static Node *symbol_lookup(String_or_char *name, Symtab *symtab, int (*check) (Node *n)) {
Node *n = 0;
if (DohCheck(name)) {
n = _symbol_lookup(name, symtab, check);
@ -908,7 +908,7 @@ static Node *symbol_lookup(const_String_or_char_ptr name, Symtab *symtab, int (*
* symbol_lookup_qualified()
* ----------------------------------------------------------------------------- */
static Node *symbol_lookup_qualified(const_String_or_char_ptr name, Symtab *symtab, const String *prefix, int local, int (*checkfunc) (Node *n)) {
static Node *symbol_lookup_qualified(String_or_char *name, Symtab *symtab, String *prefix, int local, int (*checkfunc) (Node *n)) {
/* This is a little funky, we search by fully qualified names */
if (!symtab)
@ -928,7 +928,6 @@ static Node *symbol_lookup_qualified(const_String_or_char_ptr name, Symtab *symt
/* Make qualified name of current scope */
String *qalloc = 0;
String *qname = Swig_symbol_qualifiedscopename(symtab);
const String *cqname;
if (qname) {
if (Len(qname)) {
if (prefix && Len(prefix)) {
@ -938,11 +937,10 @@ static Node *symbol_lookup_qualified(const_String_or_char_ptr name, Symtab *symt
Append(qname, prefix);
}
qalloc = qname;
cqname = qname;
} else {
cqname = prefix;
qname = prefix;
}
st = Getattr(symtabs, cqname);
st = Getattr(symtabs, qname);
/* Found a scope match */
if (st) {
if (!name) {
@ -976,7 +974,7 @@ static Node *symbol_lookup_qualified(const_String_or_char_ptr name, Symtab *symt
* to get the real node.
* ----------------------------------------------------------------------------- */
Node *Swig_symbol_clookup(const_String_or_char_ptr name, Symtab *n) {
Node *Swig_symbol_clookup(String_or_char *name, Symtab *n) {
Hash *hsym = 0;
Node *s = 0;
@ -1048,7 +1046,7 @@ Node *Swig_symbol_clookup(const_String_or_char_ptr name, Symtab *n) {
* inheritance hierarchy.
* ----------------------------------------------------------------------------- */
Node *Swig_symbol_clookup_check(const_String_or_char_ptr name, Symtab *n, int (*checkfunc) (Node *n)) {
Node *Swig_symbol_clookup_check(String_or_char *name, Symtab *n, int (*checkfunc) (Node *n)) {
Hash *hsym = 0;
Node *s = 0;
@ -1112,7 +1110,7 @@ Node *Swig_symbol_clookup_check(const_String_or_char_ptr name, Symtab *n, int (*
* Swig_symbol_clookup_local()
* ----------------------------------------------------------------------------- */
Node *Swig_symbol_clookup_local(const_String_or_char_ptr name, Symtab *n) {
Node *Swig_symbol_clookup_local(String_or_char *name, Symtab *n) {
Hash *h, *hsym;
Node *s = 0;
@ -1160,7 +1158,7 @@ Node *Swig_symbol_clookup_local(const_String_or_char_ptr name, Symtab *n) {
* Swig_symbol_clookup_local_check()
* ----------------------------------------------------------------------------- */
Node *Swig_symbol_clookup_local_check(const_String_or_char_ptr name, Symtab *n, int (*checkfunc) (Node *)) {
Node *Swig_symbol_clookup_local_check(String_or_char *name, Symtab *n, int (*checkfunc) (Node *)) {
Hash *h, *hsym;
Node *s = 0;
@ -1211,7 +1209,7 @@ Node *Swig_symbol_clookup_local_check(const_String_or_char_ptr name, Symtab *n,
* Look up a scope name.
* ----------------------------------------------------------------------------- */
Symtab *Swig_symbol_cscope(const_String_or_char_ptr name, Symtab *symtab) {
Symtab *Swig_symbol_cscope(String_or_char *name, Symtab *symtab) {
char *cname = Char(name);
if (strncmp(cname, "::", 2) == 0)
return symbol_lookup_qualified(0, global_scope, name, 0, 0);

View file

@ -229,7 +229,7 @@ Node *copyNode(Node *n) {
* checkAttribute()
* ----------------------------------------------------------------------------- */
int checkAttribute(Node *n, const_String_or_char_ptr name, const_String_or_char_ptr value) {
int checkAttribute(Node *n, const String_or_char *name, const String_or_char *value) {
String *v = Getattr(n, name);
return v ? Equal(v, value) : 0;
}

View file

@ -107,7 +107,7 @@ void Swig_typemap_init() {
tm_scope = 0;
}
static String *tmop_name(const_String_or_char_ptr op) {
static String *tmop_name(const String_or_char *op) {
static Hash *names = 0;
String *s;
/* Due to "interesting" object-identity semantics of DOH,
@ -164,7 +164,7 @@ Hash *Swig_typemap_pop_scope() {
* Add a new multi-valued typemap
* ----------------------------------------------------------------------------- */
void Swig_typemap_register(const_String_or_char_ptr op, ParmList *parms, const_String_or_char_ptr code, ParmList *locals, ParmList *kwargs) {
void Swig_typemap_register(const String_or_char *op, ParmList *parms, String_or_char *code, ParmList *locals, ParmList *kwargs) {
Hash *tm;
Hash *tm1;
Hash *tm2;
@ -270,7 +270,7 @@ void Swig_typemap_register(const_String_or_char_ptr op, ParmList *parms, const_S
* Retrieve typemap information from current scope.
* ----------------------------------------------------------------------------- */
static Hash *Swig_typemap_get(SwigType *type, const_String_or_char_ptr name, int scope) {
static Hash *Swig_typemap_get(SwigType *type, String_or_char *name, int scope) {
Hash *tm, *tm1;
/* See if this type has been seen before */
if ((scope < 0) || (scope > tm_scope))
@ -292,7 +292,7 @@ static Hash *Swig_typemap_get(SwigType *type, const_String_or_char_ptr name, int
* Copy a typemap
* ----------------------------------------------------------------------------- */
int Swig_typemap_copy(const_String_or_char_ptr op, ParmList *srcparms, ParmList *parms) {
int Swig_typemap_copy(const String_or_char *op, ParmList *srcparms, ParmList *parms) {
Hash *tm = 0;
String *tmop;
Parm *p;
@ -347,7 +347,7 @@ int Swig_typemap_copy(const_String_or_char_ptr op, ParmList *srcparms, ParmList
* Delete a multi-valued typemap
* ----------------------------------------------------------------------------- */
void Swig_typemap_clear(const_String_or_char_ptr op, ParmList *parms) {
void Swig_typemap_clear(const String_or_char *op, ParmList *parms) {
SwigType *type;
String *name;
Parm *p;
@ -590,7 +590,7 @@ static SwigType *strip_arrays(SwigType *type) {
* that includes a 'code' attribute.
* ----------------------------------------------------------------------------- */
Hash *Swig_typemap_search(const_String_or_char_ptr op, SwigType *type, const_String_or_char_ptr name, SwigType **matchtype) {
Hash *Swig_typemap_search(const String_or_char *op, SwigType *type, const String_or_char *name, SwigType **matchtype) {
Hash *result = 0, *tm, *tm1, *tma;
Hash *backup = 0;
SwigType *noarrays = 0;
@ -737,7 +737,7 @@ ret_result:
* Search for a multi-valued typemap.
* ----------------------------------------------------------------------------- */
Hash *Swig_typemap_search_multi(const_String_or_char_ptr op, ParmList *parms, int *nmatch) {
Hash *Swig_typemap_search_multi(const String_or_char *op, ParmList *parms, int *nmatch) {
SwigType *type;
SwigType *mtype = 0;
String *name;
@ -1173,7 +1173,7 @@ static void typemap_locals(DOHString * s, ParmList *l, Wrapper *f, int argnum) {
* $1 in the out typemap will be replaced by the code in actioncode.
* ----------------------------------------------------------------------------- */
static String *Swig_typemap_lookup_impl(const_String_or_char_ptr op, Node *node, const_String_or_char_ptr lname, Wrapper *f, String *actioncode) {
static String *Swig_typemap_lookup_impl(const String_or_char *op, Node *node, const String_or_char *lname, Wrapper *f, String *actioncode) {
SwigType *type;
SwigType *mtype = 0;
String *pname;
@ -1384,13 +1384,13 @@ static String *Swig_typemap_lookup_impl(const_String_or_char_ptr op, Node *node,
return s;
}
String *Swig_typemap_lookup_out(const_String_or_char_ptr op, Node *node, const_String_or_char_ptr lname, Wrapper *f, String *actioncode) {
String *Swig_typemap_lookup_out(const String_or_char *op, Node *node, const String_or_char *lname, Wrapper *f, String *actioncode) {
assert(actioncode);
assert(Cmp(op, "out") == 0);
return Swig_typemap_lookup_impl(op, node, lname, f, actioncode);
}
String *Swig_typemap_lookup(const_String_or_char_ptr op, Node *node, const_String_or_char_ptr lname, Wrapper *f) {
String *Swig_typemap_lookup(const String_or_char *op, Node *node, const String_or_char *lname, Wrapper *f) {
return Swig_typemap_lookup_impl(op, node, lname, f, 0);
}
@ -1406,7 +1406,7 @@ String *Swig_typemap_lookup(const_String_or_char_ptr op, Node *node, const_Strin
* A new attribute called "tmap:in:foo" with value "xyz" is attached to p.
* ----------------------------------------------------------------------------- */
void Swig_typemap_attach_kwargs(Hash *tm, const_String_or_char_ptr op, Parm *p) {
void Swig_typemap_attach_kwargs(Hash *tm, const String_or_char *op, Parm *p) {
String *temp = NewStringEmpty();
Parm *kw = Getattr(tm, "kwargs");
while (kw) {
@ -1438,7 +1438,7 @@ void Swig_typemap_attach_kwargs(Hash *tm, const_String_or_char_ptr op, Parm *p)
* attribute, print that warning message.
* ----------------------------------------------------------------------------- */
static void Swig_typemap_warn(const_String_or_char_ptr op, Parm *p) {
static void Swig_typemap_warn(const String_or_char *op, Parm *p) {
String *temp = NewStringf("%s:warning", op);
String *w = Getattr(p, tmop_name(temp));
Delete(temp);
@ -1447,7 +1447,7 @@ static void Swig_typemap_warn(const_String_or_char_ptr op, Parm *p) {
}
}
static void Swig_typemap_emit_code_fragments(const_String_or_char_ptr op, Parm *p) {
static void Swig_typemap_emit_code_fragments(const String_or_char *op, Parm *p) {
String *temp = NewStringf("%s:fragment", op);
String *f = Getattr(p, tmop_name(temp));
if (f) {
@ -1467,7 +1467,7 @@ static void Swig_typemap_emit_code_fragments(const_String_or_char_ptr op, Parm *
* given typemap type
* ----------------------------------------------------------------------------- */
String *Swig_typemap_get_option(Hash *tm, const_String_or_char_ptr name) {
String *Swig_typemap_get_option(Hash *tm, String *name) {
Parm *kw = Getattr(tm, "kwargs");
while (kw) {
String *kname = Getattr(kw, "name");
@ -1479,7 +1479,7 @@ String *Swig_typemap_get_option(Hash *tm, const_String_or_char_ptr name) {
return 0;
}
void Swig_typemap_attach_parms(const_String_or_char_ptr op, ParmList *parms, Wrapper *f) {
void Swig_typemap_attach_parms(const String_or_char *op, ParmList *parms, Wrapper *f) {
Parm *p, *firstp;
Hash *tm;
int nmatch = 0;

View file

@ -110,7 +110,7 @@ char cvsroot_typeobj_c[] = "$Id$";
* ----------------------------------------------------------------------------- */
#ifdef NEW
SwigType *NewSwigType(const_String_or_char_ptr initial) {
SwigType *NewSwigType(const String_or_char *initial) {
return NewString(initial);
}
@ -419,7 +419,7 @@ int SwigType_isreference(SwigType *t) {
* stored in exactly the same way as "q(const volatile)".
* ----------------------------------------------------------------------------- */
SwigType *SwigType_add_qualifier(SwigType *t, const_String_or_char_ptr qual) {
SwigType *SwigType_add_qualifier(SwigType *t, const String_or_char *qual) {
char temp[256], newq[256];
int sz, added = 0;
char *q, *cqual;
@ -537,7 +537,7 @@ SwigType *SwigType_functionpointer_decompose(SwigType *t) {
* Add, remove, and test for C++ pointer to members.
* ----------------------------------------------------------------------------- */
SwigType *SwigType_add_memberpointer(SwigType *t, const_String_or_char_ptr name) {
SwigType *SwigType_add_memberpointer(SwigType *t, const String_or_char *name) {
String *temp = NewStringf("m(%s).", name);
Insert(t, 0, temp);
Delete(temp);
@ -579,7 +579,7 @@ int SwigType_ismemberpointer(SwigType *t) {
* SwigType_pop_arrays() - Remove all arrays
* ----------------------------------------------------------------------------- */
SwigType *SwigType_add_array(SwigType *t, const_String_or_char_ptr size) {
SwigType *SwigType_add_array(SwigType *t, const String_or_char *size) {
char temp[512];
strcpy(temp, "a(");
strcat(temp, Char(size));
@ -673,7 +673,7 @@ String *SwigType_array_getdim(SwigType *t, int n) {
}
/* Replace nth array dimension */
void SwigType_array_setdim(SwigType *t, int n, const_String_or_char_ptr rep) {
void SwigType_array_setdim(SwigType *t, int n, const String_or_char *rep) {
String *result = 0;
char temp;
char *start;

View file

@ -163,7 +163,7 @@ void SwigType_typesystem_init() {
* already defined.
* ----------------------------------------------------------------------------- */
int SwigType_typedef(SwigType *type, const_String_or_char_ptr name) {
int SwigType_typedef(SwigType *type, String_or_char *name) {
if (Getattr(current_typetab, name))
return -1; /* Already defined */
if (Strcmp(type, name) == 0) { /* Can't typedef a name to itself */
@ -193,7 +193,7 @@ int SwigType_typedef(SwigType *type, const_String_or_char_ptr name) {
* Defines a class in the current scope.
* ----------------------------------------------------------------------------- */
int SwigType_typedef_class(const_String_or_char_ptr name) {
int SwigType_typedef_class(String_or_char *name) {
String *cname;
/* Printf(stdout,"class : '%s'\n", name); */
if (Getattr(current_typetab, name))
@ -232,7 +232,7 @@ String *SwigType_scope_name(Typetab *ttab) {
* Creates a new scope
* ----------------------------------------------------------------------------- */
void SwigType_new_scope(const_String_or_char_ptr name) {
void SwigType_new_scope(const String_or_char *name) {
Typetab *s;
Hash *ttab;
String *qname;
@ -539,7 +539,7 @@ static SwigType *typedef_resolve(Typetab *s, String *base) {
* ----------------------------------------------------------------------------- */
/* #define SWIG_DEBUG */
SwigType *SwigType_typedef_resolve(const SwigType *t) {
SwigType *SwigType_typedef_resolve(SwigType *t) {
String *base;
String *type = 0;
String *r = 0;
@ -840,7 +840,6 @@ 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 *
* ----------------------------------------------------------------------------- */
SwigType *SwigType_typedef_qualified(SwigType *t) {
@ -848,7 +847,7 @@ SwigType *SwigType_typedef_qualified(SwigType *t) {
String *result;
int i, len;
if (strncmp(Char(t), "::", 2) == 0) {
if (t && strncmp(Char(t), "::", 2) == 0) {
return Copy(t);
}
@ -1072,7 +1071,7 @@ int SwigType_istypedef(SwigType *t) {
* Name is a qualified name like A::B.
* ----------------------------------------------------------------------------- */
int SwigType_typedef_using(const_String_or_char_ptr name) {
int SwigType_typedef_using(String_or_char *name) {
String *base;
String *td;
String *prefix;
@ -1416,7 +1415,7 @@ static Hash *r_remembered = 0; /* Hash of types we remembered already */
static void (*r_tracefunc) (SwigType *t, String *mangled, String *clientdata) = 0;
void SwigType_remember_mangleddata(String *mangled, const_String_or_char_ptr clientdata) {
void SwigType_remember_mangleddata(String *mangled, const String_or_char *clientdata) {
if (!r_mangleddata) {
r_mangleddata = NewHash();
}
@ -1424,7 +1423,7 @@ void SwigType_remember_mangleddata(String *mangled, const_String_or_char_ptr cli
}
void SwigType_remember_clientdata(SwigType *t, const_String_or_char_ptr clientdata) {
void SwigType_remember_clientdata(SwigType *t, const String_or_char *clientdata) {
String *mt;
SwigType *lt;
Hash *h;

View file

@ -23,7 +23,7 @@ static int Max_line_size = 128;
* Create a new wrapper function object.
* ----------------------------------------------------------------------------- */
Wrapper *NewWrapper(void) {
Wrapper *NewWrapper() {
Wrapper *w;
w = (Wrapper *) malloc(sizeof(Wrapper));
w->localh = NewHash();
@ -406,7 +406,7 @@ void Wrapper_print(Wrapper *w, File *f) {
* present (which may or may not be okay to the caller).
* ----------------------------------------------------------------------------- */
int Wrapper_add_local(Wrapper *w, const_String_or_char_ptr name, const_String_or_char_ptr decl) {
int Wrapper_add_local(Wrapper *w, const String_or_char *name, const String_or_char *decl) {
/* See if the local has already been declared */
if (Getattr(w->localh, name)) {
return -1;
@ -424,7 +424,7 @@ int Wrapper_add_local(Wrapper *w, const_String_or_char_ptr name, const_String_or
* to manually construct the 'decl' string before calling.
* ----------------------------------------------------------------------------- */
int Wrapper_add_localv(Wrapper *w, const_String_or_char_ptr name, ...) {
int Wrapper_add_localv(Wrapper *w, const String_or_char *name, ...) {
va_list ap;
int ret;
String *decl;
@ -451,7 +451,7 @@ int Wrapper_add_localv(Wrapper *w, const_String_or_char_ptr name, ...) {
* Check to see if a local name has already been declared
* ----------------------------------------------------------------------------- */
int Wrapper_check_local(Wrapper *w, const_String_or_char_ptr name) {
int Wrapper_check_local(Wrapper *w, const String_or_char *name) {
if (Getattr(w->localh, name)) {
return 1;
}
@ -465,7 +465,7 @@ int Wrapper_check_local(Wrapper *w, const_String_or_char_ptr name) {
* used. Returns the name that was actually selected.
* ----------------------------------------------------------------------------- */
char *Wrapper_new_local(Wrapper *w, const_String_or_char_ptr name, const_String_or_char_ptr decl) {
char *Wrapper_new_local(Wrapper *w, const String_or_char *name, const String_or_char *decl) {
int i;
String *nname = NewString(name);
String *ndecl = NewString(decl);
@ -496,7 +496,7 @@ char *Wrapper_new_local(Wrapper *w, const_String_or_char_ptr name, const_String_
* to manually construct the 'decl' string before calling.
* ----------------------------------------------------------------------------- */
char *Wrapper_new_localv(Wrapper *w, const_String_or_char_ptr name, ...) {
char *Wrapper_new_localv(Wrapper *w, const String_or_char *name, ...) {
va_list ap;
char *ret;
String *decl;