diff --git a/src/docode.c b/src/docode.c index 119cc3049222d7d1611cbad9752af8b027572714..fb65718279fc2008a3039e668356f9891f65cb29 100644 --- a/src/docode.c +++ b/src/docode.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: docode.c,v 1.59 1999/12/12 19:48:38 grubba Exp $"); +RCSID("$Id: docode.c,v 1.60 1999/12/13 01:21:13 grubba Exp $"); #include "las.h" #include "program.h" #include "language.h" @@ -706,8 +706,7 @@ static int do_docode2(node *n,int flags) return 1; case F_SOFT_CAST: - /* FIXME: Should probably be some other flag */ - if (d_flag) { + if (runtime_options & RUNTIME_CHECK_TYPES) { tmp1 = store_prog_string(n->type); emit(F_STRING, tmp1); tmp1 = do_docode(CAR(n), 0); diff --git a/src/interpreter.h b/src/interpreter.h index d2640d5ad2821651c8070ace244a31d7672ddcac..1e5deeefbae51c39565df065bb4e92b41146cd40 100644 --- a/src/interpreter.h +++ b/src/interpreter.h @@ -1299,8 +1299,7 @@ static int eval_instruction(unsigned char *pc) fatal("Argument 1 to soft_cast isn't a string!\n"); } #endif /* PIKE_DEBUG */ - /* FIXME: Should probably be some other flag */ - if (d_flag) { + if (runtime_options & RUNTIME_CHECK_TYPES) { struct pike_string *sval_type = get_type_of_svalue(sp-1); if (!pike_types_le(sval_type, sp[-2].u.string)) { struct pike_string *t; diff --git a/src/language.yacc b/src/language.yacc index b7eb30b2f5284af03a231512179ea2fa1fb160ee..73a28d9eec3fe58ac41f052bd83d3ba98a42b4d0 100644 --- a/src/language.yacc +++ b/src/language.yacc @@ -184,7 +184,7 @@ /* This is the grammar definition of Pike. */ #include "global.h" -RCSID("$Id: language.yacc,v 1.142 1999/12/13 00:22:49 grubba Exp $"); +RCSID("$Id: language.yacc,v 1.143 1999/12/13 01:21:12 grubba Exp $"); #ifdef HAVE_MEMORY_H #include <memory.h> #endif @@ -691,7 +691,8 @@ def: modifiers type_or_error optional_stars F_IDENTIFIER my_yyerror("Missing name for argument %d.",e); } else { /* FIXME: Should probably use some other flag. */ - if (d_flag && (compiler_pass == 2) && + if ((runtime_options & RUNTIME_CHECK_TYPES) && + (compiler_pass == 2) && (compiler_frame->variable[e].type != mixed_type_string)) { node *local_node; diff --git a/src/main.c b/src/main.c index 6946a93c75dd50310a55316ccfbbad1e2ff6264c..51d7e4fd98259d66d7c9229926515bd90438688b 100644 --- a/src/main.c +++ b/src/main.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: main.c,v 1.78 1999/12/05 15:32:15 grubba Exp $"); +RCSID("$Id: main.c,v 1.79 1999/12/13 01:21:10 grubba Exp $"); #include "fdlib.h" #include "backend.h" #include "module.h" @@ -57,6 +57,7 @@ char *master_file; char **ARGV; int debug_options=0; +int runtime_options=0; int d_flag=0; int c_flag=0; int t_flag=0; @@ -312,23 +313,34 @@ int dbm_main(int argc, char **argv) case 's': debug_options|=DEBUG_SIGNALS; p++; - d_flag--; goto more_d_flags; case 't': debug_options|=NO_TAILRECURSION; p++; - d_flag--; goto more_d_flags; - case 'T': - debug_options|=DEBUG_TYPES; + default: + d_flag += (p[0] == 'd'); p++; - d_flag--; - goto more_d_flags; + } + break; - default: - d_flag++,p++; + case 'r': + more_w_flags: + switch(p[1]) { + case 't': + runtime_options |= RUNTIME_CHECK_TYPES; + p++; + goto more_w_flags; + + case 'T': + runtime_options |= RUNTIME_STRICT_TYPES; + p++; + goto more_w_flags; + + default: + break; } break; diff --git a/src/main.h b/src/main.h index c1c06ce08fcf65fe8cde29206a769a4717aff422..3f7ca199a7761436ab9523e8ec92ac06cdd4d511 100644 --- a/src/main.h +++ b/src/main.h @@ -5,23 +5,28 @@ \*/ /* - * $Id: main.h,v 1.11 1999/12/05 15:31:28 grubba Exp $ + * $Id: main.h,v 1.12 1999/12/13 01:21:11 grubba Exp $ */ #ifndef MAIN_H #define MAIN_H #include "callback.h" -extern int d_flag, t_flag, a_flag, l_flag, c_flag, p_flag, debug_options; +extern int d_flag, t_flag, a_flag, l_flag, c_flag, p_flag; +extern int debug_options, runtime_options; extern int default_t_flag; #ifdef TRY_USE_MMX extern int try_use_mmx; #endif +/* Debug options */ #define DEBUG_SIGNALS 1 #define NO_TAILRECURSION 2 -#define DEBUG_TYPES 4 + +/* Runtime options */ +#define RUNTIME_CHECK_TYPES 1 +#define RUNTIME_STRICT_TYPES 2 /* Prototypes begin here */ struct callback *add_post_master_callback(callback_func call,