Example #1
0
static PyObject *IBNibRefObj_SetMenuBarFromNib(IBNibRefObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSStatus _err;
	CFStringRef inName;
	if (!PyArg_ParseTuple(_args, "O&",
	                      CFStringRefObj_Convert, &inName))
		return NULL;
	_err = SetMenuBarFromNib(_self->ob_itself,
	                         inName);
	if (_err != noErr) return PyMac_Error(_err);
	Py_INCREF(Py_None);
	_res = Py_None;
	return _res;
}
Example #2
0
static PyObject *AE_AEObjectInit(PyObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
#ifndef AEObjectInit
	PyMac_PRECHECK(AEObjectInit);
#endif
	if (!PyArg_ParseTuple(_args, ""))
		return NULL;
	_err = AEObjectInit();
	if (_err != noErr) return PyMac_Error(_err);
	Py_INCREF(Py_None);
	_res = Py_None;
	return _res;
}
Example #3
0
static PyObject *AEDesc_AESetTheCurrentEvent(AEDescObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
#ifndef AESetTheCurrentEvent
	PyMac_PRECHECK(AESetTheCurrentEvent);
#endif
	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;
}
Example #4
0
static PyObject *DragObj_DragPostScroll(DragObjObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
#ifndef DragPostScroll
	PyMac_PRECHECK(DragPostScroll);
#endif
	if (!PyArg_ParseTuple(_args, ""))
		return NULL;
	_err = DragPostScroll(_self->ob_itself);
	if (_err != noErr) return PyMac_Error(_err);
	Py_INCREF(Py_None);
	_res = Py_None;
	return _res;
}
Example #5
0
static PyObject *Res_ResError(PyObject *_self, PyObject *_args)
{
    PyObject *_res = NULL;
    OSErr _err;
#ifndef ResError
    PyMac_PRECHECK(ResError);
#endif
    if (!PyArg_ParseTuple(_args, ""))
        return NULL;
    _err = ResError();
    if (_err != noErr) return PyMac_Error(_err);
    Py_INCREF(Py_None);
    _res = Py_None;
    return _res;
}
Example #6
0
static PyObject *DragObj_HideDragHilite(DragObjObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
#ifndef HideDragHilite
	PyMac_PRECHECK(HideDragHilite);
#endif
	if (!PyArg_ParseTuple(_args, ""))
		return NULL;
	_err = HideDragHilite(_self->ob_itself);
	if (_err != noErr) return PyMac_Error(_err);
	Py_INCREF(Py_None);
	_res = Py_None;
	return _res;
}
Example #7
0
static PyObject *SndCh_SndDoImmediate(SndChannelObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
	SndCommand cmd;
	if (!PyArg_ParseTuple(_args, "O&",
	                      SndCmd_Convert, &cmd))
		return NULL;
	_err = SndDoImmediate(_self->ob_itself,
	                      &cmd);
	if (_err != noErr) return PyMac_Error(_err);
	Py_INCREF(Py_None);
	_res = Py_None;
	return _res;
}
Example #8
0
static iciobject *
newiciobject(OSType creator)
{
	iciobject *self;
	OSStatus err;
	
	self = PyObject_NEW(iciobject, &Icitype);
	if (self == NULL)
		return NULL;
	if ((err=ICStart(&self->inst, creator)) != 0 ) {
		(void)PyMac_Error(err);
		PyObject_DEL(self);
		return NULL;
	}
	return self;
}
Example #9
0
static PyObject *Drag_NewDrag(PyObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
	DragRef theDrag;
#ifndef NewDrag
	PyMac_PRECHECK(NewDrag);
#endif
	if (!PyArg_ParseTuple(_args, ""))
		return NULL;
	_err = NewDrag(&theDrag);
	if (_err != noErr) return PyMac_Error(_err);
	_res = Py_BuildValue("O&",
	                     DragObj_New, theDrag);
	return _res;
}
Example #10
0
static PyObject *Res_GetTopResourceFile(PyObject *_self, PyObject *_args)
{
    PyObject *_res = NULL;
    OSErr _err;
    SInt16 refNum;
#ifndef GetTopResourceFile
    PyMac_PRECHECK(GetTopResourceFile);
#endif
    if (!PyArg_ParseTuple(_args, ""))
        return NULL;
    _err = GetTopResourceFile(&refNum);
    if (_err != noErr) return PyMac_Error(_err);
    _res = Py_BuildValue("h",
                         refNum);
    return _res;
}
Example #11
0
static PyObject *IBCarbon_CreateNibReference(PyObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSStatus _err;
	CFStringRef inNibName;
	IBNibRef outNibRef;
	if (!PyArg_ParseTuple(_args, "O&",
	                      CFStringRefObj_Convert, &inNibName))
		return NULL;
	_err = CreateNibReference(inNibName,
	                          &outNibRef);
	if (_err != noErr) return PyMac_Error(_err);
	_res = Py_BuildValue("O&",
	                     IBNibRefObj_New, outNibRef);
	return _res;
}
Example #12
0
static PyObject *Launch_LSCopyDisplayNameForURL(PyObject *_self, PyObject *_args)
{
    PyObject *_res = NULL;
    OSStatus _err;
    CFURLRef inURL;
    CFStringRef outDisplayName;
    if (!PyArg_ParseTuple(_args, "O&",
                          CFURLRefObj_Convert, &inURL))
        return NULL;
    _err = LSCopyDisplayNameForURL(inURL,
                                   &outDisplayName);
    if (_err != noErr) return PyMac_Error(_err);
    _res = Py_BuildValue("O&",
                         CFStringRefObj_New, outDisplayName);
    return _res;
}
Example #13
0
static PyObject *Icn_NewIconSuite(PyObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
	IconSuiteRef theIconSuite;
#ifndef NewIconSuite
	PyMac_PRECHECK(NewIconSuite);
#endif
	if (!PyArg_ParseTuple(_args, ""))
		return NULL;
	_err = NewIconSuite(&theIconSuite);
	if (_err != noErr) return PyMac_Error(_err);
	_res = Py_BuildValue("O&",
	                     ResObj_New, theIconSuite);
	return _res;
}
Example #14
0
static PyObject *Snd_SPBBytesToMilliseconds(PyObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
	long inRefNum;
	long byteCount;
	if (!PyArg_ParseTuple(_args, "l",
	                      &inRefNum))
		return NULL;
	_err = SPBBytesToMilliseconds(inRefNum,
	                              &byteCount);
	if (_err != noErr) return PyMac_Error(_err);
	_res = Py_BuildValue("l",
	                     byteCount);
	return _res;
}
Example #15
0
static PyObject *Snd_GetCompressionName(PyObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
	OSType compressionType;
	Str255 compressionName;
	if (!PyArg_ParseTuple(_args, "O&",
	                      PyMac_GetOSType, &compressionType))
		return NULL;
	_err = GetCompressionName(compressionType,
	                          compressionName);
	if (_err != noErr) return PyMac_Error(_err);
	_res = Py_BuildValue("O&",
	                     PyMac_BuildStr255, compressionName);
	return _res;
}
Example #16
0
static PyObject *Snd_GetSoundHeaderOffset(PyObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
	SndListHandle sndHandle;
	long offset;
	if (!PyArg_ParseTuple(_args, "O&",
	                      ResObj_Convert, &sndHandle))
		return NULL;
	_err = GetSoundHeaderOffset(sndHandle,
	                            &offset);
	if (_err != noErr) return PyMac_Error(_err);
	_res = Py_BuildValue("l",
	                     offset);
	return _res;
}
Example #17
0
static PyObject *Snd_SndManagerStatus(PyObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
	short theLength;
	SMStatus theStatus__out__;
	if (!PyArg_ParseTuple(_args, "h",
	                      &theLength))
		return NULL;
	_err = SndManagerStatus(theLength,
	                        &theStatus__out__);
	if (_err != noErr) return PyMac_Error(_err);
	_res = Py_BuildValue("s#",
	                     (char *)&theStatus__out__, (int)sizeof(SMStatus));
	return _res;
}
Example #18
0
static PyObject *Drag_RemoveReceiveHandler(PyObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;

	    WindowPtr theWindow = NULL;
	    OSErr _err;
	    
	    if ( !PyArg_ParseTuple(_args, "|O&", WinObj_Convert, &theWindow) )
	    	return NULL;
	    _err = RemoveReceiveHandler(dragglue_ReceiveHandlerUPP, theWindow);
		if (_err != noErr) return PyMac_Error(_err);
		Py_INCREF(Py_None);
		_res = Py_None;
		return _res;

}
Example #19
0
static PyObject *AE_AEGetInteractionAllowed(PyObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
	AEInteractAllowed level;
#ifndef AEGetInteractionAllowed
	PyMac_PRECHECK(AEGetInteractionAllowed);
#endif
	if (!PyArg_ParseTuple(_args, ""))
		return NULL;
	_err = AEGetInteractionAllowed(&level);
	if (_err != noErr) return PyMac_Error(_err);
	_res = Py_BuildValue("b",
	                     level);
	return _res;
}
Example #20
0
static PyObject *AE_AEDisposeToken(PyObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
	AEDesc theToken;
#ifndef AEDisposeToken
	PyMac_PRECHECK(AEDisposeToken);
#endif
	if (!PyArg_ParseTuple(_args, ""))
		return NULL;
	_err = AEDisposeToken(&theToken);
	if (_err != noErr) return PyMac_Error(_err);
	_res = Py_BuildValue("O&",
	                     AEDesc_New, &theToken);
	return _res;
}
Example #21
0
static PyObject *Launch_LSOpenCFURLRef(PyObject *_self, PyObject *_args)
{
    PyObject *_res = NULL;
    OSStatus _err;
    CFURLRef inURL;
    CFURLRef outLaunchedURL;
    if (!PyArg_ParseTuple(_args, "O&",
                          CFURLRefObj_Convert, &inURL))
        return NULL;
    _err = LSOpenCFURLRef(inURL,
                          &outLaunchedURL);
    if (_err != noErr) return PyMac_Error(_err);
    _res = Py_BuildValue("O&",
                         CFURLRefObj_New, outLaunchedURL);
    return _res;
}
Example #22
0
static PyObject *Launch_LSOpenFSRef(PyObject *_self, PyObject *_args)
{
    PyObject *_res = NULL;
    OSStatus _err;
    FSRef inRef;
    FSRef outLaunchedRef;
    if (!PyArg_ParseTuple(_args, "O&",
                          PyMac_GetFSRef, &inRef))
        return NULL;
    _err = LSOpenFSRef(&inRef,
                       &outLaunchedRef);
    if (_err != noErr) return PyMac_Error(_err);
    _res = Py_BuildValue("O&",
                         PyMac_BuildFSRef, &outLaunchedRef);
    return _res;
}
Example #23
0
static PyObject *Launch_LSCopyKindStringForRef(PyObject *_self, PyObject *_args)
{
    PyObject *_res = NULL;
    OSStatus _err;
    FSRef inFSRef;
    CFStringRef outKindString;
    if (!PyArg_ParseTuple(_args, "O&",
                          PyMac_GetFSRef, &inFSRef))
        return NULL;
    _err = LSCopyKindStringForRef(&inFSRef,
                                  &outKindString);
    if (_err != noErr) return PyMac_Error(_err);
    _res = Py_BuildValue("O&",
                         CFStringRefObj_New, outKindString);
    return _res;
}
Example #24
0
static PyObject *AEDesc_AESendMach(AEDescObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
	AppleEvent reply;
	AESendMode sendMode;
	AESendPriority sendPriority;
	long timeOutInTicks;
	mach_port_t replyPort;
#ifndef AESend
	PyMac_PRECHECK(AESend);
#endif
	if (!PyArg_ParseTuple(_args, "lhl",
						  &sendMode,
						  &sendPriority,
						  &timeOutInTicks))
		return NULL;
	if (sendMode == kAEWaitReply) {
		if (mach_port_allocate(mach_task_self(), MACH_PORT_RIGHT_RECEIVE, &replyPort) != KERN_SUCCESS) {
			PyErr_SetString(PyExc_SystemError, "Failed to allocate Mach port!");
			return NULL;
		}
		_err = AEPutAttributePtr(&_self->ob_itself,
								 keyReplyPortAttr,
								 typeMachPort,
								 &replyPort,
								 sizeof(replyPort));
		if (_err != noErr) goto cleanup;
	}
	_err = AESendMessage(&_self->ob_itself,
						 &reply,
						 sendMode,
						 timeOutInTicks);
	if (_err != noErr) goto cleanup;
	_res = Py_BuildValue("O&",
						 AEDesc_New, &reply);
	if (sendMode == kAEWaitReply) {
		mach_port_destroy(mach_task_self(), replyPort);
	}
	return _res;
cleanup:
	if (sendMode == kAEWaitReply) {
		mach_port_destroy(mach_task_self(), replyPort);
	}
	return PyMac_Error(_err);
}
Example #25
0
static PyObject *AEDesc_AECountItems(AEDescObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
	long theCount;
#ifndef AECountItems
	PyMac_PRECHECK(AECountItems);
#endif
	if (!PyArg_ParseTuple(_args, ""))
		return NULL;
	_err = AECountItems(&_self->ob_itself,
	                    &theCount);
	if (_err != noErr) return PyMac_Error(_err);
	_res = Py_BuildValue("l",
	                     theCount);
	return _res;
}
Example #26
0
static PyObject *AE_AESetInteractionAllowed(PyObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
	AEInteractAllowed level;
#ifndef AESetInteractionAllowed
	PyMac_PRECHECK(AESetInteractionAllowed);
#endif
	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;
}
Example #27
0
static PyObject *AE_AEProcessAppleEvent(PyObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
	EventRecord theEventRecord;
#ifndef AEProcessAppleEvent
	PyMac_PRECHECK(AEProcessAppleEvent);
#endif
	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;
}
Example #28
0
static PyObject *AEDesc_AEDuplicateDesc(AEDescObject *_self, PyObject *_args)
{
	PyObject *_res = NULL;
	OSErr _err;
	AEDesc result;
#ifndef AEDuplicateDesc
	PyMac_PRECHECK(AEDuplicateDesc);
#endif
	if (!PyArg_ParseTuple(_args, ""))
		return NULL;
	_err = AEDuplicateDesc(&_self->ob_itself,
	                       &result);
	if (_err != noErr) return PyMac_Error(_err);
	_res = Py_BuildValue("O&",
	                     AEDesc_New, &result);
	return _res;
}
Example #29
0
static PyObject *Launch_LSSetExtensionHiddenForURL(PyObject *_self, PyObject *_args)
{
    PyObject *_res = NULL;
    OSStatus _err;
    CFURLRef inURL;
    Boolean inHide;
    if (!PyArg_ParseTuple(_args, "O&b",
                          CFURLRefObj_Convert, &inURL,
                          &inHide))
        return NULL;
    _err = LSSetExtensionHiddenForURL(inURL,
                                      inHide);
    if (_err != noErr) return PyMac_Error(_err);
    Py_INCREF(Py_None);
    _res = Py_None;
    return _res;
}
Example #30
0
static PyObject *Launch_LSSetExtensionHiddenForRef(PyObject *_self, PyObject *_args)
{
    PyObject *_res = NULL;
    OSStatus _err;
    FSRef inRef;
    Boolean inHide;
    if (!PyArg_ParseTuple(_args, "O&b",
                          PyMac_GetFSRef, &inRef,
                          &inHide))
        return NULL;
    _err = LSSetExtensionHiddenForRef(&inRef,
                                      inHide);
    if (_err != noErr) return PyMac_Error(_err);
    Py_INCREF(Py_None);
    _res = Py_None;
    return _res;
}