1/* 2 File: Optimization.h 3 4 Contains: Defines that let you make MoreFiles code more efficient. 5 6 Version: MoreFiles 7 8 Copyright: � 1992-2001 by Apple Computer, Inc., all rights reserved. 9 10 You may incorporate this sample code into your applications without 11 restriction, though the sample code has been provided "AS IS" and the 12 responsibility for its operation is 100% yours. However, what you are 13 not permitted to do is to redistribute the source as "DSC Sample Code" 14 after having made changes. If you're going to re-distribute the source, 15 we require that you make it clear in the source that the code was 16 descended from Apple Sample Code, but that you've made changes. 17 18 File Ownership: 19 20 DRI: Apple Macintosh Developer Technical Support 21 22 Other Contact: Apple Macintosh Developer Technical Support 23 <http://developer.apple.com/bugreporter/> 24 25 Technology: DTS Sample Code 26 27 Writers: 28 29 (JL) Jim Luther 30 31 Change History (most recent first): 32 33 <1> 2/7/01 JL first checked in 34*/ 35 36/* 37 The Optimization changes to MoreFiles source and header files, along with 38 this file and OptimizationEnd.h, let you optimize the code produced 39 by MoreFiles in several ways. 40 41 1 -- MoreFiles contains extra code so that many routines can run under 42 Mac OS systems back to System 6. If your program requires a specific 43 version of Mac OS and your program checks for that version before 44 calling MoreFiles routines, then you can remove a lot of compatibility 45 code by defining one of the following to 1: 46 47 __MACOSSEVENFIVEONEORLATER // assume Mac OS 7.5.1 or later 48 __MACOSSEVENFIVEORLATER // assume Mac OS 7.5 or later 49 __MACOSSEVENORLATER // assume Mac OS 7.0 or later 50 51 If you're compiling 68K code, the default is to include all compatibility code. 52 If you're compiling PowerPC code (TARGET_RT_MAC_CFM), the default is __MACOSSEVENORLATER 53 If you're compiling for Carbon code (TARGET_API_MAC_CARBON), the default is __MACOSSEVENFIVEONEORLATER 54 55 2 -- You may disable Pascal calling conventions in all MoreFiles routines 56 except for system callbacks that require Pascal calling conventions. 57 This will make 68K C programs both smaller and faster. 58 (PowerPC compilers ignore pascal calling conventions.) 59 Just define __WANTPASCALELIMINATION to be 1 to turn this optimization on 60 when building MoreFiles for use from C programs (you'll need to keep 61 Pascal calling conventions when linking MoreFiles routines with Pascal 62 programs). 63 64 3 -- If Metrowerks compiler is used, "#pragma internal on" may help produce 65 better code. However, this option can also cause problems if you're 66 trying to build MoreFiles as a shared library, so it is by default not used. 67 Just define __USEPRAGMAINTERNAL to be 1 to turn this optimization on. 68 69 Original changes supplied by Fabrizio Oddone 70*/ 71 72#include <ConditionalMacros.h> 73 74// if we're compiling for Carbon, then we're running on Mac OS 8.1 or later 75#ifndef __MACOSSEVENFIVEONEORLATER 76 #define __MACOSSEVENFIVEONEORLATER TARGET_API_MAC_CARBON 77#endif 78 79#ifndef __MACOSSEVENFIVEORLATER 80 #define __MACOSSEVENFIVEORLATER __MACOSSEVENFIVEONEORLATER 81#endif 82 83#ifndef __MACOSSEVENORLATER 84 #if TARGET_RT_MAC_CFM 85 #define __MACOSSEVENORLATER 1 86 #else 87 #define __MACOSSEVENORLATER __MACOSSEVENFIVEORLATER 88 #endif 89#endif 90 91 92#ifndef __WANTPASCALELIMINATION 93 #define __WANTPASCALELIMINATION 0 94#endif 95 96#if __WANTPASCALELIMINATION 97 #define pascal 98#endif 99 100 101#ifndef __USEPRAGMAINTERNAL 102 #define __USEPRAGMAINTERNAL 0 103#endif 104 105#if __USEPRAGMAINTERNAL 106 #if defined(__MWERKS__) 107 #pragma internal on 108 #endif 109#endif 110