view dstep/coreservices/ae/AEObjects.d @ 11:07194b026fa4

Added bindings to a couple of frameworks, new license + some other things
author Jacob Carlborg <doob@me.com>
date Sat, 01 Aug 2009 15:03:28 +0200
parents
children
line wrap: on
line source

/**
 * Copyright: Copyright (c) 2009 Jacob Carlborg.
 * Authors: Jacob Carlborg
 * Version: Initial created: Jul 21, 2009 
 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
 */
module dstep.coreservices.ae.AEObjects;

//import dstep.AvailabilityMacros;
import dstep.coreservices.ae.AEDataModel;
import dstep.coreservices.ae.AppleEvents;
import dstep.coreservices.carboncore.CarbonCore;
import dstep.objc.bridge.TypeEncoding;

alias ccntTokenRecord* ccntTokenRecPtr;
alias ccntTokenRecPtr* ccntTokenRecHandle;
alias OSLAccessorProcPtr OSLAccessorUPP;
alias OSLCompareProcPtr OSLCompareUPP;
alias OSLCountProcPtr OSLCountUPP;
alias OSLDisposeTokenProcPtr OSLDisposeTokenUPP;
alias OSLGetMarkTokenProcPtr OSLGetMarkTokenUPP;
alias OSLGetErrDescProcPtr OSLGetErrDescUPP;
alias OSLMarkProcPtr OSLMarkUPP;
alias OSLAdjustMarksProcPtr OSLAdjustMarksUPP;

extern (C)
{
	alias short function (int, int, AEDesc*) OSLAdjustMarksProcPtr;
	alias short function (AEDesc*, AEDesc*, int) OSLMarkProcPtr;
	alias short function (AEDesc*, uint, AEDesc*) OSLGetMarkTokenProcPtr;
	alias short function (AEDesc*) OSLDisposeTokenProcPtr;
	alias short function (AEDesc**) OSLGetErrDescProcPtr;
	alias short function (uint, AEDesc*, AEDesc*, char*) OSLCompareProcPtr;
	alias short function (uint, AEDesc*, uint, uint, AEDesc*, AEDesc*, int) OSLAccessorProcPtr;
	alias short function (uint, uint, AEDesc*, long*) OSLCountProcPtr;
}

// This is needed otherwise the enums will fail compiling with gdc
version (GNU)
{
	private
	{
		const __kAEAND = getOSType!("AND ");
		const __kAEOR = getOSType!("OR  ");
		const __kAENOT = getOSType!("NOT ");
		const __kAEFirst = getOSType!("firs");
		const __kAELast = getOSType!("last");
		const __kAEMiddle = getOSType!("midd");
		const __kAEAny = getOSType!("any ");
		const __kAEAll = getOSType!("all ");
		const __kAENext = getOSType!("next");
		const __kAEPrevious = getOSType!("prev");
		const __keyAECompOperator = getOSType!("relo");
		const __keyAELogicalTerms = getOSType!("term");
		const __keyAELogicalOperator = getOSType!("logc");
		const __keyAEObject1 = getOSType!("obj1");
		const __keyAEObject2 = getOSType!("obj2");
		const __keyAEDesiredClass = getOSType!("want");
		const __keyAEContainer = getOSType!("from");
		const __keyAEKeyForm = getOSType!("form");
		const __keyAEKeyData = getOSType!("seld");

	}
}

// This is needed otherwise the enums will fail compiling with gdc
version (GNU)
{
	private
	{
		const __keyAERangeStart = getOSType!("star");
		const __keyAERangeStop = getOSType!("stop");
		const __keyDisposeTokenProc = getOSType!("xtok");
		const __keyAECompareProc = getOSType!("cmpr");
		const __keyAECountProc = getOSType!("cont");
		const __keyAEMarkTokenProc = getOSType!("mkid");
		const __keyAEMarkProc = getOSType!("mark");
		const __keyAEAdjustMarksProc = getOSType!("adjm");
		const __keyAEGetErrDescProc = getOSType!("indc");

	}
}

