Max 5 API Reference
00001 #ifndef _EXT_PREFIX_H_ 00002 #define _EXT_PREFIX_H_ 00003 00004 //////////////////////////////////////////////////////////////////////////////// 00005 // macros 00006 00007 #ifndef WIN_VERSION 00008 #define MAC_VERSION 1 // we'll assume that if we aren't requesting the windows version, that we build the mac version(s) of the product 00009 #endif // WIN_VERSION 00010 00011 #ifdef __cplusplus 00012 /** 00013 Ensure that any definitions following this macro use a C-linkage, not a C++ linkage. 00014 The Max API uses C-linkage. 00015 This is important for objects written in C++ or that use a C++ compiler. 00016 This macro must be balanced with the #END_USING_C_LINKAGE macro. 00017 @ingroup misc 00018 */ 00019 #define BEGIN_USING_C_LINKAGE \ 00020 extern "C" { 00021 #else 00022 /** 00023 Ensure that any definitions following this macro use a C-linkage, not a C++ linkage. 00024 The Max API uses C-linkage. 00025 This is important for objects written in C++ or that use a C++ compiler. 00026 This macro must be balanced with the #END_USING_C_LINKAGE macro. 00027 @ingroup misc 00028 */ 00029 #define BEGIN_USING_C_LINKAGE 00030 #endif // __cplusplus 00031 00032 #ifdef __cplusplus 00033 /** 00034 Close a definition section that was opened using #BEGIN_USING_C_LINKAGE. 00035 @ingroup misc 00036 */ 00037 #define END_USING_C_LINKAGE \ 00038 } 00039 #else 00040 /** 00041 Close a definition section that was opened using #BEGIN_USING_C_LINKAGE. 00042 @ingroup misc 00043 */ 00044 #define END_USING_C_LINKAGE 00045 #endif // __cplusplus 00046 00047 #ifdef WIN_VERSION 00048 00049 // Define MAXAPI_USE_MSCRT if you want to use the ms c runtime library. 00050 // Otherwise, add c74support/max-includes to your linker include paths 00051 // and your external will use the maxcrt thus avoiding any external dependencies. 00052 #ifndef MAXAPI_USE_MSCRT 00053 00054 #ifndef _CRT_NOFORCE_MANIFEST // avoid warning if already defined 00055 #define _CRT_NOFORCE_MANIFEST 00056 #endif 00057 00058 #ifndef _DEBUG 00059 // for debug use the standard microsoft C runtime 00060 #pragma comment(linker,"/NODEFAULTLIB:msvcrt.lib") 00061 #pragma comment(lib,"maxcrt.lib") 00062 #endif 00063 00064 #endif // #ifndef MAXAPI_USE_MSCRT 00065 00066 #endif // #ifdef WIN_VERSION 00067 00068 //////////////////////////////////////////////////////////////////////////////// 00069 // Mac Target 00070 00071 #ifdef MAC_VERSION 00072 #ifndef powerc 00073 #pragma d0_pointers on 00074 #endif 00075 #define _K( k ) 00076 00077 #define INCLUDE_APPLE_HEADERS 00078 00079 #if !TARGET_API_MAC_CARBON 00080 #define GRAFPORT_IN_WIND 00081 #endif 00082 00083 #if 1 // defined( __MOTO__ ) && !defined( __cplusplus ) 00084 #define FPTR_ELLIPSES 0 00085 #else 00086 #define FPTR_ELLIPSES 1 00087 #endif 00088 00089 // the C74_PRAGMA_STRUCT_PACK* macros are used to ensure that 00090 // Win32 builds of Max externals use a 2 byte struct packing 00091 // for all Max structs in projects that have a default struct 00092 // packing other than 2 (this is typically 4). On Macintosh 00093 // the default byte packing is 4, and it is with this packing 00094 // that all Max structs are packed on Macintosh. If for some 00095 // reason you are using a struct byte packing of something other 00096 // than 4 on macintosh, there may be problems. Please let us 00097 // know, and we can address this and the other Max header files to 00098 // ensure 4 byte struct packing on Macintosh in such a setting. 00099 #define C74_PRAGMA_STRUCT_PACKPUSH 0 00100 #define C74_PRAGMA_STRUCT_PACK 0 00101 #define C74_STRUCT_PACK_SIZE 4 00102 00103 // If the prefix header containing #include <Carbon/Carbon.h> is not present, then we include 00104 // a minimal set of required headers here. 00105 #ifndef __MACTYPES__ 00106 #include <MacTypes.h> 00107 #endif 00108 #include <sys/types.h> 00109 00110 #endif // MAC_VERSION 00111 00112 //////////////////////////////////////////////////////////////////////////////// 00113 // Win32 Target 00114 00115 #ifdef WIN_VERSION 00116 00117 #if !defined( __cplusplus ) 00118 #define FPTR_ELLIPSES 0 00119 #else 00120 #define FPTR_ELLIPSES 1 00121 #endif 00122 00123 // the C74_PRAGMA_STRUCT_PACK* macros are used to ensure that 00124 // Win32 builds of Max externals use a 2 byte struct packing 00125 // for all Max structs in projects that have a default struct 00126 // packing other than 2 (this is typically 4). On Macintosh 00127 // the default byte packing is 4, and it is with this packing 00128 // that all Max structs are packed on Macintosh. If for some 00129 // reason you are using a struct byte packing of something other 00130 // than 4 on macintosh, there may be problems. Please let us 00131 // know, and we can address this and the other Max header files to 00132 // ensure 4 byte struct packing on Macintosh in such a setting. 00133 #if ((defined(_MSC_VER) && !defined(__MWERKS__)) || (defined(__MWERKS__)&&(__MWERKS__ >= 0x0900))) 00134 // Visual C++ or Metrowerks >=0x0900 support pack(push,n) 00135 // this may not accomodate building for a windows target 00136 // using Metrowerks on a macintosh, which might need to use 00137 // the pragma align statement. 00138 #define C74_PRAGMA_STRUCT_PACKPUSH 1 00139 #else 00140 #define C74_PRAGMA_STRUCT_PACKPUSH 0 00141 #endif 00142 00143 #define C74_PRAGMA_STRUCT_PACK 1 00144 #define C74_STRUCT_PACK_SIZE 2 00145 00146 #pragma warning( disable : 4005 ) // macro redefinition 00147 #pragma warning( disable : 4101 ) // unreferenced local 00148 #pragma warning( disable : 4800 ) // forcing value to bool 'true' or 'false' 00149 #pragma warning( disable : 4805 ) // unsafe mix of type 'BOOL' and type 'bool' 00150 #pragma warning( disable : 4087 ) // 'function' declared with 'void' parameter list 00151 #pragma warning( disable : 4068 ) // unknown pragma 00152 #pragma warning( disable : 4244 ) // implicit larger to smaller type conversion (int + float) 00153 #pragma warning( disable : 4245 ) // implicit unsigned/signed type conversion 00154 #pragma warning( disable : 4305 ) // truncation from 'type1' to 'type2' (e.g. double->float) 00155 00156 #define _CRT_SECURE_NO_WARNINGS 00157 00158 // crtl 00159 #include <stdio.h> 00160 #include <stdlib.h> 00161 #include <stdarg.h> 00162 #include <ctype.h> 00163 #include <math.h> 00164 #include <string.h> 00165 #include <setjmp.h> 00166 #include <assert.h> 00167 00168 // windows 00169 #include <windows.h> 00170 #include <richedit.h> 00171 #include <commctrl.h> 00172 00173 #ifdef C74_PRIVATE 00174 #include "ext_prefix_win.h" 00175 #endif 00176 00177 #ifdef USE_QTML 00178 #ifndef INCLUDE_APPLE_HEADERS 00179 #define INCLUDE_APPLE_HEADERS 00180 #endif 00181 #include "qtml.h" 00182 #endif 00183 00184 #endif // WIN_VERSION 00185 00186 #endif // _EXT_PREFIX_H_
Copyright © 2008, Cycling '74