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