summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkinori MUSHA <knu@FreeBSD.org>2001-04-24 08:53:52 +0000
committerAkinori MUSHA <knu@FreeBSD.org>2001-04-24 08:53:52 +0000
commitee52e85e34ff9fb441be077c5b62d835e540c6c8 (patch)
treedd06d032de7565178e85268085a8dc78b9bceb5d
parentUpdate to 5.8.1 with lots of bugfixes. Remove the substitution of (diff)
Update the Guile support, from Matthias K,Av(Bppe.
Allow to choose what languages are wanted via the SWIG_LANGUAGE variable. (Thanks, Jacques!) Submitted by: nectar
Notes
Notes: svn path=/head/; revision=41848
-rw-r--r--devel/SWIG-devel/Makefile38
-rw-r--r--devel/SWIG-devel/files/patch-Lib::guile::guile.swg9
-rw-r--r--devel/SWIG-devel/files/patch-Lib::guile::guiledec.swg50
-rw-r--r--devel/SWIG-devel/files/patch-Lib::guile::guilemain.i16
-rw-r--r--devel/SWIG-devel/files/patch-Lib::guile::typemaps.i167
-rw-r--r--devel/SWIG-devel/files/patch-Source::Modules1.1::guile.cxx227
-rw-r--r--devel/SWIG-devel/files/patch-Source::Modules1.1::guile.h32
-rw-r--r--devel/swig13/Makefile38
-rw-r--r--devel/swig13/files/patch-Lib::guile::guile.swg9
-rw-r--r--devel/swig13/files/patch-Lib::guile::guiledec.swg50
-rw-r--r--devel/swig13/files/patch-Lib::guile::guilemain.i16
-rw-r--r--devel/swig13/files/patch-Lib::guile::typemaps.i167
-rw-r--r--devel/swig13/files/patch-Source::Modules1.1::guile.cxx227
-rw-r--r--devel/swig13/files/patch-Source::Modules1.1::guile.h32
-rw-r--r--devel/swig20/Makefile38
-rw-r--r--devel/swig20/files/patch-Lib::guile::guile.swg9
-rw-r--r--devel/swig20/files/patch-Lib::guile::guiledec.swg50
-rw-r--r--devel/swig20/files/patch-Lib::guile::guilemain.i16
-rw-r--r--devel/swig20/files/patch-Lib::guile::typemaps.i167
-rw-r--r--devel/swig20/files/patch-Source::Modules1.1::guile.cxx227
-rw-r--r--devel/swig20/files/patch-Source::Modules1.1::guile.h32
21 files changed, 1005 insertions, 612 deletions
diff --git a/devel/SWIG-devel/Makefile b/devel/SWIG-devel/Makefile
index 0066923358b8..9b096b512703 100644
--- a/devel/SWIG-devel/Makefile
+++ b/devel/SWIG-devel/Makefile
@@ -7,7 +7,7 @@
PORTNAME= swig
PORTVERSION= ${VER}a5
-PORTREVISION= 4
+PORTREVISION= 5
CATEGORIES= devel perl5 python ruby tcl82
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} \
ftp://ftp.rge.com/pub/languages/swig/ \
@@ -17,26 +17,44 @@ DISTNAME= ${PORTNAME}${PORTVERSION}
MAINTAINER= knu@FreeBSD.org
-BUILD_DEPENDS= ${PYTHON_CMD}:${PYTHON_PORTSDIR} \
- ${LOCALBASE}/bin/tclsh8.2:${PORTSDIR}/lang/tcl82
-
VER= 1.3
-USE_PERL5= yes
+SWIG_LANGUAGES?= guile perl python ruby tcl
+.for lang in ${SWIG_LANGUAGES}
+WANT_SWIG_${lang:U}= yes
+.endfor
+
+.if defined(WANT_SWIG_GUILE)
+BUILD_DEPENDS+= guile:${PORTSDIR}/lang/guile
+.endif
+.if defined(WANT_SWIG_PERL)
+USE_PERL5= yes
+.endif
+.if defined(WANT_SWIG_PYTHON)
+USE_PYTHON= yes
+PYTHON_NO_DEPENDS= yes
+BUILD_DEPENDS+= ${PYTHON_CMD}:${PYTHON_PORTSDIR}
+CONFIGURE_ARGS+= --with-pyincl=${PYTHON_INCLUDEDIR} \
+ --with-pylib=${PYTHON_LIBDIR}
+.endif
+.if defined(WANT_SWIG_RUBY)
USE_RUBY= yes
RUBY_NO_RUN_DEPENDS= yes
-PYTHON_VERSION?= python1.5
-PYTHON_NO_DEPENDS= yes
+.endif
+.if defined(WANT_SWIG_TCL)
+BUILD_DEPENDS+= ${LOCALBASE}/bin/tclsh8.2:${PORTSDIR}/lang/tcl82
+CONFIGURE_ARGS+= --with-tclincl=${LOCALBASE}/include/tcl8.2/ \
+ --with-tcllib=${LOCALBASE}/lib/tcl8.2/
+.endif
+
INSTALLS_SHLIB= yes
WRKSRC= ${WRKDIR}/SWIG${PORTVERSION}
USE_LIBTOOL= yes
CONFIGURE_ENV= CFLAGS="${CFLAGS} -fpic -DPIC"
-CONFIGURE_ARGS= --with-tclincl=${PREFIX}/include/tcl8.2/ \
- --with-tcllib=${PREFIX}/lib/tcl8.2/
ALL_TARGET= swig runtime
PLIST_SUB= VER="${VER}"
post-install:
- ${LN} ${PREFIX}/bin/swig ${PREFIX}/bin/swig${VER}
+ ${LN} -f ${PREFIX}/bin/swig ${PREFIX}/bin/swig${VER}
.include <bsd.port.mk>
diff --git a/devel/SWIG-devel/files/patch-Lib::guile::guile.swg b/devel/SWIG-devel/files/patch-Lib::guile::guile.swg
index 7341ee11f990..7be2ea708530 100644
--- a/devel/SWIG-devel/files/patch-Lib::guile::guile.swg
+++ b/devel/SWIG-devel/files/patch-Lib::guile::guile.swg
@@ -1,6 +1,7 @@
-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
+Index: SWIG/Lib/guile/guile.swg
+diff -u SWIG/Lib/guile/guile.swg:1.11 SWIG/Lib/guile/guile.swg:1.11.2.2
+--- Lib/guile/guile.swg:1.11 Sat Sep 2 11:25:27 2000
++++ Lib/guile/guile.swg Mon Feb 26 11:57:56 2001
@@ -7,6 +7,10 @@
/* SWIG pointer structure */
@@ -27,7 +28,7 @@ diff -urN ../SWIG1.3a5/Lib/guile/guile.swg ./Lib/guile/guile.swg
SWIGSTATIC
-void SWIG_Guile_RegisterTypes(swig_type_info **table)
+void SWIG_Guile_RegisterTypes(swig_type_info **table,
-+ swig_type_info **init)
++ swig_type_info **init)
{
- for (; *table; table++) {
- swig_type_info *type = *table;
diff --git a/devel/SWIG-devel/files/patch-Lib::guile::guiledec.swg b/devel/SWIG-devel/files/patch-Lib::guile::guiledec.swg
index 970c19b33ca1..b574debbd13e 100644
--- a/devel/SWIG-devel/files/patch-Lib::guile::guiledec.swg
+++ b/devel/SWIG-devel/files/patch-Lib::guile::guiledec.swg
@@ -1,7 +1,47 @@
-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 @@
+Index: SWIG/Lib/guile/guiledec.swg
+diff -u SWIG/Lib/guile/guiledec.swg:1.13 SWIG/Lib/guile/guiledec.swg:1.13.2.4
+--- Lib/guile/guiledec.swg:1.13 Thu Sep 21 16:06:17 2000
++++ Lib/guile/guiledec.swg Fri Mar 2 07:53:02 2001
+@@ -27,17 +27,29 @@
+ #define GH_NOT_PASSED SCM_UNDEFINED
+ #define GH_UNSPECIFIED SCM_UNSPECIFIED
+
+-#define GUILE_APPEND_RESULT(object) \
+- if (gswig_result == GH_UNSPECIFIED) \
+- gswig_result = object; \
+- else { \
+- if (!gh_pair_p(gswig_result)) \
+- gswig_result = gh_list(gswig_result, object, GH_NOT_PASSED); \
+- else \
+- gswig_result = gh_append2(gswig_result, \
+- gh_list(object, GH_NOT_PASSED)); \
++#define GUILE_APPEND_RESULT(object) \
++ if (gswig_result == GH_UNSPECIFIED) \
++ gswig_result = object; \
++ else { \
++ if (!gswig_list_p) { \
++ gswig_list_p = 1; \
++ gswig_result = gh_list(gswig_result, object, GH_NOT_PASSED); \
++ } \
++ else \
++ gswig_result = gh_append2(gswig_result, \
++ gh_list(object, GH_NOT_PASSED)); \
+ }
+
++/* scm_values was implemented on C level in 1.4.1, and the prototype
++ is not included in libguile.h, so play safe and lookup `values'... */
++#define GUILE_MAYBE_VALUES \
++ if (gswig_list_p) \
++ gswig_result = gh_apply(gh_lookup("values"), gswig_result);
++
++#define GUILE_MAYBE_VECTOR \
++ if (gswig_list_p) \
++ gswig_result = gh_list_to_vector(gswig_result);
++
+ static char *
+ GSWIG_scm2str (SCM s)
+ {
+@@ -78,10 +90,9 @@
size_t tag;
} swig_type_info;
@@ -10,7 +50,7 @@ diff -urN ../SWIG1.3a5/Lib/guile/guiledec.swg ./Lib/guile/guiledec.swg
SWIGSTATIC void
-SWIG_Guile_RegisterTypes (swig_type_info **table);
+SWIG_Guile_RegisterTypes (swig_type_info **table,
-+ swig_type_info **init);
++ 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/SWIG-devel/files/patch-Lib::guile::guilemain.i b/devel/SWIG-devel/files/patch-Lib::guile::guilemain.i
index 613a294d51cb..67bfa7ccbda3 100644
--- a/devel/SWIG-devel/files/patch-Lib::guile::guilemain.i
+++ b/devel/SWIG-devel/files/patch-Lib::guile::guilemain.i
@@ -1,15 +1,7 @@
-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
+Index: SWIG/Lib/guile/guilemain.i
+diff -u SWIG/Lib/guile/guilemain.i:1.4 SWIG/Lib/guile/guilemain.i:1.4.2.1
+--- Lib/guile/guilemain.i:1.4 Sun Sep 3 15:06:32 2000
++++ Lib/guile/guilemain.i Mon Feb 26 11:57:56 2001
@@ -27,6 +27,10 @@
%{
#include <libguile.h>
diff --git a/devel/SWIG-devel/files/patch-Lib::guile::typemaps.i b/devel/SWIG-devel/files/patch-Lib::guile::typemaps.i
index 0826663f96e2..e6343509ebaf 100644
--- a/devel/SWIG-devel/files/patch-Lib::guile::typemaps.i
+++ b/devel/SWIG-devel/files/patch-Lib::guile::typemaps.i
@@ -1,154 +1,25 @@
-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);
+Index: SWIG/Lib/guile/typemaps.i
+diff -u SWIG/Lib/guile/typemaps.i:1.17 SWIG/Lib/guile/typemaps.i:1.17.2.1
+--- Lib/guile/typemaps.i:1.17 Thu Sep 21 16:06:17 2000
++++ Lib/guile/typemaps.i Mon Feb 26 08:51:10 2001
+@@ -54,9 +54,20 @@
+ %typemap (guile, freearg) char *, const char * "if ($target) scm_must_free($target);";
+
++/* But this shall not apply if we try to pass a single char by
++ reference. */
+
++%typemap (guile, freearg) char *OUTPUT, char *BOTH "";
+
+ /* Void */
+
+ %typemap (guile, out) void "gswig_result = GH_UNSPECIFIED;";
+ %typemap (guile, outdoc) void "";
+
-+%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 );
-+ }
-+ }
-+
-+};
-+
-+
++/* SCM is passed through */
+
- /* GSWIG_scm2str makes a malloc'ed copy of the string, so get rid of it after
- the function call. */
++typedef unsigned long SCM;
++%typemap (guile, in) SCM "$target=$source;";
++%typemap (guile, out) SCM "$target=$source;";
+ /* typemaps.i ends here */
diff --git a/devel/SWIG-devel/files/patch-Source::Modules1.1::guile.cxx b/devel/SWIG-devel/files/patch-Source::Modules1.1::guile.cxx
index 56379bc6f449..873ebe3a7735 100644
--- a/devel/SWIG-devel/files/patch-Source::Modules1.1::guile.cxx
+++ b/devel/SWIG-devel/files/patch-Source::Modules1.1::guile.cxx
@@ -1,20 +1,50 @@
-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 @@
+Index: SWIG/Source/Modules1.1/guile.cxx
+diff -u SWIG/Source/Modules1.1/guile.cxx:1.68 SWIG/Source/Modules1.1/guile.cxx:1.68.2.6
+--- Source/Modules1.1/guile.cxx:1.68 Wed Sep 20 09:00:56 2000
++++ Source/Modules1.1/guile.cxx Fri Mar 2 07:53:02 2001
+@@ -32,8 +32,10 @@
+ -prefix name - Use NAME as prefix [default \"gswig_\"]\n\
+ -package name - Set the path of the module [default NULL]\n\
+ -Linkage lstyle - Use linkage protocol LSTYLE [default `ltdlmod']\n\
+- -procdoc file - Output procedure documentation to file\n\
++ -procdoc file - Output procedure documentation to FILE\n\
+ \n\
++ -procdocformat format - Output procedure documentation in FORMAT;\n\
++ one of `guile-1.4', `plain', `texinfo'\n\
+ The module option does not create a guile module with a separate name\n\
+ space. It specifies the name of the initialization function and is\n\
+ called a module here so that it is compadible with the rest of SWIG.\n\
+@@ -59,8 +61,10 @@
+ package = NULL;
+ linkage = GUILE_LSTYLE_SIMPLE;
+ procdoc = NULL;
++ docformat = GUILE_1_4;
+ emit_setters = 0;
+ struct_member = 0;
++ before_return = NULL;
+ }
+
+ // ---------------------------------------------------------------------
+@@ -143,6 +147,18 @@
+ Swig_arg_error();
+ }
+ }
++ else if (strcmp (argv[i], "-procdocformat") == 0) {
++ if (strcmp(argv[i+1], "guile-1.4") == 0)
++ docformat = GUILE_1_4;
++ else if (strcmp(argv[i+1], "plain") == 0)
++ docformat = PLAIN;
++ else if (strcmp(argv[i+1], "texinfo") == 0)
++ docformat = TEXINFO;
++ else Swig_arg_error();
++ Swig_mark_arg(i);
++ Swig_mark_arg(i+1);
++ i++;
++ }
+ else if (strcmp (argv[i], "-emit-setters") == 0) {
+ emit_setters = 1;
+ Swig_mark_arg (i);
+@@ -252,6 +268,9 @@
void
GUILE::initialize (void)
{
@@ -24,7 +54,7 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
switch (linkage) {
case GUILE_LSTYLE_SIMPLE:
/* Simple linkage; we have to export the SWIG_init function. The user can
-@@ -328,7 +331,7 @@
+@@ -328,7 +347,7 @@
{
SwigType_emit_type_table (f_runtime, f_wrappers);
@@ -33,7 +63,7 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
Printf (f_init, "}\n\n");
char module_name[256];
-@@ -341,7 +344,10 @@
+@@ -341,7 +360,10 @@
strcpy(module_name,module);
}
emit_linkage (module_name);
@@ -45,7 +75,80 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
if (procdoc) {
Delete(procdoc);
procdoc = NULL;
-@@ -662,7 +668,7 @@
+@@ -460,6 +482,35 @@
+ error_count++;
+ }
+
++
++/* Write out procedure documentation */
++
++void
++GUILE::write_doc(const String *proc_name,
++ const String *signature,
++ const String *doc)
++{
++ switch (docformat) {
++ case GUILE_1_4:
++ Printv(procdoc, "\f\n", 0);
++ Printv(procdoc, "(", signature, ")\n", 0);
++ Printv(procdoc, doc, "\n", 0);
++ break;
++ case PLAIN:
++ Printv(procdoc, "\f", proc_name, "\n\n", 0);
++ Printv(procdoc, "(", signature, ")\n", 0);
++ Printv(procdoc, doc, "\n\n", 0);
++ break;
++ case TEXINFO:
++ Printv(procdoc, "\f", proc_name, "\n", 0);
++ Printv(procdoc, "@deffn primitive ", signature, "\n", 0);
++ Printv(procdoc, doc, "\n", 0);
++ Printv(procdoc, "@end deffn\n\n", 0);
++ break;
++ }
++}
++
++
+ // ----------------------------------------------------------------------
+ // GUILE::create_function(char *name, char *iname, SwigType *d,
+ // ParmList *l)
+@@ -498,6 +549,7 @@
+ /* Declare return variable */
+
+ Wrapper_add_local (f,"gswig_result", "SCM gswig_result");
++ Wrapper_add_local (f,"gswig_list_p", "SCM gswig_list_p = 0");
+
+ if (procdoc)
+ guile_do_doc_typemap(returns, "outdoc", d, NULL,
+@@ -506,7 +558,7 @@
+ /* Open prototype and signature */
+
+ Printv(f->def, "static SCM\n", wname," (", 0);
+- Printv(signature, "(", proc_name, 0);
++ Printv(signature, proc_name, 0);
+
+ /* Now write code to extract the parameters */
+
+@@ -583,9 +635,8 @@
+ source, target, numargs, proc_name, f, 0);
+ }
+
+- /* Close prototype and signature */
++ /* Close prototype */
+
+- Printv(signature, ")\n", 0);
+ Printf(f->def, ")\n{\n");
+
+ /* Define the scheme name in C. This define is used by several Guile
+@@ -637,6 +688,8 @@
+
+ // Wrap things up (in a manner of speaking)
+
++ if (before_return)
++ Printv(f->code, before_return, "\n", 0);
+ Printv(f->code, "return gswig_result;\n", 0);
+
+ // Undefine the scheme name
+@@ -662,7 +715,7 @@
Printv(f_wrappers, ");\n", 0);
Printv(f_wrappers, "}\n", 0);
/* Register it */
@@ -54,7 +157,7 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
proc_name, wname, numargs-numopt, numopt);
}
else if (emit_setters && struct_member && strlen(Char(proc_name))>3) {
-@@ -675,7 +681,7 @@
+@@ -675,7 +728,7 @@
struct_member = 2; /* have a setter */
}
else Printf(f_init, "SCM getter = ");
@@ -63,7 +166,7 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
proc_name, wname, numargs-numopt, numopt);
if (!is_setter) {
/* Strip off "-get" */
-@@ -698,7 +704,7 @@
+@@ -698,17 +751,17 @@
}
else {
/* Register the function */
@@ -72,7 +175,24 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
proc_name, wname, numargs-numopt, numopt);
}
if (procdoc) {
-@@ -751,7 +757,7 @@
+- /* Write out procedure documentation */
+- Printv(signature, "Returns ", 0);
+- if (Len(returns)==0) Printv(signature, "unspecified", 0);
+- else if (returns_list) Printv(signature, "list (", returns, ")", 0);
+- else Printv(signature, returns, 0);
+- Printv(signature, "\n", 0);
+- Printv(procdoc, "\f\n", signature, 0);
++ String *returns_text = NewString("");
++ Printv(returns_text, "Returns ", 0);
++ if (Len(returns)==0) Printv(returns_text, "unspecified", 0);
++ else if (returns_list) Printv(returns_text, "list (", returns, ")", 0);
++ else Printv(returns_text, returns, 0);
++ write_doc(proc_name, signature, returns_text);
++ Delete(returns_text);
+ }
+
+ Delete(proc_name);
+@@ -751,7 +804,7 @@
if ((SwigType_type(t) != T_USER) || (is_a_pointer(t))) {
@@ -81,7 +201,7 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
if (!(Status & STAT_READONLY) && SwigType_type(t) == T_STRING) {
Printf (f_wrappers, "\t char *_temp;\n");
-@@ -821,7 +827,7 @@
+@@ -821,7 +874,7 @@
throw_unhandled_guile_type_error (t);
}
Printf (f_wrappers, "\t return gswig_result;\n");
@@ -90,7 +210,7 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
// Now add symbol to the Guile interpreter
-@@ -829,12 +835,12 @@
+@@ -829,12 +882,12 @@
|| Status & STAT_READONLY) {
/* Read-only variables become a simple procedure returning the
value. */
@@ -105,3 +225,60 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
proc_name, var_name);
Printf (f_init, "\t gh_define(\"%s\", "
"scm_make_procedure_with_setter(p, p)); }\n",
+@@ -844,29 +897,28 @@
+ if (procdoc) {
+ /* Compute documentation */
+ String *signature = NewString("");
++ String *doc = NewString("");
+
+ if (Status & STAT_READONLY) {
+- Printv(signature, "(", proc_name, ")\n", 0);
+- Printv(signature, "Returns constant ", 0);
+- guile_do_doc_typemap(signature, "varoutdoc", t, NULL,
++ Printv(signature, proc_name, 0);
++ Printv(doc, "Returns constant ", 0);
++ guile_do_doc_typemap(doc, "varoutdoc", t, NULL,
+ 0, proc_name, f);
+- Printv(signature, "\n", 0);
+ }
+ else {
+- Printv(signature, "(", proc_name,
++ Printv(signature, proc_name,
+ " #:optional ", 0);
+ guile_do_doc_typemap(signature, "varindoc", t, "new-value",
+ 1, proc_name, f);
+- Printv(signature, ")\n", 0);
+- Printv(signature, "If NEW-VALUE is provided, "
++ Printv(doc, "If NEW-VALUE is provided, "
+ "set C variable to this value.\n", 0);
+- Printv(signature, "Returns variable value ", 0);
+- guile_do_doc_typemap(signature, "varoutdoc", t, NULL,
++ Printv(doc, "Returns variable value ", 0);
++ guile_do_doc_typemap(doc, "varoutdoc", t, NULL,
+ 0, proc_name, f);
+- Printv(signature, "\n", 0);
+ }
+- Printv(procdoc, "\f\n", signature, 0);
++ write_doc(proc_name, signature, doc);
+ Delete(signature);
++ Delete(doc);
+ }
+
+ } else {
+@@ -957,5 +1009,16 @@
+ else {
+ /* Only emit traditional VAR-get and VAR-set procedures */
+ Language::cpp_variable(name, iname, t);
++ }
++}
++
++void GUILE::pragma(char *lang, char *cmd, char *value)
++{
++ if (strcmp(lang,(char*)"guile") == 0) {
++ if (strcmp(cmd, (char*)"beforereturn")==0) {
++ if (before_return)
++ Delete(before_return);
++ before_return = NewString(value);
++ }
+ }
+ }
diff --git a/devel/SWIG-devel/files/patch-Source::Modules1.1::guile.h b/devel/SWIG-devel/files/patch-Source::Modules1.1::guile.h
new file mode 100644
index 000000000000..6aa871c36d0e
--- /dev/null
+++ b/devel/SWIG-devel/files/patch-Source::Modules1.1::guile.h
@@ -0,0 +1,32 @@
+Index: SWIG/Source/Modules1.1/guile.h
+diff -u SWIG/Source/Modules1.1/guile.h:1.15 SWIG/Source/Modules1.1/guile.h:1.15.2.2
+--- Source/Modules1.1/guile.h:1.15 Tue Sep 19 09:50:15 2000
++++ Source/Modules1.1/guile.h Thu Mar 1 18:28:02 2001
+@@ -36,10 +36,18 @@
+ GUILE_LSTYLE_HOBBIT // use (hobbit4d link)
+ } linkage;
+ File *procdoc;
++ enum {
++ GUILE_1_4,
++ PLAIN,
++ TEXINFO
++ } docformat;
+ int emit_setters;
+ int struct_member;
++ String *before_return;
+ void emit_linkage(char *module_name);
+-
++ void write_doc(const String *proc_name,
++ const String *signature,
++ const String *doc);
+ public :
+ GUILE ();
+ void parse_args (int, char *argv[]);
+@@ -54,6 +62,7 @@
+ void set_init (char *);
+ void create_command (char *, char *) { };
+ void cpp_variable(char *name, char *iname, SwigType *t);
++ void pragma(char *lang, char *cmd, char *value);
+ };
+
+ /* guile.h ends here */
diff --git a/devel/swig13/Makefile b/devel/swig13/Makefile
index 0066923358b8..9b096b512703 100644
--- a/devel/swig13/Makefile
+++ b/devel/swig13/Makefile
@@ -7,7 +7,7 @@
PORTNAME= swig
PORTVERSION= ${VER}a5
-PORTREVISION= 4
+PORTREVISION= 5
CATEGORIES= devel perl5 python ruby tcl82
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} \
ftp://ftp.rge.com/pub/languages/swig/ \
@@ -17,26 +17,44 @@ DISTNAME= ${PORTNAME}${PORTVERSION}
MAINTAINER= knu@FreeBSD.org
-BUILD_DEPENDS= ${PYTHON_CMD}:${PYTHON_PORTSDIR} \
- ${LOCALBASE}/bin/tclsh8.2:${PORTSDIR}/lang/tcl82
-
VER= 1.3
-USE_PERL5= yes
+SWIG_LANGUAGES?= guile perl python ruby tcl
+.for lang in ${SWIG_LANGUAGES}
+WANT_SWIG_${lang:U}= yes
+.endfor
+
+.if defined(WANT_SWIG_GUILE)
+BUILD_DEPENDS+= guile:${PORTSDIR}/lang/guile
+.endif
+.if defined(WANT_SWIG_PERL)
+USE_PERL5= yes
+.endif
+.if defined(WANT_SWIG_PYTHON)
+USE_PYTHON= yes
+PYTHON_NO_DEPENDS= yes
+BUILD_DEPENDS+= ${PYTHON_CMD}:${PYTHON_PORTSDIR}
+CONFIGURE_ARGS+= --with-pyincl=${PYTHON_INCLUDEDIR} \
+ --with-pylib=${PYTHON_LIBDIR}
+.endif
+.if defined(WANT_SWIG_RUBY)
USE_RUBY= yes
RUBY_NO_RUN_DEPENDS= yes
-PYTHON_VERSION?= python1.5
-PYTHON_NO_DEPENDS= yes
+.endif
+.if defined(WANT_SWIG_TCL)
+BUILD_DEPENDS+= ${LOCALBASE}/bin/tclsh8.2:${PORTSDIR}/lang/tcl82
+CONFIGURE_ARGS+= --with-tclincl=${LOCALBASE}/include/tcl8.2/ \
+ --with-tcllib=${LOCALBASE}/lib/tcl8.2/
+.endif
+
INSTALLS_SHLIB= yes
WRKSRC= ${WRKDIR}/SWIG${PORTVERSION}
USE_LIBTOOL= yes
CONFIGURE_ENV= CFLAGS="${CFLAGS} -fpic -DPIC"
-CONFIGURE_ARGS= --with-tclincl=${PREFIX}/include/tcl8.2/ \
- --with-tcllib=${PREFIX}/lib/tcl8.2/
ALL_TARGET= swig runtime
PLIST_SUB= VER="${VER}"
post-install:
- ${LN} ${PREFIX}/bin/swig ${PREFIX}/bin/swig${VER}
+ ${LN} -f ${PREFIX}/bin/swig ${PREFIX}/bin/swig${VER}
.include <bsd.port.mk>
diff --git a/devel/swig13/files/patch-Lib::guile::guile.swg b/devel/swig13/files/patch-Lib::guile::guile.swg
index 7341ee11f990..7be2ea708530 100644
--- a/devel/swig13/files/patch-Lib::guile::guile.swg
+++ b/devel/swig13/files/patch-Lib::guile::guile.swg
@@ -1,6 +1,7 @@
-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
+Index: SWIG/Lib/guile/guile.swg
+diff -u SWIG/Lib/guile/guile.swg:1.11 SWIG/Lib/guile/guile.swg:1.11.2.2
+--- Lib/guile/guile.swg:1.11 Sat Sep 2 11:25:27 2000
++++ Lib/guile/guile.swg Mon Feb 26 11:57:56 2001
@@ -7,6 +7,10 @@
/* SWIG pointer structure */
@@ -27,7 +28,7 @@ diff -urN ../SWIG1.3a5/Lib/guile/guile.swg ./Lib/guile/guile.swg
SWIGSTATIC
-void SWIG_Guile_RegisterTypes(swig_type_info **table)
+void SWIG_Guile_RegisterTypes(swig_type_info **table,
-+ swig_type_info **init)
++ swig_type_info **init)
{
- for (; *table; table++) {
- swig_type_info *type = *table;
diff --git a/devel/swig13/files/patch-Lib::guile::guiledec.swg b/devel/swig13/files/patch-Lib::guile::guiledec.swg
index 970c19b33ca1..b574debbd13e 100644
--- a/devel/swig13/files/patch-Lib::guile::guiledec.swg
+++ b/devel/swig13/files/patch-Lib::guile::guiledec.swg
@@ -1,7 +1,47 @@
-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 @@
+Index: SWIG/Lib/guile/guiledec.swg
+diff -u SWIG/Lib/guile/guiledec.swg:1.13 SWIG/Lib/guile/guiledec.swg:1.13.2.4
+--- Lib/guile/guiledec.swg:1.13 Thu Sep 21 16:06:17 2000
++++ Lib/guile/guiledec.swg Fri Mar 2 07:53:02 2001
+@@ -27,17 +27,29 @@
+ #define GH_NOT_PASSED SCM_UNDEFINED
+ #define GH_UNSPECIFIED SCM_UNSPECIFIED
+
+-#define GUILE_APPEND_RESULT(object) \
+- if (gswig_result == GH_UNSPECIFIED) \
+- gswig_result = object; \
+- else { \
+- if (!gh_pair_p(gswig_result)) \
+- gswig_result = gh_list(gswig_result, object, GH_NOT_PASSED); \
+- else \
+- gswig_result = gh_append2(gswig_result, \
+- gh_list(object, GH_NOT_PASSED)); \
++#define GUILE_APPEND_RESULT(object) \
++ if (gswig_result == GH_UNSPECIFIED) \
++ gswig_result = object; \
++ else { \
++ if (!gswig_list_p) { \
++ gswig_list_p = 1; \
++ gswig_result = gh_list(gswig_result, object, GH_NOT_PASSED); \
++ } \
++ else \
++ gswig_result = gh_append2(gswig_result, \
++ gh_list(object, GH_NOT_PASSED)); \
+ }
+
++/* scm_values was implemented on C level in 1.4.1, and the prototype
++ is not included in libguile.h, so play safe and lookup `values'... */
++#define GUILE_MAYBE_VALUES \
++ if (gswig_list_p) \
++ gswig_result = gh_apply(gh_lookup("values"), gswig_result);
++
++#define GUILE_MAYBE_VECTOR \
++ if (gswig_list_p) \
++ gswig_result = gh_list_to_vector(gswig_result);
++
+ static char *
+ GSWIG_scm2str (SCM s)
+ {
+@@ -78,10 +90,9 @@
size_t tag;
} swig_type_info;
@@ -10,7 +50,7 @@ diff -urN ../SWIG1.3a5/Lib/guile/guiledec.swg ./Lib/guile/guiledec.swg
SWIGSTATIC void
-SWIG_Guile_RegisterTypes (swig_type_info **table);
+SWIG_Guile_RegisterTypes (swig_type_info **table,
-+ swig_type_info **init);
++ 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
index 613a294d51cb..67bfa7ccbda3 100644
--- a/devel/swig13/files/patch-Lib::guile::guilemain.i
+++ b/devel/swig13/files/patch-Lib::guile::guilemain.i
@@ -1,15 +1,7 @@
-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
+Index: SWIG/Lib/guile/guilemain.i
+diff -u SWIG/Lib/guile/guilemain.i:1.4 SWIG/Lib/guile/guilemain.i:1.4.2.1
+--- Lib/guile/guilemain.i:1.4 Sun Sep 3 15:06:32 2000
++++ Lib/guile/guilemain.i Mon Feb 26 11:57:56 2001
@@ -27,6 +27,10 @@
%{
#include <libguile.h>
diff --git a/devel/swig13/files/patch-Lib::guile::typemaps.i b/devel/swig13/files/patch-Lib::guile::typemaps.i
index 0826663f96e2..e6343509ebaf 100644
--- a/devel/swig13/files/patch-Lib::guile::typemaps.i
+++ b/devel/swig13/files/patch-Lib::guile::typemaps.i
@@ -1,154 +1,25 @@
-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);
+Index: SWIG/Lib/guile/typemaps.i
+diff -u SWIG/Lib/guile/typemaps.i:1.17 SWIG/Lib/guile/typemaps.i:1.17.2.1
+--- Lib/guile/typemaps.i:1.17 Thu Sep 21 16:06:17 2000
++++ Lib/guile/typemaps.i Mon Feb 26 08:51:10 2001
+@@ -54,9 +54,20 @@
+ %typemap (guile, freearg) char *, const char * "if ($target) scm_must_free($target);";
+
++/* But this shall not apply if we try to pass a single char by
++ reference. */
+
++%typemap (guile, freearg) char *OUTPUT, char *BOTH "";
+
+ /* Void */
+
+ %typemap (guile, out) void "gswig_result = GH_UNSPECIFIED;";
+ %typemap (guile, outdoc) void "";
+
-+%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 );
-+ }
-+ }
-+
-+};
-+
-+
++/* SCM is passed through */
+
- /* GSWIG_scm2str makes a malloc'ed copy of the string, so get rid of it after
- the function call. */
++typedef unsigned long SCM;
++%typemap (guile, in) SCM "$target=$source;";
++%typemap (guile, out) SCM "$target=$source;";
+ /* typemaps.i ends here */
diff --git a/devel/swig13/files/patch-Source::Modules1.1::guile.cxx b/devel/swig13/files/patch-Source::Modules1.1::guile.cxx
index 56379bc6f449..873ebe3a7735 100644
--- a/devel/swig13/files/patch-Source::Modules1.1::guile.cxx
+++ b/devel/swig13/files/patch-Source::Modules1.1::guile.cxx
@@ -1,20 +1,50 @@
-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 @@
+Index: SWIG/Source/Modules1.1/guile.cxx
+diff -u SWIG/Source/Modules1.1/guile.cxx:1.68 SWIG/Source/Modules1.1/guile.cxx:1.68.2.6
+--- Source/Modules1.1/guile.cxx:1.68 Wed Sep 20 09:00:56 2000
++++ Source/Modules1.1/guile.cxx Fri Mar 2 07:53:02 2001
+@@ -32,8 +32,10 @@
+ -prefix name - Use NAME as prefix [default \"gswig_\"]\n\
+ -package name - Set the path of the module [default NULL]\n\
+ -Linkage lstyle - Use linkage protocol LSTYLE [default `ltdlmod']\n\
+- -procdoc file - Output procedure documentation to file\n\
++ -procdoc file - Output procedure documentation to FILE\n\
+ \n\
++ -procdocformat format - Output procedure documentation in FORMAT;\n\
++ one of `guile-1.4', `plain', `texinfo'\n\
+ The module option does not create a guile module with a separate name\n\
+ space. It specifies the name of the initialization function and is\n\
+ called a module here so that it is compadible with the rest of SWIG.\n\
+@@ -59,8 +61,10 @@
+ package = NULL;
+ linkage = GUILE_LSTYLE_SIMPLE;
+ procdoc = NULL;
++ docformat = GUILE_1_4;
+ emit_setters = 0;
+ struct_member = 0;
++ before_return = NULL;
+ }
+
+ // ---------------------------------------------------------------------
+@@ -143,6 +147,18 @@
+ Swig_arg_error();
+ }
+ }
++ else if (strcmp (argv[i], "-procdocformat") == 0) {
++ if (strcmp(argv[i+1], "guile-1.4") == 0)
++ docformat = GUILE_1_4;
++ else if (strcmp(argv[i+1], "plain") == 0)
++ docformat = PLAIN;
++ else if (strcmp(argv[i+1], "texinfo") == 0)
++ docformat = TEXINFO;
++ else Swig_arg_error();
++ Swig_mark_arg(i);
++ Swig_mark_arg(i+1);
++ i++;
++ }
+ else if (strcmp (argv[i], "-emit-setters") == 0) {
+ emit_setters = 1;
+ Swig_mark_arg (i);
+@@ -252,6 +268,9 @@
void
GUILE::initialize (void)
{
@@ -24,7 +54,7 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
switch (linkage) {
case GUILE_LSTYLE_SIMPLE:
/* Simple linkage; we have to export the SWIG_init function. The user can
-@@ -328,7 +331,7 @@
+@@ -328,7 +347,7 @@
{
SwigType_emit_type_table (f_runtime, f_wrappers);
@@ -33,7 +63,7 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
Printf (f_init, "}\n\n");
char module_name[256];
-@@ -341,7 +344,10 @@
+@@ -341,7 +360,10 @@
strcpy(module_name,module);
}
emit_linkage (module_name);
@@ -45,7 +75,80 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
if (procdoc) {
Delete(procdoc);
procdoc = NULL;
-@@ -662,7 +668,7 @@
+@@ -460,6 +482,35 @@
+ error_count++;
+ }
+
++
++/* Write out procedure documentation */
++
++void
++GUILE::write_doc(const String *proc_name,
++ const String *signature,
++ const String *doc)
++{
++ switch (docformat) {
++ case GUILE_1_4:
++ Printv(procdoc, "\f\n", 0);
++ Printv(procdoc, "(", signature, ")\n", 0);
++ Printv(procdoc, doc, "\n", 0);
++ break;
++ case PLAIN:
++ Printv(procdoc, "\f", proc_name, "\n\n", 0);
++ Printv(procdoc, "(", signature, ")\n", 0);
++ Printv(procdoc, doc, "\n\n", 0);
++ break;
++ case TEXINFO:
++ Printv(procdoc, "\f", proc_name, "\n", 0);
++ Printv(procdoc, "@deffn primitive ", signature, "\n", 0);
++ Printv(procdoc, doc, "\n", 0);
++ Printv(procdoc, "@end deffn\n\n", 0);
++ break;
++ }
++}
++
++
+ // ----------------------------------------------------------------------
+ // GUILE::create_function(char *name, char *iname, SwigType *d,
+ // ParmList *l)
+@@ -498,6 +549,7 @@
+ /* Declare return variable */
+
+ Wrapper_add_local (f,"gswig_result", "SCM gswig_result");
++ Wrapper_add_local (f,"gswig_list_p", "SCM gswig_list_p = 0");
+
+ if (procdoc)
+ guile_do_doc_typemap(returns, "outdoc", d, NULL,
+@@ -506,7 +558,7 @@
+ /* Open prototype and signature */
+
+ Printv(f->def, "static SCM\n", wname," (", 0);
+- Printv(signature, "(", proc_name, 0);
++ Printv(signature, proc_name, 0);
+
+ /* Now write code to extract the parameters */
+
+@@ -583,9 +635,8 @@
+ source, target, numargs, proc_name, f, 0);
+ }
+
+- /* Close prototype and signature */
++ /* Close prototype */
+
+- Printv(signature, ")\n", 0);
+ Printf(f->def, ")\n{\n");
+
+ /* Define the scheme name in C. This define is used by several Guile
+@@ -637,6 +688,8 @@
+
+ // Wrap things up (in a manner of speaking)
+
++ if (before_return)
++ Printv(f->code, before_return, "\n", 0);
+ Printv(f->code, "return gswig_result;\n", 0);
+
+ // Undefine the scheme name
+@@ -662,7 +715,7 @@
Printv(f_wrappers, ");\n", 0);
Printv(f_wrappers, "}\n", 0);
/* Register it */
@@ -54,7 +157,7 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
proc_name, wname, numargs-numopt, numopt);
}
else if (emit_setters && struct_member && strlen(Char(proc_name))>3) {
-@@ -675,7 +681,7 @@
+@@ -675,7 +728,7 @@
struct_member = 2; /* have a setter */
}
else Printf(f_init, "SCM getter = ");
@@ -63,7 +166,7 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
proc_name, wname, numargs-numopt, numopt);
if (!is_setter) {
/* Strip off "-get" */
-@@ -698,7 +704,7 @@
+@@ -698,17 +751,17 @@
}
else {
/* Register the function */
@@ -72,7 +175,24 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
proc_name, wname, numargs-numopt, numopt);
}
if (procdoc) {
-@@ -751,7 +757,7 @@
+- /* Write out procedure documentation */
+- Printv(signature, "Returns ", 0);
+- if (Len(returns)==0) Printv(signature, "unspecified", 0);
+- else if (returns_list) Printv(signature, "list (", returns, ")", 0);
+- else Printv(signature, returns, 0);
+- Printv(signature, "\n", 0);
+- Printv(procdoc, "\f\n", signature, 0);
++ String *returns_text = NewString("");
++ Printv(returns_text, "Returns ", 0);
++ if (Len(returns)==0) Printv(returns_text, "unspecified", 0);
++ else if (returns_list) Printv(returns_text, "list (", returns, ")", 0);
++ else Printv(returns_text, returns, 0);
++ write_doc(proc_name, signature, returns_text);
++ Delete(returns_text);
+ }
+
+ Delete(proc_name);
+@@ -751,7 +804,7 @@
if ((SwigType_type(t) != T_USER) || (is_a_pointer(t))) {
@@ -81,7 +201,7 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
if (!(Status & STAT_READONLY) && SwigType_type(t) == T_STRING) {
Printf (f_wrappers, "\t char *_temp;\n");
-@@ -821,7 +827,7 @@
+@@ -821,7 +874,7 @@
throw_unhandled_guile_type_error (t);
}
Printf (f_wrappers, "\t return gswig_result;\n");
@@ -90,7 +210,7 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
// Now add symbol to the Guile interpreter
-@@ -829,12 +835,12 @@
+@@ -829,12 +882,12 @@
|| Status & STAT_READONLY) {
/* Read-only variables become a simple procedure returning the
value. */
@@ -105,3 +225,60 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
proc_name, var_name);
Printf (f_init, "\t gh_define(\"%s\", "
"scm_make_procedure_with_setter(p, p)); }\n",
+@@ -844,29 +897,28 @@
+ if (procdoc) {
+ /* Compute documentation */
+ String *signature = NewString("");
++ String *doc = NewString("");
+
+ if (Status & STAT_READONLY) {
+- Printv(signature, "(", proc_name, ")\n", 0);
+- Printv(signature, "Returns constant ", 0);
+- guile_do_doc_typemap(signature, "varoutdoc", t, NULL,
++ Printv(signature, proc_name, 0);
++ Printv(doc, "Returns constant ", 0);
++ guile_do_doc_typemap(doc, "varoutdoc", t, NULL,
+ 0, proc_name, f);
+- Printv(signature, "\n", 0);
+ }
+ else {
+- Printv(signature, "(", proc_name,
++ Printv(signature, proc_name,
+ " #:optional ", 0);
+ guile_do_doc_typemap(signature, "varindoc", t, "new-value",
+ 1, proc_name, f);
+- Printv(signature, ")\n", 0);
+- Printv(signature, "If NEW-VALUE is provided, "
++ Printv(doc, "If NEW-VALUE is provided, "
+ "set C variable to this value.\n", 0);
+- Printv(signature, "Returns variable value ", 0);
+- guile_do_doc_typemap(signature, "varoutdoc", t, NULL,
++ Printv(doc, "Returns variable value ", 0);
++ guile_do_doc_typemap(doc, "varoutdoc", t, NULL,
+ 0, proc_name, f);
+- Printv(signature, "\n", 0);
+ }
+- Printv(procdoc, "\f\n", signature, 0);
++ write_doc(proc_name, signature, doc);
+ Delete(signature);
++ Delete(doc);
+ }
+
+ } else {
+@@ -957,5 +1009,16 @@
+ else {
+ /* Only emit traditional VAR-get and VAR-set procedures */
+ Language::cpp_variable(name, iname, t);
++ }
++}
++
++void GUILE::pragma(char *lang, char *cmd, char *value)
++{
++ if (strcmp(lang,(char*)"guile") == 0) {
++ if (strcmp(cmd, (char*)"beforereturn")==0) {
++ if (before_return)
++ Delete(before_return);
++ before_return = NewString(value);
++ }
+ }
+ }
diff --git a/devel/swig13/files/patch-Source::Modules1.1::guile.h b/devel/swig13/files/patch-Source::Modules1.1::guile.h
new file mode 100644
index 000000000000..6aa871c36d0e
--- /dev/null
+++ b/devel/swig13/files/patch-Source::Modules1.1::guile.h
@@ -0,0 +1,32 @@
+Index: SWIG/Source/Modules1.1/guile.h
+diff -u SWIG/Source/Modules1.1/guile.h:1.15 SWIG/Source/Modules1.1/guile.h:1.15.2.2
+--- Source/Modules1.1/guile.h:1.15 Tue Sep 19 09:50:15 2000
++++ Source/Modules1.1/guile.h Thu Mar 1 18:28:02 2001
+@@ -36,10 +36,18 @@
+ GUILE_LSTYLE_HOBBIT // use (hobbit4d link)
+ } linkage;
+ File *procdoc;
++ enum {
++ GUILE_1_4,
++ PLAIN,
++ TEXINFO
++ } docformat;
+ int emit_setters;
+ int struct_member;
++ String *before_return;
+ void emit_linkage(char *module_name);
+-
++ void write_doc(const String *proc_name,
++ const String *signature,
++ const String *doc);
+ public :
+ GUILE ();
+ void parse_args (int, char *argv[]);
+@@ -54,6 +62,7 @@
+ void set_init (char *);
+ void create_command (char *, char *) { };
+ void cpp_variable(char *name, char *iname, SwigType *t);
++ void pragma(char *lang, char *cmd, char *value);
+ };
+
+ /* guile.h ends here */
diff --git a/devel/swig20/Makefile b/devel/swig20/Makefile
index 0066923358b8..9b096b512703 100644
--- a/devel/swig20/Makefile
+++ b/devel/swig20/Makefile
@@ -7,7 +7,7 @@
PORTNAME= swig
PORTVERSION= ${VER}a5
-PORTREVISION= 4
+PORTREVISION= 5
CATEGORIES= devel perl5 python ruby tcl82
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} \
ftp://ftp.rge.com/pub/languages/swig/ \
@@ -17,26 +17,44 @@ DISTNAME= ${PORTNAME}${PORTVERSION}
MAINTAINER= knu@FreeBSD.org
-BUILD_DEPENDS= ${PYTHON_CMD}:${PYTHON_PORTSDIR} \
- ${LOCALBASE}/bin/tclsh8.2:${PORTSDIR}/lang/tcl82
-
VER= 1.3
-USE_PERL5= yes
+SWIG_LANGUAGES?= guile perl python ruby tcl
+.for lang in ${SWIG_LANGUAGES}
+WANT_SWIG_${lang:U}= yes
+.endfor
+
+.if defined(WANT_SWIG_GUILE)
+BUILD_DEPENDS+= guile:${PORTSDIR}/lang/guile
+.endif
+.if defined(WANT_SWIG_PERL)
+USE_PERL5= yes
+.endif
+.if defined(WANT_SWIG_PYTHON)
+USE_PYTHON= yes
+PYTHON_NO_DEPENDS= yes
+BUILD_DEPENDS+= ${PYTHON_CMD}:${PYTHON_PORTSDIR}
+CONFIGURE_ARGS+= --with-pyincl=${PYTHON_INCLUDEDIR} \
+ --with-pylib=${PYTHON_LIBDIR}
+.endif
+.if defined(WANT_SWIG_RUBY)
USE_RUBY= yes
RUBY_NO_RUN_DEPENDS= yes
-PYTHON_VERSION?= python1.5
-PYTHON_NO_DEPENDS= yes
+.endif
+.if defined(WANT_SWIG_TCL)
+BUILD_DEPENDS+= ${LOCALBASE}/bin/tclsh8.2:${PORTSDIR}/lang/tcl82
+CONFIGURE_ARGS+= --with-tclincl=${LOCALBASE}/include/tcl8.2/ \
+ --with-tcllib=${LOCALBASE}/lib/tcl8.2/
+.endif
+
INSTALLS_SHLIB= yes
WRKSRC= ${WRKDIR}/SWIG${PORTVERSION}
USE_LIBTOOL= yes
CONFIGURE_ENV= CFLAGS="${CFLAGS} -fpic -DPIC"
-CONFIGURE_ARGS= --with-tclincl=${PREFIX}/include/tcl8.2/ \
- --with-tcllib=${PREFIX}/lib/tcl8.2/
ALL_TARGET= swig runtime
PLIST_SUB= VER="${VER}"
post-install:
- ${LN} ${PREFIX}/bin/swig ${PREFIX}/bin/swig${VER}
+ ${LN} -f ${PREFIX}/bin/swig ${PREFIX}/bin/swig${VER}
.include <bsd.port.mk>
diff --git a/devel/swig20/files/patch-Lib::guile::guile.swg b/devel/swig20/files/patch-Lib::guile::guile.swg
index 7341ee11f990..7be2ea708530 100644
--- a/devel/swig20/files/patch-Lib::guile::guile.swg
+++ b/devel/swig20/files/patch-Lib::guile::guile.swg
@@ -1,6 +1,7 @@
-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
+Index: SWIG/Lib/guile/guile.swg
+diff -u SWIG/Lib/guile/guile.swg:1.11 SWIG/Lib/guile/guile.swg:1.11.2.2
+--- Lib/guile/guile.swg:1.11 Sat Sep 2 11:25:27 2000
++++ Lib/guile/guile.swg Mon Feb 26 11:57:56 2001
@@ -7,6 +7,10 @@
/* SWIG pointer structure */
@@ -27,7 +28,7 @@ diff -urN ../SWIG1.3a5/Lib/guile/guile.swg ./Lib/guile/guile.swg
SWIGSTATIC
-void SWIG_Guile_RegisterTypes(swig_type_info **table)
+void SWIG_Guile_RegisterTypes(swig_type_info **table,
-+ swig_type_info **init)
++ swig_type_info **init)
{
- for (; *table; table++) {
- swig_type_info *type = *table;
diff --git a/devel/swig20/files/patch-Lib::guile::guiledec.swg b/devel/swig20/files/patch-Lib::guile::guiledec.swg
index 970c19b33ca1..b574debbd13e 100644
--- a/devel/swig20/files/patch-Lib::guile::guiledec.swg
+++ b/devel/swig20/files/patch-Lib::guile::guiledec.swg
@@ -1,7 +1,47 @@
-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 @@
+Index: SWIG/Lib/guile/guiledec.swg
+diff -u SWIG/Lib/guile/guiledec.swg:1.13 SWIG/Lib/guile/guiledec.swg:1.13.2.4
+--- Lib/guile/guiledec.swg:1.13 Thu Sep 21 16:06:17 2000
++++ Lib/guile/guiledec.swg Fri Mar 2 07:53:02 2001
+@@ -27,17 +27,29 @@
+ #define GH_NOT_PASSED SCM_UNDEFINED
+ #define GH_UNSPECIFIED SCM_UNSPECIFIED
+
+-#define GUILE_APPEND_RESULT(object) \
+- if (gswig_result == GH_UNSPECIFIED) \
+- gswig_result = object; \
+- else { \
+- if (!gh_pair_p(gswig_result)) \
+- gswig_result = gh_list(gswig_result, object, GH_NOT_PASSED); \
+- else \
+- gswig_result = gh_append2(gswig_result, \
+- gh_list(object, GH_NOT_PASSED)); \
++#define GUILE_APPEND_RESULT(object) \
++ if (gswig_result == GH_UNSPECIFIED) \
++ gswig_result = object; \
++ else { \
++ if (!gswig_list_p) { \
++ gswig_list_p = 1; \
++ gswig_result = gh_list(gswig_result, object, GH_NOT_PASSED); \
++ } \
++ else \
++ gswig_result = gh_append2(gswig_result, \
++ gh_list(object, GH_NOT_PASSED)); \
+ }
+
++/* scm_values was implemented on C level in 1.4.1, and the prototype
++ is not included in libguile.h, so play safe and lookup `values'... */
++#define GUILE_MAYBE_VALUES \
++ if (gswig_list_p) \
++ gswig_result = gh_apply(gh_lookup("values"), gswig_result);
++
++#define GUILE_MAYBE_VECTOR \
++ if (gswig_list_p) \
++ gswig_result = gh_list_to_vector(gswig_result);
++
+ static char *
+ GSWIG_scm2str (SCM s)
+ {
+@@ -78,10 +90,9 @@
size_t tag;
} swig_type_info;
@@ -10,7 +50,7 @@ diff -urN ../SWIG1.3a5/Lib/guile/guiledec.swg ./Lib/guile/guiledec.swg
SWIGSTATIC void
-SWIG_Guile_RegisterTypes (swig_type_info **table);
+SWIG_Guile_RegisterTypes (swig_type_info **table,
-+ swig_type_info **init);
++ 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/swig20/files/patch-Lib::guile::guilemain.i b/devel/swig20/files/patch-Lib::guile::guilemain.i
index 613a294d51cb..67bfa7ccbda3 100644
--- a/devel/swig20/files/patch-Lib::guile::guilemain.i
+++ b/devel/swig20/files/patch-Lib::guile::guilemain.i
@@ -1,15 +1,7 @@
-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
+Index: SWIG/Lib/guile/guilemain.i
+diff -u SWIG/Lib/guile/guilemain.i:1.4 SWIG/Lib/guile/guilemain.i:1.4.2.1
+--- Lib/guile/guilemain.i:1.4 Sun Sep 3 15:06:32 2000
++++ Lib/guile/guilemain.i Mon Feb 26 11:57:56 2001
@@ -27,6 +27,10 @@
%{
#include <libguile.h>
diff --git a/devel/swig20/files/patch-Lib::guile::typemaps.i b/devel/swig20/files/patch-Lib::guile::typemaps.i
index 0826663f96e2..e6343509ebaf 100644
--- a/devel/swig20/files/patch-Lib::guile::typemaps.i
+++ b/devel/swig20/files/patch-Lib::guile::typemaps.i
@@ -1,154 +1,25 @@
-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);
+Index: SWIG/Lib/guile/typemaps.i
+diff -u SWIG/Lib/guile/typemaps.i:1.17 SWIG/Lib/guile/typemaps.i:1.17.2.1
+--- Lib/guile/typemaps.i:1.17 Thu Sep 21 16:06:17 2000
++++ Lib/guile/typemaps.i Mon Feb 26 08:51:10 2001
+@@ -54,9 +54,20 @@
+ %typemap (guile, freearg) char *, const char * "if ($target) scm_must_free($target);";
+
++/* But this shall not apply if we try to pass a single char by
++ reference. */
+
++%typemap (guile, freearg) char *OUTPUT, char *BOTH "";
+
+ /* Void */
+
+ %typemap (guile, out) void "gswig_result = GH_UNSPECIFIED;";
+ %typemap (guile, outdoc) void "";
+
-+%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 );
-+ }
-+ }
-+
-+};
-+
-+
++/* SCM is passed through */
+
- /* GSWIG_scm2str makes a malloc'ed copy of the string, so get rid of it after
- the function call. */
++typedef unsigned long SCM;
++%typemap (guile, in) SCM "$target=$source;";
++%typemap (guile, out) SCM "$target=$source;";
+ /* typemaps.i ends here */
diff --git a/devel/swig20/files/patch-Source::Modules1.1::guile.cxx b/devel/swig20/files/patch-Source::Modules1.1::guile.cxx
index 56379bc6f449..873ebe3a7735 100644
--- a/devel/swig20/files/patch-Source::Modules1.1::guile.cxx
+++ b/devel/swig20/files/patch-Source::Modules1.1::guile.cxx
@@ -1,20 +1,50 @@
-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 @@
+Index: SWIG/Source/Modules1.1/guile.cxx
+diff -u SWIG/Source/Modules1.1/guile.cxx:1.68 SWIG/Source/Modules1.1/guile.cxx:1.68.2.6
+--- Source/Modules1.1/guile.cxx:1.68 Wed Sep 20 09:00:56 2000
++++ Source/Modules1.1/guile.cxx Fri Mar 2 07:53:02 2001
+@@ -32,8 +32,10 @@
+ -prefix name - Use NAME as prefix [default \"gswig_\"]\n\
+ -package name - Set the path of the module [default NULL]\n\
+ -Linkage lstyle - Use linkage protocol LSTYLE [default `ltdlmod']\n\
+- -procdoc file - Output procedure documentation to file\n\
++ -procdoc file - Output procedure documentation to FILE\n\
+ \n\
++ -procdocformat format - Output procedure documentation in FORMAT;\n\
++ one of `guile-1.4', `plain', `texinfo'\n\
+ The module option does not create a guile module with a separate name\n\
+ space. It specifies the name of the initialization function and is\n\
+ called a module here so that it is compadible with the rest of SWIG.\n\
+@@ -59,8 +61,10 @@
+ package = NULL;
+ linkage = GUILE_LSTYLE_SIMPLE;
+ procdoc = NULL;
++ docformat = GUILE_1_4;
+ emit_setters = 0;
+ struct_member = 0;
++ before_return = NULL;
+ }
+
+ // ---------------------------------------------------------------------
+@@ -143,6 +147,18 @@
+ Swig_arg_error();
+ }
+ }
++ else if (strcmp (argv[i], "-procdocformat") == 0) {
++ if (strcmp(argv[i+1], "guile-1.4") == 0)
++ docformat = GUILE_1_4;
++ else if (strcmp(argv[i+1], "plain") == 0)
++ docformat = PLAIN;
++ else if (strcmp(argv[i+1], "texinfo") == 0)
++ docformat = TEXINFO;
++ else Swig_arg_error();
++ Swig_mark_arg(i);
++ Swig_mark_arg(i+1);
++ i++;
++ }
+ else if (strcmp (argv[i], "-emit-setters") == 0) {
+ emit_setters = 1;
+ Swig_mark_arg (i);
+@@ -252,6 +268,9 @@
void
GUILE::initialize (void)
{
@@ -24,7 +54,7 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
switch (linkage) {
case GUILE_LSTYLE_SIMPLE:
/* Simple linkage; we have to export the SWIG_init function. The user can
-@@ -328,7 +331,7 @@
+@@ -328,7 +347,7 @@
{
SwigType_emit_type_table (f_runtime, f_wrappers);
@@ -33,7 +63,7 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
Printf (f_init, "}\n\n");
char module_name[256];
-@@ -341,7 +344,10 @@
+@@ -341,7 +360,10 @@
strcpy(module_name,module);
}
emit_linkage (module_name);
@@ -45,7 +75,80 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
if (procdoc) {
Delete(procdoc);
procdoc = NULL;
-@@ -662,7 +668,7 @@
+@@ -460,6 +482,35 @@
+ error_count++;
+ }
+
++
++/* Write out procedure documentation */
++
++void
++GUILE::write_doc(const String *proc_name,
++ const String *signature,
++ const String *doc)
++{
++ switch (docformat) {
++ case GUILE_1_4:
++ Printv(procdoc, "\f\n", 0);
++ Printv(procdoc, "(", signature, ")\n", 0);
++ Printv(procdoc, doc, "\n", 0);
++ break;
++ case PLAIN:
++ Printv(procdoc, "\f", proc_name, "\n\n", 0);
++ Printv(procdoc, "(", signature, ")\n", 0);
++ Printv(procdoc, doc, "\n\n", 0);
++ break;
++ case TEXINFO:
++ Printv(procdoc, "\f", proc_name, "\n", 0);
++ Printv(procdoc, "@deffn primitive ", signature, "\n", 0);
++ Printv(procdoc, doc, "\n", 0);
++ Printv(procdoc, "@end deffn\n\n", 0);
++ break;
++ }
++}
++
++
+ // ----------------------------------------------------------------------
+ // GUILE::create_function(char *name, char *iname, SwigType *d,
+ // ParmList *l)
+@@ -498,6 +549,7 @@
+ /* Declare return variable */
+
+ Wrapper_add_local (f,"gswig_result", "SCM gswig_result");
++ Wrapper_add_local (f,"gswig_list_p", "SCM gswig_list_p = 0");
+
+ if (procdoc)
+ guile_do_doc_typemap(returns, "outdoc", d, NULL,
+@@ -506,7 +558,7 @@
+ /* Open prototype and signature */
+
+ Printv(f->def, "static SCM\n", wname," (", 0);
+- Printv(signature, "(", proc_name, 0);
++ Printv(signature, proc_name, 0);
+
+ /* Now write code to extract the parameters */
+
+@@ -583,9 +635,8 @@
+ source, target, numargs, proc_name, f, 0);
+ }
+
+- /* Close prototype and signature */
++ /* Close prototype */
+
+- Printv(signature, ")\n", 0);
+ Printf(f->def, ")\n{\n");
+
+ /* Define the scheme name in C. This define is used by several Guile
+@@ -637,6 +688,8 @@
+
+ // Wrap things up (in a manner of speaking)
+
++ if (before_return)
++ Printv(f->code, before_return, "\n", 0);
+ Printv(f->code, "return gswig_result;\n", 0);
+
+ // Undefine the scheme name
+@@ -662,7 +715,7 @@
Printv(f_wrappers, ");\n", 0);
Printv(f_wrappers, "}\n", 0);
/* Register it */
@@ -54,7 +157,7 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
proc_name, wname, numargs-numopt, numopt);
}
else if (emit_setters && struct_member && strlen(Char(proc_name))>3) {
-@@ -675,7 +681,7 @@
+@@ -675,7 +728,7 @@
struct_member = 2; /* have a setter */
}
else Printf(f_init, "SCM getter = ");
@@ -63,7 +166,7 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
proc_name, wname, numargs-numopt, numopt);
if (!is_setter) {
/* Strip off "-get" */
-@@ -698,7 +704,7 @@
+@@ -698,17 +751,17 @@
}
else {
/* Register the function */
@@ -72,7 +175,24 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
proc_name, wname, numargs-numopt, numopt);
}
if (procdoc) {
-@@ -751,7 +757,7 @@
+- /* Write out procedure documentation */
+- Printv(signature, "Returns ", 0);
+- if (Len(returns)==0) Printv(signature, "unspecified", 0);
+- else if (returns_list) Printv(signature, "list (", returns, ")", 0);
+- else Printv(signature, returns, 0);
+- Printv(signature, "\n", 0);
+- Printv(procdoc, "\f\n", signature, 0);
++ String *returns_text = NewString("");
++ Printv(returns_text, "Returns ", 0);
++ if (Len(returns)==0) Printv(returns_text, "unspecified", 0);
++ else if (returns_list) Printv(returns_text, "list (", returns, ")", 0);
++ else Printv(returns_text, returns, 0);
++ write_doc(proc_name, signature, returns_text);
++ Delete(returns_text);
+ }
+
+ Delete(proc_name);
+@@ -751,7 +804,7 @@
if ((SwigType_type(t) != T_USER) || (is_a_pointer(t))) {
@@ -81,7 +201,7 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
if (!(Status & STAT_READONLY) && SwigType_type(t) == T_STRING) {
Printf (f_wrappers, "\t char *_temp;\n");
-@@ -821,7 +827,7 @@
+@@ -821,7 +874,7 @@
throw_unhandled_guile_type_error (t);
}
Printf (f_wrappers, "\t return gswig_result;\n");
@@ -90,7 +210,7 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
// Now add symbol to the Guile interpreter
-@@ -829,12 +835,12 @@
+@@ -829,12 +882,12 @@
|| Status & STAT_READONLY) {
/* Read-only variables become a simple procedure returning the
value. */
@@ -105,3 +225,60 @@ diff -urN ../SWIG1.3a5/Source/Modules1.1/guile.cxx ./Source/Modules1.1/guile.cxx
proc_name, var_name);
Printf (f_init, "\t gh_define(\"%s\", "
"scm_make_procedure_with_setter(p, p)); }\n",
+@@ -844,29 +897,28 @@
+ if (procdoc) {
+ /* Compute documentation */
+ String *signature = NewString("");
++ String *doc = NewString("");
+
+ if (Status & STAT_READONLY) {
+- Printv(signature, "(", proc_name, ")\n", 0);
+- Printv(signature, "Returns constant ", 0);
+- guile_do_doc_typemap(signature, "varoutdoc", t, NULL,
++ Printv(signature, proc_name, 0);
++ Printv(doc, "Returns constant ", 0);
++ guile_do_doc_typemap(doc, "varoutdoc", t, NULL,
+ 0, proc_name, f);
+- Printv(signature, "\n", 0);
+ }
+ else {
+- Printv(signature, "(", proc_name,
++ Printv(signature, proc_name,
+ " #:optional ", 0);
+ guile_do_doc_typemap(signature, "varindoc", t, "new-value",
+ 1, proc_name, f);
+- Printv(signature, ")\n", 0);
+- Printv(signature, "If NEW-VALUE is provided, "
++ Printv(doc, "If NEW-VALUE is provided, "
+ "set C variable to this value.\n", 0);
+- Printv(signature, "Returns variable value ", 0);
+- guile_do_doc_typemap(signature, "varoutdoc", t, NULL,
++ Printv(doc, "Returns variable value ", 0);
++ guile_do_doc_typemap(doc, "varoutdoc", t, NULL,
+ 0, proc_name, f);
+- Printv(signature, "\n", 0);
+ }
+- Printv(procdoc, "\f\n", signature, 0);
++ write_doc(proc_name, signature, doc);
+ Delete(signature);
++ Delete(doc);
+ }
+
+ } else {
+@@ -957,5 +1009,16 @@
+ else {
+ /* Only emit traditional VAR-get and VAR-set procedures */
+ Language::cpp_variable(name, iname, t);
++ }
++}
++
++void GUILE::pragma(char *lang, char *cmd, char *value)
++{
++ if (strcmp(lang,(char*)"guile") == 0) {
++ if (strcmp(cmd, (char*)"beforereturn")==0) {
++ if (before_return)
++ Delete(before_return);
++ before_return = NewString(value);
++ }
+ }
+ }
diff --git a/devel/swig20/files/patch-Source::Modules1.1::guile.h b/devel/swig20/files/patch-Source::Modules1.1::guile.h
new file mode 100644
index 000000000000..6aa871c36d0e
--- /dev/null
+++ b/devel/swig20/files/patch-Source::Modules1.1::guile.h
@@ -0,0 +1,32 @@
+Index: SWIG/Source/Modules1.1/guile.h
+diff -u SWIG/Source/Modules1.1/guile.h:1.15 SWIG/Source/Modules1.1/guile.h:1.15.2.2
+--- Source/Modules1.1/guile.h:1.15 Tue Sep 19 09:50:15 2000
++++ Source/Modules1.1/guile.h Thu Mar 1 18:28:02 2001
+@@ -36,10 +36,18 @@
+ GUILE_LSTYLE_HOBBIT // use (hobbit4d link)
+ } linkage;
+ File *procdoc;
++ enum {
++ GUILE_1_4,
++ PLAIN,
++ TEXINFO
++ } docformat;
+ int emit_setters;
+ int struct_member;
++ String *before_return;
+ void emit_linkage(char *module_name);
+-
++ void write_doc(const String *proc_name,
++ const String *signature,
++ const String *doc);
+ public :
+ GUILE ();
+ void parse_args (int, char *argv[]);
+@@ -54,6 +62,7 @@
+ void set_init (char *);
+ void create_command (char *, char *) { };
+ void cpp_variable(char *name, char *iname, SwigType *t);
++ void pragma(char *lang, char *cmd, char *value);
+ };
+
+ /* guile.h ends here */