Previous Up

3.9  Other tips

3.9.1  Initialisation at start-up

If you wish to have ECLiPSe do or execute things at startup time, you can achieve this in TkECLiPSe by setting the initial query call in the Preference editor; and in the command-line eclipse by putting via a .eclipserc file.

For eclipse, before displaying the initial prompt, the system checks whether there is a file called .eclipserc in the current directory and if not, in the user's home directory. If such a file is found, ECLiPSe compiles it first. Thus it is possible to put various initialisation commands into this file. ECLiPSe has many possibilities to change its default behaviour and setting up a .eclipserc file is a convenient way to achieve this. A different name for the initialisation file can be specified in the environment variable ECLIPSEINIT. If ECLIPSEINIT is set to an empty string, no initialisation is done. If the system is started with a -e option, then the .eclipserc file is ignored.

For TkECLiPSe, the system will make the initial query call as set in the Preference Editor before giving control to the user. This call can be set to compile an initialisation file. This can be the .eclipserc file, or some other file if the user want to initialise the system differently in TkECLiPSe.

3.9.2  Recommended file names

It is recommended programming practice to give the Prolog source programs the suffix .pl, or .ecl if it contains ECLiPSe specific code. It is not enforced by the system, but it simplifies managing the source programs. The compile/1 predicate automatically adds the suffix to the filename, so that it does not need to be specified; if the literal filename can not be found, the system tries appending each of the valid suffixes in turn and tries to find the resulting filename. The system's list of valid Prolog suffixes is in the global flag prolog_suffix and can be examined and modified using get_flag/2 and set_flag/2. For example, to add the new suffix “.pro” use:
get_flag(prolog_suffix, Old), set_flag(prolog_suffix, [".pro"|Old]).

Previous Up