pike.git/
src/
interpret.c
Branch:
Tag:
Non-build tags
All tags
No tags
2006-01-20
2006-01-20 17:55:50 by Henrik Grubbström (Grubba) <grubba@grubba.org>
558620980850cd3d44f658d0d05dab415a79be08 (
57
lines) (+
55
/-
2
)
[
Show
|
Annotate
]
Branch:
7.9
Added some documentation and some more debug at trace level 6.
Rev: src/interpret.c:1.366
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: interpret.c,v 1.
365
2005
/
12
/
31
03
:
37
:
14
nilsson
Exp $
+
|| $Id: interpret.c,v 1.
366
2006
/
01
/
20
17
:
55
:
50
grubba
Exp $
*/ #include "global.h"
574:
#endif ;
+
/* Find the lexical scope @[depth] levels out.
+
*
+
* @[loc]:
+
* Input:
+
* struct object *o // object to start from.
+
* struct inherit *inherit // inherit in o->prog.
+
* int parent_identifier // identifier in o to start from.
+
*
+
* Output:
+
* struct object *o // object containing the scope.
+
* struct inherit *inherit // inherit in o->prog being the scope.
+
* int parent_identifier // identifier in o from the inherit.
+
*/
PMOD_EXPORT void find_external_context(struct external_variable_context *loc, int depth) {
636:
{ default: {
+
/* Find the program that inherited us. */
int my_level = inh->inherit_level; #ifdef PIKE_DEBUG if(!my_level)
643:
#endif while(loc->inherit->inherit_level >= my_level) {
-
TRACE((5,"- inherit-- (%d >= %d)\n",loc->inherit->inherit_level, my_level));
+
TRACE((5,"- inherit-- (%d >= %d)\n",
+
loc->inherit->inherit_level, my_level));
loc->inherit--;
-
+
TRACE((5, "- identifier_level: %d\n",
+
loc->inherit->identifier_level));
} find_external_context(loc, inh->parent_offset);
-
+
TRACE((5,
+
"- inh->parent_identifier: %d\n"
+
"- inh->identifier_level: %d\n"
+
"- loc->parent_identifier: %d\n"
+
"- loc->inherit->parent_offset: %d\n"
+
"- loc->inherit->identifier_level: %d\n",
+
inh->parent_identifier,
+
inh->identifier_level,
+
loc->parent_identifier,
+
loc->inherit->parent_offset,
+
loc->inherit->identifier_level));
+
loc->parent_identifier = inh->parent_identifier + loc->inherit->identifier_level;
-
+
TRACE((5, "- parent_identifier: %d\n", loc->parent_identifier));
} break;
658:
TRACE((5,"- Following inherit->parent\n")); loc->parent_identifier=inh->parent_identifier; loc->o=inh->parent;
+
#ifdef PIKE_DEBUG
+
TRACE((5, "- parent_identifier: %d\n"
+
"- o: %p\n"
+
"- inh: %d\n",
+
loc->parent_identifier,
+
loc->o,
+
loc->inherit - loc->o->prog->inherits));
+
if(Pike_interpreter.trace_level>5) {
+
dump_program_tables(loc->o->prog, 4);
+
}
+
#endif
break; case OBJECT_PARENT:
672:
loc->parent_identifier=LOW_PARENT_INFO(loc->o,p)->parent_identifier; loc->o=LOW_PARENT_INFO(loc->o,p)->parent;
+
#ifdef PIKE_DEBUG
+
TRACE((5, "- parent_identifier: %d\n"
+
"- o: %p\n",
+
loc->parent_identifier,
+
loc->o));
+
if(Pike_interpreter.trace_level>5) {
+
dump_program_tables(loc->o->prog, 4);
+
}
+
#endif
break; }
706:
loc->parent_identifier); #endif loc->inherit=INHERIT_FROM_INT(p, loc->parent_identifier);
+
TRACE((5, "- loc->inherit: %d\n",
+
loc->inherit - loc->o->prog->inherits));
} else /* Return a valid pointer to a dummy inherit for the convenience