Merge remote-tracking branch 'origin/master' into gsoc2012-scilab

Conflicts:
	Examples/Makefile.in
This commit is contained in:
Sylvestre Ledru 2013-08-06 10:06:31 +02:00
commit 21e17eaa73
795 changed files with 16905 additions and 11792 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,3 +1,4 @@
# see top-level Makefile.in
class
extend
simple

View file

@ -2,28 +2,25 @@ TOP = ../..
SWIG = $(TOP)/../preinst-swig
TARGET = example
INTERFACE = example.i
INTERFACEDIR = jni/
PACKAGEDIR = src/org/swig
PACKAGENAME= org.swig.classexample
SWIGOPT = -package $(PACKAGENAME) -outdir $(PACKAGEDIR)/classexample
PROJECTNAME= SwigClass
TARGETID = 1
#INSTALLOPTIONS = -s # To install on SD Card
all:: android
check: build
android::
android update project --target $(TARGETID) --name $(PROJECTNAME) --path .
$(SWIG) -c++ -java $(SWIGOPT) -o jni/$(TARGET)_wrap.cpp jni/$(INTERFACE)
ndk-build
ant debug
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' INTERFACEDIR='$(INTERFACEDIR)' \
PROJECTNAME='$(PROJECTNAME)' TARGETID='$(TARGETID)' android_cpp
install::
-adb uninstall $(PACKAGENAME)
adb install bin/$(PROJECTNAME)-debug.apk
install:
$(MAKE) -f $(TOP)/Makefile INSTALLOPTIONS='$(INSTALLOPTIONS)' PROJECTNAME='$(PROJECTNAME)' \
PACKAGEDIR='$(PACKAGEDIR)' PACKAGENAME='$(PACKAGENAME)' android_install
clean::
ant clean
rm -f jni/$(TARGET)_wrap.cpp
rm -f `find $(PACKAGEDIR) -name \*.java | grep -v $(PROJECTNAME).java`
check: all
clean:
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' PROJECTNAME='$(PROJECTNAME)' \
PACKAGEDIR='$(PACKAGEDIR)' INTERFACEDIR='$(INTERFACEDIR)' android_clean

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.swig.extendexample"
android:versionCode="1"
android:versionName="1.0">
<application android:label="@string/app_name" >
<activity android:name="SwigExtend"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

View file

@ -0,0 +1,26 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
TARGET = example
INTERFACE = example.i
INTERFACEDIR = jni/
PACKAGEDIR = src/org/swig
PACKAGENAME= org.swig.extendexample
SWIGOPT = -package $(PACKAGENAME) -outdir $(PACKAGEDIR)/extendexample
PROJECTNAME= SwigExtend
TARGETID = 1
#INSTALLOPTIONS = -s # To install on SD Card
check: build
build:
$(MAKE) -f $(TOP)/Makefile 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)' \
PACKAGEDIR='$(PACKAGEDIR)' PACKAGENAME='$(PACKAGENAME)' android_install
clean:
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' PROJECTNAME='$(PROJECTNAME)' \
PACKAGEDIR='$(PACKAGEDIR)' INTERFACEDIR='$(INTERFACEDIR)' android_clean

View file

@ -0,0 +1,17 @@
# This file is used to override default values used by the Ant build system.
#
# This file must be checked in Version Control Systems, as it is
# integral to the build system of your project.
# This file is only used by the Ant script.
# You can use this to override default values such as
# 'source.dir' for the location of your java source folder and
# 'out.dir' for the location of your output folder.
# You can also use it define how the release builds are signed by declaring
# the following properties:
# 'key.store' for the location of your keystore and
# 'key.alias' for the name of the key to use.
# The password will be asked during the build when you use the 'release' target.

View file

@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="SwigExtend" default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contains the path to the SDK. It should *NOT* be checked into
Version Control Systems. -->
<loadproperties srcFile="local.properties" />
<!-- The ant.properties file can be created by you. It is only edited by the
'android' tool to add properties to it.
This is the place to change some Ant specific build properties.
Here are some properties you may want to change/update:
source.dir
The name of the source directory. Default is 'src'.
out.dir
The name of the output directory. Default is 'bin'.
For other overridable properties, look at the beginning of the rules
files in the SDK, at tools/ant/build.xml
Properties related to the SDK location or the project target should
be updated using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your
application and should be checked into Version Control Systems.
-->
<property file="ant.properties" />
<!-- The project.properties file is created and updated by the 'android'
tool, as well as ADT.
This contains project specific properties such as project target, and library
dependencies. Lower level build properties are stored in ant.properties
(or in .classpath for Eclipse projects).
This file is an integral part of the build system for your
application and should be checked into Version Control Systems. -->
<loadproperties srcFile="project.properties" />
<!-- quick check on sdk.dir -->
<fail
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project'"
unless="sdk.dir"
/>
<!-- extension targets. Uncomment the ones where you want to do custom work
in between standard targets -->
<!--
<target name="-pre-build">
</target>
<target name="-pre-compile">
</target>
/* This is typically used for code obfuscation.
Compiled code location: ${out.classes.absolute.dir}
If this is not done in place, override ${out.dex.input.absolute.dir} */
<target name="-post-compile">
</target>
-->
<!-- Import the actual build file.
To customize existing targets, there are two options:
- Customize only one target:
- copy/paste the target into this file, *before* the
<import> task.
- customize it to your needs.
- Customize the whole content of build.xml
- copy/paste the content of the rules files (minus the top node)
into this file, replacing the <import> task.
- customize to your needs.
***********************
****** IMPORTANT ******
***********************
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
in order to avoid having your file be overridden by tools such as "android update project"
-->
<!-- version-tag: 1 -->
<import file="${sdk.dir}/tools/ant/build.xml" />
</project>

View file

@ -0,0 +1,10 @@
# File: Android.mk
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := example
LOCAL_SRC_FILES := example_wrap.cpp example.cpp
LOCAL_CFLAGS := -frtti
include $(BUILD_SHARED_LIBRARY)

View file

@ -0,0 +1,2 @@
# File: Application.mk
APP_STL := gnustl_static

View file

@ -0,0 +1,14 @@
/* File : example.cxx */
#include "example.h"
static Streamer * streamerInstance = 0;
void setStreamer(Streamer* streamer) {
streamerInstance = streamer;
}
Streamer& getStreamer() {
return *streamerInstance;
}

View file

