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

📄 placalc.h

📁 占星术4.0源码
💻 H
📖 第 1 页 / 共 2 页
字号:
# define NO_OF_HOUSES 12
#define MAX_PL_INDEX 32
/*
 * in a bitlist flag each planet is represented by a bit;
 * all 13 defined planets can be called at once with
 * LILITH is not automatically included
 */
#define CALC_ALL_PLANET_BITS  ((1 << 13) - 1)	/* bits 0..12 set */

/*
 * AFL: Astrological factor letters for use in selections strings.
 * Each factor (planet, house cusp etc) has a typical letter which
 * can be combined in a selctions string for specifying a certain
 * sequence of factors for a table or other kind of display.
 * The function apl2planet() can be used to translate the AFL letters
 * into planet indices.
 */

# define AFL_SUN	'0'
# define AFL_MON	'1'
# define AFL_MER	'2'
# define AFL_VEN	'3'
# define AFL_MAR	'4'
# define AFL_JUP	'5'
# define AFL_SAT	'6'
# define AFL_URA	'7'
# define AFL_NEP	'8'
# define AFL_PLU	'9'
# define AFL_CHI	'c'
# define AFL_LIL	'i'	/* mean Lilith: direction of lunar aphel */
# define AFL_AC		'A'
# define AFL_MC		'M'
# define AFL_TNODE	'N'	/* TRUE_NODE */
# define AFL_MNODE	'n'	/* MEAN_NODE */

/*
 * other AFL definitions not recognized by afl2planet()
 */
# define AFL_SIDT	's'	/* sidereal time */
# define AFL_WDAY	'd'	/* day of week column */

# define apl2planet	afl2planet	/* change of original name */


# define J2000	2451545.0	/* Epoch of JPL ephemeris DE200, absolute */
# define J1950  2433282.423	/* Epoch of JPL ephemeris DE102 */
#define JUL_OFFSET 2433282.0	/* offset of Astrodienst relative Julian date */
#define EPOCH1850 -36524.0	/* jupiter,saturn 0 jan 1850, 12:00 */
#define EPOCH1900 -18262.0	/* inner planets  0 jan 1900, 12:00 */
#define EPOCH1950  0.0		/* pluto 	  0 jan 1950, 12:00 */
                                /* this is the origin of the Astrodienst
                                   relative julian calendar system */
#define EPOCH1960  3653.0	/* uranus,neptune 1 jan 1960, 12:00 */

#define ENDMARK  99		/* used to mark the end of disturbation terms */

#define NODE_INTERVAL	0.005	/* days, = 7m20s */
#define MOON_SPEED_INTERVAL  0.0001 /* 8.64 seconds later */

/*
 * flag bits used in calc and calcserv
 */
# define CALC_BIT_HELIO	1	/* geo/helio */
# define CALC_BIT_NOAPP	2	/* apparent/true positions */
# define CALC_BIT_NONUT	4	/* true eq. of date/ mean equ. of date */
# define CALC_BIT_EPHE	8	/* universal/ephemeris time */
# define CALC_BIT_SPEED	16	/* without/with speed */
# define CALC_BIT_BETA	32	/* without/with latitude */
# define CALC_BIT_RGEO	64	/* without/with relative rgeo */
# define CALC_BIT_RAU	128	/* without/with real radius */
# define CALC_BIT_MUST_USE_EPHE	256	/* epheserv may not use calc */
# define CALC_BIT_MAY_USE_EPHE	512	/* calcserv may use ephread */

# if HPUNIX
#   define XYZ_FILE  "/users/ephe/xyz1950"	/* for creating */
#   define LRZ_FILE "/users/ephe/LRZ5_"	/* for creating */
#   define OPEN_EPHE "r"	
#ifndef ASTROLOG
#   define EPHE_PATH "/users/ephe"	/* for  LRZ and CHI */
#endif
# else

/* ephemeris file path for MSDOS */

/*****************************************************************************
******************************************************************************
  ATTENTION: PLACALC USERS ON MSDOS:

  EPHE_PATH indicates where the ephemeris files LRZ_nnn and CHI_nnn
  are found in you system.
  EPHE_PATH is only used once at the beginning of placalc.c to initialize
  the global variable ephe_path.

  If you do not have the ephemeris files in \PAIR\EPHE, you must do one of
  two things:
  - change the #define statement below to point to your ephemeris directory
  - OR change the global char *ephe_path before  you call any placalc
  function.
  Take care, that ephe_path ends NOT with the directory character ('\' in DOS).
******************************************************************************
*****************************************************************************/
#ifndef ASTROLOG
#   define EPHE_PATH "\\pair\\ephe"	
#endif

#   define OPEN_EPHE "rb"		/* read binary */
# endif

