pike.git/
src/
encode.c
Branch:
Tag:
Non-build tags
All tags
No tags
2008-05-21
2008-05-21 20:07:41 by Henrik Grubbström (Grubba) <grubba@grubba.org>
7ec65867ba0d59779e4b418e66496c4844605a09 (
41
lines) (+
36
/-
5
)
[
Show
|
Annotate
]
Branch:
7.9
Decoder()->decode_object() can now cause lfun::create() to be called.
Rev: src/encode.c:1.269
2:
|| This file is part of Pike. For copyright information see COPYRIGHT. || Pike is distributed under GPL, LGPL and MPL. See the file COPYING || for more information.
-
|| $Id: encode.c,v 1.
268
2008/05/21
13
:07:
02
grubba Exp $
+
|| $Id: encode.c,v 1.
269
2008/05/21
20
:07:
41
grubba Exp $
*/ #include "global.h"
2937:
"Cannot decode objects without a " "\"decode_object\" function in the codec.\n"); apply_low(data->codec,fun,2);
+
if ((Pike_sp[-1].type == T_ARRAY) &&
+
((fun = FIND_LFUN(o->prog, LFUN_CREATE)) != -1)) {
+
/* Call lfun::create(@args). */
+
INT32 args;
+
Pike_sp--;
+
args = Pike_sp->u.array->size;
+
if (args) {
+
/* Note: Eats reference */
+
push_array_items(Pike_sp->u.array);
+
} else {
+
free_array(Pike_sp->u.array);
+
}
+
apply_low(o, fun, args);
+
}
pop_stack(); }
3605:
* to see what objects are now finished. */ {
-
int fun = -1;
+
int
decode_
fun = -1;
struct unfinished_obj_link *l, **ptr; if (data->unfinished_objects) { if(!data->codec) decode_error(Pike_sp - 1, NULL, "Cannot decode object without codec.\n");
-
fun = find_identifier("decode_object", data->codec->prog);
-
if (fun < 0)
+
decode_
fun =
+
find_identifier("decode_object", data->codec->prog);
+
if (
decode_
fun < 0)
decode_error(Pike_sp - 1, NULL, "Cannot decode objects without a " "\"decode_object\" function in the codec.\n"); } for(ptr= &data->unfinished_objects ; (l=*ptr);) {
-
+
int fun;
struct object *o=l->o; if(o->prog) {
3643:
free((char *)l); /* Let the codec do it's job... */
-
apply_low(data->codec, fun, 2);
+
apply_low(data->codec,
decode_
fun, 2);
+
if ((Pike_sp[-1].type == T_ARRAY) &&
+
((fun = FIND_LFUN(o->prog, LFUN_CREATE)) != -1)) {
+
/* Call lfun::create(@args). */
+
INT32 args;
+
Pike_sp--;
+
args = Pike_sp->u.array->size;
+
if (args) {
+
/* Note: Eats reference to the array. */
+
push_array_items(Pike_sp->u.array);
+
} else {
+
free_array(Pike_sp->u.array);
+
}
+
apply_low(o, fun, args);
+
}
pop_stack(); } }