2003-08-02
2003-08-02 01:10:17 by Martin Stjernholm <mast@lysator.liu.se>
-
684bd25c41df78a5237fd0346d53843c0f3180ea
(57 lines)
(+34/-23)
[
Show
| Annotate
]
Branch: 7.9
Use the symbolic names for the magic values in parent_offset. Fixed a
bug with mixed up variable names in low_inherit. Print a bit more of
the inherit table in dump_program_tables.
Rev: src/program.c:1.511
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: program.c,v 1.510 2003/07/31 14:28:50 tomas Exp $
+ || $Id: program.c,v 1.511 2003/08/02 01:10:17 mast Exp $
*/
#include "global.h"
- RCSID("$Id: program.c,v 1.510 2003/07/31 14:28:50 tomas Exp $");
+ RCSID("$Id: program.c,v 1.511 2003/08/02 01:10:17 mast Exp $");
#include "program.h"
#include "object.h"
#include "dynamic_buffer.h"
2047:
i.identifier_ref_offset=0;
i.parent=0;
i.parent_identifier=-1;
- i.parent_offset=-18;
+ i.parent_offset=OBJECT_PARENT;
i.name=0;
add_to_inherits(i);
}
2387: Inside #if defined(PIKE_DEBUG)
fprintf(stderr, "\n"
"%*sInherit table:\n"
- "%*s ####: Level id_level offset ref_offset\n",
+ "%*s ####: Level prog_id id_level storage_offs "
+ "par_id par_offs par_obj_id id_ref_offs\n",
indent, "", indent, "");
for (d=0; d < p->num_inherits; d++) {
struct inherit *inh = p->inherits + d;
- fprintf(stderr, "%*s %4d: %5d %8d %6d"/* %10d*/"\n",
+ fprintf(stderr, "%*s %4d: %5d %7d %8d %12d %6d %8d %10d %11d\n",
indent, "",
- d, inh->inherit_level, inh->identifier_level,
- inh->storage_offset /*, inh->identifier_ref_offset*/);
+ d, inh->inherit_level,
+ inh->prog ? inh->prog->id : -1,
+ inh->identifier_level, inh->storage_offset,
+ inh->parent_identifier, inh->parent_offset,
+ inh->parent ? inh->parent->program_id : -1,
+ inh->identifier_ref_offset);
}
fprintf(stderr, "\n"
"%*sIdentifier table:\n"
2526: Inside #if defined(PIKE_DEBUG)
p->storage_needed)
Pike_fatal("Not enough room allocated by inherit!\n");
+ if (p->inherits[e].inherit_level == 1 &&
+ p->inherits[e].identifier_level != p->inherits[e].identifier_ref_offset) {
+ dump_program_tables (p, 0);
+ Pike_fatal ("Unexpected difference between identifier_level "
+ "and identifier_ref_offset in inherit %d.\n", e);
+ }
+
if(e)
{
if(p->inherits[e-1].storage_offset >
3225:
if(depth<=0) return depth;
while(depth-->0)
{
- if( (*i)->parent_offset != -17)
+ if( (*i)->parent_offset != INHERIT_PARENT)
{
int tmp=(*i)->parent_identifier;
if( (*i)->parent_offset > 0)
3405:
}else{
inherit.parent=parent;
inherit.parent_identifier=parent_identifier;
- inherit.parent_offset=-17;
+ inherit.parent_offset=INHERIT_PARENT;
}
}else{
inherit.parent_offset=parent_offset;
3416:
{
if(parent && parent->next != parent && inherit.parent_offset)
{
- /* Fake object */
+
struct object *par=parent;
int e,pid=parent_identifier;
3437:
{
struct external_variable_context tmp;
struct inherit *in2=in;
- while(in2->identifier_level >= in->identifier_level) in2--;
+ while(in2->inherit_level >= in->inherit_level) in2--;
tmp.o=par;
tmp.inherit=in2;
tmp.parent_identifier=pid;
3447:
}
break;
- case -17:
+ case INHERIT_PARENT:
pid = in->parent_identifier;
par = in->parent;
break;
- case -18:
+ case OBJECT_PARENT:
/* Ponder: Can we be sure that PROGRAM_USES_PARENT
* doesn't get set later? /mast */
if(par->prog->flags & PROGRAM_USES_PARENT)
3467:
}
inherit.parent=par;
- inherit.parent_offset=-17;
+ inherit.parent_offset=INHERIT_PARENT;
}
}
}
3481:
}
else if(inherit.name)
{
+ /* FIXME: Wide string handling. */
struct pike_string *s;
s=begin_shared_string(inherit.name->len + name->len + 2);
MEMCPY(s->str,name->str,name->len);
3593:
do_inherit(s,flags,name);
return;
}else{
- p=s->u.program;
- }
- }else{
- yyerror("Inherit identifier is not a constant program");
- return;
- }
-
- low_inherit(p,
+ low_inherit(s->u.program,
0,
numid,
offset+42,
flags,
name);
-
+ }
+ }else{
+ yyerror("Inherit identifier is not a constant program");
+ return;
+ }
break;
default:
4047:
}
if(/* c && */ !svalues_are_constant(c,1,BIT_MIXED,0))
- yyerror("Constant values may not have references this_object()");
+ yyerror("Constant values may not have references to this.");
}while(0);