MCPcopy Create free account
hub / github.com/WheretIB/nullc / FillFunctionPointerInfo

Function FillFunctionPointerInfo

SuperCalc.cpp:1220–1294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1218}
1219
1220void FillFunctionPointerInfo(const ExternTypeInfo& type, char* ptr, HTREEITEM parent)
1221{
1222 TVINSERTSTRUCT helpInsert;
1223 helpInsert.hParent = parent;
1224 helpInsert.hInsertAfter = TVI_LAST;
1225 helpInsert.item.mask = TVIF_TEXT;
1226 helpInsert.item.cchTextMax = 0;
1227 char name[256];
1228
1229 if(nullcGetCurrentExecutor(NULL) == NULLC_X86)
1230 return;
1231
1232 ExternFuncInfo &func = codeFunctions[*(int*)(ptr + 4)];
1233 ExternTypeInfo &returnType = codeTypes[codeTypeExtra[type.memberOffset]];
1234
1235 char *it = name;
1236 it += safeprintf(it, 256 - int(it - name), "function %d %s %s(", *(int*)(ptr + 4), codeSymbols + returnType.offsetToName, codeSymbols + func.offsetToName);
1237 for(unsigned int arg = 0; arg < func.paramCount; arg++)
1238 {
1239 ExternLocalInfo &lInfo = codeLocals[func.offsetToFirstLocal + arg];
1240 it += safeprintf(it, 256 - int(it - name), "%s %s%s", codeSymbols + codeTypes[lInfo.type].offsetToName, codeSymbols + lInfo.offsetToName, arg == func.paramCount - 1 ? "" : ", ");
1241 }
1242 it += safeprintf(it, 256 - int(it - name), ")");
1243
1244 helpInsert.item.pszText = name;
1245 TreeView_InsertItem(hVars, &helpInsert);
1246
1247 safeprintf(name, 256, "%s context = 0x%x", func.parentType == ~0u ? "void ref" : codeSymbols + codeTypes[func.parentType].offsetToName, *(int*)(ptr));
1248 helpInsert.item.pszText = name;
1249 HTREEITEM contextList = TreeView_InsertItem(hVars, &helpInsert);
1250
1251 TVINSERTSTRUCT nextInsert;
1252 nextInsert.hParent = contextList;
1253 nextInsert.hInsertAfter = TVI_LAST;
1254 nextInsert.item.mask = TVIF_TEXT;
1255 nextInsert.item.cchTextMax = 0;
1256
1257 ExternFuncInfo::Upvalue *upvalue = *(ExternFuncInfo::Upvalue**)(ptr);
1258 if(!upvalue || !upvalue->ptr)
1259 {
1260 InsertUnavailableInfo(contextList);
1261 return;
1262 }
1263 if(func.parentType != ~0u)
1264 {
1265 if(func.externCount)
1266 {
1267 FillVariableInfo(codeTypes[codeTypes[func.parentType].subType], (char*)upvalue, contextList, false);
1268 }else{
1269 FillVariableInfo(codeTypes[func.parentType], (char*)upvalue, contextList, false);
1270 return;
1271 }
1272 }
1273
1274 ExternLocalInfo *externals = &codeLocals[func.offsetToFirstLocal + func.localCount];
1275 for(unsigned int i = 0; i < func.externCount; i++)
1276 {
1277 char *it = name;

Callers 1

FillVariableInfoFunction · 0.85

Calls 5

nullcGetCurrentExecutorFunction · 0.85
safeprintfFunction · 0.85
InsertUnavailableInfoFunction · 0.85
FillVariableInfoFunction · 0.85
GetBasicVariableInfoFunction · 0.85

Tested by

no test coverage detected