From b103b3efbfc99a4872c2e2c6c795f85811b46c53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Grubbstr=C3=B6m=20=28Grubba=29?= <grubba@grubba.org> Date: Tue, 20 Feb 2001 14:02:12 +0100 Subject: [PATCH] Various f_cast()-related fixes. Rev: src/interpret_functions.h:1.47 Rev: src/module_support.c:1.40 Rev: src/modules/Gmp/mpz_glue.c:1.88 Rev: src/modules/files/file.c:1.212 Rev: src/opcodes.c:1.100 Rev: src/operators.c:1.124 --- src/interpret_functions.h | 7 +++---- src/module_support.c | 10 +++++----- src/modules/Gmp/mpz_glue.c | 6 +++--- src/modules/files/file.c | 4 ++-- src/opcodes.c | 5 +++-- src/operators.c | 6 +++--- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/interpret_functions.h b/src/interpret_functions.h index 9f1adc096d..98e4175223 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 d3f753067e..ebca1d5a85 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 67333fce44..a5b0638b4c 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 c15aede0af..0a0e8c0e90 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 8242d62ee8..6c4b47fb1e 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 4fb15998ad..332685b386 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; -- GitLab