home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Interactive Guide
/
c-cplusplus-interactive-guide.iso
/
c_ref
/
csource1
/
ast40dos
/
xdata.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-01-04
|
20KB
|
418 lines
/*
** Astrolog (Version 4.00) File: xdata.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 GRAPH
/*
******************************************************************************
** Graphics Global Variables.
******************************************************************************
*/
bitmap bm; /* Pointer to allocated memory. */
int bitmaprow; /* Horizontal size of bitmap array in memory. */
word PTR metacur; /* Current mem position when making metafile. */
char modex = MODEv; /* Current type of chart to create. */
char bitmapmode = BITMAPMODE; /* Current bitmap file type (-Xb). */
char *outputfile = NULL; /* Current name of bitmap file (-Xo). */
char *dispname = NULL; /* Current X11 display name (-Xd). */
circlestruct PTR circ = NULL; /* Table of sine and cosine values. */
int xfile;
#ifdef ISG
int xbitmap = FALSE; /* Are we creating a bitmap file (-Xb set). */
#else
int xbitmap = TRUE;
#endif
int psfile = FALSE; /* Are we generating a PostScript file (-Xp set). */
int metafile = FALSE; /* Are we generating a metafile graphic (-XM set). */
int xmono = FALSE; /* Is this a monochrome monitor. */
int xcolor = TRUE; /* Are we drawing a color chart (-Xm not set). */
int xreverse = FALSE; /* Are we drawing in reverse video (-Xr set). */
int xroot = FALSE; /* Are we drawing on the X11 background (-XB set). */
int xtext = TRUE; /* Are we printing chart info on chart (-XT set). */
int xfont = TRUE; /* Are we simulating fonts in charts (-XM0 set). */
int xbonus = FALSE; /* Are we drawing in alternate mode (-Xi set). */
int xlabel = TRUE; /* Are we labeling objects in charts (-Xl not set). */
int xborder = TRUE; /* Are we drawing borders around charts. */
int xnow = 0; /* Current animation mode. (-Xn). */
int xeast = 0; /* Current object to place on Asc (-X1). */
int scale = 200; /* Current character scale factor (-Xs). */
int textrows = 0; /* Numb. of rows to set text screen to (-V). */
int gridobjects = OBJECTS; /* Number of cells in -g graphic grids. */
int metawid = 10; /* Pen width to use when creating metafiles. */
int offsetx = 0, offsety = 0; /* Viewport origin. */
int turtlex = 0, turtley = 0; /* Current coordinates of pen. */
int chartx = DEFAULTX, charty = DEFAULTY; /* Current size of graphic chart. */
int degree = 0; /* Current rotation of globe. */
real tilt = 0.0; /* Current vertical tilt of rotating globe. */
int scalet; /* Relative scale to draw chart text at. */
/* Color tables for Astrolog's graphic palette. */
colrgb rgbbmp[] = {
0x000000, 0x00007F, 0x007F00, 0x007F7F,
0x7F0000, 0x7F007F, 0x7F7F00, 0xBFBFBF,
0x7F7F7F, 0x0000FF, 0x00FF00, 0x00FFFF,
0xFF0000, 0xFF00FF, 0xFFFF00, 0xFFFFFF};
#ifdef MSG
colrgb rgb[] = {
_BLACK, _RED, _GREEN, _BROWN,
_BLUE, _MAGENTA, _CYAN, _WHITE,
_GRAY, _LIGHTRED, _LIGHTGREEN, _YELLOW,
_LIGHTBLUE, _LIGHTMAGENTA, _LIGHTCYAN, _BRIGHTWHITE};
#endif
#ifdef X11
char *rgbname[] = {
"black", "orangered3", "green4", "darkorange2",
"blue4", "violet", "cyan4", "grey65",
"grey35", "orangered1", "green1", "yellow1",
"blue1", "pink", "cyan1", "white"};
colrgb rgbind[16];
#endif
/* These are the actual color arrays and variables used by the program. */
/* Technically, Astrolog always assumes we are drawning on a color terminal; */
/* for B/W graphics, all the values below are filled with black or white. */
colrgb fg, bg;
colpal colcur = -1, metafillcol = -1, on, off, hilite, gray,
maincolor[6+1], rainbowcolor[7+1],
elemcolor[4], aspectcolor[ASPECTS+1], objectcolor[TOTAL+1];
/* A bunch of physical X window variables dealing with the window itself. */
#ifdef X11
Colormap cmap;
Display *disp;
GC gc, pmgc;
KeySym key;
Pixmap pixmap, icon;
Window window, root;
XSizeHints hint;
#if FALSE
XWMHints *wmhint;
#endif
int screen, depth;
char xkey[10];
#endif
/*
******************************************************************************
** Astrolog Icon.
******************************************************************************
*/
#ifdef X11
/* This information used to define Astrolog's X icon (Rainbow over Third */
/* Eye) is identical to the output format used by the bitmap program. */
/* You could extract this section and run xsetroot -bitmap on it. */
#define icon_width 63
#define icon_height 32
/*static*/ char icon_bits[] = {
0x00,0x00,0x00,0xa8,0x0a,0x00,0x00,0x00,0x00,0x00,0x40,0x55,0x55,0x01,0x00,
0x00,0x00,0x00,0xa8,0xaa,0xaa,0x0a,0x00,0x00,0x00,0x00,0x54,0xf5,0x57,0x15,
0x00,0x00,0x00,0x80,0xaa,0xaa,0xaa,0xaa,0x00,0x00,0x00,0x40,0xd5,0xff,0xff,
0x55,0x01,0x00,0x00,0xa0,0xaa,0xaa,0xaa,0xaa,0x02,0x00,0x00,0x50,0xfd,0xff,
0xff,0x5f,0x05,0x00,0x00,0xa8,0xaa,0x2a,0xaa,0xaa,0x0a,0x00,0x00,0xd4,0xff,
0xaf,0xfa,0xff,0x15,0x00,0x00,0xaa,0x2a,0x00,0x00,0xaa,0x2a,0x00,0x00,0xf5,
0xbf,0xaa,0xaa,0xfe,0x57,0x00,0x80,0xaa,0x02,0x00,0x00,0xa0,0xaa,0x00,0x40,
0xfd,0xab,0xfa,0xaf,0xea,0x5f,0x01,0xa0,0xaa,0x80,0xff,0xff,0x80,0xaa,0x02,
0x50,0xff,0xea,0xff,0xff,0xab,0x7f,0x05,0xa0,0x2a,0xf0,0xff,0xff,0x07,0xaa,
0x02,0xd0,0xbf,0xfa,0x0f,0xf8,0xaf,0x7e,0x05,0xa8,0x0a,0xfc,0x01,0xc0,0x1f,
0xa8,0x0a,0xd4,0xaf,0x7e,0x00,0x00,0xbf,0xfa,0x15,0xa8,0x0a,0x3f,0x00,0x00,
0x7e,0xa8,0x0a,0xf4,0xaf,0x1f,0xe0,0x03,0xfc,0xfa,0x15,0xaa,0x82,0x0f,0xdc,
0x1d,0xf8,0xa0,0x2a,0xf4,0xab,0x07,0x23,0x62,0xf0,0xea,0x17,0xaa,0xc2,0x87,
0x91,0xc4,0xf0,0xa1,0x2a,0xf4,0xeb,0xc3,0xd0,0x85,0xe1,0xeb,0x17,0xaa,0xe0,
0x83,0x91,0xc4,0xe0,0x83,0x2a,0xf5,0xeb,0x03,0x23,0x62,0xe0,0xeb,0x57,0xaa,
0xe0,0x01,0xdc,0x1d,0xc0,0x83,0x2a,0xf5,0xeb,0x01,0xe0,0x03,0xc0,0xeb,0x57,
0xaa,0xe0,0x01,0x00,0x00,0xc0,0x83,0x2a,0xfd,0xeb,0x01,0x00,0x00,0xc0,0xeb,
0x5f};
#endif
/*
******************************************************************************
** Graphics Table Data.
******************************************************************************
*/
char *signdraw[] = {"",
"ND4HU2HLGDFBR6EUHLGD2G",