Changeset 120 for trunk/infrastructure/pyd/def.d
- Timestamp:
- 07/26/07 20:06:38 (5 years ago)
- Files:
-
- trunk/infrastructure/pyd/def.d (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/infrastructure/pyd/def.d
r100 r120 36 36 ]; 37 37 38 private PyMethodDef[][ char[]] module_methods;39 private PyObject*[ char[]] pyd_modules;38 private PyMethodDef[][string] module_methods; 39 private PyObject*[string] pyd_modules; 40 40 41 private void ready_module_methods( char[]modulename) {41 private void ready_module_methods(string modulename) { 42 42 PyMethodDef empty; 43 43 if (!(modulename in module_methods)) { … … 47 47 } 48 48 49 PyObject* Pyd_Module_p( char[]modulename="") {49 PyObject* Pyd_Module_p(string modulename="") { 50 50 PyObject** m = modulename in pyd_modules; 51 51 if (m is null) return null; … … 85 85 *It's greater than 10!) 86 86 */ 87 void def(alias fn, char[] name = symbolnameof!(fn), fn_t=typeof(&fn), uint MIN_ARGS = minArgs!(fn, fn_t)) (char[]docstring="") {87 void def(alias fn, string name = symbolnameof!(fn), fn_t=typeof(&fn), uint MIN_ARGS = minArgs!(fn, fn_t)) (string docstring="") { 88 88 def!("", fn, name, fn_t, MIN_ARGS)(docstring); 89 89 } 90 90 91 void def( char[] modulename, alias fn, char[] name = symbolnameof!(fn), fn_t=typeof(&fn), uint MIN_ARGS = minArgs!(fn, fn_t)) (char[]docstring) {91 void def(string modulename, alias fn, string name = symbolnameof!(fn), fn_t=typeof(&fn), uint MIN_ARGS = minArgs!(fn, fn_t)) (string docstring) { 92 92 pragma(msg, "def: " ~ name); 93 93 PyMethodDef empty; … … 102 102 } 103 103 104 char[]pyd_module_name;104 string pyd_module_name; 105 105 106 106 /** 107 107 * Module initialization function. Should be called after the last call to def. 108 108 */ 109 PyObject* module_init( char[]docstring="") {109 PyObject* module_init(string docstring="") { 110 110 //_loadPythonSupport(); 111 char[]name = pyd_module_name;111 string name = pyd_module_name; 112 112 ready_module_methods(""); 113 113 pyd_modules[""] = Py_InitModule3((name ~ \0).ptr, module_methods[""].ptr, (docstring ~ \0).ptr); … … 118 118 * Module initialization function. Should be called after the last call to def. 119 119 */ 120 PyObject* add_module( char[] name, char[]docstring="") {120 PyObject* add_module(string name, string docstring="") { 121 121 ready_module_methods(name); 122 122 pyd_modules[name] = Py_InitModule3((name ~ \0).ptr, module_methods[name].ptr, (docstring ~ \0).ptr);