// This is needed otherwise the enums will fail compiling with gdc
version (GNU)
{
	private
	{
		const __formAbsolutePosition = getOSType!("indx");
		const __formRelativePosition = getOSType!("rele");
		const __formTest = getOSType!("test");
		const __formRange = getOSType!("rang");
		const __formPropertyID = getOSType!("prop");
		const __formName = getOSType!("name");
		const __formUniqueID = getOSType!("ID  ");
		const __typeObjectSpecifier = getOSType!("obj ");
		const __typeObjectBeingExamined = getOSType!("exmn");
		const __typeCurrentContainer = getOSType!("ccnt");
		const __typeToken = getOSType!("toke");
		const __typeRelativeDescriptor = getOSType!("rel ");
		const __typeAbsoluteOrdinal = getOSType!("abso");
		const __typeIndexDescriptor = getOSType!("inde");
		const __typeRangeDescriptor = getOSType!("rang");
		const __typeLogicalDescriptor = getOSType!("logi");
		const __typeCompDescriptor = getOSType!("cmpd");
		const __typeOSLTokenList = getOSType!("ostl");

	}
}

// This is needed otherwise the enums will fail compiling with gdc
version (GNU)
{
	private
	{
		const __typeWhoseDescriptor = getOSType!("whos");
		const __formWhose = getOSType!("whos");
		const __typeWhoseRange = getOSType!("wrng");
		const __keyAEWhoseRangeStart = getOSType!("wstr");
		const __keyAEWhoseRangeStop = getOSType!("wstp");
		const __keyAEIndex = getOSType!("kidx");
		const __keyAETest = getOSType!("ktst");

	}
}

enum
{
	kAEAND = getOSType!("AND "),
	kAEOR = getOSType!("OR  "),
	kAENOT = getOSType!("NOT "),
	kAEFirst = getOSType!("firs"),
	kAELast = getOSType!("last"),
	kAEMiddle = getOSType!("midd"),
	kAEAny = getOSType!("any "),
	kAEAll = getOSType!("all "),
	kAENext = getOSType!("next"),
	kAEPrevious = getOSType!("prev"),
	keyAECompOperator = getOSType!("relo"),
	keyAELogicalTerms = getOSType!("term"),
	keyAELogicalOperator = getOSType!("logc"),
	keyAEObject1 = getOSType!("obj1"),
	keyAEObject2 = getOSType!("obj2"),
	keyAEDesiredClass = getOSType!("want"),
	keyAEContainer = getOSType!("from"),
	keyAEKeyForm = getOSType!("form"),
	keyAEKeyData = getOSType!("seld")
}

enum
{
	keyAERangeStart = getOSType!("star"),
	keyAERangeStop = getOSType!("stop"),
	keyDisposeTokenProc = getOSType!("xtok"),
	keyAECompareProc = getOSType!("cmpr"),
	keyAECountProc = getOSType!("cont"),
	keyAEMarkTokenProc = getOSType!("mkid"),
	keyAEMarkProc = getOSType!("mark"),
	keyAEAdjustMarksProc = getOSType!("adjm"),
	keyAEGetErrDescProc = getOSType!("indc")
}

enum
{
	formAbsolutePosition = getOSType!("indx"),
	formRelativePosition = getOSType!("rele"),
	formTest = getOSType!("test"),
	formRange = getOSType!("rang"),
	formPropertyID = getOSType!("prop"),
	formName = getOSType!("name"),
	formUniqueID = getOSType!("ID  "),
	typeObjectSpecifier = getOSType!("obj "),
	typeObjectBeingExamined = getOSType!("exmn"),
	typeCurrentContainer = getOSType!("ccnt"),
	typeToken = getOSType!("toke"),
	typeRelativeDescriptor = getOSType!("rel "),
	typeAbsoluteOrdinal = getOSType!("abso"),
	typeIndexDescriptor = getOSType!("inde"),
	typeRangeDescriptor = getOSType!("rang"),
	typeLogicalDescriptor = getOSType!("logi"),
	typeCompDescriptor = getOSType!("cmpd"),
	typeOSLTokenList = getOSType!("ostl")
}

enum
{
	kAEIDoMinimum = 0x0000,
	kAEIDoWhose = 0x0001,
	kAEIDoMarking = 0x0004,
	kAEPassSubDescs = 0x0008,
	kAEResolveNestedLists = 0x0010,
	kAEHandleSimpleRanges = 0x0020,
	kAEUseRelativeIterators = 0x0040
}

enum
{
	typeWhoseDescriptor = getOSType!("whos"),
	formWhose = getOSType!("whos"),
	typeWhoseRange = getOSType!("wrng"),
	keyAEWhoseRangeStart = getOSType!("wstr"),
	keyAEWhoseRangeStop = getOSType!("wstp"),
	keyAEIndex = getOSType!("kidx"),
	keyAETest = getOSType!("ktst")
}

