diff --git a/src/interpret_functions.h b/src/interpret_functions.h index 9f1adc096d234d488e4d1bcbbca05beb52e83b35..98e417522313de46ac4b0a83253bc047e601463c 100644 --- a/src/interpret_functions.h +++ b/src/interpret_functions.h @@ -1,5 +1,5 @@ /* - * $Id: interpret_functions.h,v 1.46 2001/02/20 00:01:00 grubba Exp $ + * $Id: interpret_functions.h,v 1.47 2001/02/20 13:02:11 grubba Exp $ * * Opcode definitions for the interpreter. */ @@ -1395,9 +1395,8 @@ BREAK; OPCODE0(F_SOFT_CAST, "soft cast") /* Stack: type_string, value */ #ifdef PIKE_DEBUG - if (Pike_sp[-2].type != T_STRING) { - /* FIXME: The type should really be T_TYPE... */ - fatal("Argument 1 to soft_cast isn't a string!\n"); + if (Pike_sp[-2].type != T_TYPE) { + fatal("Argument 1 to soft_cast isn't a type!\n"); } #endif /* PIKE_DEBUG */ if (runtime_options & RUNTIME_CHECK_TYPES) { diff --git a/src/module_support.c b/src/module_support.c index d3f753067ebfc735dd379371495a1bc1144bd580..ebca1d5a856bc4d455de9269041041408a2bc33b 100644 --- a/src/module_support.c +++ b/src/module_support.c @@ -7,8 +7,9 @@ #include "pike_error.h" #include "mapping.h" #include "object.h" +#include "opcodes.h" -RCSID("$Id: module_support.c,v 1.39 2000/12/13 21:35:05 hubbe Exp $"); +RCSID("$Id: module_support.c,v 1.40 2001/02/20 13:02:11 grubba Exp $"); /* Checks that args_to_check arguments are OK. * Returns 1 if everything worked ok, zero otherwise. @@ -145,7 +146,6 @@ int va_get_args(struct svalue *s, va_list ap) { int ret=0; - extern void f_cast(); while(*fmt) { @@ -177,7 +177,7 @@ int va_get_args(struct svalue *s, DO_NOT_WARN((int)s->u.float_number); else { - push_text( "int" ); + ref_push_type_value(int_type_string); push_svalue( s ); f_cast( ); if(sp[-1].type == T_INT) @@ -197,7 +197,7 @@ int va_get_args(struct svalue *s, *va_arg(ap, INT_TYPE *) = DO_NOT_WARN((INT_TYPE)s->u.float_number); else { - push_text( "int" ); + ref_push_type_value(int_type_string); push_svalue( s ); f_cast( ); if(sp[-1].type == T_INT) @@ -247,7 +247,7 @@ int va_get_args(struct svalue *s, *va_arg(ap, FLOAT_TYPE *)=(float)s->u.integer; else { - push_text( "float" ); + ref_push_type_value(float_type_string); push_svalue( s ); f_cast( ); *va_arg(ap, FLOAT_TYPE *)=sp[-1].u.float_number; diff --git a/src/modules/Gmp/mpz_glue.c b/src/modules/Gmp/mpz_glue.c index 67333fce447ae68c046fc0476a67b8c7a3f07769..a5b0638b4cbbefcc8e8bb33879cc8e63a0065d5a 100644 --- a/src/modules/Gmp/mpz_glue.c +++ b/src/modules/Gmp/mpz_glue.c @@ -4,7 +4,7 @@ ||| See the files COPYING and DISCLAIMER for more information. \*/ #include "global.h" -RCSID("$Id: mpz_glue.c,v 1.87 2001/02/04 11:40:35 hubbe Exp $"); +RCSID("$Id: mpz_glue.c,v 1.88 2001/02/20 13:02:12 grubba Exp $"); #include "gmp_machine.h" #if defined(HAVE_GMP2_GMP_H) && defined(HAVE_LIBGMP2) @@ -1228,7 +1228,7 @@ static void mpzmod_lsh(INT32 args) struct object *res = NULL; if (args != 1) Pike_error("Wrong number of arguments to Gmp.mpz->`<<.\n"); - ref_push_string(int_type_string); + ref_push_type_value(int_type_string); stack_swap(); f_cast(); if(sp[-1].u.integer < 0) @@ -1244,7 +1244,7 @@ static void mpzmod_rsh(INT32 args) struct object *res = NULL; if (args != 1) Pike_error("Wrong number of arguments to Gmp.mpz->`>>.\n"); - ref_push_string(int_type_string); + ref_push_type_value(int_type_string); stack_swap(); f_cast(); if (sp[-1].u.integer < 0) diff --git a/src/modules/files/file.c b/src/modules/files/file.c index c15aede0af446528092bcbce381310e3dbaaaf59..0a0e8c0e909dc7938094e66b29b58d566022da69 100644 --- a/src/modules/files/file.c +++ b/src/modules/files/file.c @@ -6,7 +6,7 @@ /**/ #define NO_PIKE_SHORTHAND #include "global.h" -RCSID("$Id: file.c,v 1.211 2001/02/15 18:48:24 grubba Exp $"); +RCSID("$Id: file.c,v 1.212 2001/02/20 13:02:12 grubba Exp $"); #include "fdlib.h" #include "interpret.h" #include "svalue.h" @@ -2658,7 +2658,7 @@ static void file_lsh(INT32 args) if(Pike_sp[-1].type != PIKE_T_STRING) { - ref_push_string(string_type_string); + ref_push_type_value(string_type_string); stack_swap(); f_cast(); } diff --git a/src/opcodes.c b/src/opcodes.c index 8242d62ee8e1f8a637fa6f9e037ed066e487b30b..6c4b47fb1efc79e7f504bb683935aa8677f3e42f 100644 --- a/src/opcodes.c +++ b/src/opcodes.c @@ -26,7 +26,7 @@ #include "bignum.h" #include "operators.h" -RCSID("$Id: opcodes.c,v 1.99 2001/02/19 23:50:01 grubba Exp $"); +RCSID("$Id: opcodes.c,v 1.100 2001/02/20 13:02:11 grubba Exp $"); void index_no_free(struct svalue *to,struct svalue *what,struct svalue *ind) { @@ -644,7 +644,8 @@ PMOD_EXPORT void f_cast(void) #ifdef PIKE_DEBUG struct svalue *save_sp=sp; if(sp[-2].type != T_TYPE) - fatal("Cast expression destroyed stack or left droppings!\n"); + fatal("Cast expression destroyed stack or left droppings! (Type:%d)\n", + sp[-2].type); #endif o_cast(sp[-2].u.type, compile_type_to_runtime_type(sp[-2].u.string)); diff --git a/src/operators.c b/src/operators.c index 4fb15998ad899523907ba7f16cf9c93241d17bd8..332685b386074d33acf76597c1830007b66793a2 100644 --- a/src/operators.c +++ b/src/operators.c @@ -6,7 +6,7 @@ /**/ #include "global.h" #include <math.h> -RCSID("$Id: operators.c,v 1.123 2001/02/08 19:28:10 grubba Exp $"); +RCSID("$Id: operators.c,v 1.124 2001/02/20 13:02:12 grubba Exp $"); #include "interpret.h" #include "svalue.h" #include "multiset.h" @@ -806,7 +806,7 @@ static int float_promote(void) if(is_bignum_object_in_svalue(sp-2) && sp[-1].type==T_FLOAT) { stack_swap(); - push_constant_text(tFloat); + ref_push_type_value(float_type_string); stack_swap(); f_cast(); stack_swap(); @@ -814,7 +814,7 @@ static int float_promote(void) } else if(is_bignum_object_in_svalue(sp-1) && sp[-2].type==T_FLOAT) { - push_constant_text(tFloat); + ref_push_type_value(float_type_string); stack_swap(); f_cast(); return 1;