jpl.fli
Class Prolog

java.lang.Object
  extended byjpl.fli.Prolog

public final class Prolog
extends java.lang.Object

This class consists only of constants (static finals) and static native methods. The constants and methods defined herein are in (almost) strict 1-1 correspondence with the functions in the Prolog FLI by the same name (except without the PL_, SQ_, etc. prefixes).

See the file jpl_fli_Prolog.c for the native implementations of these methods. Refer to your local Prolog FLI documentations for the meanings of these methods, and observe the following:

  • The types and signatures of the following methods are almost in 1-1 correspondence with the Prolog FLI. The Prolog types term_t, atom_t, functor_t, etc. are mirrored in this package with classes by the same name, making the C and Java uses of these interfaces similar.
  • As term_t, functor_t, etc. types are Java classes, they are passed to these methods by value; however, calling these methods on such class instances does have side effects. In general, the value fields of these instances will be modified, in much the same way the term_t, functor_t, etc. Prolog instances would be modified.
  • The exceptions to this rule occur when maintaining the same signature would be impossible, e.g., when the Prolog FLI functions require pointers; in this case, the signatures have been modified to take *Holder classes (Int, Double, String, etc.), to indicate a call by reference parameter.
  • Functions which take variable-length argument lists in C take arrays in Java; from Java 1.1 onwards, anonymous arrays can be used e.g. Term[] { new Atom("a"), new Atom ("b") }

  • Copyright (C) 1998 Fred Dushin

    This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

    This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library Public License for more details.


    Version:
    $Revision: 1.2 $

    Field Summary
    static int ATOM
               
    static int BUF_DISCARDABLE
               
    static int BUF_MALLOC
               
    static int BUF_RING
               
    static int COMPOUND
               
    static int CVT_ALL
               
    static int CVT_ATOM
               
    static int CVT_ATOMIC
               
    static int CVT_FLOAT
               
    static int CVT_INTEGER
               
    static int CVT_LIST
               
    static int CVT_NUMBER
               
    static int CVT_STRING
               
    static int CVT_VARIABLE
               
    static int fail
               
    static int FLOAT
               
    static int INTEGER
               
    static int JBOOLEAN
               
    static int JREF
               
    static int JVOID
               
    static int Q_CATCH_EXCEPTION
               
    static int Q_NODEBUG
               
    static int Q_NORMAL
               
    static int Q_PASS_EXCEPTION
               
    static int STRING
               
    static int succeed
               
    static int TERM
              Deprecated. use Prolog.COMPOUND
    static int VARIABLE
               
     
    Constructor Summary
    Prolog()
               
     
    Method Summary
    static int action_abort()
               
    static java.lang.String atom_chars(atom_t a)
               
    static int attach_engine(engine_t e)
               
    static engine_t attach_pool_engine()
               
    static boolean call_predicate(module_t m, int debug, predicate_t pred, term_t t0)
               
    static boolean call(term_t t, module_t m)
               
    static void close_foreign_frame(fid_t cid)
               
    static void close_query(qid_t qid)
               
    static int compare(term_t t1, term_t t2)
               
    static void cons_functor_v(term_t h, functor_t fd, term_t a0)
               
    static void cons_list(term_t l, term_t h, term_t t)
               
    static module_t context()
               
    static term_t copy_term_ref(term_t from)
               
    static boolean current_engine_is_pool()
               
    static engine_t current_engine()
               
    static void cut_query(qid_t qid)
               
    static void discard_foreign_frame(fid_t cid)
               
    static term_t exception(qid_t qid)
               
    static int functor_arity(functor_t f)
               
    static atom_t functor_name(functor_t f)
               
    static java.lang.String[] get_actual_init_args()
               
    static boolean get_arg(int index, term_t t, term_t a)
               
    static boolean get_atom_chars(term_t t, StringHolder a)
               
    static boolean get_atom(term_t t, atom_t a)
               
    static java.lang.String get_c_lib_version()
               
    static java.lang.String[] get_default_init_args()
               
    static boolean get_float(term_t t, DoubleHolder d)
               
    static boolean get_functor(term_t t, functor_t f)
               
    static boolean get_integer(term_t t, IntHolder i)
               
    static boolean get_jboolean(term_t t, BooleanHolder b)
               
    static boolean get_jref(term_t t, ObjectHolder obj)
               
    static boolean get_module(term_t t, module_t module)
               
    static boolean get_name_arity(term_t t, StringHolder name, IntHolder arity)
               
    static boolean get_pointer(term_t t, PointerHolder ptr)
               
    static boolean get_string_chars(term_t t, StringHolder s)
               
    static void halt(int status)
               
    static boolean initialise()
               
    static boolean is_atom(term_t t)
               
    static boolean is_atomic(term_t t)
               
    static boolean is_compound(term_t t)
               
    static boolean is_float(term_t t)
               
    static boolean is_functor(term_t t, functor_t f)
               
    static boolean is_integer(term_t t)
               
    static boolean is_number(term_t t)
               
    static boolean is_variable(term_t t)
               
    static atom_t module_name(module_t module)
               
    static atom_t new_atom(java.lang.String s)
               
    static functor_t new_functor(atom_t f, int a)
               
    static module_t new_module(atom_t name)
               
    static term_t new_term_ref()
               
    static term_t new_term_refs(int n)
               
    static boolean next_solution(qid_t qid)
               
    static fid_t open_foreign_frame()
               
    static qid_t open_query(module_t m, int flags, predicate_t pred, term_t t0)
               
    static int pool_engine_id(engine_t e)
               
    static predicate_t pred(functor_t f, module_t m)
               
    static int predicate_info(predicate_t pred, atom_t name, IntHolder arity, module_t module)
               
    static predicate_t predicate(java.lang.String name, int arity, java.lang.String module)
               
    static void put_atom(term_t t, atom_t a)
               
    static void put_float(term_t t, double f)
               
    static void put_functor(term_t t, functor_t functor)
               
    static void put_integer(term_t t, long i)
               
    static void put_jboolean(term_t t, boolean b)
               
    static void put_jref(term_t t, java.lang.Object ref)
               
    static void put_jvoid(term_t t)
               
    static void put_pointer(term_t t, PointerHolder ptr)
               
    static void put_term(term_t t1, term_t t2)
               
    static void put_variable(term_t t)
               
    static int release_pool_engine()
               
    static void reset_term_refs(term_t r)
               
    static boolean set_default_init_args(java.lang.String[] argv)
               
    static int strip_module(term_t in, module_t m, term_t out)
               
    static int term_type(term_t t)
               
    static int thread_self()
               
    static void unregister_atom(atom_t a)
               
     
    Methods inherited from class java.lang.Object
    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
     

    Field Detail

    VARIABLE

    public static final int VARIABLE
    See Also:
    Constant Field Values

    ATOM

    public static final int ATOM
    See Also:
    Constant Field Values

    INTEGER

    public static final int INTEGER
    See Also:
    Constant Field Values

    FLOAT

    public static final int FLOAT
    See Also:
    Constant Field Values

    STRING

    public static final int STRING
    See Also:
    Constant Field Values

    COMPOUND

    public static final int COMPOUND
    See Also:
    Constant Field Values

    JBOOLEAN

    public static final int JBOOLEAN
    See Also:
    Constant Field Values

    JREF

    public static final int JREF
    See Also:
    Constant Field Values

    JVOID

    public static final int JVOID
    See Also:
    Constant Field Values

    TERM

    public static final int TERM
    Deprecated. use Prolog.COMPOUND

    See Also:
    Constant Field Values

    succeed

    public static final int succeed
    See Also:
    Constant Field Values

    fail

    public static final int fail
    See Also:
    Constant Field Values

    Q_NORMAL

    public static final int Q_NORMAL
    See Also:
    Constant Field Values

    Q_NODEBUG

    public static final int Q_NODEBUG
    See Also:
    Constant Field Values

    Q_CATCH_EXCEPTION

    public static final int Q_CATCH_EXCEPTION
    See Also:
    Constant Field Values

    Q_PASS_EXCEPTION

    public static final int Q_PASS_EXCEPTION
    See Also:
    Constant Field Values

    CVT_ATOM

    public static final int CVT_ATOM
    See Also:
    Constant Field Values

    CVT_STRING

    public static final int CVT_STRING
    See Also:
    Constant Field Values

    CVT_LIST

    public static final int CVT_LIST
    See Also:
    Constant Field Values

    CVT_INTEGER

    public static final int CVT_INTEGER
    See Also:
    Constant Field Values

    CVT_FLOAT

    public static final int CVT_FLOAT
    See Also:
    Constant Field Values

    CVT_VARIABLE

    public static final int CVT_VARIABLE
    See Also:
    Constant Field Values

    CVT_NUMBER

    public static final int CVT_NUMBER
    See Also:
    Constant Field Values

    CVT_ATOMIC

    public static final int CVT_ATOMIC
    See Also:
    Constant Field Values

    CVT_ALL

    public static final int CVT_ALL
    See Also:
    Constant Field Values

    BUF_DISCARDABLE

    public static final int BUF_DISCARDABLE
    See Also:
    Constant Field Values

    BUF_RING

    public static final int BUF_RING
    See Also:
    Constant Field Values

    BUF_MALLOC

    public static final int BUF_MALLOC
    See Also:
    Constant Field Values
    Constructor Detail

    Prolog

    public Prolog()
    Method Detail

    compare

    public static int compare(term_t t1,
                              term_t t2)

    new_term_ref

    public static term_t new_term_ref()

    new_term_refs

    public static term_t new_term_refs(int n)

    copy_term_ref

    public static term_t copy_term_ref(term_t from)

    reset_term_refs

    public static void reset_term_refs(term_t r)

    new_atom

    public static atom_t new_atom(java.lang.String s)

    atom_chars

    public static java.lang.String atom_chars(atom_t a)

    new_functor

    public static functor_t new_functor(atom_t f,
                                        int a)

    functor_name

    public static atom_t functor_name(functor_t f)

    functor_arity

    public static int functor_arity(functor_t f)

    unregister_atom

    public static void unregister_atom(atom_t a)

    get_atom

    public static boolean get_atom(term_t t,
                                   atom_t a)

    get_atom_chars

    public static boolean get_atom_chars(term_t t,
                                         StringHolder a)

    get_string_chars

    public static boolean get_string_chars(term_t t,
                                           StringHolder s)

    get_integer

    public static boolean get_integer(term_t t,
                                      IntHolder i)

    get_pointer

    public static boolean get_pointer(term_t t,
                                      PointerHolder ptr)

    get_float

    public static boolean get_float(term_t t,
                                    DoubleHolder d)

    get_functor

    public static boolean get_functor(term_t t,
                                      functor_t f)

    get_name_arity

    public static boolean get_name_arity(term_t t,
                                         StringHolder name,
                                         IntHolder arity)

    get_module

    public static boolean get_module(term_t t,
                                     module_t module)

    get_arg

    public static boolean get_arg(int index,
                                  term_t t,
                                  term_t a)

    get_jref

    public static boolean get_jref(term_t t,
                                   ObjectHolder obj)

    get_jboolean

    public static boolean get_jboolean(term_t t,
                                       BooleanHolder b)

    term_type

    public static int term_type(term_t t)

    is_variable

    public static boolean is_variable(term_t t)

    is_atom

    public static boolean is_atom(term_t t)

    is_integer

    public static boolean is_integer(term_t t)

    is_float

    public static boolean is_float(term_t t)

    is_compound

    public static boolean is_compound(term_t t)

    is_functor

    public static boolean is_functor(term_t t,
                                     functor_t f)

    is_atomic

    public static boolean is_atomic(term_t t)

    is_number

    public static boolean is_number(term_t t)

    put_variable

    public static void put_variable(term_t t)

    put_atom

    public static void put_atom(term_t t,
                                atom_t a)

    put_integer

    public static void put_integer(term_t t,
                                   long i)

    put_pointer

    public static void put_pointer(term_t t,
                                   PointerHolder ptr)

    put_float

    public static void put_float(term_t t,
                                 double f)

    put_functor

    public static void put_functor(term_t t,
                                   functor_t functor)

    put_term

    public static void put_term(term_t t1,
                                term_t t2)

    put_jref

    public static void put_jref(term_t t,
                                java.lang.Object ref)

    put_jboolean

    public static void put_jboolean(term_t t,
                                    boolean b)

    put_jvoid

    public static void put_jvoid(term_t t)

    cons_functor_v

    public static void cons_functor_v(term_t h,
                                      functor_t fd,
                                      term_t a0)

    cons_list

    public static void cons_list(term_t l,
                                 term_t h,
                                 term_t t)

    pred

    public static predicate_t pred(functor_t f,
                                   module_t m)

    predicate

    public static predicate_t predicate(java.lang.String name,
                                        int arity,
                                        java.lang.String module)

    predicate_info

    public static int predicate_info(predicate_t pred,
                                     atom_t name,
                                     IntHolder arity,
                                     module_t module)

    open_query

    public static qid_t open_query(module_t m,
                                   int flags,
                                   predicate_t pred,
                                   term_t t0)

    next_solution

    public static boolean next_solution(qid_t qid)

    close_query

    public static void close_query(qid_t qid)

    cut_query

    public static void cut_query(qid_t qid)

    call

    public static boolean call(term_t t,
                               module_t m)

    call_predicate

    public static boolean call_predicate(module_t m,
                                         int debug,
                                         predicate_t pred,
                                         term_t t0)

    open_foreign_frame

    public static fid_t open_foreign_frame()

    close_foreign_frame

    public static void close_foreign_frame(fid_t cid)

    discard_foreign_frame

    public static void discard_foreign_frame(fid_t cid)

    context

    public static module_t context()

    module_name

    public static atom_t module_name(module_t module)

    new_module

    public static module_t new_module(atom_t name)

    strip_module

    public static int strip_module(term_t in,
                                   module_t m,
                                   term_t out)

    exception

    public static term_t exception(qid_t qid)

    get_default_init_args

    public static java.lang.String[] get_default_init_args()

    set_default_init_args

    public static boolean set_default_init_args(java.lang.String[] argv)

    initialise

    public static boolean initialise()

    get_actual_init_args

    public static java.lang.String[] get_actual_init_args()

    halt

    public static void halt(int status)

    thread_self

    public static int thread_self()

    attach_pool_engine

    public static engine_t attach_pool_engine()

    release_pool_engine

    public static int release_pool_engine()

    current_engine

    public static engine_t current_engine()

    current_engine_is_pool

    public static boolean current_engine_is_pool()

    get_c_lib_version

    public static java.lang.String get_c_lib_version()

    action_abort

    public static int action_abort()

    attach_engine

    public static int attach_engine(engine_t e)

    pool_engine_id

    public static int pool_engine_id(engine_t e)