
get_flag(?Flag, -Value)

   Succeeds if the flag Flag has the value Value.

Arguments
   Flag                Atom or Variable.
   Value               Prolog term.

Type
   Development Environment and Global Settings

Description
   Used to query or check the value(s) of a flag with given name Flag,
   or to enumerate all flags and their values.

   The flags which are read/write may be updated using set_flag/2.
   A table of current flag values can be printed with env/0.

   The following list details the environment flags:

after_event_timer
    Access mode :   read/write

    Type :  Atomic constant real or virtual

    Description : Obsolete - was used to specify the timer for
        event_after/2 and event_after_every/2.  It is now always 'real'.


bounded
    Access mode :   read-only

    Type :   Atomic constant false or true

    Description : ISO-Prolog flag - indicates whether integer arithmetic
        is restricted to the range min_integer..max_integer ('true'), or
        whether it works with arbitrarily large numbers ('false').
        For ECLiPSe, this is 'false' (unless the system has explicitly
        been built without bignum support).


break_level
    Access mode :   read/write

    Type :   Integer

    Description :   Specifies current nesting level of recursive
        top-level loops.


breal_exceptions
    Access mode :   read/write

    Type :   Atomic constant off (default) or on

    Description :   If on,  unifying or testing bounded reals
        for identity raises an 'undecidable comparison of bounded reals'
        exception in case the comparison is undecidable (i.e. the bounds
        overlap).  If off, bounded reals compare equal when
        their bounds are equal.  This flag does not affect arithmetic
        comparisons.


char_conversion
    Access mode :   read/write

    Type :   Atomic constant off (default) or on

    Description : ISO-Prolog compatibility flag - used to enable ISO's
        idiosyncratic char-conversion feature (not implemented in ECLiPSe).


coroutine
    Access mode :   read/write

    Type :   Atomic constant off (default) or on

    Description :   Specifies whether built-in predicates delay or
        raise instantiation faults.


cpu_count
    Access mode :   read-only

    Type :   Positive integer

    Default :   Hardware dependent

    Description :   Indicates the number of logical processors on the machine.


cwd
    Access mode :   read/write

    Type :   String

    Description :   Specifies the name of the current working directory.
        May also be set using cd/1 or read using getcwd/1.


cwd_scope
    Access mode :   read/write

    Type :   Atomic constant process (default) or separate

    Description :   Specifies whether cd/1, getcwd/1, the cwd flag and
        relative path names refer the process's current directory ('process'),
        or to the ECLiPSe system's own idea of current directory ('separate').
        Note that the effective current directory may change when the cwd_mode
        is switched, as no synchronisation is done.


debug
    Access mode : read/write

    Type : Atomic constant off (default) or on

    Description : ISO-Prolog compatibility flag - use 'debugging' instead.
        The setting debug=off corresponds to debugging=nodebug,
        and debug=on corresponds to debugging=creep.


debug_compile
    Access mode :   read/write

    Type :   Atomic constant on or off

    Default :   on

    Description :   Specifies whether clauses are compiled for
        debugging or not.  May be overwritten on a file by file
        basis using pragma(debug) or pragma(nodebug).


debugging
    Access mode : read/write

    Type : Atomic constant nodebug (default), creep, or leap

    Description : Specifies whether debugging is disabled (nodebug) or
        enabled.  trace/0 sets the creep mode, debug/0 sets the leap mode.


default_globalsize
    Access mode : read/write

    Type : Integer (kBytes)

    Default :   depends on creation options of the current engine

    Description : The default value for the global(KiBytes) option
	(the size of the global/trail stack) when creating additional
	engines with engine_create/2.  This setting is specific to the
	current engine, but gets inherited by every created engine,
	unless overwritten by an explicit global(KiBytes) creation option.
        It determines the max_gobal_trail value of created engines.
        The main engine of a standalone ECLiPSe gets its initial value
        from the -g command line option.


