This repository has been archived by the owner on Jul 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathastrolog.h
1507 lines (1357 loc) · 50.3 KB
/
astrolog.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
** Astrolog (Version 6.00) File: astrolog.h
**
** IMPORTANT NOTICE: Astrolog and all chart display routines and anything
** not enumerated below used in this program are Copyright (C) 1991-2015 by
** Walter D. Pullen ([email protected], http://www.astrolog.org/astrolog.htm).
** Permission is granted to freely use, modify, and distribute these
** routines provided these credits and notices remain unmodified with any
** altered or distributed versions of the program.
**
** The main ephemeris databases and calculation routines are from the
** library SWISS EPHEMERIS and are programmed and copyright 1997-2008 by
** Astrodienst AG. The use of that source code is subject to the license for
** Swiss Ephemeris Free Edition, available at http://www.astro.com/swisseph.
** This copyright notice must not be changed or removed by any user of this
** program.
**
** Additional 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 ([email protected]). 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.
**
** The original planetary calculation routines used in this program have
** been copyrighted and the initial core of this program was mostly a
** conversion to C of the routines created by James Neely as listed in
** 'Manual of Computer Programming for Astrologers', by Michael Erlewine,
** available from Matrix Software.
**
** The PostScript code within the core graphics routines are programmed
** and Copyright (C) 1992-1993 by Brian D. Willoughby ([email protected]).
**
** More formally: This program is free software; you can redistribute it
** and/or modify it under the terms of the GNU General Public License as
** published by the Free Software Foundation; either version 2 of the
** License, or (at your option) any later version. This program is
** distributed in the hope that it will be useful and inspiring, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** General Public License for more details, a copy of which is in the
** LICENSE.HTM file included with Astrolog, and at http://www.gnu.org
**
** Initial programming 8/28-30/1991.
** X Window graphics initially programmed 10/23-29/1991.
** PostScript graphics initially programmed 11/29-30/1992.
** Last code change made 12/20/2015.
*/
/*
** TO COMPILE: For most systems, especially Unix, DOS, and Macs, 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 graphics can be disabled even if you are running X windows.
*/
/*#define PC /* Comment out this #define if you have a Unix, Mac, or other */
/* system that isn't a generic PC running DOS or MS Windows. */
/*#define MAC /* Comment out this #define if you're not compiling for a Mac. */
#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 WIN /* Comment out this #define if you don't have MS Windows, or */
/* else have them but want to compile a DOS version instead. */
/*#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 BGI /* Comment out this #define if you don't have access to the */
/* Borland C BGI graphics library for PC's in graphics.h, or */
/* you do and just don't wish to compile such graphics in. */
/*#define MACG /* Comment out this #define if you don't have a Mac, or else */
/* have one and don't wish to compile in Mac screen graphics. */
#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 valid if X11, WIN, MSG, BGI, or MACG 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 */
#define SWITCHES /* Comment out this #define if your system can not handle */
/* parameters on the command line (such as Mac's). */
#define ENVIRON /* Comment out this #define if your system doesn't have */
/* environment variables or can't compile calls to them. */
/*#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, Linux, VMS compilers, and NeXT's. */
#define PROTO /* Comment out this #define if you have an older compiler */
/* which doesn't allow full Ansi function prototypes. This */
/* is for programmers only and has no effect on executable. */
/*
** 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 SWISS /* Comment out this #define if you don't want the Swiss */
/* Ephemeris most accurate calculation features and formulas */
/* to be compiled into the program (as accessed with -b). */
#define PLACALC /* Comment out this #define if you don't want the Placalc */
/* less accurate calculation features and formulas to be */
/* compiled into the program (as accessed with -bp). */
#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 ARABIC /* Comment out this #define if you don't want any chart */
/* lists that include Arabic parts included in the program. */
#define CONSTEL /* Comment out this #define if you don't want any of the */
/* astronomical constellation charts in the program. */
#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 or */
/* in the dirs indicated by environment variables. For PC systems, use */
/* two backslashes instead of one forward one to divide subdirectories. */
#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 48 /* Greater numbers means more accuracy but slower */
/* calculation, of exact aspect and transit times. */
#define DEFAULT_INFOFILE "astrolog.as"
/* Name of file to look in for default program parameters (which will */
/* override the compile time values here, if the file exists). */
#define ENVIRONALL "ASTROLOG"
#define ENVIRONVER "ASTR"
/* Name of environment variables to look in for chart, ephemeris, and */
/* default files. The second name is a version specific variable which */
/* gets the current version appended to it before it is accessed. */
#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 150 /* Max number of aspects or transits displayable. */
#define MAXCROSS 750 /* Max number of latitude crossings displayable. */
#define CREDITWIDTH 74 /* Number of text columns in the -Hc credit screen. */
#define MAXSWITCHES 32 /* Max number of switch parameters per input line. */
#define PSGUTTER 9 /* Points of white space on PostScript page edge. */
#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
#ifdef BGI
#define DEFHIRESMODE 0 /* Zero or less means a 'hi-res' mode of driver. */
#define DEFLORESMODE 1 /* One or more means a 'lo-res' mode of driver. */
#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 by */
/* default 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.as file, which will override any
** corresponding compile time values here. Don't change any of the
** values in the section below unless you 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 250000L /* 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 BIODAYS 14 /* Days to include in graphic biorhythms. */
#define DEGINC 2 /* Number of degrees per segment for circles. */
#define DEFORB 7.0 /* Min distance glyphs can be from each other. */
#define MAXSCALE 400 /* Max scale factor as passed to -Xs swtich. */
#define TILTSTEP 11.25 /* Degrees to change when pressing '[' or ']'. */
#endif /* GRAPH */
#define chH (char)(us.fAnsiChar ? 196 : '-') /* Ansi and Ascii */
#define chV (char)(us.fAnsiChar ? 179 : '|') /* characters used to */
#define chC (char)(us.fAnsiChar ? 197 : '|') /* display text charts. */
#define chNW (char)(us.fAnsiChar ? 218 : '+')
#define chNE (char)(us.fAnsiChar ? 191 : '+')
#define chSW (char)(us.fAnsiChar ? 192 : '+')
#define chSE (char)(us.fAnsiChar ? 217 : '+')
#define chJN (char)(us.fAnsiChar ? 193 : '-')
#define chJS (char)(us.fAnsiChar ? 194 : '-')
#define chJW (char)(us.fAnsiChar ? 180 : '|')
#define chJE (char)(us.fAnsiChar ? 195 : '|')
#define chDeg0 (char)(us.fAnsiChar ? 248 : ' ')
#define chDeg1 (char)(us.fAnsiChar ? 248 : ':')
#define chDeg2 (char)(us.fAnsiChar ? 176 : ' ')
/*
** One shouldn't ever need to change anything below this line to compile.
*/
#define ASTROLOG
#ifdef _DEBUG
#define DEBUG
#endif
#define MATRIX
#ifdef SWISS
#define EPHEM
#endif
#ifdef PLACALC
#define EPHEM
#endif
/*#define BETA /* Uncomment to compile in beta message on startup. */
#define _CRT_SECURE_NO_DEPRECATE
#define _CRT_NONSTDC_NO_DEPRECATE
#include <stdio.h>
#ifndef ATOF
#include <stdlib.h>
#endif
#include <math.h>
#ifdef PC
#include <malloc.h>
#include <windows.h>
#endif
#ifdef TIME
#include <time.h>
#endif
#ifdef X11
#define ISG
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#endif
#ifdef WIN
#define ISG
#include <windows.h>
#include <commdlg.h>
#include <objbase.h>
#include <comdef.h>
#include <comdefsp.h>
#include <shlobj.h>
#include <shfolder.h>
#include <shobjidl.h>
#include <shlwapi.h>
#include "resource.h"
#endif
#ifdef MSG
#define ISG
#define PCG
#include <graph.h>
#include <conio.h>
#endif
#ifdef BGI
#define ISG
#define PCG
#include <graphics.h>
#include <conio.h>
#endif
#ifdef MACG
#define ISG
#endif
#ifdef PS
#define STROKE
#endif
#ifdef META
#define STROKE
#endif
#ifdef MOUSE
#ifdef PC
#include <dos.h>
#endif
#endif /* MOUSE */
/*
** Make sure only legal combinations of the graphics options are active.
*/
#ifdef MAC
#ifdef SWITCHES
#error "If 'MAC' is defined 'SWITCHES' must not be as well"
#endif
#ifdef ENVIRON
#error "If 'MAC' is defined 'ENVIRON' must not be as well"
#endif
#endif /* MAC */
#ifdef X11
#ifndef GRAPH
#error "If 'X11' is defined 'GRAPH' must be too"
#endif
#ifdef WIN
#error "If 'X11' is defined 'WIN' must not be as well"
#endif
#ifdef MSG
#error "If 'X11' is defined 'MSG' must not be as well"
#endif
#ifdef BGI
#error "If 'X11' is defined 'BGI' must not be as well"
#endif
#ifdef MACG
#error "If 'X11' is defined 'MACG' must not be as well"
#endif
#ifdef PC
#error "If 'X11' is defined 'PC' must not be as well"
#endif
#endif /* X11 */
#ifdef WIN
#ifndef GRAPH
#error "If 'WIN' is defined 'GRAPH' must be too"
#endif
#ifdef X11
#error "If 'WIN' is defined 'X11' must not be as well"
#endif
#ifdef MSG
#error "If 'WIN' is defined 'MSG' must not be as well"
#endif
#ifdef BGI
#error "If 'WIN' is defined 'BGI' must not be as well"
#endif
#ifdef MACG
#error "If 'WIN' is defined 'MACG' must not be as well"
#endif
#ifndef PC
#error "If 'WIN' is defined 'PC' must be too"
#endif
#endif /* WIN */
#ifdef MSG
#ifndef GRAPH
#error "If 'MSG' is defined 'GRAPH' must be too"
#endif
#ifdef X11
#error "If 'MSG' is defined 'X11' must not be as well"
#endif
#ifdef WIN
#error "If 'MSG' is defined 'WIN' must not be as well"
#endif
#ifdef BGI
#error "If 'MSG' is defined 'BGI' must not be as well"
#endif
#ifdef MACG
#error "If 'MSG' is defined 'MACG' must not be as well"
#endif
#ifndef PC
#error "If 'MSG' is defined 'PC' must be too"
#endif
#endif /* MSG */
#ifdef BGI
#ifndef GRAPH
#error "If 'BGI' is defined 'GRAPH' must be too"
#endif
#ifdef X11
#error "If 'BGI' is defined 'X11' must not be as well"
#endif
#ifdef WIN
#error "If 'BGI' is defined 'WIN' must not be as well"
#endif
#ifdef MSG
#error "If 'BGI' is defined 'MSG' must not be as well"
#endif
#ifdef MACG
#error "If 'BGI' is defined 'MACG' must not be as well"
#endif
#ifndef PC
#error "If 'BGI' is defined 'PC' must be too"
#endif
#endif /* BGI */
#ifdef MACG
#ifndef GRAPH
#error "If 'MACG' is defined 'GRAPH' must be too"
#endif
#ifndef MAC
#error "If 'MACG' is defined 'MAC' must be too"
#endif
#ifdef X11
#error "If 'MACG' is defined 'X11' must not be as well"
#endif
#ifdef WIN
#error "If 'MACG' is defined 'WIN' must not be as well"
#endif
#ifdef MSG
#error "If 'MACG' is defined 'MSG' must not be as well"
#endif
#ifdef BGI
#error "If 'MACG' is defined 'BGI' must not be as well"
#endif
#ifdef PC
#error "If 'MACG' is defined 'PC' must not be as well"
#endif
#endif /* MACG */
#ifdef MOUSE
#ifdef GRAPH
#ifndef ISG
#error "If 'MOUSE' is defined 'X11', 'WIN', 'MSG', 'BGI', or 'MACG' must be too"
#endif
#endif /* GRAPH */
#endif /* MOUSE */
#ifdef PS
#ifndef GRAPH
#error "If 'PS' is defined 'GRAPH' must be too"
#endif
#endif /* PS */
#ifdef META
#ifndef GRAPH
#error "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 fFalse FALSE
#define fTrue TRUE
#define szAppNameCore "Astrolog"
#define szVersionCore "6.00"
#define szDateCore "December 2015"
#define szAddressCore \
"[email protected] - http://www.astrolog.org/astrolog.htm"
#define szNowCore "now"
#define szTtyCore "tty"
#define szSetCore "set"
#define szNulCore "nul"
#define cchSzDef 80
#define cchSzMax 255
#define nDegMax 360
#define nDegHalf 180
#define yeaJ2G 1582
#define monJ2G mOct
#define dayJ2G1 4
#define dayJ2G2 15
#define rPi 3.14159265358979323846
#define rPi2 (rPi*2.0)
#define rPiHalf (rPi/2.0)
#define rDegMax 360.0
#define rDegHalf 180.0
#define rDegQuad 90.0
#define rDegRad (rDegHalf/rPi)
#define rEpoch2000 (-24.736467)
#define rAxis 23.44578889
#define rSmall (1.7453E-09)
#define rLarge 10000.0
#define rRound 0.5
#define chNull '\0'
#define chEscape '\33'
#define chBell '\7'
#define chReturn '\r'
#define chTab '\t'
#define chDelete '\b'
#define chBreak '\3'
#define chRet 'R'
/* Array index limits */
#define cSign 12
#define cObj 89
#define cObjInt uranHi
#define objMax (cObj+1)
#define cAspect 18
#define cAspectInt aBQn
#define cSystem 15
#define cCnstl 88
#define cZone 69
#define cSector 36
#define cPart 177
#define cAspConfig 6
#define cWeek 7
#define cColor 16
#define cRay 7
#define xFont 6
#define yFont 10
#define xFontT (xFont*gi.nScaleT)
#define yFontT (yFont*gi.nScaleT)
#define xSideT (SIDESIZE*gi.nScaleT)
/* Object array index values */
#define cPlanet oVes
#define cThing oLil
#define oMain 10
#define oCore 21
#define cUran 9
#define cStar 47
#define cuspLo (oCore+1)
#define cuspHi (cuspLo+cSign-1)
#define uranLo (cuspHi+1)
#define uranHi (uranLo+cUran-1)
#define oNorm uranHi
#define starLo (uranHi+1)
#define starHi (starLo+cStar-1)
/* Month index values */
enum _months {
mJan = 1,
mFeb = 2,
mMar = 3,
mApr = 4,
mMay = 5,
mJun = 6,
mJul = 7,
mAug = 8,
mSep = 9,
mOct = 10,
mNov = 11,
mDec = 12,
};
/* Elements */
enum _elements {
eFir = 0,
eEar = 1,
eAir = 2,
eWat = 3,
};
/* Zodiac signs */
enum _signs {
sAri = 1,
sTau = 2,
sGem = 3,
sCan = 4,
sLeo = 5,
sVir = 6,
sLib = 7,
sSco = 8,
sSag = 9,
sCap = 10,
sAqu = 11,
sPis = 12,
};
/* Objects */
enum _objects {
oEar = 0,
oSun = 1,
oMoo = 2,
oMer = 3,
oVen = 4,
oMar = 5,
oJup = 6,
oSat = 7,
oUra = 8,
oNep = 9,
oPlu = 10,
oChi = 11,
oCer = 12,
oPal = 13,
oJun = 14,
oVes = 15,
oNod = 16,
oSou = 17,
oLil = 18,
oFor = 19,
oVtx = 20,
oEP = 21,
oAsc = 22,
o2nd = 23,
o3rd = 24,
oNad = 25,
o5th = 26,
o6th = 27,
oDes = 28,
o8th = 29,
o9th = 30,
oMC = 31,
o11t = 32,
o12t = 33,
oVul = 34,
oOri = (starLo-1+10),
oAnd = (starLo-1+47),
};
/* Aspects */
enum _aspects {
aDir = -2,
aSig = -1,
aCon = 1,
aOpp = 2,
aSqu = 3,
aTri = 4,
aSex = 5,
aInc = 6,
aSSx = 7,
aSSq = 8,
aSes = 9,
aQui = 10,
aBQn = 11,
};
/* Biorhythm cycle constants */
#define brPhy 23.0
#define brEmo 28.0
#define brInt 33.0
/* Relationship chart modes */
enum _relationshipchart {
rcNone = 0,
rcSynastry = 1,
rcComposite = 2,
rcMidpoint = 3,
rcDifference = 4,
rcBiorhythm = 5,
rcDual = -1,
rcTriWheel = -2,
rcQuadWheel = -3,
rcTransit = -4,
rcProgress = -5,
};
/* Aspect configurations */
enum _configurations {
acS = 1,
acGT = 2,
acTS = 3,
acY = 4,
acGC = 5,
acC = 6,
};
/* Graphics chart modes */
enum _graphicschart {
gWheel = 1,
gHouse = 2,
gGrid = 3,
gHorizon = 4,
gOrbit = 5,
gSector = 6,
gCalendar = 7,
gDisposit = 8,
gEsoteric = 9,
gAstroGraph = 10,
gEphemeris = 11,
gWorldMap = 12,
gGlobe = 13,
gPolar = 14,
gBiorhythm = 15,
#ifdef WIN
gAspect = 16,
gMidpoint = 17,
gArabic = 18,
gSign = 19,
gObject = 20,
gHelpAsp = 21,
gConstel = 22,
gPlanet = 23,
gMeaning = 24,
gRay = 25,
gSwitch = 26,
gObscure = 27,
gKeystroke = 28,
gCredit = 29,
gRising = 30,
gTraTraHit = 31,
gTraTraInf = 32,
gTraNatHit = 33,
gTraNatInf = 34,
#endif
};
/* Colors */
enum _colors {
kReverse = -2,
kDefault = -1,
kBlack = 0,
kMaroon = 1,
kDkGreen = 2,
kOrange = 3,
kDkBlue = 4,
kPurple = 5,
kDkCyan = 6,
kLtGray = 7,
kDkGray = 8,
kRed = 9,
kGreen = 10,
kYellow = 11,
kBlue = 12,
kMagenta = 13,
kCyan = 14,
kWhite = 15,
kElement = 16,
kRay = 17,
kNull = 16,
};
/* Arabic parts */
enum _arabicparts {
apFor = 0,
apSpi = 1,
};
/* Draw text formatting flags */
enum _drawtext {
dtCent = 0x0,
dtLeft = 0x1,
dtBottom = 0x2,
dtErase = 0x4,
dtScale = 0x8,
dtTop = 0x10,
};
/* User string parse modes */
enum _parsemode {
pmMon = 1,
pmDay = 2,
pmYea = 3,
pmTim = 4,
pmDst = 5,
pmZon = 6,
pmLon = 7,
pmLat = 8,
pmObject = 9,
pmAspect = 10,
pmSystem = 11,
pmSign = 12,
pmColor = 13,
};
/* PC mouse flags */
enum _mouseflags {
mfLeft = 0x01,
mfRight = 0x02,
mfMiddle = 0x04,
};
/* Termination codes */
enum _terminationcode {
tcError = -1,
tcOK = 0,
tcFatal = 1,
tcForce = 2,
};
#ifndef _ZRES256COLOR
#define _ZRES256COLOR 263
#endif
/*
******************************************************************************
** Macro Functions.
******************************************************************************
*/
#define BLo(w) ((byte)(w))
#define BHi(w) ((byte)((word)(w) >> 8 & 0xFF))
#define WLo(l) ((word)(dword)(l))
#define WHi(l) ((word)((dword)(l) >> 16 & 0xFFFF))
#define WFromBB(bLo, bHi) ((word)BLo(bLo) | (word)((byte)(bHi)) << 8)
#define LFromWW(wLo, wHi) ((dword)WLo(wLo) | (dword)((word)(wHi)) << 16)
#define LFromBB(b1, b2, b3, b4) LFromWW(WFromBB(b1, b2), WFromBB(b3, b4))
#define RGBR(l) BLo(l)
#define RGBG(l) BHi(l)
#define RGBB(l) ((byte)((dword)(l) >> 16 & 0xFF))
#define ChHex(n) (char)((n) < 10 ? '0' + (n) : 'a' + (n) - 10)
#define VgaFromEga(x) NMultDiv((x), 480, 350)
#define VgaFromCga(x) NMultDiv((x), 480, 200)
#define Max(v1, v2) ((v1) > (v2) ? (v1) : (v2))
#define Min(v1, v2) ((v1) < (v2) ? (v1) : (v2))
#define NSgn(n) ((n) < 0 ? -1 : (n) > 0)
#define RSgn2(r) ((r) < 0.0 ? -1.0 : 1.0)
#define FBetween(v, v1, v2) ((v) >= (v1) && (v) <= (v2))
#define RFract(r) ((r) - RFloor(r))
#define ChCap(ch) ((ch) >= 'a' && (ch) <= 'z' ? (ch) - 'a' + 'A' : (ch))
#define ChUncap(ch) (FCapCh(ch) ? (ch) - 'A' + 'a' : (ch))
#define FCapCh(ch) ((ch) >= 'A' && (ch) <= 'Z')
#define FNumCh(ch) ((ch) >= '0' && (ch) <= '9')
#define NMultDiv(n1, n2, n3) ((int)((long)(n1) * (n2) / (n3)))
#define Ratio(v1, v2, v3) ((v1) + ((v2) - (v1)) * (v3))
#define ZFromS(s) ((real)(((s)-1)*30))
#define SFromZ(r) (((int)(r))/30+1)
#define RFromD(r) ((r)/rDegRad)
#define DFromR(r) ((r)*rDegRad)
#define GFromO(o) ((rDegMax - (o))/10.0)
#define RAbs(r) fabs(r)
#define NAbs(n) abs(n)
#define RFloor(r) floor(r)
#define NFloor(r) ((int)RFloor(r))
#define RSqr(r) sqrt(r)
#define RSin(r) sin(r)
#define RCos(r) cos(r)
#define RTan(r) tan(r)
#define RAtn(r) atan(r)
#define RAsin(r) asin(r)
#define RAcos(r) acos(r)
#define RSinD(r) RSin(RFromD(r))
#define RCosD(r) RCos(RFromD(r))
#define NSinD(nR, nD) ((int)((real)(nR)*RSinD((real)nD)))
#define NCosD(nR, nD) ((int)((real)(nR)*RCosD((real)nD)))
#define FItem(obj) FBetween(obj, 0, cObj)
#define FNorm(obj) FBetween(obj, 0, oNorm)
#define FCusp(obj) FBetween(obj, cuspLo, cuspHi)
#define FAngle(obj) (FCusp(obj) && ((obj)-cuspLo)%3 == 0)
#define FMinor(obj) (FCusp(obj) && ((obj)-cuspLo)%3 != 0)
#define FUranian(obj) FBetween(obj, uranLo, uranHi)
#define FStar(obj) FBetween(obj, starLo, starHi)
#define FObject(obj) ((obj) <= oVes || (obj) >= uranLo)
#define FThing(obj) ((obj) <= cThing || (obj) >= uranLo)
#define FHelio(obj) (FNorm(obj) && FObject(obj) && (obj) != oMoo)
#define FAspect(asp) FBetween(asp, 1, us.nAsp)
#define FSector(s) FBetween(s, 1, cSector)
#define ChDst(dst) (dst == 0.0 ? 'S' : (dst == 1.0 ? 'D' : 'A'))
#define ChDashF(f) (f ? '=' : '_')
#define SzNumF(f) (f ? "1 " : "0 ")
#define DayInYearHi(yea) (365-28+DayInMonth(2, yea))
#define FChSwitch(ch) \
((ch) == '-' || (ch) == '/' || (ch) == '_' || (ch) == '=' || (ch) == ':')
#define FValidMon(mon) FBetween(mon, 1, 12)
#define FValidDay(day, mon, yea) ((day) >= 1 && (day) <= DayInMonth(mon, yea))
#define FValidYea(yea) FBetween(yea, -20000, 20000)
#define FValidTim(tim) ((tim) > -2.0 && (tim) < 24.0 && \
RFract(RAbs(tim)) < 0.60)
#define FValidDst(dst) FValidZon(dst)
#define FValidZon(zon) FBetween(zon, -24.0, 24.0)
#define FValidLon(lon) FBetween(lon, -rDegHalf, rDegHalf)
#define FValidLat(lat) FBetween(lat, -rDegQuad, rDegQuad)
#define FValidAspect(asp) FBetween(asp, 0, cAspect)
#define FValidSystem(n) FBetween(n, 0, cSystem-1)
#define FValidDivision(n) FBetween(n, 1, 2880)
#define FValidOffset(r) FBetween(r, -rDegMax, rDegMax)
#define FValidCenter(obj) \
(FBetween(obj, oEar, uranHi) && FObject(obj) && (obj) != oMoo)
#define FValidHarmonic(n) FBetween(n, 1, 30000)
#define FValidWheel(n) FBetween(n, 1, WHEELROWS)
#define FValidAstrograph(n) (n > 0 && 160%n == 0)
#define FValidPart(n) FBetween(n, 1, cPart)
#define FValidBioday(n) FBetween(n, 1, 199)
#define FValidScreen(n) FBetween(n, 20, 200)
#define FValidMacro(n) FBetween(n, 1, 48)
#define FValidTextrows(n) ((n) == 25 || (n) == 43 || (n) == 50)
#define FValidGlyphs(n) FBetween(n, 0, 2232)
#define FValidGrid(n) FBetween(n, 1, cObj)
#define FValidEsoteric(n) FBetween(n, 1, 32000)
#define FValidScale(n) (FBetween(n, 100, MAXSCALE) && (n)%100 == 0)
#define FValidGraphx(x) (FBetween(x, BITMAPX1, BITMAPX) || (x) == 0)
#define FValidGraphy(y) (FBetween(y, BITMAPY1, BITMAPY) || (y) == 0)
#define FValidRotation(n) FBetween(n, 0, nDegMax-1)
#define FValidTilt(n) FBetween(n, -rDegQuad, rDegQuad)
#define FValidColor(n) FBetween(n, 0, cColor - 1)
#define FValidBmpmode(ch) \
((ch) == 'N' || (ch) == 'C' || (ch) == 'V' || (ch) == 'A' || (ch) == 'B')
#define FValidTimer(n) FBetween(n, 1, 32000)
#define chSig3(A) szSignName[A][0], szSignName[A][1], szSignName[A][2]
#define chObj3(A) szObjName[A][0], szObjName[A][1], szObjName[A][2]
#define chMon3(A) szMonth[A][0], szMonth[A][1], szMonth[A][2]
#define chDay3(A) szDay[A][0], szDay[A][1], szDay[A][2]
#define kSignA(s) kObjA[cuspLo-1+(s)]
#define kSignB(s) kObjB[cuspLo-1+(s)]
#define kModeA(m) kElemA[m <= 1 ? m : eWat]
#define szPerson (ciMain.nam[0] ? ciMain.nam : "This person")
#define szPerson0 (ciMain.nam[0] ? ciMain.nam : "the person")
#define szPerson1 (ciMain.nam[0] ? ciMain.nam : "Person1")
#define szPerson2 (ciTwin.nam[0] ? ciTwin.nam : "Person2")
#define FIgnore(i) ignore[i]
#define FIgnore2(i) ignore2[i]
#define fNoTimeOrSpace (Mon == -1)
#define loop for (;;)
#define inv(v) v = !(v)
#define neg(v) v = -(v)
#define PrintL() PrintCh('\n')
#define PrintL2() PrintSz("\n\n")
#define PrintF(sz) fprintf(file, sz)
#define PrintFSz() fprintf(file, sz)
#define SwapN(n1, n2) (n1)^=(n2)^=(n1)^=(n2)
#define FSwitchF(f) ((((f) | fOr) & !fAnd) ^ fNot)
#define SwitchF(f) f = FSwitchF(f)
#define SwitchF2(f) f = (((f) | (fOr || fNot)) & !fAnd)
#define SetCI(ci, M, D, Y, T, S, Z, O, A) \
ci.mon = M; ci.day = D; ci.yea = Y; \
ci.tim = T; ci.dst = S; ci.zon = Z; ci.lon = O; ci.lat = A
#define CONST const
#define AllocateNear(p, cb) (p) = (char *)malloc(cb)
#define AllocateFar(p, cb) (p) = (byte *)malloc(cb)
#define AllocateHuge(p, cb) (p) = (byte *)malloc(cb)
#define DeallocateNear(p) free(p)
#define DeallocateFar(p) DeallocateNear(p)
#define DeallocateHuge(p) DeallocateFar(p)
#ifndef PC
#define chDirSep '/'