Trusted Components 2007

Installing EiffelStudio


Install EiffelStudio 6.0 build 69618 which can be found at http://eiffelsoftware.origo.ethz.ch/downloads/releases/6.0/
If you are using Windows, make sure you don't install EiffelStudio in a path containing spaces.

Getting source code of EiffelStudio


Prepare source code of EiffelStudio at revision 69618
1. First, you need to check out source code of EiffelStudio (~/es is the location for the checked out files):
svn co https://svn.origo.ethz.ch/eiffelstudio/trunk ~/es -r 69618

2. Revert base library to revision 99. This is because a new feature is added into base library after EiffelStudio 6.0 release, if we still want to use 6.0 to compile the source code at revision 69618, we have to avoid this new feature. Do the following to revert base library to revision 99:

cd ~/es/Src/library/base/elks
svn up -r 99

Compiling source code of EiffelStudio


If you are using Linux, a detailed description can be found at http://eiffelsoftware.origo.ethz.ch/Compiling_EiffelStudio. Although in the page, it requires EiffelStudio 6.1 release and source code, it's still OK to following the instructions with our 6.0 release.

For those who cannot get runtime or libraries compiled, please check that you have packages libc6-dev, libgtk2 installed.
libc6-dev is needed to compile runtime, libgtk2 is needed to compile vision2 library.



For those who encounter "cannot find -lXtst" error when linking EiffelStudio, please check that you have libxtst6-dev package or something alike installed.


If you are using Windows, follow this:
1. Define environment variables:

  • Point the environment variables called EIFFEL_SRC and ISE_LIBRARY to the directory where you want to compile EiffelStudio.


   For example 
   EIFFEL_SRC=d:\Eiffelstudio\Src.
   ISE_LIBRARY=%EIFFEL_SRC%
   where d:\Eiffelstudio\Src is the location of your checkout.


  • Make sure that ISE_EIFFEL, ISE_PLATFORM and ISE_C_COMPILER are properly defined. ISE_EIFFEL should point to your EiffelStudio installation directory, ISE_PLATFORM should be windows, and ISE_C_COMPILER is the C compiler that you are using.


   For example
    ISE_EIFFEL=c:\Eiffel60
    ISE_PLATFORM=windows
    ISE_C_COMPILER=msc

2. Make sure %ISE_EIFFEL%\studio\spec\%ISE_PLATFORM%\bin is in your PATH

3. Patch your EiffelStudio installation by:

  • Copy the content of the %EIFFEL_SRC%\C\shell\bin directory into %ISE_EIFFEL%\studio\spec\%ISE_PLATFORM%\bin
  • Create the directory %ISE_EIFFEL%\studio\spec\%ISE_PLATFORM%\etc
  • Copy compile_library.bat from %EIFFEL_SRC%\..\Delivery\studio\spec\windows into %ISE_EIFFEL%\studio\spec\%ISE_PLATFORM%\bin
  • Extract http://trustedcomponents.origo.ethz.ch/system/files/config.zip to %ISE_EIFFEL%\studio\config\%ISE_PLATFORM%\%ISE_C_COMPILER%

4. Install cygwin from http://www.cygwin.com/.
It's a Unix API simulator on Windows. The reason is that some scripts to compile EiffelStudio run-time is written in bash.

5. Compile runtime by doing:

cd %EIFFEL_SRC%\C
configure clean

cd %EIFFEL_SRC%\C
configure win32 m

cd %EIFFEL_SRC%\library\net\Clib
compile_library.bat

cd %EIFFEL_SRC%\library\vision2\Clib
compile_library.bat

cd %EIFFEL_SRC%\library\wel\Clib
compile_library.bat

cd %EIFFEL_SRC%\C_library\zlib
make_msc.bat

cd %EIFFEL_SRC%\C_library\libpng
make_msc.bat

cd %EIFFEL_SRC%\framework\cli_writer\Clib
nmake

cd %EIFFEL_SRC%\framework\cli_debugger\Clib
nmake

Or, you can use this bat file to compile runtime: http://trustedcomponents.origo.ethz.ch/system/files/compile_runtime_win32.zip

6. Compile EiffelStudio
Now that we have taken care of the C code compilation we can compile the compiler. We assume that ec (which is the executable of EiffelStudio) is in your path.

The configuration file of the compiler contains two active targets:

* batch: for the command line compiler.
* bench: for the graphical compiler, aka EiffelStudio.

Go to $EIFFEL_SRC/Eiffel/Ace and type the following command and replace target_name with either batch or bench.

ec -config ec.ecf -target target_name -c_compile


Playing with ASTs


An easy way to start program analysis is to play with Abstract Syntax Tree (AST), which a tree representing the structure of the code written in plain text. In Eiffel, AST_EIFFEL is the ancestor class for every type of AST nodes. It has descendants such as CLASS_AS for an Eiffel class, FEATURE_AS for a feature and LOOP_AS for a from...until loop.

Let's take CLASS_AS for example. In CLASS_AS, there are features such as `parents' representing all listed parent classes, and `features' represents feature clauses in that class.

To walk through an AST tree, we usually use Visitor Pattern. To map it to our Eiffel situation, there is a class AST_VISITOR with a bunch of descendants each of which performs a certain task, such as AST_NULL_VISITOR performs the task of only walking through but doing nothing, and AST_FEATURE_CHECKER_GENERATOR performs type checking.

Some handy classes to get a class or a feature you want


CLASS_C, which is internal representation of a compiled class
E_FEATURE, which is internal representation of a compiled feature. From CLASS_C.feature_with_name, you can get an E_FEATURE object of the feature whose name is given by the formal argument.

Now comes to the question "Where can I get an CLASS_C object for a certain class?". Some easy ways include:
1) Use SHARED_WORKBENCH.universe.classes_with_name/compiled_classes_with_name
2) Use stones (A stone is the displayed pebble when you do pick-and-drop). Stone is used intensively in EiffelStudio to abstract data communications among different tools. For example, when you drop a stone (say, a class stone) into a tool such as Class tool, the Class tool gets an input which is the class stone, and the Class tool with display certain information according to the stone. Stone class hierarchy begins from EB_STONE. And there are classes such as CLASSC_STONE, FEATURE_STONE within which you can find the CLASS_C object or E_FEATURE object they are referencing to.

Miscellaneous


  • Enable Pick-and-drop mode

From Mensu Tools -> Preferences, and then click the "Flat View" button, and search for keyword "pnd", change the preference value to "True", and close the preference window. This will prevent context-menu from poping up.

  • Setup command argument to run EiffelStudio in GUI mode

If you tried to debug EiffelStudio and it outputs the message "File: '/home/xxx/Src/Eiffel/Ace/Ace.ecf' cannot be read", you need to setup an argument for the debugee: Right-click on the "Start" button in the debugging toolbar, add a debug option profile, and in the "Arguments" field, type "-gui".

AttachmentSize
config.zip1.62 KB
compile_runtime_win32.zip393 bytes