# define EPHE_STEP	80		/* days step in LRZ ephe */
# define EPHE_DAYS_PER_FILE 100000	/* days per ephe file */
# define EPHE_OUTER "LRZ5_"		/* file name prefix */
# define EPHE_OUTER_BSIZE	60	/* blocksize  */
# define EPHE_CHIRON "CHI_"		/* file name prefix */
# define EPHE_CHIRON_BSIZE	12	/* blocksize  */

/********************************************
  About the format of the ephemeris files
  ----------------------------------------
  We use currently ephemeris files with steps of 80 days.
  There are 1250 "records" in each file, so that one file
  spans 100000 days.
  We have two types of ephemeris files:
  LRZ5_nn 	for the outer planets Jupiter ... Pluto
  CHI_nn	for Chiron.
  nn is an expression derived from the first julian daynumber on the
  file. Jd 2100'000 to 2199'920 is on file LRZ5_21 and CHI_21;
  for negative Jd we use the filenames LRZ5_Mxx  with M indicating the minus.

  Given the jd for which you want the ephemeris, it is simple to build
  the filename and use fseek() within the file to go where the data is.
  This is done by the functions lrz_file_posit() and chi_file_posit().

  The stored coordinates are for each date and planet:
  L = ecliptic longitude relative to mean exquinox of date,
      in units of milliseconds of acr (1/3600000 degree) as type long;
  R = radius vector, units of 10-7 AU, as type long.
  Z = disctance of ecliptic; Z = R * sin(latitude); in units of 10-7 AU,
      as type long.
  The data is stored in the byte ordering of the Astrodienst HPUX machines,
  which is most significant byte first. It is not the same byte ordering
  as on Intel processors; the function longreorder() converts between
  the disk file format and the internal format of MSDOS machines.

  For LRZ5- files, we have 60-byte records LRZ(Jupiter),LRZ(Saturn),
  LRZ(Uranus), LRZ(Neptune), LRZ(Pluto). 
  For CHI-files we have 12-byte records LRZ.

************************************************/

# endif /* _PLACALC_INCLUDED */
#ifdef ASTROLOG
#ifdef ASTROLOG
/* Begin contents of astrolib.h */
#endif
/*******************************************
$Header: astrolib.h,v 1.2 91/11/16 16:21:02 alois Exp $
astrolib.h

NOTE for users of the PLACALC package:
This include files declares many function which
are NOT part of the PLACALC package. It is only
included because it also declares some items contained
in PLACALC.

ourdef.h should be included before this!

*******************************************/
# ifndef _ASTROLIB_INCLUDED
# define _ASTROLIB_INCLUDED

/* define days of the week for day_of_week() results */
# define DOW_MONDAY	0
# define DOW_SUNDAY	6

# define ORD_DIV	10000		/* for kdv and clients */

/* makros for bit operations */
# define clear_bit(v,bit_nr) 	((v) & ~(1L << (bit_nr)))
# define set_bit(v,bit_nr) 	((v) | (1L << (bit_nr)))
# define bit(bit_nr)		(1L << (bit_nr))
# define check_bit(v,bit_nr)	((v) & (1L << (bit_nr)))

# define SPLIT_CS_ROUND_SEC    1
# define SPLIT_CS_ROUND_MIN    2
# define SPLIT_CS_ROUND_DEG    4
# define SPLIT_CS_ROUND_ASTRO  8
# define SPLIT_CS_MOD_360      16
# define SPLIT_CS_MOD_24       32

/*******************************************
type definitions
********************************************/
struct adate {	/* date structure used by revjuls and juldays */
       int day, month, year;
       centisec csec;
       };

struct spl_cs {
  centisec cs;
  int sign;
  int degree;
  int min;
  int sec;
};

extern UCHAR *atl_collaps (UCHAR *isp, UCHAR *osp);	/* atlclps.c */
extern UCHAR *atl_uncollaps (UCHAR *isp, UCHAR *osp);

extern isalpha256(int);				/* ctype256.c	*/
extern isalnum256(int);
extern isupper256(int);
extern toupper256(int);
extern tolower256(int);
extern isspace256(int);

/* functions exported by gettext.c */
  extern open_text( char *filename, int max);	/* returns OK or ERR */
  extern void close_text();	
  extern char *get_text(int nr);
  extern char get_textc(int nr);
  extern get_text_array(char *array[], int nr, int arraysie);
	/* returns OK or ERR */

# define isdigit256(x) (isascii(x) && isdigit(x))

/****************************************
  converts astrodienst daynumber to string
****************************************/
extern char *adate_to_asc(char *cp, int adate);

extern double adate_to_julday(int adate);

extern int cut_string(char *s, char *cpos[], int nmax);		/* cutstr.c */
extern char *remove_nl(char *s);	
extern int comma_count(char *s);

extern int cut_string_any(char *s, char *cutlist, char *cpos[], int nmax);
		/* cutstr2.c	*/

extern long d2l(double x);				/* d2l.c	*/

