diff options
Diffstat (limited to 'Mac/Modules/qd')
-rw-r--r-- | Mac/Modules/qd/_Qdmodule.c | 30 | ||||
-rw-r--r-- | Mac/Modules/qd/qdsupport.py | 12 |
2 files changed, 23 insertions, 19 deletions
diff --git a/Mac/Modules/qd/_Qdmodule.c b/Mac/Modules/qd/_Qdmodule.c index ec44936..3bbe2c3 100644 --- a/Mac/Modules/qd/_Qdmodule.c +++ b/Mac/Modules/qd/_Qdmodule.c @@ -5,8 +5,12 @@ +#ifdef _WIN32 +#include "pywintoolbox.h" +#else #include "macglue.h" #include "pymactoolbox.h" +#endif /* Macro to test whether a weak-loaded CFM function exists */ #define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\ @@ -442,7 +446,8 @@ static PyObject *BMObj_getdata(BitMapObject *_self, PyObject *_args) if ( !PyArg_ParseTuple(_args, "ii", &from, &length) ) return NULL; cp = _self->ob_itself->baseAddr+from; - return PyString_FromStringAndSize(cp, length); + _res = PyString_FromStringAndSize(cp, length); + return _res; } @@ -458,7 +463,8 @@ static PyObject *BMObj_putdata(BitMapObject *_self, PyObject *_args) cp = _self->ob_itself->baseAddr+from; memcpy(cp, icp, length); Py_INCREF(Py_None); - return Py_None; + _res = Py_None; + return _res; } @@ -912,7 +918,6 @@ static PyObject *Qd_GetPenState(PyObject *_self, PyObject *_args) GetPenState(&pnState__out__); _res = Py_BuildValue("s#", (char *)&pnState__out__, (int)sizeof(PenState)); - pnState__error__: ; return _res; } @@ -3470,7 +3475,6 @@ static PyObject *Qd_GetIndPattern(PyObject *_self, PyObject *_args) index); _res = Py_BuildValue("s#", (char *)&thePat__out__, (int)sizeof(Pattern)); - thePat__error__: ; return _res; } @@ -4116,7 +4120,6 @@ static PyObject *Qd_GetQDGlobalsArrow(PyObject *_self, PyObject *_args) GetQDGlobalsArrow(&arrow__out__); _res = Py_BuildValue("s#", (char *)&arrow__out__, (int)sizeof(Cursor)); - arrow__error__: ; return _res; } @@ -4129,7 +4132,6 @@ static PyObject *Qd_GetQDGlobalsDarkGray(PyObject *_self, PyObject *_args) GetQDGlobalsDarkGray(&dkGray__out__); _res = Py_BuildValue("s#", (char *)&dkGray__out__, (int)sizeof(Pattern)); - dkGray__error__: ; return _res; } @@ -4142,7 +4144,6 @@ static PyObject *Qd_GetQDGlobalsLightGray(PyObject *_self, PyObject *_args) GetQDGlobalsLightGray(<Gray__out__); _res = Py_BuildValue("s#", (char *)<Gray__out__, (int)sizeof(Pattern)); - ltGray__error__: ; return _res; } @@ -4155,7 +4156,6 @@ static PyObject *Qd_GetQDGlobalsGray(PyObject *_self, PyObject *_args) GetQDGlobalsGray(&gray__out__); _res = Py_BuildValue("s#", (char *)&gray__out__, (int)sizeof(Pattern)); - gray__error__: ; return _res; } @@ -4168,7 +4168,6 @@ static PyObject *Qd_GetQDGlobalsBlack(PyObject *_self, PyObject *_args) GetQDGlobalsBlack(&black__out__); _res = Py_BuildValue("s#", (char *)&black__out__, (int)sizeof(Pattern)); - black__error__: ; return _res; } @@ -4181,7 +4180,6 @@ static PyObject *Qd_GetQDGlobalsWhite(PyObject *_self, PyObject *_args) GetQDGlobalsWhite(&white__out__); _res = Py_BuildValue("s#", (char *)&white__out__, (int)sizeof(Pattern)); - white__error__: ; return _res; } @@ -4448,7 +4446,6 @@ static PyObject *Qd_MacDrawText(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; char *textBuf__in__; - int textBuf__len__; int textBuf__in_len__; short firstByte; short byteCount; @@ -4457,12 +4454,13 @@ static PyObject *Qd_MacDrawText(PyObject *_self, PyObject *_args) &firstByte, &byteCount)) return NULL; + /* Fool compiler warnings */ + textBuf__in_len__ = textBuf__in_len__; MacDrawText(textBuf__in__, firstByte, byteCount); Py_INCREF(Py_None); _res = Py_None; - textBuf__error__: ; return _res; } @@ -4499,7 +4497,6 @@ static PyObject *Qd_TextWidth(PyObject *_self, PyObject *_args) PyObject *_res = NULL; short _rv; char *textBuf__in__; - int textBuf__len__; int textBuf__in_len__; short firstByte; short byteCount; @@ -4508,12 +4505,13 @@ static PyObject *Qd_TextWidth(PyObject *_self, PyObject *_args) &firstByte, &byteCount)) return NULL; + /* Fool compiler warnings */ + textBuf__in_len__ = textBuf__in_len__; _rv = TextWidth(textBuf__in__, firstByte, byteCount); _res = Py_BuildValue("h", _rv); - textBuf__error__: ; return _res; } @@ -4977,7 +4975,6 @@ static PyObject *Qd_DrawText(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; char *textBuf__in__; - int textBuf__len__; int textBuf__in_len__; short firstByte; short byteCount; @@ -4986,12 +4983,13 @@ static PyObject *Qd_DrawText(PyObject *_self, PyObject *_args) &firstByte, &byteCount)) return NULL; + /* Fool compiler warnings */ + textBuf__in_len__ = textBuf__in_len__; DrawText(textBuf__in__, firstByte, byteCount); Py_INCREF(Py_None); _res = Py_None; - textBuf__error__: ; return _res; } diff --git a/Mac/Modules/qd/qdsupport.py b/Mac/Modules/qd/qdsupport.py index 5f7c5bc..9c177b6 100644 --- a/Mac/Modules/qd/qdsupport.py +++ b/Mac/Modules/qd/qdsupport.py @@ -24,7 +24,11 @@ from macsupport import * class TextThingieClass(FixedInputBufferType): def getargsCheck(self, name): - pass + Output("/* Fool compiler warnings */") + Output("%s__in_len__ = %s__in_len__;", name, name) + + def declareSize(self, name): + Output("int %s__in_len__;", name) TextThingie = TextThingieClass(None) @@ -566,7 +570,8 @@ char *cp; if ( !PyArg_ParseTuple(_args, "ii", &from, &length) ) return NULL; cp = _self->ob_itself->baseAddr+from; -return PyString_FromStringAndSize(cp, length); +_res = PyString_FromStringAndSize(cp, length); +return _res; """ f = ManualGenerator("getdata", getdata_body) f.docstring = lambda: """(int start, int size) -> string. Return bytes from the bitmap""" @@ -582,7 +587,8 @@ if ( !PyArg_ParseTuple(_args, "is#", &from, &icp, &length) ) cp = _self->ob_itself->baseAddr+from; memcpy(cp, icp, length); Py_INCREF(Py_None); -return Py_None; +_res = Py_None; +return _res; """ f = ManualGenerator("putdata", putdata_body) f.docstring = lambda: """(int start, string data). Store bytes into the bitmap""" |