Updated Guile modules.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@815 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
011819c2d1
commit
277186567a
8 changed files with 61 additions and 35 deletions
|
|
@ -9,10 +9,17 @@ INCLUDE = -I../../Include
|
||||||
|
|
||||||
all:: static
|
all:: static
|
||||||
|
|
||||||
static::
|
dynamic::
|
||||||
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
$(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \
|
||||||
|
SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
||||||
INCLUDE='$(INCLUDE)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \
|
INCLUDE='$(INCLUDE)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \
|
||||||
TARGET='gifguile' INTERFACE='$(INTERFACE)' guile_static
|
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile
|
||||||
|
|
||||||
|
static::
|
||||||
|
$(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \
|
||||||
|
SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
||||||
|
INCLUDE='$(INCLUDE)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \
|
||||||
|
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_static
|
||||||
|
|
||||||
clean::
|
clean::
|
||||||
rm -f *_wrap* *.o *~ *.so gifguile .~* core *.gif
|
rm -f *_wrap* *.o *~ *.so gifguile .~* core *.gif
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
;;; Plot a 3D function
|
;;; Plot a 3D function
|
||||||
|
|
||||||
|
;; Use the wrapped GIFPlot library
|
||||||
|
(use-modules (gifplot))
|
||||||
|
|
||||||
;; Here is the function to plot
|
;; Here is the function to plot
|
||||||
(define (func x y)
|
(define (func x y)
|
||||||
(* 5
|
(* 5
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,17 @@ INCLUDE = -I../../Include
|
||||||
|
|
||||||
all:: static
|
all:: static
|
||||||
|
|
||||||
static::
|
dynamic::
|
||||||
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
$(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \
|
||||||
|
SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
||||||
INCLUDE='$(INCLUDE)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \
|
INCLUDE='$(INCLUDE)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \
|
||||||
TARGET='gifguile' INTERFACE='$(INTERFACE)' guile_static
|
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile
|
||||||
|
|
||||||
|
static::
|
||||||
|
$(MAKE) -f $(TOP)/Makefile TOP='$(TOP)' \
|
||||||
|
SRCS='$(SRCS)' SWIG='$(SWIG)' \
|
||||||
|
INCLUDE='$(INCLUDE)' LIBS='$(LIBS)' SWIGOPT='$(SWIGOPT)' \
|
||||||
|
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_static
|
||||||
|
|
||||||
clean::
|
clean::
|
||||||
rm -f *_wrap* *.o *~ *.so gifguile .~* core *.gif
|
rm -f *_wrap* *.o *~ *.so gifguile .~* core *.gif
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,11 @@
|
||||||
This is a very minimalistic example in which just a few functions
|
This is a very minimalistic example in which just a few functions
|
||||||
and constants from library are wrapped and used to draw some simple
|
and constants from library are wrapped and used to draw some simple
|
||||||
shapes. Run `gifguile -s runme.scm'.
|
shapes.
|
||||||
|
|
||||||
|
`make' will build a version of Guile which defines an additional
|
||||||
|
module (simple). Run `./simple-guile -s runme.scm' to test it.
|
||||||
|
|
||||||
|
`make dynamic' will build a dynamically loadable module, which can be
|
||||||
|
loaded from any Guile interpreter. Run `guile -s runme.scm' to test
|
||||||
|
it. The `use-modules' call in `runme.scm' dynamically loads the
|
||||||
|
module.
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,8 @@
|
||||||
;; Draw some simple shapes
|
;;; Draw some simple shapes
|
||||||
|
|
||||||
|
;; Use the wrapped GIFPlot library
|
||||||
|
(use-modules (simple))
|
||||||
|
|
||||||
(display "Drawing some basic shapes\n")
|
(display "Drawing some basic shapes\n")
|
||||||
|
|
||||||
(define cmap (new-ColorMap))
|
(define cmap (new-ColorMap))
|
||||||
|
|
|
||||||
|
|
@ -244,39 +244,23 @@ python_static_cpp: $(SRCS)
|
||||||
GUILE_INCLUDE = @GUILEINCLUDE@
|
GUILE_INCLUDE = @GUILEINCLUDE@
|
||||||
GUILE_LIB = @GUILELIB@
|
GUILE_LIB = @GUILELIB@
|
||||||
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
|
||||||
# Build a C dynamically loadable module
|
|
||||||
# ----------------------------------------------------------------
|
|
||||||
|
|
||||||
guile-hobbit: $(SRCS)
|
|
||||||
$(SWIG) -guile -Linkage hobbit $(SWIGOPT) $(INTERFACE)
|
|
||||||
for f in $^ ; do $(libtool_comp) $(CC) -c -O2 $(INCLUDE) $$f ; done
|
|
||||||
$(libtool_link) $(CC) -g -O2 -o lib$^.la -rpath `pwd` $^
|
|
||||||
|
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
# Build a C dynamically loadable module
|
# Build a C dynamically loadable module
|
||||||
# ----------------------------------------------------------------
|
# ----------------------------------------------------------------
|
||||||
|
|
||||||
guile: $(SRCS)
|
guile: $(SRCS)
|
||||||
$(SWIG) -guile $(SWIGOPT) $(INTERFACE)
|
$(SWIG) -guile -Linkage ltdlmod $(SWIGOPT) $(INTERFACE)
|
||||||
for f in $(ISRCS) ; do $(libtool_comp) \
|
$(CC) -c $(CCSHARED) $(CFLAGS) $(INCLUDE) $(GUILE_INCLUDE) $(ISRCS) $(SRCS)
|
||||||
$(CC) -c $(INCLUDE) $(GUILE_INCLUDE) $(ISRCS) ; done
|
$(LDSHARED) $(OBJS) $(IOBJS) $(LIBS) -o lib$(TARGET)$(SO)
|
||||||
$(libtool_link) $(LDSHARED) -o lib$(TARGET)$(SO) \
|
|
||||||
$(OBJS) $(IOBJS) $(LIBS)
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
# Build a C++ dynamically loadable module
|
# Build a C++ dynamically loadable module
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
|
|
||||||
guile_cpp: $(SRCS)
|
guile_cpp: $(SRCS)
|
||||||
$(SWIG) -c++ -guile $(SWIGOPT) $(INTERFACE)
|
$(SWIG) -c++ -guile -Linkage ltdlmod $(SWIGOPT) $(INTERFACE)
|
||||||
$(libtool) compile \
|
$(CXX) -c $(CCSHARED) $(CFLAGS) $(INCLUDE) $(GUILE_INCLUDE) $(ISRCS) $(SRCS) $(CXXSRCS)
|
||||||
$(CXX) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(SRCS) $(CXXSRCS) \
|
$(LDSHARED) $(OBJS) $(IOBJS) $(LIBS) -o lib$(TARGET)$(SO)
|
||||||
$(INCLUDE) $(GUILE_INCLUDE)
|
|
||||||
$(libtool) link \
|
|
||||||
$(CXXSHARED) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) \
|
|
||||||
-o lib$(TARGET)$(SO)
|
|
||||||
|
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
# Build statically linked Guile interpreter
|
# Build statically linked Guile interpreter
|
||||||
|
|
@ -285,14 +269,16 @@ guile_cpp: $(SRCS)
|
||||||
GUILE_LIBOPTS = @GUILELINK@ @LIBS@ $(SYSLIBS)
|
GUILE_LIBOPTS = @GUILELINK@ @LIBS@ $(SYSLIBS)
|
||||||
|
|
||||||
guile_static: $(SRCS)
|
guile_static: $(SRCS)
|
||||||
$(SWIG) -guile -lguilemain.i $(SWIGOPT) $(INTERFACE)
|
$(SWIG) -guile -lguilemain.i -Linkage ltdlmod $(SWIGOPT) $(INTERFACE)
|
||||||
$(CC) $(CFLAGS) @LINKFORSHARED@ $(ISRCS) $(SRCS) $(INCLUDE) \
|
$(CC) $(CFLAGS) $(ISRCS) $(SRCS) $(INCLUDE) \
|
||||||
$(GUILE_INCLUDE) $(LIBS) -L$(GUILE_LIB) $(GUILE_LIBOPTS) -o $(TARGET)
|
-DSWIGINIT="scm_init_$(TARGET)_module();" \
|
||||||
|
$(GUILE_INCLUDE) $(LIBS) -L$(GUILE_LIB) $(GUILE_LIBOPTS) -o $(TARGET)-guile
|
||||||
|
|
||||||
guile_static_cpp: $(SRCS)
|
guile_static_cpp: $(SRCS)
|
||||||
$(SWIG) -c++ -guile -lguilemain.i $(SWIGOPT) $(INTERFACE)
|
$(SWIG) -c++ -guile -lguilemain.i -Linkage ltdlmod $(SWIGOPT) $(INTERFACE)
|
||||||
$(CXX) $(CFLAGS) $(ISRCS) $(SRCS) $(CXXSRCS) $(INCLUDE) \
|
$(CXX) $(CFLAGS) $(ISRCS) $(SRCS) $(CXXSRCS) $(INCLUDE) \
|
||||||
$(GUILE_INCLUDE) $(LIBS) -L$(GUILE_LIB) $(GUILE_LIBOPTS) -o $(TARGET)
|
-DSWIGINIT="scm_init_$(TARGET)_module();" \
|
||||||
|
$(GUILE_INCLUDE) $(LIBS) -L$(GUILE_LIB) $(GUILE_LIBOPTS) -o $(TARGET)-guile
|
||||||
|
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
|
|
|
||||||
|
|
@ -2,3 +2,10 @@ This directory contains examples for Guile.
|
||||||
|
|
||||||
simple - The simple example from the user manual.
|
simple - The simple example from the user manual.
|
||||||
matrix - A very simple Matrix example.
|
matrix - A very simple Matrix example.
|
||||||
|
|
||||||
|
Note that the examples in this directory build a special version of
|
||||||
|
Guile which includes the wrapped functions in the top-level module.
|
||||||
|
|
||||||
|
If you want to put the wrapped functions into an own module,
|
||||||
|
statically or dynamically linked, see the Examples/GIFPlot/Guile
|
||||||
|
directory.
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,11 @@ GDB_INTERFACE;
|
||||||
static void
|
static void
|
||||||
inner_main(void *closure, int argc, char **argv)
|
inner_main(void *closure, int argc, char **argv)
|
||||||
{
|
{
|
||||||
|
#ifdef SWIGINIT
|
||||||
|
SWIGINIT
|
||||||
|
#else
|
||||||
SWIG_init(); /* SWIG init function */
|
SWIG_init(); /* SWIG init function */
|
||||||
|
#endif
|
||||||
scm_shell(argc, argv); /* scheme interpreter */
|
scm_shell(argc, argv); /* scheme interpreter */
|
||||||
/* never reached: scm_shell will perform an exit */
|
/* never reached: scm_shell will perform an exit */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue