Changeset 110
- Timestamp:
- 05/25/07 16:38:13 (1 year ago)
- Files:
-
- trunk/examples/testdll/testdll.d (modified) (1 diff)
- trunk/infrastructure/pyd/class_wrap.d (modified) (1 diff)
- trunk/infrastructure/pyd/func_wrap.d (modified) (1 diff)
- trunk/infrastructure/pyd/lib_abstract.d (modified) (1 diff)
- trunk/infrastructure/pyd/make_wrapper.d (modified) (1 diff)
- trunk/support.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/examples/testdll/testdll.d
r103 r110 102 102 103 103 extern(C) void PydMain() { 104 pragma(msg, "testdll.PydMain"); 104 105 def!(foo); 105 106 // Python does not support function overloading. This allows us to wrap trunk/infrastructure/pyd/class_wrap.d
r103 r110 326 326 */ 327 327 template StaticDef(alias fn, char[] docstring="") { 328 alias StaticDef!(fn, symbolnameof!(fn), symbolnameof!(fn), typeof(&fn), minArgs!(fn), docstring) Def;328 alias StaticDef!(fn, symbolnameof!(fn), symbolnameof!(fn), typeof(&fn), minArgs!(fn), docstring) StaticDef; 329 329 } 330 330 template StaticDef(alias fn, char[] name, char[] docstring) { 331 alias StaticDef!(fn, symbolnameof!(fn), name, typeof(&fn), minArgs!(fn), docstring) Def;331 alias StaticDef!(fn, symbolnameof!(fn), name, typeof(&fn), minArgs!(fn), docstring) StaticDef; 332 332 } 333 333 template StaticDef(alias fn, char[] name, fn_t, char[] docstring) { 334 alias StaticDef!(fn, symbolnameof!(fn), name, fn_t, minArgs!(fn), docstring) Def;334 alias StaticDef!(fn, symbolnameof!(fn), name, fn_t, minArgs!(fn), docstring) StaticDef; 335 335 } 336 336 template StaticDef(alias fn, fn_t, char[] docstring="") { 337 alias StaticDef!(fn, symbolnameof!(fn), symbolnameof!(fn), fn_t, minArgs!(fn), docstring) Def;337 alias StaticDef!(fn, symbolnameof!(fn), symbolnameof!(fn), fn_t, minArgs!(fn), docstring) StaticDef; 338 338 } 339 339 template StaticDef(alias fn, char[] name, fn_t, uint MIN_ARGS=minArgs!(fn), char[] docstring="") { 340 alias StaticDef!(fn, symbolnameof!(fn), name, fn_t, MIN_ARGS, docstring) Def;341 } 342 struct StaticDef(alias fn, char[] name, fn_t, uint MIN_ARGS, char[] docstring) {340 alias StaticDef!(fn, symbolnameof!(fn), name, fn_t, MIN_ARGS, docstring) StaticDef; 341 } 342 struct StaticDef(alias fn, char[] _realname, char[] name, fn_t, uint MIN_ARGS, char[] docstring) { 343 343 //static const type = ParamType.StaticDef; 344 344 alias fn func; trunk/infrastructure/pyd/func_wrap.d
r100 r110 131 131 throw new Exception("applyPyTupleToAlias reached end! argCount = " ~ toString(argCount)); 132 132 static if (!is(RT == void)) 133 return R eturnType!(fn_t).init;133 return RT.init; 134 134 } 135 135 trunk/infrastructure/pyd/lib_abstract.d
r100 r110 49 49 public import std.string : toString; 50 50 public import std.traits : ParameterTypeTuple, ReturnType; 51 public import std.bind : minArgs = minNumArgs;51 public import meta.Default : minArgs; 52 52 public import std.metastrings : ToString; 53 53 } trunk/infrastructure/pyd/make_wrapper.d
r101 r110 98 98 } 99 99 } 100 template __pyd_abstract_call(fn_t) { 101 ReturnType!(fn_t) func(T ...) (char[] name, T t) { 102 PyObject* _pyobj = this.__pyd_get_pyobj(); 103 if (_pyobj !is null) { 104 PyObject* method = PyObject_GetAttrString(_pyobj, (name ~ \0).ptr); 105 if (method is null) handle_exception(); 106 auto pydg = PydCallable_AsDelegate!(fn_to_dg!(fn_t))(method); 107 Py_DECREF(method); 108 return pydg(t); 109 } else { 110 PyErr_SetNone(PyExc_NotImplementedError); 111 handle_exception(); 112 //return ReturnType!(fn_t).init; 113 } 114 } 115 } 100 116 template __pyd_get_overload(char[] realname, fn_t) { 101 117 ReturnType!(fn_t) func(T ...) (char[] name, T t) { trunk/support.py
r69 r110 59 59 del kwargs['raw_only'] 60 60 with_pyd = kwargs.pop('with_pyd', True) 61 with_st = kwargs.pop('with_st', True)61 with_st = kwargs.pop('with_st', False) # 5/23/07 st off by default. 62 62 # StackThreads doesn't work with Tango at the moment. 63 63 if with_tango:
