NL file parsing fix for Qt Gui to properly load array variable entries. (#288)
* Ported over recent fix to PalettePoke function from windows to Qt. * NL file parsing fix for Qt Gui to properly load array variable entries.
This commit is contained in:
parent
8d1082b290
commit
fde7bfab9f
|
@ -298,7 +298,7 @@ int generateNLFilenameForBank(int bank, char *NLfilename)
|
||||||
int debugSymbolTable_t::loadFileNL( int bank )
|
int debugSymbolTable_t::loadFileNL( int bank )
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int i, j, ofs, lineNum = 0, literal = 0;
|
int i, j, ofs, lineNum = 0, literal = 0, array = 0;
|
||||||
char fileName[512], line[512];
|
char fileName[512], line[512];
|
||||||
char stmp[512];
|
char stmp[512];
|
||||||
debugSymbolPage_t *page = NULL;
|
debugSymbolPage_t *page = NULL;
|
||||||
|
@ -364,6 +364,8 @@ int debugSymbolTable_t::loadFileNL( int bank )
|
||||||
else if ( line[i] == '$' )
|
else if ( line[i] == '$' )
|
||||||
{
|
{
|
||||||
// Line is a new debug offset
|
// Line is a new debug offset
|
||||||
|
array = 0;
|
||||||
|
|
||||||
j=0; i++;
|
j=0; i++;
|
||||||
if ( !isxdigit( line[i] ) )
|
if ( !isxdigit( line[i] ) )
|
||||||
{
|
{
|
||||||
|
@ -377,6 +379,18 @@ int debugSymbolTable_t::loadFileNL( int bank )
|
||||||
|
|
||||||
ofs = strtol( stmp, NULL, 16 );
|
ofs = strtol( stmp, NULL, 16 );
|
||||||
|
|
||||||
|
if ( line[i] == '/' )
|
||||||
|
{
|
||||||
|
j=0; i++;
|
||||||
|
while ( isxdigit( line[i] ) )
|
||||||
|
{
|
||||||
|
stmp[j] = line[i]; i++; j++;
|
||||||
|
}
|
||||||
|
stmp[j] = 0;
|
||||||
|
|
||||||
|
array = strtol( stmp, NULL, 16 );
|
||||||
|
}
|
||||||
|
|
||||||
if ( line[i] != '#' )
|
if ( line[i] != '#' )
|
||||||
{
|
{
|
||||||
printf("Error: Missing field delimiter following offset $%X on Line %i of File %s\n", ofs, lineNum, fileName );
|
printf("Error: Missing field delimiter following offset $%X on Line %i of File %s\n", ofs, lineNum, fileName );
|
||||||
|
@ -484,10 +498,39 @@ int debugSymbolTable_t::loadFileNL( int bank )
|
||||||
|
|
||||||
sym->comment.assign( stmp );
|
sym->comment.assign( stmp );
|
||||||
|
|
||||||
if ( page->addSymbol( sym ) )
|
if ( array > 0 )
|
||||||
{
|
{
|
||||||
printf("Error: Failed to add symbol for offset $%04X Name '%s' on Line %i of File %s\n", ofs, stmp, lineNum, fileName );
|
debugSymbol_t *arraySym = NULL;
|
||||||
delete sym; sym = NULL; // Failed to add symbol
|
|
||||||
|
for (j=0; j<array; j++)
|
||||||
|
{
|
||||||
|
arraySym = new debugSymbol_t();
|
||||||
|
|
||||||
|
if ( arraySym )
|
||||||
|
{
|
||||||
|
arraySym->ofs = sym->ofs + j;
|
||||||
|
|
||||||
|
sprintf( stmp, "[%i]", j );
|
||||||
|
arraySym->name.assign( sym->name );
|
||||||
|
arraySym->name.append( stmp );
|
||||||
|
arraySym->comment.assign( sym->comment );
|
||||||
|
|
||||||
|
if ( page->addSymbol( arraySym ) )
|
||||||
|
{
|
||||||
|
printf("Error: Failed to add symbol for offset $%04X Name '%s' on Line %i of File %s\n", ofs, arraySym->name.c_str(), lineNum, fileName );
|
||||||
|
delete arraySym; arraySym = NULL; // Failed to add symbol
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete sym; sym = NULL; // Delete temporary symbol
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( page->addSymbol( sym ) )
|
||||||
|
{
|
||||||
|
printf("Error: Failed to add symbol for offset $%04X Name '%s' on Line %i of File %s\n", ofs, sym->name.c_str(), lineNum, fileName );
|
||||||
|
delete sym; sym = NULL; // Failed to add symbol
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue