MCPcopy Create free account
hub / github.com/CruiserOne/Astrolog / PrintS

Function PrintS

charts0.cpp:177–224  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

175// Unix's '-' or PC's '/', whichever is appropriate for system.
176
177void PrintS(CONST char *sz)
178{
179 char ch, ch1, ch2, ch3, ch4;
180 static char ch1Prev = chNull, ch2Prev = chNull, ch3Prev = chNull,
181 ch4Prev = chNull;
182
183 // Determine color for first part of line.
184 ch1 = sz[1]; ch2 = sz[2]; ch3 = sz[3]; ch4 = sz[4];
185 if (*sz != ' ')
186 AnsiColor(kRedA);
187 else if (ch1 != ' ')
188 AnsiColor(ch1 == 'P' || ch2 != ch2Prev ||
189 ((ch2 == 'Y' || ch2 == 'X' || ch2 == 'W' || ch2 == '~') &&
190 ch3 != ch3Prev) ||
191 (ch2 == 'Y' && ch3 == 'X' && ch4 != ch4Prev) ?
192 kGreenA : kDkGreenA);
193 else {
194 AnsiColor(kDefault);
195 PrintSz(" ");
196 }
197
198 // Print first part of line.
199 while ((ch = *sz) && ch != ':' &&
200 (ch1 != 'P' || (ch != ' ' || *(sz+1) != 't'))) {
201 if (ch != '_')
202 PrintCh(ch);
203 else
204 PrintCh(chSwitch);
205 sz++;
206 }
207 if (*sz)
208 PrintCh(*sz++);
209
210 // Print rest of line in default color.
211 AnsiColor(kDefault);
212 while (ch = *sz) {
213 if (ch != '_')
214 PrintCh(ch);
215 else
216 PrintCh(chSwitch);
217 sz++;
218 }
219 PrintL();
220
221 if (ch1 != ' ') {
222 ch1Prev = ch1; ch2Prev = ch2; ch3Prev = ch3; ch4Prev = ch4;
223 }
224}
225
226
227// Print a list of every command switch that can be passed to the program, and

Callers 5

DisplaySwitchesFunction · 0.85
DisplaySwitchesRareFunction · 0.85
DisplayKeysXFunction · 0.85
DisplaySwitchesXFunction · 0.85
DisplaySwitchesWFunction · 0.85

Calls 3

AnsiColorFunction · 0.85
PrintSzFunction · 0.85
PrintChFunction · 0.85

Tested by

no test coverage detected