pike.git / src / lex.c

version» Context lines:

pike.git/src/lex.c:1:   /*\   ||| This file a part of Pike, and is copyright by Fredrik Hubinette   ||| Pike is distributed as GPL (General Public License)   ||| See the files COPYING and DISCLAIMER for more information.   \*/   #include "global.h" - RCSID("$Id: lex.c,v 1.45 1998/03/22 06:19:37 hubbe Exp $"); + RCSID("$Id: lex.c,v 1.46 1998/03/31 21:52:20 hubbe Exp $");   #include "language.h"   #include "array.h"   #include "lex.h"   #include "stralloc.h"   #include "dynamic_buffer.h"   #include "constants.h"   #include "hashtable.h"   #include "stuff.h"   #include "pike_memory.h"   #include "interpret.h"
pike.git/src/lex.c:31:   #endif      #include <ctype.h>   #include <math.h>   #include <fcntl.h>   #include <errno.h>   #include "time_stuff.h"      #define LEXDEBUG 0    + #ifdef INSTR_PROFILING + int last_instruction=0; + #endif +    void exit_lex(void)   {   #ifdef DEBUG    if(p_flag)    {    int e;    fprintf(stderr,"Opcode usage: (opcode, runned, compiled)\n");    for(e=0;e<F_MAX_OPCODE-F_OFFSET;e++)    {    fprintf(stderr,":: %-20s %8ld %8ld\n",    low_get_f_name(e+F_OFFSET,0),    (long)instrs[e].runs,    (long)instrs[e].compiles);    } -  +  + #ifdef INSTR_PROFILING +  for(e=0;e<F_MAX_OPCODE-F_OFFSET;e++) +  { +  int d; +  for(d=0;d<256;d++) +  if(instrs[e].reruns[d]) +  fprintf(stderr,"%010ld::%s - %s\n",instrs[e].reruns[d],low_get_f_name(e+F_OFFSET,0),low_get_f_name(d+F_OFFSET,0));    }   #endif    } -  + #endif + }      struct keyword instr_names[]=   {   { "!", F_NOT },   { "!=", F_NE },   { "%", F_MOD },   { "%=", F_MOD_EQ },   { "& global", F_GLOBAL_LVALUE, I_HASARG },   { "& local", F_LOCAL_LVALUE, I_HASARG },   { "&", F_AND },
pike.git/src/lex.c:108:   { "constant", F_CONSTANT, I_HASARG },   { "continue", F_CONTINUE },   { "copy_value", F_COPY_VALUE },   { "default", F_DEFAULT },   { "do-while", F_DO },   { "dumb return", F_DUMB_RETURN },   { "float number", F_FLOAT },   { "for", F_FOR },   { "global", F_GLOBAL, I_HASARG },   { "index", F_INDEX }, - { "->", F_ARROW, I_HASARG }, + { "->x", F_ARROW, I_HASARG }, + { "object(const)->func", F_STRICT_ARROW, I_HASARG }, + { "object(const)->var", F_STRICT_ARROW_VARIABLE, I_HASARG },   { "clear string subtype", F_CLEAR_STRING_SUBTYPE },   { "arrow string", F_ARROW_STRING, I_HASARG },   { "indirect", F_INDIRECT },      { "branch", F_BRANCH, I_ISJUMP },   { "branch non zero", F_BRANCH_WHEN_NON_ZERO, I_ISJUMP }, -  + { "branch if local", F_BRANCH_IF_LOCAL, I_HASARG },   { "branch when zero", F_BRANCH_WHEN_ZERO, I_ISJUMP },   { "branch if <", F_BRANCH_WHEN_LT, I_ISJUMP },   { "branch if >", F_BRANCH_WHEN_GT, I_ISJUMP },   { "branch if <=", F_BRANCH_WHEN_LE, I_ISJUMP },   { "branch if >=", F_BRANCH_WHEN_GE, I_ISJUMP },   { "branch if ==", F_BRANCH_WHEN_EQ, I_ISJUMP },   { "branch if !=", F_BRANCH_WHEN_NE, I_ISJUMP },   { "++Loop", F_INC_LOOP, I_ISJUMP },   { "++Loop!=", F_INC_NEQ_LOOP, I_ISJUMP },   { "--Loop", F_DEC_LOOP, I_ISJUMP },   { "--Loop!=", F_DEC_NEQ_LOOP, I_ISJUMP },   { "&&", F_LAND, I_ISJUMP },   { "||", F_LOR, I_ISJUMP },   { "==||", F_EQ_OR, I_ISJUMP },   { "==&&", F_EQ_AND, I_ISJUMP },   { "catch", F_CATCH, I_ISJUMP },   { "foreach", F_FOREACH, I_ISJUMP }, - { "data", F_POINTER, I_ISPOINTER }, + { "pointer", F_POINTER, I_ISPOINTER }, + { "data", F_DATA, I_DATA },      { "local function call",F_CALL_LFUN, I_HASARG },   { "local function call and pop",F_CALL_LFUN_AND_POP, I_HASARG },   { "local function", F_LFUN, I_HASARG },   { "local", F_LOCAL, I_HASARG },   { "external", F_EXTERNAL, I_HASARG },   { "& external", F_EXTERNAL_LVALUE, I_HASARG },   { "LDA", F_LDA, I_HASARG },   { "mark & local", F_MARK_AND_LOCAL, I_HASARG },   { "ltosval2", F_LTOSVAL2 },   { "lvalue to svalue", F_LTOSVAL },   { "lvalue_list", F_LVALUE_LIST },   { "[ lvalues ]", F_ARRAY_LVALUE, I_HASARG }, -  + { "mark sp-X", F_MARK_X, I_HASARG },   { "mark", F_MARK },   { "mark mark", F_MARK2 },   { "negative number", F_NEG_NUMBER, I_HASARG },   { "number", F_NUMBER, I_HASARG },   { "pop", F_POP_VALUE },   { "pop_n_elems", F_POP_N_ELEMS, I_HASARG },   { "push 0", F_CONST0 },   { "push 1", F_CONST1 },   { "push 0x7fffffff", F_BIGNUM },   { "range", F_RANGE },   { "return", F_RETURN },   { "return 0", F_RETURN_0 },   { "return 1", F_RETURN_1 }, -  + { "return local", F_RETURN_LOCAL, I_HASARG },   { "sscanf", F_SSCANF, I_HASARG },   { "string", F_STRING, I_HASARG },   { "switch", F_SWITCH, I_HASARG },   { "unary minus", F_NEGATE },   { "while", F_WHILE },   { "x++ and pop", F_INC_AND_POP },   { "x++", F_POST_INC },   { "x-- and pop", F_DEC_AND_POP },   { "x--", F_POST_DEC },   { "|", F_OR },   { "|=", F_OR_EQ },   { "~", F_COMPL },   { "label", F_LABEL,1 },   { "align", F_ALIGN, I_HASARG },   { "call", F_APPLY, I_HASARG },   { "clear local", F_CLEAR_LOCAL, I_HASARG },   { "clear 2 local", F_CLEAR_2_LOCAL, I_HASARG }, -  + { "clear 4 local", F_CLEAR_4_LOCAL, I_HASARG },   { "++local", F_INC_LOCAL, I_HASARG },   { "++local and pop", F_INC_LOCAL_AND_POP, I_HASARG },   { "local++", F_POST_INC_LOCAL, I_HASARG },   { "--local", F_DEC_LOCAL, I_HASARG },   { "--local and pop", F_DEC_LOCAL_AND_POP, I_HASARG },   { "local--", F_POST_DEC_LOCAL, I_HASARG },   { "sizeof", F_SIZEOF },   { "sizeof local", F_SIZEOF_LOCAL, I_HASARG },   { "throw(0)", F_THROW_ZERO },   { "string index", F_STRING_INDEX, I_HASARG },   { "local index", F_LOCAL_INDEX, I_HASARG }, -  + { "local local index", F_LOCAL_LOCAL_INDEX, 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 },   { "2 locals", F_2_LOCALS, I_HASARG },   { "byte", F_BYTE, I_HASARG },   { "nop", F_NOP },   { "add integer", F_ADD_INT, I_HASARG },   { "add -integer", F_ADD_NEG_INT, I_HASARG }, -  + { "mark & string", F_MARK_AND_STRING, I_HASARG },   { "mark & call", F_MARK_APPLY, I_HASARG },   { "mark, call & pop", F_MARK_APPLY_POP, I_HASARG },   { "apply and return", F_APPLY_AND_RETURN, I_HASARG }, -  + { "apply, assign local and pop", F_APPLY_ASSIGN_LOCAL_AND_POP, I_HASARG }, + { "apply & assign local", F_APPLY_ASSIGN_LOCAL, I_HASARG },   { "call lfun & return", F_CALL_LFUN_AND_RETURN, I_HASARG },   { "call function", F_CALL_FUNCTION, 0 },   { "call function & return", F_CALL_FUNCTION_AND_RETURN, 0 },   { "+= and pop", F_ADD_TO_AND_POP, 0 },   };      struct instr instrs[F_MAX_INSTR - F_OFFSET];      struct reserved   {