Use EXIT_SUCCESS' and EXIT_FAILURE'.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@761 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
3f80052155
commit
877aa52016
11 changed files with 490 additions and 490 deletions
|
|
@ -79,7 +79,7 @@ GUILE::parse_args (int argc, char *argv[])
|
||||||
if (argv[i]) {
|
if (argv[i]) {
|
||||||
if (strcmp (argv[i], "-help") == 0) {
|
if (strcmp (argv[i], "-help") == 0) {
|
||||||
fputs (guile_usage, stderr);
|
fputs (guile_usage, stderr);
|
||||||
SWIG_exit (0);
|
SWIG_exit (EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
// Silent recognition (no side effects) of "-with-smobs" is here
|
// Silent recognition (no side effects) of "-with-smobs" is here
|
||||||
// as a convenience to users. This will be removed after 1.3a4
|
// as a convenience to users. This will be removed after 1.3a4
|
||||||
|
|
@ -236,7 +236,7 @@ GUILE::headers (void)
|
||||||
Printf (f_runtime, "/* Implementation : GUILE */\n\n");
|
Printf (f_runtime, "/* Implementation : GUILE */\n\n");
|
||||||
|
|
||||||
// Write out directives and declarations
|
// Write out directives and declarations
|
||||||
|
|
||||||
if (NoInclude) {
|
if (NoInclude) {
|
||||||
Printf(f_runtime, "#define SWIG_NOINCLUDE\n");
|
Printf(f_runtime, "#define SWIG_NOINCLUDE\n");
|
||||||
}
|
}
|
||||||
|
|
@ -382,7 +382,7 @@ is_a_pointer (SwigType *t)
|
||||||
|
|
||||||
static char *
|
static char *
|
||||||
guile_typemap_lookup(const char *op, SwigType *type, String_or_char *pname, String_or_char *source,
|
guile_typemap_lookup(const char *op, SwigType *type, String_or_char *pname, String_or_char *source,
|
||||||
String_or_char *target, Wrapper *f)
|
String_or_char *target, Wrapper *f)
|
||||||
{
|
{
|
||||||
char *tm;
|
char *tm;
|
||||||
tm = Swig_typemap_lookup((char*) op, type, pname, source, target, f);
|
tm = Swig_typemap_lookup((char*) op, type, pname, source, target, f);
|
||||||
|
|
@ -392,7 +392,7 @@ guile_typemap_lookup(const char *op, SwigType *type, String_or_char *pname, Stri
|
||||||
tm = Swig_typemap_lookup((char*) op, (char*) "int", pname, source, target, f);
|
tm = Swig_typemap_lookup((char*) op, (char*) "int", pname, source, target, f);
|
||||||
}
|
}
|
||||||
return tm;
|
return tm;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Lookup a typemap, replace all relevant parameters and write it to
|
/* Lookup a typemap, replace all relevant parameters and write it to
|
||||||
the given generalized file. Return 0 if no typemap found. */
|
the given generalized file. Return 0 if no typemap found. */
|
||||||
|
|
@ -497,7 +497,7 @@ GUILE::create_function (char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
0, proc_name, f);
|
0, proc_name, f);
|
||||||
|
|
||||||
/* Open prototype and signature */
|
/* Open prototype and signature */
|
||||||
|
|
||||||
Printv(f->def, "static SCM\n", wname," (", 0);
|
Printv(f->def, "static SCM\n", wname," (", 0);
|
||||||
Printv(signature, "(", proc_name, 0);
|
Printv(signature, "(", proc_name, 0);
|
||||||
|
|
||||||
|
|
@ -547,7 +547,7 @@ GUILE::create_function (char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
source, target, numargs, proc_name, f, 0);
|
source, target, numargs, proc_name, f, 0);
|
||||||
|
|
||||||
/* Pass output arguments back to the caller. */
|
/* Pass output arguments back to the caller. */
|
||||||
|
|
||||||
guile_do_typemap(outarg, "argout", pt, pn,
|
guile_do_typemap(outarg, "argout", pt, pn,
|
||||||
source, target, numargs, proc_name, f, 0);
|
source, target, numargs, proc_name, f, 0);
|
||||||
|
|
||||||
|
|
@ -565,7 +565,7 @@ GUILE::create_function (char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// free up any memory allocated for the arguments.
|
// free up any memory allocated for the arguments.
|
||||||
|
|
||||||
guile_do_typemap(cleanup, "freearg", pt, pn,
|
guile_do_typemap(cleanup, "freearg", pt, pn,
|
||||||
|
|
@ -573,17 +573,17 @@ GUILE::create_function (char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close prototype and signature */
|
/* Close prototype and signature */
|
||||||
|
|
||||||
Printv(signature, ")\n", 0);
|
Printv(signature, ")\n", 0);
|
||||||
Printf(f->def, ")\n{\n");
|
Printf(f->def, ")\n{\n");
|
||||||
|
|
||||||
/* Define the scheme name in C */
|
/* Define the scheme name in C */
|
||||||
/* FIXME: This is only needed for the code in exception.i since
|
/* FIXME: This is only needed for the code in exception.i since
|
||||||
typemaps can always use $name. I propose to define a new macro
|
typemaps can always use $name. I propose to define a new macro
|
||||||
SWIG_exception_in(ERROR, MESSAGE, FUNCTION) and use it instead of
|
SWIG_exception_in(ERROR, MESSAGE, FUNCTION) and use it instead of
|
||||||
SWIG_exception(ERROR, MESSAGE). */
|
SWIG_exception(ERROR, MESSAGE). */
|
||||||
Printv(f->def, "#define SCHEME_NAME \"", proc_name, "\"\n", 0);
|
Printv(f->def, "#define SCHEME_NAME \"", proc_name, "\"\n", 0);
|
||||||
|
|
||||||
// Now write code to make the function call
|
// Now write code to make the function call
|
||||||
Printv(f->code, tab4, "gh_defer_ints();\n", 0);
|
Printv(f->code, tab4, "gh_defer_ints();\n", 0);
|
||||||
emit_func_call (name, d, l, f);
|
emit_func_call (name, d, l, f);
|
||||||
|
|
@ -618,7 +618,7 @@ GUILE::create_function (char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
// Look for any remaining cleanup
|
// Look for any remaining cleanup
|
||||||
|
|
||||||
if (NewObject) {
|
if (NewObject) {
|
||||||
guile_do_typemap(f->code, "newfree", d, iname,
|
guile_do_typemap(f->code, "newfree", d, iname,
|
||||||
(char*)"result", (char*)"", 0, proc_name, f, 0);
|
(char*)"result", (char*)"", 0, proc_name, f, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -671,7 +671,7 @@ GUILE::create_function (char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
Printv(signature, "\n", 0);
|
Printv(signature, "\n", 0);
|
||||||
Printv(procdoc, "\f\n", signature, 0);
|
Printv(procdoc, "\f\n", signature, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Delete(proc_name);
|
Delete(proc_name);
|
||||||
Delete(outarg);
|
Delete(outarg);
|
||||||
Delete(cleanup);
|
Delete(cleanup);
|
||||||
|
|
@ -699,7 +699,7 @@ GUILE::link_variable (char *name, char *iname, SwigType *t)
|
||||||
char var_name[256];
|
char var_name[256];
|
||||||
char *tm;
|
char *tm;
|
||||||
Wrapper *f;
|
Wrapper *f;
|
||||||
|
|
||||||
f = NewWrapper();
|
f = NewWrapper();
|
||||||
// evaluation function names
|
// evaluation function names
|
||||||
|
|
||||||
|
|
@ -730,7 +730,7 @@ GUILE::link_variable (char *name, char *iname, SwigType *t)
|
||||||
"\"Unable to set %s. Variable is read only.\", SCM_EOL);\n",
|
"\"Unable to set %s. Variable is read only.\", SCM_EOL);\n",
|
||||||
proc_name, proc_name);
|
proc_name, proc_name);
|
||||||
}
|
}
|
||||||
else if ((tm = guile_typemap_lookup ("varin",
|
else if ((tm = guile_typemap_lookup ("varin",
|
||||||
t, name, (char*)"s_0", name, f))) {
|
t, name, (char*)"s_0", name, f))) {
|
||||||
Printf (f_wrappers, "%s\n", tm);
|
Printf (f_wrappers, "%s\n", tm);
|
||||||
}
|
}
|
||||||
|
|
@ -764,7 +764,7 @@ GUILE::link_variable (char *name, char *iname, SwigType *t)
|
||||||
// Now return the value of the variable (regardless
|
// Now return the value of the variable (regardless
|
||||||
// of evaluating or setting)
|
// of evaluating or setting)
|
||||||
|
|
||||||
if ((tm = guile_typemap_lookup ("varout",
|
if ((tm = guile_typemap_lookup ("varout",
|
||||||
t, name, name, (char*)"gswig_result", f))) {
|
t, name, name, (char*)"gswig_result", f))) {
|
||||||
Printf (f_wrappers, "%s\n", tm);
|
Printf (f_wrappers, "%s\n", tm);
|
||||||
}
|
}
|
||||||
|
|
@ -791,7 +791,7 @@ GUILE::link_variable (char *name, char *iname, SwigType *t)
|
||||||
if (procdoc) {
|
if (procdoc) {
|
||||||
/* Compute documentation */
|
/* Compute documentation */
|
||||||
String *signature = NewString("");
|
String *signature = NewString("");
|
||||||
|
|
||||||
if (Status & STAT_READONLY) {
|
if (Status & STAT_READONLY) {
|
||||||
Printv(signature, "(", proc_name, ")\n", 0);
|
Printv(signature, "(", proc_name, ")\n", 0);
|
||||||
Printv(signature, "Returns constant ", 0);
|
Printv(signature, "Returns constant ", 0);
|
||||||
|
|
@ -878,7 +878,7 @@ GUILE::declare_const (char *name, char *, SwigType *type, char *value)
|
||||||
if (SwigType_type(type) == T_STRING) {
|
if (SwigType_type(type) == T_STRING) {
|
||||||
Printf (f_header, "\"%s\";\n", value);
|
Printf (f_header, "\"%s\";\n", value);
|
||||||
} else if (SwigType_type(type) == T_CHAR) {
|
} else if (SwigType_type(type) == T_CHAR) {
|
||||||
Printf (f_header, "\'%s\';\n", value);
|
Printf (f_header, "\'%s\';\n", value);
|
||||||
} else {
|
} else {
|
||||||
Printf (f_header, "%s;\n", value);
|
Printf (f_header, "%s;\n", value);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* !!!!!!!
|
/* !!!!!!!
|
||||||
* DB 7/24/00: Is there any way to clean up the implementation of this module?
|
* DB 7/24/00: Is there any way to clean up the implementation of this module?
|
||||||
* I've tried to bring it as far as I can with core changes, but it's getting
|
* I've tried to bring it as far as I can with core changes, but it's getting
|
||||||
* to be a little rough.
|
* to be a little rough.
|
||||||
|
|
@ -85,7 +85,7 @@ char *JAVA::SwigTcToJniType(DataType *t, int ret) {
|
||||||
case T_UCHAR: return (char*)"jbyteArray";
|
case T_UCHAR: return (char*)"jbyteArray";
|
||||||
case T_SCHAR: return (char*)"jbyteArray";
|
case T_SCHAR: return (char*)"jbyteArray";
|
||||||
case T_BOOL: return (char*)"jbooleanArray";
|
case T_BOOL: return (char*)"jbooleanArray";
|
||||||
case T_VOID:
|
case T_VOID:
|
||||||
case T_USER: return (char*)"jlong";
|
case T_USER: return (char*)"jlong";
|
||||||
}
|
}
|
||||||
} else if(DataType_is_pointer(t) > 1) {
|
} else if(DataType_is_pointer(t) > 1) {
|
||||||
|
|
@ -275,7 +275,7 @@ void JAVA::writeRegisterNatives()
|
||||||
Printf(f_wrappers,"JNINativeMethod nativeMethods[] = {\n");
|
Printf(f_wrappers,"JNINativeMethod nativeMethods[] = {\n");
|
||||||
Printv(f_wrappers, registerNativesList, 0);
|
Printv(f_wrappers, registerNativesList, 0);
|
||||||
Printf(f_wrappers, "};\n");
|
Printf(f_wrappers, "};\n");
|
||||||
|
|
||||||
Printf(f_wrappers,"\nint numberOfNativeMethods=sizeof(nativeMethods)/sizeof(JNINativeMethod);\n\n");
|
Printf(f_wrappers,"\nint numberOfNativeMethods=sizeof(nativeMethods)/sizeof(JNINativeMethod);\n\n");
|
||||||
|
|
||||||
// The registerNatives function
|
// The registerNatives function
|
||||||
|
|
@ -428,7 +428,7 @@ void JAVA::headers(void)
|
||||||
// if (file::include("java.swg",f_header) == -1) {
|
// if (file::include("java.swg",f_header) == -1) {
|
||||||
if (Swig_insert_file("java.swg",f_header) == -1) {
|
if (Swig_insert_file("java.swg",f_header) == -1) {
|
||||||
Printf(stderr,"Fatal Error. Unable to locate 'java.swg'.\n");
|
Printf(stderr,"Fatal Error. Unable to locate 'java.swg'.\n");
|
||||||
SWIG_exit(1);
|
SWIG_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -439,7 +439,7 @@ void JAVA::headers(void)
|
||||||
// name has already been specified.
|
// name has already been specified.
|
||||||
// ---------------------------------------------------------------------
|
// ---------------------------------------------------------------------
|
||||||
|
|
||||||
void JAVA::initialize()
|
void JAVA::initialize()
|
||||||
{
|
{
|
||||||
if (!module) {
|
if (!module) {
|
||||||
Printf(stderr,"*** Error. No module name specified.\n");
|
Printf(stderr,"*** Error. No module name specified.\n");
|
||||||
|
|
@ -461,15 +461,15 @@ void JAVA::initialize()
|
||||||
} else {
|
} else {
|
||||||
package = c_pkgstr = jni_pkgstr = (char*)"";
|
package = c_pkgstr = jni_pkgstr = (char*)"";
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(bigbuf, "Java_%s%s", c_pkgstr, module);
|
sprintf(bigbuf, "Java_%s%s", c_pkgstr, module);
|
||||||
c_pkgstr = Swig_copy_string(bigbuf);
|
c_pkgstr = Swig_copy_string(bigbuf);
|
||||||
sprintf(bigbuf, "%s_%%f", c_pkgstr);
|
sprintf(bigbuf, "%s_%%f", c_pkgstr);
|
||||||
Swig_name_register((char*)"wrapper", Swig_copy_string(bigbuf));
|
Swig_name_register((char*)"wrapper", Swig_copy_string(bigbuf));
|
||||||
Swig_name_register((char*)"set", (char*)"set_%v");
|
Swig_name_register((char*)"set", (char*)"set_%v");
|
||||||
Swig_name_register((char*)"get", (char*)"get_%v");
|
Swig_name_register((char*)"get", (char*)"get_%v");
|
||||||
Swig_name_register((char*)"member", (char*)"%c_%m");
|
Swig_name_register((char*)"member", (char*)"%c_%m");
|
||||||
|
|
||||||
// Generate the java class
|
// Generate the java class
|
||||||
sprintf(bigbuf, "%s.java", module);
|
sprintf(bigbuf, "%s.java", module);
|
||||||
if((f_java = fopen(bigbuf, "w")) == 0) {
|
if((f_java = fopen(bigbuf, "w")) == 0) {
|
||||||
|
|
@ -551,7 +551,7 @@ void JAVA::create_function(char *name, char *iname, DataType *t, ParmList *l)
|
||||||
if(!classdef_emitted) emit_classdef();
|
if(!classdef_emitted) emit_classdef();
|
||||||
|
|
||||||
// Make a wrapper name for this function
|
// Make a wrapper name for this function
|
||||||
|
|
||||||
char *jniname = makeValidJniName(iname);
|
char *jniname = makeValidJniName(iname);
|
||||||
char *wname = Swig_name_wrapper(jniname);
|
char *wname = Swig_name_wrapper(jniname);
|
||||||
free(jniname);
|
free(jniname);
|
||||||
|
|
@ -632,7 +632,7 @@ void JAVA::create_function(char *name, char *iname, DataType *t, ParmList *l)
|
||||||
|
|
||||||
// Add to Jni function header
|
// Add to Jni function header
|
||||||
Printv(f->def, ", ", jnitype, " ", source, 0);
|
Printv(f->def, ", ", jnitype, " ", source, 0);
|
||||||
|
|
||||||
// Get typemap for this argument
|
// Get typemap for this argument
|
||||||
tm = typemap_lookup((char*)"in",typemap_lang,pt,pn,source,target,f);
|
tm = typemap_lookup((char*)"in",typemap_lang,pt,pn,source,target,f);
|
||||||
if (tm) {
|
if (tm) {
|
||||||
|
|
@ -667,7 +667,7 @@ void JAVA::create_function(char *name, char *iname, DataType *t, ParmList *l)
|
||||||
target_copy = Swig_copy_string(Wrapper_new_localv(f,target,Char(basic_jniptrtype), target, 0));
|
target_copy = Swig_copy_string(Wrapper_new_localv(f,target,Char(basic_jniptrtype), target, 0));
|
||||||
target_length = Swig_copy_string(Wrapper_new_localv(f,target,"jsize", target, "=", Char(source_length),0));
|
target_length = Swig_copy_string(Wrapper_new_localv(f,target,"jsize", target, "=", Char(source_length),0));
|
||||||
if(local_i == NULL) local_i = Swig_copy_string(Wrapper_new_local(f,"i","int i"));
|
if(local_i == NULL) local_i = Swig_copy_string(Wrapper_new_local(f,"i","int i"));
|
||||||
|
|
||||||
DOHString *scalarFunc = NewStringf("Get%sArrayElements",scalarType);
|
DOHString *scalarFunc = NewStringf("Get%sArrayElements",scalarType);
|
||||||
|
|
||||||
Printv(f->code, tab4, target_copy, " = ", JNICALL(scalarFunc), source, ", 0);\n", 0);
|
Printv(f->code, tab4, target_copy, " = ", JNICALL(scalarFunc), source, ", 0);\n", 0);
|
||||||
|
|
@ -677,7 +677,7 @@ void JAVA::create_function(char *name, char *iname, DataType *t, ParmList *l)
|
||||||
Printv(f->code, tab8, target, "[i] = *(", DataType_lstr(pt,0), ")&", target_copy, "[i];\n", 0);
|
Printv(f->code, tab8, target, "[i] = *(", DataType_lstr(pt,0), ")&", target_copy, "[i];\n", 0);
|
||||||
} else {
|
} else {
|
||||||
DataType_del_pointer(pt);
|
DataType_del_pointer(pt);
|
||||||
Printv(f->code, tab8, target, "[i] = (", DataType_lstr(pt,0), ")", target_copy, "[i];\n", 0);
|
Printv(f->code, tab8, target, "[i] = (", DataType_lstr(pt,0), ")", target_copy, "[i];\n", 0);
|
||||||
DataType_add_pointer(pt);
|
DataType_add_pointer(pt);
|
||||||
}
|
}
|
||||||
Delete(scalarFunc);
|
Delete(scalarFunc);
|
||||||
|
|
@ -728,7 +728,7 @@ void JAVA::create_function(char *name, char *iname, DataType *t, ParmList *l)
|
||||||
if(DataType_is_pointer(pt) > 1) {
|
if(DataType_is_pointer(pt) > 1) {
|
||||||
Printv(outarg, tab8, "*(", DataType_lstr(pt,0), ")&", target_copy, "[i] = ", target, "[i];\n", 0);
|
Printv(outarg, tab8, "*(", DataType_lstr(pt,0), ")&", target_copy, "[i] = ", target, "[i];\n", 0);
|
||||||
} else {
|
} else {
|
||||||
Printv(outarg, tab8, target_copy, "[i] = (", basic_jnitype, ") ", target, "[i];\n", 0);
|
Printv(outarg, tab8, target_copy, "[i] = (", basic_jnitype, ") ", target, "[i];\n", 0);
|
||||||
}
|
}
|
||||||
DOHString *scalarFunc = NewStringf("Release%sArrayElements",scalarType);
|
DOHString *scalarFunc = NewStringf("Release%sArrayElements",scalarType);
|
||||||
Printv(outarg, tab4, JNICALL(scalarFunc), source, ", ", target_copy, ", 0);\n", 0);
|
Printv(outarg, tab4, JNICALL(scalarFunc), source, ", ", target_copy, ", 0);\n", 0);
|
||||||
|
|
@ -755,7 +755,7 @@ void JAVA::create_function(char *name, char *iname, DataType *t, ParmList *l)
|
||||||
if(!native_func)
|
if(!native_func)
|
||||||
emit_func_call(name,t,l,f);
|
emit_func_call(name,t,l,f);
|
||||||
|
|
||||||
// Return value if necessary
|
// Return value if necessary
|
||||||
|
|
||||||
if((DataType_type(t) != T_VOID) && !native_func) {
|
if((DataType_type(t) != T_VOID) && !native_func) {
|
||||||
if ((tm = typemap_lookup((char*)"out",typemap_lang,t,iname,(char*)"result",(char*)"_jresult"))) {
|
if ((tm = typemap_lookup((char*)"out",typemap_lang,t,iname,(char*)"result",(char*)"_jresult"))) {
|
||||||
|
|
@ -809,18 +809,18 @@ void JAVA::create_function(char *name, char *iname, DataType *t, ParmList *l)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wrap things up (in a manner of speaking)
|
// Wrap things up (in a manner of speaking)
|
||||||
if(DataType_type(t) != T_VOID)
|
if(DataType_type(t) != T_VOID)
|
||||||
Printv(f->code, tab4, "return _jresult;\n", 0);
|
Printv(f->code, tab4, "return _jresult;\n", 0);
|
||||||
Printf(f->code, "}\n");
|
Printf(f->code, "}\n");
|
||||||
|
|
||||||
// Substitute the cleanup code (some exception handlers like to have this)
|
// Substitute the cleanup code (some exception handlers like to have this)
|
||||||
Replace(f->code,"$cleanup",cleanup, DOH_REPLACE_ANY);
|
Replace(f->code,"$cleanup",cleanup, DOH_REPLACE_ANY);
|
||||||
|
|
||||||
// Emit the function
|
// Emit the function
|
||||||
|
|
||||||
if(!native_func)
|
if(!native_func)
|
||||||
Wrapper_print(f,f_wrappers);
|
Wrapper_print(f,f_wrappers);
|
||||||
|
|
||||||
// If registerNatives is active, store the table entry for this method
|
// If registerNatives is active, store the table entry for this method
|
||||||
if (useRegisterNatives) {
|
if (useRegisterNatives) {
|
||||||
Printv(registerNativesList,
|
Printv(registerNativesList,
|
||||||
|
|
@ -828,7 +828,7 @@ void JAVA::create_function(char *name, char *iname, DataType *t, ParmList *l)
|
||||||
"\"", name, "\", \"(", javaParameterSignature, ")", javaReturnSignature, "\", ", wname,
|
"\"", name, "\", \"(", javaParameterSignature, ")", javaReturnSignature, "\", ", wname,
|
||||||
"},\n",
|
"},\n",
|
||||||
0);
|
0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Delete(cleanup);
|
Delete(cleanup);
|
||||||
|
|
@ -879,7 +879,7 @@ void JAVA::declare_const(char *name, char *iname, DataType *type, char *value) {
|
||||||
if(!jtype) jtype = SwigTcToJavaType(type, 0, 0);
|
if(!jtype) jtype = SwigTcToJavaType(type, 0, 0);
|
||||||
if(strcmp(jname, value) == 0 || strstr(value,"::") != NULL) {
|
if(strcmp(jname, value) == 0 || strstr(value,"::") != NULL) {
|
||||||
Printf(stderr, "ignoring enum constant: %s\n", jname);
|
Printf(stderr, "ignoring enum constant: %s\n", jname);
|
||||||
} else
|
} else
|
||||||
Printf(jfile, " public final static %s %s = %s;\n\n", jtype, jname, value);
|
Printf(jfile, " public final static %s %s = %s;\n\n", jtype, jname, value);
|
||||||
} else {
|
} else {
|
||||||
if(DataType_type(type) == T_STRING) {
|
if(DataType_type(type) == T_STRING) {
|
||||||
|
|
@ -947,7 +947,7 @@ void JAVA::pragma(char *lang, char *code, char *value) {
|
||||||
|
|
||||||
void JAVA::add_typedef(DataType *t, char *name) {
|
void JAVA::add_typedef(DataType *t, char *name) {
|
||||||
if(!shadow) return;
|
if(!shadow) return;
|
||||||
|
|
||||||
// First check to see if there aren't too many pointers
|
// First check to see if there aren't too many pointers
|
||||||
|
|
||||||
if (DataType_is_pointer(t) > 1) return;
|
if (DataType_is_pointer(t) > 1) return;
|
||||||
|
|
@ -1109,9 +1109,9 @@ void JAVA::cpp_member_func(char *name, char *iname, DataType *t, ParmList *l) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((DataType_Gettypecode(t) != T_VOID) && shadowrettype)
|
if((DataType_Gettypecode(t) != T_VOID) && shadowrettype)
|
||||||
Printf(nativecall, "))");
|
Printf(nativecall, "))");
|
||||||
|
|
||||||
Printf(nativecall,");\n");
|
Printf(nativecall,");\n");
|
||||||
|
|
||||||
Printf(f_shadow, ") {\n");
|
Printf(f_shadow, ") {\n");
|
||||||
|
|
@ -1187,7 +1187,7 @@ void JAVA::cpp_static_func(char *name, char *iname, DataType *t, ParmList *l) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if((DataType_type(t) != T_VOID) && shadowrettype)
|
if((DataType_type(t) != T_VOID) && shadowrettype)
|
||||||
Printf(nativecall,"))");
|
Printf(nativecall,"))");
|
||||||
|
|
||||||
Printf(nativecall,");\n");
|
Printf(nativecall,");\n");
|
||||||
|
|
@ -1314,7 +1314,7 @@ void JAVA::cpp_inherit(char **baseclass, int) {
|
||||||
|
|
||||||
if(cnt > 1)
|
if(cnt > 1)
|
||||||
Printf(stderr, "Warning: %s inherits from multiple base classes. Multiple inheritance is not supported.\n", shadow_classname);
|
Printf(stderr, "Warning: %s inherits from multiple base classes. Multiple inheritance is not supported.\n", shadow_classname);
|
||||||
|
|
||||||
shadow_baseclass = Swig_copy_string(*baseclass);
|
shadow_baseclass = Swig_copy_string(*baseclass);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ MZSCHEME::parse_args (int argc, char *argv[])
|
||||||
if (argv[i]) {
|
if (argv[i]) {
|
||||||
if (strcmp (argv[i], "-help") == 0) {
|
if (strcmp (argv[i], "-help") == 0) {
|
||||||
fputs (mzscheme_usage, stderr);
|
fputs (mzscheme_usage, stderr);
|
||||||
SWIG_exit (0);
|
SWIG_exit (EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
else if (strcmp (argv[i], "-prefix") == 0) {
|
else if (strcmp (argv[i], "-prefix") == 0) {
|
||||||
if (argv[i + 1]) {
|
if (argv[i + 1]) {
|
||||||
|
|
@ -185,7 +185,7 @@ MZSCHEME::headers (void)
|
||||||
if (Swig_insert_file ("mzscheme.swg", f_header) == -1) {
|
if (Swig_insert_file ("mzscheme.swg", f_header) == -1) {
|
||||||
Printf (stderr, "SWIG : Fatal error. ");
|
Printf (stderr, "SWIG : Fatal error. ");
|
||||||
Printf (stderr, "Unable to locate 'mzscheme.swg' in SWIG library.\n");
|
Printf (stderr, "Unable to locate 'mzscheme.swg' in SWIG library.\n");
|
||||||
SWIG_exit (1);
|
SWIG_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -734,7 +734,7 @@ MZSCHEME::usage_returns (char *iname, DataType *d, ParmList *l, DOHString *usage
|
||||||
int have_param = 0, j;
|
int have_param = 0, j;
|
||||||
|
|
||||||
param = NewString("");
|
param = NewString("");
|
||||||
|
|
||||||
Clear(usage);
|
Clear(usage);
|
||||||
Printf(usage,"returns ");
|
Printf(usage,"returns ");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* perl5.cxx
|
* perl5.cxx
|
||||||
*
|
*
|
||||||
* Generate Perl5 wrappers
|
* Generate Perl5 wrappers
|
||||||
*
|
*
|
||||||
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
|
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
|
||||||
* Loic Dachary (loic@ceic.com)
|
* Loic Dachary (loic@ceic.com)
|
||||||
* David Fletcher
|
* David Fletcher
|
||||||
* Gary Holt
|
* Gary Holt
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2000. The University of Chicago
|
* Copyright (C) 1999-2000. The University of Chicago
|
||||||
* See the file LICENSE for information on usage and redistribution.
|
* See the file LICENSE for information on usage and redistribution.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
/* DB: I had to take some features related to package naming out of this to
|
/* DB: I had to take some features related to package naming out of this to
|
||||||
|
|
@ -49,7 +49,7 @@ static int is_static = 0;
|
||||||
|
|
||||||
static int blessed = 0; /* Enable object oriented features */
|
static int blessed = 0; /* Enable object oriented features */
|
||||||
static Hash *classes = 0; /* A hash table for storing the classes we've seen so far */
|
static Hash *classes = 0; /* A hash table for storing the classes we've seen so far */
|
||||||
static Hash *symbols = 0;
|
static Hash *symbols = 0;
|
||||||
static int have_constructor = 0;
|
static int have_constructor = 0;
|
||||||
static int have_destructor= 0;
|
static int have_destructor= 0;
|
||||||
static int have_data_members = 0;
|
static int have_data_members = 0;
|
||||||
|
|
@ -151,7 +151,7 @@ PERL5::parse() {
|
||||||
|
|
||||||
classes = NewHash();
|
classes = NewHash();
|
||||||
symbols = NewHash();
|
symbols = NewHash();
|
||||||
|
|
||||||
vinit = NewString("");
|
vinit = NewString("");
|
||||||
pm = NewString("");
|
pm = NewString("");
|
||||||
func_stubs = NewString("");
|
func_stubs = NewString("");
|
||||||
|
|
@ -168,12 +168,12 @@ PERL5::parse() {
|
||||||
|
|
||||||
if (Swig_insert_file("common.swg", f_runtime) == -1) {
|
if (Swig_insert_file("common.swg", f_runtime) == -1) {
|
||||||
Printf(stderr,"SWIG : Fatal error. Unable to locate 'common.swg' in SWIG library.\n");
|
Printf(stderr,"SWIG : Fatal error. Unable to locate 'common.swg' in SWIG library.\n");
|
||||||
SWIG_exit(1);
|
SWIG_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Swig_insert_file("perl5.swg", f_runtime) == -1) {
|
if (Swig_insert_file("perl5.swg", f_runtime) == -1) {
|
||||||
Printf(stderr,"SWIG : Fatal error. Unable to locate 'perl5.swg' in SWIG library.\n");
|
Printf(stderr,"SWIG : Fatal error. Unable to locate 'perl5.swg' in SWIG library.\n");
|
||||||
SWIG_exit(1);
|
SWIG_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
yyparse();
|
yyparse();
|
||||||
}
|
}
|
||||||
|
|
@ -182,7 +182,7 @@ PERL5::parse() {
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PERL5::set_module()
|
* PERL5::set_module()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
PERL5::set_module(char *mod_name) {
|
PERL5::set_module(char *mod_name) {
|
||||||
if (import_file) {
|
if (import_file) {
|
||||||
if (!(Cmp(import_file,input_file+strlen(input_file)-Len(import_file)))) {
|
if (!(Cmp(import_file,input_file+strlen(input_file)-Len(import_file)))) {
|
||||||
|
|
@ -195,7 +195,7 @@ PERL5::set_module(char *mod_name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (module) return;
|
if (module) return;
|
||||||
|
|
||||||
module = NewString(mod_name);
|
module = NewString(mod_name);
|
||||||
|
|
||||||
/* Create a C module name and put it in 'cmodule' */
|
/* Create a C module name and put it in 'cmodule' */
|
||||||
|
|
@ -215,7 +215,7 @@ PERL5::initialize()
|
||||||
|
|
||||||
if (!module){
|
if (!module){
|
||||||
Printf(stderr,"*** Error. No module name specified.\n");
|
Printf(stderr,"*** Error. No module name specified.\n");
|
||||||
SWIG_exit(1);
|
SWIG_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!package) {
|
if (!package) {
|
||||||
|
|
@ -231,7 +231,7 @@ PERL5::initialize()
|
||||||
realpackage = NewString(package);
|
realpackage = NewString(package);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create a .pm file
|
/* Create a .pm file
|
||||||
* Need to strip off any prefixes that might be found in
|
* Need to strip off any prefixes that might be found in
|
||||||
* the module name */
|
* the module name */
|
||||||
|
|
||||||
|
|
@ -247,7 +247,7 @@ PERL5::initialize()
|
||||||
sprintf(filen,"%s%s.pm", output_dir,m);
|
sprintf(filen,"%s%s.pm", output_dir,m);
|
||||||
if ((f_pm = fopen(filen,"w")) == 0) {
|
if ((f_pm = fopen(filen,"w")) == 0) {
|
||||||
Printf(stderr,"Unable to open %s\n", filen);
|
Printf(stderr,"Unable to open %s\n", filen);
|
||||||
SWIG_exit(0);
|
SWIG_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!blessed) {
|
if (!blessed) {
|
||||||
|
|
@ -305,7 +305,7 @@ PERL5::initialize()
|
||||||
Printf(f_pm,"@ISA = qw(Exporter DynaLoader);\n");
|
Printf(f_pm,"@ISA = qw(Exporter DynaLoader);\n");
|
||||||
} else {
|
} else {
|
||||||
Printf(f_pm,"@ISA = qw(Exporter);\n");
|
Printf(f_pm,"@ISA = qw(Exporter);\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start creating magic code */
|
/* Start creating magic code */
|
||||||
|
|
||||||
|
|
@ -351,7 +351,7 @@ PERL5::close(void) {
|
||||||
0);
|
0);
|
||||||
|
|
||||||
Printf(f_header,"%s\n", magic);
|
Printf(f_header,"%s\n", magic);
|
||||||
|
|
||||||
String *type_table = NewString("");
|
String *type_table = NewString("");
|
||||||
SwigType_emit_type_table(f_runtime,type_table);
|
SwigType_emit_type_table(f_runtime,type_table);
|
||||||
|
|
||||||
|
|
@ -379,7 +379,7 @@ PERL5::close(void) {
|
||||||
Printv(vinit,tab4, "XSRETURN(1);\n", "}\n", 0);
|
Printv(vinit,tab4, "XSRETURN(1);\n", "}\n", 0);
|
||||||
Printf(f_wrappers,"%s", vinit);
|
Printf(f_wrappers,"%s", vinit);
|
||||||
|
|
||||||
Printf(f_pm,"package %s;\n", package);
|
Printf(f_pm,"package %s;\n", package);
|
||||||
|
|
||||||
if (!is_static) {
|
if (!is_static) {
|
||||||
Printf(f_pm,"bootstrap %s;\n", realpackage);
|
Printf(f_pm,"bootstrap %s;\n", realpackage);
|
||||||
|
|
@ -410,7 +410,7 @@ PERL5::close(void) {
|
||||||
"}\n\n",
|
"}\n\n",
|
||||||
0);
|
0);
|
||||||
|
|
||||||
/* Output a CLEAR method. This is just a place-holder, but by providing it we
|
/* Output a CLEAR method. This is just a place-holder, but by providing it we
|
||||||
* can make declarations such as
|
* can make declarations such as
|
||||||
* %$u = ( x => 2, y=>3, z =>4 );
|
* %$u = ( x => 2, y=>3, z =>4 );
|
||||||
*
|
*
|
||||||
|
|
@ -468,9 +468,9 @@ get_pointer(char *iname, char *srcname, char *src, char *dest,
|
||||||
|
|
||||||
/* If we're passing a void pointer, we give the pointer conversion a NULL
|
/* If we're passing a void pointer, we give the pointer conversion a NULL
|
||||||
pointer, otherwise pass in the expected type. */
|
pointer, otherwise pass in the expected type. */
|
||||||
|
|
||||||
if (SwigType_type(t) == T_VOID) Printf(f, " 0 ) < 0) {\n");
|
if (SwigType_type(t) == T_VOID) Printf(f, " 0 ) < 0) {\n");
|
||||||
else
|
else
|
||||||
Printv(f, "SWIGTYPE", SwigType_manglestr(t), ") < 0) {\n",0);
|
Printv(f, "SWIGTYPE", SwigType_manglestr(t), ") < 0) {\n",0);
|
||||||
|
|
||||||
Printv(f,
|
Printv(f,
|
||||||
|
|
@ -492,7 +492,7 @@ PERL5::create_command(char *cname, char *iname) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PERL5::create_function()
|
* PERL5::create_function()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
|
|
@ -505,7 +505,7 @@ PERL5::create_function(char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
char *tm;
|
char *tm;
|
||||||
String *cleanup, *outarg;
|
String *cleanup, *outarg;
|
||||||
int numopt = 0;
|
int numopt = 0;
|
||||||
int need_save, num_saved = 0;
|
int need_save, num_saved = 0;
|
||||||
|
|
||||||
f = NewWrapper();
|
f = NewWrapper();
|
||||||
cleanup = NewString("");
|
cleanup = NewString("");
|
||||||
|
|
@ -560,18 +560,18 @@ PERL5::create_function(char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
Printf(f->code," %s = (%s)SvIV(ST(%d));\n", target, SwigType_lstr(pt,0),j);
|
Printf(f->code," %s = (%s)SvIV(ST(%d));\n", target, SwigType_lstr(pt,0),j);
|
||||||
break;
|
break;
|
||||||
case T_CHAR :
|
case T_CHAR :
|
||||||
|
|
||||||
Printf(f->code," %s = (char) *SvPV(ST(%d),PL_na);\n", target, j);
|
Printf(f->code," %s = (char) *SvPV(ST(%d),PL_na);\n", target, j);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_DOUBLE :
|
case T_DOUBLE :
|
||||||
case T_FLOAT :
|
case T_FLOAT :
|
||||||
Printf(f->code," %s = (%s)SvNV(ST(%d));\n", target, SwigType_lstr(pt,0), j);
|
Printf(f->code," %s = (%s)SvNV(ST(%d));\n", target, SwigType_lstr(pt,0), j);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_VOID :
|
case T_VOID :
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_USER:
|
case T_USER:
|
||||||
SwigType_add_pointer(pt);
|
SwigType_add_pointer(pt);
|
||||||
sprintf(temp,"argument %d", i+1);
|
sprintf(temp,"argument %d", i+1);
|
||||||
|
|
@ -595,7 +595,7 @@ PERL5::create_function(char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* The source is going to be an array of saved values. */
|
/* The source is going to be an array of saved values. */
|
||||||
sprintf(temp,"_saved[%d]",num_saved);
|
sprintf(temp,"_saved[%d]",num_saved);
|
||||||
if (j>= (pcount-numopt))
|
if (j>= (pcount-numopt))
|
||||||
Printf(f->code," } \n");
|
Printf(f->code," } \n");
|
||||||
j++;
|
j++;
|
||||||
|
|
@ -624,7 +624,7 @@ PERL5::create_function(char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
Delete(tempstr);
|
Delete(tempstr);
|
||||||
need_save = 1;
|
need_save = 1;
|
||||||
}
|
}
|
||||||
/* If we need a saved variable, we need to emit to emit some code for that
|
/* If we need a saved variable, we need to emit to emit some code for that
|
||||||
This only applies if the argument actually existed (not ignore) */
|
This only applies if the argument actually existed (not ignore) */
|
||||||
if ((need_save) && (!Getignore(p))) {
|
if ((need_save) && (!Getignore(p))) {
|
||||||
Printv(f->code, tab4, temp, " = ", source, ";\n", 0);
|
Printv(f->code, tab4, temp, " = ", source, ";\n", 0);
|
||||||
|
|
@ -667,7 +667,7 @@ PERL5::create_function(char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
tab4, "sv_setpv((SV*)ST(argvi++),ctemp);\n",
|
tab4, "sv_setpv((SV*)ST(argvi++),ctemp);\n",
|
||||||
0);
|
0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_USER:
|
case T_USER:
|
||||||
SwigType_add_pointer(d);
|
SwigType_add_pointer(d);
|
||||||
SwigType_remember(d);
|
SwigType_remember(d);
|
||||||
|
|
@ -675,7 +675,7 @@ PERL5::create_function(char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
tab4, "SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE", SwigType_manglestr(d),");\n", 0);
|
tab4, "SWIG_MakePtr(ST(argvi++), (void *) result, SWIGTYPE", SwigType_manglestr(d),");\n", 0);
|
||||||
SwigType_del_pointer(d);
|
SwigType_del_pointer(d);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_STRING:
|
case T_STRING:
|
||||||
Printf(f->code," sv_setpv((SV*)ST(argvi++),(char *) result);\n");
|
Printf(f->code," sv_setpv((SV*)ST(argvi++),(char *) result);\n");
|
||||||
break;
|
break;
|
||||||
|
|
@ -693,7 +693,7 @@ PERL5::create_function(char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If there were any output args, take care of them. */
|
/* If there were any output args, take care of them. */
|
||||||
|
|
||||||
Printv(f->code,outarg,0);
|
Printv(f->code,outarg,0);
|
||||||
|
|
||||||
/* If there was any cleanup, do that. */
|
/* If there was any cleanup, do that. */
|
||||||
|
|
@ -737,7 +737,7 @@ PERL5::create_function(char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
* Create a stub for this function, provided it's not a member function
|
* Create a stub for this function, provided it's not a member function
|
||||||
*
|
*
|
||||||
* Really we only need to create a stub if this function involves
|
* Really we only need to create a stub if this function involves
|
||||||
* complex datatypes. If it does, we'll make a small wrapper to
|
* complex datatypes. If it does, we'll make a small wrapper to
|
||||||
* process the arguments. If it doesn't, we'll just make a symbol
|
* process the arguments. If it doesn't, we'll just make a symbol
|
||||||
* table entry.
|
* table entry.
|
||||||
* -------------------------------------------------------------------- */
|
* -------------------------------------------------------------------- */
|
||||||
|
|
@ -745,7 +745,7 @@ PERL5::create_function(char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
if ((blessed) && (!member_func)) {
|
if ((blessed) && (!member_func)) {
|
||||||
int need_stub = 0;
|
int need_stub = 0;
|
||||||
String *func = NewString("");
|
String *func = NewString("");
|
||||||
|
|
||||||
/* We'll make a stub since we may need it anyways */
|
/* We'll make a stub since we may need it anyways */
|
||||||
|
|
||||||
Printv(func, "sub ", iname, " {\n",
|
Printv(func, "sub ", iname, " {\n",
|
||||||
|
|
@ -786,7 +786,7 @@ PERL5::create_function(char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
Printv(func, tab4, "my $result = ", package, "::", iname, "(@args);\n", 0);
|
Printv(func, tab4, "my $result = ", package, "::", iname, "(@args);\n", 0);
|
||||||
|
|
||||||
/* Now check to see what kind of return result was found.
|
/* Now check to see what kind of return result was found.
|
||||||
* If this function is returning a result by 'value', SWIG did an
|
* If this function is returning a result by 'value', SWIG did an
|
||||||
* implicit malloc/new. We'll mark the object like it was created
|
* implicit malloc/new. We'll mark the object like it was created
|
||||||
* in Perl so we can garbage collect it. */
|
* in Perl so we can garbage collect it. */
|
||||||
|
|
||||||
|
|
@ -838,7 +838,7 @@ PERL5::create_function(char *name, char *iname, SwigType *d, ParmList *l)
|
||||||
DelWrapper(f);
|
DelWrapper(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PERL5::link_variable()
|
* PERL5::link_variable()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
@ -889,9 +889,9 @@ void PERL5::link_variable(char *name, char *iname, SwigType *t)
|
||||||
case T_CHAR :
|
case T_CHAR :
|
||||||
Printv(setf->code, tab4, name, " = (char) *SvPV(sv,PL_na);\n", 0);
|
Printv(setf->code, tab4, name, " = (char) *SvPV(sv,PL_na);\n", 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_USER:
|
case T_USER:
|
||||||
|
|
||||||
SwigType_add_pointer(t);
|
SwigType_add_pointer(t);
|
||||||
Wrapper_add_local(setf,"_temp", "void *_temp");
|
Wrapper_add_local(setf,"_temp", "void *_temp");
|
||||||
get_pointer(iname,(char*)"value",(char*)"sv",(char*)"_temp", t, setf->code, (char*)"return(1)");
|
get_pointer(iname,(char*)"value",(char*)"sv",(char*)"_temp", t, setf->code, (char*)"return(1)");
|
||||||
|
|
@ -902,7 +902,7 @@ void PERL5::link_variable(char *name, char *iname, SwigType *t)
|
||||||
case T_STRING:
|
case T_STRING:
|
||||||
Wrapper_add_local(setf,"_a","char *_a");
|
Wrapper_add_local(setf,"_a","char *_a");
|
||||||
Printf(setf->code," _a = (char *) SvPV(sv,PL_na);\n");
|
Printf(setf->code," _a = (char *) SvPV(sv,PL_na);\n");
|
||||||
|
|
||||||
if (CPlusPlus)
|
if (CPlusPlus)
|
||||||
Printv(setf->code,
|
Printv(setf->code,
|
||||||
tab4, "if (", name, ") delete [] ", name, ";\n",
|
tab4, "if (", name, ") delete [] ", name, ";\n",
|
||||||
|
|
@ -951,11 +951,11 @@ void PERL5::link_variable(char *name, char *iname, SwigType *t)
|
||||||
Printf(setf->code," return 1;\n}\n");
|
Printf(setf->code," return 1;\n}\n");
|
||||||
Replace(setf->code,"$name",iname, DOH_REPLACE_ANY);
|
Replace(setf->code,"$name",iname, DOH_REPLACE_ANY);
|
||||||
Wrapper_print(setf,magic);
|
Wrapper_print(setf,magic);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now write a function to evaluate the variable */
|
/* Now write a function to evaluate the variable */
|
||||||
|
|
||||||
Printf(getf->def,"SWIGCLASS_STATIC int %s(SV *sv, MAGIC *mg) {\n", val_name);
|
Printf(getf->def,"SWIGCLASS_STATIC int %s(SV *sv, MAGIC *mg) {\n", val_name);
|
||||||
Printv(getf->code,
|
Printv(getf->code,
|
||||||
tab4, "MAGIC_PPERL\n",
|
tab4, "MAGIC_PPERL\n",
|
||||||
|
|
@ -968,7 +968,7 @@ void PERL5::link_variable(char *name, char *iname, SwigType *t)
|
||||||
Printf(getf->code,"%s\n", tm);
|
Printf(getf->code,"%s\n", tm);
|
||||||
} else {
|
} else {
|
||||||
switch(SwigType_type(t)) {
|
switch(SwigType_type(t)) {
|
||||||
|
|
||||||
case T_INT : case T_BOOL: case T_UINT:
|
case T_INT : case T_BOOL: case T_UINT:
|
||||||
case T_SHORT : case T_USHORT:
|
case T_SHORT : case T_USHORT:
|
||||||
case T_LONG : case T_ULONG:
|
case T_LONG : case T_ULONG:
|
||||||
|
|
@ -995,11 +995,11 @@ void PERL5::link_variable(char *name, char *iname, SwigType *t)
|
||||||
tab4, "rsv = SvRV(sv);\n",
|
tab4, "rsv = SvRV(sv);\n",
|
||||||
tab4, "sv_setiv(rsv,(IV) &", name, ");\n",
|
tab4, "sv_setiv(rsv,(IV) &", name, ");\n",
|
||||||
0);
|
0);
|
||||||
|
|
||||||
Wrapper_add_local(getf,"rsv","SV *rsv");
|
Wrapper_add_local(getf,"rsv","SV *rsv");
|
||||||
Printv(vinit, tab4, "SWIG_MakePtr(sv, (void *) &", name, ",SWIGTYPE", SwigType_manglestr(t), ");\n",0);
|
Printv(vinit, tab4, "SWIG_MakePtr(sv, (void *) &", name, ",SWIGTYPE", SwigType_manglestr(t), ");\n",0);
|
||||||
SwigType_del_pointer(t);
|
SwigType_del_pointer(t);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_STRING:
|
case T_STRING:
|
||||||
|
|
@ -1016,7 +1016,7 @@ void PERL5::link_variable(char *name, char *iname, SwigType *t)
|
||||||
Delete(ta);
|
Delete(ta);
|
||||||
Delete(aop);
|
Delete(aop);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Delete(ta);
|
Delete(ta);
|
||||||
Delete(aop);
|
Delete(aop);
|
||||||
}
|
}
|
||||||
|
|
@ -1026,7 +1026,7 @@ void PERL5::link_variable(char *name, char *iname, SwigType *t)
|
||||||
tab4, "rsv = SvRV(sv);\n",
|
tab4, "rsv = SvRV(sv);\n",
|
||||||
tab4, "sv_setiv(rsv,(IV) ", name, ");\n",
|
tab4, "sv_setiv(rsv,(IV) ", name, ");\n",
|
||||||
0);
|
0);
|
||||||
|
|
||||||
Wrapper_add_local(getf,"rsv","SV *rsv");
|
Wrapper_add_local(getf,"rsv","SV *rsv");
|
||||||
Printv(vinit, tab4, "SWIG_MakePtr(sv,(void *) 1, SWIGTYPE", SwigType_manglestr(t), ");\n",0);
|
Printv(vinit, tab4, "SWIG_MakePtr(sv,(void *) 1, SWIGTYPE", SwigType_manglestr(t), ");\n",0);
|
||||||
break;
|
break;
|
||||||
|
|
@ -1039,19 +1039,19 @@ void PERL5::link_variable(char *name, char *iname, SwigType *t)
|
||||||
|
|
||||||
Replace(getf->code,"$name",iname, DOH_REPLACE_ANY);
|
Replace(getf->code,"$name",iname, DOH_REPLACE_ANY);
|
||||||
Wrapper_print(getf,magic);
|
Wrapper_print(getf,magic);
|
||||||
|
|
||||||
/* Now add symbol to the PERL interpreter */
|
/* Now add symbol to the PERL interpreter */
|
||||||
if ((Status & STAT_READONLY) || (!setable)) {
|
if ((Status & STAT_READONLY) || (!setable)) {
|
||||||
Printv(vinit, tab4, "swig_create_magic(sv,\"", package, "::", iname, "\",MAGIC_CAST MAGIC_CLASS swig_magic_readonly, MAGIC_CAST MAGIC_CLASS ", val_name, ");\n",0);
|
Printv(vinit, tab4, "swig_create_magic(sv,\"", package, "::", iname, "\",MAGIC_CAST MAGIC_CLASS swig_magic_readonly, MAGIC_CAST MAGIC_CLASS ", val_name, ");\n",0);
|
||||||
} else {
|
} else {
|
||||||
Printv(vinit, tab4, "swig_create_magic(sv,\"", package, "::", iname, "\", MAGIC_CAST MAGIC_CLASS ", set_name, ", MAGIC_CAST MAGIC_CLASS ", val_name, ");\n",0);
|
Printv(vinit, tab4, "swig_create_magic(sv,\"", package, "::", iname, "\", MAGIC_CAST MAGIC_CLASS ", set_name, ", MAGIC_CAST MAGIC_CLASS ", val_name, ");\n",0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're blessed, try to figure out what to do with the variable
|
/* If we're blessed, try to figure out what to do with the variable
|
||||||
1. If it's a Perl object of some sort, create a tied-hash
|
1. If it's a Perl object of some sort, create a tied-hash
|
||||||
around it.
|
around it.
|
||||||
2. Otherwise, just hack Perl's symbol table */
|
2. Otherwise, just hack Perl's symbol table */
|
||||||
|
|
||||||
if (blessed) {
|
if (blessed) {
|
||||||
if (is_shadow(t)) {
|
if (is_shadow(t)) {
|
||||||
Printv(var_stubs,
|
Printv(var_stubs,
|
||||||
|
|
@ -1182,7 +1182,7 @@ PERL5::declare_const(char *name, char *, SwigType *type, char *value)
|
||||||
Printf(f_header,"%s\n",setrv);
|
Printf(f_header,"%s\n",setrv);
|
||||||
have_ref_func = 1;
|
have_ref_func = 1;
|
||||||
}
|
}
|
||||||
Printv(vinit, tab4, "swig_setrv(\"", package, "::", name, "\", (void *) ", value, ", \"",
|
Printv(vinit, tab4, "swig_setrv(\"", package, "::", name, "\", (void *) ", value, ", \"",
|
||||||
SwigType_manglestr(type), "\");\n", 0);
|
SwigType_manglestr(type), "\");\n", 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -1210,7 +1210,7 @@ PERL5::declare_const(char *name, char *, SwigType *type, char *value)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PERL5::usage_func()
|
* PERL5::usage_func()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
char *
|
char *
|
||||||
PERL5::usage_func(char *iname, SwigType *, ParmList *l) {
|
PERL5::usage_func(char *iname, SwigType *, ParmList *l) {
|
||||||
|
|
@ -1221,7 +1221,7 @@ PERL5::usage_func(char *iname, SwigType *, ParmList *l) {
|
||||||
if (!temp) temp = NewString("");
|
if (!temp) temp = NewString("");
|
||||||
Clear(temp);
|
Clear(temp);
|
||||||
Printf(temp,"%s(",iname);
|
Printf(temp,"%s(",iname);
|
||||||
|
|
||||||
/* Now go through and print parameters */
|
/* Now go through and print parameters */
|
||||||
p = l;
|
p = l;
|
||||||
i = 0;
|
i = 0;
|
||||||
|
|
@ -1244,7 +1244,7 @@ PERL5::usage_func(char *iname, SwigType *, ParmList *l) {
|
||||||
Putc(',',temp);
|
Putc(',',temp);
|
||||||
} else {
|
} else {
|
||||||
p = Getnext(p);
|
p = Getnext(p);
|
||||||
if (p)
|
if (p)
|
||||||
if ((i>0) && (!Getignore(p)))
|
if ((i>0) && (!Getignore(p)))
|
||||||
Putc(',',temp);
|
Putc(',',temp);
|
||||||
}
|
}
|
||||||
|
|
@ -1267,22 +1267,22 @@ PERL5::add_native(char *name, char *funcname, SwigType *, ParmList *) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*** OBJECT-ORIENTED FEATURES
|
*** OBJECT-ORIENTED FEATURES
|
||||||
****************************************************************************
|
****************************************************************************
|
||||||
*** These extensions provide a more object-oriented interface to C++
|
*** These extensions provide a more object-oriented interface to C++
|
||||||
*** classes and structures. The code here is based on extensions
|
*** classes and structures. The code here is based on extensions
|
||||||
*** provided by David Fletcher and Gary Holt.
|
*** provided by David Fletcher and Gary Holt.
|
||||||
***
|
|
||||||
*** I have generalized these extensions to make them more general purpose
|
|
||||||
*** and to resolve object-ownership problems.
|
|
||||||
***
|
***
|
||||||
*** The approach here is very similar to the Python module :
|
*** I have generalized these extensions to make them more general purpose
|
||||||
*** 1. All of the original methods are placed into a single
|
*** and to resolve object-ownership problems.
|
||||||
*** package like before except that a 'c' is appended to the
|
|
||||||
*** package name.
|
|
||||||
***
|
***
|
||||||
*** 2. All methods and function calls are wrapped with a new
|
*** The approach here is very similar to the Python module :
|
||||||
*** perl function. While possibly inefficient this allows
|
*** 1. All of the original methods are placed into a single
|
||||||
|
*** package like before except that a 'c' is appended to the
|
||||||
|
*** package name.
|
||||||
|
***
|
||||||
|
*** 2. All methods and function calls are wrapped with a new
|
||||||
|
*** perl function. While possibly inefficient this allows
|
||||||
*** us to catch complex function arguments (which are hard to
|
*** us to catch complex function arguments (which are hard to
|
||||||
*** track otherwise).
|
*** track otherwise).
|
||||||
***
|
***
|
||||||
|
|
@ -1299,7 +1299,7 @@ PERL5::add_native(char *name, char *funcname, SwigType *, ParmList *) {
|
||||||
***
|
***
|
||||||
*** 6. Object ownership is maintained by having a hash table
|
*** 6. Object ownership is maintained by having a hash table
|
||||||
*** within in each package called "this". It is unlikely
|
*** within in each package called "this". It is unlikely
|
||||||
*** that C++ program will use this so it's a somewhat
|
*** that C++ program will use this so it's a somewhat
|
||||||
*** safe variable name.
|
*** safe variable name.
|
||||||
***
|
***
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
@ -1321,7 +1321,7 @@ PERL5::cpp_open_class(char *classname, char *rname, char *ctype, int strip) {
|
||||||
Delete(real_classname); real_classname = 0;
|
Delete(real_classname); real_classname = 0;
|
||||||
Delete(base_class); base_class = 0;
|
Delete(base_class); base_class = 0;
|
||||||
Delete(fullclassname); fullclassname = 0;
|
Delete(fullclassname); fullclassname = 0;
|
||||||
|
|
||||||
/* If the class is being renamed to something else, use the renaming */
|
/* If the class is being renamed to something else, use the renaming */
|
||||||
if (rname) {
|
if (rname) {
|
||||||
class_name = NewString(rname);
|
class_name = NewString(rname);
|
||||||
|
|
@ -1366,7 +1366,7 @@ PERL5::cpp_close_class() {
|
||||||
|
|
||||||
if (Cmp(class_name,realpackage))
|
if (Cmp(class_name,realpackage))
|
||||||
Printv(pm, "@ISA = qw( ",realpackage, 0);
|
Printv(pm, "@ISA = qw( ",realpackage, 0);
|
||||||
else
|
else
|
||||||
Printv(pm, "@ISA = qw( ", 0);
|
Printv(pm, "@ISA = qw( ", 0);
|
||||||
|
|
||||||
if (base_class) {
|
if (base_class) {
|
||||||
|
|
@ -1378,7 +1378,7 @@ PERL5::cpp_close_class() {
|
||||||
|
|
||||||
Printf(pm, "%%OWNER = ();\n");
|
Printf(pm, "%%OWNER = ();\n");
|
||||||
if (have_data_members) {
|
if (have_data_members) {
|
||||||
Printv(pm,
|
Printv(pm,
|
||||||
"%BLESSEDMEMBERS = (\n", blessedmembers, ");\n\n",
|
"%BLESSEDMEMBERS = (\n", blessedmembers, ");\n\n",
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
|
|
@ -1425,7 +1425,7 @@ PERL5::cpp_close_class() {
|
||||||
tab4, "return $val;\n",
|
tab4, "return $val;\n",
|
||||||
"}\n\n",
|
"}\n\n",
|
||||||
0);
|
0);
|
||||||
|
|
||||||
/* Output a STORE method. This is also common to all classes (might move to base class) */
|
/* Output a STORE method. This is also common to all classes (might move to base class) */
|
||||||
|
|
||||||
Printv(pm,
|
Printv(pm,
|
||||||
|
|
@ -1534,16 +1534,16 @@ PERL5::cpp_member_func(char *name, char *iname, SwigType *t, ParmList *l) {
|
||||||
}
|
}
|
||||||
p = Getnext(p);
|
p = Getnext(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Okay. We've made argument adjustments, now call into the package */
|
/* Okay. We've made argument adjustments, now call into the package */
|
||||||
|
|
||||||
Printv(func,
|
Printv(func,
|
||||||
tab4, "my $result = ", package, "::", Swig_name_member(class_name,realname),
|
tab4, "my $result = ", package, "::", Swig_name_member(class_name,realname),
|
||||||
"(@args);\n",
|
"(@args);\n",
|
||||||
0);
|
0);
|
||||||
|
|
||||||
/* Now check to see what kind of return result was found.
|
/* Now check to see what kind of return result was found.
|
||||||
* If this function is returning a result by 'value', SWIG did an
|
* If this function is returning a result by 'value', SWIG did an
|
||||||
* implicit malloc/new. We'll mark the object like it was created
|
* implicit malloc/new. We'll mark the object like it was created
|
||||||
* in Perl so we can garbage collect it. */
|
* in Perl so we can garbage collect it. */
|
||||||
|
|
||||||
|
|
@ -1556,7 +1556,7 @@ PERL5::cpp_member_func(char *name, char *iname, SwigType *t, ParmList *l) {
|
||||||
need_wrapper = 1;
|
need_wrapper = 1;
|
||||||
|
|
||||||
} else if (is_shadow(t)) {
|
} else if (is_shadow(t)) {
|
||||||
|
|
||||||
Printv(func,tab4, "return undef if (!defined($result));\n", 0);
|
Printv(func,tab4, "return undef if (!defined($result));\n", 0);
|
||||||
|
|
||||||
/* If we're returning an object by value, put it's reference
|
/* If we're returning an object by value, put it's reference
|
||||||
|
|
@ -1579,7 +1579,7 @@ PERL5::cpp_member_func(char *name, char *iname, SwigType *t, ParmList *l) {
|
||||||
need_wrapper = 1;
|
need_wrapper = 1;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* Hmmm. This doesn't appear to be anything I know about so just
|
/* Hmmm. This doesn't appear to be anything I know about so just
|
||||||
return it unmodified */
|
return it unmodified */
|
||||||
|
|
||||||
Printv(func, tab4,"return $result;\n", "}\n", 0);
|
Printv(func, tab4,"return $result;\n", "}\n", 0);
|
||||||
|
|
@ -1621,7 +1621,7 @@ void PERL5::cpp_variable(char *name, char *iname, SwigType *t) {
|
||||||
/* Emit a pair of get/set functions for the variable */
|
/* Emit a pair of get/set functions for the variable */
|
||||||
|
|
||||||
member_func = 1;
|
member_func = 1;
|
||||||
this->Language::cpp_variable(name, iname, t);
|
this->Language::cpp_variable(name, iname, t);
|
||||||
member_func = 0;
|
member_func = 0;
|
||||||
|
|
||||||
if (iname) realname = iname;
|
if (iname) realname = iname;
|
||||||
|
|
@ -1631,10 +1631,10 @@ void PERL5::cpp_variable(char *name, char *iname, SwigType *t) {
|
||||||
Printf(cname,"%s::%s", class_name, realname);
|
Printf(cname,"%s::%s", class_name, realname);
|
||||||
if (Getattr(symbols,cname)) {
|
if (Getattr(symbols,cname)) {
|
||||||
Delete(cname);
|
Delete(cname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Setattr(symbols,cname,cname);
|
Setattr(symbols,cname,cname);
|
||||||
|
|
||||||
/* Store name of key for future reference */
|
/* Store name of key for future reference */
|
||||||
Printf(member_keys,"'%s', ", realname);
|
Printf(member_keys,"'%s', ", realname);
|
||||||
|
|
||||||
|
|
@ -1642,12 +1642,12 @@ void PERL5::cpp_variable(char *name, char *iname, SwigType *t) {
|
||||||
|
|
||||||
if (is_shadow(t)) {
|
if (is_shadow(t)) {
|
||||||
|
|
||||||
/* This is a Perl object that we have already seen. Add an
|
/* This is a Perl object that we have already seen. Add an
|
||||||
entry to the members list*/
|
entry to the members list*/
|
||||||
Printv(blessedmembers,
|
Printv(blessedmembers,
|
||||||
tab4, realname, " => '", is_shadow(t), "',\n",
|
tab4, realname, " => '", is_shadow(t), "',\n",
|
||||||
0);
|
0);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
have_data_members++;
|
have_data_members++;
|
||||||
|
|
@ -1659,7 +1659,7 @@ void PERL5::cpp_variable(char *name, char *iname, SwigType *t) {
|
||||||
*
|
*
|
||||||
* Emits a blessed constructor for our class. In addition to our construct
|
* Emits a blessed constructor for our class. In addition to our construct
|
||||||
* we manage a Perl hash table containing all of the pointers created by
|
* we manage a Perl hash table containing all of the pointers created by
|
||||||
* the constructor. This prevents us from accidentally trying to free
|
* the constructor. This prevents us from accidentally trying to free
|
||||||
* something that wasn't necessarily allocated by malloc or new
|
* something that wasn't necessarily allocated by malloc or new
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
|
|
@ -1678,7 +1678,7 @@ PERL5::cpp_constructor(char *name, char *iname, ParmList *l) {
|
||||||
|
|
||||||
if (blessed) {
|
if (blessed) {
|
||||||
|
|
||||||
if (iname)
|
if (iname)
|
||||||
realname = iname;
|
realname = iname;
|
||||||
else {
|
else {
|
||||||
if (class_renamed) realname = class_name;
|
if (class_renamed) realname = class_name;
|
||||||
|
|
@ -1692,17 +1692,17 @@ PERL5::cpp_constructor(char *name, char *iname, ParmList *l) {
|
||||||
}
|
}
|
||||||
Setattr(symbols,cname, cname);
|
Setattr(symbols,cname, cname);
|
||||||
if ((Cmp(realname,class_name) == 0) || ((!iname) && (ObjCClass)) ){
|
if ((Cmp(realname,class_name) == 0) || ((!iname) && (ObjCClass)) ){
|
||||||
|
|
||||||
/* Emit a blessed constructor */
|
/* Emit a blessed constructor */
|
||||||
|
|
||||||
Printf(pcode, "sub new {\n");
|
Printf(pcode, "sub new {\n");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
/* Constructor doesn't match classname so we'll just use the normal name */
|
/* Constructor doesn't match classname so we'll just use the normal name */
|
||||||
|
|
||||||
Printv(pcode, "sub ", Swig_name_construct(realname), " () {\n", 0);
|
Printv(pcode, "sub ", Swig_name_construct(realname), " () {\n", 0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Printv(pcode, tab4, "my $self = shift;\n",
|
Printv(pcode, tab4, "my $self = shift;\n",
|
||||||
|
|
@ -1712,12 +1712,12 @@ PERL5::cpp_constructor(char *name, char *iname, ParmList *l) {
|
||||||
* Now we have to go through and patch up the argument list. If any
|
* Now we have to go through and patch up the argument list. If any
|
||||||
* arguments to our function correspond to other Perl objects, we
|
* arguments to our function correspond to other Perl objects, we
|
||||||
* need to extract them from a tied-hash table object. */
|
* need to extract them from a tied-hash table object. */
|
||||||
|
|
||||||
p = l;
|
p = l;
|
||||||
i = 0;
|
i = 0;
|
||||||
while(p) {
|
while(p) {
|
||||||
SwigType *pt = Gettype(p);
|
SwigType *pt = Gettype(p);
|
||||||
|
|
||||||
if (is_shadow(pt)) {
|
if (is_shadow(pt)) {
|
||||||
/* Yep. This smells alot like an object, patch up the arguments */
|
/* Yep. This smells alot like an object, patch up the arguments */
|
||||||
Printf(pcode, " $args[%d] = tied(%%{$args[%d]});\n", i, i);
|
Printf(pcode, " $args[%d] = tied(%%{$args[%d]});\n", i, i);
|
||||||
|
|
@ -1725,7 +1725,7 @@ PERL5::cpp_constructor(char *name, char *iname, ParmList *l) {
|
||||||
p = Getnext(p);
|
p = Getnext(p);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
Printv(pcode,
|
Printv(pcode,
|
||||||
tab4, "$self = ", package, "::", Swig_name_construct(realname), "(@args);\n",
|
tab4, "$self = ", package, "::", Swig_name_construct(realname), "(@args);\n",
|
||||||
tab4, "return undef if (!defined($self));\n",
|
tab4, "return undef if (!defined($self));\n",
|
||||||
|
|
@ -1747,7 +1747,7 @@ PERL5::cpp_constructor(char *name, char *iname, ParmList *l) {
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PERL5::cpp_destructor()
|
* PERL5::cpp_destructor()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
PERL5::cpp_destructor(char *name, char *newname) {
|
PERL5::cpp_destructor(char *name, char *newname) {
|
||||||
String *realname;
|
String *realname;
|
||||||
member_func = 1;
|
member_func = 1;
|
||||||
|
|
@ -1764,7 +1764,7 @@ PERL5::cpp_destructor(char *name, char *newname) {
|
||||||
|
|
||||||
Printv(pcode,
|
Printv(pcode,
|
||||||
"sub DESTROY {\n",
|
"sub DESTROY {\n",
|
||||||
tab4, "return unless $_[0]->isa('HASH');\n",
|
tab4, "return unless $_[0]->isa('HASH');\n",
|
||||||
tab4, "my $self = tied(%{$_[0]});\n",
|
tab4, "my $self = tied(%{$_[0]});\n",
|
||||||
tab4, "delete $ITERATORS{$self};\n",
|
tab4, "delete $ITERATORS{$self};\n",
|
||||||
tab4, "if (exists $OWNER{$self}) {\n",
|
tab4, "if (exists $OWNER{$self}) {\n",
|
||||||
|
|
@ -1772,9 +1772,9 @@ PERL5::cpp_destructor(char *name, char *newname) {
|
||||||
tab8, "delete $OWNER{$self};\n",
|
tab8, "delete $OWNER{$self};\n",
|
||||||
tab4, "}\n}\n\n",
|
tab4, "}\n}\n\n",
|
||||||
0);
|
0);
|
||||||
|
|
||||||
have_destructor = 1;
|
have_destructor = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
member_func = 0;
|
member_func = 0;
|
||||||
}
|
}
|
||||||
|
|
@ -1782,7 +1782,7 @@ PERL5::cpp_destructor(char *name, char *newname) {
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PERL5::cpp_static_func()
|
* PERL5::cpp_static_func()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
PERL5::cpp_static_func(char *name, char *iname, SwigType *t, ParmList *l) {
|
PERL5::cpp_static_func(char *name, char *iname, SwigType *t, ParmList *l) {
|
||||||
this->Language::cpp_static_func(name,iname,t,l);
|
this->Language::cpp_static_func(name,iname,t,l);
|
||||||
char *realname;
|
char *realname;
|
||||||
|
|
@ -1793,11 +1793,11 @@ PERL5::cpp_static_func(char *name, char *iname, SwigType *t, ParmList *l) {
|
||||||
Printv(pcode, "*", realname, " = *", realpackage, "::", Swig_name_member(class_name,realname), ";\n", 0);
|
Printv(pcode, "*", realname, " = *", realpackage, "::", Swig_name_member(class_name,realname), ";\n", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PERL5::cpp_inherit()
|
* PERL5::cpp_inherit()
|
||||||
* ------------------------------------------------------------------------------ */
|
* ------------------------------------------------------------------------------ */
|
||||||
void
|
void
|
||||||
PERL5::cpp_inherit(char **baseclass, int) {
|
PERL5::cpp_inherit(char **baseclass, int) {
|
||||||
char *bc;
|
char *bc;
|
||||||
int i = 0, have_first = 0;
|
int i = 0, have_first = 0;
|
||||||
|
|
@ -1806,7 +1806,7 @@ PERL5::cpp_inherit(char **baseclass, int) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Inherit variables and constants from base classes, but not
|
/* Inherit variables and constants from base classes, but not
|
||||||
functions (since Perl can handle that okay). */
|
functions (since Perl can handle that okay). */
|
||||||
|
|
||||||
this->Language::cpp_inherit(baseclass, INHERIT_CONST | INHERIT_VAR);
|
this->Language::cpp_inherit(baseclass, INHERIT_CONST | INHERIT_VAR);
|
||||||
|
|
@ -1830,7 +1830,7 @@ PERL5::cpp_inherit(char **baseclass, int) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PERL5::cpp_declare_const()
|
* PERL5::cpp_declare_const()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
|
|
@ -1838,7 +1838,7 @@ PERL5::cpp_declare_const(char *name, char *iname, SwigType *type, char *value) {
|
||||||
String *realname;
|
String *realname;
|
||||||
int oldblessed = blessed;
|
int oldblessed = blessed;
|
||||||
char cname[256];
|
char cname[256];
|
||||||
|
|
||||||
/* Create a normal constant */
|
/* Create a normal constant */
|
||||||
blessed = 0;
|
blessed = 0;
|
||||||
this->Language::cpp_declare_const(name, iname, type, value);
|
this->Language::cpp_declare_const(name, iname, type, value);
|
||||||
|
|
@ -1849,10 +1849,10 @@ PERL5::cpp_declare_const(char *name, char *iname, SwigType *type, char *value) {
|
||||||
realname = name;
|
realname = name;
|
||||||
else
|
else
|
||||||
realname = iname;
|
realname = iname;
|
||||||
|
|
||||||
sprintf(cname,"%s::%s",Char(class_name),Char(realname));
|
sprintf(cname,"%s::%s",Char(class_name),Char(realname));
|
||||||
if (Getattr(symbols, cname)) {
|
if (Getattr(symbols, cname)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Setattr(symbols, cname,cname);
|
Setattr(symbols, cname,cname);
|
||||||
|
|
||||||
|
|
@ -1864,7 +1864,7 @@ PERL5::cpp_declare_const(char *name, char *iname, SwigType *type, char *value) {
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PERL5::cpp_class_decl()
|
* PERL5::cpp_class_decl()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
PERL5::cpp_class_decl(char *name, char *rename, char *type) {
|
PERL5::cpp_class_decl(char *name, char *rename, char *type) {
|
||||||
String *stype;
|
String *stype;
|
||||||
if (blessed) {
|
if (blessed) {
|
||||||
|
|
@ -1884,12 +1884,12 @@ PERL5::cpp_class_decl(char *name, char *rename, char *type) {
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PERL5::add_typedef()
|
* PERL5::add_typedef()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
PERL5::add_typedef(SwigType *t, char *name) {
|
PERL5::add_typedef(SwigType *t, char *name) {
|
||||||
|
|
||||||
if (!blessed) return;
|
if (!blessed) return;
|
||||||
if (is_shadow(t)) {
|
if (is_shadow(t)) {
|
||||||
cpp_class_decl(name,Char(is_shadow(t)),"");
|
cpp_class_decl(name,Char(is_shadow(t)),"");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* python.cxx
|
* python.cxx
|
||||||
*
|
*
|
||||||
* Python module.
|
* Python module.
|
||||||
*
|
*
|
||||||
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
|
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2000. The University of Chicago
|
* Copyright (C) 1999-2000. The University of Chicago
|
||||||
* See the file LICENSE for information on usage and redistribution.
|
* See the file LICENSE for information on usage and redistribution.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static char cvsroot[] = "$Header$";
|
static char cvsroot[] = "$Header$";
|
||||||
|
|
@ -16,14 +16,14 @@ static char cvsroot[] = "$Header$";
|
||||||
|
|
||||||
static String *const_code = 0;
|
static String *const_code = 0;
|
||||||
static String *shadow_methods = 0;
|
static String *shadow_methods = 0;
|
||||||
static String *module = 0;
|
static String *module = 0;
|
||||||
static String *interface = 0;
|
static String *interface = 0;
|
||||||
static String *global_name = 0;
|
static String *global_name = 0;
|
||||||
static int shadow = 0;
|
static int shadow = 0;
|
||||||
static int have_defarg = 0;
|
static int have_defarg = 0;
|
||||||
static int have_output;
|
static int have_output;
|
||||||
static int use_kw = 0;
|
static int use_kw = 0;
|
||||||
static int noopt = 1;
|
static int noopt = 1;
|
||||||
static FILE *f_shadow;
|
static FILE *f_shadow;
|
||||||
static Hash *hash;
|
static Hash *hash;
|
||||||
static Hash *symbols;
|
static Hash *symbols;
|
||||||
|
|
@ -62,7 +62,7 @@ PYTHON::parse_args(int argc, char *argv[]) {
|
||||||
int i;
|
int i;
|
||||||
strcpy(LibDir,"python");
|
strcpy(LibDir,"python");
|
||||||
|
|
||||||
for (i = 1; i < argc; i++) {
|
for (i = 1; i < argc; i++) {
|
||||||
if (argv[i]) {
|
if (argv[i]) {
|
||||||
if(strcmp(argv[i],"-module") == 0) {
|
if(strcmp(argv[i],"-module") == 0) {
|
||||||
if (argv[i+1]) {
|
if (argv[i+1]) {
|
||||||
|
|
@ -72,7 +72,7 @@ PYTHON::parse_args(int argc, char *argv[]) {
|
||||||
i++;
|
i++;
|
||||||
} else {
|
} else {
|
||||||
Swig_arg_error();
|
Swig_arg_error();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Added edz@bsn.com */
|
/* Added edz@bsn.com */
|
||||||
} else if(strcmp(argv[i],"-interface") == 0) {
|
} else if(strcmp(argv[i],"-interface") == 0) {
|
||||||
|
|
@ -121,7 +121,7 @@ PYTHON::parse_args(int argc, char *argv[]) {
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
PYTHON::parse() {
|
PYTHON::parse() {
|
||||||
|
|
||||||
hash = NewHash();
|
hash = NewHash();
|
||||||
symbols = NewHash();
|
symbols = NewHash();
|
||||||
const_code = NewString("");
|
const_code = NewString("");
|
||||||
|
|
@ -135,16 +135,16 @@ PYTHON::parse() {
|
||||||
Swig_banner(f_runtime);
|
Swig_banner(f_runtime);
|
||||||
|
|
||||||
Printf(f_runtime,"#define SWIGPYTHON\n");
|
Printf(f_runtime,"#define SWIGPYTHON\n");
|
||||||
if (NoInclude)
|
if (NoInclude)
|
||||||
Printf(f_runtime,"#define SWIG_NOINCLUDE\n");
|
Printf(f_runtime,"#define SWIG_NOINCLUDE\n");
|
||||||
|
|
||||||
if (Swig_insert_file("common.swg", f_runtime) == -1) {
|
if (Swig_insert_file("common.swg", f_runtime) == -1) {
|
||||||
Printf(stderr,"SWIG : Fatal error. Unable to locate common.swg. (Possible installation problem).\n");
|
Printf(stderr,"SWIG : Fatal error. Unable to locate common.swg. (Possible installation problem).\n");
|
||||||
SWIG_exit(1);
|
SWIG_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (Swig_insert_file("python.swg", f_runtime) == -1) {
|
if (Swig_insert_file("python.swg", f_runtime) == -1) {
|
||||||
Printf(stderr,"SWIG : Fatal error. Unable to locate python.swg. (Possible installation problem).\n");
|
Printf(stderr,"SWIG : Fatal error. Unable to locate python.swg. (Possible installation problem).\n");
|
||||||
SWIG_exit(1);
|
SWIG_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
yyparse();
|
yyparse();
|
||||||
}
|
}
|
||||||
|
|
@ -180,7 +180,7 @@ PYTHON::import(char *filename) {
|
||||||
import_file = NewString(filename);
|
import_file = NewString(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PYTHON::add_method()
|
* PYTHON::add_method()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
|
|
@ -200,7 +200,7 @@ PYTHON::initialize(void) {
|
||||||
|
|
||||||
if (!module) {
|
if (!module) {
|
||||||
Printf(stderr,"*** Error. No module name specified.\n");
|
Printf(stderr,"*** Error. No module name specified.\n");
|
||||||
SWIG_exit(1);
|
SWIG_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
/* If shadow classing is enabled, we're going to change the module name to "modulec" */
|
/* If shadow classing is enabled, we're going to change the module name to "modulec" */
|
||||||
if (shadow) {
|
if (shadow) {
|
||||||
|
|
@ -211,12 +211,12 @@ PYTHON::initialize(void) {
|
||||||
Append(module,"c");
|
Append(module,"c");
|
||||||
if ((f_shadow = fopen(filen,"w")) == 0) {
|
if ((f_shadow = fopen(filen,"w")) == 0) {
|
||||||
Printf(stderr,"Unable to open %s\n", filen);
|
Printf(stderr,"Unable to open %s\n", filen);
|
||||||
SWIG_exit(0);
|
SWIG_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
Printf(f_shadow,"# This file was created automatically by SWIG.\n");
|
Printf(f_shadow,"# This file was created automatically by SWIG.\n");
|
||||||
Printf(f_shadow,"import %s\n", interface ? interface : module);
|
Printf(f_shadow,"import %s\n", interface ? interface : module);
|
||||||
|
|
||||||
// Include some information in the code
|
// Include some information in the code
|
||||||
Printf(f_header,"\n/*-----------------------------------------------\n @(target):= %s.so\n\
|
Printf(f_header,"\n/*-----------------------------------------------\n @(target):= %s.so\n\
|
||||||
------------------------------------------------*/\n", interface ? interface : module);
|
------------------------------------------------*/\n", interface ? interface : module);
|
||||||
|
|
||||||
|
|
@ -225,7 +225,7 @@ PYTHON::initialize(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Printf(f_header,"#define SWIG_init init%s\n\n", module);
|
Printf(f_header,"#define SWIG_init init%s\n\n", module);
|
||||||
Printf(f_header,"#define SWIG_name \"%s\"\n", module);
|
Printf(f_header,"#define SWIG_name \"%s\"\n", module);
|
||||||
|
|
||||||
/* Output the start of the init function. */
|
/* Output the start of the init function. */
|
||||||
Printf(f_init,"static PyObject *SWIG_globals;\n");
|
Printf(f_init,"static PyObject *SWIG_globals;\n");
|
||||||
|
|
@ -290,7 +290,7 @@ PYTHON::close(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PYTHON::get_pointer()
|
* PYTHON::get_pointer()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
|
|
@ -298,7 +298,7 @@ PYTHON::get_pointer(char *src, char *dest, SwigType *t, String *f, char *ret) {
|
||||||
SwigType *lt;
|
SwigType *lt;
|
||||||
SwigType_remember(t);
|
SwigType_remember(t);
|
||||||
Printv(f,tab4, "if ((SWIG_ConvertPtr(", src, ",(void **) &", dest, ",", 0);
|
Printv(f,tab4, "if ((SWIG_ConvertPtr(", src, ",(void **) &", dest, ",", 0);
|
||||||
|
|
||||||
lt = Swig_clocal_type(t);
|
lt = Swig_clocal_type(t);
|
||||||
if (Cmp(lt,"p.void") == 0) {
|
if (Cmp(lt,"p.void") == 0) {
|
||||||
Printv(f, "0,1)) == -1) return ", ret, ";\n", 0);
|
Printv(f, "0,1)) == -1) return ", ret, ";\n", 0);
|
||||||
|
|
@ -368,8 +368,8 @@ PYTHON::create_function(char *name, char *iname, SwigType *d, ParmList *l) {
|
||||||
Wrapper_add_local(f,"resultobj", "PyObject *resultobj");
|
Wrapper_add_local(f,"resultobj", "PyObject *resultobj");
|
||||||
|
|
||||||
/* Get the function usage string for later use */
|
/* Get the function usage string for later use */
|
||||||
|
|
||||||
usage = usage_func(iname,d,l);
|
usage = usage_func(iname,d,l);
|
||||||
|
|
||||||
/* Write code to extract function parameters. */
|
/* Write code to extract function parameters. */
|
||||||
pcount = emit_args(d, l, f);
|
pcount = emit_args(d, l, f);
|
||||||
|
|
@ -379,7 +379,7 @@ PYTHON::create_function(char *name, char *iname, SwigType *d, ParmList *l) {
|
||||||
Printf(parse_args," if(!PyArg_ParseTupleAndKeywords(args,kwargs,\"");
|
Printf(parse_args," if(!PyArg_ParseTupleAndKeywords(args,kwargs,\"");
|
||||||
Printf(arglist,",kwnames");
|
Printf(arglist,",kwnames");
|
||||||
}
|
}
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
j = 0;
|
j = 0;
|
||||||
numopt = check_numopt(l);
|
numopt = check_numopt(l);
|
||||||
|
|
@ -394,7 +394,7 @@ PYTHON::create_function(char *name, char *iname, SwigType *d, ParmList *l) {
|
||||||
sprintf(source,"obj%d",i);
|
sprintf(source,"obj%d",i);
|
||||||
sprintf(target,Char(Getlname(p)));
|
sprintf(target,Char(Getlname(p)));
|
||||||
sprintf(argnum,"%d",j+1);
|
sprintf(argnum,"%d",j+1);
|
||||||
|
|
||||||
if (!Getignore(p)) {
|
if (!Getignore(p)) {
|
||||||
Putc(',',arglist);
|
Putc(',',arglist);
|
||||||
if (j == pcount-numopt) Putc('|',parse_args); /* Optional argument separator */
|
if (j == pcount-numopt) Putc('|',parse_args); /* Optional argument separator */
|
||||||
|
|
@ -438,7 +438,7 @@ PYTHON::create_function(char *name, char *iname, SwigType *d, ParmList *l) {
|
||||||
case T_DOUBLE:
|
case T_DOUBLE:
|
||||||
Putc('d',parse_args);
|
Putc('d',parse_args);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_BOOL:
|
case T_BOOL:
|
||||||
{
|
{
|
||||||
char tempb[128];
|
char tempb[128];
|
||||||
|
|
@ -463,11 +463,11 @@ PYTHON::create_function(char *name, char *iname, SwigType *d, ParmList *l) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_USER:
|
case T_USER:
|
||||||
|
|
||||||
Putc('O',parse_args);
|
Putc('O',parse_args);
|
||||||
sprintf(source,"argo%d", i);
|
sprintf(source,"argo%d", i);
|
||||||
sprintf(target,Char(Getlname(p)));
|
sprintf(target,Char(Getlname(p)));
|
||||||
|
|
||||||
Wrapper_add_localv(f,source,"PyObject *",source,"=0",0);
|
Wrapper_add_localv(f,source,"PyObject *",source,"=0",0);
|
||||||
Printf(arglist,"&%s",source);
|
Printf(arglist,"&%s",source);
|
||||||
SwigType_add_pointer(pt);
|
SwigType_add_pointer(pt);
|
||||||
|
|
@ -483,14 +483,14 @@ PYTHON::create_function(char *name, char *iname, SwigType *d, ParmList *l) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_POINTER: case T_ARRAY: case T_REFERENCE:
|
case T_POINTER: case T_ARRAY: case T_REFERENCE:
|
||||||
|
|
||||||
/* Have some sort of pointer variable. Create a temporary local
|
/* Have some sort of pointer variable. Create a temporary local
|
||||||
variable for the string and read the pointer value into it. */
|
variable for the string and read the pointer value into it. */
|
||||||
|
|
||||||
Putc('O',parse_args);
|
Putc('O',parse_args);
|
||||||
sprintf(source,"argo%d", i);
|
sprintf(source,"argo%d", i);
|
||||||
sprintf(target,"%s",Char(Getlname(p)));
|
sprintf(target,"%s",Char(Getlname(p)));
|
||||||
|
|
||||||
Wrapper_add_localv(f,source,"PyObject *",source,"=0",0);
|
Wrapper_add_localv(f,source,"PyObject *",source,"=0",0);
|
||||||
Printf(arglist,"&%s",source);
|
Printf(arglist,"&%s",source);
|
||||||
get_pointer(source, target, pt, get_pointers, (char*)"NULL");
|
get_pointer(source, target, pt, get_pointers, (char*)"NULL");
|
||||||
|
|
@ -501,8 +501,8 @@ PYTHON::create_function(char *name, char *iname, SwigType *d, ParmList *l) {
|
||||||
Printf(stderr,"%s : Line %d. Unable to use type %s as a function argument.\n",input_file, line_number, SwigType_str(pt,0));
|
Printf(stderr,"%s : Line %d. Unable to use type %s as a function argument.\n",input_file, line_number, SwigType_str(pt,0));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!noarg)
|
if (!noarg)
|
||||||
Printf(arglist,"&%s",Getlname(p));
|
Printf(arglist,"&%s",Getlname(p));
|
||||||
}
|
}
|
||||||
j++;
|
j++;
|
||||||
|
|
@ -524,7 +524,7 @@ PYTHON::create_function(char *name, char *iname, SwigType *d, ParmList *l) {
|
||||||
Replace(outarg,"$argnum",argnum,DOH_REPLACE_ANY);
|
Replace(outarg,"$argnum",argnum,DOH_REPLACE_ANY);
|
||||||
Replace(outarg,"$arg",source, DOH_REPLACE_ANY);
|
Replace(outarg,"$arg",source, DOH_REPLACE_ANY);
|
||||||
have_output++;
|
have_output++;
|
||||||
}
|
}
|
||||||
p = Getnext(p);
|
p = Getnext(p);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
@ -538,7 +538,7 @@ PYTHON::create_function(char *name, char *iname, SwigType *d, ParmList *l) {
|
||||||
Printv(parse_args,
|
Printv(parse_args,
|
||||||
arglist, ")) return NULL;\n",
|
arglist, ")) return NULL;\n",
|
||||||
0);
|
0);
|
||||||
|
|
||||||
/* Now slap the whole first part of the wrapper function together */
|
/* Now slap the whole first part of the wrapper function together */
|
||||||
Printv(f->code, parse_args, get_pointers, check, 0);
|
Printv(f->code, parse_args, get_pointers, check, 0);
|
||||||
|
|
||||||
|
|
@ -611,7 +611,7 @@ PYTHON::create_function(char *name, char *iname, SwigType *d, ParmList *l) {
|
||||||
if ((tm = Swig_typemap_lookup((char*)"ret",d,iname,(char*)"result",(char*)"",0))) {
|
if ((tm = Swig_typemap_lookup((char*)"ret",d,iname,(char*)"result",(char*)"",0))) {
|
||||||
Printf(f->code,"%s\n",tm);
|
Printf(f->code,"%s\n",tm);
|
||||||
}
|
}
|
||||||
|
|
||||||
Printf(f->code," return resultobj;\n}\n");
|
Printf(f->code," return resultobj;\n}\n");
|
||||||
|
|
||||||
/* Substitute the cleanup code */
|
/* Substitute the cleanup code */
|
||||||
|
|
@ -631,7 +631,7 @@ PYTHON::create_function(char *name, char *iname, SwigType *d, ParmList *l) {
|
||||||
if ((shadow) && (!(shadow & PYSHADOW_MEMBER))) {
|
if ((shadow) && (!(shadow & PYSHADOW_MEMBER))) {
|
||||||
int need_wrapper = 0;
|
int need_wrapper = 0;
|
||||||
int munge_return = 0;
|
int munge_return = 0;
|
||||||
|
|
||||||
/* Check return code for modification */
|
/* Check return code for modification */
|
||||||
if (is_shadow(d)) {
|
if (is_shadow(d)) {
|
||||||
need_wrapper = 1;
|
need_wrapper = 1;
|
||||||
|
|
@ -650,7 +650,7 @@ PYTHON::create_function(char *name, char *iname, SwigType *d, ParmList *l) {
|
||||||
if (munge_return) {
|
if (munge_return) {
|
||||||
/* If the output of this object has been remapped in any way, we're
|
/* If the output of this object has been remapped in any way, we're
|
||||||
going to return it as a bare object */
|
going to return it as a bare object */
|
||||||
|
|
||||||
if (!Swig_typemap_search((char*)"out",d,iname)) {
|
if (!Swig_typemap_search((char*)"out",d,iname)) {
|
||||||
|
|
||||||
/* If there are output arguments, we are going to return the value
|
/* If there are output arguments, we are going to return the value
|
||||||
|
|
@ -701,7 +701,7 @@ PYTHON::link_variable(char *name, char *iname, SwigType *t) {
|
||||||
Printv(vars, global_name, " = ", module, ".", global_name, "\n", 0);
|
Printv(vars, global_name, " = ", module, ".", global_name, "\n", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wname = Char(Swig_name_wrapper(name));
|
wname = Char(Swig_name_wrapper(name));
|
||||||
|
|
||||||
/* Create a function for setting the value of the variable */
|
/* Create a function for setting the value of the variable */
|
||||||
|
|
@ -728,7 +728,7 @@ PYTHON::link_variable(char *name, char *iname, SwigType *t) {
|
||||||
tab4, name, " = tval;\n",
|
tab4, name, " = tval;\n",
|
||||||
0);
|
0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_FLOAT: case T_DOUBLE:
|
case T_FLOAT: case T_DOUBLE:
|
||||||
Wrapper_add_localv(setf,"tval",SwigType_lstr(t,0), "tval",0);
|
Wrapper_add_localv(setf,"tval",SwigType_lstr(t,0), "tval",0);
|
||||||
Printv(setf->code,
|
Printv(setf->code,
|
||||||
|
|
@ -741,7 +741,7 @@ PYTHON::link_variable(char *name, char *iname, SwigType *t) {
|
||||||
tab4, name, " = tval;\n",
|
tab4, name, " = tval;\n",
|
||||||
0);
|
0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_CHAR:
|
case T_CHAR:
|
||||||
Wrapper_add_local(setf,"tval","char * tval");
|
Wrapper_add_local(setf,"tval","char * tval");
|
||||||
Printv(setf->code,
|
Printv(setf->code,
|
||||||
|
|
@ -773,7 +773,7 @@ PYTHON::link_variable(char *name, char *iname, SwigType *t) {
|
||||||
tab8, "return 1; \n",
|
tab8, "return 1; \n",
|
||||||
tab4, "}\n",
|
tab4, "}\n",
|
||||||
0);
|
0);
|
||||||
|
|
||||||
if (CPlusPlus) {
|
if (CPlusPlus) {
|
||||||
Printv(setf->code,
|
Printv(setf->code,
|
||||||
tab4, "if (", name, ") delete [] ", name, ";\n",
|
tab4, "if (", name, ") delete [] ", name, ";\n",
|
||||||
|
|
@ -800,8 +800,8 @@ PYTHON::link_variable(char *name, char *iname, SwigType *t) {
|
||||||
if (dim && Len(dim)) {
|
if (dim && Len(dim)) {
|
||||||
Printf(setf->code, "strncpy(%s,PyString_AsString(val), %s);\n", name,dim);
|
Printf(setf->code, "strncpy(%s,PyString_AsString(val), %s);\n", name,dim);
|
||||||
setable = 1;
|
setable = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!setable) {
|
if (!setable) {
|
||||||
Printv(setf->code,
|
Printv(setf->code,
|
||||||
tab4, "PyErr_SetString(PyExc_TypeError,\"Variable ", iname,
|
tab4, "PyErr_SetString(PyExc_TypeError,\"Variable ", iname,
|
||||||
|
|
@ -833,10 +833,10 @@ PYTHON::link_variable(char *name, char *iname, SwigType *t) {
|
||||||
tab4, "return 1;\n",
|
tab4, "return 1;\n",
|
||||||
0);
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Printf(setf->code,"}\n");
|
Printf(setf->code,"}\n");
|
||||||
Wrapper_print(setf,f_wrappers);
|
Wrapper_print(setf,f_wrappers);
|
||||||
|
|
||||||
/* Create a function for getting the value of a variable */
|
/* Create a function for getting the value of a variable */
|
||||||
Printf(getf->def,"static PyObject *%s_get() {", wname);
|
Printf(getf->def,"static PyObject *%s_get() {", wname);
|
||||||
Wrapper_add_local(getf,"pyobj", "PyObject *pyobj");
|
Wrapper_add_local(getf,"pyobj", "PyObject *pyobj");
|
||||||
|
|
@ -848,7 +848,7 @@ PYTHON::link_variable(char *name, char *iname, SwigType *t) {
|
||||||
Replace(getf->code,"$name",iname, DOH_REPLACE_ANY);
|
Replace(getf->code,"$name",iname, DOH_REPLACE_ANY);
|
||||||
} else {
|
} else {
|
||||||
switch(SwigType_type(t)) {
|
switch(SwigType_type(t)) {
|
||||||
case T_INT: case T_UINT:
|
case T_INT: case T_UINT:
|
||||||
case T_SHORT: case T_USHORT:
|
case T_SHORT: case T_USHORT:
|
||||||
case T_LONG: case T_ULONG:
|
case T_LONG: case T_ULONG:
|
||||||
case T_SCHAR: case T_UCHAR: case T_BOOL:
|
case T_SCHAR: case T_UCHAR: case T_BOOL:
|
||||||
|
|
@ -898,7 +898,7 @@ PYTHON::link_variable(char *name, char *iname, SwigType *t) {
|
||||||
|
|
||||||
Printf(getf->code," return pyobj;\n}\n");
|
Printf(getf->code," return pyobj;\n}\n");
|
||||||
Wrapper_print(getf,f_wrappers);
|
Wrapper_print(getf,f_wrappers);
|
||||||
|
|
||||||
/* Now add this to the variable linking mechanism */
|
/* Now add this to the variable linking mechanism */
|
||||||
|
|
||||||
Printf(f_init,"\t SWIG_addvarlink(SWIG_globals,\"%s\",%s_get, %s_set);\n", iname, wname, wname);
|
Printf(f_init,"\t SWIG_addvarlink(SWIG_globals,\"%s\",%s_get, %s_set);\n", iname, wname, wname);
|
||||||
|
|
@ -955,7 +955,7 @@ PYTHON::declare_const(char *name, char *, SwigType *type, char *value) {
|
||||||
}
|
}
|
||||||
if ((shadow) && (!(shadow & PYSHADOW_MEMBER))) {
|
if ((shadow) && (!(shadow & PYSHADOW_MEMBER))) {
|
||||||
Printv(vars,name, " = ", module, ".", name, "\n", 0);
|
Printv(vars,name, " = ", module, ".", name, "\n", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
|
|
@ -1007,7 +1007,7 @@ PYTHON::usage_func(char *iname, SwigType *, ParmList *l) {
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PYTHON::add_native()
|
* PYTHON::add_native()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
PYTHON::add_native(char *name, char *funcname, SwigType *, ParmList *) {
|
PYTHON::add_native(char *name, char *funcname, SwigType *, ParmList *) {
|
||||||
add_method(name, funcname,0);
|
add_method(name, funcname,0);
|
||||||
if (shadow) {
|
if (shadow) {
|
||||||
|
|
@ -1018,7 +1018,7 @@ PYTHON::add_native(char *name, char *funcname, SwigType *, ParmList *) {
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PYTHON::cpp_class_decl() - Register a class definition
|
* PYTHON::cpp_class_decl() - Register a class definition
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
PYTHON::cpp_class_decl(char *name, char *rename, char *type) {
|
PYTHON::cpp_class_decl(char *name, char *rename, char *type) {
|
||||||
String *stype;
|
String *stype;
|
||||||
if (shadow) {
|
if (shadow) {
|
||||||
|
|
@ -1039,7 +1039,7 @@ PYTHON::cpp_class_decl(char *name, char *rename, char *type) {
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PYTHON::pragma()
|
* PYTHON::pragma()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
PYTHON::pragma(char *lang, char *cmd, char *value) {
|
PYTHON::pragma(char *lang, char *cmd, char *value) {
|
||||||
|
|
||||||
if (strcmp(lang,(char*)"python") == 0) {
|
if (strcmp(lang,(char*)"python") == 0) {
|
||||||
|
|
@ -1080,7 +1080,7 @@ struct PyPragma {
|
||||||
m_text = NewString(text);
|
m_text = NewString(text);
|
||||||
next = 0;
|
next = 0;
|
||||||
}
|
}
|
||||||
~PyPragma() {
|
~PyPragma() {
|
||||||
Delete(m_method);
|
Delete(m_method);
|
||||||
Delete(m_text);
|
Delete(m_text);
|
||||||
if (next) delete next;
|
if (next) delete next;
|
||||||
|
|
@ -1092,7 +1092,7 @@ static PyPragma *pragmas = 0;
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PYTHON::cpp_pragma() - Handle C++ pragmas
|
* PYTHON::cpp_pragma() - Handle C++ pragmas
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
PYTHON::cpp_pragma(Pragma *plist) {
|
PYTHON::cpp_pragma(Pragma *plist) {
|
||||||
PyPragma *pyp1 = 0, *pyp2 = 0;
|
PyPragma *pyp1 = 0, *pyp2 = 0;
|
||||||
if (pragmas) {
|
if (pragmas) {
|
||||||
|
|
@ -1139,13 +1139,13 @@ PYTHON::cpp_pragma(Pragma *plist) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PYTHON::emitAddPragmas()
|
* PYTHON::emitAddPragmas()
|
||||||
*
|
*
|
||||||
* Search the current class pragma for any text belonging to name.
|
* Search the current class pragma for any text belonging to name.
|
||||||
* Append the text properly spaced to the output string.
|
* Append the text properly spaced to the output string.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
PYTHON::emitAddPragmas(String *output, char* name, char* spacing) {
|
PYTHON::emitAddPragmas(String *output, char* name, char* spacing) {
|
||||||
PyPragma *p = pragmas;
|
PyPragma *p = pragmas;
|
||||||
while (p) {
|
while (p) {
|
||||||
|
|
@ -1180,10 +1180,10 @@ static int class_renamed = 0;
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PYTHON::cpp_open_class()
|
* PYTHON::cpp_open_class()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
PYTHON::cpp_open_class(char *classname, char *rname, char *ctype, int strip) {
|
PYTHON::cpp_open_class(char *classname, char *rname, char *ctype, int strip) {
|
||||||
this->Language::cpp_open_class(classname, rname, ctype, strip);
|
this->Language::cpp_open_class(classname, rname, ctype, strip);
|
||||||
|
|
||||||
if (shadow) {
|
if (shadow) {
|
||||||
/* Create new strings for building up a wrapper function */
|
/* Create new strings for building up a wrapper function */
|
||||||
setattr = NewString("");
|
setattr = NewString("");
|
||||||
|
|
@ -1222,7 +1222,7 @@ PYTHON::cpp_open_class(char *classname, char *rname, char *ctype, int strip) {
|
||||||
tab8, "method = ", class_name, ".__setmethods__.get(name,None)\n",
|
tab8, "method = ", class_name, ".__setmethods__.get(name,None)\n",
|
||||||
tab8, "if method: return method(self,value)\n",
|
tab8, "if method: return method(self,value)\n",
|
||||||
0);
|
0);
|
||||||
|
|
||||||
Printv(getattr, tab4, "def __getattr__(self,name):\n", 0);
|
Printv(getattr, tab4, "def __getattr__(self,name):\n", 0);
|
||||||
Printv(csetattr, tab4, "__setmethods__ = {\n", 0);
|
Printv(csetattr, tab4, "__setmethods__ = {\n", 0);
|
||||||
Printv(cgetattr, tab4, "__getmethods__ = {\n", 0);
|
Printv(cgetattr, tab4, "__getmethods__ = {\n", 0);
|
||||||
|
|
@ -1232,7 +1232,7 @@ PYTHON::cpp_open_class(char *classname, char *rname, char *ctype, int strip) {
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PYTHON::cpp_member_func()
|
* PYTHON::cpp_member_func()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
PYTHON::cpp_member_func(char *name, char *iname, SwigType *t, ParmList *l) {
|
PYTHON::cpp_member_func(char *name, char *iname, SwigType *t, ParmList *l) {
|
||||||
char *realname;
|
char *realname;
|
||||||
int oldshadow;
|
int oldshadow;
|
||||||
|
|
@ -1245,13 +1245,13 @@ PYTHON::cpp_member_func(char *name, char *iname, SwigType *t, ParmList *l) {
|
||||||
shadow = oldshadow;
|
shadow = oldshadow;
|
||||||
if (shadow) {
|
if (shadow) {
|
||||||
realname = iname ? iname : name;
|
realname = iname ? iname : name;
|
||||||
|
|
||||||
/* Check to see if we've already seen this */
|
/* Check to see if we've already seen this */
|
||||||
sprintf(cname,"python:%s::%s",class_name,realname);
|
sprintf(cname,"python:%s::%s",class_name,realname);
|
||||||
if (Getattr(symbols,cname)) return;
|
if (Getattr(symbols,cname)) return;
|
||||||
Setattr(symbols,cname,cname);
|
Setattr(symbols,cname,cname);
|
||||||
|
|
||||||
if (strcmp(realname,"__repr__") == 0)
|
if (strcmp(realname,"__repr__") == 0)
|
||||||
have_repr = 1;
|
have_repr = 1;
|
||||||
|
|
||||||
if (!is_shadow(t) && !noopt) {
|
if (!is_shadow(t) && !noopt) {
|
||||||
|
|
@ -1263,12 +1263,12 @@ PYTHON::cpp_member_func(char *name, char *iname, SwigType *t, ParmList *l) {
|
||||||
Printv(pyclass,tab4, "def ", realname, "(*args, **kwargs):\n", 0);
|
Printv(pyclass,tab4, "def ", realname, "(*args, **kwargs):\n", 0);
|
||||||
else
|
else
|
||||||
Printv(pyclass, tab4, "def ", realname, "(*args):\n", 0);
|
Printv(pyclass, tab4, "def ", realname, "(*args):\n", 0);
|
||||||
|
|
||||||
if (use_kw)
|
if (use_kw)
|
||||||
Printv(pyclass, tab8, "val = apply(", module, ".", Swig_name_member(class_name,realname), ",args, kwargs)\n", 0);
|
Printv(pyclass, tab8, "val = apply(", module, ".", Swig_name_member(class_name,realname), ",args, kwargs)\n", 0);
|
||||||
else
|
else
|
||||||
Printv(pyclass, tab8, "val = apply(", module, ".", Swig_name_member(class_name,realname), ",args)\n",0);
|
Printv(pyclass, tab8, "val = apply(", module, ".", Swig_name_member(class_name,realname), ",args)\n",0);
|
||||||
|
|
||||||
/* Check to see if the return type is an object */
|
/* Check to see if the return type is an object */
|
||||||
if (is_shadow(t)) {
|
if (is_shadow(t)) {
|
||||||
if (!Swig_typemap_search((char*)"out",t,Swig_name_member(class_name,realname))) {
|
if (!Swig_typemap_search((char*)"out",t,Swig_name_member(class_name,realname))) {
|
||||||
|
|
@ -1292,7 +1292,7 @@ PYTHON::cpp_member_func(char *name, char *iname, SwigType *t, ParmList *l) {
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PYTHON::cpp_constructor()
|
* PYTHON::cpp_constructor()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
PYTHON::cpp_constructor(char *name, char *iname, ParmList *l) {
|
PYTHON::cpp_constructor(char *name, char *iname, ParmList *l) {
|
||||||
char *realname;
|
char *realname;
|
||||||
int oldshadow = shadow;
|
int oldshadow = shadow;
|
||||||
|
|
@ -1304,13 +1304,13 @@ PYTHON::cpp_constructor(char *name, char *iname, ParmList *l) {
|
||||||
|
|
||||||
if (shadow) {
|
if (shadow) {
|
||||||
realname = iname ? iname : class_name;
|
realname = iname ? iname : class_name;
|
||||||
|
|
||||||
/* Check to see if we've already seen this */
|
/* Check to see if we've already seen this */
|
||||||
sprintf(cname,":python:constructor:%s::%s",class_name,realname);
|
sprintf(cname,":python:constructor:%s::%s",class_name,realname);
|
||||||
if (Getattr(symbols,cname)) return;
|
if (Getattr(symbols,cname)) return;
|
||||||
Setattr(symbols,cname,cname);
|
Setattr(symbols,cname,cname);
|
||||||
|
|
||||||
if (!have_constructor) {
|
if (!have_constructor) {
|
||||||
if (use_kw)
|
if (use_kw)
|
||||||
Printv(construct, tab4, "def __init__(self,*args,**kwargs):\n", 0);
|
Printv(construct, tab4, "def __init__(self,*args,**kwargs):\n", 0);
|
||||||
else
|
else
|
||||||
|
|
@ -1346,7 +1346,7 @@ PYTHON::cpp_constructor(char *name, char *iname, ParmList *l) {
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PYTHON::cpp_destructor()
|
* PYTHON::cpp_destructor()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
PYTHON::cpp_destructor(char *name, char *newname) {
|
PYTHON::cpp_destructor(char *name, char *newname) {
|
||||||
char *realname;
|
char *realname;
|
||||||
int oldshadow = shadow;
|
int oldshadow = shadow;
|
||||||
|
|
@ -1357,12 +1357,12 @@ PYTHON::cpp_destructor(char *name, char *newname) {
|
||||||
if (shadow) {
|
if (shadow) {
|
||||||
if (newname) realname = newname;
|
if (newname) realname = newname;
|
||||||
else realname = class_renamed ? class_name : name;
|
else realname = class_renamed ? class_name : name;
|
||||||
|
|
||||||
Printv(pyclass, tab4, "def __del__(self,", module, "=", module, "):\n", 0);
|
Printv(pyclass, tab4, "def __del__(self,", module, "=", module, "):\n", 0);
|
||||||
emitAddPragmas(pyclass,(char*)"__del__",(char*)tab8);
|
emitAddPragmas(pyclass,(char*)"__del__",(char*)tab8);
|
||||||
Printv(pyclass, tab8, "if self.thisown == 1 :\n",
|
Printv(pyclass, tab8, "if self.thisown == 1 :\n",
|
||||||
tab8, tab4, module, ".", Swig_name_destroy(realname), "(self)\n", 0);
|
tab8, tab4, module, ".", Swig_name_destroy(realname), "(self)\n", 0);
|
||||||
|
|
||||||
have_destructor = 1;
|
have_destructor = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1370,11 +1370,11 @@ PYTHON::cpp_destructor(char *name, char *newname) {
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PYTHON::cpp_close_class() - Close a class and write wrappers
|
* PYTHON::cpp_close_class() - Close a class and write wrappers
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
PYTHON::cpp_close_class() {
|
PYTHON::cpp_close_class() {
|
||||||
String *ptrclass;
|
String *ptrclass;
|
||||||
String *repr;
|
String *repr;
|
||||||
|
|
||||||
ptrclass = NewString("");
|
ptrclass = NewString("");
|
||||||
repr = NewString("");
|
repr = NewString("");
|
||||||
|
|
||||||
|
|
@ -1479,7 +1479,7 @@ PYTHON::cpp_inherit(char **baseclass,int) {
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PYTHON::cpp_variable() - Add a member variable
|
* PYTHON::cpp_variable() - Add a member variable
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
PYTHON::cpp_variable(char *name, char *iname, SwigType *t) {
|
PYTHON::cpp_variable(char *name, char *iname, SwigType *t) {
|
||||||
char *realname;
|
char *realname;
|
||||||
int inhash = 0;
|
int inhash = 0;
|
||||||
|
|
@ -1500,10 +1500,10 @@ PYTHON::cpp_variable(char *name, char *iname, SwigType *t) {
|
||||||
if (Getattr(symbols,cname)) return;
|
if (Getattr(symbols,cname)) return;
|
||||||
|
|
||||||
Setattr(symbols,cname,cname);
|
Setattr(symbols,cname,cname);
|
||||||
|
|
||||||
/* Figure out if we've seen this datatype before */
|
/* Figure out if we've seen this datatype before */
|
||||||
if (is_shadow(t)) inhash = 1;
|
if (is_shadow(t)) inhash = 1;
|
||||||
|
|
||||||
if (Status & STAT_READONLY) {
|
if (Status & STAT_READONLY) {
|
||||||
/* *setattr << tab8 << tab4 << "raise RuntimeError, \'Member is read-only\'\n"; */
|
/* *setattr << tab8 << tab4 << "raise RuntimeError, \'Member is read-only\'\n"; */
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -1520,7 +1520,7 @@ PYTHON::cpp_variable(char *name, char *iname, SwigType *t) {
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PYTHON::cpp_declare_const()
|
* PYTHON::cpp_declare_const()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
PYTHON::cpp_declare_const(char *name, char *iname, SwigType *type, char *value) {
|
PYTHON::cpp_declare_const(char *name, char *iname, SwigType *type, char *value) {
|
||||||
char *realname;
|
char *realname;
|
||||||
int oldshadow = shadow;
|
int oldshadow = shadow;
|
||||||
|
|
@ -1540,11 +1540,11 @@ PYTHON::cpp_declare_const(char *name, char *iname, SwigType *type, char *value)
|
||||||
Printv(cinit, tab4, realname, " = ", module, ".", Swig_name_member(class_name,realname), "\n", 0);
|
Printv(cinit, tab4, realname, " = ", module, ".", Swig_name_member(class_name,realname), "\n", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* PYTHON::add_typedef() - Manage typedef's for shadow classes
|
* PYTHON::add_typedef() - Manage typedef's for shadow classes
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
PYTHON::add_typedef(SwigType *t, char *name) {
|
PYTHON::add_typedef(SwigType *t, char *name) {
|
||||||
if (!shadow) return;
|
if (!shadow) return;
|
||||||
if (is_shadow(t)) {
|
if (is_shadow(t)) {
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ static void insert_file(char *filename, File *file) {
|
||||||
"SWIG : Fatal error. "
|
"SWIG : Fatal error. "
|
||||||
"Unable to locate %s. (Possible installation problem).\n",
|
"Unable to locate %s. (Possible installation problem).\n",
|
||||||
filename);
|
filename);
|
||||||
SWIG_exit(1);
|
SWIG_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -358,7 +358,7 @@ String *RUBY::make_wrapper_name(char *cname) {
|
||||||
/* --------------------------------------------------------------------------
|
/* --------------------------------------------------------------------------
|
||||||
* RUBY::add_native()
|
* RUBY::add_native()
|
||||||
* -------------------------------------------------------------------------- */
|
* -------------------------------------------------------------------------- */
|
||||||
void
|
void
|
||||||
RUBY::add_native(char *name, char *funcname, SwigType *, ParmList *) {
|
RUBY::add_native(char *name, char *funcname, SwigType *, ParmList *) {
|
||||||
Printf(stderr,"%s : Line %d. Adding native function %s not supported (ignored).\n", input_file, line_number, funcname);
|
Printf(stderr,"%s : Line %d. Adding native function %s not supported (ignored).\n", input_file, line_number, funcname);
|
||||||
}
|
}
|
||||||
|
|
@ -678,7 +678,7 @@ void RUBY::create_function(char *name, char *iname, SwigType *t, ParmList *l) {
|
||||||
|
|
||||||
void RUBY::link_variable(char *name, char *iname, SwigType *t) {
|
void RUBY::link_variable(char *name, char *iname, SwigType *t) {
|
||||||
char *tm;
|
char *tm;
|
||||||
|
|
||||||
String *getfname, *setfname;
|
String *getfname, *setfname;
|
||||||
Wrapper *getf, *setf;
|
Wrapper *getf, *setf;
|
||||||
|
|
||||||
|
|
@ -1217,7 +1217,7 @@ void RUBY::cpp_destructor(char *name, char *newname) {
|
||||||
Printv(freebody, Swig_name_destroy(name), "(", Swig_cparm_name(0,0), ")", 0);
|
Printv(freebody, Swig_name_destroy(name), "(", Swig_cparm_name(0,0), ")", 0);
|
||||||
} else {
|
} else {
|
||||||
/* When no addmethods mode, swig emits no destroy function. */
|
/* When no addmethods mode, swig emits no destroy function. */
|
||||||
if (CPlusPlus)
|
if (CPlusPlus)
|
||||||
Printv(freebody, Swig_cppdestructor_call(), 0);
|
Printv(freebody, Swig_cppdestructor_call(), 0);
|
||||||
else
|
else
|
||||||
Printv(freebody, Swig_cdestructor_call(), 0);
|
Printv(freebody, Swig_cdestructor_call(), 0);
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* tcl8.cxx
|
* tcl8.cxx
|
||||||
*
|
*
|
||||||
* Tcl8.0 wrapper module.
|
* Tcl8.0 wrapper module.
|
||||||
*
|
*
|
||||||
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
|
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
|
||||||
*
|
*
|
||||||
* Copyright (C) 1999-2000. The University of Chicago
|
* Copyright (C) 1999-2000. The University of Chicago
|
||||||
* See the file LICENSE for information on usage and redistribution.
|
* See the file LICENSE for information on usage and redistribution.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static char cvsroot[] = "$Header$";
|
static char cvsroot[] = "$Header$";
|
||||||
|
|
@ -40,10 +40,10 @@ static int have_destructor;
|
||||||
static String *class_name = 0;
|
static String *class_name = 0;
|
||||||
static String *class_type = 0;
|
static String *class_type = 0;
|
||||||
static String *real_classname = 0;
|
static String *real_classname = 0;
|
||||||
static Hash *repeatcmd = 0;
|
static Hash *repeatcmd = 0;
|
||||||
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* TCL8::parse_args()
|
* TCL8::parse_args()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
@ -95,7 +95,7 @@ TCL8::parse_args(int argc, char *argv[]) {
|
||||||
SWIG_config_file("tcl8.swg");
|
SWIG_config_file("tcl8.swg");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* TCL8::parse()
|
* TCL8::parse()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
@ -110,18 +110,18 @@ TCL8::parse() {
|
||||||
repeatcmd = NewHash();
|
repeatcmd = NewHash();
|
||||||
|
|
||||||
Swig_banner(f_runtime);
|
Swig_banner(f_runtime);
|
||||||
|
|
||||||
/* Include a Tcl configuration file */
|
/* Include a Tcl configuration file */
|
||||||
if (NoInclude) {
|
if (NoInclude) {
|
||||||
Printf(f_runtime,"#define SWIG_NOINCLUDE\n");
|
Printf(f_runtime,"#define SWIG_NOINCLUDE\n");
|
||||||
}
|
}
|
||||||
/* if (Swig_insert_file("common.swg",f_runtime) == -1) {
|
/* if (Swig_insert_file("common.swg",f_runtime) == -1) {
|
||||||
Printf(stderr,"SWIG : Fatal error. Unable to locate 'common.swg' in SWIG library.\n");
|
Printf(stderr,"SWIG : Fatal error. Unable to locate 'common.swg' in SWIG library.\n");
|
||||||
SWIG_exit(1);
|
SWIG_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (Swig_insert_file("swigtcl8.swg",f_runtime) == -1) {
|
if (Swig_insert_file("swigtcl8.swg",f_runtime) == -1) {
|
||||||
Printf(stderr,"SWIG : Fatal error. Unable to locate 'swigtcl8.swg' in SWIG library.\n");
|
Printf(stderr,"SWIG : Fatal error. Unable to locate 'swigtcl8.swg' in SWIG library.\n");
|
||||||
SWIG_exit(1);
|
SWIG_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
yyparse();
|
yyparse();
|
||||||
|
|
@ -165,11 +165,11 @@ TCL8::initialize() {
|
||||||
|
|
||||||
if ((!ns_name) && (nspace)) {
|
if ((!ns_name) && (nspace)) {
|
||||||
Printf(stderr,"Tcl error. Must specify a namespace.\n");
|
Printf(stderr,"Tcl error. Must specify a namespace.\n");
|
||||||
SWIG_exit(1);
|
SWIG_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (!init_name) {
|
if (!init_name) {
|
||||||
Printf(stderr,"*** Error. No module name specified.\n");
|
Printf(stderr,"*** Error. No module name specified.\n");
|
||||||
SWIG_exit(1);
|
SWIG_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
Printf(f_header,"#define SWIG_init %s\n", init_name);
|
Printf(f_header,"#define SWIG_init %s\n", init_name);
|
||||||
if (!module) module = NewString("swig");
|
if (!module) module = NewString("swig");
|
||||||
|
|
@ -203,7 +203,7 @@ TCL8::initialize() {
|
||||||
if (nspace) {
|
if (nspace) {
|
||||||
Printf(f_init,"Tcl_Eval(interp,\"namespace eval %s { }\");\n", ns_name);
|
Printf(f_init,"Tcl_Eval(interp,\"namespace eval %s { }\");\n", ns_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
Printf(cmd_info, "\nstatic _swig_command_info _swig_commands[] = {\n");
|
Printf(cmd_info, "\nstatic _swig_command_info _swig_commands[] = {\n");
|
||||||
Printf(var_info, "\nstatic _swig_var_info _swig_variables[] = {\n");
|
Printf(var_info, "\nstatic _swig_var_info _swig_variables[] = {\n");
|
||||||
Printv(f_init,
|
Printv(f_init,
|
||||||
|
|
@ -252,7 +252,7 @@ TCL8::create_command(char *cname, char *iname) {
|
||||||
|
|
||||||
String *wname = Swig_name_wrapper(cname);
|
String *wname = Swig_name_wrapper(cname);
|
||||||
Printv(cmd_info, tab4, "{ SWIG_prefix \"", iname, "\", ", wname, ", NULL},\n", 0);
|
Printv(cmd_info, tab4, "{ SWIG_prefix \"", iname, "\", ", wname, ", NULL},\n", 0);
|
||||||
|
|
||||||
/* Add interpreter name to repeatcmd hash table. This hash is used in C++ code
|
/* Add interpreter name to repeatcmd hash table. This hash is used in C++ code
|
||||||
generation to try and find repeated wrapper functions. */
|
generation to try and find repeated wrapper functions. */
|
||||||
|
|
||||||
|
|
@ -263,7 +263,7 @@ TCL8::create_command(char *cname, char *iname) {
|
||||||
* TCL8::create_function()
|
* TCL8::create_function()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void
|
void
|
||||||
TCL8::create_function(char *name, char *iname, SwigType *d, ParmList *l) {
|
TCL8::create_function(char *name, char *iname, SwigType *d, ParmList *l) {
|
||||||
Parm *p;
|
Parm *p;
|
||||||
int pcount,i,j;
|
int pcount,i,j;
|
||||||
|
|
@ -314,7 +314,7 @@ TCL8::create_function(char *name, char *iname, SwigType *d, ParmList *l) {
|
||||||
Replace(incode,"$arg",source, DOH_REPLACE_ANY);
|
Replace(incode,"$arg",source, DOH_REPLACE_ANY);
|
||||||
} else {
|
} else {
|
||||||
switch(SwigType_type(pt)) {
|
switch(SwigType_type(pt)) {
|
||||||
case T_INT:
|
case T_INT:
|
||||||
case T_UINT:
|
case T_UINT:
|
||||||
Putc('i', argstr);
|
Putc('i', argstr);
|
||||||
Printf(args,",&%s",target);
|
Printf(args,",&%s",target);
|
||||||
|
|
@ -353,20 +353,20 @@ TCL8::create_function(char *name, char *iname, SwigType *d, ParmList *l) {
|
||||||
Putc('f',argstr);
|
Putc('f',argstr);
|
||||||
Printf(args,",&%s", target);
|
Printf(args,",&%s", target);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_DOUBLE:
|
case T_DOUBLE:
|
||||||
Putc('d',argstr);
|
Putc('d',argstr);
|
||||||
Printf(args,",&%s", target);
|
Printf(args,",&%s", target);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_CHAR :
|
case T_CHAR :
|
||||||
Putc('c',argstr);
|
Putc('c',argstr);
|
||||||
Printf(args,",&%s",target);
|
Printf(args,",&%s",target);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_VOID :
|
case T_VOID :
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_USER:
|
case T_USER:
|
||||||
SwigType_add_pointer(pt);
|
SwigType_add_pointer(pt);
|
||||||
SwigType_remember(pt);
|
SwigType_remember(pt);
|
||||||
|
|
@ -374,7 +374,7 @@ TCL8::create_function(char *name, char *iname, SwigType *d, ParmList *l) {
|
||||||
Printv(args, ",&", target, ", SWIGTYPE", SwigType_manglestr(pt), 0);
|
Printv(args, ",&", target, ", SWIGTYPE", SwigType_manglestr(pt), 0);
|
||||||
SwigType_del_pointer(pt);
|
SwigType_del_pointer(pt);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_STRING:
|
case T_STRING:
|
||||||
Putc('s',argstr);
|
Putc('s',argstr);
|
||||||
Printf(args,",&%s",target);
|
Printf(args,",&%s",target);
|
||||||
|
|
@ -385,7 +385,7 @@ TCL8::create_function(char *name, char *iname, SwigType *d, ParmList *l) {
|
||||||
Putc('p',argstr);
|
Putc('p',argstr);
|
||||||
Printv(args, ",&", target, ", SWIGTYPE", SwigType_manglestr(pt), 0);
|
Printv(args, ",&", target, ", SWIGTYPE", SwigType_manglestr(pt), 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
Printf(stderr,"%s : Line %d: Unable to use type %s as a function argument.\n",
|
Printf(stderr,"%s : Line %d: Unable to use type %s as a function argument.\n",
|
||||||
input_file, line_number, SwigType_str(pt,0));
|
input_file, line_number, SwigType_str(pt,0));
|
||||||
|
|
@ -442,29 +442,29 @@ TCL8::create_function(char *name, char *iname, SwigType *d, ParmList *l) {
|
||||||
case T_UCHAR:
|
case T_UCHAR:
|
||||||
Printv(f->code, "Tcl_SetObjResult(interp,Tcl_NewIntObj((long) result));\n",0);
|
Printv(f->code, "Tcl_SetObjResult(interp,Tcl_NewIntObj((long) result));\n",0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Is a single character. We return it as a string */
|
/* Is a single character. We return it as a string */
|
||||||
case T_CHAR :
|
case T_CHAR :
|
||||||
Printv(f->code, "Tcl_SetObjResult(interp,Tcl_NewStringObj(&result,1));\n",0);
|
Printv(f->code, "Tcl_SetObjResult(interp,Tcl_NewStringObj(&result,1));\n",0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_DOUBLE :
|
case T_DOUBLE :
|
||||||
case T_FLOAT :
|
case T_FLOAT :
|
||||||
Printv(f->code, "Tcl_SetObjResult(interp,Tcl_NewDoubleObj((double) result));\n",0);
|
Printv(f->code, "Tcl_SetObjResult(interp,Tcl_NewDoubleObj((double) result));\n",0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_USER :
|
case T_USER :
|
||||||
|
|
||||||
/* Okay. We're returning malloced memory at this point.
|
/* Okay. We're returning malloced memory at this point.
|
||||||
Probably dangerous, but safe programming is for wimps. */
|
Probably dangerous, but safe programming is for wimps. */
|
||||||
SwigType_add_pointer(d);
|
SwigType_add_pointer(d);
|
||||||
SwigType_remember(d);
|
SwigType_remember(d);
|
||||||
Printv(f->code, "Tcl_SetObjResult(interp,SWIG_NewPointerObj((void *) result,SWIGTYPE",
|
Printv(f->code, "Tcl_SetObjResult(interp,SWIG_NewPointerObj((void *) result,SWIGTYPE",
|
||||||
SwigType_manglestr(d), "));\n", 0);
|
SwigType_manglestr(d), "));\n", 0);
|
||||||
|
|
||||||
SwigType_del_pointer(d);
|
SwigType_del_pointer(d);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_STRING:
|
case T_STRING:
|
||||||
Printv(f->code, "Tcl_SetObjResult(interp,Tcl_NewStringObj(result,-1));\n",0);
|
Printv(f->code, "Tcl_SetObjResult(interp,Tcl_NewStringObj(result,-1));\n",0);
|
||||||
break;
|
break;
|
||||||
|
|
@ -620,7 +620,7 @@ TCL8::link_variable(char *name, char *iname, SwigType *t) {
|
||||||
0);
|
0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_CHAR:
|
case T_CHAR:
|
||||||
Printv(set->code, "*(addr) = *value;\n",0);
|
Printv(set->code, "*(addr) = *value;\n",0);
|
||||||
Wrapper_add_local(get,"temp", "char temp[2]");
|
Wrapper_add_local(get,"temp", "char temp[2]");
|
||||||
Printv(get->code, "temp[0] = *addr; temp[1] = 0;\n",
|
Printv(get->code, "temp[0] = *addr; temp[1] = 0;\n",
|
||||||
|
|
@ -674,7 +674,7 @@ TCL8::link_variable(char *name, char *iname, SwigType *t) {
|
||||||
Printf(set->code, "strncpy(addr,value,%s);\n", dim);
|
Printf(set->code, "strncpy(addr,value,%s);\n", dim);
|
||||||
setable = 1;
|
setable = 1;
|
||||||
readonly = Status & STAT_READONLY;
|
readonly = Status & STAT_READONLY;
|
||||||
}
|
}
|
||||||
Printv(get->code, "Tcl_SetVar2(interp,name1,name2,addr, flags);\n",0);
|
Printv(get->code, "Tcl_SetVar2(interp,name1,name2,addr, flags);\n",0);
|
||||||
} else {
|
} else {
|
||||||
Printf(stderr,"%s:%d: Array variable '%s' will be read-only.\n", input_file, line_number, name);
|
Printf(stderr,"%s:%d: Array variable '%s' will be read-only.\n", input_file, line_number, name);
|
||||||
|
|
@ -729,7 +729,7 @@ TCL8::link_variable(char *name, char *iname, SwigType *t) {
|
||||||
DelWrapper(set);
|
DelWrapper(set);
|
||||||
}
|
}
|
||||||
Printv(var_info, tab4,"{ SWIG_prefix \"", iname, "\", (void *) ", isarray ? "" : "&", name, ",", getname, ",", 0);
|
Printv(var_info, tab4,"{ SWIG_prefix \"", iname, "\", (void *) ", isarray ? "" : "&", name, ",", getname, ",", 0);
|
||||||
|
|
||||||
if (readonly) {
|
if (readonly) {
|
||||||
static int readonlywrap = 0;
|
static int readonlywrap = 0;
|
||||||
if (!readonlywrap) {
|
if (!readonlywrap) {
|
||||||
|
|
@ -753,7 +753,7 @@ TCL8::link_variable(char *name, char *iname, SwigType *t) {
|
||||||
void
|
void
|
||||||
TCL8::declare_const(char *name, char *, SwigType *type, char *value) {
|
TCL8::declare_const(char *name, char *, SwigType *type, char *value) {
|
||||||
int OldStatus = Status;
|
int OldStatus = Status;
|
||||||
SwigType *t;
|
SwigType *t;
|
||||||
char var_name[256];
|
char var_name[256];
|
||||||
char *tm;
|
char *tm;
|
||||||
String *rvalue;
|
String *rvalue;
|
||||||
|
|
@ -761,7 +761,7 @@ TCL8::declare_const(char *name, char *, SwigType *type, char *value) {
|
||||||
|
|
||||||
/* Make a static variable */
|
/* Make a static variable */
|
||||||
sprintf(var_name,"_wrap_const_%s",name);
|
sprintf(var_name,"_wrap_const_%s",name);
|
||||||
|
|
||||||
if (SwigType_type(type) == T_STRING) {
|
if (SwigType_type(type) == T_STRING) {
|
||||||
rvalue = NewStringf("\"%s\"",value);
|
rvalue = NewStringf("\"%s\"",value);
|
||||||
} else if (SwigType_type(type) == T_CHAR) {
|
} else if (SwigType_type(type) == T_CHAR) {
|
||||||
|
|
@ -788,7 +788,7 @@ TCL8::declare_const(char *name, char *, SwigType *type, char *value) {
|
||||||
Printf(f_init,"\t %s_char = new char[32];\n",var_name);
|
Printf(f_init,"\t %s_char = new char[32];\n",var_name);
|
||||||
else
|
else
|
||||||
Printf(f_init,"\t %s_char = (char *) malloc(32);\n",var_name);
|
Printf(f_init,"\t %s_char = (char *) malloc(32);\n",var_name);
|
||||||
|
|
||||||
Printf(f_init,"\t sprintf(%s_char,\"%%ld\", (long) %s);\n", var_name, var_name);
|
Printf(f_init,"\t sprintf(%s_char,\"%%ld\", (long) %s);\n", var_name, var_name);
|
||||||
sprintf(var_name,"%s_char",var_name);
|
sprintf(var_name,"%s_char",var_name);
|
||||||
t = NewString("char");
|
t = NewString("char");
|
||||||
|
|
@ -807,7 +807,7 @@ TCL8::declare_const(char *name, char *, SwigType *type, char *value) {
|
||||||
Printf(f_init,"\t %s_char = new char[32];\n",var_name);
|
Printf(f_init,"\t %s_char = new char[32];\n",var_name);
|
||||||
else
|
else
|
||||||
Printf(f_init,"\t %s_char = (char *) malloc(32);\n",var_name);
|
Printf(f_init,"\t %s_char = (char *) malloc(32);\n",var_name);
|
||||||
|
|
||||||
Printf(f_init,"\t sprintf(%s_char,\"%%lu\", (unsigned long) %s);\n", var_name, var_name);
|
Printf(f_init,"\t sprintf(%s_char,\"%%lu\", (unsigned long) %s);\n", var_name, var_name);
|
||||||
sprintf(var_name,"%s_char",var_name);
|
sprintf(var_name,"%s_char",var_name);
|
||||||
t = NewSwigType(T_CHAR);
|
t = NewSwigType(T_CHAR);
|
||||||
|
|
@ -820,7 +820,7 @@ TCL8::declare_const(char *name, char *, SwigType *type, char *value) {
|
||||||
Printf(f_header,"static %s %s = (%s) (%s);\n", SwigType_lstr(type,0), var_name, SwigType_lstr(type,0), value);
|
Printf(f_header,"static %s %s = (%s) (%s);\n", SwigType_lstr(type,0), var_name, SwigType_lstr(type,0), value);
|
||||||
link_variable(var_name,name,type);
|
link_variable(var_name,name,type);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_CHAR:
|
case T_CHAR:
|
||||||
SwigType_add_pointer(type);
|
SwigType_add_pointer(type);
|
||||||
Printf(f_header,"static %s %s = \"%s\";\n", SwigType_lstr(type,0), var_name, value);
|
Printf(f_header,"static %s %s = \"%s\";\n", SwigType_lstr(type,0), var_name, value);
|
||||||
|
|
@ -840,7 +840,7 @@ TCL8::declare_const(char *name, char *, SwigType *type, char *value) {
|
||||||
Printf(f_init,"\t %s_char = new char[%d];\n",var_name,(int) Len(SwigType_manglestr(type))+ 20);
|
Printf(f_init,"\t %s_char = new char[%d];\n",var_name,(int) Len(SwigType_manglestr(type))+ 20);
|
||||||
else
|
else
|
||||||
Printf(f_init,"\t %s_char = (char *) malloc(%d);\n",var_name, (int) Len(SwigType_manglestr(type))+ 20);
|
Printf(f_init,"\t %s_char = (char *) malloc(%d);\n",var_name, (int) Len(SwigType_manglestr(type))+ 20);
|
||||||
|
|
||||||
t = NewSwigType(T_CHAR);
|
t = NewSwigType(T_CHAR);
|
||||||
SwigType_add_pointer(t);
|
SwigType_add_pointer(t);
|
||||||
SwigType_remember(type);
|
SwigType_remember(type);
|
||||||
|
|
@ -877,7 +877,7 @@ TCL8::usage_string(char *iname, SwigType *, ParmList *l) {
|
||||||
} else {
|
} else {
|
||||||
Printf(temp,"%s ", iname);
|
Printf(temp,"%s ", iname);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now go through and print parameters */
|
/* Now go through and print parameters */
|
||||||
i = 0;
|
i = 0;
|
||||||
pcount = ParmList_len(l);
|
pcount = ParmList_len(l);
|
||||||
|
|
@ -905,8 +905,8 @@ TCL8::usage_string(char *iname, SwigType *, ParmList *l) {
|
||||||
}
|
}
|
||||||
return Char(temp);
|
return Char(temp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* TCL8::add_native()
|
* TCL8::add_native()
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
|
@ -927,11 +927,11 @@ TCL8::cpp_open_class(char *classname, char *rename, char *ctype, int strip) {
|
||||||
if (!included_object) {
|
if (!included_object) {
|
||||||
if (Swig_insert_file("object.swg",f_header) == -1) {
|
if (Swig_insert_file("object.swg",f_header) == -1) {
|
||||||
Printf(stderr,"SWIG : Fatal error. Unable to locate 'object.swg' in SWIG library.\n");
|
Printf(stderr,"SWIG : Fatal error. Unable to locate 'object.swg' in SWIG library.\n");
|
||||||
SWIG_exit(1);
|
SWIG_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
included_object = 1;
|
included_object = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Clear(attributes);
|
Clear(attributes);
|
||||||
Printf(attributes, "static _swig_attribute _swig_");
|
Printf(attributes, "static _swig_attribute _swig_");
|
||||||
Printv(attributes, classname, "_attributes[] = {\n", 0);
|
Printv(attributes, classname, "_attributes[] = {\n", 0);
|
||||||
|
|
@ -979,7 +979,7 @@ TCL8::cpp_close_class() {
|
||||||
Printf(attributes, " {0,0,0}\n};\n");
|
Printf(attributes, " {0,0,0}\n};\n");
|
||||||
Printv(code,attributes,0);
|
Printv(code,attributes,0);
|
||||||
|
|
||||||
Printv(code, "static _swig_class _wrap_class_", class_name, " = { \"", class_name,
|
Printv(code, "static _swig_class _wrap_class_", class_name, " = { \"", class_name,
|
||||||
"\", &SWIGTYPE", SwigType_manglestr(t), ",",0);
|
"\", &SWIGTYPE", SwigType_manglestr(t), ",",0);
|
||||||
|
|
||||||
if (have_constructor) {
|
if (have_constructor) {
|
||||||
|
|
@ -1013,7 +1013,7 @@ void TCL8::cpp_member_func(char *name, char *iname, SwigType *t, ParmList *l) {
|
||||||
strcpy(temp, Char(Swig_name_member(class_name,realname)));
|
strcpy(temp, Char(Swig_name_member(class_name,realname)));
|
||||||
rname = Getattr(repeatcmd,temp);
|
rname = Getattr(repeatcmd,temp);
|
||||||
if (!rname) rname = Swig_name_wrapper(temp);
|
if (!rname) rname = Swig_name_wrapper(temp);
|
||||||
|
|
||||||
Printv(methods, tab4, "{\"", realname, "\", ", rname, "}, \n", 0);
|
Printv(methods, tab4, "{\"", realname, "\", ", rname, "}, \n", 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -237,7 +237,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
||||||
Swig_mark_arg(i);
|
Swig_mark_arg(i);
|
||||||
} else if (strcmp(argv[i],"-swiglib") == 0) {
|
} else if (strcmp(argv[i],"-swiglib") == 0) {
|
||||||
printf("%s\n", LibDir);
|
printf("%s\n", LibDir);
|
||||||
SWIG_exit(0);
|
SWIG_exit (EXIT_SUCCESS);
|
||||||
} else if (strcmp(argv[i],"-o") == 0) {
|
} else if (strcmp(argv[i],"-o") == 0) {
|
||||||
Swig_mark_arg(i);
|
Swig_mark_arg(i);
|
||||||
if (argv[i+1]) {
|
if (argv[i+1]) {
|
||||||
|
|
@ -253,7 +253,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
||||||
fprintf(stderr,"Copyright (c) 1995-98\n");
|
fprintf(stderr,"Copyright (c) 1995-98\n");
|
||||||
fprintf(stderr,"University of Utah and the Regents of the University of California\n");
|
fprintf(stderr,"University of Utah and the Regents of the University of California\n");
|
||||||
fprintf(stderr,"\nCompiled with %s\n", SWIG_CC);
|
fprintf(stderr,"\nCompiled with %s\n", SWIG_CC);
|
||||||
SWIG_exit(0);
|
SWIG_exit (EXIT_SUCCESS);
|
||||||
} else if (strncmp(argv[i],"-l",2) == 0) {
|
} else if (strncmp(argv[i],"-l",2) == 0) {
|
||||||
// Add a new directory search path
|
// Add a new directory search path
|
||||||
Append(libfiles,argv[i]+2);
|
Append(libfiles,argv[i]+2);
|
||||||
|
|
@ -287,7 +287,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
||||||
// Parse language dependent options
|
// Parse language dependent options
|
||||||
lang->parse_args(argc,argv);
|
lang->parse_args(argc,argv);
|
||||||
|
|
||||||
if (help) SWIG_exit(0); // Exit if we're in help mode
|
if (help) SWIG_exit (EXIT_SUCCESS); // Exit if we're in help mode
|
||||||
|
|
||||||
// Check all of the options to make sure we're cool.
|
// Check all of the options to make sure we're cool.
|
||||||
Swig_check_options();
|
Swig_check_options();
|
||||||
|
|
@ -399,7 +399,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
||||||
String *ds = Swig_include(input_file);
|
String *ds = Swig_include(input_file);
|
||||||
if (!ds) {
|
if (!ds) {
|
||||||
Printf(stderr,"Unable to find '%s'\n", input_file);
|
Printf(stderr,"Unable to find '%s'\n", input_file);
|
||||||
SWIG_exit(1);
|
SWIG_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
if (lang_config) {
|
if (lang_config) {
|
||||||
Printf(fs,"\n%%include \"%s\"\n", lang_config);
|
Printf(fs,"\n%%include \"%s\"\n", lang_config);
|
||||||
|
|
@ -416,7 +416,7 @@ int SWIG_main(int argc, char *argv[], Language *l) {
|
||||||
if (cpp_only) {
|
if (cpp_only) {
|
||||||
Printf(stdout,"%s", cpps);
|
Printf(stdout,"%s", cpps);
|
||||||
while (freeze);
|
while (freeze);
|
||||||
SWIG_exit(0);
|
SWIG_exit (EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Initialize the scanner
|
// Initialize the scanner
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,15 +1,15 @@
|
||||||
/* -----------------------------------------------------------------------------
|
/* -----------------------------------------------------------------------------
|
||||||
* scanner.cxx
|
* scanner.cxx
|
||||||
*
|
*
|
||||||
* SWIG1.1 tokenizer.
|
* SWIG1.1 tokenizer.
|
||||||
*
|
*
|
||||||
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
|
* Author(s) : David Beazley (beazley@cs.uchicago.edu)
|
||||||
*
|
*
|
||||||
* Copyright (C) 1998-2000. The University of Chicago
|
* Copyright (C) 1998-2000. The University of Chicago
|
||||||
* Copyright (C) 1995-1998. The University of Utah and The Regents of the
|
* Copyright (C) 1995-1998. The University of Utah and The Regents of the
|
||||||
* University of California.
|
* University of California.
|
||||||
*
|
*
|
||||||
* See the file LICENSE for information on usage and redistribution.
|
* See the file LICENSE for information on usage and redistribution.
|
||||||
* ----------------------------------------------------------------------------- */
|
* ----------------------------------------------------------------------------- */
|
||||||
|
|
||||||
static char cvsroot[] = "$Header$";
|
static char cvsroot[] = "$Header$";
|
||||||
|
|
@ -29,7 +29,7 @@ struct InFile {
|
||||||
DOHFile *f;
|
DOHFile *f;
|
||||||
int line_number;
|
int line_number;
|
||||||
char *in_file;
|
char *in_file;
|
||||||
int extern_mode;
|
int extern_mode;
|
||||||
int force_extern;
|
int force_extern;
|
||||||
int inline_mode;
|
int inline_mode;
|
||||||
struct InFile *prev;
|
struct InFile *prev;
|
||||||
|
|
@ -40,7 +40,7 @@ InFile *in_head;
|
||||||
DOHFile *LEX_in = 0;
|
DOHFile *LEX_in = 0;
|
||||||
static DOHString *header = 0;
|
static DOHString *header = 0;
|
||||||
static DOHString *comment = 0;
|
static DOHString *comment = 0;
|
||||||
DOHString *CCode = 0; // String containing C code
|
DOHString *CCode = 0; // String containing C code
|
||||||
static char *yybuffer = 0;
|
static char *yybuffer = 0;
|
||||||
|
|
||||||
static char yytext[YYBSIZE];
|
static char yytext[YYBSIZE];
|
||||||
|
|
@ -72,7 +72,7 @@ void scanner_init() {
|
||||||
/**************************************************************
|
/**************************************************************
|
||||||
* scanner_file(FILE *f)
|
* scanner_file(FILE *f)
|
||||||
*
|
*
|
||||||
* Start reading from new file
|
* Start reading from new file
|
||||||
**************************************************************/
|
**************************************************************/
|
||||||
void scanner_file(DOHFile *f) {
|
void scanner_file(DOHFile *f) {
|
||||||
InFile *in;
|
InFile *in;
|
||||||
|
|
@ -80,7 +80,7 @@ void scanner_file(DOHFile *f) {
|
||||||
in = (InFile *) malloc(sizeof(InFile));
|
in = (InFile *) malloc(sizeof(InFile));
|
||||||
in->f = f;
|
in->f = f;
|
||||||
in->in_file = input_file;
|
in->in_file = input_file;
|
||||||
in->extern_mode = WrapExtern;
|
in->extern_mode = WrapExtern;
|
||||||
in->force_extern = ForceExtern;
|
in->force_extern = ForceExtern;
|
||||||
in->inline_mode = 0;
|
in->inline_mode = 0;
|
||||||
if (!in_head) in->prev = 0;
|
if (!in_head) in->prev = 0;
|
||||||
|
|
@ -93,7 +93,7 @@ void scanner_file(DOHFile *f) {
|
||||||
/**************************************************************
|
/**************************************************************
|
||||||
* scanner_close()
|
* scanner_close()
|
||||||
*
|
*
|
||||||
* Close current input file and go to next
|
* Close current input file and go to next
|
||||||
**************************************************************/
|
**************************************************************/
|
||||||
|
|
||||||
void scanner_close() {
|
void scanner_close() {
|
||||||
|
|
@ -127,7 +127,7 @@ void scanner_close() {
|
||||||
|
|
||||||
char nextchar() {
|
char nextchar() {
|
||||||
int c = 0;
|
int c = 0;
|
||||||
|
|
||||||
while (LEX_in) {
|
while (LEX_in) {
|
||||||
c = Getc(LEX_in);
|
c = Getc(LEX_in);
|
||||||
if (c == EOF) {
|
if (c == EOF) {
|
||||||
|
|
@ -139,7 +139,7 @@ char nextchar() {
|
||||||
if (!LEX_in) return 0;
|
if (!LEX_in) return 0;
|
||||||
if (yylen >= YYBSIZE) {
|
if (yylen >= YYBSIZE) {
|
||||||
Printf(stderr,"** FATAL ERROR. Buffer overflow in scanner.cxx.\nReport this to swig-dev@cs.uchicago.edu.\n");
|
Printf(stderr,"** FATAL ERROR. Buffer overflow in scanner.cxx.\nReport this to swig-dev@cs.uchicago.edu.\n");
|
||||||
SWIG_exit(1);
|
SWIG_exit (EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
yytext[yylen] = c;
|
yytext[yylen] = c;
|
||||||
yylen++;
|
yylen++;
|
||||||
|
|
@ -165,7 +165,7 @@ void retract(int n) {
|
||||||
|
|
||||||
/**************************************************************
|
/**************************************************************
|
||||||
* start_inline(char *text, int line)
|
* start_inline(char *text, int line)
|
||||||
*
|
*
|
||||||
* This grabs a chunk of text and tries to inline it into
|
* This grabs a chunk of text and tries to inline it into
|
||||||
* the current file. (This is kind of wild, but cool when
|
* the current file. (This is kind of wild, but cool when
|
||||||
* it works).
|
* it works).
|
||||||
|
|
@ -195,7 +195,7 @@ void start_inline(char *text, int line) {
|
||||||
/**************************************************************
|
/**************************************************************
|
||||||
* yycomment(char *, int line)
|
* yycomment(char *, int line)
|
||||||
*
|
*
|
||||||
* Inserts a comment into a documentation entry.
|
* Inserts a comment into a documentation entry.
|
||||||
**************************************************************/
|
**************************************************************/
|
||||||
|
|
||||||
void yycomment(char *, int, int) {
|
void yycomment(char *, int, int) {
|
||||||
|
|
@ -279,7 +279,7 @@ void skip_to_end(void) {
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if (isspace(c)) {
|
if (isspace(c)) {
|
||||||
if (strncmp(yytext,"@end",4) == 0) return;
|
if (strncmp(yytext,"@end",4) == 0) return;
|
||||||
else {
|
else {
|
||||||
yylen = 0;
|
yylen = 0;
|
||||||
state = 0;
|
state = 0;
|
||||||
|
|
@ -294,7 +294,7 @@ void skip_to_end(void) {
|
||||||
input_file);
|
input_file);
|
||||||
FatalError();
|
FatalError();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************
|
/**************************************************************
|
||||||
* void skip_decl(void)
|
* void skip_decl(void)
|
||||||
|
|
@ -302,8 +302,8 @@ void skip_to_end(void) {
|
||||||
* This tries to skip over an entire declaration. For example
|
* This tries to skip over an entire declaration. For example
|
||||||
*
|
*
|
||||||
* friend ostream& operator<<(ostream&, const char *s);
|
* friend ostream& operator<<(ostream&, const char *s);
|
||||||
*
|
*
|
||||||
* or
|
* or
|
||||||
* friend ostream& operator<<(ostream&, const char *s) { };
|
* friend ostream& operator<<(ostream&, const char *s) { };
|
||||||
*
|
*
|
||||||
**************************************************************/
|
**************************************************************/
|
||||||
|
|
@ -346,7 +346,7 @@ static void get_escape() {
|
||||||
int result = 0;
|
int result = 0;
|
||||||
int state = 0;
|
int state = 0;
|
||||||
char c;
|
char c;
|
||||||
|
|
||||||
while(1) {
|
while(1) {
|
||||||
c = nextchar();
|
c = nextchar();
|
||||||
if (c == 0) break;
|
if (c == 0) break;
|
||||||
|
|
@ -427,9 +427,9 @@ static void get_escape() {
|
||||||
yytext[yylen-1] = (char) result;
|
yytext[yylen-1] = (char) result;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (isdigit(c))
|
if (isdigit(c))
|
||||||
result = (result << 4) + (c - '0');
|
result = (result << 4) + (c - '0');
|
||||||
else
|
else
|
||||||
result = (result << 4) + (10 + tolower(c) - 'a');
|
result = (result << 4) + (10 + tolower(c) - 'a');
|
||||||
yylen--;
|
yylen--;
|
||||||
break;
|
break;
|
||||||
|
|
@ -437,7 +437,7 @@ static void get_escape() {
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************
|
/**************************************************************
|
||||||
* int yylook()
|
* int yylook()
|
||||||
*
|
*
|
||||||
|
|
@ -469,9 +469,9 @@ int yylook(void) {
|
||||||
state = 0;
|
state = 0;
|
||||||
yylen = 0;
|
yylen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Look for single character symbols */
|
/* Look for single character symbols */
|
||||||
|
|
||||||
else if (c == '(') return (LPAREN);
|
else if (c == '(') return (LPAREN);
|
||||||
else if (c == ')') return (RPAREN);
|
else if (c == ')') return (RPAREN);
|
||||||
else if (c == ';') return (SEMI);
|
else if (c == ';') return (SEMI);
|
||||||
|
|
@ -502,7 +502,7 @@ int yylook(void) {
|
||||||
else if (c == '<') state = 60;
|
else if (c == '<') state = 60;
|
||||||
else if (c == '>') state = 61;
|
else if (c == '>') state = 61;
|
||||||
else if (c == '~') return (NOT);
|
else if (c == '~') return (NOT);
|
||||||
else if (c == '!') return (LNOT);
|
else if (c == '!') return (LNOT);
|
||||||
else if (c == '\\') {
|
else if (c == '\\') {
|
||||||
state = 99;
|
state = 99;
|
||||||
}
|
}
|
||||||
|
|
@ -510,8 +510,8 @@ int yylook(void) {
|
||||||
else if (c == ']') return (RBRACKET);
|
else if (c == ']') return (RBRACKET);
|
||||||
|
|
||||||
/* Look for multi-character sequences */
|
/* Look for multi-character sequences */
|
||||||
|
|
||||||
else if (c == '/') state = 1; // Comment (maybe)
|
else if (c == '/') state = 1; // Comment (maybe)
|
||||||
else if (c == '\"') state = 2; // Possibly a string
|
else if (c == '\"') state = 2; // Possibly a string
|
||||||
else if (c == '#') state = 3; // CPP
|
else if (c == '#') state = 3; // CPP
|
||||||
else if (c == '%') state = 4; // Directive
|
else if (c == '%') state = 4; // Directive
|
||||||
|
|
@ -639,7 +639,7 @@ int yylook(void) {
|
||||||
state = 99;
|
state = 99;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 40: /* Process an include block */
|
case 40: /* Process an include block */
|
||||||
if ((c = nextchar()) == 0) {
|
if ((c = nextchar()) == 0) {
|
||||||
Printf(stderr,"%s : EOF. Unterminated include block detected.\n", input_file);
|
Printf(stderr,"%s : EOF. Unterminated include block detected.\n", input_file);
|
||||||
|
|
@ -689,7 +689,7 @@ int yylook(void) {
|
||||||
return LESSTHAN;
|
return LESSTHAN;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 61:
|
case 61:
|
||||||
if ((c = nextchar()) == 0) return (0);
|
if ((c = nextchar()) == 0) return (0);
|
||||||
if (c == '>') return RSHIFT;
|
if (c == '>') return RSHIFT;
|
||||||
else {
|
else {
|
||||||
|
|
@ -834,7 +834,7 @@ int yylook(void) {
|
||||||
yytext[yylen] = 0;
|
yytext[yylen] = 0;
|
||||||
yylval.id = Swig_copy_string(yytext);
|
yylval.id = Swig_copy_string(yytext);
|
||||||
return(NUM_LONG);
|
return(NUM_LONG);
|
||||||
}
|
}
|
||||||
|
|
||||||
case 88:
|
case 88:
|
||||||
/* An unsigned integer of some sort */
|
/* An unsigned integer of some sort */
|
||||||
|
|
@ -848,7 +848,7 @@ int yylook(void) {
|
||||||
yytext[yylen] = 0;
|
yytext[yylen] = 0;
|
||||||
yylval.id = Swig_copy_string(yytext);
|
yylval.id = Swig_copy_string(yytext);
|
||||||
return(NUM_UNSIGNED);
|
return(NUM_UNSIGNED);
|
||||||
}
|
}
|
||||||
|
|
||||||
case 9:
|
case 9:
|
||||||
if ((c = nextchar()) == 0) return (0);
|
if ((c = nextchar()) == 0) return (0);
|
||||||
|
|
@ -884,8 +884,8 @@ int yylook(void) {
|
||||||
Printf(stderr,"%s : Line %d ::Illegal character '%c'=%d.\n",input_file, line_number,c,c);
|
Printf(stderr,"%s : Line %d ::Illegal character '%c'=%d.\n",input_file, line_number,c,c);
|
||||||
FatalError();
|
FatalError();
|
||||||
}
|
}
|
||||||
state = 0;
|
state = 0;
|
||||||
Error = 1;
|
Error = 1;
|
||||||
return(ILLEGAL);
|
return(ILLEGAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -909,7 +909,7 @@ void scanner_ignore_typedef() {
|
||||||
*************************************************************/
|
*************************************************************/
|
||||||
|
|
||||||
extern "C" int yylex(void) {
|
extern "C" int yylex(void) {
|
||||||
|
|
||||||
int l;
|
int l;
|
||||||
|
|
||||||
if (!scan_init) {
|
if (!scan_init) {
|
||||||
|
|
@ -917,10 +917,10 @@ extern "C" int yylex(void) {
|
||||||
// if (LEX_in == NULL) LEX_in = stdin;
|
// if (LEX_in == NULL) LEX_in = stdin;
|
||||||
// scanner_file(LEX_in);
|
// scanner_file(LEX_in);
|
||||||
}
|
}
|
||||||
|
|
||||||
l = yylook();
|
l = yylook();
|
||||||
|
|
||||||
/* We got some sort of non-white space object. We set the start_line
|
/* We got some sort of non-white space object. We set the start_line
|
||||||
variable unless it has already been set */
|
variable unless it has already been set */
|
||||||
|
|
||||||
if (!start_line) {
|
if (!start_line) {
|
||||||
|
|
@ -978,7 +978,7 @@ extern "C" int yylex(void) {
|
||||||
return(TYPE_BOOL);
|
return(TYPE_BOOL);
|
||||||
}
|
}
|
||||||
// C++ keywords
|
// C++ keywords
|
||||||
|
|
||||||
if (CPlusPlus) {
|
if (CPlusPlus) {
|
||||||
if (strcmp(yytext,"class") == 0) return(CLASS);
|
if (strcmp(yytext,"class") == 0) return(CLASS);
|
||||||
if (strcmp(yytext,"private") == 0) return(PRIVATE);
|
if (strcmp(yytext,"private") == 0) return(PRIVATE);
|
||||||
|
|
@ -1020,7 +1020,7 @@ extern "C" int yylex(void) {
|
||||||
return(TYPEDEF);
|
return(TYPEDEF);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignored keywords
|
// Ignored keywords
|
||||||
|
|
||||||
if (strcmp(yytext,"volatile") == 0) return(yylex());
|
if (strcmp(yytext,"volatile") == 0) return(yylex());
|
||||||
|
|
||||||
|
|
@ -1049,7 +1049,7 @@ extern "C" int yylex(void) {
|
||||||
}
|
}
|
||||||
if (strcmp(yytext,"%constant") == 0) return(CONSTANT);
|
if (strcmp(yytext,"%constant") == 0) return(CONSTANT);
|
||||||
if (strcmp(yytext,"%macro") == 0) return(SWIGMACRO);
|
if (strcmp(yytext,"%macro") == 0) return(SWIGMACRO);
|
||||||
|
|
||||||
if (strcmp(yytext,"%section") == 0) {
|
if (strcmp(yytext,"%section") == 0) {
|
||||||
yylval.ivalue = line_number;
|
yylval.ivalue = line_number;
|
||||||
return(SECTION);
|
return(SECTION);
|
||||||
|
|
@ -1065,7 +1065,7 @@ extern "C" int yylex(void) {
|
||||||
if (strcmp(yytext,"%title") == 0) {
|
if (strcmp(yytext,"%title") == 0) {
|
||||||
yylval.ivalue = line_number;
|
yylval.ivalue = line_number;
|
||||||
return(TITLE);
|
return(TITLE);
|
||||||
}
|
}
|
||||||
if (strcmp(yytext,"%style") == 0) return(STYLE);
|
if (strcmp(yytext,"%style") == 0) return(STYLE);
|
||||||
if (strcmp(yytext,"%localstyle") == 0) return(LOCALSTYLE);
|
if (strcmp(yytext,"%localstyle") == 0) return(LOCALSTYLE);
|
||||||
if (strcmp(yytext,"%typedef") == 0) {
|
if (strcmp(yytext,"%typedef") == 0) {
|
||||||
|
|
@ -1092,14 +1092,14 @@ extern "C" int yylex(void) {
|
||||||
}
|
}
|
||||||
// Have an unknown identifier, as a last step, we'll
|
// Have an unknown identifier, as a last step, we'll
|
||||||
// do a typedef lookup on it.
|
// do a typedef lookup on it.
|
||||||
|
|
||||||
if (check_typedef) {
|
if (check_typedef) {
|
||||||
if (SwigType_istypedef(yytext)) {
|
if (SwigType_istypedef(yytext)) {
|
||||||
yylval.type = NewString(yytext);
|
yylval.type = NewString(yytext);
|
||||||
return(TYPE_TYPEDEF);
|
return(TYPE_TYPEDEF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
yylval.id = Swig_copy_string(yytext);
|
yylval.id = Swig_copy_string(yytext);
|
||||||
return(ID);
|
return(ID);
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ extern char output_dir[512]; // Output directory
|
||||||
extern int Verbose;
|
extern int Verbose;
|
||||||
extern int IsVirtual;
|
extern int IsVirtual;
|
||||||
|
|
||||||
#define FatalError() if ((error_count++) > 20) { fprintf(stderr,"Confused by earlier errors. Bailing out\n"); SWIG_exit(1); }
|
#define FatalError() if ((error_count++) > 20) { fprintf(stderr,"Confused by earlier errors. Bailing out\n"); SWIG_exit (EXIT_FAILURE); }
|
||||||
|
|
||||||
/* Miscellaneous stuff */
|
/* Miscellaneous stuff */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue