Friday, May 23, 2008

Syx, GTK+ and threading

you all know that Gtk+ has locks for the GUI when dealing with the X server and prevent async events to be sent. This is done by manually acquiring/releasing the lock on Gdk. Many Gtk+ ports don't do this automatically.

Syx used gtk_main() into a thread and automatically put gdk enter/leave for each function in its wrapper. It would be somewhat ugly in Smalltalk code having to enter/leave each time.
Of course, on Windows everything leads to troubles with threads.

But Smalltalk has Processes, handled by an internal scheduler. I decided then to not create a thread but cycle through Gtk+ events in the scheduler itself. Now everything works correctly.

Difference with other wrappers? The way Smalltalk is thought let you perform multi-tasking without the need to use OS threads, which means no problems on Windows and no need to take care of the Gdk lock everytime.

In addition, I rewrote part of the Console (Smalltalk-side) to be asyncronous using Semaphores. Now you can work on widgets after you run Gtk main! A small example:

Smalltalk YX 0.1.7 is ready.
Type "help!" to get help.
> Smalltalk loadPlugin: 'gtk'!
> | w |
> w := GtkWindow new.
> Gtk main.
> w add: (GtkLabel new: 'hello').
> w showAll!
a GtkWindow
You can imagine the result ;)
If you want to try it out you can download the scheduler branch snapshot.

Stay tuned for next 0.1.7 release.

Friday, May 02, 2008

Syx Manual

I report the post on the mailing list below:

with the next release 0.1.7, once I get a working interpreter and updated all the parts of Syx,
I will move output of doxygen to doc/reference and start a texinfo manual in doc/manual.

My idea is to have this kind of manual:
1) What is Smalltalk
2) Why Smalltalk YX
3) Introduction to the language
4) Introduction the Syx environment
5) COMPLETE Class and methods documentation, EACH non private method will be documented with examples
and EACH class will have usage examples
6) Embedding
7) Advanced topics, internal documentation

I know it's not the time yet for Smalltalk YX to get such documentation but I think it will be
a nice boost for the project and also for the entire Smalltalk community.
Since I don't have such fantasy now I will start directly with all except the 5th topic.

Any hint will be appreciated.

The Smalltalk reference will be created automatically from Smalltalk itself.