MCPcopy Create free account
hub / github.com/TASEmulators/fceux / loadFileNL

Method loadFileNL

src/debugsymboltable.cpp:464–708  ·  view source on GitHub ↗

--------------------------------------------------------------

Source from the content-addressed store, hash-verified

462}
463//--------------------------------------------------------------
464int debugSymbolTable_t::loadFileNL( int bank )
465{
466 FILE *fp;
467 int i, j, ofs, lineNum = 0, literal = 0, array = 0;
468 std::string fileName;
469 char stmp[512], line[512];
470 debugSymbolPage_t *page = nullptr;
471 debugSymbol_t *sym = nullptr;
472 FCEU::autoScopedLock alock(cs);
473
474 //printf("Looking to Load Debug Bank: $%X \n", bank );
475
476 if ( generateNLFilenameForBank( bank, fileName ) )
477 {
478 return -1;
479 }
480 //printf("Loading NL File: %s\n", fileName.c_str() );
481
482 fp = ::fopen( fileName.c_str(), "r" );
483
484 if ( fp == nullptr )
485 {
486 return -1;
487 }
488 page = new debugSymbolPage_t(bank);
489
490 pageMap[ page->pageNum() ] = page;
491
492 while ( fgets( line, sizeof(line), fp ) != 0 )
493 {
494 i=0; lineNum++;
495 //printf("%4i:%s", lineNum, line );
496
497 if ( line[i] == '\\' )
498 {
499 // Line is a comment continuation line.
500 i++;
501
502 j=0;
503 stmp[j] = '\n'; j++;
504
505 while ( line[i] != 0 )
506 {
507 stmp[j] = line[i]; j++; i++;
508 }
509 stmp[j] = 0;
510
511 j--;
512 while ( j >= 0 )
513 {
514 if ( isspace( stmp[j] ) )
515 {
516 stmp[j] = 0;
517 }
518 else
519 {
520 break;
521 }

Callers

nothing calls this directly

Calls 6

isspaceClass · 0.85
FCEU_printfFunction · 0.85
pageNumMethod · 0.80
addSymbolMethod · 0.80
nameMethod · 0.45

Tested by

no test coverage detected