default_localsize
    Access mode : read/write

    Type : Integer (kBytes)

    Default :   depends on creation options of the current engine

    Description : The default value for the local(KiBytes) option
	(the size of the local/control stack) when creating additional
	engines with engine_create/2.  This setting is specific to the
	current engine, but gets inherited by every created engine,
	unless overwritten by an explicit local(KiBytes) creation option.
        It determines the max_local_control value of created engines.
        The main engine of a standalone ECLiPSe gets its initial value
        from the -l command line option.


default_language
    Access mode : read/write

    Type : Atom

    Default : normally 'eclipse_language', unless overridden by a -L
        command line option or an ECLIPSEDEFAULTLANGUAGE environment setting.

    Description : Specifies the source language dialect for modules which
        are created without an explicit language specification (module/1
        directive or the create_module/1). Other possible settings are
        for example 'iso', 'iso_strict' or 'sicstus'.


dialect
    Access mode : read-only

    Type : Atom with fixed value 'eclipse'

    Description : This is a flag proposed by the Prolog Commons
        initiative to help writing portabile Prolog programs.


double_quotes
    Access mode : read/write, module-local

    Type : Atomic values atom, codes, chars or string.

    Default : 'string' for eclipse_language, 'codes' for iso language dialects.

    Description : ISO-Prolog compatibility flag only.  For ECLiPSe code,
        consider the more general character class settings such as
        :- local chtab(0'", string_quote).


eclipse_info_suffix
    Access mode : read

    Type : String

    Default : ".eci"

    Description : Specifies the ECLiPSe information file suffix used when a 
        file is generated by icompile/1. The suffix will be automatically
        appended to the base file name when the information file is generated. 


eclipse_object_suffix
    Access mode : read

    Type : String

    Default : ".eco"

    Description : Specifies the ECLiPSe object file suffix used when a file
        is fcompiled. The suffix will be automatically appended to the 
        file's base name when the object file is generated. When loading a 
        file (e.g. use_module/1, lib/1), the system will try to find an
        object file before a source file by appending the given suffix
        before the source suffix(es).


enable_interrupts
    Access mode : read/write

    Type : Atomic constant

    Default :   on

    Description : This flag is obsolete, its value is always 'on'.
        Interrupts (signals) are now handled by a separate thread.


extension
    Access mode : read-only, nondet

    Type : Atomic constant.

    Default :   configuration dependent

    Description : Specifies which extensions are available in the
        system.  This flag may contain multiple values and will return
        them on backtracking.


float_precision
    Access mode : read-only

    Type : Atomic constant

    Value :   double (64-bit)

    Description : The precision of floating point values.


gc
    Access mode :   read/write

    Type :   Atomic constant on (default), verbose or off

    Description :   Specifies whether garbage collection is enabled
        (on), disabled (off) or enabled and reports every collection on
        log_output (verbose).


gc_policy
    Access mode :   read/write

    Type :   Atomic constant adaptive (default) or fixed.

    Description :   This option affects the triggering heuristics of
        the garbage collector, together with the gc_interval setting.
        The adaptive policy minimises garbage collection time,
        while the fixed policy minimises space consumption.


gc_interval
    Access mode :   read/write

    Type :   Integer

    Default :   1/32 of global stack size, at least 64KB

    Description :   Specify how often the collector is invoked.
        Roughly, the argument specifies the minimum number of bytes a
        program must have newly allocated before a garbage collection
        is triggered.  If the garbage collector runs frequently while
        reclaiming little space it may make sense to increase
        gc_interval, thus reducing the number of garbage collections. 
        This is normally only necessary when the gc_policy is set to
        fixed.  With gc_policy set to adaptive, the
        collection intervals will be adjusted automatically.  See also
        gc_policy setting.


gc_interval_dict
    Access mode :   read/write

    Type :   Integer

    Default :   960

    Description :   Specify after how many new dictionary entries the
        dictionary garbage collector is invoked.  To disable dictionary
        garbage collection completely, set this value to 0 (zero).


goal_expansion
    Access mode :   read/write

    Type :   Atomic constant on (default) or off

    Description :   Specifies whether goal expansion (inling) is done by
        the compiler or other source processing tools.  Can be disabled
        for debugging purposes, but usually it is preferable to use a
        compiler/source-processor option or a pragma for this purpose.


hostarch
    Access mode : read-only

    Type : String

    Description : String identifying the host processor and operating
        system.  It is also the name of the machine-dependent
        subdirectories in the ECLiPSe installation.


hostid
    Access mode : read-only

    Type : String

    Description : The unique identification of the host machine that
        the system is running on.


hostname
    Access mode : read-only

    Type : string

    Description : The name of the current host machine.


ignore_eof
    Access mode : read/write

    Type :   Atomic constant on or off

    Description : Controls whether ECLiPSe can be exited by typing an
        end-of-file to the toplevel-prompt or whether this is ignored.
        If ignored, ECLiPSe can be exited by calling halt/0.


installation_directory
    Access mode : read-only

    Type : string

    Description : The name of the toplevel directory of the running
        ECLiPSe installation.  All ECLiPSe library, documentation and
        other directories are below this one.


integer_rounding_function
    Access mode : read-only

    Type : Atomic constant toward_zero (fixed) or down

    Description : ISO-Prolog flag - its value in ECLiPSe is 'toward_zero'.


last_errno
    Access mode : read-only

    Type : Integer

    Description : The error code that the most recent failed operating
        system call returned. This should no longer be used because of
        portability problems, use errno_id/1 instead.


library_path
    Access mode : read/write

    Type : List of strings

    Default :   the contents of the user's ECLIPSELIBRARYPATH
        environment variable, followed by the system library directories

    Description : Specifies the list of pathnames used by the system to
        search for library files.  The library path is used by lib/1
        for autoloading, and to expand library/1 structures in pathnames.


loaded_library
    Access mode :   read/write, nondet

    Type :   Atom

    Description :   Returns the names of the currently loaded
        libraries.  This flag may contain multiple values and will
        return them on backtracking.


macro_expansion
    Access mode :   read/write

    Type :   Atomic constant on (default) or off

    Description :   Specifies whether macro expansion (including clause
        expansion and goal expansion/inlining) is enabled or disabled.
        Should be disabled only for very specific debugging purposes.
        It is preferrable to disable macro expansion on a per-stream
        basis (see set_stream_property/3) or via a source-processor option.


max_arity
    Access mode : read-only

    Type : The atom unbounded (fixed) or an integer

    Description : ISO-Prolog flag - would be an integer giving the
        maximum compound term arity.  In ECLiPSe always 'unbounded'.


max_integer
    Access mode : read-only, semidet

    Type : Integer

    Description :   If the range of integer is bounded (i.e. bignums not
       supported), returns the maximum representable integer value. Fails 
       if the integer range is unbounded. 


max_global_trail
    Access mode : read-only

    Type : Integer

    Description : The maximum size in bytes to which the global/trail stack
        can grow. See also statistics/2.


max_local_control
    Access mode : read-only

    Type : Integer

    Description : The maximum size in bytes to which the local/control stack
        can grow. See also statistics/2.


max_predicate_arity
    Access mode :   read-only

    Type :   Integer

    Default :   255

    Description :   Returns the maximum number of arguments allowed for
        an ECLiPSe predicate.


min_integer
    Access mode : read-only, semidet

    Type : Integer

    Description :   If the range of integer is bounded (i.e. bignums not
       supported), returns the minimum representable integer value. Fails 
       if the integer range is unbounded. 


object_suffix
    Access mode :   read-only

    Type :   String

    Description :   This flag is deprecated, it returns the same value as
        system_object_suffix, but without the leading dot (e.g. "so").


output_mode
    Access mode : read/write

    Type : String

    Default :   "mPQ"

    Description : The value is a control string that is recognised by
        the %w format of printf/3.  This format is used to output
        results on the toplevel loop and to print debugger trace lines.
        See also the output_options flag, which should be preferred.


output_options
    Access mode : read/write

    Type : List of structures

    Default :   [attributes(pretty), quoted(true), ...]

    Description : The value is an output options list as understood by
        write_term/2,3.   This format is used to output results on the
        toplevel loop and to print debugger trace lines only!
        This flag is a more expressive and more readable alternative to
        the value of the output_mode flag (their values are synchonized).
        Note that default output options can also be set on a per-stream
        basis in open/4 or via set_stream_property/3.


pid
    Access mode :   read-only

    Type :   Integer

    Description :   Returns the process identifier of the current ECLiPSe.


ppid
    Access mode :   read-only

    Type :   Integer

    Description :   Returns the process identifier of the current
        ECLiPSe's parent process.


prefer_rationals
    Access mode :   read/write

    Type :   Atomic constant on or off

    Default :   off

    Description :   Specifies whether the result of a / - division of two
        integers gives a rational or a floating point result.  Similar
        for the result of raising an integer to a negative integral power.


print_depth
    Access mode :   read/write

    Type :   Integer

    Default :   20

    Description :   Specifies the default print depth bound for printing
        compound terms/lists.  It is not taken into account by the output
        predicates that produce machine-readable output (write_canonical,
        writeq, etc), but other I/O built-ins obey this flag, unless
        overruled by per-stream or write_term/2,3 output options
        (depth(Max) or max_depth(Max)).


prolog_suffix
    Access mode :   read/write

    Type :   List of strings

    Default :   ["", ".ecl", ".pl"]

    Description :  Specifies the ECLiPSe/Prolog source file suffix(es) used
        when compiling files or loading libraries.  The system tries to
        find the file by appending the given suffixes in the order provided.


random_mode
    Access mode :   read/write

    Type :   Atom (one of 'system', 'lcg', 'xs')

    Default :   lcg

    Description :   Specifies the method used for generating
        pseudo-random numbers in random/1,2 and frandom/1.


remote_protocol_version
    Access mode :   read only

    Type :   Integer

    Description :   Specifies the version of the protocol which this
        Eclipse uses to communicate with remotely attached peers.  See
        Embedding and Interfacing Manual: The Remote Interface Protocol.


syntax_option
    Access mode :   read/write, module-local

    Type :   Atom

    Description :   Returns the names of the currently enabled syntax
        options.  This flag may contain multiple values and will return
        them on backtracking.  A syntax option can be set using
        local syntax_option(Option) and reset using
        local syntax_option(not(Option)).
        Most compatibility packages affect these flags as well.
        For a details see syntax_option/1.


system_object_suffix
    Access mode :   read-only

    Type :   String

    Description :   Returns the suffix of the external object files
        that can be loaded using load/1.  Common values are ".so" on Unix,
	".dll" on Windows, and ".dylib" on OSX.


tmp_dir
    Access mode : read/write

    Type : String

    Default : configuration dependent (see Description below)

    Description : Specifies the temporary directory that ECLiPSe may use
        for storing temporary data files. Value should be an
        existing directory (in ECLiPSe's file name syntax) that the user
        can write to (set_flag/2 will fail otherwise). It is also
        recommended that the directory should reside on a local disk where
        the I/O operations are as fast as possible.   By default, this
        directory is taken from the environment variable ECLIPSETMP if it
        exist. Otherwise, it is "/tmp" for Unix systems; "//C/Temp" for
        Windows. If none of these exist, it is set to the current
        working directory at start up.


toplevel_module
    Access mode :   read/write

    Type :   Atom

    Default :  taked from the '-t' command line option, otherwise 'eclipse'

    Description :   The name of the current top-level module.  This is
        the context module for all queries entered in the top-level
        loop.  By default, this is also shown in the top-level prompt.


unix_time
    Access mode :   read-only

    Type :   Integer

    Description :   Return the time as given by the UNIX time(3)
        function, ie.  seconds since 00:00:00 GMT, Jan 1 1970.


unknown
    Access mode :   read/write, module-local

    Type :   Atomic constant abort, error, warning or fail

    Default :  error in iso dialects, otherwise abort

    Description : ISO-Prolog flag - controls the behaviour on calling an
        undefined predicate. The alternatives are:
        'abort' (print an error message, then throw(abort), non-ISO),
        'error' (throw error(existence_error(procedure,Name/Arity), Context)),
        'warning' (print a warning message, then fail),
        'fail' (fail silently).


unknown_option
    Access mode :   read/write, module-local

    Type :   Atomic constant error, warning or ignore

    Default :  error in iso dialects, otherwise warning

    Description : Controls the behaviour of built-ins (e.g. write_term/2,3)
        when encountering an unknown option argument:
        'error' (raise an error),
        'warning' (print a warning message and ignore),
        'ignore' (ignore silently).


variable_names
    Access mode :   read/write

    Type :   Atomic constant on, off or check_singletons

    Default :   check_singletons

    Description :   Controls the ability to retain the source name of
        variables.  This flag affects the reading process only, i.e.
        when a variable is read (or compiled) with the flag set to on,
        it will keep its name even when the flag is switched off later.
        check_singletons is like on but additionally the compiler emits
        warnings about source variables which occur only once in a
        clause and whose name does not start with an underscore.  The
        source variable names are being created during the term input
        if this flag is not off, and then they are kept independently
        of the value of this flag.


version
    Access mode :   read-only

    Type :   Atom

    Description :   Returns the current version number of ECLiPSe .


version_as_list
    Access mode :   read-only

    Type :   List of integers

    Description :   Returns a list of integers, starting with your ECLiPSe
        system's major version number, and ending with its build number.
        Note that this list can be used for lexicographic comparison, e.g.
        [5,3,17] @>= [5,3] or [5,3,17] @>= [5,1,24].


version_data
    Access mode :   read-only

    Type :   Term of the form eclipse(Major,Minor,Build)

    Description :   A compatibility flag proposed by Prolog Commons.
        It combines the information from 'dialect' and 'version_as_list'.


worker
    Access mode :   read-only

    Type :   Integer

    Description :   In a parallel session it returns a positive number,
        identifying the worker on which the flag inquiry was executed.
        In a sequential session 0 is returned.


workers
    Access mode :   read/write

    Type :   A structure Host:N, where Host is an atom and N integer

    Description :   In a parallel session it returns a positive number
        for N, which is the number of active workers on a given host
        Host.  If Host is a variable, it is bound to the host name
        where this predicate is executed.


workerids
    Access mode :   read-only

    Type :   A structure Host:ActiveList+AsleepList, where Host is an
        atom and ActiveList and AsleepList are integer lists

    Description :   In a parallel session it returns the workerid lists
        of of both active and asleep workers on a given host Host.  If
        Host is a variable, it is bound to the host name where this
        predicate is executed.


wm_window
    Access mode :   read/write

    Type :   Atomic constant on or off

    Description :   In a parallel session this flag tells if the window
        interface for the worker manager is on or off.




Modes and Determinism
   get_flag(-, -) is nondet
   get_flag(+, -) is nondet

Modules
   This predicate is sensitive to its module context (tool predicate, see @/2).

Fail Conditions
   Fails if a flag with the given name is not set, or does not exist

Exceptions
     5 --- Flag is neither an atom nor variable.

Examples
   
Success:
   ?- get_flag(gc, X).
   X = on
   yes.

   ?- get_flag(loaded_library, L).
   L = lists     More? (;)
   L = development_support     More? (;)
   yes.

Error:
   get_flag(1,X).           (Error 5)


See Also
   set_flag / 2, current_prolog_flag / 2, env / 0, errno_id / 1, engine_create / 2, syntax_option / 1
