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.95 2001/07/09 11:37:21 grubba Exp $"); + RCSID("$Id: lex.c,v 1.96 2001/07/09 14:19:16 grubba 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:78: Inside #if defined(INSTR_PROFILING)
  {    int e;    struct instr_counter **tmp=&instr_counter_storage;       for(e=0;e<p_flag;e++)    {    tmp[0]->runned++;    tmp=tmp[0]->next + last_instruction[e];    last_instruction[e]=last_instruction[e+1];    } + #ifndef HAVE_COMPUTED_GOTO    ((char **)(tmp))[0]++; -  + #endif /* !HAVE_COMPUTED_GOTO */    last_instruction[e]=instr;   }      void present_runned(struct instr_counter *d, int depth, int maxdepth)   {    int e;    if(depth == maxdepth)    {    long runned = depth < p_flag ? d->runned : (long)d;    if(!runned) return;
pike.git/src/lex.c:316:    }else{    sprintf(buf, "Call efun %d", n - F_MAX_OPCODE);    return buf;    }    }else{    sprintf(buf, "<OTHER %d>", n);    return buf;    }   }    + #ifdef HAVE_COMPUTED_GOTO + char *get_opcode_name(PIKE_OPCODE_T n) + { +  int fcode; +  int low = 0; +  int high = F_MAX_OPCODE - F_OFFSET; +  static char buf[64]; +  +  if (!n) { +  return "<NULL opcode!>"; +  } +  +  while (low < high) { +  int mid = (low+high)/2; +  if (opcode_to_fcode[mid].opcode < n) { +  low = mid + 1; +  } else if (opcode_to_fcode[mid].opcode > n) { +  high = mid; +  } else { +  return get_f_name(opcode_to_fcode[mid].fcode); +  } +  } +  +  sprintf(buf, "<Unknown opcode 0x%p>", n); +  return buf; + } + #endif /* HAVE_COMPUTED_GOTO */ +    char *get_token_name(int n)   {    static char buf[30];    if (n<F_MAX_INSTR && instrs[n-F_OFFSET].name)    {    return instrs[n-F_OFFSET].name;    }else{    sprintf(buf, "<OTHER %d>", n);    return buf;    }