Vala and Genie programming

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#16 Post by Lobster »

but a request
:) Will try and bear that in mind.
I quite often miss posts, lose threads (and my mind on special occasions) etc.

Shadow my programming buddy was very impressed with Genie
(as usual he had mastered and gone beyond what I could do in aprox 10 minutes)
I too like it and want to get the IDE working or linking it to the Glade system in the devxx

If we adopt what is in effect 3 languages (the Python like Genie, the C++ like Vala and of course C) all interlinked with a potential IDE and mashable
Add the odd bit of Bash script, we really have something with vast potential.
The generation of C code in particular makes us more processor independent as the ARM chip is likely to increase in importance as phone and netbooks begin to merge . . .
(am I ranting again)

Anyway what I would like to suggest is (this is up to Barry too)
we create the future tutorials here
http://puppylinux.org/ (oh boy that is down - but the wiki section)
or on the old wiki

or even a page here:
http://tmxxine.com/wik/wikka.php?wakka=LinuxTmxxine10
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

MUguest
Posts: 73
Joined: Sat 09 Dec 2006, 16:40

#17 Post by MUguest »

Here is a new PET of the Valaide.
It includes in an own subfolder /usr/local/glib2.18/ some newer systemlibraries.

They do NOT replace Puppys files, so there is no danger to corrupt something.
These files are only needed for the IDE, not for Vala itself.

http://dotpups.de/puppy4/dotpups/Programming/Vala/

Problem description:
The IDE depends on libgio.so.
But this was not built for Puppys Glib 2.14.2, but is part of newer versions of Glib.
So despite the IDE starts with libgio.so from Muggins, it crashes soon, as Puppys glib is too old.
So I now added a newer glib and Gtk (only what was needed, not the full stuff).
As Puppy could break compatibility with other programs, if we would replace existing files, I include them from the seperate folder.
They will be used automatically by "validestart" or by running the IDE from the menu.

Note: the IDE does not have a grafical designer.
To use Glade, we need to create an example project, that is able to use Glade XML files.
It seems that the IDE itself was created using Glade, so it should be not too difficult.
I will have a look when I find some time.

Mark

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#18 Post by Lobster »

Valide is working fine in 4.2 rc3 :)
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#19 Post by Lobster »

:oops: just found out that the official Genie site is editable
Just register . . .

http://live.gnome.org/Genie

What requirements are needed to make Geany (our text editor)
have support for Genie? (I should know this)
Last edited by Lobster on Mon 16 Mar 2009, 15:31, edited 1 time in total.
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

MUguest
Posts: 73
Joined: Sat 09 Dec 2006, 16:40

#20 Post by MUguest »

I attach a Glade example.
I created it from:
http://live.gnome.org/Vala/GladeSample

I had to add some changes, to be able to use it in the IDE.
I attach a screenshot, that makes it easier to understand the following text.


Extract the attached archive to your valide project-folder.

Then set up the IDE preferences, so that you see the filebrowser in the left panel.
(you must click on the small folder there, to see it).

Also set up the IDE, to see the bottom area, where you get info about compilation, and see output from your testprograms.

Doubleclick main.vala, to open it in the inbuilt editor.
Also doubleclick gladesample.glade, to see it.

In addition, open gladesample.glade in Glade.

To be able to compile, I had to modifiy Glade1/Glade1.vide.
I added these lines:

Code: Select all

<pkg>libglade-2.0</pkg>
<pkg>gmodule</pkg>
This simulates the compileroptions from the original example.

I also created a new project in Glade.
A window with two buttons.
I had to set the window to "visible".
And I had to set three custom signalhandlers, when you click on the buttons, or close the window.

When you compile and execute the example, you will not see anything in the area at bottom of the IDE, until you close the examplewindow.
Then the messages appear, that show, which button was clicked.

Mark
Attachments
glade1.jpg
(137.77 KiB) Downloaded 1705 times

DMcCunney
Posts: 889
Joined: Tue 03 Feb 2009, 00:45

#21 Post by DMcCunney »

Lobster wrote:What requirements are needed to make Genie (our text editor)
You mean Geany...
have support for Genie? (I should know this)
Define "support".

Geany is one of a number of editors based on Neil Hodgson's Scintilla edit control. For a probably incomplete list, see http://texteditors.org/cgi-bin/wiki.pl? ... itorFamily

