Thursday, September 12, 2013

Using Geany as IDE for JALv2 language

Until recently I used Piklab as IDE for JALv2/jallib, but I wanted something simpler and easier to configure. So I found that Geany IDE, which use gtk+ libraries, meets my requirements.

1. Installing packages

For this tutorial, you must have both Geany,IDE and Jallib package installed. It is possible to find Geany being already on your Linux distro repository so you can just install it, but you will need to download the Jallib package (which contains the JALv2 compiler).Go here, at “Downloads“ section, and download the last official package or the last SVN build, having a name like this, “jallib-pack-bee-$version-$” (unde $version means the distribution version, and $date, is the date of packet creation).

When jallib package download is complete, create a folder in your $HOME folder (e.g., /home/george), named jallib and unpack the archive inside. It must look like in the image bellow:

2. Configuring Geany for single file compilation

Launch Geany and from “Build“ menu, select “Set Build Commands“ option.

From the appearing dialog window, select the first button without label, from the “Label” column:

Another dialog window will show up, containing an editing field where you must introduce the name of the operation – the text must be suggestive. Note that the chosen text will appear as an option inside “Build“ menu. By example, chose “Compile Jalv2 file” :

In the field from the button's right ("Command" column) insert the following text:
$HOME/jallib/compiler/jalv2 -s $HOME/jallib/lib %f

That is all from now, press “Ok“ button. You can test what you did by loading a .jal file and selecting “Compile Jalv2 file;) from “Build” menu (the option is active only if you had opened a file):

If the selected file is one form the “Blink” series, then the compilation is done instantly:

The great thing is that when the compiler throws an error in the console, you can double-click on the line and the caret(cursor) is positioned on the faulty line inside the editor:


3. Configuring Geany for project compiling

Well, this part depends on Geany plug-in installation and I didn't understood this part well... explore for yourself. Anyway, a suitable command can be this one:
$HOME/jallib/compiler/jalv2 -s $HOME/jallib/lib -s %d %f

4. Configuring syntax colouring

Unfortunately, the Geany development team didn't hear yet about JALv2 language  :( . The most closest language is VHDL, with a similar syntax and keywords (well, maybe Ada is closest, but at the time I didn't knew and I modified the VHDL file). Once you opened a .jal file, chose this option from the menu structure:

to see the following result:

We have the posibility to edit the configuration files for creating our own rules for .jal files? Yes, it is possible. We'll modify the configuration file for VHDL language without affecting the general settings so we can revert them any time.


4.1 Installing the configuration files for JAL syntax

Download the filetype_extensions.conf file and install it in the following folder:
Download the filetypes.vhdl file and install it in the following folder:
Restart Geany and you should have a more complete syntax colouring. I don't pretend that I succeeded in removing all VHDL keywords, and that I've succeeded in adding all JALv2 keywords, but the most important are there. But I believe that the functionality is reasonable and anyway, the configuration file can be edited by you any time you want.

Unfortunately, I can't have a complete syntax colouring in one screen capture, so bellow are three screenshots - look at them (definitely, a big improvement from before, when we had only the default VHDL configuration):

filetypes.vhdl este deja la versiunea

5. Conclusion

I think it can't be simple than this and Geany is also available under Windows. Well, it can't be compared with a dedicate JALv2 IDE as is Jaledit but this is a very fast cross platform solution. What do you think?

No comments:

Post a Comment