Changeset 94d484a in mainline for uspace/app/sbi/src/stree.c


Ignore:
Timestamp:
2010-03-07T17:45:33Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
d0febca
Parents:
fa36f29
Message:

Update SBI to rev. 90.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/sbi/src/stree.c

    rfa36f29 r94d484a  
    149149}
    150150
     151stree_arg_attr_t *stree_arg_attr_new(arg_attr_class_t aac)
     152{
     153        stree_arg_attr_t *arg_attr;
     154
     155        arg_attr = calloc(1, sizeof(stree_arg_attr_t));
     156        if (arg_attr == NULL) {
     157                printf("Memory allocation failed.\n");
     158                exit(1);
     159        }
     160
     161        arg_attr->aac = aac;
     162        return arg_attr;
     163}
     164
    151165stree_stat_t *stree_stat_new(stat_class_t sc)
    152166{
     
    267281}
    268282
     283stree_except_t *stree_except_new(void)
     284{
     285        stree_except_t *except_c;
     286
     287        except_c = calloc(1, sizeof(stree_except_t));
     288        if (except_c == NULL) {
     289                printf("Memory allocation failed.\n");
     290                exit(1);
     291        }
     292
     293        return except_c;
     294}
     295
    269296stree_block_t *stree_block_new(void)
    270297{
     
    361388}
    362389
     390stree_index_t *stree_index_new(void)
     391{
     392        stree_index_t *index;
     393
     394        index = calloc(1, sizeof(stree_index_t));
     395        if (index == NULL) {
     396                printf("Memory allocation failed.\n");
     397                exit(1);
     398        }
     399
     400        return index;
     401}
     402
    363403stree_nameref_t *stree_nameref_new(void)
    364404{
     
    428468}
    429469
     470stree_taccess_t *stree_taccess_new(void)
     471{
     472        stree_taccess_t *taccess;
     473
     474        taccess = calloc(1, sizeof(stree_taccess_t));
     475        if (taccess == NULL) {
     476                printf("Memory allocation failed.\n");
     477                exit(1);
     478        }
     479
     480        return taccess;
     481}
     482
    430483stree_tapply_t *stree_tapply_new(void)
    431484{
     
    441494}
    442495
    443 stree_taccess_t *stree_taccess_new(void)
    444 {
    445         stree_taccess_t *taccess;
    446 
    447         taccess = calloc(1, sizeof(stree_taccess_t));
    448         if (taccess == NULL) {
    449                 printf("Memory allocation failed.\n");
    450                 exit(1);
    451         }
    452 
    453         return taccess;
     496stree_tindex_t *stree_tindex_new(void)
     497{
     498        stree_tindex_t *tindex;
     499
     500        tindex = calloc(1, sizeof(stree_tindex_t));
     501        if (tindex == NULL) {
     502                printf("Memory allocation failed.\n");
     503                exit(1);
     504        }
     505
     506        return tindex;
    454507}
    455508
     
    506559        return program;
    507560}
     561
     562/** Determine if argument @a arg has attribute of class @a aac. */
     563bool_t stree_arg_has_attr(stree_fun_arg_t *arg, arg_attr_class_t aac)
     564{
     565        list_node_t *node;
     566        stree_arg_attr_t *attr;
     567
     568        node = list_first(&arg->attr);
     569        while (node != NULL) {
     570                attr = list_node_data(node, stree_arg_attr_t *);
     571                if (attr->aac == aac)
     572                        return b_true;
     573
     574                node = list_next(&arg->attr, node);
     575        }
     576
     577        return b_false;
     578}
     579
     580/** Determine wheter @a a is derived (transitively) from @a b.
     581 *
     582 * @param a     Derived CSI.
     583 * @param b     Base CSI.
     584 * @return      @c b_true if @a a is equal to or directly or indirectly
     585 *              derived from @a b.
     586 */
     587bool_t stree_is_csi_derived_from_csi(stree_csi_t *a, stree_csi_t *b)
     588{
     589        stree_csi_t *csi;
     590
     591        csi = a;
     592        while (csi != NULL) {
     593                if (csi == b)
     594                        return b_true;
     595
     596                csi = csi->base_csi;
     597        }
     598
     599        /* We went all the way to the root and did not find b. */
     600        return b_false;
     601}
Note: See TracChangeset for help on using the changeset viewer.