Changeset 11b18d6c8033bdf184ee5924e576f0de3e5861aa
- Timestamp:
- 04/19/10 18:03:45 (2 years ago)
- Author:
- Philip Herron <redbrain@…>
- Parents:
- 168c2a5ec263be75f797e77bdf8a7e3011663c1a
- Children:
- 794fb4166890a42ec59270e3441d7ddf500fdbdb
- git-committer:
- Philip Herron <redbrain@omicron.(none)> / 2010-04-19T18:03:45Z+0100
- Message:
-
compiles now time to fill out the objects
- Location:
- src
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r8cc1949
|
r11b18d6
|
|
| 40 | 40 | |
| 41 | 41 | /* Declare the tables */ |
| 42 | | extern crl_stack *crl_parse_stk, *crl_lex_stack; |
| | 42 | extern crl_stack_t *crl_parse_stk, *crl_lex_stack; |
| 43 | 43 | // the runtime symbol stack! |
| 44 | 44 | extern crl_context_table *crl_runtime_ctx_table; |
| 45 | | static crl_stack* crl_runtime_gbg = NULL; |
| 46 | | |
| 47 | | static void free_hash_table_symbols( crl_table ** ); |
| | 45 | static crl_stack_t* crl_runtime_gbg = NULL; |
| | 46 | |
| | 47 | static void free_hash_table_symbols( crl_table_t ** ); |
| 48 | 48 | |
| 49 | 49 | void crl_garbage_lex_free( void ) |
| … |
… |
|
| 52 | 52 | { |
| 53 | 53 | char * o; |
| 54 | | while( (o= crl_stack_pop( crl_lex_stack )) ) |
| | 54 | while( (o= crl_dd_stack_pop( crl_lex_stack )) ) |
| 55 | 55 | { |
| 56 | 56 | crl_free( o ); |
| 57 | 57 | } |
| 58 | | crl_stack_free( crl_lex_stack ); |
| | 58 | crl_dd_stack_free( crl_lex_stack ); |
| 59 | 59 | crl_lex_stack= NULL; |
| 60 | 60 | } |
| … |
… |
|
| 67 | 67 | crl_debug("garbage collector running...\n"); |
| 68 | 68 | crl_symbol_obj *p_obj; |
| 69 | | unsigned int i = crl_stack_get_size( crl_runtime_gbg ); |
| | 69 | unsigned int i = crl_dd_stack_get_size( crl_runtime_gbg ); |
| 70 | 70 | unsigned int idx = 0; |
| 71 | 71 | |
| … |
… |
|
| 75 | 75 | idx++; crl_garbage_free_obj( &p_obj ); |
| 76 | 76 | } |
| 77 | | crl_stack_free( crl_runtime_gbg ); |
| | 77 | crl_dd_stack_free( crl_runtime_gbg ); |
| 78 | 78 | crl_runtime_gbg = NULL; |
| 79 | 79 | } |
| … |
… |
|
| 86 | 86 | if( crl_runtime_gbg ) |
| 87 | 87 | { |
| 88 | | crl_stack_push( crl_runtime_gbg, (*sym) ); |
| | 88 | crl_dd_stack_push( crl_runtime_gbg, (*sym) ); |
| 89 | 89 | } |
| 90 | 90 | else |
| 91 | 91 | { |
| 92 | | crl_runtime_gbg= (crl_stack*) |
| 93 | | crl_malloc(sizeof(crl_stack)); |
| 94 | | crl_stack_init( &crl_runtime_gbg ); |
| 95 | | |
| 96 | | crl_stack_push( crl_runtime_gbg, (*sym) ); |
| | 92 | crl_runtime_gbg= (crl_stack_t *) |
| | 93 | crl_malloc(sizeof(crl_stack_t)); |
| | 94 | crl_dd_stack_init( &crl_runtime_gbg ); |
| | 95 | |
| | 96 | crl_dd_stack_push( crl_runtime_gbg, (*sym) ); |
| 97 | 97 | } |
| 98 | 98 | } |
| … |
… |
|
| 117 | 117 | { |
| 118 | 118 | crl_debug("freeing parse stk!\n"); |
| 119 | | crl_stack_free( crl_parse_stk ); |
| | 119 | crl_dd_stack_free( crl_parse_stk ); |
| 120 | 120 | crl_debug("done!\n"); |
| 121 | 121 | } |
| … |
… |
|
| 147 | 147 | { |
| 148 | 148 | case TYPE_LIST: |
| 149 | | crl_garbage_free_hash_table( &((*sym)->op_a.list_table) ); |
| | 149 | crl_fatal("not implemented yet!\n"); |
| 150 | 150 | break; |
| 151 | 151 | |
| … |
… |
|
| 169 | 169 | { |
| 170 | 170 | case TYPE_LIST: |
| 171 | | crl_garbage_free_hash_table( &((*sym)->op_b.list_table) ); |
| | 171 | crl_fatal("not implemented yet!\n"); |
| 172 | 172 | break; |
| 173 | 173 | |
| … |
… |
|
| 187 | 187 | if( (*sym)->op_b.stack_table ) |
| 188 | 188 | { |
| 189 | | crl_stack *t= (*sym)->op_b.stack_table; |
| 190 | | char * o= crl_stack_pop( t ); |
| | 189 | crl_stack_t *t= (*sym)->op_b.stack_table; |
| | 190 | char * o= crl_dd_stack_pop( t ); |
| 191 | 191 | while( o ) |
| 192 | 192 | { |
| 193 | 193 | crl_free( o ); |
| 194 | | o= crl_stack_pop( t ); |
| | 194 | o= crl_dd_stack_pop( t ); |
| 195 | 195 | } |
| 196 | | crl_stack_free( t ); |
| | 196 | crl_dd_stack_free( t ); |
| 197 | 197 | } |
| 198 | 198 | break; |
| … |
… |
|
| 201 | 201 | if( (*sym)->op_b.stack_table ) |
| 202 | 202 | { |
| 203 | | crl_stack *t= (*sym)->op_b.stack_table; |
| 204 | | crl_symbol_obj * o= crl_stack_pop( t ); |
| | 203 | crl_stack_t *t= (*sym)->op_b.stack_table; |
| | 204 | crl_symbol_obj * o= crl_dd_stack_pop( t ); |
| 205 | 205 | while( o ) |
| 206 | 206 | { |
| 207 | 207 | crl_garbage_free_obj( &o ); |
| 208 | | o= crl_stack_pop( t ); |
| | 208 | o= crl_dd_stack_pop( t ); |
| 209 | 209 | } |
| 210 | | crl_stack_free( t ); |
| | 210 | crl_dd_stack_free( t ); |
| 211 | 211 | } |
| 212 | 212 | break; |
| … |
… |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | | void crl_garbage_free_hash_table( crl_table **table ) |
| | 233 | void crl_garbage_free_hash_table( crl_table_t ** table ) |
| 234 | 234 | { |
| 235 | 235 | crl_debug("freeing hash table!\n"); |
| … |
… |
|
| 239 | 239 | |
| 240 | 240 | static |
| 241 | | void free_hash_table_symbols( crl_table **table ) |
| | 241 | void free_hash_table_symbols( crl_table_t ** table ) |
| 242 | 242 | { |
| 243 | 243 | if( table ) |
| … |
… |
|
| 292 | 292 | void crl_garbage_free_context_table( crl_context_table **stack ) |
| 293 | 293 | { |
| 294 | | signed int len= crl_context_get_table_size( *stack ); |
| | 294 | signed int len= crl_rr_context_get_table_size( *stack ); |
| 295 | 295 | crl_debug("stack frame size :: '%i'!\n", len ); |
| 296 | 296 | len--; |
-
|
r168c2a5
|
r11b18d6
|
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | | bool crl_context_push_function_def( crl_symbol_obj * functor, |
| | 252 | bool crl_rr_context_push_function_def( crl_symbol_obj * functor, |
| 253 | 253 | crl_context_table ** context ) |
| 254 | 254 | { |
| … |
… |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | | bool crl_context_push_object_def( crl_symbol_obj * object, |
| | 279 | bool crl_rr_context_push_object_def( crl_symbol_obj * object, |
| 280 | 280 | crl_context_table ** context ) |
| 281 | 281 | { |
| … |
… |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | | void crl_context_init_context( crl_branch_context ** branch ) |
| | 330 | void crl_rr_context_init( crl_branch_context ** branch ) |
| 331 | 331 | { |
| 332 | 332 | if( branch ) |
| … |
… |
|
| 369 | 369 | **/ |
| 370 | 370 | crl_branch_context * |
| 371 | | crl_context_clone_branch( crl_branch_context ** ctx ) |
| | 371 | crl_rr_context_clone_branch( crl_branch_context ** ctx ) |
| 372 | 372 | { |
| 373 | 373 | crl_branch_context * retval = (crl_branch_context*) |
| … |
… |
|
| 387 | 387 | |
| 388 | 388 | crl_obj_state_t * |
| 389 | | crl_context_clone_obj_state( crl_obj_state_t ** obj_s ) |
| | 389 | crl_rr_context_clone_obj_state( crl_obj_state_t ** obj_s ) |
| 390 | 390 | { |
| 391 | 391 | crl_debug("clone object state!\n"); |
| … |
… |
|
| 397 | 397 | retval->identifier = crl_strdup( (*obj_s)->identifier ); |
| 398 | 398 | retval->state = ((*obj_s)->state); |
| 399 | | retval->context = crl_context_clone_branch( &((*obj_s)->context) ); |
| | 399 | retval->context = crl_rr_context_clone_branch( &((*obj_s)->context) ); |
| 400 | 400 | crl_debug("cloned context!\n"); |
| 401 | 401 | } |
| … |
… |
|
| 413 | 413 | crl_branch_context *ctx= (crl_branch_context*) |
| 414 | 414 | crl_malloc(sizeof( crl_branch_context )); |
| 415 | | crl_context_init_context( &ctx ); |
| | 415 | crl_rr_context_init( &ctx ); |
| 416 | 416 | |
| 417 | 417 | crl_runtime_ctx_table= (crl_context_table*) |