1 /* NAME:
2 QD3DExtension.c
3
4 DESCRIPTION:
5 Entry point for Quesa API calls. Performs parameter checking and
6 then forwards each API call to the equivalent E3xxxxx routine.
7
8 COPYRIGHT:
9 Copyright (c) 1999-2004, Quesa Developers. All rights reserved.
10
11 For the current release of Quesa, please see:
12
13 <http://www.quesa.org/>
14
15 Redistribution and use in source and binary forms, with or without
16 modification, are permitted provided that the following conditions
17 are met:
18
19 o Redistributions of source code must retain the above copyright
20 notice, this list of conditions and the following disclaimer.
21
22 o Redistributions in binary form must reproduce the above
23 copyright notice, this list of conditions and the following
24 disclaimer in the documentation and/or other materials provided
25 with the distribution.
26
27 o Neither the name of Quesa nor the names of its contributors
28 may be used to endorse or promote products derived from this
29 software without specific prior written permission.
30
31 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
32 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
33 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
34 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
35 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
36 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
37 TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
38 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
39 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
40 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
41 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 ___________________________________________________________________________
43 */
44 //=============================================================================
45 // Include files
46 //-----------------------------------------------------------------------------
47 #include "E3Prefix.h"
48 #include "E3Extension.h"
49
50
51
52
53
54 //=============================================================================
55 // Internal constants
56 //-----------------------------------------------------------------------------
57 // Internal constants go here
58
59
60
61
62
63 //=============================================================================
64 // Internal types
65 //-----------------------------------------------------------------------------
66 // Internal types go here
67
68
69
70
71
72 //=============================================================================
73 // Internal macros
74 //-----------------------------------------------------------------------------
75 // Internal macros go here
76
77
78
79
80
81 //=============================================================================
82 // Public functions
83 //-----------------------------------------------------------------------------
84 // Q3XObjectHierarchy_RegisterClass : Quesa API entry point.
85 //-----------------------------------------------------------------------------
86 TQ3XObjectClass
Q3XObjectHierarchy_RegisterClass(TQ3ObjectType parentType,TQ3ObjectType * objectType,const char * objectName,TQ3XMetaHandler metaHandler,TQ3XMetaHandler virtualMetaHandler,TQ3Uns32 methodsSize,TQ3Uns32 instanceSize)87 Q3XObjectHierarchy_RegisterClass(TQ3ObjectType parentType, TQ3ObjectType *objectType,
88 const char *objectName, TQ3XMetaHandler metaHandler,
89 TQ3XMetaHandler virtualMetaHandler, TQ3Uns32 methodsSize, TQ3Uns32 instanceSize)
90 {
91
92
93 // Release build checks
94 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(objectType), NULL);
95 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(objectName), NULL);
96
97
98
99 // Debug build checks
100 #if Q3_DEBUG
101 if (0) // Further checks on parentType
102 return(NULL);
103
104 if (0) // Further checks on objectType
105 return(NULL);
106
107 if (0) // Further checks on objectName
108 return(NULL);
109
110 if (0) // Further checks on metaHandler
111 return(NULL);
112
113 if (0) // Further checks on virtualMetaHandler
114 return(NULL);
115
116 if (0) // Further checks on methodsSize
117 return(NULL);
118
119 if (0) // Further checks on instanceSize
120 return(NULL);
121 #endif
122
123
124
125 // Call the bottleneck
126 E3System_Bottleneck();
127
128
129
130 // Call our implementation
131 return(E3XObjectHierarchy_RegisterClass(parentType, objectType, objectName,
132 metaHandler, virtualMetaHandler, methodsSize, instanceSize));
133 }
134
135
136
137
138
139 //=============================================================================
140 // Q3XObjectHierarchy_UnregisterClass : Quesa API entry point.
141 //-----------------------------------------------------------------------------
142 TQ3Status
Q3XObjectHierarchy_UnregisterClass(TQ3XObjectClass objectClass)143 Q3XObjectHierarchy_UnregisterClass(TQ3XObjectClass objectClass)
144 {
145
146
147 // Release build checks
148 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(objectClass), kQ3Failure);
149
150
151
152 // Debug build checks
153 #if Q3_DEBUG
154 if (0) // Further checks on objectClass
155 return(kQ3Failure);
156 #endif
157
158
159
160 // Call the bottleneck
161 E3System_Bottleneck();
162
163
164
165 // Call our implementation
166 return(E3XObjectHierarchy_UnregisterClass(objectClass));
167 }
168
169
170
171
172
173 //=============================================================================
174 // Q3XObjectClass_GetMethod : Quesa API entry point.
175 //-----------------------------------------------------------------------------
176 TQ3XFunctionPointer
Q3XObjectClass_GetMethod(TQ3XObjectClass objectClass,TQ3XMethodType methodType)177 Q3XObjectClass_GetMethod(TQ3XObjectClass objectClass, TQ3XMethodType methodType)
178 {
179
180
181 // Release build checks
182
183
184
185 // Debug build checks
186 #if Q3_DEBUG
187 if (0) // Further checks on objectClass
188 return(NULL);
189
190 if (0) // Further checks on methodType
191 return(NULL);
192 #endif
193
194
195
196 // Call the bottleneck
197 E3System_Bottleneck();
198
199
200
201 // Call our implementation
202 return(E3XObjectClass_GetMethod(objectClass, methodType));
203 }
204
205
206
207
208
209 //=============================================================================
210 // Q3XObjectHierarchy_NewObject : Quesa API entry point.
211 //-----------------------------------------------------------------------------
212 TQ3Object
Q3XObjectHierarchy_NewObject(TQ3XObjectClass objectClass,void * parameters)213 Q3XObjectHierarchy_NewObject(TQ3XObjectClass objectClass, void *parameters)
214 {
215
216
217 // Release build checks
218
219
220
221 // Debug build checks
222 #if Q3_DEBUG
223 if (0) // Further checks on objectClass
224 return(NULL);
225
226 if (0) // Further checks on parameters
227 return(NULL);
228 #endif
229
230
231
232 // Call the bottleneck
233 E3System_Bottleneck();
234
235
236
237 // Call our implementation
238 return(E3XObjectHierarchy_NewObject(objectClass, parameters));
239 }
240
241
242
243
244
245 //=============================================================================
246 // Q3XObjectClass_GetLeafType : Quesa API entry point.
247 //-----------------------------------------------------------------------------
248 TQ3ObjectType
Q3XObjectClass_GetLeafType(TQ3XObjectClass objectClass)249 Q3XObjectClass_GetLeafType(TQ3XObjectClass objectClass)
250 {
251
252
253 // Release build checks
254
255
256
257 // Debug build checks
258 #if Q3_DEBUG
259 if (0) // Further checks on objectClass
260 return(kQ3ObjectTypeInvalid);
261 #endif
262
263
264
265 // Call the bottleneck
266 E3System_Bottleneck();
267
268
269
270 // Call our implementation
271 return(E3XObjectClass_GetLeafType(objectClass));
272 }
273
274
275
276
277
278 //=============================================================================
279 // Q3XObjectHierarchy_GetClassVersion : Quesa API entry point.
280 //-----------------------------------------------------------------------------
281 TQ3Status
Q3XObjectHierarchy_GetClassVersion(TQ3ObjectType objectClassType,TQ3XObjectClassVersion * version)282 Q3XObjectHierarchy_GetClassVersion(TQ3ObjectType objectClassType, TQ3XObjectClassVersion *version)
283 {
284
285
286 // Release build checks
287 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(version), kQ3Failure);
288
289
290
291 // Debug build checks
292 #if Q3_DEBUG
293 if (0) // Further checks on objectClassType
294 return(kQ3Failure);
295
296 if (0) // Further checks on version
297 return(kQ3Failure);
298 #endif
299
300
301
302 // Call the bottleneck
303 E3System_Bottleneck();
304
305
306
307 // Call our implementation
308 return(E3XObjectHierarchy_GetClassVersion(objectClassType, version));
309 }
310
311
312
313
314
315 //=============================================================================
316 // Q3XObjectClass_GetType : Quesa API entry point.
317 //-----------------------------------------------------------------------------
318 TQ3Status
Q3XObjectClass_GetType(TQ3XObjectClass objectClass,TQ3ObjectType * theType)319 Q3XObjectClass_GetType(TQ3XObjectClass objectClass, TQ3ObjectType *theType)
320 {
321
322
323 // Release build checks
324 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(theType), kQ3Failure);
325
326
327
328 // Debug build checks
329 #if Q3_DEBUG
330 if (0) // Further checks on objectClass
331 return(kQ3Failure);
332
333 if (0) // Further checks on theType
334 return(kQ3Failure);
335 #endif
336
337
338
339 // Call the bottleneck
340 E3System_Bottleneck();
341
342
343
344 // Call our implementation
345 return(E3XObjectClass_GetType(objectClass, theType));
346 }
347
348
349
350
351
352 //=============================================================================
353 // Q3XObjectHierarchy_FindClassByType : Quesa API entry point.
354 //-----------------------------------------------------------------------------
355 TQ3XObjectClass
Q3XObjectHierarchy_FindClassByType(TQ3ObjectType theType)356 Q3XObjectHierarchy_FindClassByType(TQ3ObjectType theType)
357 {
358
359
360 // Release build checks
361
362
363
364 // Debug build checks
365 #if Q3_DEBUG
366 if (0) // Further checks on theType
367 return(NULL);
368 #endif
369
370
371
372 // Call the bottleneck
373 E3System_Bottleneck();
374
375
376
377 // Call our implementation
378 return(E3XObjectHierarchy_FindClassByType(theType));
379 }
380
381
382
383
384
385 //=============================================================================
386 // Q3XObjectClass_GetPrivate : Quesa API entry point.
387 //-----------------------------------------------------------------------------
388 void *
Q3XObjectClass_GetPrivate(TQ3XObjectClass objectClass,TQ3Object targetObject)389 Q3XObjectClass_GetPrivate(TQ3XObjectClass objectClass, TQ3Object targetObject)
390 {
391
392
393 // Release build checks
394 Q3_REQUIRE_OR_RESULT(targetObject->IsObjectValid (), NULL);
395
396
397
398 // Debug build checks
399 #if Q3_DEBUG
400 if (0) // Further checks on objectClass
401 return(NULL);
402
403 if (0) // Further checks on targetObject
404 return(NULL);
405 #endif
406
407
408
409 // Call the bottleneck
410 E3System_Bottleneck();
411
412
413
414 // Call our implementation
415 return(E3XObjectClass_GetPrivate(objectClass, targetObject));
416 }
417
418
419
420
421
422 //=============================================================================
423 // Q3XObject_GetClass : Quesa API entry point.
424 //-----------------------------------------------------------------------------
425 TQ3XObjectClass
Q3XObject_GetClass(TQ3Object object)426 Q3XObject_GetClass(TQ3Object object)
427 {
428
429
430 // Release build checks
431 Q3_REQUIRE_OR_RESULT(object->IsObjectValid (), NULL);
432
433
434
435 // Debug build checks
436 #if Q3_DEBUG
437 if (0) // Further checks on object
438 return(NULL);
439 #endif
440
441
442
443 // Call the bottleneck
444 E3System_Bottleneck();
445
446
447
448 // Call our implementation
449 return(E3XObject_GetClass(object));
450 }
451
452
453
454
455
456 //=============================================================================
457 // Q3XSharedLibrary_Register : Quesa API entry point.
458 //-----------------------------------------------------------------------------
459 TQ3Status
Q3XSharedLibrary_Register(TQ3XSharedLibraryInfo * sharedLibraryInfo)460 Q3XSharedLibrary_Register(TQ3XSharedLibraryInfo *sharedLibraryInfo)
461 {
462
463
464 // Release build checks
465 Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(sharedLibraryInfo), kQ3Failure);
466
467
468
469 // Debug build checks
470 #if Q3_DEBUG
471 if (0) // Further checks on sharedLibraryInfo
472 return(kQ3Failure);
473 #endif
474
475
476
477 // Call the bottleneck
478 E3System_Bottleneck();
479
480
481
482 // Call our implementation
483 return(E3XSharedLibrary_Register(sharedLibraryInfo));
484 }
485
486
487
488
489
490 //=============================================================================
491 // Q3XSharedLibrary_Unregister : Quesa API entry point.
492 //-----------------------------------------------------------------------------
493 TQ3Status
Q3XSharedLibrary_Unregister(TQ3Uns32 sharedLibrary)494 Q3XSharedLibrary_Unregister(TQ3Uns32 sharedLibrary)
495 {
496
497
498 // Release build checks
499
500
501
502 // Debug build checks
503 #if Q3_DEBUG
504 if (0) // Further checks on sharedLibrary
505 return(kQ3Failure);
506 #endif
507
508
509
510 // Call the bottleneck
511 E3System_Bottleneck();
512
513
514
515 // Call our implementation
516 return(E3XSharedLibrary_Unregister(sharedLibrary));
517 }
518
519
520
521
522
523 //=============================================================================
524 // Q3XError_Post : Quesa API entry point.
525 //-----------------------------------------------------------------------------
526 void
Q3XError_Post(TQ3Error error)527 Q3XError_Post(TQ3Error error)
528 {
529
530
531 // Release build checks
532
533
534
535 // Debug build checks
536 #if Q3_DEBUG
537 if (0) // Further checks on error
538 return;
539 #endif
540
541
542
543 // Call the bottleneck
544 E3System_Bottleneck();
545
546
547
548 // Call our implementation
549 E3XError_Post(error);
550 }
551
552
553
554
555
556 //=============================================================================
557 // Q3XWarning_Post : Quesa API entry point.
558 //-----------------------------------------------------------------------------
559 void
Q3XWarning_Post(TQ3Warning warning)560 Q3XWarning_Post(TQ3Warning warning)
561 {
562
563
564 // Release build checks
565
566
567
568 // Debug build checks
569 #if Q3_DEBUG
570 if (0) // Further checks on warning
571 return;
572 #endif
573
574
575
576 // Call the bottleneck
577 E3System_Bottleneck();
578
579
580
581 // Call our implementation
582 E3XWarning_Post(warning);
583 }
584
585
586
587
588
589 //=============================================================================
590 // Q3XNotice_Post : Quesa API entry point.
591 //-----------------------------------------------------------------------------
592 void
Q3XNotice_Post(TQ3Notice notice)593 Q3XNotice_Post(TQ3Notice notice)
594 {
595
596
597 // Release build checks
598
599
600
601 // Debug build checks
602 #if Q3_DEBUG
603 if (0) // Further checks on notice
604 return;
605 #endif
606
607
608
609 // Call the bottleneck
610 E3System_Bottleneck();
611
612
613
614 // Call our implementation
615 E3XNotice_Post(notice);
616 }
617
618
619
620
621
622 //=============================================================================
623 // Q3XMacintoshError_Post : Quesa API entry point.
624 //-----------------------------------------------------------------------------
625 #if QUESA_OS_MACINTOSH
626 void
Q3XMacintoshError_Post(OSErr macOSErr)627 Q3XMacintoshError_Post(OSErr macOSErr)
628 {
629
630
631 // Call our implementation
632 E3XMacintoshError_Post(macOSErr);
633 }
634 #endif
635
636
637
638
639