org.jpl7

## Class JPL

- java.lang.Object
- - org.jpl7.JPL

-     public class JPL
      extends java.lang.Object

  The jpl.JPL class contains static methods which allow (i) inspection and alteration of the "default" initialisation arguments (ii) explicit initialisation (iii) discovery of whether the Prolog engine is already initialised, and if so, with what arguments. The Prolog engine must be initialized before any queries are made, but this will happen automatically (upon the first call to a Prolog FLI routine) if it has not already been done explicitly.

  Copyright (C) 2004 Paul Singleton

  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
    --- | ---
    `protected static boolean` | `DEBUG`
    `static Term` | `JFALSE`
    `static Term` | `JNULL`
    `static Term` | `JTRUE`
    `static Term` | `JVOID`
    `static Atom` | `LIST_NIL`
    `protected static Atom` | `LIST_NIL_MODERN`
    `protected static Atom` | `LIST_NIL_TRADITIONAL`
    `static java.lang.String` | `LIST_PAIR`
    `protected static java.lang.String` | `LIST_PAIR_MODERN`
    `protected static java.lang.String` | `LIST_PAIR_TRADITIONAL`
    `static boolean` | `LIST_TOSTRING_TEXTUAL`
    `protected static boolean` | `modeDontTellMe`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `JPL()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String[]` | `getActualInitArgs()` Returns, in an array of String, the sequence of command-line arguments that were actually used when the Prolog engine was formerly initialised.
    `static java.lang.String[]` | `getDefaultInitArgs()` Returns, in an array of String, the sequence of command-line arguments that would be used if the Prolog engine were to be initialised now.
    `static java.lang.String` | `getSyntax()`
    `static void` | `halt()` Deprecated.
    `static boolean` | `init()` Initialises the Prolog engine using the current default initialisation parameters, and returns 'true' (or 'false' if already initialised).
    `static boolean` | `init(java.lang.String[] args)` Initializes the Prolog engine, using the String argument parameters passed.
    `protected static boolean` | `isSimpleName(java.lang.String s)` Checks if a string is a simple atom, with no quoting needed
    `static java.lang.String` | `jarPath()`
    `static void` | `loadNativeLibrary()`
    `static void` | `main(java.lang.String[] args)`
    `static Term` | `newJRef(java.lang.Object object)`
    `protected static java.lang.String` | `quotedName(java.lang.String name)` Returns a quoted (iff necessary) form of the Atom's name, as understood by Prolog read/1
    `static void` | `setDefaultInitArgs(java.lang.String[] args)` Specifies, in an array of String, the sequence of command-line arguments that should be used if the Prolog engine is subsequently initialised.
    `static void` | `setDTMMode(boolean dtm)` Sets the global "dont-tell-me" mode (default value: true).
    `static java.lang.String` | `setNativeLibraryDir(java.lang.String newDir)`
    `static java.lang.String` | `setNativeLibraryName(java.lang.String newName)`
    `static java.lang.String` | `setNativeLibraryPath(java.lang.String newPath)`
    `static void` | `setTraditional()`
    `static void` | `setTraditionalAnyway()`
    `static java.lang.String` | `version_string()` Returns a String (eg "3.0.0-alpha") identifying this version of JPL.
    `static org.jpl7.Version` | `version()` Returns (as a Version) an identification of this version of JPL.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEBUG

          protected static final boolean DEBUG

      See Also:
        Constant Field Values

    - #### JFALSE

          public static final Term JFALSE

    - #### JTRUE

          public static final Term JTRUE

    - #### JNULL

          public static final Term JNULL

    - #### JVOID

          public static final Term JVOID

    - #### modeDontTellMe

          protected static boolean modeDontTellMe

    - #### LIST_NIL_MODERN

          protected static final Atom LIST_NIL_MODERN

    - #### LIST_NIL_TRADITIONAL

          protected static final Atom LIST_NIL_TRADITIONAL

    - #### LIST_NIL

          public static Atom LIST_NIL

    - #### LIST_PAIR_MODERN

          protected static final java.lang.String LIST_PAIR_MODERN

      See Also:
        Constant Field Values

    - #### LIST_PAIR_TRADITIONAL

          protected static final java.lang.String LIST_PAIR_TRADITIONAL

      See Also:
        Constant Field Values

    - #### LIST_PAIR

          public static java.lang.String LIST_PAIR

    - #### LIST_TOSTRING_TEXTUAL

          public static boolean LIST_TOSTRING_TEXTUAL

  - ### Constructor Detail

    - #### JPL

          public JPL()

  - ### Method Detail

    - #### setNativeLibraryName

          public static java.lang.String setNativeLibraryName(java.lang.String newName)

    - #### setNativeLibraryDir

          public static java.lang.String setNativeLibraryDir(java.lang.String newDir)

    - #### setNativeLibraryPath

          public static java.lang.String setNativeLibraryPath(java.lang.String newPath)

    - #### loadNativeLibrary

          public static void loadNativeLibrary()

    - #### jarPath

          public static java.lang.String jarPath()

    - #### setDTMMode

          public static void setDTMMode(boolean dtm)

      Sets the global "dont-tell-me" mode (default value: true). When 'true', bindings will *not* be returned for any variable (in a Query's goal) whose name begins with an underscore character (except for "anonymous" variables, i.e. those whose name comprises just the underscore character, whose bindings are never returned). When 'false', bindings are returned for *all* variables except anonymous ones; this mode may be useful when traditional top-level interpreter behaviour is wanted, e.g. in a Java-based Prolog IDE or debugger.

      This method should be regarded as experimental, and may subsequently be deprecated in favour of some more general mechanism for setting options, perhaps per-Query and per-call as well as globally.

      Parameters:
        `dtm` - new "dont-tell-me" mode value

    - #### setTraditional

          public static void setTraditional()

    - #### setTraditionalAnyway

          public static void setTraditionalAnyway()

    - #### getSyntax

          public static java.lang.String getSyntax()

    - #### getDefaultInitArgs

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

      Returns, in an array of String, the sequence of command-line arguments that would be used if the Prolog engine were to be initialised now. Returns null if the Prolog VM has already been initialised (in which case the default init args are irrelevant and the actual init args are of interest)

      Returns:
        current default initialisation arguments, or null if already initialised
      See Also:
        `getActualInitArgs()`

    - #### setDefaultInitArgs

          public static void setDefaultInitArgs(java.lang.String[] args)

      Specifies, in an array of String, the sequence of command-line arguments that should be used if the Prolog engine is subsequently initialised.

      Parameters:
        `args` - new default initialization arguments

    - #### getActualInitArgs

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

      Returns, in an array of String, the sequence of command-line arguments that were actually used when the Prolog engine was formerly initialised. This method returns null if the Prolog engine has not yet been initialised, and thus may be used to test this condition.
      Returns:
        actual initialization arguments

    - #### init

          public static boolean init(java.lang.String[] args)

      Initializes the Prolog engine, using the String argument parameters passed. This method need be called only if you want to both (i) initialise the Prolog engine with parameters other than the default ones and (ii) force initialisation to occur (rather than allow it to occur automatically at the first query). For parameter options, consult your local Prolog documentation. The parameter values are passed directly to initialization routines for the Prolog environment.

      This method must be called before making any queries.

      Parameters:
        `args` - Initialization parameter list
      Returns:
        true iff initialization was new; false if already initialized

    - #### init

          public static boolean init()

      Initialises the Prolog engine using the current default initialisation parameters, and returns 'true' (or 'false' if already initialised).
      Returns:
        true if initialization was new, false if already initialized

    - #### isSimpleName

          protected static boolean isSimpleName(java.lang.String s)

      Checks if a string is a simple atom, with no quoting needed
      Parameters:
        `s` - string to check if it is simple name (no quoting needed)
      Returns:
        whether s is a simple name, i.e. which needs no quoting in source text

    - #### newJRef

          public static Term newJRef(java.lang.Object object)

      Parameters:
        `object` - the object of interest to get the JREF
      Returns:
        a new Term instance which canonically represents the given object reference (concrete or null)

    - #### quotedName

          protected static java.lang.String quotedName(java.lang.String name)

      Returns a quoted (iff necessary) form of the Atom's name, as understood by Prolog read/1
      Parameters:
        `name` - the name to quote if needed
      Returns:
        a quoted form of the Atom's name, as understood by Prolog read/1

    - #### halt

          @Deprecated
          public static void halt()

      Deprecated.
      Terminates the Prolog session.

      Note. This method calls the FLI halt() method with a status of 0, but the halt method currently is a no-op in SWI.

    - #### version

          public static org.jpl7.Version version()

      Returns (as a Version) an identification of this version of JPL.
      Returns:
        the running version of JPL.

    - #### version_string

          public static java.lang.String version_string()

      Returns a String (eg "3.0.0-alpha") identifying this version of JPL.
      Returns:
        a String (eg "3.0.0-alpha") identifying this version of JPL.

    - #### main

          public static void main(java.lang.String[] args)