[ Development Environment and Global Settings | Reference Manual | Alphabetic Index ]

# get_flag(?Flag, -Value)

Succeeds if the flag Flag has the value Value.

Flag
  Atom or Variable.
Value
  Prolog term.

## Description

Used to return or check the environment flag Flag with value Value. The environment flags which are read/write may be updated using set_flag/2. The current values of the environment flags are returned by env/0.

The following list details the environment flags:

after_event_timer

  Access mode : read/write

  Type : Atomic constant real or virtual

  Description : Specifies the timer used for event_after/2 and event_after_every/2.

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 on or off

  Default : off

  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.

coroutine

  Access mode : read/write

  Type : Atomic constant on or off

  Default : configuration dependent

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

cpu_count

  Access mode : read

  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

  Type : Atomic constant process 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_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-only

  Type : Atomic constant nodebug, creep, or leap

  Default : nodebug

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

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_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_local_control value of created engines. The main engine of a standalone ECLiPSe gets its initial value from the -g command line option.

default_language

  Access mode : read/write

  Type : Atom

  Default : eclipse_language

  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' or 'sicstus'.

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

  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

  Default : double

  Description : This flag is obsolete. Its value is always double.

gc

  Access mode : read/write

  Type : Atomic constant on, verbose or off

  Default : on

  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 or fixed.

  Default : adaptive

  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 or off

  Default : on

  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.

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

  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 or off

  Default : on

  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_integer

  Access mode : read-only

  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 global/trail 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.

object_suffix

  Access mode : read-only

  Type : String

  Description : This flag is obsolete, 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 : "QPm"

  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.

output_options

  Access mode : read/write

  Type : List of structures

  Default : [depth(20), attributes(pretty), ...]

  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. This flag is an alternative, more readable representation of the values of the print_depth and output_mode flag. It reflects the values of those flags and will change their values whenever it is changed itself.

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 if 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 print depth bound for printing compound terms. 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. Identical to the depth(N) component of the output_options flag.

prolog_suffix

  Access mode : read/write

  Type : List of strings

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

  Description : Specifies the 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.

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

  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 is reset using set_flag(syntax_option, not(Flag)). Most compatibility packages affect these flags as well. The following options are available:

  atom_subscripts
    allow atoms to be followed by subscripts, and parse as subscript/2. Useful for parsing other languages, e.g. FlatZinc.
  bar_is_no_atom
    disallow the use of an unquoted vertical bar as atom or functor, except when it occurs in infix-position.
  bar_is_semicolon
    translate occurrences of unquoted infix vertical bars into terms with functor ;/2, e.g. (a|b) = (a;b).
  based_bignums
    Allow base notation even for integers longer than the wordsize (i.e. they are always positive).
  blanks_after_sign
    ignore blank space between a sign and a number (by default, this space is significant and will lead to the sign being taken as prefix operator rather than the number's sign). Also allow signs of numbers to be quoted.
  blanks_in_nil
    has no effect (obsolete).
  curly_args_as_list
    Parse terms written as {a,b,c} as {}([a,b,c]) instead of the default {}((a,b,c)).
  doubled_quote_is_quote
    parse a pair of quotes within a quoted item as one occurrence of the quote within the item. If this option is off (the default), consecutive string-quoted and list-quoted items are parsed as a single (concatenated) item, while consecutive quoted atoms are parsed as consecutive atoms.
  eof_is_no_fullstop
    do not treat end-of-file as a fullstop.
  float_needs_point
    require floating point numbers to be written with a decimal point, e.g. 1.0e-3 instead of 1e-3.
  general_subscripts
    allow atoms, parenthesized subterms and subscripted subterms to be followed by subscripts, and parse as subscript/2. Useful for parsing other languages, e.g. Zinc.
  iso_base_prefix
    allow binary, octal or hexadecimal numbers to be written with 0b, 0o or 0x prefix respectively, and disallow the `base'number` notation.
  iso_escapes
    ISO-Prolog compatible escape sequences within strings and atoms.
  iso_restrictions
    enable all ISO-Prolog syntax restrictions that are not controlled by individual settings. This includes: disallowing operators as operands of operators; disallowing an atom to be declared as both an infix and a postfix operator; restrictions on changing operator properties for comma, vertical bar, and the empty-bracket atoms.
  limit_arg_precedence
    do not allow terms with a precedence higher than 999 as structure arguments, unless parenthesised.
  nested_comments
    allow bracketed comments to be nested.
  nl_in_quotes
    allow newlines to occur inside quotes (default).
  no_array_subscripts
    do not allow array subscript syntax for subscript/2.
  no_attributes
    disallow the Eclipse specific syntax for variable attributes in curly braces.
  no_blanks
    do not allow blanks between functor and opening parenthesis (default).
  no_curly_arguments
    disallow the Eclipse specific syntax for structures with named arguments in curly braces.
  no_string_concatenation
    do not parse consecutive string literals as a single (concatenated) string.
  plus_is_no_sign
    do not interpret a plus sign preceding a number as the number's sign (effectively ignoring it), but treat it as a possible prefix operator +/1.
  read_floats_as_breals
    read all floating point numbers as bounded reals rather than as floats. The resulting breal is a small interval enclosing the true value of the number in decimal notation.
  syntax_errors_fail
    the predicates of the read-family fail when encountering a syntax error (after printing an error message). Without this option, the predicates throw an error term of the form error(syntax_error(MessageString),context(...)).
  var_functor_is_apply
    allow variables as functors, and parse a term like X(A,B,C) as apply(X,[A,B,C]).

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 : eclipse

  Description : The name of the current top-level module. This is the caller 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.

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].

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

### Exceptions

(5) type error
  Flag is neither an atom nor variable.

## Examples

    Success:
       [eclipse]: get_flag(gc, X).
       X = on

       yes.
       [eclipse]: 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, env / 0, errno_id / 1, engine_create / 2