… | |
… | |
104 | } |
104 | } |
105 | #endif |
105 | #endif |
106 | |
106 | |
107 | static const char thawer_eof[] = "\n\n\n\0\0\0"; |
107 | static const char thawer_eof[] = "\n\n\n\0\0\0"; |
108 | |
108 | |
|
|
109 | bool object_thawer::errors_are_fatal = true; |
|
|
110 | |
109 | object_thawer::object_thawer (const char *path) |
111 | object_thawer::object_thawer (const char *path) |
110 | : name (strdup (path)) |
112 | : name (strdup (path)) |
111 | { |
113 | { |
112 | av = 0; |
114 | av = 0; |
113 | text = 0; |
115 | text = 0; |
… | |
… | |
223 | resolve_delayed_derefs (false); |
225 | resolve_delayed_derefs (false); |
224 | |
226 | |
225 | free ((void *)name); |
227 | free ((void *)name); |
226 | } |
228 | } |
227 | |
229 | |
|
|
230 | static void |
|
|
231 | error_out () |
|
|
232 | { |
|
|
233 | if (object_thawer::errors_are_fatal) |
|
|
234 | { |
|
|
235 | LOG (llevError, "(parse errors at this time are fatal, exiting)"); |
|
|
236 | exit (1); |
|
|
237 | } |
|
|
238 | } |
|
|
239 | |
228 | void |
240 | void |
229 | object_thawer::parse_warn (const char *msg) |
241 | object_thawer::parse_warn (const char *msg) |
230 | { |
242 | { |
231 | LOG (llevWarn, "%s:%d, \"%s %s\": %s\n", |
243 | LOG (llevWarn, "%s:%d, \"%s %s\": %s\n", |
232 | this->name, linenum, |
244 | this->name, linenum, |
… | |
… | |
244 | switch (kw) |
256 | switch (kw) |
245 | { |
257 | { |
246 | case KW_EOF: |
258 | case KW_EOF: |
247 | LOG (llevError, "%s:%d end of file while reading %s '%s', aborting load.\n", |
259 | LOG (llevError, "%s:%d end of file while reading %s '%s', aborting load.\n", |
248 | this->name, linenum, type, name); |
260 | this->name, linenum, type, name); |
|
|
261 | error_out (); |
249 | return false; |
262 | return false; |
250 | |
263 | |
251 | case KW_ERROR: |
264 | case KW_ERROR: |
252 | LOG (llevError, "%s:%d error while reading %s '%s', at '%s', aborting load.\n", |
265 | LOG (llevError, "%s:%d error while reading %s '%s', at '%s', aborting load.\n", |
253 | this->name, linenum, |
266 | this->name, linenum, |
254 | type, name, |
267 | type, name, |
255 | kw_str ? kw_str : "<file load>"); |
268 | kw_str ? kw_str : "<file load>"); |
|
|
269 | error_out (); |
256 | return false; |
270 | return false; |
257 | |
271 | |
258 | default: |
272 | default: |
259 | LOG (llevError, "%s:%d unexpected line (%s %s) while reading %s '%s', %s.\n", |
273 | LOG (llevError, "%s:%d unexpected line (%s %s) while reading %s '%s', %s.\n", |
260 | this->name, linenum, |
274 | this->name, linenum, |
261 | kw_str ? kw_str : "<null>", |
275 | kw_str ? kw_str : "<null>", |
262 | value ? value : "<null>", |
276 | value ? value : "<null>", |
263 | type, name, |
277 | type, name, |
264 | skip ? "skipping line" : "aborting load"); |
278 | skip ? "skipping line" : "aborting load"); |
|
|
279 | error_out (); |
265 | return skip; |
280 | return skip; |
266 | } |
281 | } |
267 | } |
282 | } |
268 | |
283 | |
269 | void |
284 | void |