summaryrefslogtreecommitdiffstats
path: root/Mac/Modules/res
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>2001-12-18 15:39:38 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>2001-12-18 15:39:38 (GMT)
commit620a7667ebb2ebd31a22349c20e66bad3a8980f9 (patch)
treed624b4ded7165d1c7703b2570f445ac661068f80 /Mac/Modules/res
parentf30c3ad0d9eb8ab076ebfb1e8faa33ce68130649 (diff)
downloadcpython-620a7667ebb2ebd31a22349c20e66bad3a8980f9.zip
cpython-620a7667ebb2ebd31a22349c20e66bad3a8980f9.tar.gz
cpython-620a7667ebb2ebd31a22349c20e66bad3a8980f9.tar.bz2
Updated to Universal Headers 3.4
Diffstat (limited to 'Mac/Modules/res')
-rw-r--r--Mac/Modules/res/_Resmodule.c53
-rw-r--r--Mac/Modules/res/resscan.py5
-rw-r--r--Mac/Modules/res/ressupport.py1
3 files changed, 59 insertions, 0 deletions
diff --git a/Mac/Modules/res/_Resmodule.c b/Mac/Modules/res/_Resmodule.c
index b29e852..0c4576b 100644
--- a/Mac/Modules/res/_Resmodule.c
+++ b/Mac/Modules/res/_Resmodule.c
@@ -5,8 +5,12 @@
+#ifdef _WIN32
+#include "pywintoolbox.h"
+#else
#include "macglue.h"
#include "pymactoolbox.h"
+#endif
/* Macro to test whether a weak-loaded CFM function exists */
#define PyMac_PRECHECK(rtn) do { if ( &rtn == NULL ) {\
@@ -1357,6 +1361,51 @@ static PyObject *Res_GetNextResourceFile(PyObject *_self, PyObject *_args)
}
#endif
+static PyObject *Res_FSOpenResFile(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ short _rv;
+ FSRef ref;
+ SignedByte permission;
+ if (!PyArg_ParseTuple(_args, "O&b",
+ PyMac_GetFSRef, &ref,
+ &permission))
+ return NULL;
+ _rv = FSOpenResFile(&ref,
+ permission);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("h",
+ _rv);
+ return _res;
+}
+
+static PyObject *Res_FSResourceFileAlreadyOpen(PyObject *_self, PyObject *_args)
+{
+ PyObject *_res = NULL;
+ Boolean _rv;
+ FSRef resourceFileRef;
+ Boolean inChain;
+ SInt16 refNum;
+ if (!PyArg_ParseTuple(_args, "O&",
+ PyMac_GetFSRef, &resourceFileRef))
+ return NULL;
+ _rv = FSResourceFileAlreadyOpen(&resourceFileRef,
+ &inChain,
+ &refNum);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("bbh",
+ _rv,
+ inChain,
+ refNum);
+ return _res;
+}
+
static PyObject *Res_Resource(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@@ -1518,6 +1567,10 @@ static PyMethodDef Res_methods[] = {
{"GetNextResourceFile", (PyCFunction)Res_GetNextResourceFile, 1,
"(SInt16 curRefNum) -> (OSErr _rv, SInt16 nextRefNum)"},
#endif
+ {"FSOpenResFile", (PyCFunction)Res_FSOpenResFile, 1,
+ "(FSRef ref, SignedByte permission) -> (short _rv)"},
+ {"FSResourceFileAlreadyOpen", (PyCFunction)Res_FSResourceFileAlreadyOpen, 1,
+ "(FSRef resourceFileRef) -> (Boolean _rv, Boolean inChain, SInt16 refNum)"},
{"Resource", (PyCFunction)Res_Resource, 1,
"Convert a string to a resource object.\n\nThe created resource object is actually just a handle,\napply AddResource() to write it to a resource file.\nSee also the Handle() docstring.\n"},
{"Handle", (PyCFunction)Res_Handle, 1,
diff --git a/Mac/Modules/res/resscan.py b/Mac/Modules/res/resscan.py
index d748adb..ecdd86b 100644
--- a/Mac/Modules/res/resscan.py
+++ b/Mac/Modules/res/resscan.py
@@ -46,6 +46,11 @@ class ResourcesScanner(Scanner):
## "MaxSizeRsrc", # GetMaxResourceSize
]
+ def makeblacklisttypes(self):
+ return [
+ "UniCharCount", #TBD
+ ]
+
def makegreylist(self):
return [
('#if TARGET_API_MAC_OS8', [
diff --git a/Mac/Modules/res/ressupport.py b/Mac/Modules/res/ressupport.py
index f7a1f45..056e214 100644
--- a/Mac/Modules/res/ressupport.py
+++ b/Mac/Modules/res/ressupport.py
@@ -5,6 +5,7 @@
from macsupport import *
+FSRef_ptr = OpaqueType("FSRef", "PyMac_BuildFSRef", "PyMac_GetFSRef")
class ResMixIn: