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

📄 astrolog.h

📁 占星术4.0源码
💻 H
📖 第 1 页 / 共 2 页
字号:
#define DASHrb 5
#define DASHr0 -1
#define DASHrp -2

/* Graphics chart modes */

#define MODEv 'v'
#define MODEw 'w'
#define MODEg 'g'
#define MODEZ 'Z'
#define MODES 'S'
#define MODEL 'L'
#define MODEE 'E'
#define MODEW 'W'
#define MODEG 'G'
#define MODEP 'P'
#define MODEb 'b'

/* Ansi colors */

#define REVERSE -2
#define DEFAULT -1
#define BLACK   0
#define MAROON  1
#define DKGREEN 2
#define ORANGE  3
#define DKBLUE  4
#define PURPLE  5
#define DKCYAN  6
#define LTGRAY  7
#define DKGRAY  8
#define RED     9
#define GREEN   10
#define YELLOW  11
#define BLUE    12
#define MAGENTA 13
#define CYAN    14
#define WHITE   15

/* Termination codes */

#define _ERROR -1
#define _OK    0
#define _FATAL 1
#define _FORCE 2

#ifndef _ZRES256COLOR
#define _ZRES256COLOR 263
#endif


/*
******************************************************************************
** Macro Functions.
******************************************************************************
*/

#define LOBYTE(W) ((byte) (W))
#define HIBYTE(W) ((byte) ((word)(W) >> 8 & 0xFF))
#define LOWORD(L) ((word) (dword)(L))
#define HIWORD(L) ((word) ((dword)(L) >> 16 & 0xFFFF))
#define MAKEWORD(L, H) ((word)LOBYTE(L) | (word)((byte)(H)) << 8)
#define MAKELONG(L, H) ((dword)LOWORD(L) | (dword)((word)(H)) << 16)
#define MAKEQUAD(A, B, C, D) MAKELONG(MAKEWORD(A, B), MAKEWORD(C, D))
#define RGB(R, G, B) ((dword)((byte)(R) | (word)(G)<<8 | (dword)(byte)(B)<<16))
#define RGBR(R) LOBYTE(R)
#define RGBG(G) HIBYTE(G)
#define RGBB(B) ((byte) ((dword)(B) >> 16 & 0xFF))
#define INTTOHEX(I) (char) ((I) < 10 ? '0' + (I) : 'a' + (I) - 10)
#define ISEGA(R) ((R) == _ERESNOCOLOR || (R) == _ERESCOLOR)
#define ISCGA(R) ((R) == _HRESBW || (R) == _HRES16COLOR)
#define EGATOVGA(X) MULTDIV((X), 480, 350)
#define CGATOVGA(X) MULTDIV((X), 480, 200)

#define MAX(A, B) ((A) > (B) ? (A) : (B))
#define MIN(A, B) ((A) < (B) ? (A) : (B))
#define SGN(A) ((A) < 0 ? -1 : (A) > 0 ? 1 : 0)
#define SGN2(A) ((A) < 0.0 ? -1.0 : 1.0)
#define FRACT(A) ((A) - floor(A))
#define CAP(C) ((C) >= 'a' && (C) <= 'z' ? (C) - 'a' + 'A' : (C))
#define UNCAP(C) ((C) >= 'A' && (C) <= 'Z' ? (C) - 'A' + 'a' : (C))
#define MULTDIV(X, Y, Z) ((int)((long)(X) * (Y) / (Z)))
#define STOZ(S) ((real)(((S)-1)*30))
#define ZTOS(D) (((int)(D))/30+1)
#define DTOR(D) ((D)/DEGRAD)
#define RTOD(R) ((R)*DEGRAD)
#define ASIN(R) ((R)*(R) == 1.0 ? (R)*PI/2.0 : atan((R)/sqrt(1.0-(R)*(R))))
#define ACOS(R) ((R) == 0.0 ? 0.0 : atan(sqrt(1.0-(R)*(R))/(R)))
#define ATAN(R) atan(R)
#define SIND(D) sin((D)/DEGRAD)
#define COSD(D) cos((D)/DEGRAD)
#define RSIND(R, D) ((int)((real)(R)*SIND((real)D)))
#define RCOSD(R, D) ((int)((real)(R)*COSD((real)D)))
#define SWAP(A, B) (A)^=(B)^=(A)^=(B)
#define SORT(A, B) if ((A) > (B)) SWAP(A, B)

