MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / checkvaltype

Function checkvaltype

src/debug.cpp:1124–1232  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1122}
1123
1124static int checkvaltype(TCHAR **cp, uae_u32 *val, debugfloatx80 *valx80, int *size, TCHAR def)
1125{
1126 TCHAR form[256], *p;
1127#ifdef AMIBERRY
1128 int remaining_bufsize;
1129#endif
1130 bool gotop = false;
1131 bool copyrest = false;
1132 double out;
1133 int sizetype = -1;
1134 TCHAR *startp = NULL;
1135 debugfloatx80 vx80 = { 0 };
1136 int outret = 1;
1137
1138 form[0] = 0;
1139 if (size) {
1140 *size = 0;
1141 }
1142 p = form;
1143 for (;;) {
1144 uae_u32 v;
1145 int ret = checkvaltype2(cp, &v, &vx80, def);
1146 if (!ret) {
1147 if (isoperator(cp) || gotop || **cp == '\"' || **cp == '\'') {
1148 goto docalc;
1149 }
1150 return 0;
1151 }
1152 if (ret == 1 || ret == -1) {
1153 *val = v;
1154#ifdef AMIBERRY
1155 remaining_bufsize = sizeof(form) - (p - &form[0])*sizeof(TCHAR);
1156#endif
1157 // stupid but works!
1158 _sntprintf(p, remaining_bufsize, _T("%u"), v);
1159#ifdef WITH_SOFTFLOAT
1160 } else {
1161 *val = 0;
1162 *valx80 = vx80;
1163#ifdef AMIBERRY
1164 remaining_bufsize = sizeof(form) - (p - &form[0])*sizeof(TCHAR);
1165#endif
1166 _sntprintf(p, remaining_bufsize, _T("%f"), f80todouble(vx80));
1167 if (size) {
1168 *size = NUMTYTPE_X;
1169 }
1170 outret = -1;
1171#endif
1172 }
1173 p += _tcslen (p);
1174 *p = 0;
1175 if (peekchar(cp) == '.') {
1176 readchar(cp);
1177 if (size) {
1178 *size = readsize(v, cp);
1179 }
1180 }
1181 TCHAR *cpb = *cp;

Callers 1

readnumFunction · 0.85

Calls 10

checkvaltype2Function · 0.85
isoperatorFunction · 0.85
f80todoubleFunction · 0.85
peekcharFunction · 0.85
readcharFunction · 0.85
readsizeFunction · 0.85
ignore_wsFunction · 0.85
more_params2Function · 0.85
calcFunction · 0.70
console_out_fFunction · 0.50

Tested by

no test coverage detected