예제 #1
0
static int
p_shelf_create2(value vinit, type tinit, value vbag, type tbag)
{
    pword bag;
    pword *pheap, *pglobal;
    t_heap_array *obj;
    int i, err;

    Check_Ref(tbag);
    Check_Structure(tinit);
    pglobal = vinit.ptr;
    i = DidArity(pglobal->val.did);

    /* INSTANCE INITIALISATION */
    obj = (t_heap_array *) hg_alloc_size(
			    sizeof(t_heap_array) + i*sizeof(pword));
    obj->ref_ctr = 1;
    pheap = obj->array;
    pheap[0] = pglobal[0];
    for (; i > 0; --i)
    {
	pword *parg = &pglobal[i];
	Dereference_(parg);
	err = create_heapterm(&pheap[i], parg->val, parg->tag);
	Return_If_Not_Success(err);
    }
    bag = ec_handle(&heap_array_tid, (t_ext_ptr) obj);
    Return_Unify_Pw(vbag, tbag, bag.val, bag.tag);
}
예제 #2
0
static int
p_shelf_create3(value vkey, type tkey, value vinit, type tinit, value vbag, type tbag)
{
    dident key_did;
    pword *p, bag;
    t_heap_array *obj;
    int i;
    Check_Ref(tbag);
    Get_Functor_Did(vkey, tkey, key_did);
    i = DidArity(key_did);
    if (i < 1)
	{ Bip_Error(RANGE_ERROR); }

    /* INSTANCE INITIALISATION */
    obj = (t_heap_array *) hg_alloc_size(
			    sizeof(t_heap_array) + i*sizeof(pword));
    obj->ref_ctr = 1;
    p = obj->array;
    for (; i > 0; --i)
    {
	int err = create_heapterm(&p[i], vinit, tinit);
	Return_If_Not_Success(err);
    }
    p[0].val.did = key_did;
    p[0].tag.kernel = TDICT;

    bag = ec_handle(&heap_array_tid, (t_ext_ptr) obj);
    Return_Unify_Pw(vbag, tbag, bag.val, bag.tag);
}
예제 #3
0
static void
get_cursor_handlepw(cursor_t *cursor, pword * cursor_handle)
{
    session_t * session = cursor->session;

    *cursor_handle = ec_handle(&cursor_handle_tid, cursor);

}
예제 #4
0
int
p_session_init(
		/* - */ value v_session, type t_session
		)
{
	session_t * session;
	pword p_session;

	session_init( &session);

	if (session == NULL)
	{
	    Bip_Error(dbi_errno);
	}
	session->refs = 1;
	p_session = ec_handle(&session_handle_tid, session);

	Return_Unify_Pw(v_session, t_session, p_session.val, p_session.tag );
}