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
- Library usage:
These predicates are builtin in Ciao, so nothing special has to be done to use them. - Exports:
- Predicates:
get_arch/1, get_os/1, get_platform/1, get_debug/1, get_eng_location/1, get_ciao_ext/1, get_exec_ext/1, get_so_ext/1, this_module/1, current_module/1, ciao_c_headers_dir/1, ciao_lib_dir/1, ciaolibdir/1. - Regular Types:
internal_module_id/1.
- Predicates:
- Imports:
- Packages:
prelude, nonpure, assertions, nortchecks, isomodes.
- Packages:
Documentation on exports
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 ?-
(Trust) Usage:get_arch(ArchDescriptor)
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.
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 ?-
(Trust) Usage:get_os(OsDescriptor)
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.
(Trust) Usage:get_platform(Platform)
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.
(Trust) Usage:get_debug(Debug)
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.
(True) Usage:get_eng_location(Ext)
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.
(Trust) Usage:get_ciao_ext(Ext)
Ext is the default extension for the executable Ciao programs.
- The following properties hold upon exit:
(basic_props:atm/1)Ext is an atom.
(Trust) Usage:get_exec_ext(Ext)
Ext is the extension for executables.
- The following properties hold upon exit:
(basic_props:atm/1)Ext is an atom.
(True) Usage:get_so_ext(Ext)
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.
(Trust) Usage:this_module(Module)
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
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)
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.
(Trust) Usage:ciao_c_headers_dir(CiaoPath)
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.
(Trust) Usage:ciao_lib_dir(CiaoPath)
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.
(Trust) Usage:ciaolibdir(CiaoPath)
Like ciao_lib_dir/1, for compatibility for third-party tools (deprecated).
- The following properties hold upon exit:
(basic_props:atm/1)CiaoPath is an atom.
Usage:internal_module_id(M)
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.