… | |
… | |
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; |
109 | bool object_thawer::errors_are_fatal = true; |
110 | |
110 | |
|
|
111 | object_thawer::object_thawer (const char *data, AV *perlav) |
|
|
112 | : name (strdup ("(memory stream)")) |
|
|
113 | { |
|
|
114 | av = perlav; |
|
|
115 | text = newSVpv (data, 0); |
|
|
116 | sv_catpv (text, thawer_eof); |
|
|
117 | line = SvPVbyte_nolen (text); |
|
|
118 | next (); |
|
|
119 | } |
|
|
120 | |
111 | object_thawer::object_thawer (const_utf8_string path) |
121 | object_thawer::object_thawer (const_utf8_string path) |
112 | { |
122 | { |
113 | new_from_path (path); |
123 | new_from_path (path); |
114 | } |
124 | } |
115 | |
125 | |
… | |
… | |
164 | |
174 | |
165 | CALL_END; |
175 | CALL_END; |
166 | } |
176 | } |
167 | } |
177 | } |
168 | |
178 | |
169 | object_thawer::object_thawer (const char *data, AV *perlav) |
|
|
170 | : name (strdup ("(memory stream)")) |
|
|
171 | { |
|
|
172 | av = perlav; |
|
|
173 | text = newSVpv (data, 0); |
|
|
174 | sv_catpv (text, thawer_eof); |
|
|
175 | line = SvPVbyte_nolen (text); |
|
|
176 | next (); |
|
|
177 | } |
|
|
178 | |
|
|
179 | void |
179 | void |
180 | object_thawer::get (attachable *obj, int oid) |
180 | object_thawer::get (attachable *obj, int oid) |
181 | { |
181 | { |
182 | if (!av || oid < 0) // this is actually an error of sorts |
182 | if (!av || oid < 0) // this is actually an error of sorts |
183 | return; |
183 | return; |
… | |
… | |
248 | exit (1); |
248 | exit (1); |
249 | } |
249 | } |
250 | } |
250 | } |
251 | |
251 | |
252 | void |
252 | void |
253 | object_thawer::parse_warn (const char *msg) |
253 | object_thawer::parse_warn (const char *msg) const |
254 | { |
254 | { |
255 | LOG (llevWarn, "%s:%d, \"%s %s\": %s\n", |
255 | LOG (llevWarn, "%s:%d, \"%s %s\": %s\n", |
256 | this->name, linenum, |
256 | this->name, linenum, |
257 | kw_str ? kw_str : "<null>", |
257 | kw_str ? kw_str : "<null>", |
258 | value ? value : "<null>", |
258 | value ? value : "<null>", |
259 | msg); |
259 | msg); |
260 | } |
260 | } |
261 | |
261 | |
262 | bool |
262 | bool |
263 | object_thawer::parse_error (const char *type, const char *name, bool skip) |
263 | object_thawer::parse_error (const char *type, const char *name, bool skip) const |
264 | { |
264 | { |
265 | if (!type) type = "file section"; |
265 | if (!type) type = "file section"; |
266 | if (!name) name = "generic"; |
266 | if (!name) name = "generic"; |
267 | |
267 | |
268 | switch (kw) |
268 | switch (kw) |