pike.git / src / las.c

version» Context lines:

pike.git/src/las.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: las.c,v 1.180 2000/06/24 00:48:13 hubbe Exp $"); + RCSID("$Id: las.c,v 1.181 2000/07/07 01:48:40 hubbe 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:1118:    }    }   }      /* Leaves a function or object on the stack */   void resolv_class(node *n)   {    check_tree(n,0);       resolv_constant(n); -  switch(sp[-1].type) +  switch(Pike_sp[-1].type)    {    case T_OBJECT: -  if(!sp[-1].u.object->prog) +  if(!Pike_sp[-1].u.object->prog)    {    pop_stack();    push_int(0);    }else{    f_object_program(1);    }    break;       default:    if (Pike_compiler->compiler_pass!=1)
pike.git/src/las.c:1148:    break;    }   }      /* This one always leaves a program if possible */   void resolv_program(node *n)   {    check_tree(n,0);       resolv_class(n); -  switch(sp[-1].type) +  switch(Pike_sp[-1].type)    {    case T_FUNCTION: -  if(program_from_function(sp-1)) +  if(program_from_function(Pike_sp-1))    break;       default:    if (Pike_compiler->compiler_pass!=1)    yyerror("Illegal program identifier");    pop_stack();    push_int(0);       case T_PROGRAM:    break;
pike.git/src/las.c:1178:   {    node *ret;    JMP_BUF tmp;       check_tree(n,0);       if(SETJMP(tmp))    {    ONERROR tmp;    SET_ONERROR(tmp,exit_on_error,"Error in handle_error in master object!"); -  assign_svalue_no_free(sp++, & throw_value); +  assign_svalue_no_free(Pike_sp++, & throw_value);    APPLY_MASTER("handle_error", 1);    pop_stack();    UNSET_ONERROR(tmp);       if (node_name) {    my_yyerror("Couldn't index module '%s'.", node_name);    } else {    yyerror("Couldn't index module.");    }    push_int(0);    }else{    resolv_constant(n); -  switch(sp[-1].type) +  switch(Pike_sp[-1].type)    {    case T_INT:    if(!Pike_compiler->num_parse_error) {    if (node_name) {    my_yyerror("Failed to index module '%s' with '%s' "    "(module doesn't exist?)",    node_name, id->str);    } else {    my_yyerror("Failed to index module with '%s' "    "(module doesn't exist?)",
pike.git/src/las.c:1224:    yyerror("Failed to index module (Not a module?)");    }    pop_stack();    push_int(0);    break;       default:    {    int c;    DECLARE_CYCLIC(); -  c=(int)BEGIN_CYCLIC(sp[-1].u.refs, id); +  c=(int)BEGIN_CYCLIC(Pike_sp[-1].u.refs, id);    if(c>1)    {    my_yyerror("Recursive module dependency in '%s'.",id->str);    pop_stack();    push_int(0);    }else{    SET_CYCLIC_RET(c+1);    ref_push_string(id);    { -  struct svalue *save_sp = sp-2; +  struct svalue *save_sp = Pike_sp-2;    JMP_BUF recovery;    if (SETJMP(recovery)) {    /* f_index() threw an error!    *    * FIXME: Report the error thrown.    */ -  if (sp > save_sp) { -  pop_n_elems(sp - save_sp); -  } else if (sp != save_sp) { +  if (Pike_sp > save_sp) { +  pop_n_elems(Pike_sp - save_sp); +  } else if (Pike_sp != save_sp) {    fatal("f_index() munged stack!\n");    }    push_int(0); -  sp[-1].subtype = NUMBER_UNDEFINED; +  Pike_sp[-1].subtype = NUMBER_UNDEFINED;    } else {    f_index(2);    }    UNSETJMP(recovery);    }    -  if(sp[-1].type == T_INT && -  !sp[-1].u.integer && -  sp[-1].subtype==NUMBER_UNDEFINED) +  if(Pike_sp[-1].type == T_INT && +  !Pike_sp[-1].u.integer && +  Pike_sp[-1].subtype==NUMBER_UNDEFINED)    {    if (node_name) {    my_yyerror("Index '%s' not present in module '%s'.",    id->str, node_name);    } else {    my_yyerror("Index '%s' not present in module.", id->str);    }    }    }    END_CYCLIC();    }    }    }    UNSETJMP(tmp); -  ret=mkconstantsvaluenode(sp-1); +  ret=mkconstantsvaluenode(Pike_sp-1);    pop_stack();    return ret;   }         int node_is_eq(node *a,node *b)   {    check_tree(a,0);    check_tree(b,0);   
pike.git/src/las.c:3592:    {    foo->yes=1;    pike_throw();    }   }      int eval_low(node *n)   {    unsigned INT16 num_strings, num_constants;    INT32 jump; -  struct svalue *save_sp = sp; +  struct svalue *save_sp = Pike_sp;    int ret;      #ifdef PIKE_DEBUG    if(l_flag > 3 && n)    {    fprintf(stderr,"Evaluating (tree info=%x):",n->tree_info);    print_tree(n);    }   #endif   
pike.git/src/las.c:3649:    yyerror(a->string->str);    }else{    yyerror("Nonstandard error format.");    }    }    else if(throw_value.type == T_OBJECT)    {    ref_push_object(throw_value.u.object);    push_int(0);    f_index(2); -  if(sp[-1].type != T_STRING) +  if(Pike_sp[-1].type != T_STRING)    yyerror("Nonstandard error format.");    else -  yyerror(sp[-1].u.string->str); +  yyerror(Pike_sp[-1].u.string->str);    pop_stack();    }    else    {    yyerror("Nonstandard error format.");    }    }    }else{    if(foo.yes) -  pop_n_elems(sp-save_sp); +  pop_n_elems(Pike_sp-save_sp);    else -  ret=sp-save_sp; +  ret=Pike_sp-save_sp;    }       remove_callback(tmp_callback);    }       while(Pike_compiler->new_program->num_strings > num_strings)    {    Pike_compiler->new_program->num_strings--;    free_string(Pike_compiler->new_program->strings[Pike_compiler->new_program->num_strings]);    }
pike.git/src/las.c:3700:       Pike_compiler->new_program->num_program=jump;       return ret;   }      static node *eval(node *n)   {    node *new;    int args; -  extern struct svalue *sp; +     if(!is_const(n) || n->token==':')    return n;       args=eval_low(n);       switch(args)    {    case -1:    return n;    break;       case 0:    if(Pike_compiler->catch_level) return n;    free_node(n);    n=0;    break;       case 1: -  if(Pike_compiler->catch_level && IS_ZERO(sp-1)) +  if(Pike_compiler->catch_level && IS_ZERO(Pike_sp-1))    {    pop_stack();    return n;    }    if (n->token == F_SOFT_CAST) { -  new = mksoftcastnode(n->type, mksvaluenode(sp-1)); +  new = mksoftcastnode(n->type, mksvaluenode(Pike_sp-1));    } else { -  new = mksvaluenode(sp-1); +  new = mksvaluenode(Pike_sp-1);    if (n->type && (!new->type || ((n->type != new->type) &&    pike_types_le(n->type,new->type)))) {    if (new->type)    free_string(new->type);    copy_shared_string(new->type,n->type);    }    }    free_node(n);    n = new;    pop_stack();    break;       default:    if (n->token != F_SOFT_CAST) {    free_node(n);    n=NULL;    while(args--)    { -  n=mknode(F_ARG_LIST,mksvaluenode(sp-1),n); +  n=mknode(F_ARG_LIST,mksvaluenode(Pike_sp-1),n);    pop_stack();    }    } else {    node *nn = n;    n = NULL;    while(args--)    { -  n=mknode(F_ARG_LIST,mksvaluenode(sp-1),n); +  n=mknode(F_ARG_LIST,mksvaluenode(Pike_sp-1),n);    pop_stack();    }    n = mksoftcastnode(nn->type, n);    free_node(nn);    }    }    return dmalloc_touch(node *, n);   }      INT32 last_function_opt_info;