Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3e82872

Browse files
committed
Merging the various tweaks for MacPython-OS9 2.3a1 back into the trunk.
1 parent 6c64fa7 commit 3e82872

27 files changed

Lines changed: 220 additions & 290 deletions

Mac/Build/PythonCore.mcp

0 Bytes
Binary file not shown.

Mac/Build/PythonInterpreter.mcp

0 Bytes
Binary file not shown.

Mac/Build/PythonStandSmall.mcp

0 Bytes
Binary file not shown.

Mac/Build/_CG.carbon.mcp

-332 Bytes
Binary file not shown.

Mac/Contrib/osam/OSAm.c

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -49,25 +49,30 @@ OSAm_RunCompiledScript (self, args)
4949
char *line;
5050
DescType typeCode;
5151
long dataSize = 0;
52+
OSErr err;
5253

53-
HLock (temp.dataHandle);
54-
55-
dataSize = GetHandleSize (temp.dataHandle);
54+
dataSize = AEGetDescDataSize (&temp);
5655

5756
if (dataSize > 0)
5857
{
59-
PyObject *result = PyString_FromStringAndSize ((*temp.dataHandle),
58+
PyObject *result = PyString_FromStringAndSize (NULL,
6059
dataSize);
61-
62-
AEDisposeDesc (&temp);
60+
6361

6462
if (!result)
6563
{
6664
printf ("OSAm.error Out of memory.\n");
6765
Py_INCREF (Py_None);
66+
AEDisposeDesc (&temp);
6867
return Py_None;
6968
}
69+
if ( (err=AEGetDescData(&temp, PyString_AS_STRING(result), dataSize)) < 0 )
70+
{
71+
AEDisposeDesc(&temp);
72+
return PyMac_Error(err);
73+
}
7074

75+
AEDisposeDesc(&temp);
7176
return result;
7277
}
7378
}
@@ -110,28 +115,32 @@ OSAm_CompileAndSave (self, args)
110115
char *line;
111116
DescType typeCode;
112117
long dataSize = 0;
118+
OSErr err;
113119

114-
HLock (temp.dataHandle);
115-
116-
dataSize = GetHandleSize (temp.dataHandle);
120+
dataSize = AEGetDescDataSize (&temp);
117121

118122
if (dataSize > 0)
119123
{
120-
PyObject *result = PyString_FromStringAndSize ((*temp.dataHandle),
124+
PyObject *result = PyString_FromStringAndSize (NULL,
121125
dataSize);
122-
123-
AEDisposeDesc (&temp);
126+
124127

125128
if (!result)
126129
{
127130
printf ("OSAm.error Out of memory.\n");
128131
Py_INCREF (Py_None);
132+
AEDisposeDesc (&temp);
129133
return Py_None;
130134
}
135+
if ( (err=AEGetDescData(&temp, PyString_AS_STRING(result), dataSize)) < 0 )
136+
{
137+
AEDisposeDesc(&temp);
138+
return PyMac_Error(err);
139+
}
131140

141+
AEDisposeDesc(&temp);
132142
return result;
133143
}
134-
135144
}
136145

137146
if (myErr != noErr)
@@ -170,25 +179,30 @@ OSAm_CompileAndExecute (self, args)
170179
char *line;
171180
DescType typeCode;
172181
long dataSize = 0;
182+
OSErr err;
173183

174-
HLock (temp.dataHandle);
175-
176-
dataSize = GetHandleSize (temp.dataHandle);
184+
dataSize = AEGetDescDataSize (&temp);
177185

178186
if (dataSize > 0)
179187
{
180-
PyObject *result = PyString_FromStringAndSize ((*temp.dataHandle),
188+
PyObject *result = PyString_FromStringAndSize (NULL,
181189
dataSize);
182-
183-
AEDisposeDesc (&temp);
190+
184191

185192
if (!result)
186193
{
187194
printf ("OSAm.error Out of memory.\n");
188195
Py_INCREF (Py_None);
196+
AEDisposeDesc (&temp);
189197
return Py_None;
190198
}
199+
if ( (err=AEGetDescData(&temp, PyString_AS_STRING(result), dataSize)) < 0 )
200+
{
201+
AEDisposeDesc(&temp);
202+
return PyMac_Error(err);
203+
}
191204

205+
AEDisposeDesc(&temp);
192206
return result;
193207
}
194208
}
@@ -216,7 +230,7 @@ static struct PyMethodDef OSAm_methods[] =
216230
(PyCFunction) OSAm_CompileAndExecute,
217231
METH_VARARGS,
218232
OSAm_DoCommand__doc__},
219-
233+
#if 0
220234
{"CompileAndSave",
221235
(PyCFunction) OSAm_CompileAndSave,
222236
METH_VARARGS,
@@ -226,6 +240,7 @@ static struct PyMethodDef OSAm_methods[] =
226240
(PyCFunction) OSAm_RunCompiledScript,
227241
METH_VARARGS,
228242
OSAm_DoCommand__doc__},
243+
#endif
229244

230245
{NULL, (PyCFunction) NULL, 0, NULL}
231246
};

Mac/Contrib/osam/OSAm.prj

-30.4 KB
Binary file not shown.

Mac/Contrib/osam/ScriptRunner.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ static c2pstr(const char *cc)
4444

4545
OSAError LoadScriptingComponent (ComponentInstance * scriptingComponent);
4646

47-
47+
#if 0
4848
/*
4949
* store the script as a compile script so that OSA
5050
* components may load and execute the script easily
@@ -143,6 +143,7 @@ CompileAndSave (const char *text,
143143

144144
return err2;
145145
}
146+
#endif
146147

147148

148149
OSAError
@@ -194,7 +195,7 @@ CompileAndExecute (const char *text,
194195
return err2;
195196
}
196197

197-
198+
#if 0
198199
/*
199200
* This routine reads in a saved script file and executes
200201
* the script contained within (from a 'scpt' resource.)
@@ -291,6 +292,7 @@ ExecuteScriptFile (const char *theFilePath,
291292

292293
return err2;
293294
}
295+
#endif
294296

295297

296298
OSAError

0 commit comments

Comments
 (0)