Changeset 39e8406 in mainline for uspace/app/sbi/src/rdata.c
- Timestamp:
- 2010-03-20T21:57:13Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b535aeb
- Parents:
- 6ba20a6b
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sbi/src/rdata.c
r6ba20a6b r39e8406 243 243 } 244 244 245 rdata_titem_t *rdata_titem_new(titem_class_t tic)246 {247 rdata_titem_t *titem;248 249 titem = calloc(1, sizeof(rdata_titem_t));250 if (titem == NULL) {251 printf("Memory allocation failed.\n");252 exit(1);253 }254 255 titem->tic = tic;256 return titem;257 }258 259 rdata_tarray_t *rdata_tarray_new(void)260 {261 rdata_tarray_t *tarray;262 263 tarray = calloc(1, sizeof(rdata_tarray_t));264 if (tarray == NULL) {265 printf("Memory allocation failed.\n");266 exit(1);267 }268 269 return tarray;270 }271 272 rdata_tcsi_t *rdata_tcsi_new(void)273 {274 rdata_tcsi_t *tcsi;275 276 tcsi = calloc(1, sizeof(rdata_tcsi_t));277 if (tcsi == NULL) {278 printf("Memory allocation failed.\n");279 exit(1);280 }281 282 return tcsi;283 }284 285 rdata_tprimitive_t *rdata_tprimitive_new(void)286 {287 rdata_tprimitive_t *tprimitive;288 289 tprimitive = calloc(1, sizeof(rdata_tprimitive_t));290 if (tprimitive == NULL) {291 printf("Memory allocation failed.\n");292 exit(1);293 }294 295 return tprimitive;296 }297 298 245 void rdata_array_alloc_element(rdata_array_t *array) 299 246 { … … 447 394 } 448 395 449 /** Get item var-class.450 *451 * Get var-class of @a item, regardless whether it is a value or address.452 * (I.e. the var class of the value or variable at the given address).453 */454 var_class_t rdata_item_get_vc(rdata_item_t *item)455 {456 var_class_t vc;457 458 switch (item->ic) {459 case ic_value:460 vc = item->u.value->var->vc;461 break;462 case ic_address:463 switch (item->u.address->ac) {464 case ac_var:465 vc = item->u.address->u.var_a->vref->vc;466 break;467 case ac_prop:468 printf("Unimplemented: Get property address "469 "varclass.\n");470 exit(1);471 default:472 assert(b_false);473 }474 break;475 default:476 assert(b_false);477 }478 479 return vc;480 }481 482 /** Determine if CSI @a a is derived from CSI described by type item @a tb. */483 bool_t rdata_is_csi_derived_from_ti(stree_csi_t *a, rdata_titem_t *tb)484 {485 bool_t res;486 487 switch (tb->tic) {488 case tic_tcsi:489 res = stree_is_csi_derived_from_csi(a, tb->u.tcsi->csi);490 break;491 default:492 printf("Error: Base type is not a CSI.\n");493 exit(1);494 }495 496 return res;497 }498 499 396 void rdata_item_print(rdata_item_t *item) 500 397 {
Note:
See TracChangeset
for help on using the changeset viewer.