Scintilla provides syntax highlighting and code folding for supported languages. To add support for a language, you need to create a lexer for Scintilla, which describes the structure and syntax of the language. You can find instructions on doing that here: [url]http://www.scintilla.org/Lexer.txt[/quote]

Once lexers are created, you ought to be able to use Geany to create/edit genie/vala code, and use the IDE features to build your projects. IDE support for things like automatically displaying the results when your code is compiled and run may be another matter. I haven't looked into Geany enough to say.

Geany also lacks scripting support. That's not part of Scintilla. It's available in some other Scintilla based editors, like ScTE, which uses Lua as the script language.
______
Dennis

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#22 Post by MU »

I uploaded a slightly hacked IDE.

http://dotpups.de/puppy4/dotpups/Progra ... enie-test/

It can compile the Genie *.gs files.
As by default, it creates *.vala files, you must create a empty .gs by hand, and then add it to an existing project.
You then can delete the generated main.vala.

I also uploaded the file I patched, project.vala.
Find the two patches by searching for "//MU".


Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#23 Post by Lobster »

Define "support".
You just did - many thanks.
Enrico, the Geany developer (thanks for spelling info my spelling is
atros . . . atrocu . . . bad!) is on this forum.
So hopefully he will offer support if he hears about Genie/Vala . . .

Hey Mark will try your modified IDE next :)
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#24 Post by Lobster »

Mark I installed it once and could not get it working (Valide loaded but I was unable to compile - due to not following your instructions fully)
Tried again and got this even after deleting and uninstalling old version . . . so will have to reinstall - which might take a while . . .
There was an error expanding package valide-0.4-1-i686-Genie-4.tar.gz.
Either the file is corrupted, or has not expanded into its own directory with
name of valide-0.4-1-i686-Genie-4/ (which is how most packages expand).
You will have to go into /root/.packages/ directory and manually clean it up.

This script will now exit...
Last edited by Lobster on Sat 02 May 2009, 13:55, edited 1 time in total.
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#25 Post by MU »

might be a broken download.
I just downloaded and installed it at home in NYP, this works.
So the file is not corrupt.
Please try to download again.
Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#26 Post by MU »

Like this you quickly can test it:

create a new Project.
I created one called "Genie", Gtk.
So I have /root/valide/Genie/

When it finished, exit the IDE.
Rename with your filemanager:

/root/valide/Genie/main.vala
to:
/root/valide/Genie/main.gs

Start the IDE again, and open your project.
Now right-click main.vala, and choose "add".
There add "main.gs".
And delete "main.vala" with a rightclick.
It still is listed, as you just renamed it, but it still is shown, as the IDE uses a internal filelist, to manage projects.
At this point, the IDE crashes.
It still is somewhat buggy :(

But if you open again now your project, you can enter Genie code in main.gs, and "save - compile - execute".

This example works:

Code: Select all

[indent=2]

init

  var a = "test"
  print("%s" , a)

Version 0.4 was released on march, 10th, so I hope that soon bugfixes will be added.
We should inform the developer of the IDE about this thread.
I think it might be pretty motivating to see people using it :)
Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

DMcCunney
Posts: 889
Joined: Tue 03 Feb 2009, 00:45

#27 Post by DMcCunney »

Lobster wrote:
Define "support".
You just did - many thanks.
Enrico, the Geany developer (thanks for spelling info my spelling is
atros . . . atrocu . . . bad!) is on this forum.
So hopefully he will offer support if he hears about Genie/Vala . . .
Er. you're asking him to create Scintilla lexers for Genie/Vala for use in Geany?

Generally speaking, authors of editors based on Scintilla don't write lexers for specific languages. Users who program in those languages and need support for them do. The user understands the syntax and structure of the language, since they code in it. The author of the editor may not have heard of the language.

If you need lexers for Geany and Vala, that might be something you should take a crack at doing.

A SciTE variant called SciTE-st includes a Vala lexer, but it's written in Lua, and can't just be dropped into Geany. (SciTE-st includes Lua as an embedded script language.)

Go here: http://caladbolg.net/scite_st.php

Versions for Windows and Linux are available.
______
Dennis

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#28 Post by Lobster »

This example works:
Hi Mark
Managed to get it working - almost . . .
Followed everything as you suggested but that compiling part does not seem to be doing anything - sometimes I get an error message that the program is already running but I see nothing.

