Internal Runtime Information

Author(s): Daniel Cabeza, Manuel Carro, Jose F. Morales.

This module provides internal information about the current running engine and enviroment. That information includes the architecture, platform, operating system, location of libraries, and C header files. That information is mainly used in parts of the Ciao dynamic compilation (location of source, generation of gluecode for the foreign interface, etc.).

Usage and interface

Documentation on exports

PREDICATE
This predicate will describe the computer architecture wich is currently executing the predicate.

Computer architectures are identified by a simple atom. This atom is implementation-defined, and may suffer any change from one Ciao version to another.

For example, Ciao running on an Intel-based machine will retrieve:

?- get_arch(I).

I = i86 ? ;

no
?- 

Usage: get_arch(ArchDescriptor)

  • Description: Unifies ArchDescriptor with a simple atom which describes the computer architecture currently executing the predicate.
  • The following properties hold upon exit:
    (basic_props:atm/1)ArchDescriptor is an atom.

PREDICATE
This predicate will describe the operating system which is running on the machine currently executing the Prolog program.

Operating systems are identified by a simple atom. This atom is implementation-defined, and may suffer changes from one Ciao version to another.

For example, Ciao running on Linux will retrieve:

?- get_os(I).

I = 'LINUX' ? ;

no
?- 

Usage: get_os(OsDescriptor)

  • Description: Unifies OsDescriptor with a simple atom which describes the running operating system when predicate was called.
  • The following properties hold upon exit:
    (basic_props:atm/1)OsDescriptor is an atom.

PREDICATE

Usage: get_platform(Platform)

  • Description: Platform is the atom describing the current operating system and computer architecture.
  • The following properties hold upon exit:
    (basic_props:atm/1)Platform is an atom.

PREDICATE

Usage: get_debug(Debug)

  • Description: Unifies Debug with an atom that indicates if the emulator has been compiled with debug information
  • The following properties hold upon exit:
    (basic_props:atm/1)Debug is an atom.

PREDICATE

Usage: get_eng_location(Ext)

  • Description: Ext indicates if the engine is located in a library (dyn) or in an executable (empty).
  • Calls should, and exit will be compatible with:
    (basic_props:atm/1)Ext is an atom.

PREDICATE

Usage: get_ciao_ext(Ext)

  • Description: Ext is the default extension for the executable Ciao programs.
  • The following properties hold upon exit:
    (basic_props:atm/1)Ext is an atom.

PREDICATE

Usage: get_exec_ext(Ext)

  • Description: Ext is the extension for executables.
  • The following properties hold upon exit:
    (basic_props:atm/1)Ext is an atom.

PREDICATE

Usage: get_so_ext(Ext)

  • Description: Ext is the default extension for the shared libraries. For example, .dll in Windows and .so in most Unix systems.
  • Calls should, and exit will be compatible with:
    (basic_props:atm/1)Ext is an atom.

PREDICATE

Meta-predicate with arguments: this_module(addmodule(?)).

Usage: this_module(Module)

  • Description: Module is the internal module identifier for current module.
  • The following properties hold upon exit:
    (system_info:internal_module_id/1)Module is an internal module identifier

PREDICATE
This predicate will successively unify its argument with all module names currently loaded. Module names will be simple atoms.

When called using a free variable as argument, it will retrieve on backtracking all modules currently loaded. This is usefull when called from the Ciao toplevel.

When called using a module name as argument it will check whether the given module is loaded or not. This is usefull when called from user programs.

Usage: current_module(Module)

  • Description: Retrieves (on backtracking) all currently loaded modules into your application.
  • The following properties should hold upon exit:
    (system_info:internal_module_id/1)Module is an internal module identifier
  • The following properties should hold globally:
    (basic_props:native/1)This predicate is understood natively by CiaoPP.

PREDICATE

Usage: ciao_c_headers_dir(CiaoPath)

  • Description: CiaoPath is the path to the root of the installed Ciao header C files (.h), typically used for interfacing Ciao and C.
  • The following properties hold upon exit:
    (basic_props:atm/1)CiaoPath is an atom.

PREDICATE

Usage: ciao_lib_dir(CiaoPath)

  • Description: CiaoPath is the path to the root of the Ciao libraries. Inside this directory, there are the directories 'lib', 'library' and 'contrib', which contain library modules.
  • The following properties hold upon exit:
    (basic_props:atm/1)CiaoPath is an atom.

REGTYPE
For a user file it is a term user/1 with an argument different for each user file, for other modules is just the name of the module (as an atom).

Usage: internal_module_id(M)

  • Description: M is an internal module identifier

Known bugs and planned improvements

  • Run-time checks have been reported not to work with this code. That means that either the assertions here, or the code that implements the run-time checks are erroneous.