+2004-09-23 Ken Raeburn <raeburn@mit.edu>
+
+ * profile.swg: Only include tclsh.i if building for Tcl.
+ (Tcl_SetResult, my_tcl_setresult): Compile hack only if building
+ for Tcl.
+ (%typemap SWIGTYPE *OUTPUT): Initialization is not specific to the
+ scripting language. Add Python code.
+ (%typemap errcode_t, errcode_t*): Add placeholders for Python
+ support.
+
2004-08-28 Ken Raeburn <raeburn@mit.edu>
* prof_file.c (profile_open_file): If an error occurs while
#include "com_err.h"
#include "profile.h"
+#ifdef SWIGTCL
/* Reduce warnings about cast discarding const to just this one, from
every SWIG-generated call to Tcl_SetResult. */
static void my_tcl_setresult(Tcl_Interp *i, const char *str, Tcl_FreeProc *f)
}
#undef Tcl_SetResult
#define Tcl_SetResult my_tcl_setresult
+#endif
%}
%include "typemaps.i"
-%typemap(tcl8,in,numinputs=0) SWIGTYPE *OUTPUT ($1_basetype tmp) {
- $1 = &tmp;
+/* These should perhaps be part of the general SWIG package, maybe? */
+%typemap(in,numinputs=0) SWIGTYPE *OUTPUT ($1_basetype tmp) {
+ /*generic swigtype hack*/ $1 = &tmp;
}
%typemap(tcl8,argout) SWIGTYPE *OUTPUT
- "/*foo*/Tcl_SetObjResult(interp,SWIG_NewInstanceObj((void *) *$1, $*1_descriptor,0));";
+ "/*generic swigtype hack*/ Tcl_SetObjResult(interp,SWIG_NewInstanceObj((void *) *$1, $*1_descriptor,0));";
+%typemap(python,argout) SWIGTYPE *OUTPUT
+ "/*generic swigtype hack*/ resultobj = SWIG_NewPointerObj((void *) *$1, $*1_descriptor,0);";
%module profile
SWIG_fail;
}
}
+%typemap(python,argout) errcode_t* {
+ /* do something with *($1) */ abort();
+}
+%typemap(python,out) errcode_t {
+ /* do something with $1 */ abort();
+}
/* "char **OUTPUT" : Supply a place for the function to stuff one
string pointer. */
errcode_t profile_add_relation(profile_t p, const char **nullterm,
const char *new_val = NULL);
+#ifdef SWIGTCL
%include "tclsh.i"
+#endif