⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 astrolog.h

📁 占星术4.0源码
💻 H
📖 第 1 页 / 共 2 页
字号:
/*
** Astrolog (Version 4.00) File: astrolog.h
**
** 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.
*/

/*
** TO COMPILE: For most systems, especially Unix and DOS based ones, the only
** changes that should need to be made to the code are to edit or comment the
** #define's below to equal the particulars of your own system and locale:
** 
** SYSTEM SECTION: These settings describe platform and hardware specifics.
** They are all required to be set properly or the program likely won't
** compile or run. Some of these are technically optional and can be
** commented out even if your system would normally support them, e.g.
** the X11 features can be disabled even if you are running X windows.
*/

#define PC /* Comment out this #define if you have a Unix or some other */
           /* system that isn't the generic PC running DOS.             */

/*#define ATOF /* Comment out this #define if you have a system in which  */
             /* 'atof' and related functions aren't defined in stdio.h, */
             /* such as most PC's, VMS compilers, and NeXT's.           */

/*#define X11 /* Comment out this #define if you don't have X windows, or */
            /* else have them and don't wish to compile in X graphics.  */

#define MSG /* Comment out this #define if you don't have access to the     */
            /* Microsoft C PC graphics library as in graph.h, or you do and */
            /* have a PC and just don't wish to compile these graphics in.  */

#define SWITCHES /* Comment out this #define if your system can not handle */
                 /* parameters on the command line (such as Mac's).        */

#define MOUSE /* Comment out this #define if you don't have a mouse, or */
              /* don't wish to compile in mouse tracking features. This */
              /* is only an option if either X11 or MSG above are set.  */

#define TIME /* Comment out this #define if your compiler can't take the  */
             /* calls to the 'time' or 'localtime' functions as in time.h */

/*
** FEATURES SECTION: These settings describe features that are always
** available to be compiled into the program no matter what platform or
** hardware is available. Their settings are always optional.
*/

#define GRAPH /* Comment out this #define if you don't want any graphics   */
              /* in the program. This switch allows at least generation of */
              /* bitmap files and must be set if any of the more advanced  */
              /* graphics feature additions are also compiled in.          */

#define PLACALC /* Comment out this #define if you don't want the more */
                /* accurate calculation features and formulas to be    */
                /* compiled into the program (as accessed with -b).    */

#define PS /* Comment out this #define if you don't want the ability to */
           /* generate charts in the PostScript graphics format.        */

#define META /* Comment out this #define if you don't want the ability to  */
             /* generate charts in the MS Windows metafile picture format. */

#define INTERPRET /* Comment out this #define if you don't want the ability */
                  /* to display interpretations of the various chart types. */

#define BIORHYTHM /* Comment out this #define if you don't want the    */
                  /* non-astrological biorhythm charts in the program. */

/*
** DATA CONFIGURATION SECTION: These settings describe particulars of
** your own location and where the program looks for certain info. It is
** recommended that these values be changed appropriately, although the
** program will still run if they are left alone.
*/

#ifndef PC
#define DEFAULT_DIR "~/astrolog/"
#else
#define DEFAULT_DIR "C:\\ASTROLOG\\"
#endif
  /* Change this string to directory path program should look in for the    */
  /* astrolog.dat default file if one is not in the current directory. For  */
  /* PC users, use two backslashes instead of one forward slash to divide   */
  /* subdirectories. (The above string must also end with the "/" or "\\"!) */

#define CHART_DIR DEFAULT_DIR
  /* This string is the directory the program looks in for chart info    */
  /* files (-i switch) if not in the current directory. This is normally */
  /* the default dir above but may be changed to be somewhere else.      */

#define EPHE_DIR DEFAULT_DIR
  /* This string is the directory the program looks in for the ephemeris */
  /* files as accessed with the -b switch. This is normally the default  */
  /* dir above but may be changed to be somewhere else.                  */

#define DEFAULT_LONG 122.20 /* Change these values to the longitude west    */
#define DEFAULT_LAT   47.36 /* and latitude north of your current location. */
                            /* Use negative values for east/southern areas. */

#define DEFAULT_ZONE 8.00 /* Change this number to the time zone of your */
                          /* current location in hours before (west of)  */
                          /* GMT. Use negative values for eastern zones. */

/*
** OPTIONAL CONFIGURATION SECTION: Although not necessary, one may like
** to change some of the values below: These constants affect some of
** the default parameters and other such things.
*/

#define DEFAULT_SYSTEM 0 /* Normally, Placidus houses are used (unless the */
                         /* user specifies otherwise). If you want a       */
                         /* different default system, change this number   */
                         /* to a value from 0..9 (values same as in -c).   */

#define DEFAULT_ASPECTS 5 /* Default number of aspects to use in charts. */