#define IsCusp(I) ((I) >= C_LO && (I) <= C_HI)
#define IsObject(I) ((I) < THINGS || (I) > C_HI)
#define IsThing(I) ((I) <= THINGS || (I) > C_HI)
#define IsItem(I) ((I) >= 1 && (I) <= TOTAL)
#define DayInYear(Y) (365-28+DayInMonth(2, Y))
#define DayOfWeek(M, D, Y) ((int)((MdyToJulian(M, D, Y) + 1) % 7))

#define IsValidMon(M) ((M) >= 1 && (M) <= 12)
#define IsValidDay(D, M, Y) ((D) >= 1 && (D) <= DayInMonth(M, Y))
#define IsValidYea(Y) ((Y) >= -10000 && (Y) <= 10000)
#define IsValidTim(T) ((T) > -2.0 && (T) < 24.0)
#define IsValidZon(Z) ((Z) >= -24.0 && (Z) <= 24.0)
#define IsValidLon(O) ((O) >= -DEGHALF && (O) <= DEGHALF)
#define IsValidLat(A) ((A) >= -DEGQUAD && (A) <= DEGQUAD)
#define IsValidAspect(A) ((A) >= 0 && (A) <= ASPECTS)
#define IsValidSystem(H) ((H) >= 0 && (H) <= SYSTEMS)
#define IsValidDivision(D) ((D) > 0 && (D) <= 2880)
#define IsValidWheel(R) ((R) >= 1 && (R) <= WHEELROWS)
#define IsValidScreen(W) ((W) >= 20 && (W) <= 200)
#define IsValidTextrows(R) ((R) == 25 || (R) == 43 || (R) == 50)
#define IsValidGrid(C) ((C) > 0 && (C) <= TOTAL)
#define IsValidScale(S) ((S) >= 100 && (S) <= 300 && (S)%100 == 0)
#define IsValidGraphx(X) ((X) >= BITMAPX1 && (X) <= BITMAPX)
#define IsValidGraphy(Y) ((Y) >= BITMAPY1 && (Y) <= BITMAPY)
#define IsValidResmode(R) ((R) >= _MAXRESMODE && (R) <= _ZRES256COLOR)
#define IsValidBmpmode(M) \
  ((M) == 'N' || (M) == 'C' || (M) == 'V' || (M) == 'A' || (M) == 'B')

#define SetCore(M, D, Y, T, Z, O, A) \
  MM = (M); DD = (D); YY = (Y); TT = (T); ZZ = (Z); OO = (O); AA = (A)
#define SetMain(M, D, Y, T, Z, O, A) \
  Mon = (M); Day = (D); Yea = (Y); Tim = (T); Zon = (Z); Lon = (O); Lat = (A)
#define SetSave(M, D, Y, T, Z, O, A) MonX = (M); DayX = (D); YeaX = (Y); \
  TimX = (T); ZonX = (Z); LonX = (O); LatX = (A)
#define SetTwin(M, D, Y, T, Z, O, A) Mon2 = (M); Day2 = (D); Yea2 = (Y); \
  Tim2 = (T); Zon2 = (Z); Lon2 = (O); Lat2 = (A)
