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

Function AddNewSymbolicName

src/drivers/win/debuggersp.cpp:1096–1281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1094}
1095
1096void AddNewSymbolicName(uint16 newAddress, char* newOffset, char* newName, char* newComment, int size, int init, bool nameOverwrite, bool commentHeadOnly, bool commentOverwrite)
1097{
1098 // remove all delimiterChars from name and comment
1099 char* pos = newName;
1100 while (pos < newName + strlen(newName))
1101 {
1102 pos = strstr(pos, delimiterChar);
1103 if (pos)
1104 strcpy(pos, pos + 1);
1105 else
1106 break;
1107 }
1108 pos = newComment;
1109 while (pos < newComment + strlen(newComment))
1110 {
1111 pos = strstr(pos, delimiterChar);
1112 if (pos)
1113 strcpy(pos, pos + 1);
1114 else
1115 break;
1116 }
1117
1118 if (*newName || *newComment)
1119 {
1120 int i = 0;
1121 char* tmpNewOffset = (char*)malloc(strlen(newOffset) + 1);
1122 strcpy(tmpNewOffset, newOffset);
1123 uint16 tmpNewAddress = newAddress;
1124 int tmpInit = init;
1125 do {
1126 Name* node = getNamesPointerForAddress(tmpNewAddress);
1127 if (!node)
1128 {
1129 node = (Name*)malloc(sizeof(Name));
1130 node->offset = (char*)malloc(strlen(tmpNewOffset) + 1);
1131 strcpy(node->offset, tmpNewOffset);
1132 node->offsetNumeric = tmpNewAddress;
1133
1134 // Node name
1135 if (strlen(newName))
1136 {
1137 if (size)
1138 {
1139 char arr_index[16];
1140 sprintf(arr_index, "[%X]", tmpInit);
1141 node->name = (char*)malloc(strlen(newName) + strlen(arr_index) + 1);
1142 strcpy(node->name, newName);
1143 strcat(node->name, arr_index);
1144 }
1145 else
1146 {
1147 node->name = (char*)malloc(strlen(newName) + 1);
1148 strcpy(node->name, newName);
1149 }
1150 }
1151 else
1152 node->name = 0;
1153

Callers 1

SymbolicNamingCallBFunction · 0.85

Calls 8

getBankIndexForAddressFunction · 0.85
addSymbolAtBankOffsetMethod · 0.80
getSymbolAtBankOffsetMethod · 0.80
updateNameMethod · 0.80
commentAssignMethod · 0.80
trimTrailingSpacesMethod · 0.80

Tested by

no test coverage detected