We will use the following tools, both installed on our Linux Prism servers:
How to start using the above tools is explained further below. You can run EiffelStudio IDE (Integrated Development Environment) or the Eiffel command line compiler (ec
) in one of three ways:
red
compute server). The IDE is invoked from the command line as “estudio15.12”. The Windows version of EiffelStudio is nice to use. But note that all Labs, Assignments, Projects and Labtests must be submitted and executable on the Prism (Linux) version. Although all versions on the different operating systems are similar there may be some slight differences.
Whenever you want to get started with a new language (in our case Eiffel) or an Integrated Development Environment (in our case, EiffelStudio), one always tries to run the simplest possible program - one that prints out “Hello World”.
On your Prism account, ensure that you have at least 200MB (of your 1GB allotment) for EIFGENs (eiffel generated C code). The command
cd du -h
will help you see what your memory usage is. You can use the eclean
command to remove all the EIFGEN directories (see below).
In Java you need (a) the hello_world.java
code and (b) the variable CLASSPATH must be set correctly so that the Java runtime will find your classes and the basic pacakges to compile your program.
In Eiffel you also need (a) the hello_world.e
file with the Eiffel code as well as (b) a *.ecf
file that tells the Eiffel compiler (called ec) where to find your files as well as all the libraries (such as the base library) that your code will be using. Here are the contents of hello_world.e
:
class HELLO_WORLD create make feature make do print("Hi World!") end end
You run the compiler (“ec”) from the command line on the hello_world.e
file as follows:
ec15.12 hello_world.e
On Prism (Linux), we have renamed the command line compiler (“ec”) to '“ec15.12”, as we are using EiffelStudio version 15.01.
[On your own install in Linux/Windows/MacOs, you may be prompted to precompile. Answer Yes.]
On Windows/MacOs, the command line will just be “ec”. On Windows, use the EiffelStudio 15.01 Command Prompt (available from the Start
menu).
When you invoke ec
on a single source file such as hello_world.e
, the compiler will generate the ecf file for you (hello_world.ecf
). ECF files specify which libraries will be used. The Base library is always included.
To execute the program:
cd EIFGENs/hello_world/W_code ./hello_world
and it should print out the message.
In general, you will need other libraries (in addition to the Base library) and thus you will invoke the compiler on the ECF file.
You can obtain a finalized executable that can be deployed by any user (without the need for the EiffelStudio environment) by:
ec15.12 -c_compile -finalize -config hello_world.ecf
The Eiffel program is translated to C, and the C program is compiled to executable machine code (that does not need a virtual machine to run it). To execute the program:
cd EIFGENs/hello_world/F_code ./hello_world
The above executable should print out “Hi world”. This executable is all you need to run the program on any other Linux machine of the same architecture.
The compiler creates a large number of C and other files that you should get rid off to conserve disk space.
We recommend that you reserve 200MB of free space on your disk for generating the intermediate C files.
If you invoke the Linux command eclean
on your directory, the EIFGENs (Eiffel generated files) will be deleted leaving only *.e and *.ecf files.
> eclean .
You can invoke the EiffelStudio IDE on the above project as follows:
> estudio15.12 &
(On your own install, it is just estudio
).
When you start a new project on the IDE, you can use the Wizard to generate an ECF file automatically. If you already have a project with ECF file foo.ecf
, then you can start from the command line as follows: estudio15.12 foo.ecf &
.
(The ampersand at the end causes the EStudio process to run in the background, leaving the terminal free for further commands.)
If you are using the command line under windows, then the compiler is ec (not ec15.12). Use the Eiffel 15.12 command prompt (available from the Start menu). Alternatively,ensure that:
C:\Program Files\Eiffel Software\EiffelStudio 15.12 GPL\studio\spec\windows\bin
is on your PATH variable.
We will be using the ESPEC unit testing framework (a library developed at York University and now part of the EiffelStudio distribution).
On the Prism/Linux workstations and the VM, the ESpec Library is present by default (when creating a new project). If it is your own install, then you need to add the library.
groups
section by clicking on the arrow next to it(To add other libraries, or to add the ESPEC library that comes with your version of eiffelStudio, see here)
The ECF file will thus have the following line in it:
<library name="espec" location="$ISE_LIBRARY\contrib\library\testing\framework \espec\library\espec-safe.ecf"/>
Change the code in class HELLO_WORLD to the following, in order to test if the ESpec library is working. In the tool bar, select the HELLO_WORLD class and change the class the code below:
class HELLO_WORLD inherit ES_TEST create make feature {NONE} -- Initialization make -- Run tests do add_boolean_case (agent t0) --show_errors show_browser run_espec end feature -- tests t0: BOOLEAN do comment("t0: succeed?") Result := false end end
The test will succeed if you have Result := true
(and you will get a green bar).
For more on how to use the testing framework see
These are rough notes that may be out of date.
MacOs: MacOs Install
To install in Linux/Ubuntu
sudo apt-get purge eiffelstudio sudo apt-get update sudo apt-get install eiffelstudio