pike.git / src / interpret_functions.h

version» Context lines:

pike.git/src/interpret_functions.h:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: interpret_functions.h,v 1.113 2002/11/02 16:24:10 grubba Exp $ + || $Id: interpret_functions.h,v 1.114 2002/11/10 20:19:18 grubba Exp $   */      /*    * Opcode definitions for the interpreter.    */      #include "global.h"      #undef CJUMP   #undef AUTO_BIGNUM_LOOP_TEST
pike.git/src/interpret_functions.h:51:   #define OPCODE2_RETURN(A, B, F, C) OPCODE2_RETURN(A, B, F) --- C   #define OPCODE0_TAILRETURN(A, B, F, C) OPCODE0_TAILRETURN(A, B, F) --- C   #define OPCODE1_TAILRETURN(A, B, F, C) OPCODE1_TAILRETURN(A, B, F) --- C   #define OPCODE2_TAILRETURN(A, B, F, C) OPCODE2_TAILRETURN(A, B, F) --- C   #define OPCODE0_BRANCH(A, B, F, C) OPCODE0_BRANCH(A, B, F) --- C   #define OPCODE1_BRANCH(A, B, F, C) OPCODE1_BRANCH(A, B, F) --- C   #define OPCODE2_BRANCH(A, B, F, C) OPCODE2_BRANCH(A, B, F) --- C   #define OPCODE0_TAILBRANCH(A, B, F, C) OPCODE0_TAILBRANCH(A, B, F) --- C   #define OPCODE1_TAILBRANCH(A, B, F, C) OPCODE1_TAILBRANCH(A, B, F) --- C   #define OPCODE2_TAILBRANCH(A, B, F, C) OPCODE2_TAILBRANCH(A, B, F) --- C + #define OPCODE0_ALIAS(A, B, F, C) OPCODE0_ALIAS(A, B, F, C) --- FOO + #define OPCODE1_ALIAS(A, B, F, C) OPCODE1_ALIAS(A, B, F, C) --- FOO + #define OPCODE2_ALIAS(A, B, F, C) OPCODE2_ALIAS(A, B, F, C) --- FOO   #endif /* GEN_PROTOS */    -  + #ifndef OPCODE0_ALIAS + #define OPCODE0_ALIAS(A,B,C,D) OPCODE0(A,B,C,{D();}) + #endif /* !OPCODE0_ALIAS */ + #ifndef OPCODE1_ALIAS + #define OPCODE1_ALIAS(A,B,C,D) OPCODE1(A,B,C,{D();}) + #endif /* !OPCODE1_ALIAS */ + #ifndef OPCODE2_ALIAS + #define OPCODE2_ALIAS(A,B,C,D) OPCODE2(A,B,C,{D();}) + #endif /* !OPCODE2_ALIAS */    -  +    /*   #ifndef PROG_COUNTER   #define PROG_COUNTER pc   #endif   */      #ifndef INTER_ESCAPE_CATCH   #define INTER_ESCAPE_CATCH return -2   #endif   
pike.git/src/interpret_functions.h:1474:   OPCODE0(F_ADD_FLOATS, "float+float", 0, {    if(Pike_sp[-1].type == T_FLOAT && Pike_sp[-2].type == T_FLOAT)    {    Pike_sp[-2].u.float_number+=Pike_sp[-1].u.float_number;    Pike_sp--;    }else{    f_add(2);    }   });    - OPCODE0(F_SUBTRACT, "-", 0, { -  o_subtract(); - }); + OPCODE0_ALIAS(F_SUBTRACT, "-", 0, o_subtract); + OPCODE0_ALIAS(F_AND, "&", 0, o_and); + OPCODE0_ALIAS(F_OR, "|", 0, o_or); + OPCODE0_ALIAS(F_XOR, "^", 0, o_xor); + OPCODE0_ALIAS(F_MULTIPLY, "*", 0, o_multiply); + OPCODE0_ALIAS(F_DIVIDE, "/", 0, o_divide); + OPCODE0_ALIAS(F_MOD, "%", 0, o_mod);    - OPCODE0(F_AND, "&", 0, { -  o_and(); - }); -  - OPCODE0(F_OR, "|", 0, { -  o_or(); - }); -  - OPCODE0(F_XOR, "^", 0, { -  o_xor(); - }); -  - OPCODE0(F_MULTIPLY, "*", 0, { -  o_multiply(); - }); -  - OPCODE0(F_DIVIDE, "/", 0, { -  o_divide(); - }); -  - OPCODE0(F_MOD, "%", 0, { -  o_mod(); - }); -  +    OPCODE1(F_ADD_INT, "add integer", 0, {    if(Pike_sp[-1].type == T_INT    DO_IF_BIGNUM(    && (!INT_TYPE_ADD_OVERFLOW(Pike_sp[-1].u.integer, arg1))    )    )    {    Pike_sp[-1].u.integer+=arg1;    }else{    push_int(arg1);
pike.git/src/interpret_functions.h:1652:   });      OPCODE2(F_MAGIC_INDICES, "::_indices", 0, {    push_magic_index(magic_indices_program, arg2, arg1);   });      OPCODE2(F_MAGIC_VALUES, "::_values", 0, {    push_magic_index(magic_values_program, arg2, arg1);   });    - OPCODE0(F_CAST, "cast", 0, { -  f_cast(); - }); + OPCODE0_ALIAS(F_CAST, "cast", 0, f_cast); + OPCODE0_ALIAS(F_CAST_TO_INT, "cast_to_int", 0, o_cast_to_int); + OPCODE0_ALIAS(F_CAST_TO_STRING, "cast_to_string", 0, o_cast_to_string);    - OPCODE0(F_CAST_TO_INT, "cast_to_int", 0, { -  o_cast_to_int(); - }); -  - OPCODE0(F_CAST_TO_STRING, "cast_to_string", 0, { -  o_cast_to_string(); - }); -  +    OPCODE0(F_SOFT_CAST, "soft cast", 0, {    /* Stack: type_string, value */    DO_IF_DEBUG({    if (Pike_sp[-2].type != T_TYPE) {    Pike_fatal("Argument 1 to soft_cast isn't a type!\n");    }    });    if (runtime_options & RUNTIME_CHECK_TYPES) {    struct pike_type *sval_type = get_type_of_svalue(Pike_sp-1);    if (!pike_types_le(sval_type, Pike_sp[-2].u.type)) {
pike.git/src/interpret_functions.h:1727:    struct pike_string *t = describe_type(Pike_sp[-2].u.type);    fprintf(stderr, "Soft cast to %s\n", t->str);    free_string(t);    }    });    }    stack_swap();    pop_stack();   });    - OPCODE0(F_RANGE, "range", 0, { -  o_range(); - }); + OPCODE0_ALIAS(F_RANGE, "range", 0, o_range);      OPCODE0(F_COPY_VALUE, "copy_value", 0, {    struct svalue tmp;    copy_svalues_recursively_no_free(&tmp,Pike_sp-1,1,0);    free_svalue(Pike_sp-1);    Pike_sp[-1]=tmp;   });      OPCODE0(F_INDIRECT, "indirect", 0, {    struct svalue s;
pike.git/src/interpret_functions.h:1768:   OPCODE0(F_SIZEOF, "sizeof", 0, {    INT32 val = pike_sizeof(Pike_sp-1);    pop_stack();    push_int(val);   });      OPCODE1(F_SIZEOF_LOCAL, "sizeof local", 0, {    push_int(pike_sizeof(Pike_fp->locals+arg1));   });    - OPCODE1(F_SSCANF, "sscanf", 0, { -  o_sscanf(arg1); - }); + OPCODE1_ALIAS(F_SSCANF, "sscanf", 0, o_sscanf);      #define MKAPPLY(OP,OPCODE,NAME,TYPE, ARG2, ARG3) \   OP(PIKE_CONCAT(F_,OPCODE),NAME, I_PC_AT_NEXT, { \   Pike_fp->pc=PROG_COUNTER; \   if(low_mega_apply(TYPE,DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp)), \    ARG2, ARG3)) \   { \    Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL; \    DO_JUMP_TO(Pike_fp->pc); \   } \