Changeset 330

Show
Ignore:
Timestamp:
06/03/09 18:40:18 (3 years ago)
Author:
stnsls
Message:

Update.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/swisseph/swisseph.d

    r255 r330  
    11/** 
    2  * dswisseph: D port of AstroDienst Swiss Ephemeris library. 
     2 * D bindings for AstroDienst Swiss Ephemeris library. 
    33 * 
    4  * AstroDienst website http://www.astro.com/swisseph 
     4 * Author: Stanislas Marquis <stnsls@gmail.com> 
     5 * Swisseph version: 1.76.00 
     6 * Date: 03.06.2009 
     7 */ 
     8 
     9module swisseph; 
     10 
     11extern (C): 
     12 
     13/************************************************************ 
     14  $Header: /home/dieter/sweph/RCS/swephexp.h,v 1.74 2008/06/16 10:07:20 dieter Exp $ 
     15  SWISSEPH: exported definitions and constants 
     16 
     17  This file represents the standard application interface (API) 
     18  to the Swiss Ephemeris. 
     19 
     20  A C programmer needs only to include this file, and link his code 
     21  with the SwissEph library. 
     22 
     23  The function calls are documented in the Programmer's documentation, 
     24  which is online in HTML format. 
     25 
     26  Structure of this file: 
     27    Public API definitions 
     28    Internal developer's definitions 
     29    Public API functions. 
     30 
     31  Authors: Dieter Koch and Alois Treindl, Astrodienst ZÃŒrich 
     32 
     33************************************************************/ 
     34/* Copyright (C) 1997 - 2008 Astrodienst AG, Switzerland.  All rights reserved. 
     35 
     36  License conditions 
     37  ------------------ 
     38 
     39  This file is part of Swiss Ephemeris. 
     40 
     41  Swiss Ephemeris is distributed with NO WARRANTY OF ANY KIND.  No author 
     42  or distributor accepts any responsibility for the consequences of using it, 
     43  or for whether it serves any particular purpose or works at all, unless he 
     44  or she says so in writing. 
     45 
     46  Swiss Ephemeris is made available by its authors under a dual licensing 
     47  system. The software developer, who uses any part of Swiss Ephemeris 
     48  in his or her software, must choose between one of the two license models, 
     49  which are 
     50  a) GNU public license version 2 or later 
     51  b) Swiss Ephemeris Professional License 
     52 
     53  The choice must be made before the software developer distributes software 
     54  containing parts of Swiss Ephemeris to others, and before any public 
     55  service using the developed software is activated. 
     56 
     57  If the developer choses the GNU GPL software license, he or she must fulfill 
     58  the conditions of that license, which includes the obligation to place his 
     59  or her whole software project under the GNU GPL or a compatible license. 
     60  See http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 
     61 
     62  If the developer choses the Swiss Ephemeris Professional license, 
     63  he must follow the instructions as found in http://www.astro.com/swisseph/ 
     64  and purchase the Swiss Ephemeris Professional Edition from Astrodienst 
     65  and sign the corresponding license contract. 
     66 
     67  The License grants you the right to use, copy, modify and redistribute 
     68  Swiss Ephemeris, but only under certain conditions described in the License. 
     69  Among other things, the License requires that the copyright notices and 
     70  this notice be preserved on all copies. 
     71 
     72  Authors of the Swiss Ephemeris: Dieter Koch and Alois Treindl 
     73 
     74  The authors of Swiss Ephemeris have no control or influence over any of 
     75  the derived works, i.e. over software or services created by other 
     76  programmers which use Swiss Ephemeris functions. 
     77 
     78  The names of the authors or of the copyright holder (Astrodienst) must not 
     79  be used for promoting any software, product or service which uses or contains 
     80  the Swiss Ephemeris. This copyright notice is the ONLY place where the 
     81  names of the authors can legally appear, except in cases where they have 
     82  given special permission in writing. 
     83 
     84  The trademarks 'Swiss Ephemeris' and 'Swiss Ephemeris inside' may be used 
     85  for promoting such software, products or services. 
     86*/ 
     87 
     88/*********************************************************** 
     89 * definitions for use also by non-C programmers 
     90 ***********************************************************/ 
     91 
     92/* values for gregflag in swe_julday() and swe_revjul() */ 
     93const SE_JUL_CAL        = 0; 
     94const SE_GREG_CAL       = 1; 
     95 
     96/* 
     97 * planet numbers for the ipl parameter in swe_calc() 
     98 */ 
     99const SE_ECL_NUT        = -1; 
     100 
     101const SE_SUN            = 0; 
     102const SE_MOON           = 1; 
     103const SE_MERCURY        = 2; 
     104const SE_VENUS          = 3; 
     105const SE_MARS           = 4; 
     106const SE_JUPITER        = 5; 
     107const SE_SATURN         = 6; 
     108const SE_URANUS         = 7; 
     109const SE_NEPTUNE        = 8; 
     110const SE_PLUTO          = 9; 
     111const SE_MEAN_NODE      = 10; 
     112const SE_TRUE_NODE      = 11; 
     113const SE_MEAN_APOG      = 12; 
     114const SE_OSCU_APOG      = 13; 
     115const SE_EARTH          = 14; 
     116const SE_CHIRON         = 15; 
     117const SE_PHOLUS         = 16; 
     118const SE_CERES          = 17; 
     119const SE_PALLAS         = 18; 
     120const SE_JUNO           = 19; 
     121const SE_VESTA          = 20; 
     122const SE_INTP_APOG      = 21; 
     123const SE_INTP_PERG      = 22; 
     124 
     125const SE_NPLANETS       = 23; 
     126 
     127const SE_AST_OFFSET     = 10000; 
     128const SE_VARUNA         = SE_AST_OFFSET + 20000; 
     129 
     130const SE_FICT_OFFSET    = 40; 
     131const SE_FICT_OFFSET_1  = 39; 
     132const SE_FICT_MAX       = 999; 
     133const SE_NFICT_ELEM     = 15; 
     134 
     135const SE_COMET_OFFSET   = 1000; 
     136 
     137const SE_NALL_NAT_POINTS = SE_NPLANETS + SE_NFICT_ELEM; 
     138 
     139/* Hamburger or Uranian "planets" */ 
     140const SE_CUPIDO         = 40; 
     141const SE_HADES          = 41; 
     142const SE_ZEUS           = 42; 
     143const SE_KRONOS         = 43; 
     144const SE_APOLLON        = 44; 
     145const SE_ADMETOS        = 45; 
     146const SE_VULKANUS       = 46; 
     147const SE_POSEIDON       = 47; 
     148/* other fictitious bodies */ 
     149const SE_ISIS           = 48; 
     150const SE_NIBIRU         = 49; 
     151const SE_HARRINGTON     = 50; 
     152const SE_NEPTUNE_LEVERRIER  = 51; 
     153const SE_NEPTUNE_ADAMS      = 52; 
     154const SE_PLUTO_LOWELL       = 53; 
     155const SE_PLUTO_PICKERING    = 54; 
     156const SE_VULCAN         = 55; 
     157const SE_WHITE_MOON     = 56; 
     158const SE_PROSERPINA     = 57; 
     159const SE_WALDEMATH      = 58; 
     160 
     161const SE_FIXSTAR        = -10; 
     162 
     163const SE_ASC            = 0; 
     164const SE_MC             = 1; 
     165const SE_ARMC           = 2; 
     166const SE_VERTEX     = 3; 
     167const SE_EQUASC     = 4;   /* "equatorial ascendant" */ 
     168const SE_COASC1     = 5;   /* "co-ascendant" (W. Koch) */ 
     169const SE_COASC2     = 6;   /* "co-ascendant" (M. Munkasey) */ 
     170const SE_POLASC     = 7;   /* "polar ascendant" (M. Munkasey) */ 
     171const SE_NASCMC     = 8; 
     172 
     173/* 
     174 * flag bits for parameter iflag in function swe_calc() 
     175 * The flag bits are defined in such a way that iflag = 0 delivers what one 
     176 * usually wants: 
     177 *    - the default ephemeris (SWISS EPHEMERIS) is used, 
     178 *    - apparent geocentric positions referring to the true equinox of date 
     179 *      are returned. 
     180 * If not only coordinates, but also speed values are required, use 
     181 * flag = SEFLG_SPEED. 
    5182 * 
    6  * Authors: Stanislas Marquis <stnsls@gmail.com> 
    7  * Swisseph version: 1.72.00 
    8  * Date: 05.04.2008 
    9  * 
     183 * The 'L' behind the number indicates that 32-bit integers (Long) are used. 
    10184 */ 
    11  
    12 module swisseph; 
    13  
    14 extern (C): 
    15  
    16 const int SE_JUL_CAL = 0; 
    17 const int SE_GREG_CAL = 1; 
    18  
    19 const int SE_ECL_NUT = -1; 
    20  
    21 const int SE_SUN = 0; 
    22 const int SE_MOON = 1; 
    23 const int SE_MERCURY = 2; 
    24 const int SE_VENUS = 3; 
    25 const int SE_MARS = 4; 
    26 const int SE_JUPITER = 5; 
    27 const int SE_SATURN = 6; 
    28 const int SE_URANUS = 7; 
    29 const int SE_NEPTUNE = 8; 
    30 const int SE_PLUTO = 9; 
    31 const int SE_MEAN_NODE = 10; 
    32 const int SE_TRUE_NODE = 11; 
    33 const int SE_MEAN_APOG = 12; 
    34 const int SE_OSCU_APOG = 13; 
    35 const int SE_EARTH = 14; 
    36 const int SE_CHIRON = 15; 
    37 const int SE_PHOLUS = 16; 
    38 const int SE_CERES = 17; 
    39 const int SE_PALLAS = 18; 
    40 const int SE_JUNO = 19; 
    41 const int SE_VESTA = 20; 
    42 const int SE_INTP_APOG = 21; 
    43 const int SE_INTP_PERG = 22; 
    44  
    45 const int SE_NPLANETS = 23; 
    46  
    47 const int SE_AST_OFFSET = 10000; 
    48 const int SE_VARUNA = SE_AST_OFFSET + 20000; 
    49  
    50 const int SE_FICT_OFFSET = 40; 
    51 const int SE_FICT_OFFSET_1 = 39; 
    52 const int SE_FICT_MAX = 999; 
    53 const int SE_NFICT_ELEM = 15; 
    54  
    55 const int SE_COMET_OFFSET = 1000; 
    56  
    57 const int SE_NALL_NAT_POINTS = SE_NPLANETS + SE_NFICT_ELEM; 
    58  
    59 const int SE_CUPIDO = 40; 
    60 const int SE_HADES = 41; 
    61 const int SE_ZEUS = 42; 
    62 const int SE_KRONOS = 43; 
    63 const int SE_APOLLON = 44; 
    64 const int SE_ADMETOS = 45; 
    65 const int SE_VULKANUS = 46; 
    66 const int SE_POSEIDON = 47; 
    67  
    68 const int SE_ISIS = 48; 
    69 const int SE_NIBIRU = 49; 
    70 const int SE_HARRINGTON = 50; 
    71 const int SE_NEPTUNE_LEVERRIER = 51; 
    72 const int SE_NEPTUNE_ADAMS = 52; 
    73 const int SE_PLUTO_LOWELL = 53; 
    74 const int SE_PLUTO_PICKERING = 54; 
    75 const int SE_VULCAN = 55; 
    76 const int SE_WHITE_MOON = 56; 
    77 const int SE_PROSERPINA = 57; 
    78 const int SE_WALDEMATH = 58; 
    79  
    80 const int SE_FIXSTAR = -10; 
    81  
    82 const int SE_ASC = 0; 
    83 const int SE_MC = 1; 
    84 const int SE_ARMC = 2; 
    85 const int SE_VERTEX = 3; 
    86 const int SE_EQUASC = 4; 
    87 const int SE_COASC1 = 5; 
    88 const int SE_COASC2 = 6; 
    89 const int SE_POLASC = 7; 
    90 const int SE_NASCMC = 8; 
    91  
    92 const int SEFLG_JPLEPH = 1; 
    93 const int SEFLG_SWIEPH = 2; 
    94 const int SEFLG_MOSEPH = 4; 
    95  
    96 const int SEFLG_HELCTR = 8; 
    97 const int SEFLG_TRUEPOS = 16; 
    98 const int SEFLG_J2000 = 32; 
    99 const int SEFLG_NONUT = 64; 
    100 const int SEFLG_SPEED3 = 128; 
    101 const int SEFLG_SPEED = 256; 
    102 const int SEFLG_NOGDEFL = 512; 
    103 const int SEFLG_NOABERR = 1024; 
    104 const int SEFLG_EQUATORIAL = 2*1024; 
    105 const int SEFLG_XYZ = 4*1024; 
    106 const int SEFLG_RADIANS = 8*1024; 
    107 const int SEFLG_BARYCTR = 16*1024; 
    108 const int SEFLG_TOPOCTR = 32*1024; 
    109 const int SEFLG_SIDEREAL = 64*1024; 
    110 const int SEFLG_ICRS = 128*1024; 
    111  
    112 const int SE_SIDBITS = 256; 
    113  
    114 const int SE_SIDBIT_ECL_T0 = 256; 
    115  
    116 const int SE_SIDBIT_SSY_PLANE = 512; 
    117  
    118 const int SE_SIDM_FAGAN_BRADLEY = 0; 
    119 const int SE_SIDM_LAHIRI = 1; 
    120 const int SE_SIDM_DELUCE = 2; 
    121 const int SE_SIDM_RAMAN = 3; 
    122 const int SE_SIDM_USHASHASHI = 4; 
    123 const int SE_SIDM_KRISHNAMURTI = 5; 
    124 const int SE_SIDM_DJWHAL_KHUL = 6; 
    125 const int SE_SIDM_YUKTESHWAR = 7; 
    126 const int SE_SIDM_JN_BHASIN = 8; 
    127 const int SE_SIDM_BABYL_KUGLER1 = 9; 
    128 const int SE_SIDM_BABYL_KUGLER2 = 10; 
    129 const int SE_SIDM_BABYL_KUGLER3 = 11; 
    130 const int SE_SIDM_BABYL_HUBER = 12; 
    131 const int SE_SIDM_BABYL_ETPSC = 13; 
    132 const int SE_SIDM_ALDEBARAN_15TAU = 14; 
    133 const int SE_SIDM_HIPPARCHOS = 15; 
    134 const int SE_SIDM_SASSANIAN = 16; 
    135 const int SE_SIDM_GALCENT_0SAG = 17; 
    136 const int SE_SIDM_J2000 = 18; 
    137 const int SE_SIDM_J1900 = 19; 
    138 const int SE_SIDM_B1950 = 20; 
    139 const int SE_SIDM_USER = 255; 
    140  
    141 const int SE_NSIDM_PREDEF = 21; 
    142  
    143 const int SE_NODBIT_MEAN = 1; 
    144 const int SE_NODBIT_OSCU = 2; 
    145 const int SE_NODBIT_OSCU_BAR = 4; 
    146 const int SE_NODBIT_FOPOINT = 256; 
    147  
    148 const int SEFLG_DEFAULTEPH = SEFLG_SWIEPH; 
    149  
    150 const int SE_MAX_STNAME = 20; 
    151  
    152 const int SE_ECL_CENTRAL = 1; 
    153 const int SE_ECL_NONCENTRAL = 2; 
    154 const int SE_ECL_TOTAL = 4; 
    155 const int SE_ECL_ANNULAR = 8; 
    156 const int SE_ECL_PARTIAL = 16; 
    157 const int SE_ECL_ANNULAR_TOTAL = 32; 
    158 const int SE_ECL_PENUMBRAL = 64; 
    159 const int SE_ECL_VISIBLE = 128; 
    160 const int SE_ECL_MAX_VISIBLE = 256; 
    161 const int SE_ECL_1ST_VISIBLE = 512; 
    162 const int SE_ECL_2ND_VISIBLE = 1024; 
    163 const int SE_ECL_3RD_VISIBLE = 2048; 
    164 const int SE_ECL_4TH_VISIBLE = 4096; 
    165 const int SE_ECL_ONE_TRY = 32*1024; 
    166  
    167 const int SE_CALC_RISE = 1; 
    168 const int SE_CALC_SET = 2; 
    169 const int SE_CALC_MTRANSIT = 4; 
    170 const int SE_CALC_ITRANSIT = 8; 
    171 const int SE_BIT_DISC_CENTER = 256; 
    172 const int SE_BIT_NO_REFRACTION = 512; 
    173 const int SE_ECL2HOR = 0; 
    174 const int SE_EQU2HOR = 1; 
    175 const int SE_HOR2ECL = 0; 
    176 const int SE_HOR2EQU = 1; 
    177  
    178 const int SE_TRUE_TO_APP = 0; 
    179 const int SE_APP_TO_TRUE = 1; 
    180  
    181 const int SE_DE_NUMBER = 406; 
    182 const char[] SE_FNAME_DE200 = "de200.eph"; 
    183 const char[] SE_FNAME_DE403 = "de403.eph"; 
    184 const char[] SE_FNAME_DE404 = "de404.eph"; 
    185 const char[] SE_FNAME_DE405 = "de405.eph"; 
    186 const char[] SE_FNAME_DE406 = "de406.eph"; 
    187 const char[] SE_FNAME_DFT = SE_FNAME_DE406; 
    188 const char[] SE_STARFILE = "fixstars.cat"; 
    189 const char[] SE_ASTNAMFILE = "seasnam.txt"; 
    190 const char[] SE_FICTFILE = "seorbel.txt"; 
    191  
    192 const char[] SE_EPHE_PATH = ".:/users/ephe2/:/users/ephe/"; 
    193  
    194 const int SE_SPLIT_DEG_ROUND_SEC = 1; 
    195 const int SE_SPLIT_DEG_ROUND_MIN = 2; 
    196 const int SE_SPLIT_DEG_ROUND_DEG = 4; 
    197 const int SE_SPLIT_DEG_ZODIACAL = 8; 
    198 const int SE_SPLIT_DEG_KEEP_SIGN = 16; 
    199 const int SE_SPLIT_DEG_KEEP_DEG = 32; 
    200  
    201  
    202 int swe_calc(double tjd, int ipl, int iflag, double* xx, char* serr); 
    203 int swe_calc_ut(double tjd_ut, int ipl, int iflag, double* xx, char* serr); 
    204 int swe_fixstar(char* star, double tjd, int iflag, double* xx, char* serr); 
    205 int swe_fixstar_ut(char* star, double tjd_ut, int iflag, double* xx, char* serr); 
     185const SEFLG_JPLEPH      = 1;       /* use JPL ephemeris */ 
     186const SEFLG_SWIEPH      = 2;       /* use SWISSEPH ephemeris */ 
     187const SEFLG_MOSEPH      = 4;       /* use Moshier ephemeris */ 
     188 
     189const SEFLG_HELCTR      = 8;      /* return heliocentric position */ 
     190const SEFLG_TRUEPOS     = 16;     /* return true positions, not apparent */ 
     191const SEFLG_J2000       = 32;     /* no precession, i.e. give J2000 equinox */ 
     192const SEFLG_NONUT       = 64;     /* no nutation, i.e. mean equinox of date */ 
     193const SEFLG_SPEED3      = 128;     /* speed from 3 positions (do not use it, 
     194                                  SEFLG_SPEED is faster and more precise.) */ 
     195const SEFLG_SPEED       = 256;     /* high precision speed  */ 
     196const SEFLG_NOGDEFL     = 512;     /* turn off gravitational deflection */ 
     197const SEFLG_NOABERR     = 1024;    /* turn off 'annual' aberration of light */ 
     198const SEFLG_EQUATORIAL  = (2*1024);    /* equatorial positions are wanted */ 
     199const SEFLG_XYZ         = (4*1024);    /* cartesian, not polar, coordinates */ 
     200const SEFLG_RADIANS     = (8*1024);    /* coordinates in radians, not degrees */ 
     201const SEFLG_BARYCTR     = (16*1024);   /* barycentric positions */ 
     202const SEFLG_TOPOCTR     = (32*1024);   /* topocentric positions */ 
     203const SEFLG_SIDEREAL    = (64*1024);   /* sidereal positions */ 
     204const SEFLG_ICRS        = (128*1024);   /* ICRS (DE406 reference frame) */ 
     205 
     206const SE_SIDBITS        = 256; 
     207/* for projection onto ecliptic of t0 */ 
     208const SE_SIDBIT_ECL_T0  = 256; 
     209/* for projection onto solar system plane */ 
     210const SE_SIDBIT_SSY_PLANE   = 512; 
     211 
     212/* sidereal modes (ayanamsas) */ 
     213const SE_SIDM_FAGAN_BRADLEY     = 0; 
     214const SE_SIDM_LAHIRI            = 1; 
     215const SE_SIDM_DELUCE            = 2; 
     216const SE_SIDM_RAMAN             = 3; 
     217const SE_SIDM_USHASHASHI        = 4; 
     218const SE_SIDM_KRISHNAMURTI      = 5; 
     219const SE_SIDM_DJWHAL_KHUL       = 6; 
     220const SE_SIDM_YUKTESHWAR        = 7; 
     221const SE_SIDM_JN_BHASIN         = 8; 
     222const SE_SIDM_BABYL_KUGLER1     = 9; 
     223const SE_SIDM_BABYL_KUGLER2     = 10; 
     224const SE_SIDM_BABYL_KUGLER3     = 11; 
     225const SE_SIDM_BABYL_HUBER       = 12; 
     226const SE_SIDM_BABYL_ETPSC       = 13; 
     227const SE_SIDM_ALDEBARAN_15TAU   = 14; 
     228const SE_SIDM_HIPPARCHOS        = 15; 
     229const SE_SIDM_SASSANIAN         = 16; 
     230const SE_SIDM_GALCENT_0SAG      = 17; 
     231const SE_SIDM_J2000             = 18; 
     232const SE_SIDM_J1900             = 19; 
     233const SE_SIDM_B1950             = 20; 
     234const SE_SIDM_USER              = 255; 
     235 
     236const SE_NSIDM_PREDEF           = 21; 
     237 
     238/* used for swe_nod_aps(): */ 
     239const SE_NODBIT_MEAN        = 1;    /* mean nodes/apsides */ 
     240const SE_NODBIT_OSCU        = 2;    /* osculating nodes/apsides */ 
     241const SE_NODBIT_OSCU_BAR    = 4;    /* same, but motion about solar system barycenter is considered */ 
     242const SE_NODBIT_FOPOINT     = 256;  /* focal point of orbit instead of aphelion */ 
     243 
     244/* default ephemeris used when no ephemeris flagbit is set */ 
     245const SEFLG_DEFAULTEPH      = SEFLG_SWIEPH; 
     246 
     247const SE_MAX_STNAME         = 256; /* maximum size of fixstar name; 
     248                                   * the parameter star in swe_fixstar 
     249                                   * must allow twice this space for 
     250                                   * the returned star name. 
     251                                   */ 
     252 
     253/* defines for eclipse computations */ 
     254 
     255const SE_ECL_CENTRAL        = 1; 
     256const SE_ECL_NONCENTRAL     = 2; 
     257const SE_ECL_TOTAL          = 4; 
     258const SE_ECL_ANNULAR        = 8; 
     259const SE_ECL_PARTIAL        = 16; 
     260const SE_ECL_ANNULAR_TOTAL  = 32; 
     261const SE_ECL_PENUMBRAL      = 64; 
     262const SE_ECL_ALLTYPES_SOLAR = (SE_ECL_CENTRAL|SE_ECL_NONCENTRAL|SE_ECL_TOTAL|SE_ECL_ANNULAR|SE_ECL_PARTIAL|SE_ECL_ANNULAR_TOTAL); 
     263const SE_ECL_ALLTYPES_LUNAR = (SE_ECL_TOTAL|SE_ECL_PARTIAL|SE_ECL_PENUMBRAL); 
     264const SE_ECL_VISIBLE        = 128; 
     265const SE_ECL_MAX_VISIBLE    = 256; 
     266const SE_ECL_1ST_VISIBLE    = 512; 
     267const SE_ECL_2ND_VISIBLE    = 1024; 
     268const SE_ECL_3RD_VISIBLE    = 2048; 
     269const SE_ECL_4TH_VISIBLE    = 4096; 
     270const SE_ECL_ONE_TRY        = (32*1024); 
     271        /* check if the next conjunction of the moon with 
     272         * a planet is an occultation; don't search further */ 
     273 
     274/* for swe_rise_transit() */ 
     275const SE_CALC_RISE          = 1; 
     276const SE_CALC_SET           = 2; 
     277const SE_CALC_MTRANSIT      = 4; 
     278const SE_CALC_ITRANSIT      = 8; 
     279const SE_BIT_DISC_CENTER    = 256; /* to be or'ed to SE_CALC_RISE/SET */ 
     280                    /* if rise or set of disc center is */ 
     281                    /* required */ 
     282const SE_BIT_NO_REFRACTION  = 512; /* to be or'ed to SE_CALC_RISE/SET, */ 
     283                    /* if refraction is not to be considered */ 
     284const SE_BIT_CIVIL_TWILIGHT = 1024; /* to be or'ed to SE_CALC_RISE/SET */ 
     285const SE_BIT_NAUTIC_TWILIGHT    = 2048; /* to be or'ed to SE_CALC_RISE/SET */ 
     286const SE_BIT_ASTRO_TWILIGHT     = 4096; /* to be or'ed to SE_CALC_RISE/SET */ 
     287 
     288 
     289/* for swe_azalt() and swe_azalt_rev() */ 
     290const SE_ECL2HOR        = 0; 
     291const SE_EQU2HOR        = 1; 
     292const SE_HOR2ECL        = 0; 
     293const SE_HOR2EQU        = 1; 
     294 
     295/* for swe_refrac() */ 
     296const SE_TRUE_TO_APP    = 0; 
     297const SE_APP_TO_TRUE    = 1; 
     298 
     299/* 
     300 * only used for experimenting with various JPL ephemeris files 
     301 * which are available at Astrodienst's internal network 
     302 */ 
     303const SE_DE_NUMBER      = 406; 
     304const char[] SE_FNAME_DE200    = "de200.eph"; 
     305const char[] SE_FNAME_DE403    = "de403.eph"; 
     306const char[] SE_FNAME_DE404    = "de404.eph"; 
     307const char[] SE_FNAME_DE405    = "de405.eph"; 
     308const char[] SE_FNAME_DE406    = "de406.eph"; 
     309const char[] SE_FNAME_DFT      = SE_FNAME_DE406; 
     310const char[] SE_STARFILE       = "fixstars.cat"; 
     311const char[] SE_ASTNAMFILE     = "seasnam.txt"; 
     312const char[] SE_FICTFILE       = "seorbel.txt"; 
     313 
     314/* 
     315 * ephemeris path 
     316 * this defines where ephemeris files are expected if the function 
     317 * swe_set_ephe_path() is not called by the application. 
     318 * Normally, every application should make this call to define its 
     319 * own place for the ephemeris files. 
     320 */ 
     321 
     322version ( Windows ) 
     323
     324    version( PAIR_SWEPH ) 
     325    { 
     326    const char[] SE_EPHE_PATH   = "\\pair\\ephe\\"; 
     327    } 
     328    else 
     329    { 
     330    const char[] SE_EPHE_PATH   = "\\sweph\\ephe\\"; 
     331    } 
     332
     333version ( OSX ) 
     334
     335const char[] SE_EPHE_PATH   = ":ephe:"; 
     336
     337version ( linux ) 
     338
     339const char[] SE_EPHE_PATH   = ".:/usr/share/swisseph/:/usr/local/share/swisseph/"; 
     340
     341 
     342 
     343/* defines for function swe_split_deg() (in swephlib.c) */ 
     344const SE_SPLIT_DEG_ROUND_SEC    = 1; 
     345const SE_SPLIT_DEG_ROUND_MIN    = 2; 
     346const SE_SPLIT_DEG_ROUND_DEG    = 4; 
     347const SE_SPLIT_DEG_ZODIACAL     = 8; 
     348const SE_SPLIT_DEG_KEEP_SIGN    = 16;    /* don't round to next sign, 
     349                     * e.g. 29.9999999 will be rounded 
     350                     * to 29°59'59" (or 29°59' or 29°) */ 
     351const SE_SPLIT_DEG_KEEP_DEG     = 32;    /* don't round to next degree 
     352                     * e.g. 13.9999999 will be rounded 
     353                     * to 13°59'59" (or 13°59' or 13°) */ 
     354 
     355/* for heliacal functions */ 
     356const SE_HELIACAL_RISING        = 1; 
     357const SE_HELIACAL_SETTING       = 2; 
     358const SE_MORNING_FIRST          = SE_HELIACAL_RISING; 
     359const SE_EVENING_LAST           = SE_HELIACAL_SETTING; 
     360const SE_EVENING_FIRST          = 3; 
     361const SE_MORNING_LAST           = 4; 
     362const SE_ACRONYCHAL_RISING      = 5;  /* still not implemented */ 
     363const SE_COSMICAL_SETTING       = 6;  /* still not implemented */ 
     364const SE_ACRONYCHAL_SETTING     = SE_COSMICAL_SETTING; 
     365 
     366const SE_HELFLAG_LONG_SEARCH    = 128; 
     367const SE_HELFLAG_HIGH_PRECISION = 256; 
     368const SE_HELFLAG_OPTICAL_PARAMS = 512; 
     369const SE_HELFLAG_NO_DETAILS     = 1024; 
     370const SE_HELFLAG_AVKIND_VR      = 2048; 
     371const SE_HELFLAG_AVKIND_PTO     = 4096; 
     372const SE_HELFLAG_AVKIND_MIN7    = 8192; 
     373const SE_HELFLAG_AVKIND_MIN9    = 16384; 
     374const SE_HELFLAG_AVKIND = (SE_HELFLAG_AVKIND_VR|SE_HELFLAG_AVKIND_PTO|SE_HELFLAG_AVKIND_MIN7|SE_HELFLAG_AVKIND_MIN9); 
     375const TJD_INVALID       = 99999999.0; 
     376const SIMULATE_VICTORVB = 1; 
     377 
     378const SE_PHOTOPIC_FLAG  = 0; 
     379const SE_SCOTOPIC_FLAG  = 1; 
     380const SE_MIXEDOPIC_FLAG = 2; 
     381 
     382/* 
     383 * by compiling with -DPAIR_SWEPH in the compiler options it 
     384 * is possible to create a more compact version of SwissEph which 
     385 * contains no code for the JPL ephemeris file and for the builtin 
     386 * Moshier ephemeris. 
     387 * This is quite useful for MSDOS real mode applications which need to 
     388 * run within 640 kb. 
     389 * The option is called PAIR_SWEPH because it was introduced for 
     390 * Astrodienst's partner software PAIR. 
     391 */ 
     392version ( PAIR_SWEPH ) 
     393
     394const bool NO_JPL = true; 
     395
     396 
     397 
     398 
     399/*********************************************************** 
     400 * exported functions 
     401 ***********************************************************/ 
     402 
     403int swe_heliacal_ut(double tjdstart_ut, double *geopos, double *datm, double *dobs, char *ObjectName, int TypeEvent, int iflag, double *dret, char *serr); 
     404int swe_heliacal_pheno_ut(double tjd_ut, double *geopos, double *datm, double *dobs, char *ObjectName, int TypeEvent, int helflag, double *darr, char *serr); 
     405int swe_vis_limit_mag(double tjdut, double *geopos, double *datm, double *dobs, char *ObjectName, int helflag, double *dret, char *serr); 
     406/* the following are secret, for Victor Reijs' */ 
     407int swe_heliacal_angle(double tjdut, double *dgeo, double *datm, double *dobs, int helflag, double mag, double azi_obj, double azi_sun, double azi_moon, double alt_moon, double *dret, char *serr); 
     408int swe_topo_arcus_visionis(double tjdut, double *dgeo, double *datm, double *dobs, int helflag, double mag, double azi_obj, double alt_obj, double azi_sun, double azi_moon, double alt_moon, double *dret, char *serr); 
     409 
     410/**************************** 
     411 * exports from sweph.c 
     412 ****************************/ 
     413 
     414char* swe_version(char *); 
     415 
     416/* planets, moon, nodes etc. */ 
     417int swe_calc( 
     418        double tjd, int ipl, int iflag, 
     419        double *xx, 
     420        char *serr); 
     421 
     422int swe_calc_ut(double tjd_ut, int ipl, int iflag, 
     423    double *xx, char *serr); 
     424 
     425/* fixed stars */ 
     426int swe_fixstar( 
     427        char *star, double tjd, int iflag, 
     428        double *xx, 
     429        char *serr); 
     430 
     431int swe_fixstar_ut(char *star, double tjd_ut, int iflag, 
     432    double *xx, char *serr); 
     433 
     434int swe_fixstar_mag(char *star, double *mag, char *serr); 
     435 
     436/* close Swiss Ephemeris */ 
    206437void swe_close(); 
    207 void swe_set_ephe_path(char* path); 
    208 void swe_set_jpl_file(char* fname); 
    209 char* swe_get_planet_name(int ipl, char* spname); 
     438 
     439/* set directory path of ephemeris files */ 
     440void swe_set_ephe_path(char *path); 
     441 
     442/* set file name of JPL file */ 
     443void swe_set_jpl_file(char *fname); 
     444 
     445/* get planet name */ 
     446char* swe_get_planet_name(int ipl, char *spname); 
     447 
     448/* set geographic position of observer */ 
    210449void swe_set_topo(double geolon, double geolat, double geoalt); 
     450 
     451/* set sidereal mode */ 
    211452void swe_set_sid_mode(int sid_mode, double t0, double ayan_t0); 
     453 
     454/* get ayanamsa */ 
    212455double swe_get_ayanamsa(double tjd_et); 
     456 
    213457double swe_get_ayanamsa_ut(double tjd_ut); 
     458 
    214459char* swe_get_ayanamsa_name(int isidmode); 
    215 int swe_date_conversion(int y, int m, int d, double utime, char c, double* tjd); 
    216 double swe_julday(int year, int month, int day, double hour, int gregflag); 
    217 void swe_revjul(double jd, int gregflag, int* jyear, int* jmon, int* jday, double* jut); 
    218 int swe_houses(double tjd_ut, double geolat, double geolon, int hsys, double* cusps, double* ascmc); 
    219 int swe_houses_ex(double tjd_ut, int iflag, double geolat, double geolon, int hsys, double* cusps, double* ascmc); 
    220 int swe_houses_armc(double armc, double geolat, double eps, int hsys, double* cusps, double* ascmc); 
    221 double swe_house_pos(double armc, double geolat, double eps, int hsys, double* xpin, char* serr); 
    222 int swe_gauquelin_sector(double t_ut, int ipl, char* starname, int iflag, int imeth, double* geopos, double atpress, double attemp, double* dgsect, char* serr); 
    223 int swe_sol_eclipse_where(double tjd, int ifl, double* geopos, double* attr, char* serr); 
    224 int swe_lun_occult_where(double tjd, int ipl, char* starname, int ifl, double* geopos, double* attr, char* serr); 
    225 int swe_sol_eclipse_how(double tjd, int ifl, double* geopos, double* attr, char* serr); 
    226 int swe_sol_eclipse_when_loc(double tjd_start, int ifl, double* geopos, double* tret, double* attr, int backward, char* serr); 
    227 int swe_lun_occult_when_loc(double tjd_start, int ipl, char* starname, int ifl, double* geopos, double* tret, double* attr, int backward, char* serr); 
    228 int swe_sol_eclipse_when_glob(double tjd_start, int ifl, int ifltype, double* tret, int backward, char* serr); 
    229 int swe_lun_occult_when_glob(double tjd_start, int ipl, char* starname, int ifl, int ifltype, double* tret, int backward, char* serr); 
    230 int swe_lun_eclipse_how(double tjd_ut, int ifl, double* geopos, double* attr, char* serr); 
    231 int swe_lun_eclipse_when(double tjd_start, int ifl, int ifltype, double* tret, int backward, char* serr); 
    232 int swe_pheno(double tjd, int ipl, int iflag, double* attr, char* serr); 
    233 int swe_pheno_ut(double tjd_ut, int ipl, int iflag, double* attr, char* serr); 
     460 
     461/**************************** 
     462 * exports from swedate.c 
     463 ****************************/ 
     464 
     465int swe_date_conversion( 
     466        int y , int m , int d ,         /* year, month, day */ 
     467        double utime,   /* universal time in hours (decimal) */ 
     468        char c,         /* calendar g[regorian]|j[ulian] */ 
     469        double *tjd); 
     470 
     471double swe_julday( 
     472        int year, int month, int day, double hour, 
     473        int gregflag); 
     474 
     475void swe_revjul ( 
     476        double jd, 
     477        int gregflag, 
     478        int *jyear, int *jmon, int *jday, double *jut); 
     479 
     480int swe_utc_to_jd( 
     481        int iyear, int imonth, int iday, 
     482    int ihour, int imin, double dsec, 
     483    int gregflag, double *dret, char *serr); 
     484 
     485void swe_jdet_to_utc( 
     486        double tjd_et, int gregflag, 
     487    int *iyear, int *imonth, int *iday, 
     488    int *ihour, int *imin, double *dsec); 
     489 
     490void swe_jdut1_to_utc( 
     491        double tjd_ut, int gregflag, 
     492    int *iyear, int *imonth, int *iday, 
     493    int *ihour, int *imin, double *dsec); 
     494 
     495/**************************** 
     496 * exports from swehouse.c 
     497 ****************************/ 
     498 
     499int swe_houses( 
     500        double tjd_ut, double geolat, double geolon, int hsys, 
     501    double *cusps, double *ascmc); 
     502 
     503int swe_houses_ex( 
     504        double tjd_ut, int iflag, double geolat, double geolon, int hsys, 
     505    double *cusps, double *ascmc); 
     506 
     507int swe_houses_armc( 
     508        double armc, double geolat, double eps, int hsys, 
     509    double *cusps, double *ascmc); 
     510 
     511double swe_house_pos( 
     512    double armc, double geolat, double eps, int hsys, double *xpin, char *serr); 
     513 
     514/**************************** 
     515 * exports from swecl.c 
     516 ****************************/ 
     517 
     518int swe_gauquelin_sector(double t_ut, int ipl, char *starname, int iflag, int imeth, double *geopos, double atpress, double attemp, double *dgsect, char *serr); 
     519 
     520/* computes geographic location and attributes of solar 
     521 * eclipse at a given tjd */ 
     522int swe_sol_eclipse_where(double tjd, int ifl, double *geopos, double *attr, char *serr); 
     523 
     524int swe_lun_occult_where(double tjd, int ipl, char *starname, int ifl, double *geopos, double *attr, char *serr); 
     525 
     526/* computes attributes of a solar eclipse for given tjd, geolon, geolat */ 
     527int swe_sol_eclipse_how(double tjd, int ifl, double *geopos, double *attr, char *serr); 
     528 
     529/* finds time of next local eclipse */ 
     530int swe_sol_eclipse_when_loc(double tjd_start, int ifl, double *geopos, double *tret, double *attr, int backward, char *serr); 
     531 
     532int swe_lun_occult_when_loc(double tjd_start, int ipl, char *starname, int ifl, 
     533     double *geopos, double *tret, double *attr, int backward, char *serr); 
     534 
     535/* finds time of next eclipse globally */ 
     536int swe_sol_eclipse_when_glob(double tjd_start, int ifl, int ifltype, 
     537     double *tret, int backward, char *serr); 
     538 
     539/* finds time of next occultation globally */ 
     540int swe_lun_occult_when_glob(double tjd_start, int ipl, char *starname, int ifl, int ifltype, 
     541     double *tret, int backward, char *serr); 
     542 
     543/* computes attributes of a lunar eclipse for given tjd */ 
     544int swe_lun_eclipse_how( 
     545          double tjd_ut, 
     546          int ifl, 
     547          double *geopos, 
     548          double *attr, 
     549          char *serr); 
     550 
     551int swe_lun_eclipse_when(double tjd_start, int ifl, int ifltype, 
     552     double *tret, int backward, char *serr); 
     553 
     554/* planetary phenomena */ 
     555int swe_pheno(double tjd, int ipl, int iflag, double *attr, char *serr); 
     556 
     557int swe_pheno_ut(double tjd_ut, int ipl, int iflag, double *attr, char *serr); 
     558 
    234559double swe_refrac(double inalt, double atpress, double attemp, int calc_flag); 
    235 double swe_refrac_extended(double inalt, double geoalt, double atpress, double attemp, double lapse_rate, int calc_flag, double* dret); 
     560 
     561double swe_refrac_extended(double inalt, double geoalt, double atpress, double attemp, double lapse_rate, int calc_flag, double *dret); 
     562 
    236563void swe_set_lapse_rate(double lapse_rate); 
    237 void swe_azalt(double tjd_ut, int calc_flag, double* geopos, double atpress, double attemp, double* xin, double* xaz); 
    238 void swe_azalt_rev(double tjd_ut, int calc_flag, double* geopos, double* xin, double* xout); 
    239 int swe_rise_trans(double tjd_ut, int ipl, char* starname, int epheflag, int rsmi, double* geopos, double atpress, double attemp, double* tret, char* serr); 
    240 int swe_nod_aps(double tjd_et, int ipl, int iflag, int method, double* xnasc, double* xndsc, double* xperi, double* xaphe, char* serr); 
    241 int swe_nod_aps_ut(double tjd_ut, int ipl, int iflag, int method, double* xnasc, double* xndsc, double* xperi, double* xaphe, char* serr); 
     564 
     565void swe_azalt( 
     566      double tjd_ut, 
     567      int calc_flag, 
     568      double *geopos, 
     569      double atpress, 
     570      double attemp, 
     571      double *xin, 
     572      double *xaz); 
     573 
     574void swe_azalt_rev( 
     575      double tjd_ut, 
     576      int calc_flag, 
     577      double *geopos, 
     578      double *xin, 
     579      double *xout); 
     580 
     581int swe_rise_trans( 
     582               double tjd_ut, int ipl, char *starname, 
     583           int epheflag, int rsmi, 
     584               double *geopos, 
     585           double atpress, double attemp, 
     586               double *tret, 
     587               char *serr); 
     588 
     589int swe_nod_aps(double tjd_et, int ipl, int iflag, 
     590                      int  method, 
     591                      double *xnasc, double *xndsc, 
     592                      double *xperi, double *xaphe, 
     593                      char *serr); 
     594 
     595int swe_nod_aps_ut(double tjd_ut, int ipl, int iflag, 
     596                      int  method, 
     597                      double *xnasc, double *xndsc, 
     598                      double *xperi, double *xaphe, 
     599                      char *serr); 
     600 
     601 
     602/**************************** 
     603 * exports from swephlib.c 
     604 ****************************/ 
     605 
     606/* delta t */ 
    242607double swe_deltat(double tjd); 
    243 int swe_time_equ(double tjd, double* te, char* serr); 
     608 
     609/* equation of time */ 
     610int swe_time_equ(double tjd, double *te, char *serr); 
     611 
     612/* sidereal time */ 
    244613double swe_sidtime0(double tjd_ut, double eps, double nut); 
    245614double swe_sidtime(double tjd_ut); 
    246 void swe_cotrans(double* xpo, double* xpn, double eps); 
    247 void swe_cotrans_sp(double* xpo, double* xpn, double eps); 
     615 
     616/* coordinate transformation polar -> polar */ 
     617void swe_cotrans(double *xpo, double *xpn, double eps); 
     618void swe_cotrans_sp(double *xpo, double *xpn, double eps); 
     619 
     620/* tidal acceleration to be used in swe_deltat() */ 
    248621double swe_get_tid_acc(); 
    249622void swe_set_tid_acc(double t_acc); 
     623 
    250624double swe_degnorm(double x); 
    251625double swe_radnorm(double x); 
    252626double swe_rad_midp(double x1, double x0); 
    253627double swe_deg_midp(double x1, double x0); 
    254 void swe_split_deg(double ddeg, int roundflag, int* ideg, int* imin, int* isec, double* dsecfr, int* isgn); 
     628 
     629void swe_split_deg(double ddeg, int roundflag, int *ideg, int *imin, int *isec, double *dsecfr, int *isgn); 
     630 
     631/******************************************************* 
     632 * other functions from swephlib.c; 
     633 * they are not needed for Swiss Ephemeris, 
     634 * but may be useful to former Placalc users. 
     635 ********************************************************/ 
     636 
     637/* normalize argument into interval [0..DEG360] */ 
    255638int swe_csnorm(int p); 
    256 int swe_difcsn(int p1, int p2); 
    257 double swe_difdegn(double p1, double p2); 
     639 
     640/* distance in centisecs p1 - p2 normalized to [0..360[ */ 
     641int swe_difcsn (int p1, int p2); 
     642 
     643double swe_difdegn (double p1, double p2); 
     644 
     645/* distance in centisecs p1 - p2 normalized to [-180..180[ */ 
    258646int swe_difcs2n(int p1, int p2); 
     647 
    259648double swe_difdeg2n(double p1, double p2); 
    260649double swe_difrad2n(double p1, double p2); 
     650 
     651/* round second, but at 29.5959 always down */ 
    261652int swe_csroundsec(int x); 
     653 
     654/* double to int with rounding, no overflow check */ 
    262655int swe_d2l(double x); 
     656 
     657/* monday = 0, ... sunday = 6 */ 
    263658int swe_day_of_week(double jd); 
    264 char* swe_cs2timestr(int t, int sep, int suppressZero, char* a); 
    265 char* swe_cs2lonlatstr(int t, char pchar, char mchar, char* s); 
    266 char* swe_cs2degstr(int t, char* a); 
    267  
    268  
    269 /* End. */ 
     659 
     660char* swe_cs2timestr(int t, int sep, int suppressZero, char *a); 
     661 
     662char* swe_cs2lonlatstr(int t, char pchar, char mchar, char *s); 
     663 
     664char* swe_cs2degstr(int t, char *a); 
     665