@ -0,0 +1,71 @@
/* File : example.h */
#include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <sstream>
struct Streamer {
virtual void display(std::string text) const = 0;
virtual ~Streamer() {}
};
void setStreamer(Streamer* streamer);
Streamer& getStreamer();
template<typename T> Streamer& operator<<(Streamer& stream, T const& val) {
std::ostringstream s;
s << val;
stream.display(s.str());
return stream;
}
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() { getStreamer() << "~Employee() @ " << this << "\n"; }
};
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);
getStreamer() << "New employee added. Current employees are:" << "\n";
std::vector<Employee*>::iterator i;
for (i=list.begin(); i!=list.end(); i++) {
getStreamer() << " " << (*i)->getTitle() << "\n";
}
}
const Employee *get_item(int i) {
return list[i];
}
~EmployeeList() {
std::vector<Employee*>::iterator i;
getStreamer() << "~EmployeeList, deleting " << list.size() << " employees." << "\n";
for (i=list.begin(); i!=list.end(); i++) {
delete *i;
}
getStreamer() << "~EmployeeList empty." << "\n";
}
};

View file

@ -0,0 +1,18 @@
/* 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;
/* A base class for callbacks from C++ to output text on the Java side */
%feature("director") Streamer;
%include "example.h"

View file

@ -0,0 +1,10 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must *NOT* be checked in Version Control Systems,
# as it contains information specific to your local configuration.
# location of the SDK. This is only used by Ant
# For customization when using a Version Control System, please read the
# header note.
sdk.dir=/home/william/android/android-sdk-linux_x86

View file

@ -0,0 +1,40 @@
-optimizationpasses 5
-dontusemixedcaseclassnames
-dontskipnonpubliclibraryclasses
-dontpreverify
-verbose
-optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-keep public class * extends android.app.Activity
-keep public class * extends android.app.Application
-keep public class * extends android.app.Service
-keep public class * extends android.content.BroadcastReceiver
-keep public class * extends android.content.ContentProvider
-keep public class * extends android.app.backup.BackupAgentHelper
-keep public class * extends android.preference.Preference
-keep public class com.android.vending.licensing.ILicensingService
-keepclasseswithmembernames class * {
native <methods>;
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet);
}
-keepclasseswithmembers class * {
public <init>(android.content.Context, android.util.AttributeSet, int);
}
-keepclassmembers class * extends android.app.Activity {
public void *(android.view.View);
}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
-keep class * implements android.os.Parcelable {
public static final android.os.Parcelable$Creator *;
}

View file

@ -0,0 +1,11 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "ant.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=android-8

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button
android:id="@+id/RunButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Run..."
android:onClick="onRunButtonClick"
/>
<ScrollView
android:id="@+id/Scroller"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:id="@+id/OutputText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
</ScrollView>
</LinearLayout>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">SwigExtend</string>
</resources>

View file

@ -0,0 +1,129 @@
package org.swig.extendexample;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.ScrollView;
import android.text.method.ScrollingMovementMethod;
// CEO class, which overrides Employee::getPosition().
class CEO extends Manager {
public CEO(String name) {
super(name);
}
public String getPosition() {
return "CEO";
}
// Public method to stop the SWIG proxy base class from thinking it owns the underlying C++ memory.
public void disownMemory() {
swigCMemOwn = false;
}
}
public class SwigExtend extends Activity
{
TextView outputText = null;
ScrollView scroller = null;
/** Handles upcalls from C++ so that C++ code can display text on the TextView */
class TextViewStreamer extends Streamer {
public void display(String text) {
outputText.append(text);
}
}
TextViewStreamer textViewStreamer = new TextViewStreamer();
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
outputText = (TextView)findViewById(R.id.OutputText);
outputText.setText("Press 'Run' to start...\n");
outputText.setMovementMethod(new ScrollingMovementMethod());
scroller = (ScrollView)findViewById(R.id.Scroller);
example.setStreamer(textViewStreamer);
}
public void onRunButtonClick(View view)
{
outputText.append("Started...\n");
nativeCall();
outputText.append("Finished!\n");
// Ensure scroll to end of text
scroller.post(new Runnable() {
public void run() {
scroller.fullScroll(ScrollView.FOCUS_DOWN);
}
});
}
/** Calls into C/C++ code */
public void nativeCall()
{
// Create an instance of CEO, a class derived from the Java proxy of the
// underlying C++ class. The calls to getName() and getPosition() are standard,
// the call to getTitle() uses the director wrappers to call CEO.getPosition().
CEO e = new CEO("Alice");
outputText.append( e.getName() + " is a " + e.getPosition() + "\n");
outputText.append( "Just call her \"" + e.getTitle() + "\"\n" );
outputText.append( "----------------------\n" );
// Create a new EmployeeList instance. This class does not have a C++
// director wrapper, but can be used freely with other classes that do.
EmployeeList list = new EmployeeList();
// EmployeeList owns its items, so we must surrender ownership of objects we add.
e.disownMemory();
list.addEmployee(e);
outputText.append( "----------------------\n" );
// Now we access the first four items in list (three are C++ objects that
// EmployeeList's constructor adds, the last is our CEO). The virtual
// methods of all these instances are treated the same. For items 0, 1, and
// 2, all methods resolve in C++. For item 3, our CEO, getTitle calls
// getPosition which resolves in Java. The call to getPosition is
// slightly different, however, because of the overidden getPosition() call, since
// now the object reference has been "laundered" by passing through
// EmployeeList as an Employee*. Previously, Java resolved the call
// immediately in CEO, but now Java thinks the object is an instance of
// class Employee. So the call passes through the
// Employee proxy class and on to the C wrappers and C++ director,
// eventually ending up back at the Java CEO implementation of getPosition().
// The call to getTitle() for item 3 runs the C++ Employee::getTitle()
// method, which in turn calls getPosition(). This virtual method call
// passes down through the C++ director class to the Java implementation
// in CEO. All this routing takes place transparently.
outputText.append( "(position, title) for items 0-3:\n" );
outputText.append( " " + list.get_item(0).getPosition() + ", \"" + list.get_item(0).getTitle() + "\"\n" );
outputText.append( " " + list.get_item(1).getPosition() + ", \"" + list.get_item(1).getTitle() + "\"\n" );
outputText.append( " " + list.get_item(2).getPosition() + ", \"" + list.get_item(2).getTitle() + "\"\n" );
outputText.append( " " + list.get_item(3).getPosition() + ", \"" + list.get_item(3).getTitle() + "\"\n" );
outputText.append( "----------------------\n" );
// Time to delete the EmployeeList, which will delete all the Employee*
// items it contains. The last item is our CEO, which gets destroyed as well.
list.delete();
outputText.append( "----------------------\n" );
}
/** static constructor */
static {
System.loadLibrary("example");
}
}

View file

