Wide range of minor bug fixes and improvements.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@966 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Dave Beazley 2000-12-22 04:27:51 +00:00
commit ce983e3203
10 changed files with 132 additions and 28 deletions

View file

@ -250,5 +250,3 @@ int check_numopt(ParmList *p) {

View file

@ -240,7 +240,16 @@ int swig11_file(DOH *node, void *clientdata) {
int swig11_scope(DOH *node, void *clientdata) {
DOH *c;
String *name;
int oldnative = Native;
c = Getchild(node);
name = Getname(node);
if (name && (Cmp(name,"native") == 0)) {
Native = 1;
Swig_emit_all(c,clientdata);
Native = oldnative;
return 0;
}
Swig_typemap_new_scope();
Swig_emit_all(c,clientdata);
Swig_typemap_pop_scope();
@ -308,6 +317,8 @@ int swig11_pragma(DOH *node, void *clientdata) {
ReadOnly = 1;
} else if (Cmp(name,"readwrite") == 0) {
ReadOnly = 0;
} else if (Cmp(name,"name") == 0) {
new_name = value;
}
lang->pragma(node);
return 0;
@ -453,7 +464,12 @@ int swig11_function(DOH *node, void *clientdata) {
/* Can't wrap a static function. Oh well. */
if (is_static) return 0;
emit_extern_func(node,f_header);
lang->function(node);
if (Native) {
lang->nativefunction(node);
} else {
lang->function(node);
}
}
return 0;
}
@ -471,6 +487,11 @@ int swig11_variable(DOH *node, void *clientdata) {
if (WrapExtern) return 0;
if (Access != PUBLIC) return 0;
if (Native) {
Printf(stderr,"%s:%d. Can't wrap variables in %%native mode (ignored).\n", Getfile(node),Getline(node));
return 0;
}
type = Gettype(node);
is_static = check_static(node);
@ -579,6 +600,11 @@ int swig11_class(DOH *node, void *clientdata) {
Setattr(class_hash,name,node);
if (WrapExtern) return 0;
if (Native) {
Printf(stderr,"%s:%d. Can't wrap structures or classes in %%native mode (ignored).\n", Getfile(node),Getline(node));
return 0;
}
set_scriptname(node);
class_name = name;

View file

@ -992,7 +992,14 @@ PYTHON::nativefunction(DOH *node) {
name = GetChar(node,"scriptname");
funcname = GetChar(node,"name");
add_method(name, funcname,0);
/* Figure out what kind of function this is */
if (Swig_proto_cmp("f(p.PyObject,p.PyObject).p.PyObject",node) == 0) {
/* Not with keyword arguments */
add_method(name,funcname,0);
}
if (Swig_proto_cmp("f(p.PyObject,p.PyObject,p.PyObject).p.PyObject",node) == 0) {
add_method(name,funcname,1);
}
if (shadow) {
Printv(func, name, " = ", module, ".", name, "\n\n", 0);
}

View file

@ -926,7 +926,17 @@ TCL8::nativefunction(DOH *node) {
name = GetChar(node,"scriptname");
funcname = GetChar(node,"name");
Printf(f_init,"\t Tcl_CreateObjCommand(interp, SWIG_prefix \"%s\", %s, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);\n",name, funcname);
if ((Swig_proto_cmp("f(ClientData,p.Tcl_Interp,int,p.p.Tcl_Obj).int", node) == 0) ||
(Swig_proto_cmp("f(ClientData,p.Tcl_Interp,int,a().p.Tcl_Obj).int", node) == 0)) {
Printf(f_init,"\t Tcl_CreateObjCommand(interp, SWIG_prefix \"%s\", %s, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);\n",name, funcname);
}
if ((Swig_proto_cmp("f(ClientData,p.Tcl_Interp,int,p.p.char).int", node) == 0) ||
(Swig_proto_cmp("f(ClientData,p.Tcl_Interp,int,a().p.char).int", node) == 0)) {
Printf(f_init,"\t Tcl_CreateCommand(interp, SWIG_prefix \"%s\", %s, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL);\n",name, funcname);
}
}
/* -----------------------------------------------------------------------------