improve Android support
This commit is contained in:
parent
ab06b04a09
commit
2d2eb70842
@ -1,13 +1,31 @@
|
|||||||
# File: Android.mk
|
# File: Android.mk
|
||||||
|
#use current directory
|
||||||
LOCAL_PATH := $(call my-dir)
|
LOCAL_PATH := $(call my-dir)
|
||||||
NDK_TOOLCHAIN_VERSION := 4.8
|
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_LDLIBS := -llog -landroid
|
|
||||||
LOCAL_LDLIBS += @abs_top_builddir@/libYap.a @abs_top_builddir@/yapi.o
|
LOCAL_LDLIBS := -landroid -llog
|
||||||
|
LOCAL_MODULE := yap0
|
||||||
|
LOCAL_SRC_FILES += @abs_top_builddir@/../../gmp/lib/libgmp.so
|
||||||
|
include $(PREBUILT_SHARED_LIBRARY)
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
LOCAL_MODULE := yap1
|
||||||
|
LOCAL_SRC_FILES += @abs_top_builddir@/libYap.a
|
||||||
|
include $(PREBUILT_STATIC_LIBRARY)
|
||||||
|
|
||||||
|
include $(CLEAR_VARS)
|
||||||
|
|
||||||
|
|
||||||
|
NDK_TOOLCHAIN_VERSION := @GCC_VERSION@
|
||||||
|
LOCAL_LDLIBS := -landroid -llog
|
||||||
LOCAL_MODULE := example
|
LOCAL_MODULE := example
|
||||||
LOCAL_SRC_FILES := yap_wrap.cpp
|
LOCAL_SHARED_LIBRARIES := yap0 yap1
|
||||||
LOCAL_C_INCLUDES := @abs_top_builddir@ @srcdir@/../../H @srcdir@/../../include @srcdir@/../../os @srcdir@/../../OPTYap @srcdir@/../../BEAM @srcdir@/../../CXX
|
LOCAL_STATIC_LIBRARIES := @abs_top_builddir@/libYap.ar
|
||||||
LOCAL_CFLAGS := @DEFS@ -D_YAP_NOT_INSTALLED_=1
|
LOCAL_SRC_FILES += @abs_top_builddir@/packages/swig/android/jni/yap_wrap.cpp
|
||||||
|
LOCAL_C_INCLUDES := @abs_top_builddir@ @abs_top_builddir@/../../gmp/include @srcdir@/../../H @srcdir@/../../include @srcdir@/../../os @srcdir@/../../OPTYap @srcdir@/../../BEAM @srcdir@/../../CXX
|
||||||
|
LOCAL_CFLAGS := @YAP_EXTRAS@ @DEFS@ -D_YAP_NOT_INSTALLED_=1 -DDESTDIR=\"\"
|
||||||
LOCAL_CPP_FEATURES := rtti
|
LOCAL_CPP_FEATURES := rtti
|
||||||
# LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
|
# LOCAL_ALLOW_UNDEFINED_SYMBOLS := true
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
@ -8,8 +8,8 @@ include ../Makefile.defs
|
|||||||
DEFS=@DEFS@ -D_YAP_NOT_INSTALLED_=1 -DDESTDIR=\"$(DESTDIR)\"
|
DEFS=@DEFS@ -D_YAP_NOT_INSTALLED_=1 -DDESTDIR=\"$(DESTDIR)\"
|
||||||
YAP_EXTRAS=@YAP_EXTRAS@
|
YAP_EXTRAS=@YAP_EXTRAS@
|
||||||
srcdir=@srcdir@
|
srcdir=@srcdir@
|
||||||
CPPFLAGS=@CPPFLAGS@ -I../.. -I$(srcdir)/../../H -I$(srcdir)/../../include -I$(srcdir)/../../os -I$(srcdir)/../../OPTYap -I$(srcdir)/../../BEAM -I$(srcdir)/../../CXX
|
CPPFLAGS= -I../.. -I$(srcdir)/../../H -I$(srcdir)/../../include -I$(srcdir)/../../os -I$(srcdir)/../../OPTYap -I$(srcdir)/../../BEAM -I$(srcdir)/../../CXX
|
||||||
CXXFLAGS= @SHLIB_CXXFLAGS@ $(YAP_EXTRAS) $(DEFS) $(CPPFLAGS)
|
CXXFLAGS= $(YAP_EXTRAS) $(DEFS) $(CPPFLAGS)
|
||||||
|
|
||||||
PROGRAMS= $(srcdir)/python/demo.py \
|
PROGRAMS= $(srcdir)/python/demo.py \
|
||||||
|
|
||||||
@ -26,7 +26,7 @@ python/_yap.so: python/yap_wrap.o
|
|||||||
|
|
||||||
python/yap_wrap.c: $(srcdir)/yap.i
|
python/yap_wrap.c: $(srcdir)/yap.i
|
||||||
mkdir -p python
|
mkdir -p python
|
||||||
$(SWIG) -c++ -python -outdir python -o $@ $(DEFS) $(CPPFLAGS) -Wall $<
|
$(SWIG) -c++ -python -outdir python -o $@ $(CXXFLAGS) -Wall $<
|
||||||
|
|
||||||
python/yap_wrap.o: python/yap_wrap.c
|
python/yap_wrap.o: python/yap_wrap.c
|
||||||
$(CXX) -c $(CXXFLAGS) @PYTHON_INCLUDES@ $< -o $@
|
$(CXX) -c $(CXXFLAGS) @PYTHON_INCLUDES@ $< -o $@
|
||||||
@ -35,10 +35,10 @@ java: jni/libyap.@SO@ java/yap.java
|
|||||||
cd java ; $(JAVAC) *.java; $(JAR) cvf yap.jar *.class
|
cd java ; $(JAVAC) *.java; $(JAR) cvf yap.jar *.class
|
||||||
|
|
||||||
jni/libyap.@SO@: jni/yap_wrap.o
|
jni/libyap.@SO@: jni/yap_wrap.o
|
||||||
$(CXX) -shared $(LDSOFLAGS) -L ../.. -lYap -o $@ ../../yapi.o $< $(LIBS) @JPLLDFLAGS@ -L ../.. -lYap -lpthread
|
$(CXX) -shared $(LDSOFLAGS) -o $@ ../../yapi.o $< $(LIBS) @JPLLDFLAGS@ -L ../.. -lYap -lpthread
|
||||||
|
|
||||||
jni/yap_wrap.cpp: $(srcdir)/yap.i
|
jni/yap_wrap.cpp: $(srcdir)/yap.i
|
||||||
$(SWIG) -c++ -java -package pt.up.fc.dcc.yap -outdir java -o $@ $(DEFS) $(CPPFLAGS) -Wall $<
|
$(SWIG) -c++ -java -package pt.up.fc.dcc.yap -outdir java -o $@ $(CXXFLAGS) -Wall $<
|
||||||
|
|
||||||
jni/yap_wrap.o: jni/yap_wrap.cpp
|
jni/yap_wrap.o: jni/yap_wrap.cpp
|
||||||
$(CXX) -c $(CXXFLAGS) @JPLCFLAGS@ $< -o $@
|
$(CXX) -c $(CXXFLAGS) @JPLCFLAGS@ $< -o $@
|
||||||
@ -51,16 +51,18 @@ jni/yap_wrap.o: jni/yap_wrap.cpp
|
|||||||
# adb install bin/SwigSimple-debug.apk
|
# adb install bin/SwigSimple-debug.apk
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
android: android/jni/yap_wrap.cpp
|
android: android/jni/yap_wrap.cpp
|
||||||
|
|
||||||
android/jni/yap_wrap.cpp: $(srcdir)/yap.i
|
android/jni/yap_wrap.cpp: $(srcdir)/yap.i
|
||||||
android create project --target 1 --name SwigSimple --path ./android --activity SwigSimple --package org.swig.simple
|
android create project --target 1 --name SwigSimple --path ./android --activity SwigSimple --package org.swig.simple;\
|
||||||
( cd android ; mkdir -p jni; mkdir -p assets/share/Yap; mkdir -p assets/lib/Yap;\
|
( cd android ; mkdir -p jni jni/lib; mkdir -p assets/share/Yap; mkdir -p assets/lib/Yap;\
|
||||||
$(SWIG) -c++ -java -I$(srcdir)/../../CXX -package org.swig.simple -outdir src/org/swig/simple -o jni/yap_wrap.cpp $< ;\
|
$(SWIG) -c++ -java -I$(srcdir)/../../CXX -package org.swig.simple -outdir src/org/swig/simple -o jni/yap_wrap.cpp $(CXXFLAGS) $< ;\
|
||||||
cp $(srcdir)/android/SwigSimple.java src/org/swig/simple/ ;\
|
cp $(srcdir)/android/SwigSimple.java src/org/swig/simple/ ;\
|
||||||
cp $(srcdir)/android/main.xml res/layout ;\
|
cp $(srcdir)/android/main.xml res/layout ;\
|
||||||
|
cp $(srcdir)/android/Application.mk jni ;\
|
||||||
cp -r $(DESTDIR)$(PLLIBDIR)/* assets/share/Yap;\
|
cp -r $(DESTDIR)$(PLLIBDIR)/* assets/share/Yap;\
|
||||||
cp -r $(DESTDIR)$(SOLIBDIR)/* assets/lib/Yap;\
|
cp -r ../../../startup.yss assets/lib/Yap;\
|
||||||
|
cp -r $(DESTDIR)$(SOLIBDIR)/*.so jni;\
|
||||||
cp ../Android.mk jni ;\
|
cp ../Android.mk jni ;\
|
||||||
ndk-build; \
|
ndk-build; \
|
||||||
ant debug \
|
ant debug \
|
||||||
@ -75,7 +77,7 @@ install:
|
|||||||
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f */*
|
rm -fr android/* jni/* java/* python/*
|
||||||
|
|
||||||
distclean: clean
|
distclean: clean
|
||||||
rm -f *def Makefile
|
rm -f *def Makefile
|
||||||
|
@ -1,2 +1,4 @@
|
|||||||
# File: Application.mk
|
# File: Application.mk
|
||||||
NDK_TOOLCHAIN_VERSION = 4.8
|
NDK_TOOLCHAIN_VERSION = 4.8
|
||||||
|
APP_STL := gnustl_static
|
||||||
|
APP_CPPFLAGS += -fexceptions
|
||||||
|
@ -11,79 +11,184 @@ import android.content.pm.PackageInfo;
|
|||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.content.res.AssetManager;
|
import android.content.res.AssetManager;
|
||||||
|
import android.widget.EditText;
|
||||||
|
|
||||||
public class SwigSimple extends Activity
|
public class SwigSimple extends Activity
|
||||||
{
|
{
|
||||||
TextView outputText = null;
|
TextView outputText = null;
|
||||||
ScrollView scroller = null;
|
ScrollView scroller = null;
|
||||||
YAPEngine eng = null;
|
YAPEngine eng = null;
|
||||||
|
EditText text;
|
||||||
|
String str;
|
||||||
|
String buf;
|
||||||
|
|
||||||
/** Called when the activity is first created. */
|
/** Called when the activity is first created. */
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState)
|
public void onCreate(Bundle savedInstanceState)
|
||||||
{
|
{
|
||||||
|
String s = null;
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
String s = "ugh";
|
setContentView(R.layout.main);
|
||||||
setContentView(R.layout.main);
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
PackageManager m = getPackageManager();
|
PackageManager m = getPackageManager();
|
||||||
s = getPackageName();
|
s = getPackageName();
|
||||||
PackageInfo p = m.getPackageInfo(s, 0);
|
PackageInfo p = m.getPackageInfo(s, 0);
|
||||||
s = p.applicationInfo.dataDir;
|
//s = p.applicationInfo.dataDir;
|
||||||
mgr = getResources().getAssets();
|
AssetManager mgr = getResources().getAssets();
|
||||||
load(mgr);
|
load(mgr);
|
||||||
} catch(NameNotFoundException e) {
|
} catch(NameNotFoundException e) {
|
||||||
Log.e(TAG, "Couldn't find package information in PackageManager", e);
|
Log.e(TAG, "Couldn't find package information in PackageManager", e);
|
||||||
}
|
}
|
||||||
|
Log.i(TAG, "mgr=" +mgr);
|
||||||
outputText = (TextView)findViewById(R.id.OutputText);
|
|
||||||
outputText.setText("Application " + s + "\nPress 'Run' to start...\n");
|
|
||||||
outputText.setMovementMethod(new ScrollingMovementMethod());
|
|
||||||
YAPParams p = new YAPParams();
|
|
||||||
eng = new YAPEngine( p );
|
|
||||||
|
|
||||||
scroller = (ScrollView)findViewById(R.id.Scroller);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onRunButtonClick(View view)
|
text = (EditText)findViewById(R.id.EditText01);
|
||||||
{
|
outputText = (TextView)findViewById(R.id.OutputText);
|
||||||
outputText.append("Started...\n");
|
outputText.setText("Application " + s + "\nPress 'Run' to start...\n");
|
||||||
if (BuildConfig.DEBUG) {
|
outputText.setMovementMethod(new ScrollingMovementMethod());
|
||||||
Log.i(TAG, "onRunButtonClick called");
|
scroller = (ScrollView)findViewById(R.id.Scroller);
|
||||||
}
|
eng = new YAPEngine( );
|
||||||
outputText.append("Finished!\n");
|
Log.i(TAG, "engine done");
|
||||||
|
JavaCallback callback = new JavaCallback( outputText );
|
||||||
|
// set the Java Callback
|
||||||
|
eng.setYAPCallback(callback);
|
||||||
|
if (BuildConfig.DEBUG) {
|
||||||
|
Log.i(TAG, "callback done");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure scroll to end of text
|
public void onResetButtonClick(View view)
|
||||||
scroller.post(new Runnable() {
|
{
|
||||||
public void run() {
|
if (BuildConfig.DEBUG) {
|
||||||
scroller.fullScroll(ScrollView.FOCUS_DOWN);
|
Log.i(TAG, "onReseButtonClick called");
|
||||||
String s = "['/assets/share/Yap/lists'].\n";
|
}
|
||||||
outputText.append(s);
|
// Ensure scroll to end of text
|
||||||
YAPQuery q = eng.query(s);
|
scroller.post(new Runnable() {
|
||||||
q.next();
|
public void run() {
|
||||||
String s = "member(X, [1,2,3]).\n";
|
scroller.fullScroll(ScrollView.FOCUS_DOWN);
|
||||||
outputText.append(s);
|
text.setText("");
|
||||||
YAPQuery q = eng.query(s);
|
}
|
||||||
q.next();
|
});
|
||||||
String sn =
|
}
|
||||||
}
|
|
||||||
});
|
public void onRunButtonClick(View view)
|
||||||
}
|
{
|
||||||
|
if (BuildConfig.DEBUG) {
|
||||||
|
Log.i(TAG, "onRunButtonClick called");
|
||||||
|
}
|
||||||
|
// Ensure scroll to end of text
|
||||||
|
scroller.post(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
scroller.fullScroll(ScrollView.FOCUS_DOWN);
|
||||||
|
str = text.getText().toString();
|
||||||
|
outputText.append("?- " + str);
|
||||||
|
YAPQuery q = eng.query( str );
|
||||||
|
YAPListTerm vs = q.namedVars();
|
||||||
|
// text.setText("");
|
||||||
|
if (vs.nil()) {
|
||||||
|
if (q.next()) {
|
||||||
|
outputText.append( "yes\n" );
|
||||||
|
} else {
|
||||||
|
outputText.append( "no\n" );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
while (q.next()) {
|
||||||
|
int i=1;
|
||||||
|
// outputText.append(Integer.toString(i++) + ": " + vs.text() +"\n");
|
||||||
|
while(!vs.nil()){
|
||||||
|
YAPTerm eq = vs.car();
|
||||||
|
//outputText.append(Integer.toString(i) + ": " + eq.text() );
|
||||||
|
outputText.append(Integer.toString(i++) + ":\t" + eq.getArg(1).text() + " = " + eq.getArg(2).text() +"\n" );
|
||||||
|
vs = vs.cdr();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
q.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onRunSelectionButtonClick(View view)
|
||||||
|
{
|
||||||
|
if (BuildConfig.DEBUG) {
|
||||||
|
Log.i(TAG, "onRunButtonClick called");
|
||||||
|
}
|
||||||
|
// Ensure scroll to end of text
|
||||||
|
scroller.post(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
scroller.fullScroll(ScrollView.FOCUS_DOWN);
|
||||||
|
int startSelection = text.getSelectionStart();
|
||||||
|
int endSelection = text.getSelectionEnd();
|
||||||
|
str = text.getText().toString().substring( startSelection, endSelection );
|
||||||
|
outputText.append("?- " + str);
|
||||||
|
YAPQuery q = eng.query( str );
|
||||||
|
YAPListTerm vs = q.namedVars();
|
||||||
|
// text.setText("");
|
||||||
|
if (vs.nil()) {
|
||||||
|
if (q.next()) {
|
||||||
|
outputText.append( "yes\n" );
|
||||||
|
} else {
|
||||||
|
outputText.append( "no\n" );
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
while (q.next()) {
|
||||||
|
int i=1;
|
||||||
|
// outputText.append(Integer.toString(i++) + ": " + vs.text() +"\n");
|
||||||
|
while(!vs.nil()){
|
||||||
|
YAPTerm eq = vs.car();
|
||||||
|
//outputText.append(Integer.toString(i) + ": " + eq.text() );
|
||||||
|
outputText.append(Integer.toString(i++) + ":\t" + eq.getArg(1).text() + " = " + eq.getArg(2).text() +"\n" );
|
||||||
|
vs = vs.cdr();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
q.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** static constructor */
|
/** static constructor */
|
||||||
static {
|
static {
|
||||||
System.loadLibrary("android");
|
System.loadLibrary("android");
|
||||||
System.loadLibrary("log");
|
System.loadLibrary("log");
|
||||||
System.loadLibrary("example");
|
System.loadLibrary("gmp");
|
||||||
}
|
System.loadLibrary("example");
|
||||||
|
}
|
||||||
private static native void load(AssetManager mgr);
|
|
||||||
|
|
||||||
private AssetManager mgr;
|
private static native void load(AssetManager mgr);
|
||||||
|
|
||||||
private static final String TAG = "SwigSimple";
|
private AssetManager mgr;
|
||||||
|
|
||||||
|
private static final String TAG = "SwigSimple";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class JavaCallback extends YAPCallback
|
||||||
|
{
|
||||||
|
TextView output;
|
||||||
|
|
||||||
|
public JavaCallback( TextView outputText )
|
||||||
|
{
|
||||||
|
super();
|
||||||
|
output = outputText;
|
||||||
|
Log.i(TAG, "java callback init");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
System.out.println("JavaCallback.run() ");
|
||||||
|
Log.i(TAG, "java callback ");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void displayInWindow(String s)
|
||||||
|
{
|
||||||
|
System.out.println("JavaCallback.run() ");
|
||||||
|
Log.i(TAG, "java callback ");
|
||||||
|
output.append(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final String TAG = "JavaCallback";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,19 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout
|
||||||
android:orientation="vertical"
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="fill_parent"
|
android:orientation="vertical"
|
||||||
android:layout_height="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
>
|
android:layout_height="fill_parent">
|
||||||
|
<LinearLayout
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:layout_width="fill_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/EditText01"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1.0"
|
||||||
|
android:lines="6" />
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/RunButton"
|
android:id="@+id/RunButton"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -11,16 +21,32 @@
|
|||||||
android:text="Run..."
|
android:text="Run..."
|
||||||
android:onClick="onRunButtonClick"
|
android:onClick="onRunButtonClick"
|
||||||
/>
|
/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/RunSelectionButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Select"
|
||||||
|
android:onClick="onRunSelectionButtonClick"
|
||||||
|
/>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/ClearButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="Reset"
|
||||||
|
android:onClick="onClearButtonClick"
|
||||||
|
/>
|
||||||
|
</LinearLayout>
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:id="@+id/Scroller"
|
android:id="@+id/Scroller"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent">
|
||||||
>
|
<TextView
|
||||||
<TextView
|
|
||||||
android:id="@+id/OutputText"
|
android:id="@+id/OutputText"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
/>
|
/>
|
||||||
|
<!-- Set MaxLegth EditText -->
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
@ -14,7 +14,6 @@ def go():
|
|||||||
vs = q.namedVars();
|
vs = q.namedVars();
|
||||||
while vs.length() > 0:
|
while vs.length() > 0:
|
||||||
eq = vs.car()
|
eq = vs.car()
|
||||||
print eq.text()
|
|
||||||
print eq.getArg(1).text() + " = " + eq.getArg(2).text()
|
print eq.getArg(1).text() + " = " + eq.getArg(2).text()
|
||||||
vs = vs.cdr()
|
vs = vs.cdr()
|
||||||
print "no more answers"
|
print "no more answers"
|
||||||
|
@ -1,12 +1,31 @@
|
|||||||
/* example.i */
|
/* example.i */
|
||||||
%module yap
|
%module(directors="1") yap
|
||||||
|
|
||||||
%{
|
%{
|
||||||
/* Put header files here or function declarations like below */
|
/* Put header files here or function declarations like below */
|
||||||
|
|
||||||
|
#define YAP_CPP_INTERFACE 1
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
|
||||||
#include "yapi.hh"
|
#include "yapi.hh"
|
||||||
|
|
||||||
|
extern Term Yap_StringToTerm(const char *s, size_t len, term_t bindings);
|
||||||
|
|
||||||
|
#if THREADS
|
||||||
|
#define Yap_regp regcache
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// we cannot consult YapInterface.h, that conflicts with what we declare, though
|
||||||
|
// it shouldn't
|
||||||
|
}
|
||||||
|
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
|
||||||
|
/* turn on director wrapping Callback */
|
||||||
|
%feature("director") YAPCallback;
|
||||||
|
|
||||||
|
|
||||||
%include "yapi.hh"
|
%include "yapi.hh"
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user