]> granicus.if.org Git - python/commitdiff
Tweaks to make this module OS9-compatible.
authorJack Jansen <jack.jansen@cwi.nl>
Fri, 13 Dec 2002 23:16:00 +0000 (23:16 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Fri, 13 Dec 2002 23:16:00 +0000 (23:16 +0000)
Mac/Modules/file/_Filemodule.c
Mac/Modules/file/filescan.py
Mac/Modules/file/filesupport.py

index 6f7ef51fd57f7adc3233ff0e83a4edd947d4d0b1..0029d6cb5bc63987b223fb61920e37964bdb34c3 100644 (file)
@@ -1199,7 +1199,7 @@ static PyObject *File_FSPathMakeRef(PyObject *_self, PyObject *_args)
 {
        PyObject *_res = NULL;
        OSStatus _err;
-       char* path;
+       UInt8 * path;
        FSRef ref;
        Boolean isDirectory;
        if (!PyArg_ParseTuple(_args, "s",
@@ -1215,6 +1215,8 @@ static PyObject *File_FSPathMakeRef(PyObject *_self, PyObject *_args)
        return _res;
 }
 
+#if TARGET_API_MAC_OSX
+
 static PyObject *File_FNNotify(PyObject *_self, PyObject *_args)
 {
        PyObject *_res = NULL;
@@ -1235,12 +1237,15 @@ static PyObject *File_FNNotify(PyObject *_self, PyObject *_args)
        _res = Py_None;
        return _res;
 }
+#endif
+
+#if TARGET_API_MAC_OSX
 
 static PyObject *File_FNNotifyByPath(PyObject *_self, PyObject *_args)
 {
        PyObject *_res = NULL;
        OSStatus _err;
-       char* path;
+       UInt8 * path;
        FNMessage message;
        OptionBits flags;
        if (!PyArg_ParseTuple(_args, "sll",
@@ -1256,6 +1261,9 @@ 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)
 {
@@ -1274,6 +1282,7 @@ static PyObject *File_FNNotifyAll(PyObject *_self, PyObject *_args)
        _res = Py_None;
        return _res;
 }
+#endif
 
 static PyObject *File_FSRefMakePath(PyObject *_self, PyObject *_args)
 {
@@ -1411,13 +1420,22 @@ static PyMethodDef File_methods[] = {
        {"FSGetResourceForkName", (PyCFunction)File_FSGetResourceForkName, 1,
         PyDoc_STR("() -> (HFSUniStr255 resourceForkName)")},
        {"FSPathMakeRef", (PyCFunction)File_FSPathMakeRef, 1,
-        PyDoc_STR("(char* path) -> (FSRef ref, Boolean isDirectory)")},
+        PyDoc_STR("(UInt8 * path) -> (FSRef ref, Boolean isDirectory)")},
+
+#if TARGET_API_MAC_OSX
        {"FNNotify", (PyCFunction)File_FNNotify, 1,
         PyDoc_STR("(FSRef ref, FNMessage message, OptionBits flags) -> None")},
+#endif
+
+#if TARGET_API_MAC_OSX
        {"FNNotifyByPath", (PyCFunction)File_FNNotifyByPath, 1,
-        PyDoc_STR("(char* path, FNMessage message, OptionBits flags) -> None")},
+        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
        {"FSRefMakePath", (PyCFunction)File_FSRefMakePath, 1,
         PyDoc_STR("(FSRef) -> string")},
        {NULL, NULL, 0}
index 7a96d69535166af37bb4e41f882cbcabd9cce1bb..454fefc7a697a8bd9a9a24b1a42a4e7b9e864241 100644 (file)
@@ -89,6 +89,14 @@ class MyScanner(Scanner_OSX):
                        
                        ]
 
+       def makegreylist(self):
+               return [
+                       ('#if TARGET_API_MAC_OSX', [
+                               'FNNotifyAll',
+                               'FNNotifyByPath',
+                               'FNNotify',
+                       ])]
+                       
        def makeblacklisttypes(self):
                return [
                        "CInfoPBPtr", # Old stuff
@@ -127,10 +135,6 @@ class MyScanner(Scanner_OSX):
        def makerepairinstructions(self):
                return [
                        # Various ways to give pathnames
-                       ([('UInt8_ptr', 'path', 'InMode')],
-                        [('stringptr', 'path', 'InMode')]
-                       ),
-                        
                        ([('char_ptr', '*', 'InMode')],
                         [('stringptr', '*', 'InMode')]
                        ),
index a009c3dcba696da71fb83c52b64e30611c2073f0..f916c3455ddbe0f2a59b80dfc18e2d50cda843d1 100644 (file)
@@ -46,11 +46,7 @@ FSVolumeRefNum = Type("FSVolumeRefNum", "h")
 HFSUniStr255 = OpaqueType("HFSUniStr255", "PyMac_BuildHFSUniStr255", "PyMac_GetHFSUniStr255")
 SInt64 = Type("SInt64", "L")
 UInt64 = Type("UInt64", "L")
-#UInt8_ptr
-#UniCharCount
-#char_ptr
-#void_ptr
-
+UInt8_ptr = InputOnlyType("UInt8 *", "s")
 
 includestuff = includestuff + """
 #ifdef WITHOUT_FRAMEWORKS