[Python-checkins] python/dist/src/Mac/Modules Nav.c,1.19,1.20 icgluemodule.c,1.10,1.11 macconfig.c,1.34,1.35 macfsmodule.c,1.57,1.58 macmodule.c,1.52,1.53 macosmodule.c,1.61,1.62
jackjansen@users.sourceforge.net
jackjansen@users.sourceforge.net
Thu, 12 Dec 2002 02:32:22 -0800
Update of /cvsroot/python/python/dist/src/Mac/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv21368/Modules
Modified Files:
Nav.c icgluemodule.c macconfig.c macfsmodule.c macmodule.c
macosmodule.c
Log Message:
Getting rid of pre-Carbon (MacOS8) support. All code depending on
TARGET_API_MAC_OS8 (or !TARGET_API_MAC_CARBON) is gone. Also some
TARGET_API_MAC_OSX conditional code is gone, because it is no longer
used on OSX-only Python (only in MacPython-OS9).
Index: Nav.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/Nav.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** Nav.c 22 Nov 2002 23:39:52 -0000 1.19
--- Nav.c 12 Dec 2002 10:31:49 -0000 1.20
***************
*** 352,356 ****
return NULL;
}
- #if TARGET_API_MAC_CARBON
if (err=AEGetDescData(&desc, &fss, sizeof(FSSpec))) {
Py_DECREF(rv);
--- 352,355 ----
***************
*** 358,364 ****
return NULL;
}
- #else
- memcpy((void *)&fss, (void *)*desc.dataHandle, sizeof(FSSpec));
- #endif
rvitem = PyMac_BuildFSSpec(&fss);
PyList_SetItem(rv, i, rvitem);
--- 357,360 ----
Index: icgluemodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/icgluemodule.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** icgluemodule.c 17 Jul 2002 16:30:34 -0000 1.10
--- icgluemodule.c 12 Dec 2002 10:31:49 -0000 1.11
***************
*** 36,49 ****
#ifdef WITHOUT_FRAMEWORKS
- // #if !TARGET_API_MAC_OS8
- // /* The Carbon headers define PRAGMA_ALIGN_SUPPORT to something illegal,
- // ** because you shouldn't use it for Carbon. All good and well, but portable
- // ** code still needs it. So, we undefine it here.
- // */
- // #undef PRAGMA_ALIGN_SUPPORTED
- // #define PRAGMA_ALIGN_SUPPORTED 0
- // #endif /* !TARGET_API_MAC_OS8 */
-
- // #include "ICAPI.h"
#include <InternetConfig.h>
#else
--- 36,39 ----
***************
*** 68,144 ****
/* ---------------------------------------------------------------- */
- #if TARGET_API_MAC_OS8
- static char ici_ICFindConfigFile__doc__[] =
- "()->None; Find config file in standard places"
- ;
-
- static PyObject *
- ici_ICFindConfigFile(iciobject *self, PyObject *args)
- {
- OSStatus err;
-
- if (!PyArg_ParseTuple(args, ""))
- return NULL;
- if ((err=ICFindConfigFile(self->inst, 0, NULL)) != 0 )
- return PyMac_Error(err);
- Py_INCREF(Py_None);
- return Py_None;
- }
-
-
- static char ici_ICFindUserConfigFile__doc__[] =
- "(vRefNum, dirID)->None; Find config file in specified place"
- ;
-
- static PyObject *
- ici_ICFindUserConfigFile(iciobject *self, PyObject *args)
- {
- OSStatus err;
- ICDirSpec where;
-
- if (!PyArg_ParseTuple(args, "sl", &where.vRefNum, &where.dirID))
- return NULL;
- if ((err=ICFindUserConfigFile(self->inst, &where)) != 0 )
- return PyMac_Error(err);
- Py_INCREF(Py_None);
- return Py_None;
- }
-
-
- static char ici_ICChooseConfig__doc__[] =
- "()->None; Let the user choose a config file"
- ;
-
- static PyObject *
- ici_ICChooseConfig(iciobject *self, PyObject *args)
- {
- OSStatus err;
-
- if (!PyArg_ParseTuple(args, ""))
- return NULL;
- if ((err=ICChooseConfig(self->inst)) != 0 )
- return PyMac_Error(err);
- Py_INCREF(Py_None);
- return Py_None;
- }
-
- static char ici_ICChooseNewConfig__doc__[] =
- "()->None; Let the user choose a new config file"
- ;
-
- static PyObject *
- ici_ICChooseNewConfig(iciobject *self, PyObject *args)
- {
- OSStatus err;
-
- if (!PyArg_ParseTuple(args, ""))
- return NULL;
- if ((err=ICChooseNewConfig(self->inst)) != 0 )
- return PyMac_Error(err);
- Py_INCREF(Py_None);
- return Py_None;
- }
- #endif /* TARGET_API_MAC_OS8 */
-
static char ici_ICGetSeed__doc__[] =
--- 58,61 ----
***************
*** 424,433 ****
static struct PyMethodDef ici_methods[] = {
- #if TARGET_API_MAC_OS8
- {"ICFindConfigFile", (PyCFunction)ici_ICFindConfigFile, METH_VARARGS, ici_ICFindConfigFile__doc__},
- {"ICFindUserConfigFile", (PyCFunction)ici_ICFindUserConfigFile, METH_VARARGS, ici_ICFindUserConfigFile__doc__},
- {"ICChooseConfig", (PyCFunction)ici_ICChooseConfig, METH_VARARGS, ici_ICChooseConfig__doc__},
- {"ICChooseNewConfig", (PyCFunction)ici_ICChooseNewConfig, METH_VARARGS, ici_ICChooseNewConfig__doc__},
- #endif /* TARGET_API_MAC_OS8 */
{"ICGetSeed", (PyCFunction)ici_ICGetSeed, METH_VARARGS, ici_ICGetSeed__doc__},
{"ICBegin", (PyCFunction)ici_ICBegin, METH_VARARGS, ici_ICBegin__doc__},
--- 341,344 ----
Index: macconfig.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macconfig.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** macconfig.c 6 Sep 2002 23:33:40 -0000 1.34
--- macconfig.c 12 Dec 2002 10:31:49 -0000 1.35
***************
*** 245,258 ****
{"_TE", init_TE},
{"ColorPicker", initColorPicker},
- #if !TARGET_API_MAC_CARBON
- {"_Help", init_Help},
- {"Printing", initPrinting},
- #endif
- #if TARGET_API_MAC_CARBON
{"_CF", init_CF},
- #endif
- #if TARGET_API_MAC_CARBON
{"hfsplus", inithfsplus},
- #endif
#endif /* USE_TOOLBOX */
#ifdef USE_QT
--- 245,250 ----
Index: macfsmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macfsmodule.c,v
retrieving revision 1.57
retrieving revision 1.58
diff -C2 -d -r1.57 -r1.58
*** macfsmodule.c 6 Aug 2002 12:59:44 -0000 1.57
--- macfsmodule.c 12 Dec 2002 10:31:49 -0000 1.58
***************
*** 383,387 ****
_mfs_GetFSSpecFromFSRef(PyObject *self, FSSpec *fssp)
{
- #if !TARGET_API_MAC_OS8
static FSRef *fsrp;
--- 383,386 ----
***************
*** 391,395 ****
return 1;
}
- #endif
return 0;
}
--- 390,393 ----
***************
*** 399,408 ****
_mfs_GetFSRefFromFSRef(PyObject *self, FSRef *fsrp)
{
- #if !TARGET_API_MAC_OS8
if ( is_mfsrobject(self) ) {
*fsrp = ((mfsrobject *)self)->fsref;
return 1;
}
- #endif
return 0;
}
--- 397,404 ----
***************
*** 412,421 ****
_mfs_GetFSRefFromFSSpec(PyObject *self, FSRef *fsrp)
{
- #if !TARGET_API_MAC_OS8
if ( is_mfssobject(self) ) {
if ( FSpMakeFSRef(&((mfssobject *)self)->fsspec, fsrp) == noErr )
return 1;
}
- #endif
return 0;
}
--- 408,415 ----
***************
*** 534,541 ****
mfss_FSpMakeFSRef(mfssobject *self, PyObject *args)
{
- #if TARGET_API_MAC_OS8
- PyErr_SetString(PyExc_NotImplementedError, "FSRef objects not supported on this platform");
- return 0;
- #else
OSErr err;
FSRef fsref;
--- 528,531 ----
***************
*** 549,553 ****
}
return (PyObject *)newmfsrobject(&fsref);
- #endif
}
--- 539,542 ----
***************
*** 778,782 ****
/* End of code for FSSpec objects */
/* -------------------------------------------------------- */
- #if !TARGET_API_MAC_OS8
static PyObject *
mfsr_as_fsspec(mfsrobject *self, PyObject *args)
--- 767,770 ----
***************
*** 892,896 ****
/* End of code for FSRef objects */
- #endif /* !TARGET_API_MAC_OS8 */
/* -------------------------------------------------------- */
--- 880,883 ----
***************
*** 912,1000 ****
}
- #if !TARGET_API_MAC_CARBON
- static PyObject *
- mfs_StandardGetFile(PyObject *self, PyObject *args)
- {
- SFTypeList list;
- short numtypes;
- StandardFileReply reply;
-
- list[0] = list[1] = list[2] = list[3] = 0;
- numtypes = 0;
- if (!PyArg_ParseTuple(args, "|O&O&O&O&", PyMac_GetOSType, &list[0],
- PyMac_GetOSType, &list[1], PyMac_GetOSType, &list[2],
- PyMac_GetOSType, &list[3]) )
- return NULL;
- while ( numtypes < 4 && list[numtypes] ) {
- numtypes++;
- }
- if ( numtypes == 0 )
- numtypes = -1;
- StandardGetFile((FileFilterUPP)0, numtypes, list, &reply);
- return Py_BuildValue("(Oi)", newmfssobject(&reply.sfFile), reply.sfGood);
- }
-
- static PyObject *
- mfs_PromptGetFile(PyObject *self, PyObject *args)
- {
- SFTypeList list;
- short numtypes;
- StandardFileReply reply;
- char *prompt = NULL;
-
- list[0] = list[1] = list[2] = list[3] = 0;
- numtypes = 0;
- if (!PyArg_ParseTuple(args, "s|O&O&O&O&", &prompt, PyMac_GetOSType, &list[0],
- PyMac_GetOSType, &list[1], PyMac_GetOSType, &list[2],
- PyMac_GetOSType, &list[3]) )
- return NULL;
- while ( numtypes < 4 && list[numtypes] ) {
- numtypes++;
- }
- if ( numtypes == 0 )
- numtypes = -1;
- PyMac_PromptGetFile(numtypes, list, &reply, prompt);
- return Py_BuildValue("(Oi)", newmfssobject(&reply.sfFile), reply.sfGood);
- }
-
- static PyObject *
- mfs_StandardPutFile(PyObject *self, PyObject *args)
- {
- Str255 prompt, dft;
- StandardFileReply reply;
-
- dft[0] = 0;
- if (!PyArg_ParseTuple(args, "O&|O&", PyMac_GetStr255, &prompt, PyMac_GetStr255, &dft) )
- return NULL;
- StandardPutFile(prompt, dft, &reply);
- return Py_BuildValue("(Oi)",newmfssobject(&reply.sfFile), reply.sfGood);
- }
-
- /*
- ** Set initial directory for file dialogs */
- static PyObject *
- mfs_SetFolder(PyObject *self, PyObject *args)
- {
- FSSpec spec;
- FSSpec ospec;
- short orefnum;
- long oparid;
-
- /* Get old values */
- orefnum = -LMGetSFSaveDisk();
- oparid = LMGetCurDirStore();
- (void)FSMakeFSSpec(orefnum, oparid, "\pplaceholder", &ospec);
-
- /* Go to working directory by default */
- (void)FSMakeFSSpec(0, 0, "\p:placeholder", &spec);
- if (!PyArg_ParseTuple(args, "|O&", PyMac_GetFSSpec, &spec))
- return NULL;
- /* Set standard-file working directory */
- LMSetSFSaveDisk(-spec.vRefNum);
- LMSetCurDirStore(spec.parID);
- return (PyObject *)newmfssobject(&ospec);
- }
- #endif
-
static PyObject *
mfs_FSSpec(PyObject *self, PyObject *args)
--- 899,902 ----
***************
*** 1010,1017 ****
mfs_FSRef(PyObject *self, PyObject *args)
{
- #if TARGET_API_MAC_OS8
- PyErr_SetString(PyExc_NotImplementedError, "FSRef objects not supported on this platform");
- return 0;
- #else
FSRef fsr;
--- 912,915 ----
***************
*** 1019,1023 ****
return NULL;
return (PyObject *)newmfsrobject(&fsr);
- #endif
}
--- 917,920 ----
***************
*** 1057,1076 ****
}
- #if !TARGET_API_MAC_CARBON
- static PyObject *
- mfs_GetDirectory(PyObject *self, PyObject *args)
- {
- FSSpec fsdir;
- int ok;
- char *prompt = NULL;
-
- if (!PyArg_ParseTuple(args, "|s", &prompt) )
- return NULL;
-
- ok = PyMac_GetDirectory(&fsdir, prompt);
- return Py_BuildValue("(Oi)", newmfssobject(&fsdir), ok);
- }
- #endif
-
static PyObject *
mfs_FindFolder(PyObject *self, PyObject *args)
--- 954,957 ----
***************
*** 1144,1154 ****
static struct PyMethodDef mfs_methods[] = {
{"ResolveAliasFile", mfs_ResolveAliasFile, 1},
- #if !TARGET_API_MAC_CARBON
- {"StandardGetFile", mfs_StandardGetFile, 1},
- {"PromptGetFile", mfs_PromptGetFile, 1},
- {"StandardPutFile", mfs_StandardPutFile, 1},
- {"GetDirectory", mfs_GetDirectory, 1},
- {"SetFolder", mfs_SetFolder, 1},
- #endif
{"FSSpec", mfs_FSSpec, 1},
{"FSRef", mfs_FSRef, 1},
--- 1025,1028 ----
***************
*** 1171,1178 ****
PyMac_GetFSRef(PyObject *v, FSRef *fsr)
{
- #if TARGET_API_MAC_OS8
- PyErr_SetString(PyExc_TypeError, "FSRef objects not supported on this platform");
- return 0;
- #else
/* If it's an FSRef we're also okay. */
if (_mfs_GetFSRefFromFSRef(v, fsr))
--- 1045,1048 ----
***************
*** 1196,1200 ****
PyErr_SetString(PyExc_TypeError, "FSRef argument should be existing FSRef, FSSpec or (OSX only) pathname");
return 0;
- #endif
}
--- 1066,1069 ----
***************
*** 1202,1210 ****
PyObject *PyMac_BuildFSRef(FSRef *v)
{
- #if TARGET_API_MAC_OS8
- return NULL;
- #else
return (PyObject *)newmfsrobject(v);
- #endif
}
--- 1071,1075 ----
Index: macmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macmodule.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -C2 -d -r1.52 -r1.53
*** macmodule.c 11 Apr 2002 20:46:11 -0000 1.52
--- macmodule.c 12 Dec 2002 10:31:49 -0000 1.53
***************
*** 33,41 ****
#include <errno.h>
- #if TARGET_API_MAC_OS8
- /* Skip for Carbon */
- #include "macstat.h"
- #endif
-
#ifdef USE_GUSI
/* Remove defines from macstat.h */
--- 33,36 ----
***************
*** 50,56 ****
#include <sys/stat.h>
#else /* USE_GUSI */
- #if TARGET_API_MAC_OS8
- #define stat macstat
- #endif
#endif /* USE_GUSI */
--- 45,48 ----
***************
*** 240,261 ****
#endif
- #if TARGET_API_MAC_OS8
- static PyObject *
- mac_getbootvol(self, args)
- PyObject *self;
- PyObject *args;
- {
- char *res;
- if (!PyArg_ParseTuple(args, ""))
- return NULL;
- Py_BEGIN_ALLOW_THREADS
- res = getbootvol();
- Py_END_ALLOW_THREADS
- if (res == NULL)
- return mac_error();
- return PyString_FromString(res);
- }
- #endif
-
static PyObject *
mac_getcwd(self, args)
--- 232,235 ----
***************
*** 472,494 ****
static PyTypeObject StatResultType;
- #ifdef TARGET_API_MAC_OS8
- static PyStructSequence_Field xstat_result_fields[] = {
- COMMON_STAT_RESULT_FIELDS
- { "st_rsize" },
- { "st_creator" },
- { "st_type "},
- {0}
- };
-
- static PyStructSequence_Desc xstat_result_desc = {
- "mac.xstat_result",
- stat_result__doc__,
- xstat_result_fields,
- 13
- };
-
- static PyTypeObject XStatResultType;
- #endif
-
static PyObject *
_pystat_from_struct_stat(struct stat st, void* _mst)
--- 446,449 ----
***************
*** 496,507 ****
PyObject *v;
! #if TARGET_API_MAC_OS8
! struct macstat *mst;
!
! if (_mst != NULL)
! v = PyStructSequence_New(&XStatResultType);
! else
! #endif
! v = PyStructSequence_New(&StatResultType);
PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long)st.st_mode));
PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long)st.st_ino));
--- 451,455 ----
PyObject *v;
! v = PyStructSequence_New(&StatResultType);
PyStructSequence_SET_ITEM(v, 0, PyInt_FromLong((long)st.st_mode));
PyStructSequence_SET_ITEM(v, 1, PyInt_FromLong((long)st.st_ino));
***************
*** 517,540 ****
PyStructSequence_SET_ITEM(v, 9,
PyFloat_FromDouble((double)st.st_ctime));
! #if TARGET_API_MAC_OS8
! if (_mst != NULL) {
! mst = (struct macstat *) _mst;
! PyStructSequence_SET_ITEM(v, 10,
! PyInt_FromLong((long)mst->st_rsize));
! PyStructSequence_SET_ITEM(v, 11,
! PyString_FromStringAndSize(mst->st_creator,
! 4));
! PyStructSequence_SET_ITEM(v, 12,
! PyString_FromStringAndSize(mst->st_type,
! 4));
}
- #endif
-
- if (PyErr_Occurred()) {
- Py_DECREF(v);
- return NULL;
- }
! return v;
}
--- 465,474 ----
PyStructSequence_SET_ITEM(v, 9,
PyFloat_FromDouble((double)st.st_ctime));
! if (PyErr_Occurred()) {
! Py_DECREF(v);
! return NULL;
}
! return v;
}
***************
*** 580,615 ****
#endif /* WEHAVE_FSTAT */
- #if TARGET_API_MAC_OS8
- static PyObject *
- mac_xstat(self, args)
- PyObject *self;
- PyObject *args;
- {
- struct macstat mst;
- struct stat st;
- char *path;
- int res;
- if (!PyArg_ParseTuple(args, "s", &path))
- return NULL;
- /*
- ** Convoluted: we want stat() and xstat() to agree, so we call both
- ** stat and macstat, and use the latter only for values not provided by
- ** the former.
- */
- Py_BEGIN_ALLOW_THREADS
- res = macstat(path, &mst);
- Py_END_ALLOW_THREADS
- if (res != 0)
- return mac_error();
- Py_BEGIN_ALLOW_THREADS
- res = stat(path, &st);
- Py_END_ALLOW_THREADS
- if (res != 0)
- return mac_error();
-
- return _pystat_from_struct_stat(st, (void*) &mst);
- }
- #endif
-
static PyObject *
mac_sync(self, args)
--- 514,517 ----
***************
*** 685,691 ****
{"fstat", mac_fstat, 1},
#endif
- #if TARGET_API_MAC_OS8
- {"getbootvol", mac_getbootvol, 1}, /* non-standard */
- #endif
{"getcwd", mac_getcwd, 1},
{"listdir", mac_listdir, 1},
--- 587,590 ----
***************
*** 697,703 ****
{"rmdir", mac_rmdir, 1},
{"stat", mac_stat, 1},
- #if TARGET_API_MAC_OS8
- {"xstat", mac_xstat, 1},
- #endif
{"sync", mac_sync, 1},
{"remove", mac_unlink, 1},
--- 596,599 ----
***************
*** 824,830 ****
PyDict_SetItemString(d, "stat_result", (PyObject*) &StatResultType);
- #if TARGET_API_MAC_OS8
- PyStructSequence_InitType(&XStatResultType, &xstat_result_desc);
- PyDict_SetItemString(d, "xstat_result", (PyObject*) &XStatResultType);
- #endif
}
--- 720,722 ----
Index: macosmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/macosmodule.c,v
retrieving revision 1.61
retrieving revision 1.62
diff -C2 -d -r1.61 -r1.62
*** macosmodule.c 17 Jul 2002 16:30:34 -0000 1.61
--- macosmodule.c 12 Dec 2002 10:31:49 -0000 1.62
***************
*** 349,395 ****
}
- #if TARGET_API_MAC_OS8
- /*----------------------------------------------------------------------*/
- /* STDWIN High Level Event interface */
-
- #include <EPPC.h>
- #include <Events.h>
-
- static char accepthle_doc[] = "Get arguments of pending high-level event";
-
- static PyObject *
- MacOS_AcceptHighLevelEvent(self, args)
- PyObject *self;
- PyObject *args;
- {
- TargetID sender;
- unsigned long refcon;
- Ptr buf;
- unsigned long len;
- OSErr err;
- PyObject *res;
-
- buf = NULL;
- len = 0;
- err = AcceptHighLevelEvent(&sender, &refcon, buf, &len);
- if (err == bufferIsSmall) {
- buf = malloc(len);
- if (buf == NULL)
- return PyErr_NoMemory();
- err = AcceptHighLevelEvent(&sender, &refcon, buf, &len);
- if (err != noErr) {
- free(buf);
- return PyErr_Mac(MacOS_Error, (int)err);
- }
- }
- else if (err != noErr)
- return PyErr_Mac(MacOS_Error, (int)err);
- res = Py_BuildValue("s#ls#",
- (char *)&sender, (int)(sizeof sender), refcon, (char *)buf, (int)len);
- free(buf);
- return res;
- }
- #endif
-
#if !TARGET_API_MAC_OSX
static char schedparams_doc[] = "Set/return mainloop interrupt check flag, etc";
--- 349,352 ----
***************
*** 702,708 ****
static PyMethodDef MacOS_Methods[] = {
- #if TARGET_API_MAC_OS8
- {"AcceptHighLevelEvent", MacOS_AcceptHighLevelEvent, 1, accepthle_doc},
- #endif
{"GetCreatorAndType", MacOS_GetCreatorAndType, 1, getcrtp_doc},
{"SetCreatorAndType", MacOS_SetCreatorAndType, 1, setcrtp_doc},
--- 659,662 ----
***************
*** 760,765 ****
#if TARGET_API_MAC_OSX
#define PY_RUNTIMEMODEL "macho"
- #elif TARGET_API_MAC_OS8
- #define PY_RUNTIMEMODEL "ppc"
#elif TARGET_API_MAC_CARBON
#define PY_RUNTIMEMODEL "carbon"
--- 714,717 ----