From: astrolog@byron.u.washington.edu (Astrolog)
Newsgroups: alt.astrology
Subject: * Astrolog birthchart program version 2.30 [Part 03/12] data.c
Summary: (Gemini) Source file - extract and save to "data.c"
Keywords: Astrolog 2.30
Date: 12 Sep 92 02:40:52 GMT
Organization: University of Washington

/*
** Astrolog (Version 2.30) File: data.c
**
** IMPORTANT: The planetary calculation routines used in this program
** have been Copyrighted and the core of this program is basically a
** conversion to C of the routines created by James Neely as listed in
** Michael Erlewine's 'Manual of Computer Programming for Astrologers',
** available from Matrix Software. The copyright gives us permission to
** use the routines for our own purposes but not to sell them or profit
** from them in any way.
**
** IN ADDITION: the graphics database and chart display routines used in
** this program are Copyright (C) 1991-1992 by Walter D. Pullen. Permission
** is granted to freely use and distribute these routines provided one
** doesn't sell, restrict, or profit from them in any way. Modification
** is allowed provided these notices remain with any altered or edited
** versions of the program.
*/

#include "astrolog.h"


/*
*******************************************************************************
** Global variables
*******************************************************************************
*/

FILE *data;
char *filename, *filename2;

int total    = TOTAL;
int aspects  = DEFAULT_ASPECTS;
int universe = FALSE;
int siderial = FALSE;
int right    = FALSE;
int centerplanet   = 1;
long todisplay     = 0;
int housesystem    = DEFAULT_SYSTEM;
int cusp           = FALSE;
int uranian        = FALSE;
int multiplyfactor = 1;   /* Value passed to -x switch.       */
int onasc     = 0;        /* Value passed to -1 or -2 switch. */
int flip      = FALSE;    /* Is -f switch in effect?          */
int decan     = FALSE;    /* Is -3 switch in effect?          */
int geodetic  = FALSE;    /* Is -G switch in effect?          */
int graphstep = 5;        /* Latitude value passed to -L switch.           */
int progress  = FALSE;    /* Are we doing a -p progressed chart?           */
int autom     = FALSE;    /* Do we need to prompt user for chart info?     */
int relation  = FALSE;    /* What relationship chart are we doing, if any? */
int operation = 0;        /* Are we doing any special operations?          */
double progday = 365.25;  /* Day value passed to -p0 switch.               */
double defzone = DEFAULT_ZONE;
double deflong = DEFAULT_LONG;
double deflat  = DEFAULT_LAT;
double modulus = DEGREES;

double SD = 0.0, Mon, Day, Yea, Tim, Zon, Lon, Lat, Mon2, Yea2, Delta = 0.0,
  M = 9.0, D = 11.0, Y = 1992.0, F = 19.18, X = 7.0, L5 = 122.20, LA = 47.36,
  T, JD, Jdp;

double planet[TOTAL+1], planetalt[TOTAL+1], house[SIGNS+1], ret[TOTAL+1],
  spacex[BASE+1], spacey[BASE+1], spacez[BASE+1], force[TOTAL+1];
short grid[TOTAL+1][TOTAL+1];
byte gridname[TOTAL+1][TOTAL+1], inhouse[TOTAL+1],
  inhouse1[TOTAL+1], inhouse2[TOTAL+1];
int starname[STARS+1];

/* Restriction status of each object, as specified with -R switch. */

byte ignore[TOTAL+1]
  = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,                /* Planets  */
#ifdef ASTEROIDS
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0,                   /* Minors   */
#else
     1, 1, 1, 1, 1, 0, 1, 0, 0, 1,
#endif
     0, 0, 0, 0,                                     /* Cusps    */
     0, 0, 0, 0, 0, 0, 0, 0,                         /* Uranians */
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* Stars    */
     0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};


/*
*******************************************************************************
** Table data
*******************************************************************************
*/

char *signname[]
  = {"", "Aries", "Taurus", "Gemini", "Cancer", "Leo",
       "Virgo", "Libra", "Scorpio",
       "Sagittarius", "Capricorn", "Aquarius", "Pisces"};

char *signabbrev[]
  = {"",
       "Ar", "Ta", "Ge", "Cn", "Le", "Vi", "Li", "Sc", "Sg", "Cp", "Aq", "Pi"};

char *objectname[]
  = {"Earth", "Sun", "Moon", "Mercury", "Venus", "Mars",      /* Planets   */
       "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto",
       "Chiron", "Ceres", "Pallas", "Juno", "Vesta",          /* Asteroids */
       "Node", "Fortune", "Midheaven", "Ascendant", "Vertex", /* Others    */
       "11th Cusp", "12th Cusp", "2nd Cusp", "3rd Cusp",      /* Cusps     */
       "Cupido", "Hades", "Zeus", "Kronos",                   /* Uranians  */
       "Apollo", "Admetos", "Vulkanus", "Poseidon",

       "Achernar", "Polaris", "Zeta Retic.", "Pleiades",      /* Stars     */
       "Aldebaran", "Capella", "Rigel", "Bellatrix", "Alnath",
       "Orion", "Betelgeuse", "Menkalinan", "Murzim", "Canopus",
       "Alhena", "Sirius", "Adara", "Wezen", "Castor",
       "Procyon", "Pollux", "Suhail", "Avior", "Miaplacidus",
       "Alphard", "Regulus", "Dubhe", "Acrux", "Gacrux",
       "Becrux", "Alioth", "Spica", "Alkaid", "Agena",
       "Arcturus", "Kentaurus", "Antares", "Shaula", "Sargas",
       "Australis", "Vega", "Altair", "Peacock", "Deneb",
       "Alnair", "Fomalhaut", "Andromeda"};

char *systemname[]
  = {"Placidus", "Koch", "Equal", "Campanus", "Meridian",
       "Regiomontanus", "Porphyry", "Morinus", "Topocentric", "Null"};

char *aspectname[]
  = {"", "Conjunct", "Opposite", "Square", "Trine", "Sextile",
       "Inconjunct", "Semisextile", "Semisquare", "Sesquiquadrate",
       "Quintile", "Biquintile",
       "Semiquintile", "Septile", "Novile",
       "Binovile", "Biseptile", "Triseptile", "Quatronovile"};

char *aspectabbrev[]
  = {"   ", "Con", "Opp", "Squ", "Tri", "Sex",
       "Inc", "SSx", "SSq", "Ses", "Qui", "BQn",
       "SQn", "Sep", "Nov", "BNv", "BSp", "TSp", "QNv"};

