Skip to content

Commit

Permalink
Since the D 2.0 series has been found lacking at the moment, Pyd once…
Browse files Browse the repository at this point in the history
… again compiles under the 1.0 series. (Specifically 1.016 or later; tested with 1.020.)

git-svn-id: http://svn.dsource.org/projects/pyd/trunk@121 1df65b71-e716-0410-9316-ac55df2b1602
  • Loading branch information
KirkMcDonald authored and KirkMcDonald committed Jul 30, 2007
1 parent f36727b commit 6c5b4a7
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion infrastructure/pyd/class_wrap.d
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ template _wrap_class(_T, string name, Params...) {
// alias make_wrapper!(_T, Params).wrapper shim_class;
// alias _T T;
} else {
pragma(msg, "wrap_struct: " ~ name);
pragma(msg, "wrap_struct: '" ~ name ~ "'");
alias void shim_class;
alias _T* T;
}
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/pyd/ctor_wrap.d
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ template wrapped_struct_init(T) {
int init(PyObject* self, PyObject* args, PyObject* kwds) {
return exception_catcher({
static if (is(T S : S*)) {
pragma(msg, "wrapped_struct_init, S is " ~ prettynameof!(S));
pragma(msg, "wrapped_struct_init, S is '" ~ prettynameof!(S) ~ "'");
T t = new S;
WrapPyObject_SetObj(self, t);
}
Expand Down
15 changes: 10 additions & 5 deletions infrastructure/pyd/lib_abstract.d
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,17 @@ version (Tango) {
string objToStr(Object o) {
return o.toString();
}
template symbolnameof(alias symbol) {
static if (is(typeof(symbol) == function)) {
const char[] symbolnameof = (&symbol).stringof[2 .. $];
} else {
const char[] symbolnameof = symbol.stringof;
version (D_Version2) {
// D1 issues?
template symbolnameof(alias symbol) {
static if (is(typeof(symbol) == function)) {
const char[] symbolnameof = (&symbol).stringof[2 .. $];
} else {
const char[] symbolnameof = symbol.stringof;
}
}
} else {
public import meta.Nameof : symbolnameof;
}
public import meta.Nameof : /*symbolnameof,*/ prettytypeof, prettynameof;

Expand Down
25 changes: 9 additions & 16 deletions infrastructure/pyd/make_object.d
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ T d_type(T) (PyObject* o) {
PyUnicode_AsWideChar(cast(PyUnicodeObject*)o, temp, temp.length);
return temp;
+/
} else static if (is(string : T)) {
const(char)* result;
} else static if (is(string : T) || is(char[] : T)) {
c_str result;
PyObject* repr;
// If it's a string, convert it
if (PyString_Check(o) || PyUnicode_Check(o)) {
Expand All @@ -366,22 +366,15 @@ T d_type(T) (PyObject* o) {
Py_DECREF(repr);
}
if (result is null) handle_exception();
return .toString(result);
} else static if (is(char[] : T)) {
const(char)* result;
PyObject* repr;
// If it's a string, convert it
if (PyString_Check(o) || PyUnicode_Check(o)) {
result = PyString_AsString(o);
// If it's something else, convert its repr
version (D_Version2) {
static if (is(string : T)) {
return .toString(result);
} else {
return .toString(result).dup;
}
} else {
repr = PyObject_Repr(o);
if (repr is null) handle_exception();
result = PyString_AsString(repr);
Py_DECREF(repr);
return .toString(result).dup;
}
if (result is null) handle_exception();
return .toString(result).dup;
} else static if (is(T E : E[])) {
// Dynamic arrays
PyObject* iter = PyObject_GetIter(o);
Expand Down
4 changes: 3 additions & 1 deletion infrastructure/python/python.d
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ version(Windows) {
}

version (D_Version2) {
alias const(char)* c_str;
// Need to define const(char)* in a way which is syntactically valid in a
// D 1.0 compiler.
mixin("alias const(char)* c_str;");
} else {
alias char* c_str;
}
Expand Down

0 comments on commit 6c5b4a7

Please sign in to comment.