pike.git / src / docode.c

version» Context lines:

pike.git/src/docode.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: docode.c,v 1.12 1997/03/05 05:22:55 hubbe Exp $"); + RCSID("$Id: docode.c,v 1.13 1997/03/09 09:11:10 hubbe Exp $");   #include "las.h"   #include "program.h"   #include "language.h"   #include "pike_types.h"   #include "stralloc.h"   #include "interpret.h"   #include "constants.h"   #include "array.h"   #include "macros.h"   #include "error.h"   #include "memory.h"   #include "svalue.h"   #include "main.h"   #include "lex.h"   #include "builtin_functions.h"   #include "peep.h"   #include "docode.h" -  + #include "operators.h"      INT32 current_break=-1;   INT32 current_continue=-1;      static INT32 current_switch_case;   static INT32 current_switch_default;   static INT32 current_switch_values_on_stack;   static INT32 *current_switch_jumptable =0;      void ins_byte(unsigned char b,int area)
pike.git/src/docode.c:152:    current_line=n->line_number;    i=do_docode2(n, flags);       current_line=save_current_line;    return i;   }         void do_jump_when_zero(node *n,int j);    + static int is_efun(node *n, c_fun fun) + { +  return n && n->token == F_CONSTANT && +  n->u.sval.subtype == FUNCTION_BUILTIN && +  n->u.sval.u.efun->function == fun; + } +    void do_jump_when_non_zero(node *n,int j)   {    if(!node_is_tossable(n))    {    if(node_is_true(n))    {    do_jump(F_BRANCH,j);    return;    }       if(node_is_false(n))    return;    }       switch(n->token)    { -  +  case F_APPLY: +  if(is_efun(CAR(n), f_not)) +  { +  do_jump_when_zero(CDR(n), j); +  return; +  } +  break; +     case F_NOT:    do_jump_when_zero(CAR(n), j);    return; -  case F_OR: +  +  case F_LAND: +  { +  int tmp=alloc_label(); +  do_jump_when_zero(CAR(n), tmp); +  do_jump_when_non_zero(CDR(n), j); +  emit(F_LABEL,tmp); +  return; +  } +  +  case F_LOR:    do_jump_when_non_zero(CAR(n), j);    do_jump_when_non_zero(CDR(n), j);    return;    }       if(do_docode(n, DO_NOT_COPY)!=1)    fatal("Infernal compiler skiterror.\n");    do_jump(F_BRANCH_WHEN_NON_ZERO,j);   }   
pike.git/src/docode.c:198:       if(node_is_false(n))    {    do_jump(F_BRANCH,j);    return;    }    }       switch(n->token)    { +  case F_APPLY: +  if(is_efun(CAR(n), f_not)) +  { +  do_jump_when_non_zero(CDR(n), j); +  return; +  } +  break; +     case F_NOT:    do_jump_when_non_zero(CAR(n), j);    return; -  case F_AND: +  +  case F_LOR: +  { +  int tmp=alloc_label(); +  do_jump_when_non_zero(CAR(n), tmp); +  do_jump_when_zero(CDR(n), j); +  emit(F_LABEL,tmp); +  return; +  } +  +  case F_LAND:    do_jump_when_zero(CAR(n), j);    do_jump_when_zero(CDR(n), j);    return;    }       if(do_docode(n, DO_NOT_COPY)!=1)    fatal("Infernal compiler skiterror.\n");    do_jump(F_BRANCH_WHEN_ZERO,j);   }