summaryrefslogtreecommitdiffstats
path: root/devel/swig13/files
diff options
context:
space:
mode:
Diffstat (limited to 'devel/swig13/files')
-rw-r--r--devel/swig13/files/patch-Lib::guile::guile.swg38
-rw-r--r--devel/swig13/files/patch-Lib::guile::guiledec.swg16
-rw-r--r--devel/swig13/files/patch-Lib::guile::guilemain.i34
-rw-r--r--devel/swig13/files/patch-Lib::guile::typemaps.i154
-rw-r--r--devel/swig13/files/patch-Source::Modules1.1::guile.cxx107
5 files changed, 349 insertions, 0 deletions
diff --git a/devel/swig13/files/patch-Lib::guile::guile.swg b/devel/swig13/files/patch-Lib::guile::guile.swg
new file mode 100644
index 0000000..7341ee1
--- /dev/null
+++ b/devel/swig13/files/patch-Lib::guile::guile.swg
@@ -0,0 +1,38 @@
+diff -urN ../SWIG1.3a5/Lib/guile/guile.swg ./Lib/guile/guile.swg
+--- ../SWIG1.3a5/Lib/guile/guile.swg Sat Sep 2 11:25:27 2000
++++ ./Lib/guile/guile.swg Tue Feb 27 06:12:33 2001
+@@ -7,6 +7,10 @@
+
+ /* SWIG pointer structure */
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ struct SwigCast {
+ unsigned short type; /* Index into SwigPtrTbl */
+ void *(*cast)(void *); /* Pointer casting function */
+@@ -140,7 +144,7 @@
+ int start, end;
+ size_t *result;
+ if (!SwigPtrSort) SWIG_SortTable();
+- result = bsearch(_t, SwigPtrTbl, SwigPtrN, sizeof(size_t), swigcmp);
++ result = (size_t *) bsearch(_t, SwigPtrTbl, SwigPtrN, sizeof(size_t), swigcmp);
+ if (result!=NULL) return SwigPtrList+*result;
+ else return NULL;
+ }
+@@ -246,10 +250,11 @@
+ /* Convert datatype table */
+
+ SWIGSTATIC
+-void SWIG_Guile_RegisterTypes(swig_type_info **table)
++void SWIG_Guile_RegisterTypes(swig_type_info **table,
++ swig_type_info **init)
+ {
+- for (; *table; table++) {
+- swig_type_info *type = *table;
++ for (; *init; table++, init++) {
++ swig_type_info *type = *table = *init;
+ char *origname = type->name;
+ /* Register datatype itself and store pointer back */
+ type->tag = SWIG_RegisterType(origname, type->str);
diff --git a/devel/swig13/files/patch-Lib::guile::guiledec.swg b/devel/swig13/files/patch-Lib::guile::guiledec.swg
new file mode 100644
index 0000000..970c19b
--- /dev/null
+++ b/devel/swig13/files/patch-Lib::guile::guiledec.swg
@@ -0,0 +1,16 @@
+diff -urN ../SWIG1.3a5/Lib/guile/guiledec.swg ./Lib/guile/guiledec.swg
+--- ../SWIG1.3a5/Lib/guile/guiledec.swg Thu Sep 21 16:06:17 2000
++++ ./Lib/guile/guiledec.swg Tue Feb 27 06:12:33 2001
+@@ -78,10 +78,9 @@
+ size_t tag;
+ } swig_type_info;
+
+-#define swig_types_initial swig_types
+-
+ SWIGSTATIC void
+-SWIG_Guile_RegisterTypes (swig_type_info **table);
++SWIG_Guile_RegisterTypes (swig_type_info **table,
++ swig_type_info **init);
+
+ /* Register a new type-mapping with the type-checker. origtype is the
+ original datatype and newtype is an equivalent type. cast is optional
diff --git a/devel/swig13/files/patch-Lib::guile::guilemain.i b/devel/swig13/files/patch-Lib::guile::guilemain.i
new file mode 100644
index 0000000..613a294
--- /dev/null
+++ b/devel/swig13/files/patch-Lib::guile::guilemain.i
@@ -0,0 +1,34 @@
+diff -urN ../SWIG1.3a5/Lib/guile/guilemain.i ./Lib/guile/guilemain.i
+--- ../SWIG1.3a5/Lib/guile/guilemain.i Sun Sep 3 15:06:32 2000
++++ ./Lib/guile/guilemain.i Tue Feb 27 06:12:33 2001
+@@ -7,7 +7,7 @@
+ * Wrapper and Interface Generator (SWIG 1.1)
+ *
+ * - Automatic Version Information via RCS/CVS:
+-* $Id: guilemain.i,v 1.4 2000/09/03 20:06:32 mkoeppe Exp $
++* $Id: guilemain.i,v 1.4.2.1 2001/02/26 17:57:56 mkoeppe Exp $
+ * $Source: /cvs/projects/SWIG/Lib/guile/guilemain.i,v $
+ *
+ * This program is free software; you can redistribute it and/or modify
+@@ -27,6 +27,10 @@
+ %{
+ #include <libguile.h>
+
++#ifdef __cplusplus
++extern "C" {
++#endif
++
+ /* Debugger interface (don't change the order of the following lines) */
+ #define GDB_TYPE SCM
+ #include <libguile/gdb_interface.h>
+@@ -43,6 +47,10 @@
+ scm_shell(argc, argv); /* scheme interpreter */
+ /* never reached: scm_shell will perform an exit */
+ }
++
++#ifdef __cplusplus
++}
++#endif
+
+ int
+ main(int argc, char **argv)
diff --git a/devel/swig13/files/patch-Lib::guile::typemaps.i b/devel/swig13/files/patch-Lib::guile::typemaps.i
new file mode 100644
index 0000000..0826663
--- /dev/null
+++ b/devel/swig13/files/patch-Lib::guile::typemaps.i
@@ -0,0 +1,154 @@
+diff -urN ../SWIG1.3a5/Lib/guile/typemaps.i ./Lib/guile/typemaps.i
+--- ../SWIG1.3a5/Lib/guile/typemaps.i Thu Sep 21 16:06:17 2000
++++ ./Lib/guile/typemaps.i Tue Feb 27 06:17:46 2001
+@@ -49,6 +49,150 @@
+ SIMPLE_MAP(char *, GSWIG_scm2str, gh_str02scm, string);
+ SIMPLE_MAP(const char *, GSWIG_scm2str, gh_str02scm, string);
+
++
++
++
++%define SIMPLE_MAP_STR(C_NAME, SCM_TO_C, C_TO_SCM, SCM_NAME)
++ %typemap (guile, in) C_NAME { char* x; x=SCM_TO_C($source); $target = new string(x); scm_must_free(x);};
++ %typemap (guile, varin) C_NAME { char* x; x=SCM_TO_C($source); $target = new string(x); scm_must_free(x);};
++ %typemap (guile, out) C_NAME "$target = C_TO_SCM($source->c_str());";
++ %typemap (guile, varout) C_NAME "$target = C_TO_SCM($source->c_str());";
++%enddef
++
++SIMPLE_MAP_STR(string , GSWIG_scm2str, gh_str02scm, string);
++SIMPLE_MAP_STR(string&, GSWIG_scm2str, gh_str02scm, string);
++SIMPLE_MAP_STR(const string , GSWIG_scm2str, gh_str02scm, string);
++SIMPLE_MAP_STR(const string&, GSWIG_scm2str, gh_str02scm, string);
++
++%typemap (guile, freearg) string, string&, const string, const string& "if ($target) delete $target;";
++
++
++
++
++%typemap (guile, in) vector<string> (vector<string> temp) {
++
++ SCM v = gh_list_to_vector( $source );
++ unsigned long len = gh_vector_length (v);
++ unsigned long i=0;
++
++ $target = new vector<string>();
++
++ for( i=0; i<len; i++)
++ {
++ // cerr << " copying i:" << i << endl;
++ SCM scm_i = gh_ulong2scm(i);
++ SCM scm_str = gh_vector_ref( v, scm_i );
++ char* x = GSWIG_scm2str(scm_str);
++ $target->push_back(string(x));
++ scm_must_free(x);
++ }
++
++};
++%typemap (guile, freearg) vector<string> "if ($target) delete $target;";
++
++
++%typemap (guile, out) vector<string> {
++
++ int i=0;
++ int count = $source->size();
++
++ cerr << " convert vector<> to scheme world" << endl;
++
++ if( !count )
++ {
++ $target = gh_list( SCM_UNDEFINED );
++ }
++ else
++ {
++ const string& s = (*$source)[count-1];
++ cerr << " convert vector<> to scheme world 2... s: " << s << endl;
++ $target = gh_list( gh_str02scm( s.c_str()), SCM_UNDEFINED );
++ cerr << " convert vector<> to scheme world 3 " << endl;
++
++ for( i=count-2; i>=0; i-- )
++ {
++ cerr << " convert vector<> to scheme world i:" << i << endl;
++ const string& s = (*$source)[i];
++ $target = gh_cons( gh_str02scm( s.c_str()), $target );
++ }
++ }
++};
++
++
++%typemap (guile, out) vector<foo*> {
++
++///////////////////////////////////////////////////////////////////////////////
++///////////////////////////////////////////////////////////////////////////////
++
++ swig_type_info *element_type_mangled_name = SWIGTYPE_p_foo;
++ typedef foo* element_type;
++
++///////////////////////////////////////////////////////////////////////////////
++///////////////////////////////////////////////////////////////////////////////
++
++ int i=0;
++ int count = $source->size();
++
++ if( !count )
++ {
++ $target = gh_list( SCM_UNDEFINED );
++ }
++ else
++ {
++ element_type s = (*$source)[count-1];
++ SCM s_scm = SWIG_Guile_MakePtr( s, element_type_mangled_name );
++ $target = gh_list( s_scm, SCM_UNDEFINED );
++
++ for( i=count-2; i>=0; i-- )
++ {
++ element_type s = (*$source)[i];
++ s_scm = SWIG_Guile_MakePtr( s, element_type_mangled_name );
++ $target = gh_cons( s_scm , $target );
++ }
++ }
++
++};
++
++
++
++
++
++%typemap (guile, out) vector<Witme_DirItem*> {
++
++///////////////////////////////////////////////////////////////////////////////
++///////////////////////////////////////////////////////////////////////////////
++
++ swig_type_info *element_type_mangled_name = SWIGTYPE_p_Witme_DirItem;
++ typedef Witme_DirItem* element_type;
++
++///////////////////////////////////////////////////////////////////////////////
++///////////////////////////////////////////////////////////////////////////////
++
++ int i=0;
++ int count = $source->size();
++
++ if( !count )
++ {
++ $target = gh_list( SCM_UNDEFINED );
++ }
++ else
++ {
++ element_type s = (*$source)[count-1];
++ SCM s_scm = SWIG_Guile_MakePtr( s, element_type_mangled_name );
++ $target = gh_list( s_scm, SCM_UNDEFINED );
++
++ for( i=count-2; i>=0; i-- )
++ {
++ element_type s = (*$source)[i];
++ s_scm = SWIG_Guile_MakePtr( s, element_type_mangled_name );
++ $target = gh_cons( s_scm , $target );
++ }
++ }
++
++};
++
++
++
+ /* GSWIG_scm2str makes a malloc'ed copy of the string, so get rid of it after
+ the function call. */
+
diff --git a/devel/swig13/files/patch-Source::Modules1.1::guile.cxx b/devel/swig13/files/patch-Source::Modules1.1::guile.cxx
new file mode 100644
index 0000000..56379bc
--- /dev/null
+++ b/devel/swig13/files/patch-Source::Modules1.1::guile.cxx
@@ -0,0 +1,107 @@
+diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
+--- ../SWIG1.3a5/Source/Modules1.1/guile.cxx Wed Sep 20 09:00:56 2000
++++ ./Source/Modules1.1/guile.cxx Tue Feb 27 06:12:33 2001
+@@ -13,10 +13,10 @@
+ * can be used and distributed.
+ *****************************************************************************/
+
+-static char cvsroot[] = "$Header: /cvs/projects/SWIG/Source/Modules1.1/guile.cxx,v 1.68 2000/09/20 14:00:56 mkoeppe Exp $";
++static char cvsroot[] = "$Header: /cvs/projects/SWIG/Source/Modules1.1/guile.cxx,v 1.68.2.3 2001/02/26 17:57:56 mkoeppe Exp $";
+
+ /***********************************************************************
+- * $Header: /cvs/projects/SWIG/Source/Modules1.1/guile.cxx,v 1.68 2000/09/20 14:00:56 mkoeppe Exp $
++ * $Header: /cvs/projects/SWIG/Source/Modules1.1/guile.cxx,v 1.68.2.3 2001/02/26 17:57:56 mkoeppe Exp $
+ *
+ * guile.cxx
+ *
+@@ -252,6 +252,9 @@
+ void
+ GUILE::initialize (void)
+ {
++ if (CPlusPlus) {
++ Printf(f_runtime, "extern \"C\" {\n\n");
++ }
+ switch (linkage) {
+ case GUILE_LSTYLE_SIMPLE:
+ /* Simple linkage; we have to export the SWIG_init function. The user can
+@@ -328,7 +331,7 @@
+ {
+ SwigType_emit_type_table (f_runtime, f_wrappers);
+
+- Printf (f_init, "SWIG_Guile_RegisterTypes(swig_types);\n");
++ Printf (f_init, "SWIG_Guile_RegisterTypes(swig_types, swig_types_initial);\n");
+ Printf (f_init, "}\n\n");
+ char module_name[256];
+
+@@ -341,7 +344,10 @@
+ strcpy(module_name,module);
+ }
+ emit_linkage (module_name);
+-
++ if (CPlusPlus) {
++ Printf(f_init, "\n}\n");
++ }
++
+ if (procdoc) {
+ Delete(procdoc);
+ procdoc = NULL;
+@@ -662,7 +668,7 @@
+ Printv(f_wrappers, ");\n", 0);
+ Printv(f_wrappers, "}\n", 0);
+ /* Register it */
+- Printf (f_init, "gh_new_procedure(\"%s\", %s_rest, 0, 0, 1);\n",
++ Printf (f_init, "gh_new_procedure(\"%s\", (SCM (*) ()) %s_rest, 0, 0, 1);\n",
+ proc_name, wname, numargs-numopt, numopt);
+ }
+ else if (emit_setters && struct_member && strlen(Char(proc_name))>3) {
+@@ -675,7 +681,7 @@
+ struct_member = 2; /* have a setter */
+ }
+ else Printf(f_init, "SCM getter = ");
+- Printf (f_init, "gh_new_procedure(\"%s\", %s, %d, %d, 0);\n",
++ Printf (f_init, "gh_new_procedure(\"%s\", (SCM (*) ()) %s, %d, %d, 0);\n",
+ proc_name, wname, numargs-numopt, numopt);
+ if (!is_setter) {
+ /* Strip off "-get" */
+@@ -698,7 +704,7 @@
+ }
+ else {
+ /* Register the function */
+- Printf (f_init, "gh_new_procedure(\"%s\", %s, %d, %d, 0);\n",
++ Printf (f_init, "gh_new_procedure(\"%s\", (SCM (*) ()) %s, %d, %d, 0);\n",
+ proc_name, wname, numargs-numopt, numopt);
+ }
+ if (procdoc) {
+@@ -751,7 +757,7 @@
+
+ if ((SwigType_type(t) != T_USER) || (is_a_pointer(t))) {
+
+- Printf (f_wrappers, "SCM %s(SCM s_0) {\n", var_name);
++ Printf (f_wrappers, "static SCM %s(SCM s_0)\n{\n", var_name);
+
+ if (!(Status & STAT_READONLY) && SwigType_type(t) == T_STRING) {
+ Printf (f_wrappers, "\t char *_temp;\n");
+@@ -821,7 +827,7 @@
+ throw_unhandled_guile_type_error (t);
+ }
+ Printf (f_wrappers, "\t return gswig_result;\n");
+- Printf (f_wrappers, "}\n");
++ Printf (f_wrappers, "}\n\n");
+
+ // Now add symbol to the Guile interpreter
+
+@@ -829,12 +835,12 @@
+ || Status & STAT_READONLY) {
+ /* Read-only variables become a simple procedure returning the
+ value. */
+- Printf (f_init, "\t gh_new_procedure(\"%s\", %s, 0, 1, 0);\n",
++ Printf (f_init, "\t gh_new_procedure(\"%s\", (SCM (*) ()) %s, 0, 1, 0);\n",
+ proc_name, var_name);
+ }
+ else {
+ /* Read/write variables become a procedure with setter. */
+- Printf (f_init, "\t{ SCM p = gh_new_procedure(\"%s\", %s, 0, 1, 0);\n",
++ Printf (f_init, "\t{ SCM p = gh_new_procedure(\"%s\", (SCM (*) ()) %s, 0, 1, 0);\n",
+ proc_name, var_name);
+ Printf (f_init, "\t gh_define(\"%s\", "
+ "scm_make_procedure_with_setter(p, p)); }\n",
OpenPOWER on IntegriCloud