view dstep/coreservices/carboncore/MixedMode.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.carboncore.MixedMode;

//import dstep.AvailabilityMacros;
import dstep.coreservices.carboncore.MacTypes;
import dstep.internal.Types;

alias ushort CallingConventionType;
alias byte ISAType;
alias byte RTAType;
alias ushort registerSelectorType;
alias uint ProcInfoType;
alias ushort RoutineFlagsType;
alias RoutineRecord* RoutineRecordPtr;
alias RoutineRecordPtr* RoutineRecordHandle;
alias ubyte RDFlagsType;
alias RoutineDescriptor* RoutineDescriptorPtr;
alias RoutineDescriptorPtr* RoutineDescriptorHandle;

enum
{
	kRoutineDescriptorVersion = 7
}

enum
{
	_MixedModeMagic = 0xAAFE
}

enum
{
	kCurrentMixedModeStateRecord = 1
}

enum
{
	kPascalStackBased = 0,
	kCStackBased = 1,
	kRegisterBased = 2,
	kD0DispatchedPascalStackBased = 8,
	kD1DispatchedPascalStackBased = 12,
	kD0DispatchedCStackBased = 9,
	kStackDispatchedPascalStackBased = 14,
	kThinkCStackBased = 5
}

enum
{
	kM68kISA = 0,
	kPowerPCISA = 1
}

enum
{
	kX86ISA = 2
}

enum
{
	kOld68kRTA = 0 << 4,
	kPowerPCRTA = 0 << 4,
	kCFM68kRTA = 1 << 4
}

enum
{
	kX86RTA = 2 << 4
}

enum
{
	kRegisterD0 = 0,
	kRegisterD1 = 1,
	kRegisterD2 = 2,
	kRegisterD3 = 3,
	kRegisterD4 = 8,
	kRegisterD5 = 9,
	kRegisterD6 = 10,
	kRegisterD7 = 11,
	kRegisterA0 = 4,
	kRegisterA1 = 5,
	kRegisterA2 = 6,
	kRegisterA3 = 7,
	kRegisterA4 = 12,
	kRegisterA5 = 13,
	kRegisterA6 = 14,
	kCCRegisterCBit = 16,
	kCCRegisterVBit = 17,
	kCCRegisterZBit = 18,
	kCCRegisterNBit = 19,
	kCCRegisterXBit = 20
}

enum
{
	kNoByteCode = 0,
	kOneByteCode = 1,
	kTwoByteCode = 2,
	kFourByteCode = 3
}

enum
{
	kProcDescriptorIsAbsolute = 0x00,
	kProcDescriptorIsRelative = 0x01
}

enum
{
	kFragmentIsPrepared = 0x00,
	kFragmentNeedsPreparing = 0x02
}

enum
{
	kUseCurrentISA = 0x00,
	kUseNativeISA = 0x04
}

enum
{
	kPassSelector = 0x00,
	kDontPassSelector = 0x08
}

enum
{
	kRoutineIsNotDispatchedDefaultRoutine = 0x00,
	kRoutineIsDispatchedDefaultRoutine = 0x10
}

enum
{
	kProcDescriptorIsProcPtr = 0x00,
	kProcDescriptorIsIndex = 0x20
}

enum
{
	kSelectorsAreNotIndexable = 0x00,
	kSelectorsAreIndexable = 0x01
}

enum
{
	kCallingConventionWidth = 4,
	kCallingConventionPhase = 0,
	kCallingConventionMask = 0x0F,
	kResultSizeWidth = 2,
	kResultSizePhase = kCallingConventionWidth,
	kResultSizeMask = 0x30,
	kStackParameterWidth = 2,
	kStackParameterPhase = (kCallingConventionWidth + kResultSizeWidth),
	kStackParameterMask = cast(c_long)0xFFFFFFC0,
	kRegisterResultLocationWidth = 5,
	kRegisterResultLocationPhase = (kCallingConventionWidth + kResultSizeWidth),
	kRegisterParameterWidth = 5,
	kRegisterParameterPhase = (kCallingConventionWidth + kResultSizeWidth + kRegisterResultLocationWidth),
	kRegisterParameterMask = 0x7FFFF800,
	kRegisterParameterSizePhase = 0,
	kRegisterParameterSizeWidth = 2,
	kRegisterParameterWhichPhase = kRegisterParameterSizeWidth,
	kRegisterParameterWhichWidth = 3,
	kDispatchedSelectorSizeWidth = 2,
	kDispatchedSelectorSizePhase = (kCallingConventionWidth + kResultSizeWidth),
	kDispatchedParameterPhase = (kCallingConventionWidth + kResultSizeWidth + kDispatchedSelectorSizeWidth),
	kSpecialCaseSelectorWidth = 6,
	kSpecialCaseSelectorPhase = kCallingConventionWidth,
	kSpecialCaseSelectorMask = 0x03F0
}

enum
{
	kSpecialCase = 0x000F
}

enum
{
	kSpecialCaseHighHook = 0,
	kSpecialCaseCaretHook = 0,
	kSpecialCaseEOLHook = 1,
	kSpecialCaseWidthHook = 2,
	kSpecialCaseTextWidthHook = 2,
	kSpecialCaseNWidthHook = 3,
	kSpecialCaseDrawHook = 4,
	kSpecialCaseHitTestHook = 5,
	kSpecialCaseTEFindWord = 6,
	kSpecialCaseProtocolHandler = 7,
	kSpecialCaseSocketListener = 8,
	kSpecialCaseTERecalc = 9,
	kSpecialCaseTEDoText = 10,
	kSpecialCaseGNEFilterProc = 11,
	kSpecialCaseMBarHook = 12
}

struct RoutineRecord
{
	uint procInfo;
	byte reserved1;
	byte ISA;
	ushort routineFlags;
	ProcPtr procDescriptor;
	uint reserved2;
	uint selector;
}


struct RoutineDescriptor
{
	ushort goMixedModeTrap;
	byte version_;
	ubyte routineDescriptorFlags;
	uint reserved1;
	ubyte reserved2;
	ubyte selectorInfo;
	ushort routineCount;
	RoutineRecord* routineRecords;
}


struct MixedModeStateRecord
{
	uint state1;
	uint state2;
	uint state3;
	uint state4;
}