#define SIGNAM(A) signname[A][0], signname[A][1], signname[A][2]
#define OBJNAM(A) objectname[A][0], objectname[A][1], objectname[A][2]
#define MONNAM(A) monthname[A][0], monthname[A][1], monthname[A][2]
#define DAYNAM(A) dayname[A][0], dayname[A][1], dayname[A][2]
#define dabs(A) fabs(A)
#define signansi(A) elemansi[(A)-1 & 3]
#define signcolor(A) elemcolor[(A)-1 & 3]
#define printc(A) putc(A, S)
#define printl() printc('\n')
#define printl2() fprintf(S, "\n\n")
#define loop for (;;)

#ifndef PC
#define DASH '-'
#define FAR
#define PTR *
#define Allocate(P, B, T) (P) = (T) malloc(B)
#define Deallocate(P) free(P)
#else
#define DASH '/'
#define FAR far
#define PTR huge *
#define Allocate(P, B, T) (P) = (T) halloc((long)(B), sizeof(byte))
#define Deallocate(P) hfree(P)
#endif

#ifdef GRAPH
#define epsfile (psfile > TRUE)

/* Are particular coordinates on the chart? */
#define ISLEGAL(X, Y, x1, y1, x2, y2) \
  ((X) >= x1 && (X) < x2 && (Y) >= y1 && (Y) < y2)
#define ISCHART(X, Y) ISLEGAL((X), (Y), 0, 0, chartx, charty)

/* Get a coordinate based on chart radius, a fraction, and (co)sin value. */
#define POINT(U, R, S) ((int) ((R)*(U)*(S)+Sgn((S))/3.0))

/* Determine (co)sin factors based on zodiac angle and chart orientation. */
#define PX(A) COSD(A)
#define PY(A) SIND(A)
#define PZ(A) Mod(DEGHALF-(A)+asc)
#endif


/*
******************************************************************************
** Type Definitions.
******************************************************************************
*/

#define byte  unsigned char
#define word  unsigned short
#define dword unsigned long
#define bool  int
#define uint  unsigned int
#define real  double

typedef struct _gridstruct {
  byte  n[TOTAL+1][TOTAL+1];
  short v[TOTAL+1][TOTAL+1];
} gridstruct;

typedef struct _crosstruct {
  real lat[MAXCROSS];
  real lon[MAXCROSS];
  int obj1[MAXCROSS];
  int obj2[MAXCROSS];
} crosstruct;

#ifdef GRAPH
#define colrgb unsigned long
#define colpal int

typedef struct _circlestruct {
  real x[DEGR+1];
  real y[DEGR+1];
} circlestruct;

typedef byte PTR bitmap;
#endif /* GRAPH */


/*
******************************************************************************
** Function Declarations.
******************************************************************************
*/

/* From data.c */

extern FILE *S;
extern int noswitches, total, aspects, universe, centerplanet, placalc,
  seconds, housesystem, ansi, divisions, screenwidth, eurodate, eurotime,
  smartcusp, column80, todisplay, exdisplay, andisplay, operation, relation,
  interpret, progress, multiplyfactor, onasc,
  wheelrows, graphstep, autom;
extern char *progname, *filename, *filename2, string[];
extern real progday, defzone, deflong, deflat, modulus;
extern int MM, DD, YY, Mon, Day, Yea, Mon2, Day2, Yea2, MonX, DayX, YeaX,
  Delta;
extern real TT, ZZ, OO, AA, Tim, Zon, Lon, Lat, Tim2, Zon2, Lon2, Lat2,
  TimX, ZonX, LonX, LatX, SD, T, JD, Jdp, MC, Asc, Vtx;

extern real planet[], planetalt[], house[], ret[],
  spacex[], spacey[], spacez[], force[],
  planet1[], planet2[], planetalt1[], planetalt2[],
  house1[], house2[], ret1[], ret2[];
extern gridstruct PTR grid;
extern byte inhouse[], inhouse1[], inhouse2[];
extern int starname[], objectansi[];

extern byte ignore[], ignore2[];
extern real aspectangle[], aspectorb[], planetorb[], planetadd[];
extern int ruler1[], ruler2[], exalt[], rules[],
  mainansi[], rainbowansi[], elemansi[], aspectansi[];
