atom.c
void atom_get_owners_r(atom_t* obj, atom_t* ownlist) {
    if (!(obj && atom_is_container(obj))) {
        printf("\x1b[95m" "Fatal error: get_owners: bad object!\n" "\x1b[0m");
        exit(EXIT_FAILURE);
    } else if (!(ownlist && ownlist->type == LIST)) {
        printf("\x1b[95m" "Fatal error: get_owners: bad list!\n" "\x1b[0m");
        exit(EXIT_FAILURE);
    }

    if (!obj->val.list->bindlist)
        return;
    list_t* bl = obj->val.list->bindlist->val.list;
    atom_t* item;

    for (int i = 0; i < bl->len; ++i) {
        item = bl->items[i];
        if (list_idx(ownlist, item) == -1) {
            list_add_h(ownlist, item);   // add item itself
            atom_get_owners_r(item, ownlist);  // add item owners
        }
    }
}
/*
--------------------------------------
atom_get_owners_r

    Create a list of all objects through which a given object can be reached.
--------------------------------------
*/
atom_get_owners_r
Create a list of all objects through which a given object can be reached.
atom_get_owners_r Create a list of all objects through which a given object can be reached .
void atom_get_owners_r(atom_t* obj, atom_t* ownlist) {
    if (!(obj && atom_is_container(obj))) {
        printf("\x1b[95m" "Fatal error: get_owners: bad object!\n" "\x1b[0m");
        exit(EXIT_FAILURE);
    } else if (!(ownlist && ownlist->type == LIST)) {
        printf("\x1b[95m" "Fatal error: get_owners: bad list!\n" "\x1b[0m");
        exit(EXIT_FAILURE);
    }
    if (!obj->val.list->bindlist)
        return;
    list_t* bl = obj->val.list->bindlist->val.list;
    atom_t* item;
    for (int i = 0; i < bl->len; ++i) {
        item = bl->items[i];
        if (list_idx(ownlist, item) == -1) {
            list_add_h(ownlist, item);   
            atom_get_owners_r(item, ownlist);  
        }
    }
}
void atom_get_owners_r ( atom_t * obj , atom_t * ownlist ) { if ( ! ( obj && atom_is_container ( obj ) ) ) { printf ( " \x1b " " \n " " \x1b " ) ; exit ( EXIT_FAILURE ) ; } else if ( ! ( ownlist && ownlist -> type == LIST ) ) { printf ( " \x1b " " \n " " \x1b " ) ; exit ( EXIT_FAILURE ) ; } if ( ! obj -> val . list -> bindlist ) return ; list_t * bl = obj -> val . list -> bindlist -> val . list ; atom_t * item ; for ( int i = 0 ; i < bl -> len ; ++ i ) { item = bl -> items [ i ] ; if ( list_idx ( ownlist , item ) == -1 ) { list_add_h ( ownlist , item ) ; atom_get_owners_r ( item , ownlist ) ; } } }
atom_get_owners_r
Create a list of all objects through which a given object can be reached.
atom_get_owners_r Create a list of all objects through which a given object can be reached .
// add item itself // add item owners