diff --git a/src/interpret_functions.h b/src/interpret_functions.h index 51fe1365d50e5d6236035a1fc74dff2e923ef311..1ef9d46a56ccbb535152546daa7cbca4bad39681 100644 --- a/src/interpret_functions.h +++ b/src/interpret_functions.h @@ -1,5 +1,5 @@ /* - * $Id: interpret_functions.h,v 1.13 2000/04/20 14:03:39 grubba Exp $ + * $Id: interpret_functions.h,v 1.14 2000/04/20 22:30:08 grubba Exp $ * * Opcode definitions for the interpreter. */ @@ -394,30 +394,40 @@ OPCODE1(F_INC_LOCAL, "++local") } BREAK; - CASE(F_POST_INC_LOCAL); - instr=GET_ARG(); - assign_svalue_no_free(Pike_sp++,Pike_fp->locals+instr); - goto inc_local_and_pop; +OPCODE1(F_POST_INC_LOCAL, "local++") + assign_svalue_no_free(Pike_sp++, Pike_fp->locals + arg1); + if( (Pike_fp->locals[arg1].type == PIKE_T_INT) +#ifdef AUTO_BIGNUM + && (!INT_TYPE_ADD_OVERFLOW(Pike_fp->locals[arg1].u.integer, 1)) +#endif /* AUTO_BIGNUM */ + ) + { + Pike_fp->locals[arg1].u.integer++; + } else { + assign_svalue_no_free(Pike_sp++, Pike_fp->locals + arg1); + push_int(1); + f_add(2); + assign_svalue(Pike_fp->locals + arg1, Pike_sp-1); + pop_stack(); + } +BREAK; - CASE(F_INC_LOCAL_AND_POP); - instr=GET_ARG(); - inc_local_and_pop: +OPCODE1(F_INC_LOCAL_AND_POP, "++local and pop") + if( (Pike_fp->locals[arg1].type == PIKE_T_INT) #ifdef AUTO_BIGNUM - if(Pike_fp->locals[instr].type == PIKE_T_INT && - !INT_TYPE_ADD_OVERFLOW(Pike_fp->locals[instr].u.integer, 1)) -#else - if(Pike_fp->locals[instr].type == PIKE_T_INT) + && (!INT_TYPE_ADD_OVERFLOW(Pike_fp->locals[arg1].u.integer, 1)) #endif /* AUTO_BIGNUM */ - { - Pike_fp->locals[instr].u.integer++; - }else{ - assign_svalue_no_free(Pike_sp++,Pike_fp->locals+instr); - push_int(1); - f_add(2); - assign_svalue(Pike_fp->locals+instr,Pike_sp-1); - pop_stack(); - } - break; + ) + { + Pike_fp->locals[arg1].u.integer++; + } else { + assign_svalue_no_free(Pike_sp++, Pike_fp->locals + arg1); + push_int(1); + f_add(2); + assign_svalue(Pike_fp->locals + arg1, Pike_sp-1); + pop_stack(); + } +BREAK; OPCODE1(F_DEC_LOCAL, "--local") instr = arg1; @@ -437,32 +447,41 @@ OPCODE1(F_DEC_LOCAL, "--local") } BREAK; - CASE(F_POST_DEC_LOCAL); - instr=GET_ARG(); - assign_svalue_no_free(Pike_sp++,Pike_fp->locals+instr); - goto dec_local_and_pop; - /* Pike_fp->locals[instr].u.integer--; */ - break; +OPCODE1(F_POST_DEC_LOCAL, "local--") + assign_svalue_no_free(Pike_sp++, Pike_fp->locals + arg1); + if( (Pike_fp->locals[arg1].type == PIKE_T_INT) +#ifdef AUTO_BIGNUM + && (!INT_TYPE_SUB_OVERFLOW(Pike_fp->locals[arg1].u.integer, 1)) +#endif /* AUTO_BIGNUM */ + ) + { + Pike_fp->locals[arg1].u.integer--; + } else { + assign_svalue_no_free(Pike_sp++, Pike_fp->locals + arg1); + push_int(1); + o_subtract(); + assign_svalue(Pike_fp->locals + arg1, Pike_sp-1); + pop_stack(); + } + /* Pike_fp->locals[instr].u.integer--; */ +BREAK; - CASE(F_DEC_LOCAL_AND_POP); - instr=GET_ARG(); - dec_local_and_pop: +OPCODE1(F_DEC_LOCAL_AND_POP, "--local and pop") + if( (Pike_fp->locals[arg1].type == PIKE_T_INT) #ifdef AUTO_BIGNUM - if(Pike_fp->locals[instr].type == PIKE_T_INT && - !INT_TYPE_SUB_OVERFLOW(Pike_fp->locals[instr].u.integer, 1)) -#else - if(Pike_fp->locals[instr].type == PIKE_T_INT) + && (!INT_TYPE_SUB_OVERFLOW(Pike_fp->locals[arg1].u.integer, 1)) #endif /* AUTO_BIGNUM */ - { - Pike_fp->locals[instr].u.integer--; - }else{ - assign_svalue_no_free(Pike_sp++,Pike_fp->locals+instr); - push_int(1); - o_subtract(); - assign_svalue(Pike_fp->locals+instr,Pike_sp-1); - pop_stack(); - } - break; + ) + { + Pike_fp->locals[arg1].u.integer--; + } else { + assign_svalue_no_free(Pike_sp++, Pike_fp->locals + arg1); + push_int(1); + o_subtract(); + assign_svalue(Pike_fp->locals + arg1, Pike_sp-1); + pop_stack(); + } +BREAK; OPCODE0(F_LTOSVAL, "lvalue to svalue") lvalue_to_svalue_no_free(Pike_sp, Pike_sp-2); diff --git a/src/lex.c b/src/lex.c index 84cbbf546b4ef924ef4ddda63d8ef067515cd4b9..dc6d3a75de66b7ad31ef709b0dc26c176d145155 100644 --- a/src/lex.c +++ b/src/lex.c @@ -5,7 +5,7 @@ \*/ /**/ #include "global.h" -RCSID("$Id: lex.c,v 1.75 2000/04/20 14:03:52 grubba Exp $"); +RCSID("$Id: lex.c,v 1.76 2000/04/20 22:30:21 grubba Exp $"); #include "language.h" #include "array.h" #include "lex.h" @@ -166,10 +166,6 @@ struct keyword instr_names[]= { "label", F_LABEL,I_HASARG }, { "align", F_ALIGN, I_HASARG }, { "call", F_APPLY, I_HASARG }, -{ "++local and pop", F_INC_LOCAL_AND_POP, I_HASARG }, -{ "local++", F_POST_INC_LOCAL, I_HASARG }, -{ "--local and pop", F_DEC_LOCAL_AND_POP, I_HASARG }, -{ "local--", F_POST_DEC_LOCAL, I_HASARG }, { "int index", F_POS_INT_INDEX, I_HASARG }, { "-int index", F_NEG_INT_INDEX, I_HASARG }, { "apply and pop", F_APPLY_AND_POP, I_HASARG },