Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
24835927
Commit
24835927
authored
Jan 01, 2002
by
Jack Jansen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some support for unicode arguments.
parent
6d173f64
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
215 additions
and
12 deletions
+215
-12
Mac/Modules/cf/_CFmodule.c
Mac/Modules/cf/_CFmodule.c
+69
-0
Mac/Modules/cf/cfscan.py
Mac/Modules/cf/cfscan.py
+6
-3
Mac/Modules/cf/cfsupport.py
Mac/Modules/cf/cfsupport.py
+0
-2
Mac/Modules/mlte/_Mltemodule.c
Mac/Modules/mlte/_Mltemodule.c
+27
-0
Mac/Modules/mlte/mltescan.py
Mac/Modules/mlte/mltescan.py
+0
-3
Mac/Modules/mlte/mltesupport.py
Mac/Modules/mlte/mltesupport.py
+2
-0
Mac/Modules/res/_Resmodule.c
Mac/Modules/res/_Resmodule.c
+104
-0
Mac/Modules/res/resscan.py
Mac/Modules/res/resscan.py
+5
-2
Mac/Modules/res/ressupport.py
Mac/Modules/res/ressupport.py
+2
-2
No files found.
Mac/Modules/cf/_CFmodule.c
View file @
24835927
...
...
@@ -2046,6 +2046,26 @@ static PyObject *CFMutableStringRefObj_CFStringAppend(CFMutableStringRefObject *
return
_res
;
}
static
PyObject
*
CFMutableStringRefObj_CFStringAppendCharacters
(
CFMutableStringRefObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
UniChar
*
chars__in__
;
UniCharCount
chars__len__
;
int
chars__in_len__
;
#ifndef CFStringAppendCharacters
PyMac_PRECHECK
(
CFStringAppendCharacters
);
#endif
if
(
!
PyArg_ParseTuple
(
_args
,
"u#"
,
&
chars__in__
,
&
chars__in_len__
))
return
NULL
;
chars__len__
=
chars__in_len__
;
CFStringAppendCharacters
(
_self
->
ob_itself
,
chars__in__
,
chars__len__
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
CFMutableStringRefObj_CFStringAppendPascalString
(
CFMutableStringRefObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
...
...
@@ -2217,6 +2237,8 @@ static PyObject *CFMutableStringRefObj_CFStringTrimWhitespace(CFMutableStringRef
static
PyMethodDef
CFMutableStringRefObj_methods
[]
=
{
{
"CFStringAppend"
,
(
PyCFunction
)
CFMutableStringRefObj_CFStringAppend
,
1
,
"(CFStringRef appendedString) -> None"
},
{
"CFStringAppendCharacters"
,
(
PyCFunction
)
CFMutableStringRefObj_CFStringAppendCharacters
,
1
,
"(Buffer chars) -> None"
},
{
"CFStringAppendPascalString"
,
(
PyCFunction
)
CFMutableStringRefObj_CFStringAppendPascalString
,
1
,
"(Str255 pStr, CFStringEncoding encoding) -> None"
},
{
"CFStringAppendCString"
,
(
PyCFunction
)
CFMutableStringRefObj_CFStringAppendCString
,
1
,
...
...
@@ -3221,6 +3243,27 @@ static PyObject *CF_CFStringCreateWithCString(PyObject *_self, PyObject *_args)
return
_res
;
}
static
PyObject
*
CF_CFStringCreateWithCharacters
(
PyObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
CFStringRef
_rv
;
UniChar
*
chars__in__
;
UniCharCount
chars__len__
;
int
chars__in_len__
;
#ifndef CFStringCreateWithCharacters
PyMac_PRECHECK
(
CFStringCreateWithCharacters
);
#endif
if
(
!
PyArg_ParseTuple
(
_args
,
"u#"
,
&
chars__in__
,
&
chars__in_len__
))
return
NULL
;
chars__len__
=
chars__in_len__
;
_rv
=
CFStringCreateWithCharacters
((
CFAllocatorRef
)
NULL
,
chars__in__
,
chars__len__
);
_res
=
Py_BuildValue
(
"O&"
,
CFStringRefObj_New
,
_rv
);
return
_res
;
}
static
PyObject
*
CF_CFStringCreateWithPascalStringNoCopy
(
PyObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
...
...
@@ -3265,6 +3308,28 @@ static PyObject *CF_CFStringCreateWithCStringNoCopy(PyObject *_self, PyObject *_
return
_res
;
}
static
PyObject
*
CF_CFStringCreateWithCharactersNoCopy
(
PyObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
CFStringRef
_rv
;
UniChar
*
chars__in__
;
UniCharCount
chars__len__
;
int
chars__in_len__
;
#ifndef CFStringCreateWithCharactersNoCopy
PyMac_PRECHECK
(
CFStringCreateWithCharactersNoCopy
);
#endif
if
(
!
PyArg_ParseTuple
(
_args
,
"u#"
,
&
chars__in__
,
&
chars__in_len__
))
return
NULL
;
chars__len__
=
chars__in_len__
;
_rv
=
CFStringCreateWithCharactersNoCopy
((
CFAllocatorRef
)
NULL
,
chars__in__
,
chars__len__
,
(
CFAllocatorRef
)
NULL
);
_res
=
Py_BuildValue
(
"O&"
,
CFStringRefObj_New
,
_rv
);
return
_res
;
}
static
PyObject
*
CF_CFStringCreateMutable
(
PyObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
...
...
@@ -3667,10 +3732,14 @@ static PyMethodDef CF_methods[] = {
"(Str255 pStr, CFStringEncoding encoding) -> (CFStringRef _rv)"
},
{
"CFStringCreateWithCString"
,
(
PyCFunction
)
CF_CFStringCreateWithCString
,
1
,
"(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)"
},
{
"CFStringCreateWithCharacters"
,
(
PyCFunction
)
CF_CFStringCreateWithCharacters
,
1
,
"(Buffer chars) -> (CFStringRef _rv)"
},
{
"CFStringCreateWithPascalStringNoCopy"
,
(
PyCFunction
)
CF_CFStringCreateWithPascalStringNoCopy
,
1
,
"(Str255 pStr, CFStringEncoding encoding) -> (CFStringRef _rv)"
},
{
"CFStringCreateWithCStringNoCopy"
,
(
PyCFunction
)
CF_CFStringCreateWithCStringNoCopy
,
1
,
"(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)"
},
{
"CFStringCreateWithCharactersNoCopy"
,
(
PyCFunction
)
CF_CFStringCreateWithCharactersNoCopy
,
1
,
"(Buffer chars) -> (CFStringRef _rv)"
},
{
"CFStringCreateMutable"
,
(
PyCFunction
)
CF_CFStringCreateMutable
,
1
,
"(CFIndex maxLength) -> (CFMutableStringRef _rv)"
},
{
"CFStringCreateMutableCopy"
,
(
PyCFunction
)
CF_CFStringCreateMutableCopy
,
1
,
...
...
Mac/Modules/cf/cfscan.py
View file @
24835927
...
...
@@ -92,6 +92,9 @@ class MyScanner(Scanner_OSX):
"CFStringGetCString"
,
"CFStringGetCharacters"
,
"CFURLCreateStringWithFileSystemPath"
,
# Gone in later releases
"CFStringCreateMutableWithExternalCharactersNoCopy"
,
# Not a clue...
"CFStringSetExternalCharactersNoCopy"
,
"CFStringGetCharacterAtIndex"
,
# No format for single unichars yet.
]
def
makegreylist
(
self
):
...
...
@@ -105,9 +108,6 @@ class MyScanner(Scanner_OSX):
"void_ptr"
,
# Ditto for various array lookup methods
"CFArrayApplierFunction"
,
# Callback function pointer
"CFDictionaryApplierFunction"
,
# Callback function pointer
"UniChar_ptr"
,
# XXXX To be done
"const_UniChar_ptr"
,
# XXXX To be done
"UniChar"
,
# XXXX To be done
"va_list"
,
# For printf-to-a-cfstring. Use Python.
"const_CFStringEncoding_ptr"
,
# To be done, I guess
]
...
...
@@ -118,6 +118,9 @@ class MyScanner(Scanner_OSX):
([(
"UInt8_ptr"
,
"*"
,
"InMode"
),
(
"CFIndex"
,
"*"
,
"InMode"
)],
[(
"UcharInBuffer"
,
"*"
,
"*"
)]),
([(
"UniChar_ptr"
,
"*"
,
"InMode"
),
(
"CFIndex"
,
"*"
,
"InMode"
)],
[(
"UnicodeInBuffer"
,
"*"
,
"*"
)]),
# Some functions return a const char *. Don't worry, we won't modify it.
([(
"const_char_ptr"
,
"*"
,
"ReturnMode"
)],
[(
"return_stringptr"
,
"*"
,
"*"
)]),
...
...
Mac/Modules/cf/cfsupport.py
View file @
24835927
...
...
@@ -171,8 +171,6 @@ CFOptionFlags = Type("CFOptionFlags", "l")
CFStringEncoding
=
Type
(
"CFStringEncoding"
,
"l"
)
CFComparisonResult
=
Type
(
"CFComparisonResult"
,
"l"
)
# a bit dangerous, it's an enum
CFURLPathStyle
=
Type
(
"CFURLPathStyle"
,
"l"
)
# a bit dangerous, it's an enum
FSRef_ptr
=
OpaqueType
(
"FSRef"
,
"PyMac_BuildFSRef"
,
"PyMac_GetFSRef"
)
FSRef
=
OpaqueByValueType
(
"FSRef"
,
"PyMac_BuildFSRef"
,
"PyMac_GetFSRef"
)
char_ptr
=
stringptr
return_stringptr
=
Type
(
"char *"
,
"s"
)
# ONLY FOR RETURN VALUES!!
...
...
Mac/Modules/mlte/_Mltemodule.c
View file @
24835927
...
...
@@ -1006,6 +1006,31 @@ static PyObject *TXNObj_TXNActivate(TXNObjectObject *_self, PyObject *_args)
return
_res
;
}
static
PyObject
*
TXNObj_TXNEchoMode
(
TXNObjectObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
OSStatus
_err
;
UniChar
iEchoCharacter
;
TextEncoding
iEncoding
;
Boolean
iOn
;
#ifndef TXNEchoMode
PyMac_PRECHECK
(
TXNEchoMode
);
#endif
if
(
!
PyArg_ParseTuple
(
_args
,
"hlb"
,
&
iEchoCharacter
,
&
iEncoding
,
&
iOn
))
return
NULL
;
_err
=
TXNEchoMode
(
_self
->
ob_itself
,
iEchoCharacter
,
iEncoding
,
iOn
);
if
(
_err
!=
noErr
)
return
PyMac_Error
(
_err
);
Py_INCREF
(
Py_None
);
_res
=
Py_None
;
return
_res
;
}
static
PyObject
*
TXNObj_TXNDoFontMenuSelection
(
TXNObjectObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
...
...
@@ -1251,6 +1276,8 @@ static PyMethodDef TXNObj_methods[] = {
"(TXNFrameID iTXNFrameID, WindowPtr iWindow, DragReference iDragReference, Boolean iDifferentObjectSameWindow) -> None"
},
{
"TXNActivate"
,
(
PyCFunction
)
TXNObj_TXNActivate
,
1
,
"(TXNFrameID iTXNFrameID, TXNScrollBarState iActiveState) -> None"
},
{
"TXNEchoMode"
,
(
PyCFunction
)
TXNObj_TXNEchoMode
,
1
,
"(UniChar iEchoCharacter, TextEncoding iEncoding, Boolean iOn) -> None"
},
{
"TXNDoFontMenuSelection"
,
(
PyCFunction
)
TXNObj_TXNDoFontMenuSelection
,
1
,
"(TXNFontMenuObject iTXNFontMenuObject, SInt16 iMenuID, SInt16 iMenuItem) -> None"
},
{
"TXNPrepareFontMenu"
,
(
PyCFunction
)
TXNObj_TXNPrepareFontMenu
,
1
,
...
...
Mac/Modules/mlte/mltescan.py
View file @
24835927
...
...
@@ -93,9 +93,6 @@ MovieFileType = FOUR_CHAR_CODE('moov')
"TXNTypeAttributes"
,
#TBD
"TXNMatchTextRecord"
,
#TBD
"TXNBackground"
,
#TBD
"UniChar"
,
#TBD
"UniCharCount"
,
#TBD
"UniChar_ptr"
,
#TBD
"TXNFindUPP"
,
"ATSUStyle"
,
#TBD
"TXNActionKeyMapperProcPtr"
,
...
...
Mac/Modules/mlte/mltesupport.py
View file @
24835927
...
...
@@ -129,6 +129,8 @@ CFStringRef = OpaqueByValueType("CFStringRef", "CFStringRefObj")
OptFSSpecPtr
=
OpaqueByValueType
(
"FSSpec *"
,
"OptFSSpecPtr"
)
OptRectPtr
=
OpaqueByValueType
(
"Rect *"
,
"OptRectPtr"
)
UniChar
=
Type
(
"UniChar"
,
"h"
)
# XXXX For now...
# ADD object type here
execfile
(
"mltetypetest.py"
)
...
...
Mac/Modules/res/_Resmodule.c
View file @
24835927
...
...
@@ -1382,6 +1382,36 @@ static PyObject *Res_FSOpenResFile(PyObject *_self, PyObject *_args)
return
_res
;
}
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
)
{
PyObject
*
_res
=
NULL
;
...
...
@@ -1406,6 +1436,74 @@ static PyObject *Res_FSResourceFileAlreadyOpen(PyObject *_self, PyObject *_args)
return
_res
;
}
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
;
}
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
;
}
static
PyObject
*
Res_Resource
(
PyObject
*
_self
,
PyObject
*
_args
)
{
PyObject
*
_res
=
NULL
;
...
...
@@ -1569,8 +1667,14 @@ static PyMethodDef Res_methods[] = {
#endif
{
"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)"
},
{
"FSCreateResourceFile"
,
(
PyCFunction
)
Res_FSCreateResourceFile
,
1
,
"(FSRef parentRef, Buffer nameLength, Buffer forkNameLength) -> (OSErr _rv, FSRef newRef, FSSpec newSpec)"
},
{
"FSOpenResourceFile"
,
(
PyCFunction
)
Res_FSOpenResourceFile
,
1
,
"(FSRef ref, Buffer forkNameLength, SignedByte permissions) -> (OSErr _rv, SInt16 refNum)"
},
{
"Resource"
,
(
PyCFunction
)
Res_Resource
,
1
,
"Convert a string to a resource object.
\n\n
The created resource object is actually just a handle,
\n
apply AddResource() to write it to a resource file.
\n
See also the Handle() docstring.
\n
"
},
{
"Handle"
,
(
PyCFunction
)
Res_Handle
,
1
,
...
...
Mac/Modules/res/resscan.py
View file @
24835927
...
...
@@ -48,7 +48,6 @@ class ResourcesScanner(Scanner):
def
makeblacklisttypes
(
self
):
return
[
"UniCharCount"
,
#TBD
]
def
makegreylist
(
self
):
...
...
@@ -86,7 +85,11 @@ class ResourcesScanner(Scanner):
[(
"OutBuffer"
,
"*"
,
"InOutMode"
)]),
([(
"SInt8"
,
"*"
,
"*"
)],
[(
"SignedByte"
,
"*"
,
"*"
)])
[(
"SignedByte"
,
"*"
,
"*"
)]),
([(
"UniCharCount"
,
"*"
,
"InMode"
),
(
"UniChar_ptr"
,
"*"
,
"InMode"
)],
[(
"UnicodeReverseInBuffer"
,
"*"
,
"*"
)]),
]
if
__name__
==
"__main__"
:
...
...
Mac/Modules/res/ressupport.py
View file @
24835927
...
...
@@ -5,8 +5,6 @@
from
macsupport
import
*
FSRef_ptr
=
OpaqueType
(
"FSRef"
,
"PyMac_BuildFSRef"
,
"PyMac_GetFSRef"
)
class
ResMixIn
:
def
checkit
(
self
):
...
...
@@ -20,6 +18,8 @@ class ResFunction(ResMixIn, FunctionGenerator): pass
class
ResMethod
(
ResMixIn
,
MethodGenerator
):
pass
RsrcChainLocation
=
Type
(
"RsrcChainLocation"
,
"h"
)
FSCatalogInfoBitmap
=
FakeType
(
"0"
)
# Type("FSCatalogInfoBitmap", "l")
FSCatalogInfo_ptr
=
FakeType
(
"(FSCatalogInfo *)0"
)
# includestuff etc. are imported from macsupport
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment