diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 2003-11-19 16:34:04 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 2003-11-19 16:34:04 (GMT) |
commit | a53f4eba19856613a55ccbcfdb8c862d24a691b9 (patch) | |
tree | 55e8e3616059daa41c666e3b0abd92ed8a0efd43 /Mac/Modules/file | |
parent | 9588770e25db99692f3ebb680235bc1a02b65017 (diff) | |
download | cpython-a53f4eba19856613a55ccbcfdb8c862d24a691b9.zip cpython-a53f4eba19856613a55ccbcfdb8c862d24a691b9.tar.gz cpython-a53f4eba19856613a55ccbcfdb8c862d24a691b9.tar.bz2 |
Getting rid of code conditional on TARGET_API_MAC_*.
Diffstat (limited to 'Mac/Modules/file')
-rw-r--r-- | Mac/Modules/file/_Filemodule.c | 66 | ||||
-rw-r--r-- | Mac/Modules/file/filescan.py | 8 | ||||
-rw-r--r-- | Mac/Modules/file/filesupport.py | 48 |
3 files changed, 0 insertions, 122 deletions
diff --git a/Mac/Modules/file/_Filemodule.c b/Mac/Modules/file/_Filemodule.c index 9d6e371..f5f48d2 100644 --- a/Mac/Modules/file/_Filemodule.c +++ b/Mac/Modules/file/_Filemodule.c @@ -1757,8 +1757,6 @@ static PyObject *FSRef_FSOpenFork(FSRefObject *_self, PyObject *_args) return _res; } -#if TARGET_API_MAC_OSX - static PyObject *FSRef_FNNotify(FSRefObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -1777,7 +1775,6 @@ static PyObject *FSRef_FNNotify(FSRefObject *_self, PyObject *_args) _res = Py_None; return _res; } -#endif static PyObject *FSRef_FSNewAliasMinimal(FSRefObject *_self, PyObject *_args) { @@ -1836,26 +1833,9 @@ static PyObject *FSRef_as_pathname(FSRefObject *_self, PyObject *_args) { 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; } @@ -1887,11 +1867,8 @@ static PyMethodDef FSRef_methods[] = { PyDoc_STR("(Buffer forkNameLength) -> None")}, {"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)")}, {"FSIsAliasFile", (PyCFunction)FSRef_FSIsAliasFile, 1, @@ -2726,8 +2703,6 @@ static PyObject *File_FSPathMakeRef(PyObject *_self, PyObject *_args) return _res; } -#if TARGET_API_MAC_OSX - static PyObject *File_FNNotifyByPath(PyObject *_self, PyObject *_args) { PyObject *_res = NULL; @@ -2748,9 +2723,6 @@ static PyObject *File_FNNotifyByPath(PyObject *_self, PyObject *_args) _res = Py_None; return _res; } -#endif - -#if TARGET_API_MAC_OSX static PyObject *File_FNNotifyAll(PyObject *_self, PyObject *_args) { @@ -2769,7 +2741,6 @@ static PyObject *File_FNNotifyAll(PyObject *_self, PyObject *_args) _res = Py_None; return _res; } -#endif static PyObject *File_NewAlias(PyObject *_self, PyObject *_args) { @@ -3106,16 +3077,10 @@ static PyMethodDef File_methods[] = { PyDoc_STR("() -> (HFSUniStr255 resourceForkName)")}, {"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)")}, {"NewAliasMinimalFromFullPath", (PyCFunction)File_NewAliasMinimalFromFullPath, 1, @@ -3167,32 +3132,10 @@ PyMac_GetFSSpec(PyObject *v, FSSpec *spec) return 1; } 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) { PyMac_Error(err); @@ -3200,9 +3143,6 @@ PyMac_GetFSSpec(PyObject *v, FSSpec *spec) } return 1; } -#if !TARGET_API_MAC_OSX - PyErr_SetString(PyExc_TypeError, "FSSpec, FSRef, pathname or (refnum, parid, path) required"); -#endif return 0; } @@ -3217,7 +3157,6 @@ PyMac_GetFSRef(PyObject *v, FSRef *fsr) return 1; } -#if TARGET_API_MAC_OSX /* On OSX we now try a pathname */ if ( PyString_Check(v) || PyUnicode_Check(v)) { char *path = NULL; @@ -3230,14 +3169,9 @@ PyMac_GetFSRef(PyObject *v, FSRef *fsr) return 1; } /* 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; PyMac_Error(err); diff --git a/Mac/Modules/file/filescan.py b/Mac/Modules/file/filescan.py index ca977af..8d663a3 100644 --- a/Mac/Modules/file/filescan.py +++ b/Mac/Modules/file/filescan.py @@ -105,14 +105,6 @@ class MyScanner(Scanner_OSX): ] - def makegreylist(self): - return [ - ('#if TARGET_API_MAC_OSX', [ - 'FNNotifyAll', - 'FNNotifyByPath', - 'FNNotify', - ])] - def makeblacklisttypes(self): return [ "CInfoPBPtr", # Old stuff diff --git a/Mac/Modules/file/filesupport.py b/Mac/Modules/file/filesupport.py index 9fa8edd..f06bbb8 100644 --- a/Mac/Modules/file/filesupport.py +++ b/Mac/Modules/file/filesupport.py @@ -225,32 +225,10 @@ PyMac_GetFSSpec(PyObject *v, FSSpec *spec) return 1; } 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) { PyMac_Error(err); @@ -258,9 +236,6 @@ PyMac_GetFSSpec(PyObject *v, FSSpec *spec) } return 1; } -#if !TARGET_API_MAC_OSX - PyErr_SetString(PyExc_TypeError, "FSSpec, FSRef, pathname or (refnum, parid, path) required"); -#endif return 0; } @@ -275,7 +250,6 @@ PyMac_GetFSRef(PyObject *v, FSRef *fsr) return 1; } -#if TARGET_API_MAC_OSX /* On OSX we now try a pathname */ if ( PyString_Check(v) || PyUnicode_Check(v)) { char *path = NULL; @@ -288,14 +262,9 @@ PyMac_GetFSRef(PyObject *v, FSRef *fsr) return 1; } /* 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; PyMac_Error(err); @@ -814,26 +783,9 @@ f.docstring = lambda: "() -> string" fsref_methods.append(f) 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; """ f = ManualGenerator("as_pathname", FSRef_as_pathname_body) |