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

📄 placalc.h

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

#include "astrolog.h"

#ifdef ASTROLOG
#define EPHE_PATH EPHE_DIR
extern int lrz_file_posit();
extern int chi_file_posit();
extern int outer_hel();
extern void longreorder();
extern int inpolq();
#endif
#ifdef PLACALC
#ifdef ASTROLOG
/* Begin contents of astrolib.h */
#endif
/************************************************************
   $Header: placalc.h,v 1.4 93/03/22 10:08:39 alois Exp $
   definitions and constants for planetary routines

   ATTENTION: PLACALC USERS ON MSDOS:
   See the note close to the end of this file regarding EPHE_PATH.

  ---------------------------------------------------------------
  | Copyright Astrodienst AG and Alois Treindl, 1991, 1993.	|
  | The use of this source code is subject to regulations made	|
  | by Astrodienst Zurich. The code is NOT in the public domain.|
  |								|
  | This copyright notice must not be changed or removed	|
  | by any user of this program.				|
  ---------------------------------------------------------------

************************************************************/
# ifndef _PLACALC_INCLUDED
# define _PLACALC_INCLUDED

#ifndef ASTROLOG
#include "ourdef.h"	/* this is the basic include files which
			contains many definitions used throughout
			Astrodienst's programs.
			*/
#else /* ASTROLOG */
#ifdef ASTROLOG
/* Begin contents of ourdef.h */
#endif
/************************************************************
   $Header: ourdef.h,v 1.2 91/11/16 16:21:37 alois Exp $
   definitions and constants for all Astrodienst C programs
   contains only declarations and #defines, no global variables.
   auto-dectection of MSDOS (TURBO_C or MS_C) or HPUNIX
   
************************************************************/

#ifndef _OURDEF_INCLUDED /* allow multiple #includes of ourdef.h */
#define _OURDEF_INCLUDED
 
# define MY_TRUE 1	/* for use in other defines, before TRUE is defined */
# define MY_FALSE 0	/* for use in other defines, before TRUE is defined */

#ifdef MSDOS	/* already defined by some DOS compilers */
# undef MSDOS
# define MSDOS MY_TRUE
#endif

#ifdef __TURBOC__	/* defined by  turboc */
# ifndef MSDOS
#   define MSDOS MY_TRUE
# endif
# define TURBO_C
#endif

#if MSDOS
#  define HPUNIX MY_FALSE
#  ifndef TURBO_C
#    define MS_C	/* assume Microsoft C compiler */
#  endif
#else
#  define MSDOS MY_FALSE
#  define HPUNIX MY_TRUE
#  ifndef _HPUX_SOURCE
#    define _HPUX_SOURCE
#  endif
#endif

#include <math.h>
#ifndef FILE
#include <stdio.h>
#endif

#include <stdlib.h>
# if HPUNIX
#include <unistd.h>
# endif

#ifndef TRUE 
#define TRUE 1
#define FALSE 0
#endif

#ifndef OK 
#define OK (0)
#define ERR (-1)
#endif


# define UCHP	(unsigned char*)	/* used for casting *char  */
# define UCP	(unsigned char*)	/* used for casting *char  */
# define SCP	(char*)			/* used for casting *unsigned char */
# define UCHAR	unsigned char
 
#if HPUNIX
#include <malloc.h>
  typedef double  REAL8;  /* real with at least 64 bit precision */
  typedef float   REAL4;  /* real with at least 32 bit precision */
  typedef long     INT4;   /* signed integer with at least 32 bit precision */
  typedef unsigned long UINT4; 
			/* unsigned integer with at least 32 bit precision */
  typedef int     INT2;   /* signed integer with at least 16 bit precision */
  typedef int     INT1;   /* signed integer with at least 8  bit precision */
# ifndef dbd_VERSION	/* db_vista defines boolean in vista.h already */
			/* vista.h must be included before ourdef.h */
  typedef int     BOOLEAN;
# endif
  typedef unsigned short UINT2;	/* unsigned 16 bits */
# define ABS4	abs		/* abs function for long */
# define CHARSET_HP TRUE	/* used by ctype256 */
# define START_OF_EXTRA_CHAR 161
# define DEGREE_CHAR 179	/* HP degree character */
# endif