double aspectangle[ASPECTS+1]
  = {0, 0.0, 180.0, 90.0, 120.0, 60.0, 150.0, 30.0, 45.0, 135.0, 72.0, 144.0,
       36.0, DEGREES/7.0, 40.0, 80.0, 720.0/7.0, 1080.0/7.0, 160.0};

double aspectorb[ASPECTS+1]
  = {0, 7.0, 7.0, 7.0, 7.0, 6.0, 3.0, 3.0, 3.0, 3.0, 2.0, 2.0,
       1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};

double planetorb[OBJECTS+1]
  = {0, 360.0, 360.0, 360.0, 360.0, 360.0, 360.0, 360.0, 360.0, 360.0, 360.0,
       360.0, 360.0, 360.0, 360.0, 360.0, 2.0, 2.0, 360.0, 360.0, 2.0};

double planetadd[OBJECTS+1]
  = {0, 1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
       0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};

int ruler1[OBJECTS+1]
  = {0, 5, 4,  3,  7,  1,  9, 10, 11, 12, 8,  12, 2, 6, 7, 8,11,12,10, 1, 7};
int ruler2[OBJECTS+1]
  = {0, 0, 0,  6,  2,  8, 12, 11,  0,  0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
int  exalt[OBJECTS+1]
  = {0, 1, 2, 11, 12, 10,  4,  7,  8,  9, 6,   4, 4,10, 5,11, 6, 9, 7,10,12};

char *element[] = {"Fire", "Earth", "Air", "Water"};
char *mode[] = {"Cardinal", "Fixed", "Mutuable"};

char *post[]
  = {"",
       "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "th", "th"};

char *monthname[]
  = {"", "January", "February", "March", "April", "May", "June",
       "July", "August", "September", "October", "November", "December"};

#ifdef GRAPH
char *signdraw[] = {"",
  "ND4HU2HLGDFBR6EUHLGD2G", "BL3D2F2R2E2U2H2NE2L2NH2G2",
  "BLU3LHBR7GLNL3D6NL3RFBL7ERU3", "BGNDHLGDFRNEFR2EREBU3NHDGLHUENRHL2GLG",
  "BF4H2UEU2H2L2G2D2FDGH", "BF4HNGNHEU5GHND5HGND6HGND6H",
  "BGNL3HUER2FDGR3BD2L8", "BH4FND6EFND6EFD6FREU",
  "BG4E3NH2NF2E5NL2D2", "BH3NLNUD3FND2EU2ENF2UFERFDGLF2D2G",
  "BG4EUEDFDEUEDFDEUEBU5GDGUHUGDGUHUGDG", "NL4NR4BH4F2D4G2BR8H2U4E2"};

char *objectdraw[] = {"ND4NL4NR4U4LGLDGD2FDRFR2ERUEU2HULHL", /* Earth */
  "U0BH3DGD2FDRFR2ERUEU2HULHL2GL", /* Sun */
  "BG3E2U2H2ER2FRDFD2GDLGL2H",     /* Moon */
  "BD4UNL2NR2U2REU2HNEL2NHGD2FR",  /* Mercury */
  "LHU2ER2FD2GLD2NL2NR2D2",        /* Venus */
  "HLG2DF2RE2UHE4ND2L2",           /* Mars */
  "BH3RFDGDGDR5NDNR2U6E",          /* Jupiter */
  "BH3R2NUNR2D3ND3RERFDGDF",       /* Saturn */
  "BD4NEHURBFULU3NUNR2L2NU2DGBU5NFBR6GD3F", /* Uranus */
  "BD4U2NL2NR2U5NUNRLBL2NUNLDF2R2E2UNRU",  /* Neptune */
  "D2NL2NR2D2BU8GFEHBL3D2F2R2E2U2",   /* Pluto */
  "BG2LDFEULU3NURFRFBU5GLGLU2",       /* Chiron */
  "BD4UNL3NR3U2RE2UH2L2G",            /* Ceres */
  "BD4UNL3NR3UE2HUHNUGDGF2",          /* Pallas Athena */
  "BD4UNL2NR2U4NL4NR4NE3NF3NG3NH3U3", /* Juno */
  "BU4DBG3NLFDF2E2UERBH2GDGHUH", /* Vesta */
  "BG2LGFEU2HU2E2R2F2D2GD2FEHL", /* North Node */
  "NE2NF2NG2H2GD2F2R2E2U2H2L2G", /* Part of Fortune */
  "BG4U8F4E4D8",                 /* Midheaven */
  "NR4L4ND4UE3R2F3D5",           /* Ascendant */
  "U2NHNEBD4NGNFU2L2NHNGR4NEF"}; /* Vertex */

char *housedraw[] = {"",
  "BD2NLNRU4L", "BHBUR2D2L2D2R2", "BHBUR2D2NL2D2L2",
  "BHBUD2R2NU2D2", "BEBUL2D2R2D2L2", "NLRD2L2U4R2",
  "BHBUR2DG2D", "NRLU2R2D4L2U2", "NRLU2R2D4L2",
  "BH2NLD4NLRBR2U4R2D4L2", "BH2NLD4NLRBR2RNRU4L", "BH2NLD4NLRBR2NR2U2R2U2L2"};

char *aspectdraw[] = {"",
  "HLG2DF2RE2UHE4", "BGL2GDFREU2E2U2ERFDGL2", "BH4R8D8L8U8",
  "BU4GDGDGDGDR8UHUHUHUH", "BLNH3NG3RNU4ND4RNE3F3",
  "BG4EUEUEUEUNL4NR4BDFDFDFDF", "BH4FDFDFDFDNL4NR4BUEUEUEUE", "BE4G8R8",
  "BD2L3U6R6D6L3D2R2", "F4BU3U2HULHL2GLDGD2FDRFR2E3", "BD2U3NR3NU3L3BD5R6",
  "BU2D3NR3ND3L3BU5R6", "BH3R6G6", "BR3L5HUER4FD4GL4H",
  "BF2UHL2GFR3DGL3BE6LNLU2NRLBL4LNLD2NLR", "BL2R4G4BE6LNLU2NRLBL4LNLD2NLR",
  "BL2R4G4BE6L7NLU2NLR3ND2R3ND2R", "BF2UHL2GFR3DGL3BU6LNLU2NLRBR2F2E2"};

char *asciidraw[] = {"",
  "BR2D4BD2D0", "BRD2BR2U2", "BD2R4BD2L4BFU4BR2D4", "BR2D6BENL3EHL2HER3",
  "RDLNUBR4G4BR4DLUR", "BD2NF4UEFDG2DFRE2", "BR2DG", "BR3G2D2F2", "BRF2D2G2",
  "BD2FNGRNU2ND2RNEF", "BD3R2NU2ND2R2", "BD5BR2DG", "BD3R4", "BD6BRRULD",
  "BD5E4", /* Special Characters */
  "BDD4NE4FR2EU4HL2G", "BFED6NLR", "BDER2FDG4R4", "BDER2FDGNLFDGL2H",
  "D3R3NU3ND3R", "NR4D3R3FDGL2H", "BR3NFL2GD4FR2EUHL3", "R4DG4D",
  "BDDFNR2GDFR2EUHEUHL2G", "BD5FR2EU4HL2GDFR3", /* Numbers */
  "BR2BD2D0BD2D0", "BR2BD2D0BD2G", "BR3G3F3", "BD2R4BD2L4", "BRF3G3",
  "BDER2FDGLDBD2D0", "BF2DFEU2HL2GD4FR2", /* Special Characters */
  "BD6U4E2F2D2NL4D2", "D6R3EUHNL3EUHL3", "BR3NFL2GD4FR2E", "D6R2E2U2H2L2",
  "NR4D3NR3D3R4", "NR4D3NR3D3", "BR3NFL2GD4FR2EU2L2", "D3ND3R4NU3D3",
  "BRRNRD6NLR", "BD4DFR2EU5", "D3ND3RNE3F3", "D6R4", "ND6F2NDE2D6",
  "ND6F4ND2U4", "BDD4FR2EU4HL2G", "R3FDGL3NU3D3", "BDD4FRENHNFEU3HL2G",
  "ND6R3FDGL2NLF3", "BR3NFL2GDFR2FDGL2H", "R2NR2D6", "D5FR2EU5",
  "D2FDFNDEUEU2", "D6E2NUF2U6", "DF4DBL4UE4U", "D2FRND3REU2",
  "R4DG4DR4", /* Upper Case Letters */
  "BR3L2D6R2", "BDF4", "BRR2D6L2", "BD2E2F2", "BD6R4", "BR2DF", /* Symbols */
  "BF4G2LHU2ER2FD3", "D5NDFR2EU2HL2G", "BF4BUHL2GD2FR2E", "BR4D5NDGL2HU2ER2F",
  "BF4NL4UHL2GD2FR3", "BD3RNR3ND3U2ERF", "BD8R3EU4HL2GD2FR2E", "D3ND3ER2FD3",
  "BR2D0BD2D4", "BR2D0BD2D5GLH", "D4ND2REREBD4HLH", "BR2D6", "BD2DND3EFNDEFD3",
  "BD2DND3ER2FD3", "BD3D2FR2EU2HL2G", "BD2DND5ER2FD2GL2H",
  "BR4BD8U5HL2GD2FR2E", "BD2DND3ER2F", "BD6R3EHL2HER3", "BR2D2NL2NR2D4",
  "BD2D3FRE2NU2D2", "BD2DFDFEUEU", "BD2D3FENUFEU3", "BD2F2NG2NE2F2",
  "BD2D3FR2ENU3D2GL3", "BD2R4G4R4", /* Lower Case Letters */
  "BR3GDGFDF", "BR2D2BD2D2", "BRFDFGDG", "BFEFE", "BD6R4"}; /* Symbols */
#endif

double starbright[] = {0,
  0.46, 2.02, 5.24, 5.09, 0.85, 0.08, 0.12, 1.64, 1.65, 1.70,
  0.50, 1.90, 1.98,-0.72, 1.93,-1.46, 1.50, 1.84, 1.59, 0.38,
  1.14, 1.78, 1.86, 1.68, 1.98, 1.35, 1.79, 1.58, 1.63, 1.25,
  1.77, 0.98, 1.86, 0.61,-0.04,-0.01, 0.96, 1.63, 1.87, 1.85,
  0.03, 0.77, 1.94, 1.25, 1.74, 1.16, 4.61};

double stardata[] = {
 1,37,42.9,-57,14,12,   2,31,50.5, 89,15,51,   3,17,46.1,-62,34,32,
 3,49,11.1, 24, 8,12,   4,35,55.2, 16,30,33,   5,16,41.3, 45,59,53,
 5,14,32.2, -8,12, 6,   5,25, 7.8,  6,20,59,   5,26,17.5, 28,36,27,
 5,36,12.7, -1,12, 7,   5,55,10.3,  7,24,25,   5,59,31.7, 44,56,51,
 6,22,41.9,-17,57,22,   6,23,57.2,-52,41,44,   6,37,42.7, 16,23,57,
 6,45, 8.9,-16,42,58,   6,58,37.5,-28,58,20,   7, 8,23.4,-26,23,35,
 7,34,35.9, 31,53,18,   7,39,18.1,  5,13,30,   7,45,18.9, 28, 1,34,
 8, 9,31.9,-47,20,12,   8,22,30.8,-59,30,34,   9,13,12.1,-69,43, 2,
 9,27,35.2, -8,39,31,  10, 8,22.3, 11,58, 2,  11, 3,43.6, 61,45, 3,
12,26,35.9,-63, 5,56,  12,31, 9.9,-57, 6,47,  12,47,43.3,-59,41,19,
12,54, 1.7, 55,57,35,  13,25,11.5,-11, 9,41,  13,47,32.3, 49,18,48,
14, 3,49.4,-60,22,22,  14,15,39.6, 19,10,57,  14,39,36.2,-60,50, 7,
16,29,24.4,-26,25,55,  17,33,36.4,-37, 6,13,  17,37,19.0,-42,59,52,
18,24,10.3,-34,23, 5,  18,36,56.2, 38,47, 1,  19,50,46.9,  8,52, 6,
20,25,38.8,-56,44, 7,  20,41,25.8, 45,16,49,  22, 8,13.9,-46,57,40,
22,57,39.0,-29,37,20,   0,42, 7.0, 41,16, 0};

byte errorcount[PLANETS+1] = {0, 0, 0, 0, 0, 0, 11, 5, 4, 4, 4};

double planetdata[] = {
358.4758,35999.0498,-.0002,.01675,-.4E-4,0,1,101.2208,1.7192,.00045,0,0,0,0,0,
0, /* Earth/Sun */
102.2794,149472.515,0,.205614,.2E-4,0,.3871,28.7538,.3703,.0001,47.1459,1.1852,
0.0002,7.009,.00186,0, /* Mercury */
212.6032,58517.8039,.0013,.00682,-.5E-4,0,.7233,54.3842,.5082,-.14E-2,75.7796,
0.8999,.4E-3,3.3936,.1E-2,0, /* Venus */
319.5294,19139.8585,.2E-3,.09331,.9E-4,0,1.5237,285.4318,1.0698,.1E-3,48.7864,
0.77099,0,1.8503,-.7E-3,0, /* Mars */
225.4928,3033.6879,0,.04838,-.2E-4,0,5.2029,273.393,1.3383,0,99.4198,1.0583,0,
1.3097,-.52E-2,0, /* Jupiter */
-.001,-.0005,.0045,.0051,581.7,-9.7,-.0005,2510.7,-12.5,-.0026,1313.7,-61.4,
0.0013,2370.79,-24.6,-.0013,3599.3,37.7,-.001,2574.7,31.4,-.00096,6708.2,
-114.5,-.0006,5499.4,-74.97,-.0013,1419,54.2,.0006,6339.3,-109,.0007,4824.5,
-50.9,.0020,-.0134,.0127,-.0023,676.2,.9,.00045,2361.4,174.9,.0015,1427.5,
-188.8,.0006,2110.1,153.6,.0014,3606.8,-57.7,-.0017,2540.2,121.7,-.00099,
6704.8,-22.3,-.0006,5480.2,24.5,.00096,1651.3,-118.3,.0006,6310.8,-4.8,.0007,
4826.6,36.2, /* Jupiter error */
174.2153,1223.50796,0,.05423,-.2E-3,0,9.5525,338.9117,-.3167,0,112.8261,.8259,
0,2.4908,-.0047,0, /* Saturn */
-.0009,.0037,0,.0134,1238.9,-16.4,-.00426,3040.9,-25.2,.0064,1835.3,36.1,
-.0153,610.8,-44.2,-.0015,2480.5,-69.4,-.0014,.0026,0,.0111,1242.2,78.3,-.0045,
3034.96,62.8,-.0066,1829.2,-51.5,-.0078,640.6,24.2,-.0016,2363.4,-141.4,.0006,
-.0002,0,-.0005,1251.1,43.7,.0005,622.8,13.7,.0003,1824.7,-71.1,.0001,2997.1,
78.2, /* Saturn error */
74.1757,427.2742,0,.04682,.00042,0,19.2215,95.6863,2.0508,0,73.5222,.5242,0,
0.7726,.1E-3,0, /* Uranus */
-.0021,-.0159,0,.0299,422.3,-17.7,-.0049,3035.1,-31.3,-.0038,945.3,60.1,-.0023,
1227,-4.99,.0134,-.02186,0,.0317,404.3,81.9,-.00495,3037.9,57.3,.004,993.5,
-54.4,-.0018,1249.4,79.2,-.0003,.0005,0,.0005,352.5,-54.99,.0001,3027.5,54.2,
-.0001,1150.3,-88, /* Uranus error */
30.13294,240.45516,0,.00913,-.00127,0,30.11375,284.1683,-21.6329,0,130.68415,
1.1005,0,1.7794,-.0098,0, /* Neptune */
0.1832,-.6718,.2726,-.1923,175.7,31.8,.0122,542.1,189.6,.0027,1219.4,178.1,
-.00496,3035.6,-31.3,-.1122,.166,-.0544,-.00496,3035.3,58.7,.0961,177.1,-68.8,
-.0073,630.9,51,-.0025,1236.6,78,.00196,-.0119,.0111,.0001,3049.3,44.2,-.0002,
893.9,48.5,.00007,1416.5,-25.2, /* Neptune error */
229.781,145.1781,0,.24797,.002898,0,39.539,113.5366,.2086,0,108.944,1.3739,0,
17.1514,-.0161,0, /* Pluto */
-.0426,.073,-.029,.0371,372,-331.3,-.0049,3049.6,-39.2,-.0108,566.2,318.3,
0.0003,1746.5,-238.3,-.0603,.5002,-.6126,.049,273.97,89.97,-.0049,3030.6,61.3,
0.0027,1075.3,-28.1,-.0007,1402.3,20.3,.0145,-.0928,.1195,.0117,302.6,-77.3,
0.00198,528.1,48.6,-.0002,1000.4,-46.1, /* Pluto error */
34.6127752,713.5756219,0,.382270369,-.004694073,0,13.66975144,337.407213,
2.163306646,0,208.1482658,1.247724355,0,6.911179715,.011236955,0, /* Chiron */
108.2925,7820.36556,0,.0794314,0,0,2.7672273,71.0794444,0,0,80.23555556,
1.3960111,0,10.59694444,0,0, /* Ceres */
106.6641667,7806.531667,0,.2347096,0,0,2.7704955,310.166111,0,0,172.497222,
1.39601111,0,34.81416667,0,0, /* Pallas Athena */
267.685,8256.081111,0,.2562318,0,0,2.6689897,245.3752778,0,0,170.137777,
1.396011111,.0003083333,13.01694444,0,0, /* Juno */
138.7733333,9924.931111,0,.0902807,0,0,2.360723,149.6386111,0,0,103.2197222,
1.396011111,.000308333,7.139444444,0,0, /* Vesta */
104.5959,138.5369,0,0,0,0,40.99837, 0,0,0,0,0,0,0,0,0, /* Cupido */
337.4517,101.2176,0,0,0,0,50.667443,0,0,0,0,0,0,0,0,0, /* Hades */
104.0904,80.4057, 0,0,0,0,59.214362,0,0,0,0,0,0,0,0,0, /* Zeus */
17.7346, 70.3863, 0,0,0,0,64.816896,0,0,0,0,0,0,0,0,0, /* Kronos */
138.0354,62.5,    0,0,0,0,70.361652,0,0,0,0,0,0,0,0,0, /* Apollo */
-8.678,  58.3468, 0,0,0,0,73.736476,0,0,0,0,0,0,0,0,0, /* Admetos */
55.9826, 54.2986, 0,0,0,0,77.445895,0,0,0,0,0,0,0,0,0, /* Vulkanus */
165.3595,48.6486, 0,0,0,0,83.493733,0,0,0,0,0,0,0,0,0  /* Poseidon */
};

#ifdef GRAPH
char *worlddata[] = {
"-031+70",
"LLRRHLLLLDULLGLLLDULGLLLGLRREDEGGLGGLGLGLLGDRLDRLFFRRERFDFRRREUEEHLUERERUERRF\
GLGLDDFRRRRREFRLGLLLLLGEFDLHGDDLGHLGLLHGLHURDLRRELLLRHUGLDFDLGLLFHGGLGLLLDLLLD\
RRFFDDGLLLLLLGDFGDDRRFRERREEUEREUEFRRERRFFFRFRDDLLLLRFRUREURULHLHHHEF",
"5EUROPE",
"+006+50", "RRERRRRUELLUHHLLREULLELLDGHDUFDEGRDRRLFDLLRGRRGGL", "5ENGLAND",
"+008+55", "GLFGRRREUULL", "5IRELAND",
"+023+64", "RRFRERRREHLLLLLGHLLRFLLRFL", "5ICELAND",
"-011+80", "DDURFRERLGRRLLFRRREEFRRRLHGELLLHRRFRRRRERLLLLLLLLLLLDHGULLL",
"5SVALBARD",
"-014+45",
"FRFRFDDFRDRRLLFRURFHHUERRRRRHUUEERRRRGRDERRLHLRRERRGGRFRFFGLLLLHLLLLGLLDLLLFG\
RFFRERFRERDDDGDGLLDFFEUDDFFDFFDDFFFDFDDDRRERRERRRUERRERURUEEHHLHUGGLLLUUGUHUHU\
RRFFRFRRRDRRFRRRRRRRF",
"5MIDDLE EAST",
"-009+41", "DDRUULEUGD", "5SARDINIA",
"-024+35", "RRLL", "5CRETE",
"-032+35", "RRLL", "5CYPRUS",
"-052+37", "LLHUURHUHUHERERRRDDLLLFFDDURFLLDFDDL", "0CASPAIN SEA",
"-060+44", "LLUEERDFLDL", "0ARAL SEA",
"-068+24",
"FRGFRREDDDDDFDFDDFDDFERUEUUUUEEEEEREURRREFDFRDDDDRREFDDFDDGDDRFDDFDFFRUHUUHHH\
ULUEUUURDRFDFRDEEREUUUHHHUUEERRDDEURRERREREEEUEULLREUHUHLEERRHLGLULUREERDLDRER\
RFGRFDGRRREUHHUREUE",
"6ASIA S",
"-140+36",
"DEUUEUHURREREEGLLHHDDGLDRGDDGGLGLLLGGLDLRDFEUHRRGEERDLLRGLRERRERRE",
"6JAPAN",
"-121+25", "GDFUEUL", "6TAIWAN",
"-080+10", "DDDDREUHH", "6SRI LANKA",
"-121+18", "LDDDRDDRHRRFFDDDLLEHDULRHDFDDGERDDREUUULUUHHLHEUUL",
"2PHILIPPINES",
"-131+43",
"EFREEREEEUUUEUHLLUDLULEERERERRRRRRERRFLRRRRLUERERRRDRERURRGDLGLGLGLGGDDFDFEUR\
RUERUURULEEREDERRFRERERRRERRHLHLRRRREURDRRFRFRUURRHLLLDHHLLHLLHLLLLLLLDLLHRLLL\
LLLLGHULLLLLLLLLLULLLGL",
"6SIBERIA",
"-145+71",
"RELLRHLLLLGDHGHLLLLGLLHUHLLLLLDLLLLHLLLLLDULUDLGLLLLRRERERRRELHLLLLLLLELLLLGD\
LLLLLUDLLLLLGLLLDLLLLLLLDFRDDHELLLLLLDRRLLHUDLGFGRRRRFRLHLLDGLGLLHRRREUHUUULLG\
GLDRFGHLLLHLLLLRFGHLGLLLULGLLLGLLHRHLDDDLLLLDLLLFLLHUHLRRFRRRREHLLHLLLHLL",
"6RUSSIA",
"-143+54", "GDDDDDDDEDUUURUUHUU", "6SAKHALIN",
"-180+72", "GRRRRULLL", "6WRANGEL I.",
"-137+76", "DRRRRRRRELLLLLLLL", "6SIBERIAN I.",
"-091+80", "FERDRRRRRRULLLLLRRULLLLGL", "6SEVERNAYA",
"-101+79", "GRRRRELLLL", "6ZEMLYA",
"-068+77", "LLGLLLLLLGLLGGLGLRFRRRRLHERERERRRERRRREL", "6NOVAYA",
"+123+49",
"FGULLFDDDGFDDDFFDFRFRFDFFFDLFFRDFFEHHHHUHHUFRDFFFRDFFFDFGFRFRFRRFRRRRFFRRFRFF\
DRFFRFEUUGLHHUUEUHLLLLLEUUEULLLGDLLGLHHUHUUUEHEERERRFRRHRREFRRFDFDFEUUHUUUEERE\
RUUUHFDEUHFEURRRELUERRE",
"4NORTH AMERICA S",
"+113+42", "FH", "0SALT LAKE",
"+156+20", "DRULHLHL", "4HAWAII",
"+085+22", "RERFRRFRGRRRRHLHLHLLLLLG", "4CUBA",
"+070+18", "RRHHLLLFLLLFRRRRRR", "4HAITI",
"+078+18", "RRHLLF", "4JAMAICA",
"+066+18", "ELLDR", "4PUERTO RICO",
"+078+24", "UD", "4NASSAU",
"+067+45",
"REFLGDERERREHDLLLHUELLLGLGLREEERRRRRRREERRGGDGRRRFEFUUHLLLEUUHHGLRELLHHUHHHDG\
LGHHULLHLLLLLDFGFDDGLLFDDGHHUULLLLHLLHLLLUHUUEREEREERRRREUUHLLLDDGHULLLHLUHLGD\
RFGGULLLLLLLLLHLLGFLHLLLLLRHLLLLLHLLLLLLHGLLLLGUGLLLHLL",
"4CANADA",
"+088+49",
"LGLGRRRRRRRFLLLGRGDDREUURUFRGRFGFERERREEREERLGGLGLLLGRLLGLEUERHLLLHULHL",
"0GREAT LAKES",
"+117+61", "REHRFRRERGLGLLLL", "0SLAVE LAKE",
"+125+66", "RRERRRGREDLFHGLLLERLLLL", "0BEAR LAKE",
"+097+50", "UULHURFDFG", "0LAKE WINNIPEG",
"+090+72",
"FRRLLFRRRRRRRRRRFRRGLLGRREEFRFLGLFLLLLFRERFRFRRFRRHLHFRRRUHLHRRFRURELLHLLLHRR\
HLHLHGHLHLLGLLEHFRRRHLLLLLLGLDFHLUELLGG",
"4BAFFIN I.",
"+125+72",
"RFRREERRRLLGFFRRRRRLLLLLFRRRRRRRREFRRRRHRRLHLHHLRRULGLFLHLDLLULLLLHLLLLLLLDG",
"4VICTORIA I.",
"+141+70",
"LLLLLLLLHGLHLLLHGLLGLLGLLDRRFRRDLLLULGLLFRRRRRRDLGLLGFDRRRDRRRRRGGGLLGLLGGLLR\
RERERRRERREERRELEERRRLLGDRERRURRFRRRRRFRRFUDRUDDHFDURDURLURDDLFRULURDHFFRGFEGR\
FFRFRFLHLHLFFRFE",
"4ALASKA",
"+045+60",
"REUEREUERRRRERERRRERRRRERLLLLLLHRRRGERHFRRRRHLUDLLHLRERFRERLEUHRRHLEERLLURRRR\
RRRRELLLLLLLLLLGLLLRERHGLRELLLLLLLELLLLLLLLLLGLLLLLLGLLLLLLGLULLLLLLLFRLLLLLGL\
RRRGLLLLLLLGRRRRRRRGLLLLRRFRRRRRRRRRRFDFDLFREFRDLLLDERRFGLLGFFDRFFFRRRF",
"4GREENLAND",
"+080+10",
"DRFDFDDGGGDDGRDGDDFFDFDFFDFFRFFFDDDDDDGDDDDGDDDDGDGFGDDDEUDDDGUDDLDRGDDDFDFRF\
RRFERRLHLUHUURUEELHEREURULURREURREREUHUUDFRREEEEEUEUUEERERRREUEUEUUUUUEEEEUUUH\
LHLHLLLLHLHLGEHLGEUHUUHLHLLLHHLHULEDLLELLGHLLHLGDDHUELLGLGDGHHL",
"3SOUTH AMERICA",
"+060-51", "LDRRELL", "3FALKLAND ISLANDS",
"+092+00", "FUL", "3GALAPAGOS I.",
"-032+32",
"LLGLHLLLLHLGDGHLLHHLLHLEUULLLLLLLLLGLGLLLLHDGLGDGDGGLDGGGDGDFDDDDGDDFFFFDFRFF\
RRRRRRRRERERRFFRRFFDDDGDFFFDFDDDFDGDGDDDFDFDFDDDFDFDFDDFFERRRRREEEEEEEUUEREUUH\
UEEEREEUUUUHUUUHUEUEEEEEREEUEUEEUUULLLLGLLHUHHLHUHHUUHHUUHUHHUU",
"1AFRICA",
"-049-12", "DGGGLGDDDDGDDFFREUEUEUUUEUUUUH", "1MADAGASCAR",
"-032+00", "DDDREUELLL", "0LAKE VICTORIA",
"-014+14", "LRFLU", "0LAKE CHAD",
"-124-16",
"LGDGGLGLLGLDDDGFDDFDFDGFRRRERRRRURERRRRRRRFFFEEDDRFDFRFREFRERRUUEUEEUUUUUUUHH\
HHHHHUUHHHUULDDDDGDGHLHLHEUELLLHLFLLULDRGDDLLHLGG",
"2AUSTRALIA",
"-173-35", "FFDGFDREURULHHHL", "2NEW ZEALAND N",
"-174-41", "LLDGLGLGGRFREEUREEU", "2NEW ZEALAND S",
"-145-41", "DFRRUUUDLLL", "2TASMANIA",
"-178-17", "GRRURUGDH", "2FIJI",
"-130+00", "FRFRLGFEFRFRFDGRRFRRUERFFFRRRLHHHHRHLHHLHLLHGGLHUHLGH",
"2NEW GUINEA",
"-115-04", "RUUEEURHUUEHHGGGGLLDDHLDDFDDRRDERF", "2BORNEO",
"-095+06", "DFFFFFFDFFFFRUUUHFRHLHLUHHHHHLLH", "2SUMATRA",
"-106-06", "GRFRRRRRRFRRHLHLLLLLHL", "2JAVA",
"-120+00", "DGDDRDFHUEDFRHUHREFHLGHURRRRELLLLG", "2CELEBES",
"+000-70",
"ULDLLLLLLLLGLLGLLLGLLGLLLLGLGLLGLLLLGLLLLLHLGLLLLLHLLLLLHLLLLHLLUERLEUUUUUUEE\
RRRULLGLLLLGLGGLLLDRUDRDLGHLLGLLFGRRFLLLLLLLDHLLLLHLLLLLGLLLLHLLLLLLLGRFDLLLUL\
LLGHLLLLLLLLLLHGHLLGLLLLLLLGLLLLLLLLLLLGLLLGLLLLLLLLGLLLLLLLLLLLLLLLLLLLLL",
"7ANTARCTICA W",
"+180-78",
"LLLLLLLHLLGHLLGHLUEERRERREHLLLLHLLLLLLHLLLLLLLLLLLHLHLLLLLHLLULDLLLLLDLLHLLLL\
GHFLLLLLHLLLLLLGLHLLHLGLLLLHLGLLGLLLULLLGLLHDFLLLGLGLLLELLLLHLLLLLLLLLLHLLLHLL\
LLGGHGHGLLLGLDLLLLHLLGHGLLLLLLLLLLLLLLHLGLLLLLLLLLLLLLL",
"7ANTARCTICA E",
"", "", ""};
#endif


/*
*******************************************************************************
** General and numeric routines
*******************************************************************************
*/

/* Swap two integer values. */

void swapint(i1, i2)
int *i1, *i2;
{
  int temp;
  temp = *i1; *i1 = *i2; *i2 = temp;
}


/* Swap two double float values. */

void swapdoub(d1, d2)
double *d1, *d2;
{
  double temp;
  temp = *d1; *d1 = *d2; *d2 = temp;
}


/* Return the length of a string. */

int stringlen(line)
char *line;
{
  int i;
  for (i = 0; *line++; i++)
    ;
  return i;
}


/* Determine the sign of a number: -1 if value negative, +1 if value */
/* positive, and 0 if it's zero.                                     */

double sgn(d)
double d;
{
  return d < 0.0 ? -1.0 : (d > 0.0 ? 1.0 : 0.0);
}


/* Convert an inputed fractional degrees/minutes value to a true decimal   */
/* degree quantity. For example, the user enters the decimal value "10.30" */
/* to mean 10 degrees and 30 minutes; this will return 10.5, i.e. 10       */
/* degrees and 30 minutes expressed as a floating point degree value.      */

double dectodeg(d)
double d;
{
  return sgn(d)*(floor(dabs(d))+(dabs(d)-floor(dabs(d)))*100.0/60.0);
}


/* Modulus function for floating point values. The modulus value itself */
/* has been specified earlier: it is usually either 360.0 or PI/2.0.    */

double mod(d)
double d;
{
  return ((d)-(floor((d)/modulus)*modulus));
}


/* A similar modulus function: convert an integer to value from 1..12. */

int mod12(i)
int i;
{
  while (i > SIGNS)
    i -= SIGNS;
  while (i < 1)
    i += SIGNS;
  return i;
}


/* Return the shortest distance between two degrees in the zodiac. This is  */
/* normally their difference, but we have to check if near the Aries point. */

double mindistance(deg1, deg2)
double deg1, deg2;
{
  double i;
  i = dabs(deg1-deg2);
  return i < 180 ? i : DEGREES - i;
}


/* Return the degree of the midpoint between two zodiac positions, making */
/* sure we return the true midpoint closest to the positions in question. */

double midpoint(deg1, deg2)
double deg1, deg2;
{
  double mid;
  mid = (deg1+deg2)/2.0;
  return mindistance(deg1, mid) < 90.0 ? mid : mod(mid+180.0);
}


/* Given a planet and sign, determine whether: The planet rules the sign, */
/* the planet has its fall in the sign, the planet exalts in the sign, or */
/* is debilitated in the sign; and return an appropriate character.       */

char dignify(body, sign)
int body, sign;
{
  if (body > OBJECTS)
    return ' ';
  if (ruler1[body] == sign || ruler2[body] == sign)
    return 'R';
  if (ruler1[body] == mod12(sign+6) || ruler2[body] == mod12(sign+6))
    return 'F';
  if (exalt[body] == sign)
    return 'e';
  if (exalt[body] == mod12(sign+6))
    return 'd';
  return '-';
}


/* Determine the number of days in a particular month. The year is needed, */
/* too, because we have to check for leap years in the case of February.   */

int dayinmonth(month, year)
int month, year;
{
  return (month == 9 || month == 4 || month == 6 || month == 11 ? 30 :
	  (month != 2 ? 31 :
	   (year/4*4==year && (year/100*100!=year || year/400*400==year) ?
	    29 : 28)));
}


/* Given an aspect and two objects making that aspect with each other,   */
/* return the maximum orb allowed for such an aspect. Normally this only */
/* depends on the aspect itself, but some objects require narrow orbs,   */
/* and some allow wider orbs, so check for these cases.                  */

double orb(body1, body2, aspect)
int body1, body2, aspect;
{
  double orb, i;
  orb = aspectorb[aspect];
  i = body1 > BASE ? 2.0 : (body1 > OBJECTS ? 360.0 : planetorb[body1]);
  orb = MIN(orb, i);
  i = body2 > BASE ? 2.0 : (body2 > OBJECTS ? 360.0 : planetorb[body2]);
  orb = MIN(orb, i);
  if (body1 <= OBJECTS)
    orb += planetadd[body1];
  if (body2 <= OBJECTS)
    orb += planetadd[body2];
  return orb;
}


/*
*******************************************************************************
** IO routines
*******************************************************************************
*/

/* Simplification for a commonly printed error message. */

void toofew(option)
char *option;
{
  fprintf(stderr, "Too few options to switch -%s\n", option);
  exit(1);
}


/* Nicely format the current longitude and latitude locations and return  */
/* them in a string. Various parts of the program display a chart header, */
/* and this allows the similar computations to be coded only once.        */

char *stringlocation(Lon, Lat, norm)
double Lon, Lat, norm;
{
  static char string[14];
  int i, j;
  i = (int) ((dabs(Lon)-floor(dabs(Lon)))*norm+0.1);
  j = (int) ((dabs(Lat)-floor(dabs(Lat)))*norm+0.1);
  sprintf(string, "%3.0f'%d%d%c %2.0f'%d%d%c",
	  floor(dabs(Lon)), i/10, i%10, Lon < 0.0 ? 'E' : 'W',
	  floor(dabs(Lat)), j/10, j%10, Lat < 0.0 ? 'S' : 'N');
  return string;
}


/* Return the next value in a stream of values describing how to calculate */
/* the positions of the various planets.                                   */

double readplanetdata(reset)
int reset;
{
  static double *datapointer = planetdata;
  if (!reset)
    return *datapointer++;
  datapointer = planetdata;
  return 0.0;
}


/* Similarly, return the next value in a stream of values describing the */
/* locations of the various fixed stars.                                 */

double readstardata(reset)
int reset;
{
  static double *datapointer = stardata;
  if (!reset)
    return *datapointer++;
  datapointer = stardata;
  return 0.0;
}

#ifdef GRAPH
/* Another stream reader, this one is used by the globe drawing routine: */
/* for the next body of land/water, return its name (and color), its     */
/* longitude and latitude, and a vector description of its outline.      */

int readworlddata(nam, loc, lin)
char **nam, **loc, **lin;
{
  static char **datapointer = worlddata;
  *loc = *datapointer++;
  *lin = *datapointer++;
  *nam = *datapointer++;
  if (*loc[0])
    return TRUE;
  datapointer = worlddata;    /* Reset stream when no data left. */
  return FALSE;
}
#endif


/* Print a zodiac position on the screen. */

void printminute(deg)
double deg;
{
  int sign, d, m;
  if (!right) {

    /* Normally, we print out the position in degrees/sign/minutes format: */

    deg = mod(deg + 1.0/60.0/2.0);
    sign = (int) (deg / 30.0);
    d = (int) deg - sign*30;
    m = (int) ((deg - floor(deg))*60.0);
    printf("%2d%c%c%c%s%d", d, SIGNAM(sign + 1), m < 10 ? "0" : "", m);
  } else {

    /* However, if -s0 switch in effect, print position in hours/minutes: */

    deg = mod(deg + 1.0/4.0/2.0);
    d = (int) (deg / 15.0);
    m = (int) ((deg - (double)d*15.0)*60.0/24.0);
    printf("%2dh,%s%dm", d, m < 10 ? "0" : "", m);
  }
}


/* This is similar to printing out a zodiac degree, but here we print out */
/* a (signed) declination value in degrees and minutes.                   */

void printaltitude(deg)
double deg;
{
  int d, m;
  while (deg > 90.0)    /* Make sure declination value is from -90..+90 deg. */
    deg -= 180.0;
  while (deg < -90.0)
    deg += 180.0;
  putchar(deg < 0.0 ? '-' : '+');
  deg = dabs(deg) + 1.0/60.0/2.0;
  d = (int) deg;
  m = (int) ((deg - floor(deg))*60.0);
  printf("%2d,%s%d'", d, m < 10 ? "0" : "", m);
}


/* Prompt the user for a floating point value, and make sure it conforms  */
/* to the specified bounds before returning it. If a non-numeric value is */
/* entered, then assume it's the name of a month, and try to convert it   */
/* to the appropriate number from 1 to 12; and also check for an "AM" or  */
/* "PM" suffix to hour values, and adjust the number appropriately.       */

double input(prompt, low, high)
char *prompt;
double low, high;
{
  char line[STRING], c;
  double x;
  int i, j;
  while (TRUE) {
    printf("%s > ", prompt);
    if (gets(line) == (char *) NULL) {
      printf("\nAstrolog terminated.\n");
      exit(2);
    }
    i = stringlen(line);
    for (j = 0; j < i; j++)
      if (line[j] == ':')      /* Convert all colons in the */
	line[j] = '.';         /* entered line to periods.  */
    c = CAP(line[0]);

    /* If they entered a string, then check to see if it's a month name. */

    if (c >= 'A' && c <= 'Z') {
      switch (c) {
      case 'J': x = CAP(line[1]) == 'U' ?            /* January,        */
	(CAP(line[2]) == 'L' ? 7.0 : 6.0) : 1.0;     /* June, or July   */
      case 'F': x = 2.0; break;                      /* February        */
      case 'M': x = CAP(line[2]) == 'Y' ? 5.0 : 3.0; /* March or May    */
      case 'A': x = CAP(line[1]) == 'U' ? 8.0 : 4.0; /* April or August */
      case 'S': x = 9.0; break;                      /* September       */
      case 'O': x = 10.0; break;                     /* October         */
      case 'N': x = 11.0; break;                     /* November        */
      case 'D': x = 12.0; break;                     /* December        */
      default: x = 0.0;
      }
    } else {
      sscanf(line, "%lf", &x);    /* Convert entered line to number. */
      i = stringlen(line)-1;
      if (i > 0 && CAP(line[i]) == 'M')
	i--;
      if (i > 0) {
	c = CAP(line[i]);
	if (c == 'A')                    /* Adjust value appropriately */
	  x = x >= 12.0 ? x-12.0 : x;    /* if 'AM' or 'PM' suffix.    */
	else if (c == 'P')
	  x = x >= 12.0 ? x : x+12.0;
      }
    }
    if (x >= low && x <= high)
      return x;
    printf("Value out of range of from %.0f to %.0f.\n", low, high);
  }
}


/* This important procedure gets all the parameters defining the chart that  */
/* will be worked with later. Given a "filename", it gets from it all the    */
/* pertinent chart information. This is more than just reading from a file - */
/* the procedure also takes care of the cases of prompting the user for the  */
/* information and using the time functions to determine the date now - the  */
/* program considers these cases "virtual" files. Furthermore, when reading  */
/* from a real file, we have to check if it was written in the -o0 format.   */

void inputdata(filename)
char *filename;
{
  char name[STRING], c;
  int i;
  double k, l, m;
#ifdef TIME
  struct tm curtime;
  long curtimer;

  /* If we are to read from the file "now" then that means use the time */
  /* functions to calculate the present date and time.                  */

  if (filename[0] == 'n' && filename[1] == 'o' && filename[2] == 'w' &&
      filename[3] == 0) {
    autom = 1;
    curtimer = (long) time((long *) 0);
    curtime = *localtime(&curtimer);
    M = (double) curtime.tm_mon + 1.0;
    D = (double) curtime.tm_mday;
    Y = (double) curtime.tm_year + 1900.0;
    F = (double) curtime.tm_hour + (double) curtime.tm_min / 100.0 +
      (double) curtime.tm_sec / 6000.0;
    X = defzone; L5 = deflong; LA = deflat;
    return;
  }
#endif

  /* If we are to read from the file "tty" then that means prompt the user */
  /* for all the chart information.                                        */

  if (filename[0] == 't' && filename[1] == 't' && filename[2] == 'y' &&
      filename[3] == 0) {
    printf("** Astrolog version %s (%s) **\n", VERSION, ADDRESS);
#ifdef SWITCHES
    printf("   Invoke as 'astrolog -H' for brief list of command options.\n");
#endif
    M = input("Enter month of birth", 1.0, 12.0);
    D = input("Enter day   of birth", 1.0,
	      (double) dayinmonth((int) M, 0));
    Y = input("Enter year  of birth", -4000.0, 4000.0);
    printf("Subtract 1 from hour entered if Daylight Saving time then.\n");
    F = input("Enter time  of birth", -2.0, 24.0);
    printf("Enter negative value below for time zones east of Greenwich.\n");
    X = input("Time zone in hours off GMT [HR:MIN - 5=Eastern, 8=Pacific]",
	      -24.0, 24.0);
    printf("Enter negative values below for eastern or southern locations.\n");
    L5 = input("Longitude west of place: DEG:MIN", -180.0, 180.0);
    LA = input("Latitude north of place: DEG:MIN", -90.0, 90.0);
    putchar('\n');
    return;
  }

  /* Now that the special cases are taken care of, we can assume we are */
  /* to read from a real file.                                          */

  autom = 1;
  data = fopen(filename, "r");      /* Look for file in current directory. */
  if (data == NULL) {
    sprintf(name, "%s%s", DEFAULT_DIR, filename);    /* Look for file in   */
    data = fopen(name, "r");                         /* default directory. */
    if (data == NULL) {
      fprintf(stderr, "File '%s' not found.\n", filename);
      exit(1);
    }
  }

  /* Read the chart parameters from a normal file. */

  if ((c = getc(data)) != 'S') {
    ungetc(c, data);
    fscanf(data, "%lf%lf%lf%lf%lf%lf%lf", &M, &D, &Y, &F, &X, &L5, &LA);

  /* Read the actual chart positions from a file produced with the -o0. */

  } else {

    /* Hack: A negative month value means the chart parameters are invalid, */
    /* hence -o0 is in effect and we can assume the chart positions are     */
    /* already in memory so we don't have to calculate them later.          */

    M = -1.0;
    for (i = 1; i <= OBJECTS; i++) {
      fscanf(data, "%s%lf%lf%lf", name, &k, &l, &m);
      planet[i] = (l-1.0)*30.0+k+m/60.0;
      fscanf(data, "%s%lf%lf", name, &k, &l);
      planetalt[i] = k+l/60.0;
      ret[i] = DTOR(name[1] == 'D' ? 1.0 : -1.0);
    }
    for (i = 1; i <= SIGNS/2; i++) {
      fscanf(data, "%s%lf%lf%lf", name, &k, &l, &m);
      house[i+6] = mod((house[i] = mod((l-1.0)*30.0+k+m/60.0))+180.0);
    }
  }
  fclose(data);
}

/**/