Example #1
0
seek_record_t * bst_seek(skey_t key, node_t* node_r){
  PARSE_TRY();
    volatile seek_record_t seek_record_l;
    node_t* node_s = ADDRESS(node_r->left);
    seek_record_l.ancestor = node_r;
    seek_record_l.successor = node_s; 
    seek_record_l.parent = node_s;
    seek_record_l.leaf = ADDRESS(node_s->left);

    node_t* parent_field = (node_t*) seek_record_l.parent->left;
    node_t* current_field = (node_t*) seek_record_l.leaf->left;
    node_t* current = ADDRESS(current_field);


    while (current != NULL) {
        if (!GETTAG(parent_field)) {
            seek_record_l.ancestor = seek_record_l.parent;
            seek_record_l.successor = seek_record_l.leaf;
        }
        seek_record_l.parent = seek_record_l.leaf;
        seek_record_l.leaf = current;

        parent_field = current_field;
        if (key < current->key) {
            current_field= (node_t*) current->left;
        } else {
            current_field= (node_t*) current->right;
        }
        current=ADDRESS(current_field);
    }
    seek_record->ancestor=seek_record_l.ancestor;
    seek_record->successor=seek_record_l.successor;
    seek_record->parent=seek_record_l.parent;
    seek_record->leaf=seek_record_l.leaf;
    return seek_record;
}
Example #2
0
bool isQuit(Obj expr) {
	return GETTAG(expr) == NAME &&
		cmpForm(GETNAME(expr), QUIT_COMMAND);
}
Example #3
0
File: Array.c Project: o-/p
    }
    Array result = new_Array_raw(c);
    while (0 < c)
    {
        c--;
        result->values[c] = element;
    }
    return result;
}

/* ========================================================================= */

NATIVE1(Array_instVarAt_)
    Optr w_index = NATIVE_ARG(0);
    long index = unwrap_int(w_index) - 1;
    Optr tag = GETTAG(self);
    ASSERT_TAG_LAYOUT(tag, Array);
    ASSERT_TAG_SIZE(tag, index);
    RETURN_FROM_NATIVE(((Array)self)->values[index]);
}

NATIVE2(Array_instVarAt_put_)
    Optr w_index = NATIVE_ARG(0);
    Optr w_arg = NATIVE_ARG(1);
    long index = unwrap_int(w_index) - 1;
    Optr tag = GETTAG(self);
    ASSERT_TAG_LAYOUT(tag, Array);
    ASSERT_TAG_SIZE(tag, index);
    ((Array) self)->values[index] = w_arg;
    RETURN_FROM_NATIVE(w_arg);
}
Example #4
0
bool isPrimitive(Obj obj) {
	return GETTAG(obj) == PRIM;
}
Example #5
0
bool isCompound(Obj obj) {
	return GETTAG(obj) == LIST;
}
Example #6
0
bool isNum(Obj expr) {
	return GETTAG(expr) == NUM;
}
Example #7
0
bool isVar(Obj expr) {
	return GETTAG(expr) == NAME;
}
Example #8
0
bool isError(Obj obj) { return GETTAG(obj) == ERROR; }
Example #9
0
bool isUnbound(Obj expr) { return GETTAG(expr) == DUMMY; }
Example #10
0
bool isCompound(Obj obj) {
    // isCompound_count++;
    return GETTAG(obj) == LIST;
}
Example #11
0
bool isCompiled(Obj obj) {
    // isCompiled_count++;
    return GETTAG(obj) == COMP;
}
Example #12
0
bool isVar(Obj expr) {
    form_check_count++;
    return GETTAG(expr) == NAME;
}
Example #13
0
bool isPrimitive(Obj obj) {
    // isPrimitive_count++;
    return GETTAG(obj) == PRIM;
}
Example #14
0
bool isBool(Obj expr) { return GETTAG(expr) == BOOL_; }
Example #15
0
bool isSugarDef(Obj expr) { return GETTAG(CADR(expr)) == LIST; }
Example #16
0
bool isNum(Obj expr) {
    form_check_count++;
    return GETTAG(expr) == NUM || isBool(expr);
}