diff options
Diffstat (limited to 'Examples')
794 files changed, 7163 insertions, 3081 deletions
diff --git a/Examples/Makefile.in b/Examples/Makefile.in index 01febf575..cdc33d030 100644 --- a/Examples/Makefile.in +++ b/Examples/Makefile.in @@ -14,18 +14,41 @@ # # 2. To use this makefile, set required variables, eg SRCS, INTERFACE, # INTERFACEDIR, INCLUDES, LIBS, TARGET, and do a -# $(MAKE) -f Makefile.template.in SRCS='$(SRCS)' \ +# $(MAKE) -f Makefile.template.in SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' \ # INCLUDES='$(INCLUDES) LIBS='$(LIBS)' INTERFACE='$(INTERFACE)' \ # INTERFACEDIR='$(INTERFACEDIR)' TARGET='$(TARGET)' method # # 'method' describes what is being built. #--------------------------------------------------------------- +# Regenerate Makefile if Makefile.in or config.status have changed. +Makefile: @srcdir@/Makefile.in ../config.status + cd .. && $(SHELL) ./config.status Examples/Makefile + +# SRCDIR is the relative path to the current source directory +# - For in-source-tree builds, SRCDIR with be either '' or './', but +# '../' for the test suites that build in a subdir (e.g. C#, Java) +# - For out-of-source-tree builds, SRCDIR will be a relative +# path ending with a '/' + +# SRCDIR_SRCS, etc. are $(SRCS), etc. with $(SRCDIR) prepended +SRCDIR_SRCS = $(addprefix $(SRCDIR),$(SRCS)) +SRCDIR_CSRCS = $(addprefix $(SRCDIR),$(CSRCS)) +SRCDIR_CXXSRCS = $(addprefix $(SRCDIR),$(CXXSRCS)) + +ifeq (,$(SRCDIR)) +SRCDIR_INCLUDE = -I. +else +SRCDIR_INCLUDE = -I. -I$(SRCDIR) +endif + TARGET = CC = @CC@ CXX = @CXX@ +CPPFLAGS = $(SRCDIR_INCLUDE) CFLAGS = @PLATCFLAGS@ CXXFLAGS = @BOOST_CPPFLAGS@ @PLATCXXFLAGS@ +LDFLAGS = prefix = @prefix@ exec_prefix= @exec_prefix@ SRCS = @@ -33,7 +56,7 @@ INCLUDES = LIBS = INTERFACE = INTERFACEDIR = -INTERFACEPATH = $(INTERFACEDIR)$(INTERFACE) +INTERFACEPATH = $(SRCDIR)$(INTERFACEDIR)$(INTERFACE) SWIGOPT = SWIG = swig @@ -88,7 +111,7 @@ endif ################################################################## CPP_DLLIBS = #-L/usr/local/lib/gcc-lib/sparc-sun-solaris2.5.1/2.7.2 \ - -L/usr/local/lib -lg++ -lstdc++ -lgcc + -L/usr/local/lib -lg++ -lstdc++ -lgcc # Solaris workshop 5.0 # CPP_DLLIBS = -L/opt/SUNWspro/lib -lCrun @@ -107,6 +130,7 @@ OBJS = $(SRCS:.c=.@OBJEXT@) $(CXXSRCS:.cxx=.@OBJEXT@) distclean: rm -f Makefile + rm -f d/example.mk rm -f xml/Makefile ################################################################## @@ -126,39 +150,39 @@ TCL_DLNK = @TCLDYNAMICLINKING@ TCL_SO = @TCL_SO@ TCLLDSHARED = @TCLLDSHARED@ TCLCXXSHARED = @TCLCXXSHARED@ -TCL_SCRIPT = $(RUNME).tcl +TCL_SCRIPT = $(SRCDIR)$(RUNME).tcl # ----------------------------------------------------------- # Build a new version of the tclsh shell # ----------------------------------------------------------- -tclsh: $(SRCS) - $(SWIG) -tcl8 $(SWIGOPT) $(TCL_SWIGOPTS) -ltclsh.i $(INTERFACEPATH) - $(CC) $(CFLAGS) $(SRCS) $(ISRCS) $(INCLUDES) $(TCL_INCLUDE) \ +tclsh: $(SRCDIR_SRCS) + $(SWIG) -tcl8 $(SWIGOPT) $(TCL_SWIGOPTS) -ltclsh.i -o $(ISRCS) $(INTERFACEPATH) + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(TCL_INCLUDE) \ $(TCL_LIB) $(TCL_OPTS) $(LIBS) $(SYSLIBS) -o $(TARGET) -tclsh_cpp: $(SRCS) - $(SWIG) -tcl8 -c++ $(SWIGOPT) $(TCL_SWIGOPTS) -ltclsh.i $(INTERFACEPATH) - $(CXX) $(CXXFLAGS) $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(TCL_INCLUDE) \ +tclsh_cpp: $(SRCDIR_SRCS) + $(SWIG) -tcl8 -c++ $(SWIGOPT) $(TCL_SWIGOPTS) -ltclsh.i -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(TCL_INCLUDE) \ $(TCL_LIB) $(TCL_OPTS) $(LIBS) $(SYSLIBS) -o $(TARGET) # ----------------------------------------------------------- # Build a Tcl dynamic loadable module (you might need to tweak this) # ----------------------------------------------------------- -tcl: $(SRCS) - $(SWIG) -tcl8 $(SWIGOPT) $(TCL_SWIGOPTS) $(INTERFACEPATH) - $(CC) -c $(CCSHARED) $(CFLAGS) $(SRCS) $(ISRCS) $(INCLUDES) $(TCL_INCLUDE) - $(TCLLDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(TCL_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(TCL_SO) +tcl: $(SRCDIR_SRCS) + $(SWIG) -tcl8 $(SWIGOPT) $(TCL_SWIGOPTS) -o $(ISRCS) $(INTERFACEPATH) + $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(TCL_INCLUDE) + $(TCLLDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(TCL_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(TCL_SO) # ----------------------------------------------------------- # Build a Tcl7.5 dynamic loadable module for C++ # ----------------------------------------------------------- -tcl_cpp: $(SRCS) - $(SWIG) -tcl8 -c++ $(SWIGOPT) $(TCL_SWIGOPTS) $(INTERFACEPATH) - $(CXX) -c $(CCSHARED) $(CXXFLAGS) $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(TCL_INCLUDE) - $(TCLCXXSHARED) $(CXXFLAGS) $(OBJS) $(IOBJS) $(TCL_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(TCL_SO) +tcl_cpp: $(SRCDIR_SRCS) + $(SWIG) -tcl8 -c++ $(SWIGOPT) $(TCL_SWIGOPTS) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(TCL_INCLUDE) + $(TCLCXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(TCL_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(TCL_SO) # ----------------------------------------------------------------- # Run Tcl example @@ -181,7 +205,7 @@ tcl_version: tcl_clean: rm -f *_wrap* *~ .~* mytclsh@EXEEXT@ rm -f core @EXTRA_CLEAN@ - rm -f *.@OBJEXT@ *@SO@ + rm -f *.@OBJEXT@ *$(TCL_SO) ################################################################## ##### PERL 5 ###### @@ -201,44 +225,44 @@ PERL5_CCCDLFLAGS = @PERL5CCCDLFLAGS@ PERL5_LDFLAGS = @PERL5LDFLAGS@ PERL = @PERL@ PERL5_LIB = -L$(PERL5_INCLUDE) -l@PERL5LIB@ @LIBS@ $(SYSLIBS) -PERL5_SCRIPT = $(RUNME).pl +PERL5_SCRIPT = $(SRCDIR)$(RUNME).pl # ---------------------------------------------------------------- # Build a Perl5 dynamically loadable module (C) # ---------------------------------------------------------------- -perl5: $(SRCS) - $(SWIG) -perl5 $(SWIGOPT) $(INTERFACEPATH) - $(CC) -c -Dbool=char $(CCSHARED) $(CFLAGS) $(SRCS) $(ISRCS) $(INCLUDES) $(PERL5_CCFLAGS) $(PERL5_CCCDLFLAGS) -I$(PERL5_INCLUDE) - $(LDSHARED) $(CFLAGS) $(PERL5_CCDLFLAGS) $(OBJS) $(IOBJS) $(PERL5_LDFLAGS) $(PERL5_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) +perl5: $(SRCDIR_SRCS) + $(SWIG) -perl5 $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(CC) -c -Dbool=char $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(PERL5_CCFLAGS) $(PERL5_CCCDLFLAGS) -I$(PERL5_INCLUDE) + $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(PERL5_CCDLFLAGS) $(OBJS) $(IOBJS) $(PERL5_LDFLAGS) $(PERL5_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) # ---------------------------------------------------------------- # Build a Perl5 dynamically loadable module (C++) # ---------------------------------------------------------------- -perl5_cpp: $(SRCS) - $(SWIG) -perl5 -c++ $(SWIGOPT) $(INTERFACEPATH) - $(CXX) -c $(CCSHARED) $(CXXFLAGS) $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(PERL5_CCFLAGS) $(PERL5_CCCDLFLAGS) -I$(PERL5_INCLUDE) - $(CXXSHARED) $(CXXFLAGS) $(PERL5_CCDLFLAGS) $(OBJS) $(IOBJS) $(PERL5_LDFLAGS) $(PERL5_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) +perl5_cpp: $(SRCDIR_SRCS) + $(SWIG) -perl5 -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(PERL5_CCFLAGS) $(PERL5_CCCDLFLAGS) -I$(PERL5_INCLUDE) + $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(PERL5_CCDLFLAGS) $(OBJS) $(IOBJS) $(PERL5_LDFLAGS) $(PERL5_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) # ---------------------------------------------------------------- # Build a module from existing XS C source code. (ie. from xsubpp). # ---------------------------------------------------------------- -perl5_xs: $(SRCS) - $(CC) -c $(CCSHARED) $(CFLAGS) $(SRCS) $(INCLUDES) -I$(PERL5_INCLUDE) - $(LDSHARED) $(CFLAGS) $(OBJS) $(LIBS) -o $(TARGET)$(SO) +perl5_xs: $(SRCDIR_SRCS) + $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(INCLUDES) -I$(PERL5_INCLUDE) + $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(LIBS) -o $(TARGET)$(SO) # ---------------------------------------------------------------- # Build a statically linked Perl5 executable # ---------------------------------------------------------------- -perl5_static: $(SRCS) - $(SWIG) -perl5 -static -lperlmain.i $(SWIGOPT) $(INTERFACEPATH) - $(CC) $(CFLAGS) -Dbool=char $(SRCS) $(ISRCS) $(INCLUDES) -I$(PERL5_INCLUDE) $(PERL5_LIB) $(LIBS) -o $(TARGET) +perl5_static: $(SRCDIR_SRCS) + $(SWIG) -perl5 -static -lperlmain.i $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -Dbool=char $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) -I$(PERL5_INCLUDE) $(PERL5_LIB) $(LIBS) -o $(TARGET) -perl5_static_cpp: $(SRCS) - $(SWIG) -perl5 -c++ -static -lperlmain.i $(SWIGOPT) $(INTERFACEPATH) - $(CXX) $(CXXFLAGS) $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES) -I$(PERL5_INCLUDE) $(PERL5_LIB) $(LIBS) -o $(TARGET) +perl5_static_cpp: $(SRCDIR_SRCS) + $(SWIG) -perl5 -c++ -static -lperlmain.i $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) -I$(PERL5_INCLUDE) $(PERL5_LIB) $(LIBS) -o $(TARGET) # ----------------------------------------------------------------- # Running a Perl5 example @@ -267,15 +291,17 @@ perl5_clean: ##### PYTHON ###### ################################################################## +PYTHON_FLAGS = + # Make sure these locate your Python installation ifeq (,$(PY3)) PYTHON_INCLUDE= $(DEFS) @PYINCLUDE@ PYTHON_LIB = @PYLIB@ - PYTHON = @PYTHON@ + PYTHON = @PYTHON@ $(PYTHON_FLAGS) else PYTHON_INCLUDE= $(DEFS) @PY3INCLUDE@ PYTHON_LIB = @PY3LIB@ - PYTHON = @PYTHON3@ + PYTHON = @PYTHON3@ $(PYTHON_FLAGS) endif # Extra Python specific linking options @@ -299,19 +325,19 @@ endif # Build a C dynamically loadable module # ---------------------------------------------------------------- -python: $(SRCS) - $(SWIGPYTHON) $(SWIGOPT) $(INTERFACEPATH) - $(CC) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(SRCS) $(INCLUDES) $(PYTHON_INCLUDE) - $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(PYTHON_DLNK) $(LIBS) -o $(LIBPREFIX)_$(TARGET)$(PYTHON_SO) +python: $(SRCDIR_SRCS) + $(SWIGPYTHON) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) $(PYTHON_INCLUDE) + $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(PYTHON_DLNK) $(LIBS) -o $(LIBPREFIX)_$(TARGET)$(PYTHON_SO) # ----------------------------------------------------------------- # Build a C++ dynamically loadable module # ----------------------------------------------------------------- -python_cpp: $(SRCS) - $(SWIGPYTHON) -c++ $(SWIGOPT) $(INTERFACEPATH) - $(CXX) -c $(CCSHARED) $(CXXFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) $(PYTHON_INCLUDE) - $(CXXSHARED) $(CXXFLAGS) $(OBJS) $(IOBJS) $(PYTHON_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)_$(TARGET)$(PYTHON_SO) +python_cpp: $(SRCDIR_SRCS) + $(SWIGPYTHON) -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(PYTHON_INCLUDE) + $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(PYTHON_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)_$(TARGET)$(PYTHON_SO) # ----------------------------------------------------------------- # Build statically linked Python interpreter @@ -324,14 +350,14 @@ python_cpp: $(SRCS) TKINTER = PYTHON_LIBOPTS = $(PYTHON_LINK) @LIBS@ $(TKINTER) $(SYSLIBS) -python_static: $(SRCS) - $(SWIGPYTHON) -lembed.i $(SWIGOPT) $(INTERFACEPATH) - $(CC) $(CFLAGS) @LINKFORSHARED@ $(ISRCS) $(SRCS) $(INCLUDES) \ +python_static: $(SRCDIR_SRCS) + $(SWIGPYTHON) -lembed.i $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) @LINKFORSHARED@ $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) \ $(PYTHON_INCLUDE) $(LIBS) -L$(PYTHON_LIB) $(PYTHON_LIBOPTS) -o $(TARGET) -python_static_cpp: $(SRCS) - $(SWIGPYTHON) -c++ -lembed.i $(SWIGOPT) $(INTERFACEPATH) - $(CXX) $(CXXFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) \ +python_static_cpp: $(SRCDIR_SRCS) + $(SWIGPYTHON) -c++ -lembed.i $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) \ $(PYTHON_INCLUDE) $(LIBS) -L$(PYTHON_LIB) $(PYTHON_LIBOPTS) -o $(TARGET) # ----------------------------------------------------------------- @@ -347,9 +373,15 @@ endif PY2TO3 = 2to3 `2to3 -l | grep -v -E "Available|import$$" | awk '{print "-f "$$0}'` python_run: $(PYSCRIPT) + export PYTHONPATH=".:$$PYTHONPATH"; \ $(RUNTOOL) $(PYTHON) $(PYSCRIPT) $(RUNPIPE) -$(RUNME)3.py: $(RUNME).py +ifneq (,$(SRCDIR)) +$(RUNME).py: $(SRCDIR)$(RUNME).py + cp $< $@ +endif + +$(RUNME)3.py: $(SRCDIR)$(RUNME).py cp $< $@ $(PY2TO3) -w $@ >/dev/null 2>&1 @@ -368,9 +400,10 @@ python_clean: rm -rf __pycache__ rm -f *_wrap* *~ .~* mypython@EXEEXT@ *.pyc rm -f core @EXTRA_CLEAN@ - rm -f *.@OBJEXT@ *@SO@ *@PYTHON_SO@ + rm -f *.@OBJEXT@ *@SO@ *$(PYTHON_SO) rm -f $(TARGET).py - if [ -f $(RUNME).py ]; then rm -f $(RUNME)3.py $(RUNME)3.py.bak; fi + if test -f $(SRCDIR)$(RUNME).py; then rm -f $(RUNME)3.py $(RUNME)3.py.bak; fi + case "x$(SRCDIR)" in x|x./);; *) rm -f $(RUNME).py;; esac ################################################################## @@ -385,27 +418,27 @@ OCTAVE_CXX = $(DEFS) @OCTAVE_CPPFLAGS@ @OCTAVE_CXXFLAGS@ OCTAVE_DLNK = @OCTAVE_LDFLAGS@ OCTAVE_SO = @OCTAVE_SO@ -OCTAVE_SCRIPT = $(RUNME).m +OCTAVE_SCRIPT = $(SRCDIR)$(RUNME).m # ---------------------------------------------------------------- # Build a C dynamically loadable module # Note: Octave requires C++ compiler when compiling C wrappers # ---------------------------------------------------------------- -octave: $(SRCS) - $(SWIG) -octave $(SWIGOPT) $(INTERFACEPATH) - $(CXX) -g -c $(CCSHARED) $(CXXFLAGS) $(ICXXSRCS) $(INCLUDES) $(OCTAVE_CXX) - $(CC) -g -c $(CCSHARED) $(CFLAGS) $(SRCS) $(CSRCS) $(INCLUDES) - $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(OCTAVE_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(OCTAVE_SO) +octave: $(SRCDIR_SRCS) + $(SWIG) -octave $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) -g -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(INCLUDES) $(OCTAVE_CXX) + $(CC) -g -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CSRCS) $(INCLUDES) + $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(OCTAVE_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(OCTAVE_SO) # ----------------------------------------------------------------- # Build a C++ dynamically loadable module # ----------------------------------------------------------------- -octave_cpp: $(SRCS) - $(SWIG) -c++ -octave $(SWIGOPT) $(INTERFACEPATH) - $(CXX) -g -c $(CCSHARED) $(CXXFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) $(OCTAVE_CXX) - $(CXXSHARED) -g $(CXXFLAGS) $(OBJS) $(IOBJS) $(OCTAVE_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(OCTAVE_SO) +octave_cpp: $(SRCDIR_SRCS) + $(SWIG) -c++ -octave $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) -g -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(OCTAVE_CXX) + $(CXXSHARED) -g $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(OCTAVE_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(OCTAVE_SO) # ----------------------------------------------------------------- # Running an Octave example @@ -429,7 +462,7 @@ octave_clean: rm -rf __pycache__ rm -f *_wrap* *~ .~* myoctave@EXEEXT@ *.pyc rm -f core @EXTRA_CLEAN@ - rm -f *.@OBJEXT@ *@SO@ *@OCTAVE_SO@ + rm -f *.@OBJEXT@ *@SO@ *$(OCTAVE_SO) ################################################################## ##### GUILE ###### @@ -442,21 +475,21 @@ GUILE_SO = @GUILE_SO@ GUILE_LIBS = @GUILE_LIBS@ GUILE_LIBOPTS = @LIBS@ $(SYSLIBS) GUILE_LIBPREFIX = lib -GUILE_SCRIPT = $(RUNME).scm +GUILE_SCRIPT = $(SRCDIR)$(RUNME).scm #------------------------------------------------------------------ # Build a dynamically loaded module with passive linkage #------------------------------------------------------------------ -guile: $(SRCS) - $(SWIG) -guile -Linkage passive $(SWIGOPT) $(INTERFACEPATH) - $(CC) -c $(CCSHARED) $(CFLAGS) $(INCLUDES) $(GUILE_CFLAGS) $(ISRCS) $(SRCS) - $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(GUILE_LIBS) $(LIBS) -o $(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO) +guile: $(SRCDIR_SRCS) + $(SWIG) -guile -Linkage passive $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(INCLUDES) $(GUILE_CFLAGS) $(ISRCS) $(SRCDIR_SRCS) + $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(GUILE_LIBS) $(LIBS) -o $(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO) guile_cpp: $(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO) -$(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO): $(SRCS) - $(SWIG) -c++ -guile -Linkage passive $(SWIGOPT) $(INTERFACEPATH) - $(CXX) -c $(CCSHARED) $(CXXFLAGS) $(INCLUDES) $(GUILE_CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) - $(CXXSHARED) $(CXXFLAGS) $(OBJS) $(IOBJS) $(GUILE_LIBS) $(LIBS) $(CPP_DLLIBS) -o $@ +$(GUILE_LIBPREFIX)$(TARGET)$(GUILE_SO): $(SRCDIR_SRCS) + $(SWIG) -c++ -guile -Linkage passive $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(INCLUDES) $(GUILE_CFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) + $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(GUILE_LIBS) $(LIBS) $(CPP_DLLIBS) -o $@ guile_externalhdr: $(SWIG) -guile -external-runtime $(TARGET) @@ -465,34 +498,34 @@ guile_externalhdr: # Build Guile interpreter augmented with extra functions # ----------------------------------------------------------------- -guile_augmented: - $(SWIG) -guile $(SWIGOPT) $(INTERFACE) - $(CC) $(CXXFLAGS) $(SRCS) $(ISRCS) $(GUILE_CFLAGS) $(GUILE_LIBS) $(LIBS) -o $(TARGET) +guile_augmented: $(SRCDIR_SRCS) + $(SWIG) -guile $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(GUILE_CFLAGS) $(GUILE_LIBS) $(LIBS) -o $(TARGET) # ----------------------------------------------------------------- # Build statically linked Guile interpreter # ----------------------------------------------------------------- -guile_static: $(SRCS) - $(SWIG) -guile -lguilemain.i -Linkage ltdlmod $(SWIGOPT) $(INTERFACEPATH) - $(CC) $(CFLAGS) $(ISRCS) $(SRCS) $(INCLUDES) \ +guile_static: $(SRCDIR_SRCS) + $(SWIG) -guile -lguilemain.i -Linkage ltdlmod $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) \ -DSWIGINIT="SCM scm_init_$(TARGET)_module(void); scm_init_$(TARGET)_module();" \ $(GUILE_CFLAGS) $(GUILE_LIBS) $(LIBS) $(GUILE_LIBOPTS) -o $(TARGET)-guile -guile_static_cpp: $(SRCS) - $(SWIG) -c++ -guile -lguilemain.i -Linkage ltdlmod $(SWIGOPT) $(INTERFACEPATH) - $(CXX) $(CXXFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) \ +guile_static_cpp: $(SRCDIR_SRCS) + $(SWIG) -c++ -guile -lguilemain.i -Linkage ltdlmod $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) \ -DSWIGINIT="SCM scm_init_$(TARGET)_module(void); scm_init_$(TARGET)_module();" \ $(GUILE_CFLAGS) $(GUILE_LIBS) $(LIBS) $(GUILE_LIBOPTS) -o $(TARGET)-guile -guile_simple: $(SRCS) - $(SWIG) -guile -lguilemain.i -Linkage simple $(SWIGOPT) $(INTERFACEPATH) - $(CC) $(CFLAGS) $(ISRCS) $(SRCS) $(INCLUDES) \ +guile_simple: $(SRCDIR_SRCS) + $(SWIG) -guile -lguilemain.i -Linkage simple $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) \ $(GUILE_CFLAGS) $(GUILE_LIBS) $(LIBS) $(GUILE_LIBOPTS) -o $(TARGET)-guile -guile_simple_cpp: $(SRCS) - $(SWIG) -c++ -guile -lguilemain.i -Linkage simple $(SWIGOPT) $(INTERFACEPATH) - $(CXX) $(CXXFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) \ +guile_simple_cpp: $(SRCDIR_SRCS) + $(SWIG) -c++ -guile -lguilemain.i -Linkage simple $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) \ $(GUILE_CFLAGS) $(GUILE_LIBS) $(LIBS) $(GUILE_LIBOPTS) -o $(TARGET)-guile # ----------------------------------------------------------------- @@ -519,7 +552,7 @@ guile_version: guile_clean: rm -f *_wrap* *~ .~* my-guile@EXEEXT@ $(TARGET)@EXEEXT@ rm -f core @EXTRA_CLEAN@ - rm -f *.@OBJEXT@ *@GUILE_SO@ + rm -f *.@OBJEXT@ *$(GUILE_SO) ################################################################## ##### JAVA ###### @@ -538,39 +571,39 @@ JAVALDSHARED = @JAVALDSHARED@ JAVACXXSHARED = @JAVACXXSHARED@ JAVACFLAGS = @JAVACFLAGS@ JAVA = @JAVA@ -JAVAC = @JAVAC@ +JAVAC = @JAVAC@ -d . # ---------------------------------------------------------------- # Build a java dynamically loadable module (C) # ---------------------------------------------------------------- -java: $(SRCS) - $(SWIG) -java $(SWIGOPT) $(INTERFACEPATH) - $(CC) -c $(CCSHARED) $(CFLAGS) $(JAVACFLAGS) $(SRCS) $(ISRCS) $(INCLUDES) $(JAVA_INCLUDE) - $(JAVALDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(JAVA_DLNK) $(LIBS) -o $(JAVA_LIBPREFIX)$(TARGET)$(JAVASO) +java: $(SRCDIR_SRCS) + $(SWIG) -java $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(JAVACFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(JAVA_INCLUDE) + $(JAVALDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JAVA_DLNK) $(LIBS) -o $(JAVA_LIBPREFIX)$(TARGET)$(JAVASO) # ---------------------------------------------------------------- # Build a java dynamically loadable module (C++) # ---------------------------------------------------------------- -java_cpp: $(SRCS) - $(SWIG) -java -c++ $(SWIGOPT) $(INTERFACEPATH) - $(CXX) -c $(CCSHARED) $(CXXFLAGS) $(JAVACFLAGS) $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(JAVA_INCLUDE) - $(JAVACXXSHARED) $(CXXFLAGS) $(OBJS) $(IOBJS) $(JAVA_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(JAVA_LIBPREFIX)$(TARGET)$(JAVASO) +java_cpp: $(SRCDIR_SRCS) + $(SWIG) -java -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(JAVACFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(JAVA_INCLUDE) + $(JAVACXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JAVA_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(JAVA_LIBPREFIX)$(TARGET)$(JAVASO) # ---------------------------------------------------------------- # Compile java files # ---------------------------------------------------------------- -java_compile: $(SRCS) - $(COMPILETOOL) $(JAVAC) $(JAVACFLAGS) $(JAVASRCS) +java_compile: $(SRCDIR_SRCS) + $(COMPILETOOL) $(JAVAC) $(JAVACFLAGS) $(addprefix $(SRCDIR),$(JAVASRCS)) # ----------------------------------------------------------------- # Run java example # ----------------------------------------------------------------- java_run: - env LD_LIBRARY_PATH=. $(RUNTOOL) $(JAVA) $(RUNME) $(RUNPIPE) + env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) $(JAVA) $(RUNME) $(RUNPIPE) # ----------------------------------------------------------------- # Version display @@ -600,9 +633,6 @@ java_clean: ROOT_DIR = @ROOT_DIR@ JSINCLUDES = @JSCOREINC@ @JSV8INC@ JSDYNAMICLINKING = @JSCOREDYNAMICLINKING@ @JSV8DYNAMICLINKING@ -JSSO =@JSSO@ -JSLDSHARED = @JSLDSHARED@ -JSCXXSHARED = @JSCXXSHARED@ NODEJS = @NODEJS@ NODEGYP = @NODEGYP@ @@ -613,38 +643,39 @@ NODEGYP = @NODEGYP@ javascript_wrapper: $(SWIG) -javascript $(SWIGOPT) -o $(INTERFACEDIR)$(TARGET)_wrap.c $(INTERFACEPATH) -javascript_wrapper_cpp: $(SRCS) +javascript_wrapper_cpp: $(SRCDIR_SRCS) $(SWIG) -javascript -c++ $(SWIGOPT) -o $(INTERFACEDIR)$(TARGET)_wrap.cxx $(INTERFACEPATH) -javascript_build: $(SRCS) - $(CC) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(SRCS) $(INCLUDES) $(JSINCLUDES) - $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) +javascript_build: $(SRCDIR_SRCS) + $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) $(JSINCLUDES) + $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) -javascript_build_cpp: $(SRCS) +javascript_build_cpp: $(SRCDIR_SRCS) ifeq (node,$(JSENGINE)) + sed -e 's|$$srcdir|./$(SRCDIR)|g' $(SRCDIR)binding.gyp.in > binding.gyp $(NODEGYP) --loglevel=silent configure build 1>>/dev/null else - $(CXX) -c $(CCSHARED) $(CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) $(JSINCLUDES) - $(CXXSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) + $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(JSINCLUDES) + $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) endif # These targets are used by the test-suite: -javascript: $(SRCS) javascript_custom_interpreter +javascript: $(SRCDIR_SRCS) javascript_custom_interpreter $(SWIG) -javascript $(SWIGOPT) $(INTERFACEPATH) ifeq (jsc, $(ENGINE)) - $(CC) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(SRCS) $(INCLUDES) $(JSINCLUDES) - $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) + $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) $(JSINCLUDES) + $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) else # (v8 | node) # v8 and node must be compiled as c++ - $(CXX) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) $(JSINCLUDES) - $(CXXSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) + $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(JSINCLUDES) + $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) endif -javascript_cpp: $(SRCS) javascript_custom_interpreter +javascript_cpp: $(SRCDIR_SRCS) javascript_custom_interpreter $(SWIG) -javascript -c++ $(SWIGOPT) $(INTERFACEPATH) - $(CXX) -c $(CCSHARED) $(CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) $(JSINCLUDES) - $(CXXSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) + $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(JSINCLUDES) + $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(JSDYNAMICLINKING) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) # ----------------------------------------------------------------- # Running a Javascript example @@ -655,10 +686,10 @@ javascript_custom_interpreter: ifeq (node,$(JSENGINE)) javascript_run: - $(RUNTOOL) $(NODEJS) $(RUNME).js $(RUNPIPE) + env NODE_PATH=$$PWD:$(SRCDIR) $(RUNTOOL) $(NODEJS) $(SRCDIR)$(RUNME).js $(RUNPIPE) else javascript_run: javascript_custom_interpreter - $(RUNTOOL) $(ROOT_DIR)/Tools/javascript/javascript -$(JSENGINE) -L $(TARGET) $(RUNME).js $(RUNPIPE) + $(RUNTOOL) $(ROOT_DIR)/Tools/javascript/javascript -$(JSENGINE) -L $(TARGET) $(SRCDIR)$(RUNME).js $(RUNPIPE) endif # ----------------------------------------------------------------- @@ -697,24 +728,25 @@ javascript_clean: rm -rf build rm -f *_wrap* $(RUNME) rm -f core @EXTRA_CLEAN@ - rm -f *.@OBJEXT@ *@JSSO@ *.$(SO) - (cd $(ROOT_DIR)/Tools/javascript && $(MAKE) -s clean) + rm -f *.@OBJEXT@ *@SO@ + rm -f binding.gyp example-gypcopy.cxx + cd $(ROOT_DIR)/Tools/javascript && $(MAKE) -s clean ################################################################## ##### ANDROID ###### ################################################################## -ANDROID = android -ANDROID_NDK_BUILD = ndk-build -ANDROID_ADB = adb -ANT = ant +ANDROID = @ANDROID@ +ANDROID_NDK_BUILD = @NDKBUILD@ +ANDROID_ADB = @ADB@ +ANT = @ANT@ TARGETID = 1 # ---------------------------------------------------------------- # Build an Android dynamically loadable module (C) # ---------------------------------------------------------------- -android: $(SRCS) +android: $(SRCDIR_SRCS) $(ANDROID) $(SILENT_OPTION) update project --target $(TARGETID) --name $(PROJECTNAME) --path . $(SWIG) -java $(SWIGOPT) -o $(INTERFACEDIR)$(TARGET)_wrap.c $(INTERFACEPATH) +$(ANDROID_NDK_BUILD) $(SILENT_PIPE) @@ -724,7 +756,7 @@ android: $(SRCS) # Build an Android dynamically loadable module (C++) # ---------------------------------------------------------------- -android_cpp: $(SRCS) +android_cpp: $(SRCDIR_SRCS) $(ANDROID) $(SILENT_OPTION) update project --target $(TARGETID) --name $(PROJECTNAME) --path . $(SWIG) -java -c++ $(SWIGOPT) -o $(INTERFACEDIR)$(TARGET)_wrap.cpp $(INTERFACEPATH) +$(ANDROID_NDK_BUILD) $(SILENT_PIPE) @@ -750,7 +782,7 @@ android_version: # ----------------------------------------------------------------- android_clean: - ant -q -logfile /dev/null clean + test -n "$(SRCDIR)" && cd $(SRCDIR) ; $(ANT) -q -logfile /dev/null clean rm -f $(INTERFACEDIR)$(TARGET)_wrap.* rm -f `find $(PACKAGEDIR) -name \*.java | grep -v $(PROJECTNAME).java` rm -rf obj @@ -765,13 +797,11 @@ MODULA3_INCLUDE= @MODULA3INC@ # Build a modula3 dynamically loadable module (C) # ---------------------------------------------------------------- -modula3: $(SRCS) - $(SWIG) -modula3 $(SWIGOPT) $(INTERFACEPATH) -# $(CC) -c $(CCSHARED) $(CFLAGS) $(SRCS) $(ISRCS) $(INCLUDES) \ -# $(OBJS) $(IOBJS) $(LIBS) +modula3: $(SRCDIR_SRCS) + $(SWIG) -modula3 $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) -modula3_cpp: $(SRCS) - $(SWIG) -modula3 -c++ $(SWIGOPT) $(INTERFACEPATH) +modula3_cpp: $(SRCDIR_SRCS) + $(SWIG) -modula3 -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) # ----------------------------------------------------------------- # Run modula3 example @@ -810,22 +840,22 @@ MZSCHEME_SCRIPT = $(RUNME).scm # Build a C/C++ dynamically loadable module # ---------------------------------------------------------------- -mzscheme: $(SRCS) - $(SWIG) -mzscheme $(SWIGOPT) $(INTERFACEPATH) - $(COMPILETOOL) $(MZC) `echo $(INCLUDES) | sed 's/-I/++ccf -I/g'` --cc $(ISRCS) $(SRCS) +mzscheme: $(SRCDIR_SRCS) + $(SWIG) -mzscheme $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(COMPILETOOL) $(MZC) `echo $(INCLUDES) | sed 's/-I/++ccf -I/g'` --cc $(ISRCS) $(SRCDIR_SRCS) $(COMPILETOOL) $(MZC) --ld $(TARGET)$(MZSCHEME_SO) $(OBJS) $(IOBJS) -mzscheme_cpp: $(SRCS) - $(SWIG) -mzscheme -c++ $(SWIGOPT) $(INTERFACEPATH) - $(COMPILETOOL) $(MZC) `echo $(INCLUDES) | sed 's/-I/++ccf -I/g'` --cc $(ICXXSRCS) $(SRCS) $(CXXSRCS) - $(CXXSHARED) $(CXXFLAGS) -o $(LIBPREFIX)$(TARGET)$(MZSCHEME_SO) $(OBJS) $(IOBJS) $(MZDYNOBJ) $(CPP_DLLIBS) +mzscheme_cpp: $(SRCDIR_SRCS) + $(SWIG) -mzscheme -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(COMPILETOOL) $(MZC) `echo $(INCLUDES) | sed 's/-I/++ccf -I/g'` --cc $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) + $(CXXSHARED) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $(LIBPREFIX)$(TARGET)$(MZSCHEME_SO) $(OBJS) $(IOBJS) $(MZDYNOBJ) $(CPP_DLLIBS) # ----------------------------------------------------------------- # Run mzscheme example # ----------------------------------------------------------------- mzscheme_run: - env LD_LIBRARY_PATH=. $(RUNTOOL) $(MZSCHEME) -r $(MZSCHEME_SCRIPT) $(RUNPIPE) + env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) $(MZSCHEME) -r $(MZSCHEME_SCRIPT) $(RUNPIPE) # ----------------------------------------------------------------- # Version display @@ -842,7 +872,7 @@ mzscheme_version: mzscheme_clean: rm -f *_wrap* *~ .~* rm -f core @EXTRA_CLEAN@ - rm -f *.@OBJEXT@ *@SO@ + rm -f *.@OBJEXT@ *$(MZSCHEME_SO) ################################################################## ##### Ocaml ##### @@ -865,10 +895,10 @@ OCAMLCORE=\ $(OCC) -I $(OCAMLP4WHERE) -pp "camlp4o pa_extend.cmo q_MLast.cmo" \ -c swigp4.ml -ocaml_static: $(SRCS) +ocaml_static: $(SRCDIR_SRCS) $(OCAMLCORE) - $(SWIG) -ocaml $(SWIGOPT) $(INTERFACEPATH) - $(OCC) -g -c -ccopt -g -ccopt "$(INCLUDES)" $(ISRCS) $(SRCS) + $(SWIG) -ocaml $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(OCC) -g -c -ccopt -g -ccopt "$(INCLUDES)" $(ISRCS) $(SRCDIR_SRCS) $(OCC) -g -c $(INTERFACE:%.i=%.mli) $(OCC) -g -c $(INTERFACE:%.i=%.ml) test -z "$(PROGFILE)" || test -f "$(PROGFILE)" && \ @@ -879,11 +909,11 @@ ocaml_static: $(SRCS) $(PROGFILE:%.ml=%.cmo) \ $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) -cclib "$(LIBS)" -ocaml_dynamic: $(SRCS) +ocaml_dynamic: $(SRCDIR_SRCS) $(OCAMLCORE) - $(SWIG) -ocaml $(SWIGOPT) $(INTERFACEPATH) - $(OCC) -g -c -ccopt -g -ccopt "$(INCLUDES)" $(ISRCS) $(SRCS) - $(CXXSHARED) $(CXXFLAGS) $(CCSHARED) $(CFLAGS) -o $(INTERFACE:%.i=%@SO@) \ + $(SWIG) -ocaml $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(OCC) -g -c -ccopt -g -ccopt "$(INCLUDES)" $(ISRCS) $(SRCDIR_SRCS) + $(CXXSHARED) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(CCSHARED) -o $(INTERFACE:%.i=%@SO@) \ $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) $(LIBS) $(OCAMLDLGEN) $(INTERFACE:%.i=%.ml) $(INTERFACE:%.i=%@SO@) > \ $(INTERFACE:%.i=%_dynamic.ml) @@ -898,10 +928,10 @@ ocaml_dynamic: $(SRCS) -package dl -linkpkg \ $(INTERFACE:%.i=%.cmo) $(PROGFILE:%.ml=%.cmo) -ocaml_static_toplevel: $(SRCS) +ocaml_static_toplevel: $(SRCDIR_SRCS) $(OCAMLCORE) - $(SWIG) -ocaml $(SWIGOPT) $(INTERFACEPATH) - $(OCC) -g -c -ccopt -g -ccopt "$(INCLUDES)" $(ISRCS) $(SRCS) + $(SWIG) -ocaml $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(OCC) -g -c -ccopt -g -ccopt "$(INCLUDES)" $(ISRCS) $(SRCDIR_SRCS) $(OCC) -g -c $(INTERFACE:%.i=%.mli) $(OCC) -g -c $(INTERFACE:%.i=%.ml) test -z "$(PROGFILE)" || test -f "$(PROGFILE)" && \ @@ -913,12 +943,12 @@ ocaml_static_toplevel: $(SRCS) $(INTERFACE:%.i=%.cmo) \ $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) -cclib "$(LIBS)" -ocaml_static_cpp: $(SRCS) +ocaml_static_cpp: $(SRCDIR_SRCS) $(OCAMLCORE) - $(SWIG) -ocaml -c++ $(SWIGOPT) $(INTERFACEPATH) + $(SWIG) -ocaml -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) cp $(ICXXSRCS) $(ICXXSRCS:%.cxx=%.c) $(OCC) -cc '$(CXX) -Wno-write-strings' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" \ - $(ICXXSRCS:%.cxx=%.c) $(SRCS) $(CXXSRCS) + $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(OCC) -g -c $(INTERFACE:%.i=%.mli) $(OCC) -g -c $(INTERFACE:%.i=%.ml) test -z "$(PROGFILE)" || test -f "$(PROGFILE)" && \ @@ -930,12 +960,12 @@ ocaml_static_cpp: $(SRCS) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) \ -cclib "$(LIBS)" -cc '$(CXX) -Wno-write-strings' -ocaml_static_cpp_toplevel: $(SRCS) +ocaml_static_cpp_toplevel: $(SRCDIR_SRCS) $(OCAMLCORE) - $(SWIG) -ocaml -c++ $(SWIGOPT) $(INTERFACEPATH) + $(SWIG) -ocaml -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) cp $(ICXXSRCS) $(ICXXSRCS:%.cxx=%.c) $(OCC) -cc '$(CXX) -Wno-write-strings' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" \ - $(ICXXSRCS:%.cxx=%.c) $(SRCS) $(CXXSRCS) + $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(OCC) -g -c $(INTERFACE:%.i=%.mli) $(OCC) -g -c $(INTERFACE:%.i=%.ml) test -z "$(PROGFILE)" || test -f "$(PROGFILE)" && \ @@ -948,13 +978,13 @@ ocaml_static_cpp_toplevel: $(SRCS) $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) \ -cclib "$(LIBS)" -cc '$(CXX) -Wno-write-strings' -ocaml_dynamic_cpp: $(SRCS) +ocaml_dynamic_cpp: $(SRCDIR_SRCS) $(OCAMLCORE) - $(SWIG) -ocaml -c++ $(SWIGOPT) $(INTERFACEPATH) + $(SWIG) -ocaml -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) cp $(ICXXSRCS) $(ICXXSRCS:%.cxx=%.c) $(OCC) -cc '$(CXX) -Wno-write-strings' -g -c -ccopt -g -ccopt "-xc++ $(INCLUDES)" \ - $(ICXXSRCS:%.cxx=%.c) $(SRCS) $(CXXSRCS) -ccopt -fPIC - $(CXXSHARED) $(CXXFLAGS) -o $(INTERFACE:%.i=%@SO@) \ + $(ICXXSRCS:%.cxx=%.c) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) -ccopt -fPIC + $(CXXSHARED) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) -o $(INTERFACE:%.i=%@SO@) \ $(INTERFACE:%.i=%_wrap.@OBJEXT@) $(OBJS) \ $(CPP_DLLIBS) $(LIBS) $(OCAMLDLGEN) $(INTERFACE:%.i=%.ml) $(INTERFACE:%.i=%@SO@) > \ @@ -1006,26 +1036,26 @@ RUBY_DLNK = @RUBYDYNAMICLINKING@ RUBY_LIBOPTS = @RUBYLINK@ @LIBS@ $(SYSLIBS) RUBY_SO = @RUBYSO@ RUBY = @RUBY@ -RUBY_SCRIPT = $(RUNME).rb +RUBY_SCRIPT = $(SRCDIR)$(RUNME).rb # ---------------------------------------------------------------- # Build a C dynamically loadable module # ---------------------------------------------------------------- -ruby: $(SRCS) - $(SWIG) -ruby $(SWIGOPT) $(INTERFACEPATH) - $(CC) -c $(CCSHARED) $(CFLAGS) $(RUBY_CFLAGS) $(ISRCS) $(SRCS) $(INCLUDES) $(RUBY_INCLUDE) - $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(RUBY_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(RUBY_SO) +ruby: $(SRCDIR_SRCS) + $(SWIG) -ruby $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(RUBY_CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) $(RUBY_INCLUDE) + $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(RUBY_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(RUBY_SO) # ----------------------------------------------------------------- # Build a C++ dynamically loadable module # ----------------------------------------------------------------- -ruby_cpp: $(SRCS) - $(SWIG) -c++ -ruby $(SWIGOPT) $(INTERFACEPATH) - $(CXX) -c $(CCSHARED) $(CXXFLAGS) $(RUBY_CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) $(RUBY_INCLUDE) - $(CXXSHARED) $(CXXFLAGS) $(OBJS) $(IOBJS) $(RUBY_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(RUBY_SO) +ruby_cpp: $(SRCDIR_SRCS) + $(SWIG) -c++ -ruby $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(RUBY_CFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(RUBY_INCLUDE) + $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(RUBY_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(RUBY_SO) # ----------------------------------------------------------------- # Build statically linked Ruby interpreter @@ -1034,14 +1064,14 @@ ruby_cpp: $(SRCS) # library file # ----------------------------------------------------------------- -ruby_static: $(SRCS) - $(SWIG) -ruby -lembed.i $(SWIGOPT) $(INTERFACEPATH) - $(CC) $(CFLAGS) $(RUBY_CFLAGS) @LINKFORSHARED@ $(ISRCS) $(SRCS) $(INCLUDES) \ +ruby_static: $(SRCDIR_SRCS) + $(SWIG) -ruby -lembed.i $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(RUBY_CFLAGS) @LINKFORSHARED@ $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) \ $(RUBY_INCLUDE) $(LIBS) -L$(RUBY_LIB) $(RUBY_LIBOPTS) -o $(TARGET) -ruby_cpp_static: $(SRCS) - $(SWIG) -c++ -ruby -lembed.i $(SWIGOPT) $(INTERFACEPATH) - $(CXX) $(CXXFLAGS) $(RUBY_CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) \ +ruby_cpp_static: $(SRCDIR_SRCS) + $(SWIG) -c++ -ruby -lembed.i $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(RUBY_CFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) \ $(RUBY_INCLUDE) $(LIBS) -L$(RUBY_LIB) $(RUBY_LIBOPTS) -o $(TARGET) # ----------------------------------------------------------------- @@ -1063,9 +1093,9 @@ ruby_version: # ----------------------------------------------------------------- ruby_clean: - rm -f *_wrap* *~ .~* myruby@EXEEXT@ *.pm + rm -f *_wrap* *~ .~* myruby@EXEEXT@ rm -f core @EXTRA_CLEAN@ - rm -f *.@OBJEXT@ *@SO@ + rm -f *.@OBJEXT@ *$(RUBY_SO) ################################################################## ##### PHP ###### @@ -1074,25 +1104,25 @@ ruby_clean: PHP = @PHP@ PHP_INCLUDE = @PHPINC@ PHP_SO = @PHP_SO@ -PHP_SCRIPT = $(RUNME).php +PHP_SCRIPT = $(SRCDIR)$(RUNME).php # ------------------------------------------------------------------- # Build a PHP dynamically loadable module (C) # ------------------------------------------------------------------- -php: $(SRCS) - $(SWIG) -php $(SWIGOPT) $(INTERFACEPATH) - $(CC) -c $(CCSHARED) $(CFLAGS) $(SRCS) $(ISRCS) $(INCLUDES) $(PHP_INCLUDE) - $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(PHP_SO) +php: $(SRCDIR_SRCS) + $(SWIG) -php $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) $(PHP_INCLUDE) + $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(PHP_SO) # -------------------------------------------------------------------- # Build a PHP dynamically loadable module (C++) # -------------------------------------------------------------------- -php_cpp: $(SRCS) - $(SWIG) -php -cppext cxx -c++ $(SWIGOPT) $(INTERFACEPATH) - $(CXX) -c $(CCSHARED) $(CXXFLAGS) $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(PHP_INCLUDE) - $(CXXSHARED) $(CXXFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(PHP_SO) +php_cpp: $(SRCDIR_SRCS) + $(SWIG) -php -cppext cxx -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) $(PHP_INCLUDE) + $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(PHP_SO) # ----------------------------------------------------------------- # Running a PHP example @@ -1115,7 +1145,7 @@ php_version: php_clean: rm -f *_wrap* *~ .~* example.php php_example.h rm -f core @EXTRA_CLEAN@ - rm -f *.@OBJEXT@ *@SO@ + rm -f *.@OBJEXT@ *$(PHP_SO) ################################################################## ##### Pike ###### @@ -1134,19 +1164,19 @@ PIKE_SCRIPT = $(RUNME).pike # Build a C dynamically loadable module # ---------------------------------------------------------------- -pike: $(SRCS) - $(SWIG) -pike $(SWIGOPT) $(INTERFACEPATH) - $(CC) -c $(CCSHARED) $(CFLAGS) $(PIKE_CFLAGS) $(ISRCS) $(SRCS) $(INCLUDES) $(PIKE_INCLUDE) - $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(PIKE_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) +pike: $(SRCDIR_SRCS) + $(SWIG) -pike $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(PIKE_CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) $(PIKE_INCLUDE) + $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(PIKE_DLNK) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) # ----------------------------------------------------------------- # Build a C++ dynamically loadable module # ----------------------------------------------------------------- -pike_cpp: $(SRCS) - $(SWIG) -c++ -pike $(SWIGOPT) $(INTERFACEPATH) - $(CXX) -c $(CCSHARED) $(CXXFLAGS) $(PIKE_CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) $(PIKE_INCLUDE) - $(CXXSHARED) $(CXXFLAGS) $(OBJS) $(IOBJS) $(PIKE_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) +pike_cpp: $(SRCDIR_SRCS) + $(SWIG) -c++ -pike $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(PIKE_CFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) $(PIKE_INCLUDE) + $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(PIKE_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) # ----------------------------------------------------------------- # Build statically linked Pike interpreter @@ -1155,14 +1185,14 @@ pike_cpp: $(SRCS) # library file # ----------------------------------------------------------------- -pike_static: $(SRCS) - $(SWIG) -pike -lembed.i $(SWIGOPT) $(INTERFACEPATH) - $(CC) $(CFLAGS) $(PIKE_CFLAGS) @LINKFORSHARED@ $(ISRCS) $(SRCS) $(INCLUDES) \ +pike_static: $(SRCDIR_SRCS) + $(SWIG) -pike -lembed.i $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(PIKE_CFLAGS) @LINKFORSHARED@ $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) \ $(PIKE_INCLUDE) $(LIBS) -L$(PIKE_LIB) $(PIKE_LIBOPTS) -o $(TARGET) -pike_cpp_static: $(SRCS) - $(SWIG) -c++ -pike -lembed.i $(SWIGOPT) $(INTERFACEPATH) - $(CXX) $(CXXFLAGS) $(PIKE_CFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) \ +pike_cpp_static: $(SRCDIR_SRCS) + $(SWIG) -c++ -pike -lembed.i $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(PIKE_CFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) \ $(PIKE_INCLUDE) $(LIBS) -L$(PIKE_LIB) $(PIKE_LIBOPTS) -o $(TARGET) # ----------------------------------------------------------------- @@ -1218,24 +1248,24 @@ CHICKEN_COMPILED_MAIN_OBJECT = $(CHICKEN_COMPILED_MAIN:.c=.@OBJEXT@) # ----------------------------------------------------------------- # This is the old way to build chicken, but it does not work correctly with exceptions -chicken_direct: $(SRCS) +chicken_direct: $(SRCDIR_SRCS) $(SWIG) -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACEPATH) $(CHICKEN) $(CHICKEN_GENERATED_SCHEME) $(CHICKENOPTS) \ -dynamic -feature chicken-compile-shared \ -output-file $(CHICKEN_COMPILED_SCHEME) - $(CC) -c $(CCSHARED) $(CFLAGS) $(CHICKEN_CFLAGS) \ - $(INCLUDES) $(CHICKEN_INCLUDE) $(ISRCS) $(SRCS) $(CHICKEN_COMPILED_SCHEME) - $(LDSHARED) $(CFLAGS) $(CHICKEN_COMPILED_OBJECT) $(OBJS) $(IOBJS) \ + $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(CHICKEN_CFLAGS) \ + $(INCLUDES) $(CHICKEN_INCLUDE) $(ISRCS) $(SRCDIR_SRCS) $(CHICKEN_COMPILED_SCHEME) + $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(CHICKEN_COMPILED_OBJECT) $(OBJS) $(IOBJS) \ $(LIBS) $(CHICKEN_SHAREDLIBOPTS) -o $(LIBPREFIX)$(TARGET)$(SO) -chicken_direct_cpp: $(CXXSRCS) $(CHICKSRCS) +chicken_direct_cpp: $(SRCDIR_CXXSRCS) $(CHICKSRCS) $(SWIG) -c++ -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACEPATH) $(CHICKEN) $(CHICKEN_GENERATED_SCHEME) $(CHICKENOPTS) \ -dynamic -feature chicken-compile-shared \ -output-file $(CHICKEN_COMPILED_SCHEME) - $(CXX) -c $(CCSHARED) $(CXXFLAGS) $(CHICKEN_CFLAGS) \ - $(INCLUDES) $(CHICKEN_INCLUDE) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(CHICKEN_COMPILED_SCHEME) - $(CXXSHARED) $(CXXFLAGS) $(CHICKEN_COMPILED_OBJECT) $(OBJS) $(IOBJS) \ + $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(CHICKEN_CFLAGS) \ + $(INCLUDES) $(CHICKEN_INCLUDE) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(CHICKEN_COMPILED_SCHEME) + $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(CHICKEN_COMPILED_OBJECT) $(OBJS) $(IOBJS) \ $(LIBS) $(CPP_DLLIBS) $(CHICKEN_SHAREDLIBOPTS) -o $(LIBPREFIX)$(TARGET)$(SO) # ----------------------------------------------------------------- @@ -1243,28 +1273,28 @@ chicken_direct_cpp: $(CXXSRCS) $(CHICKSRCS) # ----------------------------------------------------------------- # The following two targets are also used by the test suite -chicken_static: $(SRCS) $(CHICKSRCS) +chicken_static: $(SRCDIR_SRCS) $(CHICKSRCS) $(SWIG) -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACEPATH) $(CHICKEN) $(CHICKEN_GENERATED_SCHEME) $(CHICKENOPTS) \ -output-file $(CHICKEN_COMPILED_SCHEME) $(CHICKEN) $(CHICKEN_MAIN) $(CHICKENOPTS) \ -output-file $(CHICKEN_MAIN:.scm=_chicken.c) - $(CC) -c $(CCSHARED) $(CFLAGS) $(CHICKEN_CFLAGS) \ - $(INCLUDES) $(CHICKEN_INCLUDE) $(ISRCS) $(SRCS) \ + $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(CHICKEN_CFLAGS) \ + $(INCLUDES) $(CHICKEN_INCLUDE) $(ISRCS) $(SRCDIR_SRCS) \ $(CHICKEN_COMPILED_SCHEME) $(CHICKEN_COMPILED_MAIN) - $(CC) $(CHICKEN_COMPILED_OBJECT) $(CHICKEN_COMPILED_MAIN_OBJECT) \ + $(CC) $(CFLAGS) $(LDFLAGS) $(CHICKEN_COMPILED_OBJECT) $(CHICKEN_COMPILED_MAIN_OBJECT) \ $(OBJS) $(IOBJS) $(LIBS) $(CHICKEN_SHAREDLIBOPTS) -o $(TARGET) -chicken_static_cpp: $(CXXSRCS) $(CHICKSRCS) +chicken_static_cpp: $(SRCDIR_CXXSRCS) $(CHICKSRCS) $(SWIG) -c++ -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACEPATH) $(CHICKEN) $(CHICKEN_GENERATED_SCHEME) $(CHICKENOPTS) \ -output-file $(CHICKEN_COMPILED_SCHEME) $(CHICKEN) $(CHICKEN_MAIN) $(CHICKENOPTS) \ -output-file $(CHICKEN_MAIN:.scm=_chicken.c) - $(CXX) -c $(CCSHARED) $(CXXFLAGS) $(CHICKEN_CFLAGS) \ - $(INCLUDES) $(CHICKEN_INCLUDE) $(ICXXSRCS) $(SRCS) $(CXXSRCS) \ + $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(CHICKEN_CFLAGS) \ + $(INCLUDES) $(CHICKEN_INCLUDE) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) \ $(CHICKEN_COMPILED_SCHEME) $(CHICKEN_COMPILED_MAIN) - $(CXX) $(CHICKEN_COMPILED_OBJECT) $(CHICKEN_COMPILED_MAIN_OBJECT) \ + $(CXX) $(CXXFLAGS) $(LDFLAGS) $(CHICKEN_COMPILED_OBJECT) $(CHICKEN_COMPILED_MAIN_OBJECT) \ $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) $(CHICKEN_SHAREDLIBOPTS) -o $(TARGET) # ---------------------------------------------------------------- @@ -1273,11 +1303,11 @@ chicken_static_cpp: $(CXXSRCS) $(CHICKSRCS) chicken: $(SWIG) -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACEPATH) - $(COMPILETOOL) $(CHICKEN_CSC) -s `echo $(INCLUDES) | sed 's/-I/-C -I/g'` $(CHICKEN_GENERATED_SCHEME) $(SRCS) $(ISRCS) -o $(TARGET)$(SO) + $(COMPILETOOL) $(CHICKEN_CSC) -s `echo $(INCLUDES) | sed 's/-I/-C -I/g'` $(CHICKEN_GENERATED_SCHEME) $(SRCDIR_SRCS) $(ISRCS) -o $(TARGET)$(SO) chicken_cpp: $(SWIG) -c++ -chicken $(SWIGOPT) $(INCLUDE) $(INTERFACEPATH) - $(COMPILETOOL) $(CHICKEN_CSC) -s `echo $(INCLUDES) | sed 's/-I/-C -I/g'` $(CHICKEN_GENERATED_SCHEME) $(SRCS) $(ICXXSRCS) $(CXXSRCS) -o $(TARGET)$(SO) + $(COMPILETOOL) $(CHICKEN_CSC) -s `echo $(INCLUDES) | sed 's/-I/-C -I/g'` $(CHICKEN_GENERATED_SCHEME) $(SRCDIR_SRCS) $(ICXXSRCS) $(SRCDIR_CXXSRCS) -o $(TARGET)$(SO) chicken_externalhdr: $(SWIG) -chicken -external-runtime $(TARGET) @@ -1287,7 +1317,7 @@ chicken_externalhdr: # ----------------------------------------------------------------- chicken_run: - env LD_LIBRARY_PATH=. $(RUNTOOL) $(CHICKEN_CSI) $(CHICKEN_SCRIPT) $(RUNPIPE) + env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) $(CHICKEN_CSI) $(CHICKEN_SCRIPT) $(RUNPIPE) # ----------------------------------------------------------------- # Version display @@ -1323,33 +1353,39 @@ CSHARP_RUNME = $(CSHARPCILINTERPRETER) $(CSHARPCILINTERPRETER_FLAGS) ./$(RUNME). # Build a CSharp dynamically loadable module (C) # ---------------------------------------------------------------- -csharp: $(SRCS) - $(SWIG) -csharp $(SWIGOPT) $(INTERFACEPATH) - $(CC) -c $(CCSHARED) $(CFLAGS) $(CSHARPCFLAGS) $(SRCS) $(ISRCS) $(INCLUDES) - $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(CSHARP_DLNK) $(LIBS) -o $(CSHARP_LIBPREFIX)$(TARGET)$(CSHARPSO) +csharp: $(SRCDIR_SRCS) + $(SWIG) -csharp $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(CSHARPCFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) + $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(CSHARP_DLNK) $(LIBS) -o $(CSHARP_LIBPREFIX)$(TARGET)$(CSHARPSO) # ---------------------------------------------------------------- # Build a CSharp dynamically loadable module (C++) # ---------------------------------------------------------------- -csharp_cpp: $(SRCS) - $(SWIG) -csharp -c++ $(SWIGOPT) $(INTERFACEPATH) - $(CXX) -c $(CCSHARED) $(CXXFLAGS) $(CSHARPCFLAGS) $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES) - $(CXXSHARED) $(CXXFLAGS) $(OBJS) $(IOBJS) $(CSHARP_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(CSHARP_LIBPREFIX)$(TARGET)$(CSHARPSO) +csharp_cpp: $(SRCDIR_SRCS) + $(SWIG) -csharp -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(CSHARPCFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) + $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(CSHARP_DLNK) $(LIBS) $(CPP_DLLIBS) -o $(CSHARP_LIBPREFIX)$(TARGET)$(CSHARPSO) # ---------------------------------------------------------------- # Compile CSharp files # ---------------------------------------------------------------- -csharp_compile: $(SRCS) - $(COMPILETOOL) $(CSHARPCOMPILER) $(CSHARPFLAGS) $(CSHARPSRCS) +ifneq (,$(SRCDIR)) +SRCDIR_CSHARPSRCS = $(addprefix $(SRCDIR),$(CSHARPSRCS)) +else +SRCDIR_CSHARPSRCS = +endif + +csharp_compile: $(SRCDIR_SRCS) + $(COMPILETOOL) $(CSHARPCOMPILER) $(CSHARPFLAGS) $(CSHARPSRCS) $(SRCDIR_CSHARPSRCS) # ----------------------------------------------------------------- # Run CSharp example # ----------------------------------------------------------------- csharp_run: - env LD_LIBRARY_PATH=. $(RUNTOOL) $(CSHARP_RUNME) $(RUNPIPE) + env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) $(CSHARP_RUNME) $(RUNPIPE) # ----------------------------------------------------------------- # Version display @@ -1358,6 +1394,7 @@ csharp_run: # Version check below also works with MS csc.exe which does not understand --version csharp_version: $(CSHARPCOMPILER) --version | head -n 1 + if test -n "$(CSHARPCILINTERPRETER)" ; then "$(CSHARPCILINTERPRETER)" --version ; fi # ----------------------------------------------------------------- # Cleaning the CSharp examples @@ -1381,7 +1418,7 @@ LUA_DLNK = @LUADYNAMICLINKING@ LUA_SO = @LUA_SO@ LUA = @LUABIN@ -LUA_SCRIPT = $(RUNME).lua +LUA_SCRIPT = $(SRCDIR)$(RUNME).lua # Extra code for lua static link LUA_INTERP = ../lua.c @@ -1390,32 +1427,32 @@ LUA_INTERP = ../lua.c # Build a C dynamically loadable module # ---------------------------------------------------------------- -lua: $(SRCS) - $(SWIG) -lua $(SWIGOPT) $(INTERFACEPATH) - $(CC) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(SRCS) $(INCLUDES) $(LUA_INCLUDE) - $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(LUA_LIB) -o $(LIBPREFIX)$(TARGET)$(LUA_SO) +lua: $(SRCDIR_SRCS) + $(SWIG) -lua $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(INCLUDES) $(LUA_INCLUDE) + $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(LUA_LIB) -o $(LIBPREFIX)$(TARGET)$(LUA_SO) # ----------------------------------------------------------------- # Build a C++ dynamically loadable module # ----------------------------------------------------------------- -lua_cpp: $(SRCS) - $(SWIG) -c++ -lua $(SWIGOPT) $(INTERFACEPATH) - $(CXX) -c $(CCSHARED) $(CXXFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) $(LUA_INCLUDE) - $(CXXSHARED) $(CXXFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(LUA_LIB) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(LUA_SO) +lua_cpp: $(SRCDIR_SRCS) $(GENCXXSRCS) + $(SWIG) -c++ -lua $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(GENCXXSRCS) $(INCLUDES) $(LUA_INCLUDE) + $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(LUA_LIB) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(LUA_SO) # ----------------------------------------------------------------- # Build statically linked Lua interpreter # ----------------------------------------------------------------- -lua_static: $(SRCS) - $(SWIG) -lua -module example $(SWIGOPT) $(INTERFACEPATH) - $(CC) $(CFLAGS) $(ISRCS) $(SRCS) $(LUA_INTERP) $(INCLUDES) \ +lua_static: $(SRCDIR_SRCS) + $(SWIG) -lua -module example $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(ISRCS) $(SRCDIR_SRCS) $(SRCDIR)$(LUA_INTERP) $(INCLUDES) \ $(LUA_INCLUDE) $(LIBS) $(LUA_LIB) -o $(TARGET) -lua_static_cpp: $(SRCS) - $(SWIG) -c++ -lua -module example $(SWIGOPT) $(INTERFACEPATH) - $(CXX) $(CXXFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(LUA_INTERP) $(INCLUDES) \ +lua_static_cpp: $(SRCDIR_SRCS) $(GENCXXSRCS) + $(SWIG) -c++ -lua -module example $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(GENCXXSRCS) $(SRCDIR)$(LUA_INTERP) $(INCLUDES) \ $(LUA_INCLUDE) $(LIBS) $(LUA_LIB) -o $(TARGET) # ----------------------------------------------------------------- @@ -1426,7 +1463,7 @@ lua_run: $(RUNTOOL) $(LUA) $(LUA_SCRIPT) $(RUNPIPE) lua_embed_run: - $(RUNTOOL) ./$(TARGET) $(RUNPIPE) + $(RUNTOOL) ./$(TARGET) $(LUA_SCRIPT) $(RUNPIPE) # ----------------------------------------------------------------- # Version display @@ -1442,7 +1479,7 @@ lua_version: lua_clean: rm -f *_wrap* *~ .~* mylua@EXEEXT@ rm -f core @EXTRA_CLEAN@ - rm -f *.@OBJEXT@ *@SO@ + rm -f *.@OBJEXT@ *$(LUA_SO) ################################################################## ##### ALLEGRO CL ###### @@ -1451,15 +1488,15 @@ lua_clean: ALLEGROCL = @ALLEGROCLBIN@ ALLEGROCL_SCRIPT=$(RUNME).lisp -allegrocl: $(SRCS) - $(SWIG) -allegrocl -cwrap $(SWIGOPT) $(INTERFACEPATH) - $(CC) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(INCLUDES) $(SRCS) - $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) +allegrocl: $(SRCDIR_SRCS) + $(SWIG) -allegrocl -cwrap $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ISRCS) $(INCLUDES) $(SRCDIR_SRCS) + $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) -allegrocl_cpp: $(SRCS) - $(SWIG) -c++ -allegrocl $(SWIGOPT) $(INTERFACEPATH) - $(CXX) -c $(CCSHARED) $(CXXFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) - $(CXXSHARED) $(CXXFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) +allegrocl_cpp: $(SRCDIR_SRCS) + $(SWIG) -c++ -allegrocl $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) + $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) # ----------------------------------------------------------------- # Run ALLEGRO CL example @@ -1491,11 +1528,11 @@ allegrocl_clean: CLISP = @CLISPBIN@ CLISP_SCRIPT=$(RUNME).lisp -clisp: $(SRCS) - $(SWIG) -clisp $(SWIGOPT) $(INTERFACEPATH) +clisp: $(SRCDIR_SRCS) + $(SWIG) -clisp $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) -clisp_cpp: $(SRCS) - $(SWIG) -c++ -clisp $(SWIGOPT) $(INTERFACEPATH) +clisp_cpp: $(SRCDIR_SRCS) + $(SWIG) -c++ -clisp $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) # ----------------------------------------------------------------- # Run CLISP example @@ -1527,15 +1564,15 @@ clisp_clean: CFFI = @CFFIBIN@ CFFI_SCRIPT=$(RUNME).lisp -cffi: $(SRCS) - $(SWIG) -cffi $(SWIGOPT) $(INTERFACEPATH) -# $(CC) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(INCLUDES) $(SRCS) -# $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) +cffi: $(SRCDIR_SRCS) + $(SWIG) -cffi $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) +# $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ISRCS) $(INCLUDES) $(SRCDIR_SRCS) +# $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) -cffi_cpp: $(SRCS) - $(SWIG) -c++ -cffi $(SWIGOPT) $(INTERFACEPATH) - $(CXX) -c $(CCSHARED) $(CXXFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) - $(CXXSHARED) $(CXXFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) +cffi_cpp: $(SRCDIR_SRCS) + $(SWIG) -c++ -cffi $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) + $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) # ----------------------------------------------------------------- # Run CFFI example @@ -1567,15 +1604,15 @@ cffi_clean: UFFI = @UFFIBIN@ UFFI_SCRIPT=$(RUNME).lisp -uffi: $(SRCS) - $(SWIG) -uffi $(SWIGOPT) $(INTERFACEPATH) -# $(CC) -c $(CCSHARED) $(CFLAGS) $(ISRCS) $(INCLUDES) $(SRCS) -# $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) +uffi: $(SRCDIR_SRCS) + $(SWIG) -uffi $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) +# $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(ISRCS) $(INCLUDES) $(SRCDIR_SRCS) +# $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO) -uffi_cpp: $(SRCS) - $(SWIG) -c++ -uffi $(SWIGOPT) $(INTERFACEPATH) -# $(CXX) -c $(CCSHARED) $(CXXFLAGS) $(ICXXSRCS) $(SRCS) $(CXXSRCS) $(INCLUDES) -# $(CXXSHARED) $(CXXFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) +uffi_cpp: $(SRCDIR_SRCS) + $(SWIG) -c++ -uffi $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) +# $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(ICXXSRCS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(INCLUDES) +# $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO) # ----------------------------------------------------------------- # Run UFFI example @@ -1618,23 +1655,23 @@ R_SCRIPT=$(RUNME).R # Build a R dynamically loadable module (C) # ---------------------------------------------------------------- -r: $(SRCS) - $(SWIG) -r $(SWIGOPT) $(INTERFACEPATH) -ifneq ($(SRCS),) - $(CC) -g -c $(CFLAGS) $(R_CFLAGS) $(SRCS) $(INCLUDES) +r: $(SRCDIR_SRCS) + $(SWIG) -r $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) +ifneq ($(SRCDIR_SRCS),) + $(CC) -g -c $(CPPFLAGS) $(CFLAGS) $(R_CFLAGS) $(SRCDIR_SRCS) $(INCLUDES) endif - +( PKG_CPPFLAGS="$(INCLUDES)" $(COMPILETOOL) $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(ISRCS) $(OBJS) > /dev/null ) + +( PKG_CPPFLAGS="$(CPPFLAGS) $(INCLUDES)" $(COMPILETOOL) $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(ISRCS) $(OBJS) > /dev/null ) # ---------------------------------------------------------------- # Build a R dynamically loadable module (C++) # ---------------------------------------------------------------- -r_cpp: $(CXXSRCS) +r_cpp: $(SRCDIR_CXXSRCS) $(SWIG) -c++ -r $(SWIGOPT) -o $(RCXXSRCS) $(INTERFACEPATH) -ifneq ($(CXXSRCS),) - $(CXX) -g -c $(CXXFLAGS) $(R_CFLAGS) $(CXXSRCS) $(INCLUDES) +ifneq ($(SRCDIR_CXXSRCS),) + $(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) $(R_CFLAGS) $(SRCDIR_CXXSRCS) $(INCLUDES) endif - +( PKG_CPPFLAGS="$(INCLUDES)" $(COMPILETOOL) $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(RCXXSRCS) $(OBJS) > /dev/null ) + +( PKG_CPPFLAGS="$(CPPFLAGS) $(INCLUDES)" $(COMPILETOOL) $(R) CMD SHLIB -o $(LIBPREFIX)$(TARGET)$(SO) $(RCXXSRCS) $(OBJS) > /dev/null ) # ----------------------------------------------------------------- # Run R example @@ -1693,13 +1730,13 @@ GOGCCOBJS = $(GOSRCS:.go=.@OBJEXT@) # Build a Go module (C) # ---------------------------------------------------------------- -go: $(SRCS) - $(SWIG) -go $(GOOPT) $(GOSWIGARG) $(SWIGOPT) $(INTERFACEPATH) +go: $(SRCDIR_SRCS) + $(SWIG) -go $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) if $(GO12) || $(GO13) || $(GOGCC); then \ - $(CC) -g -c $(CFLAGS) $(SRCS) $(ISRCS) $(INCLUDES); \ + $(CC) -g -c $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES); \ else \ - $(CC) -g -c $(CCSHARED) $(CFLAGS) $(SRCS) $(ISRCS) $(INCLUDES); \ - $(LDSHARED) $(CFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO); \ + $(CC) -g -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES); \ + $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(LIBPREFIX)$(TARGET)$(SO); \ fi $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(GOSRCS) if ! $(GOGCC) ; then \ @@ -1714,12 +1751,12 @@ go: $(SRCS) $(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)); \ fi; \ fi - if test -f $(RUNME).go; then \ - $(GO) $(GOCOMPILEARG) $(RUNME).go; \ + if test -f $(SRCDIR)$(RUNME).go; then \ + $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \ if $(GOGCC) ; then \ $(COMPILETOOL) $(GO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS); \ elif $(GO12) || $(GO13); then \ - $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld $(CC) -extldflags "$(CFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \ + $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CC)" -extldflags "$(CFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \ else \ $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \ fi; \ @@ -1729,13 +1766,13 @@ go: $(SRCS) # Build a Go module (C++) # ---------------------------------------------------------------- -go_cpp: $(SRCS) - $(SWIG) -go -c++ $(GOOPT) $(GOSWIGARG) $(SWIGOPT) $(INTERFACEPATH) +go_cpp: $(SRCDIR_SRCS) + $(SWIG) -go -c++ $(GOOPT) $(GOSWIGARG) $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) if $(GO12) || $(GO13) || $(GOGCC); then \ - $(CXX) -g -c $(CXXFLAGS) $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES); \ + $(CXX) -g -c $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES); \ else \ - $(CXX) -g -c $(CCSHARED) $(CXXFLAGS) $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES); \ - $(CXXSHARED) $(CXXFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO); \ + $(CXX) -g -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES); \ + $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(LIBPREFIX)$(TARGET)$(SO); \ fi $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(GOSRCS) if ! $(GOGCC) ; then \ @@ -1750,12 +1787,12 @@ go_cpp: $(SRCS) $(COMPILETOOL) $(GOPACK) grc $(GOPACKAGE) $(GOGCOBJS) $(GOCSRCS:.c=.$(GOOBJEXT)); \ fi; \ fi - if test -f $(RUNME).go; then \ - $(GO) $(GOCOMPILEARG) $(RUNME).go; \ + if test -f $(SRCDIR)$(RUNME).go; then \ + $(GO) $(GOCOMPILEARG) $(SRCDIR)$(RUNME).go; \ if $(GOGCC) ; then \ $(COMPILETOOL) $(GO) -o $(RUNME) $(RUNME).@OBJEXT@ $(GOGCCOBJS) $(OBJS) $(IOBJS) -lstdc++; \ elif $(GO12) || $(GO13); then \ - $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld $(CXX) -extldflags "$(CXXFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \ + $(COMPILETOOL) $(GOTOOL) $(GOLD) -linkmode external -extld "$(CXX)" -extldflags "$(CXXFLAGS) $(LDFLAGS)" -o $(RUNME) $(RUNME).$(GOOBJEXT); \ else \ $(COMPILETOOL) $(GOTOOL) $(GOLD) -r $${GOROOT:-`go env GOROOT`}/pkg/$${GOOS:-`go env GOOS`}_$${GOARCH:-`go env GOARCH`}:. -o $(RUNME) $(RUNME).$(GOOBJEXT); \ fi; \ @@ -1766,7 +1803,7 @@ go_cpp: $(SRCS) # ----------------------------------------------------------------- go_run: - env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) ./$(RUNME) $(RUNPIPE) + env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) ./$(RUNME) $(RUNPIPE) # ----------------------------------------------------------------- # Version display @@ -1808,19 +1845,19 @@ D_RUNME = ./$(RUNME) # Build a dynamically loadable D wrapper for a C module # ---------------------------------------------------------------- -d: $(SRCS) - $(SWIGD) $(SWIGOPT) $(INTERFACEPATH) - $(CC) -c $(CCSHARED) $(CFLAGS) $(DCFLAGS) $(EXTRA_CFLAGS) $(SRCS) $(ISRCS) $(INCLUDES) - $(LDSHARED) $(CFLAGS) $(DCFLAGS) $(EXTRA_LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(DLIBPREFIX)$(TARGET)$(SO) +d: $(SRCDIR_SRCS) + $(SWIGD) $(SWIGOPT) -o $(ISRCS) $(INTERFACEPATH) + $(CC) -c $(CCSHARED) $(CPPFLAGS) $(CFLAGS) $(DCFLAGS) $(EXTRA_CFLAGS) $(SRCDIR_SRCS) $(ISRCS) $(INCLUDES) + $(LDSHARED) $(CFLAGS) $(LDFLAGS) $(DCFLAGS) $(EXTRA_LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) -o $(DLIBPREFIX)$(TARGET)$(SO) # ---------------------------------------------------------------- # Build a dynamically loadable D wrapper for a C++ module # ---------------------------------------------------------------- -d_cpp: $(SRCS) - $(SWIGD) -c++ $(SWIGOPT) $(INTERFACEPATH) - $(CXX) -c $(CCSHARED) $(CXXFLAGS) $(DCFLAGS) $(EXTRA_CFLAGS) $(SRCS) $(CXXSRCS) $(ICXXSRCS) $(INCLUDES) - $(CXXSHARED) $(CXXFLAGS) $(DCFLAGS) $(EXTRA_LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(DLIBPREFIX)$(TARGET)$(SO) +d_cpp: $(SRCDIR_SRCS) + $(SWIGD) -c++ $(SWIGOPT) -o $(ICXXSRCS) $(INTERFACEPATH) + $(CXX) -c $(CCSHARED) $(CPPFLAGS) $(CXXFLAGS) $(DCFLAGS) $(EXTRA_CFLAGS) $(SRCDIR_SRCS) $(SRCDIR_CXXSRCS) $(ICXXSRCS) $(INCLUDES) + $(CXXSHARED) $(CXXFLAGS) $(LDFLAGS) $(DCFLAGS) $(EXTRA_LDFLAGS) $(OBJS) $(IOBJS) $(LIBS) $(CPP_DLLIBS) -o $(DLIBPREFIX)$(TARGET)$(SO) # ---------------------------------------------------------------- # Compile D files @@ -1828,7 +1865,7 @@ d_cpp: $(SRCS) # Clear the DFLAGS environment variable for the compiler call itself # to work around a discrepancy in argument handling between DMD and LDC. -d_compile: $(SRCS) +d_compile: $(SRCDIR_SRCS) DFLAGS="" $(COMPILETOOL) $(DCOMPILER) $(DFLAGS) $(DSRCS) # ----------------------------------------------------------------- @@ -1836,7 +1873,7 @@ d_compile: $(SRCS) # ----------------------------------------------------------------- d_run: - $(RUNTOOL) $(D_RUNME) $(RUNPIPE) + env LD_LIBRARY_PATH=$$PWD $(RUNTOOL) $(D_RUNME) $(RUNPIPE) # ----------------------------------------------------------------- # Version display diff --git a/Examples/android/class/Makefile b/Examples/android/class/Makefile index cef405ece..574566623 100644 --- a/Examples/android/class/Makefile +++ b/Examples/android/class/Makefile @@ -3,7 +3,7 @@ SWIG = $(TOP)/../preinst-swig TARGET = example INTERFACE = example.i INTERFACEDIR = jni/ -PACKAGEDIR = src/org/swig +PACKAGEDIR = $(SRCDIR)src/org/swig PACKAGENAME= org.swig.classexample SWIGOPT = -package $(PACKAGENAME) -outdir $(PACKAGEDIR)/classexample PROJECTNAME= SwigClass @@ -13,14 +13,14 @@ TARGETID = 1 check: build build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' INTERFACEDIR='$(INTERFACEDIR)' \ PROJECTNAME='$(PROJECTNAME)' TARGETID='$(TARGETID)' android_cpp install: - $(MAKE) -f $(TOP)/Makefile INSTALLOPTIONS='$(INSTALLOPTIONS)' PROJECTNAME='$(PROJECTNAME)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INSTALLOPTIONS='$(INSTALLOPTIONS)' PROJECTNAME='$(PROJECTNAME)' \ PACKAGEDIR='$(PACKAGEDIR)' PACKAGENAME='$(PACKAGENAME)' android_install clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' PROJECTNAME='$(PROJECTNAME)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' PROJECTNAME='$(PROJECTNAME)' \ PACKAGEDIR='$(PACKAGEDIR)' INTERFACEDIR='$(INTERFACEDIR)' android_clean diff --git a/Examples/android/extend/Makefile b/Examples/android/extend/Makefile index 9b796494a..fb974d22c 100644 --- a/Examples/android/extend/Makefile +++ b/Examples/android/extend/Makefile @@ -3,7 +3,7 @@ SWIG = $(TOP)/../preinst-swig TARGET = example INTERFACE = example.i INTERFACEDIR = jni/ -PACKAGEDIR = src/org/swig +PACKAGEDIR = $(SRCDIR)src/org/swig PACKAGENAME= org.swig.extendexample SWIGOPT = -package $(PACKAGENAME) -outdir $(PACKAGEDIR)/extendexample PROJECTNAME= SwigExtend @@ -13,14 +13,14 @@ TARGETID = 1 check: build build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' INTERFACEDIR='$(INTERFACEDIR)' \ PROJECTNAME='$(PROJECTNAME)' TARGETID='$(TARGETID)' android_cpp install: - $(MAKE) -f $(TOP)/Makefile INSTALLOPTIONS='$(INSTALLOPTIONS)' PROJECTNAME='$(PROJECTNAME)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INSTALLOPTIONS='$(INSTALLOPTIONS)' PROJECTNAME='$(PROJECTNAME)' \ PACKAGEDIR='$(PACKAGEDIR)' PACKAGENAME='$(PACKAGENAME)' android_install clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' PROJECTNAME='$(PROJECTNAME)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' PROJECTNAME='$(PROJECTNAME)' \ PACKAGEDIR='$(PACKAGEDIR)' INTERFACEDIR='$(INTERFACEDIR)' android_clean diff --git a/Examples/android/simple/Makefile b/Examples/android/simple/Makefile index 7e7ff40e1..2bf41968a 100644 --- a/Examples/android/simple/Makefile +++ b/Examples/android/simple/Makefile @@ -3,7 +3,7 @@ SWIG = $(TOP)/../preinst-swig TARGET = example INTERFACE = example.i INTERFACEDIR = jni/ -PACKAGEDIR = src/org/swig +PACKAGEDIR = $(SRCDIR)src/org/swig PACKAGENAME= org.swig.simple SWIGOPT = -package $(PACKAGENAME) -outdir $(PACKAGEDIR)/simple PROJECTNAME= SwigSimple @@ -13,14 +13,14 @@ TARGETID = 1 check: build build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' INTERFACEDIR='$(INTERFACEDIR)' \ PROJECTNAME='$(PROJECTNAME)' TARGETID='$(TARGETID)' android install: - $(MAKE) -f $(TOP)/Makefile INSTALLOPTIONS='$(INSTALLOPTIONS)' PROJECTNAME='$(PROJECTNAME)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INSTALLOPTIONS='$(INSTALLOPTIONS)' PROJECTNAME='$(PROJECTNAME)' \ PACKAGEDIR='$(PACKAGEDIR)' PACKAGENAME='$(PACKAGENAME)' android_install clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' PROJECTNAME='$(PROJECTNAME)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' PROJECTNAME='$(PROJECTNAME)' \ PACKAGEDIR='$(PACKAGEDIR)' INTERFACEDIR='$(INTERFACEDIR)' android_clean diff --git a/Examples/chicken/class/Makefile b/Examples/chicken/class/Makefile index cd445c867..a37ea4a85 100644 --- a/Examples/chicken/class/Makefile +++ b/Examples/chicken/class/Makefile @@ -6,7 +6,6 @@ CXXSRCS = example.cxx TARGET = class INCLUDE = SWIGOPT = -CFLAGS = VARIANT = # uncomment the following lines to build a static exe (only pick one of the CHICKEN_MAIN lines) @@ -15,24 +14,24 @@ VARIANT = #VARIANT = _static check: build - $(MAKE) -f $(TOP)/Makefile CHICKEN_SCRIPT='runme-lowlevel.scm' chicken_run - $(MAKE) -f $(TOP)/Makefile CHICKEN_SCRIPT='runme-tinyclos.scm' chicken_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CHICKEN_SCRIPT='runme-lowlevel.scm' chicken_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CHICKEN_SCRIPT='runme-tinyclos.scm' chicken_run build: $(TARGET) $(TARGET)_proxy $(TARGET): $(INTERFACE) $(SRCS) - $(MAKE) -f $(TOP)/Makefile \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \ SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \ INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \ SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)_cpp $(TARGET)_proxy: $(INTERFACE) $(SRCS) - $(MAKE) -f $(TOP)/Makefile \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \ SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \ INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT) -proxy' TARGET='$(TARGET)_proxy' \ SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)_cpp clean: - $(MAKE) -f $(TOP)/Makefile chicken_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_clean rm -f example.scm rm -f $(TARGET) diff --git a/Examples/chicken/class/example.cxx b/Examples/chicken/class/example.cxx index 1e8e203dd..046304519 100644 --- a/Examples/chicken/class/example.cxx +++ b/Examples/chicken/class/example.cxx @@ -1,4 +1,4 @@ -/* File : example.c */ +/* File : example.cxx */ #include "example.h" #define M_PI 3.14159265358979323846 @@ -11,18 +11,18 @@ void Shape::move(double dx, double dy) { int Shape::nshapes = 0; -double Circle::area(void) { +double Circle::area() { return M_PI*radius*radius; } -double Circle::perimeter(void) { +double Circle::perimeter() { return 2*M_PI*radius; } -double Square::area(void) { +double Square::area() { return width*width; } -double Square::perimeter(void) { +double Square::perimeter() { return 4*width; } diff --git a/Examples/chicken/constants/Makefile b/Examples/chicken/constants/Makefile index fe396733e..7167e866b 100644 --- a/Examples/chicken/constants/Makefile +++ b/Examples/chicken/constants/Makefile @@ -6,7 +6,6 @@ CXXSRCS = TARGET = constants INCLUDE = SWIGOPT = -CFLAGS = VARIANT = # uncomment the following two lines to build a static exe @@ -14,17 +13,17 @@ VARIANT = #VARIANT = _static check: build - $(MAKE) -f $(TOP)/Makefile chicken_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_run build: $(TARGET) $(TARGET): $(INTERFACE) $(SRCS) - $(MAKE) -f $(TOP)/Makefile \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \ SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \ INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \ SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT) clean: - $(MAKE) -f $(TOP)/Makefile chicken_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_clean rm -f example.scm rm -f $(TARGET) diff --git a/Examples/chicken/multimap/Makefile b/Examples/chicken/multimap/Makefile index d92cfede0..e8192e9cd 100644 --- a/Examples/chicken/multimap/Makefile +++ b/Examples/chicken/multimap/Makefile @@ -6,7 +6,6 @@ CXXSRCS = TARGET = multimap INCLUDE = SWIGOPT = -CFLAGS = VARIANT = # uncomment the following two lines to build a static exe @@ -14,17 +13,17 @@ VARIANT = #VARIANT = _static check: build - $(MAKE) -f $(TOP)/Makefile chicken_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_run build: $(TARGET) $(TARGET): $(INTERFACE) $(SRCS) - $(MAKE) -f $(TOP)/Makefile \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \ SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \ INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \ SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT) clean: - $(MAKE) -f $(TOP)/Makefile chicken_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_clean rm -f example.scm rm -f $(TARGET) diff --git a/Examples/chicken/overload/Makefile b/Examples/chicken/overload/Makefile index fb190e882..a9647d93e 100644 --- a/Examples/chicken/overload/Makefile +++ b/Examples/chicken/overload/Makefile @@ -6,7 +6,6 @@ CXXSRCS = example.cxx TARGET = overload INCLUDE = SWIGOPT = -proxy -unhideprimitive -CFLAGS = VARIANT = # uncomment the following lines to build a static exe @@ -14,17 +13,17 @@ VARIANT = #VARIANT = _static check: build - $(MAKE) -f $(TOP)/Makefile chicken_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_run build: $(TARGET) $(TARGET): $(INTERFACE) $(SRCS) - $(MAKE) -f $(TOP)/Makefile \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \ SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \ INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \ SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)_cpp clean: - $(MAKE) -f $(TOP)/Makefile chicken_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_clean rm -f example.scm rm -f $(TARGET) diff --git a/Examples/chicken/simple/Makefile b/Examples/chicken/simple/Makefile index d0d737484..c07075efa 100644 --- a/Examples/chicken/simple/Makefile +++ b/Examples/chicken/simple/Makefile @@ -6,7 +6,6 @@ CXXSRCS = TARGET = simple INCLUDE = SWIGOPT = -CFLAGS = VARIANT = # uncomment the following two lines to build a static exe @@ -14,17 +13,17 @@ VARIANT = #VARIANT = _static check: build - $(MAKE) -f $(TOP)/Makefile chicken_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_run build: $(TARGET) $(TARGET): $(INTERFACE) $(SRCS) - $(MAKE) -f $(TOP)/Makefile \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' \ SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \ INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \ SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT) clean: - $(MAKE) -f $(TOP)/Makefile chicken_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' chicken_clean rm -f example.scm example-generic.scm example-clos.scm rm -f $(TARGET) diff --git a/Examples/contract/simple_cxx/example.h b/Examples/contract/simple_cxx/example.h index 64b7684fa..de708bb7b 100644 --- a/Examples/contract/simple_cxx/example.h +++ b/Examples/contract/simple_cxx/example.h @@ -7,7 +7,7 @@ public: } virtual ~Shape() { nshapes--; - }; + } double x, y; void move(double dx, double dy); virtual double area(void) = 0; @@ -19,7 +19,7 @@ class Circle : public Shape { private: double radius; public: - Circle(double r) : radius(r) { }; + Circle(double r) : radius(r) { } virtual double area(void); virtual double perimeter(void); }; @@ -28,7 +28,7 @@ class Square : public Shape { private: double width; public: - Square(double w) : width(w) { }; + Square(double w) : width(w) { } virtual double area(void); virtual double perimeter(void); }; diff --git a/Examples/csharp/arrays/Makefile b/Examples/csharp/arrays/Makefile index 4be092d1c..e5d733d35 100644 --- a/Examples/csharp/arrays/Makefile +++ b/Examples/csharp/arrays/Makefile @@ -8,12 +8,12 @@ CSHARPSRCS = *.cs CSHARPFLAGS= -nologo -debug+ -unsafe -out:runme.exe check: build - $(MAKE) -f $(TOP)/Makefile csharp_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp - $(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile clean: - $(MAKE) -f $(TOP)/Makefile csharp_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_clean diff --git a/Examples/csharp/callback/Makefile b/Examples/csharp/callback/Makefile index 6c58abd28..4f4c84b9a 100644 --- a/Examples/csharp/callback/Makefile +++ b/Examples/csharp/callback/Makefile @@ -8,12 +8,12 @@ CSHARPSRCS = *.cs CSHARPFLAGS= -nologo -debug+ -out:runme.exe check: build - $(MAKE) -f $(TOP)/Makefile csharp_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp_cpp - $(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile clean: - $(MAKE) -f $(TOP)/Makefile csharp_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_clean diff --git a/Examples/csharp/class/Makefile b/Examples/csharp/class/Makefile index 6c58abd28..4f4c84b9a 100644 --- a/Examples/csharp/class/Makefile +++ b/Examples/csharp/class/Makefile @@ -8,12 +8,12 @@ CSHARPSRCS = *.cs CSHARPFLAGS= -nologo -debug+ -out:runme.exe check: build - $(MAKE) -f $(TOP)/Makefile csharp_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp_cpp - $(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile clean: - $(MAKE) -f $(TOP)/Makefile csharp_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_clean diff --git a/Examples/csharp/class/example.cxx b/Examples/csharp/class/example.cxx index 1e8e203dd..046304519 100644 --- a/Examples/csharp/class/example.cxx +++ b/Examples/csharp/class/example.cxx @@ -1,4 +1,4 @@ -/* File : example.c */ +/* File : example.cxx */ #include "example.h" #define M_PI 3.14159265358979323846 @@ -11,18 +11,18 @@ void Shape::move(double dx, double dy) { int Shape::nshapes = 0; -double Circle::area(void) { +double Circle::area() { return M_PI*radius*radius; } -double Circle::perimeter(void) { +double Circle::perimeter() { return 2*M_PI*radius; } -double Square::area(void) { +double Square::area() { return width*width; } -double Square::perimeter(void) { +double Square::perimeter() { return 4*width; } diff --git a/Examples/csharp/enum/Makefile b/Examples/csharp/enum/Makefile index 6c58abd28..4f4c84b9a 100644 --- a/Examples/csharp/enum/Makefile +++ b/Examples/csharp/enum/Makefile @@ -8,12 +8,12 @@ CSHARPSRCS = *.cs CSHARPFLAGS= -nologo -debug+ -out:runme.exe check: build - $(MAKE) -f $(TOP)/Makefile csharp_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp_cpp - $(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile clean: - $(MAKE) -f $(TOP)/Makefile csharp_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_clean diff --git a/Examples/csharp/extend/Makefile b/Examples/csharp/extend/Makefile index 6c58abd28..4f4c84b9a 100644 --- a/Examples/csharp/extend/Makefile +++ b/Examples/csharp/extend/Makefile @@ -8,12 +8,12 @@ CSHARPSRCS = *.cs CSHARPFLAGS= -nologo -debug+ -out:runme.exe check: build - $(MAKE) -f $(TOP)/Makefile csharp_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp_cpp - $(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile clean: - $(MAKE) -f $(TOP)/Makefile csharp_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_clean diff --git a/Examples/csharp/extend/example.h b/Examples/csharp/extend/example.h index b27ab9711..ca1aed28f 100644 --- a/Examples/csharp/extend/example.h +++ b/Examples/csharp/extend/example.h @@ -14,7 +14,7 @@ public: virtual std::string getTitle() { return getPosition() + " " + getName(); } virtual std::string getName() { return name; } virtual std::string getPosition() const { return "Employee"; } - virtual ~Employee() { printf("~Employee() @ %p\n", this); } + virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); } }; diff --git a/Examples/csharp/funcptr/Makefile b/Examples/csharp/funcptr/Makefile index ed15cb28e..99cdfa38a 100644 --- a/Examples/csharp/funcptr/Makefile +++ b/Examples/csharp/funcptr/Makefile @@ -8,12 +8,12 @@ CSHARPSRCS = *.cs CSHARPFLAGS= -nologo -debug+ -out:runme.exe check: build - $(MAKE) -f $(TOP)/Makefile csharp_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp - $(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile clean: - $(MAKE) -f $(TOP)/Makefile csharp_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_clean diff --git a/Examples/csharp/nested/Makefile b/Examples/csharp/nested/Makefile index 6c58abd28..4f4c84b9a 100644 --- a/Examples/csharp/nested/Makefile +++ b/Examples/csharp/nested/Makefile @@ -8,12 +8,12 @@ CSHARPSRCS = *.cs CSHARPFLAGS= -nologo -debug+ -out:runme.exe check: build - $(MAKE) -f $(TOP)/Makefile csharp_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp_cpp - $(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile clean: - $(MAKE) -f $(TOP)/Makefile csharp_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_clean diff --git a/Examples/csharp/reference/Makefile b/Examples/csharp/reference/Makefile index 6c58abd28..4f4c84b9a 100644 --- a/Examples/csharp/reference/Makefile +++ b/Examples/csharp/reference/Makefile @@ -8,12 +8,12 @@ CSHARPSRCS = *.cs CSHARPFLAGS= -nologo -debug+ -out:runme.exe check: build - $(MAKE) -f $(TOP)/Makefile csharp_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp_cpp - $(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile clean: - $(MAKE) -f $(TOP)/Makefile csharp_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_clean diff --git a/Examples/csharp/reference/example.cxx b/Examples/csharp/reference/example.cxx index 8a513bf49..9dbaed2ee 100644 --- a/Examples/csharp/reference/example.cxx +++ b/Examples/csharp/reference/example.cxx @@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) { char *Vector::print() { static char temp[512]; - sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); + sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z); return temp; } diff --git a/Examples/csharp/reference/example.h b/Examples/csharp/reference/example.h index 4915adb1b..bcfcfb72f 100644 --- a/Examples/csharp/reference/example.h +++ b/Examples/csharp/reference/example.h @@ -4,8 +4,8 @@ class Vector { private: double x,y,z; public: - Vector() : x(0), y(0), z(0) { }; - Vector(double x, double y, double z) : x(x), y(y), z(z) { }; + Vector() : x(0), y(0), z(0) { } + Vector(double x, double y, double z) : x(x), y(y), z(z) { } friend Vector operator+(const Vector &a, const Vector &b); char *print(); }; @@ -20,7 +20,3 @@ public: Vector &operator[](int); int size(); }; - - - - diff --git a/Examples/csharp/reference/example.i b/Examples/csharp/reference/example.i index 6daa3b1f4..173143d79 100644 --- a/Examples/csharp/reference/example.i +++ b/Examples/csharp/reference/example.i @@ -29,7 +29,7 @@ public: VectorArray(int maxsize); ~VectorArray(); int size(); - + /* This wrapper provides an alternative to the [] operator */ %extend { Vector &get(int index) { @@ -40,7 +40,3 @@ public: } } }; - - - - diff --git a/Examples/csharp/simple/Makefile b/Examples/csharp/simple/Makefile index ed15cb28e..99cdfa38a 100644 --- a/Examples/csharp/simple/Makefile +++ b/Examples/csharp/simple/Makefile @@ -8,12 +8,12 @@ CSHARPSRCS = *.cs CSHARPFLAGS= -nologo -debug+ -out:runme.exe check: build - $(MAKE) -f $(TOP)/Makefile csharp_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp - $(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile clean: - $(MAKE) -f $(TOP)/Makefile csharp_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_clean diff --git a/Examples/csharp/template/Makefile b/Examples/csharp/template/Makefile index 23fe2eec9..2d0e07009 100644 --- a/Examples/csharp/template/Makefile +++ b/Examples/csharp/template/Makefile @@ -8,12 +8,12 @@ CSHARPSRCS = *.cs CSHARPFLAGS= -nologo -debug+ -out:runme.exe check: build - $(MAKE) -f $(TOP)/Makefile csharp_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp_cpp - $(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile clean: - $(MAKE) -f $(TOP)/Makefile csharp_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_clean diff --git a/Examples/csharp/variables/Makefile b/Examples/csharp/variables/Makefile index ed15cb28e..99cdfa38a 100644 --- a/Examples/csharp/variables/Makefile +++ b/Examples/csharp/variables/Makefile @@ -8,12 +8,12 @@ CSHARPSRCS = *.cs CSHARPFLAGS= -nologo -debug+ -out:runme.exe check: build - $(MAKE) -f $(TOP)/Makefile csharp_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp - $(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile clean: - $(MAKE) -f $(TOP)/Makefile csharp_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' csharp_clean diff --git a/Examples/csharp/variables/example.c b/Examples/csharp/variables/example.c index 05e17c8c5..85685fe72 100644 --- a/Examples/csharp/variables/example.c +++ b/Examples/csharp/variables/example.c @@ -52,9 +52,9 @@ void print_vars() { printf("cvar = %c\n", cvar); printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("cstrvar = %s\n", cstrvar); - printf("iptrvar = %p\n", iptrvar); + printf("iptrvar = %p\n", (void *)iptrvar); printf("name = %s\n", name); - printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); + printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); printf("pt = (%d, %d)\n", pt.x, pt.y); printf("status = %d\n", status); } diff --git a/Examples/d/callback/Makefile b/Examples/d/callback/Makefile index eda18f13c..ad84231e1 100644 --- a/Examples/d/callback/Makefile +++ b/Examples/d/callback/Makefile @@ -1,27 +1 @@ -ifeq (2,$(D_VERSION)) - WORKING_DIR = d2/ -else - WORKING_DIR = d1/ -endif - -TOP = ../../.. -SWIG = $(TOP)/../preinst-swig -EXTRA_CFLAGS = -I../ ../example.cxx example_wrap.cxx -EXTRA_LDFLAGS = example.o example_wrap.o -TARGET = example_wrap -SWIGOPT = -DSRCS = *.d -DFLAGS = -ofrunme - -check: build - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile d_run - -build: - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile EXTRA_CFLAGS='$(EXTRA_CFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -outcurrentdir ../example.i' TARGET='$(TARGET)' d_cpp; \ - $(MAKE) -f $(TOP)/Makefile DSRCS='$(DSRCS)' DFLAGS='$(DFLAGS)' d_compile - -clean: - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile d_clean +include ../example.mk diff --git a/Examples/d/class/Makefile b/Examples/d/class/Makefile index eda18f13c..ad84231e1 100644 --- a/Examples/d/class/Makefile +++ b/Examples/d/class/Makefile @@ -1,27 +1 @@ -ifeq (2,$(D_VERSION)) - WORKING_DIR = d2/ -else - WORKING_DIR = d1/ -endif - -TOP = ../../.. -SWIG = $(TOP)/../preinst-swig -EXTRA_CFLAGS = -I../ ../example.cxx example_wrap.cxx -EXTRA_LDFLAGS = example.o example_wrap.o -TARGET = example_wrap -SWIGOPT = -DSRCS = *.d -DFLAGS = -ofrunme - -check: build - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile d_run - -build: - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile EXTRA_CFLAGS='$(EXTRA_CFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -outcurrentdir ../example.i' TARGET='$(TARGET)' d_cpp; \ - $(MAKE) -f $(TOP)/Makefile DSRCS='$(DSRCS)' DFLAGS='$(DFLAGS)' d_compile - -clean: - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile d_clean +include ../example.mk diff --git a/Examples/d/class/example.cxx b/Examples/d/class/example.cxx index 1e8e203dd..046304519 100644 --- a/Examples/d/class/example.cxx +++ b/Examples/d/class/example.cxx @@ -1,4 +1,4 @@ -/* File : example.c */ +/* File : example.cxx */ #include "example.h" #define M_PI 3.14159265358979323846 @@ -11,18 +11,18 @@ void Shape::move(double dx, double dy) { int Shape::nshapes = 0; -double Circle::area(void) { +double Circle::area() { return M_PI*radius*radius; } -double Circle::perimeter(void) { +double Circle::perimeter() { return 2*M_PI*radius; } -double Square::area(void) { +double Square::area() { return width*width; } -double Square::perimeter(void) { +double Square::perimeter() { return 4*width; } diff --git a/Examples/d/constants/Makefile b/Examples/d/constants/Makefile index d537ce281..ad84231e1 100644 --- a/Examples/d/constants/Makefile +++ b/Examples/d/constants/Makefile @@ -1,27 +1 @@ -ifeq (2,$(D_VERSION)) - WORKING_DIR = d2/ -else - WORKING_DIR = d1/ -endif - -TOP = ../../.. -SWIG = $(TOP)/../preinst-swig -EXTRA_CFLAGS = -I../ example_wrap.c -EXTRA_LDFLAGS = example_wrap.o -TARGET = example_wrap -SWIGOPT = -DSRCS = *.d -DFLAGS = -ofrunme - -check: build - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile d_run - -build: - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile EXTRA_CFLAGS='$(EXTRA_CFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -outcurrentdir ../example.i' TARGET='$(TARGET)' d; \ - $(MAKE) -f $(TOP)/Makefile DSRCS='$(DSRCS)' DFLAGS='$(DFLAGS)' d_compile - -clean: - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile d_clean +include ../example.mk diff --git a/Examples/d/constants/example.d b/Examples/d/constants/example.d deleted file mode 100644 index 7448d0ad9..000000000 --- a/Examples/d/constants/example.d +++ /dev/null @@ -1,23 +0,0 @@ -/* ---------------------------------------------------------------------------- - * This file was automatically generated by SWIG (http://www.swig.org). - * Version 1.3.41 - * - * Do not make changes to this file unless you know what you are doing--modify - * the SWIG interface file instead. - * ----------------------------------------------------------------------------- */ - -module example; - -static import example_wrap; - -static import tango.stdc.stringz; - -public const int ICONST = 42; -public const double FCONST = 2.1828; -public const char CCONST = 'x'; -public const char CCONST2 = '\n'; -public const char[] SCONST = "Hello World"; -public const char[] SCONST2 = "\"Hello World\""; -public const double EXPR = 42+3*(2.1828); -public const int iconst = 37; -public const double fconst = 3.14; diff --git a/Examples/d/enum/Makefile b/Examples/d/enum/Makefile index eda18f13c..ad84231e1 100644 --- a/Examples/d/enum/Makefile +++ b/Examples/d/enum/Makefile @@ -1,27 +1 @@ -ifeq (2,$(D_VERSION)) - WORKING_DIR = d2/ -else - WORKING_DIR = d1/ -endif - -TOP = ../../.. -SWIG = $(TOP)/../preinst-swig -EXTRA_CFLAGS = -I../ ../example.cxx example_wrap.cxx -EXTRA_LDFLAGS = example.o example_wrap.o -TARGET = example_wrap -SWIGOPT = -DSRCS = *.d -DFLAGS = -ofrunme - -check: build - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile d_run - -build: - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile EXTRA_CFLAGS='$(EXTRA_CFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -outcurrentdir ../example.i' TARGET='$(TARGET)' d_cpp; \ - $(MAKE) -f $(TOP)/Makefile DSRCS='$(DSRCS)' DFLAGS='$(DFLAGS)' d_compile - -clean: - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile d_clean +include ../example.mk diff --git a/Examples/d/example.mk.in b/Examples/d/example.mk.in new file mode 100644 index 000000000..a1d9a85fc --- /dev/null +++ b/Examples/d/example.mk.in @@ -0,0 +1,59 @@ +# +# Common Makefile code for building D examples. +# +# We actually need to configure this to gain access to the default D version to +# use when D_VERSION is not set. Using Examples/Makefile.in is not enough, as +# the location of the source files (d1/ or d2/) depends on it. The alternative +# would be to add the functionality specific to Examples/d (as opposed to the +# test suite) directly to Examples/Makefile.in. +# +# This file is supposed to be included from a Makefile in the subdirectory +# corresponding to a specific example. +# + +ifeq (,$(D_VERSION)) + D_VERSION = @DDEFAULTVERSION@ +endif + +ifeq (1,$(D_VERSION)) + VERSION_DIR = d1/ +else + VERSION_DIR = d2/ +endif + +EXAMPLES_TOP = ../../.. +SWIG_TOP = ../../../.. +SWIG = $(SWIG_TOP)/preinst-swig +EXTRA_CFLAGS = +EXTRA_CXXFLAGS = +EXTRA_LDFLAGS = +TARGET = example_wrap +SWIGOPT = -outcurrentdir +DFLAGS = -ofrunme + +ifeq (,$(SRCDIR)) +DSRCS = *.d +else +DSRCS = *.d $(addprefix ../$(SRCDIR)$(VERSION_DIR),runme.d) +endif + + +check: build + $(MAKE) -C $(VERSION_DIR) -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' d_run + +build: + mkdir -p $(VERSION_DIR) + if [ -f $(SRCDIR)example.cxx ]; then \ + $(MAKE) -C $(VERSION_DIR) -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' EXTRA_CXXFLAGS='$(EXTRA_CXXFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='example.i' CXXSRCS='example.cxx' d_cpp; \ + elif [ -f $(SRCDIR)example.c ]; then \ + $(MAKE) -C $(VERSION_DIR) -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' EXTRA_CFLAGS='$(EXTRA_CFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='example.i' SRCS='example.c' d; \ + else \ + $(MAKE) -C $(VERSION_DIR) -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' EXTRA_CFLAGS='$(EXTRA_CFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='example.i' SRCS='' d; \ + fi + $(MAKE) -C $(VERSION_DIR) -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' DSRCS='$(DSRCS)' DFLAGS='$(DFLAGS)' d_compile + +clean: + if [ -d $(VERSION_DIR) ]; then \ + $(MAKE) -C $(VERSION_DIR) -f $(EXAMPLES_TOP)/Makefile SRCDIR='../$(SRCDIR)' d_clean; \ + fi + test -f $(VERSION_DIR)runme.d || rm -rf $(VERSION_DIR) # Only delete dir if out of source diff --git a/Examples/d/extend/Makefile b/Examples/d/extend/Makefile index eda18f13c..ad84231e1 100644 --- a/Examples/d/extend/Makefile +++ b/Examples/d/extend/Makefile @@ -1,27 +1 @@ -ifeq (2,$(D_VERSION)) - WORKING_DIR = d2/ -else - WORKING_DIR = d1/ -endif - -TOP = ../../.. -SWIG = $(TOP)/../preinst-swig -EXTRA_CFLAGS = -I../ ../example.cxx example_wrap.cxx -EXTRA_LDFLAGS = example.o example_wrap.o -TARGET = example_wrap -SWIGOPT = -DSRCS = *.d -DFLAGS = -ofrunme - -check: build - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile d_run - -build: - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile EXTRA_CFLAGS='$(EXTRA_CFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -outcurrentdir ../example.i' TARGET='$(TARGET)' d_cpp; \ - $(MAKE) -f $(TOP)/Makefile DSRCS='$(DSRCS)' DFLAGS='$(DFLAGS)' d_compile - -clean: - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile d_clean +include ../example.mk diff --git a/Examples/d/extend/example.h b/Examples/d/extend/example.h index 7ad93fbc1..7a8c04c33 100644 --- a/Examples/d/extend/example.h +++ b/Examples/d/extend/example.h @@ -14,7 +14,7 @@ public: virtual std::string getTitle() { return getPosition() + " " + getName(); } virtual std::string getName() { return name; } virtual std::string getPosition() const { return "Employee"; } - virtual ~Employee() { printf("~Employee() @ %p\n", this); } + virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); } }; diff --git a/Examples/d/funcptr/Makefile b/Examples/d/funcptr/Makefile index 2ba893ca7..ad84231e1 100644 --- a/Examples/d/funcptr/Makefile +++ b/Examples/d/funcptr/Makefile @@ -1,27 +1 @@ -ifeq (2,$(D_VERSION)) - WORKING_DIR = d2/ -else - WORKING_DIR = d1/ -endif - -TOP = ../../.. -SWIG = $(TOP)/../preinst-swig -EXTRA_CFLAGS = -I../ ../example.c example_wrap.c -EXTRA_LDFLAGS = example.o example_wrap.o -TARGET = example_wrap -SWIGOPT = -DSRCS = *.d -DFLAGS = -ofrunme - -check: build - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile d_run - -build: - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile EXTRA_CFLAGS='$(EXTRA_CFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -outcurrentdir ../example.i' TARGET='$(TARGET)' d; \ - $(MAKE) -f $(TOP)/Makefile DSRCS='$(DSRCS)' DFLAGS='$(DFLAGS)' d_compile - -clean: - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile d_clean +include ../example.mk diff --git a/Examples/d/simple/Makefile b/Examples/d/simple/Makefile index a8808c9c5..ad84231e1 100644 --- a/Examples/d/simple/Makefile +++ b/Examples/d/simple/Makefile @@ -1,27 +1 @@ -ifeq (2,$(D_VERSION)) - WORKING_DIR = d2/ -else - WORKING_DIR = d1/ -endif - -TOP = ../../.. -SWIG = $(TOP)/../preinst-swig -EXTRA_CFLAGS = -I../ ../example.c example_wrap.c -EXTRA_LDFLAGS = example.o example_wrap.o -TARGET = example_wrap -SWIGOPT = -DSRCS = *.d -DFLAGS = -ofrunme - -check: build - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile d_run - -build: - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile EXTRA_CFLAGS='$(EXTRA_CFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -outcurrentdir ../example.i' TARGET='$(TARGET)' d; \ - $(MAKE) -f $(TOP)/Makefile DSRCS='$(DSRCS)' DFLAGS='$(DFLAGS)' d_compile - -clean: - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile d_clean +include ../example.mk diff --git a/Examples/d/variables/Makefile b/Examples/d/variables/Makefile index a8808c9c5..ad84231e1 100644 --- a/Examples/d/variables/Makefile +++ b/Examples/d/variables/Makefile @@ -1,27 +1 @@ -ifeq (2,$(D_VERSION)) - WORKING_DIR = d2/ -else - WORKING_DIR = d1/ -endif - -TOP = ../../.. -SWIG = $(TOP)/../preinst-swig -EXTRA_CFLAGS = -I../ ../example.c example_wrap.c -EXTRA_LDFLAGS = example.o example_wrap.o -TARGET = example_wrap -SWIGOPT = -DSRCS = *.d -DFLAGS = -ofrunme - -check: build - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile d_run - -build: - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile EXTRA_CFLAGS='$(EXTRA_CFLAGS)' EXTRA_LDFLAGS='$(EXTRA_LDFLAGS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -outcurrentdir ../example.i' TARGET='$(TARGET)' d; \ - $(MAKE) -f $(TOP)/Makefile DSRCS='$(DSRCS)' DFLAGS='$(DFLAGS)' d_compile - -clean: - cd $(WORKING_DIR); \ - $(MAKE) -f $(TOP)/Makefile d_clean +include ../example.mk diff --git a/Examples/d/variables/example.c b/Examples/d/variables/example.c index 3b4e9f346..f5356c755 100644 --- a/Examples/d/variables/example.c +++ b/Examples/d/variables/example.c @@ -52,9 +52,9 @@ void print_vars() { printf("cvar = %c\n", cvar); printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("cstrvar = %s\n", cstrvar); - printf("iptrvar = %p\n", iptrvar); + printf("iptrvar = %p\n", (void *)iptrvar); printf("name = %s\n", name); - printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); + printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); printf("pt = (%d, %d)\n", pt.x, pt.y); printf("status = %d\n", status); } diff --git a/Examples/go/callback/Makefile b/Examples/go/callback/Makefile index 46a14b417..bf5275f14 100644 --- a/Examples/go/callback/Makefile +++ b/Examples/go/callback/Makefile @@ -6,11 +6,11 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_cpp clean: - $(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INTERFACE='$(INTERFACE)' go_clean diff --git a/Examples/go/class/Makefile b/Examples/go/class/Makefile index 72605caa5..de067cdd8 100644 --- a/Examples/go/class/Makefile +++ b/Examples/go/class/Makefile @@ -6,11 +6,11 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_cpp clean: - $(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INTERFACE='$(INTERFACE)' go_clean diff --git a/Examples/go/class/class.cxx b/Examples/go/class/class.cxx index 1e8e203dd..f87c7ec8f 100644 --- a/Examples/go/class/class.cxx +++ b/Examples/go/class/class.cxx @@ -1,4 +1,4 @@ -/* File : example.c */ +/* File : class.cxx */ #include "example.h" #define M_PI 3.14159265358979323846 @@ -11,18 +11,18 @@ void Shape::move(double dx, double dy) { int Shape::nshapes = 0; -double Circle::area(void) { +double Circle::area() { return M_PI*radius*radius; } -double Circle::perimeter(void) { +double Circle::perimeter() { return 2*M_PI*radius; } -double Square::area(void) { +double Square::area() { return width*width; } -double Square::perimeter(void) { +double Square::perimeter() { return 4*width; } diff --git a/Examples/go/class/index.html b/Examples/go/class/index.html index b39119d12..df93b5672 100644 --- a/Examples/go/class/index.html +++ b/Examples/go/class/index.html @@ -33,8 +33,8 @@ public: } virtual ~Shape() { nshapes--; - }; - double x, y; + } + double x, y; void move(double dx, double dy); virtual double area() = 0; virtual double perimeter() = 0; @@ -45,7 +45,7 @@ class Circle : public Shape { private: double radius; public: - Circle(double r) : radius(r) { }; + Circle(double r) : radius(r) { } virtual double area(); virtual double perimeter(); }; @@ -54,7 +54,7 @@ class Square : public Shape { private: double width; public: - Square(double w) : width(w) { }; + Square(double w) : width(w) { } virtual double area(); virtual double perimeter(); }; diff --git a/Examples/go/constants/Makefile b/Examples/go/constants/Makefile index 9fa967366..8fb07fd6b 100644 --- a/Examples/go/constants/Makefile +++ b/Examples/go/constants/Makefile @@ -6,11 +6,11 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go clean: - $(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INTERFACE='$(INTERFACE)' go_clean diff --git a/Examples/go/enum/Makefile b/Examples/go/enum/Makefile index 1ceecc15c..2e2f1b2bd 100644 --- a/Examples/go/enum/Makefile +++ b/Examples/go/enum/Makefile @@ -6,11 +6,11 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_cpp clean: - $(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INTERFACE='$(INTERFACE)' go_clean diff --git a/Examples/go/extend/Makefile b/Examples/go/extend/Makefile index 67da89286..290694210 100644 --- a/Examples/go/extend/Makefile +++ b/Examples/go/extend/Makefile @@ -6,11 +6,11 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_cpp clean: - $(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INTERFACE='$(INTERFACE)' go_clean diff --git a/Examples/go/extend/example.h b/Examples/go/extend/example.h index b27ab9711..ca1aed28f 100644 --- a/Examples/go/extend/example.h +++ b/Examples/go/extend/example.h @@ -14,7 +14,7 @@ public: virtual std::string getTitle() { return getPosition() + " " + getName(); } virtual std::string getName() { return name; } virtual std::string getPosition() const { return "Employee"; } - virtual ~Employee() { printf("~Employee() @ %p\n", this); } + virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); } }; diff --git a/Examples/go/funcptr/Makefile b/Examples/go/funcptr/Makefile index 2c32c45fc..82031c9d5 100644 --- a/Examples/go/funcptr/Makefile +++ b/Examples/go/funcptr/Makefile @@ -6,11 +6,11 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go clean: - $(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INTERFACE='$(INTERFACE)' go_clean diff --git a/Examples/go/multimap/Makefile b/Examples/go/multimap/Makefile index 0c5ec395f..4d739162b 100644 --- a/Examples/go/multimap/Makefile +++ b/Examples/go/multimap/Makefile @@ -6,11 +6,11 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go clean: - $(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INTERFACE='$(INTERFACE)' go_clean diff --git a/Examples/go/pointer/Makefile b/Examples/go/pointer/Makefile index 12e94f939..9f1f3fda0 100644 --- a/Examples/go/pointer/Makefile +++ b/Examples/go/pointer/Makefile @@ -6,11 +6,11 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go clean: - $(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INTERFACE='$(INTERFACE)' go_clean diff --git a/Examples/go/reference/Makefile b/Examples/go/reference/Makefile index 41a944239..e136f6fae 100644 --- a/Examples/go/reference/Makefile +++ b/Examples/go/reference/Makefile @@ -6,11 +6,11 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_cpp clean: - $(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INTERFACE='$(INTERFACE)' go_clean diff --git a/Examples/go/reference/example.h b/Examples/go/reference/example.h index 4915adb1b..bcfcfb72f 100644 --- a/Examples/go/reference/example.h +++ b/Examples/go/reference/example.h @@ -4,8 +4,8 @@ class Vector { private: double x,y,z; public: - Vector() : x(0), y(0), z(0) { }; - Vector(double x, double y, double z) : x(x), y(y), z(z) { }; + Vector() : x(0), y(0), z(0) { } + Vector(double x, double y, double z) : x(x), y(y), z(z) { } friend Vector operator+(const Vector &a, const Vector &b); char *print(); }; @@ -20,7 +20,3 @@ public: Vector &operator[](int); int size(); }; - - - - diff --git a/Examples/go/reference/example.i b/Examples/go/reference/example.i index 1cf19c82c..173143d79 100644 --- a/Examples/go/reference/example.i +++ b/Examples/go/reference/example.i @@ -29,7 +29,7 @@ public: VectorArray(int maxsize); ~VectorArray(); int size(); - + /* This wrapper provides an alternative to the [] operator */ %extend { Vector &get(int index) { diff --git a/Examples/go/reference/reference.cxx b/Examples/go/reference/reference.cxx index 8a513bf49..9dbaed2ee 100644 --- a/Examples/go/reference/reference.cxx +++ b/Examples/go/reference/reference.cxx @@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) { char *Vector::print() { static char temp[512]; - sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); + sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z); return temp; } diff --git a/Examples/go/simple/Makefile b/Examples/go/simple/Makefile index 907da8821..5bc16549d 100644 --- a/Examples/go/simple/Makefile +++ b/Examples/go/simple/Makefile @@ -5,11 +5,11 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go clean: - $(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INTERFACE='$(INTERFACE)' go_clean diff --git a/Examples/go/template/Makefile b/Examples/go/template/Makefile index 51cd97a80..a1d674836 100644 --- a/Examples/go/template/Makefile +++ b/Examples/go/template/Makefile @@ -6,11 +6,11 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_cpp clean: - $(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INTERFACE='$(INTERFACE)' go_clean diff --git a/Examples/go/variables/Makefile b/Examples/go/variables/Makefile index 1f144929c..d0da605e0 100644 --- a/Examples/go/variables/Makefile +++ b/Examples/go/variables/Makefile @@ -6,11 +6,11 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go clean: - $(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INTERFACE='$(INTERFACE)' go_clean diff --git a/Examples/guile/class/Makefile b/Examples/guile/class/Makefile index 8de4f292b..48426a8fb 100644 --- a/Examples/guile/class/Makefile +++ b/Examples/guile/class/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile guile_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' guile_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='my-guile' INTERFACE='$(INTERFACE)' guile_static_cpp clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' guile_clean diff --git a/Examples/guile/class/example.cxx b/Examples/guile/class/example.cxx index 1e8e203dd..046304519 100644 --- a/Examples/guile/class/example.cxx +++ b/Examples/guile/class/example.cxx @@ -1,4 +1,4 @@ -/* File : example.c */ +/* File : example.cxx */ #include "example.h" #define M_PI 3.14159265358979323846 @@ -11,18 +11,18 @@ void Shape::move(double dx, double dy) { int Shape::nshapes = 0; -double Circle::area(void) { +double Circle::area() { return M_PI*radius*radius; } -double Circle::perimeter(void) { +double Circle::perimeter() { return 2*M_PI*radius; } -double Square::area(void) { +double Square::area() { return width*width; } -double Square::perimeter(void) { +double Square::perimeter() { return 4*width; } diff --git a/Examples/guile/constants/Makefile b/Examples/guile/constants/Makefile index 2b6965e9e..d3f58ebdc 100644 --- a/Examples/guile/constants/Makefile +++ b/Examples/guile/constants/Makefile @@ -5,11 +5,11 @@ TARGET = my-guile INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_augmented_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' guile_augmented_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_augmented clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' guile_clean diff --git a/Examples/guile/matrix/Makefile b/Examples/guile/matrix/Makefile index a32210e65..53638c867 100644 --- a/Examples/guile/matrix/Makefile +++ b/Examples/guile/matrix/Makefile @@ -5,11 +5,11 @@ TARGET = matrix INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' GUILE_RUNOPTIONS='-e do-test' guile_augmented_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' GUILE_RUNOPTIONS='-e do-test' guile_augmented_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' LIBS='-lm' guile_augmented clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' guile_clean diff --git a/Examples/guile/matrix/runme.scm b/Examples/guile/matrix/runme.scm index f11061e56..f11061e56 100755..100644 --- a/Examples/guile/matrix/runme.scm +++ b/Examples/guile/matrix/runme.scm diff --git a/Examples/guile/multimap/Makefile b/Examples/guile/multimap/Makefile index 4ca82a3d3..b8f5e9b5a 100644 --- a/Examples/guile/multimap/Makefile +++ b/Examples/guile/multimap/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile guile_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' guile_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='my-guile' INTERFACE='$(INTERFACE)' guile_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' guile_clean diff --git a/Examples/guile/multivalue/Makefile b/Examples/guile/multivalue/Makefile index 4ca82a3d3..b8f5e9b5a 100644 --- a/Examples/guile/multivalue/Makefile +++ b/Examples/guile/multivalue/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile guile_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' guile_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='my-guile' INTERFACE='$(INTERFACE)' guile_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' guile_clean diff --git a/Examples/guile/port/Makefile b/Examples/guile/port/Makefile index d6ec0ac24..95a3a479f 100644 --- a/Examples/guile/port/Makefile +++ b/Examples/guile/port/Makefile @@ -5,12 +5,12 @@ TARGET = port INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_augmented_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' guile_augmented_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_augmented clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' guile_clean rm -f test.out diff --git a/Examples/guile/simple/Makefile b/Examples/guile/simple/Makefile index da4eb9015..517e41c64 100644 --- a/Examples/guile/simple/Makefile +++ b/Examples/guile/simple/Makefile @@ -5,11 +5,11 @@ TARGET = my-guile INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_augmented_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' guile_augmented_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_augmented clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' guile_clean diff --git a/Examples/guile/std_vector/Makefile b/Examples/guile/std_vector/Makefile index fd7a8439a..d7f5de217 100644 --- a/Examples/guile/std_vector/Makefile +++ b/Examples/guile/std_vector/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile guile_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' guile_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='my-guile' INTERFACE='$(INTERFACE)' guile_static_cpp clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' guile_clean diff --git a/Examples/java/callback/Makefile b/Examples/java/callback/Makefile index 8f274e7cb..13cfd1708 100644 --- a/Examples/java/callback/Makefile +++ b/Examples/java/callback/Makefile @@ -7,12 +7,12 @@ SWIGOPT = JAVASRCS = *.java check: build - $(MAKE) -f $(TOP)/Makefile java_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp - $(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile clean: - $(MAKE) -f $(TOP)/Makefile java_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_clean diff --git a/Examples/java/class/Makefile b/Examples/java/class/Makefile index 8f274e7cb..13cfd1708 100644 --- a/Examples/java/class/Makefile +++ b/Examples/java/class/Makefile @@ -7,12 +7,12 @@ SWIGOPT = JAVASRCS = *.java check: build - $(MAKE) -f $(TOP)/Makefile java_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp - $(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile clean: - $(MAKE) -f $(TOP)/Makefile java_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_clean diff --git a/Examples/java/constants/Makefile b/Examples/java/constants/Makefile index 4e21fc4cd..637ce0ead 100644 --- a/Examples/java/constants/Makefile +++ b/Examples/java/constants/Makefile @@ -7,12 +7,12 @@ SWIGOPT = JAVASRCS = *.java check: build - $(MAKE) -f $(TOP)/Makefile java_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp - $(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile clean: - $(MAKE) -f $(TOP)/Makefile java_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_clean diff --git a/Examples/java/enum/Makefile b/Examples/java/enum/Makefile index 8f274e7cb..13cfd1708 100644 --- a/Examples/java/enum/Makefile +++ b/Examples/java/enum/Makefile @@ -7,12 +7,12 @@ SWIGOPT = JAVASRCS = *.java check: build - $(MAKE) -f $(TOP)/Makefile java_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp - $(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile clean: - $(MAKE) -f $(TOP)/Makefile java_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_clean diff --git a/Examples/java/extend/Makefile b/Examples/java/extend/Makefile index 8f274e7cb..13cfd1708 100644 --- a/Examples/java/extend/Makefile +++ b/Examples/java/extend/Makefile @@ -7,12 +7,12 @@ SWIGOPT = JAVASRCS = *.java check: build - $(MAKE) -f $(TOP)/Makefile java_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp - $(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile clean: - $(MAKE) -f $(TOP)/Makefile java_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_clean diff --git a/Examples/java/extend/example.h b/Examples/java/extend/example.h index b27ab9711..ca1aed28f 100644 --- a/Examples/java/extend/example.h +++ b/Examples/java/extend/example.h @@ -14,7 +14,7 @@ public: virtual std::string getTitle() { return getPosition() + " " + getName(); } virtual std::string getName() { return name; } virtual std::string getPosition() const { return "Employee"; } - virtual ~Employee() { printf("~Employee() @ %p\n", this); } + virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); } }; diff --git a/Examples/java/funcptr/Makefile b/Examples/java/funcptr/Makefile index e9e29f3a3..c0b1927ca 100644 --- a/Examples/java/funcptr/Makefile +++ b/Examples/java/funcptr/Makefile @@ -7,12 +7,12 @@ SWIGOPT = JAVASRCS = *.java check: build - $(MAKE) -f $(TOP)/Makefile java_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java - $(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile clean: - $(MAKE) -f $(TOP)/Makefile java_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_clean diff --git a/Examples/java/multimap/Makefile b/Examples/java/multimap/Makefile index e9e29f3a3..c0b1927ca 100644 --- a/Examples/java/multimap/Makefile +++ b/Examples/java/multimap/Makefile @@ -7,12 +7,12 @@ SWIGOPT = JAVASRCS = *.java check: build - $(MAKE) -f $(TOP)/Makefile java_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java - $(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile clean: - $(MAKE) -f $(TOP)/Makefile java_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_clean diff --git a/Examples/java/native/Makefile b/Examples/java/native/Makefile index e858cbe77..fa67e48a4 100644 --- a/Examples/java/native/Makefile +++ b/Examples/java/native/Makefile @@ -7,12 +7,12 @@ SWIGOPT = JAVASRCS = *.java check: build - $(MAKE) -f $(TOP)/Makefile java_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java - $(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile clean: - $(MAKE) -f $(TOP)/Makefile java_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_clean diff --git a/Examples/java/nested/Makefile b/Examples/java/nested/Makefile index 8f274e7cb..13cfd1708 100644 --- a/Examples/java/nested/Makefile +++ b/Examples/java/nested/Makefile @@ -7,12 +7,12 @@ SWIGOPT = JAVASRCS = *.java check: build - $(MAKE) -f $(TOP)/Makefile java_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp - $(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile clean: - $(MAKE) -f $(TOP)/Makefile java_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_clean diff --git a/Examples/java/pointer/Makefile b/Examples/java/pointer/Makefile index e9e29f3a3..c0b1927ca 100644 --- a/Examples/java/pointer/Makefile +++ b/Examples/java/pointer/Makefile @@ -7,12 +7,12 @@ SWIGOPT = JAVASRCS = *.java check: build - $(MAKE) -f $(TOP)/Makefile java_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java - $(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile clean: - $(MAKE) -f $(TOP)/Makefile java_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_clean diff --git a/Examples/java/reference/Makefile b/Examples/java/reference/Makefile index 8f274e7cb..13cfd1708 100644 --- a/Examples/java/reference/Makefile +++ b/Examples/java/reference/Makefile @@ -7,12 +7,12 @@ SWIGOPT = JAVASRCS = *.java check: build - $(MAKE) -f $(TOP)/Makefile java_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp - $(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile clean: - $(MAKE) -f $(TOP)/Makefile java_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_clean diff --git a/Examples/java/reference/example.cxx b/Examples/java/reference/example.cxx index 8a513bf49..9dbaed2ee 100644 --- a/Examples/java/reference/example.cxx +++ b/Examples/java/reference/example.cxx @@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) { char *Vector::print() { static char temp[512]; - sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); + sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z); return temp; } diff --git a/Examples/java/reference/example.h b/Examples/java/reference/example.h index 4915adb1b..bcfcfb72f 100644 --- a/Examples/java/reference/example.h +++ b/Examples/java/reference/example.h @@ -4,8 +4,8 @@ class Vector { private: double x,y,z; public: - Vector() : x(0), y(0), z(0) { }; - Vector(double x, double y, double z) : x(x), y(y), z(z) { }; + Vector() : x(0), y(0), z(0) { } + Vector(double x, double y, double z) : x(x), y(y), z(z) { } friend Vector operator+(const Vector &a, const Vector &b); char *print(); }; @@ -20,7 +20,3 @@ public: Vector &operator[](int); int size(); }; - - - - diff --git a/Examples/java/reference/example.i b/Examples/java/reference/example.i index 6daa3b1f4..173143d79 100644 --- a/Examples/java/reference/example.i +++ b/Examples/java/reference/example.i @@ -29,7 +29,7 @@ public: VectorArray(int maxsize); ~VectorArray(); int size(); - + /* This wrapper provides an alternative to the [] operator */ %extend { Vector &get(int index) { @@ -40,7 +40,3 @@ public: } } }; - - - - diff --git a/Examples/java/simple/Makefile b/Examples/java/simple/Makefile index e9e29f3a3..c0b1927ca 100644 --- a/Examples/java/simple/Makefile +++ b/Examples/java/simple/Makefile @@ -7,12 +7,12 @@ SWIGOPT = JAVASRCS = *.java check: build - $(MAKE) -f $(TOP)/Makefile java_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java - $(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile clean: - $(MAKE) -f $(TOP)/Makefile java_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_clean diff --git a/Examples/java/template/Makefile b/Examples/java/template/Makefile index 4e21fc4cd..637ce0ead 100644 --- a/Examples/java/template/Makefile +++ b/Examples/java/template/Makefile @@ -7,12 +7,12 @@ SWIGOPT = JAVASRCS = *.java check: build - $(MAKE) -f $(TOP)/Makefile java_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp - $(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile clean: - $(MAKE) -f $(TOP)/Makefile java_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_clean diff --git a/Examples/java/typemap/Makefile b/Examples/java/typemap/Makefile index e858cbe77..fa67e48a4 100644 --- a/Examples/java/typemap/Makefile +++ b/Examples/java/typemap/Makefile @@ -7,12 +7,12 @@ SWIGOPT = JAVASRCS = *.java check: build - $(MAKE) -f $(TOP)/Makefile java_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java - $(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile clean: - $(MAKE) -f $(TOP)/Makefile java_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_clean diff --git a/Examples/java/variables/Makefile b/Examples/java/variables/Makefile index e9e29f3a3..c0b1927ca 100644 --- a/Examples/java/variables/Makefile +++ b/Examples/java/variables/Makefile @@ -7,12 +7,12 @@ SWIGOPT = JAVASRCS = *.java check: build - $(MAKE) -f $(TOP)/Makefile java_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java - $(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile clean: - $(MAKE) -f $(TOP)/Makefile java_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' java_clean diff --git a/Examples/java/variables/example.c b/Examples/java/variables/example.c index 05e17c8c5..85685fe72 100644 --- a/Examples/java/variables/example.c +++ b/Examples/java/variables/example.c @@ -52,9 +52,9 @@ void print_vars() { printf("cvar = %c\n", cvar); printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("cstrvar = %s\n", cstrvar); - printf("iptrvar = %p\n", iptrvar); + printf("iptrvar = %p\n", (void *)iptrvar); printf("name = %s\n", name); - printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); + printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); printf("pt = (%d, %d)\n", pt.x, pt.y); printf("status = %d\n", status); } diff --git a/Examples/javascript/class/Makefile b/Examples/javascript/class/Makefile index 31846faae..54a8f7b03 100755..100644 --- a/Examples/javascript/class/Makefile +++ b/Examples/javascript/class/Makefile @@ -1,3 +1,3 @@ SRCS = example.cxx -include ../example.mk +include $(SRCDIR)../example.mk diff --git a/Examples/javascript/class/binding.gyp b/Examples/javascript/class/binding.gyp deleted file mode 100644 index 54eebfaa0..000000000 --- a/Examples/javascript/class/binding.gyp +++ /dev/null @@ -1,8 +0,0 @@ -{ - "targets": [ - { - "target_name": "example", - "sources": [ "example.cxx", "example_wrap.cxx" ] - } - ] -} diff --git a/Examples/javascript/class/binding.gyp.in b/Examples/javascript/class/binding.gyp.in new file mode 100644 index 000000000..cb2b45e8f --- /dev/null +++ b/Examples/javascript/class/binding.gyp.in @@ -0,0 +1,9 @@ +{ + "targets": [ + { + "target_name": "example", + "sources": [ "<!(cp $srcdir/example.cxx example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ], + "include_dirs": ["$srcdir"] + } + ] +} diff --git a/Examples/javascript/class/example.cxx b/Examples/javascript/class/example.cxx index e23fa6f73..046304519 100755..100644 --- a/Examples/javascript/class/example.cxx +++ b/Examples/javascript/class/example.cxx @@ -1,5 +1,5 @@ -/* File : example.c */ -#include <iostream> +/* File : example.cxx */ + #include "example.h" #define M_PI 3.14159265358979323846 @@ -11,18 +11,18 @@ void Shape::move(double dx, double dy) { int Shape::nshapes = 0; -double Circle::area(void) { +double Circle::area() { return M_PI*radius*radius; } -double Circle::perimeter(void) { +double Circle::perimeter() { return 2*M_PI*radius; } -double Square::area(void) { +double Square::area() { return width*width; } -double Square::perimeter(void) { +double Square::perimeter() { return 4*width; } diff --git a/Examples/javascript/class/example.h b/Examples/javascript/class/example.h index 64b7684fa..642130cd0 100755..100644 --- a/Examples/javascript/class/example.h +++ b/Examples/javascript/class/example.h @@ -7,11 +7,11 @@ public: } virtual ~Shape() { nshapes--; - }; + } double x, y; void move(double dx, double dy); - virtual double area(void) = 0; - virtual double perimeter(void) = 0; + virtual double area() = 0; + virtual double perimeter() = 0; static int nshapes; }; @@ -19,16 +19,16 @@ class Circle : public Shape { private: double radius; public: - Circle(double r) : radius(r) { }; - virtual double area(void); - virtual double perimeter(void); + Circle(double r) : radius(r) { } + virtual double area(); + virtual double perimeter(); }; class Square : public Shape { private: double width; public: - Square(double w) : width(w) { }; - virtual double area(void); - virtual double perimeter(void); + Square(double w) : width(w) { } + virtual double area(); + virtual double perimeter(); }; diff --git a/Examples/javascript/class/example.i b/Examples/javascript/class/example.i index 75700b305..fbdf7249f 100755..100644 --- a/Examples/javascript/class/example.i +++ b/Examples/javascript/class/example.i @@ -7,4 +7,3 @@ /* Let's just grab the original header file here */ %include "example.h" - diff --git a/Examples/javascript/class/example.js b/Examples/javascript/class/example.js index 79cd3913f..2e7f83a06 100644 --- a/Examples/javascript/class/example.js +++ b/Examples/javascript/class/example.js @@ -1 +1 @@ -module.exports = require("./build/Release/example"); +module.exports = require("build/Release/example"); diff --git a/Examples/javascript/class/runme.js b/Examples/javascript/class/runme.js index e1d5d9797..6a77b8d8e 100755..100644 --- a/Examples/javascript/class/runme.js +++ b/Examples/javascript/class/runme.js @@ -1,4 +1,4 @@ -var example = require("./example"); +var example = require("example"); // ----- Object creation ----- diff --git a/Examples/javascript/constant/Makefile b/Examples/javascript/constant/Makefile index ea04c7df8..0402f8d09 100755..100644 --- a/Examples/javascript/constant/Makefile +++ b/Examples/javascript/constant/Makefile @@ -1,3 +1,3 @@ SRCS = -include ../example.mk +include $(SRCDIR)../example.mk diff --git a/Examples/javascript/constant/binding.gyp b/Examples/javascript/constant/binding.gyp deleted file mode 100644 index 69af46b22..000000000 --- a/Examples/javascript/constant/binding.gyp +++ /dev/null @@ -1,8 +0,0 @@ -{ - "targets": [ - { - "target_name": "example", - "sources": [ "example_wrap.cxx" ] - } - ] -} diff --git a/Examples/javascript/constant/binding.gyp.in b/Examples/javascript/constant/binding.gyp.in new file mode 100644 index 000000000..59779aef4 --- /dev/null +++ b/Examples/javascript/constant/binding.gyp.in @@ -0,0 +1,9 @@ +{ + "targets": [ + { + "target_name": "example", + "sources": [ "example_wrap.cxx" ], + "include_dirs": ["$srcdir"] + } + ] +} diff --git a/Examples/javascript/constant/example.i b/Examples/javascript/constant/example.i index a6d28e7c9..a6d28e7c9 100755..100644 --- a/Examples/javascript/constant/example.i +++ b/Examples/javascript/constant/example.i diff --git a/Examples/javascript/constant/example.js b/Examples/javascript/constant/example.js index 79cd3913f..2e7f83a06 100644 --- a/Examples/javascript/constant/example.js +++ b/Examples/javascript/constant/example.js @@ -1 +1 @@ -module.exports = require("./build/Release/example"); +module.exports = require("build/Release/example"); diff --git a/Examples/javascript/constant/runme.js b/Examples/javascript/constant/runme.js index f4b55881e..f29d1a850 100755..100644 --- a/Examples/javascript/constant/runme.js +++ b/Examples/javascript/constant/runme.js @@ -1,4 +1,4 @@ -var example = require("./example"); +var example = require("example"); console.log("ICONST = " + example.ICONST + " (should be 42)"); console.log("FCONST = " + example.FCONST + " (should be 2.1828)"); diff --git a/Examples/javascript/enum/Makefile b/Examples/javascript/enum/Makefile index 31846faae..54a8f7b03 100755..100644 --- a/Examples/javascript/enum/Makefile +++ b/Examples/javascript/enum/Makefile @@ -1,3 +1,3 @@ SRCS = example.cxx -include ../example.mk +include $(SRCDIR)../example.mk diff --git a/Examples/javascript/enum/binding.gyp b/Examples/javascript/enum/binding.gyp deleted file mode 100644 index 54eebfaa0..000000000 --- a/Examples/javascript/enum/binding.gyp +++ /dev/null @@ -1,8 +0,0 @@ -{ - "targets": [ - { - "target_name": "example", - "sources": [ "example.cxx", "example_wrap.cxx" ] - } - ] -} diff --git a/Examples/javascript/enum/binding.gyp.in b/Examples/javascript/enum/binding.gyp.in new file mode 100644 index 000000000..cb2b45e8f --- /dev/null +++ b/Examples/javascript/enum/binding.gyp.in @@ -0,0 +1,9 @@ +{ + "targets": [ + { + "target_name": "example", + "sources": [ "<!(cp $srcdir/example.cxx example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ], + "include_dirs": ["$srcdir"] + } + ] +} diff --git a/Examples/javascript/enum/example.cxx b/Examples/javascript/enum/example.cxx index 6785e57ac..6785e57ac 100755..100644 --- a/Examples/javascript/enum/example.cxx +++ b/Examples/javascript/enum/example.cxx diff --git a/Examples/javascript/enum/example.h b/Examples/javascript/enum/example.h index 9119cd9fc..9119cd9fc 100755..100644 --- a/Examples/javascript/enum/example.h +++ b/Examples/javascript/enum/example.h diff --git a/Examples/javascript/enum/example.i b/Examples/javascript/enum/example.i index 23ee8a822..23ee8a822 100755..100644 --- a/Examples/javascript/enum/example.i +++ b/Examples/javascript/enum/example.i diff --git a/Examples/javascript/enum/example.js b/Examples/javascript/enum/example.js index 79cd3913f..2e7f83a06 100644 --- a/Examples/javascript/enum/example.js +++ b/Examples/javascript/enum/example.js @@ -1 +1 @@ -module.exports = require("./build/Release/example"); +module.exports = require("build/Release/example"); diff --git a/Examples/javascript/enum/runme.js b/Examples/javascript/enum/runme.js index d4e89e8c8..851d43c4b 100755..100644 --- a/Examples/javascript/enum/runme.js +++ b/Examples/javascript/enum/runme.js @@ -1,4 +1,4 @@ -var example = require("./example"); +var example = require("example"); // ----- Object creation ----- diff --git a/Examples/javascript/example.mk b/Examples/javascript/example.mk index 274eff1a3..cb8a33efd 100644 --- a/Examples/javascript/example.mk +++ b/Examples/javascript/example.mk @@ -7,21 +7,27 @@ else JSENGINE=node endif +ifneq (, $(V8_VERSION)) + JSV8_VERSION=$(V8_VERSION) +else + JSV8_VERSION=0x031110 +endif + EXAMPLES_TOP=../.. SWIG_TOP=../../.. SWIG = $(SWIG_TOP)/preinst-swig TARGET = example INTERFACE = example.i -SWIGOPT=-$(JSENGINE) +SWIGOPT=-$(JSENGINE) -DV8_VERSION=$(JSV8_VERSION) check: build - $(MAKE) -f $(EXAMPLES_TOP)/Makefile JSENGINE='$(JSENGINE)' TARGET='$(TARGET)' javascript_run + $(MAKE) -f $(EXAMPLES_TOP)/Makefile SRCDIR='$(SRCDIR)' JSENGINE='$(JSENGINE)' TARGET='$(TARGET)' javascript_run build: - $(MAKE) -f $(EXAMPLES_TOP)/Makefile CXXSRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(EXAMPLES_TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' javascript_wrapper_cpp - $(MAKE) -f $(EXAMPLES_TOP)/Makefile CXXSRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(EXAMPLES_TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' JSENGINE='$(JSENGINE)' javascript_build_cpp clean: - $(MAKE) -f $(EXAMPLES_TOP)/Makefile javascript_clean + $(MAKE) -f $(EXAMPLES_TOP)/Makefile SRCDIR='$(SRCDIR)' javascript_clean diff --git a/Examples/javascript/exception/Makefile b/Examples/javascript/exception/Makefile index 31846faae..54a8f7b03 100755..100644 --- a/Examples/javascript/exception/Makefile +++ b/Examples/javascript/exception/Makefile @@ -1,3 +1,3 @@ SRCS = example.cxx -include ../example.mk +include $(SRCDIR)../example.mk diff --git a/Examples/javascript/exception/binding.gyp b/Examples/javascript/exception/binding.gyp.in index 2be0a17a2..2e97d9757 100644 --- a/Examples/javascript/exception/binding.gyp +++ b/Examples/javascript/exception/binding.gyp.in @@ -2,7 +2,8 @@ "targets": [ { "target_name": "example", - "sources": [ "example.cxx", "example_wrap.cxx" ], + "sources": [ "<!(cp $srcdir/example.cxx example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ], + "include_dirs": ["$srcdir"], 'defines': [ 'BUILDING_NODE_EXTENSION=1', ], diff --git a/Examples/javascript/exception/example.js b/Examples/javascript/exception/example.js index 79cd3913f..2e7f83a06 100644 --- a/Examples/javascript/exception/example.js +++ b/Examples/javascript/exception/example.js @@ -1 +1 @@ -module.exports = require("./build/Release/example"); +module.exports = require("build/Release/example"); diff --git a/Examples/javascript/exception/runme.js b/Examples/javascript/exception/runme.js index 977f51ebc..43ce66d6d 100644 --- a/Examples/javascript/exception/runme.js +++ b/Examples/javascript/exception/runme.js @@ -1,4 +1,4 @@ -var example = require("./example"); +var example = require("example"); console.log("Trying to catch some exceptions."); t = new example.Test(); diff --git a/Examples/javascript/functor/Makefile b/Examples/javascript/functor/Makefile index 31846faae..0402f8d09 100755..100644 --- a/Examples/javascript/functor/Makefile +++ b/Examples/javascript/functor/Makefile @@ -1,3 +1,3 @@ -SRCS = example.cxx +SRCS = -include ../example.mk +include $(SRCDIR)../example.mk diff --git a/Examples/javascript/functor/binding.gyp b/Examples/javascript/functor/binding.gyp deleted file mode 100644 index 54eebfaa0..000000000 --- a/Examples/javascript/functor/binding.gyp +++ /dev/null @@ -1,8 +0,0 @@ -{ - "targets": [ - { - "target_name": "example", - "sources": [ "example.cxx", "example_wrap.cxx" ] - } - ] -} diff --git a/Examples/javascript/functor/binding.gyp.in b/Examples/javascript/functor/binding.gyp.in new file mode 100644 index 000000000..59779aef4 --- /dev/null +++ b/Examples/javascript/functor/binding.gyp.in @@ -0,0 +1,9 @@ +{ + "targets": [ + { + "target_name": "example", + "sources": [ "example_wrap.cxx" ], + "include_dirs": ["$srcdir"] + } + ] +} diff --git a/Examples/javascript/functor/example.js b/Examples/javascript/functor/example.js index 79cd3913f..2e7f83a06 100644 --- a/Examples/javascript/functor/example.js +++ b/Examples/javascript/functor/example.js @@ -1 +1 @@ -module.exports = require("./build/Release/example"); +module.exports = require("build/Release/example"); diff --git a/Examples/javascript/functor/runme.js b/Examples/javascript/functor/runme.js index dc12470f4..28dc64320 100644 --- a/Examples/javascript/functor/runme.js +++ b/Examples/javascript/functor/runme.js @@ -1,4 +1,4 @@ -var example = require("./example"); +var example = require("example"); a = new example.intSum(0); b = new example.doubleSum(100.0); diff --git a/Examples/javascript/nspace/Makefile b/Examples/javascript/nspace/Makefile index ea04c7df8..0402f8d09 100755..100644 --- a/Examples/javascript/nspace/Makefile +++ b/Examples/javascript/nspace/Makefile @@ -1,3 +1,3 @@ SRCS = -include ../example.mk +include $(SRCDIR)../example.mk diff --git a/Examples/javascript/nspace/binding.gyp b/Examples/javascript/nspace/binding.gyp deleted file mode 100644 index 69af46b22..000000000 --- a/Examples/javascript/nspace/binding.gyp +++ /dev/null @@ -1,8 +0,0 @@ -{ - "targets": [ - { - "target_name": "example", - "sources": [ "example_wrap.cxx" ] - } - ] -} diff --git a/Examples/javascript/nspace/binding.gyp.in b/Examples/javascript/nspace/binding.gyp.in new file mode 100644 index 000000000..59779aef4 --- /dev/null +++ b/Examples/javascript/nspace/binding.gyp.in @@ -0,0 +1,9 @@ +{ + "targets": [ + { + "target_name": "example", + "sources": [ "example_wrap.cxx" ], + "include_dirs": ["$srcdir"] + } + ] +} diff --git a/Examples/javascript/nspace/example.js b/Examples/javascript/nspace/example.js index 79cd3913f..2e7f83a06 100644 --- a/Examples/javascript/nspace/example.js +++ b/Examples/javascript/nspace/example.js @@ -1 +1 @@ -module.exports = require("./build/Release/example"); +module.exports = require("build/Release/example"); diff --git a/Examples/javascript/nspace/runme.js b/Examples/javascript/nspace/runme.js index d6a49d8d4..fad73477d 100644 --- a/Examples/javascript/nspace/runme.js +++ b/Examples/javascript/nspace/runme.js @@ -3,7 +3,7 @@ // This file illustrates class C++ interface generated // by SWIG. -var example = require("./example"); +var example = require("example"); // Calling a module function ( aka global function ) if (example.module_function() !== 7) { diff --git a/Examples/javascript/operator/Makefile b/Examples/javascript/operator/Makefile index ea04c7df8..0402f8d09 100755..100644 --- a/Examples/javascript/operator/Makefile +++ b/Examples/javascript/operator/Makefile @@ -1,3 +1,3 @@ SRCS = -include ../example.mk +include $(SRCDIR)../example.mk diff --git a/Examples/javascript/operator/binding.gyp b/Examples/javascript/operator/binding.gyp deleted file mode 100644 index 69af46b22..000000000 --- a/Examples/javascript/operator/binding.gyp +++ /dev/null @@ -1,8 +0,0 @@ -{ - "targets": [ - { - "target_name": "example", - "sources": [ "example_wrap.cxx" ] - } - ] -} diff --git a/Examples/javascript/operator/binding.gyp.in b/Examples/javascript/operator/binding.gyp.in new file mode 100644 index 000000000..59779aef4 --- /dev/null +++ b/Examples/javascript/operator/binding.gyp.in @@ -0,0 +1,9 @@ +{ + "targets": [ + { + "target_name": "example", + "sources": [ "example_wrap.cxx" ], + "include_dirs": ["$srcdir"] + } + ] +} diff --git a/Examples/javascript/operator/example.js b/Examples/javascript/operator/example.js index 79cd3913f..2e7f83a06 100644 --- a/Examples/javascript/operator/example.js +++ b/Examples/javascript/operator/example.js @@ -1 +1 @@ -module.exports = require("./build/Release/example"); +module.exports = require("build/Release/example"); diff --git a/Examples/javascript/operator/runme.js b/Examples/javascript/operator/runme.js index a700918d6..f72ca1c28 100644 --- a/Examples/javascript/operator/runme.js +++ b/Examples/javascript/operator/runme.js @@ -1,4 +1,4 @@ -var example = require("./example"); +var example = require("example"); a = new example.Complex(2,3); b = new example.Complex(-5,10); diff --git a/Examples/javascript/overload/Makefile b/Examples/javascript/overload/Makefile index ea04c7df8..0402f8d09 100755..100644 --- a/Examples/javascript/overload/Makefile +++ b/Examples/javascript/overload/Makefile @@ -1,3 +1,3 @@ SRCS = -include ../example.mk +include $(SRCDIR)../example.mk diff --git a/Examples/javascript/overload/binding.gyp b/Examples/javascript/overload/binding.gyp deleted file mode 100644 index 69af46b22..000000000 --- a/Examples/javascript/overload/binding.gyp +++ /dev/null @@ -1,8 +0,0 @@ -{ - "targets": [ - { - "target_name": "example", - "sources": [ "example_wrap.cxx" ] - } - ] -} diff --git a/Examples/javascript/overload/binding.gyp.in b/Examples/javascript/overload/binding.gyp.in new file mode 100644 index 000000000..59779aef4 --- /dev/null +++ b/Examples/javascript/overload/binding.gyp.in @@ -0,0 +1,9 @@ +{ + "targets": [ + { + "target_name": "example", + "sources": [ "example_wrap.cxx" ], + "include_dirs": ["$srcdir"] + } + ] +} diff --git a/Examples/javascript/overload/example.js b/Examples/javascript/overload/example.js index 79cd3913f..2e7f83a06 100644 --- a/Examples/javascript/overload/example.js +++ b/Examples/javascript/overload/example.js @@ -1 +1 @@ -module.exports = require("./build/Release/example"); +module.exports = require("build/Release/example"); diff --git a/Examples/javascript/overload/runme.js b/Examples/javascript/overload/runme.js index 1e6c861a6..1c23e3b6b 100644 --- a/Examples/javascript/overload/runme.js +++ b/Examples/javascript/overload/runme.js @@ -1,4 +1,4 @@ -var example = require("./example"); +var example = require("example"); example.f(); example.f(1); diff --git a/Examples/javascript/pointer/Makefile b/Examples/javascript/pointer/Makefile index 31846faae..54a8f7b03 100755..100644 --- a/Examples/javascript/pointer/Makefile +++ b/Examples/javascript/pointer/Makefile @@ -1,3 +1,3 @@ SRCS = example.cxx -include ../example.mk +include $(SRCDIR)../example.mk diff --git a/Examples/javascript/pointer/binding.gyp b/Examples/javascript/pointer/binding.gyp deleted file mode 100644 index 54eebfaa0..000000000 --- a/Examples/javascript/pointer/binding.gyp +++ /dev/null @@ -1,8 +0,0 @@ -{ - "targets": [ - { - "target_name": "example", - "sources": [ "example.cxx", "example_wrap.cxx" ] - } - ] -} diff --git a/Examples/javascript/pointer/binding.gyp.in b/Examples/javascript/pointer/binding.gyp.in new file mode 100644 index 000000000..cb2b45e8f --- /dev/null +++ b/Examples/javascript/pointer/binding.gyp.in @@ -0,0 +1,9 @@ +{ + "targets": [ + { + "target_name": "example", + "sources": [ "<!(cp $srcdir/example.cxx example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ], + "include_dirs": ["$srcdir"] + } + ] +} diff --git a/Examples/javascript/pointer/example.cxx b/Examples/javascript/pointer/example.cxx index 8762329fe..8762329fe 100755..100644 --- a/Examples/javascript/pointer/example.cxx +++ b/Examples/javascript/pointer/example.cxx diff --git a/Examples/javascript/pointer/example.i b/Examples/javascript/pointer/example.i index 38c67d7d2..38c67d7d2 100755..100644 --- a/Examples/javascript/pointer/example.i +++ b/Examples/javascript/pointer/example.i diff --git a/Examples/javascript/pointer/example.js b/Examples/javascript/pointer/example.js index 79cd3913f..2e7f83a06 100644 --- a/Examples/javascript/pointer/example.js +++ b/Examples/javascript/pointer/example.js @@ -1 +1 @@ -module.exports = require("./build/Release/example"); +module.exports = require("build/Release/example"); diff --git a/Examples/javascript/pointer/runme.js b/Examples/javascript/pointer/runme.js index fb8cf0c74..e9fa9a0bc 100755..100644 --- a/Examples/javascript/pointer/runme.js +++ b/Examples/javascript/pointer/runme.js @@ -1,4 +1,4 @@ -var example = require("./example"); +var example = require("example"); // First create some objects using the pointer library. console.log("Testing the pointer library"); diff --git a/Examples/javascript/reference/Makefile b/Examples/javascript/reference/Makefile index 31846faae..54a8f7b03 100755..100644 --- a/Examples/javascript/reference/Makefile +++ b/Examples/javascript/reference/Makefile @@ -1,3 +1,3 @@ SRCS = example.cxx -include ../example.mk +include $(SRCDIR)../example.mk diff --git a/Examples/javascript/reference/binding.gyp b/Examples/javascript/reference/binding.gyp deleted file mode 100644 index 54eebfaa0..000000000 --- a/Examples/javascript/reference/binding.gyp +++ /dev/null @@ -1,8 +0,0 @@ -{ - "targets": [ - { - "target_name": "example", - "sources": [ "example.cxx", "example_wrap.cxx" ] - } - ] -} diff --git a/Examples/javascript/reference/binding.gyp.in b/Examples/javascript/reference/binding.gyp.in new file mode 100644 index 000000000..cb2b45e8f --- /dev/null +++ b/Examples/javascript/reference/binding.gyp.in @@ -0,0 +1,9 @@ +{ + "targets": [ + { + "target_name": "example", + "sources": [ "<!(cp $srcdir/example.cxx example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ], + "include_dirs": ["$srcdir"] + } + ] +} diff --git a/Examples/javascript/reference/example.cxx b/Examples/javascript/reference/example.cxx index 8a513bf49..9dbaed2ee 100755..100644 --- a/Examples/javascript/reference/example.cxx +++ b/Examples/javascript/reference/example.cxx @@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) { char *Vector::print() { static char temp[512]; - sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); + sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z); return temp; } diff --git a/Examples/javascript/reference/example.h b/Examples/javascript/reference/example.h index 4915adb1b..bcfcfb72f 100755..100644 --- a/Examples/javascript/reference/example.h +++ b/Examples/javascript/reference/example.h @@ -4,8 +4,8 @@ class Vector { private: double x,y,z; public: - Vector() : x(0), y(0), z(0) { }; - Vector(double x, double y, double z) : x(x), y(y), z(z) { }; + Vector() : x(0), y(0), z(0) { } + Vector(double x, double y, double z) : x(x), y(y), z(z) { } friend Vector operator+(const Vector &a, const Vector &b); char *print(); }; @@ -20,7 +20,3 @@ public: Vector &operator[](int); int size(); }; - - - - diff --git a/Examples/javascript/reference/example.i b/Examples/javascript/reference/example.i index 1cf19c82c..173143d79 100755..100644 --- a/Examples/javascript/reference/example.i +++ b/Examples/javascript/reference/example.i @@ -29,7 +29,7 @@ public: VectorArray(int maxsize); ~VectorArray(); int size(); - + /* This wrapper provides an alternative to the [] operator */ %extend { Vector &get(int index) { diff --git a/Examples/javascript/reference/example.js b/Examples/javascript/reference/example.js index 79cd3913f..2e7f83a06 100644 --- a/Examples/javascript/reference/example.js +++ b/Examples/javascript/reference/example.js @@ -1 +1 @@ -module.exports = require("./build/Release/example"); +module.exports = require("build/Release/example"); diff --git a/Examples/javascript/reference/runme.js b/Examples/javascript/reference/runme.js index 88c108314..04f732520 100755..100644 --- a/Examples/javascript/reference/runme.js +++ b/Examples/javascript/reference/runme.js @@ -1,5 +1,5 @@ // This file illustrates the manipulation of C++ references in Javascript. -var example = require("./example"); +var example = require("example"); // ----- Object creation ----- diff --git a/Examples/javascript/simple/Makefile b/Examples/javascript/simple/Makefile index 31846faae..54a8f7b03 100755..100644 --- a/Examples/javascript/simple/Makefile +++ b/Examples/javascript/simple/Makefile @@ -1,3 +1,3 @@ SRCS = example.cxx -include ../example.mk +include $(SRCDIR)../example.mk diff --git a/Examples/javascript/simple/binding.gyp b/Examples/javascript/simple/binding.gyp deleted file mode 100644 index 54eebfaa0..000000000 --- a/Examples/javascript/simple/binding.gyp +++ /dev/null @@ -1,8 +0,0 @@ -{ - "targets": [ - { - "target_name": "example", - "sources": [ "example.cxx", "example_wrap.cxx" ] - } - ] -} diff --git a/Examples/javascript/simple/binding.gyp.in b/Examples/javascript/simple/binding.gyp.in new file mode 100644 index 000000000..cb2b45e8f --- /dev/null +++ b/Examples/javascript/simple/binding.gyp.in @@ -0,0 +1,9 @@ +{ + "targets": [ + { + "target_name": "example", + "sources": [ "<!(cp $srcdir/example.cxx example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ], + "include_dirs": ["$srcdir"] + } + ] +} diff --git a/Examples/javascript/simple/example.js b/Examples/javascript/simple/example.js index 79cd3913f..2e7f83a06 100644 --- a/Examples/javascript/simple/example.js +++ b/Examples/javascript/simple/example.js @@ -1 +1 @@ -module.exports = require("./build/Release/example"); +module.exports = require("build/Release/example"); diff --git a/Examples/javascript/simple/runme.js b/Examples/javascript/simple/runme.js index be2c18669..4abff0e2a 100755..100644 --- a/Examples/javascript/simple/runme.js +++ b/Examples/javascript/simple/runme.js @@ -1,4 +1,4 @@ -var example = require("./example"); +var example = require("example"); /* Call our gcd() function */ diff --git a/Examples/javascript/template/Makefile b/Examples/javascript/template/Makefile index ea04c7df8..0402f8d09 100755..100644 --- a/Examples/javascript/template/Makefile +++ b/Examples/javascript/template/Makefile @@ -1,3 +1,3 @@ SRCS = -include ../example.mk +include $(SRCDIR)../example.mk diff --git a/Examples/javascript/template/binding.gyp b/Examples/javascript/template/binding.gyp deleted file mode 100644 index 69af46b22..000000000 --- a/Examples/javascript/template/binding.gyp +++ /dev/null @@ -1,8 +0,0 @@ -{ - "targets": [ - { - "target_name": "example", - "sources": [ "example_wrap.cxx" ] - } - ] -} diff --git a/Examples/javascript/template/binding.gyp.in b/Examples/javascript/template/binding.gyp.in new file mode 100644 index 000000000..59779aef4 --- /dev/null +++ b/Examples/javascript/template/binding.gyp.in @@ -0,0 +1,9 @@ +{ + "targets": [ + { + "target_name": "example", + "sources": [ "example_wrap.cxx" ], + "include_dirs": ["$srcdir"] + } + ] +} diff --git a/Examples/javascript/template/example.js b/Examples/javascript/template/example.js index 79cd3913f..2e7f83a06 100644 --- a/Examples/javascript/template/example.js +++ b/Examples/javascript/template/example.js @@ -1 +1 @@ -module.exports = require("./build/Release/example"); +module.exports = require("build/Release/example"); diff --git a/Examples/javascript/template/runme.js b/Examples/javascript/template/runme.js index 55894dfd5..6a29fa77c 100644 --- a/Examples/javascript/template/runme.js +++ b/Examples/javascript/template/runme.js @@ -1,4 +1,4 @@ -var example = require("./example"); +var example = require("example"); //Call some templated functions console.log(example.maxint(3,7)); @@ -9,20 +9,20 @@ console.log(example.maxdouble(3.14,2.18)); iv = new example.vecint(100); dv = new example.vecdouble(1000); -for(i=0;i<=100;i++) +for(i=0;i<100;i++) iv.setitem(i,2*i); -for(i=0;i<=1000;i++) +for(i=0;i<1000;i++) dv.setitem(i, 1.0/(i+1)); sum = 0; -for(i=0;i<=100;i++) +for(i=0;i<100;i++) sum = sum + iv.getitem(i); console.log(sum); sum = 0.0; -for(i=0;i<=1000;i++) +for(i=0;i<1000;i++) sum = sum + dv.getitem(i); console.log(sum); diff --git a/Examples/javascript/variables/Makefile b/Examples/javascript/variables/Makefile index 31846faae..54a8f7b03 100755..100644 --- a/Examples/javascript/variables/Makefile +++ b/Examples/javascript/variables/Makefile @@ -1,3 +1,3 @@ SRCS = example.cxx -include ../example.mk +include $(SRCDIR)../example.mk diff --git a/Examples/javascript/variables/binding.gyp b/Examples/javascript/variables/binding.gyp deleted file mode 100644 index 54eebfaa0..000000000 --- a/Examples/javascript/variables/binding.gyp +++ /dev/null @@ -1,8 +0,0 @@ -{ - "targets": [ - { - "target_name": "example", - "sources": [ "example.cxx", "example_wrap.cxx" ] - } - ] -} diff --git a/Examples/javascript/variables/binding.gyp.in b/Examples/javascript/variables/binding.gyp.in new file mode 100644 index 000000000..cb2b45e8f --- /dev/null +++ b/Examples/javascript/variables/binding.gyp.in @@ -0,0 +1,9 @@ +{ + "targets": [ + { + "target_name": "example", + "sources": [ "<!(cp $srcdir/example.cxx example-gypcopy.cxx && echo example-gypcopy.cxx)", "example_wrap.cxx" ], + "include_dirs": ["$srcdir"] + } + ] +} diff --git a/Examples/javascript/variables/example.cxx b/Examples/javascript/variables/example.cxx index f10390a9e..15314b383 100755..100644 --- a/Examples/javascript/variables/example.cxx +++ b/Examples/javascript/variables/example.cxx @@ -57,9 +57,9 @@ void print_vars() { printf("cvar = %c\n", cvar); printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("cstrvar = %s\n", cstrvar); - printf("iptrvar = %p\n", iptrvar); + printf("iptrvar = %p\n", (void *)iptrvar); printf("name = %s\n", name); - printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); + printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); printf("pt = (%d, %d)\n", pt.x, pt.y); printf("status = %d\n", status); } diff --git a/Examples/javascript/variables/example.h b/Examples/javascript/variables/example.h index 0f7e89594..0f7e89594 100755..100644 --- a/Examples/javascript/variables/example.h +++ b/Examples/javascript/variables/example.h diff --git a/Examples/javascript/variables/example.i b/Examples/javascript/variables/example.i index 591b871ed..591b871ed 100755..100644 --- a/Examples/javascript/variables/example.i +++ b/Examples/javascript/variables/example.i diff --git a/Examples/javascript/variables/example.js b/Examples/javascript/variables/example.js index 79cd3913f..2e7f83a06 100644 --- a/Examples/javascript/variables/example.js +++ b/Examples/javascript/variables/example.js @@ -1 +1 @@ -module.exports = require("./build/Release/example"); +module.exports = require("build/Release/example"); diff --git a/Examples/javascript/variables/runme.js b/Examples/javascript/variables/runme.js index 537e17296..a2b5f791c 100755..100644 --- a/Examples/javascript/variables/runme.js +++ b/Examples/javascript/variables/runme.js @@ -1,4 +1,4 @@ -var example = require("./example"); +var example = require("example"); // Try to set the values of some global variables example.ivar = 42; diff --git a/Examples/lua/arrays/Makefile b/Examples/lua/arrays/Makefile index d398dffea..4191f7ec3 100644 --- a/Examples/lua/arrays/Makefile +++ b/Examples/lua/arrays/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile lua_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='mylua' INTERFACE='$(INTERFACE)' lua_static clean: - $(MAKE) -f $(TOP)/Makefile lua_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_clean diff --git a/Examples/lua/arrays/example.c b/Examples/lua/arrays/example.c index ed23738c8..da1bd755a 100644 --- a/Examples/lua/arrays/example.c +++ b/Examples/lua/arrays/example.c @@ -13,7 +13,7 @@ void sort_int(int* arr, int len) qsort(arr, len, sizeof(int), compare_int); } -// ditto doubles +/* ditto doubles */ int compare_double(const void * a, const void * b) { return (int)( *(double*)a - *(double*)b ); diff --git a/Examples/lua/class/Makefile b/Examples/lua/class/Makefile index c39e8acdf..96308f0df 100644 --- a/Examples/lua/class/Makefile +++ b/Examples/lua/class/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile lua_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mylua' INTERFACE='$(INTERFACE)' lua_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile lua_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_clean diff --git a/Examples/lua/class/example.cxx b/Examples/lua/class/example.cxx index 1e8e203dd..046304519 100644 --- a/Examples/lua/class/example.cxx +++ b/Examples/lua/class/example.cxx @@ -1,4 +1,4 @@ -/* File : example.c */ +/* File : example.cxx */ #include "example.h" #define M_PI 3.14159265358979323846 @@ -11,18 +11,18 @@ void Shape::move(double dx, double dy) { int Shape::nshapes = 0; -double Circle::area(void) { +double Circle::area() { return M_PI*radius*radius; } -double Circle::perimeter(void) { +double Circle::perimeter() { return 2*M_PI*radius; } -double Square::area(void) { +double Square::area() { return width*width; } -double Square::perimeter(void) { +double Square::perimeter() { return 4*width; } diff --git a/Examples/lua/class/runme.lua b/Examples/lua/class/runme.lua index 2c3ad8ced..5d140defe 100644 --- a/Examples/lua/class/runme.lua +++ b/Examples/lua/class/runme.lua @@ -53,7 +53,6 @@ print("\nGuess I'll clean up now") -- Note: this invokes the virtual destructor c=nil s=nil -s = 3 -- call gc to make sure they are collected collectgarbage() diff --git a/Examples/lua/constants/Makefile b/Examples/lua/constants/Makefile index 7e36e15a1..ae33cb182 100644 --- a/Examples/lua/constants/Makefile +++ b/Examples/lua/constants/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = check: build - $(MAKE) -f $(TOP)/Makefile lua_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mylua' INTERFACE='$(INTERFACE)' lua_static clean: - $(MAKE) -f $(TOP)/Makefile lua_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_clean diff --git a/Examples/lua/dual/Makefile b/Examples/lua/dual/Makefile index 12ee00a68..c86152a97 100644 --- a/Examples/lua/dual/Makefile +++ b/Examples/lua/dual/Makefile @@ -1,21 +1,21 @@ TOP = ../.. SWIG = $(TOP)/../preinst-swig TARGET = dual -CXXSRCS = example2_wrap.cxx +GENCXXSRCS = example2_wrap.cxx INTERFACE = dual.i LUA_INTERP = dual.cpp # This is a little different to normal as we need to static link two modules and a custom interpreter # We need the external runtime, then swig examples2, and build the module as normal check: build - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' lua_embed_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' lua_embed_run build: $(SWIG) -lua -external-runtime - $(SWIG) -c++ -lua $(SWIGOPT) example2.i - $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(SWIG) -c++ -lua $(SWIGOPT) -o $(GENCXXSRCS) $(SRCDIR)example2.i + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) GENCXXSRCS='$(GENCXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='example.i' LUA_INTERP='$(LUA_INTERP)' lua_static_cpp clean: - $(MAKE) -f $(TOP)/Makefile lua_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_clean rm -f swigluarun.h $(TARGET) diff --git a/Examples/lua/dual/dual.cpp b/Examples/lua/dual/dual.cpp index b54e44de1..2108a7275 100644 --- a/Examples/lua/dual/dual.cpp +++ b/Examples/lua/dual/dual.cpp @@ -45,14 +45,14 @@ void testModule(lua_State *L) swig_type_info *pTypeInfo=0,*pTypeInfo2=0; swig_module_info *pModule=0; pModule=SWIG_GetModule(L); - DEBUG2(" SWIG_GetModule() returns %p\n",pModule) + DEBUG2(" SWIG_GetModule() returns %p\n", (void *)pModule) if(pModule==0) return; pTypeInfo = SWIG_TypeQuery(L,"Foo *"); DEBUG2(" Type (Foo*) is %s\n",pTypeInfo==0?"unknown":"known"); - DEBUG3(" Module %p typeinfo(Foo*) %p\n",pModule,pTypeInfo); + DEBUG3(" Module %p typeinfo(Foo*) %p\n", (void *)pModule, (void *)pTypeInfo); pTypeInfo2 = SWIG_TypeQuery(L,"Bar *"); DEBUG2(" Type (Bar*) is %s\n",pTypeInfo2==0?"unknown":"known"); - DEBUG3(" Module %p typeinfo(Bar*) %p\n",pModule,pTypeInfo2); + DEBUG3(" Module %p typeinfo(Bar*) %p\n", (void *)pModule, (void *)pTypeInfo2); } int main(int argc,char* argv[]) diff --git a/Examples/lua/embed/Makefile b/Examples/lua/embed/Makefile index 57979c061..5e3a91893 100644 --- a/Examples/lua/embed/Makefile +++ b/Examples/lua/embed/Makefile @@ -9,12 +9,12 @@ LIBS = -lm # this is a little different to normal as we have our own special interpreter # which we want to static link check: build - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' lua_embed_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' lua_embed_run build: - $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' LIBS='$(LIBS)' INTERFACE='example.i' LUA_INTERP='$(LUA_INTERP)' lua_static clean: - $(MAKE) -f $(TOP)/Makefile lua_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_clean rm -f $(TARGET) diff --git a/Examples/lua/embed/embed.c b/Examples/lua/embed/embed.c index 507567489..1f10cc8e8 100644 --- a/Examples/lua/embed/embed.c +++ b/Examples/lua/embed/embed.c @@ -13,6 +13,7 @@ We will be using the luaL_dostring()/lua_dostring() function to call into lua #include <stdlib.h> #include <stdio.h> +#include <string.h> #include <lua.h> #include <lauxlib.h> @@ -62,9 +63,13 @@ int main(int argc,char* argv[]) { luaopen_example(L); printf("[C] all looks ok\n"); printf("\n"); - printf("[C] let's load the file 'runme.lua'\n"); + if (argc != 2 || argv[1] == NULL || strlen(argv[1]) == 0) { + printf("[C] ERROR: no lua file given on command line\n"); + exit(3); + } + printf("[C] let's load the file '%s'\n", argv[1]); printf("[C] any lua code in this file will be executed\n"); - if (luaL_loadfile(L, "runme.lua") || lua_pcall(L, 0, 0, 0)) { + if (luaL_loadfile(L, argv[1]) || lua_pcall(L, 0, 0, 0)) { printf("[C] ERROR: cannot run lua file: %s",lua_tostring(L, -1)); exit(3); } diff --git a/Examples/lua/embed2/Makefile b/Examples/lua/embed2/Makefile index ec22bdcae..d30ba0942 100644 --- a/Examples/lua/embed2/Makefile +++ b/Examples/lua/embed2/Makefile @@ -9,12 +9,12 @@ LIBS = -lm # this is a little different to normal as we have our own special interpreter # which we want to static link check: build - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' lua_embed_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' lua_embed_run build: - $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' LIBS='$(LIBS)' INTERFACE='example.i' LUA_INTERP='$(LUA_INTERP)' lua_static clean: - $(MAKE) -f $(TOP)/Makefile lua_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_clean rm -f $(TARGET) diff --git a/Examples/lua/embed2/embed2.c b/Examples/lua/embed2/embed2.c index 100a1fb33..0ce9f8f7f 100644 --- a/Examples/lua/embed2/embed2.c +++ b/Examples/lua/embed2/embed2.c @@ -24,6 +24,7 @@ We will be using the luaL_dostring()/lua_dostring() function to call into lua #include <stdlib.h> #include <stdio.h> +#include <string.h> #include <lua.h> #include <lauxlib.h> @@ -52,7 +53,7 @@ int call_add(lua_State *L,int a,int b,int* res) { lua_getglobal(L, "add"); /* function to be called */ if (!lua_isfunction(L,-1)) { printf("[C] error: cannot find function 'add'\n"); - lua_settop(L,top); // reset + lua_settop(L,top); return 0; } lua_pushnumber(L,a); @@ -60,18 +61,18 @@ int call_add(lua_State *L,int a,int b,int* res) { if (lua_pcall(L, 2, 1, 0) != 0) /* call function with 2 arguments and 1 result */ { printf("[C] error running function `add': %s\n",lua_tostring(L, -1)); - lua_settop(L,top); // reset + lua_settop(L,top); return 0; } - // check results + /* check results */ if (!lua_isnumber(L,-1)) { printf("[C] error: returned value is not a number\n"); - lua_settop(L,top); // reset + lua_settop(L,top); return 0; } *res=(int)lua_tonumber(L,-1); lua_settop(L,top); /* reset stack */ - return 1; // ok + return 1; } /* This is a variargs call function for calling from C into Lua. @@ -189,9 +190,13 @@ int main(int argc,char* argv[]) { luaopen_example(L); printf("[C] all looks ok\n"); printf("\n"); - printf("[C] let's load the file 'runme.lua'\n"); + if (argc != 2 || argv[1] == NULL || strlen(argv[1]) == 0) { + printf("[C] ERROR: no lua file given on command line\n"); + exit(3); + } + printf("[C] let's load the file '%s'\n", argv[1]); printf("[C] any lua code in this file will be executed\n"); - if (luaL_loadfile(L, "runme.lua") || lua_pcall(L, 0, 0, 0)) { + if (luaL_loadfile(L, argv[1]) || lua_pcall(L, 0, 0, 0)) { printf("[C] ERROR: cannot run lua file: %s",lua_tostring(L, -1)); exit(3); } diff --git a/Examples/lua/embed2/runme.lua b/Examples/lua/embed2/runme.lua index 9e7ab616c..6e93164c0 100644 --- a/Examples/lua/embed2/runme.lua +++ b/Examples/lua/embed2/runme.lua @@ -3,25 +3,25 @@ print "[lua] This is runme.lua" -- we do not need to load the library, as it was already in the interpreter -- but let's check anyway assert(type(example)=='table',"Don't appear to have loaded the example module") -
--- note: we will copy the functions from example table into global
--- this will help us later
-for k,v in pairs(example) do _G[k]=v end
--- our add function
+-- note: we will copy the functions from example table into global +-- this will help us later +for k,v in pairs(example) do _G[k]=v end + +-- our add function -- we will be calling this from C -function add(a,b)
- print("[lua] this is function add(",a,b,")")
- c=a+b
- print("[lua] returning",c)
- return c
+function add(a,b) + print("[lua] this is function add(",a,b,")") + c=a+b + print("[lua] returning",c) + return c end -function append(a,b)
- print("[lua] this is function append(",a,b,")")
- c=a..b
- print("[lua] returning",c)
- return c
+function append(a,b) + print("[lua] this is function append(",a,b,")") + c=a..b + print("[lua] returning",c) + return c end diff --git a/Examples/lua/embed3/Makefile b/Examples/lua/embed3/Makefile index 8cfa97454..fc0026122 100644 --- a/Examples/lua/embed3/Makefile +++ b/Examples/lua/embed3/Makefile @@ -9,13 +9,13 @@ LUA_INTERP = embed3.cpp # which we want to static link # we also need the external runtime, so we can get access to certain internals of SWIG check: build - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' lua_embed_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' lua_embed_run build: $(SWIG) -c++ -lua $(SWIGOPT) -external-runtime swigluarun.h - $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='example.i' LUA_INTERP='$(LUA_INTERP)' lua_static_cpp clean: - $(MAKE) -f $(TOP)/Makefile lua_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_clean rm -f swigluarun.h $(TARGET) diff --git a/Examples/lua/embed3/embed3.cpp b/Examples/lua/embed3/embed3.cpp index d559167d1..9be49add3 100644 --- a/Examples/lua/embed3/embed3.cpp +++ b/Examples/lua/embed3/embed3.cpp @@ -113,10 +113,14 @@ int main(int argc, char* argv[]) { push_pointer(L,&engine,"Engine *",0); lua_setglobal(L, "pEngine"); // set as global variable - printf("[C++] now let's load the file 'runme.lua'\n"); + if (argc != 2 || argv[1] == NULL || strlen(argv[1]) == 0) { + printf("[C++] ERROR: no lua file given on command line\n"); + exit(3); + } + printf("[C++] now let's load the file '%s'\n", argv[1]); printf("[C++] any lua code in this file will be executed\n"); - if (luaL_loadfile(L, "runme.lua") || lua_pcall(L, 0, 0, 0)) { - printf("[C++] ERROR: cannot run lua file: %s", lua_tostring(L, -1)); + if (luaL_loadfile(L, argv[1]) || lua_pcall(L, 0, 0, 0)) { + printf("[C++] ERROR: cannot run lua file: %s",lua_tostring(L, -1)); exit(3); } printf("[C++] We are now back in C++, all looks ok\n"); diff --git a/Examples/lua/exception/Makefile b/Examples/lua/exception/Makefile index 3dbebb4e5..ac9c28b69 100644 --- a/Examples/lua/exception/Makefile +++ b/Examples/lua/exception/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile lua_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mylua' INTERFACE='$(INTERFACE)' lua_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile lua_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_clean diff --git a/Examples/lua/funcptr3/Makefile b/Examples/lua/funcptr3/Makefile index 8b51e73e8..aeeaad469 100644 --- a/Examples/lua/funcptr3/Makefile +++ b/Examples/lua/funcptr3/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = check: build - $(MAKE) -f $(TOP)/Makefile lua_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='mylua' INTERFACE='$(INTERFACE)' lua_static clean: - $(MAKE) -f $(TOP)/Makefile lua_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_clean diff --git a/Examples/lua/functest/Makefile b/Examples/lua/functest/Makefile index 8b51e73e8..aeeaad469 100644 --- a/Examples/lua/functest/Makefile +++ b/Examples/lua/functest/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = check: build - $(MAKE) -f $(TOP)/Makefile lua_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='mylua' INTERFACE='$(INTERFACE)' lua_static clean: - $(MAKE) -f $(TOP)/Makefile lua_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_clean diff --git a/Examples/lua/functest/example.i b/Examples/lua/functest/example.i index 631e0602d..9bb64cbf5 100644 --- a/Examples/lua/functest/example.i +++ b/Examples/lua/functest/example.i @@ -1,13 +1,12 @@ /* File : example.i */ %module example -%include "typemaps.i" // you must have this for the typemaps for ptrs -// basic function testing -// +%include "typemaps.i" + %inline %{ -extern int add1(int x, int y); // return x+y -- basic function test -extern void add2(int x, int *INPUT, int *OUTPUT); // *z = x+*y -- argin and argout test -extern int add3(int x, int y, int *OUTPUT); // return x+y, *z=x-y -- returning 2 values -extern void add4(int x, int *INOUT); // *y += x -- INOUT dual purpose variable +extern int add1(int x, int y); /* return x+y -- basic function test */ +extern void add2(int x, int *INPUT, int *OUTPUT); /* *z = x+*y -- argin and argout test */ +extern int add3(int x, int y, int *OUTPUT); /* return x+y, *z=x-y -- returning 2 values */ +extern void add4(int x, int *INOUT); /* *y += x -- INOUT dual purpose variable */ %} diff --git a/Examples/lua/functor/Makefile b/Examples/lua/functor/Makefile index 4e4edbfa5..e647fb2a8 100644 --- a/Examples/lua/functor/Makefile +++ b/Examples/lua/functor/Makefile @@ -7,15 +7,15 @@ LIBS = -lm SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile lua_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mylua' INTERFACE='$(INTERFACE)' lua_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile lua_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_clean diff --git a/Examples/lua/import/Makefile b/Examples/lua/import/Makefile index 0a9aebd57..8d64a21c6 100644 --- a/Examples/lua/import/Makefile +++ b/Examples/lua/import/Makefile @@ -4,17 +4,17 @@ SWIGOPT = LIBS = check: build - $(MAKE) -f $(TOP)/Makefile lua_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='base' INTERFACE='base.i' lua_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' lua_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' lua_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' lua_cpp clean: - $(MAKE) -f $(TOP)/Makefile lua_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_clean diff --git a/Examples/lua/import/base.h b/Examples/lua/import/base.h index fec0f329c..ff6fecdd3 100644 --- a/Examples/lua/import/base.h +++ b/Examples/lua/import/base.h @@ -1,7 +1,7 @@ class Base { public: - Base() { }; - virtual ~Base() { }; + Base() { } + virtual ~Base() { } virtual const char * A() const { return "Base::A"; } diff --git a/Examples/lua/nspace/Makefile b/Examples/lua/nspace/Makefile index 57875ec49..17757c2ec 100644 --- a/Examples/lua/nspace/Makefile +++ b/Examples/lua/nspace/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile lua_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mylua' INTERFACE='$(INTERFACE)' lua_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile lua_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_clean diff --git a/Examples/lua/owner/Makefile b/Examples/lua/owner/Makefile index c39e8acdf..96308f0df 100644 --- a/Examples/lua/owner/Makefile +++ b/Examples/lua/owner/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile lua_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mylua' INTERFACE='$(INTERFACE)' lua_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile lua_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_clean diff --git a/Examples/lua/owner/example.cxx b/Examples/lua/owner/example.cxx index bce484aea..c2c073d79 100644 --- a/Examples/lua/owner/example.cxx +++ b/Examples/lua/owner/example.cxx @@ -39,12 +39,15 @@ Square* createSquare(double w) return new Square(w); } -ShapeOwner::ShapeOwner() {printf(" ShapeOwner(%p)\n",this);} +ShapeOwner::ShapeOwner() { + printf(" ShapeOwner(%p)\n", (void *)this); +} + ShapeOwner::~ShapeOwner() { - printf(" ~ShapeOwner(%p)\n",this); - for(unsigned i=0;i<shapes.size();i++) - delete shapes[i]; + printf(" ~ShapeOwner(%p)\n", (void *)this); + for(unsigned i=0;i<shapes.size();i++) + delete shapes[i]; } void ShapeOwner::add(Shape* ptr) // this method takes ownership of the object diff --git a/Examples/lua/owner/example.h b/Examples/lua/owner/example.h index 320bb2569..9101c6330 100644 --- a/Examples/lua/owner/example.h +++ b/Examples/lua/owner/example.h @@ -8,7 +8,7 @@ public: } virtual ~Shape() { nshapes--; - }; + } double x, y; void move(double dx, double dy); virtual double area(void) = 0; @@ -20,7 +20,7 @@ class Circle : public Shape { private: double radius; public: - Circle(double r) : radius(r) { }; + Circle(double r) : radius(r) { } virtual double area(void); virtual double perimeter(void); }; @@ -29,7 +29,7 @@ class Square : public Shape { private: double width; public: - Square(double w) : width(w) { }; + Square(double w) : width(w) { } virtual double area(void); virtual double perimeter(void); }; diff --git a/Examples/lua/pointer/Makefile b/Examples/lua/pointer/Makefile index 8b51e73e8..aeeaad469 100644 --- a/Examples/lua/pointer/Makefile +++ b/Examples/lua/pointer/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = check: build - $(MAKE) -f $(TOP)/Makefile lua_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='mylua' INTERFACE='$(INTERFACE)' lua_static clean: - $(MAKE) -f $(TOP)/Makefile lua_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_clean diff --git a/Examples/lua/simple/Makefile b/Examples/lua/simple/Makefile index d398dffea..4191f7ec3 100644 --- a/Examples/lua/simple/Makefile +++ b/Examples/lua/simple/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile lua_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='mylua' INTERFACE='$(INTERFACE)' lua_static clean: - $(MAKE) -f $(TOP)/Makefile lua_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_clean diff --git a/Examples/lua/variables/Makefile b/Examples/lua/variables/Makefile index d398dffea..4191f7ec3 100644 --- a/Examples/lua/variables/Makefile +++ b/Examples/lua/variables/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile lua_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' lua static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='mylua' INTERFACE='$(INTERFACE)' lua_static clean: - $(MAKE) -f $(TOP)/Makefile lua_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' lua_clean diff --git a/Examples/lua/variables/example.c b/Examples/lua/variables/example.c index 05e17c8c5..85685fe72 100644 --- a/Examples/lua/variables/example.c +++ b/Examples/lua/variables/example.c @@ -52,9 +52,9 @@ void print_vars() { printf("cvar = %c\n", cvar); printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("cstrvar = %s\n", cstrvar); - printf("iptrvar = %p\n", iptrvar); + printf("iptrvar = %p\n", (void *)iptrvar); printf("name = %s\n", name); - printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); + printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); printf("pt = (%d, %d)\n", pt.x, pt.y); printf("status = %d\n", status); } diff --git a/Examples/modula3/class/Makefile b/Examples/modula3/class/Makefile index af8e099cc..2e2f37526 100644 --- a/Examples/modula3/class/Makefile +++ b/Examples/modula3/class/Makefile @@ -8,10 +8,10 @@ SWIGOPT = -c++ MODULA3SRCS = *.[im]3 check: build - $(MAKE) -f $(TOP)/Makefile modula3_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3 m3ppinplace $(MODULA3SRCS) # compilation of example_wrap.cxx is started by cm3 @@ -21,4 +21,4 @@ build: cm3 clean: - $(MAKE) -f $(TOP)/Makefile modula3_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean diff --git a/Examples/modula3/class/example.cxx b/Examples/modula3/class/example.cxx index 1e8e203dd..046304519 100644 --- a/Examples/modula3/class/example.cxx +++ b/Examples/modula3/class/example.cxx @@ -1,4 +1,4 @@ -/* File : example.c */ +/* File : example.cxx */ #include "example.h" #define M_PI 3.14159265358979323846 @@ -11,18 +11,18 @@ void Shape::move(double dx, double dy) { int Shape::nshapes = 0; -double Circle::area(void) { +double Circle::area() { return M_PI*radius*radius; } -double Circle::perimeter(void) { +double Circle::perimeter() { return 2*M_PI*radius; } -double Square::area(void) { +double Square::area() { return width*width; } -double Square::perimeter(void) { +double Square::perimeter() { return 4*width; } diff --git a/Examples/modula3/enum/Makefile b/Examples/modula3/enum/Makefile index a351cb1b9..3915e5405 100644 --- a/Examples/modula3/enum/Makefile +++ b/Examples/modula3/enum/Makefile @@ -8,18 +8,18 @@ SWIGOPT = -c++ MODULA3SRCS = *.[im]3 check: build - $(MAKE) -f $(TOP)/Makefile modula3_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run build: $(SWIG) -modula3 $(SWIGOPT) -module Example -generateconst $(CONSTNUMERIC) $(TARGET).h $(CXX) -Wall $(CONSTNUMERIC).c -o $(CONSTNUMERIC) $(CONSTNUMERIC) >$(CONSTNUMERIC).i - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3 m3ppinplace $(MODULA3SRCS) mv m3makefile $(MODULA3SRCS) src/ cm3 clean: - $(MAKE) -f $(TOP)/Makefile modula3_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean diff --git a/Examples/modula3/exception/Makefile b/Examples/modula3/exception/Makefile index 8d4525512..1dbf1a156 100644 --- a/Examples/modula3/exception/Makefile +++ b/Examples/modula3/exception/Makefile @@ -8,15 +8,15 @@ MODULA3SRCS = *.[im]3 MODULA3FLAGS= -o runme check: build - $(MAKE) -f $(TOP)/Makefile modula3_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3_cpp -# $(MAKE) -f $(TOP)/Makefile MODULA3SRCS='$(MODULA3SRCS)' MODULA3FLAGS='$(MODULA3FLAGS)' modula3_compile +# $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' MODULA3SRCS='$(MODULA3SRCS)' MODULA3FLAGS='$(MODULA3FLAGS)' modula3_compile m3ppinplace $(MODULA3SRCS) mv m3makefile $(MODULA3SRCS) src/ cm3 clean: - $(MAKE) -f $(TOP)/Makefile modula3_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean diff --git a/Examples/modula3/reference/Makefile b/Examples/modula3/reference/Makefile index 1a5fdeb30..3b68fe822 100644 --- a/Examples/modula3/reference/Makefile +++ b/Examples/modula3/reference/Makefile @@ -7,14 +7,14 @@ SWIGOPT = -c++ MODULA3SRCS = *.[im]3 check: build - $(MAKE) -f $(TOP)/Makefile modula3_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3 m3ppinplace $(MODULA3SRCS) mv m3makefile $(MODULA3SRCS) src/ cm3 clean: - $(MAKE) -f $(TOP)/Makefile modula3_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean diff --git a/Examples/modula3/reference/example.cxx b/Examples/modula3/reference/example.cxx index 649b0169c..9dbaed2ee 100644 --- a/Examples/modula3/reference/example.cxx +++ b/Examples/modula3/reference/example.cxx @@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) { char *Vector::print() { static char temp[512]; - sprintf(temp,"Vector %x (%g,%g,%g)", (int)this, x,y,z); + sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z); return temp; } diff --git a/Examples/modula3/reference/example.h b/Examples/modula3/reference/example.h index 0a9cd447f..7b4ba8fb8 100644 --- a/Examples/modula3/reference/example.h +++ b/Examples/modula3/reference/example.h @@ -4,8 +4,8 @@ struct Vector { private: double x,y,z; public: - Vector() : x(0), y(0), z(0) { }; - Vector(double x, double y, double z) : x(x), y(y), z(z) { }; + Vector() : x(0), y(0), z(0) { } + Vector(double x, double y, double z) : x(x), y(y), z(z) { } Vector operator+(const Vector &b) const; char *print(); }; diff --git a/Examples/modula3/simple/Makefile b/Examples/modula3/simple/Makefile index 6287dac20..2796b25f8 100644 --- a/Examples/modula3/simple/Makefile +++ b/Examples/modula3/simple/Makefile @@ -7,14 +7,14 @@ SWIGOPT = MODULA3SRCS = *.[im]3 check: build - $(MAKE) -f $(TOP)/Makefile modula3_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3 m3ppinplace $(MODULA3SRCS) mv m3makefile $(MODULA3SRCS) src/ cm3 clean: - $(MAKE) -f $(TOP)/Makefile modula3_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean diff --git a/Examples/modula3/typemap/Makefile b/Examples/modula3/typemap/Makefile index 6287dac20..2796b25f8 100644 --- a/Examples/modula3/typemap/Makefile +++ b/Examples/modula3/typemap/Makefile @@ -7,14 +7,14 @@ SWIGOPT = MODULA3SRCS = *.[im]3 check: build - $(MAKE) -f $(TOP)/Makefile modula3_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' modula3 m3ppinplace $(MODULA3SRCS) mv m3makefile $(MODULA3SRCS) src/ cm3 clean: - $(MAKE) -f $(TOP)/Makefile modula3_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' modula3_clean diff --git a/Examples/mzscheme/multimap/Makefile b/Examples/mzscheme/multimap/Makefile index f8eeb72c3..ecf83fbeb 100644 --- a/Examples/mzscheme/multimap/Makefile +++ b/Examples/mzscheme/multimap/Makefile @@ -6,10 +6,10 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile mzscheme_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' mzscheme clean: - $(MAKE) -f $(TOP)/Makefile mzscheme_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_clean diff --git a/Examples/mzscheme/simple/Makefile b/Examples/mzscheme/simple/Makefile index f8eeb72c3..ecf83fbeb 100644 --- a/Examples/mzscheme/simple/Makefile +++ b/Examples/mzscheme/simple/Makefile @@ -6,10 +6,10 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile mzscheme_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' mzscheme clean: - $(MAKE) -f $(TOP)/Makefile mzscheme_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_clean diff --git a/Examples/mzscheme/std_vector/Makefile b/Examples/mzscheme/std_vector/Makefile index d2bf0a013..75918a61e 100644 --- a/Examples/mzscheme/std_vector/Makefile +++ b/Examples/mzscheme/std_vector/Makefile @@ -9,7 +9,7 @@ GPP = `which g++` MZC = test -n "/usr/bin/mzc" && /usr/bin/mzc check: build - $(MAKE) -f $(TOP)/Makefile mzscheme_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_run build: $(SWIG) -mzscheme -c++ $(SWIGOPT) $(INTERFACE) @@ -17,4 +17,4 @@ build: $(MZC) --linker $(GPP) --ld $(TARGET).so example_wrap.o clean: - $(MAKE) -f $(TOP)/Makefile mzscheme_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' mzscheme_clean diff --git a/Examples/ocaml/argout_ref/Makefile b/Examples/ocaml/argout_ref/Makefile index 4e12e3769..09893af65 100644 --- a/Examples/ocaml/argout_ref/Makefile +++ b/Examples/ocaml/argout_ref/Makefile @@ -8,21 +8,21 @@ PROGFILE = example_prog.ml OBJS = example.o check: build - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' ocaml_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_run build: static static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \ ocaml_static_cpp dynamic: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \ ocaml_dynamic_cpp clean: - $(MAKE) -f $(TOP)/Makefile MLFILE='$(MLFILE)' ocaml_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' MLFILE='$(MLFILE)' ocaml_clean diff --git a/Examples/ocaml/contract/Makefile b/Examples/ocaml/contract/Makefile index 1db93e38a..df5d6a6f5 100644 --- a/Examples/ocaml/contract/Makefile +++ b/Examples/ocaml/contract/Makefile @@ -8,27 +8,27 @@ PROGFILE = example_prog.ml OBJS = check: build - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' ocaml_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_run build: static dynamic: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \ ocaml_dynamic static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \ ocaml_static toplevel: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \ ocaml_static_toplevel clean: - $(MAKE) -f $(TOP)/Makefile MLFILE='$(MLFILE)' ocaml_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' MLFILE='$(MLFILE)' ocaml_clean diff --git a/Examples/ocaml/scoped_enum/Makefile b/Examples/ocaml/scoped_enum/Makefile index e5de57ac2..794733971 100644 --- a/Examples/ocaml/scoped_enum/Makefile +++ b/Examples/ocaml/scoped_enum/Makefile @@ -8,27 +8,27 @@ PROGFILE = example_prog.ml OBJS = check: build - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' ocaml_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_run build: static dynamic: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \ ocaml_dynamic_cpp static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \ ocaml_static_cpp toplevel: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \ ocaml_static_cpp_toplevel clean: - $(MAKE) -f $(TOP)/Makefile MLFILE='$(MLFILE)' ocaml_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' MLFILE='$(MLFILE)' ocaml_clean diff --git a/Examples/ocaml/shapes/Makefile b/Examples/ocaml/shapes/Makefile index c1ab6507c..69102f3b1 100644 --- a/Examples/ocaml/shapes/Makefile +++ b/Examples/ocaml/shapes/Makefile @@ -9,27 +9,27 @@ PROGFILE = example_prog.ml OBJS = example.o check: build - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' ocaml_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_run build: static static_top static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ MLFILE='$(MLFILE)' PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \ ocaml_static_cpp static_top: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ MLFILE='$(MLFILE)' PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \ ocaml_static_cpp_toplevel dynamic: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \ ocaml_dynamic_cpp clean: - $(MAKE) -f $(TOP)/Makefile MLFILE='$(MLFILE)' ocaml_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' MLFILE='$(MLFILE)' ocaml_clean diff --git a/Examples/ocaml/simple/Makefile b/Examples/ocaml/simple/Makefile index 64c7256c1..49bf81c1e 100644 --- a/Examples/ocaml/simple/Makefile +++ b/Examples/ocaml/simple/Makefile @@ -8,27 +8,27 @@ PROGFILE = example_prog.ml OBJS = example.o check: build - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' ocaml_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_run build: static dynamic: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \ ocaml_dynamic static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \ ocaml_static toplevel: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' \ PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \ ocaml_static_toplevel clean: - $(MAKE) -f $(TOP)/Makefile MLFILE='$(MLFILE)' ocaml_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' MLFILE='$(MLFILE)' ocaml_clean diff --git a/Examples/ocaml/std_string/Makefile b/Examples/ocaml/std_string/Makefile index 89f997090..8f8b2f684 100644 --- a/Examples/ocaml/std_string/Makefile +++ b/Examples/ocaml/std_string/Makefile @@ -6,19 +6,19 @@ INTERFACE = example.i PROGFILE = runme.ml check: build - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' ocaml_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_run build: static static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ ocaml_static_cpp dynamic: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ ocaml_dynamic_cpp clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' ocaml_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_clean diff --git a/Examples/ocaml/std_vector/Makefile b/Examples/ocaml/std_vector/Makefile index 89f997090..8f8b2f684 100644 --- a/Examples/ocaml/std_vector/Makefile +++ b/Examples/ocaml/std_vector/Makefile @@ -6,19 +6,19 @@ INTERFACE = example.i PROGFILE = runme.ml check: build - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' ocaml_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_run build: static static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ ocaml_static_cpp dynamic: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ ocaml_dynamic_cpp clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' ocaml_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_clean diff --git a/Examples/ocaml/stl/Makefile b/Examples/ocaml/stl/Makefile index a913611fb..e4cce4883 100644 --- a/Examples/ocaml/stl/Makefile +++ b/Examples/ocaml/stl/Makefile @@ -6,29 +6,29 @@ INTERFACE = example.i PROGFILE = runme.ml check: build - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' ocaml_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_run build: static static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ ocaml_static_cpp director: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ ocaml_static_cpp_director dynamic: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ ocaml_static_cpp toplevel: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ ocaml_static_cpp_toplevel clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' ocaml_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_clean diff --git a/Examples/ocaml/string_from_ptr/Makefile b/Examples/ocaml/string_from_ptr/Makefile index 6d344854a..294bdec83 100644 --- a/Examples/ocaml/string_from_ptr/Makefile +++ b/Examples/ocaml/string_from_ptr/Makefile @@ -9,27 +9,27 @@ PROGFILE = example_prog.ml OBJS = check: build - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' ocaml_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_run build: static static_top static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ MLFILE='$(MLFILE)' PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \ ocaml_static_cpp static_top: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ MLFILE='$(MLFILE)' PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \ ocaml_static_cpp_toplevel dynamic: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' MLFILE='$(MLFILE)' PROGFILE='$(PROGFILE)' OBJS='$(OBJS)' \ ocaml_dynamic_cpp clean: - $(MAKE) -f $(TOP)/Makefile MLFILE='$(MLFILE)' ocaml_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' MLFILE='$(MLFILE)' ocaml_clean diff --git a/Examples/ocaml/strings_test/Makefile b/Examples/ocaml/strings_test/Makefile index 49cc544ed..b6b866669 100644 --- a/Examples/ocaml/strings_test/Makefile +++ b/Examples/ocaml/strings_test/Makefile @@ -6,24 +6,24 @@ INTERFACE = example.i PROGFILE = runme.ml check: build - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' ocaml_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_run build: static top static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ ocaml_static_cpp dynamic: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ ocaml_static_cpp top: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ PROGFILE='$(PROGFILE)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ ocaml_static_cpp_toplevel clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' ocaml_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' ocaml_clean diff --git a/Examples/octave/callback/Makefile b/Examples/octave/callback/Makefile index d38d7f896..3b746de2f 100644 --- a/Examples/octave/callback/Makefile +++ b/Examples/octave/callback/Makefile @@ -1,17 +1,3 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -CXXSRCS = example.cxx -TARGET = swigexample -INTERFACE = example.i -LIBS = -lm -SWIGOPT = +CXXSRCS = example.cxx -check: build - $(MAKE) -f $(TOP)/Makefile octave_run - -build: - $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp - -clean: - $(MAKE) -f $(TOP)/Makefile octave_clean +include $(SRCDIR)../example.mk diff --git a/Examples/octave/callback/example.i b/Examples/octave/callback/example.i index 3192904db..50ef5096d 100644 --- a/Examples/octave/callback/example.i +++ b/Examples/octave/callback/example.i @@ -1,5 +1,8 @@ /* File : example.i */ %module(directors="1") swigexample + +%feature("autodoc", 1); + %{ #include "example.h" %} diff --git a/Examples/octave/class/Makefile b/Examples/octave/class/Makefile index d38d7f896..3b746de2f 100644 --- a/Examples/octave/class/Makefile +++ b/Examples/octave/class/Makefile @@ -1,17 +1,3 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -CXXSRCS = example.cxx -TARGET = swigexample -INTERFACE = example.i -LIBS = -lm -SWIGOPT = +CXXSRCS = example.cxx -check: build - $(MAKE) -f $(TOP)/Makefile octave_run - -build: - $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp - -clean: - $(MAKE) -f $(TOP)/Makefile octave_clean +include $(SRCDIR)../example.mk diff --git a/Examples/octave/class/example.cxx b/Examples/octave/class/example.cxx index 1e8e203dd..046304519 100644 --- a/Examples/octave/class/example.cxx +++ b/Examples/octave/class/example.cxx @@ -1,4 +1,4 @@ -/* File : example.c */ +/* File : example.cxx */ #include "example.h" #define M_PI 3.14159265358979323846 @@ -11,18 +11,18 @@ void Shape::move(double dx, double dy) { int Shape::nshapes = 0; -double Circle::area(void) { +double Circle::area() { return M_PI*radius*radius; } -double Circle::perimeter(void) { +double Circle::perimeter() { return 2*M_PI*radius; } -double Square::area(void) { +double Square::area() { return width*width; } -double Square::perimeter(void) { +double Square::perimeter() { return 4*width; } diff --git a/Examples/octave/class/example.i b/Examples/octave/class/example.i index b109bcb78..52e9fd3bf 100644 --- a/Examples/octave/class/example.i +++ b/Examples/octave/class/example.i @@ -1,6 +1,8 @@ /* File : example.i */ %module swigexample +%feature("autodoc", 1); + %{ #include "example.h" %} diff --git a/Examples/octave/constants/Makefile b/Examples/octave/constants/Makefile index 03501bd81..acf4d0575 100644 --- a/Examples/octave/constants/Makefile +++ b/Examples/octave/constants/Makefile @@ -1,17 +1,3 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -CXXSRCS = -TARGET = swigexample -INTERFACE = example.i -LIBS = -lm -SWIGOPT = +CXXSRCS = -check: build - $(MAKE) -f $(TOP)/Makefile octave_run - -build: - $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp - -clean: - $(MAKE) -f $(TOP)/Makefile octave_clean +include $(SRCDIR)../example.mk diff --git a/Examples/octave/constants/example.i b/Examples/octave/constants/example.i index 405974b44..ab42a6b21 100644 --- a/Examples/octave/constants/example.i +++ b/Examples/octave/constants/example.i @@ -1,6 +1,8 @@ /* File : example.i */ %module swigexample +%feature("autodoc", 1); + /* A few preprocessor macros */ #define ICONST 42 diff --git a/Examples/octave/contract/Makefile b/Examples/octave/contract/Makefile index 73e3962ed..413b64bbd 100644 --- a/Examples/octave/contract/Makefile +++ b/Examples/octave/contract/Makefile @@ -1,15 +1,3 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -SRCS = example.c -TARGET = swigexample -INTERFACE = example.i +SRCS = example.c -check: build - $(MAKE) -f $(TOP)/Makefile octave_run - -build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave - -clean: - $(MAKE) -f $(TOP)/Makefile octave_clean +include $(SRCDIR)../example.mk diff --git a/Examples/octave/contract/example.i b/Examples/octave/contract/example.i index 78c459efc..8976607b2 100644 --- a/Examples/octave/contract/example.i +++ b/Examples/octave/contract/example.i @@ -1,6 +1,8 @@ /* File : example.i */ %module swigexample +%feature("autodoc", 1); + %contract gcd(int x, int y) { require: x >= 0; diff --git a/Examples/octave/enum/Makefile b/Examples/octave/enum/Makefile index d38d7f896..3b746de2f 100644 --- a/Examples/octave/enum/Makefile +++ b/Examples/octave/enum/Makefile @@ -1,17 +1,3 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -CXXSRCS = example.cxx -TARGET = swigexample -INTERFACE = example.i -LIBS = -lm -SWIGOPT = +CXXSRCS = example.cxx -check: build - $(MAKE) -f $(TOP)/Makefile octave_run - -build: - $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp - -clean: - $(MAKE) -f $(TOP)/Makefile octave_clean +include $(SRCDIR)../example.mk diff --git a/Examples/octave/enum/example.i b/Examples/octave/enum/example.i index cee9af471..084bab06b 100644 --- a/Examples/octave/enum/example.i +++ b/Examples/octave/enum/example.i @@ -1,6 +1,8 @@ /* File : example.i */ %module swigexample +%feature("autodoc", 1); + %{ #include "example.h" %} diff --git a/Examples/octave/example.mk b/Examples/octave/example.mk new file mode 100644 index 000000000..e0b1e4efb --- /dev/null +++ b/Examples/octave/example.mk @@ -0,0 +1,32 @@ +# Note: as a convention an example must be in a child directory of this. +# These paths are relative to such an example directory + +TOP = ../.. +SWIG = $(TOP)/../preinst-swig +TARGET = swigexample +INTERFACE = example.i + +check: build + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_run + +build: +ifneq (,$(SRCS)) + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ + SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave +else + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp +endif +ifneq (,$(TARGET2)$(SWIGOPT2)) +ifneq (,$(SRCS)) + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ + SWIGOPT='$(SWIGOPT2)' TARGET='$(TARGET2)' INTERFACE='$(INTERFACE)' octave +else + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + SWIGOPT='$(SWIGOPT2)' TARGET='$(TARGET2)' INTERFACE='$(INTERFACE)' octave_cpp +endif +endif + + +clean: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' octave_clean diff --git a/Examples/octave/extend/Makefile b/Examples/octave/extend/Makefile index d38d7f896..3b746de2f 100644 --- a/Examples/octave/extend/Makefile +++ b/Examples/octave/extend/Makefile @@ -1,17 +1,3 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -CXXSRCS = example.cxx -TARGET = swigexample -INTERFACE = example.i -LIBS = -lm -SWIGOPT = +CXXSRCS = example.cxx -check: build - $(MAKE) -f $(TOP)/Makefile octave_run - -build: - $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp - -clean: - $(MAKE) -f $(TOP)/Makefile octave_clean +include $(SRCDIR)../example.mk diff --git a/Examples/octave/extend/example.h b/Examples/octave/extend/example.h index 9e15cf8e4..77a26ec95 100644 --- a/Examples/octave/extend/example.h +++ b/Examples/octave/extend/example.h @@ -14,7 +14,7 @@ public: virtual std::string getTitle() { return getPosition() + " " + getName(); } virtual std::string getName() { return name; } virtual std::string getPosition() const { return "Employee"; } - virtual ~Employee() { printf("~Employee() @ %p\n", this); } + virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); } }; diff --git a/Examples/octave/extend/example.i b/Examples/octave/extend/example.i index 953c2f314..3b9ac53c4 100644 --- a/Examples/octave/extend/example.i +++ b/Examples/octave/extend/example.i @@ -1,5 +1,8 @@ /* File : example.i */ %module(directors="1") swigexample + +%feature("autodoc", 1); + %{ #include "example.h" %} diff --git a/Examples/octave/funcptr/Makefile b/Examples/octave/funcptr/Makefile index 73e3962ed..413b64bbd 100644 --- a/Examples/octave/funcptr/Makefile +++ b/Examples/octave/funcptr/Makefile @@ -1,15 +1,3 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -SRCS = example.c -TARGET = swigexample -INTERFACE = example.i +SRCS = example.c -check: build - $(MAKE) -f $(TOP)/Makefile octave_run - -build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave - -clean: - $(MAKE) -f $(TOP)/Makefile octave_clean +include $(SRCDIR)../example.mk diff --git a/Examples/octave/funcptr/example.i b/Examples/octave/funcptr/example.i index 163a1991b..c6fcfe781 100644 --- a/Examples/octave/funcptr/example.i +++ b/Examples/octave/funcptr/example.i @@ -1,5 +1,8 @@ /* File : example.i */ %module swigexample + +%feature("autodoc", 1); + %{ #include "example.h" %} diff --git a/Examples/octave/funcptr2/Makefile b/Examples/octave/funcptr2/Makefile index 73e3962ed..413b64bbd 100644 --- a/Examples/octave/funcptr2/Makefile +++ b/Examples/octave/funcptr2/Makefile @@ -1,15 +1,3 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -SRCS = example.c -TARGET = swigexample -INTERFACE = example.i +SRCS = example.c -check: build - $(MAKE) -f $(TOP)/Makefile octave_run - -build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave - -clean: - $(MAKE) -f $(TOP)/Makefile octave_clean +include $(SRCDIR)../example.mk diff --git a/Examples/octave/funcptr2/example.i b/Examples/octave/funcptr2/example.i index 33378a1c1..bbe50fb8f 100644 --- a/Examples/octave/funcptr2/example.i +++ b/Examples/octave/funcptr2/example.i @@ -1,5 +1,8 @@ /* File : example.i */ %module swigexample + +%feature("autodoc", 1); + %{ #include "example.h" %} diff --git a/Examples/octave/functor/Makefile b/Examples/octave/functor/Makefile index 94fb96337..acf4d0575 100644 --- a/Examples/octave/functor/Makefile +++ b/Examples/octave/functor/Makefile @@ -1,17 +1,3 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -CXXSRCS = -TARGET = swigexample -INTERFACE = example.i -LIBS = -lm -SWIGOPT = +CXXSRCS = -check: build - $(MAKE) -f $(TOP)/Makefile octave_run - -build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp - -clean: - $(MAKE) -f $(TOP)/Makefile octave_clean +include $(SRCDIR)../example.mk diff --git a/Examples/octave/functor/example.i b/Examples/octave/functor/example.i index ade20c56c..0c21a8ed6 100644 --- a/Examples/octave/functor/example.i +++ b/Examples/octave/functor/example.i @@ -1,6 +1,7 @@ /* File : example.i */ %module swigexample +%feature("autodoc", 1); %inline %{ // From B. Strousjoup, "The C++ Programming Language, Third Edition", p. 514 diff --git a/Examples/octave/module_load/Makefile b/Examples/octave/module_load/Makefile index e388763bd..d2cd66e70 100644 --- a/Examples/octave/module_load/Makefile +++ b/Examples/octave/module_load/Makefile @@ -1,18 +1,7 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -SRCS = example.c -TARGET = swigexample -INTERFACE = example.i +SRCS = example.c +TARGET = swigexample +SWIGOPT = -module swigexample +TARGET2 = swigexample2 +SWIGOPT2 = -module swigexample2 -globals . -check: build - $(MAKE) -f $(TOP)/Makefile octave_run - -build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - TARGET='$(TARGET)' SWIGOPT='-module $$(TARGET)' INTERFACE='$(INTERFACE)' octave - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - TARGET='$(TARGET)2' SWIGOPT='-module $$(TARGET) -globals .' INTERFACE='$(INTERFACE)' octave - -clean: - $(MAKE) -f $(TOP)/Makefile octave_clean - rm -f $(TARGET).m +include $(SRCDIR)../example.mk diff --git a/Examples/octave/module_load/example.i b/Examples/octave/module_load/example.i index fd074d4f2..bd0e39937 100644 --- a/Examples/octave/module_load/example.i +++ b/Examples/octave/module_load/example.i @@ -1,5 +1,8 @@ /* File : example.i */ /* module name given on cmdline */ + +%feature("autodoc", 1); + %{ #include "example.h" %} diff --git a/Examples/octave/operator/Makefile b/Examples/octave/operator/Makefile index 94fb96337..acf4d0575 100644 --- a/Examples/octave/operator/Makefile +++ b/Examples/octave/operator/Makefile @@ -1,17 +1,3 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -CXXSRCS = -TARGET = swigexample -INTERFACE = example.i -LIBS = -lm -SWIGOPT = +CXXSRCS = -check: build - $(MAKE) -f $(TOP)/Makefile octave_run - -build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp - -clean: - $(MAKE) -f $(TOP)/Makefile octave_clean +include $(SRCDIR)../example.mk diff --git a/Examples/octave/operator/example.i b/Examples/octave/operator/example.i index a2d97731d..7fad8e609 100644 --- a/Examples/octave/operator/example.i +++ b/Examples/octave/operator/example.i @@ -1,6 +1,10 @@ /* File : example.i */ %module swigexample + +%feature("autodoc", 1); + #pragma SWIG nowarn=SWIGWARN_IGNORE_OPERATOR_EQ + %{ #include "example.h" %} diff --git a/Examples/octave/pointer/Makefile b/Examples/octave/pointer/Makefile index 73e3962ed..413b64bbd 100644 --- a/Examples/octave/pointer/Makefile +++ b/Examples/octave/pointer/Makefile @@ -1,15 +1,3 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -SRCS = example.c -TARGET = swigexample -INTERFACE = example.i +SRCS = example.c -check: build - $(MAKE) -f $(TOP)/Makefile octave_run - -build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave - -clean: - $(MAKE) -f $(TOP)/Makefile octave_clean +include $(SRCDIR)../example.mk diff --git a/Examples/octave/pointer/example.i b/Examples/octave/pointer/example.i index 545e3ada4..8b9e0f134 100644 --- a/Examples/octave/pointer/example.i +++ b/Examples/octave/pointer/example.i @@ -1,6 +1,8 @@ /* File : example.i */ %module swigexample +%feature("autodoc", 1); + %{ extern void add(int *, int *, int *); extern void sub(int *, int *, int *); diff --git a/Examples/octave/reference/Makefile b/Examples/octave/reference/Makefile index d38d7f896..3b746de2f 100644 --- a/Examples/octave/reference/Makefile +++ b/Examples/octave/reference/Makefile @@ -1,17 +1,3 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -CXXSRCS = example.cxx -TARGET = swigexample -INTERFACE = example.i -LIBS = -lm -SWIGOPT = +CXXSRCS = example.cxx -check: build - $(MAKE) -f $(TOP)/Makefile octave_run - -build: - $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp - -clean: - $(MAKE) -f $(TOP)/Makefile octave_clean +include $(SRCDIR)../example.mk diff --git a/Examples/octave/reference/example.cxx b/Examples/octave/reference/example.cxx index 9b72ca6a2..632a03a5b 100644 --- a/Examples/octave/reference/example.cxx +++ b/Examples/octave/reference/example.cxx @@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) { char *Vector::print() { static char temp[512]; - sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); + sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z); return temp; } diff --git a/Examples/octave/reference/example.h b/Examples/octave/reference/example.h index 697afafe0..bcfcfb72f 100644 --- a/Examples/octave/reference/example.h +++ b/Examples/octave/reference/example.h @@ -4,8 +4,8 @@ class Vector { private: double x,y,z; public: - Vector() : x(0), y(0), z(0) { }; - Vector(double x, double y, double z) : x(x), y(y), z(z) { }; + Vector() : x(0), y(0), z(0) { } + Vector(double x, double y, double z) : x(x), y(y), z(z) { } friend Vector operator+(const Vector &a, const Vector &b); char *print(); }; diff --git a/Examples/octave/reference/example.i b/Examples/octave/reference/example.i index da09800c0..0aa733451 100644 --- a/Examples/octave/reference/example.i +++ b/Examples/octave/reference/example.i @@ -4,6 +4,8 @@ %module swigexample +%feature("autodoc", 1); + %{ #include "example.h" %} diff --git a/Examples/octave/simple/Makefile b/Examples/octave/simple/Makefile index 73e3962ed..413b64bbd 100644 --- a/Examples/octave/simple/Makefile +++ b/Examples/octave/simple/Makefile @@ -1,15 +1,3 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -SRCS = example.c -TARGET = swigexample -INTERFACE = example.i +SRCS = example.c -check: build - $(MAKE) -f $(TOP)/Makefile octave_run - -build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave - -clean: - $(MAKE) -f $(TOP)/Makefile octave_clean +include $(SRCDIR)../example.mk diff --git a/Examples/octave/simple/example.i b/Examples/octave/simple/example.i index 127bfcd84..a3006f282 100644 --- a/Examples/octave/simple/example.i +++ b/Examples/octave/simple/example.i @@ -1,6 +1,8 @@ /* File : example.i */ %module swigexample +%feature("autodoc", 1); + %inline %{ extern int gcd(int x, int y); extern double Foo; diff --git a/Examples/octave/template/Makefile b/Examples/octave/template/Makefile index 94fb96337..acf4d0575 100644 --- a/Examples/octave/template/Makefile +++ b/Examples/octave/template/Makefile @@ -1,17 +1,3 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -CXXSRCS = -TARGET = swigexample -INTERFACE = example.i -LIBS = -lm -SWIGOPT = +CXXSRCS = -check: build - $(MAKE) -f $(TOP)/Makefile octave_run - -build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave_cpp - -clean: - $(MAKE) -f $(TOP)/Makefile octave_clean +include $(SRCDIR)../example.mk diff --git a/Examples/octave/template/example.i b/Examples/octave/template/example.i index cfff18ded..3c57f3884 100644 --- a/Examples/octave/template/example.i +++ b/Examples/octave/template/example.i @@ -1,6 +1,8 @@ /* File : example.i */ %module swigexample +%feature("autodoc", 1); + %{ #include "example.h" %} diff --git a/Examples/octave/variables/Makefile b/Examples/octave/variables/Makefile index 73e3962ed..413b64bbd 100644 --- a/Examples/octave/variables/Makefile +++ b/Examples/octave/variables/Makefile @@ -1,15 +1,3 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -SRCS = example.c -TARGET = swigexample -INTERFACE = example.i +SRCS = example.c -check: build - $(MAKE) -f $(TOP)/Makefile octave_run - -build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' octave - -clean: - $(MAKE) -f $(TOP)/Makefile octave_clean +include $(SRCDIR)../example.mk diff --git a/Examples/octave/variables/example.c b/Examples/octave/variables/example.c index e2b72e0ea..a9102a9d5 100644 --- a/Examples/octave/variables/example.c +++ b/Examples/octave/variables/example.c @@ -52,9 +52,9 @@ void print_vars() { printf("cvar = %c\n", cvar); printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("cstrvar = %s\n", cstrvar); - printf("iptrvar = %p\n", iptrvar); + printf("iptrvar = %p\n", (void *)iptrvar); printf("name = %s\n", name); - printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); + printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); printf("pt = (%d, %d)\n", pt.x, pt.y); printf("status = %d\n", status); } diff --git a/Examples/octave/variables/example.i b/Examples/octave/variables/example.i index 3e11495ad..9d8b03ec2 100644 --- a/Examples/octave/variables/example.i +++ b/Examples/octave/variables/example.i @@ -1,5 +1,8 @@ /* File : example.i */ %module swigexample + +%feature("autodoc", 1); + %{ #include "example.h" %} diff --git a/Examples/perl5/callback/Makefile b/Examples/perl5/callback/Makefile index 544d13642..0d1cc574f 100644 --- a/Examples/perl5/callback/Makefile +++ b/Examples/perl5/callback/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile perl5_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile perl5_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_clean diff --git a/Examples/perl5/check.list b/Examples/perl5/check.list index 78d45fc0b..dda849311 100644 --- a/Examples/perl5/check.list +++ b/Examples/perl5/check.list @@ -6,6 +6,7 @@ constants2 extend funcptr import +java multimap multiple_inheritance pointer diff --git a/Examples/perl5/class/Makefile b/Examples/perl5/class/Makefile index 544d13642..0d1cc574f 100644 --- a/Examples/perl5/class/Makefile +++ b/Examples/perl5/class/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile perl5_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile perl5_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_clean diff --git a/Examples/perl5/constants/Makefile b/Examples/perl5/constants/Makefile index 899282913..b7b411534 100644 --- a/Examples/perl5/constants/Makefile +++ b/Examples/perl5/constants/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile perl5_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5 static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_static clean: - $(MAKE) -f $(TOP)/Makefile perl5_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_clean diff --git a/Examples/perl5/constants2/Makefile b/Examples/perl5/constants2/Makefile index 2ed10d733..85dd13741 100644 --- a/Examples/perl5/constants2/Makefile +++ b/Examples/perl5/constants2/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i SWIGOPT = -const check: build - $(MAKE) -f $(TOP)/Makefile perl5_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5 static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_static clean: - $(MAKE) -f $(TOP)/Makefile perl5_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_clean diff --git a/Examples/perl5/extend/Makefile b/Examples/perl5/extend/Makefile index 544d13642..0d1cc574f 100644 --- a/Examples/perl5/extend/Makefile +++ b/Examples/perl5/extend/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile perl5_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile perl5_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_clean diff --git a/Examples/perl5/extend/example.h b/Examples/perl5/extend/example.h index b27ab9711..ca1aed28f 100644 --- a/Examples/perl5/extend/example.h +++ b/Examples/perl5/extend/example.h @@ -14,7 +14,7 @@ public: virtual std::string getTitle() { return getPosition() + " " + getName(); } virtual std::string getName() { return name; } virtual std::string getPosition() const { return "Employee"; } - virtual ~Employee() { printf("~Employee() @ %p\n", this); } + virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); } }; diff --git a/Examples/perl5/funcptr/Makefile b/Examples/perl5/funcptr/Makefile index 366b5897c..3e1de1fc1 100644 --- a/Examples/perl5/funcptr/Makefile +++ b/Examples/perl5/funcptr/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile perl5_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5 static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_static clean: - $(MAKE) -f $(TOP)/Makefile perl5_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_clean diff --git a/Examples/perl5/import/Makefile b/Examples/perl5/import/Makefile index baa8277fd..b31ab7952 100644 --- a/Examples/perl5/import/Makefile +++ b/Examples/perl5/import/Makefile @@ -4,17 +4,17 @@ SWIGOPT = LIBS = check: build - $(MAKE) -f $(TOP)/Makefile perl5_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='baseclass' INTERFACE='base.i' perl5_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' perl5_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' perl5_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' perl5_cpp clean: - $(MAKE) -f $(TOP)/Makefile perl5_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_clean diff --git a/Examples/perl5/import/base.h b/Examples/perl5/import/base.h index 5a266f68c..c0b47956b 100644 --- a/Examples/perl5/import/base.h +++ b/Examples/perl5/import/base.h @@ -2,8 +2,8 @@ class Base { public: - Base() { }; - virtual ~Base() { }; + Base() { } + virtual ~Base() { } virtual void A() { printf("I'm Base::A\n"); } diff --git a/Examples/perl5/inline/Makefile b/Examples/perl5/inline/Makefile index d544a6532..5c98748c1 100644 --- a/Examples/perl5/inline/Makefile +++ b/Examples/perl5/inline/Makefile @@ -1,6 +1,6 @@ run: - $(MAKE) -f $(TOP)/Makefile perl5_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run clean: - $(MAKE) -f $(TOP)/Makefile perl5_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_clean rm -rf _Inline diff --git a/Examples/perl5/java/Makefile b/Examples/perl5/java/Makefile index ff3aab0e7..5eaea3212 100644 --- a/Examples/perl5/java/Makefile +++ b/Examples/perl5/java/Makefile @@ -6,17 +6,17 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile perl5_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run -build: Example.class - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' CXX="gcj" \ +build: Example.class Example.h + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ CXXSHARED="gcj -fpic -shared Example.class" PERL5_CCFLAGS='' PERL5_EXP='' LIBS="-lstdc++" perl5_cpp clean: - $(MAKE) -f $(TOP)/Makefile perl5_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_clean rm -f *.class Example.h -Example.class: Example.java - gcj -fPIC -C -c -g Example.java - gcjh Example +Example.class Example.h: $(SRCDIR)Example.java + gcj -d . -fPIC -C -c -g $(SRCDIR)Example.java + gcjh Example.class diff --git a/Examples/perl5/multimap/Makefile b/Examples/perl5/multimap/Makefile index 366b5897c..3e1de1fc1 100644 --- a/Examples/perl5/multimap/Makefile +++ b/Examples/perl5/multimap/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile perl5_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5 static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_static clean: - $(MAKE) -f $(TOP)/Makefile perl5_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_clean diff --git a/Examples/perl5/multiple_inheritance/Makefile b/Examples/perl5/multiple_inheritance/Makefile index 62355a82c..1fe5a51bb 100644 --- a/Examples/perl5/multiple_inheritance/Makefile +++ b/Examples/perl5/multiple_inheritance/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = check: build - $(MAKE) -f $(TOP)/Makefile perl5_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile perl5_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_clean diff --git a/Examples/perl5/pointer/Makefile b/Examples/perl5/pointer/Makefile index 366b5897c..3e1de1fc1 100644 --- a/Examples/perl5/pointer/Makefile +++ b/Examples/perl5/pointer/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile perl5_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5 static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_static clean: - $(MAKE) -f $(TOP)/Makefile perl5_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_clean diff --git a/Examples/perl5/reference/Makefile b/Examples/perl5/reference/Makefile index 986fab86a..a22f5a68d 100644 --- a/Examples/perl5/reference/Makefile +++ b/Examples/perl5/reference/Makefile @@ -7,15 +7,15 @@ LIBS = -lm SWIGOPT = -noproxy check: build - $(MAKE) -f $(TOP)/Makefile perl5_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' SWIGOPT='$(SWIGOPT)' perl5_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='myperl' INTERFACE='$(INTERFACE)' SWIGOPT='$(SWIGOPT)' perl5_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile perl5_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_clean diff --git a/Examples/perl5/reference/example.cxx b/Examples/perl5/reference/example.cxx index 8a513bf49..9dbaed2ee 100644 --- a/Examples/perl5/reference/example.cxx +++ b/Examples/perl5/reference/example.cxx @@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) { char *Vector::print() { static char temp[512]; - sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); + sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z); return temp; } diff --git a/Examples/perl5/reference/example.h b/Examples/perl5/reference/example.h index 4915adb1b..bcfcfb72f 100644 --- a/Examples/perl5/reference/example.h +++ b/Examples/perl5/reference/example.h @@ -4,8 +4,8 @@ class Vector { private: double x,y,z; public: - Vector() : x(0), y(0), z(0) { }; - Vector(double x, double y, double z) : x(x), y(y), z(z) { }; + Vector() : x(0), y(0), z(0) { } + Vector(double x, double y, double z) : x(x), y(y), z(z) { } friend Vector operator+(const Vector &a, const Vector &b); char *print(); }; @@ -20,7 +20,3 @@ public: Vector &operator[](int); int size(); }; - - - - diff --git a/Examples/perl5/reference/example.i b/Examples/perl5/reference/example.i index 6daa3b1f4..173143d79 100644 --- a/Examples/perl5/reference/example.i +++ b/Examples/perl5/reference/example.i @@ -29,7 +29,7 @@ public: VectorArray(int maxsize); ~VectorArray(); int size(); - + /* This wrapper provides an alternative to the [] operator */ %extend { Vector &get(int index) { @@ -40,7 +40,3 @@ public: } } }; - - - - diff --git a/Examples/perl5/simple/Makefile b/Examples/perl5/simple/Makefile index 366b5897c..3e1de1fc1 100644 --- a/Examples/perl5/simple/Makefile +++ b/Examples/perl5/simple/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile perl5_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5 static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_static clean: - $(MAKE) -f $(TOP)/Makefile perl5_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_clean diff --git a/Examples/perl5/value/Makefile b/Examples/perl5/value/Makefile index 366b5897c..3e1de1fc1 100644 --- a/Examples/perl5/value/Makefile +++ b/Examples/perl5/value/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile perl5_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5 static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_static clean: - $(MAKE) -f $(TOP)/Makefile perl5_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_clean diff --git a/Examples/perl5/value/example.i b/Examples/perl5/value/example.i index 98fd60ed5..39663c6b8 100644 --- a/Examples/perl5/value/example.i +++ b/Examples/perl5/value/example.i @@ -26,7 +26,7 @@ Vector *new_Vector(double x, double y, double z) { } void vector_print(Vector *v) { - printf("Vector %p = (%g, %g, %g)\n", v, v->x, v->y, v->z); + printf("Vector %p = (%g, %g, %g)\n", (void *)v, v->x, v->y, v->z); } %} diff --git a/Examples/perl5/variables/Makefile b/Examples/perl5/variables/Makefile index 366b5897c..3e1de1fc1 100644 --- a/Examples/perl5/variables/Makefile +++ b/Examples/perl5/variables/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile perl5_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' perl5 static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_static clean: - $(MAKE) -f $(TOP)/Makefile perl5_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_clean diff --git a/Examples/perl5/variables/example.c b/Examples/perl5/variables/example.c index 05e17c8c5..85685fe72 100644 --- a/Examples/perl5/variables/example.c +++ b/Examples/perl5/variables/example.c @@ -52,9 +52,9 @@ void print_vars() { printf("cvar = %c\n", cvar); printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("cstrvar = %s\n", cstrvar); - printf("iptrvar = %p\n", iptrvar); + printf("iptrvar = %p\n", (void *)iptrvar); printf("name = %s\n", name); - printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); + printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); printf("pt = (%d, %d)\n", pt.x, pt.y); printf("status = %d\n", status); } diff --git a/Examples/perl5/xmlstring/Makefile b/Examples/perl5/xmlstring/Makefile index df9dabd11..4f02d3ee4 100644 --- a/Examples/perl5/xmlstring/Makefile +++ b/Examples/perl5/xmlstring/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lxerces-c -lxerces-depdom -lm check: build - $(MAKE) -f $(TOP)/Makefile perl5_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' LIBS=$(LIBS) CXX="g++ -g3" perl5_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='myperl' INTERFACE='$(INTERFACE)' perl5_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile perl5_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' perl5_clean diff --git a/Examples/php/callback/Makefile b/Examples/php/callback/Makefile index 6f7e4ad27..3ad3999a5 100644 --- a/Examples/php/callback/Makefile +++ b/Examples/php/callback/Makefile @@ -7,15 +7,15 @@ LIBS = -lm SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile php_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run build: - $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' php_cpp static: - $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' php_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile php_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_clean diff --git a/Examples/php/class/Makefile b/Examples/php/class/Makefile index cefd81f78..8b2b340e9 100644 --- a/Examples/php/class/Makefile +++ b/Examples/php/class/Makefile @@ -7,17 +7,17 @@ LIBS = SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile php_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ php_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \ php_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile php_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_clean diff --git a/Examples/php/constants/Makefile b/Examples/php/constants/Makefile index 3f24a3921..e5b49571e 100644 --- a/Examples/php/constants/Makefile +++ b/Examples/php/constants/Makefile @@ -7,17 +7,17 @@ LIBS = SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile php_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ php static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \ php_static clean: - $(MAKE) -f $(TOP)/Makefile php_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_clean diff --git a/Examples/php/cpointer/Makefile b/Examples/php/cpointer/Makefile index 57785acc7..f2c15c5c1 100644 --- a/Examples/php/cpointer/Makefile +++ b/Examples/php/cpointer/Makefile @@ -7,17 +7,17 @@ LIBS = SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile php_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ php static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \ php_static clean: - $(MAKE) -f $(TOP)/Makefile php_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_clean diff --git a/Examples/php/disown/Makefile b/Examples/php/disown/Makefile index cefd81f78..8b2b340e9 100644 --- a/Examples/php/disown/Makefile +++ b/Examples/php/disown/Makefile @@ -7,17 +7,17 @@ LIBS = SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile php_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ php_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \ php_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile php_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_clean diff --git a/Examples/php/disown/example.h b/Examples/php/disown/example.h index 985bc333d..e9f96743f 100644 --- a/Examples/php/disown/example.h +++ b/Examples/php/disown/example.h @@ -9,7 +9,7 @@ public: } virtual ~Shape() { nshapes--; - }; + } double x, y; void move(double dx, double dy); virtual double area(void) = 0; @@ -22,8 +22,8 @@ class Circle : public Shape { private: double radius; public: - Circle(double r) : radius(r) { }; - ~Circle() { }; + Circle(double r) : radius(r) { } + ~Circle() { } void set_radius( double r ); virtual double area(void); virtual double perimeter(void); @@ -33,7 +33,7 @@ class Square : public Shape { private: double width; public: - Square(double w) : width(w) { }; + Square(double w) : width(w) { } ~Square() { } virtual double area(void); virtual double perimeter(void); @@ -44,7 +44,7 @@ private: typedef std::vector<Shape*>::iterator iterator; std::vector<Shape*> shapes; public: - ShapeContainer() : shapes() {}; + ShapeContainer() : shapes() {} ~ShapeContainer(); void addShape( Shape *s ); }; diff --git a/Examples/php/enum/Makefile b/Examples/php/enum/Makefile index 22f979d2f..2028d03c7 100644 --- a/Examples/php/enum/Makefile +++ b/Examples/php/enum/Makefile @@ -7,17 +7,17 @@ LIBS = SWIGOPT = -noproxy check: build - $(MAKE) -f $(TOP)/Makefile php_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ php_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \ php_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile php_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_clean diff --git a/Examples/php/extend/Makefile b/Examples/php/extend/Makefile index 6f7e4ad27..3ad3999a5 100644 --- a/Examples/php/extend/Makefile +++ b/Examples/php/extend/Makefile @@ -7,15 +7,15 @@ LIBS = -lm SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile php_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run build: - $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' php_cpp static: - $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' php_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile php_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_clean diff --git a/Examples/php/extend/example.h b/Examples/php/extend/example.h index b27ab9711..ca1aed28f 100644 --- a/Examples/php/extend/example.h +++ b/Examples/php/extend/example.h @@ -14,7 +14,7 @@ public: virtual std::string getTitle() { return getPosition() + " " + getName(); } virtual std::string getName() { return name; } virtual std::string getPosition() const { return "Employee"; } - virtual ~Employee() { printf("~Employee() @ %p\n", this); } + virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); } }; diff --git a/Examples/php/funcptr/Makefile b/Examples/php/funcptr/Makefile index 57785acc7..f2c15c5c1 100644 --- a/Examples/php/funcptr/Makefile +++ b/Examples/php/funcptr/Makefile @@ -7,17 +7,17 @@ LIBS = SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile php_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ php static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \ php_static clean: - $(MAKE) -f $(TOP)/Makefile php_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_clean diff --git a/Examples/php/overloading/Makefile b/Examples/php/overloading/Makefile index cefd81f78..8b2b340e9 100644 --- a/Examples/php/overloading/Makefile +++ b/Examples/php/overloading/Makefile @@ -7,17 +7,17 @@ LIBS = SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile php_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ php_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \ php_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile php_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_clean diff --git a/Examples/php/pointer/Makefile b/Examples/php/pointer/Makefile index 57785acc7..f2c15c5c1 100644 --- a/Examples/php/pointer/Makefile +++ b/Examples/php/pointer/Makefile @@ -7,17 +7,17 @@ LIBS = SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile php_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ php static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \ php_static clean: - $(MAKE) -f $(TOP)/Makefile php_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_clean diff --git a/Examples/php/pragmas/Makefile b/Examples/php/pragmas/Makefile index 3f24a3921..e5b49571e 100644 --- a/Examples/php/pragmas/Makefile +++ b/Examples/php/pragmas/Makefile @@ -7,17 +7,17 @@ LIBS = SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile php_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ php static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \ php_static clean: - $(MAKE) -f $(TOP)/Makefile php_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_clean diff --git a/Examples/php/proxy/Makefile b/Examples/php/proxy/Makefile index cefd81f78..8b2b340e9 100644 --- a/Examples/php/proxy/Makefile +++ b/Examples/php/proxy/Makefile @@ -7,17 +7,17 @@ LIBS = SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile php_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ php_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \ php_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile php_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_clean diff --git a/Examples/php/proxy/example.h b/Examples/php/proxy/example.h index 361dff898..0683f07f3 100644 --- a/Examples/php/proxy/example.h +++ b/Examples/php/proxy/example.h @@ -9,7 +9,7 @@ public: } virtual ~Shape() { nshapes--; - }; + } double x, y; void move(double dx, double dy); virtual double area(void) = 0; @@ -22,8 +22,8 @@ class Circle : public Shape { private: double radius; public: - Circle(double r) : radius(r) { }; - ~Circle() { }; + Circle(double r) : radius(r) { } + ~Circle() { } void set_radius( double r ); virtual double area(void); virtual double perimeter(void); @@ -33,7 +33,7 @@ class Square : public Shape { private: double width; public: - Square(double w) : width(w) { }; + Square(double w) : width(w) { } ~Square() { } virtual double area(void); virtual double perimeter(void); diff --git a/Examples/php/reference/Makefile b/Examples/php/reference/Makefile index cefd81f78..8b2b340e9 100644 --- a/Examples/php/reference/Makefile +++ b/Examples/php/reference/Makefile @@ -7,17 +7,17 @@ LIBS = SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile php_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ php_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \ php_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile php_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_clean diff --git a/Examples/php/reference/example.cxx b/Examples/php/reference/example.cxx index 13e47eade..7ead7fbf6 100644 --- a/Examples/php/reference/example.cxx +++ b/Examples/php/reference/example.cxx @@ -19,23 +19,23 @@ Vector operator+(const Vector &a, const Vector &b) { char *Vector::as_string() { static char temp[512]; - sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); + sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z); return temp; } VectorArray::VectorArray(int size) { items = new Vector[size]; maxsize = size; - printf("VectorArray new: self=%p\n",this); + printf("VectorArray new: self=%p\n", (void *)this); } VectorArray::~VectorArray() { - printf("VectorArray delete: self=%p\n",this); + printf("VectorArray delete: self=%p\n", (void *)this); delete [] items; } Vector &VectorArray::operator[](int index) { - printf("VectorArray: read[%d] self=%p\n",index,this); + printf("VectorArray: read[%d] self=%p\n", index, (void *)this); if ((index < 0) || (index >= maxsize)) { printf("Panic! Array index out of bounds.\n"); exit(1); @@ -44,6 +44,6 @@ Vector &VectorArray::operator[](int index) { } int VectorArray::size() { - printf("VectorArray: size %d self=%p\n",maxsize,this); + printf("VectorArray: size %d self=%p\n", maxsize, (void *)this); return maxsize; } diff --git a/Examples/php/reference/example.h b/Examples/php/reference/example.h index 1b88cbf5c..353b88835 100644 --- a/Examples/php/reference/example.h +++ b/Examples/php/reference/example.h @@ -4,8 +4,8 @@ class Vector { private: double x,y,z; public: - Vector() : x(0), y(0), z(0) { }; - Vector(double x, double y, double z) : x(x), y(y), z(z) { }; + Vector() : x(0), y(0), z(0) { } + Vector(double x, double y, double z) : x(x), y(y), z(z) { } friend Vector operator+(const Vector &a, const Vector &b); char *as_string(); }; @@ -20,7 +20,3 @@ public: Vector &operator[](int); int size(); }; - - - - diff --git a/Examples/php/reference/example.i b/Examples/php/reference/example.i index d6122866b..df1459921 100644 --- a/Examples/php/reference/example.i +++ b/Examples/php/reference/example.i @@ -1,10 +1,6 @@ /* File : example.i */ -/* This example has nothing to do with references but the name is used by all - * the other languages so it's hard to rename to something more meaningful. - * - * Mostly it shows how to use %extend. - */ +/* This file has a few "typical" uses of C++ references. */ %module example @@ -33,11 +29,11 @@ public: VectorArray(int maxsize); ~VectorArray(); int size(); - - /* This wrapper provides an alternative to the [] operator */ + + /* This wrapper provides an alternative to the [] operator */ %extend { Vector &get(int index) { - printf("VectorArray extended get: %p %d\n",$self,index); + printf("VectorArray extended get: %p %d\n", (void *)$self, index); return (*$self)[index]; } void set(int index, Vector &a) { diff --git a/Examples/php/simple/Makefile b/Examples/php/simple/Makefile index 57785acc7..f2c15c5c1 100644 --- a/Examples/php/simple/Makefile +++ b/Examples/php/simple/Makefile @@ -7,17 +7,17 @@ LIBS = SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile php_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ php static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \ php_static clean: - $(MAKE) -f $(TOP)/Makefile php_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_clean diff --git a/Examples/php/sync/Makefile b/Examples/php/sync/Makefile index cefd81f78..8b2b340e9 100644 --- a/Examples/php/sync/Makefile +++ b/Examples/php/sync/Makefile @@ -7,17 +7,17 @@ LIBS = SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile php_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ php_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \ php_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile php_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_clean diff --git a/Examples/php/sync/example.cxx b/Examples/php/sync/example.cxx index 31ed2021b..0942279b2 100644 --- a/Examples/php/sync/example.cxx +++ b/Examples/php/sync/example.cxx @@ -10,4 +10,4 @@ void Sync::printer(void) { printf("The value of global x is %d\n", x); printf("The value of class s is %s\n", s); printf("The value of class x is %d\n", x); -}; +} diff --git a/Examples/php/value/Makefile b/Examples/php/value/Makefile index 449686784..3db7afec5 100644 --- a/Examples/php/value/Makefile +++ b/Examples/php/value/Makefile @@ -7,17 +7,17 @@ LIBS = SWIGOPT = -noproxy check: build - $(MAKE) -f $(TOP)/Makefile php_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ php static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \ php_static clean: - $(MAKE) -f $(TOP)/Makefile php_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_clean diff --git a/Examples/php/value/example.i b/Examples/php/value/example.i index 386fa3b84..20a453468 100644 --- a/Examples/php/value/example.i +++ b/Examples/php/value/example.i @@ -11,7 +11,7 @@ %inline %{ void vector_print(Vector *v) { - printf("Vector %p = (%g, %g, %g)\n", v, v->x, v->y, v->z); + printf("Vector %p = (%g, %g, %g)\n", (void *)v, v->x, v->y, v->z); } %} diff --git a/Examples/php/variables/Makefile b/Examples/php/variables/Makefile index 57785acc7..f2c15c5c1 100644 --- a/Examples/php/variables/Makefile +++ b/Examples/php/variables/Makefile @@ -7,17 +7,17 @@ LIBS = SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile php_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ php static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myphp' INTERFACE='$(INTERFACE)' \ php_static clean: - $(MAKE) -f $(TOP)/Makefile php_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' php_clean diff --git a/Examples/php/variables/example.c b/Examples/php/variables/example.c index b21dee32d..d4c6d026d 100644 --- a/Examples/php/variables/example.c +++ b/Examples/php/variables/example.c @@ -52,9 +52,9 @@ void print_vars() { printf("cvar = %c\n", cvar); printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("cstrvar = %s\n", cstrvar); - printf("iptrvar = %p\n", iptrvar); + printf("iptrvar = %p\n", (void *)iptrvar); printf("name = %c%c%c%c%c\n", name[0],name[1],name[2],name[3],name[4]); - printf("ptptr = %p %s\n", ptptr, Point_print( ptptr ) ); + printf("ptptr = %p %s\n", (void *)ptptr, Point_print( ptptr ) ); printf("pt = (%d, %d)\n", pt.x, pt.y); printf("status = %d\n", status); } diff --git a/Examples/pike/class/Makefile b/Examples/pike/class/Makefile index aadc47151..d8cf4ea7e 100644 --- a/Examples/pike/class/Makefile +++ b/Examples/pike/class/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile pike_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mypike' INTERFACE='$(INTERFACE)' pike_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile pike_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_clean diff --git a/Examples/pike/constants/Makefile b/Examples/pike/constants/Makefile index c9385ce3b..736d30f03 100644 --- a/Examples/pike/constants/Makefile +++ b/Examples/pike/constants/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile pike_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='mypike' INTERFACE='$(INTERFACE)' pike_static clean: - $(MAKE) -f $(TOP)/Makefile pike_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_clean diff --git a/Examples/pike/enum/Makefile b/Examples/pike/enum/Makefile index aadc47151..d8cf4ea7e 100644 --- a/Examples/pike/enum/Makefile +++ b/Examples/pike/enum/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile pike_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mypike' INTERFACE='$(INTERFACE)' pike_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile pike_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_clean diff --git a/Examples/pike/overload/Makefile b/Examples/pike/overload/Makefile index 8d799efe1..f111b1137 100644 --- a/Examples/pike/overload/Makefile +++ b/Examples/pike/overload/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lstdc++ -lm check: build - $(MAKE) -f $(TOP)/Makefile pike_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mypike' INTERFACE='$(INTERFACE)' pike_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile pike_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_clean diff --git a/Examples/pike/simple/Makefile b/Examples/pike/simple/Makefile index f58ed4e65..d7f6b209e 100644 --- a/Examples/pike/simple/Makefile +++ b/Examples/pike/simple/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile pike_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='mypike' INTERFACE='$(INTERFACE)' pike_static clean: - $(MAKE) -f $(TOP)/Makefile pike_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_clean diff --git a/Examples/pike/template/Makefile b/Examples/pike/template/Makefile index e4fc945f7..da115c1d5 100644 --- a/Examples/pike/template/Makefile +++ b/Examples/pike/template/Makefile @@ -7,15 +7,15 @@ LIBS = -lm SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile pike_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' pike_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='mypike' INTERFACE='$(INTERFACE)' pike_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile pike_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' pike_clean diff --git a/Examples/python/callback/Makefile b/Examples/python/callback/Makefile index 684995801..a4c4d2a69 100644 --- a/Examples/python/callback/Makefile +++ b/Examples/python/callback/Makefile @@ -7,15 +7,15 @@ LIBS = -lm SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp static: - $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/check.list b/Examples/python/check.list index e9e7c8357..a43a5fca0 100644 --- a/Examples/python/check.list +++ b/Examples/python/check.list @@ -24,7 +24,6 @@ simple smartptr std_vector std_map -swigrun template varargs variables diff --git a/Examples/python/class/Makefile b/Examples/python/class/Makefile index e940c1f43..41cded284 100644 --- a/Examples/python/class/Makefile +++ b/Examples/python/class/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/constants/Makefile b/Examples/python/constants/Makefile index 15ffa24c9..8ec6e9cc9 100644 --- a/Examples/python/constants/Makefile +++ b/Examples/python/constants/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/contract/Makefile b/Examples/python/contract/Makefile index 999521ccc..fe1d9325e 100644 --- a/Examples/python/contract/Makefile +++ b/Examples/python/contract/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/docstrings/Makefile b/Examples/python/docstrings/Makefile index 51552f3cf..f471930dd 100644 --- a/Examples/python/docstrings/Makefile +++ b/Examples/python/docstrings/Makefile @@ -7,17 +7,17 @@ LIBS = -lm SWIGOPT = -O check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/enum/Makefile b/Examples/python/enum/Makefile index e940c1f43..41cded284 100644 --- a/Examples/python/enum/Makefile +++ b/Examples/python/enum/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/exception/Makefile b/Examples/python/exception/Makefile index fb200fbaf..ad3d49fe1 100644 --- a/Examples/python/exception/Makefile +++ b/Examples/python/exception/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/exception/example.i b/Examples/python/exception/example.i index 08672c3a8..817c5221c 100644 --- a/Examples/python/exception/example.i +++ b/Examples/python/exception/example.i @@ -10,3 +10,12 @@ /* Let's just grab the original header file here */ %include "example.h" +%inline %{ +// The -builtin SWIG option results in SWIGPYTHON_BUILTIN being defined +#ifdef SWIGPYTHON_BUILTIN +bool is_python_builtin() { return true; } +#else +bool is_python_builtin() { return false; } +#endif +%} + diff --git a/Examples/python/exception/runme.py b/Examples/python/exception/runme.py index 718707861..9e9241194 100644 --- a/Examples/python/exception/runme.py +++ b/Examples/python/exception/runme.py @@ -20,10 +20,17 @@ try: except RuntimeError,e: print e.args[0] -try: - t.hosed() -except example.Exc,e: - print e.code, e.msg +if not example.is_python_builtin(): + try: + t.hosed() + except example.Exc,e: + print e.code, e.msg +else: + try: + t.hosed() + except BaseException,e: + # Throwing builtin classes as exceptions not supported (-builtin option) + print e for i in range(1,4): try: diff --git a/Examples/python/exceptproxy/Makefile b/Examples/python/exceptproxy/Makefile index 86a643415..f406dfaf4 100644 --- a/Examples/python/exceptproxy/Makefile +++ b/Examples/python/exceptproxy/Makefile @@ -7,15 +7,15 @@ LIBS = -lm SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/exceptproxy/example.i b/Examples/python/exceptproxy/example.i index 4a1e0bae9..0a46afbb6 100644 --- a/Examples/python/exceptproxy/example.i +++ b/Examples/python/exceptproxy/example.i @@ -109,6 +109,12 @@ %template(doubleQueue) Queue<double>; - - +%inline %{ +// The -builtin SWIG option results in SWIGPYTHON_BUILTIN being defined +#ifdef SWIGPYTHON_BUILTIN +bool is_python_builtin() { return true; } +#else +bool is_python_builtin() { return false; } +#endif +%} diff --git a/Examples/python/exceptproxy/runme.py b/Examples/python/exceptproxy/runme.py index a2ae55584..07e4b0a7f 100644 --- a/Examples/python/exceptproxy/runme.py +++ b/Examples/python/exceptproxy/runme.py @@ -1,10 +1,16 @@ # file: runme.py import example +if example.is_python_builtin(): + print "Skipping example: -builtin option does not support %exceptionclass" + exit(0) + q = example.intQueue(10) print "Inserting items into intQueue" +print type(example.FullError) + try: for i in range(0,100): q.enqueue(i) diff --git a/Examples/python/extend/Makefile b/Examples/python/extend/Makefile index 684995801..a4c4d2a69 100644 --- a/Examples/python/extend/Makefile +++ b/Examples/python/extend/Makefile @@ -7,15 +7,15 @@ LIBS = -lm SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp static: - $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/extend/example.h b/Examples/python/extend/example.h index b27ab9711..ca1aed28f 100644 --- a/Examples/python/extend/example.h +++ b/Examples/python/extend/example.h @@ -14,7 +14,7 @@ public: virtual std::string getTitle() { return getPosition() + " " + getName(); } virtual std::string getName() { return name; } virtual std::string getPosition() const { return "Employee"; } - virtual ~Employee() { printf("~Employee() @ %p\n", this); } + virtual ~Employee() { printf("~Employee() @ %p\n", (void *)this); } }; diff --git a/Examples/python/funcptr/Makefile b/Examples/python/funcptr/Makefile index df3bc86ff..222916fa1 100644 --- a/Examples/python/funcptr/Makefile +++ b/Examples/python/funcptr/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/funcptr2/Makefile b/Examples/python/funcptr2/Makefile index df3bc86ff..222916fa1 100644 --- a/Examples/python/funcptr2/Makefile +++ b/Examples/python/funcptr2/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/functor/Makefile b/Examples/python/functor/Makefile index dde0d0910..1234c310e 100644 --- a/Examples/python/functor/Makefile +++ b/Examples/python/functor/Makefile @@ -7,15 +7,15 @@ LIBS = -lm SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/import/Makefile b/Examples/python/import/Makefile index f63e12271..d83dfeaa8 100644 --- a/Examples/python/import/Makefile +++ b/Examples/python/import/Makefile @@ -4,19 +4,19 @@ SWIGOPT = LIBS = check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='base' INTERFACE='base.i' python_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' python_cpp clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean rm -f foo.py bar.py spam.py base.py diff --git a/Examples/python/import/base.h b/Examples/python/import/base.h index 5a266f68c..c0b47956b 100644 --- a/Examples/python/import/base.h +++ b/Examples/python/import/base.h @@ -2,8 +2,8 @@ class Base { public: - Base() { }; - virtual ~Base() { }; + Base() { } + virtual ~Base() { } virtual void A() { printf("I'm Base::A\n"); } diff --git a/Examples/python/import_packages/Makefile b/Examples/python/import_packages/Makefile index fda2380b3..dfd46d05c 100644 --- a/Examples/python/import_packages/Makefile +++ b/Examples/python/import_packages/Makefile @@ -5,17 +5,23 @@ LIBS = PY3 = import_packages_subdirs = \ - same_modnames1 \ + same_modnames1 \ same_modnames2 \ from_init1 \ from_init2 \ from_init3 \ relativeimport1 \ - relativeimport1 + relativeimport2 \ + relativeimport3 check: build + if test "x$(SRCDIR)" != x; then \ + for file in `cd $(SRCDIR) && find . -type f -name __init__.py`; do \ + cp "${SRCDIR}$$file" "$$file" || exit 1; \ + done; \ + fi; \ for s in $(import_packages_subdirs); do \ - (cd $$s && $(MAKE) check); \ + (cd $$s && $(MAKE) check); \ done build: @@ -29,7 +35,12 @@ static: done clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean + if test "x$(SRCDIR)" != x; then \ + for file in `cd $(SRCDIR) && find . -type f -name __init__.py`; do \ + rm -f "$$file" || exit 1; \ + done; \ + fi; \ for s in $(import_packages_subdirs); do \ (cd $$s && $(MAKE) clean); \ done diff --git a/Examples/python/import_packages/from_init1/Makefile b/Examples/python/import_packages/from_init1/Makefile index 8e35c6c61..b9d803a0e 100644 --- a/Examples/python/import_packages/from_init1/Makefile +++ b/Examples/python/import_packages/from_init1/Makefile @@ -11,7 +11,7 @@ else endif check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build @@ -20,6 +20,6 @@ static: cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd py2 && $(MAKE) clean cd py3 && $(MAKE) clean diff --git a/Examples/python/import_packages/from_init1/py2/Makefile b/Examples/python/import_packages/from_init1/py2/Makefile index 4c0dfab07..9595397d8 100644 --- a/Examples/python/import_packages/from_init1/py2/Makefile +++ b/Examples/python/import_packages/from_init1/py2/Makefile @@ -10,5 +10,5 @@ static: cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd pkg2 && $(MAKE) clean diff --git a/Examples/python/import_packages/from_init1/py2/pkg2/Makefile b/Examples/python/import_packages/from_init1/py2/pkg2/Makefile index 0dd174659..1eb810e05 100644 --- a/Examples/python/import_packages/from_init1/py2/pkg2/Makefile +++ b/Examples/python/import_packages/from_init1/py2/pkg2/Makefile @@ -4,17 +4,17 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp_static clean:: - $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean - $(MAKE) -f $(TOP)/Makefile TARGET='bar' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean diff --git a/Examples/python/import_packages/from_init1/py3/Makefile b/Examples/python/import_packages/from_init1/py3/Makefile index 4c0dfab07..9595397d8 100644 --- a/Examples/python/import_packages/from_init1/py3/Makefile +++ b/Examples/python/import_packages/from_init1/py3/Makefile @@ -10,5 +10,5 @@ static: cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd pkg2 && $(MAKE) clean diff --git a/Examples/python/import_packages/from_init1/py3/pkg2/Makefile b/Examples/python/import_packages/from_init1/py3/pkg2/Makefile index 0dd174659..1eb810e05 100644 --- a/Examples/python/import_packages/from_init1/py3/pkg2/Makefile +++ b/Examples/python/import_packages/from_init1/py3/pkg2/Makefile @@ -4,17 +4,17 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp_static clean:: - $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean - $(MAKE) -f $(TOP)/Makefile TARGET='bar' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean diff --git a/Examples/python/import_packages/from_init1/runme.py b/Examples/python/import_packages/from_init1/runme.py index c23a085fa..bbe092bab 100644 --- a/Examples/python/import_packages/from_init1/runme.py +++ b/Examples/python/import_packages/from_init1/runme.py @@ -1,6 +1,10 @@ -# Test import of modules content from within __init__.py -print "Testing %module(package=...) + python 'import' in __init__.py" import sys +import os.path + +# Test import of modules content from within __init__.py +testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) +print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py" + if sys.version_info < (3,0): import py2.pkg2 print " Finished importing py2.pkg2" diff --git a/Examples/python/import_packages/from_init2/Makefile b/Examples/python/import_packages/from_init2/Makefile index 8e35c6c61..b9d803a0e 100644 --- a/Examples/python/import_packages/from_init2/Makefile +++ b/Examples/python/import_packages/from_init2/Makefile @@ -11,7 +11,7 @@ else endif check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build @@ -20,6 +20,6 @@ static: cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd py2 && $(MAKE) clean cd py3 && $(MAKE) clean diff --git a/Examples/python/import_packages/from_init2/py2/Makefile b/Examples/python/import_packages/from_init2/py2/Makefile index 4c0dfab07..9595397d8 100644 --- a/Examples/python/import_packages/from_init2/py2/Makefile +++ b/Examples/python/import_packages/from_init2/py2/Makefile @@ -10,5 +10,5 @@ static: cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd pkg2 && $(MAKE) clean diff --git a/Examples/python/import_packages/from_init2/py2/pkg2/Makefile b/Examples/python/import_packages/from_init2/py2/pkg2/Makefile index 3fe56139d..36e099b78 100644 --- a/Examples/python/import_packages/from_init2/py2/pkg2/Makefile +++ b/Examples/python/import_packages/from_init2/py2/pkg2/Makefile @@ -4,15 +4,15 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='bar' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean cd pkg3 && $(MAKE) clean diff --git a/Examples/python/import_packages/from_init2/py2/pkg2/pkg3/Makefile b/Examples/python/import_packages/from_init2/py2/pkg2/pkg3/Makefile index a417e2745..cb20bd25f 100644 --- a/Examples/python/import_packages/from_init2/py2/pkg2/pkg3/Makefile +++ b/Examples/python/import_packages/from_init2/py2/pkg2/pkg3/Makefile @@ -4,12 +4,12 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean diff --git a/Examples/python/import_packages/from_init2/py3/Makefile b/Examples/python/import_packages/from_init2/py3/Makefile index 4c0dfab07..9595397d8 100644 --- a/Examples/python/import_packages/from_init2/py3/Makefile +++ b/Examples/python/import_packages/from_init2/py3/Makefile @@ -10,5 +10,5 @@ static: cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd pkg2 && $(MAKE) clean diff --git a/Examples/python/import_packages/from_init2/py3/pkg2/Makefile b/Examples/python/import_packages/from_init2/py3/pkg2/Makefile index 3fe56139d..36e099b78 100644 --- a/Examples/python/import_packages/from_init2/py3/pkg2/Makefile +++ b/Examples/python/import_packages/from_init2/py3/pkg2/Makefile @@ -4,15 +4,15 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='bar' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean cd pkg3 && $(MAKE) clean diff --git a/Examples/python/import_packages/from_init2/py3/pkg2/pkg3/Makefile b/Examples/python/import_packages/from_init2/py3/pkg2/pkg3/Makefile index a417e2745..cb20bd25f 100644 --- a/Examples/python/import_packages/from_init2/py3/pkg2/pkg3/Makefile +++ b/Examples/python/import_packages/from_init2/py3/pkg2/pkg3/Makefile @@ -4,12 +4,12 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean diff --git a/Examples/python/import_packages/from_init2/runme.py b/Examples/python/import_packages/from_init2/runme.py index c23a085fa..bbe092bab 100644 --- a/Examples/python/import_packages/from_init2/runme.py +++ b/Examples/python/import_packages/from_init2/runme.py @@ -1,6 +1,10 @@ -# Test import of modules content from within __init__.py -print "Testing %module(package=...) + python 'import' in __init__.py" import sys +import os.path + +# Test import of modules content from within __init__.py +testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) +print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py" + if sys.version_info < (3,0): import py2.pkg2 print " Finished importing py2.pkg2" diff --git a/Examples/python/import_packages/from_init3/Makefile b/Examples/python/import_packages/from_init3/Makefile index 8e35c6c61..b9d803a0e 100644 --- a/Examples/python/import_packages/from_init3/Makefile +++ b/Examples/python/import_packages/from_init3/Makefile @@ -11,7 +11,7 @@ else endif check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build @@ -20,6 +20,6 @@ static: cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd py2 && $(MAKE) clean cd py3 && $(MAKE) clean diff --git a/Examples/python/import_packages/from_init3/py2/Makefile b/Examples/python/import_packages/from_init3/py2/Makefile index 4c0dfab07..9595397d8 100644 --- a/Examples/python/import_packages/from_init3/py2/Makefile +++ b/Examples/python/import_packages/from_init3/py2/Makefile @@ -10,5 +10,5 @@ static: cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd pkg2 && $(MAKE) clean diff --git a/Examples/python/import_packages/from_init3/py2/pkg2/Makefile b/Examples/python/import_packages/from_init3/py2/pkg2/Makefile index 3fe56139d..36e099b78 100644 --- a/Examples/python/import_packages/from_init3/py2/pkg2/Makefile +++ b/Examples/python/import_packages/from_init3/py2/pkg2/Makefile @@ -4,15 +4,15 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='bar' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean cd pkg3 && $(MAKE) clean diff --git a/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/Makefile b/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/Makefile index 470f9d561..d6ae1b2bc 100644 --- a/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/Makefile +++ b/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/Makefile @@ -10,5 +10,5 @@ static: cd pkg4 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd pkg4 && $(MAKE) clean diff --git a/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/pkg4/Makefile b/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/pkg4/Makefile index a98d31122..286d90070 100644 --- a/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/pkg4/Makefile +++ b/Examples/python/import_packages/from_init3/py2/pkg2/pkg3/pkg4/Makefile @@ -4,12 +4,12 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean diff --git a/Examples/python/import_packages/from_init3/py3/Makefile b/Examples/python/import_packages/from_init3/py3/Makefile index 4c0dfab07..9595397d8 100644 --- a/Examples/python/import_packages/from_init3/py3/Makefile +++ b/Examples/python/import_packages/from_init3/py3/Makefile @@ -10,5 +10,5 @@ static: cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd pkg2 && $(MAKE) clean diff --git a/Examples/python/import_packages/from_init3/py3/pkg2/Makefile b/Examples/python/import_packages/from_init3/py3/pkg2/Makefile index 3fe56139d..36e099b78 100644 --- a/Examples/python/import_packages/from_init3/py3/pkg2/Makefile +++ b/Examples/python/import_packages/from_init3/py3/pkg2/Makefile @@ -4,15 +4,15 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='bar' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean cd pkg3 && $(MAKE) clean diff --git a/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/Makefile b/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/Makefile index 470f9d561..d6ae1b2bc 100644 --- a/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/Makefile +++ b/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/Makefile @@ -10,5 +10,5 @@ static: cd pkg4 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd pkg4 && $(MAKE) clean diff --git a/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/pkg4/Makefile b/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/pkg4/Makefile index a98d31122..286d90070 100644 --- a/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/pkg4/Makefile +++ b/Examples/python/import_packages/from_init3/py3/pkg2/pkg3/pkg4/Makefile @@ -4,12 +4,12 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean diff --git a/Examples/python/import_packages/from_init3/runme.py b/Examples/python/import_packages/from_init3/runme.py index c23a085fa..bbe092bab 100644 --- a/Examples/python/import_packages/from_init3/runme.py +++ b/Examples/python/import_packages/from_init3/runme.py @@ -1,6 +1,10 @@ -# Test import of modules content from within __init__.py -print "Testing %module(package=...) + python 'import' in __init__.py" import sys +import os.path + +# Test import of modules content from within __init__.py +testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) +print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py" + if sys.version_info < (3,0): import py2.pkg2 print " Finished importing py2.pkg2" diff --git a/Examples/python/import_packages/relativeimport1/Makefile b/Examples/python/import_packages/relativeimport1/Makefile index 8e35c6c61..b9d803a0e 100644 --- a/Examples/python/import_packages/relativeimport1/Makefile +++ b/Examples/python/import_packages/relativeimport1/Makefile @@ -11,7 +11,7 @@ else endif check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build @@ -20,6 +20,6 @@ static: cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd py2 && $(MAKE) clean cd py3 && $(MAKE) clean diff --git a/Examples/python/import_packages/relativeimport1/py2/Makefile b/Examples/python/import_packages/relativeimport1/py2/Makefile index 4c0dfab07..9595397d8 100644 --- a/Examples/python/import_packages/relativeimport1/py2/Makefile +++ b/Examples/python/import_packages/relativeimport1/py2/Makefile @@ -10,5 +10,5 @@ static: cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd pkg2 && $(MAKE) clean diff --git a/Examples/python/import_packages/relativeimport1/py2/pkg2/Makefile b/Examples/python/import_packages/relativeimport1/py2/pkg2/Makefile index 3fe56139d..36e099b78 100644 --- a/Examples/python/import_packages/relativeimport1/py2/pkg2/Makefile +++ b/Examples/python/import_packages/relativeimport1/py2/pkg2/Makefile @@ -4,15 +4,15 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='bar' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean cd pkg3 && $(MAKE) clean diff --git a/Examples/python/import_packages/relativeimport1/py2/pkg2/pkg3/Makefile b/Examples/python/import_packages/relativeimport1/py2/pkg2/pkg3/Makefile index a417e2745..cb20bd25f 100644 --- a/Examples/python/import_packages/relativeimport1/py2/pkg2/pkg3/Makefile +++ b/Examples/python/import_packages/relativeimport1/py2/pkg2/pkg3/Makefile @@ -4,12 +4,12 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean diff --git a/Examples/python/import_packages/relativeimport1/py3/Makefile b/Examples/python/import_packages/relativeimport1/py3/Makefile index 4c0dfab07..9595397d8 100644 --- a/Examples/python/import_packages/relativeimport1/py3/Makefile +++ b/Examples/python/import_packages/relativeimport1/py3/Makefile @@ -10,5 +10,5 @@ static: cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd pkg2 && $(MAKE) clean diff --git a/Examples/python/import_packages/relativeimport1/py3/pkg2/Makefile b/Examples/python/import_packages/relativeimport1/py3/pkg2/Makefile index 3fe56139d..36e099b78 100644 --- a/Examples/python/import_packages/relativeimport1/py3/pkg2/Makefile +++ b/Examples/python/import_packages/relativeimport1/py3/pkg2/Makefile @@ -4,15 +4,15 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='bar' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean cd pkg3 && $(MAKE) clean diff --git a/Examples/python/import_packages/relativeimport1/py3/pkg2/pkg3/Makefile b/Examples/python/import_packages/relativeimport1/py3/pkg2/pkg3/Makefile index a417e2745..cb20bd25f 100644 --- a/Examples/python/import_packages/relativeimport1/py3/pkg2/pkg3/Makefile +++ b/Examples/python/import_packages/relativeimport1/py3/pkg2/pkg3/Makefile @@ -4,12 +4,12 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean diff --git a/Examples/python/import_packages/relativeimport1/runme.py b/Examples/python/import_packages/relativeimport1/runme.py index 44ce8d1c4..99b6e513e 100644 --- a/Examples/python/import_packages/relativeimport1/runme.py +++ b/Examples/python/import_packages/relativeimport1/runme.py @@ -1,6 +1,10 @@ -# Test import of modules content from within __init__.py -print "Testing %module(package=...) with -relativeimport" import sys +import os.path + +# Test import of modules content from within __init__.py +testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) +print "Testing " + testname + " - %module(package=...) with -relativeimport" + if sys.version_info < (3,0): import py2.pkg2.bar print " Finished importing py2.pkg2.bar" diff --git a/Examples/python/import_packages/relativeimport2/Makefile b/Examples/python/import_packages/relativeimport2/Makefile index 8e35c6c61..b9d803a0e 100644 --- a/Examples/python/import_packages/relativeimport2/Makefile +++ b/Examples/python/import_packages/relativeimport2/Makefile @@ -11,7 +11,7 @@ else endif check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build @@ -20,6 +20,6 @@ static: cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd py2 && $(MAKE) clean cd py3 && $(MAKE) clean diff --git a/Examples/python/import_packages/relativeimport2/py2/Makefile b/Examples/python/import_packages/relativeimport2/py2/Makefile index 4c0dfab07..9595397d8 100644 --- a/Examples/python/import_packages/relativeimport2/py2/Makefile +++ b/Examples/python/import_packages/relativeimport2/py2/Makefile @@ -10,5 +10,5 @@ static: cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd pkg2 && $(MAKE) clean diff --git a/Examples/python/import_packages/relativeimport2/py2/pkg2/Makefile b/Examples/python/import_packages/relativeimport2/py2/pkg2/Makefile index 3fe56139d..36e099b78 100644 --- a/Examples/python/import_packages/relativeimport2/py2/pkg2/Makefile +++ b/Examples/python/import_packages/relativeimport2/py2/pkg2/Makefile @@ -4,15 +4,15 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='bar' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean cd pkg3 && $(MAKE) clean diff --git a/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/Makefile b/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/Makefile index 470f9d561..d6ae1b2bc 100644 --- a/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/Makefile +++ b/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/Makefile @@ -10,5 +10,5 @@ static: cd pkg4 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd pkg4 && $(MAKE) clean diff --git a/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/pkg4/Makefile b/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/pkg4/Makefile index a98d31122..286d90070 100644 --- a/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/pkg4/Makefile +++ b/Examples/python/import_packages/relativeimport2/py2/pkg2/pkg3/pkg4/Makefile @@ -4,12 +4,12 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean diff --git a/Examples/python/import_packages/relativeimport2/py3/Makefile b/Examples/python/import_packages/relativeimport2/py3/Makefile index 4c0dfab07..9595397d8 100644 --- a/Examples/python/import_packages/relativeimport2/py3/Makefile +++ b/Examples/python/import_packages/relativeimport2/py3/Makefile @@ -10,5 +10,5 @@ static: cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd pkg2 && $(MAKE) clean diff --git a/Examples/python/import_packages/relativeimport2/py3/pkg2/Makefile b/Examples/python/import_packages/relativeimport2/py3/pkg2/Makefile index 3fe56139d..36e099b78 100644 --- a/Examples/python/import_packages/relativeimport2/py3/pkg2/Makefile +++ b/Examples/python/import_packages/relativeimport2/py3/pkg2/Makefile @@ -4,15 +4,15 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='bar' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean cd pkg3 && $(MAKE) clean diff --git a/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/Makefile b/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/Makefile index 470f9d561..d6ae1b2bc 100644 --- a/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/Makefile +++ b/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/Makefile @@ -10,5 +10,5 @@ static: cd pkg4 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd pkg4 && $(MAKE) clean diff --git a/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/pkg4/Makefile b/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/pkg4/Makefile index a98d31122..286d90070 100644 --- a/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/pkg4/Makefile +++ b/Examples/python/import_packages/relativeimport2/py3/pkg2/pkg3/pkg4/Makefile @@ -4,12 +4,12 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean diff --git a/Examples/python/import_packages/relativeimport2/runme.py b/Examples/python/import_packages/relativeimport2/runme.py index ac60eb630..f0ab6c446 100644 --- a/Examples/python/import_packages/relativeimport2/runme.py +++ b/Examples/python/import_packages/relativeimport2/runme.py @@ -1,6 +1,10 @@ -# Test import of modules content from within __init__.py -print "Testing %module(package=...) + python 'import' in __init__.py" import sys +import os.path + +# Test import of modules content from within __init__.py +testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) +print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py" + if sys.version_info < (3,0): import py2.pkg2.bar print " Finished importing py2.pkg2.bar" diff --git a/Examples/python/import_packages/relativeimport2/runme3.py b/Examples/python/import_packages/relativeimport2/runme3.py deleted file mode 100644 index 4b0d112cf..000000000 --- a/Examples/python/import_packages/relativeimport2/runme3.py +++ /dev/null @@ -1,9 +0,0 @@ -# Test import of modules content from within __init__.py -print("Testing %module(package=...) + python 'import' in __init__.py") -import sys -if sys.version_info < (3, 0): - import py2.pkg2.bar - print(" Finished importing py2.pkg2.bar") -else: - import py3.pkg2.bar - print(" Finished importing py3.pkg2.bar") diff --git a/Examples/python/import_packages/relativeimport3/Makefile b/Examples/python/import_packages/relativeimport3/Makefile new file mode 100644 index 000000000..b9d803a0e --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/Makefile @@ -0,0 +1,25 @@ +TOP = ../../.. +SWIG = $(realpath $(TOP)/../preinst-swig) +SWIGOPT = +LIBS = +PY3 = + +ifeq (,$(PY3)) + PKG1DIR = "py2" +else + PKG1DIR = "py3" +endif + +check: build + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run + +build: + cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' build + +static: + cd $(PKG1DIR) && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT) -relativeimport' LIBS='$(LIBS)' static + +clean: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean + cd py2 && $(MAKE) clean + cd py3 && $(MAKE) clean diff --git a/Examples/python/import_packages/relativeimport3/README b/Examples/python/import_packages/relativeimport3/README new file mode 100644 index 000000000..a99ef2426 --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/README @@ -0,0 +1,22 @@ +This example tests the %import directive and -relativeimport swig option. + +Use 'python runme.py' to run a test. + +Overview: +--------- + +The example defines 2 different extension modules--each wrapping a separate C++ +class. + + pyX/pkg2/pkg3/foo.i - Pkg3_Foo class + pyX/pkg2/bar.i - Pkg2_Bar class derived from Pkg3_Foo + +The code is processed by swig with -relativeimport flag. The runtime test +imports pyX.pkg2.bar module. + +If everything works well, the module pyX.pkg2.bar shall load properly. + +Unix: +----- +- Run make +- Run the test as described above diff --git a/Examples/python/import_packages/relativeimport3/py2/Makefile b/Examples/python/import_packages/relativeimport3/py2/Makefile new file mode 100644 index 000000000..9595397d8 --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/py2/Makefile @@ -0,0 +1,14 @@ +TOP = ../../../.. +SWIG = $(realpath $(TOP)/../preinst-swig) +SWIGOPT = +LIBS = + +build: + cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build + +static: + cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static + +clean: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean + cd pkg2 && $(MAKE) clean diff --git a/Examples/javascript/functor/example.cxx b/Examples/python/import_packages/relativeimport3/py2/__init__.py index e69de29bb..e69de29bb 100644 --- a/Examples/javascript/functor/example.cxx +++ b/Examples/python/import_packages/relativeimport3/py2/__init__.py diff --git a/Examples/python/import_packages/relativeimport3/py2/pkg2/Makefile b/Examples/python/import_packages/relativeimport3/py2/pkg2/Makefile new file mode 100644 index 000000000..36e099b78 --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/py2/pkg2/Makefile @@ -0,0 +1,18 @@ +TOP = ../../../../.. +SWIG = $(realpath $(TOP)/../preinst-swig) +SWIGOPT = +LIBS = + +build: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp + cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build + +static: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp + cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static + +clean: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean + cd pkg3 && $(MAKE) clean diff --git a/Examples/javascript/pointer/typemaps.i b/Examples/python/import_packages/relativeimport3/py2/pkg2/__init__.py index e69de29bb..e69de29bb 100644 --- a/Examples/javascript/pointer/typemaps.i +++ b/Examples/python/import_packages/relativeimport3/py2/pkg2/__init__.py diff --git a/Examples/python/import_packages/relativeimport3/py2/pkg2/bar.hpp b/Examples/python/import_packages/relativeimport3/py2/pkg2/bar.hpp new file mode 100644 index 000000000..8f09cd5fa --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/py2/pkg2/bar.hpp @@ -0,0 +1,5 @@ +#ifndef PY2_PKG2_BAR_HPP +#define PY2_PKG2_BAR_HPP +#include "../../py2/pkg2/pkg3/foo.hpp" +struct Pkg2_Bar : Pkg3_Foo {}; +#endif /* PY2_PKG2_BAR_HPP */ diff --git a/Examples/python/import_packages/relativeimport3/py2/pkg2/bar.i b/Examples/python/import_packages/relativeimport3/py2/pkg2/bar.i new file mode 100644 index 000000000..6f4690b25 --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/py2/pkg2/bar.i @@ -0,0 +1,6 @@ +%module(package="py2.pkg2") bar +%{ +#include "../../py2/pkg2/bar.hpp" +%} +%import (module="foo", package="py2.pkg2.pkg3") "../../py2/pkg2/pkg3/foo.hpp" +%include "../../py2/pkg2/bar.hpp" diff --git a/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/Makefile b/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/Makefile new file mode 100644 index 000000000..cb20bd25f --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/Makefile @@ -0,0 +1,15 @@ +TOP = ../../../../../.. +SWIG = $(realpath $(TOP)/../preinst-swig) +SWIGOPT = +LIBS = + +build: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp + +static: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static + +clean: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean diff --git a/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/__init__.py b/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/__init__.py diff --git a/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/foo.hpp b/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/foo.hpp new file mode 100644 index 000000000..b6c89a431 --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/foo.hpp @@ -0,0 +1,4 @@ +#ifndef PY2_PKG2_PKG3_FOO_HPP +#define PY2_PKG2_PKG3_FOO_HPP +struct Pkg3_Foo {}; +#endif /* PY2_PKG2_PKG3_FOO_HPP */ diff --git a/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/foo.i b/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/foo.i new file mode 100644 index 000000000..ba32483d2 --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/py2/pkg2/pkg3/foo.i @@ -0,0 +1,5 @@ +%module(package="py2.pkg2.pkg3") foo +%{ +#include "../../../py2/pkg2/pkg3/foo.hpp" +%} +%include "../../../py2/pkg2/pkg3/foo.hpp" diff --git a/Examples/python/import_packages/relativeimport3/py3/Makefile b/Examples/python/import_packages/relativeimport3/py3/Makefile new file mode 100644 index 000000000..9595397d8 --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/py3/Makefile @@ -0,0 +1,14 @@ +TOP = ../../../.. +SWIG = $(realpath $(TOP)/../preinst-swig) +SWIGOPT = +LIBS = + +build: + cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build + +static: + cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static + +clean: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean + cd pkg2 && $(MAKE) clean diff --git a/Examples/python/import_packages/relativeimport3/py3/__init__.py b/Examples/python/import_packages/relativeimport3/py3/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/py3/__init__.py diff --git a/Examples/python/import_packages/relativeimport3/py3/pkg2/Makefile b/Examples/python/import_packages/relativeimport3/py3/pkg2/Makefile new file mode 100644 index 000000000..36e099b78 --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/py3/pkg2/Makefile @@ -0,0 +1,18 @@ +TOP = ../../../../.. +SWIG = $(realpath $(TOP)/../preinst-swig) +SWIGOPT = +LIBS = + +build: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp + cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build + +static: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp + cd pkg3 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static + +clean: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='bar' python_clean + cd pkg3 && $(MAKE) clean diff --git a/Examples/python/import_packages/relativeimport3/py3/pkg2/__init__.py b/Examples/python/import_packages/relativeimport3/py3/pkg2/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/py3/pkg2/__init__.py diff --git a/Examples/python/import_packages/relativeimport3/py3/pkg2/bar.hpp b/Examples/python/import_packages/relativeimport3/py3/pkg2/bar.hpp new file mode 100644 index 000000000..408d910d7 --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/py3/pkg2/bar.hpp @@ -0,0 +1,5 @@ +#ifndef PY3_PKG2_BAR_HPP +#define PY3_PKG2_BAR_HPP +#include "../../py3/pkg2/pkg3/foo.hpp" +struct Pkg2_Bar : Pkg3_Foo {}; +#endif /* PY3_PKG2_BAR_HPP */ diff --git a/Examples/python/import_packages/relativeimport3/py3/pkg2/bar.i b/Examples/python/import_packages/relativeimport3/py3/pkg2/bar.i new file mode 100644 index 000000000..157c62e2c --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/py3/pkg2/bar.i @@ -0,0 +1,6 @@ +%module(package="py3.pkg2") bar +%{ +#include "../../py3/pkg2/bar.hpp" +%} +%import (module="foo", package="py3.pkg2.pkg3") "../../py3/pkg2/pkg3/foo.hpp" +%include "../../py3/pkg2/bar.hpp" diff --git a/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/Makefile b/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/Makefile new file mode 100644 index 000000000..cb20bd25f --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/Makefile @@ -0,0 +1,15 @@ +TOP = ../../../../../.. +SWIG = $(realpath $(TOP)/../preinst-swig) +SWIGOPT = +LIBS = + +build: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp + +static: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static + +clean: + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean diff --git a/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/__init__.py b/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/__init__.py new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/__init__.py diff --git a/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/foo.hpp b/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/foo.hpp new file mode 100644 index 000000000..531721d36 --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/foo.hpp @@ -0,0 +1,4 @@ +#ifndef PY3_PKG2_PKG3_FOO_HPP +#define PY3_PKG2_PKG3_FOO_HPP +struct Pkg3_Foo {}; +#endif /* PY3_PKG2_PKG3_FOO_HPP */ diff --git a/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/foo.i b/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/foo.i new file mode 100644 index 000000000..c6ba529b7 --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/py3/pkg2/pkg3/foo.i @@ -0,0 +1,5 @@ +%module(package="py3.pkg2.pkg3") foo +%{ +#include "../../../py3/pkg2/pkg3/foo.hpp" +%} +%include "../../../py3/pkg2/pkg3/foo.hpp" diff --git a/Examples/python/import_packages/relativeimport3/runme.py b/Examples/python/import_packages/relativeimport3/runme.py new file mode 100644 index 000000000..99b6e513e --- /dev/null +++ b/Examples/python/import_packages/relativeimport3/runme.py @@ -0,0 +1,13 @@ +import sys +import os.path + +# Test import of modules content from within __init__.py +testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) +print "Testing " + testname + " - %module(package=...) with -relativeimport" + +if sys.version_info < (3,0): + import py2.pkg2.bar + print " Finished importing py2.pkg2.bar" +else: + import py3.pkg2.bar + print " Finished importing py3.pkg2.bar" diff --git a/Examples/python/import_packages/same_modnames1/Makefile b/Examples/python/import_packages/same_modnames1/Makefile index 9dd5971dc..e05c13017 100644 --- a/Examples/python/import_packages/same_modnames1/Makefile +++ b/Examples/python/import_packages/same_modnames1/Makefile @@ -4,7 +4,7 @@ SWIGOPT = LIBS = check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: cd pkg1 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build @@ -15,6 +15,6 @@ static: cd pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd pkg1 && $(MAKE) clean cd pkg2 && $(MAKE) clean diff --git a/Examples/python/import_packages/same_modnames1/pkg1/Makefile b/Examples/python/import_packages/same_modnames1/pkg1/Makefile index 9b51a76ed..df1b30321 100644 --- a/Examples/python/import_packages/same_modnames1/pkg1/Makefile +++ b/Examples/python/import_packages/same_modnames1/pkg1/Makefile @@ -4,12 +4,12 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean diff --git a/Examples/python/import_packages/same_modnames1/pkg2/Makefile b/Examples/python/import_packages/same_modnames1/pkg2/Makefile index 9b51a76ed..df1b30321 100644 --- a/Examples/python/import_packages/same_modnames1/pkg2/Makefile +++ b/Examples/python/import_packages/same_modnames1/pkg2/Makefile @@ -4,12 +4,12 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean diff --git a/Examples/python/import_packages/same_modnames1/runme.py b/Examples/python/import_packages/same_modnames1/runme.py index 923f0e0bb..7bec1ec1e 100644 --- a/Examples/python/import_packages/same_modnames1/runme.py +++ b/Examples/python/import_packages/same_modnames1/runme.py @@ -1,5 +1,9 @@ +import os.path + # Test import of same modules from different packages -print "Testing %module(package=...) + %import + same modules in different packages" +testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) +print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py" + import pkg2.foo print " Finished importing pkg2.foo" diff --git a/Examples/python/import_packages/same_modnames2/Makefile b/Examples/python/import_packages/same_modnames2/Makefile index cfc327883..770343a80 100644 --- a/Examples/python/import_packages/same_modnames2/Makefile +++ b/Examples/python/import_packages/same_modnames2/Makefile @@ -4,7 +4,7 @@ SWIGOPT = LIBS = check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: cd pkg1 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' build @@ -15,6 +15,6 @@ static: cd pkg1/pkg2 && $(MAKE) SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' LIBS='$(LIBS)' static clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean cd pkg1 && $(MAKE) clean cd pkg1/pkg2 && $(MAKE) clean diff --git a/Examples/python/import_packages/same_modnames2/pkg1/Makefile b/Examples/python/import_packages/same_modnames2/pkg1/Makefile index 9b51a76ed..df1b30321 100644 --- a/Examples/python/import_packages/same_modnames2/pkg1/Makefile +++ b/Examples/python/import_packages/same_modnames2/pkg1/Makefile @@ -4,12 +4,12 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean diff --git a/Examples/python/import_packages/same_modnames2/pkg1/pkg2/Makefile b/Examples/python/import_packages/same_modnames2/pkg1/pkg2/Makefile index 053b911f5..11e8573ad 100644 --- a/Examples/python/import_packages/same_modnames2/pkg1/pkg2/Makefile +++ b/Examples/python/import_packages/same_modnames2/pkg1/pkg2/Makefile @@ -4,12 +4,12 @@ SWIGOPT = LIBS = build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp static: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='foo' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='foo' python_clean diff --git a/Examples/python/import_packages/same_modnames2/runme.py b/Examples/python/import_packages/same_modnames2/runme.py index af8f78194..eec6121eb 100644 --- a/Examples/python/import_packages/same_modnames2/runme.py +++ b/Examples/python/import_packages/same_modnames2/runme.py @@ -1,3 +1,8 @@ +import os.path + +testname = os.path.basename(os.path.dirname(os.path.abspath(__file__))) +print "Testing " + testname + " - %module(package=...) + python 'import' in __init__.py" + import pkg1.pkg2.foo print " Finished importing pkg1.pkg2.foo" diff --git a/Examples/python/import_template/Makefile b/Examples/python/import_template/Makefile index f63e12271..d83dfeaa8 100644 --- a/Examples/python/import_template/Makefile +++ b/Examples/python/import_template/Makefile @@ -4,19 +4,19 @@ SWIGOPT = LIBS = check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='base' INTERFACE='base.i' python_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' python_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' python_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' python_cpp clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean rm -f foo.py bar.py spam.py base.py diff --git a/Examples/python/import_template/base.h b/Examples/python/import_template/base.h index c755a6f9d..8faafb3d7 100644 --- a/Examples/python/import_template/base.h +++ b/Examples/python/import_template/base.h @@ -2,8 +2,8 @@ template<class T> class Base { public: - Base() { }; - virtual ~Base() { }; + Base() { } + virtual ~Base() { } virtual void A() { printf("I'm Base::A\n"); } diff --git a/Examples/python/java/Makefile b/Examples/python/java/Makefile index 12a9b512a..4befa38ba 100644 --- a/Examples/python/java/Makefile +++ b/Examples/python/java/Makefile @@ -6,17 +6,18 @@ INTERFACE = example.i LIBS = -lm check: build + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run -build: Example.class - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' CXX="gcj" \ +build: Example.class Example.h + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ CXXSHARED="gcj -fpic -shared Example.class" DEFS='' LIBS="-lstdc++" python_cpp clean: - $(MAKE) -f $(TOP)/Makefile python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_clean rm -f $(TARGET).py rm -f *.class Example.h -Example.class: Example.java - gcj -fPIC -C -c -g Example.java - gcjh Example +Example.class Example.h: $(SRCDIR)Example.java + gcj -d . -fPIC -C -c -g $(SRCDIR)Example.java + gcjh Example.class diff --git a/Examples/python/java/example.i b/Examples/python/java/example.i index 13d5b5e70..80e08870f 100644 --- a/Examples/python/java/example.i +++ b/Examples/python/java/example.i @@ -7,3 +7,7 @@ %include Example.h + +%extend Example { + ~Example() {} +} diff --git a/Examples/python/libffi/Makefile b/Examples/python/libffi/Makefile index ae51b0a60..db5dfe138 100644 --- a/Examples/python/libffi/Makefile +++ b/Examples/python/libffi/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' LIBS='-L/usr/local/lib -lffi' python static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/multimap/Makefile b/Examples/python/multimap/Makefile index df3bc86ff..222916fa1 100644 --- a/Examples/python/multimap/Makefile +++ b/Examples/python/multimap/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/operator/Makefile b/Examples/python/operator/Makefile index dde0d0910..1234c310e 100644 --- a/Examples/python/operator/Makefile +++ b/Examples/python/operator/Makefile @@ -7,15 +7,15 @@ LIBS = -lm SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/performance/constructor/Makefile b/Examples/python/performance/constructor/Makefile index 98a50ec29..8e65123cf 100644 --- a/Examples/python/performance/constructor/Makefile +++ b/Examples/python/performance/constructor/Makefile @@ -5,17 +5,17 @@ TARGET = Simple INTERFACE = Simple.i build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -module Simple_baseline' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -module Simple_baseline' \ TARGET='$(TARGET)_baseline' INTERFACE='$(INTERFACE)' python_cpp - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -O -module Simple_optimized' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -O -module Simple_optimized' \ TARGET='$(TARGET)_optimized' INTERFACE='$(INTERFACE)' python_cpp - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -builtin -O -module Simple_builtin' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -builtin -O -module Simple_builtin' \ TARGET='$(TARGET)_builtin' INTERFACE='$(INTERFACE)' python_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean rm -f $(TARGET)_*.py diff --git a/Examples/python/performance/func/Makefile b/Examples/python/performance/func/Makefile index 98a50ec29..8e65123cf 100644 --- a/Examples/python/performance/func/Makefile +++ b/Examples/python/performance/func/Makefile @@ -5,17 +5,17 @@ TARGET = Simple INTERFACE = Simple.i build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -module Simple_baseline' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -module Simple_baseline' \ TARGET='$(TARGET)_baseline' INTERFACE='$(INTERFACE)' python_cpp - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -O -module Simple_optimized' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -O -module Simple_optimized' \ TARGET='$(TARGET)_optimized' INTERFACE='$(INTERFACE)' python_cpp - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -builtin -O -module Simple_builtin' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -builtin -O -module Simple_builtin' \ TARGET='$(TARGET)_builtin' INTERFACE='$(INTERFACE)' python_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean rm -f $(TARGET)_*.py diff --git a/Examples/python/performance/hierarchy/Makefile b/Examples/python/performance/hierarchy/Makefile index 98a50ec29..8e65123cf 100644 --- a/Examples/python/performance/hierarchy/Makefile +++ b/Examples/python/performance/hierarchy/Makefile @@ -5,17 +5,17 @@ TARGET = Simple INTERFACE = Simple.i build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -module Simple_baseline' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -module Simple_baseline' \ TARGET='$(TARGET)_baseline' INTERFACE='$(INTERFACE)' python_cpp - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -O -module Simple_optimized' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -O -module Simple_optimized' \ TARGET='$(TARGET)_optimized' INTERFACE='$(INTERFACE)' python_cpp - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -builtin -O -module Simple_builtin' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -builtin -O -module Simple_builtin' \ TARGET='$(TARGET)_builtin' INTERFACE='$(INTERFACE)' python_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean rm -f $(TARGET)_*.py diff --git a/Examples/python/performance/hierarchy_operator/Makefile b/Examples/python/performance/hierarchy_operator/Makefile index 98a50ec29..8e65123cf 100644 --- a/Examples/python/performance/hierarchy_operator/Makefile +++ b/Examples/python/performance/hierarchy_operator/Makefile @@ -5,17 +5,17 @@ TARGET = Simple INTERFACE = Simple.i build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -module Simple_baseline' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -module Simple_baseline' \ TARGET='$(TARGET)_baseline' INTERFACE='$(INTERFACE)' python_cpp - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -O -module Simple_optimized' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -O -module Simple_optimized' \ TARGET='$(TARGET)_optimized' INTERFACE='$(INTERFACE)' python_cpp - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -builtin -O -module Simple_builtin' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -builtin -O -module Simple_builtin' \ TARGET='$(TARGET)_builtin' INTERFACE='$(INTERFACE)' python_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean rm -f $(TARGET)_*.py diff --git a/Examples/python/performance/operator/Makefile b/Examples/python/performance/operator/Makefile index 98a50ec29..8e65123cf 100644 --- a/Examples/python/performance/operator/Makefile +++ b/Examples/python/performance/operator/Makefile @@ -5,17 +5,17 @@ TARGET = Simple INTERFACE = Simple.i build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -module Simple_baseline' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -module Simple_baseline' \ TARGET='$(TARGET)_baseline' INTERFACE='$(INTERFACE)' python_cpp - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -O -module Simple_optimized' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -O -module Simple_optimized' \ TARGET='$(TARGET)_optimized' INTERFACE='$(INTERFACE)' python_cpp - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -builtin -O -module Simple_builtin' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG) -builtin -O -module Simple_builtin' \ TARGET='$(TARGET)_builtin' INTERFACE='$(INTERFACE)' python_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean rm -f $(TARGET)_*.py diff --git a/Examples/python/pointer/Makefile b/Examples/python/pointer/Makefile index df3bc86ff..222916fa1 100644 --- a/Examples/python/pointer/Makefile +++ b/Examples/python/pointer/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/reference/Makefile b/Examples/python/reference/Makefile index e940c1f43..41cded284 100644 --- a/Examples/python/reference/Makefile +++ b/Examples/python/reference/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/reference/example.cxx b/Examples/python/reference/example.cxx index 8a513bf49..9dbaed2ee 100644 --- a/Examples/python/reference/example.cxx +++ b/Examples/python/reference/example.cxx @@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) { char *Vector::print() { static char temp[512]; - sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); + sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z); return temp; } diff --git a/Examples/python/reference/example.h b/Examples/python/reference/example.h index 4915adb1b..bcfcfb72f 100644 --- a/Examples/python/reference/example.h +++ b/Examples/python/reference/example.h @@ -4,8 +4,8 @@ class Vector { private: double x,y,z; public: - Vector() : x(0), y(0), z(0) { }; - Vector(double x, double y, double z) : x(x), y(y), z(z) { }; + Vector() : x(0), y(0), z(0) { } + Vector(double x, double y, double z) : x(x), y(y), z(z) { } friend Vector operator+(const Vector &a, const Vector &b); char *print(); }; @@ -20,7 +20,3 @@ public: Vector &operator[](int); int size(); }; - - - - diff --git a/Examples/python/reference/example.i b/Examples/python/reference/example.i index 8c95b3213..8af8397ec 100644 --- a/Examples/python/reference/example.i +++ b/Examples/python/reference/example.i @@ -31,7 +31,7 @@ public: VectorArray(int maxsize); ~VectorArray(); int size(); - + /* This wrapper provides an alternative to the [] operator */ %extend { Vector &get(int index) { @@ -42,7 +42,3 @@ public: } } }; - - - - diff --git a/Examples/python/simple/Makefile b/Examples/python/simple/Makefile index df3bc86ff..222916fa1 100644 --- a/Examples/python/simple/Makefile +++ b/Examples/python/simple/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/smartptr/Makefile b/Examples/python/smartptr/Makefile index aaba9cbbc..19609353d 100644 --- a/Examples/python/smartptr/Makefile +++ b/Examples/python/smartptr/Makefile @@ -7,15 +7,15 @@ LIBS = -lm SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/smartptr/example.h b/Examples/python/smartptr/example.h index c0f9b1d57..c18e7eaf4 100644 --- a/Examples/python/smartptr/example.h +++ b/Examples/python/smartptr/example.h @@ -7,7 +7,7 @@ public: } virtual ~Shape() { nshapes--; - }; + } double x, y; void move(double dx, double dy); virtual double area() = 0; @@ -19,7 +19,7 @@ class Circle : public Shape { private: double radius; public: - Circle(double r) : radius(r) { }; + Circle(double r) : radius(r) { } virtual double area(); virtual double perimeter(); }; diff --git a/Examples/python/std_map/Makefile b/Examples/python/std_map/Makefile index 86a643415..f406dfaf4 100644 --- a/Examples/python/std_map/Makefile +++ b/Examples/python/std_map/Makefile @@ -7,15 +7,15 @@ LIBS = -lm SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/std_vector/Makefile b/Examples/python/std_vector/Makefile index 86a643415..f406dfaf4 100644 --- a/Examples/python/std_vector/Makefile +++ b/Examples/python/std_vector/Makefile @@ -7,15 +7,15 @@ LIBS = -lm SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/swigrun/Makefile b/Examples/python/swigrun/Makefile deleted file mode 100644 index c58f39caf..000000000 --- a/Examples/python/swigrun/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -TOP = ../.. -SWIG = $(TOP)/../preinst-swig -CXXSRCS = example.cxx -TARGET = example -INTERFACE = example.i -LIBS = -lm -SWIGOPT = - -check: build - $(MAKE) -f $(TOP)/Makefile python_run - -build: - $(SWIG) -python -external-runtime - $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp - -static: - $(MAKE) -f $(TOP)/Makefile $(SWIGLIB) CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - SWIGOPT='$(SWIGOPT)' TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static - -clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean - rm -f swigpyrun.h diff --git a/Examples/python/swigrun/example.cxx b/Examples/python/swigrun/example.cxx deleted file mode 100644 index 25906a559..000000000 --- a/Examples/python/swigrun/example.cxx +++ /dev/null @@ -1,20 +0,0 @@ -/* File : example.cxx */ - -#include <Python.h> -#include "swigpyrun.h" -#include "example.h" - - -Manager* convert_to_Manager(PyObject *py_obj) -{ - Manager* c_ptr; - swig_type_info *ty = SWIG_TypeQuery("Manager *"); - printf("manager ty %p \n", ty); - if (SWIG_ConvertPtr(py_obj, (void **) &c_ptr, ty, 0) == -1) { - c_ptr = 0; - } else { - Py_XINCREF(py_obj); - } - return c_ptr; -} - diff --git a/Examples/python/swigrun/example.h b/Examples/python/swigrun/example.h deleted file mode 100644 index 69e6fe4de..000000000 --- a/Examples/python/swigrun/example.h +++ /dev/null @@ -1,58 +0,0 @@ -/* File : example.h */ - -#include <cstdio> -#include <iostream> -#include <vector> -#include <string> -#include <cmath> - -class Employee { -private: - std::string name; -public: - Employee(const char* n): name(n) {} - virtual std::string getTitle() { return getPosition() + " " + getName(); } - virtual std::string getName() { return name; } - virtual std::string getPosition() const { return "Employee"; } - virtual ~Employee() { printf("~Employee() @ %p\n", this); } -}; - - -class Manager: public Employee { -public: - Manager(const char* n): Employee(n) {} - virtual std::string getPosition() const { return "Manager"; } -}; - - -class EmployeeList { - std::vector<Employee*> list; -public: - EmployeeList() { - list.push_back(new Employee("Bob")); - list.push_back(new Employee("Jane")); - list.push_back(new Manager("Ted")); - } - void addEmployee(Employee *p) { - list.push_back(p); - std::cout << "New employee added. Current employees are:" << std::endl; - std::vector<Employee*>::iterator i; - for (i=list.begin(); i!=list.end(); i++) { - std::cout << " " << (*i)->getTitle() << std::endl; - } - } - const Employee *get_item(int i) { - return list[i]; - } - ~EmployeeList() { - std::vector<Employee*>::iterator i; - std::cout << "~EmployeeList, deleting " << list.size() << " employees." << std::endl; - for (i=list.begin(); i!=list.end(); i++) { - delete *i; - } - std::cout << "~EmployeeList empty." << std::endl; - } -}; - -Manager* convert_to_Manager(PyObject *obj); - diff --git a/Examples/python/swigrun/example.i b/Examples/python/swigrun/example.i deleted file mode 100644 index c8ec32e09..000000000 --- a/Examples/python/swigrun/example.i +++ /dev/null @@ -1,15 +0,0 @@ -/* File : example.i */ -%module(directors="1") example -%{ -#include "example.h" -%} - -%include "std_vector.i" -%include "std_string.i" - -/* turn on director wrapping for Manager */ -%feature("director") Employee; -%feature("director") Manager; - -%include "example.h" - diff --git a/Examples/python/swigrun/runme.py b/Examples/python/swigrun/runme.py deleted file mode 100644 index abcd96463..000000000 --- a/Examples/python/swigrun/runme.py +++ /dev/null @@ -1,28 +0,0 @@ -# file: runme.py - -# This file illustrates the cross language polymorphism using directors. - -import example - - -# CEO class, which overrides Employee::getPosition(). - -class CEO(example.Manager): - def __init__(self, name): - example.Manager.__init__(self, name) - def getPosition(self): - return "CEO" - def __del__(self): - print "CEO.__del__(),", self.getName() - # for proxy class extensions that are not "disowned" and - # define a __del__ method, it is very important to call the - # base class __del__. otherwise the c++ objects will never - # be deleted. - example.Manager.__del__(self) - - - - -e = CEO("Alice") -m = example.convert_to_Manager(e) -print m diff --git a/Examples/python/template/Makefile b/Examples/python/template/Makefile index 86a643415..f406dfaf4 100644 --- a/Examples/python/template/Makefile +++ b/Examples/python/template/Makefile @@ -7,15 +7,15 @@ LIBS = -lm SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='mypython' INTERFACE='$(INTERFACE)' python_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/varargs/Makefile b/Examples/python/varargs/Makefile index 15ffa24c9..8ec6e9cc9 100644 --- a/Examples/python/varargs/Makefile +++ b/Examples/python/varargs/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/variables/Makefile b/Examples/python/variables/Makefile index df3bc86ff..222916fa1 100644 --- a/Examples/python/variables/Makefile +++ b/Examples/python/variables/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile python_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' python_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' python static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='mypython' INTERFACE='$(INTERFACE)' python_static clean: - $(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' python_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' TARGET='$(TARGET)' python_clean diff --git a/Examples/python/variables/example.c b/Examples/python/variables/example.c index 05e17c8c5..85685fe72 100644 --- a/Examples/python/variables/example.c +++ b/Examples/python/variables/example.c @@ -52,9 +52,9 @@ void print_vars() { printf("cvar = %c\n", cvar); printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("cstrvar = %s\n", cstrvar); - printf("iptrvar = %p\n", iptrvar); + printf("iptrvar = %p\n", (void *)iptrvar); printf("name = %s\n", name); - printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); + printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); printf("pt = (%d, %d)\n", pt.x, pt.y); printf("status = %d\n", status); } diff --git a/Examples/r/class/Makefile b/Examples/r/class/Makefile index 8a64f49a9..3e5d6a6ca 100644 --- a/Examples/r/class/Makefile +++ b/Examples/r/class/Makefile @@ -5,11 +5,11 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile r_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' r_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' r_cpp clean: - $(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' r_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INTERFACE='$(INTERFACE)' r_clean diff --git a/Examples/r/class/example.cxx b/Examples/r/class/example.cxx index 1e8e203dd..046304519 100644 --- a/Examples/r/class/example.cxx +++ b/Examples/r/class/example.cxx @@ -1,4 +1,4 @@ -/* File : example.c */ +/* File : example.cxx */ #include "example.h" #define M_PI 3.14159265358979323846 @@ -11,18 +11,18 @@ void Shape::move(double dx, double dy) { int Shape::nshapes = 0; -double Circle::area(void) { +double Circle::area() { return M_PI*radius*radius; } -double Circle::perimeter(void) { +double Circle::perimeter() { return 2*M_PI*radius; } -double Square::area(void) { +double Square::area() { return width*width; } -double Square::perimeter(void) { +double Square::perimeter() { return 4*width; } diff --git a/Examples/r/simple/Makefile b/Examples/r/simple/Makefile index 8a8e0e1c1..5cc41530c 100644 --- a/Examples/r/simple/Makefile +++ b/Examples/r/simple/Makefile @@ -5,11 +5,11 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile r_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' r_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' r clean: - $(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' r_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' INTERFACE='$(INTERFACE)' r_clean diff --git a/Examples/ruby/class/Makefile b/Examples/ruby/class/Makefile index ef267bc44..516f842d7 100644 --- a/Examples/ruby/class/Makefile +++ b/Examples/ruby/class/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/constants/Makefile b/Examples/ruby/constants/Makefile index 7af9ec89e..561d5fd84 100644 --- a/Examples/ruby/constants/Makefile +++ b/Examples/ruby/constants/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/enum/Makefile b/Examples/ruby/enum/Makefile index ef267bc44..516f842d7 100644 --- a/Examples/ruby/enum/Makefile +++ b/Examples/ruby/enum/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/exception_class/Makefile b/Examples/ruby/exception_class/Makefile index f0ae7e573..6723a2a7c 100644 --- a/Examples/ruby/exception_class/Makefile +++ b/Examples/ruby/exception_class/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/free_function/Makefile b/Examples/ruby/free_function/Makefile index ef267bc44..516f842d7 100644 --- a/Examples/ruby/free_function/Makefile +++ b/Examples/ruby/free_function/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/funcptr/Makefile b/Examples/ruby/funcptr/Makefile index ddbc1ae30..15b39cf0d 100644 --- a/Examples/ruby/funcptr/Makefile +++ b/Examples/ruby/funcptr/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/funcptr2/Makefile b/Examples/ruby/funcptr2/Makefile index ddbc1ae30..15b39cf0d 100644 --- a/Examples/ruby/funcptr2/Makefile +++ b/Examples/ruby/funcptr2/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/functor/Makefile b/Examples/ruby/functor/Makefile index 662baa110..348bd66e3 100644 --- a/Examples/ruby/functor/Makefile +++ b/Examples/ruby/functor/Makefile @@ -5,15 +5,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/hashargs/Makefile b/Examples/ruby/hashargs/Makefile index 3933cf279..59a36c0dd 100644 --- a/Examples/ruby/hashargs/Makefile +++ b/Examples/ruby/hashargs/Makefile @@ -7,15 +7,15 @@ LIBS = -lm SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/import/Makefile b/Examples/ruby/import/Makefile index cd7719b5c..b5d06bdd7 100644 --- a/Examples/ruby/import/Makefile +++ b/Examples/ruby/import/Makefile @@ -4,17 +4,17 @@ SWIGOPT = LIBS = check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='base' INTERFACE='base.i' ruby_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' ruby_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' ruby_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' ruby_cpp clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/import_template/Makefile b/Examples/ruby/import_template/Makefile index cd7719b5c..b5d06bdd7 100644 --- a/Examples/ruby/import_template/Makefile +++ b/Examples/ruby/import_template/Makefile @@ -4,17 +4,17 @@ SWIGOPT = LIBS = check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='base' INTERFACE='base.i' ruby_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' ruby_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' ruby_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' ruby_cpp clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/java/Makefile b/Examples/ruby/java/Makefile index 4d2493493..7d611abd2 100644 --- a/Examples/ruby/java/Makefile +++ b/Examples/ruby/java/Makefile @@ -6,17 +6,17 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run -build: Example.class - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' CXX="gcj" \ +build: Example.class Example.h + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ CXXSHARED="gcj -fpic -shared Example.class" LIBS="-lstdc++" DEFS='' ruby_cpp clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean rm -f *.class Example.h -Example.class: Example.java - gcj -fPIC -C -c -g Example.java - gcjh Example +Example.class Example.h: $(SRCDIR)Example.java + gcj -d . -fPIC -C -c -g $(SRCDIR)Example.java + gcjh Example.class diff --git a/Examples/ruby/mark_function/Makefile b/Examples/ruby/mark_function/Makefile index ef267bc44..516f842d7 100644 --- a/Examples/ruby/mark_function/Makefile +++ b/Examples/ruby/mark_function/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/multimap/Makefile b/Examples/ruby/multimap/Makefile index ddbc1ae30..15b39cf0d 100644 --- a/Examples/ruby/multimap/Makefile +++ b/Examples/ruby/multimap/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/operator/Makefile b/Examples/ruby/operator/Makefile index 5fd4b077b..bdcf52646 100644 --- a/Examples/ruby/operator/Makefile +++ b/Examples/ruby/operator/Makefile @@ -7,15 +7,15 @@ LIBS = -lm SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/overloading/Makefile b/Examples/ruby/overloading/Makefile index ef267bc44..516f842d7 100644 --- a/Examples/ruby/overloading/Makefile +++ b/Examples/ruby/overloading/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/pointer/Makefile b/Examples/ruby/pointer/Makefile index ddbc1ae30..15b39cf0d 100644 --- a/Examples/ruby/pointer/Makefile +++ b/Examples/ruby/pointer/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/reference/Makefile b/Examples/ruby/reference/Makefile index ef267bc44..516f842d7 100644 --- a/Examples/ruby/reference/Makefile +++ b/Examples/ruby/reference/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/reference/example.cxx b/Examples/ruby/reference/example.cxx index 8a513bf49..9dbaed2ee 100644 --- a/Examples/ruby/reference/example.cxx +++ b/Examples/ruby/reference/example.cxx @@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) { char *Vector::print() { static char temp[512]; - sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); + sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z); return temp; } diff --git a/Examples/ruby/reference/example.h b/Examples/ruby/reference/example.h index 4915adb1b..bcfcfb72f 100644 --- a/Examples/ruby/reference/example.h +++ b/Examples/ruby/reference/example.h @@ -4,8 +4,8 @@ class Vector { private: double x,y,z; public: - Vector() : x(0), y(0), z(0) { }; - Vector(double x, double y, double z) : x(x), y(y), z(z) { }; + Vector() : x(0), y(0), z(0) { } + Vector(double x, double y, double z) : x(x), y(y), z(z) { } friend Vector operator+(const Vector &a, const Vector &b); char *print(); }; @@ -20,7 +20,3 @@ public: Vector &operator[](int); int size(); }; - - - - diff --git a/Examples/ruby/reference/example.i b/Examples/ruby/reference/example.i index 6daa3b1f4..173143d79 100644 --- a/Examples/ruby/reference/example.i +++ b/Examples/ruby/reference/example.i @@ -29,7 +29,7 @@ public: VectorArray(int maxsize); ~VectorArray(); int size(); - + /* This wrapper provides an alternative to the [] operator */ %extend { Vector &get(int index) { @@ -40,7 +40,3 @@ public: } } }; - - - - diff --git a/Examples/ruby/simple/Makefile b/Examples/ruby/simple/Makefile index ddbc1ae30..15b39cf0d 100644 --- a/Examples/ruby/simple/Makefile +++ b/Examples/ruby/simple/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/std_vector/Makefile b/Examples/ruby/std_vector/Makefile index 208a64495..370bd8fb6 100644 --- a/Examples/ruby/std_vector/Makefile +++ b/Examples/ruby/std_vector/Makefile @@ -7,15 +7,15 @@ LIBS = -lm SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/template/Makefile b/Examples/ruby/template/Makefile index 208a64495..370bd8fb6 100644 --- a/Examples/ruby/template/Makefile +++ b/Examples/ruby/template/Makefile @@ -7,15 +7,15 @@ LIBS = -lm SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ SWIGOPT='$(SWIGOPT)' TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/value/Makefile b/Examples/ruby/value/Makefile index ddbc1ae30..15b39cf0d 100644 --- a/Examples/ruby/value/Makefile +++ b/Examples/ruby/value/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/value/example.i b/Examples/ruby/value/example.i index 98fd60ed5..39663c6b8 100644 --- a/Examples/ruby/value/example.i +++ b/Examples/ruby/value/example.i @@ -26,7 +26,7 @@ Vector *new_Vector(double x, double y, double z) { } void vector_print(Vector *v) { - printf("Vector %p = (%g, %g, %g)\n", v, v->x, v->y, v->z); + printf("Vector %p = (%g, %g, %g)\n", (void *)v, v->x, v->y, v->z); } %} diff --git a/Examples/ruby/variables/Makefile b/Examples/ruby/variables/Makefile index ddbc1ae30..15b39cf0d 100644 --- a/Examples/ruby/variables/Makefile +++ b/Examples/ruby/variables/Makefile @@ -5,15 +5,15 @@ TARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile ruby_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' ruby static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='myruby' INTERFACE='$(INTERFACE)' ruby_static clean: - $(MAKE) -f $(TOP)/Makefile ruby_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' ruby_clean diff --git a/Examples/ruby/variables/example.c b/Examples/ruby/variables/example.c index 05e17c8c5..85685fe72 100644 --- a/Examples/ruby/variables/example.c +++ b/Examples/ruby/variables/example.c @@ -52,9 +52,9 @@ void print_vars() { printf("cvar = %c\n", cvar); printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("cstrvar = %s\n", cstrvar); - printf("iptrvar = %p\n", iptrvar); + printf("iptrvar = %p\n", (void *)iptrvar); printf("name = %s\n", name); - printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); + printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); printf("pt = (%d, %d)\n", pt.x, pt.y); printf("status = %d\n", status); } diff --git a/Examples/tcl/class/Makefile b/Examples/tcl/class/Makefile index db6149cb3..aacf30e04 100644 --- a/Examples/tcl/class/Makefile +++ b/Examples/tcl/class/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile tcl_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tcl_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mytclsh' INTERFACE='$(INTERFACE)' tclsh_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile tcl_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_clean diff --git a/Examples/tcl/constants/Makefile b/Examples/tcl/constants/Makefile index ed4d89f52..17c8afa3f 100644 --- a/Examples/tcl/constants/Makefile +++ b/Examples/tcl/constants/Makefile @@ -6,15 +6,15 @@ DLTARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile tcl_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(DLTARGET)' INTERFACE='$(INTERFACE)' tcl static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tclsh clean: - $(MAKE) -f $(TOP)/Makefile tcl_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_clean diff --git a/Examples/tcl/contract/Makefile b/Examples/tcl/contract/Makefile index ca6134e75..01fdc37b3 100644 --- a/Examples/tcl/contract/Makefile +++ b/Examples/tcl/contract/Makefile @@ -7,15 +7,15 @@ INTERFACE = example.i SWIGOPT = check: build - $(MAKE) -f $(TOP)/Makefile tcl_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ TARGET='$(DLTARGET)' INTERFACE='$(INTERFACE)' tcl static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tclsh clean: - $(MAKE) -f $(TOP)/Makefile tcl_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_clean diff --git a/Examples/tcl/enum/Makefile b/Examples/tcl/enum/Makefile index db6149cb3..aacf30e04 100644 --- a/Examples/tcl/enum/Makefile +++ b/Examples/tcl/enum/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile tcl_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tcl_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mytclsh' INTERFACE='$(INTERFACE)' tclsh_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile tcl_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_clean diff --git a/Examples/tcl/funcptr/Makefile b/Examples/tcl/funcptr/Makefile index 919077918..7155bf3c3 100644 --- a/Examples/tcl/funcptr/Makefile +++ b/Examples/tcl/funcptr/Makefile @@ -6,15 +6,15 @@ DLTARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile tcl_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(DLTARGET)' INTERFACE='$(INTERFACE)' tcl static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tclsh clean: - $(MAKE) -f $(TOP)/Makefile tcl_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_clean diff --git a/Examples/tcl/import/Makefile b/Examples/tcl/import/Makefile index 81cd7c471..6aa48e7a8 100644 --- a/Examples/tcl/import/Makefile +++ b/Examples/tcl/import/Makefile @@ -4,18 +4,18 @@ SWIGOPT = LIBS = check: build - $(MAKE) -f $(TOP)/Makefile tcl_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run build: - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='base' INTERFACE='base.i' tcl_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='foo' INTERFACE='foo.i' tcl_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='bar' INTERFACE='bar.i' tcl_cpp - $(MAKE) -f $(TOP)/Makefile SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \ LIBS='$(LIBS)' TARGET='spam' INTERFACE='spam.i' tcl_cpp clean: - $(MAKE) -f $(TOP)/Makefile tcl_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_clean diff --git a/Examples/tcl/java/Makefile b/Examples/tcl/java/Makefile index 3a9212381..4be3764e2 100644 --- a/Examples/tcl/java/Makefile +++ b/Examples/tcl/java/Makefile @@ -6,20 +6,17 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile tcl_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run -build: Example.class - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ - TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' CXX="gcj" \ - TCL_CXXSHARED="gcj -fpic -shared Example.class " LIBS="-lstdc++" DEFS='' tcl_cpp +build: Example.class Example.h + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' \ + TCLCXXSHARED="gcj -fpic -shared Example.class " LIBS="-lstdc++" DEFS='' tcl_cpp clean: - $(MAKE) -f $(TOP)/Makefile tcl_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_clean rm -f *.class Example.h -run: - tclsh runme.tcl - -Example.class: Example.java - gcj -fPIC -C -c -g Example.java - gcjh Example +Example.class Example.h: $(SRCDIR)Example.java + gcj -d . -fPIC -C -c -g $(SRCDIR)Example.java + gcjh Example.class diff --git a/Examples/tcl/multimap/Makefile b/Examples/tcl/multimap/Makefile index 919077918..7155bf3c3 100644 --- a/Examples/tcl/multimap/Makefile +++ b/Examples/tcl/multimap/Makefile @@ -6,15 +6,15 @@ DLTARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile tcl_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(DLTARGET)' INTERFACE='$(INTERFACE)' tcl static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tclsh clean: - $(MAKE) -f $(TOP)/Makefile tcl_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_clean diff --git a/Examples/tcl/operator/Makefile b/Examples/tcl/operator/Makefile index 6c91c3d21..1c6e1be98 100644 --- a/Examples/tcl/operator/Makefile +++ b/Examples/tcl/operator/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile tcl_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tcl_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mytclsh' INTERFACE='$(INTERFACE)' tclsh_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile tcl_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_clean diff --git a/Examples/tcl/pointer/Makefile b/Examples/tcl/pointer/Makefile index 919077918..7155bf3c3 100644 --- a/Examples/tcl/pointer/Makefile +++ b/Examples/tcl/pointer/Makefile @@ -6,15 +6,15 @@ DLTARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile tcl_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(DLTARGET)' INTERFACE='$(INTERFACE)' tcl static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tclsh clean: - $(MAKE) -f $(TOP)/Makefile tcl_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_clean diff --git a/Examples/tcl/reference/Makefile b/Examples/tcl/reference/Makefile index db6149cb3..aacf30e04 100644 --- a/Examples/tcl/reference/Makefile +++ b/Examples/tcl/reference/Makefile @@ -6,15 +6,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile tcl_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tcl_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='mytclsh' INTERFACE='$(INTERFACE)' tclsh_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile tcl_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_clean diff --git a/Examples/tcl/reference/example.cxx b/Examples/tcl/reference/example.cxx index 8a513bf49..9dbaed2ee 100644 --- a/Examples/tcl/reference/example.cxx +++ b/Examples/tcl/reference/example.cxx @@ -19,7 +19,7 @@ Vector operator+(const Vector &a, const Vector &b) { char *Vector::print() { static char temp[512]; - sprintf(temp,"Vector %p (%g,%g,%g)", this, x,y,z); + sprintf(temp,"Vector %p (%g,%g,%g)", (void *)this, x,y,z); return temp; } diff --git a/Examples/tcl/reference/example.h b/Examples/tcl/reference/example.h index 4915adb1b..bcfcfb72f 100644 --- a/Examples/tcl/reference/example.h +++ b/Examples/tcl/reference/example.h @@ -4,8 +4,8 @@ class Vector { private: double x,y,z; public: - Vector() : x(0), y(0), z(0) { }; - Vector(double x, double y, double z) : x(x), y(y), z(z) { }; + Vector() : x(0), y(0), z(0) { } + Vector(double x, double y, double z) : x(x), y(y), z(z) { } friend Vector operator+(const Vector &a, const Vector &b); char *print(); }; @@ -20,7 +20,3 @@ public: Vector &operator[](int); int size(); }; - - - - diff --git a/Examples/tcl/reference/example.i b/Examples/tcl/reference/example.i index 6daa3b1f4..173143d79 100644 --- a/Examples/tcl/reference/example.i +++ b/Examples/tcl/reference/example.i @@ -29,7 +29,7 @@ public: VectorArray(int maxsize); ~VectorArray(); int size(); - + /* This wrapper provides an alternative to the [] operator */ %extend { Vector &get(int index) { @@ -40,7 +40,3 @@ public: } } }; - - - - diff --git a/Examples/tcl/simple/Makefile b/Examples/tcl/simple/Makefile index 919077918..7155bf3c3 100644 --- a/Examples/tcl/simple/Makefile +++ b/Examples/tcl/simple/Makefile @@ -6,15 +6,15 @@ DLTARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile tcl_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(DLTARGET)' INTERFACE='$(INTERFACE)' tcl static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tclsh clean: - $(MAKE) -f $(TOP)/Makefile tcl_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_clean diff --git a/Examples/tcl/std_vector/Makefile b/Examples/tcl/std_vector/Makefile index a150fc956..f29f933ba 100644 --- a/Examples/tcl/std_vector/Makefile +++ b/Examples/tcl/std_vector/Makefile @@ -7,15 +7,15 @@ INTERFACE = example.i LIBS = -lm check: build - $(MAKE) -f $(TOP)/Makefile tcl_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run build: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(DLTARGET)' INTERFACE='$(INTERFACE)' tcl_cpp static: - $(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tclsh_cpp_static clean: - $(MAKE) -f $(TOP)/Makefile tcl_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_clean diff --git a/Examples/tcl/value/Makefile b/Examples/tcl/value/Makefile index 919077918..7155bf3c3 100644 --- a/Examples/tcl/value/Makefile +++ b/Examples/tcl/value/Makefile @@ -6,15 +6,15 @@ DLTARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile tcl_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(DLTARGET)' INTERFACE='$(INTERFACE)' tcl static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tclsh clean: - $(MAKE) -f $(TOP)/Makefile tcl_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_clean diff --git a/Examples/tcl/value/example.i b/Examples/tcl/value/example.i index 98fd60ed5..39663c6b8 100644 --- a/Examples/tcl/value/example.i +++ b/Examples/tcl/value/example.i @@ -26,7 +26,7 @@ Vector *new_Vector(double x, double y, double z) { } void vector_print(Vector *v) { - printf("Vector %p = (%g, %g, %g)\n", v, v->x, v->y, v->z); + printf("Vector %p = (%g, %g, %g)\n", (void *)v, v->x, v->y, v->z); } %} diff --git a/Examples/tcl/variables/Makefile b/Examples/tcl/variables/Makefile index 919077918..7155bf3c3 100644 --- a/Examples/tcl/variables/Makefile +++ b/Examples/tcl/variables/Makefile @@ -6,15 +6,15 @@ DLTARGET = example INTERFACE = example.i check: build - $(MAKE) -f $(TOP)/Makefile tcl_run + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_run build: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(DLTARGET)' INTERFACE='$(INTERFACE)' tcl static: - $(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \ + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' SRCS='$(SRCS)' SWIG='$(SWIG)' \ TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' tclsh clean: - $(MAKE) -f $(TOP)/Makefile tcl_clean + $(MAKE) -f $(TOP)/Makefile SRCDIR='$(SRCDIR)' tcl_clean diff --git a/Examples/tcl/variables/example.c b/Examples/tcl/variables/example.c index 05e17c8c5..85685fe72 100644 --- a/Examples/tcl/variables/example.c +++ b/Examples/tcl/variables/example.c @@ -52,9 +52,9 @@ void print_vars() { printf("cvar = %c\n", cvar); printf("strvar = %s\n", strvar ? strvar : "(null)"); printf("cstrvar = %s\n", cstrvar); - printf("iptrvar = %p\n", iptrvar); + printf("iptrvar = %p\n", (void *)iptrvar); printf("name = %s\n", name); - printf("ptptr = %p (%d, %d)\n", ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); + printf("ptptr = %p (%d, %d)\n", (void *)ptptr, ptptr ? ptptr->x : 0, ptptr ? ptptr->y : 0); printf("pt = (%d, %d)\n", pt.x, pt.y); printf("status = %d\n", status); } diff --git a/Examples/test-suite/allegrocl/Makefile.in b/Examples/test-suite/allegrocl/Makefile.in index 5f75bfc08..02ef8e302 100644 --- a/Examples/test-suite/allegrocl/Makefile.in +++ b/Examples/test-suite/allegrocl/Makefile.in @@ -5,6 +5,7 @@ LANGUAGE = allegrocl ALLEGROCL = @ALLEGROCLBIN@ SCRIPTSUFFIX = _runme.lisp + srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ @@ -12,7 +13,7 @@ top_builddir = @top_builddir@ # these cpp tests generate warnings/errors when compiling # the wrapper .cxx file. -CPP_TEST_BROKEN_CXX = +CPP_TEST_BROKEN_CXX = # the error is wrap:action code generated by swig. \ # error: can't convert [std::string] 'b' to 'bool' \ # might just need a bool overload op for std::string. \ @@ -71,7 +72,7 @@ CPP_TEST_CASES_ACL_UNSUPPORTED = \ extern_throws \ throw_exception \ using_pointers \ - + C_TEST_CASES_ACL_BROKEN = \ # 'cdate.i' module support \ li_cdata \ @@ -96,7 +97,7 @@ include $(srcdir)/../common.mk # none! # Rules for the different types of tests -%.cpptest: +%.cpptest: $(setup) +$(swig_and_compile_cpp) $(run_testcase) @@ -106,7 +107,7 @@ include $(srcdir)/../common.mk +$(swig_and_compile_c) $(run_testcase) -%.multicpptest: +%.multicpptest: $(setup) +$(swig_and_compile_multi_cpp) $(run_testcase) @@ -114,13 +115,12 @@ include $(srcdir)/../common.mk # Runs the testcase. A testcase is only run if # a file is found which has _runme.lisp appended after the testcase name. run_testcase = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(ALLEGROCLBIN) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(ALLEGROCLBIN) -batch -s $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ fi %.clean: @rm -f $*.cl clean: - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile allegrocl_clean - + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" allegrocl_clean diff --git a/Examples/test-suite/allowexcept.i b/Examples/test-suite/allowexcept.i index 37b01cd75..c901295df 100644 --- a/Examples/test-suite/allowexcept.i +++ b/Examples/test-suite/allowexcept.i @@ -21,7 +21,7 @@ UVW Bar::static_member_variable; %} -// Now test the allowexcept feature by making the usual $action uncompileable and ensuring the %exception is picked up +// Now test the allowexcept feature by making the usual $action uncompilable and ensuring the %exception is picked up struct XYZ { }; diff --git a/Examples/test-suite/autodoc.i b/Examples/test-suite/autodoc.i index 599a3f12f..d85899756 100644 --- a/Examples/test-suite/autodoc.i +++ b/Examples/test-suite/autodoc.i @@ -133,3 +133,11 @@ typedef int Integer; void banana(S *a, const struct tagS *b, int c, Integer d) {} %} +%inline %{ +#ifdef SWIGPYTHON_BUILTIN +bool is_python_builtin() { return true; } +#else +bool is_python_builtin() { return false; } +#endif +%} + diff --git a/Examples/test-suite/cffi/Makefile.in b/Examples/test-suite/cffi/Makefile.in index aa8b40aec..ee7e3f61e 100644 --- a/Examples/test-suite/cffi/Makefile.in +++ b/Examples/test-suite/cffi/Makefile.in @@ -5,6 +5,7 @@ LANGUAGE = cffi CFFI = @CFFIBIN@ SCRIPTSUFFIX = _runme.lisp + srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ @@ -14,13 +15,13 @@ include $(srcdir)/../common.mk # Overridden variables here # no C++ tests for now CPP_TEST_CASES = -#C_TEST_CASES += +#C_TEST_CASES += # Custom tests - tests with additional commandline options # none! # Rules for the different types of tests -%.cpptest: +%.cpptest: $(setup) +$(swig_and_compile_cpp) $(run_testcase) @@ -30,7 +31,7 @@ CPP_TEST_CASES = +$(swig_and_compile_c) $(run_testcase) -%.multicpptest: +%.multicpptest: $(setup) +$(swig_and_compile_multi_cpp) $(run_testcase) @@ -38,14 +39,13 @@ CPP_TEST_CASES = # Runs the testcase. A testcase is only run if # a file is found which has _runme.lisp appended after the testcase name. run_testcase = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CFFI) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CFFI) -batch -s $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ fi # Clean: (does nothing, we dont generate extra cffi code) %.clean: - + @exit 0 clean: - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile cffi_clean - + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" cffi_clean diff --git a/Examples/test-suite/chicken/Makefile.in b/Examples/test-suite/chicken/Makefile.in index 3c2f3de54..31ab311bb 100644 --- a/Examples/test-suite/chicken/Makefile.in +++ b/Examples/test-suite/chicken/Makefile.in @@ -3,12 +3,14 @@ ####################################################################### LANGUAGE = chicken -VARIANT = +VARIANT = SCRIPTSUFFIX = _runme.ss PROXYSUFFIX = _runme_proxy.ss + srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ + CHICKEN_CSI = @CHICKEN_CSI@ -quiet -batch -no-init SO = @SO@ @@ -17,7 +19,7 @@ SO = @SO@ # Skip the STD cases for now, except for li_std_string.i SKIP_CPP_STD_CASES = Yes -CPP_TEST_CASES += li_std_string +CPP_TEST_CASES += li_std_string EXTRA_TEST_CASES += chicken_ext_test.externaltest @@ -39,11 +41,11 @@ SWIGOPT += -nounit %.multiproxy: SCRIPTSUFFIX = $(PROXYSUFFIX) # Rules for the different types of tests -%.cpptest: +%.cpptest: $(setup) +$(swig_and_compile_cpp) $(run_testcase) - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \ $(MAKE) $*.cppproxy; \ fi @@ -51,15 +53,15 @@ SWIGOPT += -nounit $(setup) +$(swig_and_compile_c) $(run_testcase) - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \ $(MAKE) $*.cproxy; \ fi -%.multicpptest: +%.multicpptest: $(setup) +$(swig_and_compile_multi_cpp) $(run_testcase) - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(PROXYSUFFIX) ]; then \ $(MAKE) $*.multiproxy; \ fi @@ -86,14 +88,14 @@ SWIGOPT += -nounit # Runs the testcase. A testcase is only run if # a file is found which has _runme.scm appended after the testcase name. run_testcase = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CHICKEN_CSI) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CHICKEN_CSI) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ fi # Clean %.clean: - + @exit 0 clean: - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile chicken_clean + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" chicken_clean rm -f *.scm diff --git a/Examples/test-suite/clisp/Makefile.in b/Examples/test-suite/clisp/Makefile.in index 24655a60f..6837ed60b 100644 --- a/Examples/test-suite/clisp/Makefile.in +++ b/Examples/test-suite/clisp/Makefile.in @@ -5,6 +5,7 @@ LANGUAGE = clisp CLISP = @CLISPBIN@ SCRIPTSUFFIX = _runme.lisp + srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ @@ -14,13 +15,13 @@ include $(srcdir)/../common.mk # Overridden variables here # no C++ tests for now CPP_TEST_CASES = -#C_TEST_CASES += +#C_TEST_CASES += # Custom tests - tests with additional commandline options # none! # Rules for the different types of tests -%.cpptest: +%.cpptest: $(setup) +$(swig_and_compile_cpp) $(run_testcase) @@ -30,7 +31,7 @@ CPP_TEST_CASES = +$(swig_and_compile_c) $(run_testcase) -%.multicpptest: +%.multicpptest: $(setup) +$(swig_and_compile_multi_cpp) $(run_testcase) @@ -38,14 +39,13 @@ CPP_TEST_CASES = # Runs the testcase. A testcase is only run if # a file is found which has _runme.lisp appended after the testcase name. run_testcase = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CLISP) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(CLISP) -batch -s $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ fi # Clean: (does nothing, we dont generate extra clisp code) %.clean: - + @exit 0 clean: - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile clisp_clean - + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" clisp_clean diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index 2a4591524..ac2dfd4dd 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -69,7 +69,13 @@ INCLUDES = -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE) LIBS = -L. LIBPREFIX = lib ACTION = check -INTERFACEDIR = $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/ +INTERFACEDIR = ../ +SRCDIR = $(srcdir)/ +SCRIPTDIR = $(srcdir) + +# Regenerate Makefile if Makefile.in or config.status have changed. +Makefile: $(srcdir)/Makefile.in ../../../config.status + cd ../../../ && $(SHELL) ./config.status $(EXAMPLES)/$(TEST_SUITE)/$(LANGUAGE)/Makefile # # Please keep test cases in alphabetical order. @@ -80,6 +86,7 @@ INTERFACEDIR = $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/ CPP_TEST_BROKEN += \ constants \ cpp_broken \ + director_nested_class \ exception_partial_info \ extend_variable \ li_std_vector_ptr \ @@ -136,6 +143,7 @@ CPP_TEST_CASES += \ class_scope_weird \ compactdefaultargs \ const_const_2 \ + constant_directive \ constant_pointers \ constover \ constructor_copy \ @@ -166,6 +174,7 @@ CPP_TEST_CASES += \ director_abstract \ director_alternating \ director_basic \ + director_property \ director_binary_string \ director_classes \ director_classic \ @@ -204,6 +213,7 @@ CPP_TEST_CASES += \ enum_template \ enum_thorough \ enum_var \ + equality \ evil_diamond \ evil_diamond_ns \ evil_diamond_prop \ @@ -241,6 +251,7 @@ CPP_TEST_CASES += \ insert_directive \ keyword_rename \ kind \ + kwargs_feature \ langobj \ li_attribute \ li_attribute_template \ @@ -288,6 +299,7 @@ CPP_TEST_CASES += \ nested_directors \ nested_comment \ nested_scope \ + nested_template_base \ nested_workaround \ newobject1 \ null_pointer \ @@ -301,6 +313,7 @@ CPP_TEST_CASES += \ overload_extend \ overload_method \ overload_numeric \ + overload_polymorphic \ overload_rename \ overload_return_type \ overload_simple \ @@ -371,6 +384,7 @@ CPP_TEST_CASES += \ template_classes \ template_const_ref \ template_construct \ + template_templated_constructors \ template_default \ template_default2 \ template_default_arg \ @@ -409,7 +423,6 @@ CPP_TEST_CASES += \ template_partial_specialization \ template_partial_specialization_typedef \ template_qualifier \ - template_qualifier \ template_ref_type \ template_rename \ template_retvalue \ @@ -468,6 +481,7 @@ CPP_TEST_CASES += \ typemap_various \ typename \ types_directive \ + unicode_strings \ union_scope \ using1 \ using2 \ @@ -518,6 +532,7 @@ CPP11_TEST_CASES = \ cpp11_rvalue_reference3 \ cpp11_sizeof_object \ cpp11_static_assert \ + cpp11_strongly_typed_enumerations \ cpp11_thread_local \ cpp11_template_double_brackets \ cpp11_template_explicit \ @@ -530,7 +545,6 @@ CPP11_TEST_CASES = \ # Broken C++11 test cases. CPP11_TEST_BROKEN = \ # cpp11_hash_tables \ # not fully implemented yet -# cpp11_strongly_typed_enumerations \ # SWIG not quite getting this right yet in all langs # cpp11_variadic_templates \ # Broken for some languages (such as Java) # cpp11_reference_wrapper \ # No typemaps @@ -602,6 +616,7 @@ C_TEST_CASES += \ memberin_extend_c \ name \ nested \ + nested_extend_c \ nested_structs \ newobject2 \ overload_extend \ @@ -682,14 +697,14 @@ partialcheck: $(MAKE) check CC=true CXX=true LDSHARED=true CXXSHARED=true RUNTOOL=true COMPILETOOL=true swig_and_compile_cpp = \ - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \ + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CXXSRCS="$(CXXSRCS)" \ SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \ INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \ TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \ $(LANGUAGE)$(VARIANT)_cpp swig_and_compile_c = \ - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CSRCS="$(CSRCS)" \ + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CSRCS="$(CSRCS)" \ SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \ INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \ TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \ @@ -697,7 +712,7 @@ swig_and_compile_c = \ swig_and_compile_multi_cpp = \ for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \ - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \ + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CXXSRCS="$(CXXSRCS)" \ SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" LIBS='$(LIBS)' \ INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \ TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$$f.i" \ @@ -705,11 +720,11 @@ swig_and_compile_multi_cpp = \ done swig_and_compile_external = \ - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \ + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" \ SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \ TARGET="$*_wrap_hdr.h" \ $(LANGUAGE)$(VARIANT)_externalhdr; \ - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS) $*_external.cxx" \ + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CXXSRCS="$(CXXSRCS) $*_external.cxx" \ SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" \ INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \ TARGET="$(TARGETPREFIX)$*$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$*.i" \ @@ -718,7 +733,7 @@ swig_and_compile_external = \ swig_and_compile_runtime = \ setup = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \ else \ echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \ diff --git a/Examples/test-suite/constant_directive.i b/Examples/test-suite/constant_directive.i new file mode 100644 index 000000000..8204720d6 --- /dev/null +++ b/Examples/test-suite/constant_directive.i @@ -0,0 +1,28 @@ +%module constant_directive + +// %constant and struct +%{ + struct Type1 { + Type1(int val = 0) : val(val) {} + int val; + }; + static Type1 TYPE1_CONSTANT1(1); + static Type1 TYPE1_CONST2(2); + static Type1 TYPE1_CONST3(3); +%} + +struct Type1 { + Type1(int val = 0) : val(val) {} + int val; +}; + +%inline %{ +Type1 getType1Instance() { return Type1(111); } +%} + +%constant Type1 TYPE1_CONSTANT1; +%constant Type1 TYPE1_CONSTANT2 = TYPE1_CONST2; +%constant Type1 *TYPE1_CONSTANT3 = &TYPE1_CONST3; + +%constant int TYPE_INT = 0; + diff --git a/Examples/test-suite/cpp11_constexpr.i b/Examples/test-suite/cpp11_constexpr.i index 412b8132a..d91107cc6 100644 --- a/Examples/test-suite/cpp11_constexpr.i +++ b/Examples/test-suite/cpp11_constexpr.i @@ -18,6 +18,12 @@ struct ConstExpressions { static const int LLL = 300; constexpr int MMM() { return 400; } constexpr const int NNN() { return 500; } + // Regression tests for support added in SWIG 3.0.4: + static constexpr const int JJJ1 = 101; + constexpr static int KKK1 = 201; + // Regression tests for https://github.com/swig/swig/issues/284 : + explicit constexpr ConstExpressions(int) { } + constexpr explicit ConstExpressions(double) { } }; %} diff --git a/Examples/test-suite/cpp11_function_objects.i b/Examples/test-suite/cpp11_function_objects.i index fb75edea6..e80f60a2f 100644 --- a/Examples/test-suite/cpp11_function_objects.i +++ b/Examples/test-suite/cpp11_function_objects.i @@ -3,25 +3,31 @@ Function objects are objects which overload the operator() function. The std::function does not provide any seamless support in the target languages yet. */ -%module cpp11_function_objects +%module(directors="1") cpp11_function_objects %rename(__call__) Test::operator(); +%feature("director") Test; + %inline %{ -struct Test { +class Test { +public: int value; - void operator()(int x, int y) { + virtual void operator()(int x, int y) { value=x+y; } Test() : value(0) {} -} test; + virtual ~Test() {} +}; + +Test test; #include <functional> std::function<void ( int, int )> pF = test; -int testit1(Test new_test, int a, int b) { - pF = new_test; +int testit1(Test &new_test, int a, int b) { + pF = std::ref(new_test); pF(a, b); return new_test.value; } diff --git a/Examples/test-suite/cpp11_strongly_typed_enumerations.i b/Examples/test-suite/cpp11_strongly_typed_enumerations.i index ed466369e..3a4ee107a 100644 --- a/Examples/test-suite/cpp11_strongly_typed_enumerations.i +++ b/Examples/test-suite/cpp11_strongly_typed_enumerations.i @@ -1,11 +1,9 @@ -/* This testcase checks whether SWIG produces the correct wrapper for the - strongly typed enums. Enums with the same type are comparable. Enum classes - require support for nested classes. */ +// This testcase checks whether SWIG produces the correct wrappers for strongly typed enums. + %module cpp11_strongly_typed_enumerations -%warnfilter(302) Val1; -%warnfilter(302) Val2; -%warnfilter(302) Val3; -%warnfilter(302) Val4; + +%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Class1::Struct1; +%warnfilter(SWIGWARN_PARSE_NAMED_NESTED_CLASS) Class2::Struct1; /* Forward declarations (illegally accepted by SWIG - oh well!) */ enum Enum1 : short; @@ -17,15 +15,19 @@ enum : unsigned short; enum class Enum1 { Val1, Val2, - Val3 = 100, - Val4 /* = 101 */ + Val3 = 13, + Val4, + Val5a = 13, + Val6a }; enum class Enum2 : short { Val1, Val2, - Val3 = 100, - Val4 + Val3 = 23, + Val4, + Val5b = 23, + Val6b }; %} @@ -39,24 +41,24 @@ enum class Enum5; // Legal in C++11, because enum class declarati enum class Enum6 : unsigned int; // Legal C++11. enum Enum4 : unsigned int { - Val1, Val2, Val3 = 100, Val4 + Val1, Val2, Val3 = 43, Val4 }; enum class Enum5 { - Val1, Val2, Val3 = 100, Val4 + Val1, Val2, Val3 = 53, Val4 }; enum class Enum6 : unsigned int { - Val1, Val2, Val3 = 300, Val4 + Val1, Val2, Val3 = 63, Val4 }; typedef enum class Enum7 : unsigned int { - Val1, Val2, Val3 = 300, Val4 + Val1, Val2, Val3 = 73, Val4 } Enum7td; // enum inherits from non-primitive type enum class Enum8 : size_t { - Val1, Val2, Val3 = 300, Val4 + Val1, Val2, Val3 = 83, Val4 }; template <typename T> struct TType { @@ -64,7 +66,7 @@ template <typename T> struct TType { }; enum class Enum10 : TType<int>::type_name { - Val1, Val2, Val3 = 300, Val4 + Val1, Val2, Val3 = 103, Val4 }; // forward declaration, no definition of enum @@ -73,15 +75,144 @@ struct UseEnum11 { Enum11 myenum11; }; -/* -TODO -enum class MyClass {AAA, BBB, CCC}; -namespace Space { -enum MyEnum {XXX, YYY, ZZZ}; -} -struct SSS { - MyClass m; +class Class1 +{ +public: + enum class Enum12 + { + Val1 = 1121, + Val2 = 1122, + Val3, + Val4, + Val5c = 1121, + Val6c + }; + + enum Enum13 + { + Val1 = 1131, + Val2 = 1132, + Val3, + Val4, + Val5d = 1131, + Val6d + }; + + enum class Enum14 + { + Val1 = 1141, + Val2 = 1142, + Val3, + Val4, + Val5e = 1141, + Val6e + }; + + struct Struct1 + { + enum class Enum12 + { + Val1 = 3121, + Val2 = 3122, + Val3, + Val4, + Val5f = 3121, + Val6f + }; + + enum Enum13 + { + Val1 = 3131, + Val2 = 3132, + Val3, + Val4, + }; + + enum class Enum14 + { + Val1 = 3141, + Val2 = 3142, + Val3, + Val4, + Val5g = 3141, + Val6g + }; + }; + Enum1 class1Test1(Enum1 e) { return e; } + Enum12 class1Test2(Enum12 e) { return e; } + Struct1::Enum12 class1Test3(Struct1::Enum12 e) { return e; } +}; + +class Class2 +{ +public: + enum class Enum12 + { + Val1 = 2121, + Val2 = 2122, + Val3, + Val4, + Val5h = 2121, + Val6h + }; + + enum Enum13 + { + Val1 = 2131, + Val2 = 2132, + Val3, + Val4, + Val5i = 2131, + Val6i + }; + + enum class Enum14 + { + Val1 = 2141, + Val2 = 2142, + Val3, + Val4, + Val5j = 2141, + Val6j + }; + + struct Struct1 + { + enum class Enum12 + { + Val1 = 4121, + Val2 = 4122, + Val3, + Val4, + Val5k = 4121, + Val6k + }; + + enum Enum13 + { + Val1 = 4131, + Val2 = 4132, + Val3, + Val4, + Val5l = 4131, + Val6l + }; + + enum class Enum14 + { + Val1 = 4141, + Val2 = 4142, + Val3, + Val4, + Val5m = 4141, + Val6m + }; + }; }; -*/ + +Enum1 globalTest1(Enum1 e) { return e; } +Class1::Enum12 globalTest2(Class1::Enum12 e) { return e; } +Class1::Struct1::Enum12 globalTest3(Class1::Struct1::Enum12 e) { return e; } + %} diff --git a/Examples/test-suite/cpp11_strongly_typed_enumerations_simple.i b/Examples/test-suite/cpp11_strongly_typed_enumerations_simple.i new file mode 100644 index 000000000..3848d2940 --- /dev/null +++ b/Examples/test-suite/cpp11_strongly_typed_enumerations_simple.i @@ -0,0 +1,5 @@ +%module cpp11_strongly_typed_enumerations_simple + +%include <enumsimple.swg> + +%include "cpp11_strongly_typed_enumerations.i" diff --git a/Examples/test-suite/csharp/Makefile.in b/Examples/test-suite/csharp/Makefile.in index 993699bc8..292c751e4 100644 --- a/Examples/test-suite/csharp/Makefile.in +++ b/Examples/test-suite/csharp/Makefile.in @@ -8,6 +8,7 @@ CSHARPCILINTERPRETER = @CSHARPCILINTERPRETER@ CSHARPCILINTERPRETER_FLAGS = @CSHARPCILINTERPRETER_FLAGS@ CSHARPPATHSEPARATOR = "@CSHARPPATHSEPARATOR@" CSHARPCYGPATH_W = @CSHARPCYGPATH_W@ + srcdir = @srcdir@ top_srcdir = ../@top_srcdir@ top_builddir = ../@top_builddir@ @@ -27,9 +28,13 @@ CPP_TEST_CASES = \ intermediary_classname \ li_boost_intrusive_ptr +CPP11_TEST_CASES = \ + cpp11_strongly_typed_enumerations_simple \ + include $(srcdir)/../common.mk # Overridden variables here +SRCDIR = ../$(srcdir)/ SWIGOPT += -namespace $*Namespace CSHARPFLAGSSPECIAL = @@ -40,7 +45,7 @@ csharp_lib_arrays.cpptest: CSHARPFLAGSSPECIAL = -unsafe csharp_swig2_compatibility.cpptest: SWIGOPT += -DSWIG2_CSHARP # Rules for the different types of tests -%.cpptest: +%.cpptest: $(setup) +(cd $* && $(swig_and_compile_cpp)) +$(run_testcase) @@ -50,14 +55,14 @@ csharp_swig2_compatibility.cpptest: SWIGOPT += -DSWIG2_CSHARP +(cd $* && $(swig_and_compile_c)) +$(run_testcase) -%.multicpptest: +%.multicpptest: $(setup) +(cd $* && $(swig_and_compile_multi_cpp)) +$(run_testcase) # Makes a directory for the testcase if it does not exist setup = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \ else \ echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \ @@ -71,10 +76,10 @@ setup = \ # Note C# uses LD_LIBRARY_PATH under Unix, PATH under Cygwin/Windows and SHLIB_PATH on HPUX. # DYLD_FALLBACK_LIBRARY_PATH is cleared for MacOSX. run_testcase = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ $(MAKE) -f $*/$(top_builddir)/$(EXAMPLES)/Makefile \ CSHARPFLAGS='-nologo -debug+ $(CSHARPFLAGSSPECIAL) -out:$*_runme.exe' \ - CSHARPSRCS='`$(CSHARPCYGPATH_W) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)` `find $* -name "*.cs" -exec $(CSHARPCYGPATH_W) "{}" \+`' csharp_compile && \ + CSHARPSRCS='`$(CSHARPCYGPATH_W) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX)` `find $* -name "*.cs" -exec $(CSHARPCYGPATH_W) "{}" \+`' csharp_compile && \ env LD_LIBRARY_PATH="$*:$$LD_LIBRARY_PATH" PATH="$*:$$PATH" SHLIB_PATH="$*:$$SHLIB_PATH" DYLD_FALLBACK_LIBRARY_PATH= $(RUNTOOL) $(CSHARPCILINTERPRETER) $(CSHARPCILINTERPRETER_FLAGS) ./$*_runme.exe; \ else \ cd $* && \ diff --git a/Examples/test-suite/csharp/cpp11_strongly_typed_enumerations_runme.cs b/Examples/test-suite/csharp/cpp11_strongly_typed_enumerations_runme.cs new file mode 100644 index 000000000..f2c25e7a2 --- /dev/null +++ b/Examples/test-suite/csharp/cpp11_strongly_typed_enumerations_runme.cs @@ -0,0 +1,169 @@ +using System; +using cpp11_strongly_typed_enumerationsNamespace; + +public class cpp11_strongly_typed_enumerations_runme { + + public static int enumCheck(int actual, int expected) { + if (actual != expected) + throw new ApplicationException("Enum value mismatch. Expected " + expected + " Actual: " + actual); + return expected + 1; + } + + public static void Main() { + int val = 0; + val = enumCheck((int)Enum1.Val1, val); + val = enumCheck((int)Enum1.Val2, val); + val = enumCheck((int)Enum1.Val3, 13); + val = enumCheck((int)Enum1.Val4, val); + val = enumCheck((int)Enum1.Val5a, 13); + val = enumCheck((int)Enum1.Val6a, val); + + val = 0; + val = enumCheck((int)Enum2.Val1, val); + val = enumCheck((int)Enum2.Val2, val); + val = enumCheck((int)Enum2.Val3, 23); + val = enumCheck((int)Enum2.Val4, val); + val = enumCheck((int)Enum2.Val5b, 23); + val = enumCheck((int)Enum2.Val6b, val); + + val = 0; + val = enumCheck((int)Enum4.Val1, val); + val = enumCheck((int)Enum4.Val2, val); + val = enumCheck((int)Enum4.Val3, 43); + val = enumCheck((int)Enum4.Val4, val); + + val = 0; + val = enumCheck((int)Enum5.Val1, val); + val = enumCheck((int)Enum5.Val2, val); + val = enumCheck((int)Enum5.Val3, 53); + val = enumCheck((int)Enum5.Val4, val); + + val = 0; + val = enumCheck((int)Enum6.Val1, val); + val = enumCheck((int)Enum6.Val2, val); + val = enumCheck((int)Enum6.Val3, 63); + val = enumCheck((int)Enum6.Val4, val); + + val = 0; + val = enumCheck((int)Enum7td.Val1, val); + val = enumCheck((int)Enum7td.Val2, val); + val = enumCheck((int)Enum7td.Val3, 73); + val = enumCheck((int)Enum7td.Val4, val); + + val = 0; + val = enumCheck((int)Enum8.Val1, val); + val = enumCheck((int)Enum8.Val2, val); + val = enumCheck((int)Enum8.Val3, 83); + val = enumCheck((int)Enum8.Val4, val); + + val = 0; + val = enumCheck((int)Enum10.Val1, val); + val = enumCheck((int)Enum10.Val2, val); + val = enumCheck((int)Enum10.Val3, 103); + val = enumCheck((int)Enum10.Val4, val); + + val = 0; + val = enumCheck((int)Class1.Enum12.Val1, 1121); + val = enumCheck((int)Class1.Enum12.Val2, 1122); + val = enumCheck((int)Class1.Enum12.Val3, val); + val = enumCheck((int)Class1.Enum12.Val4, val); + val = enumCheck((int)Class1.Enum12.Val5c, 1121); + val = enumCheck((int)Class1.Enum12.Val6c, val); + + val = 0; + val = enumCheck((int)Class1.Enum13.Val1, 1131); + val = enumCheck((int)Class1.Enum13.Val2, 1132); + val = enumCheck((int)Class1.Enum13.Val3, val); + val = enumCheck((int)Class1.Enum13.Val4, val); + val = enumCheck((int)Class1.Enum13.Val5d, 1131); + val = enumCheck((int)Class1.Enum13.Val6d, val); + + val = 0; + val = enumCheck((int)Class1.Enum14.Val1, 1141); + val = enumCheck((int)Class1.Enum14.Val2, 1142); + val = enumCheck((int)Class1.Enum14.Val3, val); + val = enumCheck((int)Class1.Enum14.Val4, val); + val = enumCheck((int)Class1.Enum14.Val5e, 1141); + val = enumCheck((int)Class1.Enum14.Val6e, val); + + val = 0; + val = enumCheck((int)Class1.Struct1.Enum12.Val1, 3121); + val = enumCheck((int)Class1.Struct1.Enum12.Val2, 3122); + val = enumCheck((int)Class1.Struct1.Enum12.Val3, val); + val = enumCheck((int)Class1.Struct1.Enum12.Val4, val); + val = enumCheck((int)Class1.Struct1.Enum12.Val5f, 3121); + val = enumCheck((int)Class1.Struct1.Enum12.Val6f, val); + + val = 0; + val = enumCheck((int)Class1.Struct1.Enum13.Val1, 3131); + val = enumCheck((int)Class1.Struct1.Enum13.Val2, 3132); + val = enumCheck((int)Class1.Struct1.Enum13.Val3, val); + val = enumCheck((int)Class1.Struct1.Enum13.Val4, val); + + val = 0; + val = enumCheck((int)Class1.Struct1.Enum14.Val1, 3141); + val = enumCheck((int)Class1.Struct1.Enum14.Val2, 3142); + val = enumCheck((int)Class1.Struct1.Enum14.Val3, val); + val = enumCheck((int)Class1.Struct1.Enum14.Val4, val); + val = enumCheck((int)Class1.Struct1.Enum14.Val5g, 3141); + val = enumCheck((int)Class1.Struct1.Enum14.Val6g, val); + + val = 0; + val = enumCheck((int)Class2.Enum12.Val1, 2121); + val = enumCheck((int)Class2.Enum12.Val2, 2122); + val = enumCheck((int)Class2.Enum12.Val3, val); + val = enumCheck((int)Class2.Enum12.Val4, val); + val = enumCheck((int)Class2.Enum12.Val5h, 2121); + val = enumCheck((int)Class2.Enum12.Val6h, val); + + val = 0; + val = enumCheck((int)Class2.Enum13.Val1, 2131); + val = enumCheck((int)Class2.Enum13.Val2, 2132); + val = enumCheck((int)Class2.Enum13.Val3, val); + val = enumCheck((int)Class2.Enum13.Val4, val); + val = enumCheck((int)Class2.Enum13.Val5i, 2131); + val = enumCheck((int)Class2.Enum13.Val6i, val); + + val = 0; + val = enumCheck((int)Class2.Enum14.Val1, 2141); + val = enumCheck((int)Class2.Enum14.Val2, 2142); + val = enumCheck((int)Class2.Enum14.Val3, val); + val = enumCheck((int)Class2.Enum14.Val4, val); + val = enumCheck((int)Class2.Enum14.Val5j, 2141); + val = enumCheck((int)Class2.Enum14.Val6j, val); + + val = 0; + val = enumCheck((int)Class2.Struct1.Enum12.Val1, 4121); + val = enumCheck((int)Class2.Struct1.Enum12.Val2, 4122); + val = enumCheck((int)Class2.Struct1.Enum12.Val3, val); + val = enumCheck((int)Class2.Struct1.Enum12.Val4, val); + val = enumCheck((int)Class2.Struct1.Enum12.Val5k, 4121); + val = enumCheck((int)Class2.Struct1.Enum12.Val6k, val); + + val = 0; + val = enumCheck((int)Class2.Struct1.Enum13.Val1, 4131); + val = enumCheck((int)Class2.Struct1.Enum13.Val2, 4132); + val = enumCheck((int)Class2.Struct1.Enum13.Val3, val); + val = enumCheck((int)Class2.Struct1.Enum13.Val4, val); + val = enumCheck((int)Class2.Struct1.Enum13.Val5l, 4131); + val = enumCheck((int)Class2.Struct1.Enum13.Val6l, val); + + val = 0; + val = enumCheck((int)Class2.Struct1.Enum14.Val1, 4141); + val = enumCheck((int)Class2.Struct1.Enum14.Val2, 4142); + val = enumCheck((int)Class2.Struct1.Enum14.Val3, val); + val = enumCheck((int)Class2.Struct1.Enum14.Val4, val); + val = enumCheck((int)Class2.Struct1.Enum14.Val5m, 4141); + val = enumCheck((int)Class2.Struct1.Enum14.Val6m, val); + + Class1 class1 = new Class1(); + enumCheck((int)class1.class1Test1(Enum1.Val5a), 13); + enumCheck((int)class1.class1Test2(Class1.Enum12.Val5c), 1121); + enumCheck((int)class1.class1Test3(Class1.Struct1.Enum12.Val5f), 3121); + + enumCheck((int)cpp11_strongly_typed_enumerations.globalTest1(Enum1.Val5a), 13); + enumCheck((int)cpp11_strongly_typed_enumerations.globalTest2(Class1.Enum12.Val5c), 1121); + enumCheck((int)cpp11_strongly_typed_enumerations.globalTest3(Class1.Struct1.Enum12.Val5f), 3121); + } +} + diff --git a/Examples/test-suite/csharp/csharp_exceptions_runme.cs b/Examples/test-suite/csharp/csharp_exceptions_runme.cs index 43585b106..51805ce87 100644 --- a/Examples/test-suite/csharp/csharp_exceptions_runme.cs +++ b/Examples/test-suite/csharp/csharp_exceptions_runme.cs @@ -323,7 +323,9 @@ public class TestThread { } catch (ArgumentOutOfRangeException e) { String expectedMessage = "caught:" + i + "\n" + "Parameter name: input"; if (e.Message.Replace(runme.CRLF,"\n") != expectedMessage) - throw new Exception("Exception message incorrect. Expected:\n[" + expectedMessage + "]\n" + "Received:\n[" + e.Message + "]"); + throw new Exception("Exception message incorrect. Expected:\n[" + + expectedMessage + "]\n" + "Received:\n[" + + e.Message + "]"); if (e.ParamName != "input") throw new Exception("Exception ParamName incorrect. Expected:\n[input]\n" + "Received:\n[" + e.ParamName + "]"); if (e.InnerException != null) @@ -333,7 +335,7 @@ public class TestThread { throw new Exception("throwsException.dub = " + throwsClass.dub + " expected: 1234.5678"); } } catch (Exception e) { - Console.Error.WriteLine("Test failed (thread " + threadId + "): " + e.Message); + Console.Error.WriteLine("Test failed (thread " + threadId + "): " + e.Message + "\n TestThread Inner stack trace: " + e.StackTrace); Failed = true; } } diff --git a/Examples/test-suite/d/Makefile.in b/Examples/test-suite/d/Makefile.in index 61c2749dc..3333df110 100644 --- a/Examples/test-suite/d/Makefile.in +++ b/Examples/test-suite/d/Makefile.in @@ -3,17 +3,22 @@ ####################################################################### LANGUAGE = d + srcdir = @srcdir@ top_srcdir = ../@top_srcdir@ top_builddir = ../@top_builddir@ +ifeq (,$(D_VERSION)) + D_VERSION = @DDEFAULTVERSION@ +endif + ifeq (2,$(D_VERSION)) VERSIONSUFFIX = .2 else VERSIONSUFFIX = .1 endif -TESTSUFFIX = _runme$(VERSIONSUFFIX).d +SCRIPTSUFFIX = _runme$(VERSIONSUFFIX).d CPP_TEST_CASES = \ d_nativepointers \ @@ -21,10 +26,9 @@ CPP_TEST_CASES = \ include $(srcdir)/../common.mk -# Override some variables from common.mk: - +# Overridden variables here +SRCDIR = ../$(srcdir)/ TARGETSUFFIX = _wrap - SWIGOPT+=-splitproxy -package $* # Rules for the different types of tests @@ -45,7 +49,7 @@ SWIGOPT+=-splitproxy -package $* # Makes a directory for the testcase if it does not exist setup = \ - if [ -f $(srcdir)/$(TESTPREFIX)$*$(TESTSUFFIX) ]; then \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \ else \ echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \ @@ -60,11 +64,11 @@ setup = \ # Compiles D files then runs the testcase. A testcase is only run if # a file is found which has _runme.d appended after the testcase name. run_testcase = \ - if [ -f $(srcdir)/$(TESTPREFIX)$*$(TESTSUFFIX) ]; then \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ cd $*$(VERSIONSUFFIX) && \ $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile \ DFLAGS='-of$*_runme' \ - DSRCS='../$(srcdir)/$(TESTPREFIX)$*$(TESTSUFFIX) `find $* -name *.d`' d_compile && \ + DSRCS='../$(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) `find $* -name *.d`' d_compile && \ env LD_LIBRARY_PATH=".:$$LD_LIBRARY_PATH" $(RUNTOOL) ./$*_runme; \ else \ cd $*$(VERSIONSUFFIX) && \ diff --git a/Examples/test-suite/d/li_boost_shared_ptr_runme.2.d b/Examples/test-suite/d/li_boost_shared_ptr_runme.2.d index 0027aad05..028929543 100644 --- a/Examples/test-suite/d/li_boost_shared_ptr_runme.2.d +++ b/Examples/test-suite/d/li_boost_shared_ptr_runme.2.d @@ -2,6 +2,7 @@ module li_boost_shared_ptr_runme; import core.memory; import core.thread; +import core.time; import std.conv; import std.exception; import std.stdio; @@ -31,15 +32,6 @@ void main() { if (TRACE) writeln("---> NEARLY FINISHED <---"); - // Try to get the GC to collect everything not referenced anymore. - int countdown = 100; - while (--countdown) { - GC.collect(); - if (Klass.getTotal_count() == 1) - break; - Thread.sleep(100); - } - // A single remaining instance expected: the global variable (GlobalValue). if (Klass.getTotal_count() != 1) throw new Exception("Klass.total_count=" ~ to!string(Klass.getTotal_count())); @@ -55,9 +47,15 @@ void main() { } void runTest() { + // We want to check whether all the C++ Klass instances have been properly + // destructed after the tests have run. However, as it is legal for the GC + // to leave an object around even if it is unreachable, use deterministic + // memory management here. + import std.typecons : scoped; + // simple shared_ptr usage - created in C++ { - auto k = new Klass("me oh my"); + auto k = scoped!Klass("me oh my"); string val = k.getValue(); verifyValue("me oh my", val); verifyCount(1, k); @@ -73,7 +71,7 @@ void runTest() { // pass by shared_ptr { - auto k = new Klass("me oh my"); + auto k = scoped!Klass("me oh my"); auto kret = smartpointertest(k); string val = kret.getValue(); verifyValue("me oh my smartpointertest", val); @@ -83,7 +81,7 @@ void runTest() { // pass by shared_ptr pointer { - auto k = new Klass("me oh my"); + auto k = scoped!Klass("me oh my"); auto kret = smartpointerpointertest(k); string val = kret.getValue(); verifyValue("me oh my smartpointerpointertest", val); @@ -93,7 +91,7 @@ void runTest() { // pass by shared_ptr reference { - auto k = new Klass("me oh my"); + auto k = scoped!Klass("me oh my"); auto kret = smartpointerreftest(k); string val = kret.getValue(); verifyValue("me oh my smartpointerreftest", val); @@ -103,7 +101,7 @@ void runTest() { // pass by shared_ptr pointer reference { - auto k = new Klass("me oh my"); + auto k = scoped!Klass("me oh my"); auto kret = smartpointerpointerreftest(k); string val = kret.getValue(); verifyValue("me oh my smartpointerpointerreftest", val); @@ -113,7 +111,7 @@ void runTest() { // const pass by shared_ptr { - auto k = new Klass("me oh my"); + auto k = scoped!Klass("me oh my"); auto kret = constsmartpointertest(k); string val = kret.getValue(); verifyValue("me oh my", val); @@ -123,7 +121,7 @@ void runTest() { // const pass by shared_ptr pointer { - auto k = new Klass("me oh my"); + auto k = scoped!Klass("me oh my"); auto kret = constsmartpointerpointertest(k); string val = kret.getValue(); verifyValue("me oh my", val); @@ -133,7 +131,7 @@ void runTest() { // const pass by shared_ptr reference { - auto k = new Klass("me oh my"); + auto k = scoped!Klass("me oh my"); auto kret = constsmartpointerreftest(k); string val = kret.getValue(); verifyValue("me oh my", val); @@ -143,7 +141,7 @@ void runTest() { // pass by value { - auto k = new Klass("me oh my"); + auto k = scoped!Klass("me oh my"); auto kret = valuetest(k); string val = kret.getValue(); verifyValue("me oh my valuetest", val); @@ -153,7 +151,7 @@ void runTest() { // pass by pointer { - auto k = new Klass("me oh my"); + auto k = scoped!Klass("me oh my"); auto kret = pointertest(k); string val = kret.getValue(); verifyValue("me oh my pointertest", val); @@ -163,7 +161,7 @@ void runTest() { // pass by reference { - auto k = new Klass("me oh my"); + auto k = scoped!Klass("me oh my"); auto kret = reftest(k); string val = kret.getValue(); verifyValue("me oh my reftest", val); @@ -173,7 +171,7 @@ void runTest() { // pass by pointer reference { - auto k = new Klass("me oh my"); + auto k = scoped!Klass("me oh my"); auto kret = pointerreftest(k); string val = kret.getValue(); verifyValue("me oh my pointerreftest", val); @@ -215,7 +213,7 @@ void runTest() { ////////////////////////////////// Derived classes //////////////////////////////////////// // derived pass by shared_ptr { - auto k = new KlassDerived("me oh my"); + auto k = scoped!KlassDerived("me oh my"); auto kret = derivedsmartptrtest(k); string val = kret.getValue(); verifyValue("me oh my derivedsmartptrtest-Derived", val); @@ -224,7 +222,7 @@ void runTest() { } // derived pass by shared_ptr pointer { - auto k = new KlassDerived("me oh my"); + auto k = scoped!KlassDerived("me oh my"); auto kret = derivedsmartptrpointertest(k); string val = kret.getValue(); verifyValue("me oh my derivedsmartptrpointertest-Derived", val); @@ -233,7 +231,7 @@ void runTest() { } // derived pass by shared_ptr ref { - auto k = new KlassDerived("me oh my"); + auto k = scoped!KlassDerived("me oh my"); auto kret = derivedsmartptrreftest(k); string val = kret.getValue(); verifyValue("me oh my derivedsmartptrreftest-Derived", val); @@ -242,7 +240,7 @@ void runTest() { } // derived pass by shared_ptr pointer ref { - auto k = new KlassDerived("me oh my"); + auto k = scoped!KlassDerived("me oh my"); auto kret = derivedsmartptrpointerreftest(k); string val = kret.getValue(); verifyValue("me oh my derivedsmartptrpointerreftest-Derived", val); @@ -251,7 +249,7 @@ void runTest() { } // derived pass by pointer { - auto k = new KlassDerived("me oh my"); + auto k = scoped!KlassDerived("me oh my"); auto kret = derivedpointertest(k); string val = kret.getValue(); verifyValue("me oh my derivedpointertest-Derived", val); @@ -260,7 +258,7 @@ void runTest() { } // derived pass by ref { - auto k = new KlassDerived("me oh my"); + auto k = scoped!KlassDerived("me oh my"); auto kret = derivedreftest(k); string val = kret.getValue(); verifyValue("me oh my derivedreftest-Derived", val); @@ -271,7 +269,7 @@ void runTest() { ////////////////////////////////// Derived and base class mixed //////////////////////////////////////// // pass by shared_ptr (mixed) { - auto k = new KlassDerived("me oh my"); + auto k = scoped!KlassDerived("me oh my"); auto kret = smartpointertest(k); string val = kret.getValue(); verifyValue("me oh my smartpointertest-Derived", val); @@ -281,7 +279,7 @@ void runTest() { // pass by shared_ptr pointer (mixed) { - auto k = new KlassDerived("me oh my"); + auto k = scoped!KlassDerived("me oh my"); auto kret = smartpointerpointertest(k); string val = kret.getValue(); verifyValue("me oh my smartpointerpointertest-Derived", val); @@ -291,7 +289,7 @@ void runTest() { // pass by shared_ptr reference (mixed) { - auto k = new KlassDerived("me oh my"); + auto k = scoped!KlassDerived("me oh my"); auto kret = smartpointerreftest(k); string val = kret.getValue(); verifyValue("me oh my smartpointerreftest-Derived", val); @@ -301,7 +299,7 @@ void runTest() { // pass by shared_ptr pointer reference (mixed) { - auto k = new KlassDerived("me oh my"); + auto k = scoped!KlassDerived("me oh my"); auto kret = smartpointerpointerreftest(k); string val = kret.getValue(); verifyValue("me oh my smartpointerpointerreftest-Derived", val); @@ -311,7 +309,7 @@ void runTest() { // pass by value (mixed) { - auto k = new KlassDerived("me oh my"); + auto k = scoped!KlassDerived("me oh my"); auto kret = valuetest(k); string val = kret.getValue(); verifyValue("me oh my valuetest", val); // note slicing @@ -321,7 +319,7 @@ void runTest() { // pass by pointer (mixed) { - auto k = new KlassDerived("me oh my"); + auto k = scoped!KlassDerived("me oh my"); auto kret = pointertest(k); string val = kret.getValue(); verifyValue("me oh my pointertest-Derived", val); @@ -331,7 +329,7 @@ void runTest() { // pass by ref (mixed) { - auto k = new KlassDerived("me oh my"); + auto k = scoped!KlassDerived("me oh my"); auto kret = reftest(k); string val = kret.getValue(); verifyValue("me oh my reftest-Derived", val); @@ -341,7 +339,7 @@ void runTest() { // 3rd derived class { - auto k = new Klass3rdDerived("me oh my"); + auto k = scoped!Klass3rdDerived("me oh my"); string val = k.getValue(); verifyValue("me oh my-3rdDerived", val); verifyCount(3, k); // 3 classes in inheritance chain == 3 swigCPtr values @@ -353,128 +351,140 @@ void runTest() { ////////////////////////////////// Member variables //////////////////////////////////////// // smart pointer by value { - auto m = new MemberVariables(); - auto k = new Klass("smart member value"); - m.SmartMemberValue = k; - string val = k.getValue(); - verifyValue("smart member value", val); - verifyCount(2, k); - - auto kmember = m.SmartMemberValue; - val = kmember.getValue(); - verifyValue("smart member value", val); - verifyCount(3, kmember); - verifyCount(3, k); - - delete m; + auto k = scoped!Klass("smart member value"); + Klass kmember; + + { + auto m = scoped!MemberVariables(); + m.SmartMemberValue = k; + string val = k.getValue(); + verifyValue("smart member value", val); + verifyCount(2, k); + + kmember = m.SmartMemberValue; + val = kmember.getValue(); + verifyValue("smart member value", val); + verifyCount(3, kmember); + verifyCount(3, k); + } verifyCount(2, kmember); verifyCount(2, k); } // smart pointer by pointer { - auto m = new MemberVariables(); - auto k = new Klass("smart member pointer"); - m.SmartMemberPointer = k; - string val = k.getValue(); - verifyValue("smart member pointer", val); - verifyCount(1, k); - - auto kmember = m.SmartMemberPointer; - val = kmember.getValue(); - verifyValue("smart member pointer", val); - verifyCount(2, kmember); - verifyCount(2, k); - - delete m; + auto k = scoped!Klass("smart member pointer"); + Klass kmember; + + { + auto m = scoped!MemberVariables(); + m.SmartMemberPointer = k; + string val = k.getValue(); + verifyValue("smart member pointer", val); + verifyCount(1, k); + + kmember = m.SmartMemberPointer; + val = kmember.getValue(); + verifyValue("smart member pointer", val); + verifyCount(2, kmember); + verifyCount(2, k); + } verifyCount(2, kmember); verifyCount(2, k); } // smart pointer by reference { - auto m = new MemberVariables(); - auto k = new Klass("smart member reference"); - m.SmartMemberReference = k; - string val = k.getValue(); - verifyValue("smart member reference", val); - verifyCount(2, k); - - auto kmember = m.SmartMemberReference; - val = kmember.getValue(); - verifyValue("smart member reference", val); - verifyCount(3, kmember); - verifyCount(3, k); - - // The C++ reference refers to SmartMemberValue... - auto kmemberVal = m.SmartMemberValue; - val = kmember.getValue(); - verifyValue("smart member reference", val); - verifyCount(4, kmemberVal); - verifyCount(4, kmember); - verifyCount(4, k); - - delete m; + auto k = scoped!Klass("smart member reference"); + Klass kmember; + + { + auto m = scoped!MemberVariables(); + m.SmartMemberReference = k; + string val = k.getValue(); + verifyValue("smart member reference", val); + verifyCount(2, k); + + kmember = m.SmartMemberReference; + val = kmember.getValue(); + verifyValue("smart member reference", val); + verifyCount(3, kmember); + verifyCount(3, k); + + // The C++ reference refers to SmartMemberValue... + auto kmemberVal = m.SmartMemberValue; + val = kmember.getValue(); + verifyValue("smart member reference", val); + verifyCount(4, kmemberVal); + verifyCount(4, kmember); + verifyCount(4, k); + } verifyCount(3, kmember); verifyCount(3, k); } // plain by value { - auto m = new MemberVariables(); - auto k = new Klass("plain member value"); - m.MemberValue = k; - string val = k.getValue(); - verifyValue("plain member value", val); - verifyCount(1, k); - - auto kmember = m.MemberValue; - val = kmember.getValue(); - verifyValue("plain member value", val); - verifyCount(1, kmember); - verifyCount(1, k); - - delete m; + auto k = scoped!Klass("plain member value"); + Klass kmember; + + { + auto m = scoped!MemberVariables(); + m.MemberValue = k; + string val = k.getValue(); + verifyValue("plain member value", val); + verifyCount(1, k); + + kmember = m.MemberValue; + val = kmember.getValue(); + verifyValue("plain member value", val); + verifyCount(1, kmember); + verifyCount(1, k); + } verifyCount(1, kmember); verifyCount(1, k); } // plain by pointer { - auto m = new MemberVariables(); - auto k = new Klass("plain member pointer"); - m.MemberPointer = k; - string val = k.getValue(); - verifyValue("plain member pointer", val); - verifyCount(1, k); - - auto kmember = m.MemberPointer; - val = kmember.getValue(); - verifyValue("plain member pointer", val); - verifyCount(1, kmember); - verifyCount(1, k); - - delete m; + auto k = scoped!Klass("plain member pointer"); + Klass kmember; + + { + auto m = scoped!MemberVariables(); + m.MemberPointer = k; + string val = k.getValue(); + verifyValue("plain member pointer", val); + verifyCount(1, k); + + kmember = m.MemberPointer; + val = kmember.getValue(); + verifyValue("plain member pointer", val); + verifyCount(1, kmember); + verifyCount(1, k); + } verifyCount(1, kmember); verifyCount(1, k); } // plain by reference { - auto m = new MemberVariables(); - auto k = new Klass("plain member reference"); - m.MemberReference = k; - string val = k.getValue(); - verifyValue("plain member reference", val); - verifyCount(1, k); - - auto kmember = m.MemberReference; - val = kmember.getValue(); - verifyValue("plain member reference", val); - verifyCount(1, kmember); - verifyCount(1, k); - - delete m; + auto k = scoped!Klass("plain member reference"); + Klass kmember; + + { + auto m = scoped!MemberVariables(); + m.MemberReference = k; + string val = k.getValue(); + verifyValue("plain member reference", val); + verifyCount(1, k); + + kmember = m.MemberReference; + val = kmember.getValue(); + verifyValue("plain member reference", val); + verifyCount(1, kmember); + verifyCount(1, k); + } verifyCount(1, kmember); verifyCount(1, k); @@ -482,7 +492,7 @@ void runTest() { // null member variables { - auto m = new MemberVariables(); + auto m = scoped!MemberVariables(); // shared_ptr by value auto k = m.SmartMemberValue; @@ -504,7 +514,7 @@ void runTest() { auto kglobal = GlobalSmartValue; enforce(kglobal is null, "expected null"); - auto k = new Klass("smart global value"); + auto k = scoped!Klass("smart global value"); GlobalSmartValue = k; verifyCount(2, k); @@ -520,7 +530,7 @@ void runTest() { { Klass kglobal; - auto k = new Klass("global value"); + auto k = scoped!Klass("global value"); GlobalValue = k; verifyCount(1, k); @@ -538,7 +548,7 @@ void runTest() { auto kglobal = GlobalPointer; enforce(kglobal is null, "expected null"); - auto k = new Klass("global pointer"); + auto k = scoped!Klass("global pointer"); GlobalPointer = k; verifyCount(1, k); @@ -553,7 +563,7 @@ void runTest() { { Klass kglobal; - auto k = new Klass("global reference"); + auto k = scoped!Klass("global reference"); GlobalReference = k; verifyCount(1, k); diff --git a/Examples/test-suite/default_args.i b/Examples/test-suite/default_args.i index 839d28e3e..bcb8766a8 100644 --- a/Examples/test-suite/default_args.i +++ b/Examples/test-suite/default_args.i @@ -13,6 +13,27 @@ %inline %{ #include <string> + // All kinds of numbers: hex, octal (which pose special problems to Python), negative... + void trickyvalue1(int first, int pos = -1) {} + void trickyvalue2(int first, unsigned rgb = 0xabcdef) {} + void trickyvalue3(int first, int mode = 0644) {} + + void doublevalue1(int first, double num = 0.0e-1) {} + void doublevalue2(int first, double num = -0.0E2) {} + + // Long long arguments are not handled at Python level currently but still work. + void seek(long long offset = 0LL) {} + void seek2(unsigned long long offset = 0ULL) {} + void seek3(long offset = 0L) {} + void seek4(unsigned long offset = 0UL) {} + void seek5(unsigned long offset = 0U) {} + void seek6(unsigned long offset = 02U) {} + void seek7(unsigned long offset = 00U) {} + void seek8(unsigned long offset = 1U) {} + void seek9(long offset = 1L) {} + void seekA(long long offset = 1LL) {} + void seekB(unsigned long long offset = 1ULL) {} + // Anonymous arguments int anonymous(int = 7771); int anonymous(int x) { return x; } @@ -29,6 +50,12 @@ bool blah(speed s = FAST, flavor f = SWEET) { return (s == FAST && f == SWEET); }; }; + // using base class enum in a derived class + class DerivedEnumClass : public EnumClass { + public: + void accelerate(speed s = SLOW) { } + }; + // casts const char * casts1(const char *m = (const char *) NULL) { char *ret = NULL; @@ -199,6 +226,7 @@ namespace Space { struct Klass { int val; Klass(int val = -1) : val(val) {} + static Klass inc(int n = 1, const Klass& k = Klass()) { return Klass(k.val + n); } }; Klass constructorcall(const Klass& k = Klass()) { return k; } diff --git a/Examples/test-suite/default_constructor.i b/Examples/test-suite/default_constructor.i index 091adff20..f7fc8cfa6 100644 --- a/Examples/test-suite/default_constructor.i +++ b/Examples/test-suite/default_constructor.i @@ -168,5 +168,11 @@ public: } }; - +%inline %{ +#ifdef SWIGPYTHON_BUILTIN +bool is_python_builtin() { return true; } +#else +bool is_python_builtin() { return false; } +#endif +%} diff --git a/Examples/test-suite/director_abstract.i b/Examples/test-suite/director_abstract.i index cc9dca55a..7dfcc8984 100644 --- a/Examples/test-suite/director_abstract.i +++ b/Examples/test-suite/director_abstract.i @@ -156,7 +156,7 @@ namespace ns class Example3 { protected: - /* the default constructor is always emitter, even when protected, + /* the default constructor is always emitted, even when protected, having another public constructor, and 'dirprot' is not used. This is just for Java compatibility */ Example3() diff --git a/Examples/test-suite/director_exception.i b/Examples/test-suite/director_exception.i index 3fd3e563c..2559ae566 100644 --- a/Examples/test-suite/director_exception.i +++ b/Examples/test-suite/director_exception.i @@ -1,5 +1,7 @@ %module(directors="1") director_exception +%warnfilter(SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) return_const_char_star; + %{ #if defined(_MSC_VER) @@ -106,7 +108,7 @@ Foo *launder(Foo *f) { %} %feature("director") Bar; - +%feature("director") ReturnAllTypes; %inline %{ struct Exception1 @@ -132,4 +134,28 @@ Foo *launder(Foo *f) { virtual std::string pang() throw () { return "Bar::pang()"; } }; + // Class to allow regression testing SWIG/PHP not checking if an exception + // had been thrown in directorout typemaps. + class ReturnAllTypes + { + public: + int call_int() { return return_int(); } + double call_double() { return return_double(); } + const char * call_const_char_star() { return return_const_char_star(); } + std::string call_std_string() { return return_std_string(); } + Bar call_Bar() { return return_Bar(); } + + virtual int return_int() { return 0; } + virtual double return_double() { return 0.0; } + virtual const char * return_const_char_star() { return ""; } + virtual std::string return_std_string() { return std::string(); } + virtual Bar return_Bar() { return Bar(); } + virtual ~ReturnAllTypes() {} + }; + +#ifdef SWIGPYTHON_BUILTIN +bool is_python_builtin() { return true; } +#else +bool is_python_builtin() { return false; } +#endif %} diff --git a/Examples/test-suite/director_keywords.i b/Examples/test-suite/director_keywords.i index 473786c00..53f36a8f6 100644 --- a/Examples/test-suite/director_keywords.i +++ b/Examples/test-suite/director_keywords.i @@ -1,13 +1,16 @@ // Checks if collisions of argument names with target language keywords are -// resolved properly when directors are used (currently only »abstract« for -// C#, D and Java is checked). +// resolved properly when directors are used %module(directors="1") director_keywords +%warnfilter(SWIGWARN_PARSE_KEYWORD); + %feature("director") Foo; %inline %{ struct Foo { virtual ~Foo() {} - virtual void bar(int abstract) {} + virtual void check_abstract(int abstract) {} // for Java, C#, D... + virtual void check_self(int self) {} // self for Python + virtual void check_from(int from) {} // for Python }; %} diff --git a/Examples/test-suite/director_nested_class.i b/Examples/test-suite/director_nested_class.i new file mode 100644 index 000000000..f3d627f3c --- /dev/null +++ b/Examples/test-suite/director_nested_class.i @@ -0,0 +1,25 @@ +%module(directors="1") director_nested_class + + +%feature("director") DirectorOuter::DirectorInner; +%feature("director") DirectorOuter::DirectorInner::DirectorInnerInner; + +%inline %{ +struct DirectorOuter { + struct DirectorInner { + virtual ~DirectorInner() {} + virtual int vmethod(int input) const = 0; + struct DirectorInnerInner { + DirectorInnerInner(DirectorInner *din = 0) {} + virtual ~DirectorInnerInner() {} + virtual int innervmethod(int input) const = 0; + }; + }; + static int callMethod(const DirectorInner &di, int value) { + return di.vmethod(value); + } + static int callInnerInnerMethod(const DirectorInner::DirectorInnerInner &di, int value) { + return di.innervmethod(value); + } +}; +%} diff --git a/Examples/test-suite/director_nestedmodule.i b/Examples/test-suite/director_nestedmodule.i new file mode 100644 index 000000000..4e304340f --- /dev/null +++ b/Examples/test-suite/director_nestedmodule.i @@ -0,0 +1,29 @@ +%module(directors="1") "director::nestedmodule" + +%{ +#include <string> + +class Foo { + public: + virtual ~Foo() {} + virtual std::string ping() { return "Foo::ping()"; } + virtual std::string pong() { return "Foo::pong();" + ping(); } + + static Foo* get_self(Foo *slf) {return slf;} +}; + +%} + +%include <std_string.i> + +%feature("director") Foo; + + +class Foo { + public: + virtual ~Foo(); + virtual std::string ping(); + virtual std::string pong(); + + static Foo* get_self(Foo *slf); +}; diff --git a/Examples/test-suite/director_property.i b/Examples/test-suite/director_property.i new file mode 100644 index 000000000..3363c3c4f --- /dev/null +++ b/Examples/test-suite/director_property.i @@ -0,0 +1,151 @@ +%module(directors="1") director_property + +%warnfilter(SWIGWARN_TYPEMAP_THREAD_UNSAFE,SWIGWARN_TYPEMAP_DIRECTOROUT_PTR) MyClass::pmethod; + +%{ + #include <string> + + class Foo { + private: + std::string a; + public: + virtual ~Foo() {} + virtual std::string ping() { return "Foo::ping()"; } + virtual std::string pong() { return "Foo::pong();" + ping(); } + virtual std::string getA() { return this->a; } + virtual void setA(std::string a) { this->a = a; } + + static Foo* get_self(Foo *slf) {return slf;} + + }; + + %} + + %include <std_string.i> + + %feature("director") Foo; + + + class Foo { + public: + virtual ~Foo(); + virtual std::string ping(); + virtual std::string pong(); + virtual std::string getA(); + virtual void setA(std::string a); + + static Foo* get_self(Foo *slf); + + }; + + %{ + #include <complex> + %} + %feature("director") A; + + // basic renaming + %rename(rg) A::gg; + %feature("nodirector") hi::A1::gg; + + %inline %{ + + struct A{ + A(std::complex<int> i, double d=0.0) {} + A(int i, bool j=false) {} + virtual ~A() {} + + virtual int f(int i=0) {return i;} + virtual int gg(int i=0) {return i;} + }; + + namespace hi { + + struct A1 : public A { + A1(std::complex<int> i, double d=0.0) : A(i, d) {} + A1(int i, bool j=false) : A(i, j) {} + + virtual int ff(int i = 0) {return i;} + }; + } + + + %} + + + %feature("director") MyClass; + + %inline %{ + + typedef void VoidType; + + struct Bar + { + int x; + Bar(int _x = 0) : x(_x) + { + } + }; + + + +class MyClass { +public: + MyClass(int a = 0) + { + } + + virtual void method(VoidType *) + { + } + + virtual ~MyClass() + { + } + + virtual Bar vmethod(Bar b) + { + b.x += 13; + return b; + } + + virtual Bar* pmethod(Bar *b) + { + b->x += 12; + return b; + } + + Bar cmethod(const Bar &b) + { + return vmethod(b); + } + + static MyClass *get_self(MyClass *c) + { + return c; + } + + static Bar * call_pmethod(MyClass *myclass, Bar *b) { + return myclass->pmethod(b); + } +}; + +template<class T> +class MyClassT { +public: + MyClassT(int a = 0) + { + } + + virtual void method(VoidType *) + { + } + + virtual ~MyClassT() + { + } + +}; + +%} + +%template(MyClassT_i) MyClassT<int>; diff --git a/Examples/test-suite/enum_rename.i b/Examples/test-suite/enum_rename.i index 0cab4d0d8..23e100db9 100644 --- a/Examples/test-suite/enum_rename.i +++ b/Examples/test-suite/enum_rename.i @@ -2,7 +2,7 @@ %warnfilter(SWIGWARN_PARSE_REDEFINED) S_May; -// %rename using regex can do the equivalent of these two renames, which was resulting in uncompileable code +// %rename using regex can do the equivalent of these two renames, which was resulting in uncompilable code %rename(May) M_May; %rename(May) S_May; diff --git a/Examples/test-suite/enum_thorough.i b/Examples/test-suite/enum_thorough.i index ec31c2787..3ece5471b 100644 --- a/Examples/test-suite/enum_thorough.i +++ b/Examples/test-suite/enum_thorough.i @@ -277,6 +277,18 @@ OldNameStruct::doublenametag renameTest6(OldNameStruct::doublenametag e) OldNameStruct::singlename renameTest7(OldNameStruct::singlename e) { return e; } %} +%rename(Clash1_di1) Clash1::di1; +%rename(Clash1_di2) Clash1::di2; +%rename(Clash1_di3) Clash1::di3; +%inline %{ +namespace Clash1 { + enum DuplicateItems1 { di1, di2 = 10, di3 }; +} +namespace Clash2 { + enum DuplicateItems2 { di1, di2 = 10, di3 }; +} +%} + %inline %{ struct TreesClass { enum trees {oak, fir, pine }; diff --git a/Examples/test-suite/equality.i b/Examples/test-suite/equality.i new file mode 100644 index 000000000..cdabc4892 --- /dev/null +++ b/Examples/test-suite/equality.i @@ -0,0 +1,69 @@ +/* File : equality.i */ +/* + Specific test for operator== overload. Partially overlaps with + operator_overload.i +*/ + +%module equality + +%warnfilter(SWIGWARN_LANG_IDENTIFIER) operator==; + +%inline %{ + +/* Point has no equality operator */ +typedef struct Point +{ + double x; + double y; +} Point; + +static const Point s_zeroPoint = { 0.0, 0.0 }; +/* stack version */ +Point MakePoint(double x, double y) + { Point new_point = {x, y}; return new_point; } + +const Point* GetZeroPointPtr() { return &s_zeroPoint; } +Point GetZeroPointCopy() { return s_zeroPoint; } + +/* EqualOpDefined has correct equality operator */ +class EqualOpDefined { +public: + EqualOpDefined(): + x(5) {} + EqualOpDefined(int val): + x(val) {} + + int x; +}; + +/* EqualOpWrong has logically incorrect equality operator */ +class EqualOpWrong { +public: + inline static const EqualOpWrong* GetStaticObject(); +}; + +static EqualOpWrong s_wrongEqOp; + +const EqualOpWrong* EqualOpWrong::GetStaticObject() + { return &s_wrongEqOp; } + + +inline bool operator==( const EqualOpDefined& first, const EqualOpDefined& second ) + { return first.x == second.x; } + +inline bool operator==( const EqualOpWrong& first, const EqualOpWrong& second ) + { return false; } + +%} + +/* + in order to wrapper this correctly + we need to extend the class + to make the friends & non members part of the class +*/ +%extend EqualOpDefined { + bool operator==(const EqualOpDefined& b){return (*$self) == b;} +} +%extend EqualOpWrong { + bool operator==(const EqualOpWrong& b){return (*$self) == b;} +} diff --git a/Examples/test-suite/errors/.gitignore b/Examples/test-suite/errors/.gitignore new file mode 100644 index 000000000..22ca11947 --- /dev/null +++ b/Examples/test-suite/errors/.gitignore @@ -0,0 +1,4 @@ +*.newerr +cpp_recursive_typedef.py +cpp_shared_ptr.py +xxx.py diff --git a/Examples/test-suite/errors/Makefile.in b/Examples/test-suite/errors/Makefile.in index 601dcd303..4c61001e7 100644 --- a/Examples/test-suite/errors/Makefile.in +++ b/Examples/test-suite/errors/Makefile.in @@ -13,42 +13,44 @@ # file (.stderr) in addition to the test case itself. ####################################################################### -LANGUAGE = python +LANGUAGE = errors ERROR_EXT = newerr -# Portable dos2unix / todos for stripping CR -TODOS = tr -d '\r' -#TODOS = sed -e 's/\r$$//' # On OSX behaves as if written 's/r$$//' srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ # All .i files with prefix 'cpp_' will be treated as C++ input and remaining .i files as C input -ALL_ERROR_TEST_CASES := $(patsubst %.i,%, $(wildcard *.i)) +ALL_ERROR_TEST_CASES := $(patsubst %.i,%, $(notdir $(wildcard $(srcdir)/*.i))) CPP_ERROR_TEST_CASES := $(filter cpp_%, $(ALL_ERROR_TEST_CASES)) C_ERROR_TEST_CASES := $(filter-out $(CPP_ERROR_TEST_CASES), $(ALL_ERROR_TEST_CASES)) ERROR_TEST_CASES := $(CPP_ERROR_TEST_CASES:=.cpptest) \ - $(C_ERROR_TEST_CASES:=.ctest) + $(C_ERROR_TEST_CASES:=.ctest) include $(srcdir)/../common.mk +# Portable dos2unix / todos for stripping CR +TODOS = tr -d '\r' +#TODOS = sed -e 's/\r$$//' # On OSX behaves as if written 's/r$$//' + +# strip source directory from output, so that diffs compare +STRIP_SRCDIR = sed -e 's|\\|/|g' -e 's|^$(SRCDIR)||' # Rules for the different types of tests -%.cpptest: +%.cpptest: echo "$(ACTION)ing errors testcase $*" - -$(SWIG) -c++ -python -Wall -Fstandard $(SWIGOPT) $*.i 2>&1 | $(TODOS) > $*.$(ERROR_EXT) - $(COMPILETOOL) diff -c $*.stderr $*.$(ERROR_EXT) + -$(SWIG) -c++ -python -Wall -Fstandard $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT) + $(COMPILETOOL) diff -c $(SRCDIR)$*.stderr $*.$(ERROR_EXT) %.ctest: echo "$(ACTION)ing errors testcase $*" - -$(SWIG) -python -Wall -Fstandard $(SWIGOPT) $*.i 2>&1 | $(TODOS) > $*.$(ERROR_EXT) - $(COMPILETOOL) diff -c $*.stderr $*.$(ERROR_EXT) + -$(SWIG) -python -Wall -Fstandard $(SWIGOPT) $(SRCDIR)$*.i 2>&1 | $(TODOS) | $(STRIP_SRCDIR) > $*.$(ERROR_EXT) + $(COMPILETOOL) diff -c $(SRCDIR)$*.stderr $*.$(ERROR_EXT) %.clean: - + @exit 0 clean: - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile $(LANGUAGE)_clean + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" python_clean @rm -f *.$(ERROR_EXT) *.py - diff --git a/Examples/test-suite/errors/c_extra_rblock.stderr b/Examples/test-suite/errors/c_extra_rblock.stderr index 82877023a..be14eee4c 100644 --- a/Examples/test-suite/errors/c_extra_rblock.stderr +++ b/Examples/test-suite/errors/c_extra_rblock.stderr @@ -1 +1 @@ -c_extra_rblock.i:5: Error: Syntax error in input(1). +c_extra_rblock.i:5: Error: Syntax error. Extraneous '%}' diff --git a/Examples/test-suite/errors/c_missing_semi.stderr b/Examples/test-suite/errors/c_missing_semi.stderr index 791b959ca..18befaa1b 100644 --- a/Examples/test-suite/errors/c_missing_semi.stderr +++ b/Examples/test-suite/errors/c_missing_semi.stderr @@ -1 +1 @@ -c_missing_semi.i:3: Error: Syntax error in input(1). +c_missing_semi.i:3: Error: Syntax error - possibly a missing semicolon. diff --git a/Examples/test-suite/errors/cpp_extra_brackets.stderr b/Examples/test-suite/errors/cpp_extra_brackets.stderr index 12bb1f327..f1fabc78d 100644 --- a/Examples/test-suite/errors/cpp_extra_brackets.stderr +++ b/Examples/test-suite/errors/cpp_extra_brackets.stderr @@ -1 +1 @@ -cpp_extra_brackets.i:5: Error: Syntax error in input(3). +cpp_extra_brackets.i:5: Error: Unexpected ')'. diff --git a/Examples/test-suite/errors/pp_constant.i b/Examples/test-suite/errors/pp_constant.i index 2be108e83..c29f4c86d 100644 --- a/Examples/test-suite/errors/pp_constant.i +++ b/Examples/test-suite/errors/pp_constant.i @@ -29,7 +29,9 @@ comment */ %constant int ddd=; #define E1 1234 -#/*C comment*/define E2 1234 +// This case doesn't actually work, but appeared to before we gave an error +// for unknown preprocessor directives. +// #/*C comment*/define E2 1234 #define E3 1234 %constant int eee=; diff --git a/Examples/test-suite/errors/pp_constant.stderr b/Examples/test-suite/errors/pp_constant.stderr index 9c79ec2be..54a87edfe 100644 --- a/Examples/test-suite/errors/pp_constant.stderr +++ b/Examples/test-suite/errors/pp_constant.stderr @@ -2,7 +2,7 @@ pp_constant.i:9: Warning 305: Bad constant value (ignored). pp_constant.i:15: Warning 305: Bad constant value (ignored). pp_constant.i:23: Warning 305: Bad constant value (ignored). pp_constant.i:29: Warning 305: Bad constant value (ignored). -pp_constant.i:35: Warning 305: Bad constant value (ignored). -pp_constant.i:42: Warning 305: Bad constant value (ignored). -pp_constant.i:46: Warning 305: Bad constant value (ignored). -pp_constant.i:49: Warning 305: Bad constant value (ignored). +pp_constant.i:37: Warning 305: Bad constant value (ignored). +pp_constant.i:44: Warning 305: Bad constant value (ignored). +pp_constant.i:48: Warning 305: Bad constant value (ignored). +pp_constant.i:51: Warning 305: Bad constant value (ignored). diff --git a/Examples/test-suite/errors/pp_missing_enddef.stderr b/Examples/test-suite/errors/pp_missing_enddef.stderr index bb4ea3c75..c461699e6 100644 --- a/Examples/test-suite/errors/pp_missing_enddef.stderr +++ b/Examples/test-suite/errors/pp_missing_enddef.stderr @@ -1 +1 @@ -pp_missing_enddef.i:EOF: Error: Missing %enddef for macro starting on line 3 +pp_missing_enddef.i:3: Error: Missing %enddef for macro starting here diff --git a/Examples/test-suite/errors/pp_missing_endif.stderr b/Examples/test-suite/errors/pp_missing_endif.stderr index 0bbfad7f2..4db4021aa 100644 --- a/Examples/test-suite/errors/pp_missing_endif.stderr +++ b/Examples/test-suite/errors/pp_missing_endif.stderr @@ -1 +1 @@ -pp_missing_endif.i:EOF: Error: Missing #endif for conditional starting on line 3 +pp_missing_endif.i:3: Error: Missing #endif for conditional starting here diff --git a/Examples/test-suite/errors/pp_missing_endoffile.i b/Examples/test-suite/errors/pp_missing_endoffile.i new file mode 100644 index 000000000..2074495a8 --- /dev/null +++ b/Examples/test-suite/errors/pp_missing_endoffile.i @@ -0,0 +1,7 @@ +%module xxx +/* %beginfile and %endoffile are internal directives inserted when %include is + * used. Users should never use them directly, but test coverage for this + * error message still seems useful to have. + */ +%includefile "dummy.i" %beginfile + diff --git a/Examples/test-suite/errors/pp_missing_endoffile.stderr b/Examples/test-suite/errors/pp_missing_endoffile.stderr new file mode 100644 index 000000000..7269f2e92 --- /dev/null +++ b/Examples/test-suite/errors/pp_missing_endoffile.stderr @@ -0,0 +1 @@ +pp_missing_endoffile.i:6: Error: Missing %endoffile for file inclusion block starting here diff --git a/Examples/test-suite/errors/pp_missing_rblock.stderr b/Examples/test-suite/errors/pp_missing_rblock.stderr index 8f4a54c0a..f00457d73 100644 --- a/Examples/test-suite/errors/pp_missing_rblock.stderr +++ b/Examples/test-suite/errors/pp_missing_rblock.stderr @@ -1 +1 @@ -pp_missing_rblock.i:EOF: Error: Unterminated %{ ... %} block starting on line 3 +pp_missing_rblock.i:3: Error: Unterminated %{ ... %} block diff --git a/Examples/test-suite/errors/pp_unknowndirective.i b/Examples/test-suite/errors/pp_unknowndirective.i new file mode 100644 index 000000000..659a997d3 --- /dev/null +++ b/Examples/test-suite/errors/pp_unknowndirective.i @@ -0,0 +1,7 @@ +%module xxx + +/* This used to give the rather cryptic "Syntax error in input(1)." prior to + * SWIG 3.0.4. This testcase checks that the improved message is actually + * issued. + */ +%remane("typo") tyop; diff --git a/Examples/test-suite/errors/pp_unknowndirective.stderr b/Examples/test-suite/errors/pp_unknowndirective.stderr new file mode 100644 index 000000000..d0d5e249f --- /dev/null +++ b/Examples/test-suite/errors/pp_unknowndirective.stderr @@ -0,0 +1 @@ +pp_unknowndirective.i:7: Error: Unknown directive '%remane'. diff --git a/Examples/test-suite/errors/pp_unknowndirective2.i b/Examples/test-suite/errors/pp_unknowndirective2.i new file mode 100644 index 000000000..889e6c5b2 --- /dev/null +++ b/Examples/test-suite/errors/pp_unknowndirective2.i @@ -0,0 +1,11 @@ +%module xxx + +#ifdef FOO +long long i; +/* Check we get an error for an unknown directive (this should be #elif). + * Unknown directives were silently ignored by SWIG < 3.0.3. */ +#elsif defined(BAR) +long i; +#else +int i; +#endif diff --git a/Examples/test-suite/errors/pp_unknowndirective2.stderr b/Examples/test-suite/errors/pp_unknowndirective2.stderr new file mode 100644 index 000000000..70afa670c --- /dev/null +++ b/Examples/test-suite/errors/pp_unknowndirective2.stderr @@ -0,0 +1 @@ +pp_unknowndirective2.i:7: Error: Unknown SWIG preprocessor directive: elsif (if this is a block of target language code, delimit it with %{ and %}) diff --git a/Examples/test-suite/errors/pp_unterm_char.stderr b/Examples/test-suite/errors/pp_unterm_char.stderr index 4386e933d..147e3859d 100644 --- a/Examples/test-suite/errors/pp_unterm_char.stderr +++ b/Examples/test-suite/errors/pp_unterm_char.stderr @@ -1 +1 @@ -pp_unterm_char.i:EOF: Error: Unterminated character constant starting at line 4 +pp_unterm_char.i:4: Error: Unterminated character constant diff --git a/Examples/test-suite/errors/pp_unterm_comment.stderr b/Examples/test-suite/errors/pp_unterm_comment.stderr index 4ff34230c..ab1edac14 100644 --- a/Examples/test-suite/errors/pp_unterm_comment.stderr +++ b/Examples/test-suite/errors/pp_unterm_comment.stderr @@ -1 +1 @@ -pp_unterm_comment.i:EOF: Error: Unterminated comment starting on line 3 +pp_unterm_comment.i:3: Error: Unterminated comment diff --git a/Examples/test-suite/errors/pp_unterm_string.stderr b/Examples/test-suite/errors/pp_unterm_string.stderr index 16b4034f3..14e110ebb 100644 --- a/Examples/test-suite/errors/pp_unterm_string.stderr +++ b/Examples/test-suite/errors/pp_unterm_string.stderr @@ -1 +1 @@ -pp_unterm_string.i:EOF: Error: Unterminated string constant starting at line 4 +pp_unterm_string.i:4: Error: Unterminated string constant diff --git a/Examples/test-suite/errors/pp_unterminated_block.i b/Examples/test-suite/errors/pp_unterminated_block.i new file mode 100644 index 000000000..99f5f0bc2 --- /dev/null +++ b/Examples/test-suite/errors/pp_unterminated_block.i @@ -0,0 +1,5 @@ +%module xxx + +%{ +int foo(int x); + diff --git a/Examples/test-suite/errors/pp_unterminated_block.stderr b/Examples/test-suite/errors/pp_unterminated_block.stderr new file mode 100644 index 000000000..03c16a45f --- /dev/null +++ b/Examples/test-suite/errors/pp_unterminated_block.stderr @@ -0,0 +1 @@ +pp_unterminated_block.i:3: Error: Unterminated %{ ... %} block diff --git a/Examples/test-suite/exception_order.i b/Examples/test-suite/exception_order.i index 4dd13858a..bca745c7e 100644 --- a/Examples/test-suite/exception_order.i +++ b/Examples/test-suite/exception_order.i @@ -125,6 +125,13 @@ } }; int A::sfoovar = 1; + +#ifdef SWIGPYTHON_BUILTIN +bool is_python_builtin() { return true; } +#else +bool is_python_builtin() { return false; } +#endif + %} %template(ET_i) ET<int>; diff --git a/Examples/test-suite/exception_partial_info.i b/Examples/test-suite/exception_partial_info.i index 37b87ef50..47b046735 100644 --- a/Examples/test-suite/exception_partial_info.i +++ b/Examples/test-suite/exception_partial_info.i @@ -1,6 +1,6 @@ %module exception_partial_info -// This produced compileable code for Tcl, Python in 1.3.27, fails in 1.3.29 +// This produced compilable code for Tcl, Python in 1.3.27, fails in 1.3.29 %{ #if defined(_MSC_VER) diff --git a/Examples/test-suite/extend_default.i b/Examples/test-suite/extend_default.i index 097b5332e..d4a015f55 100644 --- a/Examples/test-suite/extend_default.i +++ b/Examples/test-suite/extend_default.i @@ -93,7 +93,7 @@ struct OverAfter { // %extend overrides the class definition %extend Override { int over(int a) { return a*a; } // SWIG should give a warning then choose this one over the real one - int overload(int a) { return a*a; } // Similarly, but this one generated uncompileable code in SWIG-1.3.22 + int overload(int a) { return a*a; } // Similarly, but this one generated uncompilable code in SWIG-1.3.22 } %inline %{ struct Override { diff --git a/Examples/test-suite/extend_special_variables.i b/Examples/test-suite/extend_special_variables.i index dd68e7531..1f218a8b9 100644 --- a/Examples/test-suite/extend_special_variables.i +++ b/Examples/test-suite/extend_special_variables.i @@ -19,3 +19,19 @@ struct ForExtension { }; %} + +%inline %{ +namespace Space { + template <class T> class ExtendTemplate {}; +} +%} + +%extend Space::ExtendTemplate +{ + void extending() { + $parentclassname tmp; + (void)tmp; + } +} + +%template(ExtendTemplateInt) Space::ExtendTemplate<int>; diff --git a/Examples/test-suite/go/Makefile.in b/Examples/test-suite/go/Makefile.in index 535d05a6e..4480ecf1f 100644 --- a/Examples/test-suite/go/Makefile.in +++ b/Examples/test-suite/go/Makefile.in @@ -24,12 +24,16 @@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ +CPP_TEST_CASES = \ + go_inout \ + go_director_inout + include $(srcdir)/../common.mk .SUFFIXES: .cpptest .ctest .multicpptest # Rules for the different types of tests -%.cpptest: +%.cpptest: $(setup) +$(swig_and_compile_cpp) $(run_testcase_cpp) @@ -39,7 +43,7 @@ include $(srcdir)/../common.mk +$(swig_and_compile_c) $(run_testcase) -%.multicpptest: +%.multicpptest: $(setup) +$(swig_and_compile_multi_cpp) $(run_multi_testcase) @@ -47,7 +51,7 @@ include $(srcdir)/../common.mk multi_import.multicpptest: $(setup) for f in multi_import_b multi_import_a; do \ - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile CXXSRCS="$(CXXSRCS)" \ + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" CXXSRCS="$(CXXSRCS)" \ SWIG_LIB="$(SWIG_LIB)" SWIG="$(SWIG)" LIBS='$(LIBS)' \ INCLUDES="$(INCLUDES)" SWIGOPT="$(SWIGOPT)" NOLINK=true \ TARGET="$(TARGETPREFIX)$${f}$(TARGETSUFFIX)" INTERFACEDIR="$(INTERFACEDIR)" INTERFACE="$$f.i" \ @@ -57,8 +61,8 @@ multi_import.multicpptest: # Runs the testcase. run_testcase = \ - if test -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \ - $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \ + if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \ + $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \ if $(GOGCC) ; then \ $(COMPILETOOL) $(GO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ $*.@OBJEXT@ $*_wrap.@OBJEXT@; \ elif $(GO12) || $(GO13); then \ @@ -70,8 +74,8 @@ run_testcase = \ fi run_testcase_cpp = \ - if test -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \ - $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \ + if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \ + $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \ if $(GOGCC) ; then \ $(COMPILETOOL) $(GO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ $*.@OBJEXT@ $*_wrap.@OBJEXT@ -lstdc++; \ elif $(GO12) || $(GO13); then \ @@ -83,8 +87,8 @@ run_testcase_cpp = \ fi run_multi_testcase = \ - if test -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \ - $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \ + if test -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); then \ + $(COMPILETOOL) $(GO) $(GOCOMPILEARG) -I . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \ if $(GOGCC) ; then \ files=`cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list`; \ $(COMPILETOOL) $(GO) -o $*_runme $(SCRIPTPREFIX)$*_runme.@OBJEXT@ `for f in $$files; do echo $$f.@OBJEXT@ $${f}_wrap.@OBJEXT@; done` -lstdc++; \ @@ -100,11 +104,12 @@ run_multi_testcase = \ @rm -f $*.go $*_gc.c $*_wrap.* $*_runme clean: - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile go_clean + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" go_clean rm -f mod_a.go mod_b.go imports_a.go imports_b.go rm -f clientdata_prop_a.go clientdata_prop_b.go rm -f multi_import_a.go multi_import_b.go rm -f packageoption_a.go packageoption_b.go packageoption_c.go + rm -f import_stl_a.go import_stl_b.go cvsignore: @echo '*_gc.c *_wrap.* *.so *.dll *.exp *.lib' diff --git a/Examples/test-suite/go/argout_runme.go b/Examples/test-suite/go/argout_runme.go new file mode 100644 index 000000000..5f7017e73 --- /dev/null +++ b/Examples/test-suite/go/argout_runme.go @@ -0,0 +1,41 @@ +package main + +import wrap "./argout" + +func main() { + ip := wrap.New_intp() + wrap.Intp_assign(ip, 42) + if r := wrap.Incp(ip); r != 42 { + panic(r) + } + if r := wrap.Intp_value(ip); r != 43 { + panic(r) + } + + p := wrap.New_intp() + wrap.Intp_assign(p, 2) + if r := wrap.Incp(p); r != 2 { + panic(r) + } + if r := wrap.Intp_value(p); r != 3 { + panic(r) + } + + r := wrap.New_intp() + wrap.Intp_assign(r, 7) + if r := wrap.Incr(r); r != 7 { + panic(r) + } + if r := wrap.Intp_value(r); r != 8 { + panic(r) + } + + tr := wrap.New_intp() + wrap.Intp_assign(tr, 4) + if r := wrap.Inctr(tr); r != 4 { + panic(r) + } + if r := wrap.Intp_value(tr); r != 5 { + panic(r) + } +} diff --git a/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go b/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go new file mode 100644 index 000000000..f4b84b1ee --- /dev/null +++ b/Examples/test-suite/go/cpp11_strongly_typed_enumerations_runme.go @@ -0,0 +1,171 @@ +package main + +import "fmt" +import . "./cpp11_strongly_typed_enumerations" + +func enumCheck(actual int, expected int) int { + if actual != expected { + panic(fmt.Sprintf("Enum value mismatch. Expected: %d Actual: %d", expected, actual)) + } + return expected + 1 +} + +func main() { + var val = 0 + val = enumCheck(int(Enum1_Val1), val) + val = enumCheck(int(Enum1_Val2), val) + val = enumCheck(int(Enum1_Val3), 13) + val = enumCheck(int(Enum1_Val4), val) + val = enumCheck(int(Enum1_Val5a), 13) + val = enumCheck(int(Enum1_Val6a), val) + + val = 0 + val = enumCheck(int(Enum2_Val1), val) + val = enumCheck(int(Enum2_Val2), val) + val = enumCheck(int(Enum2_Val3), 23) + val = enumCheck(int(Enum2_Val4), val) + val = enumCheck(int(Enum2_Val5b), 23) + val = enumCheck(int(Enum2_Val6b), val) + + val = 0 + val = enumCheck(int(Val1), val) + val = enumCheck(int(Val2), val) + val = enumCheck(int(Val3), 43) + val = enumCheck(int(Val4), val) + + val = 0 + val = enumCheck(int(Enum5_Val1), val) + val = enumCheck(int(Enum5_Val2), val) + val = enumCheck(int(Enum5_Val3), 53) + val = enumCheck(int(Enum5_Val4), val) + + val = 0 + val = enumCheck(int(Enum6_Val1), val) + val = enumCheck(int(Enum6_Val2), val) + val = enumCheck(int(Enum6_Val3), 63) + val = enumCheck(int(Enum6_Val4), val) + + val = 0 + val = enumCheck(int(Enum7td_Val1), val) + val = enumCheck(int(Enum7td_Val2), val) + val = enumCheck(int(Enum7td_Val3), 73) + val = enumCheck(int(Enum7td_Val4), val) + + val = 0 + val = enumCheck(int(Enum8_Val1), val) + val = enumCheck(int(Enum8_Val2), val) + val = enumCheck(int(Enum8_Val3), 83) + val = enumCheck(int(Enum8_Val4), val) + + val = 0 + val = enumCheck(int(Enum10_Val1), val) + val = enumCheck(int(Enum10_Val2), val) + val = enumCheck(int(Enum10_Val3), 103) + val = enumCheck(int(Enum10_Val4), val) + + val = 0 + val = enumCheck(int(Class1Enum12_Val1), 1121) + val = enumCheck(int(Class1Enum12_Val2), 1122) + val = enumCheck(int(Class1Enum12_Val3), val) + val = enumCheck(int(Class1Enum12_Val4), val) + val = enumCheck(int(Class1Enum12_Val5c), 1121) + val = enumCheck(int(Class1Enum12_Val6c), val) + + val = 0 + val = enumCheck(int(Class1Val1), 1131) + val = enumCheck(int(Class1Val2), 1132) + val = enumCheck(int(Class1Val3), val) + val = enumCheck(int(Class1Val4), val) + val = enumCheck(int(Class1Val5d), 1131) + val = enumCheck(int(Class1Val6d), val) + + val = 0 + val = enumCheck(int(Class1Enum14_Val1), 1141) + val = enumCheck(int(Class1Enum14_Val2), 1142) + val = enumCheck(int(Class1Enum14_Val3), val) + val = enumCheck(int(Class1Enum14_Val4), val) + val = enumCheck(int(Class1Enum14_Val5e), 1141) + val = enumCheck(int(Class1Enum14_Val6e), val) + + // Requires nested class support to work + //val = 0 + //val = enumCheck(int(Class1Struct1Enum12_Val1), 3121) + //val = enumCheck(int(Class1Struct1Enum12_Val2), 3122) + //val = enumCheck(int(Class1Struct1Enum12_Val3), val) + //val = enumCheck(int(Class1Struct1Enum12_Val4), val) + //val = enumCheck(int(Class1Struct1Enum12_Val5f), 3121) + //val = enumCheck(int(Class1Struct1Enum12_Val6f), val) + // + //val = 0 + //val = enumCheck(int(Class1Struct1Val1), 3131) + //val = enumCheck(int(Class1Struct1Val2), 3132) + //val = enumCheck(int(Class1Struct1Val3), val) + //val = enumCheck(int(Class1Struct1Val4), val) + // + //val = 0 + //val = enumCheck(int(Class1Struct1Enum14_Val1), 3141) + //val = enumCheck(int(Class1Struct1Enum14_Val2), 3142) + //val = enumCheck(int(Class1Struct1Enum14_Val3), val) + //val = enumCheck(int(Class1Struct1Enum14_Val4), val) + //val = enumCheck(int(Class1Struct1Enum14_Val5g), 3141) + //val = enumCheck(int(Class1Struct1Enum14_Val6g), val) + + val = 0 + val = enumCheck(int(Class2Enum12_Val1), 2121) + val = enumCheck(int(Class2Enum12_Val2), 2122) + val = enumCheck(int(Class2Enum12_Val3), val) + val = enumCheck(int(Class2Enum12_Val4), val) + val = enumCheck(int(Class2Enum12_Val5h), 2121) + val = enumCheck(int(Class2Enum12_Val6h), val) + + val = 0 + val = enumCheck(int(Class2Val1), 2131) + val = enumCheck(int(Class2Val2), 2132) + val = enumCheck(int(Class2Val3), val) + val = enumCheck(int(Class2Val4), val) + val = enumCheck(int(Class2Val5i), 2131) + val = enumCheck(int(Class2Val6i), val) + + val = 0 + val = enumCheck(int(Class2Enum14_Val1), 2141) + val = enumCheck(int(Class2Enum14_Val2), 2142) + val = enumCheck(int(Class2Enum14_Val3), val) + val = enumCheck(int(Class2Enum14_Val4), val) + val = enumCheck(int(Class2Enum14_Val5j), 2141) + val = enumCheck(int(Class2Enum14_Val6j), val) + + // Requires nested class support to work + //val = 0 + //val = enumCheck(int(Class2Struct1Enum12_Val1), 4121) + //val = enumCheck(int(Class2Struct1Enum12_Val2), 4122) + //val = enumCheck(int(Class2Struct1Enum12_Val3), val) + //val = enumCheck(int(Class2Struct1Enum12_Val4), val) + //val = enumCheck(int(Class2Struct1Enum12_Val5k), 4121) + //val = enumCheck(int(Class2Struct1Enum12_Val6k), val) + // + //val = 0 + //val = enumCheck(int(Class2Struct1Val1), 4131) + //val = enumCheck(int(Class2Struct1Val2), 4132) + //val = enumCheck(int(Class2Struct1Val3), val) + //val = enumCheck(int(Class2Struct1Val4), val) + //val = enumCheck(int(Class2Struct1Val5l), 4131) + //val = enumCheck(int(Class2Struct1Val6l), val) + // + //val = 0 + //val = enumCheck(int(Class2Struct1Enum14_Val1), 4141) + //val = enumCheck(int(Class2Struct1Enum14_Val2), 4142) + //val = enumCheck(int(Class2Struct1Enum14_Val3), val) + //val = enumCheck(int(Class2Struct1Enum14_Val4), val) + //val = enumCheck(int(Class2Struct1Enum14_Val5m), 4141) + //val = enumCheck(int(Class2Struct1Enum14_Val6m), val) + + class1 := NewClass1() + enumCheck(int(class1.Class1Test1(Enum1_Val5a)), 13) + enumCheck(int(class1.Class1Test2(Class1Enum12_Val5c)), 1121) + //enumCheck(int(class1.Class1Test3(Class1Struct1Enum12_Val5f)), 3121) + + enumCheck(int(GlobalTest1(Enum1_Val5a)), 13) + enumCheck(int(GlobalTest2(Class1Enum12_Val5c)), 1121) + //enumCheck(int(GlobalTest3(Class1Struct1Enum12_Val5f)), 3121) + +} diff --git a/Examples/test-suite/go/go_director_inout_runme.go b/Examples/test-suite/go/go_director_inout_runme.go new file mode 100644 index 000000000..9b9df318e --- /dev/null +++ b/Examples/test-suite/go/go_director_inout_runme.go @@ -0,0 +1,32 @@ +package main + +import ( + wrap "./go_director_inout" +) + +type GoMyClass struct {} + +func (p *GoMyClass) Adjust(m map[string]interface{}) wrap.GoRetStruct { + s := "" + for k, v := range m { + s += k + "," + v.(string) + ";" + } + return wrap.GoRetStruct{s} +} + +func main() { + a := wrap.NewDirectorMyClass(&GoMyClass{}) + m := map[string]interface{}{ + "first": "second", + } + s := a.Adjust(m) + if s.Str != "first,second;" { + panic(s) + } + + a = wrap.NewDirectorMyClass(nil) + s = a.Adjust(m) + if s.Str != `{"first":"second"}` { + panic(s.Str) + } +} diff --git a/Examples/test-suite/go/go_inout_runme.go b/Examples/test-suite/go/go_inout_runme.go new file mode 100644 index 000000000..13c429b87 --- /dev/null +++ b/Examples/test-suite/go/go_inout_runme.go @@ -0,0 +1,43 @@ +package main + +import ( + "encoding/json" + "fmt" + "reflect" + + "./go_inout" +) + +type S struct { + A int + B string + C float64 +} + +func (p *S) MarshalJSON() ([]byte, error) { + return json.Marshal(*p) +} + +func main() { + v := &S{12, "hi", 34.5} + m := go_inout.Same(v) + want := map[string]interface{}{ + // The type of A changes from int to float64 because + // JSON has no ints. + "A": float64(12), + "B": "hi", + "C": 34.5, + } + if !reflect.DeepEqual(m, want) { + fmt.Println("got", m, "want", want) + panic(m) + } + + a := []string{"a", "bc", "def"} + go_inout.DoubleArray(&a) + dwant := []string{"a", "bc", "def", "aa", "bcbc", "defdef"} + if !reflect.DeepEqual(a, dwant) { + fmt.Println("got", a, "want", dwant) + panic(a) + } +} diff --git a/Examples/test-suite/go/overload_polymorphic_runme.go b/Examples/test-suite/go/overload_polymorphic_runme.go new file mode 100644 index 000000000..1720e1a4d --- /dev/null +++ b/Examples/test-suite/go/overload_polymorphic_runme.go @@ -0,0 +1,11 @@ +package main + +import "./overload_polymorphic" + +func main(){ + t := overload_polymorphic.NewDerived() + + if overload_polymorphic.Test(t) != 0 { + panic("failed") + } +} diff --git a/Examples/test-suite/go_director_inout.i b/Examples/test-suite/go_director_inout.i new file mode 100644 index 000000000..af59e313c --- /dev/null +++ b/Examples/test-suite/go_director_inout.i @@ -0,0 +1,121 @@ +// Test the goin and goout typemaps for directors. + +%module(directors="1") go_director_inout + +%{ +#include <string> +%} + +%inline +%{ + +struct MyStruct { + std::string str; +}; + +struct RetStruct { + std::string str; +}; + +%} + +%go_import("encoding/json") + +%insert(go_header) +%{ + +type GoRetStruct struct { + Str string +} + +%} + +%typemap(gotype) RetStruct "GoRetStruct" + +%typemap(imtype) RetStruct "string" + +%typemap(goin) RetStruct +%{ + $result = $input.Str +%} + +%typemap(in) RetStruct +%{ + $result.str.assign($input.p, $input.n); +%} + +%typemap(out) RetStruct +%{ + $result = _swig_makegostring($1.str.data(), $1.str.length()); +%} + +%typemap(goout) RetStruct +%{ + $result = GoRetStruct{Str: $input} +%} + +%typemap(godirectorout) RetStruct +%{ + $result = $input.Str +%} + +%typemap(directorout) RetStruct +%{ + $result.str.assign($input.p, $input.n); +%} + +%typemap(godirectorin) RetStruct +%{ +%} + +%typemap(gotype) MyStruct "map[string]interface{}" + +%typemap(imtype) MyStruct "string" + +%typemap(goin) MyStruct +%{ + if b, err := json.Marshal($input); err != nil { + panic(err) + } else { + $result = string(b) + } +%} + +%typemap(directorin) MyStruct +%{ + $input = _swig_makegostring($1.str.data(), $1.str.length()); +%} + +%typemap(out) MyStruct +%{ + $result = _swig_makegostring($1.str.data(), $1.str.length()); +%} + +%typemap(godirectorin) MyStruct +%{ + if err := json.Unmarshal([]byte($input), &$result); err != nil { + panic(err) + } +%} + +%typemap(in) MyStruct +%{ + $1.str.assign($input.p, $input.n); +%} + +%feature("director") MyClass; + +%inline +%{ + +class MyClass { + public: + virtual ~MyClass() {} + virtual RetStruct Adjust(MyStruct s) { + RetStruct r; + r.str = s.str; + return r; + } +}; + +%} diff --git a/Examples/test-suite/go_inout.i b/Examples/test-suite/go_inout.i new file mode 100644 index 000000000..510ed68e0 --- /dev/null +++ b/Examples/test-suite/go_inout.i @@ -0,0 +1,199 @@ +// Test the goin, goout, and goargout typemaps. + +%module go_inout + +%{ +#include <string> +#include <vector> +#include <stdint.h> +%} + +%inline +%{ + +struct MyStruct { + std::string str; +}; + +struct RetStruct { + std::string str; +}; + +%} + +// Write a typemap that calls C++ by converting in and out of JSON. + +%go_import("encoding/json", "bytes", "encoding/binary") + +%insert(go_header) +%{ + +type In json.Marshaler + +%} + +%typemap(gotype) MyStruct "In" + +%typemap(imtype) MyStruct "string" + +%typemap(goin) MyStruct +%{ + { + b, err := $input.MarshalJSON() + if err != nil { + panic(err) + } + $result = string(b) + } +%} + +%typemap(in) MyStruct +%{ + $1.str.assign($input.p, $input.n); +%} + +%typemap(gotype) RetStruct "map[string]interface{}" + +%typemap(imtype) RetStruct "string" + +%typemap(out) RetStruct +%{ + $result = _swig_makegostring($1.str.data(), $1.str.length()); +%} + +%typemap(goout) RetStruct +%{ + if err := json.Unmarshal([]byte($1), &$result); err != nil { + panic(err) + } +%} + +%inline +%{ + +RetStruct Same(MyStruct s) +{ + RetStruct r; + r.str = s.str; + return r; +} + +%} + +%inline +%{ + +struct MyArray { + std::vector<std::string> strings; +}; + +static uint64_t getuint64(const char* s) { + uint64_t ret = 0; + for (int i = 0; i < 8; i++, s++) { + ret |= static_cast<uint64_t>(*s) << i * 8; + } + return ret; +} + +static void putuint64(std::string *s, size_t off, uint64_t v) { + for (int i = 0; i < 8; i++) { + (*s)[off + i] = (v >> (i * 8)) & 0xff; + } +} + +%} + +%typemap(gotype) MyArray* "*[]string" + +%typemap(imtype) MyArray* "*string" + +// Encode the slice as a single string, with length prefixes. +%typemap(goin) MyArray* +%{ + { + var buf bytes.Buffer + bin := binary.LittleEndian + var b [8]byte + bin.PutUint64(b[:], uint64(len(*$input))) + buf.Write(b[:]) + for _, s := range *$input { + bin.PutUint64(b[:], uint64(len(s))) + buf.Write(b[:]) + buf.WriteString(s) + } + str := buf.String() + $result = &str + } +%} + +// Unpack the string holding the packed slice. +%typemap(in) MyArray* (MyArray t) +%{ + { + _gostring_ *s = $input; + const char *p = static_cast<const char *>(s->p); + uint64_t len = getuint64(p); + p += 8; + t.strings.resize(len); + for (uint64_t i = 0; i < len; i++) { + uint64_t slen = getuint64(p); + p += 8; + t.strings[i].assign(p, slen); + p += slen; + } + $1 = &t; + } +%} + +// Pack the vector into a string. +%typemap(argout) MyArray* +%{ + { + size_t tot = 8; + std::vector<std::string>::const_iterator p; + for (p = $1->strings.begin(); p != $1->strings.end(); ++p) { + tot += 8 + p->size(); + } + std::string str; + str.resize(tot); + putuint64(&str, 0, $1->strings.size()); + size_t off = 8; + for (p = $1->strings.begin(); p != $1->strings.end(); ++p) { + putuint64(&str, off, p->size()); + off += 8; + str.replace(off, p->size(), *p); + off += p->size(); + } + *$input = _swig_makegostring(str.data(), str.size()); + } +%} + +// Unpack the string into a []string. +%typemap(goargout) MyArray* +%{ + { + str := *$input + bin := binary.LittleEndian + size := bin.Uint64([]byte(str[:8])) + str = str[8:] + r := make([]string, size) + for i := range r { + len := bin.Uint64([]byte(str[:8])) + str = str[8:] + r[i] = str[:len] + str = str[len:] + } + *$1 = r + } + +%} + +%inline +%{ +void DoubleArray(MyArray* v) { + size_t size = v->strings.size(); + for (size_t i = 0; i < size; i++) { + v->strings.push_back(v->strings[i] + v->strings[i]); + } +} +%} diff --git a/Examples/test-suite/guile/Makefile.in b/Examples/test-suite/guile/Makefile.in index 0c7b3137c..9050d76f5 100644 --- a/Examples/test-suite/guile/Makefile.in +++ b/Examples/test-suite/guile/Makefile.in @@ -7,16 +7,18 @@ EXTRA_TEST_CASES += guile_ext_test.externaltest LANGUAGE = guile VARIANT = SCRIPTSUFFIX = _runme.scm + srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ + GUILE = @GUILE@ GUILE_RUNTIME= C_TEST_CASES = long_long \ - list_vector \ - multivalue \ - pointer_in_out + list_vector \ + multivalue \ + pointer_in_out include $(srcdir)/../common.mk @@ -28,7 +30,7 @@ INCLUDES += -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/guile %.multicpptest: SWIGOPT += $(GUILE_RUNTIME) # Rules for the different types of tests -%.cpptest: +%.cpptest: $(setup) +$(swig_and_compile_cpp) $(run_testcase) @@ -38,7 +40,7 @@ INCLUDES += -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/guile +$(swig_and_compile_c) $(run_testcase) -%.multicpptest: +%.multicpptest: $(setup) +$(swig_and_compile_multi_cpp) $(run_testcase) @@ -51,8 +53,8 @@ INCLUDES += -I$(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/guile # Runs the testcase. A testcase is only run if # a file is found which has _runme.scm appended after the testcase name. run_testcase = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - env GUILE_AUTO_COMPILE=0 LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + env GUILE_AUTO_COMPILE=0 LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(GUILE) -l $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ fi # Clean @@ -60,4 +62,4 @@ run_testcase = \ @rm -f $*-guile clean: - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile guile_clean + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" guile_clean diff --git a/Examples/test-suite/import_nomodule.i b/Examples/test-suite/import_nomodule.i index 4fd5cbf65..60ef7e0f6 100644 --- a/Examples/test-suite/import_nomodule.i +++ b/Examples/test-suite/import_nomodule.i @@ -8,7 +8,7 @@ %import "import_nomodule.h" -#if !defined(SWIGJAVA) && !defined(SWIGRUBY) && !defined(SWIGCSHARP) && !defined(SWIGD) +#if !defined(SWIGJAVA) && !defined(SWIGRUBY) && !defined(SWIGCSHARP) && !defined(SWIGD) && !defined(SWIGPYTHON_BUILTIN) /** * The proxy class does not have Bar derived from Foo, yet an instance of Bar @@ -40,3 +40,10 @@ class Bar : public Foo { }; #endif +%inline %{ +#ifdef SWIGPYTHON_BUILTIN +bool is_python_builtin() { return true; } +#else +bool is_python_builtin() { return false; } +#endif +%} diff --git a/Examples/test-suite/infinity.i b/Examples/test-suite/infinity.i index 726150f02..e95bdf9cf 100644 --- a/Examples/test-suite/infinity.i +++ b/Examples/test-suite/infinity.i @@ -10,15 +10,16 @@ #include <math.h> /* C99 math.h defines INFINITY. If not available, this is the fallback. */ -#ifndef INFINITY - #ifdef _MSC_VER +#if !defined(INFINITY) + #if defined(_MSC_VER) union MSVC_EVIL_FLOAT_HACK { unsigned __int8 Bytes[4]; float Value; }; - static union MSVC_EVIL_FLOAT_HACK INFINITY_HACK = {{0x00, 0x00, 0x80, 0x7F}}; + const union MSVC_EVIL_FLOAT_HACK INFINITY_HACK = {{0x00, 0x00, 0x80, 0x7F}}; #define INFINITY (INFINITY_HACK.Value) + #define INFINITY_NO_CONST #endif #ifdef __GNUC__ @@ -33,15 +34,28 @@ #define INFINITY (1e1000) #endif #endif -%} -%inline %{ -/* This will allow us to bind the real INFINITY value through SWIG via MYINFINITY. Use %rename to fix the name. */ +#ifdef INFINITY_NO_CONST +/* To void: error C2099: initializer is not a constant */ +double MYINFINITY = 0.0; +void initialise_MYINFINITY(void) { + MYINFINITY = INFINITY; +} +#else const double MYINFINITY = INFINITY; +void initialise_MYINFINITY(void) { +} +#endif -/* Use of float is intentional because the original bug was in the float conversion due to overflow checking. */ float use_infinity(float inf_val) { return inf_val; } %} + +/* This will allow us to bind the real INFINITY value through SWIG via MYINFINITY. Use %rename to fix the name. */ +const double MYINFINITY = INFINITY; +void initialise_MYINFINITY(void); +/* Use of float is intentional because the original bug was in the float conversion due to overflow checking. */ +float use_infinity(float inf_val); + diff --git a/Examples/test-suite/java/Makefile.in b/Examples/test-suite/java/Makefile.in index 059325c13..310f1a773 100644 --- a/Examples/test-suite/java/Makefile.in +++ b/Examples/test-suite/java/Makefile.in @@ -7,6 +7,7 @@ JAVA = @JAVA@ JAVAC = @JAVAC@ JAVAFLAGS = -Xcheck:jni SCRIPTSUFFIX = _runme.java + srcdir = @srcdir@ top_srcdir = ../@top_srcdir@ top_builddir = ../@top_builddir@ @@ -39,9 +40,13 @@ CPP_TEST_CASES = \ java_typemaps_typewrapper # li_boost_intrusive_ptr +CPP11_TEST_CASES = \ + cpp11_strongly_typed_enumerations_simple \ + include $(srcdir)/../common.mk # Overridden variables here +SRCDIR = ../$(srcdir)/ JAVA_PACKAGE = $* JAVA_PACKAGEOPT = -package $(JAVA_PACKAGE) SWIGOPT += $(JAVA_PACKAGEOPT) @@ -55,7 +60,7 @@ director_nspace.%: JAVA_PACKAGE = $*Package director_nspace_director_name_collision.%: JAVA_PACKAGE = $*Package # Rules for the different types of tests -%.cpptest: +%.cpptest: $(setup) +(cd $(JAVA_PACKAGE) && $(swig_and_compile_cpp)) $(run_testcase) @@ -65,14 +70,14 @@ director_nspace_director_name_collision.%: JAVA_PACKAGE = $*Package +(cd $(JAVA_PACKAGE) && $(swig_and_compile_c)) $(run_testcase) -%.multicpptest: +%.multicpptest: $(setup) +(cd $(JAVA_PACKAGE) && $(swig_and_compile_multi_cpp)) $(run_testcase) # Makes a directory for the testcase if it does not exist setup = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ echo "$(ACTION)ing $(LANGUAGE) testcase $* (with run test)" ; \ else \ echo "$(ACTION)ing $(LANGUAGE) testcase $*" ; \ @@ -86,8 +91,8 @@ setup = \ # Note Java uses LD_LIBRARY_PATH under Unix, PATH under Cygwin/Windows, SHLIB_PATH on HPUX and DYLD_LIBRARY_PATH on Mac OS X. run_testcase = \ cd $(JAVA_PACKAGE) && $(COMPILETOOL) $(JAVAC) -classpath . `find . -name "*.java"` && cd .. && \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - $(COMPILETOOL) $(JAVAC) -classpath . -d . $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + $(COMPILETOOL) $(JAVAC) -classpath . -d . $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) && \ env LD_LIBRARY_PATH="$(JAVA_PACKAGE):$$LD_LIBRARY_PATH" PATH="$(JAVA_PACKAGE):$$PATH" SHLIB_PATH="$(JAVA_PACKAGE):$$SHLIB_PATH" DYLD_LIBRARY_PATH="$(JAVA_PACKAGE):$$DYLD_LIBRARY_PATH" $(RUNTOOL) $(JAVA) $(JAVAFLAGS) -classpath . $*_runme; \ fi diff --git a/Examples/test-suite/java/constant_directive_runme.java b/Examples/test-suite/java/constant_directive_runme.java new file mode 100644 index 000000000..b5135a499 --- /dev/null +++ b/Examples/test-suite/java/constant_directive_runme.java @@ -0,0 +1,22 @@ +import constant_directive.*; + +public class constant_directive_runme { + + static { + try { + System.loadLibrary("constant_directive"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) { + if (constant_directive.TYPE1_CONSTANT1.getVal() != 1) + throw new RuntimeException("fail"); + if (constant_directive.TYPE1_CONSTANT2.getVal() != 2) + throw new RuntimeException("fail"); + if (constant_directive.TYPE1_CONSTANT3.getVal() != 3) + throw new RuntimeException("fail"); + } +} diff --git a/Examples/test-suite/java/cpp11_strongly_typed_enumerations_runme.java b/Examples/test-suite/java/cpp11_strongly_typed_enumerations_runme.java new file mode 100644 index 000000000..3e0b3f651 --- /dev/null +++ b/Examples/test-suite/java/cpp11_strongly_typed_enumerations_runme.java @@ -0,0 +1,176 @@ +import cpp11_strongly_typed_enumerations.*; + +public class cpp11_strongly_typed_enumerations_runme { + + static { + try { + System.loadLibrary("cpp11_strongly_typed_enumerations"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static int enumCheck(int actual, int expected) { + if (actual != expected) + throw new RuntimeException("Enum value mismatch. Expected " + expected + " Actual: " + actual); + return expected + 1; + } + + public static void main(String argv[]) { + int val = 0; + val = enumCheck(Enum1.Val1.swigValue(), val); + val = enumCheck(Enum1.Val2.swigValue(), val); + val = enumCheck(Enum1.Val3.swigValue(), 13); + val = enumCheck(Enum1.Val4.swigValue(), val); + val = enumCheck(Enum1.Val5a.swigValue(), 13); + val = enumCheck(Enum1.Val6a.swigValue(), val); + + val = 0; + val = enumCheck(Enum2.Val1.swigValue(), val); + val = enumCheck(Enum2.Val2.swigValue(), val); + val = enumCheck(Enum2.Val3.swigValue(), 23); + val = enumCheck(Enum2.Val4.swigValue(), val); + val = enumCheck(Enum2.Val5b.swigValue(), 23); + val = enumCheck(Enum2.Val6b.swigValue(), val); + + val = 0; + val = enumCheck(Enum4.Val1.swigValue(), val); + val = enumCheck(Enum4.Val2.swigValue(), val); + val = enumCheck(Enum4.Val3.swigValue(), 43); + val = enumCheck(Enum4.Val4.swigValue(), val); + + val = 0; + val = enumCheck(Enum5.Val1.swigValue(), val); + val = enumCheck(Enum5.Val2.swigValue(), val); + val = enumCheck(Enum5.Val3.swigValue(), 53); + val = enumCheck(Enum5.Val4.swigValue(), val); + + val = 0; + val = enumCheck(Enum6.Val1.swigValue(), val); + val = enumCheck(Enum6.Val2.swigValue(), val); + val = enumCheck(Enum6.Val3.swigValue(), 63); + val = enumCheck(Enum6.Val4.swigValue(), val); + + val = 0; + val = enumCheck(Enum7td.Val1.swigValue(), val); + val = enumCheck(Enum7td.Val2.swigValue(), val); + val = enumCheck(Enum7td.Val3.swigValue(), 73); + val = enumCheck(Enum7td.Val4.swigValue(), val); + + val = 0; + val = enumCheck(Enum8.Val1.swigValue(), val); + val = enumCheck(Enum8.Val2.swigValue(), val); + val = enumCheck(Enum8.Val3.swigValue(), 83); + val = enumCheck(Enum8.Val4.swigValue(), val); + + val = 0; + val = enumCheck(Enum10.Val1.swigValue(), val); + val = enumCheck(Enum10.Val2.swigValue(), val); + val = enumCheck(Enum10.Val3.swigValue(), 103); + val = enumCheck(Enum10.Val4.swigValue(), val); + + val = 0; + val = enumCheck(Class1.Enum12.Val1.swigValue(), 1121); + val = enumCheck(Class1.Enum12.Val2.swigValue(), 1122); + val = enumCheck(Class1.Enum12.Val3.swigValue(), val); + val = enumCheck(Class1.Enum12.Val4.swigValue(), val); + val = enumCheck(Class1.Enum12.Val5c.swigValue(), 1121); + val = enumCheck(Class1.Enum12.Val6c.swigValue(), val); + + val = 0; + val = enumCheck(Class1.Enum13.Val1.swigValue(), 1131); + val = enumCheck(Class1.Enum13.Val2.swigValue(), 1132); + val = enumCheck(Class1.Enum13.Val3.swigValue(), val); + val = enumCheck(Class1.Enum13.Val4.swigValue(), val); + val = enumCheck(Class1.Enum13.Val5d.swigValue(), 1131); + val = enumCheck(Class1.Enum13.Val6d.swigValue(), val); + + val = 0; + val = enumCheck(Class1.Enum14.Val1.swigValue(), 1141); + val = enumCheck(Class1.Enum14.Val2.swigValue(), 1142); + val = enumCheck(Class1.Enum14.Val3.swigValue(), val); + val = enumCheck(Class1.Enum14.Val4.swigValue(), val); + val = enumCheck(Class1.Enum14.Val5e.swigValue(), 1141); + val = enumCheck(Class1.Enum14.Val6e.swigValue(), val); + + val = 0; + val = enumCheck(Class1.Struct1.Enum12.Val1.swigValue(), 3121); + val = enumCheck(Class1.Struct1.Enum12.Val2.swigValue(), 3122); + val = enumCheck(Class1.Struct1.Enum12.Val3.swigValue(), val); + val = enumCheck(Class1.Struct1.Enum12.Val4.swigValue(), val); + val = enumCheck(Class1.Struct1.Enum12.Val5f.swigValue(), 3121); + val = enumCheck(Class1.Struct1.Enum12.Val6f.swigValue(), val); + + val = 0; + val = enumCheck(Class1.Struct1.Enum13.Val1.swigValue(), 3131); + val = enumCheck(Class1.Struct1.Enum13.Val2.swigValue(), 3132); + val = enumCheck(Class1.Struct1.Enum13.Val3.swigValue(), val); + val = enumCheck(Class1.Struct1.Enum13.Val4.swigValue(), val); + + val = 0; + val = enumCheck(Class1.Struct1.Enum14.Val1.swigValue(), 3141); + val = enumCheck(Class1.Struct1.Enum14.Val2.swigValue(), 3142); + val = enumCheck(Class1.Struct1.Enum14.Val3.swigValue(), val); + val = enumCheck(Class1.Struct1.Enum14.Val4.swigValue(), val); + val = enumCheck(Class1.Struct1.Enum14.Val5g.swigValue(), 3141); + val = enumCheck(Class1.Struct1.Enum14.Val6g.swigValue(), val); + + val = 0; + val = enumCheck(Class2.Enum12.Val1.swigValue(), 2121); + val = enumCheck(Class2.Enum12.Val2.swigValue(), 2122); + val = enumCheck(Class2.Enum12.Val3.swigValue(), val); + val = enumCheck(Class2.Enum12.Val4.swigValue(), val); + val = enumCheck(Class2.Enum12.Val5h.swigValue(), 2121); + val = enumCheck(Class2.Enum12.Val6h.swigValue(), val); + + val = 0; + val = enumCheck(Class2.Enum13.Val1.swigValue(), 2131); + val = enumCheck(Class2.Enum13.Val2.swigValue(), 2132); + val = enumCheck(Class2.Enum13.Val3.swigValue(), val); + val = enumCheck(Class2.Enum13.Val4.swigValue(), val); + val = enumCheck(Class2.Enum13.Val5i.swigValue(), 2131); + val = enumCheck(Class2.Enum13.Val6i.swigValue(), val); + + val = 0; + val = enumCheck(Class2.Enum14.Val1.swigValue(), 2141); + val = enumCheck(Class2.Enum14.Val2.swigValue(), 2142); + val = enumCheck(Class2.Enum14.Val3.swigValue(), val); + val = enumCheck(Class2.Enum14.Val4.swigValue(), val); + val = enumCheck(Class2.Enum14.Val5j.swigValue(), 2141); + val = enumCheck(Class2.Enum14.Val6j.swigValue(), val); + + val = 0; + val = enumCheck(Class2.Struct1.Enum12.Val1.swigValue(), 4121); + val = enumCheck(Class2.Struct1.Enum12.Val2.swigValue(), 4122); + val = enumCheck(Class2.Struct1.Enum12.Val3.swigValue(), val); + val = enumCheck(Class2.Struct1.Enum12.Val4.swigValue(), val); + val = enumCheck(Class2.Struct1.Enum12.Val5k.swigValue(), 4121); + val = enumCheck(Class2.Struct1.Enum12.Val6k.swigValue(), val); + + val = 0; + val = enumCheck(Class2.Struct1.Enum13.Val1.swigValue(), 4131); + val = enumCheck(Class2.Struct1.Enum13.Val2.swigValue(), 4132); + val = enumCheck(Class2.Struct1.Enum13.Val3.swigValue(), val); + val = enumCheck(Class2.Struct1.Enum13.Val4.swigValue(), val); + val = enumCheck(Class2.Struct1.Enum13.Val5l.swigValue(), 4131); + val = enumCheck(Class2.Struct1.Enum13.Val6l.swigValue(), val); + + val = 0; + val = enumCheck(Class2.Struct1.Enum14.Val1.swigValue(), 4141); + val = enumCheck(Class2.Struct1.Enum14.Val2.swigValue(), 4142); + val = enumCheck(Class2.Struct1.Enum14.Val3.swigValue(), val); + val = enumCheck(Class2.Struct1.Enum14.Val4.swigValue(), val); + val = enumCheck(Class2.Struct1.Enum14.Val5m.swigValue(), 4141); + val = enumCheck(Class2.Struct1.Enum14.Val6m.swigValue(), val); + + Class1 class1 = new Class1(); + enumCheck(class1.class1Test1(Enum1.Val5a).swigValue(), 13); + enumCheck(class1.class1Test2(Class1.Enum12.Val5c).swigValue(), 1121); + enumCheck(class1.class1Test3(Class1.Struct1.Enum12.Val5f).swigValue(), 3121); + + enumCheck(cpp11_strongly_typed_enumerations.globalTest1(Enum1.Val5a).swigValue(), 13); + enumCheck(cpp11_strongly_typed_enumerations.globalTest2(Class1.Enum12.Val5c).swigValue(), 1121); + enumCheck(cpp11_strongly_typed_enumerations.globalTest3(Class1.Struct1.Enum12.Val5f).swigValue(), 3121); + } +} diff --git a/Examples/test-suite/java/cpp11_strongly_typed_enumerations_simple_runme.java b/Examples/test-suite/java/cpp11_strongly_typed_enumerations_simple_runme.java new file mode 100644 index 000000000..b50e94893 --- /dev/null +++ b/Examples/test-suite/java/cpp11_strongly_typed_enumerations_simple_runme.java @@ -0,0 +1,176 @@ +import cpp11_strongly_typed_enumerations_simple.*; + +public class cpp11_strongly_typed_enumerations_simple_runme { + + static { + try { + System.loadLibrary("cpp11_strongly_typed_enumerations_simple"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static int enumCheck(int actual, int expected) { + if (actual != expected) + throw new RuntimeException("Enum value mismatch. Expected " + expected + " Actual: " + actual); + return expected + 1; + } + + public static void main(String argv[]) { + int val = 0; + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum1_Val1, val); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum1_Val2, val); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum1_Val3, 13); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum1_Val4, val); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum1_Val5a, 13); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum1_Val6a, val); + + val = 0; + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum2_Val1, val); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum2_Val2, val); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum2_Val3, 23); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum2_Val4, val); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum2_Val5b, 23); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum2_Val6b, val); + + val = 0; + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Val1, val); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Val2, val); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Val3, 43); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Val4, val); + + val = 0; + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum5_Val1, val); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum5_Val2, val); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum5_Val3, 53); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum5_Val4, val); + + val = 0; + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum6_Val1, val); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum6_Val2, val); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum6_Val3, 63); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum6_Val4, val); + + val = 0; + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum7td_Val1, val); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum7td_Val2, val); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum7td_Val3, 73); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum7td_Val4, val); + + val = 0; + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum8_Val1, val); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum8_Val2, val); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum8_Val3, 83); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum8_Val4, val); + + val = 0; + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum10_Val1, val); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum10_Val2, val); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum10_Val3, 103); + val = enumCheck(cpp11_strongly_typed_enumerations_simple.Enum10_Val4, val); + + val = 0; + val = enumCheck(Class1.Enum12_Val1, 1121); + val = enumCheck(Class1.Enum12_Val2, 1122); + val = enumCheck(Class1.Enum12_Val3, val); + val = enumCheck(Class1.Enum12_Val4, val); + val = enumCheck(Class1.Enum12_Val5c, 1121); + val = enumCheck(Class1.Enum12_Val6c, val); + + val = 0; + val = enumCheck(Class1.Val1, 1131); + val = enumCheck(Class1.Val2, 1132); + val = enumCheck(Class1.Val3, val); + val = enumCheck(Class1.Val4, val); + val = enumCheck(Class1.Val5d, 1131); + val = enumCheck(Class1.Val6d, val); + + val = 0; + val = enumCheck(Class1.Enum14_Val1, 1141); + val = enumCheck(Class1.Enum14_Val2, 1142); + val = enumCheck(Class1.Enum14_Val3, val); + val = enumCheck(Class1.Enum14_Val4, val); + val = enumCheck(Class1.Enum14_Val5e, 1141); + val = enumCheck(Class1.Enum14_Val6e, val); + + val = 0; + val = enumCheck(Class1.Struct1.Enum12_Val1, 3121); + val = enumCheck(Class1.Struct1.Enum12_Val2, 3122); + val = enumCheck(Class1.Struct1.Enum12_Val3, val); + val = enumCheck(Class1.Struct1.Enum12_Val4, val); + val = enumCheck(Class1.Struct1.Enum12_Val5f, 3121); + val = enumCheck(Class1.Struct1.Enum12_Val6f, val); + + val = 0; + val = enumCheck(Class1.Struct1.Val1, 3131); + val = enumCheck(Class1.Struct1.Val2, 3132); + val = enumCheck(Class1.Struct1.Val3, val); + val = enumCheck(Class1.Struct1.Val4, val); + + val = 0; + val = enumCheck(Class1.Struct1.Enum14_Val1, 3141); + val = enumCheck(Class1.Struct1.Enum14_Val2, 3142); + val = enumCheck(Class1.Struct1.Enum14_Val3, val); + val = enumCheck(Class1.Struct1.Enum14_Val4, val); + val = enumCheck(Class1.Struct1.Enum14_Val5g, 3141); + val = enumCheck(Class1.Struct1.Enum14_Val6g, val); + + val = 0; + val = enumCheck(Class2.Enum12_Val1, 2121); + val = enumCheck(Class2.Enum12_Val2, 2122); + val = enumCheck(Class2.Enum12_Val3, val); + val = enumCheck(Class2.Enum12_Val4, val); + val = enumCheck(Class2.Enum12_Val5h, 2121); + val = enumCheck(Class2.Enum12_Val6h, val); + + val = 0; + val = enumCheck(Class2.Val1, 2131); + val = enumCheck(Class2.Val2, 2132); + val = enumCheck(Class2.Val3, val); + val = enumCheck(Class2.Val4, val); + val = enumCheck(Class2.Val5i, 2131); + val = enumCheck(Class2.Val6i, val); + + val = 0; + val = enumCheck(Class2.Enum14_Val1, 2141); + val = enumCheck(Class2.Enum14_Val2, 2142); + val = enumCheck(Class2.Enum14_Val3, val); + val = enumCheck(Class2.Enum14_Val4, val); + val = enumCheck(Class2.Enum14_Val5j, 2141); + val = enumCheck(Class2.Enum14_Val6j, val); + + val = 0; + val = enumCheck(Class2.Struct1.Enum12_Val1, 4121); + val = enumCheck(Class2.Struct1.Enum12_Val2, 4122); + val = enumCheck(Class2.Struct1.Enum12_Val3, val); + val = enumCheck(Class2.Struct1.Enum12_Val4, val); + val = enumCheck(Class2.Struct1.Enum12_Val5k, 4121); + val = enumCheck(Class2.Struct1.Enum12_Val6k, val); + + val = 0; + val = enumCheck(Class2.Struct1.Val1, 4131); + val = enumCheck(Class2.Struct1.Val2, 4132); + val = enumCheck(Class2.Struct1.Val3, val); + val = enumCheck(Class2.Struct1.Val4, val); + val = enumCheck(Class2.Struct1.Val5l, 4131); + val = enumCheck(Class2.Struct1.Val6l, val); + + val = 0; + val = enumCheck(Class2.Struct1.Enum14_Val1, 4141); + val = enumCheck(Class2.Struct1.Enum14_Val2, 4142); + val = enumCheck(Class2.Struct1.Enum14_Val3, val); + val = enumCheck(Class2.Struct1.Enum14_Val4, val); + val = enumCheck(Class2.Struct1.Enum14_Val5m, 4141); + val = enumCheck(Class2.Struct1.Enum14_Val6m, val); + + Class1 class1 = new Class1(); + enumCheck(class1.class1Test1(cpp11_strongly_typed_enumerations_simple.Enum1_Val5a), 13); + enumCheck(class1.class1Test2(Class1.Enum12_Val5c), 1121); + enumCheck(class1.class1Test3(Class1.Struct1.Enum12_Val5f), 3121); + + enumCheck(cpp11_strongly_typed_enumerations_simple.globalTest1(cpp11_strongly_typed_enumerations_simple.Enum1_Val5a), 13); + enumCheck(cpp11_strongly_typed_enumerations_simple.globalTest2(Class1.Enum12_Val5c), 1121); + enumCheck(cpp11_strongly_typed_enumerations_simple.globalTest3(Class1.Struct1.Enum12_Val5f), 3121); + } +} diff --git a/Examples/test-suite/java/director_nested_class_runme.java b/Examples/test-suite/java/director_nested_class_runme.java new file mode 100644 index 000000000..5144413b7 --- /dev/null +++ b/Examples/test-suite/java/director_nested_class_runme.java @@ -0,0 +1,41 @@ + +import director_nested_class.*; + +public class director_nested_class_runme { + + static { + try { + System.loadLibrary("director_nested_class"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) { + + director_nested_class_Derived d = new director_nested_class_Derived(); + + if (DirectorOuter.callMethod(d, 999) != 9990) { + throw new RuntimeException("callMethod(999) failed"); + } + + director_nested_class_DerivedInnerInner dinner = new director_nested_class_DerivedInnerInner(); + + if (DirectorOuter.callInnerInnerMethod(dinner, 999) != 999000) { + throw new RuntimeException("callMethod(999) failed"); + } + } +} + +class director_nested_class_Derived extends DirectorOuter.DirectorInner { + public int vmethod(int input) { + return input * 10; + } +} + +class director_nested_class_DerivedInnerInner extends DirectorOuter.DirectorInner.DirectorInnerInner { + public int innervmethod(int input) { + return input * 1000; + } +} diff --git a/Examples/test-suite/java/java_director_runme.java b/Examples/test-suite/java/java_director_runme.java index 812e791f4..2167d2621 100644 --- a/Examples/test-suite/java/java_director_runme.java +++ b/Examples/test-suite/java/java_director_runme.java @@ -53,7 +53,7 @@ public class java_director_runme { }; int actualCount = Quux.instances(); if (actualCount != expectedCount) - throw new RuntimeException("Expected count: " + expectedCount + " Actual count: " + actualCount); + System.err.println("GC failed to run (java_director). Expected count: " + expectedCount + " Actual count: " + actualCount); // Finalizers are not guaranteed to be run and sometimes they just don't } /* Test Quux1's director disconnect method rename */ diff --git a/Examples/test-suite/java/java_lib_various_runme.java b/Examples/test-suite/java/java_lib_various_runme.java index 203a30ec2..6d9e13e31 100644 --- a/Examples/test-suite/java/java_lib_various_runme.java +++ b/Examples/test-suite/java/java_lib_various_runme.java @@ -83,6 +83,25 @@ public class java_lib_various_runme { if (byjove[i] != b[i]) throw new RuntimeException("By jove, it failed: [" + new String(b) + "]"); } + + // NIOBUFFER typemap check + java.nio.ByteBuffer buf = java.nio.ByteBuffer.allocateDirect(10); + java_lib_various.niobuffer_fill_hello(buf); + if ( + (char)buf.get(0) != 'h' || + (char)buf.get(1) != 'e' || + (char)buf.get(2) != 'l' || + (char)buf.get(3) != 'l' || + (char)buf.get(4) != 'o' + ) + throw new RuntimeException( + "nio test failed: " + + (char)buf.get(0) + + (char)buf.get(1) + + (char)buf.get(2) + + (char)buf.get(3) + + (char)buf.get(4) + ); } } diff --git a/Examples/test-suite/java/kwargs_feature_runme.java b/Examples/test-suite/java/kwargs_feature_runme.java new file mode 100644 index 000000000..ba742d9ec --- /dev/null +++ b/Examples/test-suite/java/kwargs_feature_runme.java @@ -0,0 +1,23 @@ +import kwargs_feature.*; + +public class kwargs_feature_runme { + + static { + try { + System.loadLibrary("kwargs_feature"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) { + // Check normal overloading still works (no compactdefaultargs) if the kwargs feature is used, + // as the kwargs feature is not supported + Foo f = new Foo(99); + if (f.foo() != 1) + throw new RuntimeException("It went wrong"); + if (Foo.statfoo(2) != 2) + throw new RuntimeException("It went wrong"); + } +} diff --git a/Examples/test-suite/java/li_boost_intrusive_ptr_runme.java b/Examples/test-suite/java/li_boost_intrusive_ptr_runme.java index 530008a87..750ec5067 100644 --- a/Examples/test-suite/java/li_boost_intrusive_ptr_runme.java +++ b/Examples/test-suite/java/li_boost_intrusive_ptr_runme.java @@ -33,7 +33,7 @@ public class li_boost_intrusive_ptr_runme { // Change loop count to run for a long time to monitor memory final int loopCount = 5000; //5000; for (int i=0; i<loopCount; i++) { - new li_boost_intrusive_ptr_runme().runtest(); + new li_boost_intrusive_ptr_runme().runtest(i); System.gc(); System.runFinalization(); try { @@ -78,7 +78,9 @@ public class li_boost_intrusive_ptr_runme { System.out.println("Finished"); } - private void runtest() { + private int loopCount = 0; + private void runtest(int loopCount) { + this.loopCount = loopCount; // simple shared_ptr usage - created in C++ { Klass k = new Klass("me oh my"); @@ -671,36 +673,36 @@ private void toIgnore() { } private void verifyValue(String expected, String got) { if (!expected.equals(got)) - throw new RuntimeException("verify value failed. Expected: " + expected + " Got: " + got); + throw new RuntimeException("verify value failed. Expected: " + expected + " Got: " + got + " loopCount: " + loopCount); } private void verifyCount(int expected, Klass k) { int got = li_boost_intrusive_ptr.use_count(k); if (expected != got) - throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got); + throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got + " loopCount: " + loopCount); } private void verifyCount(int expected, KlassDerived kd) { int got = li_boost_intrusive_ptr.use_count(kd); if (expected != got) - throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got); + throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got + " loopCount: " + loopCount); } private void verifyCount(int expected, KlassDerivedDerived kdd) { int got = li_boost_intrusive_ptr.use_count(kdd); if (expected != got) - throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got); + throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got + " loopCount: " + loopCount); } private void verifyIntrusiveCount(int expected, Klass k) { int got = k.use_count(); if (expected != got) - throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got); + throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got + " loopCount: " + loopCount); } private void verifyIntrusiveCount(int expected, KlassDerived kd) { int got = kd.use_count(); if (expected != got) - throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got); + throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got + " loopCount: " + loopCount); } private void verifyIntrusiveCount(int expected, KlassDerivedDerived kdd) { int got = kdd.use_count(); if (expected != got) - throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got); + throw new RuntimeException("verify use_count failed. Expected: " + expected + " Got: " + got + " loopCount: " + loopCount); } } diff --git a/Examples/test-suite/java/li_boost_shared_ptr_runme.java b/Examples/test-suite/java/li_boost_shared_ptr_runme.java index aa355c86a..64c356f8e 100644 --- a/Examples/test-suite/java/li_boost_shared_ptr_runme.java +++ b/Examples/test-suite/java/li_boost_shared_ptr_runme.java @@ -59,7 +59,7 @@ public class li_boost_shared_ptr_runme { } int actualCount = Klass.getTotal_count(); if (actualCount != expectedCount) - throw new RuntimeException("Expected count: " + expectedCount + " Actual count: " + actualCount); + System.err.println("GC failed to run (li_boost_shared_ptr). Expected count: " + expectedCount + " Actual count: " + actualCount); // Finalizers are not guaranteed to be run and sometimes they just don't } int wrapper_count = li_boost_shared_ptr.shared_ptr_wrapper_count(); diff --git a/Examples/test-suite/java/li_std_auto_ptr_runme.java b/Examples/test-suite/java/li_std_auto_ptr_runme.java index db34fb529..50ed113a4 100644 --- a/Examples/test-suite/java/li_std_auto_ptr_runme.java +++ b/Examples/test-suite/java/li_std_auto_ptr_runme.java @@ -43,7 +43,7 @@ public class li_std_auto_ptr_runme { } int actualCount = Klass.getTotal_count(); if (actualCount != expectedCount) - throw new RuntimeException("Expected count: " + expectedCount + " Actual count: " + actualCount); + System.err.println("GC failed to run (li_std_auto_ptr 1). Expected count: " + expectedCount + " Actual count: " + actualCount); // Finalizers are not guaranteed to be run and sometimes they just don't } if (!k2.getLabel().equals("second")) @@ -62,7 +62,7 @@ public class li_std_auto_ptr_runme { }; int actualCount = Klass.getTotal_count(); if (actualCount != expectedCount) - throw new RuntimeException("Expected count: " + expectedCount + " Actual count: " + actualCount); + System.err.println("GC failed to run (li_std_auto_ptr 2). Expected count: " + expectedCount + " Actual count: " + actualCount); // Finalizers are not guaranteed to be run and sometimes they just don't } } } diff --git a/Examples/test-suite/java/nested_extend_c_runme.java b/Examples/test-suite/java/nested_extend_c_runme.java new file mode 100644 index 000000000..5d9d861da --- /dev/null +++ b/Examples/test-suite/java/nested_extend_c_runme.java @@ -0,0 +1,45 @@ +import nested_extend_c.*; + +public class nested_extend_c_runme { + + static { + try { + System.loadLibrary("nested_extend_c"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) throws Throwable + { + { + hiA hi = new hiA(); + if (hi.hi_extend() != 'h') + throw new RuntimeException("test failed"); + } + { + lowA low = new lowA(); + if (low.low_extend() != 99) + throw new RuntimeException("test failed"); + } + + { + hiB hi = new hiB(); + if (hi.hi_extend() != 'h') + throw new RuntimeException("test failed"); + } + { + lowB low = new lowB(); + if (low.low_extend() != 99) + throw new RuntimeException("test failed"); + } + { + FOO_bar foobar = new FOO_bar(); + foobar.setD(1234); + if (foobar.getD() != 1234) + throw new RuntimeException("test failed"); + foobar.bar_extend(); + } + } +} diff --git a/Examples/test-suite/java/nested_template_base_runme.java b/Examples/test-suite/java/nested_template_base_runme.java new file mode 100644 index 000000000..8404afe04 --- /dev/null +++ b/Examples/test-suite/java/nested_template_base_runme.java @@ -0,0 +1,27 @@ +import nested_template_base.*; + +public class nested_template_base_runme { + + static { + try { + System.loadLibrary("nested_template_base"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) { + OuterC.InnerS ois = new OuterC.InnerS(123); + OuterC.InnerC oic = new OuterC.InnerC(); + + // Check base method is available + if (oic.outer(ois).getVal() != 123) + throw new RuntimeException("Wrong value calling outer"); + + // Check non-derived class using base class + if (oic.innerc().outer(ois).getVal() != 123) + throw new RuntimeException("Wrong value calling innerc"); + + } +} diff --git a/Examples/test-suite/java/preproc_line_file_runme.java b/Examples/test-suite/java/preproc_line_file_runme.java index 123753fd9..7726b613b 100644 --- a/Examples/test-suite/java/preproc_line_file_runme.java +++ b/Examples/test-suite/java/preproc_line_file_runme.java @@ -13,13 +13,21 @@ public class preproc_line_file_runme { private static void test_file(String file, String suffix) throws Throwable { - String FILENAME_WINDOWS = "Examples\\test-suite\\preproc_line_file.i"; - String FILENAME_UNIX = "Examples/test-suite/preproc_line_file.i"; +// For swig-3.0.1 and earlier +// String FILENAME_WINDOWS = "Examples\\test-suite\\preproc_line_file.i"; +// String FILENAME_UNIX = "Examples/test-suite/preproc_line_file.i"; + + String FILENAME_WINDOWS2 = "Examples\\test-suite\\java\\..\\preproc_line_file.i"; + String FILENAME_UNIX2 = "Examples/test-suite/java/../preproc_line_file.i"; + + String FILENAME_WINDOWS3 = "..\\.\\..\\preproc_line_file.i"; + String FILENAME_UNIX3 = ".././../preproc_line_file.i"; // We don't test for exact equality here because the file names are relative to the build directory, which can be different from the source directory, // under Unix. But they do need to end with the same path components. - if (!file.endsWith(FILENAME_UNIX + suffix) && !file.endsWith(FILENAME_WINDOWS + suffix)) - throw new RuntimeException("file \"" + file + "\" doesn't end with " + FILENAME_UNIX + suffix); + if (!file.endsWith(FILENAME_UNIX2 + suffix) && !file.endsWith(FILENAME_WINDOWS2 + suffix) && + !file.endsWith(FILENAME_UNIX3 + suffix) && !file.endsWith(FILENAME_WINDOWS3 + suffix)) + throw new RuntimeException("file \"" + file + "\" doesn't end with " + FILENAME_UNIX2 + suffix + " or " + FILENAME_UNIX3 + suffix); } public static void main(String argv[]) throws Throwable diff --git a/Examples/test-suite/java/smart_pointer_const_overload_runme.java b/Examples/test-suite/java/smart_pointer_const_overload_runme.java index bb4ae2c8f..9c10dedb2 100644 --- a/Examples/test-suite/java/smart_pointer_const_overload_runme.java +++ b/Examples/test-suite/java/smart_pointer_const_overload_runme.java @@ -41,7 +41,7 @@ public class smart_pointer_const_overload_runme { Assert(f.getAccess() == MUTABLE_ACCESS); // Test static method - b.stat(); + b.statMethod(); Assert(f.getAccess() == CONST_ACCESS); diff --git a/Examples/test-suite/java/template_default_class_parms_runme.java b/Examples/test-suite/java/template_default_class_parms_runme.java index 406915b82..0a6571fa8 100644 --- a/Examples/test-suite/java/template_default_class_parms_runme.java +++ b/Examples/test-suite/java/template_default_class_parms_runme.java @@ -45,6 +45,11 @@ public class template_default_class_parms_runme { foo.setTType(a); a = foo.method(a); } + + { + MapDefaults md = new MapDefaults(); + md.test_func(10, 20, new DefaultNodeType()); + } } } diff --git a/Examples/test-suite/java/template_templated_constructors_runme.java b/Examples/test-suite/java/template_templated_constructors_runme.java new file mode 100644 index 000000000..cd3f31d21 --- /dev/null +++ b/Examples/test-suite/java/template_templated_constructors_runme.java @@ -0,0 +1,26 @@ + +import template_templated_constructors.*; + +public class template_templated_constructors_runme { + + static { + try { + System.loadLibrary("template_templated_constructors"); + } catch (UnsatisfiedLinkError e) { + System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e); + System.exit(1); + } + } + + public static void main(String argv[]) { + TConstructor1 t1 = new TConstructor1(123); + TConstructor2 t2a = new TConstructor2(); + TConstructor2 t2b = new TConstructor2(123); + + TClass1Int tc1 = new TClass1Int(123.4); + TClass2Int tc2a = new TClass2Int(); + TClass2Int tc2b = new TClass2Int(123.4); + + } +} + diff --git a/Examples/test-suite/java/template_typedef_typedef_runme.java b/Examples/test-suite/java/template_typedef_typedef_runme.java index f5f368561..5a3af0099 100644 --- a/Examples/test-suite/java/template_typedef_typedef_runme.java +++ b/Examples/test-suite/java/template_typedef_typedef_runme.java @@ -12,13 +12,13 @@ public class template_typedef_typedef_runme { } public static void main(String argv[]) { - ObjectBase ob1 = new ObjectBase(); - ob1.getBlabla1(new ObjectBase()); + Object1Base ob1 = new Object1Base(); + ob1.getBlabla1(new Object1Base()); Object2Base ob2 = new Object2Base(); ob2.getBlabla2(new Object2Base()); Factory factory = new Factory(); - factory.getBlabla3(new ObjectBase()); + factory.getBlabla3(new Object1Base()); factory.getBlabla4(new Object2Base()); } } diff --git a/Examples/test-suite/java_lib_various.i b/Examples/test-suite/java_lib_various.i index 716ae9139..180d07569 100644 --- a/Examples/test-suite/java_lib_various.i +++ b/Examples/test-suite/java_lib_various.i @@ -8,6 +8,7 @@ %apply char **STRING_ARRAY { char **languages }; %apply char *BYTE { char *chars }; %apply char **STRING_OUT { char **string_ptr }; +%apply unsigned char *NIOBUFFER { unsigned char *buf }; %typemap(freearg) char **languages "" // don't delete memory when setting global variable %{ @@ -47,5 +48,8 @@ void char_ptr_ptr_out(char **string_ptr) { *string_ptr = ret; } +void niobuffer_fill_hello(unsigned char *buf) { + sprintf ((char*)buf,"hello"); +} %} diff --git a/Examples/test-suite/javascript/Makefile.in b/Examples/test-suite/javascript/Makefile.in index 7368ea9a3..83b15f822 100755..100644 --- a/Examples/test-suite/javascript/Makefile.in +++ b/Examples/test-suite/javascript/Makefile.in @@ -4,10 +4,15 @@ LANGUAGE = javascript NODEGYP = @NODEGYP@ +NODEJS = @NODEJS@ SCRIPTSUFFIX = _runme.js +OBJEXT = @OBJEXT@ +SO = @SO@ + srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ + SWIG = $(top_builddir)/preinst_swig ifneq (, $(ENGINE)) @@ -16,23 +21,23 @@ else JSENGINE=node endif +ifneq (, $(V8_VERSION)) + JSV8_VERSION=$(V8_VERSION) +else + JSV8_VERSION=0x031110 +endif + include $(srcdir)/../common.mk +SWIGOPT += -DV8_VERSION=$(JSV8_VERSION) + _setup = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ echo "$(ACTION)ing $(LANGUAGE) ($(JSENGINE)) testcase $* (with run test)" ; \ else \ echo "$(ACTION)ing $(LANGUAGE) ($(JSENGINE)) testcase $*" ; \ fi; -ifneq (jsc,$(ENGINE)) - - # This test can not be run with v8 as it uses v8 API incompatible output typemaps - typemap_variables.cpptest: - echo "skipping $(LANGUAGE) ($(JSENGINE)) testcase typemap_variables" ; - -endif - ifeq (node,$(JSENGINE)) SWIGOPT += -v8 -DBUILDING_NODE_EXTENSION=1 @@ -47,20 +52,27 @@ ifeq (node,$(JSENGINE)) constant_pointers.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\" enum_thorough.cpptest: GYP_CFLAGS = \"-Wno-ignored-qualifiers\" + setup_node = \ + test -d $* || mkdir $*; \ + sed -e 's|$$testcase|$*|g; s|$$cflags|$(GYP_CFLAGS)|g; s|$$srcdir|$(srcdir)|g' \ + $(srcdir)/node_template/binding.gyp.in > $*/binding.gyp; \ + sed -e 's|$$testcase|$*|g;' \ + $(srcdir)/node_template/index.js.in > $*/index.js + # Note: we need to use swig in C parse mode, but make node-gyp believe it is c++ (via file extension) swig_and_compile_c = \ - sh ./setup_test.sh $* $(GYP_CFLAGS); \ - $(SWIG) -javascript $(SWIGOPT) -o $*_wrap.cxx ../$*.i; \ + $(setup_node); \ + $(SWIG) -javascript $(SWIGOPT) -o $*_wrap.cxx $(srcdir)/../$*.i; \ $(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null swig_and_compile_cpp = \ - sh ./setup_test.sh $* $(GYP_CFLAGS); \ - $(SWIG) -c++ -javascript $(SWIGOPT) ../$*.i; \ + $(setup_node); \ + $(SWIG) -c++ -javascript $(SWIGOPT) $(srcdir)/../$*.i; \ $(NODEGYP) --loglevel=silent --directory $* configure build 1>>/dev/null run_testcase = \ if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then \ - node $(srcdir)/$*$(SCRIPTSUFFIX); \ + env NODE_PATH=$$PWD:$(srcdir) $(NODEJS) $(srcdir)/$*$(SCRIPTSUFFIX); \ fi @@ -83,7 +95,7 @@ else run_testcase = \ if [ -f $(srcdir)/$*$(SCRIPTSUFFIX) ]; then \ - $(top_srcdir)/Tools/javascript/javascript -$(JSENGINE) $(srcdir)/$*$(SCRIPTSUFFIX); \ + $(RUNTOOL) $(top_builddir)/Tools/javascript/javascript -$(JSENGINE) $(srcdir)/$*$(SCRIPTSUFFIX); \ fi %.ctest: @@ -105,10 +117,15 @@ endif %.clean: - rm -rf $* + @rm -rf $* + @rm -f $*_wrap.* $*$(SO) $*.$(OBJEXT) clean: - rm -f *_wrap.cxx - rm -f *_wrap.c - rm -f *.so - rm -f *.o + for ext in _wrap.cxx _wrap.$(OBJEXT) $(SO); do \ + rm -f clientdata_prop_a$${ext} clientdata_prop_b$${ext}; \ + rm -f imports_a$${ext} imports_b$${ext}; \ + rm -f import_stl_a$${ext} import_stl_b$${ext}; \ + rm -f mod_a$${ext} mod_b$${ext}; \ + rm -f multi_import_a$${ext} multi_import_b$${ext}; \ + rm -f packageoption_a$${ext} packageoption_b$${ext} packageoption_c$${ext}; \ + done diff --git a/Examples/test-suite/javascript/abstract_access_runme.js b/Examples/test-suite/javascript/abstract_access_runme.js index 8f87d2105..f61bb4358 100644 --- a/Examples/test-suite/javascript/abstract_access_runme.js +++ b/Examples/test-suite/javascript/abstract_access_runme.js @@ -1,4 +1,4 @@ -var abstract_access = require("./abstract_access"); +var abstract_access = require("abstract_access"); var d = new abstract_access.D() if (d.do_x() != 1) { diff --git a/Examples/test-suite/javascript/abstract_inherit_runme.js b/Examples/test-suite/javascript/abstract_inherit_runme.js index 3af2eae74..f732e8767 100644 --- a/Examples/test-suite/javascript/abstract_inherit_runme.js +++ b/Examples/test-suite/javascript/abstract_inherit_runme.js @@ -1,4 +1,4 @@ -var abstract_inherit = require("./abstract_inherit"); +var abstract_inherit = require("abstract_inherit"); // Shouldn't be able to instantiate any of these classes // since none of them implements the pure virtual function diff --git a/Examples/test-suite/javascript/abstract_typedef2_runme.js b/Examples/test-suite/javascript/abstract_typedef2_runme.js index c177e49c3..d8a533ab1 100644 --- a/Examples/test-suite/javascript/abstract_typedef2_runme.js +++ b/Examples/test-suite/javascript/abstract_typedef2_runme.js @@ -1,4 +1,4 @@ -var abstract_typedef2 = require("./abstract_typedef2"); +var abstract_typedef2 = require("abstract_typedef2"); var a = new abstract_typedef2.A_UF(); diff --git a/Examples/test-suite/javascript/abstract_typedef_runme.js b/Examples/test-suite/javascript/abstract_typedef_runme.js index abcfc581d..286328fa8 100644 --- a/Examples/test-suite/javascript/abstract_typedef_runme.js +++ b/Examples/test-suite/javascript/abstract_typedef_runme.js @@ -1,4 +1,4 @@ -var abstract_typedef = require("./abstract_typedef"); +var abstract_typedef = require("abstract_typedef"); var e = new abstract_typedef.Engine(); var a = new abstract_typedef.A() diff --git a/Examples/test-suite/javascript/abstract_virtual_runme.js b/Examples/test-suite/javascript/abstract_virtual_runme.js index 9e2814e41..9a9ce9988 100644 --- a/Examples/test-suite/javascript/abstract_virtual_runme.js +++ b/Examples/test-suite/javascript/abstract_virtual_runme.js @@ -1,4 +1,4 @@ -var abstract_virtual = require("./abstract_virtual"); +var abstract_virtual = require("abstract_virtual"); d = new abstract_virtual.D() diff --git a/Examples/test-suite/javascript/array_member_runme.js b/Examples/test-suite/javascript/array_member_runme.js index 8c4ef1da5..3d9bb0e5b 100644 --- a/Examples/test-suite/javascript/array_member_runme.js +++ b/Examples/test-suite/javascript/array_member_runme.js @@ -1,4 +1,4 @@ -var array_member = require("./array_member"); +var array_member = require("array_member"); var f = new array_member.Foo(); f.data = array_member.global_data; diff --git a/Examples/test-suite/javascript/arrays_global_runme.js b/Examples/test-suite/javascript/arrays_global_runme.js index fdb365f83..0cbb28efb 100644 --- a/Examples/test-suite/javascript/arrays_global_runme.js +++ b/Examples/test-suite/javascript/arrays_global_runme.js @@ -1,4 +1,4 @@ -var arrays_global = require("./arrays_global"); +var arrays_global = require("arrays_global"); arrays_global.array_i = arrays_global.array_const_i; diff --git a/Examples/test-suite/javascript/callback_runme.js b/Examples/test-suite/javascript/callback_runme.js index 9b1ef01a3..021888641 100644 --- a/Examples/test-suite/javascript/callback_runme.js +++ b/Examples/test-suite/javascript/callback_runme.js @@ -1,4 +1,4 @@ -var callback = require("./callback"); +var callback = require("callback"); if (callback.foo(2) !== 2) { throw new Error("Failed."); diff --git a/Examples/test-suite/javascript/char_binary_runme.js b/Examples/test-suite/javascript/char_binary_runme.js index 42abe6060..b2aac920c 100644 --- a/Examples/test-suite/javascript/char_binary_runme.js +++ b/Examples/test-suite/javascript/char_binary_runme.js @@ -1,4 +1,4 @@ -var char_binary = require("./char_binary"); +var char_binary = require("char_binary"); var t = new char_binary.Test(); if (t.strlen('hile') != 4) { diff --git a/Examples/test-suite/javascript/char_strings_runme.js b/Examples/test-suite/javascript/char_strings_runme.js index cca50d851..fe17cb982 100644 --- a/Examples/test-suite/javascript/char_strings_runme.js +++ b/Examples/test-suite/javascript/char_strings_runme.js @@ -1,4 +1,4 @@ -var char_strings = require("./char_strings"); +var char_strings = require("char_strings"); var assertIsEqual = function(expected, actual) { if (expected !== actual) { diff --git a/Examples/test-suite/javascript/class_ignore_runme.js b/Examples/test-suite/javascript/class_ignore_runme.js index f0a32a1c4..ffbe021c7 100644 --- a/Examples/test-suite/javascript/class_ignore_runme.js +++ b/Examples/test-suite/javascript/class_ignore_runme.js @@ -1,4 +1,4 @@ -var class_ignore = require("./class_ignore"); +var class_ignore = require("class_ignore"); a = new class_ignore.Bar(); diff --git a/Examples/test-suite/javascript/class_scope_weird_runme.js b/Examples/test-suite/javascript/class_scope_weird_runme.js index ac745d023..73c118d61 100644 --- a/Examples/test-suite/javascript/class_scope_weird_runme.js +++ b/Examples/test-suite/javascript/class_scope_weird_runme.js @@ -1,4 +1,4 @@ -var class_scope_weird = require("./class_scope_weird"); +var class_scope_weird = require("class_scope_weird"); f = new class_scope_weird.Foo(); g = new class_scope_weird.Foo(3); diff --git a/Examples/test-suite/javascript/complextest_runme.js b/Examples/test-suite/javascript/complextest_runme.js index 1fcc97648..b87d6bffa 100644 --- a/Examples/test-suite/javascript/complextest_runme.js +++ b/Examples/test-suite/javascript/complextest_runme.js @@ -1,4 +1,4 @@ -var complextest = require("./complextest"); +var complextest = require("complextest"); a = [-1,2]; diff --git a/Examples/test-suite/javascript/constover_runme.js b/Examples/test-suite/javascript/constover_runme.js index 764d8b328..9b192b5ff 100644 --- a/Examples/test-suite/javascript/constover_runme.js +++ b/Examples/test-suite/javascript/constover_runme.js @@ -1,4 +1,4 @@ -var constover = require("./constover"); +var constover = require("constover"); p = constover.test("test"); if (p != "test") { diff --git a/Examples/test-suite/javascript/constructor_copy_runme.js b/Examples/test-suite/javascript/constructor_copy_runme.js index 39dce52ce..179b9fb40 100644 --- a/Examples/test-suite/javascript/constructor_copy_runme.js +++ b/Examples/test-suite/javascript/constructor_copy_runme.js @@ -1,4 +1,4 @@ -var constructor_copy = require("./constructor_copy"); +var constructor_copy = require("constructor_copy"); f1 = new constructor_copy.Foo1(3); f11 = new constructor_copy.Foo1(f1); diff --git a/Examples/test-suite/javascript/cpp11_strongly_typed_enumerations_runme.js b/Examples/test-suite/javascript/cpp11_strongly_typed_enumerations_runme.js new file mode 100644 index 000000000..ad9d4e883 --- /dev/null +++ b/Examples/test-suite/javascript/cpp11_strongly_typed_enumerations_runme.js @@ -0,0 +1,165 @@ +var cpp11_strongly_typed_enumerations = require("cpp11_strongly_typed_enumerations"); + +function enumCheck(actual, expected) { + if (actual != expected) { + throw new Error("Enum value mismatch. Expected: " + expected + " Actual: " + actual); + } + return expected + 1; +} + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val1, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val2, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val3, 13); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val4, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val5a, 13); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val6a, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val1, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val2, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val3, 23); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val4, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val5b, 23); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val6b, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Val1, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Val2, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Val3, 43); +val = enumCheck(cpp11_strongly_typed_enumerations.Val4, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val1, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val2, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val3, 53); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val4, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val1, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val2, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val3, 63); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val4, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val1, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val2, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val3, 73); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val4, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val1, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val2, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val3, 83); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val4, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val1, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val2, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val3, 103); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val4, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val1, 1121); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val2, 1122); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val3, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val4, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val5c, 1121); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val6c, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val1, 1131); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val2, 1132); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val3, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val4, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val5d, 1131); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val6d, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val1, 1141); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val2, 1142); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val3, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val4, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val5e, 1141); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val6e, val); + +// Requires nested class support to work +//val = 0; +//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val1, 3121); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val2, 3122); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val3, val); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val4, val); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val5f, 3121); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val6f, val); +// +//val = 0; +//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Val1, 3131); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Val2, 3132); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Val3, val); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Val4, val); +// +//val = 0; +//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val1, 3141); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val2, 3142); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val3, val); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val4, val); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val5g, 3141); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val6g, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val1, 2121); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val2, 2122); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val3, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val4, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val5h, 2121); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val6h, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val1, 2131); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val2, 2132); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val3, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val4, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val5i, 2131); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val6i, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val1, 2141); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val2, 2142); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val3, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val4, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val5j, 2141); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val6j, val); + +// Requires nested class support to work +//val = 0; +//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum12_Val1, 4121); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum12_Val2, 4122); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum12_Val3, val); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum12_Val4, val); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum12_Val5k, 4121); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum12_Val6k, val); +// +//val = 0; +//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Val1, 4131); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Val2, 4132); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Val3, val); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Val4, val); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Val5l, 4131); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Val6l, val); +// +//val = 0; +//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum14_Val1, 4141); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum14_Val2, 4142); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum14_Val3, val); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum14_Val4, val); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum14_Val5m, 4141); +//val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1_Enum14_Val6m, val); + +class1 = new cpp11_strongly_typed_enumerations.Class1(); +enumCheck(class1.class1Test1(cpp11_strongly_typed_enumerations.Enum1_Val5a), 13); +enumCheck(class1.class1Test2(cpp11_strongly_typed_enumerations.Class1.Enum12_Val5c), 1121); +//enumCheck(class1.class1Test3(cpp11_strongly_typed_enumerations.Class1.Struct1_Enum12_Val5f), 3121); + +enumCheck(cpp11_strongly_typed_enumerations.globalTest1(cpp11_strongly_typed_enumerations.Enum1_Val5a), 13); +enumCheck(cpp11_strongly_typed_enumerations.globalTest2(cpp11_strongly_typed_enumerations.Class1.Enum12_Val5c), 1121); +//enumCheck(globalTest3(cpp11_strongly_typed_enumerations.Class1.Struct1_Enum12_Val5f), 3121); diff --git a/Examples/test-suite/javascript/cpp_enum_runme.js b/Examples/test-suite/javascript/cpp_enum_runme.js index 35f7c60ac..8a248c372 100644 --- a/Examples/test-suite/javascript/cpp_enum_runme.js +++ b/Examples/test-suite/javascript/cpp_enum_runme.js @@ -1,4 +1,4 @@ -var cpp_enum = require("./cpp_enum"); +var cpp_enum = require("cpp_enum"); var f = new cpp_enum.Foo() diff --git a/Examples/test-suite/javascript/cpp_namespace_runme.js b/Examples/test-suite/javascript/cpp_namespace_runme.js index 3bdfef3e9..a6ab79964 100644 --- a/Examples/test-suite/javascript/cpp_namespace_runme.js +++ b/Examples/test-suite/javascript/cpp_namespace_runme.js @@ -1,4 +1,4 @@ -var cpp_namespace = require("./cpp_namespace"); +var cpp_namespace = require("cpp_namespace"); var n = cpp_namespace.fact(4); if (n != 24){ diff --git a/Examples/test-suite/javascript/cpp_static_runme.js b/Examples/test-suite/javascript/cpp_static_runme.js index 2579aeafe..c7917e12e 100644 --- a/Examples/test-suite/javascript/cpp_static_runme.js +++ b/Examples/test-suite/javascript/cpp_static_runme.js @@ -1,4 +1,4 @@ -var cpp_static = require("./cpp_static"); +var cpp_static = require("cpp_static"); cpp_static.StaticFunctionTest.static_func(); cpp_static.StaticFunctionTest.static_func_2(1); diff --git a/Examples/test-suite/javascript/director_alternating_runme.js b/Examples/test-suite/javascript/director_alternating_runme.js index a0411eace..cff288d35 100644 --- a/Examples/test-suite/javascript/director_alternating_runme.js +++ b/Examples/test-suite/javascript/director_alternating_runme.js @@ -1,4 +1,4 @@ -var director_alternating = require("./director_alternating"); +var director_alternating = require("director_alternating"); id = director_alternating.getBar().id(); if (id != director_alternating.idFromGetBar()) diff --git a/Examples/test-suite/javascript/disown_runme.js b/Examples/test-suite/javascript/disown_runme.js index a4a6fd880..ea742b51e 100644 --- a/Examples/test-suite/javascript/disown_runme.js +++ b/Examples/test-suite/javascript/disown_runme.js @@ -1,4 +1,4 @@ -var disown = require("./disown"); +var disown = require("disown"); var a = new disown.A(); var tmp = a.thisown; diff --git a/Examples/test-suite/javascript/dynamic_cast_runme.js b/Examples/test-suite/javascript/dynamic_cast_runme.js index 0029cb0f8..32eabcf8b 100644 --- a/Examples/test-suite/javascript/dynamic_cast_runme.js +++ b/Examples/test-suite/javascript/dynamic_cast_runme.js @@ -1,4 +1,4 @@ -var dynamic_cast = require("./dynamic_cast"); +var dynamic_cast = require("dynamic_cast"); var f = new dynamic_cast.Foo(); var b = new dynamic_cast.Bar(); diff --git a/Examples/test-suite/javascript/empty_runme.js b/Examples/test-suite/javascript/empty_runme.js index db06b3902..7894379be 100644 --- a/Examples/test-suite/javascript/empty_runme.js +++ b/Examples/test-suite/javascript/empty_runme.js @@ -1 +1 @@ -var empty = require("./empty");
\ No newline at end of file +var empty = require("empty");
\ No newline at end of file diff --git a/Examples/test-suite/javascript/enum_template_runme.js b/Examples/test-suite/javascript/enum_template_runme.js index 20f8c3482..1e71e5f64 100644 --- a/Examples/test-suite/javascript/enum_template_runme.js +++ b/Examples/test-suite/javascript/enum_template_runme.js @@ -1,4 +1,4 @@ -var enum_template = require("./enum_template"); +var enum_template = require("enum_template"); if (enum_template.MakeETest() != 1) throw "RuntimeError"; diff --git a/Examples/test-suite/javascript/infinity_runme.js b/Examples/test-suite/javascript/infinity_runme.js index 7b5182ff6..8ebe496a6 100644 --- a/Examples/test-suite/javascript/infinity_runme.js +++ b/Examples/test-suite/javascript/infinity_runme.js @@ -1,4 +1,5 @@ -var infinity = require("./infinity"); +var infinity = require("infinity"); +infinity.initialise_MYINFINITY(); var my_infinity = infinity.INFINITY; var ret_val = infinity.use_infinity(my_infinity); diff --git a/Examples/test-suite/javascript/namespace_virtual_method_runme.js b/Examples/test-suite/javascript/namespace_virtual_method_runme.js index 24d3bd487..4f1e05c84 100644 --- a/Examples/test-suite/javascript/namespace_virtual_method_runme.js +++ b/Examples/test-suite/javascript/namespace_virtual_method_runme.js @@ -1,3 +1,3 @@ -var namespace_virtual_method = require("./namespace_virtual_method"); +var namespace_virtual_method = require("namespace_virtual_method"); x = new namespace_virtual_method.Spam(); diff --git a/Examples/test-suite/javascript/node_template/binding.gyp.in b/Examples/test-suite/javascript/node_template/binding.gyp.in index 209774ae0..a82ac2f3e 100644 --- a/Examples/test-suite/javascript/node_template/binding.gyp.in +++ b/Examples/test-suite/javascript/node_template/binding.gyp.in @@ -3,7 +3,7 @@ { "target_name": "$testcase", "sources":[ "../$testcase_wrap.cxx" ], - "include_dirs": ["../.."], + "include_dirs": ["../$srcdir/.."], 'defines': [ 'BUILDING_NODE_EXTENSION=1', ], diff --git a/Examples/test-suite/javascript/nspace_extend_runme.js b/Examples/test-suite/javascript/nspace_extend_runme.js index ab81c19d3..8cabfe945 100644 --- a/Examples/test-suite/javascript/nspace_extend_runme.js +++ b/Examples/test-suite/javascript/nspace_extend_runme.js @@ -1,4 +1,4 @@ -var nspace_extend = require("./nspace_extend"); +var nspace_extend = require("nspace_extend"); // constructors and destructors var color1 = new nspace_extend.Outer.Inner1.Color(); diff --git a/Examples/test-suite/javascript/nspace_runme.js b/Examples/test-suite/javascript/nspace_runme.js index f1afff428..993610dd6 100644 --- a/Examples/test-suite/javascript/nspace_runme.js +++ b/Examples/test-suite/javascript/nspace_runme.js @@ -1,4 +1,4 @@ -var nspace = require("./nspace"); +var nspace = require("nspace"); var color1 = new nspace.Outer.Inner1.Color(); var color = new nspace.Outer.Inner1.Color(color1); diff --git a/Examples/test-suite/javascript/null_pointer_runme.js b/Examples/test-suite/javascript/null_pointer_runme.js new file mode 100644 index 000000000..7c0d61244 --- /dev/null +++ b/Examples/test-suite/javascript/null_pointer_runme.js @@ -0,0 +1,9 @@ +var null_pointer = require("null_pointer"); + +if (!null_pointer.func(null)) { + throw new Error("Javascript 'null' should be converted into NULL."); +} + +if (null_pointer.getnull() != null) { + throw new Error("NULL should be converted into Javascript 'null'."); +} diff --git a/Examples/test-suite/javascript/overload_copy_runme.js b/Examples/test-suite/javascript/overload_copy_runme.js index 1039ffda1..e2f610788 100644 --- a/Examples/test-suite/javascript/overload_copy_runme.js +++ b/Examples/test-suite/javascript/overload_copy_runme.js @@ -1,4 +1,4 @@ -var overload_copy = require("./overload_copy"); +var overload_copy = require("overload_copy"); f = new overload_copy.Foo(); g = new overload_copy.Foo(f); diff --git a/Examples/test-suite/javascript/preproc_include_runme.js b/Examples/test-suite/javascript/preproc_include_runme.js index 4b827fbcc..5ec72b842 100644 --- a/Examples/test-suite/javascript/preproc_include_runme.js +++ b/Examples/test-suite/javascript/preproc_include_runme.js @@ -1,4 +1,4 @@ -var preproc_include = require("./preproc_include"); +var preproc_include = require("preproc_include"); if (preproc_include.multiply10(10) != 100) throw "RuntimeError"; diff --git a/Examples/test-suite/javascript/preproc_runme.js b/Examples/test-suite/javascript/preproc_runme.js index 669f9d1f0..167ca5ac1 100644 --- a/Examples/test-suite/javascript/preproc_runme.js +++ b/Examples/test-suite/javascript/preproc_runme.js @@ -1,4 +1,4 @@ -var preproc = require("./preproc"); +var preproc = require("preproc"); if (preproc.endif != 1) throw "RuntimeError"; diff --git a/Examples/test-suite/javascript/rename1_runme.js b/Examples/test-suite/javascript/rename1_runme.js index 8374e6a89..68ecc11b6 100644 --- a/Examples/test-suite/javascript/rename1_runme.js +++ b/Examples/test-suite/javascript/rename1_runme.js @@ -1,4 +1,4 @@ -var rename = require("./rename1"); +var rename = require("rename1"); function part1() { var xyz = new rename.XYZInt(); diff --git a/Examples/test-suite/javascript/rename2_runme.js b/Examples/test-suite/javascript/rename2_runme.js index bc6a95a59..99f478596 100644 --- a/Examples/test-suite/javascript/rename2_runme.js +++ b/Examples/test-suite/javascript/rename2_runme.js @@ -1,4 +1,4 @@ -var rename = require("./rename2"); +var rename = require("rename2"); function part1() { var xyz = new rename.XYZInt(); diff --git a/Examples/test-suite/javascript/rename3_runme.js b/Examples/test-suite/javascript/rename3_runme.js index 9e57e80ea..237029fbb 100644 --- a/Examples/test-suite/javascript/rename3_runme.js +++ b/Examples/test-suite/javascript/rename3_runme.js @@ -1,4 +1,4 @@ -var rename = require("./rename3"); +var rename = require("rename3"); function part1() { var xyz = new rename.XYZInt(); diff --git a/Examples/test-suite/javascript/rename4_runme.js b/Examples/test-suite/javascript/rename4_runme.js index d651fc7a1..fed50dceb 100644 --- a/Examples/test-suite/javascript/rename4_runme.js +++ b/Examples/test-suite/javascript/rename4_runme.js @@ -1,4 +1,4 @@ -var rename = require("./rename4"); +var rename = require("rename4"); function part1() { var xyz = new rename.XYZInt(); diff --git a/Examples/test-suite/javascript/rename_scope_runme.js b/Examples/test-suite/javascript/rename_scope_runme.js index c0226df69..fea4d2ca9 100644 --- a/Examples/test-suite/javascript/rename_scope_runme.js +++ b/Examples/test-suite/javascript/rename_scope_runme.js @@ -1,4 +1,4 @@ -var rename_scope = require("./rename_scope"); +var rename_scope = require("rename_scope"); var a = new rename_scope.Natural_UP(); var b = new rename_scope.Natural_BP(); diff --git a/Examples/test-suite/javascript/rename_simple_runme.js b/Examples/test-suite/javascript/rename_simple_runme.js index 918dd68a5..21350cd3e 100644 --- a/Examples/test-suite/javascript/rename_simple_runme.js +++ b/Examples/test-suite/javascript/rename_simple_runme.js @@ -1,4 +1,4 @@ -var rename_simple = require("./rename_simple"); +var rename_simple = require("rename_simple"); var NewStruct = rename_simple.NewStruct; var s = new NewStruct(); diff --git a/Examples/test-suite/javascript/ret_by_value_runme.js b/Examples/test-suite/javascript/ret_by_value_runme.js index d9a77a20b..9d0840602 100644 --- a/Examples/test-suite/javascript/ret_by_value_runme.js +++ b/Examples/test-suite/javascript/ret_by_value_runme.js @@ -1,4 +1,4 @@ -var ret_by_value = require("./ret_by_value"); +var ret_by_value = require("ret_by_value"); a = ret_by_value.get_test(); if (a.myInt != 100) diff --git a/Examples/test-suite/javascript/setup_test.sh b/Examples/test-suite/javascript/setup_test.sh deleted file mode 100644 index 913a74c4b..000000000 --- a/Examples/test-suite/javascript/setup_test.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -if [ ! -d $1 ]; then - mkdir $1; -fi -sed -e "s/\$testcase/$1/" -e "s/\$cflags/$2/" < node_template/binding.gyp.in > $1/binding.gyp -sed s/\$testcase/$1/ node_template/index.js.in > $1/index.js diff --git a/Examples/test-suite/javascript/string_simple_runme.js b/Examples/test-suite/javascript/string_simple_runme.js index dbdd4136d..39ae84e9e 100644 --- a/Examples/test-suite/javascript/string_simple_runme.js +++ b/Examples/test-suite/javascript/string_simple_runme.js @@ -1,4 +1,4 @@ -var string_simple = require("./string_simple"); +var string_simple = require("string_simple"); // Test unicode string var str = "olé"; diff --git a/Examples/test-suite/javascript/struct_value_runme.js b/Examples/test-suite/javascript/struct_value_runme.js index d6b26f726..5b171b8fe 100644 --- a/Examples/test-suite/javascript/struct_value_runme.js +++ b/Examples/test-suite/javascript/struct_value_runme.js @@ -1,4 +1,4 @@ -var struct_value = require("./struct_value"); +var struct_value = require("struct_value"); b = new struct_value.Bar(); diff --git a/Examples/test-suite/javascript/template_static_runme.js b/Examples/test-suite/javascript/template_static_runme.js index 477d97249..d6106138a 100644 --- a/Examples/test-suite/javascript/template_static_runme.js +++ b/Examples/test-suite/javascript/template_static_runme.js @@ -1,3 +1,3 @@ -var template_static = require("./template_static"); +var template_static = require("template_static"); template_static.Foo.bar_double(1); diff --git a/Examples/test-suite/javascript/typedef_class_runme.js b/Examples/test-suite/javascript/typedef_class_runme.js index 3e4dc9093..64e0051c3 100644 --- a/Examples/test-suite/javascript/typedef_class_runme.js +++ b/Examples/test-suite/javascript/typedef_class_runme.js @@ -1,4 +1,4 @@ -var typedef_class = require("./typedef_class"); +var typedef_class = require("typedef_class"); a = new typedef_class.RealA(); a.a = 3; diff --git a/Examples/test-suite/javascript/typedef_inherit_runme.js b/Examples/test-suite/javascript/typedef_inherit_runme.js index 4abcc2536..7590e1e6e 100644 --- a/Examples/test-suite/javascript/typedef_inherit_runme.js +++ b/Examples/test-suite/javascript/typedef_inherit_runme.js @@ -1,4 +1,4 @@ -var typedef_inherit = require("./typedef_inherit"); +var typedef_inherit = require("typedef_inherit"); a = new typedef_inherit.Foo(); b = new typedef_inherit.Bar(); diff --git a/Examples/test-suite/javascript/typedef_scope_runme.js b/Examples/test-suite/javascript/typedef_scope_runme.js index 0ac56884c..5c1368ab7 100644 --- a/Examples/test-suite/javascript/typedef_scope_runme.js +++ b/Examples/test-suite/javascript/typedef_scope_runme.js @@ -1,4 +1,4 @@ -var typedef_scope = require("./typedef_scope"); +var typedef_scope = require("typedef_scope"); b = new typedef_scope.Bar(); x = b.test1(42,"hello"); diff --git a/Examples/test-suite/javascript/typemap_arrays_runme.js b/Examples/test-suite/javascript/typemap_arrays_runme.js index cd6827ac9..610ecdd9c 100644 --- a/Examples/test-suite/javascript/typemap_arrays_runme.js +++ b/Examples/test-suite/javascript/typemap_arrays_runme.js @@ -1,4 +1,4 @@ -var typemap_arrays = require("./typemap_arrays"); +var typemap_arrays = require("typemap_arrays"); if (typemap_arrays.sumA(null) != 60) throw "RuntimeError, Sum is wrong"; diff --git a/Examples/test-suite/javascript/typemap_delete_runme.js b/Examples/test-suite/javascript/typemap_delete_runme.js index 4b3174956..1d42ce4da 100644 --- a/Examples/test-suite/javascript/typemap_delete_runme.js +++ b/Examples/test-suite/javascript/typemap_delete_runme.js @@ -1,4 +1,4 @@ -var typemap_delete = require("./typemap_delete"); +var typemap_delete = require("typemap_delete"); r = new typemap_delete.Rect(123); if (r.val != 123) diff --git a/Examples/test-suite/javascript/typemap_namespace_runme.js b/Examples/test-suite/javascript/typemap_namespace_runme.js index 614e0ffeb..2aa358024 100644 --- a/Examples/test-suite/javascript/typemap_namespace_runme.js +++ b/Examples/test-suite/javascript/typemap_namespace_runme.js @@ -1,4 +1,4 @@ -var typemap_namespace = require("./typemap_namespace"); +var typemap_namespace = require("typemap_namespace"); if (typemap_namespace.test1("hello") != "hello") throw "RuntimeError"; diff --git a/Examples/test-suite/javascript/typemap_ns_using_runme.js b/Examples/test-suite/javascript/typemap_ns_using_runme.js index 9115c16ae..7e4019ab2 100644 --- a/Examples/test-suite/javascript/typemap_ns_using_runme.js +++ b/Examples/test-suite/javascript/typemap_ns_using_runme.js @@ -1,4 +1,4 @@ -var typemap_ns_using = require("./typemap_ns_using"); +var typemap_ns_using = require("typemap_ns_using"); if (typemap_ns_using.spam(37) != 37) throw "RuntimeError"; diff --git a/Examples/test-suite/javascript/using1_runme.js b/Examples/test-suite/javascript/using1_runme.js index a2e37fcb6..2415156f0 100644 --- a/Examples/test-suite/javascript/using1_runme.js +++ b/Examples/test-suite/javascript/using1_runme.js @@ -1,4 +1,4 @@ -var using1 = require("./using1"); +var using1 = require("using1"); if (using1.spam(37) != 37) throw "RuntimeError"; diff --git a/Examples/test-suite/javascript/using2_runme.js b/Examples/test-suite/javascript/using2_runme.js index aa5e9b15f..2ef08faca 100644 --- a/Examples/test-suite/javascript/using2_runme.js +++ b/Examples/test-suite/javascript/using2_runme.js @@ -1,4 +1,4 @@ -var using2 = require("./using2"); +var using2 = require("using2"); if (using2.spam(37) != 37) throw "RuntimeError"; diff --git a/Examples/test-suite/javascript/varargs_runme.js b/Examples/test-suite/javascript/varargs_runme.js index 69d761e63..fc6d945c1 100644 --- a/Examples/test-suite/javascript/varargs_runme.js +++ b/Examples/test-suite/javascript/varargs_runme.js @@ -1,4 +1,4 @@ -var varargs = require("./varargs"); +var varargs = require("varargs"); if (varargs.test("Hello") != "Hello") { throw new Error("Failed"); diff --git a/Examples/test-suite/kwargs_feature.i b/Examples/test-suite/kwargs_feature.i index 87153109a..a935b25f3 100644 --- a/Examples/test-suite/kwargs_feature.i +++ b/Examples/test-suite/kwargs_feature.i @@ -1,7 +1,7 @@ %module kwargs_feature %nocopyctor; -%kwargs; +%feature("kwargs"); %rename(myDel) del; %inline @@ -35,9 +35,7 @@ virtual ~Foo() { } - }; - %} @@ -64,8 +62,7 @@ // Functions %inline %{ - int foo(int a = 1, int b = 0) {return a + b; } - + int foo_fn(int a = 1, int b = 0) {return a + b; } template<typename T> T templatedfunction(T a = 1, T b = 0) { return a + b; } %} @@ -73,10 +70,8 @@ %template(templatedfunction) templatedfunction<int>; -// Deafult args with references -%inline -%{ - +// Default args with references +%inline %{ typedef int size_type; struct Hello @@ -84,13 +79,10 @@ static const size_type hello = 3; }; - - int rfoo( const size_type& x = Hello::hello, const Hello& y = Hello() ) { return x; } - %} %{ const int Hello::hello; @@ -104,9 +96,7 @@ int foo_kw(int from = 1, int except = 2) {return from + except; } - int foo_nu(int from = 1, int = 0) {return from; } int foo_mm(int min = 1, int max = 2) {return min + max; } - %} diff --git a/Examples/test-suite/li_boost_intrusive_ptr.i b/Examples/test-suite/li_boost_intrusive_ptr.i index 4916d0285..c3b211208 100644 --- a/Examples/test-suite/li_boost_intrusive_ptr.i +++ b/Examples/test-suite/li_boost_intrusive_ptr.i @@ -6,6 +6,9 @@ // count the instances of intrusive_ptr. Uncomment the INTRUSIVE_PTR_WRAPPER macro to turn this on. // // Also note the debug_shared flag which can be set from the target language. +// +// Usage of intrusive_ptr_add_ref and intrusive_ptr_release based on boost testing: +// http://www.boost.org/doc/libs/1_36_0/libs/smart_ptr/test/intrusive_ptr_test.cpp %module li_boost_intrusive_ptr @@ -13,10 +16,10 @@ %warnfilter(SWIGWARN_LANG_SMARTPTR_MISSING) KlassDerived; %warnfilter(SWIGWARN_LANG_SMARTPTR_MISSING) KlassDerivedDerived; -%{ -template<typename T> void intrusive_ptr_add_ref(const T* r) { r->addref(); } -template<typename T> void intrusive_ptr_release(const T* r) { r->release(); } +%ignore intrusive_ptr_add_ref; +%ignore intrusive_ptr_release; +%{ #include <boost/shared_ptr.hpp> #include <boost/intrusive_ptr.hpp> #include <boost/detail/atomic_count.hpp> @@ -132,6 +135,8 @@ struct Klass { void release(void) const { if (--count == 0) delete this; } int use_count(void) const { return count; } static long getTotal_count() { return total_count; } + friend void intrusive_ptr_add_ref(const Klass* r) { r->addref(); } + friend void intrusive_ptr_release(const Klass* r) { r->release(); } private: static void increment() { ++total_count; if (debug_shared) cout << " ++xxxxx Klass::increment tot: " << total_count << endl;} @@ -177,6 +182,8 @@ struct IgnoredRefCountingBase { void addref(void) const { ++count; } void release(void) const { if (--count == 0) delete this; } int use_count(void) const { return count; } + inline friend void intrusive_ptr_add_ref(const IgnoredRefCountingBase* r) { r->addref(); } + inline friend void intrusive_ptr_release(const IgnoredRefCountingBase* r) { r->release(); } static long getTotal_count() { return total_count; } private: @@ -414,6 +421,8 @@ template <class T1, class T2> struct Base { void addref(void) const { count++; } void release(void) const { if (--count == 0) delete this; } int use_count(void) const { return count; } + inline friend void intrusive_ptr_add_ref(const Base<T1, T2>* r) { r->addref(); } + inline friend void intrusive_ptr_release(const Base<T1, T2>* r) { r->release(); } }; %} diff --git a/Examples/test-suite/li_std_except_as_class.i b/Examples/test-suite/li_std_except_as_class.i index 0400c9a82..01ed1f07c 100644 --- a/Examples/test-suite/li_std_except_as_class.i +++ b/Examples/test-suite/li_std_except_as_class.i @@ -23,3 +23,11 @@ void test_domain_error() throw(std::domain_error) %include <std_except.i> void test_domain_error() throw(std::domain_error) { throw std::domain_error("std::domain_error"); } + +%inline %{ +#ifdef SWIGPYTHON_BUILTIN +bool is_python_builtin() { return true; } +#else +bool is_python_builtin() { return false; } +#endif +%} diff --git a/Examples/test-suite/li_std_string_extra.i b/Examples/test-suite/li_std_string_extra.i index aa758532a..6bef12ff4 100644 --- a/Examples/test-suite/li_std_string_extra.i +++ b/Examples/test-suite/li_std_string_extra.i @@ -49,6 +49,12 @@ std::basic_string<char,std::char_traits<char>,std::allocator<char> > test_value_ return x; } +#ifdef SWIGPYTHON_BUILTIN +bool is_python_builtin() { return true; } +#else +bool is_python_builtin() { return false; } +#endif + %} %include "li_std_string.i" diff --git a/Examples/test-suite/li_std_wstring.i b/Examples/test-suite/li_std_wstring.i index e0ecde53b..80f860338 100644 --- a/Examples/test-suite/li_std_wstring.i +++ b/Examples/test-suite/li_std_wstring.i @@ -92,6 +92,12 @@ void test_throw() throw(std::wstring){ #pragma warning(default: 4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow) #endif +#ifdef SWIGPYTHON_BUILTIN +bool is_python_builtin() { return true; } +#else +bool is_python_builtin() { return false; } +#endif + %} diff --git a/Examples/test-suite/li_swigtype_inout.i b/Examples/test-suite/li_swigtype_inout.i index 9d7e9a4c6..136c9fa9e 100644 --- a/Examples/test-suite/li_swigtype_inout.i +++ b/Examples/test-suite/li_swigtype_inout.i @@ -13,28 +13,28 @@ #include <iostream> struct XXX { XXX(int v) : value(v) { - if (debug) std::cout << "Default Constructor " << value << " " << this << std::endl; + if (debugging) std::cout << "Default Constructor " << value << " " << this << std::endl; count++; } XXX(const XXX &other) { value = other.value; - if (debug) std::cout << "Copy Constructor " << value << " " << this << std::endl; + if (debugging) std::cout << "Copy Constructor " << value << " " << this << std::endl; count++; } XXX& operator=(const XXX &other) { value = other.value; - if (debug) std::cout << "Assignment operator " << value << " " << this << std::endl; + if (debugging) std::cout << "Assignment operator " << value << " " << this << std::endl; return *this; } ~XXX() { - if (debug) std::cout << "Destructor " << value << " " << this << std::endl; + if (debugging) std::cout << "Destructor " << value << " " << this << std::endl; count--; } void showInfo() { - if (debug) std::cout << "Info " << value << " " << this << std::endl; + if (debugging) std::cout << "Info " << value << " " << this << std::endl; } int value; - static const bool debug = false; + static const bool debugging = false; static int count; }; int XXX::count = 0; diff --git a/Examples/test-suite/lua/Makefile.in b/Examples/test-suite/lua/Makefile.in index 66a0d2da9..c562f09df 100644 --- a/Examples/test-suite/lua/Makefile.in +++ b/Examples/test-suite/lua/Makefile.in @@ -5,6 +5,7 @@ LANGUAGE = lua LUA = @LUABIN@ SCRIPTSUFFIX = _runme.lua + srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ @@ -28,7 +29,7 @@ LIBS = -L. lua_no_module_global.%: SWIGOPT += -nomoduleglobal # Rules for the different types of tests -%.cpptest: +%.cpptest: $(setup) +$(swig_and_compile_cpp) $(run_testcase) @@ -38,7 +39,7 @@ lua_no_module_global.%: SWIGOPT += -nomoduleglobal +$(swig_and_compile_c) $(run_testcase) -%.multicpptest: +%.multicpptest: $(setup) +$(swig_and_compile_multi_cpp) $(run_testcase) @@ -46,19 +47,19 @@ lua_no_module_global.%: SWIGOPT += -nomoduleglobal # Runs the testcase. A testcase is only run if # a file is found which has _runme.lua appended after the testcase name. run_testcase = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - env LUA_PATH="$(srcdir)/?.lua;" $(RUNTOOL) $(LUA) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + env LUA_PATH="$(srcdir)/?.lua;" $(RUNTOOL) $(LUA) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ fi # Clean: (does nothing, we dont generate extra lua code) %.clean: - + @exit 0 clean: - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile lua_clean + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" lua_clean cvsignore: @echo '*wrap* *.so *.dll *.exp *.lib' @echo Makefile - @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.lua; done - @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.lua CVS/Entries ; then echo $${i}_runme.lua; fi; done + @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.lua; done + @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.lua CVS/Entries ; then echo $${i}_runme.lua; fi; done diff --git a/Examples/test-suite/lua/cpp11_strongly_typed_enumerations_runme.lua b/Examples/test-suite/lua/cpp11_strongly_typed_enumerations_runme.lua new file mode 100644 index 000000000..983e25aa2 --- /dev/null +++ b/Examples/test-suite/lua/cpp11_strongly_typed_enumerations_runme.lua @@ -0,0 +1,174 @@ +require("import") -- the import fn +import("cpp11_strongly_typed_enumerations") -- import lib + +-- catch "undefined" global variables +local env = _ENV -- Lua 5.2 +if not env then env = getfenv () end -- Lua 5.1 +setmetatable(env, {__index=function (t,i) error("undefined global variable `"..i.."'",2) end}) + +function enumCheck(actual, expected) + if not (actual == expected) then + error("Enum value mismatch. Expected: "..expected.." Actual: "..actual) + end + return expected + 1 +end + +--val = 0 +--val = enumCheck(cpp11_strongly_typed_enumerations.cpp11_strongly_typed_enumerations.Enum1_Val1, val) +local val = 0 +val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val1, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val2, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val3, 13) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val4, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val5a, 13) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val6a, val) + +val = 0 +val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val1, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val2, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val3, 23) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val4, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val5b, 23) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val6b, val) + +val = 0 +val = enumCheck(cpp11_strongly_typed_enumerations.Val1, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Val2, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Val3, 43) +val = enumCheck(cpp11_strongly_typed_enumerations.Val4, val) + +val = 0 +val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val1, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val2, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val3, 53) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val4, val) + +val = 0 +val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val1, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val2, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val3, 63) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val4, val) + +val = 0 +val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val1, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val2, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val3, 73) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val4, val) + +val = 0 +val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val1, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val2, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val3, 83) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val4, val) + +val = 0 +val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val1, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val2, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val3, 103) +val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val4, val) + +val = 0 +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val1, 1121) +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val2, 1122) +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val3, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val4, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val5c, 1121) +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum12_Val6c, val) + +val = 0 +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val1, 1131) +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val2, 1132) +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val3, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val4, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val5d, 1131) +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Val6d, val) + +val = 0 +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val1, 1141) +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val2, 1142) +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val3, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val4, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val5e, 1141) +val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Enum14_Val6e, val) + +-- Requires nested class support to work +--val = 0 +--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val1, 3121) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val2, 3122) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val3, val) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val4, val) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val5f, 3121) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val6f, val) +-- +--val = 0 +--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Val1, 3131) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Val2, 3132) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Val3, val) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Val4, val) +-- +--val = 0 +--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val1, 3141) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val2, 3142) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val3, val) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val4, val) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val5g, 3141) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum14_Val6g, val) + +val = 0 +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val1, 2121) +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val2, 2122) +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val3, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val4, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val5h, 2121) +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum12_Val6h, val) + +val = 0 +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val1, 2131) +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val2, 2132) +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val3, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val4, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val5i, 2131) +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Val6i, val) + +val = 0 +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val1, 2141) +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val2, 2142) +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val3, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val4, val) +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val5j, 2141) +val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Enum14_Val6j, val) + +-- Requires nested class support to work +--val = 0 +--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum12_Val1, 4121) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum12_Val2, 4122) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum12_Val3, val) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum12_Val4, val) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum12_Val5k, 4121) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum12_Val6k, val) +-- +--val = 0 +--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Val1, 4131) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Val2, 4132) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Val3, val) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Val4, val) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Val5l, 4131) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Val6l, val) +-- +--val = 0 +--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum14_Val1, 4141) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum14_Val2, 4142) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum14_Val3, val) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum14_Val4, val) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum14_Val5m, 4141) +--val = enumCheck(cpp11_strongly_typed_enumerations.Class2.Struct1.Enum14_Val6m, val) + +class1 = cpp11_strongly_typed_enumerations.Class1() +enumCheck(class1:class1Test1(cpp11_strongly_typed_enumerations.Enum1_Val5a), 13) +enumCheck(class1:class1Test2(cpp11_strongly_typed_enumerations.Class1.Enum12_Val5c), 1121) +--enumCheck(class1:class1Test3(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val5f), 3121) + +enumCheck(cpp11_strongly_typed_enumerations.globalTest1(cpp11_strongly_typed_enumerations.Enum1_Val5a), 13) +enumCheck(cpp11_strongly_typed_enumerations.globalTest2(cpp11_strongly_typed_enumerations.Class1.Enum12_Val5c), 1121) +--enumCheck(globalTest3(cpp11_strongly_typed_enumerations.Class1.Struct1.Enum12_Val5f), 3121) + diff --git a/Examples/test-suite/lua/cpp_basic_runme.lua b/Examples/test-suite/lua/cpp_basic_runme.lua index c7e0325c5..5a0e1c699 100644 --- a/Examples/test-suite/lua/cpp_basic_runme.lua +++ b/Examples/test-suite/lua/cpp_basic_runme.lua @@ -86,3 +86,14 @@ f4_name = tostring(f4) assert( f2_name == "Foo" ) assert( f3_name == "Foo" ) assert( f4_name == "FooSubSub" ) + +-- Test __eq implementation supplied by default + +-- eq_f1 and eq_f2 must be different userdata with same Foo* pointer. If eq_f1 and eq_f2 are the same userdata (e.g.) +-- > eq_f1 = smth +-- > eq_f2 = eq_f1 +-- then default Lua equality comparison kicks in and considers them equal. Access to global_fptr is actually a +-- function call (internally) and it returns new userdata each time. +eq_f1 = cb.Bar.global_fptr +eq_f2 = cb.Bar.global_fptr +assert( eq_f1 == eq_f2 ) diff --git a/Examples/test-suite/lua/equality_runme.lua b/Examples/test-suite/lua/equality_runme.lua new file mode 100644 index 000000000..cadbede0a --- /dev/null +++ b/Examples/test-suite/lua/equality_runme.lua @@ -0,0 +1,47 @@ +require("import") -- the import fn +import("equality") -- import code +eq=equality -- renaming import + +-- catch "undefined" global variables +local env = _ENV -- Lua 5.2 +if not env then env = getfenv () end -- Lua 5.1 +setmetatable(env, {__index=function (t,i) error("undefined global variable `"..i.."'",2) end}) + +-- === No equality operator === + +-- logically same data without equality operator are not equal +p1 = eq.MakePoint(10,9); +p2 = eq.MakePoint(10,9); + +assert( p1 ~= p2 ); + +-- different wrappers for same Point* are equal +p3 = eq.GetZeroPointPtr() +p4 = eq.GetZeroPointPtr() + +assert( p3 == p4 ) + + +-- === Logically correct equality operator === + +ed1 = eq.EqualOpDefined(10) +ed2 = eq.EqualOpDefined(10) +ed3 = eq.EqualOpDefined(15) + +assert( ed1 == ed2 ) +assert( ed1 ~= ed3 ) + + +-- === Logically incorrect equality operator === + +ew1 = eq.EqualOpWrong() +ew2 = eq.EqualOpWrong() + +assert( ew1 ~= ew2 ); + +ew3 = eq.EqualOpWrong.GetStaticObject() +ew4 = eq.EqualOpWrong.GetStaticObject() + +-- Even though these are pointers to same object, operator== overload should +-- state that they are not equal +assert( ew3 ~= ew4 ) diff --git a/Examples/test-suite/lua/operator_overload_runme.lua b/Examples/test-suite/lua/operator_overload_runme.lua index 5ba06ff08..c34c09021 100644 --- a/Examples/test-suite/lua/operator_overload_runme.lua +++ b/Examples/test-suite/lua/operator_overload_runme.lua @@ -1,4 +1,4 @@ --- demo of lua swig capacilities (operator overloading) +-- demo of lua swig capacities (operator overloading) require("import") -- the import fn import("operator_overload") -- import lib @@ -33,7 +33,7 @@ assert(b>=c) assert(b>d) assert(b>=d) --- lua does not support += operators: skiping +-- lua does not support += operators: skipping -- test + f=Op(1) @@ -50,7 +50,7 @@ assert(f/g==Op(1)) --lua 5.0.2 defines that unary - is __unm(self,nil) --lua 5.1.2 defines that unary - is __unm(self,self) ---C++ expectes unary - as operator-() +--C++ expects unary - as operator-() --however the latest version of SWIG strictly checks the number of args --and will complain if too many args are provided --therefore disabling these tests for now @@ -79,7 +79,7 @@ assert(tostring(Op(1))=="Op(1)") assert(tostring(Op(-3))=="Op(-3)") --- check that operator overloads are correctly propogated down inheritance hierarchy +-- check that operator overloads are correctly propagated down inheritance hierarchy a_d=OpDerived() b_d=OpDerived(5) diff --git a/Examples/test-suite/mzscheme/Makefile.in b/Examples/test-suite/mzscheme/Makefile.in index fcaf33a48..da92f76fd 100644 --- a/Examples/test-suite/mzscheme/Makefile.in +++ b/Examples/test-suite/mzscheme/Makefile.in @@ -5,6 +5,7 @@ LANGUAGE = mzscheme MZSCHEME = mzscheme SCRIPTSUFFIX = _runme.scm + srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ @@ -18,7 +19,7 @@ include $(srcdir)/../common.mk # none! # Rules for the different types of tests -%.cpptest: +%.cpptest: $(setup) +$(swig_and_compile_cpp) $(run_testcase) @@ -28,7 +29,7 @@ include $(srcdir)/../common.mk +$(swig_and_compile_c) $(run_testcase) -%.multicpptest: +%.multicpptest: $(setup) +$(swig_and_compile_multi_cpp) $(run_testcase) @@ -36,13 +37,13 @@ include $(srcdir)/../common.mk # Runs the testcase. A testcase is only run if # a file is found which has _runme.scm appended after the testcase name. run_testcase = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(MZSCHEME) -r $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(MZSCHEME) -r $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ fi # Clean %.clean: - + @exit 0 clean: - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile mzscheme_clean + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" mzscheme_clean diff --git a/Examples/test-suite/nested_class.i b/Examples/test-suite/nested_class.i index ccb7ecac1..fe405479c 100644 --- a/Examples/test-suite/nested_class.i +++ b/Examples/test-suite/nested_class.i @@ -49,6 +49,9 @@ struct Outer { struct { Integer b; }; +#else + Integer a; + Integer b; #endif union { @@ -164,6 +167,9 @@ struct Outer { public: Integer yy; }; +#else + Integer xx; + Integer yy; #endif /////////////////////////////////////////// diff --git a/Examples/test-suite/nested_extend_c.i b/Examples/test-suite/nested_extend_c.i new file mode 100644 index 000000000..64727b9ea --- /dev/null +++ b/Examples/test-suite/nested_extend_c.i @@ -0,0 +1,102 @@ +%module nested_extend_c + +#if !defined(SWIGOCTAVE) && !defined(SWIG_JAVASCRIPT_V8) +%extend hiA { + hiA() { + union hiA *self = (union hiA *)malloc(sizeof(union hiA)); + self->c = 'h'; + return self; + } + char hi_extend() { + return $self->c; + } + static const long swig_size = sizeof(union hiA); +} +%extend lowA { + lowA() { + struct lowA *self = (struct lowA *)malloc(sizeof(struct lowA)); + self->name = 0; + self->num = 99; + return self; + } + int low_extend() { + return $self->num; + } + static const long swig_size = sizeof(struct lowA); +} + +%extend hiB { + hiB() { + union hiB *self = (union hiB *)malloc(sizeof(union hiB)); + self->c = 'h'; + return self; + } + char hi_extend() { + return $self->c; + } + static const long swig_size = sizeof(union hiB); +} +%extend lowB { + lowB() { + struct lowB *self = (struct lowB *)malloc(sizeof(struct lowB)); + self->name = 0; + self->num = 99; + return self; + } + int low_extend() { + return $self->num; + } + static const long swig_size = sizeof(struct lowB); +} + +%extend FOO_bar { + void bar_extend() { + $self->d = 1; + } +}; +%extend NestedA { + static const long swig_size = sizeof(struct NestedA); +} + +#endif + +%inline %{ +typedef struct NestedA { + int a; + union hiA { + char c; + int d; + } hiA_instance; + + struct lowA { + char *name; + int num; + } lowA_instance; +} NestedA; + +typedef struct { + int a; + union hiB { + char c; + int d; + } hiB_instance; + + struct lowB { + char *name; + int num; + } lowB_instance; +} NestedB; + +typedef struct { + int a; + union { + char c; + int d; + } bar; +} FOO; + +struct { + int i; +} THING; +%} + diff --git a/Examples/test-suite/nested_scope.i b/Examples/test-suite/nested_scope.i index 789478361..bd66eec73 100644 --- a/Examples/test-suite/nested_scope.i +++ b/Examples/test-suite/nested_scope.i @@ -26,4 +26,42 @@ namespace ns { #endif }; } + class Outer1 { + struct Nested1; + public: + struct Nested2; +#ifdef __clang__ + struct Nested2 { + int data; + }; +#endif + template <class T> class AbstractClass; + class Real; + }; +#ifndef __clang__ + struct Outer1::Nested2 { + int data; + }; +#endif + + class Klass { + public: + template <class T> class AbstractClass; + class Real; + }; + + template <class T> class Klass::AbstractClass { + public: + virtual void Method() = 0; + virtual ~AbstractClass() {} + }; +%} + +%template(abstract_int) Klass::AbstractClass <int>; + +%inline %{ + class Klass::Real : public AbstractClass <int> { + public: + virtual void Method() {} + }; %} diff --git a/Examples/test-suite/nested_template_base.i b/Examples/test-suite/nested_template_base.i new file mode 100644 index 000000000..0b0272224 --- /dev/null +++ b/Examples/test-suite/nested_template_base.i @@ -0,0 +1,38 @@ +%module nested_template_base + +%inline %{ + template <class T> class OuterT { + public: + T outer(T t) { return t; } + }; +%} + +// The %template goes after OuterT and before OuterC as OuterC::InnerC's base is handled inside OuterC +%template(OuterTInnerS) OuterT<OuterC::InnerS>; + +#if !defined(SWIGCSHARP) && !defined(SWIGJAVA) +%feature("flatnested") OuterC::InnerS; +%feature("flatnested") OuterC::InnerC; +#endif + + +%inline %{ + class OuterC { + public: + struct InnerS; + class InnerC; + }; + + struct OuterC::InnerS { + int val; + InnerS(int val = 0) : val(val) {} + }; + + + class OuterC::InnerC : public OuterT<InnerS> { + public: + OuterT<InnerS>& innerc() { + return *this; + } + }; +%} diff --git a/Examples/test-suite/ocaml/Makefile.in b/Examples/test-suite/ocaml/Makefile.in index f16c3da95..9a4e008b9 100644 --- a/Examples/test-suite/ocaml/Makefile.in +++ b/Examples/test-suite/ocaml/Makefile.in @@ -6,22 +6,23 @@ LANGUAGE = ocaml OCAMLC = ocamlc VARIANT = _static SCRIPTSUFFIX = _runme.ml + srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ -C_TEST_CASES = +C_TEST_CASES = run_testcase = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) -a \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) -a \ -f $(top_srcdir)/Examples/test-suite/$*.list ] ; then \ - $(COMPILETOOL) $(OCAMLC) -c $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ + $(COMPILETOOL) $(OCAMLC) -c $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ $(COMPILETOOL) $(OCAMLC) swig.cmo -custom -g -cc '$(CXX)' -o runme `cat $(top_srcdir)/Examples/test-suite/$(*).list | sed -e 's/\(.*\)/\1_wrap.o \1.cmo/g'`&& $(RUNTOOL) ./runme; \ - elif [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - $(COMPILETOOL) $(OCAMLC) -c $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ + elif [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + $(COMPILETOOL) $(OCAMLC) -c $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ $(COMPILETOOL) $(OCAMLC) swig.cmo -custom -g -cc '$(CXX)' -o runme $(srcdir)/$(*).cmo $(srcdir)/$(*)_runme.cmo $(srcdir)/$(*)_wrap.o && \ $(RUNTOOL) ./runme; \ - fi ; + fi ; check_quant: cat /dev/null > testing @@ -80,4 +81,4 @@ include $(srcdir)/../common.mk @rm -f $*.ml $*.mli; clean: - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile ocaml_clean + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" ocaml_clean diff --git a/Examples/test-suite/ocaml/makedebugtop b/Examples/test-suite/ocaml/makedebugtop index d51439a75..d51439a75 100755..100644 --- a/Examples/test-suite/ocaml/makedebugtop +++ b/Examples/test-suite/ocaml/makedebugtop diff --git a/Examples/test-suite/octave/Makefile.in b/Examples/test-suite/octave/Makefile.in index dc309e8c6..fbffd240c 100644 --- a/Examples/test-suite/octave/Makefile.in +++ b/Examples/test-suite/octave/Makefile.in @@ -5,6 +5,7 @@ LANGUAGE = octave OCTAVE = @OCTAVE@ SCRIPTSUFFIX = _runme.m + srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ @@ -21,7 +22,7 @@ CPP_TEST_BROKEN += \ li_std_set \ li_std_stream -#C_TEST_CASES += +#C_TEST_CASES += # # This test only works with modern C compilers @@ -33,13 +34,13 @@ include $(srcdir)/../common.mk # Overridden variables here LIBS = -L. -CSRCS = $(srcdir)/octave_empty.c +CSRCS = octave_empty.c # Custom tests - tests with additional commandline options # none! # Rules for the different types of tests -%.cpptest: +%.cpptest: $(setup) +$(swig_and_compile_cpp) $(run_testcase) @@ -49,7 +50,7 @@ CSRCS = $(srcdir)/octave_empty.c +$(swig_and_compile_c) $(run_testcase) -%.multicpptest: +%.multicpptest: $(setup) +$(swig_and_compile_multi_cpp) $(run_testcase) @@ -57,8 +58,8 @@ CSRCS = $(srcdir)/octave_empty.c # Runs the testcase. A testcase is only run if # a file is found which has _runme.m appended after the testcase name. run_testcase = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH OCTAVE_PATH=$(srcdir):$$OCTAVE_PATH $(RUNTOOL) $(OCTAVE) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH OCTAVE_PATH=$(srcdir):$$OCTAVE_PATH $(RUNTOOL) $(OCTAVE) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ fi # Clean: remove the generated .m file @@ -67,18 +68,18 @@ run_testcase = \ @rm -f $*.m; clean: - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile octave_clean + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" octave_clean cvsignore: @echo '*wrap* *.mc *.so *.dll *.exp *.lib' @echo Makefile - @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.m; done - @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.m CVS/Entries ; then echo $${i}_runme.m; fi; done - @echo clientdata_prop_a.m - @echo clientdata_prop_b.m - @echo imports_a.m - @echo imports_b.m - @echo mod_a.m mod_b.m + @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.m; done + @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.m CVS/Entries ; then echo $${i}_runme.m; fi; done + @echo clientdata_prop_a.m + @echo clientdata_prop_b.m + @echo imports_a.m + @echo imports_b.m + @echo mod_a.m mod_b.m @echo hugemod.h hugemod_a.i hugemod_b.i hugemod_a.m hugemod_b.m hugemod_runme.m @echo template_typedef_import.m diff --git a/Examples/test-suite/octave/cpp11_strongly_typed_enumerations_runme.m b/Examples/test-suite/octave/cpp11_strongly_typed_enumerations_runme.m new file mode 100644 index 000000000..f66d3d569 --- /dev/null +++ b/Examples/test-suite/octave/cpp11_strongly_typed_enumerations_runme.m @@ -0,0 +1,166 @@ +cpp11_strongly_typed_enumerations + +function newvalue = enumCheck(actual, expected) + if (actual != expected); + error("Enum value mismatch. Expected: %d Actual: %d", expected, actual); + endif + newvalue = expected + 1; +end + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val1, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val2, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val3, 13); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val4, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val5a, 13); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum1_Val6a, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val1, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val2, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val3, 23); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val4, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val5b, 23); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum2_Val6b, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Val1, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Val2, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Val3, 43); +val = enumCheck(cpp11_strongly_typed_enumerations.Val4, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val1, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val2, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val3, 53); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum5_Val4, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val1, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val2, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val3, 63); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum6_Val4, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val1, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val2, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val3, 73); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum7td_Val4, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val1, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val2, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val3, 83); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum8_Val4, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val1, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val2, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val3, 103); +val = enumCheck(cpp11_strongly_typed_enumerations.Enum10_Val4, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum12_Val1, 1121); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum12_Val2, 1122); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum12_Val3, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum12_Val4, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum12_Val5c, 1121); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum12_Val6c, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Val1, 1131); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Val2, 1132); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Val3, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Val4, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Val5d, 1131); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Val6d, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum14_Val1, 1141); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum14_Val2, 1142); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum14_Val3, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum14_Val4, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum14_Val5e, 1141); +val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Enum14_Val6e, val); + +# Requires nested class support to work +#val = 0; +#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum12_Val1, 3121); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum12_Val2, 3122); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum12_Val3, val); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum12_Val4, val); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum12_Val5f, 3121); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum12_Val6f, val); +# +#val = 0; +#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Val1, 3131); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Val2, 3132); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Val3, val); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Val4, val); +# +#val = 0; +#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum14_Val1, 3141); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum14_Val2, 3142); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum14_Val3, val); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum14_Val4, val); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum14_Val5g, 3141); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class1_Struct1.Enum14_Val6g, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum12_Val1, 2121); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum12_Val2, 2122); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum12_Val3, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum12_Val4, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum12_Val5h, 2121); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum12_Val6h, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Val1, 2131); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Val2, 2132); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Val3, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Val4, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Val5i, 2131); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Val6i, val); + +val = 0; +val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum14_Val1, 2141); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum14_Val2, 2142); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum14_Val3, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum14_Val4, val); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum14_Val5j, 2141); +val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Enum14_Val6j, val); + +# Requires nested class support to work +#val = 0; +#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum12_Val1, 4121); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum12_Val2, 4122); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum12_Val3, val); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum12_Val4, val); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum12_Val5k, 4121); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum12_Val6k, val); +# +#val = 0; +#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Val1, 4131); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Val2, 4132); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Val3, val); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Val4, val); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Val5l, 4131); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Val6l, val); +# +#val = 0; +#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum14_Val1, 4141); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum14_Val2, 4142); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum14_Val3, val); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum14_Val4, val); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum14_Val5m, 4141); +#val = enumCheck(cpp11_strongly_typed_enumerations.Class2_Struct1_Enum14_Val6m, val); + +class1 = Class1(); +enumCheck(class1.class1Test1(cpp11_strongly_typed_enumerations.Enum1_Val5a), 13); +enumCheck(class1.class1Test2(cpp11_strongly_typed_enumerations.Class1_Enum12_Val5c), 1121); +#enumCheck(class1.class1Test3(cpp11_strongly_typed_enumerations.Class1_Struct1_Enum12_Val5f), 3121); + +enumCheck(cpp11_strongly_typed_enumerations.globalTest1(cpp11_strongly_typed_enumerations.Enum1_Val5a), 13); +enumCheck(cpp11_strongly_typed_enumerations.globalTest2(cpp11_strongly_typed_enumerations.Class1_Enum12_Val5c), 1121); +#enumCheck(globalTest3(cpp11_strongly_typed_enumerations.Class1_Struct1_Enum12_Val5f), 3121); + diff --git a/Examples/test-suite/octave/director_detect_runme.m b/Examples/test-suite/octave/director_detect_runme.m index f2d8c8dd2..21925712a 100644 --- a/Examples/test-suite/octave/director_detect_runme.m +++ b/Examples/test-suite/octave/director_detect_runme.m @@ -1,7 +1,7 @@ director_detect -global MyBar=@(val=2) \ - subclass(director_detect.Bar(),'val',val,@get_value,@get_class,@just_do_it,@clone); +global MyBar=@(val=2) subclass(director_detect.Bar(),'val',val,@get_value,@get_class,@just_do_it,@clone); + function val=get_value(self) self.val = self.val + 1; val = self.val; diff --git a/Examples/test-suite/octave/iadd_runme.m b/Examples/test-suite/octave/iadd_runme.m index c386c669e..c386c669e 100755..100644 --- a/Examples/test-suite/octave/iadd_runme.m +++ b/Examples/test-suite/octave/iadd_runme.m diff --git a/Examples/test-suite/octave/overload_complicated_runme.m b/Examples/test-suite/octave/overload_complicated_runme.m index 0313be954..0313be954 100755..100644 --- a/Examples/test-suite/octave/overload_complicated_runme.m +++ b/Examples/test-suite/octave/overload_complicated_runme.m diff --git a/Examples/test-suite/overload_polymorphic.i b/Examples/test-suite/overload_polymorphic.i new file mode 100644 index 000000000..a1f123b9d --- /dev/null +++ b/Examples/test-suite/overload_polymorphic.i @@ -0,0 +1,22 @@ +%module overload_polymorphic + +%inline %{ + +class Base { +public: + Base(){} + virtual ~Base(){} +}; + +class Derived : public Base { +public: + Derived(){} + virtual ~Derived(){} +}; + + + +int test(Base* base){ return 0;} +int test(int hello){ return 1; } + +%} diff --git a/Examples/test-suite/perl5/Makefile.in b/Examples/test-suite/perl5/Makefile.in index 67eaf5c9a..ccd12d6e4 100644 --- a/Examples/test-suite/perl5/Makefile.in +++ b/Examples/test-suite/perl5/Makefile.in @@ -5,7 +5,8 @@ LANGUAGE = perl5 PERL = @PERL@ SCRIPTSUFFIX = _runme.pl -TEST_RUNNER = run-perl-test.pl +TEST_RUNNER = $(srcdir)/run-perl-test.pl + srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ @@ -16,6 +17,7 @@ CPP_TEST_CASES += \ li_cstring \ li_cdata_carrays \ li_reference \ + director_nestedmodule \ C_TEST_CASES += \ li_cdata \ @@ -31,7 +33,7 @@ include $(srcdir)/../common.mk # none! # Rules for the different types of tests -%.cpptest: +%.cpptest: $(setup) +$(swig_and_compile_cpp) $(run_testcase) @@ -41,7 +43,7 @@ include $(srcdir)/../common.mk +$(swig_and_compile_c) $(run_testcase) -%.multicpptest: +%.multicpptest: $(setup) +$(swig_and_compile_multi_cpp) $(run_testcase) @@ -49,8 +51,8 @@ include $(srcdir)/../common.mk # Runs the testcase. A testcase is only run if # a file is found which has _runme.pl appended after the testcase name. run_testcase = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(PERL) $(TEST_RUNNER) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(PERL) $(TEST_RUNNER) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ fi # Clean: remove the generated .pm file @@ -58,4 +60,4 @@ run_testcase = \ @rm -f $*.pm; clean: - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile perl5_clean + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" perl5_clean diff --git a/Examples/test-suite/perl5/char_binary_runme.pl b/Examples/test-suite/perl5/char_binary_runme.pl index 4c50ee700..4c50ee700 100755..100644 --- a/Examples/test-suite/perl5/char_binary_runme.pl +++ b/Examples/test-suite/perl5/char_binary_runme.pl diff --git a/Examples/test-suite/perl5/class_ignore_runme.pl b/Examples/test-suite/perl5/class_ignore_runme.pl index 989150c3f..989150c3f 100755..100644 --- a/Examples/test-suite/perl5/class_ignore_runme.pl +++ b/Examples/test-suite/perl5/class_ignore_runme.pl diff --git a/Examples/test-suite/perl5/contract_runme.pl b/Examples/test-suite/perl5/contract_runme.pl index fb162e691..fb162e691 100755..100644 --- a/Examples/test-suite/perl5/contract_runme.pl +++ b/Examples/test-suite/perl5/contract_runme.pl diff --git a/Examples/test-suite/perl5/cpp11_strongly_typed_enumerations_runme.pl b/Examples/test-suite/perl5/cpp11_strongly_typed_enumerations_runme.pl new file mode 100644 index 000000000..db19bbfa6 --- /dev/null +++ b/Examples/test-suite/perl5/cpp11_strongly_typed_enumerations_runme.pl @@ -0,0 +1,168 @@ +use strict; +use warnings; +use Test::More tests => 78; +BEGIN { use_ok('cpp11_strongly_typed_enumerations') } +require_ok('cpp11_strongly_typed_enumerations'); + +sub enumCheck { my($actual, $expected) = @_; + is($actual, $expected); + return $expected + 1; +} + +my $val = 0; +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum1_Val1, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum1_Val2, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum1_Val3, 13); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum1_Val4, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum1_Val5a, 13); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum1_Val6a, $val); + +$val = 0; +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum2_Val1, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum2_Val2, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum2_Val3, 23); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum2_Val4, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum2_Val5b, 23); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum2_Val6b, $val); + +$val = 0; +$val = enumCheck($cpp11_strongly_typed_enumerations::Val1, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Val2, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Val3, 43); +$val = enumCheck($cpp11_strongly_typed_enumerations::Val4, $val); + +$val = 0; +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum5_Val1, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum5_Val2, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum5_Val3, 53); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum5_Val4, $val); + +$val = 0; +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum6_Val1, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum6_Val2, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum6_Val3, 63); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum6_Val4, $val); + +$val = 0; +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum7td_Val1, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum7td_Val2, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum7td_Val3, 73); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum7td_Val4, $val); + +$val = 0; +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum8_Val1, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum8_Val2, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum8_Val3, 83); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum8_Val4, $val); + +$val = 0; +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum10_Val1, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum10_Val2, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum10_Val3, 103); +$val = enumCheck($cpp11_strongly_typed_enumerations::Enum10_Val4, $val); + +$val = 0; +$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum12_Val1, 1121); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum12_Val2, 1122); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum12_Val3, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum12_Val4, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum12_Val5c, 1121); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum12_Val6c, $val); + +$val = 0; +$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Val1, 1131); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Val2, 1132); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Val3, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Val4, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Val5d, 1131); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Val6d, $val); + +$val = 0; +$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum14_Val1, 1141); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum14_Val2, 1142); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum14_Val3, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum14_Val4, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum14_Val5e, 1141); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Enum14_Val6e, $val); + +# Requires nested class support to work +#$val = 0; +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum12_Val1, 3121); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum12_Val2, 3122); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum12_Val3, $val); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum12_Val4, $val); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum12_Val5f, 3121); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum12_Val6f, $val); +# +#$val = 0; +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Val1, 3131); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Val2, 3132); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Val3, $val); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Val4, $val); +# +#$val = 0; +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum14_Val1, 3141); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum14_Val2, 3142); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum14_Val3, $val); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum14_Val4, $val); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum14_Val5g, 3141); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum14_Val6g, $val); + +$val = 0; +$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum12_Val1, 2121); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum12_Val2, 2122); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum12_Val3, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum12_Val4, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum12_Val5h, 2121); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum12_Val6h, $val); + +$val = 0; +$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Val1, 2131); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Val2, 2132); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Val3, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Val4, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Val5i, 2131); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Val6i, $val); + +$val = 0; +$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum14_Val1, 2141); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum14_Val2, 2142); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum14_Val3, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum14_Val4, $val); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum14_Val5j, 2141); +$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Enum14_Val6j, $val); + +# Requires nested class support to work +#$val = 0; +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum12_Val1, 4121); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum12_Val2, 4122); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum12_Val3, $val); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum12_Val4, $val); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum12_Val5k, 4121); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum12_Val6k, $val); +# +#$val = 0; +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Val1, 4131); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Val2, 4132); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Val3, $val); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Val4, $val); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Val5l, 4131); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Val6l, $val); +# +#$val = 0; +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum14_Val1, 4141); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum14_Val2, 4142); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum14_Val3, $val); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum14_Val4, $val); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum14_Val5m, 4141); +#$val = enumCheck($cpp11_strongly_typed_enumerations::Class2::Struct1::Enum14_Val6m, $val); + +my $class1 = cpp11_strongly_typed_enumerations::Class1->new(); +enumCheck($class1->class1Test1($cpp11_strongly_typed_enumerations::Enum1_Val5a), 13); +enumCheck($class1->class1Test2($cpp11_strongly_typed_enumerations::Class1::Enum12_Val5c), 1121); +#enumCheck($class1->class1Test3($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum12_Val5f), 3121); + +enumCheck(cpp11_strongly_typed_enumerations::globalTest1($cpp11_strongly_typed_enumerations::Enum1_Val5a), 13); +enumCheck(cpp11_strongly_typed_enumerations::globalTest2($cpp11_strongly_typed_enumerations::Class1::Enum12_Val5c), 1121); +#enumCheck(cpp11_strongly_typed_enumerations::globalTest3($cpp11_strongly_typed_enumerations::Class1::Struct1::Enum12_Val5f), 3121); + diff --git a/Examples/test-suite/perl5/enum_template_runme.pl b/Examples/test-suite/perl5/enum_template_runme.pl index bdaaa8534..bdaaa8534 100755..100644 --- a/Examples/test-suite/perl5/enum_template_runme.pl +++ b/Examples/test-suite/perl5/enum_template_runme.pl diff --git a/Examples/test-suite/perl5/grouping_runme.pl b/Examples/test-suite/perl5/grouping_runme.pl index 2009cce73..2009cce73 100755..100644 --- a/Examples/test-suite/perl5/grouping_runme.pl +++ b/Examples/test-suite/perl5/grouping_runme.pl diff --git a/Examples/test-suite/perl5/ignore_parameter_runme.pl b/Examples/test-suite/perl5/ignore_parameter_runme.pl index 8e75e0b0e..8e75e0b0e 100755..100644 --- a/Examples/test-suite/perl5/ignore_parameter_runme.pl +++ b/Examples/test-suite/perl5/ignore_parameter_runme.pl diff --git a/Examples/test-suite/perl5/inherit_missing_runme.pl b/Examples/test-suite/perl5/inherit_missing_runme.pl index bc2260215..bc2260215 100755..100644 --- a/Examples/test-suite/perl5/inherit_missing_runme.pl +++ b/Examples/test-suite/perl5/inherit_missing_runme.pl diff --git a/Examples/test-suite/perl5/li_std_except_runme.pl b/Examples/test-suite/perl5/li_std_except_runme.pl index 59d3126ea..59d3126ea 100755..100644 --- a/Examples/test-suite/perl5/li_std_except_runme.pl +++ b/Examples/test-suite/perl5/li_std_except_runme.pl diff --git a/Examples/test-suite/perl5/minherit_runme.pl b/Examples/test-suite/perl5/minherit_runme.pl index 1f3afadd2..1f3afadd2 100755..100644 --- a/Examples/test-suite/perl5/minherit_runme.pl +++ b/Examples/test-suite/perl5/minherit_runme.pl diff --git a/Examples/test-suite/perl5/naturalvar_runme.pl b/Examples/test-suite/perl5/naturalvar_runme.pl index c0f972d68..c0f972d68 100755..100644 --- a/Examples/test-suite/perl5/naturalvar_runme.pl +++ b/Examples/test-suite/perl5/naturalvar_runme.pl diff --git a/Examples/test-suite/perl5/preproc_runme.pl b/Examples/test-suite/perl5/preproc_runme.pl index 89e25f896..89e25f896 100755..100644 --- a/Examples/test-suite/perl5/preproc_runme.pl +++ b/Examples/test-suite/perl5/preproc_runme.pl diff --git a/Examples/test-suite/perl5/primitive_types_runme.pl b/Examples/test-suite/perl5/primitive_types_runme.pl index 311c138e0..311c138e0 100755..100644 --- a/Examples/test-suite/perl5/primitive_types_runme.pl +++ b/Examples/test-suite/perl5/primitive_types_runme.pl diff --git a/Examples/test-suite/perl5/reference_global_vars_runme.pl b/Examples/test-suite/perl5/reference_global_vars_runme.pl index 89d73b03d..89d73b03d 100755..100644 --- a/Examples/test-suite/perl5/reference_global_vars_runme.pl +++ b/Examples/test-suite/perl5/reference_global_vars_runme.pl diff --git a/Examples/test-suite/perl5/rename_scope_runme.pl b/Examples/test-suite/perl5/rename_scope_runme.pl index 71c0cfc6f..71c0cfc6f 100755..100644 --- a/Examples/test-suite/perl5/rename_scope_runme.pl +++ b/Examples/test-suite/perl5/rename_scope_runme.pl diff --git a/Examples/test-suite/perl5/return_const_value_runme.pl b/Examples/test-suite/perl5/return_const_value_runme.pl index 4b31c0b26..4b31c0b26 100755..100644 --- a/Examples/test-suite/perl5/return_const_value_runme.pl +++ b/Examples/test-suite/perl5/return_const_value_runme.pl diff --git a/Examples/test-suite/perl5/run-perl-test.pl b/Examples/test-suite/perl5/run-perl-test.pl index 106bf002b..106bf002b 100755..100644 --- a/Examples/test-suite/perl5/run-perl-test.pl +++ b/Examples/test-suite/perl5/run-perl-test.pl diff --git a/Examples/test-suite/perl5/sizet_runme.pl b/Examples/test-suite/perl5/sizet_runme.pl index 5f29773b3..5f29773b3 100755..100644 --- a/Examples/test-suite/perl5/sizet_runme.pl +++ b/Examples/test-suite/perl5/sizet_runme.pl diff --git a/Examples/test-suite/perl5/sneaky1_runme.pl b/Examples/test-suite/perl5/sneaky1_runme.pl index 097d44678..097d44678 100755..100644 --- a/Examples/test-suite/perl5/sneaky1_runme.pl +++ b/Examples/test-suite/perl5/sneaky1_runme.pl diff --git a/Examples/test-suite/perl5/template_typedef_cplx2_runme.pl b/Examples/test-suite/perl5/template_typedef_cplx2_runme.pl index e0a3003d2..e0a3003d2 100755..100644 --- a/Examples/test-suite/perl5/template_typedef_cplx2_runme.pl +++ b/Examples/test-suite/perl5/template_typedef_cplx2_runme.pl diff --git a/Examples/test-suite/perl5/typedef_class_runme.pl b/Examples/test-suite/perl5/typedef_class_runme.pl index a7b88a771..a7b88a771 100755..100644 --- a/Examples/test-suite/perl5/typedef_class_runme.pl +++ b/Examples/test-suite/perl5/typedef_class_runme.pl diff --git a/Examples/test-suite/perl5/typename_runme.pl b/Examples/test-suite/perl5/typename_runme.pl index 543080d8c..543080d8c 100755..100644 --- a/Examples/test-suite/perl5/typename_runme.pl +++ b/Examples/test-suite/perl5/typename_runme.pl diff --git a/Examples/test-suite/perl5/using1_runme.pl b/Examples/test-suite/perl5/using1_runme.pl index 8551b6fc6..8551b6fc6 100755..100644 --- a/Examples/test-suite/perl5/using1_runme.pl +++ b/Examples/test-suite/perl5/using1_runme.pl diff --git a/Examples/test-suite/perl5/using2_runme.pl b/Examples/test-suite/perl5/using2_runme.pl index 3a31bb364..3a31bb364 100755..100644 --- a/Examples/test-suite/perl5/using2_runme.pl +++ b/Examples/test-suite/perl5/using2_runme.pl diff --git a/Examples/test-suite/perl5/wrapmacro_runme.pl b/Examples/test-suite/perl5/wrapmacro_runme.pl index 8e0154057..8e0154057 100755..100644 --- a/Examples/test-suite/perl5/wrapmacro_runme.pl +++ b/Examples/test-suite/perl5/wrapmacro_runme.pl diff --git a/Examples/test-suite/php/Makefile.in b/Examples/test-suite/php/Makefile.in index fcdcac2b9..c3f8af5cb 100644 --- a/Examples/test-suite/php/Makefile.in +++ b/Examples/test-suite/php/Makefile.in @@ -4,11 +4,13 @@ LANGUAGE = php SCRIPTSUFFIX = _runme.php + srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ CPP_TEST_CASES += \ + php_iterator \ php_namewarn_rename \ include $(srcdir)/../common.mk @@ -29,7 +31,7 @@ missingctests: missingtests: missingcpptests missingctests # Rules for the different types of tests -%.cpptest: +%.cpptest: $(setup) +$(swig_and_compile_cpp) +$(run_testcase) @@ -39,7 +41,7 @@ missingtests: missingcpptests missingctests +$(swig_and_compile_c) +$(run_testcase) -%.multicpptest: +%.multicpptest: $(setup) +$(swig_and_compile_multi_cpp) +$(run_testcase) @@ -56,15 +58,21 @@ missingtests: missingcpptests missingctests # Runs the testcase. Tries to run testcase_runme.php, and if that's not # found, runs testcase.php, except for multicpptests. run_testcase = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHP_SCRIPT=$(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) RUNTOOL="$(RUNTOOL)" php_run; \ - elif [ -f $(srcdir)/$(SCRIPTPREFIX)$*.php -a ! -f $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list ]; then \ - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHP_SCRIPT=$(srcdir)/$(SCRIPTPREFIX)$*.php RUNTOOL="$(RUNTOOL)" php_run; \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHP_SCRIPT=$(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) RUNTOOL="$(RUNTOOL)" php_run; \ + elif [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*.php -a ! -f $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list ]; then \ + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile PHP_SCRIPT=$(SCRIPTDIR)/$(SCRIPTPREFIX)$*.php RUNTOOL="$(RUNTOOL)" php_run; \ fi # Clean: remove the generated .php file %.clean: - @rm -f $*.php; + @rm -f $*.php php_$*.h clean: - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile php_clean + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" php_clean + rm -f clientdata_prop_a.php clientdata_prop_b.php php_clientdata_prop_a.h php_clientdata_prop_b.h + rm -f import_stl_a.php import_stl_b.php php_import_stl_a.h php_import_stl_b.h + rm -f imports_a.php imports_b.php php_imports_a.h php_imports_b.h + rm -f mod_a.php mod_b.php php_mod_a.h php_mod_b.h + rm -f multi_import_a.php multi_import_b.php php_multi_import_a.h php_multi_import_b.h + rm -f packageoption_a.php packageoption_b.php packageoption_c.php php_packageoption_a.h php_packageoption_b.h php_packageoption_c.h diff --git a/Examples/test-suite/php/cpp11_strongly_typed_enumerations_runme.php b/Examples/test-suite/php/cpp11_strongly_typed_enumerations_runme.php new file mode 100644 index 000000000..bee59b209 --- /dev/null +++ b/Examples/test-suite/php/cpp11_strongly_typed_enumerations_runme.php @@ -0,0 +1,169 @@ +<?php + +require "tests.php"; +require "cpp11_strongly_typed_enumerations.php"; + +function enumCheck($actual, $expected) { + check::equal($actual, $expected, "Enum value mismatch"); + return $expected + 1; +} + + +$val = 0; +$val = enumCheck(Enum1_Val1, $val); +$val = enumCheck(Enum1_Val2, $val); +$val = enumCheck(Enum1_Val3, 13); +$val = enumCheck(Enum1_Val4, $val); +$val = enumCheck(Enum1_Val5a, 13); +$val = enumCheck(Enum1_Val6a, $val); + +$val = 0; +$val = enumCheck(Enum2_Val1, $val); +$val = enumCheck(Enum2_Val2, $val); +$val = enumCheck(Enum2_Val3, 23); +$val = enumCheck(Enum2_Val4, $val); +$val = enumCheck(Enum2_Val5b, 23); +$val = enumCheck(Enum2_Val6b, $val); + +$val = 0; +$val = enumCheck(Val1, $val); +$val = enumCheck(Val2, $val); +$val = enumCheck(Val3, 43); +$val = enumCheck(Val4, $val); + +$val = 0; +$val = enumCheck(Enum5_Val1, $val); +$val = enumCheck(Enum5_Val2, $val); +$val = enumCheck(Enum5_Val3, 53); +$val = enumCheck(Enum5_Val4, $val); + +$val = 0; +$val = enumCheck(Enum6_Val1, $val); +$val = enumCheck(Enum6_Val2, $val); +$val = enumCheck(Enum6_Val3, 63); +$val = enumCheck(Enum6_Val4, $val); + +$val = 0; +$val = enumCheck(Enum7td_Val1, $val); +$val = enumCheck(Enum7td_Val2, $val); +$val = enumCheck(Enum7td_Val3, 73); +$val = enumCheck(Enum7td_Val4, $val); + +$val = 0; +$val = enumCheck(Enum8_Val1, $val); +$val = enumCheck(Enum8_Val2, $val); +$val = enumCheck(Enum8_Val3, 83); +$val = enumCheck(Enum8_Val4, $val); + +$val = 0; +$val = enumCheck(Enum10_Val1, $val); +$val = enumCheck(Enum10_Val2, $val); +$val = enumCheck(Enum10_Val3, 103); +$val = enumCheck(Enum10_Val4, $val); + +$val = 0; +$val = enumCheck(Class1::Enum12_Val1, 1121); +$val = enumCheck(Class1::Enum12_Val2, 1122); +$val = enumCheck(Class1::Enum12_Val3, $val); +$val = enumCheck(Class1::Enum12_Val4, $val); +$val = enumCheck(Class1::Enum12_Val5c, 1121); +$val = enumCheck(Class1::Enum12_Val6c, $val); + +$val = 0; +$val = enumCheck(Class1::Val1, 1131); +$val = enumCheck(Class1::Val2, 1132); +$val = enumCheck(Class1::Val3, $val); +$val = enumCheck(Class1::Val4, $val); +$val = enumCheck(Class1::Val5d, 1131); +$val = enumCheck(Class1::Val6d, $val); + +$val = 0; +$val = enumCheck(Class1::Enum14_Val1, 1141); +$val = enumCheck(Class1::Enum14_Val2, 1142); +$val = enumCheck(Class1::Enum14_Val3, $val); +$val = enumCheck(Class1::Enum14_Val4, $val); +$val = enumCheck(Class1::Enum14_Val5e, 1141); +$val = enumCheck(Class1::Enum14_Val6e, $val); + +# Requires nested class support to work +#$val = 0; +#$val = enumCheck(Class1::Struct1.Enum12_Val1, 3121); +#$val = enumCheck(Class1::Struct1.Enum12_Val2, 3122); +#$val = enumCheck(Class1::Struct1.Enum12_Val3, $val); +#$val = enumCheck(Class1::Struct1.Enum12_Val4, $val); +#$val = enumCheck(Class1::Struct1.Enum12_Val5f, 3121); +#$val = enumCheck(Class1::Struct1.Enum12_Val6f, $val); +# +#$val = 0; +#$val = enumCheck(Class1::Struct1.$val1, 3131); +#$val = enumCheck(Class1::Struct1.$val2, 3132); +#$val = enumCheck(Class1::Struct1.$val3, $val); +#$val = enumCheck(Class1::Struct1.$val4, $val); +# +#$val = 0; +#$val = enumCheck(Class1::Struct1.Enum14_Val1, 3141); +#$val = enumCheck(Class1::Struct1.Enum14_Val2, 3142); +#$val = enumCheck(Class1::Struct1.Enum14_Val3, $val); +#$val = enumCheck(Class1::Struct1.Enum14_Val4, $val); +#$val = enumCheck(Class1::Struct1.Enum14_Val5g, 3141); +#$val = enumCheck(Class1::Struct1.Enum14_Val6g, $val); + +$val = 0; +$val = enumCheck(Class2::Enum12_Val1, 2121); +$val = enumCheck(Class2::Enum12_Val2, 2122); +$val = enumCheck(Class2::Enum12_Val3, $val); +$val = enumCheck(Class2::Enum12_Val4, $val); +$val = enumCheck(Class2::Enum12_Val5h, 2121); +$val = enumCheck(Class2::Enum12_Val6h, $val); + +$val = 0; +$val = enumCheck(Class2::Val1, 2131); +$val = enumCheck(Class2::Val2, 2132); +$val = enumCheck(Class2::Val3, $val); +$val = enumCheck(Class2::Val4, $val); +$val = enumCheck(Class2::Val5i, 2131); +$val = enumCheck(Class2::Val6i, $val); + +$val = 0; +$val = enumCheck(Class2::Enum14_Val1, 2141); +$val = enumCheck(Class2::Enum14_Val2, 2142); +$val = enumCheck(Class2::Enum14_Val3, $val); +$val = enumCheck(Class2::Enum14_Val4, $val); +$val = enumCheck(Class2::Enum14_Val5j, 2141); +$val = enumCheck(Class2::Enum14_Val6j, $val); + +# Requires nested class support to work +#$val = 0; +#$val = enumCheck(Class2::Struct1.Enum12_Val1, 4121); +#$val = enumCheck(Class2::Struct1.Enum12_Val2, 4122); +#$val = enumCheck(Class2::Struct1.Enum12_Val3, $val); +#$val = enumCheck(Class2::Struct1.Enum12_Val4, $val); +#$val = enumCheck(Class2::Struct1.Enum12_Val5k, 4121); +#$val = enumCheck(Class2::Struct1.Enum12_Val6k, $val); +# +#$val = 0; +#$val = enumCheck(Class2::Struct1.$val1, 4131); +#$val = enumCheck(Class2::Struct1.$val2, 4132); +#$val = enumCheck(Class2::Struct1.$val3, $val); +#$val = enumCheck(Class2::Struct1.$val4, $val); +#$val = enumCheck(Class2::Struct1.$val5l, 4131); +#$val = enumCheck(Class2::Struct1.$val6l, $val); +# +#$val = 0; +#$val = enumCheck(Class2::Struct1.Enum14_Val1, 4141); +#$val = enumCheck(Class2::Struct1.Enum14_Val2, 4142); +#$val = enumCheck(Class2::Struct1.Enum14_Val3, $val); +#$val = enumCheck(Class2::Struct1.Enum14_Val4, $val); +#$val = enumCheck(Class2::Struct1.Enum14_Val5m, 4141); +#$val = enumCheck(Class2::Struct1.Enum14_Val6m, $val); + +$class1 = new Class1(); +enumCheck($class1->class1Test1(Enum1_Val5a), 13); +enumCheck($class1->class1Test2(Class1::Enum12_Val5c), 1121); +#enumCheck($class1.class1Test3(Class1::Struct1.Enum12_Val5f), 3121); + +enumCheck(globalTest1(Enum1_Val5a), 13); +enumCheck(globalTest2(Class1::Enum12_Val5c), 1121); +#enumCheck(globalTest3(Class1::Struct1.Enum12_Val5f), 3121); + +?> diff --git a/Examples/test-suite/php/director_exception_runme.php b/Examples/test-suite/php/director_exception_runme.php index 33e6e9b52..8b852c2ce 100644 --- a/Examples/test-suite/php/director_exception_runme.php +++ b/Examples/test-suite/php/director_exception_runme.php @@ -4,9 +4,9 @@ require "tests.php"; require "director_exception.php"; // No new functions -check::functions(array(foo_ping,foo_pong,launder,bar_ping,bar_pong,bar_pang)); +check::functions(array(foo_ping,foo_pong,launder,bar_ping,bar_pong,bar_pang,returnalltypes_return_int,returnalltypes_return_double,returnalltypes_return_const_char_star,returnalltypes_return_std_string,returnalltypes_return_bar,returnalltypes_call_int,returnalltypes_call_double,returnalltypes_call_const_char_star,returnalltypes_call_std_string,returnalltypes_call_bar,is_python_builtin)); // No new classes -check::classes(array(director_exception,Foo,Exception1,Exception2,Base,Bar)); +check::classes(array(director_exception,Foo,Exception1,Exception2,Base,Bar,ReturnAllTypes)); // now new vars check::globals(array()); @@ -74,5 +74,54 @@ try { } catch (Exception1 $e1) { } +// Check that we can throw exceptions from director methods (this didn't used +// to work in all cases, as the exception gets "set" in PHP and the method +// then returns PHP NULL, which the directorout template may fail to convert. + +class Bad extends ReturnAllTypes { + function return_int() { throw new Exception("bad int"); } + function return_double() { throw new Exception("bad double"); } + function return_const_char_star() { throw new Exception("bad const_char_star"); } + function return_std_string() { throw new Exception("bad std_string"); } + function return_Bar() { throw new Exception("bad Bar"); } +} + +$bad = new Bad(); + +try { + $bad->call_int(); + check::fail("Exception wasn't propagated from Bad::return_int()"); +} catch (Exception $e) { + check::equal($e->getMessage(), "bad int", "propagated exception incorrect"); +} + +try { + $bad->call_double(); + check::fail("Exception wasn't propagated from Bad::return_double()"); +} catch (Exception $e) { + check::equal($e->getMessage(), "bad double", "propagated exception incorrect"); +} + +try { + $bad->call_const_char_star(); + check::fail("Exception wasn't propagated from Bad::return_const_char_star()"); +} catch (Exception $e) { + check::equal($e->getMessage(), "bad const_char_star", "propagated exception incorrect"); +} + +try { + $bad->call_std_string(); + check::fail("Exception wasn't propagated from Bad::return_std_string()"); +} catch (Exception $e) { + check::equal($e->getMessage(), "bad std_string", "propagated exception incorrect"); +} + +try { + $bad->call_Bar(); + check::fail("Exception wasn't propagated from Bad::return_Bar()"); +} catch (Exception $e) { + check::equal($e->getMessage(), "bad Bar", "propagated exception incorrect"); +} + check::done(); ?> diff --git a/Examples/test-suite/php/exception_order_runme.php b/Examples/test-suite/php/exception_order_runme.php index a83598170..acb83561a 100644 --- a/Examples/test-suite/php/exception_order_runme.php +++ b/Examples/test-suite/php/exception_order_runme.php @@ -2,7 +2,7 @@ require "tests.php"; require "exception_order.php"; -check::functions(array(a_foo,a_bar,a_foobar,a_barfoo)); +check::functions(array(a_foo,a_bar,a_foobar,a_barfoo,is_python_builtin)); check::classes(array(A,E1,E2,E3,exception_order,ET_i,ET_d)); check::globals(array(efoovar,foovar,cfoovar,a_sfoovar,a_foovar,a_efoovar)); diff --git a/Examples/test-suite/php/import_nomodule_runme.php b/Examples/test-suite/php/import_nomodule_runme.php index 84191fba9..41836ba0f 100644 --- a/Examples/test-suite/php/import_nomodule_runme.php +++ b/Examples/test-suite/php/import_nomodule_runme.php @@ -3,7 +3,7 @@ require "tests.php"; require "import_nomodule.php"; // No new functions -check::functions(array(create_foo,delete_foo,test1)); +check::functions(array(create_foo,delete_foo,test1,is_python_builtin)); // No new classes check::classes(array(import_nomodule,Bar)); // now new vars diff --git a/Examples/test-suite/php/php_iterator_runme.php b/Examples/test-suite/php/php_iterator_runme.php new file mode 100644 index 000000000..d69a5b385 --- /dev/null +++ b/Examples/test-suite/php/php_iterator_runme.php @@ -0,0 +1,24 @@ +<?php + +require "tests.php"; +require "php_iterator.php"; + +check::functions(array(myiterator_rewind,myiterator_key,myiterator_current,myiterator_next,myiterator_valid)); +check::classes(array(MyIterator)); +// No new global variables. +check::globals(array()); + +$s = ''; +foreach (new MyIterator(1, 6) as $i) { + $s .= $i; +} +check::equal($s, '12345', 'Simple iteration failed'); + +$s = ''; +foreach (new MyIterator(2, 5) as $k => $v) { + $s .= "($k=>$v)"; +} +check::equal($s, '(0=>2)(1=>3)(2=>4)', 'Simple iteration failed'); + +check::done(); +?> diff --git a/Examples/test-suite/php/threads_exception_runme.php b/Examples/test-suite/php/threads_exception_runme.php index 31148a1e1..9e4d04e10 100644 --- a/Examples/test-suite/php/threads_exception_runme.php +++ b/Examples/test-suite/php/threads_exception_runme.php @@ -4,9 +4,9 @@ require "tests.php"; require "threads_exception.php"; // Check functions -check::functions(array(test_simple,test_message,test_hosed,test_unknown,test_multi)); +check::functions(array(test_simple,test_message,test_hosed,test_unknown,test_multi,is_python_builtin)); // Check classes. -check::classes(array(Exc,Test)); +check::classes(array(Exc,Test,threads_exception)); // Chek globals. check::globals(array(exc_code,exc_msg)); diff --git a/Examples/test-suite/php_iterator.i b/Examples/test-suite/php_iterator.i new file mode 100644 index 000000000..43ab68b55 --- /dev/null +++ b/Examples/test-suite/php_iterator.i @@ -0,0 +1,20 @@ +/* php_iterator.i - PHP-specific testcase for wrapping to a PHP Iterator */ +%module php_iterator + +%typemap("phpinterfaces") MyIterator "Iterator"; + +%inline %{ + +class MyIterator { + int i, from, to; +public: + MyIterator(int from_, int to_) + : i(from_), from(from_), to(to_) { } + void rewind() { i = from; } + bool valid() const { return i != to; } + int key() const { return i - from; } + int current() const { return i; } + void next() { ++i; } +}; + +%} diff --git a/Examples/test-suite/pike/Makefile.in b/Examples/test-suite/pike/Makefile.in index 389dc74f8..92054dd9d 100644 --- a/Examples/test-suite/pike/Makefile.in +++ b/Examples/test-suite/pike/Makefile.in @@ -5,6 +5,7 @@ LANGUAGE = pike PIKE = pike SCRIPTSUFFIX = _runme.pike + srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ @@ -18,7 +19,7 @@ include $(srcdir)/../common.mk # none! # Rules for the different types of tests -%.cpptest: +%.cpptest: $(setup) +$(swig_and_compile_cpp) $(run_testcase) @@ -28,7 +29,7 @@ include $(srcdir)/../common.mk +$(swig_and_compile_c) $(run_testcase) -%.multicpptest: +%.multicpptest: $(setup) +$(swig_and_compile_multi_cpp) $(run_testcase) @@ -36,8 +37,8 @@ include $(srcdir)/../common.mk # Runs the testcase. A testcase is only run if # a file is found which has _runme.pike appended after the testcase name. run_testcase = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(PIKE) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(PIKE) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ fi # Clean: remove the generated .pike file @@ -45,5 +46,4 @@ run_testcase = \ @rm -f $*.pike; clean: - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile pike_clean - + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" pike_clean diff --git a/Examples/test-suite/preproc.i b/Examples/test-suite/preproc.i index e052bff28..779c41e97 100644 --- a/Examples/test-suite/preproc.i +++ b/Examples/test-suite/preproc.i @@ -346,3 +346,20 @@ int method(struct TypeNameTraits tnt) { return tnt.val; } %} + +/* Null directive */ +# /* comment 1 */ +# // comment 2 +# /** comment 3 */ +# /* comment 4 */ /*comment 5*/ +# /** comment 6 +# +# more comment 6 */ +# +# +# +int methodX(int x); +%{ +int methodX(int x) { return x+100; } +%} + diff --git a/Examples/test-suite/preproc_constants.i b/Examples/test-suite/preproc_constants.i index 7507d632c..ef5c35e12 100644 --- a/Examples/test-suite/preproc_constants.i +++ b/Examples/test-suite/preproc_constants.i @@ -85,6 +85,8 @@ /// constant assignment in enum #if defined(SWIGCSHARP) %csconstvalue("1<<2") kValue; +#elif defined(SWIGD) +%dconstvalue("1<<2") kValue; #endif %{ diff --git a/Examples/test-suite/python/Makefile.in b/Examples/test-suite/python/Makefile.in index e7db32fb7..82a0e9db1 100644 --- a/Examples/test-suite/python/Makefile.in +++ b/Examples/test-suite/python/Makefile.in @@ -10,10 +10,13 @@ endif LANGUAGE = python PYTHON = $(PYBIN) +PEP8 = @PEP8@ +PEP8_FLAGS = --ignore=E402,E501,E30,W291,W391 #*_runme.py for Python 2.x, *_runme3.py for Python 3.x PY2SCRIPTSUFFIX = _runme.py PY3SCRIPTSUFFIX = _runme3.py +PY2TO3 = 2to3 -x import ifeq (,$(PY3)) SCRIPTSUFFIX = $(PY2SCRIPTSUFFIX) @@ -25,10 +28,6 @@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ - -PY2TO3 = 2to3 -x import - - CPP_TEST_CASES += \ argcargvtest \ callback \ @@ -41,7 +40,6 @@ CPP_TEST_CASES += \ inout \ inplaceadd \ input \ - kwargs_feature \ li_cstring \ li_cwstring \ li_factory \ @@ -88,82 +86,89 @@ C_TEST_CASES += \ include $(srcdir)/../common.mk -BUILTIN_BROKEN = \ - default_constructor.cpptest \ - director_exception.cpptest \ - exception_order.cpptest \ - li_std_string_extra.cpptest \ - li_std_wstring.cpptest \ - python_abstractbase.cpptest \ - threads_exception.cpptest - -BUILTIN_NOT_BROKEN = $(filter-out $(BUILTIN_BROKEN),$(NOT_BROKEN_TEST_CASES)) - -builtin-check : $(BUILTIN_NOT_BROKEN) - # Overridden variables here -LIBS = -L. +SCRIPTDIR = . +LIBS = -L. VALGRIND_OPT += --suppressions=pythonswig.supp # Custom tests - tests with additional commandline options # none! # Rules for the different types of tests -%.cpptest: +%.cpptest: +$(convert_testcase) $(setup) +$(swig_and_compile_cpp) + $(check_pep8) $(run_testcase) %.ctest: +$(convert_testcase) $(setup) +$(swig_and_compile_c) + $(check_pep8) $(run_testcase) -%.multicpptest: +%.multicpptest: +$(convert_testcase) $(setup) +$(swig_and_compile_multi_cpp) + $(check_pep8_multi_cpp) $(run_testcase) -# Call 2to3 to generate Python 3.x test from the Python 2.x's *_runme.py file -%$(PY3SCRIPTSUFFIX): %$(PY2SCRIPTSUFFIX) - cp $< $@ - $(PY2TO3) -w $@ >/dev/null 2>&1 - # Runs the testcase. A testcase is only run if # a file is found which has _runme.py (or _runme3.py for Python 3) appended after the testcase name. -run_python = env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=.:$(srcdir):$$PYTHONPATH $(RUNTOOL) $(PYTHON) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) +py_runme = $(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) +py2_runme = $(SCRIPTPREFIX)$*$(PY2SCRIPTSUFFIX) +py3_runme = $(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX) + +check_pep8 = \ + if [ -n "$(PEP8)" ]; then \ + $(PEP8) $(PEP8_FLAGS) $(SCRIPTPREFIX)$*.py;\ + fi + +check_pep8_multi_cpp = \ + if [ -n "$(PEP8)" ]; then \ + for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \ + $(PEP8) $(PEP8_FLAGS) $$f.py; \ + done \ + fi -py2_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY2SCRIPTSUFFIX) -py3_runme = $(srcdir)/$(SCRIPTPREFIX)$*$(PY3SCRIPTSUFFIX) +run_python = env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PYTHONPATH=.:$(srcdir):$$PYTHONPATH $(RUNTOOL) $(PYTHON) $(py_runme) run_testcase = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + if [ -f $(SCRIPTDIR)/$(py_runme) ]; then \ $(run_python);\ fi -ifeq (,$(PY3)) +# No copying/conversion needed for in-source-tree Python 2 scripts +ifeq ($(SCRIPTDIR)|$(SCRIPTSUFFIX),$(srcdir)|$(PY2SCRIPTSUFFIX)) convert_testcase = else + convert_testcase = \ - if [ -f $(py2_runme) ]; then \ - $(MAKE) -f $(srcdir)/Makefile $(py3_runme); \ + if [ -f $(srcdir)/$(py2_runme) ]; then \ + $(MAKE) $(SCRIPTDIR)/$(py_runme); \ fi + +$(SCRIPTDIR)/$(SCRIPTPREFIX)%$(SCRIPTSUFFIX): $(srcdir)/$(SCRIPTPREFIX)%$(PY2SCRIPTSUFFIX) + test x$< = x$@ || cp $< $@ || exit 1 + test x$(PY3) = x || $(PY2TO3) -w $@ >/dev/null 2>&1 || exit 1 + endif # Clean: remove the generated .py file +# We only remove the _runme3.py if it is generated by 2to3 from a _runme.py. %.clean: - @rm -f $*.py; - @#We only remove the _runme3.py if it is generated by 2to3 from a _runme.py. - @if [ -f $(py2_runme) ]; then rm -f $(py3_runme) $(py3_runme).bak; fi + @rm -f $*.py + @if test -f $(srcdir)/$(py2_runme); then rm -f $(SCRIPTDIR)/$(py3_runme) $(SCRIPTDIR)/$(py3_runme).bak; fi + @if test "x$(SCRIPTDIR)" != "x$(srcdir)"; then rm -f $(SCRIPTDIR)/$(py2_runme); fi clean: - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile python_clean + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" python_clean rm -f hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py rm -f clientdata_prop_a.py clientdata_prop_b.py import_stl_a.py import_stl_b.py rm -f imports_a.py imports_b.py mod_a.py mod_b.py multi_import_a.py @@ -172,12 +177,12 @@ clean: cvsignore: @echo '*wrap* *.pyc *.so *.dll *.exp *.lib' @echo Makefile - @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.py; done - @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.py CVS/Entries ; then echo $${i}_runme.py; fi; done - @echo clientdata_prop_a.py - @echo clientdata_prop_b.py - @echo imports_a.py - @echo imports_b.py + @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do echo $$i.py; done + @for i in ${CPP_TEST_CASES} ${C_TEST_CASES}; do if grep -q $${i}_runme.py CVS/Entries ; then echo $${i}_runme.py; fi; done + @echo clientdata_prop_a.py + @echo clientdata_prop_b.py + @echo imports_a.py + @echo imports_b.py @echo mod_a.py mod_b.py @echo hugemod.h hugemod_a.i hugemod_b.i hugemod_a.py hugemod_b.py hugemod_runme.py @echo template_typedef_import.py @@ -185,9 +190,8 @@ cvsignore: hugemod_runme = hugemod$(SCRIPTPREFIX) hugemod: - perl hugemod.pl $(hugemod_runme) + perl hugemod.pl $(hugemod_runme) $(MAKE) hugemod_a.cpptest $(MAKE) hugemod_b.cpptest sh -c "time $(PYTHON) $(hugemod_runme)" sh -c "time $(PYTHON) $(hugemod_runme)" - diff --git a/Examples/test-suite/python/autodoc_runme.py b/Examples/test-suite/python/autodoc_runme.py index 5776ad3ef..756b85904 100644 --- a/Examples/test-suite/python/autodoc_runme.py +++ b/Examples/test-suite/python/autodoc_runme.py @@ -1,15 +1,26 @@ from autodoc import * import sys -def check(got, expected): - if expected != got: - raise RuntimeError("\n" + "Expected: [" + str(expected) + "]\n" + "Got : [" + str(got) + "]") +def check(got, expected, expected_builtin = None, skip = False): + if not skip: + expect = expected + if is_python_builtin() and expected_builtin != None: + expect = expected_builtin + if expect != got: + raise RuntimeError("\n" + "Expected: [" + str(expect) + "]\n" + "Got : [" + str(got) + "]") -check(A.__doc__, "Proxy of C++ A class") +skip = True # skip builtin check - the autodoc is missing, but it probably should not be + +check(A.__doc__, "Proxy of C++ A class", "::A") check(A.funk.__doc__, "just a string") -check(A.func0.__doc__, "func0(self, arg2, hello) -> int") -check(A.func1.__doc__, "func1(A self, short arg2, Tuple hello) -> int") -check(A.func2.__doc__, "\n" +check(A.func0.__doc__, +"func0(self, arg2, hello) -> int", +"func0(arg2, hello) -> int") +check(A.func1.__doc__, +"func1(A self, short arg2, Tuple hello) -> int", +"func1(short arg2, Tuple hello) -> int") +check(A.func2.__doc__, +"\n" " func2(self, arg2, hello) -> int\n" "\n" " Parameters:\n" @@ -17,8 +28,18 @@ check(A.func2.__doc__, "\n" " hello: int tuple[2]\n" "\n" " " +, +"\n" +"func2(arg2, hello) -> int\n" +"\n" +"Parameters:\n" +" arg2: short\n" +" hello: int tuple[2]\n" +"\n" +"" ) -check(A.func3.__doc__, "\n" +check(A.func3.__doc__, +"\n" " func3(A self, short arg2, Tuple hello) -> int\n" "\n" " Parameters:\n" @@ -26,19 +47,41 @@ check(A.func3.__doc__, "\n" " hello: int tuple[2]\n" "\n" " " +, +"\n" +"func3(short arg2, Tuple hello) -> int\n" +"\n" +"Parameters:\n" +" arg2: short\n" +" hello: int tuple[2]\n" +"\n" +"" ) -check(A.func0default.__doc__, "\n" +check(A.func0default.__doc__, +"\n" " func0default(self, e, arg3, hello, f=2) -> int\n" " func0default(self, e, arg3, hello) -> int\n" " " +, +"\n" +"func0default(e, arg3, hello, f=2) -> int\n" +"func0default(e, arg3, hello) -> int\n" +"" ) -check(A.func1default.__doc__, "\n" +check(A.func1default.__doc__, +"\n" " func1default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n" " func1default(A self, A e, short arg3, Tuple hello) -> int\n" " " +, +"\n" +"func1default(A e, short arg3, Tuple hello, double f=2) -> int\n" +"func1default(A e, short arg3, Tuple hello) -> int\n" +"" ) -check(A.func2default.__doc__, "\n" +check(A.func2default.__doc__, +"\n" " func2default(self, e, arg3, hello, f=2) -> int\n" "\n" " Parameters:\n" @@ -55,8 +98,27 @@ check(A.func2default.__doc__, "\n" " hello: int tuple[2]\n" "\n" " " +, +"\n" +"func2default(e, arg3, hello, f=2) -> int\n" +"\n" +"Parameters:\n" +" e: A *\n" +" arg3: short\n" +" hello: int tuple[2]\n" +" f: double\n" +"\n" +"func2default(e, arg3, hello) -> int\n" +"\n" +"Parameters:\n" +" e: A *\n" +" arg3: short\n" +" hello: int tuple[2]\n" +"\n" +"" ) -check(A.func3default.__doc__, "\n" +check(A.func3default.__doc__, +"\n" " func3default(A self, A e, short arg3, Tuple hello, double f=2) -> int\n" "\n" " Parameters:\n" @@ -73,19 +135,50 @@ check(A.func3default.__doc__, "\n" " hello: int tuple[2]\n" "\n" " " +, +"\n" +"func3default(A e, short arg3, Tuple hello, double f=2) -> int\n" +"\n" +"Parameters:\n" +" e: A *\n" +" arg3: short\n" +" hello: int tuple[2]\n" +" f: double\n" +"\n" +"func3default(A e, short arg3, Tuple hello) -> int\n" +"\n" +"Parameters:\n" +" e: A *\n" +" arg3: short\n" +" hello: int tuple[2]\n" +"\n" +"" ) -check(A.func0static.__doc__, "\n" +check(A.func0static.__doc__, +"\n" " func0static(e, arg2, hello, f=2) -> int\n" " func0static(e, arg2, hello) -> int\n" " " +, +"\n" +"func0static(e, arg2, hello, f=2) -> int\n" +"func0static(e, arg2, hello) -> int\n" +"" ) -check(A.func1static.__doc__, "\n" +check(A.func1static.__doc__, +"\n" " func1static(A e, short arg2, Tuple hello, double f=2) -> int\n" " func1static(A e, short arg2, Tuple hello) -> int\n" " " +, +"\n" +"func1static(A e, short arg2, Tuple hello, double f=2) -> int\n" +"func1static(A e, short arg2, Tuple hello) -> int\n" +"" ) -check(A.func2static.__doc__, "\n" +check(A.func2static.__doc__, +"\n" " func2static(e, arg2, hello, f=2) -> int\n" "\n" " Parameters:\n" @@ -102,8 +195,27 @@ check(A.func2static.__doc__, "\n" " hello: int tuple[2]\n" "\n" " " +, +"\n" +"func2static(e, arg2, hello, f=2) -> int\n" +"\n" +"Parameters:\n" +" e: A *\n" +" arg2: short\n" +" hello: int tuple[2]\n" +" f: double\n" +"\n" +"func2static(e, arg2, hello) -> int\n" +"\n" +"Parameters:\n" +" e: A *\n" +" arg2: short\n" +" hello: int tuple[2]\n" +"\n" +"" ) -check(A.func3static.__doc__, "\n" +check(A.func3static.__doc__, +"\n" " func3static(A e, short arg2, Tuple hello, double f=2) -> int\n" "\n" " Parameters:\n" @@ -120,31 +232,65 @@ check(A.func3static.__doc__, "\n" " hello: int tuple[2]\n" "\n" " " +, +"\n" +"func3static(A e, short arg2, Tuple hello, double f=2) -> int\n" +"\n" +"Parameters:\n" +" e: A *\n" +" arg2: short\n" +" hello: int tuple[2]\n" +" f: double\n" +"\n" +"func3static(A e, short arg2, Tuple hello) -> int\n" +"\n" +"Parameters:\n" +" e: A *\n" +" arg2: short\n" +" hello: int tuple[2]\n" +"\n" +"" ) if sys.version_info[0:2] > (2, 4): # Python 2.4 does not seem to work - check(A.variable_a.__doc__, "A_variable_a_get(self) -> int") - check(A.variable_b.__doc__, "A_variable_b_get(A self) -> int") - check(A.variable_c.__doc__, "\n" + check(A.variable_a.__doc__, + "A_variable_a_get(self) -> int", + "A.variable_a" + ) + check(A.variable_b.__doc__, + "A_variable_b_get(A self) -> int", + "A.variable_b" + ) + check(A.variable_c.__doc__, + "\n" "A_variable_c_get(self) -> int\n" "\n" "Parameters:\n" " self: A *\n" "\n" + , + "A.variable_c" ) - check(A.variable_d.__doc__, "\n" + check(A.variable_d.__doc__, + "\n" "A_variable_d_get(A self) -> int\n" "\n" "Parameters:\n" " self: A *\n" "\n" + , + "A.variable_d" ) -check(B.__doc__, "Proxy of C++ B class") -check(C.__init__.__doc__, "__init__(self, a, b, h) -> C") -check(D.__init__.__doc__, "__init__(D self, int a, int b, Hola h) -> D") -check(E.__init__.__doc__, "\n" +check(B.__doc__, +"Proxy of C++ B class", +"::B" +) +check(C.__init__.__doc__, "__init__(self, a, b, h) -> C", None, skip) +check(D.__init__.__doc__, "__init__(D self, int a, int b, Hola h) -> D", None, skip) +check(E.__init__.__doc__, +"\n" " __init__(self, a, b, h) -> E\n" "\n" " Parameters:\n" @@ -153,8 +299,10 @@ check(E.__init__.__doc__, "\n" " h: enum Hola\n" "\n" " " +, None, skip ) -check(F.__init__.__doc__, "\n" +check(F.__init__.__doc__, +"\n" " __init__(F self, int a, int b, Hola h) -> F\n" "\n" " Parameters:\n" @@ -163,14 +311,23 @@ check(F.__init__.__doc__, "\n" " h: enum Hola\n" "\n" " " +, None, skip ) -check(B.funk.__doc__, "funk(B self, int c, int d) -> int") +check(B.funk.__doc__, +"funk(B self, int c, int d) -> int", +"funk(int c, int d) -> int") check(funk.__doc__, "funk(A e, short arg2, int c, int d) -> int") -check(funkdefaults.__doc__, "\n" +check(funkdefaults.__doc__, +"\n" " funkdefaults(A e, short arg2, int c, int d, double f=2) -> int\n" " funkdefaults(A e, short arg2, int c, int d) -> int\n" " " +, +"\n" +"funkdefaults(A e, short arg2, int c, int d, double f=2) -> int\n" +"funkdefaults(A e, short arg2, int c, int d) -> int\n" +"" ) check(func_input.__doc__, "func_input(int * INPUT) -> int") diff --git a/Examples/test-suite/python/cpp11_function_objects_runme.py b/Examples/test-suite/python/cpp11_function_objects_runme.py index aac7f9c5f..5a63b632b 100644 --- a/Examples/test-suite/python/cpp11_function_objects_runme.py +++ b/Examples/test-suite/python/cpp11_function_objects_runme.py @@ -1,6 +1,13 @@ import cpp11_function_objects import sys +class Test1(cpp11_function_objects.Test): + def __init__(self): + cpp11_function_objects.Test.__init__(self) + + def __call__(self, a, b): + self.value = a * b + t = cpp11_function_objects.Test() if t.value != 0: raise RuntimeError("Runtime cpp11_function_objects failed. t.value should be 0, but is " + str(t.value)) @@ -10,3 +17,7 @@ t(1,2) # adds numbers and sets value if t.value != 3: raise RuntimeError("Runtime cpp11_function_objects failed. t.value not changed - should be 3, but is " + str(t.value)) +t2 = Test1() +a = cpp11_function_objects.testit1(t2, 4,3) +if a != 12: + raise RuntimeError("Runtime cpp11_function_objects failed. t.value not changed - should be 12, but is " + str(a)) diff --git a/Examples/test-suite/python/cpp11_strongly_typed_enumerations_runme.py b/Examples/test-suite/python/cpp11_strongly_typed_enumerations_runme.py new file mode 100644 index 000000000..6509ba873 --- /dev/null +++ b/Examples/test-suite/python/cpp11_strongly_typed_enumerations_runme.py @@ -0,0 +1,164 @@ +from cpp11_strongly_typed_enumerations import * + +def enumCheck(actual, expected): + if actual != expected: + raise RuntimeError("Enum value mismatch. Expected " + str(expected) + " Actual: " + str(actual)) + return expected + 1 + +val = 0 +val = enumCheck(Enum1_Val1, val) +val = enumCheck(Enum1_Val2, val) +val = enumCheck(Enum1_Val3, 13) +val = enumCheck(Enum1_Val4, val) +val = enumCheck(Enum1_Val5a, 13) +val = enumCheck(Enum1_Val6a, val) + +val = 0 +val = enumCheck(Enum2_Val1, val) +val = enumCheck(Enum2_Val2, val) +val = enumCheck(Enum2_Val3, 23) +val = enumCheck(Enum2_Val4, val) +val = enumCheck(Enum2_Val5b, 23) +val = enumCheck(Enum2_Val6b, val) + +val = 0 +val = enumCheck(Val1, val) +val = enumCheck(Val2, val) +val = enumCheck(Val3, 43) +val = enumCheck(Val4, val) + +val = 0 +val = enumCheck(Enum5_Val1, val) +val = enumCheck(Enum5_Val2, val) +val = enumCheck(Enum5_Val3, 53) +val = enumCheck(Enum5_Val4, val) + +val = 0 +val = enumCheck(Enum6_Val1, val) +val = enumCheck(Enum6_Val2, val) +val = enumCheck(Enum6_Val3, 63) +val = enumCheck(Enum6_Val4, val) + +val = 0 +val = enumCheck(Enum7td_Val1, val) +val = enumCheck(Enum7td_Val2, val) +val = enumCheck(Enum7td_Val3, 73) +val = enumCheck(Enum7td_Val4, val) + +val = 0 +val = enumCheck(Enum8_Val1, val) +val = enumCheck(Enum8_Val2, val) +val = enumCheck(Enum8_Val3, 83) +val = enumCheck(Enum8_Val4, val) + +val = 0 +val = enumCheck(Enum10_Val1, val) +val = enumCheck(Enum10_Val2, val) +val = enumCheck(Enum10_Val3, 103) +val = enumCheck(Enum10_Val4, val) + +val = 0 +val = enumCheck(Class1.Enum12_Val1, 1121) +val = enumCheck(Class1.Enum12_Val2, 1122) +val = enumCheck(Class1.Enum12_Val3, val) +val = enumCheck(Class1.Enum12_Val4, val) +val = enumCheck(Class1.Enum12_Val5c, 1121) +val = enumCheck(Class1.Enum12_Val6c, val) + +val = 0 +val = enumCheck(Class1.Val1, 1131) +val = enumCheck(Class1.Val2, 1132) +val = enumCheck(Class1.Val3, val) +val = enumCheck(Class1.Val4, val) +val = enumCheck(Class1.Val5d, 1131) +val = enumCheck(Class1.Val6d, val) + +val = 0 +val = enumCheck(Class1.Enum14_Val1, 1141) +val = enumCheck(Class1.Enum14_Val2, 1142) +val = enumCheck(Class1.Enum14_Val3, val) +val = enumCheck(Class1.Enum14_Val4, val) +val = enumCheck(Class1.Enum14_Val5e, 1141) +val = enumCheck(Class1.Enum14_Val6e, val) + +# Requires nested class support to work +#val = 0 +#val = enumCheck(Class1.Struct1.Enum12_Val1, 3121) +#val = enumCheck(Class1.Struct1.Enum12_Val2, 3122) +#val = enumCheck(Class1.Struct1.Enum12_Val3, val) +#val = enumCheck(Class1.Struct1.Enum12_Val4, val) +#val = enumCheck(Class1.Struct1.Enum12_Val5f, 3121) +#val = enumCheck(Class1.Struct1.Enum12_Val6f, val) +# +#val = 0 +#val = enumCheck(Class1.Struct1.Val1, 3131) +#val = enumCheck(Class1.Struct1.Val2, 3132) +#val = enumCheck(Class1.Struct1.Val3, val) +#val = enumCheck(Class1.Struct1.Val4, val) +# +#val = 0 +#val = enumCheck(Class1.Struct1.Enum14_Val1, 3141) +#val = enumCheck(Class1.Struct1.Enum14_Val2, 3142) +#val = enumCheck(Class1.Struct1.Enum14_Val3, val) +#val = enumCheck(Class1.Struct1.Enum14_Val4, val) +#val = enumCheck(Class1.Struct1.Enum14_Val5g, 3141) +#val = enumCheck(Class1.Struct1.Enum14_Val6g, val) + +val = 0 +val = enumCheck(Class2.Enum12_Val1, 2121) +val = enumCheck(Class2.Enum12_Val2, 2122) +val = enumCheck(Class2.Enum12_Val3, val) +val = enumCheck(Class2.Enum12_Val4, val) +val = enumCheck(Class2.Enum12_Val5h, 2121) +val = enumCheck(Class2.Enum12_Val6h, val) + +val = 0 +val = enumCheck(Class2.Val1, 2131) +val = enumCheck(Class2.Val2, 2132) +val = enumCheck(Class2.Val3, val) +val = enumCheck(Class2.Val4, val) +val = enumCheck(Class2.Val5i, 2131) +val = enumCheck(Class2.Val6i, val) + +val = 0 +val = enumCheck(Class2.Enum14_Val1, 2141) +val = enumCheck(Class2.Enum14_Val2, 2142) +val = enumCheck(Class2.Enum14_Val3, val) +val = enumCheck(Class2.Enum14_Val4, val) +val = enumCheck(Class2.Enum14_Val5j, 2141) +val = enumCheck(Class2.Enum14_Val6j, val) + +# Requires nested class support to work +#val = 0 +#val = enumCheck(Class2.Struct1.Enum12_Val1, 4121) +#val = enumCheck(Class2.Struct1.Enum12_Val2, 4122) +#val = enumCheck(Class2.Struct1.Enum12_Val3, val) +#val = enumCheck(Class2.Struct1.Enum12_Val4, val) +#val = enumCheck(Class2.Struct1.Enum12_Val5k, 4121) +#val = enumCheck(Class2.Struct1.Enum12_Val6k, val) +# +#val = 0 +#val = enumCheck(Class2.Struct1.Val1, 4131) +#val = enumCheck(Class2.Struct1.Val2, 4132) +#val = enumCheck(Class2.Struct1.Val3, val) +#val = enumCheck(Class2.Struct1.Val4, val) +#val = enumCheck(Class2.Struct1.Val5l, 4131) +#val = enumCheck(Class2.Struct1.Val6l, val) +# +#val = 0 +#val = enumCheck(Class2.Struct1.Enum14_Val1, 4141) +#val = enumCheck(Class2.Struct1.Enum14_Val2, 4142) +#val = enumCheck(Class2.Struct1.Enum14_Val3, val) +#val = enumCheck(Class2.Struct1.Enum14_Val4, val) +#val = enumCheck(Class2.Struct1.Enum14_Val5m, 4141) +#val = enumCheck(Class2.Struct1.Enum14_Val6m, val) + +class1 = Class1() +enumCheck(class1.class1Test1(Enum1_Val5a), 13) +enumCheck(class1.class1Test2(Class1.Enum12_Val5c), 1121) +#enumCheck(class1.class1Test3(Class1.Struct1.Enum12_Val5f), 3121) + +enumCheck(globalTest1(Enum1_Val5a), 13) +enumCheck(globalTest2(Class1.Enum12_Val5c), 1121) +#enumCheck(globalTest3(Class1.Struct1.Enum12_Val5f), 3121) + diff --git a/Examples/test-suite/python/default_args_runme.py b/Examples/test-suite/python/default_args_runme.py index 091a92376..f24e825ad 100644 --- a/Examples/test-suite/python/default_args_runme.py +++ b/Examples/test-suite/python/default_args_runme.py @@ -1,64 +1,90 @@ -import default_args - - -if default_args.Statics_staticMethod() != 60: - raise RuntimeError - -if default_args.cfunc1(1) != 2: - raise RuntimeError - -if default_args.cfunc2(1) != 3: - raise RuntimeError - -if default_args.cfunc3(1) != 4: - raise RuntimeError - - -f = default_args.Foo() - -f.newname() -f.newname(1) - - -try: - f = default_args.Foo(1) - error = 1 -except: - error = 0 -if error: raise RuntimeError,"Foo::Foo ignore is not working" - -try: - f = default_args.Foo(1,2) - error = 1 -except: - error = 0 -if error: raise RuntimeError,"Foo::Foo ignore is not working" - -try: - f = default_args.Foo(1,2,3) - error = 1 -except: - error = 0 -if error: raise RuntimeError,"Foo::Foo ignore is not working" - -try: - m = f.meth(1) - error = 1 -except: - error = 0 -if error: raise RuntimeError,"Foo::meth ignore is not working" - -try: - m = f.meth(1,2) - error = 1 -except: - error = 0 -if error: raise RuntimeError,"Foo::meth ignore is not working" - -try: - m = f.meth(1,2,3) - error = 1 -except: - error = 0 -if error: raise RuntimeError,"Foo::meth ignore is not working" +# Note that this test is also used by python_default_args_runme.py hence the use of __main__ and the run function + +def run(module_name): + default_args = __import__(module_name) + ec = default_args.EnumClass() + if not ec.blah(): + raise RuntimeError("EnumClass::blah() default arguments don't work") + + de = default_args.DerivedEnumClass() + de.accelerate() + de.accelerate(default_args.EnumClass.SLOW) + + if default_args.Statics_staticMethod() != 60: + raise RuntimeError + + if default_args.cfunc1(1) != 2: + raise RuntimeError + + if default_args.cfunc2(1) != 3: + raise RuntimeError + + if default_args.cfunc3(1) != 4: + raise RuntimeError + + + f = default_args.Foo() + + f.newname() + f.newname(1) + + + try: + f = default_args.Foo(1) + error = 1 + except: + error = 0 + if error: raise RuntimeError("Foo::Foo ignore is not working") + + try: + f = default_args.Foo(1,2) + error = 1 + except: + error = 0 + if error: raise RuntimeError("Foo::Foo ignore is not working") + + try: + f = default_args.Foo(1,2,3) + error = 1 + except: + error = 0 + if error: raise RuntimeError("Foo::Foo ignore is not working") + + try: + m = f.meth(1) + error = 1 + except: + error = 0 + if error: raise RuntimeError("Foo::meth ignore is not working") + + try: + m = f.meth(1,2) + error = 1 + except: + error = 0 + if error: raise RuntimeError("Foo::meth ignore is not working") + + try: + m = f.meth(1,2,3) + error = 1 + except: + error = 0 + if error: raise RuntimeError("Foo::meth ignore is not working") + + if default_args.Klass.inc(100, default_args.Klass(22)).val != 122: + raise RuntimeError("Klass::inc failed") + + if default_args.Klass.inc(100).val != 99: + raise RuntimeError("Klass::inc failed") + + if default_args.Klass.inc().val != 0: + raise RuntimeError("Klass::inc failed") + + default_args.trickyvalue1(10); default_args.trickyvalue1(10, 10) + default_args.trickyvalue2(10); default_args.trickyvalue2(10, 10) + default_args.trickyvalue3(10); default_args.trickyvalue3(10, 10) + default_args.seek(); default_args.seek(10) + +if __name__=="__main__": + run('default_args') diff --git a/Examples/test-suite/python/default_constructor_runme.py b/Examples/test-suite/python/default_constructor_runme.py index 59b130559..e6532031b 100644 --- a/Examples/test-suite/python/default_constructor_runme.py +++ b/Examples/test-suite/python/default_constructor_runme.py @@ -1,8 +1,10 @@ +import _default_constructor + # This test is expected to fail with -builtin option. # It uses the old static syntax (e.g., dc.new_A() rather than dc.A()), # which is not provided with the -builtin option. - -import _default_constructor +if _default_constructor.is_python_builtin(): + exit(0) dc = _default_constructor diff --git a/Examples/test-suite/python/director_exception_runme.py b/Examples/test-suite/python/director_exception_runme.py index 510845a5a..de3ef22a5 100644 --- a/Examples/test-suite/python/director_exception_runme.py +++ b/Examples/test-suite/python/director_exception_runme.py @@ -68,14 +68,13 @@ if not ok: # This is expected to fail with -builtin option # Throwing builtin classes as exceptions not supported -try: - raise Exception2() -except Exception2: - pass +if not is_python_builtin(): + try: + raise Exception2() + except Exception2: + pass -# This is expected to fail with -builtin option -# Throwing builtin classes as exceptions not supported -try: - raise Exception1() -except Exception1: - pass + try: + raise Exception1() + except Exception1: + pass diff --git a/Examples/test-suite/python/director_keywords_runme.py b/Examples/test-suite/python/director_keywords_runme.py new file mode 100644 index 000000000..03a50206a --- /dev/null +++ b/Examples/test-suite/python/director_keywords_runme.py @@ -0,0 +1,5 @@ +from director_keywords import * + +f = Foo() +f.check_self(20) + diff --git a/Examples/test-suite/python/director_property_runme.py b/Examples/test-suite/python/director_property_runme.py new file mode 100644 index 000000000..303e53b67 --- /dev/null +++ b/Examples/test-suite/python/director_property_runme.py @@ -0,0 +1,18 @@ +import director_property + +class PyFoo(director_property.Foo): + a = property(director_property.Foo.getA, director_property.Foo.setA) + + def ping(self): + return "PyFoo::ping()" + + +foo = PyFoo() + +foo.setA("BLABLA") +if foo.getA() != "BLABLA": + raise RuntimeError + +foo.a = "BIBI" +if foo.a != "BIBI": + raise RuntimeError diff --git a/Examples/test-suite/python/exception_order_runme.py b/Examples/test-suite/python/exception_order_runme.py index 38b53eb0c..8f095eb98 100644 --- a/Examples/test-suite/python/exception_order_runme.py +++ b/Examples/test-suite/python/exception_order_runme.py @@ -2,6 +2,8 @@ from exception_order import * # This test is expected to fail with -builtin option. # Throwing builtin classes as exceptions not supported +if is_python_builtin(): + exit(0) a = A() diff --git a/Examples/test-suite/python/import_nomodule_runme.py b/Examples/test-suite/python/import_nomodule_runme.py index ba0abfd9a..efcff9c48 100644 --- a/Examples/test-suite/python/import_nomodule_runme.py +++ b/Examples/test-suite/python/import_nomodule_runme.py @@ -1,5 +1,10 @@ from import_nomodule import * +# This test is expected to fail with -builtin option. +# The base class is needed for the builtin class hierarchy +if is_python_builtin(): + exit(0) + f = create_Foo() test1(f,42) delete_Foo(f) diff --git a/Examples/test-suite/python/kwargs_feature_runme.py b/Examples/test-suite/python/kwargs_feature_runme.py index 5539e211d..7792e2e06 100644 --- a/Examples/test-suite/python/kwargs_feature_runme.py +++ b/Examples/test-suite/python/kwargs_feature_runme.py @@ -44,10 +44,10 @@ if BarInt_sbar(b=2) != 3: if templatedfunction(b=2) != 3: raise RuntimeError -if foo(a=1,b=2) != 3: +if foo_fn(a=1,b=2) != 3: raise RuntimeError -if foo(b=2) != 3: +if foo_fn(b=2) != 3: raise RuntimeError diff --git a/Examples/test-suite/python/li_std_except_as_class_runme.py b/Examples/test-suite/python/li_std_except_as_class_runme.py index 386a878bf..a86e7a562 100644 --- a/Examples/test-suite/python/li_std_except_as_class_runme.py +++ b/Examples/test-suite/python/li_std_except_as_class_runme.py @@ -1,9 +1,19 @@ from li_std_except_as_class import * -# std::domain_error hierarchy -try: test_domain_error() -except domain_error: pass -try: test_domain_error() -except logic_error: pass -try: test_domain_error() -except exception: pass +# This test is expected to fail with -builtin option. +# Throwing builtin classes as exceptions not supported +if is_python_builtin(): + try: test_domain_error() + except RuntimeError: pass + try: test_domain_error() + except RuntimeError: pass + try: test_domain_error() + except RuntimeError: pass +else: + # std::domain_error hierarchy + try: test_domain_error() + except domain_error: pass + try: test_domain_error() + except logic_error: pass + try: test_domain_error() + except exception: pass diff --git a/Examples/test-suite/python/li_std_string_extra_runme.py b/Examples/test-suite/python/li_std_string_extra_runme.py index 9e9e3d2c3..503d09eb5 100644 --- a/Examples/test-suite/python/li_std_string_extra_runme.py +++ b/Examples/test-suite/python/li_std_string_extra_runme.py @@ -56,14 +56,13 @@ if a + " world" != "hello world": # This is expected to fail with -builtin option # Reverse operators not supported in builtin types -if "hello" + b != "hello world": - raise RuntimeError, "bad string mapping" +if not li_std_string_extra.is_python_builtin(): + if "hello" + b != "hello world": + raise RuntimeError, "bad string mapping" -# This is expected to fail with -builtin option -# Reverse operators not supported in builtin types -c = "hello" + b -if c.find_last_of("l") != 9: - raise RuntimeError, "bad string mapping" + c = "hello" + b + if c.find_last_of("l") != 9: + raise RuntimeError, "bad string mapping" s = "hello world" diff --git a/Examples/test-suite/python/li_std_wstring_runme.py b/Examples/test-suite/python/li_std_wstring_runme.py index fecc527e0..a467ae8bc 100644 --- a/Examples/test-suite/python/li_std_wstring_runme.py +++ b/Examples/test-suite/python/li_std_wstring_runme.py @@ -60,13 +60,14 @@ if a + " world" != "hello world": raise RuntimeError("bad string mapping") # This is expected to fail if -builtin is used -if "hello" + b != "hello world": - raise RuntimeError("bad string mapping") - -# This is expected to fail if -builtin is used -c = "hello" + b -if c.find_last_of("l") != 9: - raise RuntimeError("bad string mapping") +# Reverse operators not supported in builtin types +if not li_std_wstring.is_python_builtin(): + if "hello" + b != "hello world": + raise RuntimeError("bad string mapping") + + c = "hello" + b + if c.find_last_of("l") != 9: + raise RuntimeError("bad string mapping") s = "hello world" diff --git a/Examples/test-suite/python/nested_template_base_runme.py b/Examples/test-suite/python/nested_template_base_runme.py new file mode 100644 index 000000000..3d54b8391 --- /dev/null +++ b/Examples/test-suite/python/nested_template_base_runme.py @@ -0,0 +1,13 @@ +from nested_template_base import * + + +ois = InnerS(123); +oic = InnerC(); + +# Check base method is available +if (oic.outer(ois).val != 123): + raise RuntimeError("Wrong value calling outer"); + +# Check non-derived class using base class +if (oic.innerc().outer(ois).val != 123): + raise RuntimeError("Wrong value calling innerc"); diff --git a/Examples/test-suite/python/preproc_runme.py b/Examples/test-suite/python/preproc_runme.py index c989294b6..3049f00ab 100644 --- a/Examples/test-suite/python/preproc_runme.py +++ b/Examples/test-suite/python/preproc_runme.py @@ -12,3 +12,5 @@ if preproc.defined != 1: if 2*preproc.one != preproc.two: raise RuntimeError +if preproc.methodX(99) != 199: + raise RuntimeError diff --git a/Examples/test-suite/python/python_abstractbase_runme3.py b/Examples/test-suite/python/python_abstractbase_runme3.py index 94dee3ff7..9b189964d 100644 --- a/Examples/test-suite/python/python_abstractbase_runme3.py +++ b/Examples/test-suite/python/python_abstractbase_runme3.py @@ -3,6 +3,8 @@ from collections import * # This is expected to fail with -builtin option # Builtin types can't inherit from pure-python abstract bases +if is_python_builtin(): + exit(0) assert issubclass(Mapii, MutableMapping) assert issubclass(Multimapii, MutableMapping) diff --git a/Examples/test-suite/python/python_append_runme.py b/Examples/test-suite/python/python_append_runme.py index 41cebad58..54d7a3e00 100644 --- a/Examples/test-suite/python/python_append_runme.py +++ b/Examples/test-suite/python/python_append_runme.py @@ -1,11 +1,16 @@ from python_append import * + +# test not relevant for -builtin +if is_python_builtin(): + exit(0) + t=Test() t.func() t.static_func() if grabpath() != os.path.dirname(mypath): - raise RuntimeError + raise RuntimeError("grabpath failed") if grabstaticpath() != os.path.basename(mypath): - raise RuntimeError + raise RuntimeError("grabstaticpath failed") diff --git a/Examples/test-suite/python/python_threads_runme.py b/Examples/test-suite/python/python_threads_runme.py new file mode 100644 index 000000000..d00e2458f --- /dev/null +++ b/Examples/test-suite/python/python_threads_runme.py @@ -0,0 +1,10 @@ +from python_threads import * + +action = ActionGroup() +count = 1 +for child in action.GetActionList(): + if child.val != count: + raise RuntimeError("Expected: " + str(count) + " got: " + str(child.val)) + count = count + 1 + +# Was seg faulting at the end here diff --git a/Examples/test-suite/python/smart_pointer_const_overload_runme.py b/Examples/test-suite/python/smart_pointer_const_overload_runme.py index f1be315a5..098e5b4c3 100644 --- a/Examples/test-suite/python/smart_pointer_const_overload_runme.py +++ b/Examples/test-suite/python/smart_pointer_const_overload_runme.py @@ -56,7 +56,7 @@ def test(b, f): raise RuntimeError # Test static method - b.stat() + b.statMethod() if f.access != CONST_ACCESS: raise RuntimeError diff --git a/Examples/test-suite/python/threads_exception_runme.py b/Examples/test-suite/python/threads_exception_runme.py index d4b8855fc..6fe6947ec 100644 --- a/Examples/test-suite/python/threads_exception_runme.py +++ b/Examples/test-suite/python/threads_exception_runme.py @@ -20,15 +20,16 @@ except RuntimeError,e: # This is expected fail with -builtin option # Throwing builtin classes as exceptions not supported -try: - t.hosed() -except threads_exception.Exc,e: - code = e.code - if code != 42: - raise RuntimeError, "bad... code: %d" % code - msg = e.msg - if msg != "Hosed": - raise RuntimeError, "bad... msg: '%s' len: %d" % (msg, len(msg)) +if not threads_exception.is_python_builtin(): + try: + t.hosed() + except threads_exception.Exc,e: + code = e.code + if code != 42: + raise RuntimeError, "bad... code: %d" % code + msg = e.msg + if msg != "Hosed": + raise RuntimeError, "bad... msg: '%s' len: %d" % (msg, len(msg)) for i in range(1,4): try: diff --git a/Examples/test-suite/python/unicode_strings_runme.py b/Examples/test-suite/python/unicode_strings_runme.py new file mode 100644 index 000000000..e1fc7adec --- /dev/null +++ b/Examples/test-suite/python/unicode_strings_runme.py @@ -0,0 +1,14 @@ +import sys + +import unicode_strings + +# The 'u' string prefix isn't valid in Python 3.0 - 3.2 and is redundant +# in 3.3+. Since this file is run through 2to3 before testing, though, +# mark this as a unicode string in 2.x so it'll become a str in 3.x. +test_string = u'h\udce9llo w\u00f6rld' + +if sys.version_info[0:2] >= (3, 1): + if unicode_strings.non_utf8_c_str() != test_string: + raise ValueError('Test comparison mismatch') + if unicode_strings.non_utf8_std_string() != test_string: + raise ValueError('Test comparison mismatch') diff --git a/Examples/test-suite/python_abstractbase.i b/Examples/test-suite/python_abstractbase.i index f72688237..65f3d9931 100644 --- a/Examples/test-suite/python_abstractbase.i +++ b/Examples/test-suite/python_abstractbase.i @@ -16,3 +16,11 @@ namespace std %template(IntVector) vector<int>; %template(IntList) list<int>; } + +%inline %{ +#ifdef SWIGPYTHON_BUILTIN +bool is_python_builtin() { return true; } +#else +bool is_python_builtin() { return false; } +#endif +%} diff --git a/Examples/test-suite/python_append.i b/Examples/test-suite/python_append.i index e263c392b..f37a6c199 100644 --- a/Examples/test-suite/python_append.i +++ b/Examples/test-suite/python_append.i @@ -5,22 +5,22 @@ Testcase to test %pythonprepend and %pythonappend %pythoncode %pythonbegin %module python_append %pythoncode %{ - mypath = os.path.dirname("/a/b/c/d.txt") - funcpath = None - staticfuncpath = None - def grabpath(): +mypath = os.path.dirname("/a/b/c/d.txt") +funcpath = None +staticfuncpath = None +def grabpath(): return funcpath - def grabstaticpath(): +def grabstaticpath(): return staticfuncpath %} %pythonappend Test::func %{ - funcpath = os.path.dirname(funcpath) +funcpath = os.path.dirname(funcpath) %} %pythonprepend Test::func %{ - global funcpath - funcpath = mypath +global funcpath +funcpath = mypath %} %pythonappend Test::static_func %{ @@ -29,9 +29,9 @@ pass %} %pythonprepend Test::static_func { - global staticfuncpath - staticfuncpath = mypath - pass +global staticfuncpath +staticfuncpath = mypath +pass } %pythonbegin %{ @@ -46,5 +46,10 @@ public: void func() {}; }; +#ifdef SWIGPYTHON_BUILTIN +bool is_python_builtin() { return true; } +#else +bool is_python_builtin() { return false; } +#endif %} diff --git a/Examples/test-suite/python_nondynamic.i b/Examples/test-suite/python_nondynamic.i index 26c69644d..54a3f28ca 100644 --- a/Examples/test-suite/python_nondynamic.i +++ b/Examples/test-suite/python_nondynamic.i @@ -1,7 +1,7 @@ %module python_nondynamic /* - Use the %pythonnondynamic directuve to make the wrapped class a + Use the %pythonnondynamic directive to make the wrapped class a nondynamic one, ie, a python class that doesn't dynamically add new attributes. Hence, for the class diff --git a/Examples/test-suite/python_threads.i b/Examples/test-suite/python_threads.i new file mode 100644 index 000000000..08eddef11 --- /dev/null +++ b/Examples/test-suite/python_threads.i @@ -0,0 +1,40 @@ +%module(threads=1) python_threads + +%include <std_vector.i> + +%inline %{ +struct Action { + int val; + Action(int val = 0) : val(val) {} +}; +%} + +%template(VectorActionPtr) std::vector<Action *>; + +%inline %{ +#include <vector> +#include <iostream> +template <typename T> struct myStlVector : public std::vector<T> { +}; +typedef myStlVector <Action *> ActionList; + +%} + +%template(ActionList) myStlVector<Action *>; + +%inline %{ +class ActionGroup +{ +public: + ActionList &GetActionList () const { + static ActionList list; + list.push_back(new Action(1)); + list.push_back(new Action(2)); + list.push_back(new Action(3)); + list.push_back(new Action(4)); + return list; + } +}; +%} + + diff --git a/Examples/test-suite/r/Makefile.in b/Examples/test-suite/r/Makefile.in index 18e2d4b25..d0489531f 100644 --- a/Examples/test-suite/r/Makefile.in +++ b/Examples/test-suite/r/Makefile.in @@ -6,6 +6,7 @@ LANGUAGE = r SCRIPTSUFFIX = _runme.R WRAPSUFFIX = .R RUNR = R CMD BATCH --no-save --no-restore + srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ @@ -28,7 +29,7 @@ include $(srcdir)/../common.mk # none! # Rules for the different types of tests -%.cpptest: +%.cpptest: $(setup) +$(swig_and_compile_cpp) $(run_testcase) @@ -38,34 +39,34 @@ include $(srcdir)/../common.mk +$(swig_and_compile_c) $(run_testcase) -%.multicpptest: +%.multicpptest: $(setup) +$(swig_and_compile_multi_cpp) $(run_multitestcase) # Runs the testcase. -# -# Run the runme if it exists. If not just load the R wrapper to +# +# Run the runme if it exists. If not just load the R wrapper to # check for syntactic correctness run_testcase = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PATH=.:"$$PATH" $(RUNTOOL) $(RUNR) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PATH=.:"$$PATH" $(RUNTOOL) $(RUNR) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ else \ - $(RUNTOOL) $(RUNR) $(srcdir)/$(SCRIPTPREFIX)$*$(WRAPSUFFIX); \ + $(RUNTOOL) $(RUNR) ./$(SCRIPTPREFIX)$*$(WRAPSUFFIX); \ fi run_multitestcase = \ for f in `cat $(top_srcdir)/$(EXAMPLES)/$(TEST_SUITE)/$*.list` ; do \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$${f}$(SCRIPTSUFFIX) ]; then \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$${f}$(SCRIPTSUFFIX) ]; then \ env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH PATH=.:"$$PATH" \ - $(RUNTOOL) $(RUNR) $(srcdir)/$(SCRIPTPREFIX)$${f}$(SCRIPTSUFFIX); \ + $(RUNTOOL) $(RUNR) $(SCRIPTDIR)/$(SCRIPTPREFIX)$${f}$(SCRIPTSUFFIX); \ else \ - $(RUNTOOL) $(RUNR) $(srcdir)/$(SCRIPTPREFIX)$${f}$(WRAPSUFFIX); \ + $(RUNTOOL) $(RUNR) ./$(SCRIPTPREFIX)$${f}$(WRAPSUFFIX); \ fi; \ done # Clean clean: - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile r_clean + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" r_clean %.clean: @rm -f $*.R $*_wrap.so $*_wrap.cpp $*_wrap.c $*_wrap.o $*_runme.Rout $*.Rout @@ -74,5 +75,3 @@ clean: rm -f $${f}.R $${f}.Rout ; \ done \ fi - - diff --git a/Examples/test-suite/r_overload_array.i b/Examples/test-suite/r_overload_array.i index 1474661c4..aa714dfdb 100644 --- a/Examples/test-suite/r_overload_array.i +++ b/Examples/test-suite/r_overload_array.i @@ -1,7 +1,8 @@ %module r_overload_array -%include "stl.i" -# this tests the situation in which there is a scalar function -# corresponding with a vector one + +%include <stl.i> +// this tests the situation in which there is a scalar function +// corresponding with a vector one %inline %{ class Foo { diff --git a/Examples/test-suite/ruby/Makefile.in b/Examples/test-suite/ruby/Makefile.in index ab366ccd4..ae4995882 100644 --- a/Examples/test-suite/ruby/Makefile.in +++ b/Examples/test-suite/ruby/Makefile.in @@ -5,12 +5,12 @@ LANGUAGE = ruby RUBY = @RUBY@ SCRIPTSUFFIX = _runme.rb + srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ CPP_TEST_CASES = \ - kwargs_feature \ li_cdata \ li_cstring \ li_factory \ @@ -42,7 +42,7 @@ SWIGOPT += -w801 -noautorename -features autodoc=4 ruby_naming.cpptest: SWIGOPT += -autorename # Rules for the different types of tests -%.cpptest: +%.cpptest: $(setup) +$(swig_and_compile_cpp) $(run_testcase) @@ -52,7 +52,7 @@ ruby_naming.cpptest: SWIGOPT += -autorename +$(swig_and_compile_c) $(run_testcase) -%.multicpptest: +%.multicpptest: $(setup) +$(swig_and_compile_multi_cpp) $(run_testcase) @@ -60,13 +60,13 @@ ruby_naming.cpptest: SWIGOPT += -autorename # Runs the testcase. A testcase is only run if # a file is found which has _runme.rb appended after the testcase name. run_testcase = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(RUBY) -I$(srcdir):. $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(RUBY) -I$(srcdir):. $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ fi # Clean %.clean: - + @exit 0 clean: - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile ruby_clean + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" ruby_clean diff --git a/Examples/test-suite/ruby/abstract_access_runme.rb b/Examples/test-suite/ruby/abstract_access_runme.rb index 6f91702c9..6f91702c9 100755..100644 --- a/Examples/test-suite/ruby/abstract_access_runme.rb +++ b/Examples/test-suite/ruby/abstract_access_runme.rb diff --git a/Examples/test-suite/ruby/access_change_runme.rb b/Examples/test-suite/ruby/access_change_runme.rb index 5b3e99c58..5b3e99c58 100755..100644 --- a/Examples/test-suite/ruby/access_change_runme.rb +++ b/Examples/test-suite/ruby/access_change_runme.rb diff --git a/Examples/test-suite/ruby/add_link_runme.rb b/Examples/test-suite/ruby/add_link_runme.rb index 8f726d27a..8f726d27a 100755..100644 --- a/Examples/test-suite/ruby/add_link_runme.rb +++ b/Examples/test-suite/ruby/add_link_runme.rb diff --git a/Examples/test-suite/ruby/anonymous_bitfield_runme.rb b/Examples/test-suite/ruby/anonymous_bitfield_runme.rb index 6949a3f28..6949a3f28 100755..100644 --- a/Examples/test-suite/ruby/anonymous_bitfield_runme.rb +++ b/Examples/test-suite/ruby/anonymous_bitfield_runme.rb diff --git a/Examples/test-suite/ruby/apply_signed_char_runme.rb b/Examples/test-suite/ruby/apply_signed_char_runme.rb index 3256e1f02..3256e1f02 100755..100644 --- a/Examples/test-suite/ruby/apply_signed_char_runme.rb +++ b/Examples/test-suite/ruby/apply_signed_char_runme.rb diff --git a/Examples/test-suite/ruby/apply_strings_runme.rb b/Examples/test-suite/ruby/apply_strings_runme.rb index 299b96bb6..299b96bb6 100755..100644 --- a/Examples/test-suite/ruby/apply_strings_runme.rb +++ b/Examples/test-suite/ruby/apply_strings_runme.rb diff --git a/Examples/test-suite/ruby/argout_runme.rb b/Examples/test-suite/ruby/argout_runme.rb index 54cb8f30f..54cb8f30f 100755..100644 --- a/Examples/test-suite/ruby/argout_runme.rb +++ b/Examples/test-suite/ruby/argout_runme.rb diff --git a/Examples/test-suite/ruby/arrays_runme.rb b/Examples/test-suite/ruby/arrays_runme.rb index 749d81758..749d81758 100755..100644 --- a/Examples/test-suite/ruby/arrays_runme.rb +++ b/Examples/test-suite/ruby/arrays_runme.rb diff --git a/Examples/test-suite/ruby/cast_operator_runme.rb b/Examples/test-suite/ruby/cast_operator_runme.rb index 4879befbf..4879befbf 100755..100644 --- a/Examples/test-suite/ruby/cast_operator_runme.rb +++ b/Examples/test-suite/ruby/cast_operator_runme.rb diff --git a/Examples/test-suite/ruby/casts_runme.rb b/Examples/test-suite/ruby/casts_runme.rb index d1f536d75..d1f536d75 100755..100644 --- a/Examples/test-suite/ruby/casts_runme.rb +++ b/Examples/test-suite/ruby/casts_runme.rb diff --git a/Examples/test-suite/ruby/check_missing_tests.rb b/Examples/test-suite/ruby/check_missing_tests.rb index 97e197e3a..97e197e3a 100755..100644 --- a/Examples/test-suite/ruby/check_missing_tests.rb +++ b/Examples/test-suite/ruby/check_missing_tests.rb diff --git a/Examples/test-suite/ruby/class_ignore_runme.rb b/Examples/test-suite/ruby/class_ignore_runme.rb index 28e432486..28e432486 100755..100644 --- a/Examples/test-suite/ruby/class_ignore_runme.rb +++ b/Examples/test-suite/ruby/class_ignore_runme.rb diff --git a/Examples/test-suite/ruby/const_const_runme.rb b/Examples/test-suite/ruby/const_const_runme.rb index cadc73a94..cadc73a94 100755..100644 --- a/Examples/test-suite/ruby/const_const_runme.rb +++ b/Examples/test-suite/ruby/const_const_runme.rb diff --git a/Examples/test-suite/ruby/constover_runme.rb b/Examples/test-suite/ruby/constover_runme.rb index 49c0c81e8..49c0c81e8 100755..100644 --- a/Examples/test-suite/ruby/constover_runme.rb +++ b/Examples/test-suite/ruby/constover_runme.rb diff --git a/Examples/test-suite/ruby/cpp11_strongly_typed_enumerations_runme.rb b/Examples/test-suite/ruby/cpp11_strongly_typed_enumerations_runme.rb new file mode 100644 index 000000000..897a44281 --- /dev/null +++ b/Examples/test-suite/ruby/cpp11_strongly_typed_enumerations_runme.rb @@ -0,0 +1,177 @@ +#!/usr/bin/env ruby +# +# Put description here +# +# +# +# +# + +require 'swig_assert' + +require 'cpp11_strongly_typed_enumerations' + +include Cpp11_strongly_typed_enumerations + +def enumCheck(actual, expected) + raise RuntimeError,"Enum value mismatch. Expected #{expected} Actual: #{actual}" if actual != expected + return expected + 1 +end + +val = 0 +val = enumCheck(Enum1_Val1, val) +val = enumCheck(Enum1_Val2, val) +val = enumCheck(Enum1_Val3, 13) +val = enumCheck(Enum1_Val4, val) +val = enumCheck(Enum1_Val5a, 13) +val = enumCheck(Enum1_Val6a, val) + +val = 0 +val = enumCheck(Enum2_Val1, val) +val = enumCheck(Enum2_Val2, val) +val = enumCheck(Enum2_Val3, 23) +val = enumCheck(Enum2_Val4, val) +val = enumCheck(Enum2_Val5b, 23) +val = enumCheck(Enum2_Val6b, val) + +val = 0 +val = enumCheck(Val1, val) +val = enumCheck(Val2, val) +val = enumCheck(Val3, 43) +val = enumCheck(Val4, val) + +val = 0 +val = enumCheck(Enum5_Val1, val) +val = enumCheck(Enum5_Val2, val) +val = enumCheck(Enum5_Val3, 53) +val = enumCheck(Enum5_Val4, val) + +val = 0 +val = enumCheck(Enum6_Val1, val) +val = enumCheck(Enum6_Val2, val) +val = enumCheck(Enum6_Val3, 63) +val = enumCheck(Enum6_Val4, val) + +val = 0 +val = enumCheck(Enum7td_Val1, val) +val = enumCheck(Enum7td_Val2, val) +val = enumCheck(Enum7td_Val3, 73) +val = enumCheck(Enum7td_Val4, val) + +val = 0 +val = enumCheck(Enum8_Val1, val) +val = enumCheck(Enum8_Val2, val) +val = enumCheck(Enum8_Val3, 83) +val = enumCheck(Enum8_Val4, val) + +val = 0 +val = enumCheck(Enum10_Val1, val) +val = enumCheck(Enum10_Val2, val) +val = enumCheck(Enum10_Val3, 103) +val = enumCheck(Enum10_Val4, val) + +val = 0 +val = enumCheck(Class1::Enum12_Val1, 1121) +val = enumCheck(Class1::Enum12_Val2, 1122) +val = enumCheck(Class1::Enum12_Val3, val) +val = enumCheck(Class1::Enum12_Val4, val) +val = enumCheck(Class1::Enum12_Val5c, 1121) +val = enumCheck(Class1::Enum12_Val6c, val) + +val = 0 +val = enumCheck(Class1::Val1, 1131) +val = enumCheck(Class1::Val2, 1132) +val = enumCheck(Class1::Val3, val) +val = enumCheck(Class1::Val4, val) +val = enumCheck(Class1::Val5d, 1131) +val = enumCheck(Class1::Val6d, val) + +val = 0 +val = enumCheck(Class1::Enum14_Val1, 1141) +val = enumCheck(Class1::Enum14_Val2, 1142) +val = enumCheck(Class1::Enum14_Val3, val) +val = enumCheck(Class1::Enum14_Val4, val) +val = enumCheck(Class1::Enum14_Val5e, 1141) +val = enumCheck(Class1::Enum14_Val6e, val) + +# Requires nested class support to work +#val = 0 +#val = enumCheck(Class1::Struct1.Enum12_Val1, 3121) +#val = enumCheck(Class1::Struct1.Enum12_Val2, 3122) +#val = enumCheck(Class1::Struct1.Enum12_Val3, val) +#val = enumCheck(Class1::Struct1.Enum12_Val4, val) +#val = enumCheck(Class1::Struct1.Enum12_Val5f, 3121) +#val = enumCheck(Class1::Struct1.Enum12_Val6f, val) +# +#val = 0 +#val = enumCheck(Class1::Struct1.Val1, 3131) +#val = enumCheck(Class1::Struct1.Val2, 3132) +#val = enumCheck(Class1::Struct1.Val3, val) +#val = enumCheck(Class1::Struct1.Val4, val) +# +#val = 0 +#val = enumCheck(Class1::Struct1.Enum14_Val1, 3141) +#val = enumCheck(Class1::Struct1.Enum14_Val2, 3142) +#val = enumCheck(Class1::Struct1.Enum14_Val3, val) +#val = enumCheck(Class1::Struct1.Enum14_Val4, val) +#val = enumCheck(Class1::Struct1.Enum14_Val5g, 3141) +#val = enumCheck(Class1::Struct1.Enum14_Val6g, val) + +val = 0 +val = enumCheck(Class2::Enum12_Val1, 2121) +val = enumCheck(Class2::Enum12_Val2, 2122) +val = enumCheck(Class2::Enum12_Val3, val) +val = enumCheck(Class2::Enum12_Val4, val) +val = enumCheck(Class2::Enum12_Val5h, 2121) +val = enumCheck(Class2::Enum12_Val6h, val) + +val = 0 +val = enumCheck(Class2::Val1, 2131) +val = enumCheck(Class2::Val2, 2132) +val = enumCheck(Class2::Val3, val) +val = enumCheck(Class2::Val4, val) +val = enumCheck(Class2::Val5i, 2131) +val = enumCheck(Class2::Val6i, val) + +val = 0 +val = enumCheck(Class2::Enum14_Val1, 2141) +val = enumCheck(Class2::Enum14_Val2, 2142) +val = enumCheck(Class2::Enum14_Val3, val) +val = enumCheck(Class2::Enum14_Val4, val) +val = enumCheck(Class2::Enum14_Val5j, 2141) +val = enumCheck(Class2::Enum14_Val6j, val) + +# Requires nested class support to work +#val = 0 +#val = enumCheck(Class2::Struct1.Enum12_Val1, 4121) +#val = enumCheck(Class2::Struct1.Enum12_Val2, 4122) +#val = enumCheck(Class2::Struct1.Enum12_Val3, val) +#val = enumCheck(Class2::Struct1.Enum12_Val4, val) +#val = enumCheck(Class2::Struct1.Enum12_Val5k, 4121) +#val = enumCheck(Class2::Struct1.Enum12_Val6k, val) +# +#val = 0 +#val = enumCheck(Class2::Struct1.Val1, 4131) +#val = enumCheck(Class2::Struct1.Val2, 4132) +#val = enumCheck(Class2::Struct1.Val3, val) +#val = enumCheck(Class2::Struct1.Val4, val) +#val = enumCheck(Class2::Struct1.Val5l, 4131) +#val = enumCheck(Class2::Struct1.Val6l, val) +# +#val = 0 +#val = enumCheck(Class2::Struct1.Enum14_Val1, 4141) +#val = enumCheck(Class2::Struct1.Enum14_Val2, 4142) +#val = enumCheck(Class2::Struct1.Enum14_Val3, val) +#val = enumCheck(Class2::Struct1.Enum14_Val4, val) +#val = enumCheck(Class2::Struct1.Enum14_Val5m, 4141) +#val = enumCheck(Class2::Struct1.Enum14_Val6m, val) + +class1 = Class1.new +enumCheck(class1.class1Test1(Enum1_Val5a), 13) +enumCheck(class1.class1Test2(Class1::Enum12_Val5c), 1121) +#enumCheck(class1.class1Test3(Class1::Struct1.Enum12_Val5f), 3121) + +enumCheck(globalTest1(Enum1_Val5a), 13) +enumCheck(globalTest2(Class1::Enum12_Val5c), 1121) +#enumCheck(globalTest3(Class1::Struct1.Enum12_Val5f), 3121) + diff --git a/Examples/test-suite/ruby/cpp_namespace_runme.rb b/Examples/test-suite/ruby/cpp_namespace_runme.rb index 53649faf5..53649faf5 100755..100644 --- a/Examples/test-suite/ruby/cpp_namespace_runme.rb +++ b/Examples/test-suite/ruby/cpp_namespace_runme.rb diff --git a/Examples/test-suite/ruby/default_constructor_runme.rb b/Examples/test-suite/ruby/default_constructor_runme.rb index 2706f67ca..2706f67ca 100755..100644 --- a/Examples/test-suite/ruby/default_constructor_runme.rb +++ b/Examples/test-suite/ruby/default_constructor_runme.rb diff --git a/Examples/test-suite/ruby/dynamic_cast_runme.rb b/Examples/test-suite/ruby/dynamic_cast_runme.rb index 8239051b1..8239051b1 100755..100644 --- a/Examples/test-suite/ruby/dynamic_cast_runme.rb +++ b/Examples/test-suite/ruby/dynamic_cast_runme.rb diff --git a/Examples/test-suite/ruby/enum_thorough_runme.rb b/Examples/test-suite/ruby/enum_thorough_runme.rb index e4a1ec719..e4a1ec719 100755..100644 --- a/Examples/test-suite/ruby/enum_thorough_runme.rb +++ b/Examples/test-suite/ruby/enum_thorough_runme.rb diff --git a/Examples/test-suite/ruby/function_typedef_runme.rb b/Examples/test-suite/ruby/function_typedef_runme.rb index c17f44d19..c17f44d19 100755..100644 --- a/Examples/test-suite/ruby/function_typedef_runme.rb +++ b/Examples/test-suite/ruby/function_typedef_runme.rb diff --git a/Examples/test-suite/ruby/imports_runme.rb b/Examples/test-suite/ruby/imports_runme.rb index 8bd242e86..8bd242e86 100755..100644 --- a/Examples/test-suite/ruby/imports_runme.rb +++ b/Examples/test-suite/ruby/imports_runme.rb diff --git a/Examples/test-suite/ruby/integers_runme.rb b/Examples/test-suite/ruby/integers_runme.rb index b6ca45891..b6ca45891 100755..100644 --- a/Examples/test-suite/ruby/integers_runme.rb +++ b/Examples/test-suite/ruby/integers_runme.rb diff --git a/Examples/test-suite/ruby/li_cstring_runme.rb b/Examples/test-suite/ruby/li_cstring_runme.rb index a4ffcad02..a4ffcad02 100755..100644 --- a/Examples/test-suite/ruby/li_cstring_runme.rb +++ b/Examples/test-suite/ruby/li_cstring_runme.rb diff --git a/Examples/test-suite/ruby/li_math_runme.rb b/Examples/test-suite/ruby/li_math_runme.rb index 038278315..038278315 100755..100644 --- a/Examples/test-suite/ruby/li_math_runme.rb +++ b/Examples/test-suite/ruby/li_math_runme.rb diff --git a/Examples/test-suite/ruby/li_std_functors_runme.rb b/Examples/test-suite/ruby/li_std_functors_runme.rb index 5623d49f0..5623d49f0 100755..100644 --- a/Examples/test-suite/ruby/li_std_functors_runme.rb +++ b/Examples/test-suite/ruby/li_std_functors_runme.rb diff --git a/Examples/test-suite/ruby/li_std_map_runme.rb b/Examples/test-suite/ruby/li_std_map_runme.rb index 0ec8cac84..0ec8cac84 100755..100644 --- a/Examples/test-suite/ruby/li_std_map_runme.rb +++ b/Examples/test-suite/ruby/li_std_map_runme.rb diff --git a/Examples/test-suite/ruby/li_std_multimap_runme.rb b/Examples/test-suite/ruby/li_std_multimap_runme.rb index b0c2bb359..b0c2bb359 100755..100644 --- a/Examples/test-suite/ruby/li_std_multimap_runme.rb +++ b/Examples/test-suite/ruby/li_std_multimap_runme.rb diff --git a/Examples/test-suite/ruby/li_std_pair_runme.rb b/Examples/test-suite/ruby/li_std_pair_runme.rb index 685046fd2..685046fd2 100755..100644 --- a/Examples/test-suite/ruby/li_std_pair_runme.rb +++ b/Examples/test-suite/ruby/li_std_pair_runme.rb diff --git a/Examples/test-suite/ruby/li_std_queue_runme.rb b/Examples/test-suite/ruby/li_std_queue_runme.rb index 63101ed6e..63101ed6e 100755..100644 --- a/Examples/test-suite/ruby/li_std_queue_runme.rb +++ b/Examples/test-suite/ruby/li_std_queue_runme.rb diff --git a/Examples/test-suite/ruby/li_std_set_runme.rb b/Examples/test-suite/ruby/li_std_set_runme.rb index efc163bee..efc163bee 100755..100644 --- a/Examples/test-suite/ruby/li_std_set_runme.rb +++ b/Examples/test-suite/ruby/li_std_set_runme.rb diff --git a/Examples/test-suite/ruby/li_std_speed2_runme.rb b/Examples/test-suite/ruby/li_std_speed2_runme.rb index 1c4e15f2d..1c4e15f2d 100755..100644 --- a/Examples/test-suite/ruby/li_std_speed2_runme.rb +++ b/Examples/test-suite/ruby/li_std_speed2_runme.rb diff --git a/Examples/test-suite/ruby/li_std_stack_runme.rb b/Examples/test-suite/ruby/li_std_stack_runme.rb index 806bba029..806bba029 100755..100644 --- a/Examples/test-suite/ruby/li_std_stack_runme.rb +++ b/Examples/test-suite/ruby/li_std_stack_runme.rb diff --git a/Examples/test-suite/ruby/li_std_stream_runme.rb b/Examples/test-suite/ruby/li_std_stream_runme.rb index 80c5166f3..80c5166f3 100755..100644 --- a/Examples/test-suite/ruby/li_std_stream_runme.rb +++ b/Examples/test-suite/ruby/li_std_stream_runme.rb diff --git a/Examples/test-suite/ruby/li_std_vector_enum_runme.rb b/Examples/test-suite/ruby/li_std_vector_enum_runme.rb index c997fd04f..c997fd04f 100755..100644 --- a/Examples/test-suite/ruby/li_std_vector_enum_runme.rb +++ b/Examples/test-suite/ruby/li_std_vector_enum_runme.rb diff --git a/Examples/test-suite/ruby/li_std_vector_runme.rb b/Examples/test-suite/ruby/li_std_vector_runme.rb index fe3d9e0ce..fe3d9e0ce 100755..100644 --- a/Examples/test-suite/ruby/li_std_vector_runme.rb +++ b/Examples/test-suite/ruby/li_std_vector_runme.rb diff --git a/Examples/test-suite/ruby/namespace_typemap_runme.rb b/Examples/test-suite/ruby/namespace_typemap_runme.rb index 42a5e23a7..42a5e23a7 100755..100644 --- a/Examples/test-suite/ruby/namespace_typemap_runme.rb +++ b/Examples/test-suite/ruby/namespace_typemap_runme.rb diff --git a/Examples/test-suite/ruby/overload_bool_runme.rb b/Examples/test-suite/ruby/overload_bool_runme.rb index 8b7568e94..8b7568e94 100755..100644 --- a/Examples/test-suite/ruby/overload_bool_runme.rb +++ b/Examples/test-suite/ruby/overload_bool_runme.rb diff --git a/Examples/test-suite/ruby/overload_copy_runme.rb b/Examples/test-suite/ruby/overload_copy_runme.rb index eb184b83c..eb184b83c 100755..100644 --- a/Examples/test-suite/ruby/overload_copy_runme.rb +++ b/Examples/test-suite/ruby/overload_copy_runme.rb diff --git a/Examples/test-suite/ruby/overload_extend_runme.rb b/Examples/test-suite/ruby/overload_extend_runme.rb index 255793fb4..255793fb4 100755..100644 --- a/Examples/test-suite/ruby/overload_extend_runme.rb +++ b/Examples/test-suite/ruby/overload_extend_runme.rb diff --git a/Examples/test-suite/ruby/overload_extendc_runme.rb b/Examples/test-suite/ruby/overload_extendc_runme.rb index a2682bf42..a2682bf42 100755..100644 --- a/Examples/test-suite/ruby/overload_extendc_runme.rb +++ b/Examples/test-suite/ruby/overload_extendc_runme.rb diff --git a/Examples/test-suite/ruby/overload_simple_runme.rb b/Examples/test-suite/ruby/overload_simple_runme.rb index 88cee4411..88cee4411 100755..100644 --- a/Examples/test-suite/ruby/overload_simple_runme.rb +++ b/Examples/test-suite/ruby/overload_simple_runme.rb diff --git a/Examples/test-suite/ruby/overload_template_runme.rb b/Examples/test-suite/ruby/overload_template_runme.rb index b099fd3ea..b099fd3ea 100755..100644 --- a/Examples/test-suite/ruby/overload_template_runme.rb +++ b/Examples/test-suite/ruby/overload_template_runme.rb diff --git a/Examples/test-suite/ruby/primitive_ref_runme.rb b/Examples/test-suite/ruby/primitive_ref_runme.rb index 5e97c7a6c..5e97c7a6c 100755..100644 --- a/Examples/test-suite/ruby/primitive_ref_runme.rb +++ b/Examples/test-suite/ruby/primitive_ref_runme.rb diff --git a/Examples/test-suite/ruby/ruby_li_std_speed_runme.rb b/Examples/test-suite/ruby/ruby_li_std_speed_runme.rb index e79cb46a8..e79cb46a8 100755..100644 --- a/Examples/test-suite/ruby/ruby_li_std_speed_runme.rb +++ b/Examples/test-suite/ruby/ruby_li_std_speed_runme.rb diff --git a/Examples/test-suite/ruby/sneaky1_runme.rb b/Examples/test-suite/ruby/sneaky1_runme.rb index c30fdaf2a..c30fdaf2a 100755..100644 --- a/Examples/test-suite/ruby/sneaky1_runme.rb +++ b/Examples/test-suite/ruby/sneaky1_runme.rb diff --git a/Examples/test-suite/ruby/std_containers_runme.rb b/Examples/test-suite/ruby/std_containers_runme.rb index 73d443218..73d443218 100755..100644 --- a/Examples/test-suite/ruby/std_containers_runme.rb +++ b/Examples/test-suite/ruby/std_containers_runme.rb diff --git a/Examples/test-suite/ruby/stl_new_runme.rb b/Examples/test-suite/ruby/stl_new_runme.rb index 80d4ceab3..80d4ceab3 100755..100644 --- a/Examples/test-suite/ruby/stl_new_runme.rb +++ b/Examples/test-suite/ruby/stl_new_runme.rb diff --git a/Examples/test-suite/ruby/swig_assert.rb b/Examples/test-suite/ruby/swig_assert.rb index 200b08384..200b08384 100755..100644 --- a/Examples/test-suite/ruby/swig_assert.rb +++ b/Examples/test-suite/ruby/swig_assert.rb diff --git a/Examples/test-suite/ruby/swig_gc.rb b/Examples/test-suite/ruby/swig_gc.rb index 30f6dfa42..30f6dfa42 100755..100644 --- a/Examples/test-suite/ruby/swig_gc.rb +++ b/Examples/test-suite/ruby/swig_gc.rb diff --git a/Examples/test-suite/ruby/template_inherit_runme.rb b/Examples/test-suite/ruby/template_inherit_runme.rb index 609508891..609508891 100755..100644 --- a/Examples/test-suite/ruby/template_inherit_runme.rb +++ b/Examples/test-suite/ruby/template_inherit_runme.rb diff --git a/Examples/test-suite/ruby/template_ns4_runme.rb b/Examples/test-suite/ruby/template_ns4_runme.rb index bf2c5f566..bf2c5f566 100755..100644 --- a/Examples/test-suite/ruby/template_ns4_runme.rb +++ b/Examples/test-suite/ruby/template_ns4_runme.rb diff --git a/Examples/test-suite/ruby/template_ns_runme.rb b/Examples/test-suite/ruby/template_ns_runme.rb index 6446127cd..6446127cd 100755..100644 --- a/Examples/test-suite/ruby/template_ns_runme.rb +++ b/Examples/test-suite/ruby/template_ns_runme.rb diff --git a/Examples/test-suite/ruby/template_rename_runme.rb b/Examples/test-suite/ruby/template_rename_runme.rb index 18cfd4caa..18cfd4caa 100755..100644 --- a/Examples/test-suite/ruby/template_rename_runme.rb +++ b/Examples/test-suite/ruby/template_rename_runme.rb diff --git a/Examples/test-suite/ruby/typedef_inherit_runme.rb b/Examples/test-suite/ruby/typedef_inherit_runme.rb index 029b80c70..029b80c70 100755..100644 --- a/Examples/test-suite/ruby/typedef_inherit_runme.rb +++ b/Examples/test-suite/ruby/typedef_inherit_runme.rb diff --git a/Examples/test-suite/ruby/typedef_scope_runme.rb b/Examples/test-suite/ruby/typedef_scope_runme.rb index 4858a2ef6..4858a2ef6 100755..100644 --- a/Examples/test-suite/ruby/typedef_scope_runme.rb +++ b/Examples/test-suite/ruby/typedef_scope_runme.rb diff --git a/Examples/test-suite/ruby/typemap_namespace_runme.rb b/Examples/test-suite/ruby/typemap_namespace_runme.rb index 09eb57e39..09eb57e39 100755..100644 --- a/Examples/test-suite/ruby/typemap_namespace_runme.rb +++ b/Examples/test-suite/ruby/typemap_namespace_runme.rb diff --git a/Examples/test-suite/ruby/typename_runme.rb b/Examples/test-suite/ruby/typename_runme.rb index 65de7334d..65de7334d 100755..100644 --- a/Examples/test-suite/ruby/typename_runme.rb +++ b/Examples/test-suite/ruby/typename_runme.rb diff --git a/Examples/test-suite/smart_pointer_const_overload.i b/Examples/test-suite/smart_pointer_const_overload.i index e3b000b52..75a137b73 100644 --- a/Examples/test-suite/smart_pointer_const_overload.i +++ b/Examples/test-suite/smart_pointer_const_overload.i @@ -34,7 +34,7 @@ struct Foo { Foo() : x(0), xp(&x), y(0), yp(&y), access(0) { } int getx() const { return x; } void setx(int x_) { x = x_; } - static void stat() {} + static void statMethod() {} }; %} diff --git a/Examples/test-suite/smart_pointer_templatemethods.i b/Examples/test-suite/smart_pointer_templatemethods.i index f79bbcc9d..bd8808aff 100644 --- a/Examples/test-suite/smart_pointer_templatemethods.i +++ b/Examples/test-suite/smart_pointer_templatemethods.i @@ -45,7 +45,7 @@ public: %template(QueryInterfaceObjct) Objct::QueryInterface<Objct>; #endif -}; // namespace +} // namespace %} diff --git a/Examples/test-suite/struct_initialization.i b/Examples/test-suite/struct_initialization.i index c378ba31d..da1604f1b 100644 --- a/Examples/test-suite/struct_initialization.i +++ b/Examples/test-suite/struct_initialization.i @@ -3,7 +3,7 @@ %inline %{ -// Named types +/* Named types */ struct StructA { int x; } instanceA1; diff --git a/Examples/test-suite/tcl/Makefile.in b/Examples/test-suite/tcl/Makefile.in index 49d2a7826..82c59dee4 100644 --- a/Examples/test-suite/tcl/Makefile.in +++ b/Examples/test-suite/tcl/Makefile.in @@ -4,7 +4,8 @@ LANGUAGE = tcl TCLSH = tclsh -SCRIPTSUFFIX = _runme.tcl +SCRIPTSUFFIX = _runme.tcl + srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ @@ -27,7 +28,7 @@ include $(srcdir)/../common.mk # none! # Rules for the different types of tests -%.cpptest: +%.cpptest: $(setup) +$(swig_and_compile_cpp) $(run_testcase) @@ -37,7 +38,7 @@ include $(srcdir)/../common.mk +$(swig_and_compile_c) $(run_testcase) -%.multicpptest: +%.multicpptest: $(setup) +$(swig_and_compile_multi_cpp) $(run_testcase) @@ -45,13 +46,13 @@ include $(srcdir)/../common.mk # Runs the testcase. A testcase is only run if # a file is found which has _runme.tcl appended after the testcase name. run_testcase = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(TCLSH) $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(TCLSH) $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ fi # Clean %.clean: - + @exit 0 clean: - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile tcl_clean + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" tcl_clean diff --git a/Examples/test-suite/tcl/cpp11_strongly_typed_enumerations_runme.tcl b/Examples/test-suite/tcl/cpp11_strongly_typed_enumerations_runme.tcl new file mode 100644 index 000000000..5132101ad --- /dev/null +++ b/Examples/test-suite/tcl/cpp11_strongly_typed_enumerations_runme.tcl @@ -0,0 +1,172 @@ + +if [ catch { load ./cpp11_strongly_typed_enumerations[info sharedlibextension] cpp11_strongly_typed_enumerations} err_msg ] { + puts stderr "Could not load shared object:\n$err_msg" +} + +proc enumCheck {actual expected} { + if {$actual != $expected} { + error "Enum value mismatch. Expected $expected. Actual: $actual" + } + return [expr $expected + 1] +} + +#set val 0 +#set val [enumCheck $Enum1_Val1 $val] +#set val [enumCheck $Enum1_Val2 $val] + +set val 0 +set val [enumCheck $Enum1_Val1 $val] +set val [enumCheck $Enum1_Val2 $val] +set val [enumCheck $Enum1_Val3 13] +set val [enumCheck $Enum1_Val4 $val] +set val [enumCheck $Enum1_Val5a 13] +set val [enumCheck $Enum1_Val6a $val] + +set val 0 +set val [enumCheck $Enum2_Val1 $val] +set val [enumCheck $Enum2_Val2 $val] +set val [enumCheck $Enum2_Val3 23] +set val [enumCheck $Enum2_Val4 $val] +set val [enumCheck $Enum2_Val5b 23] +set val [enumCheck $Enum2_Val6b $val] + +set val 0 +set val [enumCheck $Val1 $val] +set val [enumCheck $Val2 $val] +set val [enumCheck $Val3 43] +set val [enumCheck $Val4 $val] + +set val 0 +set val [enumCheck $Enum5_Val1 $val] +set val [enumCheck $Enum5_Val2 $val] +set val [enumCheck $Enum5_Val3 53] +set val [enumCheck $Enum5_Val4 $val] + +set val 0 +set val [enumCheck $Enum6_Val1 $val] +set val [enumCheck $Enum6_Val2 $val] +set val [enumCheck $Enum6_Val3 63] +set val [enumCheck $Enum6_Val4 $val] + +set val 0 +set val [enumCheck $Enum7td_Val1 $val] +set val [enumCheck $Enum7td_Val2 $val] +set val [enumCheck $Enum7td_Val3 73] +set val [enumCheck $Enum7td_Val4 $val] + +set val 0 +set val [enumCheck $Enum8_Val1 $val] +set val [enumCheck $Enum8_Val2 $val] +set val [enumCheck $Enum8_Val3 83] +set val [enumCheck $Enum8_Val4 $val] + +set val 0 +set val [enumCheck $Enum10_Val1 $val] +set val [enumCheck $Enum10_Val2 $val] +set val [enumCheck $Enum10_Val3 103] +set val [enumCheck $Enum10_Val4 $val] + +set val 0 +set val [enumCheck $Class1_Enum12_Val1 1121] +set val [enumCheck $Class1_Enum12_Val2 1122] +set val [enumCheck $Class1_Enum12_Val3 $val] +set val [enumCheck $Class1_Enum12_Val4 $val] +set val [enumCheck $Class1_Enum12_Val5c 1121] +set val [enumCheck $Class1_Enum12_Val6c $val] + +set val 0 +set val [enumCheck $Class1_Val1 1131] +set val [enumCheck $Class1_Val2 1132] +set val [enumCheck $Class1_Val3 $val] +set val [enumCheck $Class1_Val4 $val] +set val [enumCheck $Class1_Val5d 1131] +set val [enumCheck $Class1_Val6d $val] + +set val 0 +set val [enumCheck $Class1_Enum14_Val1 1141] +set val [enumCheck $Class1_Enum14_Val2 1142] +set val [enumCheck $Class1_Enum14_Val3 $val] +set val [enumCheck $Class1_Enum14_Val4 $val] +set val [enumCheck $Class1_Enum14_Val5e 1141] +set val [enumCheck $Class1_Enum14_Val6e $val] + +# Requires nested class support to work +#set val 0 +#set val [enumCheck $Class1_Struct1_Enum12_Val1 3121] +#set val [enumCheck $Class1_Struct1_Enum12_Val2 3122] +#set val [enumCheck $Class1_Struct1_Enum12_Val3 $val] +#set val [enumCheck $Class1_Struct1_Enum12_Val4 $val] +#set val [enumCheck $Class1_Struct1_Enum12_Val5f 3121] +#set val [enumCheck $Class1_Struct1_Enum12_Val6f $val] +# +#set val 0 +#set val [enumCheck $Class1_Struct1_Val1 3131] +#set val [enumCheck $Class1_Struct1_Val2 3132] +#set val [enumCheck $Class1_Struct1_Val3 $val] +#set val [enumCheck $Class1_Struct1_Val4 $val] +# +#set val 0 +#set val [enumCheck $Class1_Struct1_Enum14_Val1 3141] +#set val [enumCheck $Class1_Struct1_Enum14_Val2 3142] +#set val [enumCheck $Class1_Struct1_Enum14_Val3 $val] +#set val [enumCheck $Class1_Struct1_Enum14_Val4 $val] +#set val [enumCheck $Class1_Struct1_Enum14_Val5g 3141] +#set val [enumCheck $Class1_Struct1_Enum14_Val6g $val] + +set val 0 +set val [enumCheck $Class2_Enum12_Val1 2121] +set val [enumCheck $Class2_Enum12_Val2 2122] +set val [enumCheck $Class2_Enum12_Val3 $val] +set val [enumCheck $Class2_Enum12_Val4 $val] +set val [enumCheck $Class2_Enum12_Val5h 2121] +set val [enumCheck $Class2_Enum12_Val6h $val] + +set val 0 +set val [enumCheck $Class2_Val1 2131] +set val [enumCheck $Class2_Val2 2132] +set val [enumCheck $Class2_Val3 $val] +set val [enumCheck $Class2_Val4 $val] +set val [enumCheck $Class2_Val5i 2131] +set val [enumCheck $Class2_Val6i $val] + +set val 0 +set val [enumCheck $Class2_Enum14_Val1 2141] +set val [enumCheck $Class2_Enum14_Val2 2142] +set val [enumCheck $Class2_Enum14_Val3 $val] +set val [enumCheck $Class2_Enum14_Val4 $val] +set val [enumCheck $Class2_Enum14_Val5j 2141] +set val [enumCheck $Class2_Enum14_Val6j $val] + +# Requires nested class support to work +#set val 0 +#set val [enumCheck $Class2_Struct1_Enum12_Val1 4121] +#set val [enumCheck $Class2_Struct1_Enum12_Val2 4122] +#set val [enumCheck $Class2_Struct1_Enum12_Val3 $val] +#set val [enumCheck $Class2_Struct1_Enum12_Val4 $val] +#set val [enumCheck $Class2_Struct1_Enum12_Val5k 4121] +#set val [enumCheck $Class2_Struct1_Enum12_Val6k $val] +# +#set val 0 +#set val [enumCheck $Class2_Struct1_Val1 4131] +#set val [enumCheck $Class2_Struct1_Val2 4132] +#set val [enumCheck $Class2_Struct1_Val3 $val] +#set val [enumCheck $Class2_Struct1_Val4 $val] +#set val [enumCheck $Class2_Struct1_Val5l 4131] +#set val [enumCheck $Class2_Struct1_Val6l $val] +# +#set val 0 +#set val [enumCheck $Class2_Struct1_Enum14_Val1 4141] +#set val [enumCheck $Class2_Struct1_Enum14_Val2 4142] +#set val [enumCheck $Class2_Struct1_Enum14_Val3 $val] +#set val [enumCheck $Class2_Struct1_Enum14_Val4 $val] +#set val [enumCheck $Class2_Struct1_Enum14_Val5m 4141] +#set val [enumCheck $Class2_Struct1_Enum14_Val6m $val] + +set class1 [Class1] +enumCheck [$class1 class1Test1 $Enum1_Val5a] 13 +enumCheck [$class1 class1Test2 $Class1_Enum12_Val5c] 1121 +#enumCheck [$class1 class1Test3 $Class1_Struct1_Enum12_Val5f] 3121 + +enumCheck [globalTest1 $Enum1_Val5a] 13 +enumCheck [globalTest2 $Class1_Enum12_Val5c] 1121 +#enumCheck [globalTest3 $Class1_Struct1_Enum12_Val5f] 3121 diff --git a/Examples/test-suite/template_default_class_parms.i b/Examples/test-suite/template_default_class_parms.i index cd37269d3..e5a8c9d49 100644 --- a/Examples/test-suite/template_default_class_parms.i +++ b/Examples/test-suite/template_default_class_parms.i @@ -31,3 +31,49 @@ namespace Space { %template(FooAnotherType) Space::Foo<Space::AnotherType>; %template() Space::ATemplate<>; + + +// Github issue #280 segfault +%inline %{ +namespace Teuchos { + class Describable {}; +} +namespace KokkosClassic { + namespace DefaultNode { + struct DefaultNodeType {}; + }; +} + +namespace Tpetra { + template <class LocalOrdinal = int, + class GlobalOrdinal = LocalOrdinal, + class Node = KokkosClassic::DefaultNode::DefaultNodeType> + class Map : public Teuchos::Describable { + public: + typedef LocalOrdinal local_ordinal_type; + typedef GlobalOrdinal global_ordinal_type; + typedef Node node_type; + void test_func(LocalOrdinal, GlobalOrdinal, Node) {} + }; +} +%} + +#ifdef SWIGJAVA +// Fixes still required for other languages +%template(MapDefaults) Tpetra::Map<>; +#endif + +%inline %{ +namespace Details { + template < class LO = ::Tpetra::Map<>::local_ordinal_type, + class GO = typename ::Tpetra::Map<LO>::global_ordinal_type, + class NT = typename ::Tpetra::Map<LO, GO>::node_type > + class Transfer : public Teuchos::Describable { + public: + void transfer_func(LO, GO, NT) {} + }; +} +%} + +// Below is not resolving correctly yet +//%template(TransferDefaults) Details::Transfer<>; diff --git a/Examples/test-suite/template_templated_constructors.i b/Examples/test-suite/template_templated_constructors.i new file mode 100644 index 000000000..ee9df94bb --- /dev/null +++ b/Examples/test-suite/template_templated_constructors.i @@ -0,0 +1,47 @@ +%module template_templated_constructors + +%inline %{ +namespace ConstructSpace { + +class TConstructor1 { +public: + template<typename T> TConstructor1(T val) {} + ~TConstructor1() {} +}; + +class TConstructor2 { +public: + TConstructor2() {} + template<typename T> TConstructor2(T val) {} + ~TConstructor2() {} +}; + +template<typename T> class TClass1 { +public: + template<typename Y> TClass1(Y t) {} +}; + +template<typename T> class TClass2 { +public: + TClass2() {} + template<typename Y> TClass2(Y t) {} +}; + +} +%} + +%extend ConstructSpace::TConstructor1 { + %template(TConstructor1) TConstructor1<int>; +} + +%template(TConstructor2) ConstructSpace::TConstructor2::TConstructor2<int>; + +%template(TClass1Int) ConstructSpace::TClass1<int>; +%extend ConstructSpace::TClass1<int> { + %template(TClass1Int) TClass1<double>; +} + +%template(TClass2Int) ConstructSpace::TClass2<int>; +%extend ConstructSpace::TClass2<int> { + %template(TClass2Int) TClass2<double>; +} diff --git a/Examples/test-suite/template_typedef_typedef.i b/Examples/test-suite/template_typedef_typedef.i index 30077c484..ac96b2db8 100644 --- a/Examples/test-suite/template_typedef_typedef.i +++ b/Examples/test-suite/template_typedef_typedef.i @@ -1,7 +1,7 @@ %module template_typedef_typedef // Github issue #50 -// The Object2::getBlabla2 and Object::getBlabla1 functions were not resolving to the correct template types +// The Object2::getBlabla2 and Object1::getBlabla1 functions were not resolving to the correct template types %inline%{ @@ -20,7 +20,7 @@ namespace TT{ }; }; template <typename T> - class Object:public T { + class Object1:public T { public: void getBlabla1(typename T::ABCD::CC1 c) { }; @@ -29,7 +29,7 @@ namespace TT{ class Factory { public: - typedef TT::Object<Base> CC1; + typedef TT::Object1<Base> CC1; typedef TT::Object2<Base> CC2; void getBlabla4(CC2 c) { }; @@ -38,6 +38,6 @@ class Factory { }; %} -%template(ObjectBase) TT::Object<Base>; +%template(Object1Base) TT::Object1<Base>; %template(Object2Base) TT::Object2<Base>; diff --git a/Examples/test-suite/threads_exception.i b/Examples/test-suite/threads_exception.i index b374f0ce6..caa79c78e 100644 --- a/Examples/test-suite/threads_exception.i +++ b/Examples/test-suite/threads_exception.i @@ -52,4 +52,10 @@ public: return 1; } }; + +#ifdef SWIGPYTHON_BUILTIN +bool is_python_builtin() { return true; } +#else +bool is_python_builtin() { return false; } +#endif %} diff --git a/Examples/test-suite/throw_exception.i b/Examples/test-suite/throw_exception.i index c1ad945fb..396c633a6 100644 --- a/Examples/test-suite/throw_exception.i +++ b/Examples/test-suite/throw_exception.i @@ -16,15 +16,15 @@ %inline %{ -class Error { +class CError { }; -void test_is_Error(Error *r) {} +void test_is_Error(CError *r) {} namespace Namespace { - typedef Error ErrorTypedef; - typedef const Error& ErrorRef; - typedef const Error* ErrorPtr; + typedef CError ErrorTypedef; + typedef const CError& ErrorRef; + typedef const CError* ErrorPtr; typedef int IntArray[10]; enum EnumTest { enum1, enum2 }; } @@ -36,26 +36,26 @@ public: void test_msg() throw(const char *) { throw "Dead"; } - void test_cls() throw(Error) { - throw Error(); + void test_cls() throw(CError) { + throw CError(); } - void test_cls_ptr() throw(Error *) { - static Error StaticError; + void test_cls_ptr() throw(CError *) { + static CError StaticError; throw &StaticError; } - void test_cls_ref() throw(Error &) { - static Error StaticError; + void test_cls_ref() throw(CError &) { + static CError StaticError; throw StaticError; } void test_cls_td() throw(Namespace::ErrorTypedef) { - throw Error(); + throw CError(); } void test_cls_ptr_td() throw(Namespace::ErrorPtr) { - static Error StaticError; + static CError StaticError; throw &StaticError; } void test_cls_ref_td() throw(Namespace::ErrorRef) { - static Error StaticError; + static CError StaticError; throw StaticError; } void test_array() throw(Namespace::IntArray) { @@ -68,10 +68,10 @@ public: void test_enum() throw(Namespace::EnumTest) { throw Namespace::enum2; } - void test_multi(int x) throw(int, const char *, Error) { + void test_multi(int x) throw(int, const char *, CError) { if (x == 1) throw 37; if (x == 2) throw "Dead"; - if (x == 3) throw Error(); + if (x == 3) throw CError(); } }; diff --git a/Examples/test-suite/typemap_array_qualifiers.i b/Examples/test-suite/typemap_array_qualifiers.i index 14df649d3..cbc6c95ff 100644 --- a/Examples/test-suite/typemap_array_qualifiers.i +++ b/Examples/test-suite/typemap_array_qualifiers.i @@ -43,8 +43,8 @@ $1 = 0; /* Correct typemap for $symname: $type */ } %inline %{ - void func1a(myarray x) {}; - void func1b(volatile myarray x) {}; + void func1a(myarray x) {} + void func1b(volatile myarray x) {} %} CLEAR_SWIGTYPE_TYPEMAPS; @@ -57,9 +57,9 @@ $1 = 0; /* Correct typemap for $symname: $type */ } %inline %{ - void func2a(const myarray x) {}; - void func2b(const myconstarray x) {}; - void func2c(const volatile myconstarray x) {}; + void func2a(const myarray x) {} + void func2b(const myconstarray x) {} + void func2c(const volatile myconstarray x) {} %} CLEAR_SWIGTYPE_TYPEMAPS; @@ -72,7 +72,7 @@ $1 = 0; /* Correct typemap for $symname: $type */ } %inline %{ - void func3a(const mycrazyarray x, const mycrazyarray y[7]) {}; + void func3a(const mycrazyarray x, const mycrazyarray y[7]) {} %} CLEAR_SWIGTYPE_TYPEMAPS; @@ -81,5 +81,5 @@ $1 = 0; /* Correct typemap for $symname: $type */ } %inline %{ - void func4a(mycrazyfunc *const x, const mycrazyfuncptr y) {}; + void func4a(mycrazyfunc *const x, const mycrazyfuncptr y) {} %} diff --git a/Examples/test-suite/typemap_directorout.i b/Examples/test-suite/typemap_directorout.i index 4a85bd47c..79d0f8d94 100644 --- a/Examples/test-suite/typemap_directorout.i +++ b/Examples/test-suite/typemap_directorout.i @@ -23,7 +23,7 @@ #ifdef SWIGD %typemap(ddirectorout) MyType & %{ WILL_NOT_COMPILE %} %typemap(ddirectorout) MyType &USEME = SWIGTYPE &; -%typemap(ddirectorout) MyType &Class1::foo2, MyType &foo1 %{ /* special start */ $typemap(ddirectorout, MyType &USEME) /* special end */ %} +%typemap(ddirectorout, nativepointer="cast(void*)$dcall") MyType &Class1::foo2, MyType &foo1 %{ /* special start */ $typemap(ddirectorout, MyType &USEME) /* special end */ %} #endif #ifdef SWIGJAVA diff --git a/Examples/test-suite/typemap_variables.i b/Examples/test-suite/typemap_variables.i index 142e35060..687cae1da 100644 --- a/Examples/test-suite/typemap_variables.i +++ b/Examples/test-suite/typemap_variables.i @@ -13,33 +13,44 @@ %} #endif +// For Javascript V8 we can not use '0' for out typemaps +#if defined(SWIG_JAVASCRIPT_V8) +%header %{ +#define OUT_NULL_VALUE SWIGV8_NULL() +%} +#else +%header %{ +#define OUT_NULL_VALUE 0 +%} +#endif + // Scripting languages use varin/varout for variables (except non-static member variables where in/out are used ???) %typemap(varin) int "this_will_not_compile_varin " %typemap(varout) int "this_will_not_compile_varout" %typemap(varin) int globul "/*int globul varin */ TYPEMAP_VARIABLES_FAIL" -%typemap(varout) int globul "/*int globul varout*/ $result=0;" +%typemap(varout) int globul "/*int globul varout*/ $result=OUT_NULL_VALUE;" %typemap(varin) int Space::nspace "/*int nspace varin */ TYPEMAP_VARIABLES_FAIL" -%typemap(varout) int Space::nspace "/*int nspace varout*/ $result=0;" +%typemap(varout) int Space::nspace "/*int nspace varout*/ $result=OUT_NULL_VALUE;" //%typemap(varin) int member "/*int member varin */" -//%typemap(varout) int member "/*int member varout*/ $result=0;" +//%typemap(varout) int member "/*int member varout*/ $result=OUT_NULL_VALUE;" %typemap(varin) int Space::Struct::smember "/*int smember varin */ TYPEMAP_VARIABLES_FAIL" -%typemap(varout) int Space::Struct::smember "/*int smember varout*/ $result=0;" +%typemap(varout) int Space::Struct::smember "/*int smember varout*/ $result=OUT_NULL_VALUE;" // Statically typed languages use in/out for variables %typemap(in) int "this_will_not_compile_in " %typemap(out) int "this_will_not_compile_out" %typemap(in) int globul "/*int globul in */ $1=0;" -%typemap(out) int globul "/*int globul out*/ $result=0;" +%typemap(out) int globul "/*int globul out*/ $result=OUT_NULL_VALUE;" %typemap(in) int Space::nspace "/*int nspace in */ $1=0;" -%typemap(out) int Space::nspace "/*int nspace out*/ $result=0;" +%typemap(out) int Space::nspace "/*int nspace out*/ $result=OUT_NULL_VALUE;" %typemap(in) int member "/*int member in */ $1=0;" #ifdef SWIGTCL %typemap(out) int member "/*int member out*/" #else -%typemap(out) int member "/*int member out*/ $result=0;" +%typemap(out) int member "/*int member out*/ $result=OUT_NULL_VALUE;" #endif %typemap(in) int Space::Struct::smember "/*int smember in */ $1=0;" -%typemap(out) int Space::Struct::smember "/*int smember out*/ $result=0;" +%typemap(out) int Space::Struct::smember "/*int smember out*/ $result=OUT_NULL_VALUE;" %typemap(javain) int "this_will_not_compile_javain " %typemap(javaout) int "this_will_not_compile_javaout" diff --git a/Examples/test-suite/uffi/Makefile.in b/Examples/test-suite/uffi/Makefile.in index 8ad153961..275778c87 100644 --- a/Examples/test-suite/uffi/Makefile.in +++ b/Examples/test-suite/uffi/Makefile.in @@ -5,6 +5,7 @@ LANGUAGE = uffi UFFI = @UFFIBIN@ SCRIPTSUFFIX = _runme.lisp + srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ @@ -14,13 +15,13 @@ include $(srcdir)/../common.mk # Overridden variables here # no C++ tests for now CPP_TEST_CASES = -#C_TEST_CASES += +#C_TEST_CASES += # Custom tests - tests with additional commandline options # none! # Rules for the different types of tests -%.cpptest: +%.cpptest: $(setup) +$(swig_and_compile_cpp) $(run_testcase) @@ -30,7 +31,7 @@ CPP_TEST_CASES = +$(swig_and_compile_c) $(run_testcase) -%.multicpptest: +%.multicpptest: $(setup) +$(swig_and_compile_multi_cpp) $(run_testcase) @@ -38,14 +39,13 @@ CPP_TEST_CASES = # Runs the testcase. A testcase is only run if # a file is found which has _runme.lisp appended after the testcase name. run_testcase = \ - if [ -f $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ - env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(UFFI) -batch -s $(srcdir)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ + if [ -f $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX) ]; then \ + env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH $(RUNTOOL) $(UFFI) -batch -s $(SCRIPTDIR)/$(SCRIPTPREFIX)$*$(SCRIPTSUFFIX); \ fi # Clean: (does nothing, we dont generate extra uffi code) %.clean: - + @exit 0 clean: - $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile uffi_clean - + $(MAKE) -f $(top_builddir)/$(EXAMPLES)/Makefile SRCDIR="$(SRCDIR)" uffi_clean diff --git a/Examples/test-suite/unicode_strings.i b/Examples/test-suite/unicode_strings.i new file mode 100644 index 000000000..56063c8a4 --- /dev/null +++ b/Examples/test-suite/unicode_strings.i @@ -0,0 +1,15 @@ +%module unicode_strings + +%include <std_string.i> + +%inline %{ + +const char* non_utf8_c_str(void) { + return "h\xe9llo w\xc3\xb6rld"; +} + +std::string non_utf8_std_string(void) { + return std::string("h\xe9llo w\xc3\xb6rld"); +} + +%} |