Changeset aaca19fb68c3cfe89e2acb105d2c3e8f5e028275

Show
Ignore:
Timestamp:
06/20/10 04:51:37 (2 years ago)
Author:
redbrain <redbrain@…>
Parents:
20d93fb737c36e2fa36fb1e9ac36734be14a77c6
Children:
15f9f5604c8c79bc8923edc3cbbf26eec93484c9
git-committer:
redbrain <redbrain@crules.org> / 2010-06-20T04:51:37Z+0100
Message:

bug fix on many references to single objects in a single context

Files:
5 modified

Legend:

Unmodified
Added
Removed
  • include/crules/symbols.h

    r20d93fb raaca19f  
    134134  bool (*print_hook)( void * , FILE * , bool ); 
    135135  crl_branch_context * context; 
    136   struct crl_number_prot_t * binary_protocol; 
    137   struct crl_builtin_member_def_t * member_fields; 
    138   struct crl_builtin_function_def_t * member_functions; 
     136  const struct crl_number_prot_t * binary_protocol; 
     137  const struct crl_builtin_member_def_t * member_fields; 
     138  const struct crl_builtin_function_def_t * member_functions; 
    139139  bool builtin; 
    140140} crl_type_obj_def_t ; 
  • src/obj_integer.c

    r4791bff raaca19f  
    155155}; 
    156156 
    157 struct crl_builtin_function_def_t integer_module_function_table[] = { 
     157const struct crl_builtin_function_def_t integer_module_function_table[] = { 
    158158  { "to_string", 0, &crl_obj_integer_to_string }, 
    159159  { NULL, 0, NULL }, 
    160160} ; 
    161161 
    162 struct crl_builtin_member_def_t integer_module_member_table[] = { 
     162const struct crl_builtin_member_def_t integer_module_member_table[] = { 
    163163  { 0, NULL }, 
    164164} ; 
    165165 
    166 struct crl_type_obj_def_t integer_object = { 
     166const struct crl_type_obj_def_t integer_object = { 
    167167  "Int", 
    168168  sizeof( crl_type_integer_t ), 
  • src/rr_context.c

    r20d93fb raaca19f  
    102102            } 
    103103        } 
     104 
     105      // def any local symbols pointing to the objects! 
     106      idx = 0; crl_table_entry *c_arr = ctx->symbol_table->array; 
     107      for( ; idx<(ctx->symbol_table->size); ++idx ) 
     108        { 
     109          crl_symbol_obj *o = c_arr[idx].symbol; 
     110 
     111          if( o ) 
     112            { 
     113              o->n_ref--; 
     114              crl_debug("de-referencing object <%p> to count <%i>!\n", 
     115                        (void*)o, o->n_ref ); 
     116            } 
     117        }       
    104118    } 
    105119 
  • src/rr_runtime.c

    r20d93fb raaca19f  
    14071407          switch( sym->type ) 
    14081408            { 
    1409               /* 
    14101409            case STRUCTURE_CONDIT_CTX: 
    14111410              crl_runtime_conditional_dispatch( sym, context ); 
     
    14221421              break; 
    14231422 
     1423              /* 
    14241424            case STRUCTURE_OBJECT_DEF: 
    14251425              if( !(crl_rr_context_push_obj_def( sym, &context )) ) 
  • src/ss_parser.y

    r4791bff raaca19f  
    5252extern bool crl_interactive; 
    5353extern int yylineno; 
     54 
     55 bool crl_parse_error = false; 
    5456 
    5557// Helps build up symbol tables to have 
     
    170172            { 
    171173              crl_runtime_exec_toplevel( $2, crl_runtime_ctx_table ); 
    172               if( (( $2->type != STRUCTURE_FUNCTION_DEF) && 
    173                   ($2->type != STRUCTURE_OBJECT_DEF)) ) 
     174              if( !crl_parse_error ) 
    174175                { 
    175                   crl_garbage_mark_obj( &$2 ); 
     176                  if( (( $2->type != STRUCTURE_FUNCTION_DEF) && 
     177                       ($2->type != STRUCTURE_OBJECT_DEF)) ) 
     178                    { 
     179                      crl_garbage_mark_obj( &$2 ); 
     180                    } 
     181                } 
     182              else 
     183                { 
     184                  if( crl_interactive ) 
     185                    { 
     186                      crl_parse_error = false; 
     187                      crl_garbage_mark_obj( &$2 ); 
     188                    } 
    176189                } 
    177190            } 
     
    179192            { 
    180193              crl_error("malformed declaration!\n"); 
     194              crl_parse_error = true; 
    181195            } 
    182196            ;