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.32.2.1 1997/06/25 22:46:39 hubbe Exp $"); + RCSID("$Id: las.c,v 1.32.2.2 1997/06/27 06:55:17 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:38:   int num_parse_error;   int cumulative_parse_error=0;   extern char *get_type_name(int);      #define MAX_GLOBAL 2048      int car_is_node(node *n)   {    switch(n->token)    { +  case F_EXTERNAL:    case F_IDENTIFIER:    case F_CONSTANT:    case F_LOCAL:    return 0;       default:    return !!CAR(n);    }   }      int cdr_is_node(node *n)   {    switch(n->token)    { -  +  case F_EXTERNAL:    case F_IDENTIFIER:    case F_CONSTANT:    case F_LOCAL:    case F_CAST:    return 0;       default:    return !!CDR(n);    }   }
pike.git/src/las.c:370:   node *mkapplynode(node *func,node *args)   {    return mknode(F_APPLY, func, args);   }      node *mkefuncallnode(char *function, node *args)   {    struct pike_string *name;    node *n;    name = findstring(function); -  if(!name || !find_module_identifier(name)) +  if(!name || !(n=find_module_identifier(name)))    {    my_yyerror("Internally used efun undefined: %s",function);    return mkintnode(0);    } -  n=mkapplynode(mksvaluenode(sp-1), args); -  pop_stack(); +  n=mkapplynode(n, args);    return n;   }      node *mkopernode(char *oper_id, node *arg1, node *arg2)   {    if(arg1 && arg2)    arg1=mknode(F_ARG_LIST,arg1,arg2);       return mkefuncallnode(oper_id, arg1);   }
pike.git/src/las.c:424:    }    res->tree_info=res->node_info;      #ifdef __CHECKER__    CDR(res)=0;   #endif    res->u.number = i;    return res;   }    + node *mkexternalnode(int level, +  int i, +  struct identifier *id) + { +  node *res = mkemptynode(); +  res->token = F_EXTERNAL; +  +  copy_shared_string(res->type, id->type); +  +  /* FIXME */ +  res->node_info = OPT_NOT_CONST; +  res->tree_info=res->node_info; +  + #ifdef __CHECKER__ +  CDR(res)=0; + #endif +  res->u.integer.a = level; +  res->u.integer.b = i; +  return res; + } +    node *mkcastnode(struct pike_string *type,node *n)   {    node *res;    if(!n) return 0;    if(type==n->type) return n;    res = mkemptynode();    res->token = F_CAST;    copy_shared_string(res->type,type);       if(match_types(object_type_string, type) ||
pike.git/src/las.c:448: Inside #if defined(__CHECKER__)
  #ifdef __CHECKER__    CDR(res)=0;   #endif    n->parent=res;    return res;   }      void resolv_constant(node *n)   {    struct identifier *i; +  struct program *p; +  INT32 numid; +     if(!n)    {    push_int(0);    }else{    switch(n->token)    {    case F_CONSTANT:    push_svalue(& n->u.sval); -  break; +  return;    -  case F_IDENTIFIER: -  i=ID_FROM_INT(new_program, n->u.number); -  -  if(IDENTIFIER_IS_CONSTANT(i->flags)) +  case F_EXTERNAL: +  p=parent_compilation(n->u.integer.a); +  if(!p)    { -  push_svalue(PROG_FROM_INT(new_program, n->u.number)->constants + -  i->func.offset); -  }else{ -  yyerror("Identifier is not a constant"); +  yyerror("Failed to resolv external constant");    push_int(0); -  +  return;    } -  +  numid=n->u.integer.b;    break;    -  +  case F_IDENTIFIER: +  p=new_program; +  numid=n->u.number; +  break; +     case F_LOCAL:    yyerror("Expected constant, got local variable");    push_int(0); -  break; +  return;       case F_GLOBAL:    yyerror("Expected constant, got global variable");    push_int(0); -  break; +  return; +  +  default: +  yyerror("Expected constant, got something else"); +  push_int(0); +  return;    } -  +  +  i=ID_FROM_INT(p, numid); +  +  if(IDENTIFIER_IS_CONSTANT(i->flags)) +  { +  push_svalue(PROG_FROM_INT(new_program, numid)->constants + +  i->func.offset); +  }else{ +  yyerror("Identifier is not a constant"); +  push_int(0);    }    } -  + }      node *index_node(node *n, struct pike_string * id)   {    node *ret;    JMP_BUF tmp;    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);