extern int date_conversion 				/* dateconv.c */
	    (int d,
	     int m,
	     int y,		/* day, month, year */
	     centisec gmtime, 	/* greenwich time in centiseconds */
	     char c, 	/* calendar g[regorian]|j[ulian]|a[stro = greg] */
	     REAL8 *tgmt	/* julian date relative 0.Jan.1950 12:00 gmt */
				/* shift is 2433282 from absolute Julian date */
	    );			/* return OK or ERR */

extern int degstr_conversion (char *s, centisec *t);		/* degstr.c */

extern int day_of_week(double jd);			/* julday.c */
	/* monday = 0, ... sunday = 6 */

extern double dtime(void);				/* ourtime.c */
	/* returns seconds since 1970, with fraction
	   and a resolution of microseconds */

extern void ecl_to_equ(double al, double ab, double obl, double *ra, double *d);
							/* ecl2equ.c */

/****************************************
 * gets astrodienst daynumber from system time
****************************************/
extern int get_adate(void);

/* get a long consisting of hhmmss of current time */
extern long get_hms(void);				/* ourtime.c */

extern int get_lpb(char *pname);			/* get_lpb.c */

extern int hp2ibm(int c);				/* hp2ibm.c	*/

extern int ibm2hp(int c);				/* ibm2hp.c	*/

/*
 * interpolation of third order with Newton and Stirling formulas for
 * vectors of double or long.
 * One needs n+1 input values for n output values.
 * u is the normalized x-value to which we interpolate.
 * u is legal within -0.5 .. + 1.0
 * The same array can be used for output and input; the last value will
 * then be unchanged after the call.
 * Attention, the function values must be steady; they cannot have jumps
 * like typical planetary longitudes have when they cross zero degree.
 * You must use make_steady() before calling interpol() otherwise,
 * and later  use norm_range() to normalize again into your range.
 */
extern int interpod(double in[], double out[], double u, int n); /*interpod.c */
extern void make_steady_d(double x[], int n, double range);
extern double norm_range_d(double x, double range);

extern int interpol(long in[], long out[], double u, int n); /* interpol.c */
extern void make_steady_l(long x[], int n, long range);
extern long norm_range_l(long x, long range);


extern double julday(int month, int day, int year, double hour, int gregflag);
							/* julday.c	*/
extern double juldays(int gregflag, struct adate *adp); /* juldays.c	*/

extern char *kdv_collaps (char *osp, char *isp);	/* kdvclps.c */
extern char *kdv_collaps_w (char *osp, char *isp, char *w);
extern char *string_to_lower(char *c);

extern void log_report(FILE *fp, char *s1, char *s2);	/* writelog.c */

extern char *get_file_name(char *file_path );
extern char *makepath(char *d, char *s);	/* makepath.c 	*/

extern char *out_ll(char *s, centisec l, char ch_dflt, char ch_opps);
						/* outll.c	*/
extern char *out_merid(char *s, centisec l);	/* outmerid.c	*/

extern char *nord_to_date(char *cp, long nord);	/* outnord.c */
extern char *out_nord (char *s, long nord);	/* outnord.c */
extern char *out_nords (long nord);		/* outnord.c */
extern char *out_nordhs (long nord, int nhor);/* outnord.c */

extern char *out_time(char *s, centisec l);	/* outtime.c	*/

extern char *print_date_time(char *s);
/*
 * output current date and time in Format: 20-Jul-89 23:20
 */

extern char *print_date_time_sec(char *s);
/*
 * output current date and time with 1/100th of second precision
 */

extern char *print_timestamp(char *s, long ntst);
/*
 * output ntst date and time in format: 20-Jul-89 23:20
 */

extern void revjul (double u,			/* revjul.c */
	      int gregflag,
	      int *jmon, int *jday, int *jyear,
	      double *jut);

extern void revjuls(double u, int gregflag, struct adate *adp); /* revjuls.c */

extern char *rm_nonprint( char *);			/* rmuscore.c	*/
extern char *rm_uscore( char *);			/* rmuscore.c	*/

extern void split_cs(struct spl_cs *psplit, int roundflag); /* splitcs.c */

extern char *stristr(char *si, char *pi);		/* stristr.c	*/
/* extern char *strstr(char *si, char *pi);		 stristr.c	*/

extern char *sread(char *s, char *r, int max);		/* sread.c	*/

extern centisec simple_degstr_conversion(char *s);	/* sdegstr.c	*/

extern int timestr_conversion(char *s, centisec *t);	/* timestr.c	*/

extern char *upcase_first_letters( char *s);		/* upcase1.c	*/

extern char *TimeString (CSEC t, int sep, BOOLEAN suppressZero); /* outdeg.c */
extern char *LonLatString (CSEC t, char pchar, char mchar);	/* outdeg.c */
extern char *DegreeString (CSEC t);				/* outdeg.c */

/********************************************************
functions from csec.c
********************************************************/

/*
 * round the arguments to full seconds, takes care with zodiac sign changes:
 * does not round 29

⌨️ 快捷键说明

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