I hate trying to understand and edit source code when its presented as plain black text.
It is funny how just a splash of colour can make so much difference to the readability of a source file.
So if you have to examine Picaxe source files on Linux (and you cannot use the LinAxePad editor) you need an alternative.
I use the editor gEdit quite a lot on Linux, and it includes colour highlighting for over a hundred file types. This not only includes the usual suspects (C, C++, Java, and so on) but also other file types (ini files, JSON and so on).
Colour highlighting is often automatically selected by gEdit based upon the file extension (although this does not appear to be working on my current version of Raspbian). You can also make a manual selection via the menu View > Highlight mode... or via the Status Bar if this has been enabled via the View menu.
For Picaxe source files with a .bas extention, gEdit will probably select VB.net syntax highlighting, which is a reasonable choice for common basic keywords.
However, if you want to take it one stage further, you can create your own syntax file.
gEdit using Solarised Dark theme & custom Picaxe.lang file |
Whether you decide to put a lot of effort into this is up to you, but I just created a dedicated file with a bit more support for Picaxe than the existing VB.net option. It works quite well for me, although the "if...then...else...endif" bit could be better.
Creating a Language file
On Debian based operating systems (like Lubuntu, Mate and Raspbian) gEdit uses syntax language files that you will probably find in:-
/usr/share/gtksourceview-3.0/language-specs
Each language file has a .lang extension and they are owned by root. So to edit these, I start by running the file manager as root. For example; on Raspbian or Lubuntu from a terminal:-
gksu pcmanfm
...then navigate to the languages-specs folder and open: vbnet.lang in gEdit
Now save this file with a new name: Picaxe.lang
Edit two lines:-
<language id="vbnet" _name="VB.NET" version="2.0" _section="Source">
...change to:-
<language id="picaxe" _name="PicAxe" version="2.0" _section="Source">
And:-
<context id="vbnet" class="no-spell-check">
...change to:-
<context id="picaxe" class="no-spell-check">
If you now close gEdit, then re-open it, you should see "Picaxe" in the Highlight Mode... list.
If you download LinAXEpad from the Picaxe download page, this includes a syntax file: PICAXE.XML. Unfortunately this is not in the required format, but I managed to copy all the keywords from the "commands" section, paste them into my new Picaxe.lang file, and edit the tags and other bits into the required format.
LinAXEpad on Linux
The official editor for Picaxe is AxePad. You can download the LinAXEpad version and use this on Linux x86 and x64 systems. I have installed it to take a look, but not really used it.
Some people on the net report stability issues, however I suspect that frequent upgrades of some Linux distributions (such as Ubuntu) may be at the root of some of these issues, because LinAXEpad just gets left behind.
To install on x86 systems, you should only need to follow the instructions from the Picaxe download page.
For my x64 laptop I also had to install x86 libraries:-
steve@steve-X401A1:~$ sudo apt-get install libgtk2.0-0:i386 libcairo2:i386 libpango1.0-0:i386 libgdk-pixbuf2.0-0:i386 libstdc++6:i386
If this doesn't work for you, take a look at the notes by xfred
However, the RaspberryPi is not a x86/x64 platform!
No comments:
Post a Comment