Bug fixes

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@729 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2000-08-30 16:29:53 +00:00
commit 23068fcf8f
2 changed files with 16 additions and 10 deletions

View file

@ -529,12 +529,23 @@ TCL8::create_function(char *name, char *iname, SwigType *d, ParmList *l) {
void void
TCL8::link_variable(char *name, char *iname, SwigType *t) { TCL8::link_variable(char *name, char *iname, SwigType *t) {
String *new_name = 0;
int isarray = 0;
/* See if there were any typemaps */ /* See if there were any typemaps */
if (Swig_typemap_search((char *)"varin",t,name) || (Swig_typemap_search((char*)"varout",t,name))) { if (Swig_typemap_search((char *)"varin",t,name) || (Swig_typemap_search((char*)"varout",t,name))) {
Printf(stderr,"%s : Line %d. Warning. varin/varout typemap methods not supported.", Printf(stderr,"%s : Line %d. Warning. varin/varout typemap methods not supported.",
input_file, line_number); input_file, line_number);
} }
isarray = SwigType_isarray(t);
if (isarray) {
Printf(stderr,"%s:%d: Array variable '%s' will be read-only.\n", input_file, line_number, name);
new_name = NewStringf("_swig_%s",name);
Printf(f_wrappers,"static %s = (%s) %s;\n", SwigType_lstr(t,new_name), SwigType_lstr(t,0), name);
name = Char(new_name);
}
/* Dump a collection of set/get functions suitable for variable tracing */ /* Dump a collection of set/get functions suitable for variable tracing */
if (!Getattr(setget,SwigType_lstr(t,0))) { if (!Getattr(setget,SwigType_lstr(t,0))) {
Setattr(setget,SwigType_lstr(t,0),"1"); Setattr(setget,SwigType_lstr(t,0),"1");
@ -673,7 +684,7 @@ TCL8::link_variable(char *name, char *iname, SwigType *t) {
} }
Printv(var_info, tab4,"{ SWIG_prefix \"", iname, "\", (void *) &", name, ", _swig_", SwigType_manglestr(t), "_get,", 0); Printv(var_info, tab4,"{ SWIG_prefix \"", iname, "\", (void *) &", name, ", _swig_", SwigType_manglestr(t), "_get,", 0);
if (Status & STAT_READONLY) { if ((Status & STAT_READONLY) || (isarray)) {
static int readonly = 0; static int readonly = 0;
if (!readonly) { if (!readonly) {
Wrapper *ro = NewWrapper(); Wrapper *ro = NewWrapper();
@ -687,6 +698,7 @@ TCL8::link_variable(char *name, char *iname, SwigType *t) {
} else { } else {
Printv(var_info, "_swig_", SwigType_manglestr(t), "_set},\n",0); Printv(var_info, "_swig_", SwigType_manglestr(t), "_set},\n",0);
} }
Delete(new_name);
} }
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------

View file

@ -842,7 +842,6 @@ statement : INCLUDE STRING LBRACE {
| HBLOCK { | HBLOCK {
if (!WrapExtern) { if (!WrapExtern) {
$1[strlen($1) - 1] = 0; $1[strlen($1) - 1] = 0;
// Printf(f_header,"#line %d \"%s\"\n", start_line, input_file);
Printf(f_header, "%s\n", $1); Printf(f_header, "%s\n", $1);
} }
} }
@ -858,7 +857,6 @@ statement : INCLUDE STRING LBRACE {
| WRAPPER HBLOCK { | WRAPPER HBLOCK {
if (!WrapExtern) { if (!WrapExtern) {
init_language();
$2[strlen($2) - 1] = 0; $2[strlen($2) - 1] = 0;
Printf(f_wrappers,"%s\n",$2); Printf(f_wrappers,"%s\n",$2);
} }
@ -875,7 +873,6 @@ statement : INCLUDE STRING LBRACE {
| INIT HBLOCK { | INIT HBLOCK {
if (!WrapExtern) { if (!WrapExtern) {
init_language();
$2[strlen($2) -1] = 0; $2[strlen($2) -1] = 0;
Printf(f_init,"%s\n", $2); Printf(f_init,"%s\n", $2);
} }
@ -952,9 +949,6 @@ statement : INCLUDE STRING LBRACE {
/* Module directive */ /* Module directive */
| MODULE ID initlist { | MODULE ID initlist {
if ($3.count)
lang->set_module($2);
else
lang->set_module($2); lang->set_module($2);
module_init = 1; module_init = 1;
init_language(); init_language();