pike.git/
src/
builtin_functions.c
Branch:
Tag:
Non-build tags
All tags
No tags
1999-12-22
1999-12-22 00:26:37 by Henrik Grubbström (Grubba) <grubba@grubba.org>
70c9260c68d40b9049ef4670760cd68aef37e33f (
31
lines) (+
29
/-
2
)
[
Show
|
Annotate
]
Branch:
7.9
Now fixed the type of object_program().
Rev: src/builtin_functions.c:1.225
5:
\*/ /**/ #include "global.h"
-
RCSID("$Id: builtin_functions.c,v 1.
224
1999/12/
14
08
:
38
:
07
hubbe
Exp $");
+
RCSID("$Id: builtin_functions.c,v 1.
225
1999/12/
22
00
:
26
:
37
grubba
Exp $");
#include "interpret.h" #include "svalue.h" #include "pike_macros.h"
1811:
push_int(0); }
+
node *fix_object_program_type(node *n)
+
{
+
/* Fix the type for a common case:
+
*
+
* object_program(object(is|implements foo))
+
*/
+
node *nn;
+
struct pike_string *new_type = NULL;
+
+
if (!n->type) {
+
copy_shared_string(n->type, program_type_string);
+
}
+
if (!(nn = CDR(n))) return NULL;
+
if ((nn->token == F_ARG_LIST) && (!(nn = CAR(nn)))) return NULL;
+
if (!nn->type) return NULL;
+
+
/* Perform the actual conversion. */
+
new_type = object_type_to_program_type(nn->type);
+
if (new_type) {
+
free_string(n->type);
+
n->type = new_type;
+
}
+
return NULL;
+
}
+
void f_reverse(INT32 args) { if(args < 1)
5510:
tFunc(tArray,tArray)),OPT_EXTERNAL_DEPEND); /* function(mixed:program) */
-
ADD_
EFUN
("object_program",f_object_program,tFunc(tMix,tPrg),0);
+
ADD_
EFUN2
("object_program",
f_object_program,tFunc(tMix,
tPrg),
+
OPT_TRY_OPTIMIZE, fix_object_program_type,
0);
/* function(mixed:int) */ ADD_EFUN("objectp", f_objectp,tFunc(tMix,tInt),0);