struct ccntTokenRecord
{
	uint tokenClass;
	AEDesc token;
}

extern (C)
{
	OSLAccessorUPP NewOSLAccessorUPP (OSLAccessorProcPtr userRoutine);
	OSLCompareUPP NewOSLCompareUPP (OSLCompareProcPtr userRoutine);
	OSLCountUPP NewOSLCountUPP (OSLCountProcPtr userRoutine);
	OSLDisposeTokenUPP NewOSLDisposeTokenUPP (OSLDisposeTokenProcPtr userRoutine);
	OSLGetMarkTokenUPP NewOSLGetMarkTokenUPP (OSLGetMarkTokenProcPtr userRoutine);
	OSLGetErrDescUPP NewOSLGetErrDescUPP (OSLGetErrDescProcPtr userRoutine);
	OSLMarkUPP NewOSLMarkUPP (OSLMarkProcPtr userRoutine);
	OSLAdjustMarksUPP NewOSLAdjustMarksUPP (OSLAdjustMarksProcPtr userRoutine);
	void DisposeOSLAccessorUPP (OSLAccessorUPP userUPP);
	void DisposeOSLCompareUPP (OSLCompareUPP userUPP);
	void DisposeOSLCountUPP (OSLCountUPP userUPP);
	void DisposeOSLDisposeTokenUPP (OSLDisposeTokenUPP userUPP);
	void DisposeOSLGetMarkTokenUPP (OSLGetMarkTokenUPP userUPP);
	void DisposeOSLGetErrDescUPP (OSLGetErrDescUPP userUPP);
	void DisposeOSLMarkUPP (OSLMarkUPP userUPP);
	void DisposeOSLAdjustMarksUPP (OSLAdjustMarksUPP userUPP);
	short InvokeOSLAccessorUPP (uint desiredClass, AEDesc* container, uint containerClass, uint form, AEDesc* selectionData, AEDesc* value, int accessorRefcon, OSLAccessorUPP userUPP);
	short InvokeOSLCompareUPP (uint oper, AEDesc* obj1, AEDesc* obj2, char* result, OSLCompareUPP userUPP);
	short InvokeOSLCountUPP (uint desiredType, uint containerClass, AEDesc* container, long* result, OSLCountUPP userUPP);
	short InvokeOSLDisposeTokenUPP (AEDesc* unneededToken, OSLDisposeTokenUPP userUPP);
	short InvokeOSLGetMarkTokenUPP (AEDesc* dContainerToken, uint containerClass, AEDesc* result, OSLGetMarkTokenUPP userUPP);
	short InvokeOSLGetErrDescUPP (AEDesc** appDescPtr, OSLGetErrDescUPP userUPP);
	short InvokeOSLMarkUPP (AEDesc* dToken, AEDesc* markToken, int index, OSLMarkUPP userUPP);
	short InvokeOSLAdjustMarksUPP (int newStart, int newStop, AEDesc* markToken, OSLAdjustMarksUPP userUPP);
	short AEObjectInit ();
	short AESetObjectCallbacks (OSLCompareUPP myCompareProc, OSLCountUPP myCountProc, OSLDisposeTokenUPP myDisposeTokenProc, OSLGetMarkTokenUPP myGetMarkTokenProc, OSLMarkUPP myMarkProc, OSLAdjustMarksUPP myAdjustMarksProc, OSLGetErrDescUPP myGetErrDescProcPtr);
	short AEResolve (AEDesc* objectSpecifier, short callbackFlags, AEDesc* theToken);
	short AEInstallObjectAccessor (uint desiredClass, uint containerType, OSLAccessorUPP theAccessor, int accessorRefcon, ubyte isSysHandler);
	short AERemoveObjectAccessor (uint desiredClass, uint containerType, OSLAccessorUPP theAccessor, ubyte isSysHandler);
	short AEGetObjectAccessor (uint desiredClass, uint containerType, OSLAccessorUPP* accessor, SRefCon* accessorRefcon, ubyte isSysHandler);
	short AEDisposeToken (AEDesc* theToken);
	short AECallObjectAccessor (uint desiredClass, AEDesc* containerToken, uint containerClass, uint keyForm, AEDesc* keyData, AEDesc* token);
}