#if MSDOS 
#ifdef TURBO_C
#  include <alloc.h>		/* MSC needs malloc ! */
#else
#  include <malloc.h>
#endif
#include <stdlib.h>
#define HUGE 1.7E+308     /* biggest value for REAL8 */
#undef M_PI
#define M_PI 3.14159265358979323846
  typedef double  REAL8;  /* real with at least 64 bit precision */
  typedef float   REAL4;  /* real with at least 32 bit precision */
  typedef long    INT4;   /* signed integer with at least 32 bit precision */
  typedef unsigned long UINT4;
                          /* unsigned integer with at least 32 bit precision */
  typedef int     INT2;   /* signed integer with at least 16 bit precision */
  typedef int     INT1; /* signed integer with at least 8  bit precision */
  typedef int     BOOLEAN;
  typedef unsigned int UINT2;	/* unsigned 16 bits */
# define ABS4	labs		/* abs function for long */ 
# define START_OF_EXTRA_CHAR 128
# define DEGREE_CHAR 248	/* MSDOS degree character */
# define CHARSET_IBM TRUE	/* remains undefined if not msdos */
#endif
 
#define forward extern

#define MINUTE_CHAR  39	/* minute character */
#define SECOND_CHAR  34	/* second character */
#define MAXCHAR 256     /* used for string declarations, allowing 255 char+\0 */
#define COMMA ','
 
#define COS8 cos
#define SIN8 sin
#define ASIN8 asin
#define TAN8 tan
#define ATAN8 atan
#define ATAN28 atan2
#define EXP10(x) pow(10.0,(x))
#define ABS8(x) fabs(x)
 
#define TANERRLIMIT 1.0E-10     /* used to check for arguments close to pi */
#define NEAR_ZERO   1.0E-16     /* used to compare for divisors close to 0 */
#define BIGREAL  1.0E+38
 
#define DEGTORAD 0.0174532925199433
#define RADTODEG 57.2957795130823
 
typedef INT4    centisec;       /* centiseconds used for angles and times */
#define CS	(centisec)	/* use for casting */
#define CSEC	centisec	/* use for typing */
	

#define DEG     360000L  /* degree expressed in centiseconds */
#define DEG7_30 (2700000L)	/* 7.5 degrees */
#define DEG15   (15 * DEG)
#define DEG24   (24 * DEG)
#define DEG30   (30 * DEG)
#define DEG60   (60 * DEG)
#define DEG90   (90 * DEG)
#define DEG120  (120 * DEG)
#define DEG150  (150 * DEG)
#define DEG180  (180 * DEG)
#define DEG270  (270 * DEG)
#define DEG360  (360 * DEG)
 
#define CSTORAD  4.84813681109536E-08 /* centisec to rad: pi / 180 /3600/100 */
#define RADTOCS  2.06264806247096E+07 /* rad to centisec 180*3600*100/pi */
 
#define DEG2MSEC 3600000.0	/* degree to milliseconds */
#define DEG2CSEC 360000.0	/* degree to centiseconds */

#define SEC2CSEC	100	/* seconds to centiseconds */

#define CS2DEG	(1.0/360000.0)	/* centisec to degree */
#define CS2CIRCLE (CS2DEG/360.0)	/* centisec to circle */
#define AU2INT	 1e7		/* factor for long storage of A.U. */

#define CSMIN	6000L
#define CSSEC	100L

# define SINDEG(x)	sin(DEGTORAD * (x))
# define COSDEG(x)	cos(DEGTORAD * (x))
# define TANDEG(x)	tan(DEGTORAD * (x))
# define SINCS(x)	sin((double)(CSTORAD * (x)))
# define COSCS(x)	cos((double)(CSTORAD * (x)))
# define TANCS(x)	tan((double)(CSTORAD * (x)))

typedef long CMM;		/* plotmod unit 0.01 mm */
# define CMM2PT       0.028346457	/* factor for CMM to points */

typedef double *vector;
 
#endif /* _OURDEF_INCLUDED */
#ifdef ASTROLOG
/* End contents of ourdef.h */
#endif
#endif /* ASTROLOG */

