Prolog
Date: 2018-01-12

org.jpl7.fli

## Class Prolog

- java.lang.Object
- - org.jpl7.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

  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `ATOM`
    `static int` | `BLOB`
    `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` | `DICT`
    `static int` | `fail`
    `static int` | `FLOAT`
    `static int` | `INTEGER`
    `static int` | `JBOOLEAN`
    `static int` | `JOBJECT`
    `static int` | `JREF`
    `static int` | `JVOID`
    `static int` | `LIST_NIL`
    `static int` | `LIST_PAIR`
    `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` | `SYNTAX_MODERN`
    `static int` | `SYNTAX_TRADITIONAL`
    `static int` | `VARIABLE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Prolog()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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 qid_t` | `current_query()`
    `static void` | `discard_foreign_frame(fid_t cid)`
    `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_big(term_t t, StringHolder s)`
    `static boolean` | `get_integer(term_t t, Int64Holder i)`
    `static boolean` | `get_jref_object(term_t t, ObjectHolder o)`
    `static boolean` | `get_name_arity(term_t t, StringHolder name, IntHolder arity)`
    `static boolean` | `get_string_chars(term_t t, StringHolder s)`
    `static int` | `get_syntax()`
    `static void` | `halt(int status)`
    `static boolean` | `initialise()`
    `static boolean` | `is_tag(java.lang.String tag)`
    `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 fid_t` | `open_foreign_frame()`
    `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_atom_chars(term_t t, java.lang.String name)`
    `static void` | `put_float(term_t t, double f)`
    `static void` | `put_integer_big(term_t t, java.lang.String i)`
    `static void` | `put_integer(term_t t, long i)`
    `static void` | `put_jref(term_t t, java.lang.Object ref)`
    `static void` | `put_nil(term_t t)`
    `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 java.lang.Object` | `tag_to_object(java.lang.String tag)`
    `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

    - #### LIST_NIL

          public static final int LIST_NIL

      See Also:
        Constant Field Values

    - #### LIST_PAIR

          public static final int LIST_PAIR

      See Also:
        Constant Field Values

    - #### BLOB

          public static final int BLOB

      See Also:
        Constant Field Values

    - #### DICT

          public static final int DICT

      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

    - #### JOBJECT

          public static final int JOBJECT

      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

    - #### SYNTAX_TRADITIONAL

          public static final int SYNTAX_TRADITIONAL

      See Also:
        Constant Field Values

    - #### SYNTAX_MODERN

          public static final int SYNTAX_MODERN

      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_integer_big

          public static boolean get_integer_big(term_t t,
                                                StringHolder s)

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

    - #### get_jref_object

          public static boolean get_jref_object(term_t t,
                                                ObjectHolder o)

    - #### object_to_tag

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

    - #### tag_to_object

          public static java.lang.Object tag_to_object(java.lang.String tag)

    - #### is_tag

          public static boolean is_tag(java.lang.String tag)

    - #### 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_integer_big

          public static void put_integer_big(term_t t,
                                             java.lang.String 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)

    - #### put_atom_chars

          public static void put_atom_chars(term_t t,
                                            java.lang.String name)

    - #### put_nil

          public static void put_nil(term_t t)

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

    - #### current_query

          public static qid_t current_query()

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

    - #### open_foreign_frame

          public static fid_t open_foreign_frame()

    - #### discard_foreign_frame

          public static void discard_foreign_frame(fid_t cid)

    - #### get_syntax

          public static int get_syntax()