Clean IDE

From Clean
Revision as of 14:45, 5 July 2010 by Bas Lijnse (talk | contribs)
Jump to: navigation, search

The Clean IDE is the kernel of the Clean System which forms the interface to the programmer and communicates with the other system components. To illustrate what the new IDE looks like and how to work with it we show on this page what you have to do to compile a simple program, the "Game of Life". The program shown here uses the object I/O library. While we explain what to do to generate an application, we also show you some of the options of the Clean IDE. If you work with the IDE, remember that

The IDE is entirely written in Clean. So, the IDE is also an example of a Clean program, and not a small one either! The 2.0 version of the IDE is currently only available on the Wintel platform. On the other platforms a much more restricted and older version of the IDE is available which is not discussed here.

Making a project and generating an application

Start the Clean IDE (CleanIDE.exe). You see an empty project window. First we have to make a new project (or open an existing project). A Clean program consists of definition modules (.dcl files) and implementation modules (.icl files). A definition module indicates which definitions defined in the corresponding implementation module are exported. The topmost root module (the main module) is always an implementation module.

A openfile.jpg

Open the main module of the "Game of Life" , LifeGameExample.icl (in ObjectIO Examples, Life folder). The source text of this Clean implementation module will be displayed in a text window and can be modified with the built-in editor (see below).

A textwindow.jpg

We now make a new Clean project, which will have LifeGameExample as main module.

A newproject.jpg

Choose "New Project..." and a new project will be made. The project administration needs to be saved in a file (e.g. LifeGameExample.prj). The name of the main module (LifeGameExample) will appear in the project window.

The LifeGameExample uses other Clean modules, namely modules from the StdEnv library and modules from the Object I/O library. Each project has an environment in which it is specified which libraries are being used in the project.

A chooseObjEnv.jpg

The IDE has a couple of popular environments predefined. You have to choose which one you would like to use in this particular project. From the "Environment" menu choose "Object IO". Now the IDE knows which libraries to use in this project.


By the way, one can define new environments ("New Environment...") or change existing ones ("Edit Current..."). One can set the libraries to be used, by adding the paths of the folders in which the corresponding Clean source modules can be found. In the environments one can also include "real" libraries containing object code (Static Libraries and Dynamic Libraries). One can even define which IDE components (Tools) to use (which Clean compiler, e.g. version 1.3 or version 2.0 , which linker, and so on). In this way you can easily assign your own preferences to a project or switch from settings just by choosing another environment setting. The environments will be remembered by the IDE, the chosen environment will be remembered in the project administration file.

In addition to the environment you might also want to use more project specific libraries which you might have created to structure your projects, but, which are too specific to put in an environment. For example, the Life Game has a help facility. The corresponding Clean modules are put in a separate folder to be shared by other examples.

A projectoptions.jpg

Choose "Project Options..." from the "Project" menu, select the "Paths" panel and add the library "ObjectIO Examples\gui utilities" to the Life Game project paths.


Now all libraries used by the "LifeGameExample" are included and we can generate the application. Of course, next time, when you open the Life Game project, everything is remembered and you can start right away with compilation.

A update runbmp.jpg

From the "Project" menu choose "Update and Run" . All Clean modules used by "LifeGameExample" will appear in the project window. Those modules which are not up to date will be compiled to abc code. If no errors are found, the code generator will translate all abc-files to object code. Finally, the linker will build the application. If everything is fine, the Clean IDE will launch the application automatically.


Make new life cells in the window of the Life Game application by clicking with the mouse in de window and choose "Play" from the "Commands" menu.