diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2003-01-08 16:27:44 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2003-01-08 16:27:44 (GMT) |
commit | 3e82872ecaa642ff8bab89c4323d1c3b09981665 (patch) | |
tree | d0987955c48352ec147d6ad0113fe4845a578546 /Mac/Contrib | |
parent | 6c64fa7ddadd7a3a24e8ddab7fd4ed9236fef1c3 (diff) | |
download | cpython-3e82872ecaa642ff8bab89c4323d1c3b09981665.zip cpython-3e82872ecaa642ff8bab89c4323d1c3b09981665.tar.gz cpython-3e82872ecaa642ff8bab89c4323d1c3b09981665.tar.bz2 |
Merging the various tweaks for MacPython-OS9 2.3a1 back into the trunk.
Diffstat (limited to 'Mac/Contrib')
-rw-r--r-- | Mac/Contrib/osam/OSAm.c | 55 | ||||
-rw-r--r-- | Mac/Contrib/osam/OSAm.prj | bin | 102673 -> 71523 bytes | |||
-rw-r--r-- | Mac/Contrib/osam/ScriptRunner.c | 6 |
3 files changed, 39 insertions, 22 deletions
diff --git a/Mac/Contrib/osam/OSAm.c b/Mac/Contrib/osam/OSAm.c index a9c3445..aa9a5da 100644 --- a/Mac/Contrib/osam/OSAm.c +++ b/Mac/Contrib/osam/OSAm.c @@ -49,25 +49,30 @@ OSAm_RunCompiledScript (self, args) char *line; DescType typeCode; long dataSize = 0; + OSErr err; - HLock (temp.dataHandle); - - dataSize = GetHandleSize (temp.dataHandle); + dataSize = AEGetDescDataSize (&temp); if (dataSize > 0) { - PyObject *result = PyString_FromStringAndSize ((*temp.dataHandle), + PyObject *result = PyString_FromStringAndSize (NULL, dataSize); - - AEDisposeDesc (&temp); + if (!result) { printf ("OSAm.error Out of memory.\n"); Py_INCREF (Py_None); + AEDisposeDesc (&temp); return Py_None; } + if ( (err=AEGetDescData(&temp, PyString_AS_STRING(result), dataSize)) < 0 ) + { + AEDisposeDesc(&temp); + return PyMac_Error(err); + } + AEDisposeDesc(&temp); return result; } } @@ -110,28 +115,32 @@ OSAm_CompileAndSave (self, args) char *line; DescType typeCode; long dataSize = 0; + OSErr err; - HLock (temp.dataHandle); - - dataSize = GetHandleSize (temp.dataHandle); + dataSize = AEGetDescDataSize (&temp); if (dataSize > 0) { - PyObject *result = PyString_FromStringAndSize ((*temp.dataHandle), + PyObject *result = PyString_FromStringAndSize (NULL, dataSize); - - AEDisposeDesc (&temp); + if (!result) { printf ("OSAm.error Out of memory.\n"); Py_INCREF (Py_None); + AEDisposeDesc (&temp); return Py_None; } + if ( (err=AEGetDescData(&temp, PyString_AS_STRING(result), dataSize)) < 0 ) + { + AEDisposeDesc(&temp); + return PyMac_Error(err); + } + AEDisposeDesc(&temp); return result; } - } if (myErr != noErr) @@ -170,25 +179,30 @@ OSAm_CompileAndExecute (self, args) char *line; DescType typeCode; long dataSize = 0; + OSErr err; - HLock (temp.dataHandle); - - dataSize = GetHandleSize (temp.dataHandle); + dataSize = AEGetDescDataSize (&temp); if (dataSize > 0) { - PyObject *result = PyString_FromStringAndSize ((*temp.dataHandle), + PyObject *result = PyString_FromStringAndSize (NULL, dataSize); - - AEDisposeDesc (&temp); + if (!result) { printf ("OSAm.error Out of memory.\n"); Py_INCREF (Py_None); + AEDisposeDesc (&temp); return Py_None; } + if ( (err=AEGetDescData(&temp, PyString_AS_STRING(result), dataSize)) < 0 ) + { + AEDisposeDesc(&temp); + return PyMac_Error(err); + } + AEDisposeDesc(&temp); return result; } } @@ -216,7 +230,7 @@ static struct PyMethodDef OSAm_methods[] = (PyCFunction) OSAm_CompileAndExecute, METH_VARARGS, OSAm_DoCommand__doc__}, - +#if 0 {"CompileAndSave", (PyCFunction) OSAm_CompileAndSave, METH_VARARGS, @@ -226,6 +240,7 @@ static struct PyMethodDef OSAm_methods[] = (PyCFunction) OSAm_RunCompiledScript, METH_VARARGS, OSAm_DoCommand__doc__}, +#endif {NULL, (PyCFunction) NULL, 0, NULL} }; diff --git a/Mac/Contrib/osam/OSAm.prj b/Mac/Contrib/osam/OSAm.prj Binary files differindex c7e45bf..527563c 100644 --- a/Mac/Contrib/osam/OSAm.prj +++ b/Mac/Contrib/osam/OSAm.prj diff --git a/Mac/Contrib/osam/ScriptRunner.c b/Mac/Contrib/osam/ScriptRunner.c index bf77d6b..6f7d9ce 100644 --- a/Mac/Contrib/osam/ScriptRunner.c +++ b/Mac/Contrib/osam/ScriptRunner.c @@ -44,7 +44,7 @@ static c2pstr(const char *cc) OSAError LoadScriptingComponent (ComponentInstance * scriptingComponent); - +#if 0 /* * store the script as a compile script so that OSA * components may load and execute the script easily @@ -143,6 +143,7 @@ CleanUp: return err2; } +#endif OSAError @@ -194,7 +195,7 @@ CleanUp: return err2; } - +#if 0 /* * This routine reads in a saved script file and executes * the script contained within (from a 'scpt' resource.) @@ -291,6 +292,7 @@ done: return err2; } +#endif OSAError |