Changes in uspace/app/sbi/src/stree.c [23de644:38aaacc2] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/sbi/src/stree.c
r23de644 r38aaacc2 37 37 #include "stree.h" 38 38 39 /** Allocate new module. 40 * 41 * @return New module 42 */ 39 43 stree_module_t *stree_module_new(void) 40 44 { … … 51 55 } 52 56 57 /** Allocate new module member. 58 * 59 * @param mc Module member class 60 * @return New module member 61 */ 53 62 stree_modm_t *stree_modm_new(modm_class_t mc) 54 63 { … … 65 74 } 66 75 76 /** Allocate new CSI. 77 * 78 * @param cc CSI class 79 * @return New CSI 80 */ 67 81 stree_csi_t *stree_csi_new(csi_class_t cc) 68 82 { … … 83 97 } 84 98 99 /** Allocate new CSI member. 100 * 101 * @param cc CSI member class 102 * @return New CSI member 103 */ 85 104 stree_csimbr_t *stree_csimbr_new(csimbr_class_t cc) 86 105 { … … 97 116 } 98 117 118 /** Allocate new member delegate. 119 * 120 * @return New member delegate 121 */ 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 function 138 */ 99 139 stree_fun_t *stree_fun_new(void) 100 140 { … … 110 150 } 111 151 152 /** Allocate new member variable. 153 * 154 * @return New member variable 155 */ 112 156 stree_var_t *stree_var_new(void) 113 157 { … … 123 167 } 124 168 169 /** Allocate new property. 170 * 171 * @return New property 172 */ 125 173 stree_prop_t *stree_prop_new(void) 126 174 { … … 136 184 } 137 185 186 /** Allocate new type argument. 187 * 188 * @return New type argument 189 */ 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 class 206 * @return New symbol attribute 207 */ 138 208 stree_symbol_attr_t *stree_symbol_attr_new(symbol_attr_class_t sac) 139 209 { … … 150 220 } 151 221 222 /** Allocate new procedure. 223 * 224 * @return New procedure 225 */ 152 226 stree_proc_t *stree_proc_new(void) 153 227 { … … 163 237 } 164 238 239 /** Allocate new procedure argument. 240 * 241 * @return New procedure argument 242 */ 165 243 stree_proc_arg_t *stree_proc_arg_new(void) 166 244 { … … 176 254 } 177 255 256 /** Allocate new function signature. 257 * 258 * @return New procedure argument 259 */ 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 class 276 * @return New procedure argument attribute 277 */ 178 278 stree_arg_attr_t *stree_arg_attr_new(arg_attr_class_t aac) 179 279 { … … 190 290 } 191 291 292 /** Allocate new statement. 293 * 294 * @param sc Statement class 295 * @return New statement 296 */ 192 297 stree_stat_t *stree_stat_new(stat_class_t sc) 193 298 { … … 204 309 } 205 310 311 /** Allocate new local variable declaration. 312 * 313 * @return New local variable declaration 314 */ 206 315 stree_vdecl_t *stree_vdecl_new(void) 207 316 { … … 217 326 } 218 327 328 /** Allocate new @c if statement. 329 * 330 * @return New @c if statement 331 */ 219 332 stree_if_t *stree_if_new(void) 220 333 { … … 230 343 } 231 344 345 /** Allocate new @c while statement. 346 * 347 * @return New @c while statement 348 */ 232 349 stree_while_t *stree_while_new(void) 233 350 { … … 243 360 } 244 361 362 /** Allocate new @c for statement. 363 * 364 * @return New @c for statement 365 */ 245 366 stree_for_t *stree_for_new(void) 246 367 { … … 256 377 } 257 378 379 /** Allocate new @c raise statement. 380 * 381 * @return New @c raise statement 382 */ 258 383 stree_raise_t *stree_raise_new(void) 259 384 { … … 269 394 } 270 395 396 /** Allocate new @c return statement. 397 * 398 * @return New @c return statement 399 */ 271 400 stree_return_t *stree_return_new(void) 272 401 { … … 282 411 } 283 412 413 /** Allocate new with-except-finally statement. 414 * 415 * @return New with-except-finally statement. 416 */ 284 417 stree_wef_t *stree_wef_new(void) 285 418 { … … 295 428 } 296 429 430 /** Allocate new expression statement. 431 * 432 * @return New expression statement 433 */ 297 434 stree_exps_t *stree_exps_new(void) 298 435 { … … 308 445 } 309 446 447 /** Allocate new @c except clause. 448 * 449 * @return New @c except clause 450 */ 310 451 stree_except_t *stree_except_new(void) 311 452 { … … 321 462 } 322 463 464 /** Allocate new statement block. 465 * 466 * @return New statement block 467 */ 323 468 stree_block_t *stree_block_new(void) 324 469 { … … 334 479 } 335 480 481 /** Allocate new expression. 482 * 483 * @param ec Expression class 484 * @return New expression 485 */ 336 486 stree_expr_t *stree_expr_new(expr_class_t ec) 337 487 { … … 348 498 } 349 499 500 /** Allocate new assignment. 501 * 502 * @param ac Assignment class 503 * @return New assignment 504 */ 350 505 stree_assign_t *stree_assign_new(assign_class_t ac) 351 506 { … … 362 517 } 363 518 519 /** Allocate new binary operation. 520 * 521 * @return New binary operation 522 */ 364 523 stree_binop_t *stree_binop_new(binop_class_t bc) 365 524 { … … 376 535 } 377 536 537 /** Allocate new unary operation. 538 * 539 * @param uc Unary operation class 540 * @return New unary operation 541 */ 378 542 stree_unop_t *stree_unop_new(unop_class_t uc) 379 543 { … … 390 554 } 391 555 556 /** Allocate new @c new operation. 557 * 558 * @return New @c new operation 559 */ 392 560 stree_new_t *stree_new_new(void) 393 561 { … … 403 571 } 404 572 573 /** Allocate new . 574 * 575 * @return New 576 */ 405 577 stree_access_t *stree_access_new(void) 406 578 { … … 416 588 } 417 589 590 /** Allocate new function call operation. 591 * 592 * @return New function call operation 593 */ 418 594 stree_call_t *stree_call_new(void) 419 595 { … … 429 605 } 430 606 607 /** Allocate new indexing operation. 608 * 609 * @return New indexing operation 610 */ 431 611 stree_index_t *stree_index_new(void) 432 612 { … … 442 622 } 443 623 624 /** Allocate new as conversion. 625 * 626 * @return New as conversion 627 */ 444 628 stree_as_t *stree_as_new(void) 445 629 { … … 455 639 } 456 640 641 /** Allocate new boxing operation. 642 * 643 * @return New boxing operation 644 */ 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 operation 661 */ 457 662 stree_nameref_t *stree_nameref_new(void) 458 663 { … … 468 673 } 469 674 675 /** Allocate new identifier. 676 * 677 * @return New identifier 678 */ 470 679 stree_ident_t *stree_ident_new(void) 471 680 { … … 481 690 } 482 691 692 /** Allocate new literal. 693 * 694 * @param ltc Literal class 695 * @return New literal 696 */ 483 697 stree_literal_t *stree_literal_new(literal_class_t ltc) 484 698 { … … 495 709 } 496 710 711 /** Allocate new @c self reference. 712 * 713 * @return New @c self reference 714 */ 497 715 stree_self_ref_t *stree_self_ref_new(void) 498 716 { … … 508 726 } 509 727 728 /** Allocate new type expression 729 * 730 * @return New type expression 731 */ 510 732 stree_texpr_t *stree_texpr_new(texpr_class_t tc) 511 733 { … … 522 744 } 523 745 746 /** Allocate new type access operation. 747 * 748 * @return New type access operation 749 */ 524 750 stree_taccess_t *stree_taccess_new(void) 525 751 { … … 535 761 } 536 762 763 /** Allocate new type application operation. 764 * 765 * @return New type application operation 766 */ 537 767 stree_tapply_t *stree_tapply_new(void) 538 768 { … … 548 778 } 549 779 780 /** Allocate new type indexing operation. 781 * 782 * @return New type indexing operation 783 */ 550 784 stree_tindex_t *stree_tindex_new(void) 551 785 { … … 561 795 } 562 796 797 /** Allocate new type literal. 798 * 799 * @return New type literal 800 */ 563 801 stree_tliteral_t *stree_tliteral_new(tliteral_class_t tlc) 564 802 { … … 575 813 } 576 814 815 /** Allocate new type name reference. 816 * 817 * @return New type name reference 818 */ 577 819 stree_tnameref_t *stree_tnameref_new(void) 578 820 { … … 588 830 } 589 831 832 /** Allocate new symbol. 833 * 834 * @return New symbol 835 */ 590 836 stree_symbol_t *stree_symbol_new(symbol_class_t sc) 591 837 { … … 602 848 } 603 849 850 /** Allocate new program. 851 * 852 * @return New program 853 */ 604 854 stree_program_t *stree_program_new(void) 605 855 { … … 615 865 } 616 866 617 /** Determine if @a symbol has attribute of class @a sac. */ 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 */ 618 873 bool_t stree_symbol_has_attr(stree_symbol_t *symbol, symbol_attr_class_t sac) 619 874 { … … 633 888 } 634 889 635 /** Determine if argument @a arg has attribute of class @a aac. */ 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 */ 636 896 bool_t stree_arg_has_attr(stree_proc_arg_t *arg, arg_attr_class_t aac) 637 897 { … … 653 913 /** Determine wheter @a a is derived (transitively) from @a b. 654 914 * 915 * XXX This does not work right with generics. 916 * 655 917 * @param a Derived CSI. 656 918 * @param b Base CSI. … … 673 935 return b_false; 674 936 } 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.