extern real objectinf[], houseinf[], aspectinf[], transitinf[];

extern char *appname, *signname[], *signabbrev[], *signenglish[],
  *housetradition[], *objectname[], *systemname[], *aspectname[],
  *aspectabbrev[], *aspectglyph[], *element[], *mode[],
  *monthname[], *dayname[], *post[];
extern byte errorcount[];
extern real planetdata[], starbright[], stardata[];
extern char *mindpart[], *description[], *desire[], *lifearea[],
  *interact[], *therefore[], *modifier[3][11];

/* From general.c */

#define PrintAltitude(D) fprintf(S, "%s", CharAltitude(D))
#define BadVal2(O, V) BadVal(O, (int)V)

extern void SwapReal(),
  Terminate(), PrintWarning(), PrintError(), TooFew(), BadVal(),
  PrintTab(), InputString(), AnsiColor(), PrintZodiac(), GetTimeNow();
extern int StringLen(), StringCmp(), Mod12(), DayInMonth();
extern real Sgn(), Angle(), Mod(), DecToDeg(), DegToDec(),
  MinDistance(), MinDifference(), Midpoint(), Orb();
extern char Dignify(), *CharZodiac(), *CharAltitude(), *CharDate(),
  *CharTime(), *CharLocation(), *ProcessProgname();
extern bool InputData();

/* From formulas.c */

#define EclToEqu(Z, L) CoorXform(Z, L, DTOR(TROPIC))
#define EquToEcl(Z, L) CoorXform(Z, L, DTOR(-TROPIC))
#define EquToLocal(Z, L, T) CoorXform(Z, L, T)
#define ReadPlanetData() (*datapointer++)
#define Biorhythm(D, R) (sin(((D)/(R))*PI*2.0)*100.0)
#define JulianDayFromTime(T) ((T)*36525.0+2415020.0)

extern long MdyToJulian();
extern void JulianToMdy();
extern real ProcessInput();
extern void CoorXform();
extern int HousePlaceIn();
extern void HousePlace();
extern void ComputeStars();
extern real CastChart();

/* From charts.c */

extern void CreateElemTable();
extern void ChartLocation();
extern void ChartGrid();
extern void PrintGrand();
extern void DisplayGrands();
extern void PrintHouse();
extern void PrintWheelSlot();
extern void ChartWheel();
extern void ChartAspect();
extern void ChartMidpoint();
extern void ChartHorizon();
extern void ChartSpace();
extern void ChartAstroGraph();

/* From options.c */

extern void CreateGrid();
extern void CreateGridRelation();
extern void CastRelation();
extern void PrintAspect();
extern void DisplayInDaySearch();
extern void DisplayInDayInfluence();
extern void DisplayTransitSearch();
extern void DisplayTransitInfluence();
extern void DisplayEphemeris();
extern void DisplayCalendarMonth();
extern void DisplayCalendarYear();
extern void PrintChart();

/* From intrpret.c */

extern void FieldWord();
extern void InterpretGeneral();
extern void InterpretAspectGeneral();
extern void InterpretLocation();
extern void InterpretAspect();
extern void InterpretGrid();
extern void InterpretMidpoint();
extern void InterpretInDay();
extern void InterpretTransit();
extern void InterpretSynastry();
extern void InterpretAspectRelation();
extern void InterpretGridRelation();
extern void InterpretMidpointRelation();
extern void SortRank();
extern void ChartInfluence();

/* From driver.c */

extern void Prints();

#ifdef GRAPH
/* From xdata.c */

#ifdef X11
extern Colormap cmap;
extern Display *disp;
extern GC gc, pmgc;
extern KeySym key;
extern Pixmap pixmap, icon;
extern Window window, root;
extern XEvent event;
extern XSizeHints hint;
extern int screen, depth;
extern char xkey[];
extern char icon_bits[];
extern char *rgbname[];
extern colrgb rgbind[];
#endif
#ifdef MSG
extern int hiresmode, loresmode;
#endif

