LayOut C API
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
common.h
Go to the documentation of this file.
1 // Copyright 2015 Trimble Inc., All rights reserved.
2 // This file is intended for public distribution.
3 
8 #ifndef SKETCHUP_COMMON_H_
9 #define SKETCHUP_COMMON_H_
10 
15 enum SUResult {
17 
19 
21 
22 
24 
26 
27 
29 
30 
31 
33 
35 
36 
38 
39 
41 
42 
43 
45 
46 
48 
50 
52 
53 
55 
57 
59 
60 
61 
63 
65 
67 
69 };
70 
71 // Define a platform-independent UTF16 type.
72 #if defined(__APPLE__) || defined(__LINUX__)
73  #ifndef FOUNDATION_IMPORT
74 typedef unsigned short unichar;
75  #endif // FOUNDATION_IMPORT
76 #else // WIN32
77  #include <wtypes.h>
78 typedef wchar_t unichar;
79 #endif
80 
81 #ifndef DOXYGEN_SHOULD_SKIP_THIS
82 
83  #define SU_EXPORT
84  #if defined WIN32 && !defined GSLAPI_NO_EXPORTS
85  #undef SU_EXPORT
86  #ifdef GSLAPI_API_EXPORTS
87  #define SU_EXPORT __declspec(dllexport)
88  #else
89  #define SU_EXPORT __declspec(dllimport)
90  #endif // GSLAPI_API_EXPORTS
91  #endif // WINDOWS
92 
93  #if defined __APPLE__
94  #undef SU_EXPORT
95  #ifdef GSLAPI_API_EXPORTS
96  #define SU_EXPORT __attribute__((visibility("default")))
97  #else
98  #define SU_EXPORT __attribute__((visibility("hidden")))
99  #endif
100  #endif // #if defined __APPLE__
101 
102  #define DEFINE_SU_TYPE(TYPENAME) \
103  typedef struct { \
104  void* ptr; \
105  } TYPENAME;
106 
107  // #define SU_RESULT SU_EXPORT enum SUResult
108 
109 #endif // DOXYGEN_SHOULD_SKIP_THIS
110 
114 #define SU_RESULT SU_EXPORT enum SUResult
115 
120 #define SU_INVALID \
121  { 0 }
122 
127 #define SUIsValid(VARIABLE) ((VARIABLE).ptr != 0)
128 
133 #define SUIsInvalid(VARIABLE) ((VARIABLE).ptr == 0)
134 
138 #define SUSetInvalid(VARIABLE) (VARIABLE).ptr = 0
139 
143 #define SUAreEqual(VARIABLE1, VARIABLE2) ((VARIABLE1).ptr == (VARIABLE2).ptr)
144 
145 #include <stddef.h> // for size_t
146 
147 #if !defined(__STDC_HOSTED__) || (__STDC_HOSTED__ == 0)
148  // The host compiler does not implement C99
149  #ifdef WIN32
150 typedef __int64 int64_t;
151 typedef __int32 int32_t;
152 typedef __int16 int16_t;
153 typedef unsigned __int32 uint32_t;
154  #else
155  #error Unsupported compiler!
156  #endif
157 #else
158  #include <stdint.h>
159 #endif // #if !defined(__STDC_HOSTED__) || (__STDC_HOSTED__ == 0)
160 
166 #ifndef SU_SUPPRESS_DEPRECATION_WARNINGS
167  #ifdef WIN32
168  #define SU_DEPRECATED_FUNCTION(version_num) \
169  __declspec(deprecated("first deprecated in SketchUp API " version_num))
170  #else
171  #define SU_DEPRECATED_FUNCTION(version_num) \
172  __attribute__((deprecated("first deprecated in SketchUp API " version_num)))
173  #endif
174 #else
175  #define SU_DEPRECATED_FUNCTION(version_num)
176 #endif
177 
178 #endif // SKETCHUP_COMMON_H_