home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 January: Mac OS SDK / Dev.CD Jan 97 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODFDev / ODF / Found / FWCommon / FWEnvDef.h < prev    next >
Encoding:
Text File  |  1996-09-17  |  8.0 KB  |  339 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                FWEnvDef.h
  4. //    Release Version:    $ ODF 2 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #ifndef FWENVDEF_H
  11. #define FWENVDEF_H
  12.  
  13. //========================================================================================
  14. // Definitions Specific to the Build Configuration
  15. //========================================================================================
  16.  
  17. #ifndef FWBLDDEF_H
  18. #include "FWBldDef.h"
  19. #endif
  20.  
  21. //========================================================================================
  22. // Wrappers for C
  23. //========================================================================================
  24.  
  25. #ifdef __cplusplus
  26.  
  27.     // C++ compilation
  28.     
  29. #define FW_EXTERN_C_BEGIN    \
  30.     extern "C" \
  31.     {
  32. #define FW_EXTERN_C_END        \
  33.     }
  34.     
  35. #else
  36.  
  37.     // Good 'ol C compilation
  38.  
  39. #define FW_EXTERN_C_BEGIN
  40. #define FW_EXTERN_C_END
  41.  
  42. #endif
  43.  
  44. //========================================================================================
  45. // Metrowerks -- Macintosh
  46. //========================================================================================
  47.  
  48. #ifdef __MWERKS__
  49.  
  50.     #ifndef FW_BUILD_MAC
  51.     #error "FW_BUILD_MAC should have already been defined in FWBldDef.h"
  52.     #endif
  53.     
  54.     #if 0x0800 <= __MWERKS__
  55.     #    if __option(exceptions)
  56.     #        define FW_NATIVE_EXCEPTIONS
  57.     #    endif
  58.     #    if __option(RTTI)
  59.     #        define FW_COMPILER_SUPPORTS_RTTI
  60.     #    endif
  61.     #endif
  62.     
  63.     #ifdef FW_BUILD_MAC68K
  64.         #ifndef FW_ODFLIB
  65.         #define FW_ODFLIB_IMPORT
  66.         #endif
  67.     #endif
  68.     
  69.     #ifndef FW_ANSI_TEMPLATE_INSTANTIATION
  70.     #define FW_ANSI_TEMPLATE_INSTANTIATION 1
  71.     #endif
  72.     
  73.     #define ppcinterfaces 1
  74.     
  75.     #ifndef OLDROUTINENAMES
  76.     #define OLDROUTINENAMES         0
  77.     #endif
  78.     
  79.     #ifndef OLDROUTINELOCATIONS
  80.     #define OLDROUTINELOCATIONS     0
  81.     #endif
  82.     
  83.     // Hack to control what is exported from a CFM shared lib on PPC. Define functions
  84.     // with indicative names which CodeWarrior will place in the .exp file. The MPW tool
  85.     // MWExportTool will then filter the .exp removing exports between off functions and
  86.     // on functions, inclusive. The functions are dead-stripped since they are not exported
  87.     // and never referenced.
  88.     
  89.     #define FW_EXPORT_ON(file, id) \
  90.         extern "C" void _FW_export_lib_on_##file##id(); \
  91.         extern "C" void _FW_export_lib_on_##file##id() { }
  92.     #define FW_EXPORT_OFF(file, id) \
  93.         extern "C" void _FW_export_lib_off_##file##id(); \
  94.         extern "C" void _FW_export_lib_off_##file##id() { }
  95.     
  96.     #define FW_FOUR_BYTE_INTS __fourbyteints__
  97.  
  98.     // Force PowerPC alignment
  99.     #ifndef FW_BUILD_MAC68K
  100.         #pragma options align=power
  101.     #endif
  102.     
  103. //========================================================================================
  104. // Symantec C++ -- Macintosh
  105. //========================================================================================
  106. #elif defined SYMANTEC_CPLUS && !defined _WINDOWS
  107.     
  108.     #pragma options(system_includes_from_project_tree)
  109.     
  110.     #define FW_AGGRESSIVE_PRECOMPILE 1
  111.             
  112.     #ifndef FW_ANSI_TEMPLATE_INSTANTIATION
  113.     #define FW_ANSI_TEMPLATE_INSTANTIATION 1
  114.     #endif
  115.  
  116.     #define PRAGMA_LIB_EXPORT 1
  117.     #define PRAGMA_IMPORT 1
  118.     
  119.     #ifndef SOMLINK
  120.     #define SOMLINK
  121.     #endif
  122.     
  123.     #ifndef SOMDLINK
  124.     #define SOMDLINK
  125.     #endif
  126.     
  127.     #ifndef FW_BUILD_MAC
  128.     #error "FW_BUILD_MAC should have already been defined in FWBldDef.h"
  129.     #endif
  130.     
  131.     #define ppcinterfaces 1
  132.     
  133.     #ifndef OLDROUTINENAMES
  134.     #define OLDROUTINENAMES         0
  135.     #endif
  136.     
  137.     #ifndef OLDROUTINELOCATIONS
  138.     #define OLDROUTINELOCATIONS     0
  139.     #endif
  140.     
  141.     #define FW_EXPORT_ON
  142.     #define FW_EXPORT_OFF
  143.     
  144.     #ifndef FW_FOUR_BYTE_INTS
  145.     #define FW_FOUR_BYTE_INTS __option(int_4)
  146.     #endif
  147.  
  148.     // Force PowerPC alignment
  149.     #pragma options align=power
  150.  
  151. //========================================================================================
  152. // CFM 68K using Symantec SCpp (__SC__ would also catch SPM but that's listed above)
  153. //========================================================================================
  154. #elif defined __SC__ && !defined _WINDOWS
  155.     
  156.     #define FW_AGGRESSIVE_PRECOMPILE 1
  157.     
  158.     #ifndef FW_ANSI_TEMPLATE_INSTANTIATION
  159.     #define FW_ANSI_TEMPLATE_INSTANTIATION 1
  160.     #endif
  161.  
  162.     // We want clients of the ODF library to turn on
  163.     // the import pragmas.  Define FW_ODFLIB only when building
  164.     // the ODF shared library. -  [sfu]
  165.     
  166.     #ifndef FW_ODFLIB
  167.     #define FW_ODFLIB_IMPORT
  168.     #endif
  169.         
  170.     #ifndef SOMLINK
  171.     #define SOMLINK
  172.     #endif
  173.     
  174.     #ifndef SOMDLINK
  175.     #define SOMDLINK
  176.     #endif
  177.     
  178.     #ifndef FW_BUILD_MAC
  179.     #error "FW_BUILD_MAC should have already been defined in FWBldDef.h"
  180.     #endif
  181.     
  182.     #define ppcinterfaces 1
  183.  
  184.     #ifndef OLDROUTINENAMES
  185.     #define OLDROUTINENAMES         0
  186.     #endif
  187.     
  188.     #ifndef OLDROUTINELOCATIONS
  189.     #define OLDROUTINELOCATIONS     0
  190.     #endif
  191.     
  192.     #define FW_EXPORT_ON
  193.     #define FW_EXPORT_OFF
  194.     
  195.     #ifndef FW_FOUR_BYTE_INTS
  196.     #define FW_FOUR_BYTE_INTS __option(int_4)
  197.     #endif
  198.     
  199. //========================================================================================
  200. // Mr. C -- Macintosh
  201. //========================================================================================
  202. #elif defined __MRC__
  203.  
  204.     #ifndef FW_USE_TEMPLATE_PRAGMAS
  205.     #define FW_USE_TEMPLATE_PRAGMAS 1
  206.     #endif
  207.     
  208.     // We want clients of the ODF library to turn on
  209.     // the import pragmas.  Define FW_ODFLIB only when building
  210.     // the ODF shared library. -  [sfu]
  211.     
  212.     #ifndef FW_ODFLIB
  213.     #define FW_ODFLIB_IMPORT
  214.     #endif
  215.     
  216.     #ifndef FW_BUILD_MAC
  217.     #error "FW_BUILD_MAC should have already been defined in FWBldDef.h"
  218.     #endif
  219.     
  220.     #define ppcinterfaces 1
  221.  
  222.     #ifndef OLDROUTINENAMES
  223.     #define OLDROUTINENAMES         0
  224.     #endif
  225.     
  226.     #ifndef OLDROUTINELOCATIONS
  227.     #define OLDROUTINELOCATIONS     0
  228.     #endif
  229.  
  230.     #define FW_EXPORT_ON
  231.     #define FW_EXPORT_OFF
  232.     
  233.     #define FW_FOUR_BYTE_INTS 1
  234.  
  235.     // Force PowerPC alignment
  236.     #pragma options align=power
  237.  
  238. //========================================================================================
  239. // Microsoft Visual C++ - Windows
  240. //========================================================================================
  241. #elif defined _MSC_VER
  242.  
  243.     #ifdef _WINDOWS_
  244.     #error Include FWEnvDef.h before including Windows.h
  245.     #endif
  246.  
  247.     #define FW_BUILD_WIN
  248.     #define FW_BUILD_WIN32
  249.     #define FW_HAS_INSTANCE_DATA
  250.     #define FW_NATIVE_EXCEPTIONS
  251.  
  252.     #define FW_FOUR_BYTE_INTS            1
  253.     #define FW_USE_PRECOMPILED_HEADERS    1
  254.     
  255.     #ifdef _DEBUG
  256.     #define    FW_DEBUG
  257.     #endif
  258.  
  259.     #define PLATFORM_WINDOWS            1
  260.  
  261.     #define STRICT
  262.     #define WIN32_LEAN_AND_MEAN
  263.     #define WIN32_EXTRA_LEAN
  264.     #include <windows.h>
  265.  
  266.     #pragma warning(disable:4080)        // Invalid name in segment pragma
  267.     #pragma warning(disable:4660)        // Template specialization already instantiated
  268.  
  269. //========================================================================================
  270. // Symantec C++ - Windows
  271. //========================================================================================
  272. #elif defined __SC__ && defined _WINDOWS
  273.  
  274.     #ifdef _WINDOWS_
  275.     #error Include FWEnvDef.h before including Windows.h
  276.     #endif
  277.  
  278.     #define FW_BUILD_WIN
  279.     #define FW_BUILD_WIN32
  280.     #define FW_HAS_INSTANCE_DATA
  281.     #define FW_NATIVE_EXCEPTIONS
  282.  
  283.     #define FW_FOUR_BYTE_INTS            1
  284.     #define FW_AGGRESIVE_PRECOMPILE        1
  285.  
  286.     #ifdef _DEBUG
  287.     #define    FW_DEBUG
  288.     #endif
  289.  
  290.     #define PLATFORM_WINDOWS            1
  291.  
  292.     #define STRICT
  293.     #include <windows.h>
  294.     
  295.     #define SOMLINK __stdcall
  296.     #define SOMDLINK __stdcall
  297.  
  298. //========================================================================================
  299. // Unsupported Compiler
  300. //========================================================================================
  301. #else
  302.  
  303.     #error Unsupported compiler
  304.  
  305. #endif
  306.  
  307. //========================================================================================
  308. // Other Defines 
  309. //========================================================================================
  310.  
  311. #ifdef FW_BUILD_MAC
  312.     #ifndef _PLATFORM_MACINTOSH_
  313.         #define _PLATFORM_MACINTOSH_         1
  314.     #endif
  315.     #ifndef PLATFORM_MACINTOSH
  316.         #define PLATFORM_MACINTOSH             1
  317.     #endif
  318.     #if !defined(FW_HAS_INSTANCE_DATA)
  319.         #define FW_HAS_INSTANCE_DATA
  320.     #endif
  321.     
  322.     #ifdef FW_NATIVE_EXCEPTIONS
  323.     #    define _NATIVE_EXCEPTIONS_
  324.     #endif
  325.     
  326.     #define FW_EXPORT
  327. #endif
  328.  
  329. #ifdef FW_BUILD_WIN
  330.     #ifndef PLATFORM_WINDOWS
  331.         #define PLATFORM_WINDOWS             1
  332.     #endif
  333.     
  334.     #define FW_EXPORT                        __declspec(dllexport)
  335.     
  336. #endif
  337.  
  338. #endif
  339.