pike.git / src / las.c

version» Context lines:

pike.git/src/las.c: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: las.c,v 1.305 2002/10/21 09:13:17 grubba Exp $ + || $Id: las.c,v 1.306 2002/10/25 13:13:57 marcus Exp $   */      #include "global.h" - RCSID("$Id: las.c,v 1.305 2002/10/21 09:13:17 grubba Exp $"); + RCSID("$Id: las.c,v 1.306 2002/10/25 13:13:57 marcus Exp $");      #include "language.h"   #include "interpret.h"   #include "las.h"   #include "array.h"   #include "object.h"   #include "stralloc.h"   #include "dynamic_buffer.h"   #include "lex.h"   #include "pike_types.h"
pike.git/src/las.c:1600:    yyerror("Expected constant, got undefined identifier");    }    push_int(0);    return;       default:    {    char fnord[1000];    if(is_const(n))    { -  ptrdiff_t args=eval_low(n); +  ptrdiff_t args=eval_low(n,1);    if(args==1) return;       if(args!=-1)    {    if(!args)    {    yyerror("Expected constant, got void expression");    }else{    yyerror("Possible internal error!!!");    pop_n_elems(DO_NOT_WARN(args-1));
pike.git/src/las.c:5275:   static void check_evaluation_time(struct callback *cb,void *tmp,void *ignored)   {    struct timer_oflo *foo=(struct timer_oflo *)tmp;    if(foo->counter-- < 0)    {    foo->yes=1;    pike_throw();    }   }    - ptrdiff_t eval_low(node *n) + ptrdiff_t eval_low(node *n,int print_error)   {    unsigned INT16 num_strings, num_constants;    INT32 jump;    struct svalue *save_sp = Pike_sp;    ptrdiff_t ret;   #ifdef PIKE_USE_MACHINE_CODE    size_t num_relocations;   #endif /* PIKE_USE_MACHINE_CODE */      #ifdef PIKE_DEBUG
pike.git/src/las.c:5330:    foo.yes=0;       make_program_executable(Pike_compiler->new_program);       tmp_callback=add_to_callback(&evaluator_callbacks,    check_evaluation_time,    (void *)&foo,0);       if(apply_low_safe_and_stupid(Pike_compiler->fake_object, jump))    { - #if 0 +  if(print_error)    /* Generate error message */    if(!Pike_compiler->catch_level)    {    struct svalue thrown = throw_value;    throw_value.type = T_INT;    yyerror("Error evaluating constant.\n");    push_svalue(&thrown);    low_safe_apply_handler("compile_exception",    error_handler, compat_handler, 1);    if (SAFE_IS_ZERO(Pike_sp-1)) yy_describe_exception(&thrown);    pop_stack();    free_svalue(&thrown);    }    else {    free_svalue(&throw_value);    throw_value.type = T_INT;    } - #else /* !0 */ +  else {    free_svalue(&throw_value);    throw_value.type = T_INT;    /* Assume the node will throw errors at runtime too. */    n->tree_info |= OPT_SIDE_EFFECT;    n->node_info |= OPT_SIDE_EFFECT; - #endif /* 0 */ +  }    }else{    if(foo.yes)    pop_n_elems(Pike_sp-save_sp);    else    ret=Pike_sp-save_sp;    }       remove_callback(tmp_callback);    }   
pike.git/src/las.c:5401:    return ret;   }      static node *eval(node *n)   {    node *new;    ptrdiff_t args;    if(!is_const(n) || n->token==':')    return n;    -  args=eval_low(n); +  args=eval_low(n,0);       switch(args)    {    case -1:    return n;    break;       case 0:    if(Pike_compiler->catch_level) return n;    free_node(n);