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

Method updateName

src/debugsymboltable.cpp:28–70  ·  view source on GitHub ↗

-------------------------------------------------------------- debugSymbol_t --------------------------------------------------------------

Source from the content-addressed store, hash-verified

26// debugSymbol_t
27//--------------------------------------------------------------
28int debugSymbol_t::updateName( const char *name, int arrayIndex )
29{
30 std::string newName;
31
32 newName.assign( name );
33
34 while ( newName.size() > 0 )
35 {
36 if ( isspace( newName.back() ) )
37 {
38 newName.pop_back();
39 }
40 else
41 {
42 break;
43 }
44 }
45
46 if (arrayIndex >= 0)
47 {
48 char stmp[32];
49
50 sprintf( stmp, "[%i]", arrayIndex );
51
52 newName.append(stmp);
53 }
54
55 if (page)
56 {
57 debugSymbol_t *dupSym = debugSymbolTable.getSymbol( page->pageNum(), newName );
58
59 if (!dbgSymAllowDuplicateNames && dupSym != nullptr && dupSym != this)
60 {
61 snprintf( dbgSymTblErrMsg, sizeof(dbgSymTblErrMsg), "Error: debug symbol '%s' already exists in %s page.\n", newName.c_str(), page->pageName() );
62 return -1;
63 }
64 }
65 _name = newName;
66
67 debugSymbolTable.updateSymbol(this);
68
69 return 0;
70}
71//--------------------------------------------------------------
72void debugSymbol_t::trimTrailingSpaces(void)
73{

Callers 3

AddNewSymbolicNameFunction · 0.80
execMethod · 0.80
setSymNameWithArrayMethod · 0.80

Calls 6

isspaceClass · 0.85
getSymbolMethod · 0.80
pageNumMethod · 0.80
pageNameMethod · 0.80
updateSymbolMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected