11/*
2- ** Astrolog (Version 7.70 ) File: astrolog.cpp
2+ ** Astrolog (Version 7.80 ) File: astrolog.cpp
33**
44** IMPORTANT NOTICE: Astrolog and all chart display routines and anything
5- ** not enumerated below used in this program are Copyright (C) 1991-2024 by
5+ ** not enumerated below used in this program are Copyright (C) 1991-2025 by
66** Walter D. Pullen (Astara@msn.com, http://www.astrolog.org/astrolog.htm).
77** Permission is granted to freely use, modify, and distribute these
88** routines provided these credits and notices remain unmodified with any
4848** Initial programming 8/28-30/1991.
4949** X Window graphics initially programmed 10/23-29/1991.
5050** PostScript graphics initially programmed 11/29-30/1992.
51- ** Last code change made 4/22/2024 .
51+ ** Last code change made 6/19/2025 .
5252*/
5353
5454#include " astrolog.h"
@@ -527,6 +527,16 @@ int NProcessSwitchesRare(int argc, char **argv, int pos,
527527 SwitchF (us.fRound );
528528 break ;
529529
530+ case ' w' :
531+ if (FErrorArgc (" Yw" , argc, 1 ))
532+ return tcError;
533+ r = RFromSz (argv[1 ]);
534+ if (FErrorValR (" Yw" , r < 0.0 , r, 0 ))
535+ return tcError;
536+ us.rStation = r;
537+ darg++;
538+ break ;
539+
530540 case ' C' :
531541 SwitchF (us.fSmartCusp );
532542 break ;
@@ -606,6 +616,9 @@ int NProcessSwitchesRare(int argc, char **argv, int pos,
606616 if (ch1 == ' 0' && fAnd ) {
607617 us.rDeltaT = rInvalid;
608618 break ;
619+ } else if (ch1 == ' 1' ) {
620+ SwitchF (us.fOffsetOnly );
621+ break ;
609622 }
610623 if (FErrorArgc (" Yz" , argc, 1 ))
611624 return tcError;
@@ -689,7 +702,7 @@ int NProcessSwitchesRare(int argc, char **argv, int pos,
689702 if (j > 0 )
690703 ch1 = ch2;
691704 k = (j == 2 ? NParseSz (argv[2 ], pmObject) : NFromSz (argv[2 ]));
692- if (FErrorValN (" Ye" , k <= 0 && j < 4 , k, 2 ))
705+ if (FErrorValN (" Ye" , k < ( int )(j != 2 ) && j < 4 , k, 2 ))
693706 return tcError;
694707 rgObjSwiss[i] = k;
695708 rgTypSwiss[i] = j;
@@ -787,24 +800,10 @@ int NProcessSwitchesRare(int argc, char **argv, int pos,
787800 darg++;
788801 break ;
789802 } else if (ch1 == ' o' ) {
790- CopyRgb (ignore, ignoreMem, sizeof (ignore));
791- CopyRgb (ignore2, ignore2Mem, sizeof (ignore2));
792- CopyRgb (ignorea, ignoreaMem, sizeof (ignorea));
793- CopyRgb (ignorez, ignorezMem, sizeof (ignorez));
794- CopyRgb (ignore7, ignore7Mem, sizeof (ignore7));
795- ignorefMem[0 ] = us.fIgnoreSign ; ignorefMem[1 ] = us.fIgnoreDir ;
796- ignorefMem[2 ] = us.fIgnoreDiralt ; ignorefMem[3 ] = us.fIgnoreDirlen ;
797- ignorefMem[4 ] = us.fIgnoreAlt0 ; ignorefMem[5 ] = us.fIgnoreDisequ ;
803+ InitRestrictions (fTrue );
798804 break ;
799805 } else if (ch1 == ' i' ) {
800- CopyRgb (ignoreMem, ignore, sizeof (ignore));
801- CopyRgb (ignore2Mem, ignore2, sizeof (ignore2));
802- CopyRgb (ignoreaMem, ignorea, sizeof (ignorea));
803- CopyRgb (ignorezMem, ignorez, sizeof (ignorez));
804- CopyRgb (ignore7Mem, ignore7, sizeof (ignore7));
805- us.fIgnoreSign = ignorefMem[0 ]; us.fIgnoreDir = ignorefMem[1 ];
806- us.fIgnoreDiralt = ignorefMem[2 ]; us.fIgnoreDirlen = ignorefMem[3 ];
807- us.fIgnoreAlt0 = ignorefMem[4 ]; us.fIgnoreDisequ = ignorefMem[5 ];
806+ InitRestrictions (fFalse );
808807 AdjustRestrictions ();
809808 break ;
810809 }
@@ -1325,9 +1324,10 @@ flag FProcessSwitches(int argc, char **argv)
13251324 // Switches which determine the type of chart to display:
13261325
13271326 case ' v' :
1328- if (ch1 == ' 0' )
1327+ if (ch1 == ' 0' ) {
13291328 SwitchF (us.fVelocity );
1330- else if (ch1 == ' 3' ) {
1329+ break ;
1330+ } else if (ch1 == ' 3' ) {
13311331 SwitchF (us.fListDecan );
13321332 if (argc > 1 && ((i = NFromSz (argv[1 ])) > 0 || FNumCh (argv[1 ][0 ]) ||
13331333 argv[1 ][0 ] == ' ~' )) {
@@ -1361,14 +1361,23 @@ flag FProcessSwitches(int argc, char **argv)
13611361 SwitchF (us.fGridConfig );
13621362 else if (ch1 == ' m' || ch2 == ' m' )
13631363 SwitchF (us.fGridMidpoint );
1364- if (ch1 == ' a' )
1365- us.nAppSep = FSwitchF (us.nAppSep );
1366- else if (ch1 == ' x' )
1367- us.nAppSep = FSwitchF (us.nAppSep ) * 2 ;
1368- else if (ch1 == ' p' )
1364+ if (ch1 == ' p' )
13691365 SwitchF (us.fParallel );
13701366 else if (ch1 == ' d' )
13711367 SwitchF (us.fDistance );
1368+ else if (ch1 == ' a' )
1369+ us.nAppSep = FSwitchF (us.nAppSep );
1370+ else if (ch1 == ' x' )
1371+ us.nAppSep = FSwitchF (us.nAppSep ) * 2 ;
1372+ else if (ch1 == ' s' ) {
1373+ if (FErrorArgc (" gs" , argc, 1 ))
1374+ return fFalse ;
1375+ i = NFromSz (argv[1 ]);
1376+ if (FErrorValN (" gs" , !FValidAppSep (i), i, 0 ))
1377+ return fFalse ;
1378+ us.nAppSep = i;
1379+ argc--; argv++;
1380+ }
13721381#ifdef X11
13731382 else if (ch1 == ' e' ) {
13741383 if (FErrorArgc (" geometry" , argc, 1 ))
@@ -1395,18 +1404,26 @@ flag FProcessSwitches(int argc, char **argv)
13951404 SwitchF (us.fAspSummary );
13961405 ch1 = ch2;
13971406 }
1398- if (ch1 == ' a' ) {
1399- us.nAppSep = FSwitchF (us.nAppSep );
1400- ch1 = ch2;
1401- } else if (ch1 == ' x' ) {
1402- us.nAppSep = FSwitchF (us.nAppSep ) * 2 ;
1403- ch1 = ch2;
1404- } else if (ch1 == ' p' ) {
1407+ if (ch1 == ' p' ) {
14051408 SwitchF (us.fParallel );
14061409 ch1 = ch2;
14071410 } else if (ch1 == ' d' ) {
14081411 SwitchF (us.fDistance );
14091412 ch1 = ch2;
1413+ } else if (ch1 == ' a' ) {
1414+ us.nAppSep = FSwitchF (us.nAppSep );
1415+ ch1 = ch2;
1416+ } else if (ch1 == ' x' ) {
1417+ us.nAppSep = FSwitchF (us.nAppSep ) * 2 ;
1418+ ch1 = ch2;
1419+ } else if (ch1 == ' s' ) {
1420+ if (FErrorArgc (" as" , argc, 1 ))
1421+ return fFalse ;
1422+ i = NFromSz (argv[1 ]);
1423+ if (FErrorValN (" as" , !FValidAppSep (i), i, 0 ))
1424+ return fFalse ;
1425+ us.nAppSep = i;
1426+ argc--; argv++;
14101427 }
14111428 switch (ch1) {
14121429 case ' j' : us.nAspectSort = asj; break ;
@@ -1594,8 +1611,8 @@ flag FProcessSwitches(int argc, char **argv)
15941611 if (j) {
15951612 ch1 = argv[1 ][0 ];
15961613 if (ch1) {
1597- us.nEphemRate =
1598- ch1 == ' h ' ? - 1 : (ch1 == ' m' ? 1 : (ch1 == ' y' ? 2 : 0 ));
1614+ us.nEphemRate = (ch1 == ' n ' ? - 2 : (ch1 == ' h ' ? - 1 :
1615+ (ch1 == ' m' ? 1 : (ch1 == ' y' ? 2 : 0 )) ));
15991616 i = NFromSz (&argv[1 ][1 ]);
16001617 us.nEphemFactor = Max (i, 1 );
16011618 }
@@ -2060,6 +2077,10 @@ flag FProcessSwitches(int argc, char **argv)
20602077 break ;
20612078
20622079 case ' i' :
2080+ if (ch1 == ' x' ) {
2081+ SwapTemp (ciCore, ciTwin, ci);
2082+ break ;
2083+ }
20632084 if (us.fNoRead ) {
20642085 ErrorArgv (" i" );
20652086 return tcError;
@@ -2079,6 +2100,7 @@ flag FProcessSwitches(int argc, char **argv)
20792100 if (FBetween (ch1, ' 1' , ' 0' + cRing)) {
20802101 *rgpci[ch1 - ' 0' ] = ciCore;
20812102 ciCore = ci;
2103+ *rgpcp[ch1 - ' 0' ] = cp0;
20822104 } else if (ch1 == ' D' ) {
20832105 ciDefa = ciCore;
20842106 ciCore = ci;
@@ -2320,7 +2342,9 @@ flag FProcessSwitches(int argc, char **argv)
23202342 case ' b' :
23212343 if (ch1 == ' 0' ) {
23222344 SwitchF (us.fSeconds );
2323- is.fSeconds = us.fSeconds ;
2345+ break ;
2346+ } else if (ch1 == ' 1' ) {
2347+ SwitchF (us.fSecond1K );
23242348 break ;
23252349 } else if (ch1 == ' j' )
23262350 us.nSwissEph = FSwitchF (us.nSwissEph == 2 ) * 2 ;
@@ -2645,10 +2669,12 @@ flag FProcessSwitches(int argc, char **argv)
26452669 ciCore = ciTwin;
26462670 if (!FInputData (argv[2 ]))
26472671 return fFalse ;
2672+ cp2 = cp0;
26482673 ciTwin = ciCore;
26492674 ciCore = ci;
26502675 if (!FInputData (argv[1 ]))
26512676 return fFalse ;
2677+ cp1 = cp0;
26522678 if (i > 2 ) {
26532679 us.nRatio1 = NFromSz (argv[3 ]);
26542680 us.nRatio2 = NFromSz (argv[4 ]);
@@ -2926,6 +2952,33 @@ flag FProcessSwitches(int argc, char **argv)
29262952******************************************************************************
29272953*/
29282954
2955+ // Store or recall the current state of restrictions, as done with the -YRo
2956+ // and -YRi switches.
2957+
2958+ void InitRestrictions (flag fStore )
2959+ {
2960+ if (fStore ) {
2961+ CopyRgb (ignore, ignoreMem, sizeof (ignore));
2962+ CopyRgb (ignore2, ignore2Mem, sizeof (ignore2));
2963+ CopyRgb (ignorea, ignoreaMem, sizeof (ignorea));
2964+ CopyRgb (ignorez, ignorezMem, sizeof (ignorez));
2965+ CopyRgb (ignore7, ignore7Mem, sizeof (ignore7));
2966+ ignorefMem[0 ] = us.fIgnoreSign ; ignorefMem[1 ] = us.fIgnoreDir ;
2967+ ignorefMem[2 ] = us.fIgnoreDiralt ; ignorefMem[3 ] = us.fIgnoreDirlen ;
2968+ ignorefMem[4 ] = us.fIgnoreAlt0 ; ignorefMem[5 ] = us.fIgnoreDisequ ;
2969+ } else {
2970+ CopyRgb (ignoreMem, ignore, sizeof (ignore));
2971+ CopyRgb (ignore2Mem, ignore2, sizeof (ignore2));
2972+ CopyRgb (ignoreaMem, ignorea, sizeof (ignorea));
2973+ CopyRgb (ignorezMem, ignorez, sizeof (ignorez));
2974+ CopyRgb (ignore7Mem, ignore7, sizeof (ignore7));
2975+ us.fIgnoreSign = ignorefMem[0 ]; us.fIgnoreDir = ignorefMem[1 ];
2976+ us.fIgnoreDiralt = ignorefMem[2 ]; us.fIgnoreDirlen = ignorefMem[3 ];
2977+ us.fIgnoreAlt0 = ignorefMem[4 ]; us.fIgnoreDisequ = ignorefMem[5 ];
2978+ }
2979+ }
2980+
2981+
29292982// Initialize program variables and tables that aren't done so at compile
29302983// time. Called once when the program starts from main() or WinMain().
29312984
@@ -2940,14 +2993,7 @@ void InitProgram()
29402993 SetCI (ciDefa, MM, DD, YY, TT, 0 , DEFAULT_ZONE, DEFAULT_LONG, DEFAULT_LAT);
29412994 is.S = stdout;
29422995 ClearB ((pbyte)szStarCustom, sizeof (szStarCustom));
2943- CopyRgb (ignore, ignoreMem, sizeof (ignore));
2944- CopyRgb (ignore2, ignore2Mem, sizeof (ignore2));
2945- CopyRgb (ignorea, ignoreaMem, sizeof (ignorea));
2946- CopyRgb (ignorez, ignorezMem, sizeof (ignorez));
2947- CopyRgb (ignore7, ignore7Mem, sizeof (ignore7));
2948- ignorefMem[0 ] = us.fIgnoreSign ; ignorefMem[1 ] = us.fIgnoreDir ;
2949- ignorefMem[2 ] = us.fIgnoreDiralt ; ignorefMem[3 ] = us.fIgnoreDirlen ;
2950- ignorefMem[4 ] = us.fIgnoreAlt0 ; ignorefMem[5 ] = us.fIgnoreDisequ ;
2996+ InitRestrictions (fTrue );
29512997 for (i = 0 ; i < objMax; i++) {
29522998 szObjDisp[i] = szObjName[i];
29532999 rgobjList[i] = i;
@@ -3179,6 +3225,7 @@ void FinalizeProgram(flag fSkip)
31793225 DeallocatePIf (gi.bmpWorld .rgb );
31803226 DeallocatePIf (gi.bmpRising .rgb );
31813227 DeallocatePIf (gi.rgspace );
3228+ DeallocatePIf (gi.rgConstel );
31823229 DeallocatePIf (gi.szFileOut );
31833230 DeallocatePIf (gs.szSidebar );
31843231 for (i = 0 ; i <= cRing; i++)
@@ -3199,6 +3246,7 @@ void FinalizeProgram(flag fSkip)
31993246 DeallocatePIf (gi.rges );
32003247 DeallocatePIf (gs.szStarsLin );
32013248 DeallocatePIf (gs.szStarsLnk );
3249+ DeallocatePIf (is.rgesSort );
32023250#endif
32033251#endif // GRAPH
32043252#ifdef X11
0 commit comments