Adapted for Universal Headers 3.4

This commit is contained in:
Jack Jansen 2001-12-16 20:18:40 +00:00
parent b519638d1e
commit 2168e9d602
19 changed files with 1779 additions and 379 deletions

View File

@ -552,105 +552,6 @@ static PyObject *AEDesc_AEGetDescDataSize(AEDescObject *_self, PyObject *_args)
}
#endif
static PyObject *AEDesc_AESend(AEDescObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
OSErr _err;
AppleEvent reply;
AESendMode sendMode;
AESendPriority sendPriority;
long timeOutInTicks;
if (!PyArg_ParseTuple(_args, "lhl",
&sendMode,
&sendPriority,
&timeOutInTicks))
return NULL;
_err = AESend(&_self->ob_itself,
&reply,
sendMode,
sendPriority,
timeOutInTicks,
upp_AEIdleProc,
(AEFilterUPP)0);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
AEDesc_New, &reply);
return _res;
}
static PyObject *AEDesc_AEResetTimer(AEDescObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
OSErr _err;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_err = AEResetTimer(&_self->ob_itself);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *AEDesc_AESuspendTheCurrentEvent(AEDescObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
OSErr _err;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_err = AESuspendTheCurrentEvent(&_self->ob_itself);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *AEDesc_AEResumeTheCurrentEvent(AEDescObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
OSErr _err;
AppleEvent reply;
AEEventHandlerUPP dispatcher__proc__ = upp_GenericEventHandler;
PyObject *dispatcher;
if (!PyArg_ParseTuple(_args, "O&O",
AEDesc_Convert, &reply,
&dispatcher))
return NULL;
_err = AEResumeTheCurrentEvent(&_self->ob_itself,
&reply,
dispatcher__proc__, (long)dispatcher);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
Py_INCREF(dispatcher); /* XXX leak, but needed */
return _res;
}
static PyObject *AEDesc_AEGetTheCurrentEvent(AEDescObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
OSErr _err;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_err = AEGetTheCurrentEvent(&_self->ob_itself);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *AEDesc_AESetTheCurrentEvent(AEDescObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
OSErr _err;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_err = AESetTheCurrentEvent(&_self->ob_itself);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *AEDesc_AEResolve(AEDescObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -715,18 +616,6 @@ static PyMethodDef AEDesc_methods[] = {
{"AEGetDescDataSize", (PyCFunction)AEDesc_AEGetDescDataSize, 1,
"() -> (Size _rv)"},
#endif
{"AESend", (PyCFunction)AEDesc_AESend, 1,
"(AESendMode sendMode, AESendPriority sendPriority, long timeOutInTicks) -> (AppleEvent reply)"},
{"AEResetTimer", (PyCFunction)AEDesc_AEResetTimer, 1,
"() -> None"},
{"AESuspendTheCurrentEvent", (PyCFunction)AEDesc_AESuspendTheCurrentEvent, 1,
"() -> None"},
{"AEResumeTheCurrentEvent", (PyCFunction)AEDesc_AEResumeTheCurrentEvent, 1,
"(AppleEvent reply, EventHandler dispatcher) -> None"},
{"AEGetTheCurrentEvent", (PyCFunction)AEDesc_AEGetTheCurrentEvent, 1,
"() -> None"},
{"AESetTheCurrentEvent", (PyCFunction)AEDesc_AESetTheCurrentEvent, 1,
"() -> None"},
{"AEResolve", (PyCFunction)AEDesc_AEResolve, 1,
"(short callbackFlags) -> (AEDesc theToken)"},
{NULL, NULL, 0}
@ -928,67 +817,6 @@ static PyObject *AE_AEReplaceDescData(PyObject *_self, PyObject *_args)
}
#endif
static PyObject *AE_AEProcessAppleEvent(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
OSErr _err;
EventRecord theEventRecord;
if (!PyArg_ParseTuple(_args, "O&",
PyMac_GetEventRecord, &theEventRecord))
return NULL;
_err = AEProcessAppleEvent(&theEventRecord);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *AE_AEGetInteractionAllowed(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
OSErr _err;
AEInteractAllowed level;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_err = AEGetInteractionAllowed(&level);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("b",
level);
return _res;
}
static PyObject *AE_AESetInteractionAllowed(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
OSErr _err;
AEInteractAllowed level;
if (!PyArg_ParseTuple(_args, "b",
&level))
return NULL;
_err = AESetInteractionAllowed(level);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *AE_AEInteractWithUser(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
OSErr _err;
long timeOutInTicks;
if (!PyArg_ParseTuple(_args, "l",
&timeOutInTicks))
return NULL;
_err = AEInteractWithUser(timeOutInTicks,
(NMRecPtr)0,
upp_AEIdleProc);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *AE_AEInstallEventHandler(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -1177,14 +1005,6 @@ static PyMethodDef AE_methods[] = {
{"AEReplaceDescData", (PyCFunction)AE_AEReplaceDescData, 1,
"(DescType typeCode, Buffer dataPtr) -> (AEDesc theAEDesc)"},
#endif
{"AEProcessAppleEvent", (PyCFunction)AE_AEProcessAppleEvent, 1,
"(EventRecord theEventRecord) -> None"},
{"AEGetInteractionAllowed", (PyCFunction)AE_AEGetInteractionAllowed, 1,
"() -> (AEInteractAllowed level)"},
{"AESetInteractionAllowed", (PyCFunction)AE_AESetInteractionAllowed, 1,
"(AEInteractAllowed level) -> None"},
{"AEInteractWithUser", (PyCFunction)AE_AEInteractWithUser, 1,
"(long timeOutInTicks) -> None"},
{"AEInstallEventHandler", (PyCFunction)AE_AEInstallEventHandler, 1,
"(AEEventClass theAEEventClass, AEEventID theAEEventID, EventHandler handler) -> None"},
{"AERemoveEventHandler", (PyCFunction)AE_AERemoveEventHandler, 1,

View File

@ -654,6 +654,93 @@ static PyObject *App_UseThemeFont(PyObject *_self, PyObject *_args)
return _res;
}
#if TARGET_API_MAC_CARBON
static PyObject *App_TruncateThemeText(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
OSStatus _err;
CFMutableStringRef inString;
ThemeFontID inFontID;
ThemeDrawState inState;
SInt16 inPixelWidthLimit;
TruncCode inTruncWhere;
Boolean outTruncated;
if (!PyArg_ParseTuple(_args, "O&Hlhh",
CFMutableStringRefObj_Convert, &inString,
&inFontID,
&inState,
&inPixelWidthLimit,
&inTruncWhere))
return NULL;
_err = TruncateThemeText(inString,
inFontID,
inState,
inPixelWidthLimit,
inTruncWhere,
&outTruncated);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("b",
outTruncated);
return _res;
}
#endif
#if TARGET_API_MAC_CARBON
static PyObject *App_GetThemeTextDimensions(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
OSStatus _err;
CFStringRef inString;
ThemeFontID inFontID;
ThemeDrawState inState;
Boolean inWrapToWidth;
Point ioBounds;
SInt16 outBaseline;
if (!PyArg_ParseTuple(_args, "O&Hlb",
CFStringRefObj_Convert, &inString,
&inFontID,
&inState,
&inWrapToWidth))
return NULL;
_err = GetThemeTextDimensions(inString,
inFontID,
inState,
inWrapToWidth,
&ioBounds,
&outBaseline);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&h",
PyMac_BuildPoint, ioBounds,
outBaseline);
return _res;
}
#endif
#if TARGET_API_MAC_CARBON
static PyObject *App_GetThemeTextShadowOutset(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
OSStatus _err;
ThemeFontID inFontID;
ThemeDrawState inState;
Rect outOutset;
if (!PyArg_ParseTuple(_args, "Hl",
&inFontID,
&inState))
return NULL;
_err = GetThemeTextShadowOutset(inFontID,
inState,
&outOutset);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
PyMac_BuildRect, &outOutset);
return _res;
}
#endif
static PyObject *App_DrawThemeScrollBarArrows(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -1111,6 +1198,21 @@ static PyMethodDef App_methods[] = {
"() -> (ThemeCheckBoxStyle outStyle)"},
{"UseThemeFont", (PyCFunction)App_UseThemeFont, 1,
"(ThemeFontID inFontID, ScriptCode inScript) -> None"},
#if TARGET_API_MAC_CARBON
{"TruncateThemeText", (PyCFunction)App_TruncateThemeText, 1,
"(CFMutableStringRef inString, ThemeFontID inFontID, ThemeDrawState inState, SInt16 inPixelWidthLimit, TruncCode inTruncWhere) -> (Boolean outTruncated)"},
#endif
#if TARGET_API_MAC_CARBON
{"GetThemeTextDimensions", (PyCFunction)App_GetThemeTextDimensions, 1,
"(CFStringRef inString, ThemeFontID inFontID, ThemeDrawState inState, Boolean inWrapToWidth) -> (Point ioBounds, SInt16 outBaseline)"},
#endif
#if TARGET_API_MAC_CARBON
{"GetThemeTextShadowOutset", (PyCFunction)App_GetThemeTextShadowOutset, 1,
"(ThemeFontID inFontID, ThemeDrawState inState) -> (Rect outOutset)"},
#endif
{"DrawThemeScrollBarArrows", (PyCFunction)App_DrawThemeScrollBarArrows, 1,
"(Rect bounds, ThemeTrackEnableState enableState, ThemeTrackPressState pressState, Boolean isHoriz) -> (Rect trackBounds)"},
{"GetThemeScrollBarTrackRect", (PyCFunction)App_GetThemeScrollBarTrackRect, 1,

View File

@ -48,12 +48,16 @@ class MyScanner(Scanner):
"appearanceBadTextColorIndexErr",
"appearanceThemeHasNoAccents",
"appearanceBadCursorIndexErr",
"DrawThemeTextBox", # Funny void* out param
]
def makegreylist(self):
return [
('#if TARGET_API_MAC_CARBON', [
'GetThemeMetric',
'GetThemeTextShadowOutset',
'GetThemeTextDimensions',
'TruncateThemeText',
])]
def makeblacklisttypes(self):
@ -71,6 +75,7 @@ class MyScanner(Scanner):
"ThemeWindowMetrics_ptr", # ditto
"ThemeDrawingState", # This is an opaque pointer, so it should be simple. Later.
"Collection", # No interface to collection mgr yet.
"BytePtr", # Not yet.
]
def makerepairinstructions(self):

View File

@ -67,6 +67,9 @@ ThemeDragSoundKind = OSTypeType("ThemeDragSoundKind")
ThemeBackgroundKind = Type("ThemeBackgroundKind", "l")
ThemeMetric = Type("ThemeMetric", "l")
RGBColor = OpaqueType("RGBColor", "QdRGB")
CFStringRef = OpaqueByValueType("CFStringRef", "CFStringRefObj")
CFMutableStringRef = OpaqueByValueType("CFMutableStringRef", "CFMutableStringRefObj")
TruncCode = Type("TruncCode", "h")
includestuff = includestuff + """
#ifdef WITHOUT_FRAMEWORKS

View File

@ -604,6 +604,26 @@ static PyObject *CFMutableArrayRefObj_CFArrayExchangeValuesAtIndices(CFMutableAr
return _res;
}
static PyObject *CFMutableArrayRefObj_CFArrayAppendArray(CFMutableArrayRefObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
CFArrayRef otherArray;
CFRange otherRange;
#ifndef CFArrayAppendArray
PyMac_PRECHECK(CFArrayAppendArray);
#endif
if (!PyArg_ParseTuple(_args, "O&O&",
CFArrayRefObj_Convert, &otherArray,
CFRange_Convert, &otherRange))
return NULL;
CFArrayAppendArray(_self->ob_itself,
otherArray,
otherRange);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyMethodDef CFMutableArrayRefObj_methods[] = {
{"CFArrayRemoveValueAtIndex", (PyCFunction)CFMutableArrayRefObj_CFArrayRemoveValueAtIndex, 1,
"(CFIndex idx) -> None"},
@ -611,6 +631,8 @@ static PyMethodDef CFMutableArrayRefObj_methods[] = {
"() -> None"},
{"CFArrayExchangeValuesAtIndices", (PyCFunction)CFMutableArrayRefObj_CFArrayExchangeValuesAtIndices, 1,
"(CFIndex idx1, CFIndex idx2) -> None"},
{"CFArrayAppendArray", (PyCFunction)CFMutableArrayRefObj_CFArrayAppendArray, 1,
"(CFArrayRef otherArray, CFRange otherRange) -> None"},
{NULL, NULL, 0}
};
@ -1468,19 +1490,19 @@ static PyObject *CFStringRefObj_CFStringCompareWithOptions(CFStringRefObject *_s
{
PyObject *_res = NULL;
CFComparisonResult _rv;
CFStringRef string2;
CFStringRef theString2;
CFRange rangeToCompare;
CFOptionFlags compareOptions;
#ifndef CFStringCompareWithOptions
PyMac_PRECHECK(CFStringCompareWithOptions);
#endif
if (!PyArg_ParseTuple(_args, "O&O&l",
CFStringRefObj_Convert, &string2,
CFStringRefObj_Convert, &theString2,
CFRange_Convert, &rangeToCompare,
&compareOptions))
return NULL;
_rv = CFStringCompareWithOptions(_self->ob_itself,
string2,
theString2,
rangeToCompare,
compareOptions);
_res = Py_BuildValue("l",
@ -1492,17 +1514,17 @@ static PyObject *CFStringRefObj_CFStringCompare(CFStringRefObject *_self, PyObje
{
PyObject *_res = NULL;
CFComparisonResult _rv;
CFStringRef string2;
CFStringRef theString2;
CFOptionFlags compareOptions;
#ifndef CFStringCompare
PyMac_PRECHECK(CFStringCompare);
#endif
if (!PyArg_ParseTuple(_args, "O&l",
CFStringRefObj_Convert, &string2,
CFStringRefObj_Convert, &theString2,
&compareOptions))
return NULL;
_rv = CFStringCompare(_self->ob_itself,
string2,
theString2,
compareOptions);
_res = Py_BuildValue("l",
_rv);
@ -1750,6 +1772,28 @@ static PyObject *CFStringRefObj_CFURLCreateWithFileSystemPath(CFStringRefObject
return _res;
}
static PyObject *CFStringRefObj_CFURLCreateWithFileSystemPathRelativeToBase(CFStringRefObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
CFURLRef _rv;
CFURLPathStyle pathStyle;
Boolean isDirectory;
CFURLRef baseURL;
if (!PyArg_ParseTuple(_args, "llO&",
&pathStyle,
&isDirectory,
OptionalCFURLRefObj_Convert, &baseURL))
return NULL;
_rv = CFURLCreateWithFileSystemPathRelativeToBase((CFAllocatorRef)NULL,
_self->ob_itself,
pathStyle,
isDirectory,
baseURL);
_res = Py_BuildValue("O&",
CFURLRefObj_New, _rv);
return _res;
}
static PyObject *CFStringRefObj_CFURLCreateStringByReplacingPercentEscapes(CFStringRefObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -1766,6 +1810,28 @@ static PyObject *CFStringRefObj_CFURLCreateStringByReplacingPercentEscapes(CFStr
return _res;
}
static PyObject *CFStringRefObj_CFURLCreateStringByAddingPercentEscapes(CFStringRefObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
CFStringRef _rv;
CFStringRef charactersToLeaveUnescaped;
CFStringRef legalURLCharactersToBeEscaped;
CFStringEncoding encoding;
if (!PyArg_ParseTuple(_args, "O&O&l",
CFStringRefObj_Convert, &charactersToLeaveUnescaped,
CFStringRefObj_Convert, &legalURLCharactersToBeEscaped,
&encoding))
return NULL;
_rv = CFURLCreateStringByAddingPercentEscapes((CFAllocatorRef)NULL,
_self->ob_itself,
charactersToLeaveUnescaped,
legalURLCharactersToBeEscaped,
encoding);
_res = Py_BuildValue("O&",
CFStringRefObj_New, _rv);
return _res;
}
static PyObject *CFStringRefObj_CFStringGetString(CFStringRefObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -1819,9 +1885,9 @@ static PyMethodDef CFStringRefObj_methods[] = {
{"CFStringGetFastestEncoding", (PyCFunction)CFStringRefObj_CFStringGetFastestEncoding, 1,
"() -> (CFStringEncoding _rv)"},
{"CFStringCompareWithOptions", (PyCFunction)CFStringRefObj_CFStringCompareWithOptions, 1,
"(CFStringRef string2, CFRange rangeToCompare, CFOptionFlags compareOptions) -> (CFComparisonResult _rv)"},
"(CFStringRef theString2, CFRange rangeToCompare, CFOptionFlags compareOptions) -> (CFComparisonResult _rv)"},
{"CFStringCompare", (PyCFunction)CFStringRefObj_CFStringCompare, 1,
"(CFStringRef string2, CFOptionFlags compareOptions) -> (CFComparisonResult _rv)"},
"(CFStringRef theString2, CFOptionFlags compareOptions) -> (CFComparisonResult _rv)"},
{"CFStringFindWithOptions", (PyCFunction)CFStringRefObj_CFStringFindWithOptions, 1,
"(CFStringRef stringToFind, CFRange rangeToSearch, CFOptionFlags searchOptions) -> (Boolean _rv, CFRange result)"},
{"CFStringCreateArrayWithFindResults", (PyCFunction)CFStringRefObj_CFStringCreateArrayWithFindResults, 1,
@ -1848,8 +1914,12 @@ static PyMethodDef CFStringRefObj_methods[] = {
"(CFURLRef baseURL) -> (CFURLRef _rv)"},
{"CFURLCreateWithFileSystemPath", (PyCFunction)CFStringRefObj_CFURLCreateWithFileSystemPath, 1,
"(CFURLPathStyle pathStyle, Boolean isDirectory) -> (CFURLRef _rv)"},
{"CFURLCreateWithFileSystemPathRelativeToBase", (PyCFunction)CFStringRefObj_CFURLCreateWithFileSystemPathRelativeToBase, 1,
"(CFURLPathStyle pathStyle, Boolean isDirectory, CFURLRef baseURL) -> (CFURLRef _rv)"},
{"CFURLCreateStringByReplacingPercentEscapes", (PyCFunction)CFStringRefObj_CFURLCreateStringByReplacingPercentEscapes, 1,
"(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)"},
{"CFURLCreateStringByAddingPercentEscapes", (PyCFunction)CFStringRefObj_CFURLCreateStringByAddingPercentEscapes, 1,
"(CFStringRef charactersToLeaveUnescaped, CFStringRef legalURLCharactersToBeEscaped, CFStringEncoding encoding) -> (CFStringRef _rv)"},
{"CFStringGetString", (PyCFunction)CFStringRefObj_CFStringGetString, 1,
"() -> (string _rv)"},
{"CFStringGetUnicode", (PyCFunction)CFStringRefObj_CFStringGetUnicode, 1,
@ -1975,13 +2045,13 @@ static PyObject *CFMutableStringRefObj_CFStringAppend(CFMutableStringRefObject *
static PyObject *CFMutableStringRefObj_CFStringAppendPascalString(CFMutableStringRefObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
StringPtr pStr;
Str255 pStr;
CFStringEncoding encoding;
#ifndef CFStringAppendPascalString
PyMac_PRECHECK(CFStringAppendPascalString);
#endif
if (!PyArg_ParseTuple(_args, "O&l",
PyMac_GetStr255, &pStr,
PyMac_GetStr255, pStr,
&encoding))
return NULL;
CFStringAppendPascalString(_self->ob_itself,
@ -2144,7 +2214,7 @@ static PyMethodDef CFMutableStringRefObj_methods[] = {
{"CFStringAppend", (PyCFunction)CFMutableStringRefObj_CFStringAppend, 1,
"(CFStringRef appendedString) -> None"},
{"CFStringAppendPascalString", (PyCFunction)CFMutableStringRefObj_CFStringAppendPascalString, 1,
"(StringPtr pStr, CFStringEncoding encoding) -> None"},
"(Str255 pStr, CFStringEncoding encoding) -> None"},
{"CFStringAppendCString", (PyCFunction)CFMutableStringRefObj_CFStringAppendCString, 1,
"(char* cStr, CFStringEncoding encoding) -> None"},
{"CFStringInsert", (PyCFunction)CFMutableStringRefObj_CFStringInsert, 1,
@ -2281,6 +2351,30 @@ static PyObject *CFURLRefObj_CFURLCreateData(CFURLRefObject *_self, PyObject *_a
return _res;
}
static PyObject *CFURLRefObj_CFURLGetFileSystemRepresentation(CFURLRefObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
Boolean _rv;
Boolean resolveAgainstBase;
UInt8 buffer;
CFIndex maxBufLen;
#ifndef CFURLGetFileSystemRepresentation
PyMac_PRECHECK(CFURLGetFileSystemRepresentation);
#endif
if (!PyArg_ParseTuple(_args, "ll",
&resolveAgainstBase,
&maxBufLen))
return NULL;
_rv = CFURLGetFileSystemRepresentation(_self->ob_itself,
resolveAgainstBase,
&buffer,
maxBufLen);
_res = Py_BuildValue("lb",
_rv,
buffer);
return _res;
}
static PyObject *CFURLRefObj_CFURLCopyAbsoluteURL(CFURLRefObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -2386,6 +2480,42 @@ static PyObject *CFURLRefObj_CFURLCopyPath(CFURLRefObject *_self, PyObject *_arg
return _res;
}
static PyObject *CFURLRefObj_CFURLCopyStrictPath(CFURLRefObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
CFStringRef _rv;
Boolean isAbsolute;
#ifndef CFURLCopyStrictPath
PyMac_PRECHECK(CFURLCopyStrictPath);
#endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = CFURLCopyStrictPath(_self->ob_itself,
&isAbsolute);
_res = Py_BuildValue("O&l",
CFStringRefObj_New, _rv,
isAbsolute);
return _res;
}
static PyObject *CFURLRefObj_CFURLCopyFileSystemPath(CFURLRefObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
CFStringRef _rv;
CFURLPathStyle pathStyle;
#ifndef CFURLCopyFileSystemPath
PyMac_PRECHECK(CFURLCopyFileSystemPath);
#endif
if (!PyArg_ParseTuple(_args, "l",
&pathStyle))
return NULL;
_rv = CFURLCopyFileSystemPath(_self->ob_itself,
pathStyle);
_res = Py_BuildValue("O&",
CFStringRefObj_New, _rv);
return _res;
}
static PyObject *CFURLRefObj_CFURLHasDirectoryPath(CFURLRefObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -2530,9 +2660,120 @@ static PyObject *CFURLRefObj_CFURLCopyFragment(CFURLRefObject *_self, PyObject *
return _res;
}
static PyObject *CFURLRefObj_CFURLCopyLastPathComponent(CFURLRefObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
CFStringRef _rv;
#ifndef CFURLCopyLastPathComponent
PyMac_PRECHECK(CFURLCopyLastPathComponent);
#endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = CFURLCopyLastPathComponent(_self->ob_itself);
_res = Py_BuildValue("O&",
CFStringRefObj_New, _rv);
return _res;
}
static PyObject *CFURLRefObj_CFURLCopyPathExtension(CFURLRefObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
CFStringRef _rv;
#ifndef CFURLCopyPathExtension
PyMac_PRECHECK(CFURLCopyPathExtension);
#endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = CFURLCopyPathExtension(_self->ob_itself);
_res = Py_BuildValue("O&",
CFStringRefObj_New, _rv);
return _res;
}
static PyObject *CFURLRefObj_CFURLCreateCopyAppendingPathComponent(CFURLRefObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
CFURLRef _rv;
CFStringRef pathComponent;
Boolean isDirectory;
if (!PyArg_ParseTuple(_args, "O&l",
CFStringRefObj_Convert, &pathComponent,
&isDirectory))
return NULL;
_rv = CFURLCreateCopyAppendingPathComponent((CFAllocatorRef)NULL,
_self->ob_itself,
pathComponent,
isDirectory);
_res = Py_BuildValue("O&",
CFURLRefObj_New, _rv);
return _res;
}
static PyObject *CFURLRefObj_CFURLCreateCopyDeletingLastPathComponent(CFURLRefObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
CFURLRef _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = CFURLCreateCopyDeletingLastPathComponent((CFAllocatorRef)NULL,
_self->ob_itself);
_res = Py_BuildValue("O&",
CFURLRefObj_New, _rv);
return _res;
}
static PyObject *CFURLRefObj_CFURLCreateCopyAppendingPathExtension(CFURLRefObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
CFURLRef _rv;
CFStringRef extension;
if (!PyArg_ParseTuple(_args, "O&",
CFStringRefObj_Convert, &extension))
return NULL;
_rv = CFURLCreateCopyAppendingPathExtension((CFAllocatorRef)NULL,
_self->ob_itself,
extension);
_res = Py_BuildValue("O&",
CFURLRefObj_New, _rv);
return _res;
}
static PyObject *CFURLRefObj_CFURLCreateCopyDeletingPathExtension(CFURLRefObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
CFURLRef _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = CFURLCreateCopyDeletingPathExtension((CFAllocatorRef)NULL,
_self->ob_itself);
_res = Py_BuildValue("O&",
CFURLRefObj_New, _rv);
return _res;
}
static PyObject *CFURLRefObj_CFURLGetFSRef(CFURLRefObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
Boolean _rv;
FSRef fsRef;
#ifndef CFURLGetFSRef
PyMac_PRECHECK(CFURLGetFSRef);
#endif
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = CFURLGetFSRef(_self->ob_itself,
&fsRef);
_res = Py_BuildValue("lO&",
_rv,
PyMac_BuildFSRef, fsRef);
return _res;
}
static PyMethodDef CFURLRefObj_methods[] = {
{"CFURLCreateData", (PyCFunction)CFURLRefObj_CFURLCreateData, 1,
"(CFStringEncoding encoding, Boolean escapeWhitespace) -> (CFDataRef _rv)"},
{"CFURLGetFileSystemRepresentation", (PyCFunction)CFURLRefObj_CFURLGetFileSystemRepresentation, 1,
"(Boolean resolveAgainstBase, CFIndex maxBufLen) -> (Boolean _rv, UInt8 buffer)"},
{"CFURLCopyAbsoluteURL", (PyCFunction)CFURLRefObj_CFURLCopyAbsoluteURL, 1,
"() -> (CFURLRef _rv)"},
{"CFURLGetString", (PyCFunction)CFURLRefObj_CFURLGetString, 1,
@ -2547,6 +2788,10 @@ static PyMethodDef CFURLRefObj_methods[] = {
"() -> (CFStringRef _rv)"},
{"CFURLCopyPath", (PyCFunction)CFURLRefObj_CFURLCopyPath, 1,
"() -> (CFStringRef _rv)"},
{"CFURLCopyStrictPath", (PyCFunction)CFURLRefObj_CFURLCopyStrictPath, 1,
"() -> (CFStringRef _rv, Boolean isAbsolute)"},
{"CFURLCopyFileSystemPath", (PyCFunction)CFURLRefObj_CFURLCopyFileSystemPath, 1,
"(CFURLPathStyle pathStyle) -> (CFStringRef _rv)"},
{"CFURLHasDirectoryPath", (PyCFunction)CFURLRefObj_CFURLHasDirectoryPath, 1,
"() -> (Boolean _rv)"},
{"CFURLCopyResourceSpecifier", (PyCFunction)CFURLRefObj_CFURLCopyResourceSpecifier, 1,
@ -2565,6 +2810,20 @@ static PyMethodDef CFURLRefObj_methods[] = {
"(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)"},
{"CFURLCopyFragment", (PyCFunction)CFURLRefObj_CFURLCopyFragment, 1,
"(CFStringRef charactersToLeaveEscaped) -> (CFStringRef _rv)"},
{"CFURLCopyLastPathComponent", (PyCFunction)CFURLRefObj_CFURLCopyLastPathComponent, 1,
"() -> (CFStringRef _rv)"},
{"CFURLCopyPathExtension", (PyCFunction)CFURLRefObj_CFURLCopyPathExtension, 1,
"() -> (CFStringRef _rv)"},
{"CFURLCreateCopyAppendingPathComponent", (PyCFunction)CFURLRefObj_CFURLCreateCopyAppendingPathComponent, 1,
"(CFStringRef pathComponent, Boolean isDirectory) -> (CFURLRef _rv)"},
{"CFURLCreateCopyDeletingLastPathComponent", (PyCFunction)CFURLRefObj_CFURLCreateCopyDeletingLastPathComponent, 1,
"() -> (CFURLRef _rv)"},
{"CFURLCreateCopyAppendingPathExtension", (PyCFunction)CFURLRefObj_CFURLCreateCopyAppendingPathExtension, 1,
"(CFStringRef extension) -> (CFURLRef _rv)"},
{"CFURLCreateCopyDeletingPathExtension", (PyCFunction)CFURLRefObj_CFURLCreateCopyDeletingPathExtension, 1,
"() -> (CFURLRef _rv)"},
{"CFURLGetFSRef", (PyCFunction)CFURLRefObj_CFURLGetFSRef, 1,
"() -> (Boolean _rv, FSRef fsRef)"},
{NULL, NULL, 0}
};
@ -2620,6 +2879,26 @@ PyTypeObject CFURLRef_Type = {
/* -------------------- End object type CFURLRef -------------------- */
static PyObject *CF___CFRangeMake(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
CFRange _rv;
CFIndex loc;
CFIndex len;
#ifndef __CFRangeMake
PyMac_PRECHECK(__CFRangeMake);
#endif
if (!PyArg_ParseTuple(_args, "ll",
&loc,
&len))
return NULL;
_rv = __CFRangeMake(loc,
len);
_res = Py_BuildValue("O&",
CFRange_New, _rv);
return _res;
}
static PyObject *CF_CFAllocatorGetTypeID(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -2660,14 +2939,14 @@ static PyObject *CF_CFCopyTypeIDDescription(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
CFStringRef _rv;
CFTypeID theType;
CFTypeID type_id;
#ifndef CFCopyTypeIDDescription
PyMac_PRECHECK(CFCopyTypeIDDescription);
#endif
if (!PyArg_ParseTuple(_args, "l",
&theType))
&type_id))
return NULL;
_rv = CFCopyTypeIDDescription(theType);
_rv = CFCopyTypeIDDescription(type_id);
_res = Py_BuildValue("O&",
CFStringRefObj_New, _rv);
return _res;
@ -2712,17 +2991,17 @@ static PyObject *CF_CFArrayCreateMutableCopy(PyObject *_self, PyObject *_args)
PyObject *_res = NULL;
CFMutableArrayRef _rv;
CFIndex capacity;
CFArrayRef srcArray;
CFArrayRef theArray;
#ifndef CFArrayCreateMutableCopy
PyMac_PRECHECK(CFArrayCreateMutableCopy);
#endif
if (!PyArg_ParseTuple(_args, "lO&",
&capacity,
CFArrayRefObj_Convert, &srcArray))
CFArrayRefObj_Convert, &theArray))
return NULL;
_rv = CFArrayCreateMutableCopy((CFAllocatorRef)NULL,
capacity,
srcArray);
theArray);
_res = Py_BuildValue("O&",
CFMutableArrayRefObj_New, _rv);
return _res;
@ -2809,17 +3088,17 @@ static PyObject *CF_CFDataCreateMutableCopy(PyObject *_self, PyObject *_args)
PyObject *_res = NULL;
CFMutableDataRef _rv;
CFIndex capacity;
CFDataRef data;
CFDataRef theData;
#ifndef CFDataCreateMutableCopy
PyMac_PRECHECK(CFDataCreateMutableCopy);
#endif
if (!PyArg_ParseTuple(_args, "lO&",
&capacity,
CFDataRefObj_Convert, &data))
CFDataRefObj_Convert, &theData))
return NULL;
_rv = CFDataCreateMutableCopy((CFAllocatorRef)NULL,
capacity,
data);
theData);
_res = Py_BuildValue("O&",
CFMutableDataRefObj_New, _rv);
return _res;
@ -2865,17 +3144,17 @@ static PyObject *CF_CFDictionaryCreateMutableCopy(PyObject *_self, PyObject *_ar
PyObject *_res = NULL;
CFMutableDictionaryRef _rv;
CFIndex capacity;
CFDictionaryRef dict;
CFDictionaryRef theDict;
#ifndef CFDictionaryCreateMutableCopy
PyMac_PRECHECK(CFDictionaryCreateMutableCopy);
#endif
if (!PyArg_ParseTuple(_args, "lO&",
&capacity,
CFDictionaryRefObj_Convert, &dict))
CFDictionaryRefObj_Convert, &theDict))
return NULL;
_rv = CFDictionaryCreateMutableCopy((CFAllocatorRef)NULL,
capacity,
dict);
theDict);
_res = Py_BuildValue("O&",
CFMutableDictionaryRefObj_New, _rv);
return _res;
@ -2900,13 +3179,13 @@ static PyObject *CF_CFStringCreateWithPascalString(PyObject *_self, PyObject *_a
{
PyObject *_res = NULL;
CFStringRef _rv;
StringPtr pStr;
Str255 pStr;
CFStringEncoding encoding;
#ifndef CFStringCreateWithPascalString
PyMac_PRECHECK(CFStringCreateWithPascalString);
#endif
if (!PyArg_ParseTuple(_args, "O&l",
PyMac_GetStr255, &pStr,
PyMac_GetStr255, pStr,
&encoding))
return NULL;
_rv = CFStringCreateWithPascalString((CFAllocatorRef)NULL,
@ -2942,13 +3221,13 @@ static PyObject *CF_CFStringCreateWithPascalStringNoCopy(PyObject *_self, PyObje
{
PyObject *_res = NULL;
CFStringRef _rv;
StringPtr pStr;
Str255 pStr;
CFStringEncoding encoding;
#ifndef CFStringCreateWithPascalStringNoCopy
PyMac_PRECHECK(CFStringCreateWithPascalStringNoCopy);
#endif
if (!PyArg_ParseTuple(_args, "O&l",
PyMac_GetStr255, &pStr,
PyMac_GetStr255, pStr,
&encoding))
return NULL;
_rv = CFStringCreateWithPascalStringNoCopy((CFAllocatorRef)NULL,
@ -3202,6 +3481,23 @@ static PyObject *CF_CFStringConvertEncodingToIANACharSetName(PyObject *_self, Py
return _res;
}
static PyObject *CF_CFStringGetMostCompatibleMacStringEncoding(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
CFStringEncoding _rv;
CFStringEncoding encoding;
#ifndef CFStringGetMostCompatibleMacStringEncoding
PyMac_PRECHECK(CFStringGetMostCompatibleMacStringEncoding);
#endif
if (!PyArg_ParseTuple(_args, "l",
&encoding))
return NULL;
_rv = CFStringGetMostCompatibleMacStringEncoding(encoding);
_res = Py_BuildValue("l",
_rv);
return _res;
}
static PyObject *CF___CFStringMakeConstantString(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -3261,19 +3557,90 @@ static PyObject *CF_CFURLCreateWithBytes(PyObject *_self, PyObject *_args)
return _res;
}
static PyObject *CF_CFURLCreateFromFileSystemRepresentation(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
CFURLRef _rv;
unsigned char *buffer__in__;
long buffer__len__;
int buffer__in_len__;
Boolean isDirectory;
#ifndef CFURLCreateFromFileSystemRepresentation
PyMac_PRECHECK(CFURLCreateFromFileSystemRepresentation);
#endif
if (!PyArg_ParseTuple(_args, "s#l",
&buffer__in__, &buffer__in_len__,
&isDirectory))
return NULL;
buffer__len__ = buffer__in_len__;
_rv = CFURLCreateFromFileSystemRepresentation((CFAllocatorRef)NULL,
buffer__in__, buffer__len__,
isDirectory);
_res = Py_BuildValue("O&",
CFURLRefObj_New, _rv);
return _res;
}
static PyObject *CF_CFURLCreateFromFileSystemRepresentationRelativeToBase(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
CFURLRef _rv;
unsigned char *buffer__in__;
long buffer__len__;
int buffer__in_len__;
Boolean isDirectory;
CFURLRef baseURL;
#ifndef CFURLCreateFromFileSystemRepresentationRelativeToBase
PyMac_PRECHECK(CFURLCreateFromFileSystemRepresentationRelativeToBase);
#endif
if (!PyArg_ParseTuple(_args, "s#lO&",
&buffer__in__, &buffer__in_len__,
&isDirectory,
OptionalCFURLRefObj_Convert, &baseURL))
return NULL;
buffer__len__ = buffer__in_len__;
_rv = CFURLCreateFromFileSystemRepresentationRelativeToBase((CFAllocatorRef)NULL,
buffer__in__, buffer__len__,
isDirectory,
baseURL);
_res = Py_BuildValue("O&",
CFURLRefObj_New, _rv);
return _res;
}
static PyObject *CF_CFURLCreateFromFSRef(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
CFURLRef _rv;
FSRef fsRef;
#ifndef CFURLCreateFromFSRef
PyMac_PRECHECK(CFURLCreateFromFSRef);
#endif
if (!PyArg_ParseTuple(_args, "O&",
PyMac_GetFSRef, &fsRef))
return NULL;
_rv = CFURLCreateFromFSRef((CFAllocatorRef)NULL,
&fsRef);
_res = Py_BuildValue("O&",
CFURLRefObj_New, _rv);
return _res;
}
static PyMethodDef CF_methods[] = {
{"__CFRangeMake", (PyCFunction)CF___CFRangeMake, 1,
"(CFIndex loc, CFIndex len) -> (CFRange _rv)"},
{"CFAllocatorGetTypeID", (PyCFunction)CF_CFAllocatorGetTypeID, 1,
"() -> (CFTypeID _rv)"},
{"CFAllocatorGetPreferredSizeForSize", (PyCFunction)CF_CFAllocatorGetPreferredSizeForSize, 1,
"(CFIndex size, CFOptionFlags hint) -> (CFIndex _rv)"},
{"CFCopyTypeIDDescription", (PyCFunction)CF_CFCopyTypeIDDescription, 1,
"(CFTypeID theType) -> (CFStringRef _rv)"},
"(CFTypeID type_id) -> (CFStringRef _rv)"},
{"CFArrayGetTypeID", (PyCFunction)CF_CFArrayGetTypeID, 1,
"() -> (CFTypeID _rv)"},
{"CFArrayCreateMutable", (PyCFunction)CF_CFArrayCreateMutable, 1,
"(CFIndex capacity) -> (CFMutableArrayRef _rv)"},
{"CFArrayCreateMutableCopy", (PyCFunction)CF_CFArrayCreateMutableCopy, 1,
"(CFIndex capacity, CFArrayRef srcArray) -> (CFMutableArrayRef _rv)"},
"(CFIndex capacity, CFArrayRef theArray) -> (CFMutableArrayRef _rv)"},
{"CFDataGetTypeID", (PyCFunction)CF_CFDataGetTypeID, 1,
"() -> (CFTypeID _rv)"},
{"CFDataCreate", (PyCFunction)CF_CFDataCreate, 1,
@ -3283,21 +3650,21 @@ static PyMethodDef CF_methods[] = {
{"CFDataCreateMutable", (PyCFunction)CF_CFDataCreateMutable, 1,
"(CFIndex capacity) -> (CFMutableDataRef _rv)"},
{"CFDataCreateMutableCopy", (PyCFunction)CF_CFDataCreateMutableCopy, 1,
"(CFIndex capacity, CFDataRef data) -> (CFMutableDataRef _rv)"},
"(CFIndex capacity, CFDataRef theData) -> (CFMutableDataRef _rv)"},
{"CFDictionaryGetTypeID", (PyCFunction)CF_CFDictionaryGetTypeID, 1,
"() -> (CFTypeID _rv)"},
{"CFDictionaryCreateMutable", (PyCFunction)CF_CFDictionaryCreateMutable, 1,
"(CFIndex capacity) -> (CFMutableDictionaryRef _rv)"},
{"CFDictionaryCreateMutableCopy", (PyCFunction)CF_CFDictionaryCreateMutableCopy, 1,
"(CFIndex capacity, CFDictionaryRef dict) -> (CFMutableDictionaryRef _rv)"},
"(CFIndex capacity, CFDictionaryRef theDict) -> (CFMutableDictionaryRef _rv)"},
{"CFStringGetTypeID", (PyCFunction)CF_CFStringGetTypeID, 1,
"() -> (CFTypeID _rv)"},
{"CFStringCreateWithPascalString", (PyCFunction)CF_CFStringCreateWithPascalString, 1,
"(StringPtr pStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
"(Str255 pStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
{"CFStringCreateWithCString", (PyCFunction)CF_CFStringCreateWithCString, 1,
"(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
{"CFStringCreateWithPascalStringNoCopy", (PyCFunction)CF_CFStringCreateWithPascalStringNoCopy, 1,
"(StringPtr pStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
"(Str255 pStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
{"CFStringCreateWithCStringNoCopy", (PyCFunction)CF_CFStringCreateWithCStringNoCopy, 1,
"(char* cStr, CFStringEncoding encoding) -> (CFStringRef _rv)"},
{"CFStringCreateMutable", (PyCFunction)CF_CFStringCreateMutable, 1,
@ -3324,12 +3691,20 @@ static PyMethodDef CF_methods[] = {
"(UInt32 codepage) -> (CFStringEncoding _rv)"},
{"CFStringConvertEncodingToIANACharSetName", (PyCFunction)CF_CFStringConvertEncodingToIANACharSetName, 1,
"(CFStringEncoding encoding) -> (CFStringRef _rv)"},
{"CFStringGetMostCompatibleMacStringEncoding", (PyCFunction)CF_CFStringGetMostCompatibleMacStringEncoding, 1,
"(CFStringEncoding encoding) -> (CFStringEncoding _rv)"},
{"__CFStringMakeConstantString", (PyCFunction)CF___CFStringMakeConstantString, 1,
"(char* cStr) -> (CFStringRef _rv)"},
{"CFURLGetTypeID", (PyCFunction)CF_CFURLGetTypeID, 1,
"() -> (CFTypeID _rv)"},
{"CFURLCreateWithBytes", (PyCFunction)CF_CFURLCreateWithBytes, 1,
"(Buffer URLBytes, CFStringEncoding encoding, CFURLRef baseURL) -> (CFURLRef _rv)"},
{"CFURLCreateFromFileSystemRepresentation", (PyCFunction)CF_CFURLCreateFromFileSystemRepresentation, 1,
"(Buffer buffer, Boolean isDirectory) -> (CFURLRef _rv)"},
{"CFURLCreateFromFileSystemRepresentationRelativeToBase", (PyCFunction)CF_CFURLCreateFromFileSystemRepresentationRelativeToBase, 1,
"(Buffer buffer, Boolean isDirectory, CFURLRef baseURL) -> (CFURLRef _rv)"},
{"CFURLCreateFromFSRef", (PyCFunction)CF_CFURLCreateFromFSRef, 1,
"(FSRef fsRef) -> (CFURLRef _rv)"},
{NULL, NULL, 0}
};

View File

@ -171,6 +171,8 @@ 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!!

View File

@ -402,6 +402,40 @@ static PyObject *CmpObj_OpenComponent(ComponentObject *_self, PyObject *_args)
return _res;
}
static PyObject *CmpObj_ResolveComponentAlias(ComponentObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
Component _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = ResolveComponentAlias(_self->ob_itself);
_res = Py_BuildValue("O&",
CmpObj_New, _rv);
return _res;
}
static PyObject *CmpObj_GetComponentPublicIndString(ComponentObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
OSErr _err;
Str255 theString;
short strListID;
short index;
if (!PyArg_ParseTuple(_args, "O&hh",
PyMac_GetStr255, theString,
&strListID,
&index))
return NULL;
_err = GetComponentPublicIndString(_self->ob_itself,
theString,
strListID,
index);
if (_err != noErr) return PyMac_Error(_err);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *CmpObj_GetComponentRefcon(ComponentObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -483,18 +517,6 @@ static PyObject *CmpObj_GetComponentIndString(ComponentObject *_self, PyObject *
return _res;
}
static PyObject *CmpObj_ResolveComponentAlias(ComponentObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
Component _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = ResolveComponentAlias(_self->ob_itself);
_res = Py_BuildValue("O&",
CmpObj_New, _rv);
return _res;
}
static PyObject *CmpObj_CountComponentInstances(ComponentObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -573,6 +595,10 @@ static PyMethodDef CmpObj_methods[] = {
"(Handle componentName, Handle componentInfo, Handle componentIcon) -> (ComponentDescription cd)"},
{"OpenComponent", (PyCFunction)CmpObj_OpenComponent, 1,
"() -> (ComponentInstance _rv)"},
{"ResolveComponentAlias", (PyCFunction)CmpObj_ResolveComponentAlias, 1,
"() -> (Component _rv)"},
{"GetComponentPublicIndString", (PyCFunction)CmpObj_GetComponentPublicIndString, 1,
"(Str255 theString, short strListID, short index) -> None"},
{"GetComponentRefcon", (PyCFunction)CmpObj_GetComponentRefcon, 1,
"() -> (long _rv)"},
{"SetComponentRefcon", (PyCFunction)CmpObj_SetComponentRefcon, 1,
@ -583,8 +609,6 @@ static PyMethodDef CmpObj_methods[] = {
"(OSType resType, short resID) -> (Handle theResource)"},
{"GetComponentIndString", (PyCFunction)CmpObj_GetComponentIndString, 1,
"(Str255 theString, short strListID, short index) -> None"},
{"ResolveComponentAlias", (PyCFunction)CmpObj_ResolveComponentAlias, 1,
"() -> (Component _rv)"},
{"CountComponentInstances", (PyCFunction)CmpObj_CountComponentInstances, 1,
"() -> (long _rv)"},
{"SetDefaultComponent", (PyCFunction)CmpObj_SetDefaultComponent, 1,

View File

@ -957,7 +957,6 @@ static PyMethodDef DlgObj_methods[] = {
"() -> None"},
{"GetDialogPort", (PyCFunction)DlgObj_GetDialogPort, 1,
"() -> (CGrafPtr _rv)"},
{NULL, NULL, 0}
};

View File

@ -54,17 +54,19 @@ class MyScanner(Scanner):
'SetDialogMovableModal',
'GetDialogControlNotificationProc',
'SetGrafPortOfDialog', # Funny, and probably not useful
# Can't find these:
'CloseStandardSheet',
'RunStandardAlert',
]
def makegreylist(self):
return [
('#if !TARGET_API_MAC_CARBON', [
'SetGrafPortOfDialog',
]),
('#if TARGET_API_MAC_CARBON', [
'InsertDialogItem',
'RemoveDialogItems',
'GetParamText',
'CloseStandardSheet',
'RunStandardAlert',
])]
def makeblacklisttypes(self):
@ -72,6 +74,9 @@ class MyScanner(Scanner):
"AlertStdAlertParamPtr", # Too much work, for now
"AlertStdAlertParamRec", # ditto
"AlertStdAlertParamRec_ptr", # ditto
"AlertStdCFStringAlertParamPtr", # ditto
"AlertStdCFStringAlertParamRec",
"AlertStdCFStringAlertParamRec_ptr",
"QTModelessCallbackProcPtr",
]

View File

@ -257,21 +257,6 @@ execfile("dlggen.py")
for f in functions: module.add(f)
for f in methods: object.add(f)
# Some methods that are currently macro's in C, but will be real routines
# in MacOS 8.
##f = Method(ExistingWindowPtr, 'GetDialogWindow', (DialogRef, 'dialog', InMode))
##object.add(f)
##f = Method(SInt16, 'GetDialogDefaultItem', (DialogRef, 'dialog', InMode))
##object.add(f)
##f = Method(SInt16, 'GetDialogCancelItem', (DialogRef, 'dialog', InMode))
##object.add(f)
##f = Method(SInt16, 'GetDialogKeyboardFocusItem', (DialogRef, 'dialog', InMode))
##object.add(f)
f = Method(void, 'SetGrafPortOfDialog', (DialogRef, 'dialog', InMode),
condition='#if !TARGET_API_MAC_CARBON')
object.add(f)
setuseritembody = """
PyObject *new = NULL;

View File

@ -73,18 +73,6 @@ static PyObject *Evt_WaitMouseUp(PyObject *_self, PyObject *_args)
return _res;
}
static PyObject *Evt_TickCount(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
UInt32 _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = TickCount();
_res = Py_BuildValue("l",
_rv);
return _res;
}
static PyObject *Evt_GetCaretTime(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -337,6 +325,136 @@ static PyObject *Evt_CheckEventQueueForUserCancel(PyObject *_self, PyObject *_ar
}
#endif
static PyObject *Evt_KeyScript(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
short code;
if (!PyArg_ParseTuple(_args, "h",
&code))
return NULL;
KeyScript(code);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *Evt_IsCmdChar(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
Boolean _rv;
EventRecord event;
short test;
if (!PyArg_ParseTuple(_args, "O&h",
PyMac_GetEventRecord, &event,
&test))
return NULL;
_rv = IsCmdChar(&event,
test);
_res = Py_BuildValue("b",
_rv);
return _res;
}
static PyObject *Evt_LMGetKeyThresh(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
SInt16 _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = LMGetKeyThresh();
_res = Py_BuildValue("h",
_rv);
return _res;
}
static PyObject *Evt_LMSetKeyThresh(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
SInt16 value;
if (!PyArg_ParseTuple(_args, "h",
&value))
return NULL;
LMSetKeyThresh(value);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *Evt_LMGetKeyRepThresh(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
SInt16 _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = LMGetKeyRepThresh();
_res = Py_BuildValue("h",
_rv);
return _res;
}
static PyObject *Evt_LMSetKeyRepThresh(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
SInt16 value;
if (!PyArg_ParseTuple(_args, "h",
&value))
return NULL;
LMSetKeyRepThresh(value);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *Evt_LMGetKbdLast(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
UInt8 _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = LMGetKbdLast();
_res = Py_BuildValue("b",
_rv);
return _res;
}
static PyObject *Evt_LMSetKbdLast(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
UInt8 value;
if (!PyArg_ParseTuple(_args, "b",
&value))
return NULL;
LMSetKbdLast(value);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *Evt_LMGetKbdType(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
UInt8 _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = LMGetKbdType();
_res = Py_BuildValue("b",
_rv);
return _res;
}
static PyObject *Evt_LMSetKbdType(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
UInt8 value;
if (!PyArg_ParseTuple(_args, "b",
&value))
return NULL;
LMSetKbdType(value);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *Evt_WaitNextEvent(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -372,8 +490,6 @@ static PyMethodDef Evt_methods[] = {
"() -> (Boolean _rv)"},
{"WaitMouseUp", (PyCFunction)Evt_WaitMouseUp, 1,
"() -> (Boolean _rv)"},
{"TickCount", (PyCFunction)Evt_TickCount, 1,
"() -> (UInt32 _rv)"},
{"GetCaretTime", (PyCFunction)Evt_GetCaretTime, 1,
"() -> (UInt32 _rv)"},
{"GetKeys", (PyCFunction)Evt_GetKeys, 1,
@ -430,6 +546,26 @@ static PyMethodDef Evt_methods[] = {
{"CheckEventQueueForUserCancel", (PyCFunction)Evt_CheckEventQueueForUserCancel, 1,
"() -> (Boolean _rv)"},
#endif
{"KeyScript", (PyCFunction)Evt_KeyScript, 1,
"(short code) -> None"},
{"IsCmdChar", (PyCFunction)Evt_IsCmdChar, 1,
"(EventRecord event, short test) -> (Boolean _rv)"},
{"LMGetKeyThresh", (PyCFunction)Evt_LMGetKeyThresh, 1,
"() -> (SInt16 _rv)"},
{"LMSetKeyThresh", (PyCFunction)Evt_LMSetKeyThresh, 1,
"(SInt16 value) -> None"},
{"LMGetKeyRepThresh", (PyCFunction)Evt_LMGetKeyRepThresh, 1,
"() -> (SInt16 _rv)"},
{"LMSetKeyRepThresh", (PyCFunction)Evt_LMSetKeyRepThresh, 1,
"(SInt16 value) -> None"},
{"LMGetKbdLast", (PyCFunction)Evt_LMGetKbdLast, 1,
"() -> (UInt8 _rv)"},
{"LMSetKbdLast", (PyCFunction)Evt_LMSetKbdLast, 1,
"(UInt8 value) -> None"},
{"LMGetKbdType", (PyCFunction)Evt_LMGetKbdType, 1,
"() -> (UInt8 _rv)"},
{"LMSetKbdType", (PyCFunction)Evt_LMSetKbdType, 1,
"(UInt8 value) -> None"},
{"WaitNextEvent", (PyCFunction)Evt_WaitNextEvent, 1,
"(EventMask eventMask, UInt32 sleep [,RegionHandle]) -> (Boolean _rv, EventRecord theEvent)"},
{NULL, NULL, 0}

View File

@ -24,7 +24,7 @@ static PyObject *Help_HMGetHelpMenuHandle(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
OSErr _err;
MenuHandle mh;
MenuRef mh;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_err = HMGetHelpMenuHandle(&mh);
@ -239,13 +239,13 @@ static PyObject *Help_HMGetBalloonWindow(PyObject *_self, PyObject *_args)
_err = HMGetBalloonWindow(&window);
if (_err != noErr) return PyMac_Error(_err);
_res = Py_BuildValue("O&",
WinObj_WhichWindow, window);
WinObj_New, window);
return _res;
}
static PyMethodDef Help_methods[] = {
{"HMGetHelpMenuHandle", (PyCFunction)Help_HMGetHelpMenuHandle, 1,
"() -> (MenuHandle mh)"},
"() -> (MenuRef mh)"},
{"HMRemoveBalloon", (PyCFunction)Help_HMRemoveBalloon, 1,
"() -> None"},
{"HMIsBalloon", (PyCFunction)Help_HMIsBalloon, 1,

View File

@ -378,8 +378,8 @@ static PyObject *ListObj_LClick(ListObject *_self, PyObject *_args)
PyObject *_res = NULL;
Boolean _rv;
Point pt;
short modifiers;
if (!PyArg_ParseTuple(_args, "O&h",
EventModifiers modifiers;
if (!PyArg_ParseTuple(_args, "O&H",
PyMac_GetPoint, &pt,
&modifiers))
return NULL;
@ -580,7 +580,7 @@ static PyMethodDef ListObj_methods[] = {
{"LCellSize", (PyCFunction)ListObj_LCellSize, 1,
"(Point cSize) -> None"},
{"LClick", (PyCFunction)ListObj_LClick, 1,
"(Point pt, short modifiers) -> (Boolean _rv)"},
"(Point pt, EventModifiers modifiers) -> (Boolean _rv)"},
{"LAddToCell", (PyCFunction)ListObj_LAddToCell, 1,
"(Buffer dataPtr, Point theCell) -> None"},
{"LClrCell", (PyCFunction)ListObj_LClrCell, 1,

View File

@ -56,6 +56,7 @@ class MyScanner(Scanner):
def makeblacklisttypes(self):
return [
"ListClickLoopUPP", # Too difficult for now
"ListDefSpecPtr", # later
]
def makerepairinstructions(self):

View File

@ -36,6 +36,7 @@ RgnHandle = OpaqueByValueType("RgnHandle", "ResObj")
DataHandle = OpaqueByValueType("DataHandle", "ResObj")
Handle = OpaqueByValueType("Handle", "ResObj")
CGrafPtr = OpaqueByValueType("CGrafPtr", "GrafObj")
EventModifiers = Type("EventModifiers", "H")
includestuff = includestuff + """
#ifdef WITHOUT_FRAMEWORKS

File diff suppressed because it is too large Load Diff

View File

@ -42,6 +42,7 @@ class MyScanner(Scanner):
"GetMenuCommandProperty",
"GetMenuTitle", # Funny arg/returnvalue
"SetMenuTitle",
"SetMenuTitleIcon", # void*
]
def makegreylist(self):
@ -83,7 +84,37 @@ class MyScanner(Scanner):
'GetMenuAttributes',
'ChangeMenuItemPropertyAttributes',
'GetMenuItemPropertyAttributes',
'AcquireRootMenu',
'UpdateInvalidMenuItems',
'InvalidateMenuItems',
'IsMenuItemInvalid',
'GetMenuCommandMark',
'SetMenuCommandMark',
'GetMenuType',
'SetMenuItemCommandKey',
'GetMenuItemCommandKey',
'SetMenuItemIndent',
'GetMenuItemIndent',
'SetMenuItemTextWithCFString',
'CopyMenuItemTextAsCFString',
'GetMenuItemHierarchicalMenu',
'SetMenuItemHierarchicalMenu',
'SetRootMenu',
'IsMenuBarInvalid',
'InvalidateMenuEnabling',
'InsertMenuItemTextWithCFString',
'AppendMenuItemTextWithCFString',
'DeleteMenuItems',
'CopyMenuItems',
'IsMenuSizeInvalid',
'InvalidateMenuSize',
'SetMenuTitleWithCFString',
'CopyMenuTitleAsCFString',
'DuplicateMenu',
'ReleaseMenu',
'RetainMenu',
'GetMenuRetainCount',
'IsValidMenu',
])]
def makeblacklisttypes(self):
@ -96,6 +127,10 @@ class MyScanner(Scanner):
"MenuDefSpecPtr", # Too difficult for now
"MenuDefSpec_ptr", # ditto
"MenuTrackingData",
"void_ptr", # Don't know yet.
"EventRef", # For now, not exported yet.
"MenuItemDataPtr", # Not yet.
"MenuItemDataRec_ptr",
]
def makerepairinstructions(self):

View File

@ -28,12 +28,15 @@ Handle = OpaqueByValueType("Handle", "ResObj")
MenuBarHandle = OpaqueByValueType("MenuBarHandle", "ResObj")
MenuID = Type("MenuID", "h")
MenuItemIndex = Type("MenuItemIndex", "h")
MenuItemID = Type("MenuItemID", "l")
MenuCommand = Type("MenuCommand", "l")
MenuAttributes = Type("MenuAttributes", "l")
MenuItemAttributes = Type("MenuItemAttributes", "l")
unsigned_char = Type('unsigned char', 'b')
FMFontFamily = Type("FMFontFamily", "h")
FMFontStyle = Type("FMFontStyle", "h")
CFStringRef = OpaqueByValueType("CFStringRef", "CFStringRefObj")
UniChar = Type("UniChar", "h")
includestuff = includestuff + """
#ifdef WITHOUT_FRAMEWORKS

View File

@ -960,6 +960,31 @@ static PyObject *TE_TESetScrapHandle(PyObject *_self, PyObject *_args)
}
#endif
static PyObject *TE_LMGetWordRedraw(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
UInt8 _rv;
if (!PyArg_ParseTuple(_args, ""))
return NULL;
_rv = LMGetWordRedraw();
_res = Py_BuildValue("b",
_rv);
return _res;
}
static PyObject *TE_LMSetWordRedraw(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
UInt8 value;
if (!PyArg_ParseTuple(_args, "b",
&value))
return NULL;
LMSetWordRedraw(value);
Py_INCREF(Py_None);
_res = Py_None;
return _res;
}
static PyObject *TE_as_TE(PyObject *_self, PyObject *_args)
{
PyObject *_res = NULL;
@ -1001,6 +1026,10 @@ static PyMethodDef TE_methods[] = {
{"TESetScrapHandle", (PyCFunction)TE_TESetScrapHandle, 1,
"(Handle value) -> None"},
#endif
{"LMGetWordRedraw", (PyCFunction)TE_LMGetWordRedraw, 1,
"() -> (UInt8 _rv)"},
{"LMSetWordRedraw", (PyCFunction)TE_LMSetWordRedraw, 1,
"(UInt8 value) -> None"},
{"as_TE", (PyCFunction)TE_as_TE, 1,
"(Handle h) -> (TEHandle _rv)"},
{NULL, NULL, 0}