1 /*  NAME:
2         QD3DStorage.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-2005, 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 "E3Storage.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 //      Q3Storage_GetType : Quesa API entry point.
85 //-----------------------------------------------------------------------------
86 TQ3ObjectType
Q3Storage_GetType(TQ3StorageObject storage)87 Q3Storage_GetType(TQ3StorageObject storage)
88 {
89 
90 
91 	// Release build checks
92 	Q3_REQUIRE_OR_RESULT( E3Storage::IsOfMyClass ( storage ), kQ3ObjectTypeInvalid);
93 
94 
95 
96 	// Debug build checks
97 #if Q3_DEBUG
98 	if (0) // Further checks on storage
99 		return(kQ3ObjectTypeInvalid);
100 #endif
101 
102 
103 
104 	// Call the bottleneck
105 	E3System_Bottleneck();
106 
107 
108 
109 	// Call our implementation
110 	return ( (E3Storage*) storage )->GetType () ;
111 }
112 
113 
114 
115 
116 
117 //=============================================================================
118 //      Q3Storage_GetSize : Quesa API entry point.
119 //-----------------------------------------------------------------------------
120 TQ3Status
Q3Storage_GetSize(TQ3StorageObject storage,TQ3Uns32 * size)121 Q3Storage_GetSize(TQ3StorageObject storage, TQ3Uns32 *size)
122 {
123 
124 
125 	// Release build checks
126 	Q3_REQUIRE_OR_RESULT( E3Storage::IsOfMyClass ( storage ), kQ3Failure);
127 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(size), kQ3Failure);
128 
129 
130 
131 	// Debug build checks
132 #if Q3_DEBUG
133 	if (0) // Further checks on storage
134 		return(kQ3Failure);
135 
136 	if (0) // Further checks on size
137 		return(kQ3Failure);
138 #endif
139 
140 
141 
142 	// Call the bottleneck
143 	E3System_Bottleneck();
144 
145 
146 
147 	// Call our implementation
148 	return ( (E3Storage*) storage )->GetSize ( size ) ;
149 }
150 
151 
152 
153 
154 
155 //=============================================================================
156 //      Q3Storage_GetData : Quesa API entry point.
157 //-----------------------------------------------------------------------------
158 TQ3Status
Q3Storage_GetData(TQ3StorageObject storage,TQ3Uns32 offset,TQ3Uns32 dataSize,unsigned char * data,TQ3Uns32 * sizeRead)159 Q3Storage_GetData(TQ3StorageObject storage, TQ3Uns32 offset, TQ3Uns32 dataSize, unsigned char *data, TQ3Uns32 *sizeRead)
160 {
161 
162 
163 	// Release build checks
164 	Q3_REQUIRE_OR_RESULT( E3Storage::IsOfMyClass ( storage ), kQ3Failure);
165 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(data), kQ3Failure);
166 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(sizeRead), kQ3Failure);
167 
168 
169 
170 	// Debug build checks
171 #if Q3_DEBUG
172 	if (0) // Further checks on storage
173 		return(kQ3Failure);
174 
175 	if (0) // Further checks on offset
176 		return(kQ3Failure);
177 
178 	if (0) // Further checks on dataSize
179 		return(kQ3Failure);
180 
181 	if (0) // Further checks on data
182 		return(kQ3Failure);
183 
184 	if (0) // Further checks on sizeRead
185 		return(kQ3Failure);
186 #endif
187 
188 
189 
190 	// Call the bottleneck
191 	E3System_Bottleneck();
192 
193 
194 
195 	// Call our implementation
196 	return ( (E3Storage*) storage )->GetData ( offset, dataSize, data, sizeRead ) ;
197 }
198 
199 
200 
201 
202 
203 //=============================================================================
204 //      Q3Storage_SetData : Quesa API entry point.
205 //-----------------------------------------------------------------------------
206 TQ3Status
Q3Storage_SetData(TQ3StorageObject storage,TQ3Uns32 offset,TQ3Uns32 dataSize,const unsigned char * data,TQ3Uns32 * sizeWritten)207 Q3Storage_SetData(TQ3StorageObject storage, TQ3Uns32 offset, TQ3Uns32 dataSize, const unsigned char *data, TQ3Uns32 *sizeWritten)
208 {
209 
210 
211 	// Release build checks
212 	Q3_REQUIRE_OR_RESULT( E3Storage::IsOfMyClass ( storage ), kQ3Failure);
213 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(data), kQ3Failure);
214 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(sizeWritten), kQ3Failure);
215 
216 
217 
218 	// Debug build checks
219 #if Q3_DEBUG
220 	if (0) // Further checks on storage
221 		return(kQ3Failure);
222 
223 	if (0) // Further checks on offset
224 		return(kQ3Failure);
225 
226 	if (0) // Further checks on dataSize
227 		return(kQ3Failure);
228 
229 	if (0) // Further checks on data
230 		return(kQ3Failure);
231 
232 	if (0) // Further checks on sizeWritten
233 		return(kQ3Failure);
234 #endif
235 
236 
237 
238 	// Call the bottleneck
239 	E3System_Bottleneck();
240 
241 
242 
243 	// Call our implementation
244 	return ( (E3Storage*) storage )->SetData ( offset, dataSize, data, sizeWritten ) ;
245 }
246 
247 
248 
249 
250 
251 //=============================================================================
252 //      Q3MemoryStorage_GetType : Quesa API entry point.
253 //-----------------------------------------------------------------------------
254 TQ3ObjectType
Q3MemoryStorage_GetType(TQ3StorageObject storage)255 Q3MemoryStorage_GetType(TQ3StorageObject storage)
256 {
257 
258 
259 	// Release build checks
260 	Q3_REQUIRE_OR_RESULT( E3Storage::IsOfMyClass ( storage ), kQ3ObjectTypeInvalid);
261 
262 
263 
264 	// Debug build checks
265 #if Q3_DEBUG
266 	if (0) // Further checks on storage
267 		return(kQ3ObjectTypeInvalid);
268 #endif
269 
270 
271 
272 	// Call the bottleneck
273 	E3System_Bottleneck();
274 
275 
276 
277 	// Call our implementation
278 	return(E3MemoryStorage_GetType(storage));
279 }
280 
281 
282 
283 
284 
285 //=============================================================================
286 //      Q3MemoryStorage_New : Quesa API entry point.
287 //-----------------------------------------------------------------------------
288 TQ3StorageObject
Q3MemoryStorage_New(const unsigned char * buffer,TQ3Uns32 validSize)289 Q3MemoryStorage_New(const unsigned char *buffer, TQ3Uns32 validSize)
290 {
291 
292 
293 	// Release build checks
294 
295 
296 	// Debug build checks
297 #if Q3_DEBUG
298 	if (0) // Further checks on buffer
299 		return(NULL);
300 
301 	if (0) // Further checks on validSize
302 		return(NULL);
303 #endif
304 
305 
306 
307 	// Call the bottleneck
308 	E3System_Bottleneck();
309 
310 
311 
312 	// Call our implementation
313 	return(E3MemoryStorage_New(buffer, validSize));
314 }
315 
316 
317 
318 
319 
320 //=============================================================================
321 //      Q3MemoryStorage_Set : Quesa API entry point.
322 //-----------------------------------------------------------------------------
323 TQ3Status
Q3MemoryStorage_Set(TQ3StorageObject storage,const unsigned char * buffer,TQ3Uns32 validSize)324 Q3MemoryStorage_Set(TQ3StorageObject storage, const unsigned char *buffer, TQ3Uns32 validSize)
325 {
326 
327 
328 	// Release build checks
329 	Q3_REQUIRE_OR_RESULT( E3Storage::IsOfMyClass ( storage ), kQ3Failure);
330 	Q3_REQUIRE_OR_RESULT(Q3Object_GetLeafType(storage) == kQ3StorageTypeMemory, kQ3Failure);
331 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(buffer), kQ3Failure);
332 
333 
334 
335 	// Debug build checks
336 #if Q3_DEBUG
337 	if (0) // Further checks on storage
338 		return(kQ3Failure);
339 
340 	if (0) // Further checks on buffer
341 		return(kQ3Failure);
342 
343 	if (0) // Further checks on validSize
344 		return(kQ3Failure);
345 #endif
346 
347 
348 
349 	// Call the bottleneck
350 	E3System_Bottleneck();
351 
352 
353 
354 	// Call our implementation
355 	return ( (E3MemoryStorage*) storage )->Set ( buffer, validSize ) ;
356 }
357 
358 
359 
360 
361 
362 //=============================================================================
363 //      Q3MemoryStorage_NewBuffer : Quesa API entry point.
364 //-----------------------------------------------------------------------------
365 TQ3StorageObject
Q3MemoryStorage_NewBuffer(unsigned char * buffer,TQ3Uns32 validSize,TQ3Uns32 bufferSize)366 Q3MemoryStorage_NewBuffer(unsigned char *buffer, TQ3Uns32 validSize, TQ3Uns32 bufferSize)
367 {
368 
369 
370 	// Release build checks
371 	// Note, buffer is allowed to be NULL.
372 	Q3_REQUIRE_OR_RESULT( validSize <= bufferSize, NULL );
373 
374 
375 
376 	// Debug build checks
377 #if Q3_DEBUG
378 	if (0) // Further checks on buffer
379 		return(NULL);
380 
381 	if (0) // Further checks on validSize
382 		return(NULL);
383 
384 	if (0) // Further checks on bufferSize
385 		return(NULL);
386 #endif
387 
388 
389 
390 	// Call the bottleneck
391 	E3System_Bottleneck();
392 
393 
394 
395 	// Call our implementation
396 	return(E3MemoryStorage_NewBuffer(buffer, validSize, bufferSize));
397 }
398 
399 
400 
401 
402 
403 //=============================================================================
404 //      Q3MemoryStorage_SetBuffer : Quesa API entry point.
405 //-----------------------------------------------------------------------------
406 TQ3Status
Q3MemoryStorage_SetBuffer(TQ3StorageObject storage,unsigned char * buffer,TQ3Uns32 validSize,TQ3Uns32 bufferSize)407 Q3MemoryStorage_SetBuffer(TQ3StorageObject storage, unsigned char *buffer, TQ3Uns32 validSize, TQ3Uns32 bufferSize)
408 {
409 
410 
411 	// Release build checks
412 	Q3_REQUIRE_OR_RESULT( E3Storage::IsOfMyClass ( storage ), kQ3Failure);
413 	Q3_REQUIRE_OR_RESULT(Q3Object_GetLeafType(storage) == kQ3StorageTypeMemory, kQ3Failure);
414 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(buffer), kQ3Failure);
415 
416 
417 
418 	// Debug build checks
419 #if Q3_DEBUG
420 	if (0) // Further checks on storage
421 		return(kQ3Failure);
422 
423 	if (0) // Further checks on buffer
424 		return(kQ3Failure);
425 
426 	if (0) // Further checks on validSize
427 		return(kQ3Failure);
428 
429 	if (0) // Further checks on bufferSize
430 		return(kQ3Failure);
431 #endif
432 
433 
434 
435 	// Call the bottleneck
436 	E3System_Bottleneck();
437 
438 
439 
440 	// Call our implementation
441 	return ( (E3MemoryStorage*) storage )->SetBuffer ( buffer, validSize, bufferSize ) ;
442 }
443 
444 
445 
446 
447 
448 //=============================================================================
449 //      Q3MemoryStorage_GetBuffer : Quesa API entry point.
450 //-----------------------------------------------------------------------------
451 //		Note :	It's not correct going by the documentation, but the QD3D
452 //				Interactive Renderer calls this with several NULL parameters.
453 //-----------------------------------------------------------------------------
454 TQ3Status
Q3MemoryStorage_GetBuffer(TQ3StorageObject storage,unsigned char ** buffer,TQ3Uns32 * validSize,TQ3Uns32 * bufferSize)455 Q3MemoryStorage_GetBuffer(TQ3StorageObject storage, unsigned char **buffer, TQ3Uns32 *validSize, TQ3Uns32 *bufferSize)
456 {
457 
458 
459 	// Release build checks
460 	Q3_REQUIRE_OR_RESULT(Q3Object_GetLeafType(storage) == kQ3StorageTypeMemory, kQ3Failure);
461 
462 	if (buffer != NULL)
463 		Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(buffer), kQ3Failure);
464 
465 	if (validSize != NULL)
466 		Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(validSize), kQ3Failure);
467 
468 	if (bufferSize != NULL)
469 		Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(bufferSize), kQ3Failure);
470 
471 
472 
473 	// Debug build checks
474 #if Q3_DEBUG
475 	if (0) // Further checks on storage
476 		return(kQ3Failure);
477 
478 	if (0) // Further checks on buffer
479 		return(kQ3Failure);
480 
481 	if (0) // Further checks on validSize
482 		return(kQ3Failure);
483 
484 	if (0) // Further checks on bufferSize
485 		return(kQ3Failure);
486 #endif
487 
488 
489 
490 	// Call the bottleneck
491 	E3System_Bottleneck();
492 
493 
494 
495 	// Call our implementation
496 	return ( (E3MemoryStorage*) storage )->GetBuffer ( buffer, validSize, bufferSize ) ;
497 }
498 
499 
500 
501 
502 
503 //=============================================================================
504 //      Q3PathStorage_New : Quesa API entry point.
505 //-----------------------------------------------------------------------------
506 #if QUESA_ALLOW_QD3D_EXTENSIONS
507 TQ3StorageObject
Q3PathStorage_New(const char * pathName)508 Q3PathStorage_New(const char *pathName)
509 {
510 
511 
512 	// Release build checks
513 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(pathName), NULL);
514 
515 
516 
517 	// Debug build checks
518 #if Q3_DEBUG
519 	if (0) // Further checks on pathName
520 		return(NULL);
521 #endif
522 
523 
524 
525 	// Call the bottleneck
526 	E3System_Bottleneck();
527 
528 
529 
530 	// Call our implementation
531 	return(E3PathStorage_New(pathName));
532 }
533 #endif
534 
535 
536 
537 
538 
539 //=============================================================================
540 //      Q3PathStorage_Set : Quesa API entry point.
541 //-----------------------------------------------------------------------------
542 #if QUESA_ALLOW_QD3D_EXTENSIONS
543 TQ3Status
Q3PathStorage_Set(TQ3StorageObject theStorage,const char * pathName)544 Q3PathStorage_Set(TQ3StorageObject theStorage, const char *pathName)
545 {
546 
547 
548 	// Release build checks
549 	Q3_REQUIRE_OR_RESULT( E3Storage::IsOfMyClass ( theStorage ), kQ3Failure);
550 	Q3_REQUIRE_OR_RESULT(Q3Object_GetLeafType(theStorage) == kQ3StorageTypePath, kQ3Failure);
551 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(pathName), kQ3Failure);
552 
553 
554 
555 	// Debug build checks
556 #if Q3_DEBUG
557 	if (0) // Further checks on theStorage
558 		return(kQ3Failure);
559 
560 	if (0) // Further checks on pathName
561 		return(kQ3Failure);
562 #endif
563 
564 
565 
566 	// Call the bottleneck
567 	E3System_Bottleneck();
568 
569 
570 
571 	// Call our implementation
572 	return ( (E3PathStorage*) theStorage )->Set ( pathName ) ;
573 }
574 #endif
575 
576 
577 
578 
579 
580 //=============================================================================
581 //      Q3PathStorage_Get : Quesa API entry point.
582 //-----------------------------------------------------------------------------
583 #if QUESA_ALLOW_QD3D_EXTENSIONS
584 TQ3Status
Q3PathStorage_Get(TQ3StorageObject theStorage,char * pathName)585 Q3PathStorage_Get(TQ3StorageObject theStorage, char *pathName)
586 {
587 
588 
589 	// Release build checks
590 	Q3_REQUIRE_OR_RESULT( E3Storage::IsOfMyClass ( theStorage ), kQ3Failure);
591 	Q3_REQUIRE_OR_RESULT(Q3Object_GetLeafType(theStorage) == kQ3StorageTypePath, kQ3Failure);
592 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(pathName), kQ3Failure);
593 
594 
595 
596 	// Debug build checks
597 #if Q3_DEBUG
598 	if (0) // Further checks on theStorage
599 		return(kQ3Failure);
600 
601 	if (0) // Further checks on pathName
602 		return(kQ3Failure);
603 #endif
604 
605 
606 
607 	// Call the bottleneck
608 	E3System_Bottleneck();
609 
610 
611 
612 	// Call our implementation
613 	return ( (E3PathStorage*) theStorage )->Get ( pathName ) ;
614 }
615 #endif
616 
617 
618 
619 
620 
621 //=============================================================================
622 //      Q3HandleStorage_New : Quesa API entry point.
623 //-----------------------------------------------------------------------------
624 #pragma mark -
625 #if QUESA_OS_MACINTOSH
626 TQ3StorageObject
Q3HandleStorage_New(Handle handle,TQ3Uns32 validSize)627 Q3HandleStorage_New(Handle handle, TQ3Uns32 validSize)
628 {
629 
630 
631 	// Release build checks
632 
633 
634 
635 	// Debug build checks
636 #if Q3_DEBUG
637 	if (0) // Further checks on handle
638 		return(NULL);
639 
640 	if (0) // Further checks on validSize
641 		return(NULL);
642 #endif
643 
644 
645 
646 	// Call the bottleneck
647 	E3System_Bottleneck();
648 
649 
650 
651 	// Call our implementation
652 	return(E3HandleStorage_New(handle, validSize));
653 }
654 
655 
656 
657 
658 
659 //=============================================================================
660 //      Q3HandleStorage_Set : Quesa API entry point.
661 //-----------------------------------------------------------------------------
662 TQ3Status
Q3HandleStorage_Set(TQ3StorageObject storage,Handle handle,TQ3Uns32 validSize)663 Q3HandleStorage_Set(TQ3StorageObject storage, Handle handle, TQ3Uns32 validSize)
664 {
665 
666 
667 	// Release build checks
668 	Q3_REQUIRE_OR_RESULT( E3Storage::IsOfMyClass ( storage ), kQ3Failure);
669 	Q3_REQUIRE_OR_RESULT(Q3Object_GetLeafType(storage) == kQ3MemoryStorageTypeHandle, kQ3Failure);
670 
671 
672 
673 	// Debug build checks
674 #if Q3_DEBUG
675 	if (0) // Further checks on storage
676 		return(kQ3Failure);
677 
678 	if (0) // Further checks on handle
679 		return(kQ3Failure);
680 
681 	if (0) // Further checks on validSize
682 		return(kQ3Failure);
683 #endif
684 
685 
686 
687 	// Call the bottleneck
688 	E3System_Bottleneck();
689 
690 
691 
692 	// Call our implementation
693 	return(E3HandleStorage_Set(storage, handle, validSize));
694 }
695 
696 
697 
698 
699 
700 //=============================================================================
701 //      Q3HandleStorage_Get : Quesa API entry point.
702 //-----------------------------------------------------------------------------
703 TQ3Status
Q3HandleStorage_Get(TQ3StorageObject storage,Handle * handle,TQ3Uns32 * validSize)704 Q3HandleStorage_Get(TQ3StorageObject storage, Handle *handle, TQ3Uns32 *validSize)
705 {
706 
707 
708 	// Release build checks
709 	Q3_REQUIRE_OR_RESULT( E3Storage::IsOfMyClass ( storage ), kQ3Failure);
710 	Q3_REQUIRE_OR_RESULT(Q3Object_GetLeafType(storage) == kQ3MemoryStorageTypeHandle, kQ3Failure);
711 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(handle), kQ3Failure);
712 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(validSize), kQ3Failure);
713 
714 
715 
716 	// Debug build checks
717 #if Q3_DEBUG
718 	if (0) // Further checks on storage
719 		return(kQ3Failure);
720 
721 	if (0) // Further checks on handle
722 		return(kQ3Failure);
723 
724 	if (0) // Further checks on validSize
725 		return(kQ3Failure);
726 #endif
727 
728 
729 
730 	// Call the bottleneck
731 	E3System_Bottleneck();
732 
733 
734 
735 	// Call our implementation
736 	return(E3HandleStorage_Get(storage, handle, validSize));
737 }
738 
739 
740 
741 
742 
743 //=============================================================================
744 //      Q3MacintoshStorage_New : Quesa API entry point.
745 //-----------------------------------------------------------------------------
746 TQ3StorageObject
Q3MacintoshStorage_New(TQ3Int16 fsRefNum)747 Q3MacintoshStorage_New(TQ3Int16 fsRefNum)
748 {
749 
750 
751 	// Release build checks
752 
753 
754 
755 	// Debug build checks
756 #if Q3_DEBUG
757 	if (0) // Further checks on fsRefNum
758 		return(NULL);
759 #endif
760 
761 
762 
763 	// Call the bottleneck
764 	E3System_Bottleneck();
765 
766 
767 
768 	// Call our implementation
769 	return(E3MacintoshStorage_New(fsRefNum));
770 }
771 
772 
773 
774 
775 
776 //=============================================================================
777 //      Q3MacintoshStorage_Set : Quesa API entry point.
778 //-----------------------------------------------------------------------------
779 TQ3Status
Q3MacintoshStorage_Set(TQ3StorageObject storage,TQ3Int16 fsRefNum)780 Q3MacintoshStorage_Set(TQ3StorageObject storage, TQ3Int16 fsRefNum)
781 {
782 
783 
784 	// Release build checks
785 	Q3_REQUIRE_OR_RESULT( E3Storage::IsOfMyClass ( storage ), kQ3Failure);
786 	Q3_REQUIRE_OR_RESULT((Q3Object_GetLeafType(storage) == kQ3StorageTypeMacintosh), kQ3Failure);
787 
788 
789 
790 	// Debug build checks
791 #if Q3_DEBUG
792 	if (0) // Further checks on storage
793 		return(kQ3Failure);
794 
795 	if (0) // Further checks on fsRefNum
796 		return(kQ3Failure);
797 #endif
798 
799 
800 
801 	// Call the bottleneck
802 	E3System_Bottleneck();
803 
804 
805 
806 	// Call our implementation
807 	return(E3MacintoshStorage_Set(storage, fsRefNum));
808 }
809 
810 
811 
812 
813 
814 //=============================================================================
815 //      Q3MacintoshStorage_Get : Quesa API entry point.
816 //-----------------------------------------------------------------------------
817 TQ3Status
Q3MacintoshStorage_Get(TQ3StorageObject storage,TQ3Int16 * fsRefNum)818 Q3MacintoshStorage_Get(TQ3StorageObject storage, TQ3Int16 *fsRefNum)
819 {
820 
821 
822 	// Release build checks
823 	Q3_REQUIRE_OR_RESULT( E3Storage::IsOfMyClass ( storage ), kQ3Failure);
824 	Q3_REQUIRE_OR_RESULT((Q3Object_GetLeafType(storage) == kQ3StorageTypeMacintosh), kQ3Failure);
825 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(fsRefNum), kQ3Failure);
826 
827 
828 
829 	// Debug build checks
830 #if Q3_DEBUG
831 	if (0) // Further checks on storage
832 		return(kQ3Failure);
833 
834 	if (0) // Further checks on fsRefNum
835 		return(kQ3Failure);
836 #endif
837 
838 
839 
840 	// Call the bottleneck
841 	E3System_Bottleneck();
842 
843 
844 
845 	// Call our implementation
846 	return(E3MacintoshStorage_Get(storage, fsRefNum));
847 }
848 
849 
850 
851 
852 
853 //=============================================================================
854 //      Q3MacintoshStorage_GetType : Quesa API entry point.
855 //-----------------------------------------------------------------------------
856 TQ3ObjectType
Q3MacintoshStorage_GetType(TQ3StorageObject storage)857 Q3MacintoshStorage_GetType(TQ3StorageObject storage)
858 {
859 
860 
861 	// Release build checks
862 	Q3_REQUIRE_OR_RESULT(Q3Object_IsType(storage, kQ3StorageTypeMacintosh), kQ3ObjectTypeInvalid);
863 
864 
865 
866 	// Debug build checks
867 #if Q3_DEBUG
868 	if (0) // Further checks on storage
869 		return(kQ3ObjectTypeInvalid);
870 #endif
871 
872 
873 
874 	// Call the bottleneck
875 	E3System_Bottleneck();
876 
877 
878 
879 	// Call our implementation
880 	return(E3MacintoshStorage_GetType(storage));
881 }
882 
883 
884 
885 
886 
887 //=============================================================================
888 //      Q3FSSpecStorage_New : Quesa API entry point.
889 //-----------------------------------------------------------------------------
890 TQ3StorageObject
Q3FSSpecStorage_New(const FSSpec * fs)891 Q3FSSpecStorage_New(const FSSpec *fs)
892 {
893 
894 
895 	// Release build checks
896 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(fs), NULL);
897 
898 
899 
900 	// Debug build checks
901 #if Q3_DEBUG
902 	if (0) // Further checks on fs
903 		return(NULL);
904 #endif
905 
906 
907 
908 	// Call the bottleneck
909 	E3System_Bottleneck();
910 
911 
912 
913 	// Call our implementation
914 	return(E3FSSpecStorage_New(fs));
915 }
916 
917 
918 
919 
920 
921 //=============================================================================
922 //      Q3FSSpecStorage_Set : Quesa API entry point.
923 //-----------------------------------------------------------------------------
924 TQ3Status
Q3FSSpecStorage_Set(TQ3StorageObject storage,const FSSpec * fs)925 Q3FSSpecStorage_Set(TQ3StorageObject storage, const FSSpec *fs)
926 {
927 
928 
929 	// Release build checks
930 	Q3_REQUIRE_OR_RESULT(Q3Object_IsType(storage, (kQ3MacintoshStorageTypeFSSpec)), kQ3Failure);
931 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(fs), kQ3Failure);
932 
933 
934 
935 	// Debug build checks
936 #if Q3_DEBUG
937 	if (0) // Further checks on storage
938 		return(kQ3Failure);
939 
940 	if (0) // Further checks on fs
941 		return(kQ3Failure);
942 #endif
943 
944 
945 
946 	// Call the bottleneck
947 	E3System_Bottleneck();
948 
949 
950 
951 	// Call our implementation
952 	return(E3FSSpecStorage_Set(storage, fs));
953 }
954 
955 
956 
957 
958 
959 //=============================================================================
960 //      Q3FSSpecStorage_Get : Quesa API entry point.
961 //-----------------------------------------------------------------------------
962 TQ3Status
Q3FSSpecStorage_Get(TQ3StorageObject storage,FSSpec * fs)963 Q3FSSpecStorage_Get(TQ3StorageObject storage, FSSpec *fs)
964 {
965 
966 
967 	// Release build checks
968 	Q3_REQUIRE_OR_RESULT(Q3Object_IsType(storage, (kQ3MacintoshStorageTypeFSSpec)), kQ3Failure);
969 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(fs), kQ3Failure);
970 
971 
972 
973 	// Debug build checks
974 #if Q3_DEBUG
975 	if (0) // Further checks on storage
976 		return(kQ3Failure);
977 
978 	if (0) // Further checks on fs
979 		return(kQ3Failure);
980 #endif
981 
982 
983 
984 	// Call the bottleneck
985 	E3System_Bottleneck();
986 
987 
988 
989 	// Call our implementation
990 	return(E3FSSpecStorage_Get(storage, fs));
991 }
992 #endif // QUESA_OS_MACINTOSH
993 
994 
995 
996 
997 
998 //=============================================================================
999 //      Q3Win32Storage_New : Quesa API entry point.
1000 //-----------------------------------------------------------------------------
1001 #pragma mark -
1002 #if QUESA_OS_WIN32
1003 TQ3StorageObject
Q3Win32Storage_New(HANDLE hFile)1004 Q3Win32Storage_New(HANDLE hFile)
1005 {
1006 
1007 
1008 	// Release build checks
1009 
1010 
1011 
1012 	// Debug build checks
1013 #if Q3_DEBUG
1014 	if (0) // Further checks on hFile
1015 		return(NULL);
1016 #endif
1017 
1018 
1019 
1020 	// Call the bottleneck
1021 	E3System_Bottleneck();
1022 
1023 
1024 
1025 	// Call our implementation
1026 	return(E3Win32Storage_New(hFile));
1027 }
1028 
1029 
1030 
1031 
1032 
1033 //=============================================================================
1034 //      Q3Win32Storage_Set : Quesa API entry point.
1035 //-----------------------------------------------------------------------------
1036 TQ3Status
Q3Win32Storage_Set(TQ3StorageObject storage,HANDLE hFile)1037 Q3Win32Storage_Set(TQ3StorageObject storage, HANDLE hFile)
1038 {
1039 
1040 
1041 	// Release build checks
1042 	Q3_REQUIRE_OR_RESULT(Q3Object_IsType(storage, (kQ3StorageTypeWin32)), kQ3Failure);
1043 
1044 
1045 
1046 	// Debug build checks
1047 #if Q3_DEBUG
1048 	if (0) // Further checks on storage
1049 		return(kQ3Failure);
1050 
1051 	if (0) // Further checks on hFile
1052 		return(kQ3Failure);
1053 #endif
1054 
1055 
1056 
1057 	// Call the bottleneck
1058 	E3System_Bottleneck();
1059 
1060 
1061 
1062 	// Call our implementation
1063 	return(E3Win32Storage_Set(storage, hFile));
1064 }
1065 
1066 
1067 
1068 
1069 
1070 //=============================================================================
1071 //      Q3Win32Storage_Get : Quesa API entry point.
1072 //-----------------------------------------------------------------------------
1073 TQ3Status
Q3Win32Storage_Get(TQ3StorageObject storage,HANDLE * hFile)1074 Q3Win32Storage_Get(TQ3StorageObject storage, HANDLE *hFile)
1075 {
1076 
1077 
1078 	// Release build checks
1079 	Q3_REQUIRE_OR_RESULT(Q3Object_IsType(storage, (kQ3StorageTypeWin32)), kQ3Failure);
1080 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(hFile), kQ3Failure);
1081 
1082 
1083 
1084 	// Debug build checks
1085 #if Q3_DEBUG
1086 	if (0) // Further checks on storage
1087 		return(kQ3Failure);
1088 
1089 	if (0) // Further checks on hFile
1090 		return(kQ3Failure);
1091 #endif
1092 
1093 
1094 
1095 	// Call the bottleneck
1096 	E3System_Bottleneck();
1097 
1098 
1099 
1100 	// Call our implementation
1101 	return(E3Win32Storage_Get(storage, hFile));
1102 }
1103 #endif // QUESA_OS_WIN32
1104 
1105 
1106 
1107 
1108 
1109 //=============================================================================
1110 //      Q3UnixPathStorage_New : Quesa API entry point.
1111 //-----------------------------------------------------------------------------
1112 #pragma mark -
1113 #if QUESA_OS_UNIX
1114 TQ3StorageObject
Q3UnixPathStorage_New(const char * pathName)1115 Q3UnixPathStorage_New(const char *pathName)
1116 {
1117 
1118 
1119 	// Release build checks
1120 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(pathName), NULL);
1121 
1122 
1123 
1124 	// Debug build checks
1125 #if Q3_DEBUG
1126 	if (0) // Further checks on pathName
1127 		return(NULL);
1128 #endif
1129 
1130 
1131 
1132 	// Call the bottleneck
1133 	E3System_Bottleneck();
1134 
1135 
1136 
1137 	// Call our implementation
1138 	return(E3UnixPathStorage_New(pathName));
1139 }
1140 
1141 
1142 
1143 
1144 
1145 //=============================================================================
1146 //      Q3UnixPathStorage_Set : Quesa API entry point.
1147 //-----------------------------------------------------------------------------
1148 TQ3Status
Q3UnixPathStorage_Set(TQ3StorageObject storage,const char * pathName)1149 Q3UnixPathStorage_Set(TQ3StorageObject storage, const char *pathName)
1150 {
1151 
1152 
1153 	// Release build checks
1154 	Q3_REQUIRE_OR_RESULT(Q3Object_IsType(storage, (kQ3UnixStorageTypePath)), kQ3Failure);
1155 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(pathName), kQ3Failure);
1156 
1157 
1158 
1159 	// Debug build checks
1160 #if Q3_DEBUG
1161 	if (0) // Further checks on storage
1162 		return(kQ3Failure);
1163 
1164 	if (0) // Further checks on pathName
1165 		return(kQ3Failure);
1166 #endif
1167 
1168 
1169 
1170 	// Call the bottleneck
1171 	E3System_Bottleneck();
1172 
1173 
1174 
1175 	// Call our implementation
1176 	return(E3UnixPathStorage_Set(storage, pathName));
1177 }
1178 
1179 
1180 
1181 
1182 
1183 //=============================================================================
1184 //      Q3UnixPathStorage_Get : Quesa API entry point.
1185 //-----------------------------------------------------------------------------
1186 TQ3Status
Q3UnixPathStorage_Get(TQ3StorageObject storage,char * pathName)1187 Q3UnixPathStorage_Get(TQ3StorageObject storage, char *pathName)
1188 {
1189 
1190 
1191 	// Release build checks
1192 	Q3_REQUIRE_OR_RESULT(Q3Object_IsType(storage, (kQ3UnixStorageTypePath)), kQ3Failure);
1193 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(pathName), kQ3Failure);
1194 
1195 
1196 
1197 	// Debug build checks
1198 #if Q3_DEBUG
1199 	if (0) // Further checks on storage
1200 		return(kQ3Failure);
1201 
1202 	if (0) // Further checks on pathName
1203 		return(kQ3Failure);
1204 #endif
1205 
1206 
1207 
1208 	// Call the bottleneck
1209 	E3System_Bottleneck();
1210 
1211 
1212 
1213 	// Call our implementation
1214 	return(E3UnixPathStorage_Get(storage, pathName));
1215 }
1216 #endif // QUESA_OS_UNIX
1217 
1218 
1219 
1220 
1221 
1222 //=============================================================================
1223 //      Q3BeStorage_New : Quesa API entry point.
1224 //-----------------------------------------------------------------------------
1225 #pragma mark -
1226 #if QUESA_OS_BE
1227 TQ3StorageObject
Q3BeStorage_New(BFile * theFile)1228 Q3BeStorage_New(BFile *theFile)
1229 {
1230 
1231 
1232 	// Release build checks
1233 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(theFile), NULL);
1234 
1235 
1236 
1237 	// Debug build checks
1238 #if Q3_DEBUG
1239 	if (0) // Further checks on theFile
1240 		return(NULL);
1241 #endif
1242 
1243 
1244 
1245 	// Call the bottleneck
1246 	E3System_Bottleneck();
1247 
1248 
1249 
1250 	// Call our implementation
1251 	return(E3BeStorage_New(theFile));
1252 }
1253 
1254 
1255 
1256 
1257 
1258 //=============================================================================
1259 //      Q3BeStorage_Set : Quesa API entry point.
1260 //-----------------------------------------------------------------------------
1261 TQ3Status
Q3BeStorage_Set(TQ3StorageObject theStorage,BFile * theFile)1262 Q3BeStorage_Set(TQ3StorageObject theStorage, BFile *theFile)
1263 {
1264 
1265 
1266 	// Release build checks
1267 	Q3_REQUIRE_OR_RESULT(Q3Object_IsType(theStorage, (kQ3StorageTypeBe)), kQ3Failure);
1268 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(theFile), kQ3Failure);
1269 
1270 
1271 
1272 	// Debug build checks
1273 #if Q3_DEBUG
1274 	if (0) // Further checks on theStorage
1275 		return(kQ3Failure);
1276 
1277 	if (0) // Further checks on theFile
1278 		return(kQ3Failure);
1279 #endif
1280 
1281 
1282 
1283 	// Call the bottleneck
1284 	E3System_Bottleneck();
1285 
1286 
1287 
1288 	// Call our implementation
1289 	return(E3BeStorage_Set(theStorage, theFile));
1290 }
1291 
1292 
1293 
1294 
1295 
1296 //=============================================================================
1297 //      Q3BeStorage_Get : Quesa API entry point.
1298 //-----------------------------------------------------------------------------
1299 TQ3Status
Q3BeStorage_Get(TQ3StorageObject theStorage,BFile ** theFile)1300 Q3BeStorage_Get(TQ3StorageObject theStorage, BFile **theFile)
1301 {
1302 
1303 
1304 	// Release build checks
1305 	Q3_REQUIRE_OR_RESULT(Q3Object_IsType(theStorage, (kQ3StorageTypeBe)), kQ3Failure);
1306 	Q3_REQUIRE_OR_RESULT(Q3_VALID_PTR(theFile), kQ3Failure);
1307 
1308 
1309 
1310 	// Debug build checks
1311 #if Q3_DEBUG
1312 	if (0) // Further checks on theStorage
1313 		return(kQ3Failure);
1314 
1315 	if (0) // Further checks on theFile
1316 		return(kQ3Failure);
1317 #endif
1318 
1319 
1320 
1321 	// Call the bottleneck
1322 	E3System_Bottleneck();
1323 
1324 
1325 
1326 	// Call our implementation
1327 	return(E3BeStorage_Get(theStorage, theFile));
1328 }
1329 #endif // OS_BE
1330 
1331 
1332 
1333 
1334