@ -2,28 +2,25 @@ TOP = ../..
SWIG = $(TOP)/../preinst-swig
TARGET = example
INTERFACE = example.i
INTERFACEDIR = jni/
PACKAGEDIR = src/org/swig
PACKAGENAME= org.swig.simple
SWIGOPT = -package $(PACKAGENAME) -outdir $(PACKAGEDIR)/simple
PROJECTNAME= SwigSimple
TARGETID = 1
#INSTALLOPTIONS = -s # To install on SD Card
all:: android
check: build
android::
android update project --target $(TARGETID) --name $(PROJECTNAME) --path .
$(SWIG) -java $(SWIGOPT) -o jni/$(TARGET)_wrap.c jni/$(INTERFACE)
ndk-build
ant debug
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' SWIGOPT='$(SWIGOPT)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' INTERFACEDIR='$(INTERFACEDIR)' \
PROJECTNAME='$(PROJECTNAME)' TARGETID='$(TARGETID)' android
install::
-adb uninstall $(PACKAGENAME)
adb install bin/$(PROJECTNAME)-debug.apk
install:
$(MAKE) -f $(TOP)/Makefile INSTALLOPTIONS='$(INSTALLOPTIONS)' PROJECTNAME='$(PROJECTNAME)' \
PACKAGEDIR='$(PACKAGEDIR)' PACKAGENAME='$(PACKAGENAME)' android_install
clean::
ant clean
rm -f jni/$(TARGET)_wrap.c
rm -f `find $(PACKAGEDIR) -name \*.java | grep -v $(PROJECTNAME).java`
check: all
clean:
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' PROJECTNAME='$(PROJECTNAME)' \
PACKAGEDIR='$(PACKAGEDIR)' INTERFACEDIR='$(INTERFACEDIR)' android_clean

View file

@ -10,29 +10,29 @@ CFLAGS =
VARIANT =
# uncomment the following lines to build a static exe (only pick one of the CHICKEN_MAIN lines)
#CHICKEN_MAIN = test-lowlevel-class.scm
#CHICKEN_MAIN = test-tinyclos-class.scm
#CHICKEN_MAIN = runme-lowlevel.scm
#CHICKEN_MAIN = runme-tinyclos.scm
#VARIANT = _static
all:: $(TARGET) $(TARGET)_proxy
check: build
$(MAKE) -f $(TOP)/Makefile CHICKEN_SCRIPT='runme-lowlevel.scm' chicken_run
$(MAKE) -f $(TOP)/Makefile CHICKEN_SCRIPT='runme-tinyclos.scm' chicken_run
build: $(TARGET) $(TARGET)_proxy
$(TARGET): $(INTERFACE) $(SRCS)
$(MAKE) -f $(TOP)/Makefile \
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)_cpp
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 \
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
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::
clean:
$(MAKE) -f $(TOP)/Makefile chicken_clean
rm -f example.scm
rm -f $(TARGET)
check::
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH csi test-lowlevel-class.scm
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH csi test-tinyclos-class.scm

View file

@ -10,21 +10,21 @@ CFLAGS =
VARIANT =
# uncomment the following two lines to build a static exe
#CHICKEN_MAIN = test-constants.scm
#CHICKEN_MAIN = runme.scm
#VARIANT = _static
all:: $(TARGET)
check: build
$(MAKE) -f $(TOP)/Makefile chicken_run
build: $(TARGET)
$(TARGET): $(INTERFACE) $(SRCS)
$(MAKE) -f $(TOP)/Makefile \
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
clean::
clean:
$(MAKE) -f $(TOP)/Makefile chicken_clean
rm -f example.scm
rm -f $(TARGET)
check::
csi test-constants.scm

View file

@ -1,6 +1,9 @@
SWIG = ../../../preinst-swig
all: single multi
check: build
cd eggs/install && csi ../../test.scm
build: single multi
# This creates an egg which contains only the single module. Any additional implementation files
# that implement the interface being wrapped should also be added to this egg
@ -9,7 +12,7 @@ single: single_wrap.cxx
tar czf eggs/single.egg single.setup single.scm single_wrap.cxx
rm -f single.scm single_wrap.cxx
# complie the single module with -nounit
# compile the single module with -nounit
single_wrap.cxx: single.i
$(SWIG) -chicken -c++ -proxy -nounit single.i
@ -34,6 +37,3 @@ setup:
mkdir -p install && \
chicken-setup -repository `pwd`/install single.egg && \
chicken-setup -repository `pwd`/install multi.egg
check:
cd eggs/install && csi ../../test.scm

View file

@ -10,21 +10,21 @@ CFLAGS =
VARIANT =
# uncomment the following two lines to build a static exe
#CHICKEN_MAIN = test-multimap.scm
#CHICKEN_MAIN = runme.scm
#VARIANT = _static
all:: $(TARGET)
check: build
$(MAKE) -f $(TOP)/Makefile chicken_run
build: $(TARGET)
$(TARGET): $(INTERFACE) $(SRCS)
$(MAKE) -f $(TOP)/Makefile \
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
clean::
clean:
$(MAKE) -f $(TOP)/Makefile chicken_clean
rm -f example.scm
rm -f $(TARGET)
check::
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH csi test-multimap.scm

View file

@ -1,4 +1,3 @@
;; run with './multimap test-multimap.scm'
;; feel free to uncomment and comment sections
(load-library 'example "multimap.so")

View file

@ -10,21 +10,21 @@ CFLAGS =
VARIANT =
# uncomment the following lines to build a static exe
#CHICKEN_MAIN = test-overload.scm
#CHICKEN_MAIN = runme.scm
#VARIANT = _static
all:: $(TARGET)
check: build
$(MAKE) -f $(TOP)/Makefile chicken_run
build: $(TARGET)
$(TARGET): $(INTERFACE) $(SRCS)
$(MAKE) -f $(TOP)/Makefile \
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)_cpp
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)_cpp
clean::
clean:
$(MAKE) -f $(TOP)/Makefile chicken_clean
rm -f example.scm
rm -f $(TARGET)
check::
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH csi test-overload.scm

View file

@ -10,21 +10,21 @@ CFLAGS =
VARIANT =
# uncomment the following two lines to build a static exe
#CHICKEN_MAIN = test-simple.scm
#CHICKEN_MAIN = runme.scm
#VARIANT = _static
all:: $(TARGET)
check: build
$(MAKE) -f $(TOP)/Makefile chicken_run
build: $(TARGET)
$(TARGET): $(INTERFACE) $(SRCS)
$(MAKE) -f $(TOP)/Makefile \
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
SRCS='$(SRCS)' CXXSRCS='$(CXXSRCS)' CHICKEN_MAIN='$(CHICKEN_MAIN)' \
INCLUDE='$(INCLUDE)' SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' \
SWIG='$(SWIG)' INTERFACE='$(INTERFACE)' CHICKENOPTS='$(CHICKENOPTS)' chicken$(VARIANT)
clean::
clean:
$(MAKE) -f $(TOP)/Makefile chicken_clean
rm -f example.scm example-generic.scm example-clos.scm
rm -f $(TARGET)
check::
env LD_LIBRARY_PATH=.:$$LD_LIBRARY_PATH csi test-simple.scm

