Changeset 121 for trunk/infrastructure
- Timestamp:
- 07/29/07 20:32:02 (1 year ago)
- Files:
-
- trunk/infrastructure/pyd/class_wrap.d (modified) (1 diff)
- trunk/infrastructure/pyd/ctor_wrap.d (modified) (1 diff)
- trunk/infrastructure/pyd/lib_abstract.d (modified) (1 diff)
- trunk/infrastructure/pyd/make_object.d (modified) (2 diffs)
- trunk/infrastructure/python/python.d (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/infrastructure/pyd/class_wrap.d
r120 r121 583 583 // alias _T T; 584 584 } else { 585 pragma(msg, "wrap_struct: " ~ name);585 pragma(msg, "wrap_struct: '" ~ name ~ "'"); 586 586 alias void shim_class; 587 587 alias _T* T; trunk/infrastructure/pyd/ctor_wrap.d
r118 r121 56 56 return exception_catcher({ 57 57 static if (is(T S : S*)) { 58 pragma(msg, "wrapped_struct_init, S is " ~ prettynameof!(S));58 pragma(msg, "wrapped_struct_init, S is '" ~ prettynameof!(S) ~ "'"); 59 59 T t = new S; 60 60 WrapPyObject_SetObj(self, t); trunk/infrastructure/pyd/lib_abstract.d
r120 r121 45 45 return o.toString(); 46 46 } 47 template symbolnameof(alias symbol) { 48 static if (is(typeof(symbol) == function)) { 49 const char[] symbolnameof = (&symbol).stringof[2 .. $]; 50 } else { 51 const char[] symbolnameof = symbol.stringof; 47 version (D_Version2) { 48 // D1 issues? 49 template symbolnameof(alias symbol) { 50 static if (is(typeof(symbol) == function)) { 51 const char[] symbolnameof = (&symbol).stringof[2 .. $]; 52 } else { 53 const char[] symbolnameof = symbol.stringof; 54 } 52 55 } 56 } else { 57 public import meta.Nameof : symbolnameof; 53 58 } 54 59 public import meta.Nameof : /*symbolnameof,*/ prettytypeof, prettynameof; trunk/infrastructure/pyd/make_object.d
r120 r121 353 353 return temp; 354 354 +/ 355 } else static if (is(string : T) ) {356 c onst(char)*result;355 } else static if (is(string : T) || is(char[] : T)) { 356 c_str result; 357 357 PyObject* repr; 358 358 // If it's a string, convert it … … 367 367 } 368 368 if (result is null) handle_exception(); 369 return .toString(result); 370 } else static if (is(char[] : T)) { 371 const(char)* result; 372 PyObject* repr; 373 // If it's a string, convert it 374 if (PyString_Check(o) || PyUnicode_Check(o)) { 375 result = PyString_AsString(o); 376 // If it's something else, convert its repr 369 version (D_Version2) { 370 static if (is(string : T)) { 371 return .toString(result); 372 } else { 373 return .toString(result).dup; 374 } 377 375 } else { 378 repr = PyObject_Repr(o); 379 if (repr is null) handle_exception(); 380 result = PyString_AsString(repr); 381 Py_DECREF(repr); 382 } 383 if (result is null) handle_exception(); 384 return .toString(result).dup; 376 return .toString(result).dup; 377 } 385 378 } else static if (is(T E : E[])) { 386 379 // Dynamic arrays trunk/infrastructure/python/python.d
r120 r121 62 62 63 63 version (D_Version2) { 64 alias const(char)* c_str; 64 // Need to define const(char)* in a way which is syntactically valid in a 65 // D 1.0 compiler. 66 mixin("alias const(char)* c_str;"); 65 67 } else { 66 68 alias char* c_str;
