Changeset 120
- Timestamp:
- 07/26/07 20:06:38 (5 years ago)
- Files:
-
- trunk/examples/testdll/testdll.d (modified) (2 diffs)
- trunk/infrastructure/meta/Demangle.d (modified) (25 diffs)
- trunk/infrastructure/pyd/class_wrap.d (modified) (11 diffs)
- trunk/infrastructure/pyd/def.d (modified) (5 diffs)
- trunk/infrastructure/pyd/func_wrap.d (modified) (2 diffs)
- trunk/infrastructure/pyd/lib_abstract.d (modified) (1 diff)
- trunk/infrastructure/pyd/make_object.d (modified) (4 diffs)
- trunk/infrastructure/pyd/make_wrapper.d (modified) (1 diff)
- trunk/infrastructure/pyd/struct_wrap.d (modified) (2 diffs)
- trunk/infrastructure/python/python.d (modified) (54 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/examples/testdll/testdll.d
r118 r120 13 13 } 14 14 15 char[]bar(int i) {15 string bar(int i) { 16 16 if (i > 10) { 17 17 return "It's greater than 10!"; … … 21 21 } 22 22 23 void baz(int i=10, char[]s="moo") {23 void baz(int i=10, string s="moo") { 24 24 writefln("i = %s\ns = %s", i, s); 25 25 } trunk/infrastructure/meta/Demangle.d
r40 r120 29 29 * Pretty-prints a mangled type string. 30 30 */ 31 template demangleType( char[]str, MangledNameType wantQualifiedNames = MangledNameType.PrettyName)31 template demangleType(string str, MangledNameType wantQualifiedNames = MangledNameType.PrettyName) 32 32 { 33 33 static if (wantQualifiedNames != MangledNameType.PrettyName) { … … 70 70 // split these off because they're numerous and simple 71 71 // Note: For portability, could replace "v" with void.mangleof, etc. 72 template demangleBasicType( char []str)72 template demangleBasicType(string str) 73 73 { 74 74 static if (str == "v") const char [] demangleBasicType = "void"; … … 106 106 } 107 107 108 template demangleTypeConsumed( char []str)108 template demangleTypeConsumed(string str) 109 109 { 110 110 static if (str[0]=='A') … … 132 132 133 133 // For static arrays, count number of digits used (eg, return 3 for "674") 134 template countLeadingDigits( char []str)134 template countLeadingDigits(string str) 135 135 { 136 136 static if (str.length>0 && beginsWithDigit!( str)) … … 147 147 // (this happens with templates, when the name being 'lengthed' is itself an Lname). 148 148 // We guard against this by ensuring that the L is less than the length of the string. 149 template getLname( char []str)149 template getLname(string str) 150 150 { 151 151 static if (str.length <= 9+1 || !beginsWithDigit!(str[1..$]) ) … … 163 163 // Deal with the case where an Lname contains an embedded "__D". 164 164 // This can happen when classes, typedefs, etc are declared inside a function. 165 template pretty_Dname( char []str, int dotnameconsumed, MangledNameType wantQualifiedNames)165 template pretty_Dname(string str, int dotnameconsumed, MangledNameType wantQualifiedNames) 166 166 { 167 167 static if ( isMangledFunction!( (str[2+dotnameconsumed]))) { … … 181 181 // Deal with the case where an Lname contains an embedded ("__D") function. 182 182 // Split into a seperate function because it's so complicated. 183 template pretty_Dfunction( char []str, int dotnameconsumed, int paramlistconsumed,183 template pretty_Dfunction(string str, int dotnameconsumed, int paramlistconsumed, 184 184 MangledNameType wantQualifiedNames) 185 185 { … … 203 203 204 204 // for an Lname that begins with "_D" 205 template get_DnameConsumed( char []str)205 template get_DnameConsumed(string str) 206 206 { 207 207 const int get_DnameConsumed = 2 + getQualifiedNameConsumed!(str[2..$]) … … 210 210 211 211 // If Lname is a template, shows it as a template 212 template prettyLname( char []str, MangledNameType wantQualifiedNames)212 template prettyLname(string str, MangledNameType wantQualifiedNames) 213 213 { 214 214 static if (str.length>3 && str[0..3] == "__T") // Template instance name … … 231 231 // str must start with an lname: first chars give the length 232 232 // how many chars are taken up with length digits + the name itself 233 template getLnameConsumed( char []str)233 template getLnameConsumed(string str) 234 234 { 235 235 static if (str.length==0) … … 245 245 } 246 246 247 template getQualifiedName( char [] str, MangledNameType wantQualifiedNames, char []dotstr = "")247 template getQualifiedName(string str, MangledNameType wantQualifiedNames, string dotstr = "") 248 248 { 249 249 static if (str.length==0) const char [] getQualifiedName=""; … … 269 269 } 270 270 271 template getQualifiedNameConsumed ( char []str)271 template getQualifiedNameConsumed (string str) 272 272 { 273 273 static if ( str.length>1 && beginsWithDigit!(str) ) { … … 290 290 * or "function " or "delegate " 291 291 */ 292 template demangleFunctionOrDelegate( char [] str, char []funcOrDelegStr, MangledNameType wantQualifiedNames)292 template demangleFunctionOrDelegate(string str, string funcOrDelegStr, MangledNameType wantQualifiedNames) 293 293 { 294 294 const char [] demangleFunctionOrDelegate = demangleExtern!(( str[0] )) … … 301 301 // Special case: types that are in function parameters 302 302 // For function parameters, the type can also contain 'lazy', 'out' or 'inout'. 303 template demangleFunctionParamType( char[]str, MangledNameType wantQualifiedNames)303 template demangleFunctionParamType(string str, MangledNameType wantQualifiedNames) 304 304 { 305 305 static if (str[0]=='L') … … 313 313 314 314 // Deal with 'out' and 'inout' parameters 315 template demangleFunctionParamTypeConsumed( char[]str)315 template demangleFunctionParamTypeConsumed(string str) 316 316 { 317 317 static if (str[0]=='K' || str[0]=='J' || str[0]=='L') … … 338 338 // Skip through the string until we find the return value. It can either be Z for normal 339 339 // functions, or Y for vararg functions. 340 template demangleReturnValue( char []str, MangledNameType wantQualifiedNames)340 template demangleReturnValue(string str, MangledNameType wantQualifiedNames) 341 341 { 342 342 static assert(str.length>=1, "Demangle error(Function): No return value found"); … … 347 347 348 348 // Stop when we get to the return value 349 template demangleParamList( char [] str, MangledNameType wantQualifiedNames, char[]commastr = "")349 template demangleParamList(string str, MangledNameType wantQualifiedNames, string commastr = "") 350 350 { 351 351 static if (str[0] == 'Z') … … 362 362 363 363 // How many characters are used in the parameter list and return value 364 template demangleParamListAndRetValConsumed( char []str)364 template demangleParamListAndRetValConsumed(string str) 365 365 { 366 366 static assert (str.length>0, "Demangle error(ParamList): No return value found"); … … 376 376 // TEMPLATES 377 377 378 template templateValueArgConsumed( char []str)378 template templateValueArgConsumed(string str) 379 379 { 380 380 static if (str[0]=='n') const int templateValueArgConsumed = 1; … … 387 387 388 388 // pretty-print a template value argument. 389 template prettyValueArg( char []str)389 template prettyValueArg(string str) 390 390 { 391 391 static if (str[0]=='n') const char [] prettyValueArg = "null"; … … 398 398 399 399 // Pretty-print a template argument 400 template prettyTemplateArg( char []str, MangledNameType wantQualifiedNames)400 template prettyTemplateArg(string str, MangledNameType wantQualifiedNames) 401 401 { 402 402 static if (str[0]=='S') // symbol name … … 411 411 } 412 412 413 template templateArgConsumed( char []str)413 template templateArgConsumed(string str) 414 414 { 415 415 static if (str[0]=='S') // symbol name … … 425 425 // Like function parameter lists, template parameter lists also end in a Z, 426 426 // but they don't have a return value at the end. 427 template prettyTemplateArgList( char [] str, MangledNameType wantQualifiedNames, char []commastr="")427 template prettyTemplateArgList(string str, MangledNameType wantQualifiedNames, string commastr="") 428 428 { 429 429 static if (str[0]=='Z') … … 435 435 } 436 436 437 template templateArgListConsumed( char []str)437 template templateArgListConsumed(string str) 438 438 { 439 439 static assert(str.length>0, "No Z found at end of template argument list"); … … 452 452 * it allows us to avoid the ugly double parentheses. 453 453 */ 454 template beginsWithDigit( char []s)454 template beginsWithDigit(string s) 455 455 { 456 456 static if (s[0]>='0' && s[0]<='9') trunk/infrastructure/pyd/class_wrap.d
r118 r120 276 276 mixin _Def!(fn, symbolnameof!(fn), typeof(&fn), ""); 277 277 } 278 struct Def(alias fn, char[]docstring) {278 struct Def(alias fn, string docstring) { 279 279 mixin _Def!(fn, /*symbolnameof!(fn),*/ symbolnameof!(fn), typeof(&fn)/+, minArgs!(fn)+/, docstring); 280 280 } 281 struct Def(alias fn, char[] name, char[]docstring) {281 struct Def(alias fn, string name, string docstring) { 282 282 mixin _Def!(fn, /*symbolnameof!(fn),*/ name, typeof(&fn)/+, minArgs!(fn)+/, docstring); 283 283 } 284 struct Def(alias fn, char[]name, fn_t) {284 struct Def(alias fn, string name, fn_t) { 285 285 mixin _Def!(fn, /*symbolnameof!(fn),*/ name, fn_t/+, minArgs!(fn)+/, ""); 286 286 } … … 288 288 mixin _Def!(fn, /*symbolnameof!(fn),*/ symbolnameof!(fn), fn_t/+, minArgs!(fn)+/, ""); 289 289 } 290 struct Def(alias fn, fn_t, char[]docstring) {290 struct Def(alias fn, fn_t, string docstring) { 291 291 mixin _Def!(fn, /*symbolnameof!(fn),*/ symbolnameof!(fn), fn_t/+, minArgs!(fn)+/, docstring); 292 292 } 293 struct Def(alias fn, char[] name, fn_t, char[]docstring) {293 struct Def(alias fn, string name, fn_t, string docstring) { 294 294 mixin _Def!(fn, /*symbolnameof!(fn),*/ name, fn_t/+, minArgs!(fn)+/, docstring); 295 295 } 296 296 /+ 297 template Def(alias fn, char[] name, fn_t, uint MIN_ARGS=minArgs!(fn)/+, char[]docstring=""+/) {297 template Def(alias fn, string name, fn_t, uint MIN_ARGS=minArgs!(fn)/+, string docstring=""+/) { 298 298 alias Def!(fn, /*symbolnameof!(fn),*/ name, fn_t, MIN_ARGS/+, docstring+/) Def; 299 299 } 300 300 +/ 301 template _Def(alias fn, /* char[] _realname,*/ char[] name, fn_t/+, uint MIN_ARGS=minArgs!(fn)+/, char[]docstring) {301 template _Def(alias fn, /*string _realname,*/ string name, fn_t/+, uint MIN_ARGS=minArgs!(fn)+/, string docstring) { 302 302 //static const type = ParamType.Def; 303 303 alias fn func; … … 336 336 mixin _StaticDef!(fn,/+ symbolnameof!(fn),+/ symbolnameof!(fn), typeof(&fn), minArgs!(fn), ""); 337 337 } 338 struct StaticDef(alias fn, char[]docstring) {338 struct StaticDef(alias fn, string docstring) { 339 339 mixin _StaticDef!(fn,/+ symbolnameof!(fn),+/ symbolnameof!(fn), typeof(&fn), minArgs!(fn), docstring); 340 340 } 341 struct StaticDef(alias _fn, char[] name, char[]docstring) {341 struct StaticDef(alias _fn, string name, string docstring) { 342 342 mixin _StaticDef!(fn,/+ symbolnameof!(fn),+/ name, typeof(&fn), minArgs!(fn), docstring); 343 343 } 344 struct StaticDef(alias _fn, char[] name, fn_t, char[]docstring) {344 struct StaticDef(alias _fn, string name, fn_t, string docstring) { 345 345 mixin _StaticDef!(fn,/+ symbolnameof!(fn),+/ name, fn_t, minArgs!(fn), docstring); 346 346 } … … 348 348 mixin _StaticDef!(fn,/+ symbolnameof!(fn),+/ symbolnameof!(fn), fn_t, minArgs!(fn), ""); 349 349 } 350 struct StaticDef(alias _fn, fn_t, char[]docstring) {350 struct StaticDef(alias _fn, fn_t, string docstring) { 351 351 mixin _StaticDef!(fn,/+ symbolnameof!(fn),+/ symbolnameof!(fn), fn_t, minArgs!(fn), docstring); 352 352 } 353 struct StaticDef(alias _fn, char[]name, fn_t) {353 struct StaticDef(alias _fn, string name, fn_t) { 354 354 mixin _StaticDef!(fn,/+ symbolnameof!(fn),+/ name, fn_t, minArgs!(fn), ""); 355 355 } 356 struct StaticDef(alias _fn, char[]name, fn_t, uint MIN_ARGS) {356 struct StaticDef(alias _fn, string name, fn_t, uint MIN_ARGS) { 357 357 mixin _StaticDef!(fn,/+ symbolnameof!(fn),+/ name, fn_t, MIN_ARGS, ""); 358 358 } 359 struct StaticDef(alias _fn, char[] name, fn_t, uint MIN_ARGS, char[]docstring) {359 struct StaticDef(alias _fn, string name, fn_t, uint MIN_ARGS, string docstring) { 360 360 mixin _StaticDef!(fn,/+ symbolnameof!(fn),+/ name, fn_t, MIN_ARGS, docstring); 361 361 } 362 template _StaticDef(alias fn,/+ char[] _realname,+/ char[] name, fn_t, uint MIN_ARGS, char[]docstring) {362 template _StaticDef(alias fn,/+ string _realname,+/ string name, fn_t, uint MIN_ARGS, string docstring) { 363 363 //static const type = ParamType.StaticDef; 364 364 alias fn func; … … 397 397 mixin _Property!(fn, symbolnameof!(fn), symbolnameof!(fn), false, ""); 398 398 } 399 struct Property(alias fn, char[]docstring) {399 struct Property(alias fn, string docstring) { 400 400 mixin _Property!(fn, symbolnameof!(fn), symbolnameof!(fn), false, docstring); 401 401 } 402 struct Property(alias fn, char[] name, char[]docstring) {402 struct Property(alias fn, string name, string docstring) { 403 403 mixin _Property!(fn, symbolnameof!(fn), name, false, docstring); 404 404 } 405 struct Property(alias fn, char[]name, bool RO) {405 struct Property(alias fn, string name, bool RO) { 406 406 mixin _Property!(fn, symbolnameof!(fn), name, RO, ""); 407 407 } 408 struct Property(alias fn, char[] name, bool RO, char[]docstring) {408 struct Property(alias fn, string name, bool RO, string docstring) { 409 409 mixin _Property!(fn, symbolnameof!(fn), name, RO, docstring); 410 410 } … … 412 412 mixin _Property!(fn, symbolnameof!(fn), symbolnameof!(fn), RO, ""); 413 413 } 414 struct Property(alias fn, bool RO, char[]docstring) {414 struct Property(alias fn, bool RO, string docstring) { 415 415 mixin _Property!(fn, symbolnameof!(fn), symbolnameof!(fn), RO, docstring); 416 416 } 417 template _Property(alias fn, char[] _realname, char[] name, bool RO, char[]docstring) {417 template _Property(alias fn, string _realname, string name, bool RO, string docstring) { 418 418 alias property_parts!(fn).getter_type get_t; 419 419 alias property_parts!(fn).setter_type set_t; … … 545 545 iterator. 546 546 */ 547 struct AltIter(alias fn, char[]name = symbolnameof!(fn), iter_t = ParameterTypeTuple!(fn)[0]) {547 struct AltIter(alias fn, string name = symbolnameof!(fn), iter_t = ParameterTypeTuple!(fn)[0]) { 548 548 static const bool needs_shim = false; 549 549 static void call(T) () { … … 564 564 } /*Pyd_with_StackThreads*/ 565 565 566 void wrap_class(T, Params...) ( char[] docstring="", char[]modulename="") {566 void wrap_class(T, Params...) (string docstring="", string modulename="") { 567 567 _wrap_class!(T, symbolnameof!(T), Params).wrap_class(docstring, modulename); 568 568 } … … 572 572 } 573 573 +/ 574 template _wrap_class(_T, char[]name, Params...) {574 template _wrap_class(_T, string name, Params...) { 575 575 static if (is(_T == class)) { 576 576 pragma(msg, "wrap_class: " ~ name); … … 587 587 alias _T* T; 588 588 } 589 void wrap_class( char[] docstring="", char[]modulename="") {589 void wrap_class(string docstring="", string modulename="") { 590 590 pragma(msg, "shim.mangleof: " ~ shim_class.mangleof); 591 591 alias wrapped_class_type!(T) type; … … 603 603 604 604 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))); 606 606 607 607 ////////////////// 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); trunk/infrastructure/pyd/func_wrap.d
r113 r120 59 59 } 60 60 61 void setWrongArgsError(int gotArgs, uint minArgs, uint maxArgs, char[]funcName="") {61 void setWrongArgsError(int gotArgs, uint minArgs, uint maxArgs, string funcName="") { 62 62 char[] str; 63 63 if (funcName == "") { … … 238 238 return null; 239 239 } 240 fn_to_dg!(fn_t) dg = dg_wrapper!(C, fn_t)(instance, &real_fn);240 fn_to_dg!(fn_t) dg = dg_wrapper!(C, fn_t)(instance, cast(fn_t)&real_fn); 241 241 return pyApplyToDelegate(dg, args); 242 242 }); trunk/infrastructure/pyd/lib_abstract.d
r110 r120 42 42 } 43 43 } else { 44 char[]objToStr(Object o) {44 string objToStr(Object o) { 45 45 return o.toString(); 46 46 } 47 public import meta.Nameof : symbolnameof, prettytypeof, prettynameof; 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; 52 } 53 } 54 public import meta.Nameof : /*symbolnameof,*/ prettytypeof, prettynameof; 48 55 49 56 public import std.string : toString; trunk/infrastructure/pyd/make_object.d
r114 r120 152 152 } else static if (is(T : cdouble)) { 153 153 return PyComplex_FromDoubles(t.re, t.im); 154 } else static if (is(T : char[])) {154 } else static if (is(T : string)) { 155 155 return PyString_FromString((t ~ \0).ptr); 156 156 } else static if (is(T : wchar[])) { … … 279 279 */ 280 280 class PydConversionException : Exception { 281 this( char[]msg) { super(msg); }281 this(string msg) { super(msg); } 282 282 } 283 283 … … 353 353 return temp; 354 354 +/ 355 } else static if (is(string : T)) { 356 const(char)* result; 357 PyObject* repr; 358 // If it's a string, convert it 359 if (PyString_Check(o) || PyUnicode_Check(o)) { 360 result = PyString_AsString(o); 361 // If it's something else, convert its repr 362 } else { 363 repr = PyObject_Repr(o); 364 if (repr is null) handle_exception(); 365 result = PyString_AsString(repr); 366 Py_DECREF(repr); 367 } 368 if (result is null) handle_exception(); 369 return .toString(result); 355 370 } else static if (is(char[] : T)) { 356 c har* result;371 const(char)* result; 357 372 PyObject* repr; 358 373 // If it's a string, convert it … … 440 455 // Pull out the name of the type of this Python object, and the 441 456 // name of the D type. 442 char[]py_typename, d_typename;457 string py_typename, d_typename; 443 458 PyObject* py_type, py_type_str; 444 459 py_type = PyObject_Type(o); trunk/infrastructure/pyd/make_wrapper.d
r118 r120 114 114 } 115 115 } 116 template __pyd_get_overload( char[]realname, fn_t) {117 ReturnType!(fn_t) func(T ...) ( char[]name, T t) {116 template __pyd_get_overload(string realname, fn_t) { 117 ReturnType!(fn_t) func(T ...) (string name, T t) { 118 118 PyObject* _pyobj = this.__pyd_get_pyobj(); 119 119 if (_pyobj !is null) { trunk/infrastructure/pyd/struct_wrap.d
r118 r120 37 37 // as a template parameter, rather than the struct type itself. 38 38 39 template wrapped_member(T, char[]name, _M=void) {39 template wrapped_member(T, string name, _M=void) { 40 40 alias wrapped_class_type!(T) type; 41 41 alias wrapped_class_object!(T) obj; … … 63 63 } 64 64 65 struct Member( char[]realname) {65 struct Member(string realname) { 66 66 mixin _Member!(realname, realname, ""); 67 67 } 68 struct Member( char[] realname, char[]docstring) {68 struct Member(string realname, string docstring) { 69 69 mixin _Member!(realname, realname, docstring); 70 70 } 71 struct Member( char[] realname, char[] name, char[]docstring) {71 struct Member(string realname, string name, string docstring) { 72 72 mixin _Member!(realname, name, docstring); 73 73 } 74 template _Member( char[] realname, char[] name, char[]docstring) {74 template _Member(string realname, string name, string docstring) { 75 75 static const bool needs_shim = false; 76 76 static void call(T) () { trunk/infrastructure/python/python.d
r119 r120 61 61 } 62 62 63 version (D_Version2) { 64 alias const(char)* c_str; 65 } else { 66 alias char* c_str; 67 } 68 63 69 /* 64 70 * Py_ssize_t is defined as a signed type which is 8 bytes on X86_64 and 4 … … 137 143 alias int (*getwritebufferproc)(PyObject *, int, void **); 138 144 alias int (*getsegcountproc)(PyObject *, int *); 139 alias int (*getcharbufferproc)(PyObject *, int, c har **);145 alias int (*getcharbufferproc)(PyObject *, int, c_str*); 140 146 // ssize_t-based buffer interface 141 147 alias Py_ssize_t (*readbufferproc)(PyObject *, Py_ssize_t, void **); 142 148 alias Py_ssize_t (*writebufferproc)(PyObject *, Py_ssize_t, void **); 143 149 alias Py_ssize_t (*segcountproc)(PyObject *, Py_ssize_t *); 144 alias Py_ssize_t (*charbufferproc)(PyObject *, Py_ssize_t, c har **);150 alias Py_ssize_t (*charbufferproc)(PyObject *, Py_ssize_t, c_str*); 145 151 146 152 alias int (*objobjproc)(PyObject *, PyObject *); … … 226 232 alias void (*destructor)(PyObject *); 227 233 alias int (*printfunc)(PyObject *, FILE *, int); 228 alias PyObject *(*getattrfunc)(PyObject *, c har *);234 alias PyObject *(*getattrfunc)(PyObject *, c_str); 229 235 alias PyObject *(*getattrofunc)(PyObject *, PyObject *); 230 alias int (*setattrfunc)(PyObject *, c har *, PyObject *);236 alias int (*setattrfunc)(PyObject *, c_str, PyObject *); 231 237 alias int (*setattrofunc)(PyObject *, PyObject *, PyObject *); 232 238 alias int (*cmpfunc)(PyObject *, PyObject *); … … 245 251 mixin PyObject_VAR_HEAD; 246 252 247 c har *tp_name;253 c_str tp_name; 248 254 Py_ssize_t tp_basicsize, tp_itemsize; 249 255 … … 269 275 C_long tp_flags; 270 276 271 c har *tp_doc;277 c_str tp_doc; 272 278 273 279 traverseproc tp_traverse; … … 362 368 PyObject * PyObject_RichCompare(PyObject *, PyObject *, int); 363 369 int PyObject_RichCompareBool(PyObject *, PyObject *, int); 364 PyObject * PyObject_GetAttrString(PyObject *, c har *);365 int PyObject_SetAttrString(PyObject *, c har *, PyObject *);366 int PyObject_HasAttrString(PyObject *, c har *);370 PyObject * PyObject_GetAttrString(PyObject *, c_str); 371 int PyObject_SetAttrString(PyObject *, c_str, PyObject *); 372 int PyObject_HasAttrString(PyObject *, c_str); 367 373 PyObject * PyObject_GetAttr(PyObject *, PyObject *); 368 374 int PyObject_SetAttr(PyObject *, PyObject *, PyObject *); … … 542 548 543 549 int PyUnicodeUCS2_Resize(PyObject **unicode, Py_ssize_t length); 544 PyObject *PyUnicodeUCS2_FromEncodedObject(PyObject *obj, c har *encoding, char *errors);550 PyObject *PyUnicodeUCS2_FromEncodedObject(PyObject *obj, c_str encoding, c_str errors); 545 551 PyObject *PyUnicodeUCS2_FromObject(PyObject *obj); 546 552 … … 550 556 PyObject *PyUnicodeUCS2_FromOrdinal(int ordinal); 551 557 552 PyObject *_PyUnicodeUCS2_AsDefaultEncodedString(PyObject *, c har *);553 554 c har *PyUnicodeUCS2_GetDefaultEncoding();555 int PyUnicodeUCS2_SetDefaultEncoding(c har *encoding);556 557 PyObject *PyUnicodeUCS2_Decode(c har *s, Py_ssize_t size, char *encoding, char *errors);558 PyObject *PyUnicodeUCS2_Encode(Py_UNICODE *s, Py_ssize_t size, c har *encoding, char *errors);559 PyObject *PyUnicodeUCS2_AsEncodedObject(PyObject *unicode, c har *encoding, char *errors);560 PyObject *PyUnicodeUCS2_AsEncodedString(PyObject *unicode, c har *encoding, char *errors);561 562 PyObject *PyUnicodeUCS2_DecodeUTF7(c har *string, Py_ssize_t length, char *errors);558 PyObject *_PyUnicodeUCS2_AsDefaultEncodedString(PyObject *, c_str); 559 560 c_str PyUnicodeUCS2_GetDefaultEncoding(); 561 int PyUnicodeUCS2_SetDefaultEncoding(c_str encoding); 562 563 PyObject *PyUnicodeUCS2_Decode(c_str s, Py_ssize_t size, c_str encoding, c_str errors); 564 PyObject *PyUnicodeUCS2_Encode(Py_UNICODE *s, Py_ssize_t size, c_str encoding, c_str errors); 565 PyObject *PyUnicodeUCS2_AsEncodedObject(PyObject *unicode, c_str encoding, c_str errors); 566 PyObject *PyUnicodeUCS2_AsEncodedString(PyObject *unicode, c_str encoding, c_str errors); 567 568 PyObject *PyUnicodeUCS2_DecodeUTF7(c_str s, Py_ssize_t length, c_str errors); 563 569 PyObject *PyUnicodeUCS2_EncodeUTF7(Py_UNICODE *data, Py_ssize_t length, 564 int encodeSetO, int encodeWhiteSpace, c har *errors570 int encodeSetO, int encodeWhiteSpace, c_str errors 565 571 ); 566 572 567 PyObject *PyUnicodeUCS2_DecodeUTF8(c har *string, Py_ssize_t length, char *errors);568 PyObject *PyUnicodeUCS2_DecodeUTF8Stateful(c har *string, Py_ssize_t length,569 c har *errors, Py_ssize_t *consumed573 PyObject *PyUnicodeUCS2_DecodeUTF8(c_str s, Py_ssize_t length, c_str errors); 574 PyObject *PyUnicodeUCS2_DecodeUTF8Stateful(c_str s, Py_ssize_t length, 575 c_str errors, Py_ssize_t *consumed 570 576 ); 571 577 PyObject *PyUnicodeUCS2_AsUTF8String(PyObject *unicode); 572 PyObject *PyUnicodeUCS2_EncodeUTF8(Py_UNICODE *data, Py_ssize_t length, c har *errors);573 574 PyObject *PyUnicodeUCS2_DecodeUTF16(c har *string, Py_ssize_t length, char *errors, int *byteorder);575 PyObject *PyUnicodeUCS2_DecodeUTF16Stateful(c har *string, Py_ssize_t length,576 c har *errors, int *byteorder, Py_ssize_t *consumed578 PyObject *PyUnicodeUCS2_EncodeUTF8(Py_UNICODE *data, Py_ssize_t length, c_str errors); 579 580 PyObject *PyUnicodeUCS2_DecodeUTF16(c_str s, Py_ssize_t length, c_str errors, int *byteorder); 581 PyObject *PyUnicodeUCS2_DecodeUTF16Stateful(c_str s, Py_ssize_t length, 582 c_str errors, int *byteorder, Py_ssize_t *consumed 577 583 ); 578 584 PyObject *PyUnicodeUCS2_AsUTF16String(PyObject *unicode); 579 585 PyObject *PyUnicodeUCS2_EncodeUTF16(Py_UNICODE *data, Py_ssize_t length, 580 c har *errors, int byteorder586 c_str errors, int byteorder 581 587 ); 582 588 583 PyObject *PyUnicodeUCS2_DecodeUnicodeEscape(c har *string, Py_ssize_t length, char *errors);589 PyObject *PyUnicodeUCS2_DecodeUnicodeEscape(c_str s, Py_ssize_t length, c_str errors); 584 590 PyObject *PyUnicodeUCS2_AsUnicodeEscapeString(PyObject *unicode); 585 591 PyObject *PyUnicodeUCS2_EncodeUnicodeEscape(Py_UNICODE *data, Py_ssize_t length); 586 PyObject *PyUnicodeUCS2_DecodeRawUnicodeEscape(c har *string, Py_ssize_t length, char *errors);592 PyObject *PyUnicodeUCS2_DecodeRawUnicodeEscape(c_str s, Py_ssize_t length, c_str errors); 587 593 PyObject *PyUnicodeUCS2_AsRawUnicodeEscapeString(PyObject *unicode); 588 594 PyObject *PyUnicodeUCS2_EncodeRawUnicodeEscape(Py_UNICODE *data, Py_ssize_t length); 589 595 590 PyObject *_PyUnicodeUCS2_DecodeUnicodeInternal(c har *string, Py_ssize_t length, char *errors);591 592 PyObject *PyUnicodeUCS2_DecodeLatin1(c har *string, Py_ssize_t length, char *errors);596 PyObject *_PyUnicodeUCS2_DecodeUnicodeInternal(c_str s, Py_ssize_t length, c_str errors); 597 598 PyObject *PyUnicodeUCS2_DecodeLatin1(c_str s, Py_ssize_t length, c_str errors); 593 599 PyObject *PyUnicodeUCS2_AsLatin1String(PyObject *unicode); 594 PyObject *PyUnicodeUCS2_EncodeLatin1(Py_UNICODE *data, Py_ssize_t length, c har *errors);595 596 PyObject *PyUnicodeUCS2_DecodeASCII(c har *string, Py_ssize_t length, char *errors);600 PyObject *PyUnicodeUCS2_EncodeLatin1(Py_UNICODE *data, Py_ssize_t length, c_str errors); 601 602 PyObject *PyUnicodeUCS2_DecodeASCII(c_str s, Py_ssize_t length, c_str errors); 597 603 PyObject *PyUnicodeUCS2_AsASCIIString(PyObject *unicode); 598 PyObject *PyUnicodeUCS2_EncodeASCII(Py_UNICODE *data, Py_ssize_t length, c har *errors);599 600 PyObject *PyUnicodeUCS2_DecodeCharmap(c har *string, Py_ssize_t length,601 PyObject *mapping, c har *errors604 PyObject *PyUnicodeUCS2_EncodeASCII(Py_UNICODE *data, Py_ssize_t length, c_str errors); 605 606 PyObject *PyUnicodeUCS2_DecodeCharmap(c_str s, Py_ssize_t length, 607 PyObject *mapping, c_str errors 602 608 ); 603 609 PyObject *PyUnicodeUCS2_AsCharmapString(PyObject *unicode, PyObject *mapping); 604 610 PyObject *PyUnicodeUCS2_EncodeCharmap(Py_UNICODE *data, Py_ssize_t length, 605 PyObject *mapping, c har *errors611 PyObject *mapping, c_str errors 606 612 ); 607 613 PyObject *PyUnicodeUCS2_TranslateCharmap(Py_UNICODE *data, Py_ssize_t length, 608 PyObject *table, c har *errors614 PyObject *table, c_str errors 609 615 ); 610 616 611 617 version (Windows) { 612 PyObject *PyUnicodeUCS2_DecodeMBCS(c har *string, Py_ssize_t length, char *errors);618 PyObject *PyUnicodeUCS2_DecodeMBCS(c_str s, Py_ssize_t length, c_str errors); 613 619 PyObject *PyUnicodeUCS2_AsMBCSString(PyObject *unicode); 614 PyObject *PyUnicodeUCS2_EncodeMBCS(Py_UNICODE *data, Py_ssize_t length, c har *errors);620 PyObject *PyUnicodeUCS2_EncodeMBCS(Py_UNICODE *data, Py_ssize_t length, c_str errors); 615 621 } 616 622 617 int PyUnicodeUCS2_EncodeDecimal(Py_UNICODE *s, Py_ssize_t length, c har *output, char *errors);623 int PyUnicodeUCS2_EncodeDecimal(Py_UNICODE *s, Py_ssize_t length, c_str output, c_str errors); 618 624 619 625 PyObject *PyUnicodeUCS2_Concat(PyObject *left, PyObject *right); … … 625 631 } 626 632 PyObject *PyUnicodeUCS2_RSplit(PyObject *s, PyObject *sep, Py_ssize_t maxsplit); 627 PyObject *PyUnicodeUCS2_Translate(PyObject *str, PyObject *table, c har *errors);633 PyObject *PyUnicodeUCS2_Translate(PyObject *str, PyObject *table, c_str errors); 628 634 PyObject *PyUnicodeUCS2_Join(PyObject *separator, PyObject *seq); 629 635 Py_ssize_t PyUnicodeUCS2_Tailmatch(PyObject *str, PyObject *substr, … … 668 674 669 675 int PyUnicodeUCS4_Resize(PyObject **unicode, Py_ssize_t length); 670 PyObject *PyUnicodeUCS4_FromEncodedObject(PyObject *obj, c har *encoding, char *errors);676 PyObject *PyUnicodeUCS4_FromEncodedObject(PyObject *obj, c_str encoding, c_str errors); 671 677 PyObject *PyUnicodeUCS4_FromObject(PyObject *obj); 672 678 … … 676 682 PyObject *PyUnicodeUCS4_FromOrdinal(int ordinal); 677 683 678 PyObject *_PyUnicodeUCS4_AsDefaultEncodedString(PyObject *, c har *);679 680 c har *PyUnicodeUCS4_GetDefaultEncoding();681 int PyUnicodeUCS4_SetDefaultEncoding(c har *encoding);682 683 PyObject *PyUnicodeUCS4_Decode(c har *s, Py_ssize_t size, char *encoding, char *errors);684 PyObject *PyUnicodeUCS4_Encode(Py_UNICODE *s, Py_ssize_t size, c har *encoding, char *errors);685 PyObject *PyUnicodeUCS4_AsEncodedObject(PyObject *unicode, c har *encoding, char *errors);686 PyObject *PyUnicodeUCS4_AsEncodedString(PyObject *unicode, c har *encoding, char *errors);687 688 PyObject *PyUnicodeUCS4_DecodeUTF7(c har *string, Py_ssize_t length, char *errors);684 PyObject *_PyUnicodeUCS4_AsDefaultEncodedString(PyObject *, c_str); 685 686 c_str PyUnicodeUCS4_GetDefaultEncoding(); 687 int PyUnicodeUCS4_SetDefaultEncoding(c_str encoding); 688 689 PyObject *PyUnicodeUCS4_Decode(c_str s, Py_ssize_t size, c_str encoding, c_str errors); 690 PyObject *PyUnicodeUCS4_Encode(Py_UNICODE *s, Py_ssize_t size, c_str encoding, c_str errors); 691 PyObject *PyUnicodeUCS4_AsEncodedObject(PyObject *unicode, c_str encoding, c_str errors); 692 PyObject *PyUnicodeUCS4_AsEncodedString(PyObject *unicode, c_str encoding, c_str errors); 693 694 PyObject *PyUnicodeUCS4_DecodeUTF7(c_str s, Py_ssize_t length, c_str errors); 689 695 PyObject *PyUnicodeUCS4_EncodeUTF7(Py_UNICODE *data, Py_ssize_t length, 690 int encodeSetO, int encodeWhiteSpace, c har *errors696 int encodeSetO, int encodeWhiteSpace, c_str errors 691 697 ); 692 698 693 PyObject *PyUnicodeUCS4_DecodeUTF8(c har *string, Py_ssize_t length, char *errors);694 PyObject *PyUnicodeUCS4_DecodeUTF8Stateful(c har *string, Py_ssize_t length,695 c har *errors, Py_ssize_t *consumed699 PyObject *PyUnicodeUCS4_DecodeUTF8(c_str s, Py_ssize_t length, c_str errors); 700 PyObject *PyUnicodeUCS4_DecodeUTF8Stateful(c_str string, Py_ssize_t length, 701 c_str errors, Py_ssize_t *consumed 696 702 ); 697 703 PyObject *PyUnicodeUCS4_AsUTF8String(PyObject *unicode); 698 PyObject *PyUnicodeUCS4_EncodeUTF8(Py_UNICODE *data, Py_ssize_t length, c har *errors);699 700 PyObject *PyUnicodeUCS4_DecodeUTF16(c har *string, Py_ssize_t length, char *errors, int *byteorder);701 PyObject *PyUnicodeUCS4_DecodeUTF16Stateful(c har *string, Py_ssize_t length,702 c har *errors, int *byteorder, Py_ssize_t *consumed704 PyObject *PyUnicodeUCS4_EncodeUTF8(Py_UNICODE *data, Py_ssize_t length, c_str errors); 705 706 PyObject *PyUnicodeUCS4_DecodeUTF16(c_str s, Py_ssize_t length, c_str errors, int *byteorder); 707 PyObject *PyUnicodeUCS4_DecodeUTF16Stateful(c_str s, Py_ssize_t length, 708 c_str errors, int *byteorder, Py_ssize_t *consumed 703 709 ); 704 710 PyObject *PyUnicodeUCS4_AsUTF16String(PyObject *unicode); 705 711 PyObject *PyUnicodeUCS4_EncodeUTF16(Py_UNICODE *data, Py_ssize_t length, 706 c har *errors, int byteorder712 c_str errors, int byteorder 707 713 ); 708 714 709 PyObject *PyUnicodeUCS4_DecodeUnicodeEscape(c har *string, Py_ssize_t length, char *errors);715 PyObject *PyUnicodeUCS4_DecodeUnicodeEscape(c_str s, Py_ssize_t length, c_str errors); 710 716 PyObject *PyUnicodeUCS4_AsUnicodeEscapeString(PyObject *unicode); 711 717 PyObject *PyUnicodeUCS4_EncodeUnicodeEscape(Py_UNICODE *data, Py_ssize_t length); 712 PyObject *PyUnicodeUCS4_DecodeRawUnicodeEscape(c har *string, Py_ssize_t length, char *errors);718 PyObject *PyUnicodeUCS4_DecodeRawUnicodeEscape(c_str s, Py_ssize_t length, c_str errors); 713 719 PyObject *PyUnicodeUCS4_AsRawUnicodeEscapeString(PyObject *unicode); 714 720 PyObject *PyUnicodeUCS4_EncodeRawUnicodeEscape(Py_UNICODE *data, Py_ssize_t length); 715 721 716 PyObject *_PyUnicodeUCS4_DecodeUnicodeInternal(c har *string, Py_ssize_t length, char *errors);717 718 PyObject *PyUnicodeUCS4_DecodeLatin1(c har *string, Py_ssize_t length, char *errors);722 PyObject *_PyUnicodeUCS4_DecodeUnicodeInternal(c_str s, Py_ssize_t length, c_str errors); 723 724 PyObject *PyUnicodeUCS4_DecodeLatin1(c_str s, Py_ssize_t length, c_str errors); 719 725 PyObject *PyUnicodeUCS4_AsLatin1String(PyObject *unicode); 720 PyObject *PyUnicodeUCS4_EncodeLatin1(Py_UNICODE *data, Py_ssize_t length, c har *errors);721 722 PyObject *PyUnicodeUCS4_DecodeASCII(c har *string, Py_ssize_t length, char *errors);726 PyObject *PyUnicodeUCS4_EncodeLatin1(Py_UNICODE *data, Py_ssize_t length, c_str errors); 727 728 PyObject *PyUnicodeUCS4_DecodeASCII(c_str s, Py_ssize_t length, c_str errors); 723 729 PyObject *PyUnicodeUCS4_AsASCIIString(PyObject *unicode); 724 PyObject *PyUnicodeUCS4_EncodeASCII(Py_UNICODE *data, Py_ssize_t length, c har *errors);725 726 PyObject *PyUnicodeUCS4_DecodeCharmap(c har *string, Py_ssize_t length,727 PyObject *mapping, c har *errors730 PyObject *PyUnicodeUCS4_EncodeASCII(Py_UNICODE *data, Py_ssize_t length, c_str errors); 731 732 PyObject *PyUnicodeUCS4_DecodeCharmap(c_str s, Py_ssize_t length, 733 PyObject *mapping, c_str errors 728 734 ); 729 735 PyObject *PyUnicodeUCS4_AsCharmapString(PyObject *unicode, PyObject *mapping); 730 736 PyObject *PyUnicodeUCS4_EncodeCharmap(Py_UNICODE *data, Py_ssize_t length, 731 PyObject *mapping, c har *errors737 PyObject *mapping, c_str errors 732 738 ); 733 739 PyObject *PyUnicodeUCS4_TranslateCharmap(Py_UNICODE *data, Py_ssize_t length, 734 PyObject *table, c har *errors740 PyObject *table, c_str errors 735 741 ); 736 742 737 743 version (Windows) { 738 PyObject *PyUnicodeUCS4_DecodeMBCS(c har *string, Py_ssize_t length, char *errors);744 PyObject *PyUnicodeUCS4_DecodeMBCS(c_str s, Py_ssize_t length, c_str errors); 739 745 PyObject *PyUnicodeUCS4_AsMBCSString(PyObject *unicode); 740 PyObject *PyUnicodeUCS4_EncodeMBCS(Py_UNICODE *data, Py_ssize_t length, c har *errors);746 PyObject *PyUnicodeUCS4_EncodeMBCS(Py_UNICODE *data, Py_ssize_t length, c_str errors); 741 747 } 742 748 743 int PyUnicodeUCS4_EncodeDecimal(Py_UNICODE *s, Py_ssize_t length, c har *output, char *errors);749 int PyUnicodeUCS4_EncodeDecimal(Py_UNICODE *s, Py_ssize_t length, c_str output, c_str errors); 744 750 745 751 PyObject *PyUnicodeUCS4_Concat(PyObject *left, PyObject *right); … … 751 757 } 752 758 PyObject *PyUnicodeUCS4_RSplit(PyObject *s, PyObject *sep, Py_ssize_t maxsplit); 753 PyObject *PyUnicodeUCS4_Translate(PyObject *str, PyObject *table, c har *errors);759 PyObject *PyUnicodeUCS4_Translate(PyObject *str, PyObject *table, c_str errors); 754 760 PyObject *PyUnicodeUCS4_Join(PyObject *separator, PyObject *seq); 755 761 Py_ssize_t PyUnicodeUCS4_Tailmatch(PyObject *str, PyObject *substr, … … 1216 1222 } 1217 1223 1218 PyObject * PyString_FromStringAndSize(c har *, Py_ssize_t);1219 PyObject * PyString_FromString(c har *);1224 PyObject * PyString_FromStringAndSize(c_str, Py_ssize_t); 1225 PyObject * PyString_FromString(c_str); 1220 1226 // PyString_FromFormatV omitted 1221 PyObject * PyString_FromFormat(c har*, ...);1227 PyObject * PyString_FromFormat(c_str, ...); 1222 1228 Py_ssize_t PyString_Size(PyObject *); 1223 c har *PyString_AsString(PyObject *);1229 c_str PyString_AsString(PyObject *); 1224 1230 /* Use only if you know it's a string */ 1225 1231 int PyString_CHECK_INTERNED(PyObject* op) { … … 1227 1233 } 1228 1234 /* Macro, trading safety for speed */ 1229 c har*PyString_AS_STRING(PyObject* op) {1235 c_str PyString_AS_STRING(PyObject* op) { 1230 1236 return (cast(PyStringObject*)op).ob_sval; 1231 1237 } … … 1246 1252 1247 1253 1248 PyObject* PyString_Decode(c har *s, Py_ssize_t size, char *encoding, char *errors);1249 PyObject* PyString_Encode(c har *s, Py_ssize_t size, char *encoding, char *errors);1250 1251 PyObject* PyString_AsEncodedObject(PyObject *str, c har *encoding, char *errors);1252 PyObject* PyString_AsDecodedObject(PyObject *str, c har *encoding, char *errors);1254 PyObject* PyString_Decode(c_str s, Py_ssize_t size, c_str encoding, c_str errors); 1255 PyObject* PyString_Encode(c_str s, Py_ssize_t size, c_str encoding, c_str errors); 1256 1257 PyObject* PyString_AsEncodedObject(PyObject *str, c_str encoding, c_str errors); 1258 PyObject* PyString_AsDecodedObject(PyObject *str, c_str encoding, c_str errors); 1253 1259 1254 1260 // Since no one has legacy Python extensions written in D, the deprecated … … 1434 1440 int PyDict_MergeFromSeq2(PyObject *d, PyObject *seq2, int override_); 1435 1441 1436 PyObject * PyDict_GetItemString(PyObject *dp, c har *key);1437 int PyDict_SetItemString(PyObject *dp, c har *key, PyObject *item);1438 int PyDict_DelItemString(PyObject *dp, c har *key);1442 PyObject * PyDict_GetItemString(PyObject *dp, c_str key); 1443 int PyDict_SetItemString(PyObject *dp, c_str key, PyObject *item); 1444 int PyDict_DelItemString(PyObject *dp, c_str key); 1439 1445 1440 1446 … … 1462 1468 1463 1469 struct PyMethodDef { 1464 c har *ml_name;1470 c_str ml_name; 1465 1471 PyCFunction ml_meth; 1466 1472 int ml_flags; 1467 c har *ml_doc;1468 } 1469 1470 PyObject * Py_FindMethod(PyMethodDef[], PyObject *, c har *);1473 c_str ml_doc; 1474 } 1475 1476 PyObject * Py_FindMethod(PyMethodDef[], PyObject *, c_str); 1471 1477 PyObject * PyCFunction_NewEx(PyMethodDef *, PyObject *,PyObject *); 1472 1478 PyObject * PyCFunction_New(PyMethodDef* ml, PyObject* self) { … … 1488 1494 } 1489 1495 1490 PyObject * Py_FindMethodInChain(PyMethodChain *, PyObject *, c har *);1496 PyObject * Py_FindMethodInChain(PyMethodChain *, PyObject *, c_str); 1491 1497 1492 1498 struct PyCFunctionObject { … … 1515 1521 } 1516 1522 1517 PyObject * PyModule_New(c har *);1523 PyObject * PyModule_New(c_str); 1518 1524 PyObject * PyModule_GetDict(PyObject *); 1519 c har *PyModule_GetName(PyObject *);1520 c har *PyModule_GetFilename(PyObject *);1525 c_str PyModule_GetName(PyObject *); 1526 c_str PyModule_GetFilename(PyObject *); 1521 1527 version (Python_2_5_Or_Later) { 1522 1528 void _PyModule_Clear(PyObject *); … … 1525 1531 // Python-header-file: Include/modsupport.h: 1526 1532 1527 const int PYTHON_API_VERSION = 1013; 1528 const char[] PYTHON_API_STRING = "1013"; 1529 1530 int PyArg_Parse(PyObject *, char *, ...); 1531 int PyArg_ParseTuple(PyObject *, char *, ...); 1533 version (Python_2_5_Or_Later) { 1534 const int PYTHON_API_VERSION = 1013; 1535 const char[] PYTHON_API_STRING = "1013"; 1536 } else { 1537 const int PYTHON_API_VERSION = 1012; 1538 const char[] PYTHON_API_STRING = "1012"; 1539 } 1540 1541 int PyArg_Parse(PyObject *, c_str, ...); 1542 int PyArg_ParseTuple(PyObject *, c_str, ...); 1532 1543 int PyArg_ParseTupleAndKeywords(PyObject *, PyObject *, 1533 c har *, char **, ...);1534 int PyArg_UnpackTuple(PyObject *, c har *, Py_ssize_t, Py_ssize_t, ...);1535 PyObject * Py_BuildValue(c har *, ...);1536 1537 int PyModule_AddObject(PyObject *, c har *, PyObject *);1538 int PyModule_AddIntConstant(PyObject *, c har *, C_long);1539 int PyModule_AddStringConstant(PyObject *, c har *, char *);1540 1541 PyObject * Py_InitModule4(c har *name, PyMethodDef *methods, char *doc,1544 c_str, char **, ...); 1545 int PyArg_UnpackTuple(PyObject *, c_str, Py_ssize_t, Py_ssize_t, ...); 1546 PyObject * Py_BuildValue(c_str, ...); 1547 1548 int PyModule_AddObject(PyObject *, c_str, PyObject *); 1549 int PyModule_AddIntConstant(PyObject *, c_str, C_long); 1550 int PyModule_AddStringConstant(PyObject *, c_str, c_str); 1551 1552 PyObject * Py_InitModule4(c_str name, PyMethodDef *methods, c_str doc, 1542 1553 PyObject *self, int apiver); 1543 1554 1544 PyObject * Py_InitModule(c har *name, PyMethodDef *methods)1555 PyObject * Py_InitModule(c_str name, PyMethodDef *methods) 1545 1556 { 1546 return Py_InitModule4(name, methods, cast(c har *)(null),1557 return Py_InitModule4(name, methods, cast(c_str)(null), 1547 1558 cast(PyObject *)(null), PYTHON_API_VERSION); 1548 1559 } 1549 1560 1550 PyObject * Py_InitModule3(c har *name, PyMethodDef *methods, char *doc) {1561 PyObject * Py_InitModule3(c_str name, PyMethodDef *methods, c_str doc) { 1551 1562 return Py_InitModule4(name, methods, doc, cast(PyObject *)null, 1552 1563 PYTHON_API_VERSION); … … 1728 1739 PyObject * PyFile_FromString(char *, char *); 1729 1740 void PyFile_SetBufSize(PyObject *, int); 1730 int PyFile_SetEncoding(PyObject *, c har *);1741 int PyFile_SetEncoding(PyObject *, c_str); 1731 1742 PyObject * PyFile_FromFile(FILE *, char *, char *, 1732 1743 int (*)(FILE *)); … … 1736 1747 int PyFile_WriteObject(PyObject *, PyObject *, int); 1737 1748 int PyFile_SoftSpace(PyObject *, int); 1738 int PyFile_WriteString(c har *, PyObject *);1749 int PyFile_WriteString(c_str, PyObject *); 1739 1750 int PyObject_AsFileDescriptor(PyObject *); 1740 1751 … … 1767 1778 void * PyCObject_AsVoidPtr(PyObject *); 1768 1779 void * PyCObject_GetDesc(PyObject *); 1769 void * PyCObject_Import(c har *module_name, char *cobject_name);1780 void * PyCObject_Import(c_str module_name, c_str cobject_name); 1770 1781 int PyCObject_SetVoidPtr(PyObject *self, void *cobj); 1771 1782 … … 1996 2007 1997 2008 int PyCodec_Register(PyObject *search_function); 1998 PyObject * _PyCodec_Lookup(c har *encoding);1999 PyObject * PyCodec_Encode(PyObject *object, c har *encoding, char *errors);2000 PyObject * PyCodec_Decode(PyObject *object, c har *encoding, char *errors);2001 PyObject * PyCodec_Encoder(c har *encoding);2002 PyObject * PyCodec_Decoder(c har *encoding);2003 PyObject * PyCodec_StreamReader(c har *encoding, PyObject *stream, char *errors);2004 PyObject * PyCodec_StreamWriter(c har *encoding, PyObject *stream, char *errors);2009 PyObject * _PyCodec_Lookup(c_str encoding); 2010 PyObject * PyCodec_Encode(PyObject *object, c_str encoding, c_str errors); 2011 PyObject * PyCodec_Decode(PyObject *object, c_str encoding, c_str errors); 2012 PyObject * PyCodec_Encoder(c_str encoding); 2013 PyObject * PyCodec_Decoder(c_str encoding); 2014 PyObject * PyCodec_StreamReader(c_str encoding, PyObject *stream, c_str errors); 2015 PyObject * PyCodec_StreamWriter(c_str encoding, PyObject *stream, c_str errors); 2005 2016 2006 2017 ///////////////////////////////////////////////////////////////////////////// … … 2008 2019 ///////////////////////////////////////////////////////////////////////////// 2009 2020 2010 int PyCodec_RegisterError(c har *name, PyObject *error);2011 PyObject * PyCodec_LookupError(c har *name);2021 int PyCodec_RegisterError(c_str name, PyObject *error); 2022 PyObject * PyCodec_LookupError(c_str name); 2012 2023 PyObject * PyCodec_StrictErrors(PyObject *exc); 2013 2024 PyObject * PyCodec_IgnoreErrors(PyObject *exc); … … 2090 2101 void PyErr_SetNone(PyObject *); 2091 2102 void PyErr_SetObject(PyObject *, PyObject *); 2092 void PyErr_SetString(PyObject *, c har *);2103 void PyErr_SetString(PyObject *, c_str); 2093 2104 PyObject * PyErr_Occurred(); 2094 2105 void PyErr_Clear(); … … 2110 2121 PyObject * PyErr_SetFromErrnoWithUnicodeFilename(PyObject *, Py_UNICODE *); 2111 2122 2112 PyObject * PyErr_Format(PyObject *, c har *, ...);2123 PyObject * PyErr_Format(PyObject *, c_str, ...); 2113 2124 2114 2125 version (Windows) { 2115 PyObject * PyErr_SetFromWindowsErrWithFilenameObject(int, c har *);2116 PyObject * PyErr_SetFromWindowsErrWithFilename(int, c har *);2126 PyObject * PyErr_SetFromWindowsErrWithFilenameObject(int, c_str); 2127 PyObject * PyErr_SetFromWindowsErrWithFilename(int, c_str); 2117 2128 PyObject * PyErr_SetFromWindowsErrWithUnicodeFilename(int, Py_UNICODE *); 2118 2129 PyObject * PyErr_SetFromWindowsErr(int); 2119 2130 PyObject * PyErr_SetExcFromWindowsErrWithFilenameObject(PyObject *, int, PyObject *); 2120 PyObject * PyErr_SetExcFromWindowsErrWithFilename(PyObject *, int, c har *);2131 PyObject * PyErr_SetExcFromWindowsErrWithFilename(PyObject *, int, c_str); 2121 2132 PyObject * PyErr_SetExcFromWindowsErrWithUnicodeFilename(PyObject *, int, Py_UNICODE *); 2122 2133 PyObject * PyErr_SetExcFromWindowsErr(PyObject *, int); … … 2129 2140 2130 2141 version (Python_2_5_Or_Later) { 2131 int PyErr_WarnEx(PyObject*, c har*, Py_ssize_t);2142 int PyErr_WarnEx(PyObject*, c_str, Py_ssize_t); 2132 2143 } else { 2133 2144 int PyErr_Warn(PyObject *, char *); 2134 2145 } 2135 int PyErr_WarnExplicit(PyObject *, c har *, char *, int, char *, PyObject *);2146 int PyErr_WarnExplicit(PyObject *, c_str, c_str, int, c_str, PyObject *); 2136 2147 2137 2148 int PyErr_CheckSignals(); 2138 2149 void PyErr_SetInterrupt(); 2139 2150 2140 void PyErr_SyntaxLocation(c har *, int);2141 PyObject * PyErr_ProgramText(c har *, int);2151 void PyErr_SyntaxLocation(c_str, int); 2152 PyObject * PyErr_ProgramText(c_str, int); 2142 2153 2143 2154 ///////////////////////////////////////////////////////////////////////////// 2144 2155 // UNICODE ENCODING ERROR HANDLING INTERFACE 2145 2156 ///////////////////////////////////////////////////////////////////////////// 2146 PyObject *PyUnicodeDecodeError_Create(c har *, char *, Py_ssize_t, Py_ssize_t, Py_ssize_t, char *);2147 2148 PyObject *PyUnicodeEncodeError_Create(c har *, Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, char *);2149 2150 PyObject *PyUnicodeTranslateError_Create(Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, c har *);2157 PyObject *PyUnicodeDecodeError_Create(c_str, c_str, Py_ssize_t, Py_ssize_t, Py_ssize_t, c_str); 2158 2159 PyObject *PyUnicodeEncodeError_Create(c_str, Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, c_str); 2160 2161 PyObject *PyUnicodeTranslateError_Create(Py_UNICODE *, Py_ssize_t, Py_ssize_t, Py_ssize_t, c_str); 2151 2162 2152 2163 PyObject *PyUnicodeEncodeError_GetEncoding(PyObject *); … … 2177 2188 PyObject *PyUnicodeTranslateError_GetReason(PyObject *); 2178 2189 2179 int PyUnicodeEncodeError_SetReason(PyObject *, c har *);2180 int PyUnicodeDecodeError_SetReason(PyObject *, c har *);2181 int PyUnicodeTranslateError_SetReason(PyObject *, c har *);2182 2183 int PyOS_snprintf(char *str, size_t size, c har *format, ...);2190 int PyUnicodeEncodeError_SetReason(PyObject *, c_str); 2191 int PyUnicodeDecodeError_SetReason(PyObject *, c_str); 2192 int PyUnicodeTranslateError_SetReason(PyObject *, c_str); 2193 2194 int PyOS_snprintf(char *str, size_t size, c_str format, ...); 2184 2195 2185 2196 … … 2281 2292 2282 2293 // Python-header-file: Include/compile.h: 2283 PyCodeObject *PyNode_Compile(node *, c har *);2294 PyCodeObject *PyNode_Compile(node *, c_str); 2284 2295 PyCodeObject *PyCode_New( 2285 2296 int, int, int, int, PyObject *, PyObject *, PyObject *, PyObject *, … … 2300 2311 2301 2312 version (Python_2_5_Or_Later) {} else { 2302 PyFutureFeatures *PyNode_Future(node *, c har *);2303 PyCodeObject *PyNode_CompileFlags(node *, c har *, PyCompilerFlags *);2313 PyFutureFeatures *PyNode_Future(node *, c_str); 2314 PyCodeObject *PyNode_CompileFlags(node *, c_str, PyCompilerFlags *); 2304 2315 } 2305 2316 … … 2312 2323 2313 2324 struct _mod; /* Declare the existence of this type */ 2314 PyCodeObject * PyAST_Compile(_mod *, c har *, PyCompilerFlags *, PyArena *);2315 PyFutureFeatures * PyFuture_FromAST(_mod *, c har *);2325 PyCodeObject * PyAST_Compile(_mod *, c_str, PyCompilerFlags *, PyArena *); 2326 PyFutureFeatures * PyFuture_FromAST(_mod *, c_str); 2316 2327 2317 2328 // Python-header-file: Include/ast.h 2318 _mod* PyAST_FromNode(node*, PyCompilerFlags*, c har*, PyArena*);2329 _mod* PyAST_FromNode(node*, PyCompilerFlags*, c_str, PyArena*); 2319 2330 } 2320 2331 … … 2342 2353 2343 2354 // These are slightly different in 2.4, but the 2.5 form should still work. 2344 int PyRun_AnyFileExFlags(FILE *, c har *, int, PyCompilerFlags *);2345 2346 int PyRun_AnyFile(FILE *fp, c har *name) {2355 int PyRun_AnyFileExFlags(FILE *, c_str, int, PyCompilerFlags *); 2356 2357 int PyRun_AnyFile(FILE *fp, c_str name) { 2347 2358 return PyRun_AnyFileExFlags(fp, name, 0, null); 2348 2359 } 2349 int PyRun_AnyFileEx(FILE *fp, c har *name, int closeit) {2360 int PyRun_AnyFileEx(FILE *fp, c_str name, int closeit) { 2350 2361 return PyRun_AnyFileExFlags(fp, name, closeit, null); 2351 2362 } 2352 int PyRun_AnyFileFlags(FILE *fp, c har *name, PyCompilerFlags *flags) {2363 int PyRun_AnyFileFlags(FILE *fp, c_str name, PyCompilerFlags *flags) { 2353 2364 return PyRun_AnyFileExFlags(fp, name, 0, flags); 2354 2365 } 2355 2366 2356 int PyRun_SimpleStringFlags(c har *, PyCompilerFlags *);2357 int PyRun_SimpleString(c har *s) {2367 int PyRun_SimpleStringFlags(c_str, PyCompilerFlags *); 2368 int PyRun_SimpleString(c_str s) { 2358 2369 return PyRun_SimpleStringFlags(s, null); 2359 2370 } 2360 2371 2361 int PyRun_SimpleFileExFlags(FILE *, c har *, int, PyCompilerFlags *);2362 int PyRun_SimpleFile(FILE *f, c har *p) {2372 int PyRun_SimpleFileExFlags(FILE *, c_str, int, PyCompilerFlags *); 2373 int PyRun_SimpleFile(FILE *f, c_str p) { 2363 2374 return PyRun_SimpleFileExFlags(f, p, 0, null); 2364 2375 } 2365 int PyRun_SimpleFileEx(FILE *f, c har *p, int c) {2376 int PyRun_SimpleFileEx(FILE *f, c_str p, int c) { 2366 2377 return PyRun_SimpleFileExFlags(f, p, c, null); 2367 2378 } 2368 2379 2369 int PyRun_InteractiveOneFlags(FILE *, c har *, PyCompilerFlags *);2370 int PyRun_InteractiveOne(FILE *f, c har *p) {2380 int PyRun_InteractiveOneFlags(FILE *, c_str, PyCompilerFlags *); 2381 int PyRun_InteractiveOne(FILE *f, c_str p) { 2371 2382 return PyRun_InteractiveOneFlags(f, p, null); 2372 2383 } 2373 int PyRun_InteractiveLoopFlags(FILE *, c har *, PyCompilerFlags *);2374 int PyRun_InteractiveLoop(FILE *f, c har *p) {2384 int PyRun_InteractiveLoopFlags(FILE *, c_str, PyCompilerFlags *); 2385 int PyRun_InteractiveLoop(FILE *f, c_str p) { 2375 2386 return PyRun_InteractiveLoopFlags(f, p, null); 2376 2387 } 2377 2388 2378 2389 version (Python_2_5_Or_Later) { 2379 _mod* PyParser_ASTFromString(c har *, char *,2390 _mod* PyParser_ASTFromString(c_str, c_str, 2380 2391 int, PyCompilerFlags *, PyArena *); 2381 _mod* PyParser_ASTFromFile(FILE *, c har *, int,2392 _mod* PyParser_ASTFromFile(FILE *, c_str, int, 2382 2393 char *, char *, PyCompilerFlags *, int *, PyArena *); 2383 2394 } 2384 2395 2385 node *PyParser_SimpleParseStringFlags(c har *, int, int);2386 node *PyParser_SimpleParseString(c har *s, int b) {2396 node *PyParser_SimpleParseStringFlags(c_str, int, int); 2397 node *PyParser_SimpleParseString(c_str s, int b) { 2387 2398 return PyParser_SimpleParseStringFlags(s, b, 0); 2388 2399 } 2389 node *PyParser_SimpleParseFileFlags(FILE *, c har *,int, int);2390 node *PyParser_SimpleParseFile(FILE *f, c har *s, int b) {2400 node *PyParser_SimpleParseFileFlags(FILE *, c_str, int, int); 2401 node *PyParser_SimpleParseFile(FILE *f, c_str s, int b) { 2391 2402 return PyParser_SimpleParseFileFlags(f, s, b, 0); 2392 2403 } 2393 2404 // node *PyParser_SimpleParseStringFlagsFilename(char *, char *, int, int); 2394 2405 2395 PyObject *PyRun_StringFlags( char *, int, PyObject *, PyObject *, PyCompilerFlags *);2396 PyObject *PyRun_String(c har *str, int s, PyObject *g, PyObject *l) {2406 PyObject *PyRun_StringFlags(c_str, int, PyObject *, PyObject *, PyCompilerFlags *); 2407 PyObject *PyRun_String(c_str str, int s, PyObject *g, PyObject *l) { 2397 2408 return PyRun_StringFlags(str, s, g, l, null); 2398 2409 } 2399 PyObject *PyRun_FileExFlags(FILE *, c har *, int, PyObject *, PyObject *, int, PyCompilerFlags *);2400 PyObject *PyRun_File(FILE *fp, c har *p, int s, PyObject *g, PyObject *l) {2410 PyObject *PyRun_FileExFlags(FILE *, c_str, int, PyObject *, PyObject *, int, PyCompilerFlags *); 2411 PyObject *PyRun_File(FILE *fp, c_str p, int s, PyObject *g, PyObject *l) { 2401 2412 return PyRun_FileExFlags(fp, p, s, g, l, 0, null); 2402 2413 } 2403 PyObject *PyRun_FileEx(FILE *fp, c har *p, int s, PyObject *g, PyObject *l, int c) {2414 PyObject *PyRun_FileEx(FILE *fp, c_str p, int s, PyObject *g, PyObject *l, int c) { 2404 2415 return PyRun_FileExFlags(fp, p, s, g, l, c, null); 2405 2416 } 2406 PyObject *PyRun_FileFlags(FILE *fp, c har *p, int s, PyObject *g, PyObject *l, PyCompilerFlags *flags) {2417 PyObject *PyRun_FileFlags(FILE *fp, c_str p, int s, PyObject *g, PyObject *l, PyCompilerFlags *flags) { 2407 2418 return PyRun_FileExFlags(fp, p, s, g, l, 0, flags); 2408 2419 } 2409 2420 2410 PyObject *Py_CompileStringFlags(c har *, char *, int, PyCompilerFlags *);2411 PyObject *Py_CompileString(c har *str, char *p, int s) {2421 PyObject *Py_CompileStringFlags(c_str, c_str, int, PyCompilerFlags *); 2422 PyObject *Py_CompileString(c_str str, c_str p, int s) { 2412 2423 return Py_CompileStringFlags(str, p, s, null); 2413 2424 } … … 2422 2433 void Py_Exit(int); 2423 2434 2424 int Py_FdIsInteractive(FILE *, c har *);2435 int Py_FdIsInteractive(FILE *, c_str); 2425 2436 2426 2437 /////////////////////////////////////////////////////////////////////////////// … … 2436 2447 char *Py_GetPath(); 2437 2448 2438 c har *Py_GetVersion();2439 c har *Py_GetPlatform();2440 c har *Py_GetCopyright();2441 c har *Py_GetCompiler();2442 c har *Py_GetBuildInfo();2449 c_str Py_GetVersion(); 2450 c_str Py_GetPlatform(); 2451 c_str Py_GetCopyright(); 2452 c_str Py_GetCompiler(); 2453 c_str Py_GetBuildInfo(); 2443 2454 version (Python_2_5_Or_Later) { 2444 c har *_Py_svnversion();2445 c har *Py_SubversionRevision();2446 c har *Py_SubversionShortBranch();2455 c_str _Py_svnversion(); 2456 c_str Py_SubversionRevision(); 2457 c_str Py_SubversionShortBranch(); 2447 2458 } 2448 2459 … … 2501 2512 return PyEval_CallObjectWithKeywords(func, arg, null); 2502 2513 } 2503 PyObject *PyEval_CallFunction(PyObject *obj, c har *format, ...);2504 PyObject *PyEval_CallMethod(PyObject *obj, c har *methodname, char *format, ...);2514 PyObject *PyEval_CallFunction(PyObject *obj, c_str format, ...); 2515 PyObject *PyEval_CallMethod(PyObject *obj, c_str methodname, c_str format, ...); 2505 2516 2506 2517 void PyEval_SetProfile(Py_tracefunc, PyObject *); … … 2528 2539 // _Py_MakeRecCheck 2529 2540 2530 c har *PyEval_GetFuncName(PyObject *);2531 c har *PyEval_GetFuncDesc(PyObject *);2541 c_str PyEval_GetFuncName(PyObject *); 2542 c_str PyEval_GetFuncDesc(PyObject *); 2532 2543 2533 2544 PyObject *PyEval_GetCallStats(PyObject *); … … 2548 2559 void PySys_SetPath(char *); 2549 2560 2550 void PySys_WriteStdout(c har *format, ...);2551 void PySys_WriteStderr(c har *format, ...);2561 void PySys_WriteStdout(c_str format, ...); 2562 void PySys_WriteStderr(c_str format, ...); 2552 2563 2553 2564 void PySys_ResetWarnOptions(); … … 2753 2764 PyObject *PyImport_ExecCodeModuleEx(char *name, PyObject *co, char *pathname); 2754 2765 PyObject *PyImport_GetModuleDict(); 2755 PyObject *PyImport_AddModule(c har *name);2756 PyObject *PyImport_ImportModule(c har *name);2766 PyObject *PyImport_AddModule(c_str name); 2767 PyObject *PyImport_ImportModule(c_str name); 2757 2768 version (Python_2_5_Or_Later) { 2758 2769 PyObject *PyImport_ImportModuleLevel(char *name, … … 2801 2812 2802 2813 // D translations of C macros: 2803 int PyObject_DelAttrString(PyObject *o, c har *a) {2814 int PyObject_DelAttrString(PyObject *o, c_str a) { 2804 2815 return PyObject_SetAttrString(o, a, null); 2805 2816 } … … 2818 2829 PyObject *PyObject_CallObject(PyObject *callable_object, PyObject *args); 2819 2830 version (Python_2_5_Or_Later) { 2820 PyObject *_PyObject_CallFunction_SizeT(PyObject *callable, c har *format, ...);2821 PyObject *_PyObject_CallMethod_SizeT(PyObject *o, c har *name, char *format, ...);2831 PyObject *_PyObject_CallFunction_SizeT(PyObject *callable, c_str format, ...); 2832 PyObject *_PyObject_CallMethod_SizeT(PyObject *o, c_str name, c_str format, ...); 2822 2833 alias _PyObject_CallFunction_SizeT PyObject_CallFunction; 2823 2834 alias _PyObject_CallMethod_SizeT PyObject_CallMethod; 2824 2835 } else { 2825 PyObject *PyObject_CallFunction(PyObject *callable_object, c har *format, ...);2826 PyObject *PyObject_CallMethod(PyObject *o, c har *m, char *format, ...);2836 PyObject *PyObject_CallFunction(PyObject *callable_object, c_str format, ...); 2837 PyObject *PyObject_CallMethod(PyObject *o, c_str m, c_str format, ...); 2827 2838 } 2828 2839 PyObject *PyObject_CallFunctionObjArgs(PyObject *callable, ...); … … 2847 2858 PyObject *PyObject_GetItem(PyObject *o, PyObject *key); 2848 2859 int PyObject_SetItem(PyObject *o, PyObject *key, PyObject *v); 2849 int PyObject_DelItemString(PyObject *o, c har *key);2860 int PyObject_DelItemString(PyObject *o, c_str key); 2850 2861 int PyObject_DelItem(PyObject *o, PyObject *key); 2851 2862 2852 int PyObject_AsCharBuffer(PyObject *obj, c har **buffer, Py_ssize_t *buffer_len);2863 int PyObject_AsCharBuffer(PyObject *obj, c_str *buffer, Py_ssize_t *buffer_len); 2853 2864 int PyObject_CheckReadBuffer(PyObject *obj); 2854 2865 int PyObject_AsReadBuffer(PyObject *obj, void **buffer, Py_ssize_t *buffer_len); … … 2945 2956 PyObject *PySequence_List(PyObject *o); 2946 2957 2947 PyObject *PySequence_Fast(PyObject *o, char*m);2958 PyObject *PySequence_Fast(PyObject *o, c_str m); 2948 2959 // D translations of C macros: 2949 2960 Py_ssize_t PySequence_Fast_GET_SIZE(PyObject *o) { … … 2994 3005 2995 3006 // D translations of C macros: 2996 int PyMapping_DelItemString(PyObject *o, c har *k) {3007 int PyMapping_DelItemString(PyObject *o, c_str k) { 2997 3008 return PyObject_DelItemString(o, k); 2998 3009 } … … 3103 3114 ///////////////////////////////////////////////////////////////////////////// 3104 3115 // Python-header-file: Include/pydebug.h: 3105 void Py_FatalError(c har *message);3116 void Py_FatalError(c_str message); 3106 3117 3107 3118 … … 3124 3135 int(*cread)(PyObject *, char **, Py_ssize_t); 3125 3136 int(*creadline)(PyObject *, char **); 3126 int(*cwrite)(PyObject *, c har *, Py_ssize_t);3137 int(*cwrite)(PyObject *, c_str, Py_ssize_t); 3127 3138 PyObject *(*cgetvalue)(PyObject *); 3128 3139 PyObject *(*NewOutput)(int); … … 3409 3420 // Python-header-file: Include/pystrtod.h: 3410 3421 3411 double PyOS_ascii_strtod(c har *str, char **ptr);3412 double PyOS_ascii_atof(c har *str);3413 char *PyOS_ascii_formatd(c har *buffer, size_t buf_len, char *format, double d);3422 double PyOS_ascii_strtod(c_str str, char **ptr); 3423 double PyOS_ascii_atof(c_str str); 3424 char *PyOS_ascii_formatd(c_str buffer, size_t buf_len, c_str format, double d); 3414 3425 3415 3426 … … 3559 3570 const int RESTRICTED = (READ_RESTRICTED | WRITE_RESTRICTED); 3560 3571 3561 PyObject *PyMember_GetOne(c har *, PyMemberDef *);3572 PyObject *PyMember_GetOne(c_str, PyMemberDef *); 3562 3573 int PyMember_SetOne(char *, PyMemberDef *, PyObject *); 3563 3574 … … 3678 3689 * with sys.setdefaultencoding, so perhaps it would be better not to expose 3679 3690 * this at all: */ 3680 c har*m_Py_FileSystemDefaultEncoding;3691 c_str m_Py_FileSystemDefaultEncoding; 3681 3692 3682 3693 PyTypeObject* m_PyCObject_Type_p; … … 3744 3755 PyObject* m_PyExc_FutureWarning; 3745 3756 3746 PyObject *eval( char[]code) {3757 PyObject *eval(string code) { 3747 3758 PyObject *pyGlobals = PyEval_GetGlobals(); /* borrowed ref */ 3748 3759 PyObject *res = PyRun_String((code ~ \0).ptr, Py_eval_input, … … 3761 3772 // These template functions will lazily-load the various singleton objects, 3762 3773 // removing the need for a "load" function that does it all at once. 3763 typeof(Ptr) lazy_sys(alias Ptr, char[]name) () {3774 typeof(Ptr) lazy_sys(alias Ptr, string name) () { 3764 3775 if (Ptr is null) { 3765 3776 PyObject* sys_modules = PyImport_GetModuleDict(); … … 3774 3785 alias lazy_sys!(m_weakref, "weakref") weakref; 3775 3786 3776 typeof(Ptr) lazy_load(alias from, alias Ptr, char[]name) () {3787 typeof(Ptr) lazy_load(alias from, alias Ptr, string name) () { 3777 3788 if (Ptr is null) { 3778 3789 Ptr = cast(typeof(Ptr)) PyObject_GetAttrString(from(), (name ~ \0).ptr); … … 3782 3793 } 3783 3794 3784 typeof(Ptr) lazy_eval(alias Ptr, char[]code) () {3795 typeof(Ptr) lazy_eval(alias Ptr, string code) () { 3785 3796 if (Ptr is null) { 3786 3797 Ptr = cast(typeof(Ptr)) eval(code); … … 3853 3864 alias lazy_load!(builtins, m_PyFile_Type_p, "file") PyFile_Type_p; 3854 3865 3855 c har*Py_FileSystemDefaultEncoding() {3866 c_str Py_FileSystemDefaultEncoding() { 3856 3867 if (m_Py_FileSystemDefaultEncoding is null) { 3857 3868 m_Py_FileSystemDefaultEncoding = PyUnicode_GetDefaultEncoding();