/*************************************************************
 Exported functions:

 In all functions the variable jd_ad indicates the use of
 Astrodienst relative julian days, and jd the use of absolute
 julian days.
*************************************************************/
extern int nacalc(REAL8 jd_ad, centisec *plon, centisec *pspe);
extern int calcserv(int id, REAL8 t, int flag, int plalist, char *so);
extern void helup(REAL8 jd_ad);
extern void togeo(REAL8 le, REAL8 re, REAL8 l, REAL8 r, REAL8 z, REAL8 *alg, REAL8 *arg);
extern int  calc(int p,
		 REAL8 jd_ad,
		 int flag, 
		 REAL8 *alng,
		 REAL8 *arad,
		 REAL8 *alat,
		 REAL8 *alngspeed);
extern int rel_geo(int planet, double rau);
extern int hel( int	planet,	/* planet index as defined by placalc.h */
		REAL8	jd_ad,	/* relative juliand date, ephemeris time */
				/* Now come 6 pointers to return values. */
		REAL8	*al,	/* longitude in degrees */
		REAL8   *ar,	/* radius in AU */
		REAL8   *az,	/* distance from ecliptic in AU */
		REAL8   *alp, 	/* speed in longitude, degrees per day */
		REAL8   *arp,	/* speed in radius, AU per day */
		REAL8   *azp);   /* speed in z, AU per day */
extern int  moon(REAL8 *al, REAL8 *ar, REAL8 *az);
extern REAL8 fraction(REAL8 t);
extern REAL8 sidtime(REAL8 jd_ad, REAL8 ecl, REAL8 nuta);
extern REAL8 smod8360(REAL8 x);
extern REAL8 mod8360(REAL8 x);
extern REAL8 diff8360(REAL8 x, REAL8 y);
extern REAL8 test_near_zero(REAL8 x);
extern REAL8 deltat(REAL8 jd_ad);
extern void to_mean_ekl (double jd, double xyz[], double lrz[]);

/*
 * get the planet index for an AFL letter
 * returns -1 if the letter does not correspond to a planet.
 */
extern int afl2planet(int apl);
 
/*************************************************************
	exported variables
*************************************************************/
extern REAL8 meanekl;
extern REAL8 ekl;
extern REAL8 nut;

extern struct elements { /* actual elements at time thelup */
  REAL8 tj,     /* centuries from epoch */
        lg,     /* mean longitude in degrees of arc*/
        pe,     /* longitude of the perihelion in degrees of arc*/
        ex,     /* excentricity in degrees of arc*/
        kn,     /* longitude of node in degrees of arc*/
        in,     /* inclination of the orbit in degrees of arc*/
        ma;     /* mean anomaly in degrees of arc*/
   } el [];

extern char *ephe_path;
extern char *placalc_err_text;
  
/*************************************************************
	definitions
*************************************************************/

/*
 * planet index numbers, used to identify a planet in calc() and
 * other related functions.
 */
#define CALC_ONLY_ECL_NUT -1	/* pseudo planet index for calls to calc */
#define SUN	0		/* used synonymously for earth too */
#define EARTH	0
#define MOON	1
#define MERCURY 2
#define VENUS	3
#define MARS	4
#define JUPITER	5
#define SATURN	6
#define URANUS	7
#define NEPTUNE 8
#define PLUTO	9
#define LASTPLANET PLUTO
#define MEAN_NODE  10
#define TRUE_NODE  11
#define CHIRON	   12
#define CALC_N	   13	/* number of planets in placalc module */
#define LILITH	   13	/* Lilith is separate, not included in standard set
			   of placalc planets. This is required because
			   otherwise some string server calls would
			   suddenly return a higher number of fields.
			   */

/*
 * houses and axes get also a 'planet' index number, but they
 * are not used by placalc itself
 * between chiron and AC we leave 6 places unused for some other celestial
 * bodies or chart factors.
 * Axes and houses cannot be computed with calls to calc(); they must
 * be computed with the housasp module functions.
 */
# define AC	   19
# define MC	   20
# define CALC_N_MC  21	/* number of normal natal factors */

# define FIRST_HSNR 21
# define LAST_HSNR 32

⌨️ 快捷键说明

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