First steps with Liberty-Eiffel

liberty-light

Well, after the release of Liberty-Eiffel as part of GNU I’m giving my first steps with Eiffel language. Some years ago I tried this language, but unfortunately I don’t found documentation in spanish. Now that I can read english, I will give me a try with this language. And, of course, I will also write spanish tutorials for upcoming users :)

The first thing I notice is a different terminology. An executable is called system and a set of classes is refereed as universe. The classes can be grouped in clusters into the universe. And the routines (operations) of a class, and its attributes, are called features. The routines are divided in functions or queries (which return a value) and procedures (which do not return a value). As opposed to C language, where we need a function named main, on Eiffel we can designate any procedure to start the execution.

But let start looking the example “Hello World!” that comes in the source tarball. First install Liberty-Eiffel, in my case I have the deb packages from Snapshots, because the stable packages for i386 are broken. The example is this, from — to the end of the lines are comments (I removed the original comments, but add others for explanation):

eiffel1

{ANY} mean that any other class can call this routine. In Eiffel we can limit the calls from certain classes. io is a class for input/output and the routine put_string write a message at default output. The source tarball, at work/eiffel.el, provide a major mode for Emacs. Save this program in a file with the name hello_world.e and compile this with:

se compile hello_world.e -o hello

In Eiffel is recommended have one class per file. The name of class capitalized and the name of the corresponding file in lowercase. Now run the executable:

./hello
Hello World.

Clap clap, our first program with Eiffel.

OK, here happened something magic. We don’t set any routine as the initial to start the execution. Liberty-Eiffel don’t implement 100% the ECMA standard in which, if the initial routine isn’t specified, is assumed it has the name make. So, I suppose in Liberty-Eiffel it is assumed to have the name main. But go ahead, Liberty use ACE files with the same purpose of makefiles in other languages. This is our ACE file for this example:

eiffel2

Again, from — to the end of the lines are comments. In cluster section there are two lines. The current directory, where is our file hello_world.e, and the paths of Liberty libraries, defined in loadpath.se. Save this file in the same directory of our source file, and with the extension ace, for example hello.ace: Now you can compile the program with:

se compile hello.ace

To clean the compile products, except the executable, use:

se clean *.e

And that is all for now. In next posts I will share other examples while I learn this interesting language. Regards :)

Configuring GNUstep

I made a small video to show how configure GNUstep in desktops other than WindowMaker. However the official website of GNUstep changed the same day I uploaded this video. So, the instructions are slightly different. You can found the themes at GNUstep Wiki, but the link to the wiki is now at External option in top menu, not at right side as show the video. In this I use the application SystemPreferences, but all these changes can be done in a terminal using the tool defaults. For example, I use this tool to change the configuration automatically when I switch from WindowMaker to Gnome, or vice versa. With this you will see how easy is configure GNUstep in other desktops. Click the image to see the video:

Configuring GNUstep

Theming and Style in GNUstep

OK, many people still think GNUstep only can look like this:

theming1

That isn’t true, GNUstep supports theming. There are some themes in GAP and others developed in Etoile. The image below show the theme Nesedah from this last project:

theming2

Not only the pixmaps and colours can be changed, also the style of the interface. This include the menu style (vertical, in-window or Mac OS style), the scrollbar position (right or left), the behaviour of contextual menus, popup list and pulldown list (so these can have similar behaviour of the gtk components). The Silver theme include an style that let users run GNUstep’s apps on, for example, Gnome without problems.

theming3

There is also the Gtk theme, that dynamically builds a theme based in the current gtk theme. Is under development, but work with some themes.

theming4

On the other hand, the WinUXTheme theme is for Windows platforms. It use native menus and (the current SVN) native Open/Save panels.

theming5

The development apps of GNUstep: ProjectCenter, Gorm and EOModelEditor; and the app for configuration, SystemPreferences, supports the in-window menu style.

Of course, as in any free software project, there are some problems here and there. But with your feedback, or patches, we can improve the theming engine or a particular theme. However, we are not graphic artists, we are programmers. So, don’t worry if you find ugly some pixmaps in the themes. But help is welcome.

gs-emacs 0.1

Well, after play some time with elisp I wrote this package to add a entry called GNUstep to Emacs menu. This entry has three options, two are to make simple App/Tool projects (for beginners). The third is for replace the non English characters to its corresponding code. This is useful for strings and plist files. This three commands can be executed with, respectively: M-x make-app, M-x make-tool y M-x replace-foreign-characters. The image below show the menu:

gnustep-emacs

A Tool project:

gnustep-tool

This package also offers auto-complete for Objective-C and the possibility to open gorm files in dired (load):

gnustep-completion

Compiling and testing a tool:

gnustep-compilation

You can download this package here. Just untar this somewhere and in your .emacs file add something like:

(load-file “/home/user/gs-emacs/gnustep.el”)

See README file if you have installed GNUstep with a non default layout. This is if you need run the GNUstep script.

My intention with this package is help Emacs’ users to learn GNUstep, and make known this wonderful development environment. So I hope this package will be helpful.

Only 8 days left, supports FisicaLab today!

bannerCampaign

GNU FisicaLab is requesting your support to give students a free application to learning physics. Students deserve free software in their schools and universities. With your support to FisicaLab you will help to educational establishments for moving in this direction. Help to liberate the schools from using privative software. Your support will help to expand the range of problems to solve in FisicaLab, in adding new features, in the availability in other languages and in many other things. Give students a chance of get an ethical education with free software. Don’t hesitate and make a donation today!