View file

@ -7,14 +7,13 @@ SWIGOPT =
CSHARPSRCS = *.cs
CSHARPFLAGS= -nologo -unsafe -out:runme.exe
all:: csharp
check: build
$(MAKE) -f $(TOP)/Makefile csharp_run
csharp::
build:
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp
$(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
clean::
clean:
$(MAKE) -f $(TOP)/Makefile csharp_clean
check: all

View file

@ -7,14 +7,13 @@ SWIGOPT =
CSHARPSRCS = *.cs
CSHARPFLAGS= -debug -nologo -out:runme.exe
all:: csharp
check: build
$(MAKE) -f $(TOP)/Makefile csharp_run
csharp::
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp_cpp
$(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
clean::
clean:
$(MAKE) -f $(TOP)/Makefile csharp_clean
check: all

View file

@ -7,14 +7,13 @@ SWIGOPT =
CSHARPSRCS = *.cs
CSHARPFLAGS= -nologo -out:runme.exe
all:: csharp
check: build
$(MAKE) -f $(TOP)/Makefile csharp_run
csharp::
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp_cpp
$(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
clean::
clean:
$(MAKE) -f $(TOP)/Makefile csharp_clean
check: all

View file

@ -7,14 +7,13 @@ SWIGOPT =
CSHARPSRCS = *.cs
CSHARPFLAGS= -nologo -out:runme.exe
all:: csharp
check: build
$(MAKE) -f $(TOP)/Makefile csharp_run
csharp::
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp_cpp
$(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
clean::
clean:
$(MAKE) -f $(TOP)/Makefile csharp_clean
check: all

View file

@ -7,14 +7,13 @@ SWIGOPT =
CSHARPSRCS = *.cs
CSHARPFLAGS= -nologo -out:runme.exe
all:: csharp
check: build
$(MAKE) -f $(TOP)/Makefile csharp_run
csharp::
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp_cpp
$(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
clean::
clean:
$(MAKE) -f $(TOP)/Makefile csharp_clean
check: all

View file

@ -7,14 +7,13 @@ SWIGOPT =
CSHARPSRCS = *.cs
CSHARPFLAGS= -nologo -out:runme.exe
all:: csharp
check: build
$(MAKE) -f $(TOP)/Makefile csharp_run
csharp::
build:
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp
$(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
clean::
clean:
$(MAKE) -f $(TOP)/Makefile csharp_clean
check: all

View file

@ -7,14 +7,13 @@ SWIGOPT =
CSHARPSRCS = *.cs
CSHARPFLAGS= -nologo -out:runme.exe
all:: csharp
check: build
$(MAKE) -f $(TOP)/Makefile csharp_run
csharp::
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp_cpp
$(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
clean::
clean:
$(MAKE) -f $(TOP)/Makefile csharp_clean
check: all

View file

@ -7,14 +7,13 @@ SWIGOPT =
CSHARPSRCS = *.cs
CSHARPFLAGS= -nologo -out:runme.exe
all:: csharp
check: build
$(MAKE) -f $(TOP)/Makefile csharp_run
csharp::
build:
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp
$(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
clean::
clean:
$(MAKE) -f $(TOP)/Makefile csharp_clean
check: all

View file

@ -7,14 +7,13 @@ SWIGOPT =
CSHARPSRCS = *.cs
CSHARPFLAGS= -nologo -out:runme.exe
all:: csharp
check: build
$(MAKE) -f $(TOP)/Makefile csharp_run
csharp::
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp_cpp
$(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
clean::
clean:
$(MAKE) -f $(TOP)/Makefile csharp_clean
check: all

View file

@ -7,14 +7,13 @@ SWIGOPT =
CSHARPSRCS = *.cs
CSHARPFLAGS= -nologo -out:runme.exe
all:: csharp
check: build
$(MAKE) -f $(TOP)/Makefile csharp_run
csharp::
build:
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' csharp
$(MAKE) -f $(TOP)/Makefile CSHARPSRCS='$(CSHARPSRCS)' CSHARPFLAGS='$(CSHARPFLAGS)' csharp_compile
clean::
clean:
$(MAKE) -f $(TOP)/Makefile csharp_clean
check: all

View file

@ -13,18 +13,15 @@ SWIGOPT =
DSRCS = *.d
DFLAGS = -ofrunme
check: build
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_run
all:: d
d::
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::
clean:
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_clean
check: all
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_run

View file

@ -13,18 +13,15 @@ SWIGOPT =
DSRCS = *.d
DFLAGS = -ofrunme
check: build
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_run
all:: d
d::
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::
clean:
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_clean
check: all
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_run

View file

@ -13,18 +13,15 @@ SWIGOPT =
DSRCS = *.d
DFLAGS = -ofrunme
check: build
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_run
all:: d
d::
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::
clean:
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_clean
check: all
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_run

View file

@ -13,18 +13,15 @@ SWIGOPT =
DSRCS = *.d
DFLAGS = -ofrunme
check: build
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_run
all:: d
d::
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::
clean:
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_clean
check: all
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_run

View file

@ -13,18 +13,15 @@ SWIGOPT =
DSRCS = *.d
DFLAGS = -ofrunme
check: build
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_run
all:: d
d::
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::
clean:
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_clean
check: all
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_run

View file

@ -13,18 +13,15 @@ SWIGOPT =
DSRCS = *.d
DFLAGS = -ofrunme
check: build
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_run
all:: d
d::
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::
clean:
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_clean
check: all
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_run

View file

@ -13,18 +13,15 @@ SWIGOPT =
DSRCS = *.d
DFLAGS = -ofrunme
check: build
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_run
all:: d
d::
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::
clean:
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_clean
check: all
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_run

View file

@ -13,18 +13,15 @@ SWIGOPT =
DSRCS = *.d
DFLAGS = -ofrunme
check: build
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_run
all:: d
d::
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::
clean:
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_clean
check: all
cd $(WORKING_DIR); \
$(MAKE) -f $(TOP)/Makefile d_run

View file

@ -5,14 +5,12 @@ TARGET = example
INTERFACE = example.i
SWIGOPT =
all:: go
check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
go::
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_cpp
clean::
$(MAKE) -f $(TOP)/Makefile go_clean
check: all
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
clean:
$(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean

View file

@ -5,12 +5,12 @@ TARGET = example
INTERFACE = example.i
LIBS = -lm
all::
check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_cpp
clean::
$(MAKE) -f $(TOP)/Makefile go_clean
check: all
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
clean:
$(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean

View file

@ -5,12 +5,12 @@ TARGET = example
INTERFACE = example.i
SWIGOPT =
all::
check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go
clean::
$(MAKE) -f $(TOP)/Makefile go_clean
check: all
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
clean:
$(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean

View file

@ -5,14 +5,12 @@ TARGET = example
INTERFACE = example.i
SWIGOPT =
all:: go
check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
go::
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_cpp
clean::
$(MAKE) -f $(TOP)/Makefile go_clean
check: all
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
clean:
$(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean

View file

@ -5,14 +5,12 @@ TARGET = example
INTERFACE = example.i
SWIGOPT =
all:: go
check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
go::
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_cpp
clean::
$(MAKE) -f $(TOP)/Makefile go_clean
check: all
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
clean:
$(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean

View file

@ -5,14 +5,12 @@ TARGET = example
INTERFACE = example.i
SWIGOPT =
all:: go
check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
go::
build:
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go
clean::
$(MAKE) -f $(TOP)/Makefile go_clean
check: all
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
clean:
$(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean

View file

@ -5,14 +5,12 @@ TARGET = example
INTERFACE = example.i
SWIGOPT =
all:: go
check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
go::
build:
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go
clean::
$(MAKE) -f $(TOP)/Makefile go_clean
check: all
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
clean:
$(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean

View file

@ -5,14 +5,12 @@ TARGET = example
INTERFACE = example.i
SWIGOPT =
all:: go
check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
go::
build:
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go
clean::
$(MAKE) -f $(TOP)/Makefile go_clean
check: all
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
clean:
$(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean

View file

@ -5,14 +5,12 @@ TARGET = example
INTERFACE = example.i
SWIGOPT =
all:: go
check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
go::
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_cpp
clean::
$(MAKE) -f $(TOP)/Makefile go_clean
check: all
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
clean:
$(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean

View file

@ -4,12 +4,12 @@ SRCS = example.c
TARGET = example
INTERFACE = example.i
all::
check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
build:
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go
clean::
$(MAKE) -f $(TOP)/Makefile go_clean
check: all
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
clean:
$(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean

View file

@ -5,14 +5,12 @@ TARGET = example
INTERFACE = example.i
SWIGOPT =
all:: go
check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
go::
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_cpp
clean::
$(MAKE) -f $(TOP)/Makefile go_clean
check: all
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
clean:
$(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean

View file

@ -5,14 +5,12 @@ TARGET = example
INTERFACE = example.i
SWIGOPT =
all:: go
check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
go::
build:
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go
clean::
$(MAKE) -f $(TOP)/Makefile go_clean
check: all
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' go_run
clean:
$(MAKE) -f $(TOP)/Makefile INTERFACE='$(INTERFACE)' go_clean

View file

@ -1,40 +0,0 @@
# Makefile for Guile. Used by all of the example programs.
subdirs = simple matrix port constants multimap multivalue
top_srcdir = @top_srcdir@
SWIG = ../$(top_srcdir)/preinst-swig
CC = @CC@
CXX = @CXX@
CFLAGS = @PLATFLAGS@
GUILEINCLUDE = @GUILEINCLUDE@
GUILELINK = @GUILELINK@
SWIGOPT =
WRAP = $(IFILE:.i=_wrap.c)
CXXWRAP = $(IFILE:.i=_wrap.cxx)
SO = @SO@
all:
for d in $(subdirs) ; do (cd $$d ; $(MAKE)) ; done
clean::
for d in $(subdirs) ; do (cd $$d ; $(MAKE) clean) ; done
rm -f *~ .~*
guile_clean:
rm -f *.@OBJEXT@ *$(SO) *_wrap* *~ .~* core my-guile $(TARGET)
# This is meant to be used w/ "make -f ../Makefile" from subdirs.
# Doesn't make sense to use it from here.
sub-all::
$(SWIG) -guile $(SWIGOPT) $(IFILE)
$(CC) $(CFLAGS) -o $(TARGET) $(SRCS) $(WRAP) $(GUILEINCLUDE) $(GUILELINK)
sub-all-cxx::
$(SWIG) -c++ -guile $(SWIGOPT) $(IFILE)
$(CXX) $(CFLAGS) -o $(TARGET) $(SRCS) $(CXXWRAP) $(GUILEINCLUDE) $(GUILELINK)
# Makefile ends here

View file

@ -1,6 +1,7 @@
This directory contains examples for Guile.
constants -- handling #define and %constant literals
class -- classic c++ class example
matrix -- a very simple Matrix example
multimap -- typemaps with multiple sub-types
multivalue -- using the %values_as_list directive

View file

@ -1,6 +1,9 @@
# see top-level Makefile.in
constants
simple
class
port
simple
std_vector
matrix
multimap
multivalue

View file

@ -0,0 +1,19 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
check: build
$(MAKE) -f $(TOP)/Makefile guile_run
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_cpp
static:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
TARGET='my-guile' INTERFACE='$(INTERFACE)' guile_static_cpp
clean:
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean

View file

@ -0,0 +1,28 @@
/* File : example.c */
#include "example.h"
#define M_PI 3.14159265358979323846
/* Move the shape to a new location */
void Shape::move(double dx, double dy) {
x += dx;
y += dy;
}
int Shape::nshapes = 0;
double Circle::area(void) {
return M_PI*radius*radius;
}
double Circle::perimeter(void) {
return 2*M_PI*radius;
}
double Square::area(void) {
return width*width;
}
double Square::perimeter(void) {
return 4*width;
}

View file

@ -0,0 +1,34 @@
/* File : example.h */
class Shape {
public:
Shape() {
nshapes++;
}
virtual ~Shape() {
nshapes--;
};
double x, y;
void move(double dx, double dy);
virtual double area(void) = 0;
virtual double perimeter(void) = 0;
static int nshapes;
};
class Circle : public Shape {
private:
double radius;
public:
Circle(double r) : radius(r) { };
virtual double area(void);
virtual double perimeter(void);
};
class Square : public Shape {
private:
double width;
public:
Square(double w) : width(w) { };
virtual double area(void);
virtual double perimeter(void);
};

View file

@ -0,0 +1,9 @@
/* File : example.i */
%module example
%{
#include "example.h"
%}
/* Let's just grab the original header file here */
%include "example.h"

View file

@ -0,0 +1,60 @@
; file: runme.scm
; This file illustrates the proxy class C++ interface generated
; by SWIG.
(load-extension "./libexample" "scm_init_example_module")
; Convenience wrapper around the display function
; (which only accepts one argument at the time)
(define (mdisplay-newline . args)
(for-each display args)
(newline))
; ----- Object creation -----
(mdisplay-newline "Creating some objects:")
(define c (new-Circle 10))
(mdisplay-newline " Created circle " c)
(define s (new-Square 10))
(mdisplay-newline " Created square " s)
; ----- Access a static member -----
(mdisplay-newline "\nA total of " (Shape-nshapes) " shapes were created")
; ----- Member data access -----
; Set the location of the object
(Shape-x-set c 20)
(Shape-y-set c 30)
(Shape-x-set s -10)
(Shape-y-set s 5)
(mdisplay-newline "\nHere is their current position:")
(mdisplay-newline " Circle = (" (Shape-x-get c) "," (Shape-y-get c) ")")
(mdisplay-newline " Square = (" (Shape-x-get s) "," (Shape-y-get s) ")")
; ----- Call some methods -----
(mdisplay-newline "\nHere are some properties of the shapes:")
(define (shape-props o)
(mdisplay-newline " " o)
(mdisplay-newline " area = " (Shape-area o))
(mdisplay-newline " perimeter = " (Shape-perimeter o)))
(for-each shape-props (list c s))
(mdisplay-newline "\nGuess I'll clean up now")
; Note: this invokes the virtual destructor
(delete-Shape c)
(delete-Shape s)
(define s 3)
(mdisplay-newline (Shape-nshapes) " shapes remain")
(mdisplay-newline "Goodbye")
(exit 0)

View file

@ -1,17 +1,15 @@
SRCS =
TARGET = my-guile
IFILE = example.i
MKDIR = ..
TOP = ../..
SWIG = $(TOP)/../preinst-swig
SRCS =
TARGET = my-guile
INTERFACE = example.i
all::
$(MAKE) -f $(MKDIR)/Makefile \
SRCS='$(SRCS)' \
TARGET=$(TARGET) \
IFILE=$(IFILE) \
sub-all
check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_augmented_run
clean::
$(MAKE) -f $(MKDIR)/Makefile TARGET='$(TARGET)' guile_clean
build:
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_augmented
check: all
./my-guile -s constants.scm
clean:
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean

View file

@ -1,10 +0,0 @@
(or (= (ICONST) 42) (exit 1))
(or (< (abs (- (FCONST) 2.1828)) 0.00001) (exit 1))
(or (char=? (CCONST) #\x) (exit 1))
(or (char=? (CCONST2) #\newline) (exit 1))
(or (string=? (SCONST) "Hello World") (exit 1))
(or (string=? (SCONST2) "\"Hello World\"") (exit 1))
(or (< (abs (- (EXPR) (+ (ICONST) (* 3 (FCONST))))) 0.00001) (exit 1))
(or (= (iconst) 37) (exit 1))
(or (< (abs (- (fconst) 3.14)) 0.00001) (exit 1))
(exit 0)

View file

@ -0,0 +1,19 @@
(or (= (ICONST) 42) (exit 1))
(display "ICONST = ")(display (ICONST))(display " (should be 42)\n")
(or (< (abs (- (FCONST) 2.1828)) 0.00001) (exit 1))
(display "FCONST = ")(display (FCONST))(display " (should be 2.1828)\n")
(or (char=? (CCONST) #\x) (exit 1))
(display "CCONST = ")(display (CCONST))(display " (should be 'x')\n")
(or (char=? (CCONST2) #\newline) (exit 1))
(display "CCONST2 = ")(display (CCONST2))(display " (this should be on a new line)\n")
(or (string=? (SCONST) "Hello World") (exit 1))
(display "SCONST = ")(display (SCONST))(display " (should be 'Hello World')\n")
(or (string=? (SCONST2) "\"Hello World\"") (exit 1))
(display "SCONST2 = ")(display (SCONST2))(display " (should be \"Hello World\")\n")
(or (< (abs (- (EXPR) (+ (ICONST) (* 3 (FCONST))))) 0.00001) (exit 1))
(display "EXPR = ")(display (abs (- (EXPR) (+ (ICONST) (* 3 (FCONST))))))(display " (should round to 0.0)\n")
(or (= (iconst) 37) (exit 1))
(display "iconst = ")(display (iconst))(display " (should be 37)\n")
(or (< (abs (- (fconst) 3.14)) 0.00001) (exit 1))
(display "fconst = ")(display (fconst))(display " (should be 3.14)\n")
(exit 0)

View file

@ -1,18 +1,15 @@
SRCS = matrix.c vector.c
TARGET = matrix
IFILE = package.i
MKDIR = ..
TOP = ../..
SWIG = $(TOP)/../preinst-swig
SRCS = matrix.c vector.c
TARGET = matrix
INTERFACE = example.i
check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' GUILE_RUNOPTIONS='-e do-test' guile_augmented_run
all::
$(MAKE) -f $(MKDIR)/Makefile \
SRCS='$(SRCS)' \
TARGET=$(TARGET) \
IFILE=$(IFILE) \
MODULE=$(MODULE) \
sub-all
build:
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' LIBS='-lm' guile_augmented
clean::
$(MAKE) -f $(MKDIR)/Makefile TARGET='$(TARGET)' guile_clean
check: all
clean:
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean

View file

@ -1,13 +1,13 @@
Matrix example. To run the example, execute the program 'matrix' and
type the following :
(load "matrix.scm")
(load "runme.scm")
(do-test 0)
Alternatively, use the command-line:
./matrix -e do-test -s matrix.scm
./matrix -e do-test -s runme.scm
Or, if your operating system is spiffy enough:
./matrix.scm
./runme.scm

View file

@ -1,7 +1,4 @@
// FILE : package.i
// See the SWIG users manual
/*** Matrix and vector package ***/
/*** Matrix and vector example ***/
%module Matrix
%{

View file

@ -1,24 +0,0 @@
#include <tcl.h>
extern int matrix_init(Tcl_Interp *); /* Init function from matrix.i */
int main() {
int code;
char input[1024];
Tcl_Interp *interp;
interp = Tcl_CreateInterp();
/* Initialize the wrappers */
if (matrix_init(interp) == TCL_ERROR)
exit(0);
fprintf(stdout,"matrix > ");
while(fgets(input, 1024, stdin) != NULL) {
code = Tcl_Eval(interp, input);
fprintf(stdout,"%s\n",interp->result);
fprintf(stdout,"matrix > ");
}
}

View file

@ -138,24 +138,28 @@
(set-m m1 i j (+ (get-m m1 i j) (get-m m2 i j)))
(add-two m1 m2 i (+ j 1)))
(add-two m1 m2 (+ i 1) 0))))
(if (null? ML) () (begin
(add-two M (car ML) 0 0)
(add-mat M (cdr ML)))))
(if (null? ML) *unspecified*
(begin
(add-two M (car ML) 0 0)
(add-mat M (cdr ML)))))
(define (cleanup ML)
(if (null? ML) () (begin
(destroy-matrix (car ML))
(cleanup (cdr ML)))))
(if (null? ML) *unspecified*
(begin
(destroy-matrix (car ML))
(cleanup (cdr ML)))))
(define (make-random ML) ; Put random values in them
(if (null? ML) () (begin
(randmat (car ML))
(make-random (cdr ML)))))
(if (null? ML) *unspecified*
(begin
(randmat (car ML))
(make-random (cdr ML)))))
(define (mul-mat m ML)
(if (null? ML) () (begin
(mat-mult m (car ML) m)
(mul-mat m (cdr ML)))))
(if (null? ML) *unspecified*
(begin
(mat-mult m (car ML) m)
(mul-mat m (cdr ML)))))
;;; Now we'll hammer on things a little bit just to make
;;; sure everything works.
@ -207,4 +211,3 @@
(cleanup M-list))
;;; matrix.scm ends here

View file

@ -4,15 +4,16 @@ SRCS = example.c
TARGET = example
INTERFACE = example.i
all::
check: build
$(MAKE) -f $(TOP)/Makefile guile_run
build:
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile
static::
static:
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
TARGET='my-guile' INTERFACE='$(INTERFACE)' guile_static
clean::
clean:
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean
check: all

View file

@ -15,43 +15,54 @@ extern int squareCubed (int n, int *OUTPUT);
extern int gcd(int x, int y);
%typemap(in) (int argc, char *argv[]) {
int i;
SCM *v;
if (!(SCM_NIMP($input) && SCM_VECTORP($input))) {
%typemap(in) (int argc, char *argv[]) %{
scm_t_array_handle handle;
size_t i;
size_t lenp;
ssize_t inc;
const SCM *v;
if (!(SCM_NIMP($input) && scm_is_vector($input))) {
SWIG_exception(SWIG_ValueError, "Expecting a vector");
return 0;
}
$1 = SCM_LENGTH($input);
v = scm_vector_elements($input, &handle, &lenp, &inc);
$1 = (int)lenp;
if ($1 == 0) {
SWIG_exception(SWIG_ValueError, "Vector must contain at least 1 element");
}
$2 = (char **) malloc(($1+1)*sizeof(char *));
v = SCM_VELTS($input);
for (i = 0; i < $1; i++) {
if (!(SCM_NIMP(v[i]) && SCM_STRINGP(v[i]))) {
free($2);
for (i = 0; i < $1; i++, v +=inc ) {
if (!(SCM_NIMP(*v) && scm_is_string(*v))) {
free($2);
SWIG_exception(SWIG_ValueError, "Vector items must be strings");
return 0;
}
$2[i] = SCM_CHARS(v[i]);
$2[i] = scm_to_locale_string(*v);
}
$2[i] = 0;
}
scm_array_handle_release (&handle);
%}
%typemap(freearg) (int argc, char *argv[]) {
free($2);
}
%typemap(freearg) (int argc, char *argv[]) %{
for (i = 0; i < $1; i++) {
free($2[i]);
}
free($2);
%}
extern int gcdmain(int argc, char *argv[]);
%typemap(in) (char *bytes, int len) {
if (!(SCM_NIMP($input) && SCM_STRINGP($input))) {
%typemap(in) (char *bytes, int len) %{
if (!(SCM_NIMP($input) && scm_is_string($input))) {
SWIG_exception(SWIG_ValueError, "Expecting a string");
}
$1 = SCM_CHARS($input);
$2 = SCM_LENGTH($input);
}
$1 = scm_to_locale_string($input);
$2 = scm_c_string_length($input);
%}
%typemap(freearg) (char *bytes, int len) %{
free($1);
%}
extern int count(char *bytes, int len, char c);
@ -59,15 +70,15 @@ extern int count(char *bytes, int len, char c);
%typemap(in) (char *str, int len) {
size_t temp;
$1 = gh_scm2newstr($input,&temp);
$1 = SWIG_Guile_scm2newstr($input,&temp);
$2 = temp;
}
/* Return the mutated string as a new object. */
%typemap(argout) (char *str, int len) {
SWIG_APPEND_VALUE(gh_str2scm($1,$2));
if ($1) scm_must_free($1);
SWIG_APPEND_VALUE(scm_from_locale_stringn($1,$2));
if ($1) SWIG_free($1);
}
extern void capitalize(char *str, int len);
@ -78,7 +89,7 @@ extern void capitalize(char *str, int len);
%typemap(check) (double cx, double cy) {
double a = $1*$1 + $2*$2;
if (a > 1.0) {
SWIG_exception(SWIG_ValueError,"$1_name and $2_name must be in unit circle");
SWIG_exception(SWIG_ValueError,"$1_name and $2_name must be in unit circle");
}
}

View file

@ -1,6 +1,6 @@
;;; Test out some multi-argument typemaps
(use-modules (example))
(load-extension "./libexample" "scm_init_example_module")
; Call the GCD function
@ -27,4 +27,4 @@
(display (capitalize "hello world"))
(newline)
(exit 0)

View file

@ -4,15 +4,16 @@ SRCS = example.c
TARGET = example
INTERFACE = example.i
all::
check: build
$(MAKE) -f $(TOP)/Makefile guile_run
build:
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile
static::
static:
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
TARGET='my-guile' INTERFACE='$(INTERFACE)' guile_static
clean::
clean:
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean
check: all

View file

@ -1,6 +1,6 @@
;;;; Show the three different ways to deal with multiple return values
(use-modules (example))
(load-extension "./libexample" "scm_init_example_module")
;;; Multiple values as lists. By default, if more than one value is to
;;; be returned, a list of the values is created and returned. The
@ -64,3 +64,4 @@
(display remainder)
(newline))
(exit 0)

View file

@ -1,18 +1,16 @@
SRCS = port.c
TARGET = port
IFILE = port.i
MKDIR = ..
TOP = ../..
SWIG = $(TOP)/../preinst-swig
SRCS = example.c
TARGET = port
INTERFACE = example.i
check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_augmented_run
all::
$(MAKE) -f $(MKDIR)/Makefile \
SRCS='$(SRCS)' \
TARGET=$(TARGET) \
IFILE=$(IFILE) \
MODULE=$(MODULE) \
sub-all
build:
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_augmented
clean::
$(MAKE) -f $(MKDIR)/Makefile TARGET='$(TARGET)' guile_clean
check: all
clean:
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean
rm -f test.out

View file

@ -1,2 +1,2 @@
This example illustrates the translation from Scheme file ports to
temporary FILE streams. Read the source and run ./port -s port.scm
temporary FILE streams. Read the source and run ./port -s runme.scm

View file

@ -21,12 +21,15 @@
(lambda ()
(print-int (current-output-port) 314159))))
(lambda args
(display "Below shows that attempting to write to a string or soft port will result in a wrong-type-error...")
(newline)
(write args) (newline)))
;; Read from a file port. Note that it is a bad idea to mix Scheme and
;; C input because of buffering.
;; C input because of buffering, hence the call to seek to rewind the file.
(with-input-from-file "test.out"
(lambda ()
(seek (current-input-port) 0 SEEK_SET)
(display (read-int (current-input-port)))
(newline)))

View file

@ -1,19 +1,15 @@
SRCS = example.c
TARGET = my-guile
IFILE = example.i
MKDIR = ..
TOP = ../..
SWIG = $(TOP)/../preinst-swig
SRCS = example.c
TARGET = my-guile
INTERFACE = example.i
all: $(TARGET)
check: build
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_augmented_run
$(TARGET):
$(MAKE) -f $(MKDIR)/Makefile \
SRCS='$(SRCS)' \
TARGET=$(TARGET) \
IFILE=$(IFILE) \
sub-all
build:
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_augmented
clean::
$(MAKE) -f $(MKDIR)/Makefile TARGET='$(TARGET)' guile_clean
check: $(TARGET)
./$(TARGET) -s example.scm > /dev/null
clean:
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean

View file

@ -2,8 +2,8 @@ A very simple example.
To run it, start the program 'my-guile' and type:
(load "example.scm")
(load "runme.scm")
Alternatively, you can use the shell command:
./my-guile -s example.scm
./my-guile -s runme.scm

View file

@ -1,4 +1,3 @@
;;; example.scm
(define (mdisplay-newline . args) ; does guile-1.3.4 have `format #t'?
(for-each display args)
@ -25,4 +24,3 @@
(exit (and (= 1932053504 (fact 13))
(= 745470.0 (My-variable))))
;;; example.scm ends here

View file

@ -1,18 +1,19 @@
TOP = ../..
SWIG = $(TOP)/../preinst-swig
SRCS =
CXXSRCS =
TARGET = example
INTERFACE = example.i
all::
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
check: build
$(MAKE) -f $(TOP)/Makefile guile_run
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' guile_cpp
static::
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
static:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
TARGET='my-guile' INTERFACE='$(INTERFACE)' guile_static_cpp
clean::
clean:
$(MAKE) -f $(TOP)/Makefile TARGET='$(TARGET)' guile_clean
check: all

View file

@ -1,6 +1,5 @@
;; run with mzscheme -r example.scm
(use-modules (example))
(load-extension "./libexample" "scm_init_example_module")
; repeatedly invoke a procedure with v and an index as arguments
(define (with-vector v proc size-proc)
@ -52,3 +51,4 @@
(print-DoubleVector v)
(delete-DoubleVector v)
(exit 0)

View file

@ -4,15 +4,15 @@ CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
SWIGOPT =
JAVASRCS = *.java
all:: java
check: build
$(MAKE) -f $(TOP)/Makefile java_run
java::
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp
javac *.java
$(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
clean::
clean:
$(MAKE) -f $(TOP)/Makefile java_clean
check: all

View file

@ -4,15 +4,15 @@ CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
SWIGOPT =
JAVASRCS = *.java
all:: java
check: build
$(MAKE) -f $(TOP)/Makefile java_run
java::
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp
javac *.java
$(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
clean::
clean:
$(MAKE) -f $(TOP)/Makefile java_clean
check: all

View file

@ -136,7 +136,7 @@ InputName=example
echo JAVA_INCLUDE: %JAVA_INCLUDE%
echo JAVA_BIN: %JAVA_BIN%
echo on
..\..\..\swig.exe -c++ -java $(InputPath)
..\..\..\swig.exe -c++ -java "$(InputPath)"
# End Custom Build
@ -151,7 +151,7 @@ InputName=example
echo JAVA_INCLUDE: %JAVA_INCLUDE%
echo JAVA_BIN: %JAVA_BIN%
echo on
..\..\..\swig.exe -c++ -java $(InputPath)
..\..\..\swig.exe -c++ -java "$(InputPath)"
# End Custom Build

View file

@ -4,15 +4,15 @@ CXXSRCS =
TARGET = example
INTERFACE = example.i
SWIGOPT =
JAVASRCS = *.java
all:: java
check: build
$(MAKE) -f $(TOP)/Makefile java_run
java::
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp
javac *.java
$(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
clean::
clean:
$(MAKE) -f $(TOP)/Makefile java_clean
check: all

View file

@ -4,15 +4,15 @@ CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
SWIGOPT =
JAVASRCS = *.java
all:: java
check: build
$(MAKE) -f $(TOP)/Makefile java_run
java::
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp
javac *.java
$(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
clean::
clean:
$(MAKE) -f $(TOP)/Makefile java_clean
check: all

View file

@ -4,15 +4,15 @@ CXXSRCS = example.cxx
TARGET = example
INTERFACE = example.i
SWIGOPT =
JAVASRCS = *.java
all:: java
check: build
$(MAKE) -f $(TOP)/Makefile java_run
java::
build:
$(MAKE) -f $(TOP)/Makefile CXXSRCS='$(CXXSRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java_cpp
javac *.java
$(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
clean::
clean:
$(MAKE) -f $(TOP)/Makefile java_clean
check: all

View file

@ -4,15 +4,15 @@ SRCS = example.c
TARGET = example
INTERFACE = example.i
SWIGOPT =
JAVASRCS = *.java
all:: java
check: build
$(MAKE) -f $(TOP)/Makefile java_run
java::
build:
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java
javac *.java
$(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
clean::
clean:
$(MAKE) -f $(TOP)/Makefile java_clean
check: all

View file

@ -4,15 +4,15 @@ SRCS = example.c
TARGET = example
INTERFACE = example.i
SWIGOPT =
JAVASRCS = *.java
all:: java
check: build
$(MAKE) -f $(TOP)/Makefile java_run
java::
build:
$(MAKE) -f $(TOP)/Makefile SRCS='$(SRCS)' SWIG='$(SWIG)' \
SWIGOPT='$(SWIGOPT)' TARGET='$(TARGET)' INTERFACE='$(INTERFACE)' java
javac *.java
$(MAKE) -f $(TOP)/Makefile JAVASRCS='$(JAVASRCS)' JAVAFLAGS='$(JAVAFLAGS)' java_compile
clean::
clean:
$(MAKE) -f $(TOP)/Makefile java_clean
check: all

Some files were not shown because too many files have changed in this diff Show more