superstudio 0.8.2102

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,34 @@
1
+ #ifndef JSON_OBJECT_ARRAY_
2
+ #define JSON_OBJECT_ARRAY_
3
+
4
+ #include <stdint.h>
5
+ #include <stdlib.h>
6
+ #include <string.h>
7
+ #include "json_builder.h"
8
+ #include "hash_linked_list.h"
9
+ #include "finalize.h"
10
+
11
+ void create_array_object(JSONDocumentBuilder* builder,
12
+ uint64_t hash,
13
+ HashList* parent_list,
14
+ JSONLevelBuilder* parent_level_definitions,
15
+ JSONLevelBuilder* empty_child_object,
16
+ JSONLevelBuilder* empty_child_array,
17
+ int identifier_int);
18
+ void count_increment_or_create_json_level_child_array(JSONDocumentBuilder* builder, JSONLevelBuilder* child_array_levels, int identifier_length, char* identifier, int identifier_int, uint64_t parent_hash, uint64_t child_hash);
19
+ void initialize_child_array_levels(JSONLevelBuilder* child_array_levels, SSMemoryStack* memory_stack);
20
+ void set_array_object_child_level_definitions(JSONLevelBuilder* level_definitions, JSONLevelBuilder* array_object_info_list, uint64_t hash, unsigned long column_count, unsigned long accessing_depth);
21
+ void assign_array_object_data(JSONLevelBuilder* level_definitions, JSONLevelBuilder* array_object_info_list, char** row_strings, unsigned long* string_sizes, unsigned long column_count, unsigned long accessing_depth);
22
+ void add_or_find_array_object_child_hashes(
23
+ JSONDocumentBuilder* builder,
24
+ JSONLevelBuilder* level_definitions,
25
+ JSONLevelBuilder* child_array_levels,
26
+ unsigned long accessing_depth,
27
+ unsigned long visible_depth,
28
+ unsigned long column_count,
29
+ unsigned long* string_sizes,
30
+ char** row_strings,
31
+ JSONObject* related_object
32
+ );
33
+
34
+ #endif
@@ -0,0 +1,320 @@
1
+ #include "json_single_object.h"
2
+ #include "ss_alloc.h"
3
+ #include "hash_linked_list.h"
4
+
5
+ void create_single_object(JSONDocumentBuilder* builder,
6
+ uint64_t hash,
7
+ int identifier_int,
8
+ JSONObject* parent_object)
9
+ {
10
+ SingleObjectJSON* adding_object = NULL;
11
+ SingleObjectJSON* single_parent_object;
12
+
13
+ int found = 0;
14
+
15
+ adding_object = parent_object->single_objects;
16
+ while (adding_object->set_flag && !found) {
17
+ single_parent_object = adding_object;
18
+ if (single_parent_object->identifier_int == identifier_int) {
19
+ found = 1;
20
+ } else {
21
+ single_parent_object = single_parent_object->value->single_objects;
22
+ while (single_parent_object->set_flag && !found) {
23
+ if (single_parent_object->identifier_int == identifier_int) {
24
+ found = 1;
25
+ } else {
26
+ single_parent_object = single_parent_object->next_item;
27
+ }
28
+ }
29
+ }
30
+ adding_object = adding_object->next_item;
31
+ }
32
+
33
+ if (!found) {
34
+ adding_object->next_item = (SingleObjectJSON*)ss_alloc(builder->memory_stack, 1, sizeof(SingleObjectJSON));
35
+ adding_object->name_characters = builder->single_object_key_lengths[identifier_int];
36
+ adding_object->name = builder->single_object_key_names[identifier_int];
37
+
38
+ builder->json_char_count += 6; //quotes, colon, braces, comma maybe
39
+
40
+ adding_object->value = (JSONObject*)ss_alloc(builder->memory_stack, 1, sizeof(JSONObject));
41
+ adding_object->value->single_values = (SingleValueJSON*)ss_alloc(builder->memory_stack, 1, sizeof(SingleValueJSON));
42
+ adding_object->value->single_objects = (SingleObjectJSON*)ss_alloc(builder->memory_stack, 1, sizeof(SingleObjectJSON));
43
+ adding_object->value->array_values = (ArrayValueJSON*)ss_alloc(builder->memory_stack, 1, sizeof(ArrayValueJSON));
44
+ adding_object->value->array_objects = (ArrayObjectJSON*)ss_alloc(builder->memory_stack, 1, sizeof(ArrayObjectJSON));
45
+ adding_object->value->array_objects->next = (ArrayObjectJSON*)ss_alloc(builder->memory_stack, 1, sizeof(ArrayObjectJSON));
46
+
47
+ adding_object->next_item->value = (JSONObject*)ss_alloc(builder->memory_stack, 1, sizeof(JSONObject));
48
+ adding_object->identifier_int = identifier_int;
49
+ adding_object->associated_hash = hash;
50
+
51
+ adding_object->value->last_single_value = adding_object->value->single_values;
52
+ adding_object->value->last_single_object = adding_object->value->single_objects;
53
+
54
+ adding_object->set_flag = 1;
55
+
56
+ builder->json_char_count += adding_object->name_characters;
57
+ }
58
+ }
59
+
60
+ void count_increment_or_create_json_level_child(JSONDocumentBuilder* builder, JSONLevelBuilder* child_levels, int identifier_length, char* identifier, int identifier_int, uint64_t parent_hash)
61
+ {
62
+ unsigned char found = 0;
63
+
64
+ while(child_levels->set_flag && !found) {
65
+ if (child_levels->identifier_length == identifier_length) {
66
+ if (!memcmp(child_levels->identifier, identifier, identifier_length)) {
67
+ found = 1;
68
+ child_levels->column_count++;
69
+ }
70
+ }
71
+ if (!found) {
72
+ child_levels = child_levels->next_child;
73
+ }
74
+ }
75
+
76
+ if (!child_levels->set_flag && !found) {
77
+ child_levels->parent_hash = parent_hash;
78
+ child_levels->identifier_int = identifier_int;
79
+ child_levels->identifier_length = identifier_length;
80
+ child_levels->identifier = identifier;
81
+
82
+ child_levels->column_count++;
83
+ child_levels->set_flag = 1;
84
+ child_levels->next_child = (JSONLevelBuilder*)ss_alloc(builder->memory_stack, 1, sizeof(JSONLevelBuilder));
85
+ child_levels->next_child_array = (JSONLevelBuilder*)ss_alloc(builder->memory_stack, 1, sizeof(JSONLevelBuilder));
86
+
87
+ child_levels->search_list = (HashList*)ss_alloc(builder->memory_stack, 1, sizeof(HashList));
88
+ initialize_search_list(child_levels, builder->memory_stack, builder->row_count);
89
+
90
+ found = 1;
91
+ }
92
+ }
93
+
94
+ void initialize_child_levels(JSONLevelBuilder* single_object_children, SSMemoryStack* memory_stack)
95
+ {
96
+ while(single_object_children->set_flag) {
97
+ single_object_children->active_row_strings = (JSONLevelStrings*)ss_alloc(memory_stack, 1, sizeof(JSONLevelStrings));
98
+ single_object_children->active_row_strings->set_strings_count = 0;
99
+
100
+ single_object_children->active_row_strings->string_lengths = (unsigned long*)ss_alloc(memory_stack, single_object_children->column_count, sizeof(unsigned long));
101
+ single_object_children->active_row_strings->row_strings = (char**)ss_alloc(memory_stack, single_object_children->column_count, sizeof(char*));
102
+
103
+ single_object_children->mapping_array_lengths = (unsigned long*)ss_alloc(memory_stack, 1, sizeof(unsigned long) * single_object_children->column_count);
104
+ single_object_children->mapping_array = (char**)ss_alloc(memory_stack, 1, sizeof(char*) * single_object_children->column_count);
105
+ single_object_children->quote_array = (unsigned long*)ss_alloc(memory_stack, 1, sizeof(unsigned long) * single_object_children->column_count);
106
+ single_object_children->do_not_hash = (unsigned long*)ss_alloc(memory_stack, 1, sizeof(unsigned long) * single_object_children->column_count);
107
+ single_object_children->depth_array = (unsigned long*)ss_alloc(memory_stack, 1, sizeof(unsigned long) * single_object_children->column_count);
108
+ single_object_children->real_depth_array = (unsigned long*)ss_alloc(memory_stack, 1, sizeof(unsigned long) * single_object_children->column_count);
109
+ single_object_children->repeating_array_columns = (unsigned long*)ss_alloc(memory_stack, 1, sizeof(unsigned long) * single_object_children->column_count);
110
+
111
+ single_object_children->column_name_lengths = (unsigned long*)ss_alloc(memory_stack, 1, sizeof(unsigned long) * single_object_children->column_count);
112
+ single_object_children->column_names = (char**)ss_alloc(memory_stack, 1, sizeof(char*) * single_object_children->column_count);
113
+
114
+ single_object_children->defined_flag = 1;
115
+ single_object_children = single_object_children->next_child;
116
+ }
117
+ }
118
+
119
+ void set_single_object_child_level_definitions(JSONLevelBuilder* level_definitions,
120
+ JSONLevelBuilder* single_object_info_list,
121
+ uint64_t hash,
122
+ unsigned long column_count,
123
+ unsigned long accessing_depth)
124
+ {
125
+ unsigned long counter = 0;
126
+ int identifier_int;
127
+ int cursor;
128
+ unsigned char found = 0;
129
+ int test_identifier_length;
130
+ char* test_identifier;
131
+ JSONLevelBuilder* single_object_children;
132
+
133
+ while(counter < column_count) {
134
+ single_object_children = single_object_info_list;
135
+ if ((read_type(accessing_depth, level_definitions->mapping_array[counter], level_definitions->mapping_array_lengths[counter]) == '2')) {
136
+ found = 0;
137
+ while(single_object_children->set_flag && !found) {
138
+ read_identifier(accessing_depth, level_definitions->mapping_array[counter], &cursor, &test_identifier_length, level_definitions->mapping_array_lengths[counter]);
139
+ test_identifier = level_definitions->mapping_array[counter] + cursor;
140
+
141
+ identifier_int = atoi(test_identifier);
142
+
143
+ if ((single_object_children->identifier_int == identifier_int) && (single_object_children->parent_hash == hash) && (single_object_children->assigned_count < single_object_children->column_count)) {
144
+ single_object_children->mapping_array_lengths[single_object_children->assigned_count] = level_definitions->mapping_array_lengths[counter];
145
+ single_object_children->mapping_array[single_object_children->assigned_count] = level_definitions->mapping_array[counter];
146
+
147
+ single_object_children->quote_array[single_object_children->assigned_count] = level_definitions->quote_array[counter];
148
+ single_object_children->do_not_hash[single_object_children->assigned_count] = level_definitions->do_not_hash[counter];
149
+ single_object_children->depth_array[single_object_children->assigned_count] = level_definitions->depth_array[counter];
150
+ single_object_children->real_depth_array[single_object_children->assigned_count] = level_definitions->real_depth_array[counter];
151
+ single_object_children->repeating_array_columns[single_object_children->assigned_count] = level_definitions->repeating_array_columns[counter];
152
+ single_object_children->column_name_lengths[single_object_children->assigned_count] = level_definitions->column_name_lengths[counter];
153
+ single_object_children->column_names[single_object_children->assigned_count] = level_definitions->column_names[counter];
154
+
155
+ single_object_children->assigned_count += 1;
156
+ }
157
+ single_object_children = single_object_children->next_child;
158
+ }
159
+ }
160
+ counter++;
161
+ }
162
+ }
163
+
164
+ void assign_single_object_data(
165
+ JSONLevelBuilder* level_definitions,
166
+ JSONLevelBuilder* single_object_info_list,
167
+ char** row_strings,
168
+ unsigned long* string_sizes,
169
+ unsigned long column_count,
170
+ unsigned long accessing_depth)
171
+ {
172
+ unsigned long counter = 0;
173
+ int cursor;
174
+ int tmp_total_assigned = 0;
175
+ unsigned char found = 0;
176
+ int test_identifier_length;
177
+ char* test_identifier;
178
+ JSONLevelBuilder* single_object_children;
179
+
180
+ while(counter < column_count) {
181
+ single_object_children = single_object_info_list;
182
+ if (read_type(accessing_depth, level_definitions->mapping_array[counter], level_definitions->mapping_array_lengths[counter]) == '2') {
183
+ found = 0;
184
+ read_identifier(accessing_depth, level_definitions->mapping_array[counter], &cursor, &test_identifier_length, level_definitions->mapping_array_lengths[counter]);
185
+ test_identifier = level_definitions->mapping_array[counter] + cursor;
186
+
187
+ while(single_object_children->set_flag && !found) {
188
+ if (!memcmp(single_object_children->identifier, test_identifier, test_identifier_length) && (single_object_children->active_row_strings->set_strings_count < single_object_children->column_count)) {
189
+ single_object_children->active_row_strings->string_lengths[single_object_children->active_row_strings->set_strings_count] = string_sizes[counter];
190
+ single_object_children->active_row_strings->row_strings[single_object_children->active_row_strings->set_strings_count] = row_strings[counter];
191
+
192
+ single_object_children->active_row_strings->set_strings_count += 1;
193
+
194
+ tmp_total_assigned++;
195
+ found = 1;
196
+ }
197
+ single_object_children = single_object_children->next_child;
198
+ }
199
+ }
200
+ counter++;
201
+ }
202
+ }
203
+
204
+ void add_or_find_single_object_child_hashes(
205
+ JSONDocumentBuilder* builder,
206
+ JSONLevelBuilder* child_levels,
207
+ JSONObject* related_object,
208
+ JSONObject* parent_object,
209
+ uint64_t hash,
210
+ unsigned char parent_type,
211
+ int parent_identifier
212
+ )
213
+ {
214
+ int found = 0;
215
+ SingleObjectJSON* related_child_objects;
216
+ SingleObjectJSON* single_parent_object;
217
+ SingleObjectJSON* object_source;
218
+
219
+ // Dev note:
220
+ // We're searching for the correct parent here. We need to use that for multi-level nested single objects
221
+ // If this isn't a single object, we don't need to worry about this
222
+ single_parent_object = related_object->single_objects;
223
+
224
+ if (parent_type == 2) {
225
+ related_child_objects = parent_object->single_objects;
226
+ while (related_child_objects->set_flag && !found) {
227
+ single_parent_object = related_child_objects;
228
+ if (single_parent_object->identifier_int == parent_identifier) {
229
+ found = 1;
230
+ } else {
231
+ single_parent_object = single_parent_object->value->single_objects;
232
+ while (single_parent_object->set_flag && !found) {
233
+ if (single_parent_object->identifier_int == parent_identifier) {
234
+ found = 1;
235
+ } else {
236
+ single_parent_object = single_parent_object->next_item;
237
+ }
238
+ }
239
+ }
240
+ related_child_objects = related_child_objects->next_item;
241
+ }
242
+ }
243
+
244
+ // Dev note:
245
+ // If we didn't find a parent, then the parent must be the passed object
246
+ if (found) {
247
+ object_source = single_parent_object->value->single_objects;
248
+ } else {
249
+ object_source = related_object->single_objects;
250
+ }
251
+
252
+ if (!found) {
253
+ while (child_levels->set_flag && child_levels->identifier_int) {
254
+ found = 0;
255
+ related_child_objects = object_source;
256
+
257
+ while(related_child_objects->set_flag && !found) {
258
+ if (related_child_objects->identifier_int == child_levels->identifier_int) {
259
+ found = 1;
260
+ }
261
+ related_child_objects = related_child_objects->next_item;
262
+ }
263
+
264
+ if(!found) {
265
+ related_child_objects->next_item = (SingleObjectJSON*)ss_alloc(builder->memory_stack, 1, sizeof(SingleObjectJSON));
266
+ related_child_objects->name_characters = builder->single_object_key_lengths[child_levels->identifier_int];
267
+
268
+ related_child_objects->name = builder->single_object_key_names[child_levels->identifier_int];
269
+
270
+ builder->json_char_count += 6;
271
+ builder->json_char_count += builder->single_object_key_lengths[child_levels->identifier_int];
272
+
273
+ related_child_objects->value = (JSONObject*)ss_alloc(builder->memory_stack, 1, sizeof(JSONObject));
274
+ related_child_objects->value->single_values = (SingleValueJSON*)ss_alloc(builder->memory_stack, 1, sizeof(SingleValueJSON));
275
+ related_child_objects->value->single_objects = (SingleObjectJSON*)ss_alloc(builder->memory_stack, 1, sizeof(SingleObjectJSON));
276
+ related_child_objects->value->array_values = (ArrayValueJSON*)ss_alloc(builder->memory_stack, 1, sizeof(ArrayValueJSON));
277
+ related_child_objects->value->array_objects = (ArrayObjectJSON*)ss_alloc(builder->memory_stack, 1, sizeof(ArrayObjectJSON));
278
+ related_child_objects->value->array_objects->next = (ArrayObjectJSON*)ss_alloc(builder->memory_stack, 1, sizeof(ArrayObjectJSON));
279
+ related_child_objects->identifier_int = child_levels->identifier_int;
280
+ related_child_objects->associated_hash = hash;
281
+
282
+ related_child_objects->value->last_single_value = related_child_objects->value->single_values;
283
+ related_child_objects->value->last_single_object = related_child_objects->value->single_objects;
284
+
285
+ related_child_objects->set_flag = 1;
286
+ }
287
+
288
+ child_levels = child_levels->next_child;
289
+ }
290
+ }
291
+ }
292
+
293
+ unsigned long finalize_single_objects(JSONDocumentBuilder* builder, SingleObjectJSON* level_single_objects, unsigned long counter, int comma_finish)
294
+ {
295
+ while(level_single_objects->set_flag) {
296
+ memcpy(builder->resulting_json + counter, oq, 1);
297
+ counter++;
298
+ memcpy(builder->resulting_json + counter, level_single_objects->name, level_single_objects->name_characters);
299
+ counter += level_single_objects->name_characters;
300
+ memcpy(builder->resulting_json + counter, oqc, 2);
301
+ counter += 2;
302
+
303
+ counter = finalize_key_values(builder, level_single_objects->value->single_values, level_single_objects->value, counter);
304
+ counter = finalize_single_objects(builder, level_single_objects->value->single_objects, counter, (level_single_objects->value->array_values->set_flag ));
305
+ counter = finalize_value_array(builder, level_single_objects->value->array_values, counter);
306
+ counter = finalize_object_array(builder, level_single_objects->value->array_objects, counter);
307
+
308
+ memcpy(builder->resulting_json + counter, cbr, 1);
309
+ counter++;
310
+
311
+ if ((level_single_objects->next_item->set_flag) || comma_finish) {
312
+ memcpy(builder->resulting_json + counter, cm, 1);
313
+ counter++;
314
+ }
315
+
316
+ level_single_objects = level_single_objects->next_item;
317
+ }
318
+
319
+ return counter;
320
+ }
@@ -0,0 +1,31 @@
1
+ #ifndef JSON_SINGLE_OBJECT_
2
+ #define JSON_SINGLE_OBJECT_
3
+
4
+ #include <stdint.h>
5
+ #include <stdlib.h>
6
+ #include <string.h>
7
+ #include <stdio.h>
8
+ #include "json_builder.h"
9
+ #include "finalize.h"
10
+
11
+ void count_increment_or_create_json_level_child(JSONDocumentBuilder* builder, JSONLevelBuilder* child_levels, int identifier_length, char* identifier, int identifier_int, uint64_t parent_hash);
12
+ void initialize_child_levels(JSONLevelBuilder* single_object_children, SSMemoryStack* memory_stack);
13
+ void create_single_object(JSONDocumentBuilder* builder,
14
+ uint64_t hash,
15
+ int identifier_int,
16
+ JSONObject* parent_object);
17
+ void set_single_object_child_level_definitions(JSONLevelBuilder* level_definitions, JSONLevelBuilder* single_object_info_list, uint64_t hash, unsigned long column_count, unsigned long accessing_depth);
18
+ void assign_single_object_data(JSONLevelBuilder* level_definitions, JSONLevelBuilder* single_object_info_list, char** row_strings, unsigned long* string_sizes, unsigned long column_count, unsigned long accessing_depth);
19
+ void add_or_find_single_object_child_hashes(
20
+ JSONDocumentBuilder* builder,
21
+ JSONLevelBuilder* child_levels,
22
+ JSONObject* related_object,
23
+ JSONObject* parent_object,
24
+ uint64_t hash,
25
+ unsigned char parent_type,
26
+ int parent_identifier
27
+ );
28
+
29
+
30
+
31
+ #endif
@@ -0,0 +1,113 @@
1
+ #include "json_value.h"
2
+ #include "hash_linked_list.h"
3
+ #include "ss_alloc.h"
4
+
5
+ void set_key_values(
6
+ JSONDocumentBuilder* builder,
7
+ unsigned long* string_sizes,
8
+ char** row,
9
+ unsigned long visible_depth,
10
+ JSONLevelBuilder* level_definitions,
11
+ JSONObject* parent_object
12
+ )
13
+ {
14
+ unsigned long counter = 0;
15
+ unsigned long visible_counter = 0;
16
+ int found = 0;
17
+ SingleValueJSON* duplicate_finder;
18
+
19
+ while(counter < level_definitions->column_count) {
20
+ if (visible_depth == level_definitions->depth_array[counter]) {
21
+ if (read_type(visible_depth, level_definitions->mapping_array[counter], level_definitions->mapping_array_lengths[counter]) == '1') {
22
+ found = 0;
23
+
24
+ if (parent_object->single_values) {
25
+ duplicate_finder = parent_object->single_values;
26
+ while(duplicate_finder->set_flag) {
27
+ if (duplicate_finder->name_characters == level_definitions->column_name_lengths[counter]) {
28
+ if (!memcmp(duplicate_finder->name, level_definitions->column_names[counter], duplicate_finder->name_characters)) {
29
+ found = 1;
30
+ }
31
+ }
32
+ duplicate_finder = duplicate_finder->next_value;
33
+ }
34
+ }
35
+
36
+ if (!found) {
37
+ builder->json_char_count += 2; // Add space for quotes for the key
38
+ builder->json_char_count += level_definitions->column_name_lengths[counter]; // Add space for the key
39
+
40
+ builder->json_char_count += 1; // Add space for the colon
41
+ if (level_definitions->quote_array[visible_counter]) {
42
+ builder->json_char_count += 2; // Add space for the quotes on the value, if needed
43
+ }
44
+ builder->json_char_count += string_sizes[visible_counter]; // Add space for the value
45
+
46
+ if (!parent_object->single_values) {
47
+ parent_object->single_values = (SingleValueJSON*)ss_alloc(builder->memory_stack, 1, sizeof(SingleValueJSON));
48
+ parent_object->last_single_value = parent_object->single_values;
49
+ }
50
+
51
+ if (parent_object->single_values->set_flag) {
52
+ parent_object->last_single_value = parent_object->last_single_value->next_value;
53
+ }
54
+ parent_object->last_single_value->next_value = (SingleValueJSON*)ss_alloc(builder->memory_stack, 1, sizeof(SingleValueJSON));
55
+ parent_object->last_single_value->set_flag = 1;
56
+ parent_object->last_single_value->name = level_definitions->column_names[counter];
57
+
58
+ parent_object->last_single_value->value = (char*)ss_alloc(builder->memory_stack, 1, string_sizes[counter]);
59
+ memcpy(parent_object->last_single_value->value, row[counter], (string_sizes[counter]));
60
+
61
+ parent_object->last_single_value->value_characters = string_sizes[visible_counter];
62
+ parent_object->last_single_value->name_characters = level_definitions->column_name_lengths[counter];
63
+ parent_object->last_single_value->quoted = level_definitions->quote_array[visible_counter];
64
+ }
65
+
66
+ if (level_definitions->column_count != (counter + 1)) {
67
+ builder->json_char_count += 1; // Add a space for the comma, as long as this not the last item in the object
68
+ }
69
+ }
70
+ visible_counter++;
71
+ }
72
+ counter++;
73
+ }
74
+ }
75
+
76
+ unsigned long finalize_key_values(JSONDocumentBuilder* builder, SingleValueJSON* single_values, JSONObject* parent_json, unsigned long counter)
77
+ {
78
+ memcpy(builder->resulting_json + counter, obr, 1);
79
+ counter++;
80
+ while(single_values->set_flag) {
81
+ memcpy(builder->resulting_json + counter, oq, 1);
82
+ counter++;
83
+ memcpy(builder->resulting_json + counter, single_values->name, single_values->name_characters);
84
+ counter += single_values->name_characters;
85
+
86
+ memcpy(builder->resulting_json + counter, oqc, 2);
87
+ counter += 2;
88
+
89
+ if (single_values->quoted) {
90
+ memcpy(builder->resulting_json + counter, oq, 1);
91
+ counter++;
92
+ memcpy(builder->resulting_json + counter, single_values->value, single_values->value_characters);
93
+ counter += single_values->value_characters;
94
+
95
+ memcpy(builder->resulting_json + counter, oq, 1);
96
+ counter++;
97
+ } else {
98
+ memcpy(builder->resulting_json + counter, single_values->value, single_values->value_characters);
99
+ counter += single_values->value_characters;
100
+ }
101
+
102
+ if ((single_values != parent_json->last_single_value) ||
103
+ ((single_values == parent_json->last_single_value) && parent_json->single_objects->set_flag) ||
104
+ ((single_values == parent_json->last_single_value) && !(parent_json->single_objects->set_flag) && parent_json->array_values->set_flag)
105
+ ) {
106
+ memcpy(builder->resulting_json + counter, cm, 1);
107
+ counter++;
108
+ }
109
+
110
+ single_values = single_values->next_value;
111
+ }
112
+ return counter;
113
+ }