summaryrefslogtreecommitdiff
path: root/Mac/Contrib
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2003-01-08 16:27:44 +0000
committerJack Jansen <jack.jansen@cwi.nl>2003-01-08 16:27:44 +0000
commitff6a2aade4828df24aa557eec2293d55c41a7338 (patch)
tree6154c255a70b1ea30c2f69155a826039a6ce60ef /Mac/Contrib
parent6a07e5648d277ba8b32154ce97bfeafdff07aab9 (diff)
downloadcpython-ff6a2aade4828df24aa557eec2293d55c41a7338.tar.gz
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.c55
-rw-r--r--Mac/Contrib/osam/OSAm.prjbin102673 -> 71523 bytes
-rw-r--r--Mac/Contrib/osam/ScriptRunner.c6
3 files changed, 39 insertions, 22 deletions
diff --git a/Mac/Contrib/osam/OSAm.c b/Mac/Contrib/osam/OSAm.c
index a9c34454f2..aa9a5da335 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
index c7e45bf86a..527563c100 100644
--- a/Mac/Contrib/osam/OSAm.prj
+++ b/Mac/Contrib/osam/OSAm.prj
Binary files differ
diff --git a/Mac/Contrib/osam/ScriptRunner.c b/Mac/Contrib/osam/ScriptRunner.c
index bf77d6bfd4..6f7d9ce4b9 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