7 __attribute__((unused)) static void UnusedFunction()
10 a.OnGetDataFromString(null);
11 a.OnGetString(null, 0, 0);
14 extern int __ecereVMethodID_class_OnGetDataFromString;
15 extern int __ecereVMethodID_class_OnGetString;
16 extern int __ecereVMethodID_class_OnFree;
19 public enum JSONResult { syntaxError, success, typeMismatch, noItem };
21 public enum SetBool : uint
25 /*public property bool // NOT WORKING!
27 set { return value ? true : false; }
28 get { return (this == true); }
33 public class JSONParser
41 while(!f.Eof() && (!ch || ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t'))
47 JSONResult GetValue(Class type, DataValue value)
49 JSONResult result = syntaxError;
55 result = GetString(&string);
59 if(type && (!strcmp(type.name, "String") || !strcmp(type.dataTypeString, "char *")))
63 else if(type && (type.type == enumClass || type.type == unitClass))
65 if(((bool (*)(void *, void *, const char *))(void *)type._vTbl[__ecereVMethodID_class_OnGetDataFromString])(type, &value.i, string))
68 result = typeMismatch;
71 else if(type && (prop = eClass_FindProperty(type, "String", type.module)))
73 // TOFIX: Add more conversion property support... Expecting void * compatible here
74 value.p = ((void *(*)())(void *)prop.Set)(string);
78 else if(type && (type.type == structClass))
80 if(((bool (*)(void *, void *, const char *))(void *)type._vTbl[__ecereVMethodID_class_OnGetDataFromString])(type, value.p, string))
83 result = typeMismatch;
89 result = typeMismatch;
96 if(type && eClass_IsDerived(type, class(Map)))
98 result = GetMap(type, (Map *)&array);
101 result = GetArray(type, &array);
103 if(result == success && type && eClass_IsDerived(type, class(Container)))
112 if(result != success)
113 result = typeMismatch;
116 else if(ch == '-' || isdigit(ch))
118 result = GetNumber(type, value);
122 void * object = value.p;
123 result = GetObject(type, &object);
126 if(type && type.type == structClass);
127 else if(type && (type.type == normalClass || type.type == noHeadClass || type.type == bitClass))
133 result = typeMismatch;
135 ((void (*)(void *, void *))(void *)type._vTbl[__ecereVMethodID_class_OnFree])(type, object);
143 while(c < sizeof(buffer)-1 && isalpha(ch))
146 if(!f.Getc(&ch)) break;
153 if(!strcmp(type.name, "bool"))
155 if(!strcmpi(buffer, "false")) value.i = 0;
156 else if(!strcmpi(buffer, "true")) value.i = 1;
158 result = typeMismatch;
160 else if(!strcmp(type.name, "SetBool"))
162 if(!strcmpi(buffer, "false")) value.i = SetBool::false;
163 else if(!strcmpi(buffer, "true")) value.i = SetBool::true;
165 result = typeMismatch;
167 else if(!strcmpi(buffer, "null"))
172 result = typeMismatch;
175 result = typeMismatch;
177 else if(ch == '}' || ch == ']')
182 JSONResult GetArray(Class type, Container * array)
184 JSONResult result = syntaxError;
189 *array = eInstance_New(type);
194 Class arrayType = null;
195 JSONResult itemResult;
197 if(eClass_IsDerived(type, class(Container)))
199 arrayType = type.templateArgs[0].dataTypeClass;
202 itemResult = GetValue(arrayType, value);
203 if(itemResult == success)
205 // TODO: Verify the matching between template type and uint64
207 if(arrayType.type == structClass)
209 t = (uint64)(uintptr)value.p;
211 else if(arrayType == class(double) || !strcmp(arrayType.dataTypeString, "double"))
213 t = value.ui64; //*(uint64 *)&value.d;
215 else if(arrayType == class(float) || !strcmp(arrayType.dataTypeString, "float"))
217 t = value.ui; //f*(uint *)&value.f;
219 else if(arrayType.typeSize == sizeof(int64) || !strcmp(arrayType.dataTypeString, "int64") ||
220 !strcmp(arrayType.dataTypeString, "unsigned int64") || !strcmp(arrayType.dataTypeString, "uint64"))
224 else if(arrayType.typeSize == sizeof(int) || !strcmp(arrayType.dataTypeString, "int") ||
225 !strcmp(arrayType.dataTypeString, "unsigned int") || !strcmp(arrayType.dataTypeString, "uint"))
229 else if(arrayType.typeSize == sizeof(short int) || !strcmp(arrayType.dataTypeString, "short") ||
230 !strcmp(arrayType.dataTypeString, "unsigned short") || !strcmp(arrayType.dataTypeString, "uint16") ||
231 !strcmp(arrayType.dataTypeString, "int16"))
235 else if(arrayType.typeSize == sizeof(byte) || !strcmp(arrayType.dataTypeString, "char") ||
236 !strcmp(arrayType.dataTypeString, "unsigned char") || !strcmp(arrayType.dataTypeString, "byte"))
242 t = (uint64)(uintptr)value.p;
244 ((void *(*)(void *, uint64))(void *)array->Add)(*array, t);
248 if(itemResult == typeMismatch)
251 PrintLn("Warning: Incompatible value for array value, expected ", (String)arrayType.name);
253 else if(itemResult == noItem)
259 if(result != syntaxError)
261 if(ch != ']' && ch != ',')
271 result = syntaxError;
279 JSONResult GetMap(Class type, Map * map)
281 JSONResult result = syntaxError;
286 Class mapNodeType = type.templateArgs[0].dataTypeClass;
287 Class keyType = mapNodeType.templateArgs[0].dataTypeClass;
288 Property keyProp = null;
289 if(keyType && !strcmp(keyType.dataTypeString, "char *"))
290 keyProp = eClass_FindProperty(mapNodeType, "key", mapNodeType.module);
292 *map = eInstance_New(type);
299 JSONResult itemResult;
301 itemResult = GetValue(mapNodeType, value);
302 if(itemResult == success)
304 String s = keyProp ? ((void * (*)(void *))(void *)keyProp.Get)(value.p) : null;
305 ((void *(*)(void *, uint64))(void *)map->Add)(*map, (uint64)(uintptr)value.p);
306 // Must free String keys here
311 if(itemResult == typeMismatch)
314 PrintLn("Warning: Incompatible value for array value, expected ", (String)mapNodeType.name);
316 else if(itemResult == noItem)
322 if(result != syntaxError)
324 if(ch != ']' && ch != ',')
334 result = syntaxError;
342 JSONResult GetString(String * string)
344 JSONResult result = syntaxError;
345 Array<char> buffer { minAllocSize = 256 };
346 bool escaped = false;
354 if(ch == '\\' && !escaped)
360 if(ch == 'b') ch = '\b';
361 else if(ch == 'f') ch = '\f';
362 else if(ch == 'n') ch = '\n';
363 else if(ch == 'r') ch = '\r';
364 else if(ch == 't') ch = '\t';
381 if(buffer.minAllocSize < buffer.count)
382 buffer.minAllocSize *= 2;
386 *string = CopyString(buffer.array);
390 if(ch != ',' && ch != '}')
395 public JSONResult GetObject(Class objectType, void ** object)
397 JSONResult result = syntaxError;
398 if(!objectType || objectType.type != structClass)
403 Class mapKeyClass = null, mapDataClass = null;
405 if(objectType && objectType.templateClass && eClass_IsDerived(objectType.templateClass, class(MapNode)))
407 mapKeyClass = objectType.templateArgs[0].dataTypeClass;
408 mapDataClass = objectType.templateArgs[2].dataTypeClass;
412 if(objectType && (objectType.type == noHeadClass || objectType.type == normalClass))
414 *object = eInstance_New(objectType);
416 else if(objectType && objectType.type != structClass)
418 *object = eSystem_New(objectType.typeSize);
425 if(GetString(&string))
427 DataMember member = null;
428 Property prop = null;
434 string[0] = (char)tolower(string[0]);
435 if(mapKeyClass && !strcmp(string, "key"))
437 prop = eClass_FindProperty(objectType, "key", objectType.module);
441 else if(mapDataClass && !strcmp(string, "value"))
443 prop = eClass_FindProperty(objectType, "value", objectType.module);
448 member = eClass_FindDataMember(objectType, string, objectType.module, null, null);
451 type = eSystem_FindClass(__thisModule, member.dataTypeString);
453 type = eSystem_FindClass(__thisModule.application, member.dataTypeString);
457 prop = eClass_FindProperty(objectType, string, objectType.module);
460 type = eSystem_FindClass(__thisModule, prop.dataTypeString);
462 type = eSystem_FindClass(__thisModule.application, prop.dataTypeString);
465 PrintLn("Warning: member ", string, " not found in class ", (String)objectType.name);
469 // Find Member in Object Class
473 if(type && type.type == structClass)
475 value.p = (byte *)*object + member._class.offset + member.offset;
481 JSONResult itemResult = GetValue(type, value);
482 if(itemResult != syntaxError)
488 PrintLn("warning: Unresolved data type ", member ? (String)member.dataTypeString : (String)prop.dataTypeString);
490 else if(itemResult == success)
495 // TOFIX: How to swiftly handle classes with base data type?
496 if(type.type == structClass)
498 else if(type.type == normalClass || type.type == noHeadClass)
500 void ** ptr = (void**)((byte *)*object + member._class.offset + member.offset);
501 if(eClass_IsDerived(type, class(Container)) && *ptr)
503 Container container = (Container)*ptr;
509 else if(type == class(double) || !strcmp(type.dataTypeString, "double"))
511 *(double *)((byte *)*object + member._class.offset + member.offset) = value.d;
513 else if(type == class(float) || !strcmp(type.dataTypeString, "float"))
515 *(float *)((byte *)*object + member._class.offset + member.offset) = value.f;
517 else if(type.typeSize == sizeof(int64) || !strcmp(type.dataTypeString, "int64") ||
518 !strcmp(type.dataTypeString, "unsigned int64") || !strcmp(type.dataTypeString, "uint64"))
520 *(uint64 *)((byte *)*object + member._class.offset + member.offset) = value.ui64;
522 else if(type.typeSize == sizeof(int) || !strcmp(type.dataTypeString, "int") ||
523 !strcmp(type.dataTypeString, "unsigned int") || !strcmp(type.dataTypeString, "uint"))
525 *(int *)((byte *)*object + member._class.offset + member.offset) = value.i;
527 else if(type.typeSize == sizeof(short int) || !strcmp(type.dataTypeString, "short") ||
528 !strcmp(type.dataTypeString, "unsigned short") || !strcmp(type.dataTypeString, "uint16") ||
529 !strcmp(type.dataTypeString, "int16"))
531 *(short *)((byte *)*object + member._class.offset + member.offset) = value.s;
533 else if(type.typeSize == sizeof(byte) || !strcmp(type.dataTypeString, "char") ||
534 !strcmp(type.dataTypeString, "unsigned char") || !strcmp(type.dataTypeString, "byte"))
536 *(char *)((byte *)*object + member._class.offset + member.offset) = value.c;
540 *(void **)((byte *)*object + member._class.offset + member.offset) = value.p;
543 else if(prop && prop.Set)
545 if(!strcmp(type.dataTypeString, "char *"))
547 ((void (*)(void *, void *))(void *)prop.Set)(*object, value.p);
551 // TOFIX: How to swiftly handle classes with base data type?
552 else if(type == class(double) || !strcmp(type.dataTypeString, "double"))
554 ((void (*)(void *, double))(void *)prop.Set)(*object, value.d);
556 else if(type == class(float) || !strcmp(type.dataTypeString, "float"))
558 ((void (*)(void *, float))(void *)prop.Set)(*object, value.f);
560 else if(type.typeSize == sizeof(int64) || !strcmp(type.dataTypeString, "int64") ||
561 !strcmp(type.dataTypeString, "unsigned int64") || !strcmp(type.dataTypeString, "uint64"))
563 ((void (*)(void *, uint64))(void *)prop.Set)(*object, value.ui64);
565 else if(type.typeSize == sizeof(int) || !strcmp(type.dataTypeString, "int") ||
566 !strcmp(type.dataTypeString, "unsigned int") || !strcmp(type.dataTypeString, "uint"))
568 ((void (*)(void *, int))(void *)prop.Set)(*object, value.i);
570 else if(type.typeSize == sizeof(short int) || !strcmp(type.dataTypeString, "short") ||
571 !strcmp(type.dataTypeString, "unsigned short") || !strcmp(type.dataTypeString, "uint16") ||
572 !strcmp(type.dataTypeString, "int16"))
574 ((void (*)(void *, short))(void *)prop.Set)(*object, value.s);
576 else if(type.typeSize == sizeof(byte) || !strcmp(type.dataTypeString, "char") ||
577 !strcmp(type.dataTypeString, "unsigned char") || !strcmp(type.dataTypeString, "byte"))
579 ((void (*)(void *, char))(void *)prop.Set)(*object, value.c);
583 ((void (*)(void *, void *))(void *)prop.Set)(*object, value.p);
589 PrintLn("Warning: Incompatible value for ", member ? (String)member.name : (String)prop.name,
590 ", expected ", member ? (String)member.dataTypeString : (String)prop.dataTypeString);
596 result = syntaxError;
599 else if(ch && ch != '}' && ch != ',')
600 result = syntaxError;
611 result = syntaxError;
619 JSONResult GetNumber(Class type, DataValue value)
621 JSONResult result = syntaxError;
624 while(c < sizeof(buffer)-1 && (ch == '-' || ch == '.' || tolower(ch) == 'e' || ch == '+' || isdigit(ch)))
627 if(!f.Getc(&ch)) break;
630 //if(strchr(buffer, '.'))
632 // TOFIX: How to swiftly handle classes with base data type?
633 if(type == class(double) || !strcmp(type.dataTypeString, "double"))
635 value.d = strtod(buffer, null);
638 else if(type == class(float) || !strcmp(type.dataTypeString, "float"))
640 value.f = (float)strtod(buffer, null);
643 // TOFIX: int64 looks for class long long?
644 //else if(type == class(int64) || !strcmp(type.dataTypeString, "int64"))
645 else if(!strcmp(type.dataTypeString, "int64"))
647 value.i64 = strtol(buffer, null, 10); // TOFIX: 64 bit support
650 else if(type == class(uint64) || !strcmp(type.dataTypeString, "uint64"))
652 value.ui64 = strtol(buffer, null, 10); // TOFIX: 64 bit support
657 value.i = strtol(buffer, null, 10);
664 bool WriteMap(File f, Class type, Map map, int indent)
670 MapIterator it { map = map };
671 Class mapNodeClass = map._class.templateArgs[0].dataTypeClass;
677 MapNode n = (MapNode)it.pointer;
682 for(i = 0; i<indent; i++) f.Puts(" ");
683 _WriteJSONObject(f, mapNodeClass, n, indent);
687 for(i = 0; i<indent; i++) f.Puts(" ");
695 bool WriteArray(File f, Class type, Container array, int indent)
701 Iterator it { array };
702 Class arrayType = type.templateArgs[0].dataTypeClass;
709 uint64 t = ((uint64(*)(void *, void *))(void *)array.GetData)(array, it.pointer);
716 // TODO: Verify the matching between template type and uint64
717 if(arrayType.type == structClass)
719 value.p = (void *)(uintptr)t;
721 else if(arrayType == class(double) || !strcmp(arrayType.dataTypeString, "double"))
724 //value.d = *(double *)&t;
726 else if(arrayType == class(float) || !strcmp(arrayType.dataTypeString, "float"))
729 //value.f = *(float *)&t;
731 else if(arrayType.typeSize == sizeof(int64) || !strcmp(arrayType.dataTypeString, "int64") ||
732 !strcmp(arrayType.dataTypeString, "unsigned int64") || !strcmp(arrayType.dataTypeString, "uint64"))
736 else if(arrayType.typeSize == sizeof(int) || !strcmp(arrayType.dataTypeString, "int") ||
737 !strcmp(arrayType.dataTypeString, "unsigned int") || !strcmp(arrayType.dataTypeString, "uint"))
741 else if(arrayType.typeSize == sizeof(short int) || !strcmp(arrayType.dataTypeString, "short") ||
742 !strcmp(arrayType.dataTypeString, "unsigned short") || !strcmp(arrayType.dataTypeString, "uint16") ||
743 !strcmp(arrayType.dataTypeString, "int16"))
747 else if(arrayType.typeSize == sizeof(byte) || !strcmp(arrayType.dataTypeString, "char") ||
748 !strcmp(arrayType.dataTypeString, "unsigned char") || !strcmp(arrayType.dataTypeString, "byte"))
754 value.p = (void *)(uintptr)t;
756 for(i = 0; i<indent; i++) f.Puts(" ");
757 WriteValue(f, arrayType, value, indent);
761 for(i = 0; i<indent; i++) f.Puts(" ");
769 bool WriteNumber(File f, Class type, DataValue value, int indent)
772 bool needClass = false;
774 if(type == class(double) || !strcmp(type.dataTypeString, "double"))
775 ((const char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, &value.d, buffer, 0, &needClass);
776 else if(type == class(float) || !strcmp(type.dataTypeString, "float"))
777 ((const char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, &value.f, buffer, null, &needClass);
778 else if(!strcmp(type.dataTypeString, "int64"))
779 ((const char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, &value.i64, buffer, null, &needClass);
780 else if(!strcmp(type.dataTypeString, "unsigned int64") || !strcmp(type.dataTypeString, "uint64") || type.typeSize == sizeof(int64))
781 ((const char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, &value.ui64, buffer, null, &needClass);
782 else if(!strcmp(type.dataTypeString, "int"))
783 ((const char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, &value.i, buffer, null, &needClass);
784 else if(!strcmp(type.dataTypeString, "unsigned int") || !strcmp(type.dataTypeString, "uint") || type.typeSize == sizeof(int))
785 ((const char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, &value.ui, buffer, null, &needClass);
786 else if(!strcmp(type.dataTypeString, "short") || !strcmp(type.dataTypeString, "int16"))
787 ((const char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, &value.s, buffer, null, &needClass);
788 else if(!strcmp(type.dataTypeString, "unsigned short") || !strcmp(type.dataTypeString, "uint16") || type.typeSize == sizeof(short int))
789 ((const char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, &value.us, buffer, null, &needClass);
790 else if(!strcmp(type.dataTypeString, "char"))
791 ((const char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, &value.c, buffer, null, &needClass);
792 else if(!strcmp(type.dataTypeString, "unsigned char") || !strcmp(type.dataTypeString, "byte") || type.typeSize == sizeof(byte))
793 ((const char *(*)(void *, void *, char *, void *, bool *))(void *)type._vTbl[__ecereVMethodID_class_OnGetString])(type, &value.uc, buffer, null, &needClass);
798 bool WriteValue(File f, Class type, DataValue value, int indent)
800 if(!strcmp(type.name, "String") || !strcmp(type.dataTypeString, "char *"))
807 //if(strchr(value.p, '\"') || strchr(value.p, '\\'))
812 char * string = value.p;
831 else if(b == sizeof(buffer)-2 || !ch)
834 if(ch) buffer[b] = 0;
848 else if(!strcmp(type.name, "bool"))
855 else if(!strcmp(type.name, "SetBool"))
857 if(value.i == SetBool::true)
859 else if(value.i == SetBool::false)
864 else if(type.type == enumClass || type.type == unitClass)
867 WriteNumber(f, type, value, indent);
870 else if(eClass_IsDerived(type, class(Map)))
872 WriteMap(f, type, value.p, indent);
874 else if(eClass_IsDerived(type, class(Container)))
876 WriteArray(f, type, value.p, indent);
878 else if(type.type == normalClass || type.type == noHeadClass || type.type == structClass || type.type == bitClass)
880 _WriteJSONObject(f, type, value.p, indent);
882 else if(type.type == systemClass)
884 WriteNumber(f, type, value, indent);
889 public bool WriteJSONObject(File f, Class objectType, void * object, int indent)
894 result = _WriteJSONObject(f, objectType, object, indent);
900 static bool _WriteJSONObject(File f, Class objectType, void * object, int indent)
904 const char * string = null;
906 if(objectType._vTbl[__ecereVMethodID_class_OnGetString] != objectType.base._vTbl[__ecereVMethodID_class_OnGetString])
910 string = ((const char *(*)())(void *)objectType._vTbl[__ecereVMethodID_class_OnGetString])(objectType, object, buffer, null, null);
914 // TOCHECK: ProjectNode.ec why do we add quotes in OnGetString there?
915 if(string[0] == '\"')
929 Class mapKeyClass = null, mapDataClass = null;
931 List<Class> bases { };
933 if(objectType.templateClass && eClass_IsDerived(objectType.templateClass, class(MapNode)))
935 mapKeyClass = objectType.templateArgs[0].dataTypeClass;
936 mapDataClass = objectType.templateArgs[2].dataTypeClass;
942 for(baseClass = objectType; baseClass; baseClass = baseClass.base)
944 if(baseClass.isInstanceClass || !baseClass.base)
946 bases.Insert(null, baseClass);
949 for(baseClass : bases)
951 for(prop = baseClass.membersAndProperties.first; prop; prop = prop.next)
953 if(prop.memberAccess != publicAccess || (prop.isProperty && (!prop.Set || !prop.Get))) continue;
956 if(!prop.conversion && (!prop.IsSet || prop.IsSet(object)))
961 if(mapKeyClass && !strcmp(prop.name, "key"))
963 else if(mapDataClass && !strcmp(prop.name, "value"))
966 type = eSystem_FindClass(__thisModule, prop.dataTypeString);
968 type = eSystem_FindClass(__thisModule.application, prop.dataTypeString);
970 PrintLn("warning: Unresolved data type ", (String)prop.dataTypeString);
973 // TOFIX: How to swiftly handle classes with base data type?
974 if(type == class(double) || !strcmp(type.dataTypeString, "double"))
976 value.d = ((double (*)(void *))(void *)prop.Get)(object);
978 else if(type == class(float) || !strcmp(type.dataTypeString, "float"))
980 value.f = ((float (*)(void *))(void *)prop.Get)(object);
982 else if(type.typeSize == sizeof(int64) || !strcmp(type.dataTypeString, "int64") ||
983 !strcmp(type.dataTypeString, "unsigned int64") || !strcmp(type.dataTypeString, "uint64"))
985 value.ui64 = ((uint64 (*)(void *))(void *)prop.Get)(object);
987 else if(type.typeSize == sizeof(int) || !strcmp(type.dataTypeString, "int") ||
988 !strcmp(type.dataTypeString, "unsigned int") || !strcmp(type.dataTypeString, "uint"))
990 value.i = ((int (*)(void *))(void *)prop.Get)(object);
992 else if(type.typeSize == sizeof(short int) || !strcmp(type.dataTypeString, "short") ||
993 !strcmp(type.dataTypeString, "unsigned short") || !strcmp(type.dataTypeString, "uint16") ||
994 !strcmp(type.dataTypeString, "int16"))
996 value.s = ((short (*)(void *))(void *)prop.Get)(object);
998 else if(type.typeSize == sizeof(byte) || !strcmp(type.dataTypeString, "char") ||
999 !strcmp(type.dataTypeString, "unsigned char") || !strcmp(type.dataTypeString, "byte"))
1001 value.c = ((char (*)(void *))(void *)prop.Get)(object);
1005 value.p = ((void *(*)(void *))(void *)prop.Get)(object);
1008 if(!isFirst) f.Puts(",\n");
1009 for(c = 0; c<indent; c++) f.Puts(" ");
1012 f.Putc((char)toupper(prop.name[0]));
1013 f.Puts(prop.name+1);
1015 WriteValue(f, type, value, indent);
1022 DataMember member = (DataMember)prop;
1023 DataValue value { };
1024 Class type = eSystem_FindClass(__thisModule, member.dataTypeString);
1026 type = eSystem_FindClass(__thisModule.application, member.dataTypeString);
1030 if(type.type == normalClass || type.type == noHeadClass || type.type == structClass || !strcmp(type.name, "String"))
1032 if(type.type == structClass)
1033 value.p = (void *)((byte *)object + member._class.offset + member.offset);
1035 value.p = *(void **)((byte *)object + member._class.offset + member.offset);
1039 else if(type == class(double) || !strcmp(type.dataTypeString, "double"))
1041 value.d = *(double *)((byte *)object + member._class.offset + member.offset);
1043 else if(type == class(float) || !strcmp(type.dataTypeString, "float"))
1045 value.f = *(float *)((byte *)object + member._class.offset + member.offset);
1047 else if(type.typeSize == sizeof(int64) || !strcmp(type.dataTypeString, "int64") ||
1048 !strcmp(type.dataTypeString, "unsigned int64") || !strcmp(type.dataTypeString, "uint64"))
1050 value.ui64 = *(uint64 *)((byte *)object + member._class.offset + member.offset);
1052 else if(type.typeSize == sizeof(int) || !strcmp(type.dataTypeString, "int") ||
1053 !strcmp(type.dataTypeString, "unsigned int") || !strcmp(type.dataTypeString, "uint"))
1055 value.i = *(int *)((byte *)object + member._class.offset + member.offset);
1056 if(!strcmp(type.name, "bool") || type.type == enumClass)
1060 else if(type.typeSize == sizeof(short int) || !strcmp(type.dataTypeString, "short") ||
1061 !strcmp(type.dataTypeString, "unsigned short") || !strcmp(type.dataTypeString, "uint16") ||
1062 !strcmp(type.dataTypeString, "int16"))
1064 value.s = *(short *)((byte *)object + member._class.offset + member.offset);
1066 else if(type.typeSize == sizeof(byte) || !strcmp(type.dataTypeString, "char") ||
1067 !strcmp(type.dataTypeString, "unsigned char") || !strcmp(type.dataTypeString, "byte"))
1069 value.c = *(char *)((byte *)object + member._class.offset + member.offset);
1073 value.i = *(int *)((byte *)object + member._class.offset + member.offset);
1076 if(!isFirst) f.Puts(",\n");
1077 for(c = 0; c<indent; c++) f.Puts(" ");
1080 f.Putc((char)toupper(member.name[0]));
1081 f.Puts(member.name+1);
1083 WriteValue(f, type, value, indent);
1094 for(c = 0; c<indent; c++) f.Puts(" "); f.Puts("}");