MCPcopy Create free account
hub / github.com/JACoders/OpenJK / ParseLine

Method ParseLine

code/qcommon/stringed_ingame.cpp:595–744  ·  view source on GitHub ↗

return is either NULL for good else error message to display...

Source from the content-addressed store, hash-verified

593// return is either NULL for good else error message to display...
594//
595const char *CStringEdPackage::ParseLine( const char *psLine )
596{
597 const char *psErrorMessage = NULL;
598
599 if (psLine)
600 {
601 if (CheckLineForKeyword( sSE_KEYWORD_VERSION, psLine ))
602 {
603 // VERSION "1"
604 //
605 const char *psVersionNumber = InsideQuotes( psLine );
606 int iVersionNumber = atoi( psVersionNumber );
607
608 if (iVersionNumber != iSE_VERSION)
609 {
610 psErrorMessage = va("Unexpected version number %d, expecting %d!\n", iVersionNumber, iSE_VERSION);
611 }
612 }
613 else
614 if ( CheckLineForKeyword(sSE_KEYWORD_CONFIG, psLine)
615 || CheckLineForKeyword(sSE_KEYWORD_FILENOTES, psLine)
616 || CheckLineForKeyword(sSE_KEYWORD_NOTES, psLine)
617 )
618 {
619 // not used ingame, but need to absorb the token
620 }
621 else
622 if (CheckLineForKeyword(sSE_KEYWORD_REFERENCE, psLine))
623 {
624 // REFERENCE GUARD_GOOD_TO_SEE_YOU
625 //
626 const char *psLocalReference = InsideQuotes( psLine );
627 AddEntry( psLocalReference );
628 }
629 else
630 if (CheckLineForKeyword(sSE_KEYWORD_FLAGS, psLine))
631 {
632 // FLAGS FLAG_CAPTION FLAG_TYPEMATIC
633 //
634 const char *psReference = GetCurrentReference_ParseOnly();
635 if (psReference[0])
636 {
637 static const char sSeperators[] = " \t";
638 char sFlags[1024]={0}; // 1024 chars should be enough to store 8 flag names
639 strncpy(sFlags, psLine, sizeof(sFlags)-1);
640 char *psToken = strtok( sFlags, sSeperators );
641 while( psToken != NULL )
642 {
643 // psToken = flag name (in caps)
644 //
645 Q_strupr(psToken); // jic
646 AddFlagReference( psReference, psToken );
647
648 // read next flag for this string...
649 //
650 psToken = strtok( NULL, sSeperators );
651 }
652 }

Callers 1

SE_Load_ActualFunction · 0.45

Calls 7

Q_struprFunction · 0.85
Q_stricmpnFunction · 0.85
Q_stricmpFunction · 0.85
vaFunction · 0.70
CopeWithDumbStringDataFunction · 0.70
Z_FreeFunction · 0.70
c_strMethod · 0.45

Tested by

no test coverage detected