[Python-checkins] CVS: python/dist/src/Mac/Modules/res _Resmodule.c,1.7,1.7.4.1 resscan.py,1.14,1.14.4.1 ressupport.py,1.18,1.18.4.1
Jack Jansen
jackjansen@users.sourceforge.net
Wed, 27 Feb 2002 15:16:54 -0800
- Previous message: [Python-checkins] CVS: python/dist/src/Mac/Modules/mlte _Mltemodule.c,1.8,1.8.4.1 mltescan.py,1.6,1.6.4.1 mltesupport.py,1.7,1.7.4.1
- Next message: [Python-checkins] CVS: python/dist/src/Mac/Modules/scrap _Scrapmodule.c,1.1,1.1.14.1 scrapscan.py,1.4,1.4.20.1 scrapsupport.py,1.4,1.4.14.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/python/python/dist/src/Mac/Modules/res
In directory usw-pr-cvs1:/tmp/cvs-serv2838/res
Modified Files:
Tag: release22-maint
_Resmodule.c resscan.py ressupport.py
Log Message:
Backport of 1.8 and 1.9:
Added some support for unicode arguments.
Index: _Resmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/_Resmodule.c,v
retrieving revision 1.7
retrieving revision 1.7.4.1
diff -C2 -d -r1.7 -r1.7.4.1
*** _Resmodule.c 18 Dec 2001 15:35:48 -0000 1.7
--- _Resmodule.c 27 Feb 2002 23:16:52 -0000 1.7.4.1
***************
*** 1383,1386 ****
--- 1383,1416 ----
}
+ static PyObject *Res_FSCreateResFile(PyObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+ FSRef parentRef;
+ UniChar *nameLength__in__;
+ UniCharCount nameLength__len__;
+ int nameLength__in_len__;
+ FSRef newRef;
+ FSSpec newSpec;
+ if (!PyArg_ParseTuple(_args, "O&u#",
+ PyMac_GetFSRef, &parentRef,
+ &nameLength__in__, &nameLength__in_len__))
+ return NULL;
+ nameLength__len__ = nameLength__in_len__;
+ FSCreateResFile(&parentRef,
+ nameLength__len__, nameLength__in__,
+ 0,
+ (FSCatalogInfo *)0,
+ &newRef,
+ &newSpec);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("O&O&",
+ PyMac_BuildFSRef, newRef,
+ PyMac_BuildFSSpec, newSpec);
+ return _res;
+ }
+
static PyObject *Res_FSResourceFileAlreadyOpen(PyObject *_self, PyObject *_args)
{
***************
*** 1407,1410 ****
--- 1437,1514 ----
}
+ #if TARGET_API_MAC_CARBON
+
+ static PyObject *Res_FSCreateResourceFile(PyObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+ OSErr _rv;
+ FSRef parentRef;
+ UniChar *nameLength__in__;
+ UniCharCount nameLength__len__;
+ int nameLength__in_len__;
+ UniChar *forkNameLength__in__;
+ UniCharCount forkNameLength__len__;
+ int forkNameLength__in_len__;
+ FSRef newRef;
+ FSSpec newSpec;
+ if (!PyArg_ParseTuple(_args, "O&u#u#",
+ PyMac_GetFSRef, &parentRef,
+ &nameLength__in__, &nameLength__in_len__,
+ &forkNameLength__in__, &forkNameLength__in_len__))
+ return NULL;
+ nameLength__len__ = nameLength__in_len__;
+ forkNameLength__len__ = forkNameLength__in_len__;
+ _rv = FSCreateResourceFile(&parentRef,
+ nameLength__len__, nameLength__in__,
+ 0,
+ (FSCatalogInfo *)0,
+ forkNameLength__len__, forkNameLength__in__,
+ &newRef,
+ &newSpec);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("hO&O&",
+ _rv,
+ PyMac_BuildFSRef, newRef,
+ PyMac_BuildFSSpec, newSpec);
+ return _res;
+ }
+ #endif
+
+ #if TARGET_API_MAC_CARBON
+
+ static PyObject *Res_FSOpenResourceFile(PyObject *_self, PyObject *_args)
+ {
+ PyObject *_res = NULL;
+ OSErr _rv;
+ FSRef ref;
+ UniChar *forkNameLength__in__;
+ UniCharCount forkNameLength__len__;
+ int forkNameLength__in_len__;
+ SignedByte permissions;
+ SInt16 refNum;
+ if (!PyArg_ParseTuple(_args, "O&u#b",
+ PyMac_GetFSRef, &ref,
+ &forkNameLength__in__, &forkNameLength__in_len__,
+ &permissions))
+ return NULL;
+ forkNameLength__len__ = forkNameLength__in_len__;
+ _rv = FSOpenResourceFile(&ref,
+ forkNameLength__len__, forkNameLength__in__,
+ permissions,
+ &refNum);
+ {
+ OSErr _err = ResError();
+ if (_err != noErr) return PyMac_Error(_err);
+ }
+ _res = Py_BuildValue("hh",
+ _rv,
+ refNum);
+ return _res;
+ }
+ #endif
+
static PyObject *Res_Resource(PyObject *_self, PyObject *_args)
{
***************
*** 1570,1575 ****
--- 1674,1691 ----
{"FSOpenResFile", (PyCFunction)Res_FSOpenResFile, 1,
"(FSRef ref, SignedByte permission) -> (short _rv)"},
+ {"FSCreateResFile", (PyCFunction)Res_FSCreateResFile, 1,
+ "(FSRef parentRef, Buffer nameLength) -> (FSRef newRef, FSSpec newSpec)"},
{"FSResourceFileAlreadyOpen", (PyCFunction)Res_FSResourceFileAlreadyOpen, 1,
"(FSRef resourceFileRef) -> (Boolean _rv, Boolean inChain, SInt16 refNum)"},
+
+ #if TARGET_API_MAC_CARBON
+ {"FSCreateResourceFile", (PyCFunction)Res_FSCreateResourceFile, 1,
+ "(FSRef parentRef, Buffer nameLength, Buffer forkNameLength) -> (OSErr _rv, FSRef newRef, FSSpec newSpec)"},
+ #endif
+
+ #if TARGET_API_MAC_CARBON
+ {"FSOpenResourceFile", (PyCFunction)Res_FSOpenResourceFile, 1,
+ "(FSRef ref, Buffer forkNameLength, SignedByte permissions) -> (OSErr _rv, SInt16 refNum)"},
+ #endif
{"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"},
Index: resscan.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/resscan.py,v
retrieving revision 1.14
retrieving revision 1.14.4.1
diff -C2 -d -r1.14 -r1.14.4.1
*** resscan.py 18 Dec 2001 15:35:52 -0000 1.14
--- resscan.py 27 Feb 2002 23:16:52 -0000 1.14.4.1
***************
*** 49,53 ****
def makeblacklisttypes(self):
return [
- "UniCharCount", #TBD
]
--- 49,52 ----
***************
*** 69,72 ****
--- 68,73 ----
'InsertResourceFile',
'FSpResourceFileAlreadyOpen',
+ 'FSOpenResourceFile',
+ 'FSCreateResourceFile',
])]
***************
*** 87,91 ****
([("SInt8", "*", "*")],
! [("SignedByte", "*", "*")])
]
--- 88,96 ----
([("SInt8", "*", "*")],
! [("SignedByte", "*", "*")]),
!
!
! ([("UniCharCount", "*", "InMode"), ("UniChar_ptr", "*", "InMode")],
! [("UnicodeReverseInBuffer", "*", "*")]),
]
Index: ressupport.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Mac/Modules/res/ressupport.py,v
retrieving revision 1.18
retrieving revision 1.18.4.1
diff -C2 -d -r1.18 -r1.18.4.1
*** ressupport.py 18 Dec 2001 15:35:57 -0000 1.18
--- ressupport.py 27 Feb 2002 23:16:52 -0000 1.18.4.1
***************
*** 6,11 ****
from macsupport import *
- FSRef_ptr = OpaqueType("FSRef", "PyMac_BuildFSRef", "PyMac_GetFSRef")
-
class ResMixIn:
--- 6,9 ----
***************
*** 21,24 ****
--- 19,24 ----
RsrcChainLocation = Type("RsrcChainLocation", "h")
+ FSCatalogInfoBitmap = FakeType("0") # Type("FSCatalogInfoBitmap", "l")
+ FSCatalogInfo_ptr = FakeType("(FSCatalogInfo *)0")
# includestuff etc. are imported from macsupport
- Previous message: [Python-checkins] CVS: python/dist/src/Mac/Modules/mlte _Mltemodule.c,1.8,1.8.4.1 mltescan.py,1.6,1.6.4.1 mltesupport.py,1.7,1.7.4.1
- Next message: [Python-checkins] CVS: python/dist/src/Mac/Modules/scrap _Scrapmodule.c,1.1,1.1.14.1 scrapscan.py,1.4,1.4.20.1 scrapsupport.py,1.4,1.4.14.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]