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.9 1996/12/04 00:27:11 hubbe Exp $"); + RCSID("$Id: las.c,v 1.10 1996/12/05 00:47:14 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:29:   #define LASDEBUG      int lasdebug=0;      static node *eval(node *);   static void optimize(node *n);      dynamic_buffer areas[NUM_AREAS];   node *init_node = 0;   int num_parse_error; + int cumulative_parse_error=0;   extern char *get_type_name(int);      #define MAX_GLOBAL 256      int car_is_node(node *n)   {    switch(n->token)    {    case F_IDENTIFIER:    case F_CONSTANT:
pike.git/src/las.c:132:      static struct node_chunk *node_chunks=0;   static node *free_nodes=0;      void free_all_nodes()   {    if(!local_variables)    {    node *tmp;    struct node_chunk *tmp2; - #ifdef DEBUG +     int e=0; -  +  +  +  if(cumulative_parse_error) +  { +     for(tmp2=node_chunks;tmp2;tmp2=tmp2->next) e+=NODES;    for(tmp=free_nodes;tmp;tmp=CAR(tmp)) e--;    if(e)    {    int e2=e;    for(tmp2=node_chunks;tmp2;tmp2=tmp2->next)    {    for(e=0;e<NODES;e++)    {    for(tmp=free_nodes;tmp;tmp=CAR(tmp))    if(tmp==tmp2->nodes+e)    break;       if(!tmp) -  fprintf(stderr,"Free node at %p.\n",(tmp2->nodes+e)); +  { +  tmp=tmp2->nodes+e; + #ifdef DEBUG +  if(!cumulative_parse_error) +  { +  fprintf(stderr,"Free node at %p.\n",tmp);    } -  +  else + #endif +  { +  /* Free the node and be happy */ +  /* Make sure we don't free any nodes twice */ +  if(car_is_node(tmp)) CAR(tmp)=0; +  if(cdr_is_node(tmp)) CDR(tmp)=0; +  free_node(tmp);    } -  fatal("Failed to free %d nodes when compiling!\n",e2); +     } -  +  } +  } + #ifdef DEBUG +  if(!cumulative_parse_error) +  fatal("Failed to free %d nodes when compiling!\n",e2);   #endif -  +  } +  }    while(node_chunks)    {    tmp2=node_chunks;    node_chunks=tmp2->next;    free((char *)tmp2);    }    free_nodes=0; -  +  cumulative_parse_error=0;    }   }      void free_node(node *n)   {    if(!n) return;    switch(n->token)    {    case USHRT_MAX:    fatal("Freeing node again!\n");