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

Function FillArrayVariableInfo

SuperCalc.cpp:1007–1084  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1005}
1006
1007void FillArrayVariableInfo(const ExternTypeInfo& type, char* ptr, HTREEITEM parent, bool update)
1008{
1009 TVINSERTSTRUCT helpInsert;
1010 helpInsert.hParent = parent;
1011 helpInsert.hInsertAfter = TVI_LAST;
1012 helpInsert.item.mask = TVIF_TEXT;
1013 helpInsert.item.cchTextMax = 0;
1014
1015 HTREEITEM child = update ? TreeView_GetChild(hWatch, parent) : NULL;
1016
1017 char name[256];
1018 HTREEITEM lastItem;
1019
1020 ExternTypeInfo &subType = codeTypes[type.subType];
1021 unsigned int arrSize = (type.arrSize == ~0u) ? *(unsigned int*)(ptr + 4) : type.arrSize;
1022 if(type.arrSize == ~0u)
1023 {
1024 arrSize = *(unsigned int*)(ptr + 4);
1025 TVITEM item;
1026 item.mask = TVIF_PARAM;
1027 item.lParam = tiExtra.size();
1028 item.hItem = parent;
1029 tiExtra.push_back(TreeItemExtra((void*)ptr, &type, parent, true));
1030 TreeView_SetItem(hVars, &item);
1031 return;
1032 }
1033 if(type.defaultAlign == 0xff)
1034 {
1035 safeprintf(name, 256, "base: %p", ptr);
1036 helpInsert.item.mask = TVIF_TEXT;
1037 helpInsert.item.pszText = name;
1038 HTREEITEM lastItem;
1039 lastItem = TreeView_InsertItem(hVars, &helpInsert);
1040 }
1041 for(unsigned int i = 0; i < arrSize; i++, ptr += subType.size)
1042 {
1043 if(i > 100)
1044 break;
1045 char *it = name;
1046 memset(name, 0, 256);
1047
1048 it += safeprintf(it, 256 - int(it - name), "[%d]: ", i);
1049
1050 if(subType.subCat == ExternTypeInfo::CAT_NONE || subType.subCat == ExternTypeInfo::CAT_POINTER)
1051 it += safeprintf(it, 256 - int(it - name), " %s", GetBasicVariableInfo(subType, ptr));
1052 else if(&subType == &codeTypes[8]) // for typeid
1053 it += safeprintf(it, 256 - int(it - name), " = %s", *(unsigned*)(ptr) < codeTypeCount ? codeSymbols + codeTypes[*(int*)(ptr)].offsetToName : "invalid: out of range");
1054
1055 helpInsert.item.mask = TVIF_TEXT | TVIF_CHILDREN | TVIF_PARAM;
1056 helpInsert.item.pszText = name;
1057 helpInsert.item.cChildren = subType.subCat == ExternTypeInfo::CAT_POINTER ? I_CHILDRENCALLBACK : (subType.subCat == ExternTypeInfo::CAT_NONE ? 0 : 1);
1058 helpInsert.item.lParam = subType.subCat == ExternTypeInfo::CAT_POINTER ? tiExtra.size() : 0;
1059 if(subType.subCat == ExternTypeInfo::CAT_POINTER)
1060 tiExtra.push_back(TreeItemExtra());
1061
1062 HTREEITEM lastItem;
1063 if(update)
1064 {

Callers 3

FillAutoArrayInfoFunction · 0.85
FillVariableInfoFunction · 0.85
WndProcFunction · 0.85

Calls 6

TreeItemExtraClass · 0.85
safeprintfFunction · 0.85
GetBasicVariableInfoFunction · 0.85
FillVariableInfoFunction · 0.85
sizeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected