Lot's of minor bug fixes

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@718 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2000-08-30 03:32:41 +00:00
commit 459759611c
7 changed files with 94 additions and 14 deletions

View file

@ -12,6 +12,9 @@
* 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
get the new type system to work. These need to be put back in at some point. */
static char cvsroot[] = "$Header$";
#include "mod11.h"
@ -20,6 +23,7 @@ static char cvsroot[] = "$Header$";
static char *usage = (char*)"\
Perl5 Options (available with -perl5)\n\
-module name - Set module name\n\
-interface name - Set interface name\n\
-package name - Set package prefix\n\
-static - Omit code related to dynamic loading.\n\
-shadow - Create shadow classes.\n\
@ -32,6 +36,7 @@ static int compat = 0;
static int export_all = 0;
static String *package = 0;
static String *module = 0;
static String *interface = 0;
static String *cmodule = 0;
static String *vinit = 0;
static FILE *f_pm = 0;
@ -95,6 +100,15 @@ PERL5::parse_args(int argc, char *argv[]) {
} else {
Swig_arg_error();
}
} else if(strcmp(argv[i],"-interface") == 0) {
if (argv[i+1]) {
interface = NewString(argv[i+1]);
Swig_mark_arg(i);
Swig_mark_arg(i+1);
i++;
} else {
Swig_arg_error();
}
} else if (strcmp(argv[i],"-module") == 0) {
if (argv[i+1]) {
module = NewString(argv[i+1]);
@ -212,7 +226,7 @@ PERL5::initialize()
if (blessed) {
realpackage = package;
package = NewStringf("%sc",package);
package = interface ? interface : NewStringf("%sc",package);
} else {
realpackage = NewString(package);
}

View file

@ -17,6 +17,7 @@ static char cvsroot[] = "$Header$";
static String *const_code = 0;
static String *shadow_methods = 0;
static String *module = 0;
static String *interface = 0;
static String *global_name = 0;
static int shadow = 0;
static int have_defarg = 0;
@ -38,6 +39,7 @@ static char *usage = (char *)"\
Python Options (available with -python)\n\
-globals name - Set name used to access C global variable ('cvar' by default).\n\
-module name - Set module name\n\
-interface name - Set the lib name\n\
-keyword - Use keyword arguments\n\
-noopt - No optimized shadows (pre 1.5.2)\n\
-opt - Optimized shadow classes (1.5.2 or later)\n\
@ -71,6 +73,18 @@ PYTHON::parse_args(int argc, char *argv[]) {
} else {
Swig_arg_error();
}
/* Added edz@bsn.com */
} else if(strcmp(argv[i],"-interface") == 0) {
if (argv[i+1]) {
interface = NewString(argv[i+1]);
Swig_mark_arg(i);
Swig_mark_arg(i+1);
i++;
} else {
Swig_arg_error();
}
/* end added */
} else if (strcmp(argv[i],"-globals") == 0) {
if (argv[i+1]) {
global_name = NewString(argv[i+1]);
@ -190,14 +204,22 @@ PYTHON::initialize(void) {
}
/* If shadow classing is enabled, we're going to change the module name to "modulec" */
if (shadow) {
sprintf(filen,"%s%s.py", output_dir, Char(module));
// If we don't have an interface then change the module name X to Xc
if (! interface)
Append(module,"c");
if ((f_shadow = fopen(filen,"w")) == 0) {
Printf(stderr,"Unable to open %s\n", filen);
SWIG_exit(0);
}
Printf(f_shadow,"# This file was created automatically by SWIG.\n");
Printf(f_shadow,"import %s\n", module);
Printf(f_shadow,"import %s\n", interface ? interface : module);
// Include some information in the code
Printf(f_header,"\n/*-----------------------------------------------\n @(target):= %s.so\n\
------------------------------------------------*/\n", interface ? interface : module);
if (!noopt)
Printf(f_shadow,"import new\n");
}

View file

@ -116,7 +116,7 @@ TCL8::parse() {
if (NoInclude) {
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");
SWIG_exit(1);
}
@ -124,6 +124,7 @@ TCL8::parse() {
Printf(stderr,"SWIG : Fatal error. Unable to locate 'swigtcl8.swg' in SWIG library.\n");
SWIG_exit(1);
}
*/
yyparse();
}
@ -543,12 +544,14 @@ TCL8::link_variable(char *name, char *iname, SwigType *t) {
Printv(set->def, "static char *_swig_", SwigType_manglestr(t), "_set(ClientData clientData, Tcl_Interp *interp, char *name1, char *name2, int flags) {",0);
Printv(get->def, "static char *_swig_", SwigType_manglestr(t), "_get(ClientData clientData, Tcl_Interp *interp, char *name1, char *name2, int flags) {",0);
SwigType_add_pointer(t);
Wrapper_add_localv(get,"addr",SwigType_lstr(t,0),"addr",0);
Wrapper_add_localv(set,"addr",SwigType_lstr(t,0),"addr",0);
Printv(set->code, "addr = (", SwigType_lstr(t,0), ") clientData;\n", 0);
Printv(get->code, "addr = (", SwigType_lstr(t,0), ") clientData;\n", 0);
SwigType_del_pointer(t);
SwigType *lt = Swig_clocal_type(t);
SwigType_add_pointer(lt);
Wrapper_add_localv(get,"addr",SwigType_lstr(lt,"addr"),0);
Wrapper_add_localv(set,"addr",SwigType_lstr(lt,"addr"),0);
Printv(set->code, "addr = (", SwigType_lstr(lt,0), ") clientData;\n", 0);
Printv(get->code, "addr = (", SwigType_lstr(lt,0), ") clientData;\n", 0);
SwigType_del_pointer(lt);
Delete(lt);
Wrapper_add_local(set, "value", "char *value");
Wrapper_add_local(get, "value", "Tcl_Obj *value");