left this out and tried it with tabs - no luck
.

Code: Select all

[indent=2]
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#29 Post by MU »

Lobster, be certain to activate "view - bottom view".
That displays the internal console, where the messages from your program are printed.

Sidenote:
the forum is extremely slow, so I also will be in the #puppylinux IRC chat, maybe we can find a solution there quicker than here :)

Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#30 Post by MU »

there also should be created a executable by compiling your application.
And be sure, to save, before you compile (other IDEs like Eclipse remind you, if the file changes, Valide does not, so you must remember to save. I forget this sometimes).

You also can test/use the generated executable outside of the IDE, like this (maybe the path is different for you, if you saved to a different folder):

cd /root/valide/Genie
./Genie


Or:
/root/valide/Genie/Genie

Mark
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#31 Post by Lobster »

MU wrote:Lobster, be certain to activate "view - bottom view".
That displays the internal console, where the messages from your program are printed.
Thank goodness there are smart people guiding the idiot cructaceans . . .
That did it
Works fine :D
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#32 Post by Lobster »

Mark are you more inclined to use Vala
because of your java experience? 8)
I am more inclined to Genie . . .

The reason I ask is because if we have a list
of reserved words for Genie that might be a way for the programmers of
Valide to provide some colour coding
and support both languages?
I believe this exists for Vala but not Genie?
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#33 Post by MU »

No, I like both.
Vala is more like C/Java, Genie like Basic.

I concentrate on vala, because there is more documentation.
So to get startet, I tried vala, then I can try to port the programs to Genie.

Concerning Syntax-highlighting, I think further modifications of the IDE would be required.
I hesitate to mess around in foreign code.
I would suggest, that you contact the author:
http://code.google.com/p/valide/
http://valaide.blogspot.com/

I think it would be better, if you do it, not me.
I already have this "tunnel-view", so would not see requirements for beginners.
So I think you could suggest more "basic" issues, that would have priority at the current state.
---------------------------------------------------
I attach a new example.
This was a "pain in the *", it took a whole day, to find out, how it works.

It is an extended version of the Glade example now written in Genie.
During compilation you get a warning, but you can ignore it.

I added two helper functions, that allow to set values like a buttontext on the Window, that was generated from the gladesample.glade.

If you use other widgets, you had to add corresponding helperfunctions, but they are very simple.
Make a copy of "get_button", and rename "button" to the type of widget, that you need to access.

Unlike C, vala/genie does not allow Widget-conversion.
This will not work:

Code: Select all

GtkWidget *w;
w=glade_xml_get_widget(xml, "button1");
Gtk_button_set_label(GTK_BUTTON(w) , "testtext");
This is not possible:
GTK_BUTTON(w)

The new helperfunctions work around that issue.

Mark
Attachments
gladegs.jpg
buttons change size and text, if you click on them.
(16.91 KiB) Downloaded 2572 times
[url=http://murga-linux.com/puppy/viewtopic.php?p=173456#173456]my recommended links[/url]

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#34 Post by Lobster »

I already have this "tunnel-view", so would not see requirements for beginners.
OK I am in a strange place (quite usual for me)
I could not drag .gs files into an editor or open them in a text editor

the only command that worked was

Code: Select all

cat v1.gs
from the terminal . . .

So I am in the process of reinstalling genie
and getting it to work from the command line again . . .
in a new run of Puppy (setting puppy up was easy)

I have no idea what or how I broke things . . .
downloading every stray pet under the sun and
wearing no tin hat might be part of it ;)

Is anyone else playing with genie?
What ya doing? :)
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

User avatar
Lobster
Official Crustacean
Posts: 15522
Joined: Wed 04 May 2005, 06:06
Location: Paradox Realm
Contact:

#35 Post by Lobster »

I would suggest, that you contact the author:
Hey Mark
I wrote to the author:
Barry Kauler (creator of Puppy Linux) is adopting Vala/Genie
http://puppylinux.com/genie/

and MU one of our top coders is exploring and adapting
Valide to run Genie

Is Genie support and colour syntax coding planned for future valide releases?
with a link to this forum
and have got 'Geni(e)de' working again

Now to try your GTK example . ..
Puppy Raspup 8.2Final 8)
Puppy Links Page http://www.smokey01.com/bruceb/puppy.html :D

Post Reply