Changes in uspace/app/sbi/src/stree.c [38aaacc2:23de644] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sbi/src/stree.c
r38aaacc2 r23de644 37 37 #include "stree.h" 38 38 39 /** Allocate new module.40 *41 * @return New module42 */43 39 stree_module_t *stree_module_new(void) 44 40 { … … 55 51 } 56 52 57 /** Allocate new module member.58 *59 * @param mc Module member class60 * @return New module member61 */62 53 stree_modm_t *stree_modm_new(modm_class_t mc) 63 54 { … … 74 65 } 75 66 76 /** Allocate new CSI.77 *78 * @param cc CSI class79 * @return New CSI80 */81 67 stree_csi_t *stree_csi_new(csi_class_t cc) 82 68 { … … 97 83 } 98 84 99 /** Allocate new CSI member.100 *101 * @param cc CSI member class102 * @return New CSI member103 */104 85 stree_csimbr_t *stree_csimbr_new(csimbr_class_t cc) 105 86 { … … 116 97 } 117 98 118 /** Allocate new member delegate.119 *120 * @return New member delegate121 */122 stree_deleg_t *stree_deleg_new(void)123 {124 stree_deleg_t *deleg;125 126 deleg = calloc(1, sizeof(stree_deleg_t));127 if (deleg == NULL) {128 printf("Memory allocation failed.\n");129 exit(1);130 }131 132 return deleg;133 }134 135 /** Allocate new member function.136 *137 * @return New member function138 */139 99 stree_fun_t *stree_fun_new(void) 140 100 { … … 150 110 } 151 111 152 /** Allocate new member variable.153 *154 * @return New member variable155 */156 112 stree_var_t *stree_var_new(void) 157 113 { … … 167 123 } 168 124 169 /** Allocate new property.170 *171 * @return New property172 */173 125 stree_prop_t *stree_prop_new(void) 174 126 { … … 184 136 } 185 137 186 /** Allocate new type argument.187 *188 * @return New type argument189 */190 stree_targ_t *stree_targ_new(void)191 {192 stree_targ_t *targ;193 194 targ = calloc(1, sizeof(stree_targ_t));195 if (targ == NULL) {196 printf("Memory allocation failed.\n");197 exit(1);198 }199 200 return targ;201 }202 203 /** Allocate new symbol attribute.204 *205 * @param sac Symbol attribute class206 * @return New symbol attribute207 */208 138 stree_symbol_attr_t *stree_symbol_attr_new(symbol_attr_class_t sac) 209 139 { … … 220 150 } 221 151 222 /** Allocate new procedure.223 *224 * @return New procedure225 */226 152 stree_proc_t *stree_proc_new(void) 227 153 { … … 237 163 } 238 164 239 /** Allocate new procedure argument.240 *241 * @return New procedure argument242 */243 165 stree_proc_arg_t *stree_proc_arg_new(void) 244 166 { … … 254 176 } 255 177 256 /** Allocate new function signature.257 *258 * @return New procedure argument259 */260 stree_fun_sig_t *stree_fun_sig_new(void)261 {262 stree_fun_sig_t *fun_sig;263 264 fun_sig = calloc(1, sizeof(stree_fun_sig_t));265 if (fun_sig == NULL) {266 printf("Memory allocation failed.\n");267 exit(1);268 }269 270 return fun_sig;271 }272 273 /** Allocate new procedure argument attribute.274 *275 * @param Argument attribute class276 * @return New procedure argument attribute277 */278 178 stree_arg_attr_t *stree_arg_attr_new(arg_attr_class_t aac) 279 179 { … … 290 190 } 291 191 292 /** Allocate new statement.293 *294 * @param sc Statement class295 * @return New statement296 */297 192 stree_stat_t *stree_stat_new(stat_class_t sc) 298 193 { … … 309 204 } 310 205 311 /** Allocate new local variable declaration.312 *313 * @return New local variable declaration314 */315 206 stree_vdecl_t *stree_vdecl_new(void) 316 207 { … … 326 217 } 327 218 328 /** Allocate new @c if statement.329 *330 * @return New @c if statement331 */332 219 stree_if_t *stree_if_new(void) 333 220 { … … 343 230 } 344 231 345 /** Allocate new @c while statement.346 *347 * @return New @c while statement348 */349 232 stree_while_t *stree_while_new(void) 350 233 { … … 360 243 } 361 244 362 /** Allocate new @c for statement.363 *364 * @return New @c for statement365 */366 245 stree_for_t *stree_for_new(void) 367 246 { … … 377 256 } 378 257 379 /** Allocate new @c raise statement.380 *381 * @return New @c raise statement382 */383 258 stree_raise_t *stree_raise_new(void) 384 259 { … … 394 269 } 395 270 396 /** Allocate new @c return statement.397 *398 * @return New @c return statement399 */400 271 stree_return_t *stree_return_new(void) 401 272 { … … 411 282 } 412 283 413 /** Allocate new with-except-finally statement.414 *415 * @return New with-except-finally statement.416 */417 284 stree_wef_t *stree_wef_new(void) 418 285 { … … 428 295 } 429 296 430 /** Allocate new expression statement.431 *432 * @return New expression statement433 */434 297 stree_exps_t *stree_exps_new(void) 435 298 { … … 445 308 } 446 309 447 /** Allocate new @c except clause.448 *449 * @return New @c except clause450 */451 310 stree_except_t *stree_except_new(void) 452 311 { … … 462 321 } 463 322 464 /** Allocate new statement block.465 *466 * @return New statement block467 */468 323 stree_block_t *stree_block_new(void) 469 324 { … … 479 334 } 480 335 481 /** Allocate new expression.482 *483 * @param ec Expression class484 * @return New expression485 */486 336 stree_expr_t *stree_expr_new(expr_class_t ec) 487 337 { … … 498 348 } 499 349 500 /** Allocate new assignment.501 *502 * @param ac Assignment class503 * @return New assignment504 */505 350 stree_assign_t *stree_assign_new(assign_class_t ac) 506 351 { … … 517 362 } 518 363 519 /** Allocate new binary operation.520 *521 * @return New binary operation522 */523 364 stree_binop_t *stree_binop_new(binop_class_t bc) 524 365 { … … 535 376 } 536 377 537 /** Allocate new unary operation.538 *539 * @param uc Unary operation class540 * @return New unary operation541 */542 378 stree_unop_t *stree_unop_new(unop_class_t uc) 543 379 { … … 554 390 } 555 391 556 /** Allocate new @c new operation.557 *558 * @return New @c new operation559 */560 392 stree_new_t *stree_new_new(void) 561 393 { … … 571 403 } 572 404 573 /** Allocate new .574 *575 * @return New576 */577 405 stree_access_t *stree_access_new(void) 578 406 { … … 588 416 } 589 417 590 /** Allocate new function call operation.591 *592 * @return New function call operation593 */594 418 stree_call_t *stree_call_new(void) 595 419 { … … 605 429 } 606 430 607 /** Allocate new indexing operation.608 *609 * @return New indexing operation610 */611 431 stree_index_t *stree_index_new(void) 612 432 { … … 622 442 } 623 443 624 /** Allocate new as conversion.625 *626 * @return New as conversion627 */628 444 stree_as_t *stree_as_new(void) 629 445 { … … 639 455 } 640 456 641 /** Allocate new boxing operation.642 *643 * @return New boxing operation644 */645 stree_box_t *stree_box_new(void)646 {647 stree_box_t *box_expr;648 649 box_expr = calloc(1, sizeof(stree_box_t));650 if (box_expr == NULL) {651 printf("Memory allocation failed.\n");652 exit(1);653 }654 655 return box_expr;656 }657 658 /** Allocate new name reference operation.659 *660 * @return New name reference operation661 */662 457 stree_nameref_t *stree_nameref_new(void) 663 458 { … … 673 468 } 674 469 675 /** Allocate new identifier.676 *677 * @return New identifier678 */679 470 stree_ident_t *stree_ident_new(void) 680 471 { … … 690 481 } 691 482 692 /** Allocate new literal.693 *694 * @param ltc Literal class695 * @return New literal696 */697 483 stree_literal_t *stree_literal_new(literal_class_t ltc) 698 484 { … … 709 495 } 710 496 711 /** Allocate new @c self reference.712 *713 * @return New @c self reference714 */715 497 stree_self_ref_t *stree_self_ref_new(void) 716 498 { … … 726 508 } 727 509 728 /** Allocate new type expression729 *730 * @return New type expression731 */732 510 stree_texpr_t *stree_texpr_new(texpr_class_t tc) 733 511 { … … 744 522 } 745 523 746 /** Allocate new type access operation.747 *748 * @return New type access operation749 */750 524 stree_taccess_t *stree_taccess_new(void) 751 525 { … … 761 535 } 762 536 763 /** Allocate new type application operation.764 *765 * @return New type application operation766 */767 537 stree_tapply_t *stree_tapply_new(void) 768 538 { … … 778 548 } 779 549 780 /** Allocate new type indexing operation.781 *782 * @return New type indexing operation783 */784 550 stree_tindex_t *stree_tindex_new(void) 785 551 { … … 795 561 } 796 562 797 /** Allocate new type literal.798 *799 * @return New type literal800 */801 563 stree_tliteral_t *stree_tliteral_new(tliteral_class_t tlc) 802 564 { … … 813 575 } 814 576 815 /** Allocate new type name reference.816 *817 * @return New type name reference818 */819 577 stree_tnameref_t *stree_tnameref_new(void) 820 578 { … … 830 588 } 831 589 832 /** Allocate new symbol.833 *834 * @return New symbol835 */836 590 stree_symbol_t *stree_symbol_new(symbol_class_t sc) 837 591 { … … 848 602 } 849 603 850 /** Allocate new program.851 *852 * @return New program853 */854 604 stree_program_t *stree_program_new(void) 855 605 { … … 865 615 } 866 616 867 /** Determine if @a symbol has attribute of class @a sac. 868 * 869 * @param symbol Symbol 870 * @param sac Symbol attribute class 871 * @return @c b_true if yes, @c b_false if no. 872 */ 617 /** Determine if @a symbol has attribute of class @a sac. */ 873 618 bool_t stree_symbol_has_attr(stree_symbol_t *symbol, symbol_attr_class_t sac) 874 619 { … … 888 633 } 889 634 890 /** Determine if argument @a arg has attribute of class @a aac. 891 * 892 * @param arg Formal procedure argument 893 * @param aac Argument attribute class 894 * @return @c b_true if yes, @c b_false if no. 895 */ 635 /** Determine if argument @a arg has attribute of class @a aac. */ 896 636 bool_t stree_arg_has_attr(stree_proc_arg_t *arg, arg_attr_class_t aac) 897 637 { … … 912 652 913 653 /** Determine wheter @a a is derived (transitively) from @a b. 914 *915 * XXX This does not work right with generics.916 654 * 917 655 * @param a Derived CSI. … … 935 673 return b_false; 936 674 } 937 938 /** Search for CSI type argument of the given name.939 *940 * @param csi CSI to look in.941 * @param ident Identifier of the type argument.942 * @return Type argument definition or @c NULL if not found.943 */944 stree_targ_t *stree_csi_find_targ(stree_csi_t *csi, stree_ident_t *ident)945 {946 list_node_t *targ_n;947 stree_targ_t *targ;948 949 targ_n = list_first(&csi->targ);950 while (targ_n != NULL) {951 targ = list_node_data(targ_n, stree_targ_t *);952 if (targ->name->sid == ident->sid)953 return targ;954 955 targ_n = list_next(&csi->targ, targ_n);956 }957 958 /* No match */959 return NULL;960 }
Note:
See TracChangeset
for help on using the changeset viewer.