Show
Ignore:
Timestamp:
07/26/07 20:06:38 (1 year ago)
Author:
KirkMcDonald
Message:

* Pyd now requires D 2.003 or later.
* Pyd now compiles with D 2.003.
* Resolved long-standing string-copying annoyance (thanks to const).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/infrastructure/pyd/class_wrap.d

    r118 r120  
    276276    mixin _Def!(fn, symbolnameof!(fn), typeof(&fn), ""); 
    277277} 
    278 struct Def(alias fn, char[] docstring) { 
     278struct Def(alias fn, string docstring) { 
    279279    mixin _Def!(fn, /*symbolnameof!(fn),*/ symbolnameof!(fn), typeof(&fn)/+, minArgs!(fn)+/, docstring); 
    280280} 
    281 struct Def(alias fn, char[] name, char[] docstring) { 
     281struct Def(alias fn, string name, string docstring) { 
    282282    mixin _Def!(fn, /*symbolnameof!(fn),*/ name, typeof(&fn)/+, minArgs!(fn)+/, docstring); 
    283283} 
    284 struct Def(alias fn, char[] name, fn_t) { 
     284struct Def(alias fn, string name, fn_t) { 
    285285    mixin _Def!(fn, /*symbolnameof!(fn),*/ name, fn_t/+, minArgs!(fn)+/, ""); 
    286286} 
     
    288288    mixin _Def!(fn, /*symbolnameof!(fn),*/ symbolnameof!(fn), fn_t/+, minArgs!(fn)+/, ""); 
    289289} 
    290 struct Def(alias fn, fn_t, char[] docstring) { 
     290struct Def(alias fn, fn_t, string docstring) { 
    291291    mixin _Def!(fn, /*symbolnameof!(fn),*/ symbolnameof!(fn), fn_t/+, minArgs!(fn)+/, docstring); 
    292292} 
    293 struct Def(alias fn, char[] name, fn_t, char[] docstring) { 
     293struct Def(alias fn, string name, fn_t, string docstring) { 
    294294    mixin _Def!(fn, /*symbolnameof!(fn),*/ name, fn_t/+, minArgs!(fn)+/, docstring); 
    295295} 
    296296/+ 
    297 template Def(alias fn, char[] name, fn_t, uint MIN_ARGS=minArgs!(fn)/+, char[] docstring=""+/) { 
     297template Def(alias fn, string name, fn_t, uint MIN_ARGS=minArgs!(fn)/+, string docstring=""+/) { 
    298298    alias Def!(fn, /*symbolnameof!(fn),*/ name, fn_t, MIN_ARGS/+, docstring+/) Def; 
    299299} 
    300300+/ 
    301 template _Def(alias fn, /*char[] _realname,*/ char[] name, fn_t/+, uint MIN_ARGS=minArgs!(fn)+/, char[] docstring) { 
     301template _Def(alias fn, /*string _realname,*/ string name, fn_t/+, uint MIN_ARGS=minArgs!(fn)+/, string docstring) { 
    302302    //static const type = ParamType.Def; 
    303303    alias fn func; 
     
    336336    mixin _StaticDef!(fn,/+ symbolnameof!(fn),+/ symbolnameof!(fn), typeof(&fn), minArgs!(fn), ""); 
    337337} 
    338 struct StaticDef(alias fn, char[] docstring) { 
     338struct StaticDef(alias fn, string docstring) { 
    339339    mixin _StaticDef!(fn,/+ symbolnameof!(fn),+/ symbolnameof!(fn), typeof(&fn), minArgs!(fn), docstring); 
    340340} 
    341 struct StaticDef(alias _fn, char[] name, char[] docstring) { 
     341struct StaticDef(alias _fn, string name, string docstring) { 
    342342    mixin _StaticDef!(fn,/+ symbolnameof!(fn),+/ name, typeof(&fn), minArgs!(fn), docstring); 
    343343} 
    344 struct StaticDef(alias _fn, char[] name, fn_t, char[] docstring) { 
     344struct StaticDef(alias _fn, string name, fn_t, string docstring) { 
    345345    mixin _StaticDef!(fn,/+ symbolnameof!(fn),+/ name, fn_t, minArgs!(fn), docstring); 
    346346} 
     
    348348    mixin _StaticDef!(fn,/+ symbolnameof!(fn),+/ symbolnameof!(fn), fn_t, minArgs!(fn), ""); 
    349349} 
    350 struct StaticDef(alias _fn, fn_t, char[] docstring) { 
     350struct StaticDef(alias _fn, fn_t, string docstring) { 
    351351    mixin _StaticDef!(fn,/+ symbolnameof!(fn),+/ symbolnameof!(fn), fn_t, minArgs!(fn), docstring); 
    352352} 
    353 struct StaticDef(alias _fn, char[] name, fn_t) { 
     353struct StaticDef(alias _fn, string name, fn_t) { 
    354354    mixin _StaticDef!(fn,/+ symbolnameof!(fn),+/ name, fn_t, minArgs!(fn), ""); 
    355355} 
    356 struct StaticDef(alias _fn, char[] name, fn_t, uint MIN_ARGS) { 
     356struct StaticDef(alias _fn, string name, fn_t, uint MIN_ARGS) { 
    357357    mixin _StaticDef!(fn,/+ symbolnameof!(fn),+/ name, fn_t, MIN_ARGS, ""); 
    358358} 
    359 struct StaticDef(alias _fn, char[] name, fn_t, uint MIN_ARGS, char[] docstring) { 
     359struct StaticDef(alias _fn, string name, fn_t, uint MIN_ARGS, string docstring) { 
    360360    mixin _StaticDef!(fn,/+ symbolnameof!(fn),+/ name, fn_t, MIN_ARGS, docstring); 
    361361} 
    362 template _StaticDef(alias fn,/+ char[] _realname,+/ char[] name, fn_t, uint MIN_ARGS, char[] docstring) { 
     362template _StaticDef(alias fn,/+ string _realname,+/ string name, fn_t, uint MIN_ARGS, string docstring) { 
    363363    //static const type = ParamType.StaticDef; 
    364364    alias fn func; 
     
    397397    mixin _Property!(fn, symbolnameof!(fn), symbolnameof!(fn), false, ""); 
    398398} 
    399 struct Property(alias fn, char[] docstring) { 
     399struct Property(alias fn, string docstring) { 
    400400    mixin _Property!(fn, symbolnameof!(fn), symbolnameof!(fn), false, docstring); 
    401401} 
    402 struct Property(alias fn, char[] name, char[] docstring) { 
     402struct Property(alias fn, string name, string docstring) { 
    403403    mixin _Property!(fn, symbolnameof!(fn), name, false, docstring); 
    404404} 
    405 struct Property(alias fn, char[] name, bool RO) { 
     405struct Property(alias fn, string name, bool RO) { 
    406406    mixin _Property!(fn, symbolnameof!(fn), name, RO, ""); 
    407407} 
    408 struct Property(alias fn, char[] name, bool RO, char[] docstring) { 
     408struct Property(alias fn, string name, bool RO, string docstring) { 
    409409    mixin _Property!(fn, symbolnameof!(fn), name, RO, docstring); 
    410410} 
     
    412412    mixin _Property!(fn, symbolnameof!(fn), symbolnameof!(fn), RO, ""); 
    413413} 
    414 struct Property(alias fn, bool RO, char[] docstring) { 
     414struct Property(alias fn, bool RO, string docstring) { 
    415415    mixin _Property!(fn, symbolnameof!(fn), symbolnameof!(fn), RO, docstring); 
    416416} 
    417 template _Property(alias fn, char[] _realname, char[] name, bool RO, char[] docstring) { 
     417template _Property(alias fn, string _realname, string name, bool RO, string docstring) { 
    418418    alias property_parts!(fn).getter_type get_t; 
    419419    alias property_parts!(fn).setter_type set_t; 
     
    545545iterator. 
    546546*/ 
    547 struct AltIter(alias fn, char[] name = symbolnameof!(fn), iter_t = ParameterTypeTuple!(fn)[0]) { 
     547struct AltIter(alias fn, string name = symbolnameof!(fn), iter_t = ParameterTypeTuple!(fn)[0]) { 
    548548    static const bool needs_shim = false; 
    549549    static void call(T) () { 
     
    564564} /*Pyd_with_StackThreads*/ 
    565565 
    566 void wrap_class(T, Params...) (char[] docstring="", char[] modulename="") { 
     566void wrap_class(T, Params...) (string docstring="", string modulename="") { 
    567567    _wrap_class!(T, symbolnameof!(T), Params).wrap_class(docstring, modulename); 
    568568} 
     
    572572} 
    573573+/ 
    574 template _wrap_class(_T, char[] name, Params...) { 
     574template _wrap_class(_T, string name, Params...) { 
    575575    static if (is(_T == class)) { 
    576576        pragma(msg, "wrap_class: " ~ name); 
     
    587587        alias _T* T; 
    588588    } 
    589 void wrap_class(char[] docstring="", char[] modulename="") { 
     589void wrap_class(string docstring="", string modulename="") { 
    590590    pragma(msg, "shim.mangleof: " ~ shim_class.mangleof); 
    591591    alias wrapped_class_type!(T) type; 
     
    603603 
    604604    assert(Pyd_Module_p(modulename) !is null, "Must initialize module before wrapping classes."); 
    605     char[] module_name = toString(python.PyModule_GetName(Pyd_Module_p(modulename))); 
     605    string module_name = toString(python.PyModule_GetName(Pyd_Module_p(modulename))); 
    606606 
    607607    //////////////////