8
8
9
9
typedef struct {
10
10
const char * name ;
11
- long age ;
11
+ double age ;
12
12
const char * location ;
13
- long body_count ;
13
+ double body_count ;
14
14
} Person ;
15
15
16
16
typedef struct {
@@ -55,9 +55,9 @@ bool parse_people(Jimp *jimp, People *ps)
55
55
void print_person (const Person * p )
56
56
{
57
57
printf ("name = %s\n" , p -> name );
58
- printf ("age = %ld \n" , p -> age );
58
+ printf ("age = %lf \n" , p -> age );
59
59
printf ("location = %s\n" , p -> location );
60
- printf ("body_count = %ld \n" , p -> body_count );
60
+ printf ("body_count = %lf \n" , p -> body_count );
61
61
}
62
62
63
63
typedef struct {
@@ -78,9 +78,10 @@ int main()
78
78
if (!read_entire_file (file_path , & sb )) return 1 ;
79
79
Jimp jimp = {
80
80
.file_path = file_path ,
81
+ .start = sb .items ,
82
+ .end = sb .items + sb .count ,
83
+ .point = sb .items ,
81
84
};
82
- static char string_store [1024 ];
83
- stb_c_lexer_init (& jimp .l , sb .items , sb .items + sb .count , string_store , sizeof (string_store ));
84
85
85
86
People ps = {0 };
86
87
Numbers xs = {0 };
@@ -91,7 +92,7 @@ int main()
91
92
} else if (strcmp (jimp .member , "number" ) == 0 ) {
92
93
if (!jimp_array_begin (& jimp )) return 1 ;
93
94
while (jimp_array_item (& jimp )) {
94
- long x = 0 ;
95
+ double x = 0 ;
95
96
if (!jimp_number (& jimp , & x )) return 1 ;
96
97
da_append (& xs , x );
97
98
}
0 commit comments