Changed %module xx_yy_zz to generate xx-yy-zz.scm and
xx-yy-zz_wrap.c[xx] (and xx-yy-zz-clos.scm and xx-yy-zz-generic.scm if using TinyCLOS). Consistent with the "namifying" of other C identifiers. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4535 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
9e8965b07f
commit
6daf196bf4
13 changed files with 95 additions and 83 deletions
|
|
@ -55,8 +55,8 @@
|
|||
difficult to wrap by hand in CHICKEN -- and its <strong>typed
|
||||
pointer representation</strong>, essential for C and C++
|
||||
libraries involving structures or classes.
|
||||
|
||||
</p>
|
||||
|
||||
</p>
|
||||
|
||||
<a name="n2"></a><H2>22.1 Preliminaries</H2>
|
||||
|
||||
|
|
@ -73,7 +73,7 @@
|
|||
|
||||
You may want to look at any of the examples in Examples/chicken/
|
||||
or Examples/GIFPlot/Chicken for the basic steps to run SWIG
|
||||
CHICKEN.
|
||||
CHICKEN.
|
||||
|
||||
We will generically refer to the <em>wrapper</em> as the
|
||||
generated files.
|
||||
|
|
@ -112,8 +112,8 @@
|
|||
<pre>% swig -chicken -c++ example.i</pre>
|
||||
</blockquote>
|
||||
This will generate <tt>example_wrap.cxx</tt>,
|
||||
<tt>example.scm</tt>, <tt>example_generic.scm</tt> and
|
||||
<tt>example_clos.scm</tt>. The basic Scheme code must be
|
||||
<tt>example.scm</tt>, <tt>example-generic.scm</tt> and
|
||||
<tt>example-clos.scm</tt>. The basic Scheme code must be
|
||||
compiled to C using your system's CHICKEN compiler.
|
||||
<blockquote>
|
||||
<pre>% chicken example.scm -output-file oexample.c</pre>
|
||||
|
|
@ -248,16 +248,16 @@
|
|||
generic procedures to implement an object-oriented Scheme
|
||||
system. Please consult a Scheme book if you are unfamiliar
|
||||
with the concept.
|
||||
|
||||
|
||||
<br></br>
|
||||
|
||||
CHICKEN has a modified version of TinyCLOS, which SWIG CHICKEN
|
||||
uses in C++ mode. SWIG CHICKEN generates a
|
||||
<tt>xxx_generic.scm</tt> and a <tt>xxx_clos.scm</tt> file, which
|
||||
<tt>xxx-generic.scm</tt> and a <tt>xxx-clos.scm</tt> file, which
|
||||
contain TinyCLOS macros. When using these macros, you will need
|
||||
to <tt>(include "xxx_generic")</tt> all the generic macros your
|
||||
to <tt>(include "xxx-generic")</tt> all the generic macros your
|
||||
program needs, and <strong>then</strong> <tt>(include
|
||||
"xxx_clos")</tt> all the metaobject (class) macros your program
|
||||
"xxx-clos")</tt> all the metaobject (class) macros your program
|
||||
needs.
|
||||
|
||||
<br></br>
|
||||
|
|
@ -391,9 +391,9 @@ CHICKEN_HOME=/usr/local/share/chicken</pre>
|
|||
to SWIG</em> will have correct TinyCLOS representations based on
|
||||
<code>SIMPLE_CLOS_OBJECT</code>. SWIG "knows" the classes that
|
||||
are exposed in the SWIG interface file; it "fully knows" only
|
||||
those classes that are not forward declarations.
|
||||
those classes that are not forward declarations.
|
||||
|
||||
<br></br>
|
||||
<br></br>
|
||||
|
||||
A real-world example of the "fully knows" problem is found in
|
||||
the VTK visualization library. All VTK classes are derived from
|
||||
|
|
@ -488,13 +488,13 @@ CHICKEN_HOME=/usr/local/share/chicken</pre>
|
|||
<code>vtkRenderer</code>.
|
||||
|
||||
</p>
|
||||
|
||||
|
||||
<a name="n15"></a><H2>22.7 Pointers</H2>
|
||||
|
||||
|
||||
<p>
|
||||
For pointer types, SWIG uses CHICKEN tagged pointers.
|
||||
|
||||
|
||||
A tagged pointer is an ordinary CHICKEN pointer with an
|
||||
extra slot for an arbitrary Scheme object. With SWIG
|
||||
CHICKEN, this Scheme object is a reference to a type-info
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ INCLUDE =
|
|||
SWIGOPT =
|
||||
CFLAGS =
|
||||
|
||||
all:: $(TARGET) example_generic.scm example_clos.scm
|
||||
all:: $(TARGET) example-generic.scm example-clos.scm
|
||||
|
||||
csi.c:
|
||||
$(MAKE) -f $(TOP)/Makefile TARGET='csi.c' \
|
||||
|
|
@ -19,7 +19,7 @@ precsi.c: precsi.scm
|
|||
$(MAKE) -f $(TOP)/Makefile TARGET='precsi.c' \
|
||||
INTERFACE='$<' chicken
|
||||
|
||||
example_wrap.cxx example.scm example_generic.scm example_clos.scm: example.i
|
||||
example_wrap.cxx example.scm example-generic.scm example-clos.scm: example.i
|
||||
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
|
||||
INCLUDE='$(INCLUDE)' INTERFACE='example.i' chicken_cpp
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ module:: $(CHICKSRCS) $(SRCS) $(CXXSRCS)
|
|||
clean::
|
||||
$(MAKE) -f $(TOP)/Makefile chicken_clean
|
||||
rm -f $(CHICKGEN)
|
||||
rm -f example.scm example_generic.scm example_clos.scm
|
||||
rm -f example.scm example-generic.scm example-clos.scm
|
||||
rm -f $(TARGET)
|
||||
|
||||
check:: all
|
||||
|
|
|
|||
|
|
@ -85,9 +85,9 @@ public:
|
|||
(display "----------------\n")
|
||||
(display "
|
||||
;; ALL generic methods must be included first
|
||||
(include \"example_generic\")
|
||||
(include \"example-generic\")
|
||||
;; After generic methods are defined, can include TinyCLOS code
|
||||
(include \"example_clos\")
|
||||
(include \"example-clos\")
|
||||
|
||||
(define A-CIRCLE-SHAPE (make <example:Circle> %radius))
|
||||
(-get-x- %shapeObject)
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
;; by SWIG.
|
||||
|
||||
;; All generic methods must be included first
|
||||
(include "example_generic")
|
||||
(include "example-generic")
|
||||
|
||||
;; After generic are defined, can include TinyCLOS code
|
||||
(include "example_clos")
|
||||
(include "example-clos")
|
||||
|
||||
;; ----- Object creation -----
|
||||
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ module:: $(CHICKSRCS) $(SRCS) $(CXXSRCS)
|
|||
clean::
|
||||
$(MAKE) -f $(TOP)/Makefile chicken_clean
|
||||
rm -f $(CHICKGEN)
|
||||
rm -f example.scm example_generic.scm example_clos.scm
|
||||
rm -f example.scm example-generic.scm example-clos.scm
|
||||
rm -f $(TARGET)
|
||||
|
||||
check:: all
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ module:: $(CHICKSRCS) $(SRCS) $(CXXSRCS)
|
|||
clean::
|
||||
$(MAKE) -f $(TOP)/Makefile chicken_clean
|
||||
rm -f $(CHICKGEN)
|
||||
rm -f example.scm example_generic.scm example_clos.scm
|
||||
rm -f example.scm example-generic.scm example-clos.scm
|
||||
rm -f $(TARGET)
|
||||
|
||||
check:: all
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ INCLUDE =
|
|||
SWIGOPT =
|
||||
CFLAGS =
|
||||
|
||||
all:: $(TARGET) example_generic.scm example_clos.scm
|
||||
all:: $(TARGET) example-generic.scm example-clos.scm
|
||||
|
||||
csi.c:
|
||||
$(MAKE) -f $(TOP)/Makefile TARGET='csi.c' \
|
||||
|
|
@ -19,7 +19,7 @@ precsi.c: precsi.scm
|
|||
$(MAKE) -f $(TOP)/Makefile TARGET='precsi.c' \
|
||||
INTERFACE='$<' chicken
|
||||
|
||||
example_wrap.cxx example.scm example_generic.scm example_clos.scm: example.i
|
||||
example_wrap.cxx example.scm example-generic.scm example-clos.scm: example.i
|
||||
$(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
|
||||
INCLUDE='$(INCLUDE)' INTERFACE='example.i' chicken_cpp
|
||||
|
||||
|
|
@ -42,7 +42,7 @@ module:: $(CHICKSRCS) $(SRCS) $(CXXSRCS)
|
|||
clean::
|
||||
$(MAKE) -f $(TOP)/Makefile chicken_clean
|
||||
rm -f $(CHICKGEN)
|
||||
rm -f example.scm example_generic.scm example_clos.scm
|
||||
rm -f example.scm example-generic.scm example-clos.scm
|
||||
rm -f $(TARGET)
|
||||
|
||||
check:: all
|
||||
|
|
|
|||
|
|
@ -43,9 +43,9 @@ class Foo {
|
|||
(display "----------------\n")
|
||||
(display "
|
||||
;; ALL generic methods must be included first
|
||||
(include \"example_generic\")
|
||||
(include \"example-generic\")
|
||||
;; After generic methods are defined, can include TinyCLOS code
|
||||
(include \"example_clos\")
|
||||
(include \"example-clos\")
|
||||
|
||||
(+example:foo+ %x-int)
|
||||
(+example:foo+ %x-string)
|
||||
|
|
|
|||
|
|
@ -34,9 +34,9 @@ Trying TinyCLOS code ...
|
|||
")
|
||||
|
||||
;; ALL generic methods must be included first
|
||||
(include "example_generic")
|
||||
(include "example-generic")
|
||||
;; After generic methods are defined, can include TinyCLOS code
|
||||
(include "example_clos")
|
||||
(include "example-clos")
|
||||
|
||||
(+example:foo+ 1)
|
||||
(+example:foo+ "some string")
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ module:: $(CHICKSRCS) $(SRCS) $(CXXSRCS)
|
|||
clean::
|
||||
$(MAKE) -f $(TOP)/Makefile chicken_clean
|
||||
rm -f $(CHICKGEN)
|
||||
rm -f example.scm example_generic.scm example_clos.scm
|
||||
rm -f example.scm example-generic.scm example-clos.scm
|
||||
rm -f $(TARGET)
|
||||
|
||||
check:: all
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ module:: $(CHICKSRCS) $(SRCS) $(CXXSRCS)
|
|||
clean::
|
||||
$(MAKE) -f $(TOP)/Makefile chicken_clean
|
||||
rm -f $(CHICKGEN)
|
||||
rm -f example.scm example_generic.scm example_clos.scm
|
||||
rm -f example.scm example-generic.scm example-clos.scm
|
||||
rm -f $(TARGET)
|
||||
|
||||
check:: all
|
||||
|
|
|
|||
|
|
@ -652,13 +652,13 @@ CHICKW(quasiquote);
|
|||
extern "C" {
|
||||
#endif
|
||||
/* Chicken initialization function */
|
||||
SWIGEXPORT(void) $module_swig_init(int, C_word, C_word) C_noret;
|
||||
SWIGEXPORT(void) $realmodule_swig_init(int, C_word, C_word) C_noret;
|
||||
/* Tag functions */
|
||||
SWIGEXPORT(int) $module_swig_num_types (void);
|
||||
SWIGEXPORT(const char*) $module_swig_type_name (int);
|
||||
SWIGEXPORT(void*) $module_swig_type_ptr (int);
|
||||
SWIGEXPORT(const char*) $module_swig_type_str (int);
|
||||
SWIGEXPORT(void) $module_swig_type_tag (int, C_word);
|
||||
SWIGEXPORT(int) $realmodule_swig_num_types (void);
|
||||
SWIGEXPORT(const char*) $realmodule_swig_type_name (int);
|
||||
SWIGEXPORT(void*) $realmodule_swig_type_ptr (int);
|
||||
SWIGEXPORT(const char*) $realmodule_swig_type_str (int);
|
||||
SWIGEXPORT(void) $realmodule_swig_type_tag (int, C_word);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
@ -667,7 +667,7 @@ SWIGEXPORT(void) $module_swig_type_tag (int, C_word);
|
|||
%insert(init) %{
|
||||
/* CHICKEN initialization function */
|
||||
SWIGEXPORT(void)
|
||||
$module_swig_init(int argc, C_word closure, C_word continuation) {
|
||||
$realmodule_swig_init(int argc, C_word closure, C_word continuation) {
|
||||
static int typeinit = 0;
|
||||
int i;
|
||||
|
||||
|
|
@ -686,29 +686,29 @@ $module_swig_init(int argc, C_word closure, C_word continuation) {
|
|||
/* Tag functions */
|
||||
|
||||
SWIGEXPORT(int)
|
||||
$module_swig_num_types (void)
|
||||
$realmodule_swig_num_types (void)
|
||||
{
|
||||
int i;
|
||||
for (i=0; swig_types_initial[i]; i++);
|
||||
return i;
|
||||
}
|
||||
SWIGEXPORT(const char*)
|
||||
$module_swig_type_name (int index)
|
||||
$realmodule_swig_type_name (int index)
|
||||
{
|
||||
return swig_types[index]->name;
|
||||
}
|
||||
SWIGEXPORT(void*)
|
||||
$module_swig_type_ptr (int index)
|
||||
$realmodule_swig_type_ptr (int index)
|
||||
{
|
||||
return (void*) (swig_types[index]);
|
||||
}
|
||||
SWIGEXPORT(const char*)
|
||||
$module_swig_type_str (int index)
|
||||
$realmodule_swig_type_str (int index)
|
||||
{
|
||||
return swig_types[index]->str;
|
||||
}
|
||||
SWIGEXPORT(void)
|
||||
$module_swig_type_tag (int index, C_word tag)
|
||||
$realmodule_swig_type_tag (int index, C_word tag)
|
||||
{
|
||||
swig_chicken_clientdata *data =
|
||||
(swig_chicken_clientdata*) malloc (sizeof (swig_chicken_clientdata));
|
||||
|
|
@ -720,17 +720,17 @@ $module_swig_type_tag (int index, C_word tag)
|
|||
|
||||
%insert(chicken) %{
|
||||
(declare
|
||||
(foreign-declare "C_extern int $module_swig_num_types (void);")
|
||||
(foreign-declare "C_extern char* $module_swig_type_name (int);")
|
||||
(foreign-declare "C_extern void* $module_swig_type_ptr (int);")
|
||||
(foreign-declare "C_extern char* $module_swig_type_str (int);")
|
||||
(foreign-declare "C_extern void $module_swig_type_tag (int, C_word);"))
|
||||
(foreign-declare "C_extern int $realmodule_swig_num_types (void);")
|
||||
(foreign-declare "C_extern char* $realmodule_swig_type_name (int);")
|
||||
(foreign-declare "C_extern void* $realmodule_swig_type_ptr (int);")
|
||||
(foreign-declare "C_extern char* $realmodule_swig_type_str (int);")
|
||||
(foreign-declare "C_extern void $realmodule_swig_type_tag (int, C_word);"))
|
||||
(define-record swig-$module-tag class name ptr str)
|
||||
(define-record-printer (swig-$module-tag tag out)
|
||||
(fprintf out "#<c++ ~S>(~A)" (swig-$module-tag-str tag)
|
||||
(swig-$module-tag-ptr tag)))
|
||||
(define swig-$module-tag-num
|
||||
((foreign-lambda int "$module_swig_num_types")))
|
||||
((foreign-lambda int "$realmodule_swig_num_types")))
|
||||
(define swig-$module-tags (make-vector swig-$module-tag-num #f))
|
||||
(letrec
|
||||
((gen
|
||||
|
|
@ -745,13 +745,13 @@ $module_swig_type_tag (int index, C_word tag)
|
|||
(make-swig-$module-tag
|
||||
1000
|
||||
((foreign-lambda
|
||||
c-string "$module_swig_type_name" int) index)
|
||||
c-string "$realmodule_swig_type_name" int) index)
|
||||
((foreign-lambda
|
||||
c-pointer "$module_swig_type_ptr" int) index)
|
||||
c-pointer "$realmodule_swig_type_ptr" int) index)
|
||||
((foreign-lambda
|
||||
c-string "$module_swig_type_str" int) index))))
|
||||
c-string "$realmodule_swig_type_str" int) index))))
|
||||
(vector-set! swig-$module-tags index tag)
|
||||
((foreign-lambda void "$module_swig_type_tag"
|
||||
((foreign-lambda void "$realmodule_swig_type_tag"
|
||||
int scheme-object) index tag)))
|
||||
indices)))
|
||||
%}
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ CHICKEN Options (available with -chicken)\n\
|
|||
static String *prefix=0;
|
||||
static int noprefix=0;
|
||||
static String *module=0;
|
||||
static String *realmodule=0;
|
||||
static char *chicken_path=(char*)"chicken";
|
||||
static int clos = 1;
|
||||
static int generic = 1;
|
||||
|
|
@ -203,6 +204,10 @@ CHICKEN::main(int argc, char *argv[])
|
|||
int
|
||||
CHICKEN::top(Node *n)
|
||||
{
|
||||
String *chicken_filename;
|
||||
String *clos_filename;
|
||||
String *generic_filename;
|
||||
|
||||
if (!CPlusPlus) {
|
||||
clos = 0;
|
||||
generic = 0;
|
||||
|
|
@ -223,6 +228,9 @@ CHICKEN::top(Node *n)
|
|||
f_init = NewString("");
|
||||
f_header = NewString("");
|
||||
f_wrappers = NewString("");
|
||||
chicken_filename = NewString("");
|
||||
clos_filename = NewString("");
|
||||
generic_filename = NewString("");
|
||||
|
||||
/* Register file targets with the SWIG file handler */
|
||||
Swig_register_filebyname("header",f_header);
|
||||
|
|
@ -239,7 +247,9 @@ CHICKEN::top(Node *n)
|
|||
}
|
||||
|
||||
/* Set module name */
|
||||
module = Copy(Getattr(n,"name"));
|
||||
realmodule = Copy(Getattr(n,"name"));
|
||||
module = Copy(realmodule);
|
||||
namify(module);
|
||||
|
||||
/* Set prefix. If a prefix has been specified make sure it ends
|
||||
in a '-' */
|
||||
|
|
@ -255,11 +265,9 @@ CHICKEN::top(Node *n)
|
|||
}
|
||||
}
|
||||
|
||||
char filen[256];
|
||||
|
||||
sprintf(filen,"%s%s.scm", Swig_file_dirname(outfile), Char(module));
|
||||
if ((f_scm = NewFile(filen,"w")) == 0) {
|
||||
Printf(stderr,"Unable to open %s\n", filen);
|
||||
Printf(chicken_filename,"%s%s.scm", Swig_file_dirname(outfile), module);
|
||||
if ((f_scm = NewFile(chicken_filename,"w")) == 0) {
|
||||
Printf(stderr,"Unable to open %s\n", chicken_filename);
|
||||
SWIG_exit(EXIT_FAILURE);
|
||||
}
|
||||
f_scm_stubs = NewString("");
|
||||
|
|
@ -274,15 +282,15 @@ CHICKEN::top(Node *n)
|
|||
Printv(f_scm,"(cond-expand ((or chicken-compile-shared shared)) (else (declare (unit ", module, "))))\n\n", NIL);
|
||||
#ifdef JONAH_IS_CRAZY
|
||||
Printv(f_scm,"(declare \n",
|
||||
tab4, "(foreign-declare \"void* ", module,
|
||||
tab4, "(foreign-declare \"void* ", realmodule,
|
||||
"_swig_get_type(char*);\"))\n", NIL);
|
||||
#endif
|
||||
#ifndef INIT_BINDING
|
||||
Printv(f_scm,"(declare \n",
|
||||
tab4, "(hide swig-init)\n",
|
||||
tab4, "(foreign-declare \"C_extern void ", module,
|
||||
tab4, "(foreign-declare \"C_extern void ", realmodule,
|
||||
"_swig_init(int,C_word,C_word) C_noret;\"))\n", NIL);
|
||||
Printv(f_scm,"(define swig-init (##core#primitive \"", module,
|
||||
Printv(f_scm,"(define swig-init (##core#primitive \"", realmodule,
|
||||
"_swig_init\"))\n", NIL);
|
||||
Printv(f_scm,"(swig-init)\n\n", NIL);
|
||||
#endif
|
||||
|
|
@ -300,10 +308,10 @@ CHICKEN::top(Node *n)
|
|||
|
||||
|
||||
if (generic) {
|
||||
sprintf(filen,"%s%s_generic.scm", Swig_file_dirname(outfile),
|
||||
Char(module));
|
||||
if ((f_generic = NewFile(filen,"w")) == 0) {
|
||||
Printf(stderr,"Unable to open %s\n", filen);
|
||||
Printf(generic_filename,"%s%s-generic.scm",
|
||||
Swig_file_dirname(outfile), module);
|
||||
if ((f_generic = NewFile(generic_filename,"w")) == 0) {
|
||||
Printf(stderr,"Unable to open %s\n", generic_filename);
|
||||
SWIG_exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
|
@ -317,10 +325,9 @@ CHICKEN::top(Node *n)
|
|||
}
|
||||
|
||||
if (clos) {
|
||||
sprintf(filen,"%s%s_clos.scm", Swig_file_dirname(outfile),
|
||||
Char(module));
|
||||
if ((f_clos = NewFile(filen,"w")) == 0) {
|
||||
Printf(stderr,"Unable to open %s\n", filen);
|
||||
Printf(clos_filename,"%s%s-clos.scm", Swig_file_dirname(outfile), module);
|
||||
if ((f_clos = NewFile(clos_filename,"w")) == 0) {
|
||||
Printf(stderr,"Unable to open %s\n", clos_filename);
|
||||
SWIG_exit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
|
@ -334,7 +341,7 @@ CHICKEN::top(Node *n)
|
|||
Printf (f_clos, "(declare (uses extras))\n");
|
||||
}
|
||||
|
||||
Printf(f_header,"#define SWIG_name \"%s\"\n", module);
|
||||
Printf(f_header,"#define SWIG_name \"%s\"\n", realmodule);
|
||||
|
||||
Printf(f_wrappers,"#ifdef __cplusplus\n");
|
||||
Printf(f_wrappers,"extern \"C\" {\n");
|
||||
|
|
@ -345,7 +352,7 @@ CHICKEN::top(Node *n)
|
|||
"#ifdef __cplusplus\n",
|
||||
"extern \"C\"\n",
|
||||
"#endif\n",
|
||||
"SWIGEXPORT(void *) ", module, "_swig_get_type (char *type) {\n",
|
||||
"SWIGEXPORT(void *) ", realmodule, "_swig_get_type (char *type) {\n",
|
||||
"int i;\n",
|
||||
"for (i = 0; swig_types_initial[i]; i++) {\n",
|
||||
"if (strcmp (type, swig_types[i]->name) == 0) ",
|
||||
|
|
@ -367,7 +374,7 @@ CHICKEN::top(Node *n)
|
|||
{
|
||||
String *tmp = NewString("");
|
||||
String *tmp2 = NewString("swig-init");
|
||||
Printv(tmp, module, "_swig_init", NIL);
|
||||
Printv(tmp, realmodule, "_swig_init", NIL);
|
||||
addMethod(tmp, tmp2, tmp);
|
||||
Delete(tmp);
|
||||
Delete(tmp2);
|
||||
|
|
@ -392,6 +399,10 @@ CHICKEN::top(Node *n)
|
|||
Replaceall(f_init_helper, "$nummethods", buftmp);
|
||||
Replaceall(f_init_helper, "$symsize", f_sym_size);
|
||||
|
||||
Delete(chicken_filename);
|
||||
Delete(clos_filename);
|
||||
Delete(generic_filename);
|
||||
|
||||
Printv(f_scm, f_scm_stubs, "\n",NIL);
|
||||
Close(f_scm);
|
||||
Delete(f_scm);
|
||||
|
|
@ -439,6 +450,7 @@ CHICKEN::insertDirective(Node *n)
|
|||
{
|
||||
String *code = Getattr(n,"code");
|
||||
Replaceall(code, "$module", module);
|
||||
Replaceall(code, "$realmodule", realmodule);
|
||||
return Language::insertDirective(n);
|
||||
}
|
||||
|
||||
|
|
@ -509,7 +521,7 @@ CHICKEN::functionWrapper(Node *n)
|
|||
num_arguments = emit_num_arguments(l);
|
||||
num_required = emit_num_required(l);
|
||||
|
||||
Append(wname, module);
|
||||
Append(wname, realmodule);
|
||||
Append(wname, Swig_name_wrapper(iname));
|
||||
if (overname) {
|
||||
Append(wname, overname);
|
||||
|
|
@ -813,7 +825,7 @@ CHICKEN::functionWrapper(Node *n)
|
|||
Printv(f_scm, "(declare (foreign-declare \"C_extern ",
|
||||
declfunc, " C_noret;\"))\n", NIL);
|
||||
Printv(f_scm, "(define ", prefix, scmname,
|
||||
" (##core#primitive \"", module, "_wrap_", iname,
|
||||
" (##core#primitive \"", realmodule, "_wrap_", iname,
|
||||
"\"))\n\n", NIL);
|
||||
#endif
|
||||
}
|
||||
|
|
@ -927,7 +939,7 @@ CHICKEN::variableWrapper(Node *n) {
|
|||
num_required = emit_num_required(l);
|
||||
|
||||
// evaluation function names
|
||||
Append(wname, module);
|
||||
Append(wname, realmodule);
|
||||
Append(wname, Swig_name_wrapper(iname));
|
||||
if (overname) {
|
||||
Append(wname, overname);
|
||||
|
|
@ -1093,7 +1105,7 @@ CHICKEN::variableWrapper(Node *n) {
|
|||
wname, "(int,C_word,C_word,C_word)"
|
||||
" C_noret;\"))\n", NIL);
|
||||
Printv(f_scm, "(define ", prefix, scmname,
|
||||
" (##core#primitive \"", module, "_wrap_", iname,
|
||||
" (##core#primitive \"", realmodule, "_wrap_", iname,
|
||||
"\"))\n\n", NIL);
|
||||
#endif
|
||||
|
||||
|
|
@ -1169,7 +1181,7 @@ CHICKEN::constantWrapper(Node *n)
|
|||
if (!addSymbol(iname,n)) return SWIG_ERROR;
|
||||
}
|
||||
|
||||
Append(wname, module);
|
||||
Append(wname, realmodule);
|
||||
Append(wname, Swig_name_wrapper(iname));
|
||||
if (overname) {
|
||||
Append(wname, overname);
|
||||
|
|
@ -1281,7 +1293,7 @@ CHICKEN::constantWrapper(Node *n)
|
|||
"C_word value)"
|
||||
" C_noret;\"))\n", NIL);
|
||||
Printv(f_scm, "(define ", prefix, scmname,
|
||||
" (##core#primitive \"", module, "_wrap_", iname,
|
||||
" (##core#primitive \"", realmodule, "_wrap_", iname,
|
||||
"\"))\n\n", NIL);
|
||||
#endif
|
||||
|
||||
|
|
@ -1350,7 +1362,7 @@ CHICKEN::classHandler(Node *n)
|
|||
tab4,"(make-swig-",prefix,"tag ",
|
||||
"1000 \"_p_",Getattr(n,"sym:name"),"\"\n",
|
||||
tab8,"((foreign-lambda* c-pointer ()\n",
|
||||
tab8, tab4, "\"return (",module,
|
||||
tab8, tab4, "\"return (",realmodule,
|
||||
"_swig_get_type (\\\"_p_",Getattr(n,"sym:name"),"\\\"));\"))\n",
|
||||
tab8, "\"",Getattr(n,"sym:name")," *\"))\n", NIL);
|
||||
#endif
|
||||
|
|
@ -1707,7 +1719,7 @@ CHICKEN::dispatchFunction(Node *n)
|
|||
String *scmname = NewString(iname);
|
||||
|
||||
namify(scmname);
|
||||
Append(wname, module);
|
||||
Append(wname, realmodule);
|
||||
Append(wname, Swig_name_wrapper(iname));
|
||||
|
||||
#ifndef BINDING
|
||||
|
|
@ -1749,9 +1761,9 @@ CHICKEN::dispatchFunction(Node *n)
|
|||
/* Create a binding for this function */
|
||||
#ifdef BINDING
|
||||
Printv(f_scm, "(declare (foreign-declare \"C_extern ",
|
||||
module, wname, "(int, C_word, C_word, C_word) C_noret;\"))\n", NIL);
|
||||
realmodule, wname, "(int, C_word, C_word, C_word) C_noret;\"))\n", NIL);
|
||||
Printv(f_scm, "(define swig-", prefix, scmname,
|
||||
"-prim (##core#primitive \"", module, "_wrap_", iname,
|
||||
"-prim (##core#primitive \"", realmodule, "_wrap_", iname,
|
||||
"\"))\n", NIL);
|
||||
Printv(f_scm, "(define (", prefix, scmname,
|
||||
" . args) (swig-", prefix, scmname, "-prim args))\n\n", NIL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue