home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Guide
/
c-cplusplus-interactive-guide.iso
/
c_ref
/
csource1
/
ast40dos
/
intrpret.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-01-04
|
22KB
|
643 lines
/*
** Astrolog (Version 4.00) File: intrpret.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"
#ifdef INTERPRET
/*
******************************************************************************
** Interpretation Subroutines.
******************************************************************************
*/
/* This function is used by the interpretation routines to print out lines */
/* of text with newlines inserted just before the end of screen is reached. */
void FieldWord(string)
char *string;
{
static char line[STRING*4];
static int cursor = 0;
int i, j;
/* Hack: Dump buffer if function called with a null string. */
if (*string == 0) {
line[cursor] = 0;
fprintf(S, "%s\n", line);
cursor = 0;
return;
}
if (cursor)
line[cursor++] = ' ';
for (i = 0; (line[cursor] = string[i]); i++, cursor++)
;
/* When buffer overflows 80 columns, print out one line and start over. */
while (cursor >= screenwidth-1) {
for (i = screenwidth-1; line[i] != ' '; i--)
;
line[i] = 0;
fprintf(S, "%s\n", line);
line[0] = line[1] = ' ';
for (j = 2; (line[j] = line[i+j-1]) != 0; j++)
;
cursor -= (i-1);
}
}
/* Display a general interpretation of what each sign of the zodiac, house, */
/* and planet or object means. This is called to do the -I0 switch table. */
void InterpretGeneral()
{
char string[STRING];
int i;
fprintf(S,
"Signs of the zodiac represent psychological characteristics.\n\n");
for (i = 1; i <= SIGNS; i++) {
AnsiColor(signansi(i));
sprintf(string, "%s is", signname[i]); FieldWord(string);
sprintf(string, "%s, and", description[i]); FieldWord(string);
sprintf(string, "%s.", desire[i]); FieldWord(string);
FieldWord("");
}
AnsiColor(DEFAULT);
fprintf(S, "\nHouses represent different areas within one's life.\n\n");
for (i = 1; i <= SIGNS; i++) {
AnsiColor(signansi(i));
sprintf(string, "The %d%s House is the area of life dealing with",
i, post[i]); FieldWord(string);
sprintf(string, "%s.", lifearea[i]); FieldWord(string);
FieldWord("");
}
AnsiColor(DEFAULT);
fprintf(S, "\nPlanets represent various parts of one's mind or self.\n\n");
for (i = 1; i <= OBJECTI; i++) {
if (ignore[i] || IsCusp(i))
continue;
AnsiColor(objectansi[i]);
sprintf(string, "%s%s%s%s represents one's",
i < 3 || (i >= THINGS && i <= OBJECTS) ? "The " : "",
i == _NOD ? "North " : (i == _FOR ? "Part of " : ""), objectname[i],
i == 13 ? " Athena" : ""); FieldWord(string);
sprintf(string, "%s.", mindpart[i]); FieldWord(string);
FieldWord("");
}
AnsiColor(DEFAULT);
}
/* Display a general interpretation of what each aspect type means. This */
/* is called when printing the interpretation table in the -I0 switch. */
void InterpretAspectGeneral()
{
char string[STRING];
int i;
fprintf(S, "\nAspects are different relationships between planets.\n\n");
for (i = 1; i <= MIN(aspects, ASPECTI); i++) {
AnsiColor(aspectansi[i]);
sprintf(string, "When planets are %s, one", aspectname[i]);
FieldWord(string); sprintf(string, interact[i], ""); FieldWord(string);
FieldWord("another.");
if (therefore[i][0]) {
sprintf(string, "%s.", therefore[i]); FieldWord(string);
}
FieldWord("");
}
return;
}
/* Print the interpretation of each planet in sign and house, as specified */
/* with the -I switch. This is basically array accessing combining the */
/* meanings of each planet, sign, and house, and a couple of other things. */
void InterpretLocation()
{
char string[STRING], c;
int i, j;
printl();
for (i = 1; i <= OBJECTI; i++) {
if (ignore[i] || IsCusp(i))
continue;
AnsiColor(objectansi[i]);
j = ZTOS(planet[i]); c = Dignify(i, j);
sprintf(string, "%s%s%s%s in %s", ret[i] < 0.0 ? "Retrograde " : "",
i == _NOD ? "North " : (i == _FOR ? "Part of " : ""), objectname[i],
i == 13 ? " Athena" : "", signname[j]);
FieldWord(string);
sprintf(string, "and %d%s House:", inhouse[i], post[inhouse[i]]);
FieldWord(string);
FieldWord("This person's"); FieldWord(mindpart[i]); FieldWord("is");
if (((int) planet[i]) % 30 < 10)
FieldWord("very");
sprintf(string, "%s, and", description[j]); FieldWord(string);
sprintf(string, "%s.", desire[j]); FieldWord(string);
FieldWord("Most often this manifests");
if (ret[i] < 0.0 && i != _NOD)
FieldWord("in an independent, backward, introverted manner, and");
FieldWord("in the area of life dealing with");
sprintf(string, "%s.", lifearea[inhouse[i]]); FieldWord(string);
/* Extra information if planet is in its ruling, falling, etc, sign. */
if (c == 'R')
FieldWord("This is a major aspect of the person's psyche!");
else if (c == 'F')
FieldWord("(This bit plays only a minor part in the person's psyche.)");
else if (c == 'e')
FieldWord("It is easy for them to express this part of themself.");
else if (c == 'd')
FieldWord("It is difficult for them to express this part of themself.");
FieldWord("");
}
}
/* Print an interpretation for a particular aspect in effect in a chart. */
/* This is called from the InterpretGrid and ChartAspect routines. */
void InterpretAspect(x, y)
int x, y;
{
char string[STRING*2];
int n;
n = grid->n[x][y];
if (n < 1 || n > ASPECTI ||
IsCusp(x) || IsCusp(y) || x > OBJECTI || y > OBJECTI)
return;
AnsiColor(aspectansi[n]);
sprintf(string, "%s %s %s: This person's", objectname[x],
aspectname[n], objectname[y]);
FieldWord(string); FieldWord(mindpart[x]);
sprintf(string, interact[n],
modifier[MIN(abs(grid->v[x][y])/150, 2)][n-1]);
FieldWord(string);
sprintf(string, "their %s.", mindpart[y]); FieldWord(string);
if (therefore[n][0]) {
sprintf(string, "%s.", therefore[n]); FieldWord(string);
}
FieldWord("");
}
/* Print the interpretation of each aspect in the aspect grid, as specified */
/* with the -g -I switch. Again, this is done by basically array accessing */
/* of the meanings of the two planets in aspect and of the aspect itself. */
void InterpretGrid()
{
int i, j;
for