]> git.ipfire.org Git - thirdparty/krb5.git/commitdiff
* profile.swg: Only include tclsh.i if building for Tcl.
authorKen Raeburn <raeburn@mit.edu>
Thu, 23 Sep 2004 22:16:13 +0000 (22:16 +0000)
committerKen Raeburn <raeburn@mit.edu>
Thu, 23 Sep 2004 22:16:13 +0000 (22:16 +0000)
(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.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16782 dc483132-0cff-0310-8789-dd5450dbe970

src/util/profile/ChangeLog
src/util/profile/profile.swg

index d5376ccdb0db7ef025e00a613702c86b9a0602b9..a08a6107d938d9a75d9e0c23c7003d4f3ed0c24e 100644 (file)
@@ -1,3 +1,13 @@
+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
index 5de7093ba911bbaabd5dbc025a827677d9d2b00c..9607343022476199363b5f824a85a6e271d032b2 100644 (file)
@@ -29,6 +29,7 @@
 #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)
@@ -37,15 +38,19 @@ 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
 
@@ -82,6 +87,12 @@ typedef void **iter_t; /* ick */
        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.  */
@@ -239,4 +250,6 @@ errcode_t profile_rename_section(profile_t p, const char **nullterm,
 errcode_t profile_add_relation(profile_t p, const char **nullterm,
                               const char *new_val = NULL);
 
+#ifdef SWIGTCL
 %include "tclsh.i"
+#endif