jpl.fli
Class Prolog

java.lang.Object
  extended by jpl.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.c for the native (ANSI C) 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.



    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 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 term_t copy_term_ref(term_t from)
               
    static boolean current_engine_is_pool()
               
    static engine_t current_engine()
               
    static term_t exception(qid_t qid)
               
    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 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_integer(term_t t, Int64Holder i)
               
    static boolean get_name_arity(term_t t, StringHolder name, IntHolder arity)
               
    static boolean get_string_chars(term_t t, StringHolder s)
               
    static void halt(int status)
               
    static boolean initialise()
               
    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 java.lang.String object_to_tag(java.lang.Object obj)
               
    static qid_t open_query(module_t m, int flags, predicate_t pred, term_t t0)
               
    static predicate_t predicate(java.lang.String name, int arity, java.lang.String module)
               
    static void put_float(term_t t, double f)
               
    static void put_integer(term_t t, long i)
               
    static void put_jref(term_t t, java.lang.Object ref)
               
    static void put_term(term_t t1, term_t t2)
               
    static void put_variable(term_t t)
               
    static int release_pool_engine()
               
    static boolean set_default_init_args(java.lang.String[] argv)
               
    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)

    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)

    unregister_atom

    public static void unregister_atom(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,
                                      Int64Holder i)

    get_float

    public static boolean get_float(term_t t,
                                    DoubleHolder d)

    get_name_arity

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

    get_arg

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

    object_to_tag

    public static java.lang.String object_to_tag(java.lang.Object obj)

    term_type

    public static int term_type(term_t t)

    put_variable

    public static void put_variable(term_t t)

    put_integer

    public static void put_integer(term_t t,
                                   long i)

    put_float

    public static void put_float(term_t t,
                                 double f)

    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)

    cons_functor_v

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

    predicate

    public static predicate_t predicate(java.lang.String name,
                                        int arity,
                                        java.lang.String 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)

    new_module

    public static module_t new_module(atom_t name)

    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()

    attach_engine

    public static int attach_engine(engine_t e)

    get_c_lib_version

    public static java.lang.String get_c_lib_version()

    action_abort

    public static int action_abort()