else // if(_class /*memberType*/.type != bitClass)
{
DataValue value { };
- if(_class.type == bitClass)
+ if(_class.type == bitClass && !memberType.noExpansion)
{
BitMember bitMember = (BitMember) member;
// TODO: Check if base type is 32 or 64 bit
if(memberType.type == noHeadClass || memberType.type == normalClass || memberType.type == structClass)
((void (*)(void *, void *))(void *)((Property)thisMember).Set)(data, value.p);
else
- ((void (*)(void *, int))(void *)((Property)thisMember).Set)(data, value.i);
+ {
+ // TODO: Complete and improve this type of stuff throughout
+ if(!strcmp(memberType.dataTypeString, "float"))
+ {
+ ((void (*)(void *, float))(void *)((Property)thisMember).Set)(data, value.f);
+ }
+ else if(!strcmp(memberType.dataTypeString, "double"))
+ {
+ ((void (*)(void *, double))(void *)((Property)thisMember).Set)(data, value.d);
+ }
+ else if(!strcmp(memberType.dataTypeString, "int64"))
+ {
+ ((void (*)(void *, int64))(void *)((Property)thisMember).Set)(data, value.i64);
+ }
+ else
+ {
+ ((void (*)(void *, int))(void *)((Property)thisMember).Set)(data, value.i);
+ }
+ }
}
}
}
{
int c;
int last = 0;
+ bool checkFor1 = true, checkFor9 = true;
int numDigits = 7, num = 1;
+ int first9 = 0;
char format[10];
+ char * dot;
+ int len;
while(numDigits && num < f) numDigits--, num *= 10;
sprintf(format, "%%.%df", numDigits);
//sprintf(string, "%f", f);
sprintf(string, format, f);
+ dot = strchr(string, '.');
- c = strlen(string)-1;
+ len = strlen(string);
+ c = len-1;
for( ; c >= 0; c--)
{
- if(string[c] != '0')
- last = Max(last, c);
- if(string[c] == '.')
+ char ch = string[c];
+ if(ch != '0' && dot)
+ {
+ if(ch == '1' && string + c - dot >= 6 && c == len - 1 && checkFor1)
+ checkFor1 = false;
+ else if(ch == '9' && string + c - dot >= 6 && c == len - 1 && checkFor9)
+ first9 = c;
+ else
+ {
+ last = Max(last, c);
+ checkFor9 = false;
+ checkFor1 = false;
+ }
+ }
+ if(ch == '.')
{
if(last == c)
string[c] = 0;
else
+ {
string[last+1] = 0;
+ if(first9)
+ {
+ while(--first9 > 0)
+ {
+ if(first9 != c)
+ if(string[first9] < '9')
+ {
+ string[first9]++;
+ break;
+ }
+ }
+ if(first9 < c)
+ {
+ string[c-1] = '1';
+ first9 = c;
+ }
+ string[first9] = 0;
+ }
+ }
break;
}
}