Branch: Tag:

1999-12-14

1999-12-14 08:41:58 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

now you can write functions in functions

Rev: src/language.yacc:1.145
Rev: src/las.c:1.142
Rev: src/las.h:1.31
Rev: src/program.c:1.182

5:   \*/   /**/   #include "global.h" - RCSID("$Id: las.c,v 1.141 1999/12/14 00:55:10 grubba Exp $"); + RCSID("$Id: las.c,v 1.142 1999/12/14 08:39:11 hubbe Exp $");      #include "language.h"   #include "interpret.h"
1382:    * optimizer    */    - #ifdef DEAD_CODE + #if 1 /* DEAD_CODE - I need this /Hubbe */      node *copy_node(node *n)   {    node *b; -  +  debug_malloc_touch(n); +  debug_malloc_touch(n->type); +  debug_malloc_touch(n->u.node.a); +  debug_malloc_touch(n->u.node.b);    check_tree(n,0);    if(!n) return n;    switch(n->token)
1395: Inside #if defined(DEAD_CODE)
   case F_IDENTIFIER:    case F_TRAMPOLINE:    b=mknewintnode(0); +  if(b->type) free_string(b->type);    *b=*n;    copy_shared_string(b->type, n->type);    return b;
1404: Inside #if defined(DEAD_CODE) and #if defined(SHARED_NODES)
   n->refs++;    return n;   #else /* !SHARED_NODES */ -  case F_CAST: -  b=mkcastnode(n->type,copy_node(CAR(n))); -  break; +     -  case F_SOFT_CAST: -  b=mksoftcastnode(n->type,copy_node(CAR(n))); -  break; -  -  case F_CONSTANT: -  b=mksvaluenode(&(n->u.sval)); -  break; -  -  default: +     switch((car_is_node(n) << 1) | cdr_is_node(n))    {    default: fatal("fooo?\n");
1439: Inside #if defined(DEAD_CODE)
   copy_shared_string(b->type, n->type);    else    b->type=0; +  +  break; +  +  case F_CAST: +  b=mkcastnode(n->type,copy_node(CAR(n))); +  break; +  +  case F_SOFT_CAST: +  b=mksoftcastnode(n->type,copy_node(CAR(n))); +  break; +  +  case F_CONSTANT: +  b=mksvaluenode(&(n->u.sval)); +  break;   #endif /* SHARED_NODES */    }    if(n->name)
2266:    name=ID_FROM_INT(new_program, CAR(n)->u.id.number)->name->str;    break;    +  case F_ARROW: +  case F_INDEX: +  if(CDAR(n)->token == F_CONSTANT && +  CDAR(n)->u.sval.type == T_STRING) +  { +  name=CDAR(n)->u.sval.u.string->str; +  }else{ +  name="dynamically resolved function"; +  } +  break; +     case F_CONSTANT:    switch(CAR(n)->u.sval.type)    {