lojix/wam_prolog/src/main/com/thesett/aima/logic/fol/wam/machine/WAMResolvingJavaMachine.java
private int setupCall_1()
    {
        // Get X0.
        int addr = deref(0);
        byte tag = derefTag;
        int val = derefVal;

        // Check it points to a structure.
        int fn;

        if (tag == STR)
        {
            fn = getHeap(val);
        }
        else if (tag == CON)
        {
            fn = val;
        }
        else
        {
            /*trace.fine("call/1 not invoked against structure.");*/

            return -1;
        }

        // Look up the call point of the matching functor.
        int f = fn & 0x00ffffff;

        WAMCallPoint callPoint = resolveCallPoint(f);

        if (callPoint.entryPoint == -1)
        {
            /*trace.fine("call/1 to unknown call point.");*/

            return -1;
        }

        int pn = callPoint.entryPoint;

        // Set registers X0... to ref to args...
        FunctorName functorName = getDeinternedFunctorName(f);
        int arity = functorName.getArity();

        for (int i = 0; i < arity; i++)
        {
            data.put(i, refTo(val + 1 + i));
        }

        return pn;
    }
private int setupCall_1()
    {
        // Get X0.
        int addr = deref(0);
        byte tag = derefTag;
        int val = derefVal;

        // Check it points to a structure.
        int fn;

        if (tag == STR)
        {
            fn = getHeap(val);
        }
        else if (tag == CON)
        {
            fn = val;
        }
        else
        {
            /*trace.fine("call/1 not invoked against structure.");*/

            return -1;
        }

        // Look up the call point of the matching functor.
        int f = fn & 0x00ffffff;

        WAMCallPoint callPoint = resolveCallPoint(f);

        if (callPoint.entryPoint == -1)
        {
            /*trace.fine("call/1 to unknown call point.");*/

            return -1;
        }

        int pn = callPoint.entryPoint;

        // Set registers X0... to ref to args...
        FunctorName functorName = getDeinternedFunctorName(f);
        int arity = functorName.getArity();

        for (int i = 0; i < arity; i++)
        {
            data.put(i, refTo(val + 1 + i));
        }

        return pn;
    }
private int setupCall_1 ( ) { // Get X0. int addr = deref ( 0 ) ; byte tag = derefTag ; int val = derefVal ; // Check it points to a structure. int fn ; if ( tag == STR ) { fn = getHeap ( val ) ; } else if ( tag == CON ) { fn = val ; } else { /*trace.fine("call/1 not invoked against structure.");*/ return - 1 ; } // Look up the call point of the matching functor. int f = fn & 0x00ffffff ; WAMCallPoint callPoint = resolveCallPoint ( f ) ; if ( callPoint . entryPoint == - 1 ) { /*trace.fine("call/1 to unknown call point.");*/ return - 1 ; } int pn = callPoint . entryPoint ; // Set registers X0... to ref to args... FunctorName functorName = getDeinternedFunctorName ( f ) ; int arity = functorName . getArity ( ) ; for ( int i = 0 ; i < arity ; i ++ ) { data . put ( i , refTo ( val + 1 + i ) ) ; } return pn ; }
Sets up the registers to make a call, for implementing call/1. The first register should reference a structure to
be turned into a predicate call. The arguments of this structure will be set up in the registers, and the entry
point of the predicate to call will be returned.

@return The entry address of the predicate to call, or <tt>-1</tt> if the call cannot be resolved to a known
predicate.
Sets up the registers to make a call for implementing call / 1 . The first register should reference a structure to be turned into a predicate call . The arguments of this structure will be set up in the registers and the entry point of the predicate to call will be returned .