pike.git/
src/
encode.c
Branch:
Tag:
Non-build tags
All tags
No tags
2008-05-26
2008-05-26 12:15:35 by Henrik Grubbström (Grubba) <grubba@grubba.org>
ec414a48370220d8ef9cb5bd3182c7101d021ad3 (
67
lines) (+
40
/-
27
)
[
Show
|
Annotate
]
Branch:
7.9
More __register_new_program()-realated fixes.
Rev: src/encode.c:1.272
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.
271
2008/05/26
10
:
41
:
23
grubba Exp $
+
|| $Id: encode.c,v 1.
272
2008/05/26
12
:
15
:
35
grubba Exp $
*/ #include "global.h"
3772:
ptrdiff_t old_pragmas; struct compilation *c; struct pike_string *save_current_file;
+
struct object *placeholder = NULL;
unsigned INT32 save_current_line; #define FOO(NUMTYPE,Y,ARGTYPE,NAME) \ NUMTYPE PIKE_CONCAT(local_num_, NAME) = 0;
3853:
SET_ONERROR(err, cleanup_new_program_decode, NULL);
-
/*
FIXME:
Ought
to
accept
codecs
without
__register_new_program
().
*/
+
{
+
int fun = find
_
identifier("
_
_
register_new_program
",
+
data->codec->prog
)
;
-
+
if (fun >= 0) {
ref_push_program(p);
-
apply(data->codec,
"__register_new_program"
, 1);
+
apply
_low
(data->codec,
fun
, 1);
/* Returned a placeholder */ if(Pike_sp[-1].type == T_OBJECT)
3872:
"from __register_new_program.\n"); } pop_stack();
+
}
+
}
copy_shared_string(save_current_file, c->lex.current_file); save_current_line = c->lex.current_line;
4531:
push_program(p); if (c->placeholder) {
-
if
(
c->
placeholder
->prog
!
=
null_program
)
{
-
Pike_error("Placeholder has been zapped during decoding.\n")
;
+
push_object(placeholder
=
c->placeholder)
;
+
c->placeholder
=
NULL
;
}
-
debug_malloc_touch(c->placeholder);
-
free_program(c->placeholder->prog);
-
add_ref(c->placeholder->prog = p);
-
c->placeholder->storage = p->storage_needed ?
-
(char *)xalloc(p->storage_needed) :
-
(char *)NULL;
-
call_c_initializers(c->placeholder);
-
call_pike_initializers(c->placeholder,0);
-
}
+
exit_compiler();
4626:
EDB(5, fprintf(stderr, "%*sProgram flags: 0x%04x\n", data->depth, "", p->flags));
+
if (placeholder) {
+
if (placeholder->prog != null_program) {
+
Pike_error("Placeholder has been zapped during decoding.\n");
+
}
+
debug_malloc_touch(placeholder);
+
free_program(placeholder->prog);
+
add_ref(placeholder->prog = p);
+
placeholder->storage = p->storage_needed ?
+
(char *)xalloc(p->storage_needed) :
+
(char *)NULL;
+
call_c_initializers(placeholder);
+
call_pike_initializers(placeholder, 0);
+
pop_stack();
+
}
+
#ifdef ENCODE_DEBUG data->depth -= 2; #endif