amath  1.8.5
Simple command line calculator
amath.h
Go to the documentation of this file.
1 /*-
2  * Copyright (c) 2014-2018 Carsten Sonne Larsen <cs@innolan.net>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  * notice, this list of conditions and the following disclaimer in the
12  * documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24  *
25  * Project homepage:
26  * https://amath.innolan.net
27  *
28  */
29 
30 #ifndef AMATH_H
31 #define AMATH_H
32 /******************************************************************************/
33 #ifdef __AMIGA__
34 # ifndef AOS3
35 # define AOS3
36 # endif
37 #endif
38 /******************************************************************************/
39 #ifdef __AROS__
40 # ifndef AROS
41 # define AROS
42 # endif
43 #endif
44 /******************************************************************************/
45 #ifdef __MORPHOS__
46 # ifndef MORPHOS
47 # define MORPHOS
48 # endif
49 #endif
50 /******************************************************************************/
51 #ifdef __amigaos4__
52 # ifndef AOS4
53 # define AOS4
54 # endif
55 #endif
56 /******************************************************************************/
57 #ifdef __HAIKU__
58 # ifndef HAIKU
59 # define HAIKU
60 # endif
61 #endif
62 /******************************************************************************/
63 #ifdef __APPLE__
64 # ifndef APPLE
65 # define APPLE
66 # endif
67 #endif
68 /******************************************************************************/
69 #if defined(_WIN32) || defined(_WIN64)
70 # ifndef WINDOWS
71 # define WINDOWS
72 # endif
73 #endif
74 /******************************************************************************/
75 #if defined(AOS3) || defined(AOS4) || defined(AROS) || defined (MORPHOS)
76 # ifndef AMIGA
77 # define AMIGA
78 # endif
79 #endif
80 /******************************************************************************/
81 #if defined(unix) || defined(__unix__) || defined(__unix)
82 # ifndef UNIX
83 # define UNIX
84 # endif
85 #endif
86 /******************************************************************************/
87 #if defined(HAIKU) || defined(UNIX) || defined(APPLE)
88 # ifndef TERMIOS
89 # define TERMIOS
90 # endif
91 # include <stdint.h>
92 # include <unistd.h>
93 #endif
94 /******************************************************************************/
95 #if defined(WINDOWS)
96 # include <stdint.h>
97 #endif
98 /******************************************************************************/
99 #if defined(AROS) || defined(MORPHOS) || defined(AOS4)
100 # include <stdint.h>
101 # include <sys/types.h>
102 #endif
103 /******************************************************************************/
104 #if defined(AOS3)
105 # include <sys/types.h>
106 # define IPTR LONG*
107 # define uintptr_t uint32_t
108 typedef u_int8_t uint8_t;
109 typedef u_int16_t uint16_t;
110 typedef u_int32_t uint32_t;
111 typedef u_int64_t uint64_t;
112 #endif
113 /******************************************************************************/
114 #if (__cplusplus <= 199711L && !defined(WINDOWS)) || !defined(__cplusplus)
115 #ifndef nullptr
116 #define nullptr 0
117 #endif
118 #elif (__cplusplus <= 199711L) && (defined(__GNUC__) || defined(__GNUG__))
119 #ifndef nullptr
120 #define nullptr 0
121 #endif
122 #endif
123 /******************************************************************************/
124 #define assert(x)
125 /******************************************************************************/
126 /* Compilers*/
127 #if defined(__clang__)
128 /* Clang */
129 # if defined(__apple_build_version__)
130 # define COMP_NAME "XCode Clang"
131 # else
132 # define COMP_NAME "Clang/LLVM"
133 # endif
134 # define str(x) #x
135 # define CL_VER_STR(x) str(x)
136 # ifdef __clang_patchlevel__
137 # define COMP_VERS CL_VER_STR(__clang_major__) DOT
138  CL_VER_STR(__clang_minor__) DOT
139  CL_VER_STR(__clang_patchlevel__)
140 # else
141 # define COMP_VERS CL_VER_STR(__clang_major__) DOT
142  CL_VER_STR(__clang_minor__)
143 # endif
144 
145 /* Intel ICC/ICPC */
146 #elif defined(__ECC) || defined(__ICC) || defined(__INTEL_COMPILER)
147 # define COMP_NAME "Intel ICC/ICPC"
148 # define COMP_VERS __VERSION__
149 
150 /* IBM XL C/C++ */
151 #elif defined(__IBMC__) || defined(__IBMCPP__)
152 # define COMP_NAME "IBM XL"
153 # define COMP_VERS __xlc__
154 
155 /* Microsoft Visual Studio */
156 #elif defined(_MSC_VER)
157 # define COMP_NAME "MSVC++"
158 # if (_MSC_VER == 1100)
159 # define COMP_VERS "5.0"
160 # elif (_MSC_VER == 1200)
161 # define COMP_VERS "6.0"
162 # elif (_MSC_VER == 1300)
163 # define COMP_VERS "7.0"
164 # elif (_MSC_VER == 1310)
165 # define COMP_VERS "7.1"
166 # elif (_MSC_VER == 1400)
167 # define COMP_VERS "8.0"
168 # elif (_MSC_VER == 1500)
169 # define COMP_VERS "9.0"
170 # elif (_MSC_VER == 1600)
171 # define COMP_VERS "10.0"
172 # elif (_MSC_VER == 1700)
173 # define COMP_VERS "11.0"
174 # elif (_MSC_VER == 1800)
175 # define COMP_VERS "12.0"
176 # elif (_MSC_VER == 1900)
177 # define COMP_VERS "14.0"
178 # elif (_MSC_VER > 1900)
179 # define COMP_VERS "15.0+"
180 # else
181 # define str(x) #x
182 # define MSC_VER_STR(x) str(x)
183 # define COMP_VERS MSC_VER_STR(_MSC_VER)
184 # endif
185 
186 /* Portland Group PGCC/PGCPP */
187 #elif defined(__PGI)
188 # define COMP_NAME "PGCC/PGCPP"
189 # define str(x) #x
190 # define PGCC_VER_STR(x) str(x)
191 # ifdef __PGIC_PATCHLEVEL__
192 # define COMP_VERS PGCC_VER_STR(__PGIC__) DOT
193  PGCC_VER_STR(__PGIC_MINOR) DOT
194  PGCC_VER_STR(__PGIC_PATCHLEVEL__)
195 # else
196 # define COMP_VERS PGCC_VER_STR(__PGIC__) DOT
197  PGCC_VER_STR(__PGIC_MINOR)
198 # endif
199 
200 /* GNU GCC/G++ */
201 #elif defined(__GNUC__) || defined(__GNUG__)
202 # define COMP_NAME "GCC"
203 # define str(x) #x
204 # define GCC_VER_STR(x) str(x)
205 # ifdef __GNUC_PATCHLEVEL__
206 # define COMP_VERS GCC_VER_STR(__GNUC__) DOT GCC_VER_STR(__GNUC_MINOR__) DOT
207  GCC_VER_STR(__GNUC_PATCHLEVEL__)
208 # else
209 # define COMP_VERS GCC_VER_STR(__GNUC__) DOT GCC_VER_STR(__GNUC_MINOR__)
210 # endif
211 #endif
212 /******************************************************************************/
213 #define EMPTYSTRING ""
214 #define SPACE " "
215 #define DOT "."
216 /******************************************************************************/
217 #if defined(WINDOWS)
218 #define NEWLINE "\r\n"
219 #elif defined(APPLE)
220 #define NEWLINE "\r"
221 #else
222 #define NEWLINE "\n"
223 #endif
224 /******************************************************************************/
225 #ifndef __cplusplus
226 typedef int bool;
227 #define true 1
228 #define false 0
229 #endif
230 /******************************************************************************/
231 #define LONG_BIT 32
232 #define wsize sizeof(unsigned int)
233 #define wmask (wsize - 1)
234 /******************************************************************************/
235 #if defined(INTELCPU) || defined(i386) || defined(i486) ||
236  defined(intel) || defined(x86) || defined(i86pc) ||
237  defined(__i386__) || defined(_M_IX86)
238 # ifdef TXTCPU
239 # undef TXTCPU
240 # endif
241 # define TXTCPU "i386"
242 #endif
243 #if defined(__x86_64__) || defined(_M_AMD64)
244 # define TXTCPU "amd64"
245 #endif
246 /******************************************************************************/
247 #if defined(__powerpc__) || defined(__powerpc64__)
248 # define TXTCPU "PowerPC"
249 #endif
250 /******************************************************************************/
251 #if defined(__arm__) || defined(_M_ARM) || defined(__ARM_ARCH_6__)
252 # define TXTCPU "arm"
253 #endif
254 #if defined(__aarch64__) || defined(_M_ARM64)
255 # define TXTCPU "arm64"
256 #endif
257 /******************************************************************************/
258 #if defined(m68060) || defined(mc68060)
259 # define TXTCPU "68060"
260 #elif defined(m68040) || defined(mc68040)
261 # define TXTCPU "68040"
262 #elif defined(m68030) || defined(mc68030)
263 # define TXTCPU "68030"
264 #elif defined(m68020) || defined(mc68020)
265 # define TXTCPU "68020"
266 #elif defined(m68010) || defined(mc68010)
267 # define TXTCPU "68010"
268 #elif defined(m68000) || defined(mc68000)
269 # define TXTCPU "68000+"
270 #endif
271 /******************************************************************************/
272 #ifndef TXTCPU
273 //#error what cpu is this ?!
274 # define TXTCPU EMPTYSTRING
275 #endif
276 /******************************************************************************/
277 #if defined(TXTCPU) && defined(__HAVE_68881__)
278 # define TXTFPU SPACE "FPU"
279 #else
280 # define TXTFPU EMPTYSTRING
281 #endif
282 /******************************************************************************/
283 #define TXTARCH TXTCPU TXTFPU
284 #define RELDATESTAMP "(07-08-2018)"
285 #define TXTDOSVERSION "\0$VER: amath 1.85" SPACE RELDATESTAMP SPACE TXTARCH
286 #define TXTTITLE "amath version 1.8.5"
287 #define TXTCOPYRIGHT "(c) 2018 Carsten Sonne Larsen"
288 #define TXTSTARTMSG TXTTITLE SPACE TXTCOPYRIGHT
289 /******************************************************************************/
291 #define TXTCOMPMSG "Compiled with " COMP_NAME SPACE COMP_VERS
292 /******************************************************************************/
293 #define CPROCNAME "amath_console"
294 /******************************************************************************/
295 #if defined(AMIGA)
296 #define AMIGADOS_NAME "dos.library"
297 #define AMIGADOS_REV 33L
298 #define INTUITION_REV 37L
299 #define INTUITION_NAME "intuition.library"
300 #define GRAPHICS_REV 37L
301 #define GRAPHICS_NAME "graphics.library"
302 #define LOCALE_REV 38L
303 #define LOCALE_NAME "locale.library"
304 #define DEVCONSOLE "console.device"
305 #define PORTCR "RKM.console.read"
306 #define PORTCW "RKM.console.write"
307 #define CATALOG_HELP "amath-help.catalog"
308 #define CATALOG_IDEN "amath-ident.catalog"
309 #define CATALOG_TEXT "amath-text.catalog"
310 #define CATALOG_KEYW "amath-keyword.catalog"
311 #define CATALOG_DEF OC_BuiltInLanguage, "english"
312 #endif
313 /******************************************************************************/
314 #endif
#define TXTTITLE
Definition: amath.h:286
#define EMPTYSTRING
Definition: amath.h:213
#define SPACE
Definition: amath.h:214
#define TXTCOPYRIGHT
Definition: amath.h:287
#define RELDATESTAMP
Definition: amath.h:284
#define TXTCPU
Definition: amath.h:274
#define wsize
Definition: amath.h:232
#define TXTFPU
Definition: amath.h:280
#define TXTARCH
Definition: amath.h:283
#define DOT
Definition: amath.h:215