[Synopsis-changes] Synopsis/Synopsis/tests/Cxx-API/Python Command.py,1.1,1.2 Interpreter.cc,1.1,1.2 Makefile,1.1,1.2
Stefan Seefeld stefan at synopsis.fresco.orgSun Jan 11 19:45:23 UTC 2004
- Previous message: [Synopsis-changes] Synopsis/Synopsis/tests/Cxx-API/Synopsis/AST - New directory
- Next message: [Synopsis-changes] Synopsis/Synopsis/tests/Cxx-API/Synopsis/AST Guard.hh,NONE,1.1 Makefile,NONE,1.1 SourceFile.cc,NONE,1.1 SourceFile.py,NONE,1.1
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Update of /cvs/synopsis/Synopsis/tests/Cxx-API/Python
In directory frida:/tmp/cvs-serv6537/Python
Modified Files:
Command.py Interpreter.cc Makefile
Log Message:
more unit tests and better coverage of the Cxx API
Index: Command.py
===================================================================
RCS file: /cvs/synopsis/Synopsis/tests/Cxx-API/Python/Command.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -d -r1.1 -r1.2
--- Command.py 9 Jan 2004 20:03:26 -0000 1.1
+++ Command.py 11 Jan 2004 19:45:21 -0000 1.2
@@ -3,3 +3,6 @@ class Command:
print 'Command.__init__:'
print args
print kwds
+
+ def execute(self):
+ print 'hello world'
Index: Interpreter.cc
===================================================================
RCS file: /cvs/synopsis/Synopsis/tests/Cxx-API/Python/Interpreter.cc,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -d -r1.1 -r1.2
--- Interpreter.cc 9 Jan 2004 20:03:26 -0000 1.1
+++ Interpreter.cc 11 Jan 2004 19:45:21 -0000 1.2
@@ -2,7 +2,6 @@
#include <Synopsis/Interpreter.hh>
#include <Synopsis/Callable.hh>
#include <Synopsis/Module.hh>
-#include "Guard.hh"
#include <string>
#include <cstdio>
#include <iostream>
@@ -53,17 +52,17 @@ void test3()
Dict local;
Object retn = interp.run_file("Command.py", Interpreter::FILE,
global, local);
- if (!retn) PyErr_Print();
- Object o = local.get("Command");
- if (!o) { throw std::runtime_error("missing object 'Command' in 'Command.py'");}
Callable type = local.get("Command");
Tuple args("first", "second", "third");
Dict kwds;
kwds.set("input", "foo.h");
kwds.set("output", "foo.i");
- type.call();
- type.call(args);
- type.call(args, kwds);
+ Object o = type.call();
+ o = type.call(args);
+ o = type.call(args, kwds);
+ o.call("execute");
+ Callable c(o.attr("execute"));
+ c.call();
}
int main(int, char **)
@@ -74,6 +73,10 @@ int main(int, char **)
test2();
test3();
}
+ catch (const Interpreter::Exception &)
+ {
+ PyErr_Print();
+ }
catch (const std::exception &e)
{
std::cout << "Error : " << e.what() << std::endl;
Index: Makefile
===================================================================
RCS file: /cvs/synopsis/Synopsis/tests/Cxx-API/Python/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -p -d -r1.1 -r1.2
--- Makefile 9 Jan 2004 20:03:26 -0000 1.1
+++ Makefile 11 Jan 2004 19:45:21 -0000 1.2
@@ -14,7 +14,8 @@ PYVERSION:=$(shell $(python) -c "from di
PYINC :=$(shell $(python) -c "from distutils import sysconfig; print sysconfig.get_python_inc()")
PYLIBS :=-L $(PYPREFIX)/lib/python$(PYVERSION)/config -lpython$(PYVERSION) -ldl -lutil -lpthread
-CPPFLAGS:= -I .. -I $(PYINC)
+CPPFLAGS:= -I ../../../include -I $(PYINC)
+LDFLAGS := -rdynamic
LIBS := $(PYLIBS)
TESTS := Object List Tuple Dict Interpreter
@@ -28,4 +29,4 @@ $(TESTS): %: %.o
$(CXX) -ggdb $(LDFLAGS) -o $@ $^ $(LIBS)
clean:
- rm -rf *.o $(TESTS)
\ No newline at end of file
+ rm -rf *.o $(TESTS)
- Previous message: [Synopsis-changes] Synopsis/Synopsis/tests/Cxx-API/Synopsis/AST - New directory
- Next message: [Synopsis-changes] Synopsis/Synopsis/tests/Cxx-API/Synopsis/AST Guard.hh,NONE,1.1 Makefile,NONE,1.1 SourceFile.cc,NONE,1.1 SourceFile.py,NONE,1.1
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Synopsis-changes mailing list