home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Guide
/
c-cplusplus-interactive-guide.iso
/
c_ref
/
csource1
/
ast40dos
/
driver.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-01-04
|
56KB
|
1,757 lines
/*
** Astrolog (Version 4.00) File: driver.c
**
** IMPORTANT NOTICE: the graphics database and chart display routines
** used in this program are Copyright (C) 1991-1993 by Walter D. Pullen
** (cruiser1@stein.u.washington.edu). 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.
**
** The main 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 personal use but not to sell them or profit from
** them in any way.
**
** The PostScript code within the core graphics routines are programmed
** and Copyright (C) 1992-1993 by Brian D. Willoughby
** (brianw@sounds.wa.com). Conditions are identical to those above.
**
** The extended accurate ephemeris databases and formulas are from the
** calculation routines in the program "Placalc" and are programmed and
** Copyright (C) 1989,1991,1993 by Astrodienst AG and Alois Treindl
** (alois@azur.ch). The use of that source code is subject to
** regulations made by Astrodienst Zurich, and the code is not in the
** public domain. This copyright notice must not be changed or removed
** by any user of this program.
**
** Initial programming 8/28,30, 9/10,13,16,20,23, 10/3,6,7, 11/7,10,21/1991.
** X Window graphics initially programmed 10/23-29/1991.
** PostScript graphics initially programmed 11/29-30/1992.
** Last code change made 12/31/1993.
*/
#include "astrolog.h"
char *filenamescreen = NULL, *filenameout, **extralines;
int prog = FALSE, extracount = 0;
/*
******************************************************************************
** Table Display Routines.
******************************************************************************
*/
/* A subprocedure of the credit displayed below, this prints out one line */
/* of credit information on the screen. Given a string, it's displayed */
/* centered with left and right borders around it, in the given color. */
#define CREDITWIDTH 74
void PrintW(string, col)
char *string;
int col;
{
int i;
if (!string) {
/* Null string means print the top, bottom, or a separator row. */
if (col < 0)
AnsiColor(RED);
printc(col ? (col > 0 ? BOXSW : BOXNW) : BOXJE);
PrintTab(BOXH, CREDITWIDTH);
printc(col ? (col > 0 ? BOXSE : BOXNE) : BOXJW);
} else {
i = StringLen(string);
printc(BOXV);
PrintTab(' ', (CREDITWIDTH-i)/2 + (i&1));
AnsiColor(col);
fprintf(S, "%s", string);
PrintTab(' ', (CREDITWIDTH-i)/2);
AnsiColor(RED);
printc(BOXV);
}
printl();
}
/* Display a list of credits showing those who helped create the various */
/* parts of Astrolog, as well as important copyright and version info, as */
/* displayed with the -Hc switch. */
void DisplayCredits()
{
char string[STRING];
PrintW(NULL, -1);
sprintf(string, "%s version %s", appname, VERSION);
PrintW(string, WHITE);
sprintf(string, "As of %s", DATE);
PrintW(string, LTGRAY);
PrintW("By Walter D. Pullen (cruiser1@stein.u.washington.edu)", CYAN);
PrintW(NULL, 0);
PrintW("Main planetary calculation formulas were converted from", GREEN);
PrintW(
"routines by James Neely, as listed in 'Manual of Computer Programming",
GREEN);
PrintW(
"for Astrologers' by Michael Erlewine, available from Matrix Software.",
GREEN);
PrintW("PostScript graphics routines by Brian D. Willoughby", YELLOW);
PrintW(
"Extended ephemeris calculation and formulas are by Alois Treindl,",
MAGENTA);
PrintW(
"as in the package 'Placalc', available from Astrodienst AG.", MAGENTA);
PrintW(
"IMPORTANT: Astrolog is 'freeware', but is copyrighted and not in public",
LTGRAY);
PrintW(
"domain. Permission is granted to freely use and distribute these",
LTGRAY);
PrintW(
"routines provided one does not sell, restrict, or profit from the",
LTGRAY);
PrintW(
"program or its output in any way. Modification is allowed provided",
LTGRAY);
PrintW(
"these exact notices remain with any altered or edited versions of the",
LTGRAY);
PrintW(
"program. These conditions are true of both the program in whole and of",
LTGRAY);
PrintW(
"all parts by any individual author. Violators are subject to copyright",
LTGRAY);
PrintW(
"law penalties, and negative karmic debts to aforementioned contributors.",
LTGRAY);
PrintW(NULL, 0);
PrintW(
"Special thanks to all those unmentioned, seen and unseen, who have",
BLUE);
PrintW(
"pointed out problems, suggested featues, and sent many positive vibes!",
BLUE);
PrintW(NULL, 1);
AnsiColor(DEFAULT);
}
/* Print out a command switch or keypress info line to the screen, as done */
/* with the -H switch or 'H' key in a graphic window. This is just printing */
/* out the string, except in Ansi mode we set the proper colors: Red for */
/* header lines, Green for individual switches or keys, and White for the */
/* rest of the line telling what it does. We also prefix each switch with */
/* either Unix's '-' or PC's '/', whichever is appropriate for the system. */
void Prints(string)
char *string;
{
int dash;
char c;
dash = string[1];
if (*string != ' ')
AnsiColor(RED);
else if (dash != ' ')
AnsiColor(dash == 'P' || string[3] == ' ' || string[3] == ':' ?
GREEN : DKGREEN);
else
AnsiColor(DEFAULT);
while ((c = *string) && c != ':' &&
(dash != 'P' || (c != ' ' || *(string+1) != 't'))) {
if (c != '_')
printc(c);
else
printc(DASH);
string++;
}
if (*string)
printc(*string++);
AnsiColor(DEFAULT);
while (c = *string) {
if (c != '_')
printc(c);
else
printc(DASH);
string++;
}
printl();
}
/* Print a list of every command switch that can be passed to the program, */
/* and a description of what it does. This is what the -H switch prints. */
void DisplaySwitches()
{
char string[STRING];
sprintf(string, "%s (version %s) command switches:", appname, VERSION);
Prints(string);
Prints(" _H: Display this help list.");
Prints(" _Hc: Display program credits and copyrights.");
Prints(" _H0: Display names of zodiac signs and houses.");
Prints(" _O: Display available planets and other celestial objects.");
Prints(" _O0: Like _O but ignore object restrictions.");
Prints(" _A: Display available aspects, their angles, and present orbs.");
#ifdef INTERPRET
Prints(" _I0: Display meanings of signs, houses, planets, and aspects.");
#endif
Prints(" _Q: Prompt for more command switches after display finished.");
#ifdef SWITCHES
Prints(" _Q0: Like _Q but prompt for additional switches on startup.");
#endif
Prints("\nSwitches which determine the type of chart to display:");
Prints(" _v: Display list of object positions (chosen by default).");
Prints(" _v0: Like _v but express velocities relative to average speed.");
Prints(" _w [<rows>]: Display chart in a graphic house wheel format.");
Prints(" _w0 [..]: Like _w but reverse order of objects in houses 4..9.");
Prints(" _g: Display aspect and midpoint grid among planets.");
Prints(" _g0: Like _g but flag aspect configurations (e.g. Yod's) too.");
Prints(" _g0: For comparison charts, show midpoints instead of aspects.");
Prints(" _ga: Like _g but indicate applying instead of difference orbs.");
Prints(" _m: Display all object midpoints in sorted zodiac order.");
Prints(" _m0: Like _m but list aspects ordered by influence instead.");
Prints(" _m[0]a: Like _m0 but indicate applyi