[Python-checkins] python/dist/src/Mac/Modules/file _Filemodule.c,
1.20, 1.21 filescan.py, 1.8, 1.9 filesupport.py, 1.18, 1.19
jackjansen at users.sourceforge.net
jackjansen at users.sourceforge.net
Wed Nov 19 11:34:06 EST 2003
Update of /cvsroot/python/python/dist/src/Mac/Modules/file
In directory sc8-pr-cvs1:/tmp/cvs-serv32109/Mac/Modules/file
Modified Files:
_Filemodule.c filescan.py filesupport.py
Log Message:
Getting rid of code conditional on TARGET_API_MAC_*.
Index: _Filemodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/file/_Filemodule.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** _Filemodule.c 19 Nov 2003 16:13:26 -0000 1.20
--- _Filemodule.c 19 Nov 2003 16:34:04 -0000 1.21
***************
*** 1758,1763 ****
}
- #if TARGET_API_MAC_OSX
-
static PyObject *FSRef_FNNotify(FSRefObject *_self, PyObject *_args)
{
--- 1758,1761 ----
***************
*** 1778,1782 ****
return _res;
}
- #endif
static PyObject *FSRef_FSNewAliasMinimal(FSRefObject *_self, PyObject *_args)
--- 1776,1779 ----
***************
*** 1837,1860 ****
PyObject *_res = NULL;
- #if TARGET_API_MAC_OSX
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_res = FSRef_FSRefMakePath(_self, _args);
- #else
- char strbuf[1024];
- OSErr err;
- FSSpec fss;
-
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- if ( !PyMac_GetFSSpec((PyObject *)_self, &fss))
- return NULL;
- err = PyMac_GetFullPathname(&fss, strbuf, sizeof(strbuf));
- if ( err ) {
- PyMac_Error(err);
- return NULL;
- }
- _res = PyString_FromString(strbuf);
- #endif
return _res;
--- 1834,1840 ----
***************
*** 1888,1896 ****
{"FSOpenFork", (PyCFunction)FSRef_FSOpenFork, 1,
PyDoc_STR("(Buffer forkNameLength, SInt8 permissions) -> (SInt16 forkRefNum)")},
-
- #if TARGET_API_MAC_OSX
{"FNNotify", (PyCFunction)FSRef_FNNotify, 1,
PyDoc_STR("(FNMessage message, OptionBits flags) -> None")},
- #endif
{"FSNewAliasMinimal", (PyCFunction)FSRef_FSNewAliasMinimal, 1,
PyDoc_STR("() -> (AliasHandle inAlias)")},
--- 1868,1873 ----
***************
*** 2727,2732 ****
}
- #if TARGET_API_MAC_OSX
-
static PyObject *File_FNNotifyByPath(PyObject *_self, PyObject *_args)
{
--- 2704,2707 ----
***************
*** 2749,2755 ****
return _res;
}
- #endif
-
- #if TARGET_API_MAC_OSX
static PyObject *File_FNNotifyAll(PyObject *_self, PyObject *_args)
--- 2724,2727 ----
***************
*** 2770,2774 ****
return _res;
}
- #endif
static PyObject *File_NewAlias(PyObject *_self, PyObject *_args)
--- 2742,2745 ----
***************
*** 3107,3120 ****
{"FSPathMakeRef", (PyCFunction)File_FSPathMakeRef, 1,
PyDoc_STR("(UInt8 * path) -> (FSRef ref, Boolean isDirectory)")},
-
- #if TARGET_API_MAC_OSX
{"FNNotifyByPath", (PyCFunction)File_FNNotifyByPath, 1,
PyDoc_STR("(UInt8 * path, FNMessage message, OptionBits flags) -> None")},
- #endif
-
- #if TARGET_API_MAC_OSX
{"FNNotifyAll", (PyCFunction)File_FNNotifyAll, 1,
PyDoc_STR("(FNMessage message, OptionBits flags) -> None")},
- #endif
{"NewAlias", (PyCFunction)File_NewAlias, 1,
PyDoc_STR("(FSSpec fromFile, FSSpec target) -> (AliasHandle alias)")},
--- 3078,3085 ----
***************
*** 3168,3197 ****
}
PyErr_Clear();
- #if !TARGET_API_MAC_OSX
- /* On OS9 we now try a pathname */
- if ( PyString_Check(v) ) {
- /* It's a pathname */
- if( !PyArg_Parse(v, "O&", PyMac_GetStr255, &path) )
- return 0;
- refnum = 0; /* XXXX Should get CurWD here?? */
- parid = 0;
- err = FSMakeFSSpec(refnum, parid, path, spec);
- if ( err && err != fnfErr ) {
- PyMac_Error(err);
- return 0;
- }
- return 1;
- }
- PyErr_Clear();
- #endif
/* Otherwise we try to go via an FSRef. On OSX we go all the way,
** on OS9 we accept only a real FSRef object
*/
- #if TARGET_API_MAC_OSX
if ( PyMac_GetFSRef(v, &fsr) ) {
- #else
- if (FSRef_Check(v)) {
- fsr = ((FSRefObject *)v)->ob_itself;
- #endif
err = FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, spec, NULL);
if (err != noErr) {
--- 3133,3140 ----
***************
*** 3201,3207 ****
return 1;
}
- #if !TARGET_API_MAC_OSX
- PyErr_SetString(PyExc_TypeError, "FSSpec, FSRef, pathname or (refnum, parid, path) required");
- #endif
return 0;
}
--- 3144,3147 ----
***************
*** 3218,3222 ****
}
- #if TARGET_API_MAC_OSX
/* On OSX we now try a pathname */
if ( PyString_Check(v) || PyUnicode_Check(v)) {
--- 3158,3161 ----
***************
*** 3231,3242 ****
}
/* XXXX Should try unicode here too */
- #endif
/* Otherwise we try to go via an FSSpec */
- #if TARGET_API_MAC_OSX
if (FSSpec_Check(v)) {
fss = ((FSSpecObject *)v)->ob_itself;
- #else
- if (PyMac_GetFSSpec(v, &fss)) {
- #endif
if ((err=FSpMakeFSRef(&fss, fsr)) == 0)
return 1;
--- 3170,3176 ----
Index: filescan.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/file/filescan.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** filescan.py 2 Feb 2003 23:00:21 -0000 1.8
--- filescan.py 19 Nov 2003 16:34:04 -0000 1.9
***************
*** 106,117 ****
]
- def makegreylist(self):
- return [
- ('#if TARGET_API_MAC_OSX', [
- 'FNNotifyAll',
- 'FNNotifyByPath',
- 'FNNotify',
- ])]
-
def makeblacklisttypes(self):
return [
--- 106,109 ----
Index: filesupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/file/filesupport.py,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** filesupport.py 19 Nov 2003 16:13:26 -0000 1.18
--- filesupport.py 19 Nov 2003 16:34:04 -0000 1.19
***************
*** 226,255 ****
}
PyErr_Clear();
- #if !TARGET_API_MAC_OSX
- /* On OS9 we now try a pathname */
- if ( PyString_Check(v) ) {
- /* It's a pathname */
- if( !PyArg_Parse(v, "O&", PyMac_GetStr255, &path) )
- return 0;
- refnum = 0; /* XXXX Should get CurWD here?? */
- parid = 0;
- err = FSMakeFSSpec(refnum, parid, path, spec);
- if ( err && err != fnfErr ) {
- PyMac_Error(err);
- return 0;
- }
- return 1;
- }
- PyErr_Clear();
- #endif
/* Otherwise we try to go via an FSRef. On OSX we go all the way,
** on OS9 we accept only a real FSRef object
*/
- #if TARGET_API_MAC_OSX
if ( PyMac_GetFSRef(v, &fsr) ) {
- #else
- if (FSRef_Check(v)) {
- fsr = ((FSRefObject *)v)->ob_itself;
- #endif
err = FSGetCatalogInfo(&fsr, kFSCatInfoNone, NULL, NULL, spec, NULL);
if (err != noErr) {
--- 226,233 ----
***************
*** 259,265 ****
return 1;
}
- #if !TARGET_API_MAC_OSX
- PyErr_SetString(PyExc_TypeError, "FSSpec, FSRef, pathname or (refnum, parid, path) required");
- #endif
return 0;
}
--- 237,240 ----
***************
*** 276,280 ****
}
- #if TARGET_API_MAC_OSX
/* On OSX we now try a pathname */
if ( PyString_Check(v) || PyUnicode_Check(v)) {
--- 251,254 ----
***************
*** 289,300 ****
}
/* XXXX Should try unicode here too */
- #endif
/* Otherwise we try to go via an FSSpec */
- #if TARGET_API_MAC_OSX
if (FSSpec_Check(v)) {
fss = ((FSSpecObject *)v)->ob_itself;
- #else
- if (PyMac_GetFSSpec(v, &fss)) {
- #endif
if ((err=FSpMakeFSRef(&fss, fsr)) == 0)
return 1;
--- 263,269 ----
***************
*** 815,838 ****
FSRef_as_pathname_body = """
- #if TARGET_API_MAC_OSX
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_res = FSRef_FSRefMakePath(_self, _args);
- #else
- char strbuf[1024];
- OSErr err;
- FSSpec fss;
-
- if (!PyArg_ParseTuple(_args, ""))
- return NULL;
- if ( !PyMac_GetFSSpec((PyObject *)_self, &fss))
- return NULL;
- err = PyMac_GetFullPathname(&fss, strbuf, sizeof(strbuf));
- if ( err ) {
- PyMac_Error(err);
- return NULL;
- }
- _res = PyString_FromString(strbuf);
- #endif
return _res;
"""
--- 784,790 ----
More information about the Python-checkins
mailing list