#define DIVISIONS 12 /* Greater numbers means more accuracy but slower  */
                     /* calculation, of exact aspect and transit times. */

#define DEFAULT_INFOFILE "astrolog.dat"
  /* Name of file to look in for default program parameters (which will */
  /* override the compile time values here, if the file exists).        */

#define WHEELCOLS 15   /* Affects width of each house in wheel display.    */
#define WHEELROWS 11   /* Max no. of objects that can be in a wheel house. */
#define SCREENWIDTH 80 /* Number of columns to print interpretations in.   */
#define MONTHSPACE 3   /* Number of spaces between each calendar column.   */
#define MAXINDAY 100   /* Max number of aspects or transits displayable.   */
#define MAXCROSS 500   /* Max number of latitude crossings displayable.    */

#ifdef GRAPH           /* For graphics, this char affects how bitmaps are */
#ifndef PC             /* written. 'N' is written like with the 'bitmap'  */
#define BITMAPMODE 'C' /* program, 'C' is compacted somewhat (files have  */
#else                  /* less spaces), and 'V' is compacted even more.   */
#define BITMAPMODE 'B' /* 'A' means write as rectangular Ascii text file. */
#endif                 /* 'B' means write as Windows bitmap (.bmp) file.  */

#ifdef MSG
#define DEFHIRESMODE _MAXRESMODE /* 'High-resolution' PC graphics mode. */
#define DEFLORESMODE _ERESCOLOR  /* 'Flicker-free' PC graphics mode.    */
#endif
#endif /* GRAPH */

/*#define TRUENODE /* Comment out this #define if you'd prefer the 'Node' */
                 /* object to refer to the Mean North Node of the Moon  */
                 /* as opposed to the True North Node of the Moon.      */

/*
** By the time you reach here and the above values are customized as
** desired, Astrolog is ready to be compiled! Be sure to similarly
** change the values in the astrolog.dat file, which will override any
** corresponding compile time values here. Don't change any of the
** values in the section below unless you really know what you're doing.
*/

#ifdef GRAPH
#define BITMAPX  2730   /* Maximum window size allowed */
#define BITMAPY  2730
#define BITMAPX1 180    /* Minimum window size allowed */
#define BITMAPY1 180
#define DEFAULTX 480    /* Default window size */
#define DEFAULTY 480
#define SIDESIZE 160    /* Size of wheel chart information sidebar.    */
#define MAXMETA 100000L /* Max bytes allowed in a metafile.            */
#define METAMUL   12    /* Metafile coordinate to chart pixel ratio.   */
#define PSMUL     11    /* PostScript coordinate to chart pixel ratio. */
#define CELLSIZE  14    /* Size for each cell in the aspect grid.      */
#define DEGINC     2    /* Number of degrees per line for circles.     */
#define DEFORB   7.0    /* Min distance glyphs can be from each other  */
#endif /* GRAPH */

#define BOXH  (ansi ? 196 : '-')    /* Ansi and Ascii characters used to */
#define BOXV  (ansi ? 179 : '|')    /* print text charts.                */
#define BOXC  (ansi ? 197 : '|')
#define BOXNW (ansi ? 218 : '+')
#define BOXNE (ansi ? 191 : '+')
#define BOXSW (ansi ? 192 : '+')
#define BOXSE (ansi ? 217 : '+')
#define BOXJN (ansi ? 193 : '-')
#define BOXJS (ansi ? 194 : '-')
#define BOXJW (ansi ? 180 : '|')
#define BOXJE (ansi ? 195 : '|')
#define DEGR1 (ansi ? 248 : ',')
#define DEGR2 (ansi ? 248 : ' ')
#define DEGR3 (ansi ? 248 : ':')


/*
** One shouldn't ever need to change anything below this line to compile.
*/

#define ASTROLOG
#define MATRIX
#include <stdio.h>
#ifndef ATOF
#include <stdlib.h>
#endif
#include <math.h>
#ifdef PC
#include <malloc.h>
#endif
#ifdef TIME
#include <time.h>
#endif
#ifdef X11
#define ISG
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#endif
#ifdef MSG
#define ISG
#include <graph.h>
#include <conio.h>
#ifdef MOUSE
#include <mouse.h>
#endif
#endif /* MSG */


/*
** Make sure only legal combinations of the graphics options are active.
*/

#ifdef X11
#ifndef GRAPH
"If 'X11' is defined 'GRAPH' must be too"
#endif
#ifdef MSG
"If 'X11' is defined 'MSG' must not be as well"
#endif
#ifdef PC
"If 'X11' is defined 'PC' must not be as well"
#endif
#endif /* X11 */

