xref: /netbsd-src/external/bsd/elftosb/dist/common/stdafx.h (revision 993229b6fea628ff8b1fa09146c80b0cfb2768eb)
1 #ifndef stdafx_h_
2 #define stdafx_h_
3 
4 // stdafx.h : include file for standard system include files,
5 // or project specific include files that are used frequently, but
6 // are changed infrequently
7 //
8 
9 // Default to external release.
10 #ifndef SGTL_INTERNAL
11     #define SGTL_INTERNAL 0
12 #endif
13 
14 #include <iostream>
15 #include <stdexcept>
16 
17 #if defined(WIN32)
18 //#include <tchar.h>
19 
20     // define this macro for use in VC++
21     #if !defined(__LITTLE_ENDIAN__)
22         #define __LITTLE_ENDIAN__ 1
23     #endif // !defined(__LITTLE_ENDIAN__)
24 #endif // defined(WIN32)
25 
26 #if defined(Linux)
27 // For Linux systems only, types.h only defines the signed
28 // integer types.  This is not professional code.
29 // Update: They are defined in the header files in the more recent version of redhat enterprise gcc.
30 #include <sys/types.h>
31 #include <stdint.h>
32 //typedef unsigned long uint32_t;
33 //typedef unsigned short uint16_t;
34 //typedef unsigned char uint8_t;
35 
36 //#define TCHAR char
37 //#define _tmain main
38 
39     // give a default endian in case one is not defined on Linux (it should be, though)
40     #if !defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
41         #define __LITTLE_ENDIAN__ 1
42     #endif // !defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
43 
44 #endif // defined(Linux)
45 
46 // gcc on Mac OS X
47 #if defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__MACOS_CLASSIC__) )
48 	#include <TargetConditionals.h>
49 
50 	#if defined(TARGET_RT_LITTLE_ENDIAN) && TARGET_RT_LITTLE_ENDIAN
51 		#if !defined(__LITTLE_ENDIAN__)
52 			#define __LITTLE_ENDIAN__
53 		#endif
54 	#elif defined(TARGET_RT_BIG_ENDIAN) && TARGET_RT_BIG_ENDIAN
55 		#if !defined(__BIG_ENDIAN__)
56 			#define __BIG_ENDIAN__
57 		#endif
58 	#endif
59 #endif
60 
61 #if defined(WIN32) //!defined(Linux) || !defined(__GNUC__)
62 // redefine missing typedefs from stdint.h or syst/types.h
63 
64 typedef unsigned long long uint64_t;
65 typedef unsigned long uint32_t;
66 typedef unsigned short uint16_t;
67 typedef unsigned char uint8_t;
68 
69 typedef long long int64_t;
70 typedef long int32_t;
71 typedef short int16_t;
72 typedef char int8_t;
73 #endif // !defined(Linux)
74 
75 #if !defined(TRUE)
76     #define TRUE 1
77 #endif // !defined(TRUE)
78 
79 #if !defined(FALSE)
80     #define FALSE 0
81 #endif // !defined(FALSE)
82 
83 #endif // stdafx_h_
84