extern bitmap bm;
extern word PTR metacur;
extern circlestruct PTR circ;
extern char modex, bitmapmode, *outputfile, *dispname;
extern colrgb fg, bg, rgb[], rgbbmp[];
extern colpal colcur, metafillcol, on, off, hilite, gray;
extern colpal maincolor[], rainbowcolor[],
  elemcolor[], aspectcolor[], objectcolor[];
extern int xfile, xbitmap, psfile, metafile, xmono, xcolor, xreverse, 
  xroot, xtext, xbonus, xlabel, xborder, xfont;
extern int bitmaprow, xnow, xeast, scale, textrows, gridobjects, metawid,
  offsetx, offsety, turtlex, turtley, chartx, charty, degree, scalet;
extern real tilt;

extern char *signdraw[], *objectdraw[], *housedraw[],
  *aspectdraw[], *asciidraw[], *worlddata[];

/* From xgeneral.c */

#define AIND(B, X, Y) ((B)[(long)(Y)*(long)(bitmaprow) + ((X) >> 1)])
#define PGET(B, X, Y) (AIND(B, X, Y) >> (((X)&1^1) << 2) & 15)
#define PSET(B, X, Y, O) AIND(B, X, Y) = AIND(B, X, Y) & \
  15 << (((X)&1) << 2) | (O) << (((X)&1^1) << 2)

#define PutByte(A) putc((byte) (A), data)
#define PutWord(A) PutByte(LOBYTE(A)); PutByte(HIBYTE(A))
#define PutLong(A) PutWord(LOWORD(A)); PutWord(HIWORD(A))

#define DrawEdge(X1, Y1, X2, Y2) DrawBox(X1, Y1, X2, Y2, 1, 1)
#define DrawEdgeAll() DrawEdge(0, 0, chartx-1, charty-1)
#define DrawLine(X1, Y1, X2, Y2) DrawDash((X1), (Y1), (X2), (Y2), 0)
#define DrawCircle(X, Y, RX, RY) \
  DrawEllipse((X)-(RX), (Y)-(RY), (X)+(RX), (Y)+(RY))

extern void WriteFile();
extern void PSbegin();
extern void PSend();
extern void WriteMeta();
extern void DrawColor();
extern void DrawPoint();
extern void DrawSpot();
extern void DrawBlock();
extern void DrawBox();
extern void DrawClearScreen();
extern void DrawDash();
extern void DrawWrap();
extern void DrawClip();
extern void DrawEllipse();
extern void DrawText();
extern void DrawSign();
extern void DrawHouse();
extern void DrawObject();
extern void DrawAspect();
extern void DrawTurtle();

/* From xcharts.c */

extern int DrawPrint();
extern void DrawInfo();
extern void XChartWheel();
extern void XChartAstroGraph();
extern void XChartGrid();
extern void XChartHorizon();
extern void XChartHorizonSky();
extern void XChartSpace();
extern void XChartEphemeris();

/* From xoptions.c */

extern int Proper();
extern bool InitCircle();
extern void FillSymbolRing();
extern void FillSymbolLine();
extern int ReadWorldData();
extern int GlobeCalc();
extern void DrawGlobe();
extern void DrawLeyLine();
extern void DrawLeyLines();
extern void DrawWorld();
extern real XHousePlaceIn();
extern void XChartWheelRelation();
extern void XChartGridRelation();
extern void XChartBiorhythm();
extern void XChart();

/* From xdriver.c */

extern void XColorInit();
extern void XDisplaySwitches();
extern bool XAction();
extern int XProcessSwitches();
#endif /* GRAPH */

/* From placalc.c */

extern int PlacalcPlanet();

/* astrolog.h */

⌨️ 快捷键说明

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