#ifdef MSG
#ifndef GRAPH
"If 'MSG' is defined 'GRAPH' must be too"
#endif
#ifdef X11
"If 'MSG' is defined 'X11' must not be as well"
#endif
#ifndef PC
"If 'MSG' is defined 'PC' must be too"
#endif
#endif /* MSG */

#ifdef MOUSE
#ifdef GRAPH
#ifndef ISG
"If 'MOUSE' is defined 'X11' or 'MSG' must be too"
#endif
#endif /* GRAPH */
#endif /* MOUSE */

#ifdef PS
#ifndef GRAPH
"If 'PS' is defined 'GRAPH' must be too"
#endif
#endif /* PS */

#ifdef META
#ifndef GRAPH
"If 'META' is defined 'GRAPH' must be too"
#endif
#endif /* META */


/*
******************************************************************************
** Program Constants.
******************************************************************************
*/

#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE  1
#endif
#define APPNAME "Astrolog"
#define VERSION "4.00"
#define DATE    "December 1993"
#define OFF     0
#define ON      1
#define STRING  80
#define DEGR    360
#define PI      3.14159265358979323846
#define DEGREES 360.0
#define DEGHALF 180.0
#define DEGQUAD 90.0
#define DEGRAD  (DEGHALF/PI)
#define SD2000  -24.736467
#define TROPIC  23.44578889
#define SMALL   (1.7453E-09)
#define LARGE   1000.0
#define ROUND   0.5
#define ESCAPE  '\33'
#define BELL    '\7'
#define SCALE   (scale/100)

/* Array index limits */

#define SIGNS   12
#define SYSTEMS 10
#define ASPECTS 18
#define ASPECTI 11
#define OBJECTI U_HI
#define TOTAL   79
#define FONTX   6
#define FONTY   10
#define FONTXT  (FONTX*scalet)
#define FONTYT  (FONTY*scalet)
#define SIDET   (SIDESIZE*scalet)

/* Object array index values */

#define PLANETS 14
#define THINGS  16
#define OBJECTS 20
#define URANIANS 8
#define STARS   47
#define BASE    32
#define C_LO    21
#define C_HI    24
#define U_LO    25
#define U_HI    32
#define S_LO    33
#define S_HI    79

/* Other specific index values */

#define _FIR 0
#define _EAR 1
#define _AIR 2
#define _WAT 3
#define _ARI 1
#define _CAN 4
#define _LIB 7
#define _CAP 10
#define _SUN 1
#define _MOO 2
#define _JUP 6
#define _PLU 10
#define _CHI 11
#define _NOD 16
#define _FOR 17
#define _MC  18
#define _ASC 19
#define _VTX 20
#define _DIR -2
#define _SIG -1
#define _CON 1
#define _OPP 2
#define _SQU 3
#define _TRI 4
#define _SEX 5
#define _INC 6
#define _SSX 7
#define _SSQ 8
#define _SES 9
#define _QUI 10
#define _BQN 11
#define _PHY 23.0
#define _EMO 28.0
#define _INT 33.0

/* Bit mask values for chart specification */

#define DASHv 0x1
#define DASHw 0x2
#define DASHg 0x4
#define DASHm 0x8
#define DASHZ 0x10
#define DASHS 0x20
#define DASHj 0x40
#define DASHL 0x80
#define DASHK 0x100
#define DASHd 0x200
#define DASHD 0x400
#define DASHE 0x800
#define DASHt 0x1000
#define DASHT 0x2000
#define DASHe 0xFFF

/* Bit mask values for subchart specification */

#define DASHv0 0x1
#define DASHw0 0x2
#define DASHg0 0x4
#define DASHga 0x8
#define DASHm0 0x10
#define DASHZ0 0x20
#define DASHZd 0x40
#define DASHj0 0x80
#define DASHL0 0x100
#define DASHKy 0x200
#define DASHdm 0x400
#define DASHEy 0x800
#define DASHXW0 0x1000
#define DASHXP0 0x2000

/* Bit mask values for table specification */

#define DASHO0 0x1
#define DASHHc 0x2
#define DASHH  0x4
#define DASHH0 0x8
#define DASHO  0x10
#define DASHA  0x20
#define DASHI0 0x40

/* Bit mask values for option specification */

#define DASHQ 0x1
#define DASHs 0x2
#define DASHC 0x4
#define DASHu 0x8
#define DASHf 0x10
#define DASH3 0x20
#define DASHG 0x40
#define DASHo 0x80
#define DASHX 0x100
#define DASHQ0 0x200
#define DASHs0 0x400
#define DASHp0 0x800
#define DASHo0 0x1000

/* Relationship chart modes */

#define DASHr  1
#define DASHrc 2
#define DASHrm 3
#define DASHrd 4

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -