home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1994 March / Source_Code_CD-ROM_Walnut_Creek_March_1994.iso / compsrcs / misc / volume37 / astrolog / part02 < prev    next >
Encoding:
Text File  |  1993-05-18  |  57.1 KB  |  1,556 lines

  1. Newsgroups: comp.sources.misc
  2. From: astrolog@u.washington.edu (Astrolog)
  3. Subject: v37i071:  astrolog - Generation of astrology charts v3.05, Part02/12
  4. Message-ID: <1993May19.061500.11129@sparky.imd.sterling.com>
  5. X-Md4-Signature: 05a3209533d8348841f1646b0d3eb70d
  6. Date: Wed, 19 May 1993 06:15:00 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: astrolog@u.washington.edu (Astrolog)
  10. Posting-number: Volume 37, Issue 71
  11. Archive-name: astrolog/part02
  12. Environment: UNIX, DOS, VMS
  13. Supersedes: astrolog: Volume 30, Issue 62-69
  14.  
  15. #! /bin/sh
  16. # This is a shell archive.  Remove anything before this line, then unpack
  17. # it by saving it into a file and typing "sh file".  To overwrite existing
  18. # files, type "sh file -c".  You can also feed this as standard input via
  19. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  20. # will see the following message at the end:
  21. #        "End of archive 2 (of 12)."
  22. # Contents:  data.c driver.c
  23. # Wrapped by pul@hardy on Sun May 16 22:23:15 1993
  24. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  25. if test -f 'data.c' -a "${1}" != "-c" ; then 
  26.   echo shar: Will not clobber existing file \"'data.c'\"
  27. else
  28. echo shar: Extracting \"'data.c'\" \(19299 characters\)
  29. sed "s/^X//" >'data.c' <<'END_OF_FILE'
  30. X/*
  31. X** Astrolog (Version 3.05) File: data.c
  32. X**
  33. X** IMPORTANT: The planetary calculation routines used in this program
  34. X** have been Copyrighted and the core of this program is basically a
  35. X** conversion to C of the routines created by James Neely as listed in
  36. X** Michael Erlewine's 'Manual of Computer Programming for Astrologers',
  37. X** available from Matrix Software. The copyright gives us permission to
  38. X** use the routines for our own purposes but not to sell them or profit
  39. X** from them in any way.
  40. X**
  41. X** IN ADDITION: the graphics database and chart display routines used in
  42. X** this program are Copyright (C) 1991-1993 by Walter D. Pullen. Permission
  43. X** is granted to freely use and distribute these routines provided one
  44. X** doesn't sell, restrict, or profit from them in any way. Modification
  45. X** is allowed provided these notices remain with any altered or edited
  46. X** versions of the program.
  47. X*/
  48. X
  49. X#include "astrolog.h"
  50. X
  51. X
  52. X/*
  53. X*******************************************************************************
  54. X** Global variables
  55. X*******************************************************************************
  56. X*/
  57. X
  58. Xint total        = TOTAL;
  59. Xint aspects      = DEFAULT_ASPECTS;
  60. Xint universe     = 0;
  61. Xint centerplanet = 1;
  62. Xint housesystem  = DEFAULT_SYSTEM;
  63. Xint ansi         = FALSE;
  64. Xint divisions    = DIVISIONS;
  65. Xint smartcusp    = FALSE;
  66. Xint column80     = FALSE;
  67. Xint todisplay    = 0;
  68. Xint exdisplay    = 0;
  69. Xint operation    = 0;
  70. Xint relation  = 0;        /* What relationship chart are we doing, if any? */
  71. Xint interpret = FALSE;    /* Is -I switch in effect?                       */
  72. Xint progress  = FALSE;    /* Are we doing a -p progressed chart?           */
  73. Xint multiplyfactor = 1;   /* Value passed to -x switch.                    */
  74. Xint onasc     = 0;        /* Value passed to -1 or -2 switch.              */
  75. Xint wheelrows = 4;        /* Number of rows per house to use for -w wheel. */
  76. Xint graphstep = 5;        /* Latitude step rate passed to -L switch.       */
  77. Xint autom     = FALSE;    /* Do we need to prompt user for chart info?     */
  78. Xreal progday = 365.25;    /* Day value passed to -pd switch.               */
  79. Xreal defzone = DEFAULT_ZONE;
  80. Xreal deflong = DEFAULT_LONG;
  81. Xreal deflat  = DEFAULT_LAT;
  82. Xreal modulus = DEGREES;
  83. Xchar *filename, *filename2, string[STRING*2];
  84. X
  85. Xreal SD = 0.0, Mon, Day, Yea, Tim, Zon, Lon, Lat, Mon2, Yea2, Delta = 0.0,
  86. X  M = 3.0, D = 20.0, Y = 1993.0, F = 6.43, X = 8.0, L5 = 122.20, LA = 47.36,
  87. X  T, JD, Jdp;
  88. X
  89. X
  90. X/*
  91. X*******************************************************************************
  92. X** Global arrays
  93. X*******************************************************************************
  94. X*/
  95. X
  96. Xreal planet[TOTAL+1], planetalt[TOTAL+1], house[SIGNS+1], ret[TOTAL+1],
  97. X  spacex[BASE+1], spacey[BASE+1], spacez[BASE+1], force[TOTAL+1];
  98. Xgridstruct PTR grid = NULL;
  99. Xbyte inhouse[TOTAL+1], inhouse1[TOTAL+1], inhouse2[TOTAL+1];
  100. Xint starname[STARS+1], objectansi[TOTAL+1];
  101. X
  102. X/* Restriction status of each object, as specified with -R switch. */
  103. X
  104. Xbyte ignore[TOTAL+1] = {
  105. X  0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,                /* Planets  */
  106. X  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,                   /* Minors   */
  107. X  0, 0, 0, 0,                                     /* Cusps    */
  108. X  0, 0, 0, 0, 0, 0, 0, 0,                         /* Uranians */
  109. X  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* Stars    */
  110. X  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  111. X
  112. Xbyte ignore2[TOTAL+1] = {
  113. X  0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,                /* Planets  */
  114. X  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,                   /* Minors   */
  115. X  0, 0, 0, 0,                                     /* Cusps    */
  116. X  0, 0, 0, 0, 0, 0, 0, 0,                         /* Uranians */
  117. X  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,  /* Stars    */
  118. X  0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
  119. X
  120. X
  121. X/*
  122. X*******************************************************************************
  123. X** Table data
  124. X*******************************************************************************
  125. X*/
  126. X
  127. Xchar *appname = APPNAME;
  128. X
  129. Xchar *signname[] = {"",
  130. X  "Aries", "Taurus", "Gemini", "Cancer", "Leo",
  131. X  "Virgo", "Libra", "Scorpio",
  132. X  "Sagittarius", "Capricorn", "Aquarius", "Pisces"};
  133. X
  134. Xchar *signabbrev[] = {"",
  135. X  "Ar", "Ta", "Ge", "Cn", "Le", "Vi", "Li", "Sc", "Sg", "Cp", "Aq", "Pi"};
  136. X
  137. Xchar *signenglish[] = {"",
  138. X  "Ram", "Bull", "Twins", "Crab", "Lion", "Virgin",
  139. X  "Scales", "Scorpion", "Archer", "Sea-Goat", "Water-Bearer", "Fishes"};
  140. X
  141. Xchar *housetradition[] = {"",
  142. X  "Personality", "Money", "Communication", "Home",
  143. X  "Children", "Servants", "Marriage", "Death",
  144. X  "Long Journeys Over Water", "Career", "Friends", "Troubles"};
  145. X
  146. Xchar *objectname[] = {
  147. X  "Earth", "Sun", "Moon", "Mercury", "Venus", "Mars",    /* Planets   */
  148. X  "Jupiter", "Saturn", "Uranus", "Neptune", "Pluto",
  149. X  "Chiron", "Ceres", "Pallas", "Juno", "Vesta",          /* Asteroids */
  150. X  "Node", "Fortune", "Midheaven", "Ascendant", "Vertex", /* Others    */
  151. X  "11th Cusp", "12th Cusp", "2nd Cusp", "3rd Cusp",      /* Cusps     */
  152. X  "Cupido", "Hades", "Zeus", "Kronos",                   /* Uranians  */
  153. X  "Apollo", "Admetos", "Vulkanus", "Poseidon",
  154. X
  155. X  "Achernar", "Polaris", "Zeta Retic.", "Pleiades",      /* Stars     */
  156. X  "Aldebaran", "Capella", "Rigel", "Bellatrix", "Alnath",
  157. X  "Orion", "Betelgeuse", "Menkalinan", "Murzim", "Canopus",
  158. X  "Alhena", "Sirius", "Adara", "Wezen", "Castor",
  159. X  "Procyon", "Pollux", "Suhail", "Avior", "Miaplacidus",
  160. X  "Alphard", "Regulus", "Dubhe", "Acrux", "Gacrux",
  161. X  "Becrux", "Alioth", "Spica", "Alkaid", "Agena",
  162. X  "Arcturus", "Kentaurus", "Antares", "Shaula", "Sargas",
  163. X  "Australis", "Vega", "Altair", "Peacock", "Deneb",
  164. X  "Alnair", "Fomalhaut", "Andromeda"};
  165. X
  166. Xchar *systemname[] = {
  167. X  "Placidus", "Koch", "Equal", "Campanus", "Meridian",
  168. X  "Regiomontanus", "Porphyry", "Morinus", "Topocentric", "Null"};
  169. X
  170. Xchar *aspectname[] = {"",
  171. X  "Conjunct", "Opposite", "Square", "Trine", "Sextile",
  172. X  "Inconjunct", "Semisextile", "Semisquare", "Sesquiquadrate",
  173. X  "Quintile", "Biquintile",
  174. X  "Semiquintile", "Septile", "Novile",
  175. X  "Binovile", "Biseptile", "Triseptile", "Quatronovile"};
  176. X
  177. Xchar *aspectabbrev[] = {"   ",
  178. X  "Con", "Opp", "Squ", "Tri", "Sex",
  179. X  "Inc", "SSx", "SSq", "Ses", "Qui", "BQn",
  180. X  "SQn", "Sep", "Nov", "BNv", "BSp", "TSp", "QNv"};
  181. X
  182. Xchar *aspectglyph[] = {"",
  183. X  "Circle with extending line", "Two circles joined by line",
  184. X  "Quadrilateral", "Triangle", "Six pointed asterisk",
  185. X  "'K' rotated right", "'K' rotated left", "Acute angle",
  186. X  "Square with extending lines", "Letter 'Q'", "'+' over '-'",
  187. X  "'-' over '+'", "Number '7'", "Number '9'", "'9' under Roman 'II'",
  188. X  "'7' under Roman 'II'", "'7' under Roman 'III'", "'9' under Roman 'IV'"};
  189. X
  190. Xreal aspectangle[ASPECTS+1] = {0,
  191. X  0.0, 180.0, 90.0, 120.0, 60.0, 150.0, 30.0, 45.0, 135.0, 72.0, 144.0,
  192. X  36.0, DEGREES/7.0, 40.0, 80.0, 720.0/7.0, 1080.0/7.0, 160.0};
  193. X
  194. Xreal aspectorb[ASPECTS+1] = {0,
  195. X  7.0, 7.0, 7.0, 7.0, 6.0, 3.0, 3.0, 3.0, 3.0, 2.0, 2.0,
  196. X  1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
  197. X
  198. Xreal planetorb[OBJECTS+1] = {0,
  199. X  360.0, 360.0, 360.0, 360.0, 360.0, 360.0, 360.0, 360.0, 360.0, 360.0,
  200. X  360.0, 360.0, 360.0, 360.0, 360.0, 2.0, 2.0, 360.0, 360.0, 2.0};
  201. X
  202. Xreal planetadd[OBJECTS+1] = {0,
  203. X  1.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
  204. X  0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
  205. X
  206. Xint ruler1[OBJECTS+1]
  207. X  = {0, 5, 4,  3,  7,  1,  9, 10, 11, 12, 8,  12, 2, 6, 7, 8,11,12,10, 1, 7};
  208. Xint ruler2[OBJECTS+1]
  209. X  = {0, 0, 0,  6,  2,  8, 12, 11,  0,  0, 0,   0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  210. Xint  exalt[OBJECTS+1]
  211. X  = {0, 1, 2, 11, 12, 10,  4,  7,  8,  9, 6,   4, 4,10, 5,11, 6, 9, 7,10,12};
  212. X
  213. X  /* This little array is the reverse of the ruler arrays: */
  214. X  /* Here, given a sign, return what planet rules it.      */
  215. Xint rules[SIGNS+1] = {0, 5, 4, 3, 2, 1, 3, 4, 10, 6, 7, 8, 9};
  216. X
  217. Xint mainansi[] = {BLACK, WHITE, LTGRAY, DKGRAY, YELLOW, MAGENTA, DKBLUE};
  218. Xint rainbowansi[] = {WHITE,
  219. X  RED, ORANGE, YELLOW, GREEN, CYAN, BLUE, PURPLE};
  220. Xint elemansi[] = {RED, YELLOW, GREEN, BLUE};
  221. Xint aspectansi[] = {WHITE,
  222. X  YELLOW, BLUE, RED, GREEN, CYAN,
  223. X  MAGENTA, MAGENTA, ORANGE, ORANGE, DKCYAN, DKCYAN,
  224. X  DKCYAN, MAROON, PURPLE, PURPLE, MAROON, MAROON, PURPLE};
  225. X
  226. Xchar *element[] = {"Fire", "Earth", "Air", "Water"};
  227. Xchar *mode[] = {"Cardinal", "Fixed", "Mutuable"};
  228. X
  229. Xchar *post[] = {"",
  230. X  "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "th", "th"};
  231. X
  232. Xchar *monthname[] = {"",
  233. X  "January", "February", "March", "April", "May", "June",
  234. X  "July", "August", "September", "October", "November", "December"};
  235. X
  236. Xchar *dayname[] = {"Sunday", "Monday", "Tuesday", "Wednesday",
  237. X  "Thursday", "Friday", "Saturday"};
  238. X
  239. X/* Influence information used by ChartInfluence() follows. The influence of */
  240. X/* a planet in its ruling or exalting sign or house is tacked onto the last */
  241. X/* two positions of the object and house influence array, respectively.     */
  242. X
  243. X  /* The inherent strength of each planet - */
  244. Xreal objectinf[] = {0, 30, 25, 10, 10, 10, 10, 10, 10, 10, 10,
  245. X                      5, 5, 5, 5, 5, 5, 5, 15, 20, 5,
  246. X                      20, 10};
  247. X
  248. X  /* The inherent strength of each house - */
  249. Xreal houseinf[]  = {0, 20, 0, 0, 10, 0, 0, 5, 0, 0, 15, 0, 0,
  250. X                      15, 5};
  251. X
  252. X  /* The inherent strength in each aspect - */
  253. Xreal aspectinf[] = {0.0, 1.0, 0.8, 0.8, 0.6, 0.6, 0.4, 0.4, 0.2, 0.2,
  254. X                      0.2, 0.2, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1};
  255. X
  256. X
  257. X/*
  258. X*******************************************************************************
  259. X** Object calculation tables
  260. X*******************************************************************************
  261. X*/
  262. X
  263. Xbyte errorcount[PLANETS+1] = {0, 0, 0, 0, 0, 0, 11, 5, 4, 4, 4};
  264. X
  265. Xreal planetdata[] = {
  266. X358.4758,35999.0498,-.0002,.01675,-.4E-4,0,1,101.2208,1.7192,.00045,0,0,0,0,0,
  267. X0, /* Earth/Sun */
  268. X102.2794,149472.515,0,.205614,.2E-4,0,.3871,28.7538,.3703,.0001,47.1459,1.1852,
  269. X0.0002,7.009,.00186,0, /* Mercury */
  270. X212.6032,58517.8039,.0013,.00682,-.5E-4,0,.7233,54.3842,.5082,-.14E-2,75.7796,
  271. X0.8999,.4E-3,3.3936,.1E-2,0, /* Venus */
  272. X319.5294,19139.8585,.2E-3,.09331,.9E-4,0,1.5237,285.4318,1.0698,.1E-3,48.7864,
  273. X0.77099,0,1.8503,-.7E-3,0, /* Mars */
  274. X
  275. X225.4928,3033.6879,0,.04838,-.2E-4,0,5.2029,273.393,1.3383,0,99.4198,1.0583,0,
  276. X1.3097,-.52E-2,0, /* Jupiter */
  277. X-.001,-.0005,.0045,.0051,581.7,-9.7,-.0005,2510.7,-12.5,-.0026,1313.7,-61.4,
  278. X0.0013,2370.79,-24.6,-.0013,3599.3,37.7,-.001,2574.7,31.4,-.00096,6708.2,
  279. X-114.5,-.0006,5499.4,-74.97,-.0013,1419,54.2,.0006,6339.3,-109,.0007,4824.5,
  280. X-50.9,.0020,-.0134,.0127,-.0023,676.2,.9,.00045,2361.4,174.9,.0015,1427.5,
  281. X-188.8,.0006,2110.1,153.6,.0014,3606.8,-57.7,-.0017,2540.2,121.7,-.00099,
  282. X6704.8,-22.3,-.0006,5480.2,24.5,.00096,1651.3,-118.3,.0006,6310.8,-4.8,.0007,
  283. X4826.6,36.2, /* Jupiter error */
  284. X
  285. X174.2153,1223.50796,0,.05423,-.2E-3,0,9.5525,338.9117,-.3167,0,112.8261,.8259,
  286. X0,2.4908,-.0047,0, /* Saturn */
  287. X-.0009,.0037,0,.0134,1238.9,-16.4,-.00426,3040.9,-25.2,.0064,1835.3,36.1,
  288. X-.0153,610.8,-44.2,-.0015,2480.5,-69.4,-.0014,.0026,0,.0111,1242.2,78.3,-.0045,
  289. X3034.96,62.8,-.0066,1829.2,-51.5,-.0078,640.6,24.2,-.0016,2363.4,-141.4,.0006,
  290. X-.0002,0,-.0005,1251.1,43.7,.0005,622.8,13.7,.0003,1824.7,-71.1,.0001,2997.1,
  291. X78.2, /* Saturn error */
  292. X
  293. X74.1757,427.2742,0,.04682,.00042,0,19.2215,95.6863,2.0508,0,73.5222,.5242,0,
  294. X0.7726,.1E-3,0, /* Uranus */
  295. X-.0021,-.0159,0,.0299,422.3,-17.7,-.0049,3035.1,-31.3,-.0038,945.3,60.1,-.0023,
  296. X1227,-4.99,.0134,-.02186,0,.0317,404.3,81.9,-.00495,3037.9,57.3,.004,993.5,
  297. X-54.4,-.0018,1249.4,79.2,-.0003,.0005,0,.0005,352.5,-54.99,.0001,3027.5,54.2,
  298. X-.0001,1150.3,-88, /* Uranus error */
  299. X
  300. X30.13294,240.45516,0,.00913,-.00127,0,30.11375,284.1683,-21.6329,0,130.68415,
  301. X1.1005,0,1.7794,-.0098,0, /* Neptune */
  302. X0.1832,-.6718,.2726,-.1923,175.7,31.8,.0122,542.1,189.6,.0027,1219.4,178.1,
  303. X-.00496,3035.6,-31.3,-.1122,.166,-.0544,-.00496,3035.3,58.7,.0961,177.1,-68.8,
  304. X-.0073,630.9,51,-.0025,1236.6,78,.00196,-.0119,.0111,.0001,3049.3,44.2,-.0002,
  305. X893.9,48.5,.00007,1416.5,-25.2, /* Neptune error */
  306. X
  307. X229.781,145.1781,0,.24797,.002898,0,39.539,113.5366,.2086,0,108.944,1.3739,0,
  308. X17.1514,-.0161,0, /* Pluto */
  309. X-.0426,.073,-.029,.0371,372,-331.3,-.0049,3049.6,-39.2,-.0108,566.2,318.3,
  310. X0.0003,1746.5,-238.3,-.0603,.5002,-.6126,.049,273.97,89.97,-.0049,3030.6,61.3,
  311. X0.0027,1075.3,-28.1,-.0007,1402.3,20.3,.0145,-.0928,.1195,.0117,302.6,-77.3,
  312. X0.00198,528.1,48.6,-.0002,1000.4,-46.1, /* Pluto error */
  313. X
  314. X34.6127752,713.5756219,0,.382270369,-.004694073,0,13.66975144,337.407213,
  315. X2.163306646,0,208.1482658,1.247724355,0,6.911179715,.011236955,0, /* Chiron */
  316. X108.2925,7820.36556,0,.0794314,0,0,2.7672273,71.0794444,0,0,80.23555556,
  317. X1.3960111,0,10.59694444,0,0, /* Ceres */
  318. X106.6641667,7806.531667,0,.2347096,0,0,2.7704955,310.166111,0,0,172.497222,
  319. X1.39601111,0,34.81416667,0,0, /* Pallas Athena */
  320. X267.685,8256.081111,0,.2562318,0,0,2.6689897,245.3752778,0,0,170.137777,
  321. X1.396011111,.0003083333,13.01694444,0,0, /* Juno */
  322. X138.7733333,9924.931111,0,.0902807,0,0,2.360723,149.6386111,0,0,103.2197222,
  323. X1.396011111,.000308333,7.139444444,0,0, /* Vesta */
  324. X
  325. X104.5959,138.5369,0,0,0,0,40.99837, 0,0,0,0,0,0,0,0,0, /* Cupido */
  326. X337.4517,101.2176,0,0,0,0,50.667443,0,0,0,0,0,0,0,0,0, /* Hades */
  327. X104.0904,80.4057, 0,0,0,0,59.214362,0,0,0,0,0,0,0,0,0, /* Zeus */
  328. X17.7346, 70.3863, 0,0,0,0,64.816896,0,0,0,0,0,0,0,0,0, /* Kronos */
  329. X138.0354,62.5,    0,0,0,0,70.361652,0,0,0,0,0,0,0,0,0, /* Apollo */
  330. X-8.678,  58.3468, 0,0,0,0,73.736476,0,0,0,0,0,0,0,0,0, /* Admetos */
  331. X55.9826, 54.2986, 0,0,0,0,77.445895,0,0,0,0,0,0,0,0,0, /* Vulkanus */
  332. X165.3595,48.6486, 0,0,0,0,83.493733,0,0,0,0,0,0,0,0,0  /* Poseidon */
  333. X};
  334. X
  335. Xreal starbright[] = {0,
  336. X  0.46, 2.02, 5.24, 5.09, 0.85, 0.08, 0.12, 1.64, 1.65, 1.70,
  337. X  0.50, 1.90, 1.98,-0.72, 1.93,-1.46, 1.50, 1.84, 1.59, 0.38,
  338. X  1.14, 1.78, 1.86, 1.68, 1.98, 1.35, 1.79, 1.58, 1.63, 1.25,
  339. X  1.77, 0.98, 1.86, 0.61,-0.04,-0.01, 0.96, 1.63, 1.87, 1.85,
  340. X  0.03, 0.77, 1.94, 1.25, 1.74, 1.16, 4.61};
  341. X
  342. Xreal stardata[] = {
  343. X 1,37,42.9,-57,14,12,   2,31,50.5, 89,15,51,   3,17,46.1,-62,34,32,
  344. X 3,49,11.1, 24, 8,12,   4,35,55.2, 16,30,33,   5,16,41.3, 45,59,53,
  345. X 5,14,32.2, -8,12, 6,   5,25, 7.8,  6,20,59,   5,26,17.5, 28,36,27,
  346. X 5,36,12.7, -1,12, 7,   5,55,10.3,  7,24,25,   5,59,31.7, 44,56,51,
  347. X 6,22,41.9,-17,57,22,   6,23,57.2,-52,41,44,   6,37,42.7, 16,23,57,
  348. X 6,45, 8.9,-16,42,58,   6,58,37.5,-28,58,20,   7, 8,23.4,-26,23,35,
  349. X 7,34,35.9, 31,53,18,   7,39,18.1,  5,13,30,   7,45,18.9, 28, 1,34,
  350. X 8, 9,31.9,-47,20,12,   8,22,30.8,-59,30,34,   9,13,12.1,-69,43, 2,
  351. X 9,27,35.2, -8,39,31,  10, 8,22.3, 11,58, 2,  11, 3,43.6, 61,45, 3,
  352. X12,26,35.9,-63, 5,56,  12,31, 9.9,-57, 6,47,  12,47,43.3,-59,41,19,
  353. X12,54, 1.7, 55,57,35,  13,25,11.5,-11, 9,41,  13,47,32.3, 49,18,48,
  354. X14, 3,49.4,-60,22,22,  14,15,39.6, 19,10,57,  14,39,36.2,-60,50, 7,
  355. X16,29,24.4,-26,25,55,  17,33,36.4,-37, 6,13,  17,37,19.0,-42,59,52,
  356. X18,24,10.3,-34,23, 5,  18,36,56.2, 38,47, 1,  19,50,46.9,  8,52, 6,
  357. X20,25,38.8,-56,44, 7,  20,41,25.8, 45,16,49,  22, 8,13.9,-46,57,40,
  358. X22,57,39.0,-29,37,20,   0,42, 7.0, 41,16, 0};
  359. X
  360. X
  361. X/*
  362. X*******************************************************************************
  363. X** Core interpretation tables
  364. X*******************************************************************************
  365. X*/
  366. X
  367. Xchar *mindpart[] = {"",
  368. X  "spirit, ego, image of self, and sense of aliveness",
  369. X  "emotional nature, moods, feelings, and caring tendencies",
  370. X  "thoughts, intellect, and communicative activity",
  371. X  "creativity, tendencies for affection and calmness, and relationship needs",
  372. X  "will, energy, activity, and aggressive, assertive tendencies",
  373. X  "enthusiastic, faithful, wise, expansive, spontaneous nature",
  374. X  "part of mind that is disciplined, respectful, and solitary",
  375. X  "individuality, desires for change, and tendency to go against social norms",
  376. X  "intuitive, spiritual, compassionate, psychic nature",
  377. X  "destiny, and capacity to transform the self and the outer world",
  378. X  "ability to help, heal, and teach others, and where one has much experience",
  379. X  "tendency to direct energy to instinctive, creative, reproductive goals",
  380. X  "tendency to direct energy away from emotional and into mental pursuits",
  381. X  "tendency to give away individual power for the benefit of a relationship",
  382. X  "capacity to direct creative energy into personal or devotional goals",
  383. X  "karmic goals, and best direction of evolutionary growth",
  384. X  "place where opportunity and success can be found",
  385. X  "view as seen in the eyes of others, reputation, and social standing",
  386. X  "personality and outward appearance, as projected to the world",
  387. X  "karmic fate and method of reception of energies"};
  388. X
  389. Xchar *description[] = {"",
  390. X  "forceful, energetic, direct, courageous",
  391. X  "practical, often skeptical and stubborn",
  392. X  "inquisitive, witty, perceptive, adaptable",
  393. X  "introspective, emotional, protective",
  394. X  "proud, gregarious, dramatic, dignified",
  395. X  "analytical, critical, modest, helpful",
  396. X  "affectionate, tolerant, often indecisive, appreciates beauty",
  397. X  "penetrating, suspicious, introspective",
  398. X  "jovial, open minded, loves freedom",
  399. X  "industrious, practical, disciplined",
  400. X  "progressive, erratic, revolutionary, idealistic, humanitarian, inventive",
  401. X  "imaginative, other worldly, impressionable"};
  402. X
  403. Xchar *desire[] = {"",
  404. X  "seeks adventure and challenge",
  405. X  "loves serenity and inner peace",
  406. X  "seeks out information",
  407. X  "wants inner and outer security",
  408. X  "desires self expression",
  409. X  "works toward perfection",
  410. X  "seeks balance, relationship, and calmness",
  411. X  "desires to transform and remove outer masks",
  412. X  "seeks meaning and new experience",
  413. X  "works for solitude and personal integrity",
  414. X  "desires individuality",
  415. X  "seeks transcendence of self"};
  416. X
  417. Xchar *lifearea[] = {"",
  418. X  "establishment of personal identity",
  419. X  "self image, self worth, and material security",
  420. X  "communicating to and receiving from the environment",
  421. X  "imagination, fantasies, inner feelings, and domestic life",
  422. X  "finding joy, pleasure, and creative expression",
  423. X  "work and feeling talented and useful",
  424. X  "personal relationships and intimacy",
  425. X  "sex, death, the occult, and other hard to grasp topics",
  426. X  "changes, exploration, and the breaking of routine",
  427. X  "career, social stature, and destiny",
  428. X  "the future, life goals, and association with friends and groups",
  429. X  "things that disrupt or cause disassociation with the personality"};
  430. X
  431. Xchar *interact[] = {"",
  432. X  "is %sconnected and fused together with",
  433. X  "%sopposes and creates tension with",
  434. X  "is %sin conflict with",
  435. X  "is %sin harmony with",
  436. X  "has %sopportunity for growth, exchange, and harmony in relation with",
  437. X  "is %sdifferent from",
  438. X  "%sgets new perspectives in relation with",
  439. X  "%screates internal friction with",
  440. X  "%screates internal agitation with",
  441. X  "%screatively relates externally with",
  442. X  "%screatively relates internally with"};
  443. X
  444. Xchar *therefore[] = {"",
  445. X  "Both parts are prominent in their psyche", "Balance is needed",
  446. X  "Adaptation is required by both sides", "", "",
  447. X  "They can often relate in a discordant way", "", "", "", "", ""};
  448. X
  449. X/* Modifier array makes the interpretation stronger for narrower orbs. */
  450. X
  451. Xchar *modifier[3][11] = {{"always ", "always ", "irreconcilably ",
  452. X  "always ", "much ", "completely ", "often ", "often ", "often ", "often ",
  453. X  "often "}, {"", "", "", "", "", "", "", "", "", "", ""}, {"somewhat ",
  454. X  "somewhat ", "somewhat ", "somewhat ", "some ", "somewhat ", "sometimes ",
  455. X  "sometimes ", "sometimes ", "sometimes ", "sometimes "}};
  456. X
  457. X/* data.c */
  458. END_OF_FILE
  459. if test 19299 -ne `wc -c <'data.c'`; then
  460.     echo shar: \"'data.c'\" unpacked with wrong size!
  461. fi
  462. # end of 'data.c'
  463. fi
  464. if test -f 'driver.c' -a "${1}" != "-c" ; then 
  465.   echo shar: Will not clobber existing file \"'driver.c'\"
  466. else
  467. echo shar: Extracting \"'driver.c'\" \(35459 characters\)
  468. sed "s/^X//" >'driver.c' <<'END_OF_FILE'
  469. X/*
  470. X** Astrolog (Version 3.05) File: driver.c
  471. X**
  472. X** IMPORTANT: The planetary calculation routines used in this program
  473. X** have been Copyrighted and the core of this program is basically a
  474. X** conversion to C of the routines created by James Neely as listed in
  475. X** Michael Erlewine's 'Manual of Computer Programming for Astrologers',
  476. X** available from Matrix Software. The copyright gives us permission to
  477. X** use the routines for our own purposes but not to sell them or profit
  478. X** from them in any way.
  479. X**
  480. X** IN ADDITION: the graphics database and chart display routines used in
  481. X** this program are Copyright (C) 1991-1993 by Walter D. Pullen. Permission
  482. X** is granted to freely use and distribute these routines provided one
  483. X** doesn't sell, restrict, or profit from them in any way. Modification
  484. X** is allowed provided these notices remain with any altered or edited
  485. X** versions of the program.
  486. X*/
  487. X
  488. X#include "astrolog.h"
  489. X
  490. Xchar *filenameout, **extralines;
  491. Xint prog = FALSE, extracount = 0;
  492. X
  493. X
  494. X/*
  495. X*******************************************************************************
  496. X** Option processing
  497. X*******************************************************************************
  498. X*/
  499. X
  500. X/* Print out a command switch or keypress info line to the screen, as done  */
  501. X/* with the -H switch or 'H' key in a graphic window. This is just printing */
  502. X/* out the string, except in Ansi mode we set the proper colors: Red for    */
  503. X/* header lines, Green for individual switches or keys, and White for the   */
  504. X/* rest of the line telling what it does. We also prefix each switch with   */
  505. X/* either Unix's '-' or PC's '/', whichever is appropriate for the system.  */
  506. X
  507. Xvoid Prints(string)
  508. Xchar *string;
  509. X{
  510. X  int dash;
  511. X  char c;
  512. X
  513. X  dash = string[1];
  514. X  AnsiColor(*string != ' ' ? RED : (dash == '_' || dash == 'P' ? GREEN : -1));
  515. X  while ((c = *string) && c != ':' &&
  516. X    (dash != 'P' || (c != ' ' || *(string+1) != 't'))) {
  517. X    if (c != '_')
  518. X      putchar(c);
  519. X    else
  520. X      putchar(DASH);
  521. X    string++;
  522. X    }
  523. X  if (*string)
  524. X    putchar(*string++);
  525. X  AnsiColor(-1);
  526. X  while (c = *string)
  527. X    {
  528. X    if (c != '_')
  529. X      putchar(c);
  530. X    else
  531. X      putchar(DASH);
  532. X    string++;
  533. X    }
  534. X  putchar('\n');
  535. X}
  536. X
  537. X
  538. X/* Print a list of every command switch that can be passed to the program, */
  539. X/* and a description of what it does. This is what the -H switch prints.   */
  540. X
  541. Xvoid DisplaySwitches()
  542. X{
  543. X  sprintf(string, "%s command switches (version %s) (%s):", appname, VERSION,
  544. X    DATE);
  545. X  Prints(string);
  546. X  Prints(" _H: Display this help list.");
  547. X  Prints(" _H0: Display names of zodiac signs and houses.");
  548. X  Prints(" _O: Display available planets and other celestial objects.");
  549. X  Prints(" _O0: Like _O but ignore object restrictions.");
  550. X  Prints(" _A: Display available aspects, their angles, and present orbs.");
  551. X  Prints(" _I0: Display meanings of signs, houses, planets, and aspects.\n");
  552. X  Prints("Switches which determine the type of chart to display:");
  553. X  Prints(" _v: Display list of object positions (chosen by default).");
  554. X  Prints(" _v0: Like _v but express velocities as absolute degree speed.");
  555. X  Prints(" _w [<rows>]: Display chart in a graphic house wheel format.");
  556. X  Prints(" _w0 [..]: Like _w but reverse order of objects in houses 4..9.");
  557. X  Prints(" _g: Display aspect and midpoint grid among planets.");
  558. X  Prints(" _g0: Like _g but flag aspect configurations (e.g. Yod's) too.");
  559. X  Prints(" _g0: For comparison charts, show midpoints instead of aspects.");
  560. X  Prints(" _ga: Like _g but indicate applying instead of difference orbs.");
  561. X  Prints(" _m: Display all object midpoints in sorted zodiac order.");
  562. X  Prints(" _m0: Like _m but list aspects ordered by influence instead.");
  563. X  Prints(" _Z: Display planet locations with respect to the local horizon.");
  564. X#ifdef GRAPH
  565. X  Prints(" _Z0: For graphics charts, like _Z but have a polar center.");
  566. X#endif
  567. X  Prints(" _S: Display x,y,z coordinate positions of planets in space.");
  568. X  Prints(" _j: Display astrological influences of each object in chart.");
  569. X  Prints(" _j0: Like _j but include influences of each sign as well.");
  570. X  Prints(" _L [<step>]: Display astro-graph locations of planetary angles.");
  571. X  Prints(" _L0 [..]: Like _L but display list of latitude crossings too.");
  572. X  Prints(" _d: Print all aspects and changes occurring in a day.");
  573. X  Prints(" _dm: Like _d but print all aspects for the entire month.");
  574. X  Prints(" _dp <month> <year>: Print aspects within progressed chart.");
  575. X  Prints(" _E: Display planetary ephemeris for given month.");
  576. X  Prints(" _Ey: Display planetary ephemeris for entire year.");
  577. X  Prints(" _e: Print all options for chart (i.e. _v_w_g0_m_Z_S_j0_L0_d_E).");
  578. X  Prints(
  579. X    " _T <month> <year>: Compute all transits to natal planets in month.");
  580. X  Prints(
  581. X    " _Tp <month> <year>: Compute progressions in month for chart.");
  582. X  Prints(" _T[p]y: <year>: Compute transits/progressions for entire year.");
  583. X#ifdef TIME
  584. X  Prints(" _Tn[y]: Compute transits to natal planets for current time now.");
  585. X#endif
  586. X  Prints(" _I: Print interpretation of selected charts.\n");
  587. X  Prints("Switches which affect how the chart parameters are obtained:");
  588. X#ifdef TIME
  589. X  Prints(" _n: Compute chart for this exact moment using current time.");
  590. X  Prints(" _n[d,m,y]: Compute chart for start of current day, month, year.");
  591. X#endif
  592. X  Prints(" _a <month> <date> <year> <time> <zone> <long> <lat>:");
  593. X  Prints("     Compute chart automatically given specified data.");
  594. X  Prints(" _z: Assume Daylight time (change default zone appropriately).");
  595. X  Prints(" _z <zone>: Change the default time zone (for _d_q_T_E options).");
  596. X  Prints(" _l <long> <lat>: Change the default longitude & latitude.");
  597. X  Prints(" _q <month> <date> <year> <time>: Compute chart with defaults.");
  598. X  Prints(" _qd <month> <date> <year>: Compute chart for noon on date.");
  599. X  Prints(" _qm <month> <year>: Compute chart for first of month.");
  600. X  Prints(" _qy <year>: Compute chart for first day of year.");
  601. X  Prints(" _i <file>: Compute chart based on info in file.");
  602. X  Prints(" _o <file> [..]: Write parameters of current chart to file.");
  603. X  Prints(" _o0 <file> [..]: Like _o but output planet/house positions.\n");
  604. X  Prints("Switches which affect what information is used in a chart:");
  605. X  Prints(" _R [<obj1> [<obj2> ..]]: Restrict specific bodies from displays.");
  606. X  Prints(" _R0 [<obj1> ..]: Like _R but restrict everything first.");
  607. X  Prints(" _R[C,u,U]: Restrict all minor cusps, all uranians, or stars.");
  608. X  Prints(" _RT[0,C,u,U] [..]: Restrict transiting planets in _T lists.");
  609. X  Prints(" _C: Include non-angular house cusps in charts.");
  610. X  Prints(" _u: Include transneptunian/uranian bodies in charts.");
  611. X  Prints(" _U: Include locations of fixed background stars in charts.");
  612. X  Prints(" _U[z,l,n,b]: Order by azimuth, altitude, name, or brightness.");
  613. X  Prints(" _A <0-18>: Specify the number of aspects to use in charts.");
  614. X  Prints(" _Ao <aspect> <orb>: Specify maximum orb for an aspect.");
  615. X  Prints(" _Am <planet> <orb>: Specify maximum orb allowed to a planet.");
  616. X  Prints(" _Ad <planet> <orb>: Specify orb addition given to a planet.\n");
  617. X  Prints("Switches which affect how a chart is computed:");
  618. X  Prints(" _c <value>: Select a different default system of houses.");
  619. X  Prints("     (0 = Placidus, 1 = Koch, 2 = Equal, 3 = Campanus,");
  620. X  Prints("     4 = Meridian, 5 = Regiomontanus, 6 = Porphry, 7 = Morinus,");
  621. X  Prints("     8 = Topocentric, 9 = None.)");
  622. X  Prints(" _s: Compute a sidereal instead of the normal tropical chart.");
  623. X  Prints(" _s0: Display locations as right ascension instead of degrees.");
  624. X  Prints(" _h [<objnum>]: Compute positions centered on specified object.");
  625. X  Prints(" _p <month> <day> <year>: Cast 2ndary progressed chart for date.");
  626. X  Prints(" _p0 <month> <day> <year>: Cast solar arc chart for date.");
  627. X#ifdef TIME
  628. X  Prints(" _p[0]n: Cast progressed chart based on current date now.");
  629. X#endif
  630. X  Prints(" _pd <days>: Set no. of days to progress / day (default 365.25).");
  631. X  Prints(" _x <1-360>: Cast harmonic chart based on specified factor.");
  632. X  Prints(" _1 [<objnum>]: Cast chart with specified object on Ascendant.");
  633. X  Prints(" _2 [<objnum>]: Cast chart with specified object on Midheaven.");
  634. X  Prints(" _3: Display objects in their zodiac decan positions.");
  635. X  Prints(" _f: Display houses as sign positions (flip them).");
  636. X  Prints(" _G: Display houses based on geographic location only.");
  637. X  Prints(" _F <objnum> <sign> <deg>: Force object's position to be value.");
  638. X  Prints(" _+ [<days>]: Cast chart for specified no. of days in the future.");
  639. X  Prints(" _- [<days>]: Cast chart for specified no. of days in the past.\n");
  640. X  Prints("Switches for relationship and comparison charts:");
  641. X  Prints(" _r <file1> <file2>: Compute a relationship synastry chart.");
  642. X  Prints(" _rc <file1> <file2>: Compute a composite chart.");
  643. X  Prints(" _rm <file1> <file2>: Compute a time space midpoint chart.");
  644. X  Prints(" _rd <file1> <file2>: Print number of days between files' dates.");
  645. X  Prints(" _rb <file1> <file2>: Display biorhythm for file1 at time file2.");
  646. X  Prints(" _r0 <file1> <file2>: Keep the charts separate in comparison.");
  647. X#ifdef TIME
  648. X  Prints(" _t <file>: Display current house transits for particular chart.");
  649. X  Prints(" _t[b,d] <file>: Print biorhythm/datediff for current time now.");
  650. X#endif
  651. X  Prints("\nSwitches to access graphics options:");
  652. X  Prints(" _k: Display text charts using Ansi characters and color.");
  653. X
  654. X  /* If graphics features are compiled in, call an additional procedure to */
  655. X  /* display the command switches offered dealing with the graphics stuff. */
  656. X
  657. X#ifdef GRAPH
  658. X  XDisplaySwitches();
  659. X#endif
  660. X}
  661. X
  662. X
  663. X/* Print out a list of the various objects - planets, asteroids, house     */
  664. X/* cusps, stars - recognized by the program, and their index values. This  */
  665. X/* is displayed when the -O switch is invoked. For some objects, display   */
  666. X/* additional information, e.g. ruling signs for planets, brightnesses and */
  667. X/* positions in the sky for fixed stars, etc.                              */
  668. X
  669. Xvoid PrintObjects(all)
  670. Xint all;
  671. X{
  672. X  int i, j;
  673. X  real Off;
  674. X
  675. X  if (!(operation & DASHC))
  676. X    for (i = C_LO; i <= C_HI; i++)    /* Set up restrictions properly: Minor */
  677. X      ignore[i] = TRUE;               /* cusps and uranians included only if */
  678. X  if (!(operation & DASHu))           /* -C and -u switches are in effect.   */
  679. X    for (i = U_LO; i <= U_HI; i++)
  680. X      ignore[i] = TRUE;
  681. X  printf("%s planets and objects:\n", appname);
  682. X  printf("No. Name       Rule Co-Rule Fall Co-Fall Exalt Debilitate\n\n");
  683. X  for (i = 1; i <= BASE; i++) if (all || !ignore[i]) {
  684. X    AnsiColor(objectansi[i]);
  685. X    printf("%2d %-12s", i, objectname[i]);
  686. X    if (i <= OBJECTS) {                      /* Print rulerships, etc */
  687. X      if (ruler1[i]) {                       /* for the planets.      */
  688. X        j = ruler2[i];
  689. X        printf("%c%c%c  %c%c%c     ", SIGNAM(ruler1[i]),
  690. X          j ? signname[j][0] : ' ', j ? signname[j][1] : ' ',
  691. X          j ? signname[j][2] : ' ');
  692. X        printf("%c%c%c  %c%c%c     ", SIGNAM(Mod12(ruler1[i]+6)),
  693. X          j ? signname[Mod12(j+6)][0] : ' ',
  694. X          j ? signname[Mod12(j+6)][1] : ' ',
  695. X          j ? signname[Mod12(j+6)][2] : ' ');
  696. X        printf("%c%c%c   %c%c%c", SIGNAM(exalt[i]),
  697. X          SIGNAM(Mod12(exalt[i]+6)));
  698. X      }
  699. X    } else if (i <= C_HI)
  700. X      printf("Minor House Cusp #%d", i-OBJECTS);
  701. X    else
  702. X      printf("Uranian #%d", i-U_LO+1);
  703. X    putchar('\n');
  704. X  }
  705. X
  706. X  /* Now, if -U in effect, read in and display stars in specified order. */
  707. X
  708. X  if (all || universe) {
  709. X    Off = ProcessInput(TRUE);
  710. X    CastStar(operation & DASHs ? 0.0 : -Off);
  711. X    for (i = S_LO; i <= S_HI; i++) if (all | !ignore[i]) {
  712. X      j = BASE+starname[i-BASE];
  713. X      AnsiColor(objectansi[j]);
  714. X      printf("%2d %-12s", i, objectname[j]);
  715. X      printf("Star #%2d    ", i-BASE);
  716. X      PrintMinute(planet[j]);
  717. X      printf("  ");
  718. X      PrintAltitude(planetalt[j]);
  719. X      printf(" %5.2f\n", starbright[j-BASE]);
  720. X    }
  721. X  }
  722. X}
  723. X
  724. X
  725. X/* Print out a list of all the aspects recognized by the program, and info  */
  726. X/* about them: their names, index numbers, degree angles, present orbs, and */
  727. X/* the description of their glyph. This gets displayed when the -A switch   */
  728. X/* is invoked (without any argument).                                       */
  729. X
  730. Xvoid PrintAspects()
  731. X{
  732. X  int i;
  733. X
  734. X  printf("%s aspects:\nNo. Name         Abbrev. Angle    Orb", appname);
  735. X  printf("          Description of glyph\n\n");
  736. X  for (i = 1; i <= ASPECTS; i++) {
  737. X    AnsiColor(aspectansi[i]);
  738. X    printf("%2d %-15s(%s) %6.2f +/- %1.0f degrees - %s\n", i, aspectname[i],
  739. X      aspectabbrev[i], aspectangle[i], aspectorb[i], aspectglyph[i]);
  740. X  }
  741. X}
  742. X
  743. X
  744. X/* Print out a list of the 12 signs and houses of the zodiac, and their    */
  745. X/* standard and traditional names, as done when the -H0 switch is invoked. */
  746. X
  747. Xvoid PrintSigns()
  748. X{
  749. X  int i;
  750. X
  751. X  printf("%s signs and houses:\n", appname);
  752. X  printf("Sign        English name      House Traditional name\n\n");
  753. X  for (i = 1; i <= SIGNS; i++) {
  754. X    AnsiColor(elemansi[i-1 & 3]);
  755. X    printf("%-12sthe %-14s%2d%s  House of %s\n", signname[i], signenglish[i],
  756. X      i, post[i], housetradition[i]);
  757. X  }
  758. X}
  759. X
  760. X
  761. X/* Read in a set of default program values used in the program, such as */
  762. X/* present location, time zone, the system of houses to use, the number */
  763. X/* of aspects and what orbs to use, and so on. These values are always  */
  764. X/* read in at the beginning of program execution.                       */
  765. X
  766. X/* The NEXTDEFAULT macro means to skip all comments in the file until we   */
  767. X/* reach the beginning of the next set of data, delimited with a '=' sign. */
  768. X
  769. X#define NEXTDEFAULT while(getc(data) != '=');
  770. X
  771. Xint InputDefaults()
  772. X{
  773. X  FILE *data;
  774. X  char name[STRING];
  775. X  int i, j;
  776. X
  777. X  filename = DEFAULT_INFOFILE;     /* First lets open the info file.      */
  778. X  data = fopen(filename, "r");     /* Look for file in current directory. */
  779. X  if (data == NULL) {
  780. X    sprintf(name, "%s%s", DEFAULT_DIR, filename);   /* Look for file in   */
  781. X    data = fopen(name, "r");                        /* default directory. */
  782. X    if (data == NULL)          /* If file not found anywhere, then forget */
  783. X      return FALSE;            /* it and use the compile time defaults.   */
  784. X  }
  785. X  fscanf(data, "%s", name); fscanf(data, "%s", name);
  786. X  if (name[0] != '3' || name [1] != '.' || name[2] != '0' ||
  787. X    (name[3] != '0' && name[3] != '5')) {
  788. X    fprintf(stderr, "%s: Bad information in default parameter file '%s'.\n",
  789. X      appname, filename);
  790. X    fprintf(stderr,
  791. X      "Delete this file or obtain one compatible with current version.\n");
  792. X    Terminate(1);
  793. X  }
  794. X  NEXTDEFAULT; fscanf(data, "%lf", &defzone);        /* Time zone    */
  795. X  NEXTDEFAULT; fscanf(data, "%lf", &deflong);        /* Longitude    */
  796. X  NEXTDEFAULT; fscanf(data, "%lf", &deflat);         /* Latitude     */
  797. X  NEXTDEFAULT; fscanf(data, "%d",  &aspects);        /* # of aspects   */
  798. X  NEXTDEFAULT; fscanf(data, "%d",  &housesystem);    /* House type     */
  799. X  NEXTDEFAULT; fscanf(data, "%d",  &ansi);           /* Ansi text?     */
  800. X  NEXTDEFAULT; fscanf(data, "%d",  &divisions);      /* For -d and -T. */
  801. X  NEXTDEFAULT; fscanf(data, "%d",  &wheelrows);      /* For -w charts. */
  802. X  NEXTDEFAULT; fscanf(data, "%d",  &smartcusp);      /* Logical -T display?  */
  803. X  NEXTDEFAULT; fscanf(data, "%d",  &column80);       /* Clip text at col 80? */
  804. X  NEXTDEFAULT;
  805. X  for (i = 1; i <= OBJECTS; i++) {         /* Object restrictions         */
  806. X    fscanf(data, "%d", &j);
  807. X    ignore[i] = j > 0;
  808. X  }
  809. X  NEXTDEFAULT;
  810. X  for (i = 1; i <= OBJECTS; i++) {         /* Transit object restrictions */
  811. X    fscanf(data, "%d", &j);
  812. X    ignore2[i] = j > 0;
  813. X  }
  814. X  NEXTDEFAULT;
  815. X  for (i = 1; i <= ASPECTS; i++)           /* Orbs for aspects  */
  816. X    fscanf(data, "%lf", &aspectorb[i]);
  817. X  NEXTDEFAULT;
  818. X  for (i = 1; i <= OBJECTS; i++)           /* Orbs for planets  */
  819. X    fscanf(data, "%lf", &planetorb[i]);
  820. X  NEXTDEFAULT;
  821. X  for (i = 1; i <= OBJECTS; i++)           /* Extra planet orbs */
  822. X    fscanf(data, "%lf", &planetadd[i]);
  823. X  NEXTDEFAULT; fscanf(data, "%lf", &objectinf[OBJECTS+1]);   /* Rules sign  */
  824. X  NEXTDEFAULT; fscanf(data, "%lf", &objectinf[OBJECTS+2]);   /* Exalts in   */
  825. X  NEXTDEFAULT; fscanf(data, "%lf",  &houseinf[SIGNS+1]);     /* Rules house */
  826. X  NEXTDEFAULT; fscanf(data, "%lf",  &houseinf[SIGNS+2]);     /* Exalts in   */
  827. X  NEXTDEFAULT;
  828. X  for (i = 1; i <= OBJECTS; i++)
  829. X    fscanf(data, "%lf", &objectinf[i]);    /* Influence of each object */
  830. X  for (i = 1; i <= SIGNS; i++)
  831. X    fscanf(data, "%lf", &houseinf[i]);     /* Influence of each house  */
  832. X  for (i = 1; i <= ASPECTS; i++)
  833. X    fscanf(data, "%lf", &aspectinf[i]);    /* Influence of each aspect */
  834. X  fclose(data);
  835. X  return TRUE;
  836. X}
  837. X
  838. X
  839. X/* Take the current chart information, and write it out to the file   */
  840. X/* as indicated by the -o switch. This is only executed at the end of */
  841. X/* program execution if the -o switch is in effect.                   */
  842. X
  843. Xvoid OutputData()
  844. X{
  845. X  FILE *data;
  846. X  int i, j;
  847. X  real k;
  848. X
  849. X  data = fopen(filenameout, "w");    /* Create and open the file for output. */
  850. X  if (data == NULL) {
  851. X    fprintf(stderr, "%s: File %s can not be created.\n", appname, filenameout);
  852. X    Terminate(1);
  853. X  }
  854. X  if (!(operation & DASHo0)) {
  855. X
  856. X    /* Write the chart information to the file. */
  857. X
  858. X    if (Mon < 1) {
  859. X      fprintf(stderr, "\n%s: Can't output chart with no time/space to file.\n",
  860. X        appname);
  861. X      fclose(data);
  862. X      Terminate(1);
  863. X    }
  864. X    fprintf(data, "%.0f\n%.0f\n%.0f\n%.2f\n%.2f\n%.2f\n%.2f\n",
  865. X      Mon, Day, Yea, Tim, Zon, Lon, Lat);
  866. X  } else {
  867. X
  868. X    /* However, if the -o0 switch is in effect, then write the actual */
  869. X    /* positions of the planets and houses to the file instead.       */
  870. X
  871. X    for (i = 1; i <= OBJECTS; i++) {
  872. X      j = (int) planet[i];
  873. X      fprintf(data, "%c%c%c: %2d %2d %10.7f\n", OBJNAM(i),
  874. X        j%30, j/30+1, FRACT(planet[i])*60.0);                /* Position */
  875. X      k = planetalt[i];
  876. X      fprintf(data, "[%c]: %3d %12.8f\n",                    /* Altitude */
  877. X        ret[i] >= 0.0 ? 'D' : 'R', (int)(Sgn(k)*
  878. X        floor(dabs(k))), (k-(real)(int)k)*60.0);        /* Retrograde? */
  879. X    }
  880. X    for (i = 1; i <= SIGNS/2; i++) {   /* Write first six cusp positions */ 
  881. X      j = (int) house[i];
  882. X      fprintf(data, "H_%c: %2d %2d %10.7f\n",
  883. X        'a'+i-1, j%30, j/30+1, FRACT(house[i])*60.0);
  884. X    }
  885. X  }
  886. X
  887. X  /* Now write any extra strings that were on the command line after the -o */
  888. X  /* specification but before the next switch, to the file as comments.     */
  889. X
  890. X  for (i = 1; i < extracount; i++) {
  891. X    extralines++;
  892. X    fprintf(data, "%s\n", extralines[1]);
  893. X  }
  894. X  fclose(data);
  895. X}
  896. X
  897. X
  898. X/* Initialize an Ansi color array with the color to print each object in. */
  899. X
  900. Xvoid InitColors()
  901. X{
  902. X  int i;
  903. X
  904. X  objectansi[0] = elemansi[1];
  905. X  for (i = 1; i <= 10; i++)
  906. X    objectansi[i] = elemansi[(ruler1[i]-1)%4];
  907. X  for (i = 11; i <= 15; i++)
  908. X    objectansi[i] = MAGENTA;
  909. X  for (i = 16; i <= 20; i++)
  910. X    objectansi[i] = DKCYAN;
  911. X  objectansi[18] = elemansi[1]; objectansi[19] = elemansi[0];
  912. X  objectansi[21] = elemansi[2]; objectansi[22] = elemansi[3];
  913. X  objectansi[23] = elemansi[1]; objectansi[24] = elemansi[2];
  914. X  for (i = U_LO; i <= U_HI; i++)
  915. X    objectansi[i] = PURPLE;
  916. X  for (i = S_LO; i <= S_HI; i++)
  917. X    objectansi[i] = starbright[i-BASE] < 1.0 ? ORANGE : MAROON;
  918. X}
  919. X
  920. X
  921. X/* This is the dispatch procedure for the entire program. After all the   */
  922. X/* command switches have been processed, this routine is called to        */
  923. X/* actually call the various routines to generate and display the charts. */
  924. X
  925. Xvoid Action()
  926. X{
  927. X  int i;
  928. X
  929. X  AnsiColor(-1);
  930. X
  931. X  /* First let's adjust the restriction status of the minor cusps, uranians, */
  932. X  /* and fixed stars based on whether -C, -u, and -U switches are in effect. */
  933. X
  934. X  if (!(operation & DASHC))
  935. X    for (i = C_LO; i <= C_HI; i++)
  936. X      ignore[i] = TRUE;
  937. X  if (!(operation & DASHu))
  938. X    for (i = U_LO; i <= U_HI; i++)
  939. X      ignore[i] = TRUE;
  940. X  if (!universe)
  941. X    for (i = S_LO; i <= S_HI; i++)
  942. X      ignore[i] = TRUE;
  943. X
  944. X  if (Delta != 0.0) {                   /* If -+ or -- switches in effect   */
  945. X    JD = MdyToJulian(M, D+Delta, Y);    /* then add the specified delta     */
  946. X    JulianToMdy(JD, &M, &D, &Y);        /* value to date before proceeding. */
  947. X  }
  948. X
  949. X    /* Here we either do a normal chart or some kind of relationship chart. */
  950. X
  951. X  if (!relation) {
  952. X    if (!autom)            /* If chart information not in memory yet, */
  953. X      InputData("tty");    /* then prompt the user for the time, etc. */
  954. X    Mon = M; Day = D; Yea = Y; Tim = F; Zon = X; Lon = L5; Lat = LA;
  955. X    CastChart(TRUE);
  956. X  } else
  957. X    CastRelation();
  958. X#ifdef GRAPH
  959. X  if (operation & DASHX)    /* If any of the X window switches in effect, */
  960. X    XAction();              /* then go make a graphics chart...           */
  961. X  else
  962. X#endif
  963. X    PrintChart(prog);       /* Otherwise print chart on text screen.      */
  964. X
  965. X  if (operation & DASHo)    /* If -o switch in effect, then write */
  966. X    OutputData();           /* the chart information to a file.   */
  967. X}
  968. X
  969. X
  970. X/* This routine is called by the main program to actually prompt the user */
  971. X/* for the command switches and parameters, to be entered one by one in   */
  972. X/* the same format as they would be on a Unix command line. This is only  */
  973. X/* executed for those non-Unix systems which don't allow passing of the   */
  974. X/* command line to the program. The result of this routine is passed back */
  975. X/* to the main program which then processes it just like in a Unix        */
  976. X/* system. (Not very graceful, but it works and gets the job done.)       */
  977. X
  978. X#ifndef SWITCHES
  979. X#define MAXSWITCHES 30
  980. Xint InputSwitches(argv)
  981. Xchar argv[MAXSWITCHES][12];
  982. X{
  983. X  int argc = 0;
  984. X
  985. X  AnsiColor(WHITE);
  986. X  printf("** %s version %s (%s) **\n", appname, VERSION, ADDRESS);
  987. X  AnsiColor(-1);
  988. X  printf("Enter all switch parameters below. (Enter %cH for help.)\n", DASH);
  989. X  printf("Press return after each switch or number parameter input.\n");
  990. X  printf("Input a '.' on a line by itself when done.\n\n");
  991. X  do {
  992. X    argc++;
  993. X    printf("Input parameter string #%2d: ", argc);
  994. X    if (gets(argv[argc]) == (char *) NULL) {
  995. X      printf("\n%s terminated.\n", appname);
  996. X      Terminate(2);
  997. X    }
  998. X  } while (argc < MAXSWITCHES && (argv[argc][0] != '.' ||
  999. X      argv[argc][1] != 0));
  1000. X  putchar('\n');
  1001. X  return argc;
  1002. X}
  1003. X#endif
  1004. X
  1005. X
  1006. X/*
  1007. X*******************************************************************************
  1008. X** Main program
  1009. X*******************************************************************************
  1010. X*/
  1011. X
  1012. X/* The main program, the starting point for Astrolog, follows. This section */
  1013. X/* basically consists of looping through and processing each switch on the  */
  1014. X/* command line, before actually calling a routine to do the neat stuff.    */
  1015. X
  1016. Xint main(argc, argv)
  1017. Xint argc;
  1018. Xchar **argv;
  1019. X{
  1020. X  int pos, i;
  1021. X  real k;
  1022. X  char cpos, *c;
  1023. X#ifdef TIME
  1024. X  struct tm curtime;
  1025. X  long curtimer;
  1026. X#endif
  1027. X#ifndef SWITCHES
  1028. X  char strings[MAXSWITCHES][12];
  1029. X  char *pointers[MAXSWITCHES];
  1030. X#endif
  1031. X
  1032. X  InputDefaults();
  1033. X#ifndef SWITCHES
  1034. X  for (i = 0; i < MAXSWITCHES; i++)
  1035. X    pointers[i] = strings[i];
  1036. X  argc = InputSwitches(strings);
  1037. X  argv = pointers;
  1038. X#endif
  1039. X  InitColors();
  1040. X
  1041. X  argc--; argv++;
  1042. X  while (argc) {
  1043. X    pos  = 1 + (argv[0][0] == '-' || argv[0][0] == '/');
  1044. X    cpos = argv[0][pos];
  1045. X    switch (argv[0][pos-1]) {
  1046. X    case 'H':
  1047. X      if (cpos != '0')
  1048. X        DisplaySwitches();
  1049. X      else
  1050. X        PrintSigns();
  1051. X      Terminate(0);
  1052. X    case 'O':
  1053. X      PrintObjects(cpos == '0');
  1054. X      Terminate(0);
  1055. X    case 'R':
  1056. X      if (cpos == 'T') {
  1057. X        c = (char PTR)ignore2;
  1058. X        pos++;
  1059. X        cpos = argv[0][pos];
  1060. X      } else
  1061. X        c = (char PTR)ignore;
  1062. X      if (cpos == '0')
  1063. X        for (i = 1; i <= total; i++)
  1064. X          c[i] = TRUE;
  1065. X      else if (cpos == 'C')
  1066. X        for (i = C_LO; i <= C_HI; i++)
  1067. X          c[i] = !c[i];
  1068. X      else if (cpos == 'u')
  1069. X        for (i = U_LO; i <= U_HI; i++)
  1070. X          c[i] = !c[i];
  1071. X      else if (cpos == 'U')
  1072. X        for (i = S_LO; i <= S_HI; i++)
  1073. X          c[i] = !c[i];
  1074. X      else if (argc <= 1 || (!atoi(argv[1]))) {
  1075. X        for (i = 11; i <= 15; i++)
  1076. X          c[i] = !c[i];
  1077. X        c[17] = !c[17]; c[20] = !c[20];
  1078. X      }
  1079. X      while (argc > 1 && (i = atoi(argv[1])))
  1080. X        if (i < 1 || i > total)
  1081. X          BadVal("R", i);
  1082. X        else {
  1083. X          c[i] = !c[i];
  1084. X          argc--; argv++;
  1085. X        }
  1086. X      break;
  1087. X    case 'u':
  1088. X      operation ^= DASHu;
  1089. X      break;
  1090. X    case 'U':
  1091. X      if (cpos == 'n' || cpos == 'b' || cpos == 'z' || cpos == 'l')
  1092. X        universe = cpos;
  1093. X      else
  1094. X        universe = !universe;
  1095. X      break;
  1096. X    case 'C':
  1097. X      operation ^= DASHC;
  1098. X      break;
  1099. X    case 'A':
  1100. X      if (argc <= 1) {
  1101. X        PrintAspects();
  1102. X        Terminate(0);
  1103. X      }
  1104. X      if (cpos != 'o' && cpos != 'm' && cpos != 'd') {
  1105. X        aspects = atoi(argv[1]);
  1106. X        if (aspects < 0 || aspects > ASPECTS)
  1107. X          BadVal("A", aspects);
  1108. X        argc--; argv++;
  1109. X      } else {
  1110. X        if (argc <= 2)
  1111. X          TooFew("A");
  1112. X        i = atoi(argv[1]);
  1113. X        if (i < 1 || i > (cpos == 'o' ? ASPECTS : OBJECTS)) {
  1114. X          fprintf(stderr, "%s: Value %d passed to switch -A%c out of range.\n",
  1115. X            appname, i, cpos);
  1116. X          Terminate(1);
  1117. X        }
  1118. X        k = atof(argv[2]);
  1119. X        if (k < -360.0 || k > 360.0) {
  1120. X          fprintf(stderr,
  1121. X            "%s: Value %.0f passed to switch -A%c out of range.\n",
  1122. X            appname, k, cpos);
  1123. X          Terminate(1);
  1124. X        }
  1125. X        if (cpos == 'm')
  1126. X          planetorb[i] = k;
  1127. X        else if (cpos == 'd')
  1128. X          planetadd[i] = k;
  1129. X        else
  1130. X          aspectorb[i] = k;
  1131. X        argc -= 2; argv += 2;
  1132. X      }
  1133. X      break;
  1134. X    case 's':
  1135. X      if (cpos != '0')
  1136. X        operation ^= DASHs;
  1137. X      else
  1138. X        operation ^= DASHs0;
  1139. X      break;
  1140. X    case 'h':
  1141. X      if (argc > 1 && (centerplanet = atoi(argv[1]))) {
  1142. X        argc--; argv++;
  1143. X      } else
  1144. X        centerplanet = 1;
  1145. X      if (centerplanet < 0 || centerplanet == 2 || (centerplanet >= THINGS &&
  1146. X        centerplanet < U_LO) || centerplanet > U_HI)
  1147. X        BadVal("h", centerplanet);
  1148. X      c = objectname[0];
  1149. X      objectname[0] = objectname[centerplanet];
  1150. X      objectname[centerplanet] = c;
  1151. X      if (centerplanet < 2)
  1152. X        centerplanet = 1-centerplanet;
  1153. X      break;
  1154. X    case 'c':
  1155. X      if (argc <= 1)
  1156. X        TooFew("c");
  1157. X      housesystem = atoi(argv[1]);
  1158. X      if (housesystem < 0 || housesystem >= SYSTEMS)
  1159. X        BadVal("c", housesystem);
  1160. X      argc--; argv++;
  1161. X      break;
  1162. X    case 'x':
  1163. X      if (argc <= 1)
  1164. X        TooFew("x");
  1165. X      multiplyfactor = atoi(argv[1]);
  1166. X      if (multiplyfactor < 1 || multiplyfactor > DEGREES)
  1167. X        BadVal("x", multiplyfactor);
  1168. X      argc--; argv++;
  1169. X      break;
  1170. X    case '1':
  1171. X      if (argc > 1 && (onasc = atoi(argv[1]))) {
  1172. X        argc--; argv++;
  1173. X      } else
  1174. X        onasc = 1;
  1175. X      if (onasc < 1 || onasc > TOTAL)
  1176. X        BadVal("1", onasc);
  1177. X      break;
  1178. X    case '2':
  1179. X      if (argc > 1 && (onasc = atoi(argv[1]))) {
  1180. X        argc--; argv++;
  1181. X      } else
  1182. X        onasc = 1;
  1183. X      if (onasc < 1 || onasc > TOTAL)
  1184. X        BadVal("2", onasc);
  1185. X      onasc = -onasc;
  1186. X      break;
  1187. X    case 'f':
  1188. X      operation ^= DASHf;
  1189. X      break;
  1190. X    case '3':
  1191. X      operation ^= DASH3;
  1192. X      break;
  1193. X    case 'G':
  1194. X      operation ^= DASHG;
  1195. X      break;
  1196. X    case 'p':
  1197. X      if (cpos == '0') {
  1198. X        operation |= DASHp0;
  1199. X        cpos = (argv[0][++pos]);
  1200. X      }
  1201. X      progress = TRUE;
  1202. X#ifdef TIME
  1203. X      if (cpos == 'n') {
  1204. X        curtimer = (long) time((long *) 0);
  1205. X        curtime = *localtime(&curtimer);
  1206. X        Mon = (real) curtime.tm_mon + 1.0;
  1207. X        Day = (real) curtime.tm_mday;
  1208. X        Yea = (real) curtime.tm_year + 1900.0;
  1209. X        Jdp = MdyToJulian(Mon, Day, Yea);
  1210. X        break;
  1211. X      }
  1212. X#endif
  1213. X      if (cpos == 'd') {
  1214. X        if (argc <= 1)
  1215. X          TooFew("pd");
  1216. X        progday = atof(argv[1]);
  1217. X        if (progday == 0.0)
  1218. X          BadVal2("pd", progday);
  1219. X        argc--; argv++;
  1220. X        break;
  1221. X      }
  1222. X      if (argc <= 3)
  1223. X        TooFew("p");
  1224. X      Mon = atof(argv[1]);
  1225. X      if (Mon < 1.0 || Mon > 12.0)
  1226. X        BadVal2("p", Mon);
  1227. X      Day = atof(argv[2]);
  1228. X      Yea = atof(argv[3]);
  1229. X      if (Day < 1.0 || Day > (real)DayInMonth((int)Mon, (int)Yea))
  1230. X        BadVal2("p", Day);
  1231. X      Jdp = MdyToJulian(Mon, Day, Yea);
  1232. X      argc -= 3; argv += 3;
  1233. X      break;
  1234. X    case 'F':
  1235. X      if (argc <= 3)
  1236. X        TooFew("F");
  1237. X      i = atoi(argv[1]);
  1238. X      if (i < 1 || i > TOTAL)
  1239. X        BadVal("F", i);
  1240. X      force[i] = atof(argv[2])*30.0-30.0+DecToDeg(atof(argv[3]));
  1241. X      if (force[i] < 0.0 || force[i] >= DEGREES)
  1242. X        BadVal2("F", force[i]);
  1243. X      else
  1244. X        force[i] += DEGREES;
  1245. X      argc -= 3; argv += 3;
  1246. X      break;
  1247. X    case '+':
  1248. X      if (argc > 1 && (k = atof(argv[1])) != 0.0) {
  1249. X        argc--; argv++;
  1250. X        Delta += k;
  1251. X      } else
  1252. X        Delta += 1.0;
  1253. X      break;
  1254. X    case '-': case '\0':
  1255. X      if (argc > 1 && (k = atof(argv[1])) != 0.0) {
  1256. X        argc--; argv++;
  1257. X        Delta -= k;
  1258. X      } else
  1259. X        Delta -= 1.0;
  1260. X      break;
  1261. X    case 'v':
  1262. X      if (cpos == '0')
  1263. X        exdisplay ^= DASHv0;
  1264. X      todisplay ^= DASHv;
  1265. X      break;
  1266. X    case 'w':
  1267. X      if (cpos == '0')
  1268. X        exdisplay ^= DASHw0;
  1269. X      if (argc > 1 && (i = atoi(argv[1]))) {
  1270. X        wheelrows = i;
  1271. X        argc--; argv++;
  1272. X      }
  1273. X      if (wheelrows < 1 || wheelrows > WHEELROWS)
  1274. X        BadVal("w", wheelrows);
  1275. X      todisplay ^= DASHw;
  1276. X      break;
  1277. X    case 'g':
  1278. X      if (cpos == '0')
  1279. X        exdisplay ^= DASHg0;
  1280. X      else if (cpos == 'a') {
  1281. X        exdisplay ^= DASHga;
  1282. X        if (argv[0][pos+1] == '0')
  1283. X          exdisplay ^= DASHg0;
  1284. X      }
  1285. X      todisplay ^= DASHg;
  1286. X      break;
  1287. X    case 'm':
  1288. X      if (cpos == '0')
  1289. X        exdisplay ^= DASHm0;
  1290. X      todisplay ^= DASHm;
  1291. X      break;
  1292. X    case 'Z':
  1293. X      if (cpos == '0')
  1294. X        exdisplay ^= DASHZ0;
  1295. X      todisplay ^= DASHZ;
  1296. X      break;
  1297. X    case 'S':
  1298. X      todisplay ^= DASHS;
  1299. X      break;
  1300. X    case 'j':
  1301. X      if (cpos == '0')
  1302. X        exdisplay ^= DASHj0;
  1303. X      todisplay ^= DASHj;
  1304. X      break;
  1305. X    case 'L':
  1306. X      if (cpos == '0')
  1307. X        exdisplay ^= DASHL0;
  1308. X      if (argc > 1 && (i = atoi(argv[1]))) {
  1309. X        graphstep = i;
  1310. X        argc--; argv++;
  1311. X      }
  1312. X      if (graphstep < 1 || 160%graphstep > 0)
  1313. X        BadVal("L", graphstep);
  1314. X      todisplay ^= DASHL;
  1315. X      break;
  1316. X    case 'd':
  1317. X      if (cpos == 'p') {
  1318. X        if (argc <= 2)
  1319. X          TooFew("dp");
  1320. X        prog = TRUE;
  1321. X        exdisplay ^= DASHdm;
  1322. X        Mon2 = atof(argv[1]);
  1323. X        Yea2 = atof(argv[2]);
  1324. X        if (Mon2 < 0.0 || Mon2 > 12.0)
  1325. X          BadVal2("dp", Mon2);
  1326. X        argc -= 2; argv += 2;
  1327. X      } else if (cpos == 'm')
  1328. X        exdisplay ^= DASHdm;
  1329. X#ifdef X11
  1330. X      else if (cpos == 'i') {
  1331. X        if (argc <= 1)
  1332. X          TooFew("display");
  1333. X        dispname = argv[1];
  1334. X      }
  1335. X#endif
  1336. X      todisplay ^= DASHd;
  1337. X      break;
  1338. X    case 'E':
  1339. X      if (cpos == 'y')
  1340. X        exdisplay ^= DASHEy;
  1341. X      todisplay ^= DASHE;
  1342. X      break;
  1343. X    case 'T':
  1344. X#ifdef TIME
  1345. X      if (cpos == 'n') {
  1346. X        curtimer = (long) time((long *) 0);
  1347. X        curtime = *localtime(&curtimer);
  1348. X        todisplay ^= DASHT;
  1349. X        if (argv[0][pos+1] == 'y')
  1350. X          Mon2 = 0.0;
  1351. X        else {
  1352. X          Mon2 = (real) curtime.tm_mon + 1.0;
  1353. X          if (Mon2 < 1.0 || Mon2 > 12.0)
  1354. X            BadVal2("Tn", Mon2);
  1355. X        }
  1356. X        Yea2 = (real) curtime.tm_year + 1900.0;
  1357. X        break;
  1358. X      }
  1359. X#endif
  1360. X      if (i = cpos == 'p')
  1361. X        prog = TRUE;
  1362. X      i = (argv[0][pos+i] == 'y');
  1363. X      if (argc <= 2-i)
  1364. X        TooFew("T");
  1365. X      todisplay ^= DASHT;
  1366. X      if (i)
  1367. X        Mon2 = 0.0;
  1368. X      else {
  1369. X        Mon2 = atof(argv[1]);
  1370. X        if (Mon2 < 1.0 || Mon2 > 12.0)
  1371. X          BadVal2("T", Mon2);
  1372. X      }
  1373. X      Yea2 = atof(argv[2-i]);
  1374. X      argc -= 2-i; argv += 2-i;
  1375. X      break;
  1376. X    case 'e':
  1377. X      todisplay ^= DASHe;
  1378. X      exdisplay ^= DASHg0 | DASHj0 | DASHL0;
  1379. X      break;
  1380. X    case 'I':
  1381. X      if (cpos == '0') {
  1382. X        ChartLocation(TRUE);
  1383. X        ChartGrid(TRUE);
  1384. X        Terminate(0);
  1385. X      }
  1386. X      interpret = !interpret;
  1387. X      break;
  1388. X#ifdef TIME
  1389. X    case 'n':
  1390. X      InputData("now");
  1391. X      if (cpos == 'd')
  1392. X        F = 0.0;
  1393. X      else if (cpos == 'm') {
  1394. X        D = 1.0; F = 0.0;
  1395. X      } else if (cpos == 'y') {
  1396. X        M = D = 1.0; F = 0.0;
  1397. X      }
  1398. X      break;
  1399. X#endif
  1400. X    case 'l':
  1401. X      if (argc <= 2)
  1402. X        TooFew("l");
  1403. X      deflong = atof(argv[1]);
  1404. X      deflat  = atof(argv[2]);
  1405. X      if (deflong < -180.0 || deflong > 180.0)
  1406. X        BadVal2("l", deflong);
  1407. X      if (deflat < -90 || deflat > 90)
  1408. X        BadVal2("l", deflat);
  1409. X      argc -= 2; argv += 2;
  1410. X      break;
  1411. X    case 'z':
  1412. X      if (argc <= 1 || (atoi(argv[1]) == 0 && argv[1][0] != '0'))
  1413. X        defzone--;
  1414. X      else {
  1415. X        defzone = atof(argv[1]);
  1416. X        if (defzone < -24.0 || defzone > 24.0)
  1417. X          BadVal2("z", defzone);
  1418. X        argc--; argv++;
  1419. X      }
  1420. X      break;
  1421. X    case 'a':
  1422. X      if (argc <= 7)
  1423. X        TooFew("a");
  1424. X      autom = TRUE;
  1425. X      M = atof(argv[1]); D = atof(argv[2]); Y = atof(argv[3]);
  1426. X      F = atof(argv[4]); X = atof(argv[5]);
  1427. X      L5 = atof(argv[6]); LA = atof(argv[7]);
  1428. X      if (M < 1.0 || M > 12.0)
  1429. X        BadVal2("a", M);
  1430. X      if (D < 1.0 || D > (real)DayInMonth((int)M, (int)Y))
  1431. X        BadVal2("a", D);
  1432. X      if (F < -2.0 || F > 24.0)
  1433. X        BadVal2("a", F);
  1434. X      if (X < -24.0 || X > 24.0)
  1435. X        BadVal2("a", M);
  1436. X      if (L5 < -180.0 || L5 > 180.0)
  1437. X        BadVal2("a", L5);
  1438. X      if (LA < -90 || LA > 90)
  1439. X        BadVal2("a", LA);
  1440. X      argc -= 7; argv += 7;
  1441. X      break;
  1442. X    case 'q':
  1443. X      i = (cpos == 'd') + 2*(cpos == 'm') + 3*(cpos == 'y');
  1444. X      if (argc <= 4-i)
  1445. X        TooFew("q");
  1446. X      autom = TRUE;
  1447. X      M = i > 2 ? 1.0 : atof(argv[1]);
  1448. X      D = i > 1 ? 1.0 : atof(argv[2-(i>2)]); Y = atof(argv[4-i-(i<1)]);
  1449. X      F = i == 0 ? atof(argv[4]) : (i > 1 ? 0.0 : 12.0);
  1450. X      X = defzone; L5 = deflong; LA = deflat;
  1451. X      if (M < 1.0 || M > 12.0)
  1452. X        BadVal2("q", M);
  1453. X      if (D < 1.0 || D > (real)DayInMonth((int)M, (int)Y))
  1454. X        BadVal2("q", D);
  1455. X      if (F < -2.0 || F > 24.0)
  1456. X        BadVal2("q", F);
  1457. X      argc -= 4-i; argv += 4-i;
  1458. X      break;
  1459. X    case 'i':
  1460. X      if (argc <= 1)
  1461. X        TooFew("i");
  1462. X      InputData(argv[1]);
  1463. X      argc--; argv++;
  1464. X      break;
  1465. X    case 'o':
  1466. X      if (argc <= 1)
  1467. X        TooFew("o");
  1468. X      if (cpos == '0')
  1469. X        operation ^= DASHo0;
  1470. X      operation ^= DASHo;
  1471. X      filenameout = argv[1];
  1472. X      extralines = argv;
  1473. X      do {
  1474. X        argc--; argv++;
  1475. X        extracount++;
  1476. X      } while (argc > 1 && (argv[1][0] != '-' || argv[1][0] != '/'));
  1477. X      break;
  1478. X    case 'r':
  1479. X      if (argc <= 2)
  1480. X        TooFew("r");
  1481. X      if (cpos == 'c')
  1482. X        relation = DASHrc;
  1483. X      else if (cpos == 'm')
  1484. X        relation = DASHrm;
  1485. X      else if (cpos == 'd')
  1486. X        relation = DASHrd;
  1487. X      else if (cpos == 'b')
  1488. X        relation = DASHrb;
  1489. X      else if (cpos == '0')
  1490. X        relation = DASHr0;
  1491. X      else
  1492. X        relation = DASHr;
  1493. X      filename = argv[1]; filename2 = argv[2];
  1494. X      argc -= 2; argv += 2;
  1495. X      break;
  1496. X#ifdef TIME
  1497. X    case 't':
  1498. X      if (argc <= 1)
  1499. X        TooFew("t");
  1500. X      if (cpos == 'd')
  1501. X        relation = DASHrd;
  1502. X      else if (cpos == 'b')
  1503. X        relation = DASHrb;
  1504. X      else
  1505. X        relation = DASHr0;
  1506. X      filename = argv[1]; filename2 = "now";
  1507. X      argc--; argv++;
  1508. X      break;
  1509. X#endif
  1510. X    case 'k':
  1511. X      ansi = !ansi;
  1512. X      break;
  1513. X#ifdef GRAPH
  1514. X    case 'X':
  1515. X      i = XProcess(argc, argv, pos);
  1516. X      operation |= DASHX;
  1517. X      argc -= i; argv += i;
  1518. X      break;
  1519. X#endif
  1520. X    default:
  1521. X      fprintf(stderr, "%s: Unknown switch '%s'\n", appname, argv[0]);
  1522. X      Terminate(1);
  1523. X    }
  1524. X    argc--; argv++;
  1525. X  }
  1526. X  Action();
  1527. X  Terminate(0);
  1528. X}
  1529. X
  1530. X/* driver.c */
  1531. END_OF_FILE
  1532. if test 35459 -ne `wc -c <'driver.c'`; then
  1533.     echo shar: \"'driver.c'\" unpacked with wrong size!
  1534. fi
  1535. # end of 'driver.c'
  1536. fi
  1537. echo shar: End of archive 2 \(of 12\).
  1538. cp /dev/null ark2isdone
  1539. MISSING=""
  1540. for I in 1 2 3 4 5 6 7 8 9 10 11 12 ; do
  1541.     if test ! -f ark${I}isdone ; then
  1542.     MISSING="${MISSING} ${I}"
  1543.     fi
  1544. done
  1545. if test "${MISSING}" = "" ; then
  1546.     echo You have unpacked all 12 archives.
  1547.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  1548. else
  1549.     echo You still need to unpack the following archives:
  1550.     echo "        " ${MISSING}
  1551. fi
  1552. ##  End of shell archive.
  1553. exit 0
  1554.  
  1555. exit 0 # Just in case...
  1556.