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

Function FProcessAAFFile

io.cpp:449–568  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

447// a file name or a file handle.
448
449flag FProcessAAFFile(CONST char *szFile, FILE *file)
450{
451 char szLine[cchSzLine], sz[cchSzMax], *pch, *sz1, *sz2, ch;
452 int i, grf;
453 flag fHaveFile, fRet = fFalse;
454
455 fHaveFile = (file != NULL);
456 if (!fHaveFile) {
457 file = FileOpen(szFile, 0, NULL);
458 if (file == NULL)
459 goto LDone;
460 }
461 is.fileIn = file;
462 do {
463
464 grf = 0;
465 while (grf != 3) {
466 while (!feof(file) && (ch = getc(file)) < ' ')
467 ;
468 if (feof(file))
469 break;
470 for (szLine[0] = ch, i = 1; i < cchSzLine-1 && !feof(file) &&
471 (uchar)(szLine[i] = getc(file)) >= ' '; i++)
472 ;
473 szLine[i] = chNull;
474 if (szLine[0] == chNull)
475 continue;
476 if (szLine[0] != '#') {
477 sprintf(szLine,
478 "The AAF file '%s' has a line not starting with '#' (character %d).",
479 szFile, (int)ch);
480 PrintWarning(szLine);
481 goto LDone;
482 }
483 if (szLine[1] == ':') // Skip over comment lines
484 continue;
485
486 // Input row #1.
487 if (FEqRgch(szLine, "#A93:", 5, fFalse)) {
488 sz1 = pch = szLine + 5;
489 AdvancePast(',');
490 pch[-1] = chNull;
491 sz2 = pch;
492 AdvancePast(',');
493 pch[-1] = chNull;
494 if (*sz1 && !FEqSz(sz1, "*"))
495 sprintf(sz, "%s %s", sz2, sz1);
496 else
497 sprintf(sz, "%s", sz2);
498 ciCore.nam = SzClone(sz);
499 AdvancePast(',');
500 DD = NFromSz(pch);
501 AdvancePast('.');
502 MM = NParseSz(pch, pmMon);
503 AdvancePast('.');
504 YY = NParseSz(pch, pmYea);
505 AdvancePast(',');
506 sz1 = pch;

Callers 1

FInputDataFunction · 0.85

Calls 8

FileOpenFunction · 0.85
PrintWarningFunction · 0.85
FEqRgchFunction · 0.85
SzCloneFunction · 0.85
NFromSzFunction · 0.85
NParseSzFunction · 0.85
RParseSzFunction · 0.85
FAppendCIListFunction · 0.85

Tested by

no test coverage detected