Changeset 168c2a5ec263be75f797e77bdf8a7e3011663c1a

Show
Ignore:
Timestamp:
04/19/10 17:59:02 (2 years ago)
Author:
Philip Herron <redbrain@…>
Parents:
8ff7a1b2cf2221d84f8514c3f63e025ca2cb4144
Children:
11b18d6c8033bdf184ee5924e576f0de3e5861aa
git-committer:
Philip Herron <redbrain@omicron.(none)> / 2010-04-19T17:59:02Z+0100
Message:

more refactors

Files:
13 modified

Legend:

Unmodified
Added
Removed
  • include/crules/objects.h

    r56c74af r168c2a5  
    101101                                             crl_context_table *  ); 
    102102 
     103extern crl_symbol_obj * crl_obj_list_print( crl_symbol_obj * , crl_symbol_obj * , 
     104                                            crl_context_table * ); 
     105 
     106extern crl_symbol_obj * crl_obj_list_delete( crl_symbol_obj * , crl_symbol_obj * , 
     107                                             crl_context_table * ); 
     108 
     109// -------------------------------------------------------------------------- 
     110 
     111extern crl_symbol_obj * crl_obj_string_init( crl_symbol_obj * , crl_symbol_obj * , 
     112                                             crl_context_table * ); 
     113 
     114extern crl_symbol_obj * crl_obj_string_push( crl_symbol_obj * , crl_symbol_obj * , 
     115                                             crl_context_table *  ); 
     116 
     117extern crl_symbol_obj * crl_obj_string_pop( crl_symbol_obj * , crl_symbol_obj * , 
     118                                            crl_context_table * ); 
     119 
     120extern crl_symbol_obj * crl_obj_string_remove( crl_symbol_obj * , crl_symbol_obj * , 
     121                                               crl_context_table * ); 
     122 
     123extern crl_symbol_obj * crl_obj_string_append( crl_symbol_obj * , crl_symbol_obj * , 
     124                                               crl_context_table * ); 
     125 
     126extern crl_symbol_obj * crl_obj_string_length( crl_symbol_obj * , crl_symbol_obj * , 
     127                                               crl_context_table *  ); 
     128 
     129extern crl_symbol_obj * crl_obj_string_print( crl_symbol_obj * , crl_symbol_obj * , 
     130                                              crl_context_table * ); 
     131 
     132extern crl_symbol_obj * crl_obj_string_delete( crl_symbol_obj * , crl_symbol_obj * , 
     133                                               crl_context_table * ); 
     134 
    103135#endif //__OBJECTS_H_ 
  • include/crules/runtime.h

    r56c74af r168c2a5  
    3232// -------------------------------------------------------------------------- 
    3333 
    34 extern bool crl_runtime_keyword_delete( crl_symbol_obj * , crl_context_table * ); 
    35  
    3634extern crl_symbol_obj * crl_runtime_loop_for( crl_symbol_obj * , crl_context_table * ); 
    3735 
     
    4240extern crl_symbol_obj * crl_runtime_eval_key_break( crl_context_table * ); 
    4341 
    44 extern bool crl_runtime_list_format( crl_table_t * , crl_context_table * ); 
    45  
    4642extern bool crl_runtime_assignment( crl_symbol_obj *,crl_context_table * ); 
    47  
    48 extern bool crl_runtime_list_print( crl_table_t * , crl_context_table *, FILE * ); 
    4943 
    5044extern bool crl_runtime_eval_bool_item( crl_symbol_obj * ); 
  • src/bb_builtin.c

    r56c74af r168c2a5  
    6161struct crl_builtin_function_def_t builtin_module_function_table[] = { 
    6262  { "print", PARAM_VARADIC, &crl_builtin_call_print }, 
    63   { NULL, 0 NULL }, 
     63  { NULL, 0, NULL }, 
    6464}; 
  • src/builtin_hash_table.c

    r1a9fc2c r168c2a5  
    3030#include <string.h> 
    3131 
    32 #include <unistd.h> 
    33 #include <sys/types.h> 
    34  
    3532#include <crules/crules.h> 
    3633#include <crules/opcodes.h> 
     
    4542#define threshold_alloc(x) (((x)+16)*3/2) 
    4643 
    47 /* Declare the tables */ 
    48 crl_table *crl_functors= NULL, *crl_rules= NULL; 
    49 //The runtime table stack! 
    50 crl_context_table *crl_runtime_ctx_table; 
    51  
    52 static void crl_hash_grow_table( crl_table * ); 
     44static void crl_dd_hash_grow_table( crl_table_t * ); 
    5345 
    5446/** 
     
    6153 *  a Digest.., but should avoid conflicts better 
    6254 **/ 
    63 crl_hash_t crl_hash_hash( const char *string ) 
     55crl_hash_t crl_dd_hash_hash( const char *string ) 
    6456{ 
    6557  crl_hash_t hash= 0x811C9DC5; 
     
    7567} 
    7668 
    77 crl_table_entry* 
    78 crl_hash_lookup_table( crl_table *tbl, crl_hash_t h ) 
     69crl_table_entry * 
     70crl_dd_hash_lookup_table( crl_table_t *tbl, crl_hash_t h ) 
    7971{ 
    8072  crl_table_entry* retval; 
     
    10294 
    10395crl_symbol_obj** 
    104 crl_hash_insert( crl_hash_t h, crl_symbol_obj* obj, 
    105                  crl_table *tbl ) 
     96crl_dd_hash_insert( crl_hash_t h, crl_symbol_obj* obj, 
     97                    crl_table_t *tbl ) 
    10698{ 
    10799  crl_symbol_obj **retval; 
    108100  if( tbl->nr >= tbl->size ) 
    109     crl_hash_grow_table( tbl ); 
     101    crl_dd_hash_grow_table( tbl ); 
    110102 
    111   crl_table_entry *entry= crl_hash_lookup_table( tbl, h ); 
     103  crl_table_entry *entry= crl_dd_hash_lookup_table( tbl, h ); 
    112104  if( entry->symbol ) 
    113105    retval= &( entry->symbol ); 
     
    122114 
    123115static 
    124 void crl_hash_grow_table( crl_table * tbl ) 
     116void crl_dd_hash_grow_table( crl_table_t * tbl ) 
    125117{ 
    126118  unsigned int prev_size= tbl->size, size= 0, i= 0; 
     
    141133 
    142134      if( s ) 
    143         crl_hash_insert( h, s, tbl ); 
     135        crl_dd_hash_insert( h, s, tbl ); 
    144136    } 
    145137  if( prev_array ) 
     
    147139} 
    148140 
    149 void crl_hash_init_table( crl_table ** tbl ) 
     141void crl_dd_hash_init_table( crl_table_t ** tbl ) 
    150142{ 
    151143  if( tbl ) 
    152144    { 
    153       crl_table *tb= *tbl; 
     145      crl_table_t *tb= *tbl; 
    154146      tb->size= 0; tb->nr= 0; 
    155147      tb->array= NULL; 
     
    161153} 
    162154 
    163 crl_table * crl_hash_clone_table( crl_table ** table ) 
     155crl_table_t * crl_dd_hash_clone_table( crl_table_t ** table ) 
    164156{ 
    165   crl_table * retval = NULL; 
     157  crl_table_t * retval = NULL; 
    166158  if( table ) 
    167159    { 
    168       retval = (crl_table*) 
    169         crl_malloc( sizeof(crl_table) ); 
    170       crl_hash_init_table( &retval ); 
     160      retval = (crl_table_t*) 
     161        crl_malloc( sizeof(crl_table_t) ); 
     162      crl_dd_hash_init_table( &retval ); 
    171163       
    172164      crl_table_entry* array = (crl_table_entry*) 
     
    184176           
    185177          if( s ) 
    186             crl_hash_insert( h, s, retval ); 
     178            crl_dd_hash_insert( h, s, retval ); 
    187179        } 
    188180       
     
    196188  return retval; 
    197189} 
    198  
    199 /** 
    200  * Initilizes the memory tables and different 
    201  * symbol tables 
    202  **/ 
    203 bool crl_init_tables( void ) 
    204 { 
    205   crl_debug("Initilizing...\n"); 
    206  
    207   crl_branch_context *ctx= (crl_branch_context*) 
    208     crl_malloc(sizeof( crl_branch_context )); 
    209   crl_context_init_context( &ctx ); 
    210  
    211   crl_runtime_ctx_table= (crl_context_table*) 
    212     crl_malloc(sizeof( crl_context_table )); 
    213   crl_context_init_table( &crl_runtime_ctx_table ); 
    214   crl_context_push( ctx, crl_runtime_ctx_table ); 
    215  
    216   crl_debug("System tables initilized!\n"); 
    217  
    218   crl_builtin_init( crl_runtime_ctx_table ); 
    219    
    220   pid_t pid; 
    221   /* get the process id */ 
    222   if( (pid = getpid( ) ) < 0 ) 
    223     { 
    224       crl_warning( "unable to get program pid" ); 
    225     } 
    226   else 
    227     { 
    228       crl_debug( "started with pid <%d>!\n", pid ); 
    229     } 
    230   return true; 
    231 } 
  • src/builtin_stack.c

    r56c74af r168c2a5  
    4242#define threshold_alloc(x) (((x)+16)*3/2) 
    4343 
    44 void crl_dd_stack_push( crl_stack *stack, void *obj ) 
     44void crl_dd_stack_push( crl_stack_t *stack, void *obj ) 
    4545{ 
    4646  unsigned int idx= stack->length, tsize= 0; 
     
    6464 
    6565inline 
    66 void* crl_dd_stack_pop( crl_stack *stack ) 
     66void* crl_dd_stack_pop( crl_stack_t *stack ) 
    6767{ 
    6868  void *obj; 
     
    7777 
    7878inline 
    79 void crl_dd_stack_init( crl_stack **stack ) 
     79void crl_dd_stack_init( crl_stack_t **stack ) 
    8080{ 
    8181  if( stack ) 
     
    9696 **/ 
    9797inline 
    98 void crl_dd_stack_free( crl_stack *stack ) 
     98void crl_dd_stack_free( crl_stack_t *stack ) 
    9999{ 
    100100  if( stack ) 
     
    107107 
    108108inline 
    109 unsigned int crl_dd_stack_get_size( crl_stack *stack ) 
     109unsigned int crl_dd_stack_get_size( crl_stack_t *stack ) 
    110110{ 
    111111  unsigned int retval; 
  • src/obj_class.c

    r4c5f389 r168c2a5  
    5151  crl_context_table *object_ctx = (crl_context_table*) 
    5252    crl_malloc( sizeof(crl_context_table) ); 
    53   crl_context_init_table( &object_ctx ); 
    54   crl_context_push( (obj->context), object_ctx ); 
     53  crl_rr_context_init_table( &object_ctx ); 
     54  crl_rr_context_push( (obj->context), object_ctx ); 
    5555 
    56   crl_symbol_obj** functor = crl_context_lookup_function( ident, &object_ctx ); 
     56  crl_symbol_obj** functor = crl_rr_context_lookup_function( ident, &object_ctx ); 
    5757  if( functor ) 
    5858    { 
     
    6666  } 
    6767 
    68   crl_context_pop( object_ctx ); 
     68  crl_rr_context_pop( object_ctx ); 
    6969  crl_garbage_free_context_table( &object_ctx ); 
    7070 
     
    7878  crl_branch_context * obj_ctx = obj->context; 
    7979 
    80   crl_table_entry *ent = crl_hash_lookup_table( obj_ctx->symbol_table, crl_hash_hash(ident) ); 
     80  crl_table_entry *ent = crl_dd_hash_lookup_table( obj_ctx->symbol_table, 
     81                                                   crl_dd_hash_hash( ident ) ); 
    8182  if( ent ) 
    8283    { 
  • src/obj_list.c

    re4fe6e3 r168c2a5  
    11/** 
    2  * object_list.c -> Part of Crules Programming language 
     2 * obj_list.c -> Part of Crules Programming language 
    33 * 
    44 * Crules is the legal property of its developers. Please refer to the 
     
    104104 
    105105struct crl_builtin_function_def_t list_module_function_table[] = { 
    106   { "__init__", 1, &crl_obj_list_init } 
     106  { "__init__", 1, &crl_obj_list_init }, 
    107107  { "push", 1, &crl_obj_list_push }, 
    108108  { "pop", 0, &crl_obj_list_pop }, 
  • src/obj_number.c

    r6ff5ad1 r168c2a5  
    4141crl_symbol_obj* 
    4242crl_obj_number_to_string( crl_symbol_obj * caller, 
     43                          crl_symbol_obj * self, 
    4344                          crl_context_table * context ) 
    4445{ 
  • src/obj_string.c

    r8cc1949 r168c2a5  
    11/** 
    2  * string_object.c -> Part of Crules Programming language 
     2 * obj_string.c -> Part of Crules Programming language 
    33 * 
    44 * Crules is the legal property of its developers. Please refer to the 
     
    1919 **/ 
    2020 
     21#ifdef HAVE_CONFIG_H 
     22# include "config.h" 
     23#else 
     24# define CMAKE 1 
     25# include "config.h.cmake" 
     26#endif 
     27 
     28#include <stdio.h> 
     29#include <stdlib.h> 
     30#include <string.h> 
     31 
     32#include <crules/crules.h> 
     33#include <crules/opcodes.h> 
     34#include <crules/symbols.h> 
     35#include <crules/objects.h> 
     36#include <crules/backend.h> 
     37#include <crules/runtime.h> 
     38#include <crules/garbage.h> 
     39#include <crules/operators.h> 
     40 
     41crl_symbol_obj * 
     42crl_obj_string_init( crl_symbol_obj * caller, 
     43                     crl_symbol_obj * self, 
     44                     crl_context_table * context ) 
     45{ 
     46  return NULL; 
     47} 
     48 
     49crl_symbol_obj * 
     50crl_obj_string_push( crl_symbol_obj * caller, 
     51                     crl_symbol_obj * self, 
     52                     crl_context_table * context ) 
     53{ 
     54  return NULL; 
     55} 
     56 
     57crl_symbol_obj * 
     58crl_obj_string_pop( crl_symbol_obj * caller, 
     59                    crl_symbol_obj * self, 
     60                    crl_context_table * context ) 
     61{ 
     62  return NULL; 
     63} 
     64 
     65crl_symbol_obj * 
     66crl_obj_string_remove( crl_symbol_obj * caller, 
     67                       crl_symbol_obj * self, 
     68                       crl_context_table * context ) 
     69{ 
     70  return NULL; 
     71} 
     72 
     73crl_symbol_obj * 
     74crl_obj_string_append( crl_symbol_obj * caller, 
     75                       crl_symbol_obj * self, 
     76                       crl_context_table * context ) 
     77{ 
     78  return NULL; 
     79} 
     80 
     81crl_symbol_obj * 
     82crl_obj_string_length( crl_symbol_obj * caller, 
     83                       crl_symbol_obj * self, 
     84                       crl_context_table * context ) 
     85{ 
     86  return NULL; 
     87} 
     88 
     89crl_symbol_obj * 
     90crl_obj_string_print( crl_symbol_obj * caller, 
     91                      crl_symbol_obj * self, 
     92                      crl_context_table * context ) 
     93{ 
     94  return NULL; 
     95} 
     96 
     97crl_symbol_obj * 
     98crl_obj_string_delete( crl_symbol_obj * caller, 
     99                       crl_symbol_obj * self, 
     100                       crl_context_table * context ) 
     101{ 
     102  return NULL; 
     103} 
     104 
     105struct crl_builtin_function_def_t string_module_function_table[] = { 
     106  { "__init__", 1, &crl_obj_string_init }, 
     107  { "push", 1, &crl_obj_string_push }, 
     108  { "pop", 0, &crl_obj_string_pop }, 
     109  { "remove", 1, &crl_obj_string_remove }, 
     110  { "append", 1, &crl_obj_string_append }, 
     111  { "length", 0, &crl_obj_string_length }, 
     112  { "print", 0, &crl_obj_string_print }, 
     113  { "delete", 0, &crl_obj_string_delete }, 
     114  { NULL, 0, NULL }, 
     115}; 
  • src/rr_context.c

    r97bcdcf r168c2a5  
    2929#include <stdlib.h> 
    3030#include <string.h> 
     31 
     32#include <unistd.h> 
     33#include <sys/types.h> 
    3134 
    3235#include <crules/crules.h> 
     
    3942#include <crules/operators.h> 
    4043 
     44//The runtime table stack! 
     45crl_context_table *crl_runtime_ctx_table; 
    4146//threshold size alloctor to scale up faster 
    4247#define threshold_alloc(x) (((x)+16)*3/2) 
    4348 
    44 void crl_context_push( crl_branch_context * ctx, 
     49void crl_rr_context_push( crl_branch_context * ctx, 
    4550                       crl_context_table * stack ) 
    4651{ 
     
    6570 
    6671crl_branch_context * 
    67 crl_context_pop( crl_context_table * stack ) 
     72crl_rr_context_pop( crl_context_table * stack ) 
    6873{ 
    6974  crl_branch_context *ctx; 
     
    8186} 
    8287 
    83 void crl_context_init_table( crl_context_table ** table ) 
     88void crl_rr_context_init_table( crl_context_table ** table ) 
    8489{ 
    8590  if( table ) 
     
    97102 
    98103unsigned int 
    99 crl_context_get_table_size( crl_context_table * stack ) 
     104crl_rr_context_get_table_size( crl_context_table * stack ) 
    100105{ 
    101106  unsigned int retval; 
     
    109114 
    110115crl_table_entry * 
    111 crl_context_lookup_symbol( const char* identifier, 
    112                            crl_context_table ** stack ) 
     116crl_rr_context_lookup_symbol( const char* identifier, 
     117                              crl_context_table ** stack ) 
    113118{ 
    114119  crl_table_entry *retval; 
    115120  if( stack ) 
    116121    { 
    117       crl_hash_t h= crl_hash_hash( identifier ); 
     122      crl_hash_t h= crl_dd_hash_hash( identifier ); 
    118123      crl_debug("looking up symbol '%s' - hash 0x%X\n", 
    119124                identifier, h); 
    120125 
    121       signed int idx= crl_context_get_table_size( (*stack) ); 
     126      signed int idx= crl_rr_context_get_table_size( (*stack) ); 
    122127      crl_debug("stack frame size :: '%i'!\n", idx ); 
    123128      crl_branch_context* ctx= NULL; idx--; 
     
    130135 
    131136          if( ctx->symbol_table->array ) 
    132             ent= crl_hash_lookup_table( ctx->symbol_table, h ); 
     137            ent= crl_dd_hash_lookup_table( ctx->symbol_table, h ); 
    133138 
    134139          if( ent ) 
     
    154159 
    155160crl_symbol_obj** 
    156 crl_context_lookup_function( const char* identifier, 
    157                              crl_context_table ** stack ) 
     161crl_rr_context_lookup_function( const char* identifier, 
     162                                crl_context_table ** stack ) 
    158163{ 
    159164  crl_symbol_obj **retval = NULL; 
    160165  if( stack ) 
    161166    { 
    162       crl_hash_t h= crl_hash_hash( identifier ); 
     167      crl_hash_t h= crl_dd_hash_hash( identifier ); 
    163168      crl_debug( "looking up function '%s' - hash 0x%X\n", 
    164169                 identifier, h ); 
    165170 
    166       signed int idx= crl_context_get_table_size( (*stack) ); 
     171      signed int idx= crl_rr_context_get_table_size( (*stack) ); 
    167172      crl_debug("stack frame size :: '%i'!\n", idx ); 
    168173      crl_branch_context* ctx= NULL; idx--; 
     
    175180 
    176181          if( ctx->function_table->array ) 
    177             ent= crl_hash_lookup_table( ctx->function_table, h ); 
     182            ent= crl_dd_hash_lookup_table( ctx->function_table, h ); 
    178183 
    179184          if( ent ) 
     
    199204 
    200205crl_obj_state_t ** 
    201 crl_context_lookup_object( const char* identifier, 
     206crl_rr_context_lookup_object( const char* identifier, 
    202207                           crl_context_table ** stack ) 
    203208{ 
     
    205210  if( stack ) 
    206211    { 
    207       crl_hash_t h= crl_hash_hash( identifier ); 
     212      crl_hash_t h= crl_dd_hash_hash( identifier ); 
    208213      crl_debug( "looking up function '%s' - hash 0x%X\n", 
    209214                 identifier, h ); 
    210215 
    211       signed int idx= crl_context_get_table_size( (*stack) ); 
     216      signed int idx= crl_rr_context_get_table_size( (*stack) ); 
    212217      crl_debug("stack frame size :: '%i'!\n", idx ); 
    213218      crl_branch_context* ctx= NULL; idx--; 
     
    220225 
    221226          if( ctx->object_table->array ) 
    222             ent= crl_hash_lookup_table( ctx->object_table, h ); 
     227            ent= crl_dd_hash_lookup_table( ctx->object_table, h ); 
    223228 
    224229          if( ent ) 
     
    249254{ 
    250255  bool retval = true; 
    251   crl_symbol_obj** f = crl_context_lookup_function( functor->identifier, context ); 
     256  crl_symbol_obj** f = crl_rr_context_lookup_function( functor->identifier, context ); 
    252257  if( !f ) 
    253258    { 
    254259      // not defined! 
    255       crl_symbol_obj **s= crl_hash_insert( crl_hash_hash( functor->identifier ), 
    256                                            functor, ((*context)->curr->function_table) ); 
     260      crl_symbol_obj **s= crl_dd_hash_insert( crl_dd_hash_hash( functor->identifier ), 
     261                                              functor, ((*context)->curr->function_table) ); 
    257262      // this shouldn't happen! 
    258263      if( s ) 
     
    277282 
    278283  crl_assert( object->op_a_t == TYPE_STRING ); 
    279   crl_obj_state_t ** o = crl_context_lookup_object( object->op_a.string, 
    280                                                     context ); 
     284  crl_obj_state_t ** o = crl_rr_context_lookup_object( object->op_a.string, 
     285                                                       context ); 
    281286  bool retval = true; 
    282287  if( !o ) 
     
    285290      crl_obj_state_t *obj_state = (crl_obj_state_t*) 
    286291        crl_malloc( sizeof(crl_obj_state_t) ); 
     292       
    287293      obj_state->identifier = crl_strdup( object->op_a.string ); 
    288294      obj_state->state = CLASS_UNINIT; 
     
    291297        crl_malloc( sizeof(crl_branch_context) ); 
    292298 
    293       crl_context_init_context( &object_ctx ); 
    294       crl_context_push( object_ctx, (*context) ); 
     299      crl_rr_context_init( &object_ctx ); 
     300      crl_rr_context_push( object_ctx, (*context) ); 
    295301       
    296302      if( !(retval = crl_runtime_exec_toplevel( object->op_b.symbol_table, (*context) )) ) 
     
    298304 
    299305      crl_debug("poping object stack frame!\n"); 
    300       obj_state->context = crl_context_pop( (*context) ); 
     306      obj_state->context = crl_rr_context_pop( (*context) ); 
    301307 
    302308      crl_symbol_obj *object_def; 
     
    305311      object_def->op_a.object_state = obj_state; 
    306312 
    307       crl_symbol_obj **s= crl_hash_insert( crl_hash_hash( object->op_a.string ), 
     313      crl_symbol_obj **s= crl_dd_hash_insert( crl_dd_hash_hash( object->op_a.string ), 
    308314                                           object_def, ((*context)->curr->object_table) ); 
    309315      // this shouldn't happen! 
     
    330336      (*branch)->loop_ctx= false; 
    331337 
    332       (*branch)->symbol_table= (crl_table *) 
    333         crl_malloc( sizeof( crl_table ) ); 
    334       (*branch)->function_table= (crl_table *) 
    335         crl_malloc( sizeof( crl_table ) ); 
    336       (*branch)->object_table= (crl_table *) 
    337         crl_malloc( sizeof( crl_table ) ); 
    338  
    339       crl_hash_init_table( &((*branch)->symbol_table) ); 
    340       crl_hash_init_table( &((*branch)->function_table) ); 
    341       crl_hash_init_table( &((*branch)->object_table) ); 
     338      (*branch)->symbol_table= (crl_table_t *) 
     339        crl_malloc( sizeof( crl_table_t ) ); 
     340      (*branch)->function_table= (crl_table_t *) 
     341        crl_malloc( sizeof( crl_table_t ) ); 
     342      (*branch)->object_table= (crl_table_t *) 
     343        crl_malloc( sizeof( crl_table_t ) ); 
     344 
     345      crl_dd_hash_init_table( &((*branch)->symbol_table) ); 
     346      crl_dd_hash_init_table( &((*branch)->function_table) ); 
     347      crl_dd_hash_init_table( &((*branch)->object_table) ); 
    342348    } 
    343349  else 
     
    373379      retval->loop_ctx = (*ctx)->loop_ctx; 
    374380 
    375       retval->symbol_table = crl_hash_clone_table( &((*ctx)->symbol_table) ); 
    376       retval->function_table = crl_hash_clone_table( &((*ctx)->function_table) ); 
    377       retval->object_table = crl_hash_clone_table( &((*ctx)->object_table) ); 
     381      retval->symbol_table = crl_dd_hash_clone_table( &((*ctx)->symbol_table) ); 
     382      retval->function_table = crl_dd_hash_clone_table( &((*ctx)->function_table) ); 
     383      retval->object_table = crl_dd_hash_clone_table( &((*ctx)->object_table) ); 
    378384    } 
    379385  return retval; 
     
    396402  return retval; 
    397403} 
     404 
     405/** 
     406 * Initilizes the memory tables and different 
     407 * symbol tables 
     408 **/ 
     409bool crl_init_tables( void ) 
     410{ 
     411  crl_debug("Initilizing...\n"); 
     412 
     413  crl_branch_context *ctx= (crl_branch_context*) 
     414    crl_malloc(sizeof( crl_branch_context )); 
     415  crl_context_init_context( &ctx ); 
     416 
     417  crl_runtime_ctx_table= (crl_context_table*) 
     418    crl_malloc(sizeof( crl_context_table )); 
     419  crl_rr_context_init_table( &crl_runtime_ctx_table ); 
     420  crl_rr_context_push( ctx, crl_runtime_ctx_table ); 
     421 
     422  crl_debug("System tables initilized!\n"); 
     423 
     424  /* Init object types and modules! */ 
     425  // .... 
     426   
     427  pid_t pid; 
     428  /* get the process id */ 
     429  if( (pid = getpid( ) ) < 0 ) 
     430    { 
     431      crl_warning( "unable to get program pid" ); 
     432    } 
     433  else 
     434    { 
     435      crl_debug( "started with pid <%d>!\n", pid ); 
     436    } 
     437  return true; 
     438} 
  • src/rr_runtime.c

    r97bcdcf r168c2a5  
    1 #/** 
     1/** 
    22 * rr_runtime.c -> Part of Crules Programming language 
    33 * 
     
    6363 
    6464/** 
    65  * @param list is the list to be checked if it is valid or not! 
    66  * 
    67  * @param context holds the stack tables of symbols 
    68  * 
    69  * @returns true or false depending if the list symbols are, 
    70  * valid and within scope of the context 
    71  **/ 
    72 bool crl_runtime_list_format( crl_table *list, 
    73                               crl_context_table *context ) 
    74 { 
    75   crl_debug("formating list...\n"); 
    76   unsigned int i= 0; bool chk= true; 
    77   crl_table_entry* ei= NULL; 
    78  
    79   crl_symbol_obj *t= NULL; 
    80   for( ; i<list->nr; ++i ) 
    81     { 
    82       ei= crl_list_access_idx( i, &list ); 
    83       t= crl_runtime_evaluate_expression( ei->symbol, context ); 
    84       crl_garbage_mark_obj( &(ei->symbol) ); 
    85       ei->symbol= t; 
    86     } 
    87   return chk; 
    88 } 
    89  
    90 /** 
    9165 * @param sym is the symbol representing the whole assignment 
    9266 * should be a symbol of type OP_ASSIGN with operands A and B of 
     
    11387    { 
    11488      crl_assert( accessor->op_a_t == TYPE_STRING ); 
    115       var= crl_context_lookup_symbol( accessor->op_a.string, &context ); 
     89      var= crl_rr_context_lookup_symbol( accessor->op_a.string, &context ); 
    11690 
    11791      if( !var ) 
    11892        { 
    11993          crl_symbol_obj *item= sym->op_b.symbol_table; 
    120           crl_symbol_obj **s= crl_hash_insert( crl_hash_hash( accessor->op_a.string ), 
     94          crl_symbol_obj **s= crl_dd_hash_insert( crl_dd_hash_hash( accessor->op_a.string ), 
    12195                                               item, context->curr->symbol_table ); 
    12296          exec= true; 
     
    141115        } 
    142116    } 
    143   else if( accessor->type == SYMBOL_INDEX_REF ) 
    144     { 
    145       crl_assert( accessor->op_a_t == TYPE_STRING ); 
    146       crl_assert( accessor->op_b_t == TYPE_SYMBOL ); 
    147  
    148       var= crl_context_lookup_symbol( accessor->op_a.string, &context ); 
    149       if( var ) 
    150         { 
    151           crl_symbol_obj* ev= crl_runtime_evaluate_expression( accessor->op_b.symbol_table, 
    152                                                                context ); 
    153           if( var->symbol->op_a_t == TYPE_LIST ) 
    154             { 
    155               if( ev->op_a_t == TYPE_INTEGER ) 
    156                 { 
    157                   crl_table_entry *e= crl_list_access_idx( ev->op_a.integer, 
    158                                                            &(var->symbol->op_a.list_table) ); 
    159                   if( !e ) 
    160                     { 
    161                       crl_fatal("symbol list <%s> item at index <%i> is undefined!\n", 
    162                                 accessor->op_a.string, ev->op_a.integer ); 
    163                     } 
    164  
    165                   crl_symbol_obj *p= e->symbol; 
    166                   crl_symbol_obj *item= sym->op_b.symbol_table; 
    167                   if( !(e->symbol= item ) ) 
    168                     { 
    169                       exec= false; 
    170                       crl_error("error assigning the symbol!\n"); 
    171                     } 
    172                   crl_garbage_mark_obj( &p ); 
    173                 } 
    174               else 
    175                 { 
    176                   crl_error("Invalid index accessor type <0x%x>!\n", 
    177                             ev->op_a_t ); exec= false; 
    178                 } 
    179             } 
    180           else if( var->symbol->op_a_t == TYPE_STRING ) 
    181             { 
    182               crl_fatal("string index access not implemented yet!\n"); 
    183             } 
    184           else 
    185             { 
    186               crl_error("Invalid symbol to access index <0x%X>!\n", 
    187                         var->symbol->op_a_t ); 
    188             } 
    189           crl_garbage_mark_obj( &ev ); 
    190         } 
    191       else 
    192         { 
    193           crl_error("undefined symbol <%s>!\n", 
    194                     accessor->op_a.string ); exec= false; 
    195         } 
    196     } 
    197117  else 
    198118    { 
     
    206126} 
    207127 
    208 /** 
    209  * @param list is the list to be printed 
    210  * @param context is the symbol table of symbols 
    211  * @param fd the file-descriptor to print to 
    212  * 
    213  * @return returns true or false depending if the operation was valid or not! 
    214  **/ 
    215 bool crl_runtime_list_print( crl_table* list, 
    216                              crl_context_table *context, 
    217                              FILE * fd ) 
    218 { 
    219   bool retval= false; 
    220   if( list ) 
    221     { 
    222       unsigned int i=0, sz= list->nr; 
    223       fprintf(fd, "[ "); 
    224       for ( ; i<sz; ++i ) 
    225         { 
    226           crl_table_entry *e= crl_list_access_idx( i, &list ); 
    227           if( e ) 
    228             { 
    229               crl_symbol_obj *sym= e->symbol; 
    230               crl_runtime_object_print( sym, context, fd, false ); 
    231  
    232               if( i < sz-1 ) 
    233                 fprintf(fd, ", "); 
    234             } 
    235           else 
    236             crl_fatal("Undefined list symbol at index %i\n", i); 
    237         } 
    238       fprintf( fd, " ] " ); 
    239       retval= true; 
    240     } 
    241   else 
    242     { 
    243       crl_error("null list in print_list!\n"); 
    244       retval= false; 
    245     } 
    246   return retval; 
    247 } 
    248  
    249128crl_symbol_obj* 
    250129crl_runtime_eval_key_break( crl_context_table *ctx ) 
     
    252131  crl_symbol_obj* retval= NULL; 
    253132  //look for the loop return address! 
    254   signed int len= crl_context_get_table_size( ctx ); 
     133  signed int len= crl_rr_context_get_table_size( ctx ); 
    255134  crl_branch_context *c; len--; bool f= false; 
    256135 
     
    278157  crl_symbol_obj* retval= NULL; 
    279158  //look for the loop return address! 
    280   signed int len= crl_context_get_table_size( ctx ); 
     159  signed int len= crl_rr_context_get_table_size( ctx ); 
    281160  crl_branch_context *c; len--; bool f= false; 
    282161 
     
    311190  crl_branch_context *loop_ctx= (crl_branch_context*) 
    312191    crl_malloc(sizeof( crl_branch_context )); 
    313   crl_context_init_context( &loop_ctx ); 
     192  crl_rr_context_init( &loop_ctx ); 
    314193  loop_ctx->loop_ctx= true; 
    315   crl_context_push( loop_ctx, context ); 
     194  crl_rr_context_push( loop_ctx, context ); 
    316195 
    317196  crl_symbol_obj *f_ctx = sym->op_a.symbol_table; 
     
    379258 
    380259  crl_debug("freeing local stack frame!\n"); 
    381   crl_branch_context* ctx= crl_context_pop( context ); 
     260  crl_branch_context* ctx= crl_rr_context_pop( context ); 
    382261  crl_garbage_free_context_branch( &ctx ); 
    383262  crl_debug("done freeing stack frame!\n"); 
     
    403282  crl_branch_context *branch_ctx= (crl_branch_context*) 
    404283    crl_malloc(sizeof( crl_branch_context )); 
    405   crl_context_init_context( &branch_ctx ); 
     284  crl_rr_context_init( &branch_ctx ); 
    406285  branch_ctx->loop_ctx= true; 
    407   crl_context_push( branch_ctx, context ); 
     286  crl_rr_context_push( branch_ctx, context ); 
    408287 
    409288  while( i_eval == true ) 
     
    458337 
    459338  crl_debug("freeing local stack frame!\n"); 
    460   crl_branch_context* ctx= crl_context_pop( context ); 
     339  crl_branch_context* ctx= crl_rr_context_pop( context ); 
    461340  crl_garbage_free_context_branch( &ctx ); 
    462341  crl_debug("done freeing stack frame!\n"); 
     
    473352                          crl_context_table *context ) 
    474353{ 
    475   crl_assert( sym->type == SYMBOL_INDEX_REF ); 
    476   crl_assert( sym->op_a_t == TYPE_STRING ); 
    477   crl_assert( sym->op_b_t == TYPE_SYMBOL ); 
    478   crl_symbol_obj *retval = NULL; 
    479  
    480   crl_table_entry* var= crl_context_lookup_symbol( sym->op_a.string, &context ); 
    481   if( var ) 
    482     { 
    483       if( var->symbol->op_a_t == TYPE_LIST ) 
    484         { 
    485           crl_symbol_obj *o= var->symbol; 
    486           crl_symbol_obj *eval= crl_runtime_evaluate_expression( sym->op_b.symbol_table, 
    487                                                                  context ); 
    488           if( eval ) 
    489             { 
    490               if( eval->op_a_t == TYPE_INTEGER ) 
    491                 { 
    492                   crl_table_entry* e= crl_list_access_idx( eval->op_a.integer, 
    493                                                            &(o->op_a.list_table) ); 
    494                   if( e ) 
    495                     retval= e->symbol; 
    496                   else 
    497                     { 
    498                       crl_fatal("symbol list <%s> with item at index <%i> is undefined!\n", 
    499                                 sym->op_a.string, eval->op_a.integer ); 
    500                     } 
    501                 } 
    502               else 
    503                 { 
    504                   crl_error("invalid index object accessor type <0x%X>!\n", 
    505                             eval->op_a_t ); 
    506                   retval= NULL; 
    507                 } 
    508             } 
    509           else 
    510             { 
    511               crl_error("index expression evaluation error!\n"); 
    512               retval= NULL; 
    513             } 
    514         } 
    515       else if( var->symbol->op_a_t == TYPE_STRING ) 
    516         { 
    517           retval= NULL; 
    518         } 
    519       else 
    520         { 
    521           crl_error("invalid object type <0x%x> for index access!\n", 
    522                     var->symbol->op_a_t ); 
    523           retval= NULL; 
    524         } 
    525     } 
    526   else 
    527     { 
    528       crl_error("symbol object <%s> is undefined!\n", sym->op_a.string ); 
    529       retval= NULL; 
    530     } 
    531   return retval; 
     354  crl_fatal("not implemented yet!\n"); 
     355  return NULL; 
    532356} 
    533357 
     
    582406 
    583407        case TYPE_LIST: 
    584           crl_runtime_list_print( sym->op_a.list_table, context, fd ); 
     408          crl_fatal("not imeplemented yet!\n"); 
    585409          exec= true; 
    586410          break; 
     
    624448    { 
    625449      crl_assert( sym->op_a_t == TYPE_STRING ); 
    626       crl_table_entry* var= crl_context_lookup_symbol( sym->op_a.string, &context ); 
     450      crl_table_entry* var= crl_rr_context_lookup_symbol( sym->op_a.string, &context ); 
    627451      if( var ) 
    628452        { 
     
    670494              sizeof(unsigned short) ); 
    671495 
    672       crl_table *lst= NULL; 
     496      crl_table_t *lst= NULL; 
    673497      switch( (*sym)->op_a_t ) 
    674498        { 
     
    693517 
    694518        case TYPE_LIST: 
    695           if( !(lst= crl_list_clone( &((*sym)->op_a.list_table ))) ) 
    696             crl_error("error cloning list!\n"); 
    697           retval->op_a.list_table= lst; 
     519          crl_fatal("not implemented yet!\n"); 
    698520          break; 
    699521 
     
    709531 
    710532        case TYPE_OBJECT: 
    711           retval->op_a.object_state = crl_context_clone_obj_state( &((*sym)->op_a.object_state) ); 
     533          retval->op_a.object_state = crl_rr_context_clone_obj_state( &((*sym)->op_a.object_state) ); 
    712534          break; 
    713535 
    714536        case TYPE_BUILTIN: 
    715           retval->op_a.callback = crl_builtin_clone_callback( &(*sym)->op_a.callback ); 
     537          crl_fatal("not implemented yet!\n"); 
    716538          break; 
    717539 
     
    752574 
    753575        case TYPE_LIST: 
    754           if( !(lst= crl_list_clone( &((*sym)->op_b.list_table ))) ) 
    755             crl_error("error cloning list!\n"); 
    756           retval->op_b.list_table= lst; 
     576          crl_fatal("not implemented yet!\n"); 
    757577          break; 
    758578 
     
    770590          if( (*sym)->op_b.stack_table ) 
    771591            { 
    772               crl_stack* t= (crl_stack*) 
    773                 crl_malloc( sizeof(crl_stack) ); 
    774               crl_stack_init( &t ); 
     592              crl_stack_t* t= (crl_stack_t*) 
     593                crl_malloc( sizeof(crl_stack_t) ); 
     594              crl_dd_stack_init( &t ); 
    775595              unsigned int len= 
    776                 crl_stack_get_size( (*sym)->op_b.stack_table ); 
     596                crl_dd_stack_get_size( (*sym)->op_b.stack_table ); 
    777597              unsigned int idx= 0; 
    778598              for( ; idx<len; ++idx ) 
     
    780600                  crl_symbol_obj *o=  (*sym)->op_b.stack_table->array[ idx ]; 
    781601                  crl_symbol_obj *r= crl_runtime_obj_clone( &o, false ); 
    782                   crl_stack_push( t, r ); 
     602                  crl_dd_stack_push( t, r ); 
    783603                } 
    784604              retval->op_b.stack_table= t; 
     
    787607 
    788608        case TYPE_OBJECT: 
    789           retval->op_b.object_state = crl_context_clone_obj_state( &((*sym)->op_b.object_state) ); 
     609          retval->op_b.object_state = crl_rr_context_clone_obj_state( &((*sym)->op_b.object_state) ); 
    790610          break; 
    791611 
    792612        case TYPE_BUILTIN: 
    793           retval->op_b.callback = crl_builtin_clone_callback( &(*sym)->op_b.callback ); 
     613          crl_fatal("not imeplemented yet!\n"); 
    794614          break; 
    795615 
     
    1059879    { 
    1060880      crl_debug("expression is a singleton item!\n"); 
    1061       if( sym->op_a_t == TYPE_LIST ) 
    1062         { 
    1063           if( crl_runtime_list_format( sym->op_a.list_table, context ) == false ) 
    1064             { 
    1065               crl_fatal("problem formating the list assignment!\n"); 
    1066               retval = NULL; 
    1067             } 
    1068         } 
    1069881      retval= crl_runtime_obj_clone( &sym, false ); 
    1070882    } 
     
    1073885      crl_debug("singleton symbol refernce!\n"); 
    1074886      crl_assert( sym->op_a_t == TYPE_STRING ); 
    1075       crl_table_entry* ei= crl_context_lookup_symbol( sym->op_a.string, 
     887      crl_table_entry* ei= crl_rr_context_lookup_symbol( sym->op_a.string, 
    1076888                                                      &context ); 
    1077889      if( ei ) 
     
    1112924    { 
    1113925      char *object_ident = sym->op_a.symbol_table->op_a.string; 
    1114       crl_obj_state_t ** o = crl_context_lookup_object( object_ident, &context ); 
     926      crl_obj_state_t ** o = crl_rr_context_lookup_object( object_ident, &context ); 
    1115927      if( o ) 
    1116928        { 
     
    1133945          retval->type = SYMBOL_PRIMARY; 
    1134946          retval->op_a_t = TYPE_OBJECT; 
    1135           retval->op_a.object_state = crl_context_clone_obj_state( o ); 
     947          retval->op_a.object_state = crl_rr_context_clone_obj_state( o ); 
    1136948 
    1137949          // its now initilized! 
     
    12381050      if( sym->op_a_t == TYPE_LIST ) 
    12391051        { 
    1240           if( crl_runtime_list_format( sym->op_a.list_table, context ) == false ) 
    1241             { 
    1242               crl_fatal("problem formating the list assignment!\n"); 
    1243               retval = NULL; 
    1244             } 
     1052          crl_fatal("not imeplemented yet!\n"); 
    12451053        } 
    12461054      retval= crl_runtime_obj_clone( &sym, false ); 
     
    12501058      crl_debug("singleton symbol refernce!\n"); 
    12511059      crl_assert( sym->op_a_t == TYPE_STRING ); 
    1252       crl_table_entry* ei= crl_context_lookup_symbol( sym->op_a.string, 
     1060      crl_table_entry* ei= crl_rr_context_lookup_symbol( sym->op_a.string, 
    12531061                                               &context ); 
    12541062      if( ei ) 
     
    12891097    { 
    12901098      char *object_ident = sym->op_a.symbol_table->op_a.string; 
    1291       crl_obj_state_t ** o = crl_context_lookup_object( object_ident, &context ); 
     1099      crl_obj_state_t ** o = crl_rr_context_lookup_object( object_ident, &context ); 
    12921100      if( o ) 
    12931101        { 
     
    13101118          retval->type = SYMBOL_PRIMARY; 
    13111119          retval->op_a_t = TYPE_OBJECT; 
    1312           retval->op_a.object_state = crl_context_clone_obj_state( o ); 
     1120          retval->op_a.object_state = crl_rr_context_clone_obj_state( o ); 
    13131121 
    13141122          // its now initilized! 
     
    13461154  crl_branch_context *argument_ctx= (crl_branch_context*) 
    13471155    crl_malloc(sizeof( crl_branch_context )); 
    1348   crl_context_init_context( &argument_ctx ); 
     1156  crl_rr_context_init( &argument_ctx ); 
    13491157  argument_ctx->return_ctx= true; 
    1350   crl_context_push( argument_ctx, function_ctx ); 
     1158  crl_rr_context_push( argument_ctx, function_ctx ); 
    13511159   
    13521160  if( (*functor_def)->op_b_t == TYPE_PARAMETERS ) 
    13531161    { 
    1354       unsigned int n_parameters = crl_stack_get_size( (*functor_def)->op_b.stack_table ); 
     1162      unsigned int n_parameters = crl_dd_stack_get_size( (*functor_def)->op_b.stack_table ); 
    13551163      unsigned int n_arguments = 0; 
    13561164 
     
    13581166      if( call->op_b_t == TYPE_ARGUMENTS ) 
    13591167        { 
    1360           n_arguments = crl_stack_get_size( call->op_b.stack_table ); 
     1168          n_arguments = crl_dd_stack_get_size( call->op_b.stack_table ); 
    13611169          if( n_arguments >= n_parameters ) 
    13621170            { 
     
    13781186                  crl_assert( o->type == SYMBOL_PRIMARY ); 
    13791187 
    1380                   crl_symbol_obj** s= crl_hash_insert( crl_hash_hash( param_idx ) , 
    1381                                                        o , function_ctx->curr->symbol_table ); 
     1188                  crl_symbol_obj** s= crl_dd_hash_insert( crl_dd_hash_hash( param_idx ) , 
     1189                                                          o , function_ctx->curr->symbol_table ); 
    13821190                  if( s ) 
    13831191                    { 
     
    14051213 
    14061214  crl_debug("Function returned!\n"); 
    1407   crl_branch_context* arg_ctx_t= crl_context_pop( function_ctx ); 
     1215  crl_branch_context* arg_ctx_t= crl_rr_context_pop( function_ctx ); 
    14081216  if( ctx_retval ) 
    14091217    { 
     
    14231231{ 
    14241232  crl_assert( sym->op_a_t == TYPE_STRING ); crl_symbol_obj* retval= NULL; 
    1425   crl_symbol_obj** proc= crl_context_lookup_function( sym->op_a.string, &context );  
     1233  crl_symbol_obj** proc= crl_rr_context_lookup_function( sym->op_a.string, &context );  
    14261234 
    14271235  if( proc ) 
     
    14291237      crl_context_table *goto_ctx_table= (crl_context_table*) 
    14301238        crl_malloc(sizeof( crl_context_table )); 
    1431       crl_context_init_table( &goto_ctx_table ); 
    1432  
    1433       unsigned int context_length= crl_context_get_table_size( context ); 
     1239      crl_rr_context_init_table( &goto_ctx_table ); 
     1240 
     1241      unsigned int context_length= crl_rr_context_get_table_size( context ); 
    14341242      unsigned int ctx_idx= 0; crl_branch_context* ctx_t; 
    14351243 
     
    14441252          else 
    14451253            { 
    1446               crl_context_push( ctx_t, goto_ctx_table ); 
     1254              crl_rr_context_push( ctx_t, goto_ctx_table ); 
    14471255            } 
    14481256        } 
     
    14531261      unsigned int i = 0; 
    14541262      for( ; i<ctx_idx; ++i ) 
    1455         crl_context_pop( goto_ctx_table ); 
     1263        crl_rr_context_pop( goto_ctx_table ); 
    14561264 
    14571265      crl_garbage_free_context_table( &goto_ctx_table ); 
     
    14781286    { 
    14791287      //look for the return address! 
    1480       signed int len= crl_context_get_table_size( ctx ); 
     1288      signed int len= crl_rr_context_get_table_size( ctx ); 
    14811289      crl_branch_context *c; len--; bool f= false; 
    14821290 
     
    15161324    crl_malloc(sizeof( crl_branch_context )); 
    15171325 
    1518   crl_context_init_context( &branch_ctx ); 
    1519   crl_context_push( branch_ctx, context ); 
     1326  crl_rr_context_init( &branch_ctx ); 
     1327  crl_rr_context_push( branch_ctx, context ); 
    15201328 
    15211329  retval= crl_runtime_exec_branch( sym, context ); 
     
    15251333 
    15261334  crl_debug("freeing local stack frame!\n"); 
    1527   crl_branch_context* ctx= crl_context_pop( context ); 
     1335  crl_branch_context* ctx= crl_rr_context_pop( context ); 
    15281336  crl_garbage_free_context_branch( &ctx ); 
    15291337  crl_debug("done freeing stack frame!\n"); 
    15301338 
    15311339  return retval; 
    1532 } 
    1533  
    1534 /** 
    1535  * Limited to deleting variables cannot delete functions! 
    1536  * 
    1537  * Note semanticaly the symbol is marked as garbage, this is 
    1538  * a nice hint to the garbage collector if you want to memory 
    1539  * consious on low memory systems, remember normal ref-counting 
    1540  * and conservative collection continue's, so if it is seen as garbage 
    1541  * the collector will eventually delete it. 
    1542  **/ 
    1543 bool crl_runtime_keyword_delete( crl_symbol_obj *sym,  
    1544                                  crl_context_table *context ) 
    1545 { 
    1546   crl_assert( sym->type == KEY_DELETE ); bool retval = true; 
    1547   crl_debug("atempting to mark symbol <%s> as garbage!\n", sym->op_a.string ); 
    1548  
    1549   crl_table_entry *var= crl_context_lookup_symbol( sym->op_a.string, &context ); 
    1550   if( var ) 
    1551     { 
    1552       if( var->symbol ) 
    1553         { 
    1554           crl_symbol_obj *s = var->symbol; 
    1555           var->symbol = NULL; 
    1556           crl_garbage_mark_obj( &s ); 
    1557         } 
    1558     } 
    1559   return (retval); 
    15601340} 
    15611341 
     
    16201400            case KEY_BREAK: 
    16211401              rex= crl_runtime_eval_key_break( context ); 
    1622               break; 
    1623  
    1624             case KEY_DELETE: 
    1625               crl_runtime_keyword_delete( sym, context ); 
    16261402              break; 
    16271403 
     
    17041480              break; 
    17051481 
    1706             case KEY_DELETE: 
    1707               crl_runtime_keyword_delete( sym, context ); 
    1708               break; 
    1709  
    17101482            case SYMBOL_REFERENCE: 
    17111483              if( crl_interactive ) 
     
    17401512 
    17411513            case STRUCTURE_FUNCTION_DEF: 
    1742               if( crl_context_push_function_def( sym, &context ) == false ) 
     1514              if( crl_rr_context_push_function_def( sym, &context ) == false ) 
    17431515                crl_fatal("error pushing function definition!\n"); 
    17441516              break; 
    17451517 
    17461518            case STRUCTURE_OBJECT_DEF: 
    1747               if( crl_context_push_object_def( sym, &context ) == false) 
     1519              if( crl_rr_context_push_object_def( sym, &context ) == false) 
    17481520                crl_fatal("error pushing object definition"); 
    17491521              break; 
  • src/ss_lexical.l

    r8ff7a1b r168c2a5  
    105105continue                {  return CONTINUE; } 
    106106return                  {  return RETURN; } 
    107 delete                  {  return DELETE; } 
    108107for                     {  return FOR; } 
    109108while                   {  return WHILE; } 
  • src/ss_parser.y

    r8ff7a1b r168c2a5  
    7676%token CONTINUE "conintue" 
    7777%token RETURN "return" 
    78 %token DELETE "delete" 
    7978%token WHILE "while" 
    8079%token FOR "for" 
     
    133132%type<symbol> return_keyword 
    134133%type<symbol> continue_keyword 
    135 %type<symbol> delete_keyword 
    136134%type<symbol> procedure 
    137135%type<symbol> pblock 
     
    875873         | return_keyword ';' 
    876874         | continue_keyword ';' 
    877          | delete_keyword ';' 
    878875         | control_structure 
    879876         ; 
    880  
    881 delete_keyword: DELETE IDENTIFIER 
    882         { 
    883           crl_symbol_obj *sym; 
    884           crl_symbol_init( sym ); 
    885           sym->type= KEY_DELETE; 
    886           sym->op_a_t = TYPE_STRING; 
    887           sym->op_a.string = $2; 
    888           $$= sym; 
    889         } 
    890877 
    891878continue_keyword: CONTINUE