astro_chart 0.1.0

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,326 @@
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
+
143
+ #ifdef MSDOS
144
+ # define HPUNIX MY_FALSE
145
+ # define INTEL_BYTE_ORDER 1
146
+ # ifndef TURBO_C
147
+ # define MS_C /* assume Microsoft C compiler */
148
+ # endif
149
+ # define UNIX_FS MY_FALSE
150
+ #else
151
+ # define MSDOS MY_FALSE
152
+ # define HPUNIX MY_TRUE
153
+ # ifndef _HPUX_SOURCE
154
+ # define _HPUX_SOURCE
155
+ # endif
156
+ # define UNIX_FS MY_TRUE
157
+ #endif
158
+
159
+ #include <math.h>
160
+ #include <stdlib.h>
161
+ #ifndef FILE
162
+ # include <stdio.h>
163
+ #endif
164
+
165
+ #if HPUNIX
166
+ # include <unistd.h>
167
+ #endif
168
+
169
+ /*
170
+ * if we have 16-bit ints, we define INT_16; we will need %ld to printf an int32
171
+ * if we have 64-bit long, we define LONG_64
172
+ * If none is defined, we have int = long = 32 bit, and use %d to printf an int32
173
+ */
174
+ #include <limits.h>
175
+ #if INT_MAX < 40000
176
+ # define INT_16
177
+ #else
178
+ # if LONG_MAX > INT_MAX
179
+ # define LONG_64
180
+ # endif
181
+ #endif
182
+
183
+ #ifdef BYTE_ORDER
184
+ #ifdef LITTLE_ENDIAN
185
+ # if BYTE_ORDER == LITTLE_ENDIAN
186
+ # define INTEL_BYTE_ORDER
187
+ # endif
188
+ #endif
189
+ #endif
190
+
191
+ #ifdef INT_16
192
+ typedef long int32;
193
+ typedef unsigned long uint32;
194
+ typedef int int16;
195
+ typedef double REAL8; /* real with at least 64 bit precision */
196
+ typedef long INT4; /* signed integer with at least 32 bit precision */
197
+ typedef unsigned long UINT4;
198
+ /* unsigned integer with at least 32 bit precision */
199
+ typedef int AS_BOOL;
200
+ typedef unsigned int UINT2; /* unsigned 16 bits */
201
+ # define ABS4 labs /* abs function for long */
202
+ #else
203
+ typedef int int32;
204
+ typedef long long int64;
205
+ typedef unsigned int uint32;
206
+ typedef short int16;
207
+ typedef double REAL8; /* real with at least 64 bit precision */
208
+ typedef int INT4; /* signed integer with at least 32 bit precision */
209
+ typedef unsigned int UINT4;
210
+ /* unsigned integer with at least 32 bit precision */
211
+ typedef int AS_BOOL;
212
+ typedef unsigned short UINT2; /* unsigned 16 bits */
213
+ # define ABS4 abs /* abs function for long */
214
+ #endif
215
+
216
+ #if MSDOS
217
+ # ifdef TURBO_C
218
+ # include <alloc.h> /* MSC needs malloc ! */
219
+ # else
220
+ # include <malloc.h>
221
+ # endif
222
+ # define SIGALRM SIGINT
223
+ #endif
224
+
225
+ #ifndef TRUE
226
+ # define TRUE 1
227
+ # define FALSE 0
228
+ #endif
229
+
230
+ #ifndef OK
231
+ # define OK (0)
232
+ # define ERR (-1)
233
+ #endif
234
+
235
+ /* hack because UCHAR is already used by mingw gcc */
236
+ #ifdef __GNUC__
237
+ #ifdef _WIN32
238
+ #define UCHAR SWE_UCHAR
239
+ #endif
240
+ #endif
241
+
242
+ typedef unsigned char UCHAR;
243
+ #define UCP (UCHAR*)
244
+ #define SCP (char*)
245
+
246
+ # define ODEGREE_STRING "°" /* degree as string, utf8 encoding */
247
+
248
+
249
+
250
+ #ifndef HUGE
251
+ # define HUGE 1.7E+308 /* biggest value for REAL8 */
252
+ #endif
253
+ #ifndef M_PI
254
+ # define M_PI 3.14159265358979323846
255
+ #endif
256
+
257
+ /* #define forward static obsolete */
258
+
259
+ #define AS_MAXCH 256 /* used for string declarations, allowing 255 char+\0 */
260
+
261
+ /*
262
+ #define DEGTORAD 0.0174532925199433
263
+ #define RADTODEG 57.2957795130823
264
+ */
265
+ #define RADTODEG (180.0 / M_PI)
266
+ #define DEGTORAD (M_PI / 180.0)
267
+
268
+ typedef int32 centisec; /* centiseconds used for angles and times */
269
+ #define CS (centisec) /* use for casting */
270
+ #define CSEC centisec /* use for typing */
271
+
272
+ #define DEG 360000 /* degree expressed in centiseconds */
273
+ #define DEG7_30 (2700000) /* 7.5 degrees */
274
+ #define DEG15 (15 * DEG)
275
+ #define DEG24 (24 * DEG)
276
+ #define DEG30 (30 * DEG)
277
+ #define DEG60 (60 * DEG)
278
+ #define DEG90 (90 * DEG)
279
+ #define DEG120 (120 * DEG)
280
+ #define DEG150 (150 * DEG)
281
+ #define DEG180 (180 * DEG)
282
+ #define DEG270 (270 * DEG)
283
+ #define DEG360 (360 * DEG)
284
+
285
+ /* #define CSTORAD 4.84813681109536E-08 centisec to rad: pi / 180 /3600/100 */
286
+ /* #define RADTOCS 2.06264806247096E+07 rad to centisec 180*3600*100/pi */
287
+ #define CSTORAD (DEGTORAD / 360000.0)
288
+ #define RADTOCS (RADTODEG * 360000.0)
289
+
290
+ #define CS2DEG (1.0/360000.0) /* centisec to degree */
291
+
292
+ /* control strings for fopen() */
293
+ #if UNIX_FS
294
+ # define BFILE_R_ACCESS "r" /* open binary file for reading */
295
+ # define BFILE_RW_ACCESS "r+" /* open binary file for writing and reading */
296
+ # define BFILE_W_CREATE "w" /* create/open binary file for write*/
297
+ # define BFILE_A_ACCESS "a+" /* create/open binary file for append*/
298
+ # define FILE_R_ACCESS "r" /* open text file for reading */
299
+ # define FILE_RW_ACCESS "r+" /* open text file for writing and reading */
300
+ # define FILE_W_CREATE "w" /* create/open text file for write*/
301
+ # define FILE_A_ACCESS "a+" /* create/open text file for append*/
302
+ # define O_BINARY 0 /* for open(), not defined in Unix */
303
+ # define OPEN_MODE 0666 /* default file creation mode */
304
+ # define DIR_GLUE "/" /* glue string for directory/file */
305
+ # define PATH_SEPARATOR ";:" /* semicolon or colon may be used */
306
+ #else
307
+ # define BFILE_R_ACCESS "rb" /* open binary file for reading */
308
+ # define BFILE_RW_ACCESS "r+b" /* open binary file for writing and reading */
309
+ # define BFILE_W_CREATE "wb" /* create/open binary file for write*/
310
+ # define BFILE_A_ACCESS "a+b" /* create/open binary file for append*/
311
+ # define PATH_SEPARATOR ";" /* semicolon as PATH separator */
312
+ # define OPEN_MODE 0666 /* default file creation mode */
313
+ # define FILE_R_ACCESS "rt" /* open text file for reading */
314
+ # define FILE_RW_ACCESS "r+t" /* open text file for writing and reading */
315
+ # define FILE_W_CREATE "wt" /* create/open text file for write*/
316
+ # define FILE_A_ACCESS "a+t" /* create/open text file for append*/
317
+ /* attention, all backslashes for msdos directry names must be written as \\,
318
+ because it is the C escape character */
319
+ # define DIR_GLUE "\\" /* glue string for directory/file */
320
+ #endif
321
+
322
+ #include <string.h>
323
+ #include <ctype.h>
324
+
325
+ #endif /* _SWEODEF_INCLUDED */
326
+ #endif /* _OURDEF_INCLUDED */