Configuration file

From Liberty Eiffel Wiki
Revision as of 21:02, 5 January 2007 by Cadrian (talk | contribs) (new in 2.3)
Jump to navigation Jump to search


The configuration is used by most SmartEiffel tools. It groups in a unique file all the data which allow the user not too have over-long command lines ;-)

Can be found in this file, in particular:

  • paths to find tools, environment variables, short templates...
  • paths of the clusters that define all the classes available by default (the universe).

This tool is generated by the installation tool of SmartEiffel.

Where is this file

Depending on the operating system, there are default values. In all cases, this default value can be overwritten using the SmartEiffel environment variable. SmartEiffel must contain the path of the configuration file. Elders who know SmallEiffel certainly still use $HOME/SmartEiffel/sys/system.se

Default values:

Windows and DOS: %USERPROFILE%\SE.CFG if the variable is defined, C:\SE.CFG otherwise
Unix and Cygwin: ~/.serc or /etc/serc (look-up in this order)
Elate : /lang/eiffel/serc

The other operating systems don't have a default value, the SmartEiffel environment variable must be used. If you have such an operating system and you think there is a reasonnable default value, thanks to tell us.

Note: The configuration handling changes slightly in the upcoming version 2.3. Instead of having only one file, one may have more than one, which are treated by priority. The lowest priority is attributed to system-wide files, while user-specific (e.g. ~/.serc) and session-specific (the SmartEiffel environment variable) get higher priority. It goes even further since each "file" can now be a directory. In that case all the entries of the directory are merged. All that because of some distributions like to add/remove files instead of grep'ing and sed'ing huge configuration files.

File syntax

The file is written using a simple text format. It is split in sections that begin by a word between square brackets on a line. Each section is comprised of key-value pairs separated by a colon.

Example:

[General]
bin: /home/cyril/SmartEiffel/bin/
sys: /home/cyril/SmartEiffel/sys/
short: /home/cyril/SmartEiffel/short/
os: UNIX
flavor: Linux
tag: 3

The General section

This section is named [General]. There must be the following keys:

bin the path to the SmartEiffel executables. This path is used in particular by the se tool (see below the Tools section) and compile.
sys the path to the SmartEiffel system files. This path is used by compile_to_c and compile_to_jvm. It contains all the basic files included by those compilers. They define the "basic bricks" of the generated Eiffel system.
short the path to the short templates (modes -html, -tex, etc.)
os the type of the operating system SmartEiffel is installed on. The recognized types are: UNIX, Windows, Cygwin, BeOS, Macintosh, Amiga, DOS, OS2, OpenVMS, Elate.
flavor allows a more accurate specification of the operating system type, useful for some plugins. For instance, if the os is UNIX, the flavor can be Solaris. There is no predefined list of values; plugins must tell which are the supported flavors.
tag normally only used by the installation tool to define the version of the configuration file. There should be ascending compatibility between versions but currently, if the tag is not the one of the installation tool, no data is kept. This behavior is changed in the upcoming 2.3, to keep as much data as possible.

The tag value is 3 for the 2.2 version of SmartEiffel and should be the same for the upcoming 2.3.

Environment

The environment allows to define environment variables specific to SmartEiffel. In particular those variables are available in the remaining of the configuration file, in the loadpath.se files, ACE files and some command line arguments.

The installation tool installs the following default variables:

[Environment]
path_tutorial: /home/cyril/SmartEiffel/tutorial/
path_tools: /home/cyril/SmartEiffel/tools/
path_lib: /home/cyril/SmartEiffel/lib/

Note that anyone can add their own variables.

The universe

The universe is the set of all the known clusters. It is defined in the [Loadpath] section.

The installation tool installs the following default universe:

[Loadpath]
lib: ${path_lib}loadpath.se
tools: ${path_tools}loadpath.se
tutorial: ${path_tutorial}loadpath.se

Note that anyone can add their own tools to the libraries they most use.

Caveat: the universe is not used by the tools if an ACE file is given. In this case, this latter file must describe the whole universe. On the other hand it is very simple to do so since just adding a single line or two to your ACE file will produce the desired effect:

cluster
   standard: "${path_lib}loadpath.se"

Tools

All the tools used by the se command are set here. Those tools must be in the directory pointed by the bin key of the [General] section. The key is used as first argument of se.

The installation tool installs the following default commands:

[Tools]
c: compile
c2c: compile_to_c
clean: clean
java: compile_to_jvm
pretty: pretty
short: short
find: finder
ace_check: ace_check
class_check: class_check
javap: print_jvm_class
doc: eiffeldoc
x_int: extract_internals
test: eiffeltest

Note that anyone can add their own tools, as long as the executable is in the directory pointed by the bin key of the [General] section and an entry is added to the [Tools] section.

C modes

Those modes are used by the C back-end: used C compiler, options...

There are by default some C modes that are automatically associated to the Eiffel compilation levels (-boost, -require_check, etc.) The C mode can also be explicitely set in the command line of compile_to_c or compile thanks to the -c_mode option.

The installation tool installs the following default C modes: boost, no_check, require_check, ensure_check, invariant_check, loop_check, all_check, debug_check and release. Only the last one must be explicitely set; it is usually used to finalize a program (se c -boost -c_mode release ...)

Usually the default C modes depend on the chosen C compiler. All those modes can be modified during the installation, but the default values come from a template file. There is one such file per supported C compiler (in the directory SmartEiffel/install, the *.rc files).