pike.git/
src/
modules/
_Debug/
debug.cmod
Branch:
Tag:
Non-build tags
All tags
No tags
2015-03-16
2015-03-16 16:10:44 by Martin Nilsson <nilsson@opera.com>
64226cb7dfb0381b00561d9814e0483cc3bfed4a (
70
lines) (+
31
/-
39
)
[
Show
|
Annotate
]
Branch:
8.1
cmod-ified the code and fixed so prev and next don't return destructed objects anymore.
123:
*! @seealso *! @[next_object()], @[prev()] */
-
static
void
f__
next(
INT32
args
)
+
PIKEFUN
mixed
next(
mixed
x
)
+
rawtype tOr6(tFunc(tStr,tStr),
+
tFunc(tObj,tObj),
+
tFunc(tMapping,tMapping),
+
tFunc(tMultiset,tMultiset),
+
tFunc(tPrg(tObj),tPrg(tObj)),
+
tFunc(tArray,tArray));
{
-
struct svalue tmp
;
-
-
pop_n_elems(args-1);
-
args
=
1
;
-
tmp=Pike_sp[-1];
+
struct svalue tmp =
*x
;
switch(TYPEOF(tmp)) {
-
case T_OBJECT: tmp.u.object=tmp.u.object->next; break;
+
case T_OBJECT:
+
tmp.u.object=tmp.u.object->next;
+
while(tmp.u.object && !tmp.u.object->prog)
+
tmp.u.object=tmp.u.object->next;
+
break;
case T_ARRAY: tmp.u.array=tmp.u.array->next; break; case T_MAPPING: tmp.u.mapping=tmp.u.mapping->next; break; case T_MULTISET:tmp.u.multiset=tmp.u.multiset->next; break;
142:
SIMPLE_BAD_ARG_ERROR("next", 1, "object|array|mapping|multiset|program|string"); }
+
if(tmp.u.refs)
-
+
assign_svalue(Pike_sp-1, &tmp);
+
else
{
-
assign_svalue(Pike_sp-1,&tmp);
-
}else{
+
pop_stack(); push_int(0); } }
-
PIKEFUN mixed next(mixed x)
-
rawtype tOr6(tFunc(tStr,tStr),
-
tFunc(tObj,tObj),
-
tFunc(tMapping,tMapping),
-
tFunc(tMultiset,tMultiset),
-
tFunc(tPrg(tObj),tPrg(tObj)),
-
tFunc(tArray,tArray));
-
{
-
f__next(1);
-
}
-
+
/*! @decl mixed prev(mixed x) *! *! Find the previous object/array/mapping/multiset or program.
177:
*! @seealso *! @[next_object()], @[next()] */
-
static
void
f__
prev(
INT32
args
)
+
PIKEFUN
mixed
prev(
mixed
x
)
+
rawtype tOr5(tFunc(tObj,tObj),
+
tFunc(tMapping,tMapping),
+
tFunc(tMultiset,tMultiset),
+
tFunc(tPrg(tObj),tPrg(tObj)),
+
tFunc(tArray,tArray));
{
-
struct svalue tmp
;
-
-
pop_n_elems(args-1);
-
args
=
1
;
-
tmp=Pike_sp[-1];
+
struct svalue tmp =
*x
;
switch(TYPEOF(tmp)) {
-
case T_OBJECT: tmp.u.object=tmp.u.object->prev; break;
+
case T_OBJECT:
+
tmp.u.object=tmp.u.object->prev;
+
while(tmp.u.object && !tmp.u.object->prog)
+
tmp.u.object=tmp.u.object->prev;
+
break;
case T_ARRAY: tmp.u.array=tmp.u.array->prev; break; case T_MAPPING: tmp.u.mapping=tmp.u.mapping->prev; break; case T_MULTISET:tmp.u.multiset=tmp.u.multiset->prev; break;
195:
SIMPLE_BAD_ARG_ERROR("prev", 1, "object|array|mapping|multiset|program"); } if(tmp.u.refs)
+
assign_svalue(Pike_sp-1, &tmp);
+
else
{
-
assign_svalue(Pike_sp-1,&tmp);
-
}else{
+
pop_stack(); push_int(0); } }
-
PIKEFUN mixed prev(mixed x)
-
rawtype tOr5(tFunc(tObj,tObj),
-
tFunc(tMapping,tMapping),
-
tFunc(tMultiset,tMultiset),
-
tFunc(tPrg(tObj),tPrg(tObj)),
-
tFunc(tArray,tArray));
-
{
-
f__prev(1);
-
}
-
+
#ifdef PIKE_DEBUG /* This function is for debugging *ONLY* * do not document please. /Hubbe