Changeset 67
- Timestamp:
- 12/19/06 01:33:06 (2 years ago)
- Files:
-
- trunk/examples/testdll/test.py (modified) (1 diff)
- trunk/examples/testdll/testdll.d (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/examples/testdll/test.py
r66 r67 50 50 print 51 51 52 print "Testing exception wrapping" 53 try: 54 testdll.throws() 55 except RuntimeError, e: 56 print "Success: Exception caught!" 57 print e 58 59 print 60 52 61 S = testdll.S 53 62 s = S() trunk/examples/testdll/testdll.d
r66 r67 3 3 import python; 4 4 import pyd.pyd; 5 //import pyd.ftype;6 5 import std.stdio, std.string; 7 6 8 //import meta.Tuple;9 //import meta.Apply;10 11 void apply_test(int i, char[] s) {12 writefln("%s %s", i, s);13 }14 15 7 void foo() { 16 /+17 alias Tuple!(int, char[]) T;18 T t;19 t.val!(0) = 20;20 t.val!(1) = "Monkey";21 apply(&apply_test, t);22 +/23 8 writefln("20 Monkey"); 24 9 } … … 76 61 } 77 62 78 void iter_test(PyObject* c) {79 Bar b = new Bar(1, 2, 3, 4, 5);80 PyObject* o, res;81 foreach(i; b) {82 o = _py(i);83 res = PyObject_CallFunctionObjArgs(c, o, null);84 Py_DECREF(res);85 Py_DECREF(o);86 }87 }88 89 63 void delegate() func_test() { 90 64 return { writefln("Delegate works!"); }; … … 127 101 } 128 102 129 //extern (C)130 //export void inittestdll() {131 103 extern(C) void PydMain() { 132 104 def!(foo); … … 140 112 def!(baz); 141 113 def!(spam); 142 def!(iter_test);143 114 def!(func_test); 144 115 def!(dg_test);
