@swisseph/node 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,345 @@
1
+ /************************************************************
2
+ definitions and constants for all Swiss Ephemeris source files,
3
+ only required for compiling the libraries, not for the external
4
+ interface of the libraries.
5
+
6
+ The definitions are a subset of Astrodienst's ourdef.h content
7
+ and must be kept compatible. Everything not used in SwissEph
8
+ has been deleted.
9
+
10
+ Does auto-detection of MSDOS (TURBO_C or MS_C), HPUNIX, Linux.
11
+ Must be extended for more portability; there should be a way
12
+ to detect byte order and file system type.
13
+
14
+ ************************************************************/
15
+
16
+ /* Copyright (C) 1997 - 2021 Astrodienst AG, Switzerland. All rights reserved.
17
+
18
+ License conditions
19
+ ------------------
20
+
21
+ This file is part of Swiss Ephemeris.
22
+
23
+ Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND. No author
24
+ or distributor accepts any responsibility for the consequences of using it,
25
+ or for whether it serves any particular purpose or works at all, unless he
26
+ or she says so in writing.
27
+
28
+ Swiss Ephemeris is made available by its authors under a dual licensing
29
+ system. The software developer, who uses any part of Swiss Ephemeris
30
+ in his or her software, must choose between one of the two license models,
31
+ which are
32
+ a) GNU Affero General Public License (AGPL)
33
+ b) Swiss Ephemeris Professional License
34
+
35
+ The choice must be made before the software developer distributes software
36
+ containing parts of Swiss Ephemeris to others, and before any public
37
+ service using the developed software is activated.
38
+
39
+ If the developer choses the AGPL software license, he or she must fulfill
40
+ the conditions of that license, which includes the obligation to place his
41
+ or her whole software project under the AGPL or a compatible license.
42
+ See https://www.gnu.org/licenses/agpl-3.0.html
43
+
44
+ If the developer choses the Swiss Ephemeris Professional license,
45
+ he must follow the instructions as found in http://www.astro.com/swisseph/
46
+ and purchase the Swiss Ephemeris Professional Edition from Astrodienst
47
+ and sign the corresponding license contract.
48
+
49
+ The License grants you the right to use, copy, modify and redistribute
50
+ Swiss Ephemeris, but only under certain conditions described in the License.
51
+ Among other things, the License requires that the copyright notices and
52
+ this notice be preserved on all copies.
53
+
54
+ Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl
55
+
56
+ The authors of Swiss Ephemeris have no control or influence over any of
57
+ the derived works, i.e. over software or services created by other
58
+ programmers which use Swiss Ephemeris functions.
59
+
60
+ The names of the authors or of the copyright holder (Astrodienst) must not
61
+ be used for promoting any software, product or service which uses or contains
62
+ the Swiss Ephemeris. This copyright notice is the ONLY place where the
63
+ names of the authors can legally appear, except in cases where they have
64
+ given special permission in writing.
65
+
66
+ The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used
67
+ for promoting such software, products or services.
68
+ */
69
+
70
+ #ifndef _OURDEF_INCLUDED /* ourdef.h is a superset of sweodef.h */
71
+ #ifndef _SWEODEF_INCLUDED /* allow multiple #includes */
72
+ #define _SWEODEF_INCLUDED
73
+
74
+ # define MY_TRUE 1 /* for use in other defines, before TRUE is defined */
75
+ # define MY_FALSE 0 /* for use in other defines, before TRUE is defined */
76
+
77
+ #ifdef __CYGWIN__ // following T. Mack Jan/July 2021
78
+ # undef __GNUC__
79
+ #endif
80
+
81
+ /* TLS support
82
+ *
83
+ * Sun Studio C/C++, IBM XL C/C++, GNU C and Intel C/C++ (Linux systems) -> __thread
84
+ * Borland, VC++ -> __declspec(thread)
85
+ */
86
+ #if !defined(TLSOFF) && !defined( __APPLE__ ) && !defined(WIN32) && !defined(DOS32)
87
+ #if defined( __GNUC__ ) || defined( __CYGWIN__ )
88
+ #define TLS __thread
89
+ #else
90
+ #define TLS __declspec(thread)
91
+ #endif
92
+ #else
93
+ #define TLS
94
+ #endif
95
+
96
+ #ifdef _WIN32 /* Microsoft VC 5.0 does not define MSDOS anymore */
97
+ # undef MSDOS
98
+ # define MSDOS MY_TRUE
99
+ #include <wtypes.h>
100
+ #include <objbase.h>
101
+ #include <wincon.h>
102
+ #include <winbase.h>
103
+ #include <io.h>
104
+ #include <windows.h>
105
+ # define sleep(x) Sleep((x) * 1000)
106
+ #endif
107
+
108
+ #ifdef _MSC_VER
109
+ # define MS_VC
110
+ #endif
111
+
112
+ #ifdef WIN32 /* Microsoft VC 5.0 does not define MSDOS anymore */
113
+ # define MSDOS MY_TRUE
114
+ #endif
115
+
116
+ #ifdef MSDOS /* already defined by some DOS compilers */
117
+ # undef MSDOS
118
+ # define MSDOS MY_TRUE
119
+ #endif
120
+
121
+ #ifdef __TURBOC__ /* defined by turboc */
122
+ # ifndef MSDOS
123
+ # define MSDOS MY_TRUE
124
+ # endif
125
+ # define TURBO_C
126
+ #endif
127
+
128
+ #ifdef __SC__ /* defined by Symantec C */
129
+ # ifndef MSDOS
130
+ # define MSDOS MY_TRUE
131
+ # endif
132
+ # define SYMANTEC_C
133
+ #endif
134
+
135
+ #ifdef __WATCOMC__ /* defined by WatcomC */
136
+ # ifndef MSDOS
137
+ # define MSDOS MY_TRUE
138
+ # endif
139
+ # define WATCOMC
140
+ #endif
141
+
142
+ #ifdef __MWERKS__ /* defined on Macintosh CodeWarrior */
143
+ # if macintosh && powerc
144
+ # define MACOS MY_TRUE /* let it undefined otherwise */
145
+ # define MSDOS MY_FALSE /* in case one above fired falsely */
146
+ # endif
147
+ #endif
148
+
149
+ #ifdef MSDOS
150
+ # define HPUNIX MY_FALSE
151
+ # define INTEL_BYTE_ORDER 1
152
+ # ifndef TURBO_C
153
+ # define MS_C /* assume Microsoft C compiler */
154
+ # endif
155
+ # define UNIX_FS MY_FALSE
156
+ #else
157
+ # ifdef MACOS
158
+ # define HPUNIX MY_FALSE
159
+ # define UNIX_FS MY_FALSE
160
+ # else
161
+ # define MSDOS MY_FALSE
162
+ # define HPUNIX MY_TRUE
163
+ # ifndef _HPUX_SOURCE
164
+ # define _HPUX_SOURCE
165
+ # endif
166
+ # define UNIX_FS MY_TRUE
167
+ # endif
168
+ #endif
169
+
170
+ #include <math.h>
171
+ #include <stdlib.h>
172
+ #ifndef FILE
173
+ # include <stdio.h>
174
+ #endif
175
+
176
+ #if HPUNIX
177
+ # include <unistd.h>
178
+ #endif
179
+
180
+ /*
181
+ * if we have 16-bit ints, we define INT_16; we will need %ld to printf an int32
182
+ * if we have 64-bit long, we define LONG_64
183
+ * If none is defined, we have int = long = 32 bit, and use %d to printf an int32
184
+ */
185
+ #include <limits.h>
186
+ #if INT_MAX < 40000
187
+ # define INT_16
188
+ #else
189
+ # if LONG_MAX > INT_MAX
190
+ # define LONG_64
191
+ # endif
192
+ #endif
193
+
194
+ #ifdef BYTE_ORDER
195
+ #ifdef LITTLE_ENDIAN
196
+ # if BYTE_ORDER == LITTLE_ENDIAN
197
+ # define INTEL_BYTE_ORDER
198
+ # endif
199
+ #endif
200
+ #endif
201
+
202
+ #ifdef INT_16
203
+ typedef long int32;
204
+ typedef unsigned long uint32;
205
+ typedef int int16;
206
+ typedef double REAL8; /* real with at least 64 bit precision */
207
+ typedef long INT4; /* signed integer with at least 32 bit precision */
208
+ typedef unsigned long UINT4;
209
+ /* unsigned integer with at least 32 bit precision */
210
+ typedef int AS_BOOL;
211
+ typedef unsigned int UINT2; /* unsigned 16 bits */
212
+ # define ABS4 labs /* abs function for long */
213
+ #else
214
+ typedef int int32;
215
+ typedef long long int64;
216
+ typedef unsigned int uint32;
217
+ typedef short int16;
218
+ typedef double REAL8; /* real with at least 64 bit precision */
219
+ typedef int INT4; /* signed integer with at least 32 bit precision */
220
+ typedef unsigned int UINT4;
221
+ /* unsigned integer with at least 32 bit precision */
222
+ typedef int AS_BOOL;
223
+ typedef unsigned short UINT2; /* unsigned 16 bits */
224
+ # define ABS4 abs /* abs function for long */
225
+ #endif
226
+
227
+ #if MSDOS
228
+ # ifdef TURBO_C
229
+ # include <alloc.h> /* MSC needs malloc ! */
230
+ # else
231
+ # include <malloc.h>
232
+ # endif
233
+ # define SIGALRM SIGINT
234
+ #endif
235
+
236
+ #ifndef TRUE
237
+ # define TRUE 1
238
+ # define FALSE 0
239
+ #endif
240
+
241
+ #ifndef OK
242
+ # define OK (0)
243
+ # define ERR (-1)
244
+ #endif
245
+
246
+ /* hack because UCHAR is already used by mingw gcc */
247
+ #ifdef __GNUC__
248
+ #ifdef _WIN32
249
+ #define UCHAR SWE_UCHAR
250
+ #endif
251
+ #endif
252
+
253
+ typedef unsigned char UCHAR;
254
+ #define UCP (UCHAR*)
255
+ #define SCP (char*)
256
+
257
+ # define ODEGREE_STRING "°" /* degree as string, utf8 encoding */
258
+
259
+
260
+
261
+ #ifndef HUGE
262
+ # define HUGE 1.7E+308 /* biggest value for REAL8 */
263
+ #endif
264
+ #ifndef M_PI
265
+ # define M_PI 3.14159265358979323846
266
+ #endif
267
+
268
+ /* #define forward static obsolete */
269
+
270
+ #define AS_MAXCH 256 /* used for string declarations, allowing 255 char+\0 */
271
+
272
+ /*
273
+ #define DEGTORAD 0.0174532925199433
274
+ #define RADTODEG 57.2957795130823
275
+ */
276
+ #define RADTODEG (180.0 / M_PI)
277
+ #define DEGTORAD (M_PI / 180.0)
278
+
279
+ typedef int32 centisec; /* centiseconds used for angles and times */
280
+ #define CS (centisec) /* use for casting */
281
+ #define CSEC centisec /* use for typing */
282
+
283
+ #define DEG 360000 /* degree expressed in centiseconds */
284
+ #define DEG7_30 (2700000) /* 7.5 degrees */
285
+ #define DEG15 (15 * DEG)
286
+ #define DEG24 (24 * DEG)
287
+ #define DEG30 (30 * DEG)
288
+ #define DEG60 (60 * DEG)
289
+ #define DEG90 (90 * DEG)
290
+ #define DEG120 (120 * DEG)
291
+ #define DEG150 (150 * DEG)
292
+ #define DEG180 (180 * DEG)
293
+ #define DEG270 (270 * DEG)
294
+ #define DEG360 (360 * DEG)
295
+
296
+ /* #define CSTORAD 4.84813681109536E-08 centisec to rad: pi / 180 /3600/100 */
297
+ /* #define RADTOCS 2.06264806247096E+07 rad to centisec 180*3600*100/pi */
298
+ #define CSTORAD (DEGTORAD / 360000.0)
299
+ #define RADTOCS (RADTODEG * 360000.0)
300
+
301
+ #define CS2DEG (1.0/360000.0) /* centisec to degree */
302
+
303
+ /* control strings for fopen() */
304
+ #if UNIX_FS
305
+ # define BFILE_R_ACCESS "r" /* open binary file for reading */
306
+ # define BFILE_RW_ACCESS "r+" /* open binary file for writing and reading */
307
+ # define BFILE_W_CREATE "w" /* create/open binary file for write*/
308
+ # define BFILE_A_ACCESS "a+" /* create/open binary file for append*/
309
+ # define FILE_R_ACCESS "r" /* open text file for reading */
310
+ # define FILE_RW_ACCESS "r+" /* open text file for writing and reading */
311
+ # define FILE_W_CREATE "w" /* create/open text file for write*/
312
+ # define FILE_A_ACCESS "a+" /* create/open text file for append*/
313
+ # define O_BINARY 0 /* for open(), not defined in Unix */
314
+ # define OPEN_MODE 0666 /* default file creation mode */
315
+ # define DIR_GLUE "/" /* glue string for directory/file */
316
+ # define PATH_SEPARATOR ";:" /* semicolon or colon may be used */
317
+ #else
318
+ # define BFILE_R_ACCESS "rb" /* open binary file for reading */
319
+ # define BFILE_RW_ACCESS "r+b" /* open binary file for writing and reading */
320
+ # define BFILE_W_CREATE "wb" /* create/open binary file for write*/
321
+ # define BFILE_A_ACCESS "a+b" /* create/open binary file for append*/
322
+ # define PATH_SEPARATOR ";" /* semicolon as PATH separator */
323
+ # define OPEN_MODE 0666 /* default file creation mode */
324
+ # ifdef MACOS
325
+ # define FILE_R_ACCESS "r" /* open text file for reading */
326
+ # define FILE_RW_ACCESS "r+" /* open text file for writing and reading */
327
+ # define FILE_W_CREATE "w" /* create/open text file for write*/
328
+ # define FILE_A_ACCESS "a+" /* create/open text file for append*/
329
+ # define DIR_GLUE ":" /* glue string for directory/file */
330
+ # else
331
+ # define FILE_R_ACCESS "rt" /* open text file for reading */
332
+ # define FILE_RW_ACCESS "r+t" /* open text file for writing and reading */
333
+ # define FILE_W_CREATE "wt" /* create/open text file for write*/
334
+ # define FILE_A_ACCESS "a+t" /* create/open text file for append*/
335
+ /* attention, all backslashes for msdos directry names must be written as \\,
336
+ because it is the C escape character */
337
+ # define DIR_GLUE "\\" /* glue string for directory/file */
338
+ # endif
339
+ #endif
340
+
341
+ #include <string.h>
342
+ #include <ctype.h>
343
+
344
+ #endif /* _SWEODEF_INCLUDED */
345
+ #endif /* _OURDEF_INCLUDED */