comparison 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
comparison
equal deleted inserted replaced
10:27e00625790b 11:07194b026fa4
1 /**
2 * Copyright: Copyright (c) 2009 Jacob Carlborg.
3 * Authors: Jacob Carlborg
4 * Version: Initial created: Jul 21, 2009
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
6 */
7 module dstep.coreservices.carboncore.MixedMode;
8
9 //import dstep.AvailabilityMacros;
10 import dstep.coreservices.carboncore.MacTypes;
11 import dstep.internal.Types;
12
13 alias ushort CallingConventionType;
14 alias byte ISAType;
15 alias byte RTAType;
16 alias ushort registerSelectorType;
17 alias uint ProcInfoType;
18 alias ushort RoutineFlagsType;
19 alias RoutineRecord* RoutineRecordPtr;
20 alias RoutineRecordPtr* RoutineRecordHandle;
21 alias ubyte RDFlagsType;
22 alias RoutineDescriptor* RoutineDescriptorPtr;
23 alias RoutineDescriptorPtr* RoutineDescriptorHandle;
24
25 enum
26 {
27 kRoutineDescriptorVersion = 7
28 }
29
30 enum
31 {
32 _MixedModeMagic = 0xAAFE
33 }
34
35 enum
36 {
37 kCurrentMixedModeStateRecord = 1
38 }
39
40 enum
41 {
42 kPascalStackBased = 0,
43 kCStackBased = 1,
44 kRegisterBased = 2,
45 kD0DispatchedPascalStackBased = 8,
46 kD1DispatchedPascalStackBased = 12,
47 kD0DispatchedCStackBased = 9,
48 kStackDispatchedPascalStackBased = 14,
49 kThinkCStackBased = 5
50 }
51
52 enum
53 {
54 kM68kISA = 0,
55 kPowerPCISA = 1
56 }
57
58 enum
59 {
60 kX86ISA = 2
61 }
62
63 enum
64 {
65 kOld68kRTA = 0 << 4,
66 kPowerPCRTA = 0 << 4,
67 kCFM68kRTA = 1 << 4
68 }
69
70 enum
71 {
72 kX86RTA = 2 << 4
73 }
74
75 enum
76 {
77 kRegisterD0 = 0,
78 kRegisterD1 = 1,
79 kRegisterD2 = 2,
80 kRegisterD3 = 3,
81 kRegisterD4 = 8,
82 kRegisterD5 = 9,
83 kRegisterD6 = 10,
84 kRegisterD7 = 11,
85 kRegisterA0 = 4,
86 kRegisterA1 = 5,
87 kRegisterA2 = 6,
88 kRegisterA3 = 7,
89 kRegisterA4 = 12,
90 kRegisterA5 = 13,
91 kRegisterA6 = 14,
92 kCCRegisterCBit = 16,
93 kCCRegisterVBit = 17,
94 kCCRegisterZBit = 18,
95 kCCRegisterNBit = 19,
96 kCCRegisterXBit = 20
97 }
98
99 enum
100 {
101 kNoByteCode = 0,
102 kOneByteCode = 1,
103 kTwoByteCode = 2,
104 kFourByteCode = 3
105 }
106
107 enum
108 {
109 kProcDescriptorIsAbsolute = 0x00,
110 kProcDescriptorIsRelative = 0x01
111 }
112
113 enum
114 {
115 kFragmentIsPrepared = 0x00,
116 kFragmentNeedsPreparing = 0x02
117 }
118
119 enum
120 {
121 kUseCurrentISA = 0x00,
122 kUseNativeISA = 0x04
123 }
124
125 enum
126 {
127 kPassSelector = 0x00,
128 kDontPassSelector = 0x08
129 }
130
131 enum
132 {
133 kRoutineIsNotDispatchedDefaultRoutine = 0x00,
134 kRoutineIsDispatchedDefaultRoutine = 0x10
135 }
136
137 enum
138 {
139 kProcDescriptorIsProcPtr = 0x00,
140 kProcDescriptorIsIndex = 0x20
141 }
142
143 enum
144 {
145 kSelectorsAreNotIndexable = 0x00,
146 kSelectorsAreIndexable = 0x01
147 }
148
149 enum
150 {
151 kCallingConventionWidth = 4,
152 kCallingConventionPhase = 0,
153 kCallingConventionMask = 0x0F,
154 kResultSizeWidth = 2,
155 kResultSizePhase = kCallingConventionWidth,
156 kResultSizeMask = 0x30,
157 kStackParameterWidth = 2,
158 kStackParameterPhase = (kCallingConventionWidth + kResultSizeWidth),
159 kStackParameterMask = cast(c_long)0xFFFFFFC0,
160 kRegisterResultLocationWidth = 5,
161 kRegisterResultLocationPhase = (kCallingConventionWidth + kResultSizeWidth),
162 kRegisterParameterWidth = 5,
163 kRegisterParameterPhase = (kCallingConventionWidth + kResultSizeWidth + kRegisterResultLocationWidth),
164 kRegisterParameterMask = 0x7FFFF800,
165 kRegisterParameterSizePhase = 0,
166 kRegisterParameterSizeWidth = 2,
167 kRegisterParameterWhichPhase = kRegisterParameterSizeWidth,
168 kRegisterParameterWhichWidth = 3,
169 kDispatchedSelectorSizeWidth = 2,
170 kDispatchedSelectorSizePhase = (kCallingConventionWidth + kResultSizeWidth),
171 kDispatchedParameterPhase = (kCallingConventionWidth + kResultSizeWidth + kDispatchedSelectorSizeWidth),
172 kSpecialCaseSelectorWidth = 6,
173 kSpecialCaseSelectorPhase = kCallingConventionWidth,
174 kSpecialCaseSelectorMask = 0x03F0
175 }
176
177 enum
178 {
179 kSpecialCase = 0x000F
180 }
181
182 enum
183 {
184 kSpecialCaseHighHook = 0,
185 kSpecialCaseCaretHook = 0,
186 kSpecialCaseEOLHook = 1,
187 kSpecialCaseWidthHook = 2,
188 kSpecialCaseTextWidthHook = 2,
189 kSpecialCaseNWidthHook = 3,
190 kSpecialCaseDrawHook = 4,
191 kSpecialCaseHitTestHook = 5,
192 kSpecialCaseTEFindWord = 6,
193 kSpecialCaseProtocolHandler = 7,
194 kSpecialCaseSocketListener = 8,
195 kSpecialCaseTERecalc = 9,
196 kSpecialCaseTEDoText = 10,
197 kSpecialCaseGNEFilterProc = 11,
198 kSpecialCaseMBarHook = 12
199 }
200
201 struct RoutineRecord
202 {
203 uint procInfo;
204 byte reserved1;
205 byte ISA;
206 ushort routineFlags;
207 ProcPtr procDescriptor;
208 uint reserved2;
209 uint selector;
210 }
211
212
213 struct RoutineDescriptor
214 {
215 ushort goMixedModeTrap;
216 byte version_;
217 ubyte routineDescriptorFlags;
218 uint reserved1;
219 ubyte reserved2;
220 ubyte selectorInfo;
221 ushort routineCount;
222 RoutineRecord* routineRecords;
223 }
224
225
226 struct MixedModeStateRecord
227 {
228 uint state1;
229 uint state2;
230 uint state3;
231 uint state4;
232 }
233