jpl.fli

Class Prolog

public final class Prolog extends 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 intATOM
    static intBUF_DISCARDABLE
    static intBUF_MALLOC
    static intBUF_RING
    static intCOMPOUND
    static intCVT_ALL
    static intCVT_ATOM
    static intCVT_ATOMIC
    static intCVT_FLOAT
    static intCVT_INTEGER
    static intCVT_LIST
    static intCVT_NUMBER
    static intCVT_STRING
    static intCVT_VARIABLE
    static intfail
    static intFLOAT
    static intINTEGER
    static intJBOOLEAN
    static intJREF
    static intJVOID
    static intQ_CATCH_EXCEPTION
    static intQ_NODEBUG
    static intQ_NORMAL
    static intQ_PASS_EXCEPTION
    static intsucceed
    static intSTRING
    static intTERM
    static intVARIABLE
    Method Summary
    static intaction_abort()
    static Stringatom_chars(atom_t a)
    static intattach_engine(engine_t e)
    static engine_tattach_pool_engine()
    static voidclose_query(qid_t qid)
    static intcompare(term_t t1, term_t t2)
    static voidcons_functor_v(term_t h, functor_t fd, term_t a0)
    static term_tcopy_term_ref(term_t from)
    static engine_tcurrent_engine()
    static booleancurrent_engine_is_pool()
    static term_texception(qid_t qid)
    static String[]get_actual_init_args()
    static booleanget_arg(int index, term_t t, term_t a)
    static booleanget_atom_chars(term_t t, StringHolder a)
    static Stringget_c_lib_version()
    static String[]get_default_init_args()
    static booleanget_float(term_t t, DoubleHolder d)
    static booleanget_integer(term_t t, Int64Holder i)
    static booleanget_name_arity(term_t t, StringHolder name, IntHolder arity)
    static booleanget_string_chars(term_t t, StringHolder s)
    static voidhalt(int status)
    static booleaninitialise()
    static atom_tnew_atom(String s)
    static functor_tnew_functor(atom_t f, int a)
    static module_tnew_module(atom_t name)
    static term_tnew_term_ref()
    static term_tnew_term_refs(int n)
    static booleannext_solution(qid_t qid)
    static Stringobject_to_tag(Object obj)
    static qid_topen_query(module_t m, int flags, predicate_t pred, term_t t0)
    static predicate_tpredicate(String name, int arity, String module)
    static voidput_float(term_t t, double f)
    static voidput_integer(term_t t, long i)
    static voidput_jref(term_t t, Object ref)
    static voidput_term(term_t t1, term_t t2)
    static voidput_variable(term_t t)
    static intrelease_pool_engine()
    static booleanset_default_init_args(String[] argv)
    static intterm_type(term_t t)
    static intthread_self()
    static voidunregister_atom(atom_t a)

    Field Detail

    ATOM

    public static final int ATOM

    BUF_DISCARDABLE

    public static final int BUF_DISCARDABLE

    BUF_MALLOC

    public static final int BUF_MALLOC

    BUF_RING

    public static final int BUF_RING

    COMPOUND

    public static final int COMPOUND

    CVT_ALL

    public static final int CVT_ALL

    CVT_ATOM

    public static final int CVT_ATOM

    CVT_ATOMIC

    public static final int CVT_ATOMIC

    CVT_FLOAT

    public static final int CVT_FLOAT

    CVT_INTEGER

    public static final int CVT_INTEGER

    CVT_LIST

    public static final int CVT_LIST

    CVT_NUMBER

    public static final int CVT_NUMBER

    CVT_STRING

    public static final int CVT_STRING

    CVT_VARIABLE

    public static final int CVT_VARIABLE

    fail

    public static final int fail

    FLOAT

    public static final int FLOAT

    INTEGER

    public static final int INTEGER

    JBOOLEAN

    public static final int JBOOLEAN

    JREF

    public static final int JREF

    JVOID

    public static final int JVOID

    Q_CATCH_EXCEPTION

    public static final int Q_CATCH_EXCEPTION

    Q_NODEBUG

    public static final int Q_NODEBUG

    Q_NORMAL

    public static final int Q_NORMAL

    Q_PASS_EXCEPTION

    public static final int Q_PASS_EXCEPTION

    succeed

    public static final int succeed

    STRING

    public static final int STRING

    TERM

    public static final int TERM

    Deprecated: use Prolog.COMPOUND

    VARIABLE

    public static final int VARIABLE

    Method Detail

    action_abort

    public static int action_abort()

    atom_chars

    public static String atom_chars(atom_t a)

    attach_engine

    public static int attach_engine(engine_t e)

    attach_pool_engine

    public static engine_t attach_pool_engine()

    close_query

    public static void close_query(qid_t qid)

    compare

    public static int compare(term_t t1, term_t t2)

    cons_functor_v

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

    copy_term_ref

    public static term_t copy_term_ref(term_t from)

    current_engine

    public static engine_t current_engine()

    current_engine_is_pool

    public static boolean current_engine_is_pool()

    exception

    public static term_t exception(qid_t qid)

    get_actual_init_args

    public static String[] get_actual_init_args()

    get_arg

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

    get_atom_chars

    public static boolean get_atom_chars(term_t t, StringHolder a)

    get_c_lib_version

    public static String get_c_lib_version()

    get_default_init_args

    public static String[] get_default_init_args()

    get_float

    public static boolean get_float(term_t t, DoubleHolder d)

    get_integer

    public static boolean get_integer(term_t t, Int64Holder i)

    get_name_arity

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

    get_string_chars

    public static boolean get_string_chars(term_t t, StringHolder s)

    halt

    public static void halt(int status)

    initialise

    public static boolean initialise()

    new_atom

    public static atom_t new_atom(String s)

    new_functor

    public static functor_t new_functor(atom_t f, int a)

    new_module

    public static module_t new_module(atom_t name)

    new_term_ref

    public static term_t new_term_ref()

    new_term_refs

    public static term_t new_term_refs(int n)

    next_solution

    public static boolean next_solution(qid_t qid)

    object_to_tag

    public static String object_to_tag(Object obj)

    open_query

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

    predicate

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

    put_float

    public static void put_float(term_t t, double f)

    put_integer

    public static void put_integer(term_t t, long i)

    put_jref

    public static void put_jref(term_t t, Object ref)

    put_term

    public static void put_term(term_t t1, term_t t2)

    put_variable

    public static void put_variable(term_t t)

    release_pool_engine

    public static int release_pool_engine()

    set_default_init_args

    public static boolean set_default_init_args(String[] argv)

    term_type

    public static int term_type(term_t t)

    thread_self

    public static int thread_self()

    unregister_atom

    public static void unregister_atom(atom_t a)