Changes in uspace/app/sbi/src/rdata.c [38aaacc2:051bc69a] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sbi/src/rdata.c
r38aaacc2 r051bc69a 52 52 #include "stree.h" 53 53 #include "symbol.h" 54 #include "strtab.h" 54 55 55 56 #include "rdata.h" … … 61 62 static void rdata_ref_copy(rdata_ref_t *src, rdata_ref_t **dest); 62 63 static void rdata_deleg_copy(rdata_deleg_t *src, rdata_deleg_t **dest); 64 static void rdata_enum_copy(rdata_enum_t *src, rdata_enum_t **dest); 63 65 static void rdata_array_copy(rdata_array_t *src, rdata_array_t **dest); 64 66 static void rdata_object_copy(rdata_object_t *src, rdata_object_t **dest); 65 67 static void rdata_resource_copy(rdata_resource_t *src, 66 68 rdata_resource_t **dest); 69 static void rdata_symbol_copy(rdata_symbol_t *src, rdata_symbol_t **dest); 67 70 68 71 static int rdata_array_get_dim(rdata_array_t *array); … … 247 250 248 251 return deleg; 252 } 253 254 /** Allocate new enum value. 255 * 256 * @return New enum value. 257 */ 258 rdata_enum_t *rdata_enum_new(void) 259 { 260 rdata_enum_t *enum_v; 261 262 enum_v = calloc(1, sizeof(rdata_enum_t)); 263 if (enum_v == NULL) { 264 printf("Memory allocation failed.\n"); 265 exit(1); 266 } 267 268 return enum_v; 249 269 } 250 270 … … 373 393 374 394 return resource_v; 395 } 396 397 /** Allocate new symbol reference. 398 * 399 * @return New symbol reference. 400 */ 401 rdata_symbol_t *rdata_symbol_new(void) 402 { 403 rdata_symbol_t *symbol_v; 404 405 symbol_v = calloc(1, sizeof(rdata_symbol_t)); 406 if (symbol_v == NULL) { 407 printf("Memory allocation failed.\n"); 408 exit(1); 409 } 410 411 return symbol_v; 375 412 } 376 413 … … 453 490 rdata_deleg_copy(src->u.deleg_v, &nvar->u.deleg_v); 454 491 break; 492 case vc_enum: 493 rdata_enum_copy(src->u.enum_v, &nvar->u.enum_v); 494 break; 455 495 case vc_array: 456 496 rdata_array_copy(src->u.array_v, &nvar->u.array_v); … … 461 501 case vc_resource: 462 502 rdata_resource_copy(src->u.resource_v, &nvar->u.resource_v); 503 break; 504 case vc_symbol: 505 rdata_symbol_copy(src->u.symbol_v, &nvar->u.symbol_v); 463 506 break; 464 507 } … … 534 577 } 535 578 579 /** Copy enum value. 580 * 581 * @param src Source enum value. 582 * @param dest Place to store pointer to new enum value. 583 */ 584 static void rdata_enum_copy(rdata_enum_t *src, rdata_enum_t **dest) 585 { 586 *dest = rdata_enum_new(); 587 (*dest)->value = src->value; 588 } 589 536 590 /** Copy array. 537 591 * … … 567 621 *dest = rdata_resource_new(); 568 622 (*dest)->data = src->data; 623 } 624 625 /** Copy symbol. 626 * 627 * @param src Source symbol. 628 * @param dest Place to store pointer to new symbol. 629 */ 630 static void rdata_symbol_copy(rdata_symbol_t *src, rdata_symbol_t **dest) 631 { 632 *dest = rdata_symbol_new(); 633 (*dest)->sym = src->sym; 569 634 } 570 635 … … 621 686 case vc_ref: var->u.ref_v = nvar->u.ref_v; break; 622 687 case vc_deleg: var->u.deleg_v = nvar->u.deleg_v; break; 688 case vc_enum: var->u.enum_v = nvar->u.enum_v; break; 623 689 case vc_array: var->u.array_v = nvar->u.array_v; break; 624 690 case vc_object: var->u.object_v = nvar->u.object_v; break; 625 691 case vc_resource: var->u.resource_v = nvar->u.resource_v; break; 692 case vc_symbol: var->u.symbol_v = nvar->u.symbol_v; break; 626 693 } 627 694 … … 732 799 printf(")"); 733 800 break; 801 case vc_enum: 802 symbol_print_fqn( 803 enum_to_symbol(var->u.enum_v->value->outer_enum)); 804 printf(".%s", 805 strtab_get_str(var->u.enum_v->value->name->sid)); 806 break; 734 807 case vc_array: 735 808 printf("array"); … … 741 814 printf("resource(%p)", var->u.resource_v->data); 742 815 break; 743 } 744 } 816 case vc_symbol: 817 printf("symbol("); 818 if (var->u.symbol_v->sym != NULL) { 819 symbol_print_fqn(var->u.symbol_v->sym); 820 } else { 821 printf("nil"); 822 } 823 printf(")"); 824 break; 825 } 826 }
Note:
See TracChangeset
for help on using the changeset viewer.