Tuesday, August 28, 2007

Syx on NAS Linux

on the Syx mailing list, Brian Zhou notified about yet another Syx platform compatibility.

He said Syx worked on nslu2, on both unslung (armeb linux 2.4) and slugosbe
(armeb linux 2.6) firmware
Porting Smalltalk YX to these devices wasn't hard, in fact it doesn't need any specific patch to the sources.

Of course, would be a very good news if Syx is available in Optware.

Thanks to Brian Zhou and to everyone are currently working on Syx.


Monday, August 20, 2007

Syx 0.1.4 has been released

release notes follow.

A more stable VM has been reached with this version. Many features have been added for both the embedding and the environment. This version also includes the "image endianness compatibility" target of the 0.2 roadmap and a lot of wrapper methods for GTK+ with a basic GtkWorkspace.
This is the list of the major changes:
  • Running blocking processes inside the scheduler has been fixed
  • Major fixes to the garbage collector, object finalization, number parsing and to the scheduler
  • Rehashing support for hashed collections such as Dictinoary, Set and Bag
  • #perform: and #copyReplace family ANSI methods have been added
  • Interval and StdIOStream classes have been added
  • Missing lexer rules for quoted symbols and double quotes in strings have been added
  • ZeroDivide exception check for number division
  • Comparing methods to String have been added
  • A bunch of improvements for the SyxGtk plugin
  • Rehash dictionaries from C
  • Visual Studio compilation and debugging support
  • Useful functions for embedding Syx have been added
  • Reorganized inline functions to support other compilers and use dllexport and dllimport when building the library on Windows
  • Inheritance for method and block objects has been fixed
  • rootdir and plugindir Scons options have been added
  • Install dependent-machine object files into libdir instead of sharedir
  • Option -c has been added to syx to continue the startup sequence once filed in files from the command line
  • Support for big endian machines has been completed
  • System signal handling has been added
  • Print a bug report to the stdout on SIGSEGV or SIGILL containing informations on the memory state, the execution state and the traceback of the active broken Process
  • Image recovery on SIGSEGV and SIGILL or through the syx --recovery option
  • Scripting header (e.g. #!/usr/bin/env syx) support on fileIn
  • argumentCount check for methods and blocks has been introduced
  • Documentation installation and uninstallation is now supported
  • Support for 'a' and 'w+' mode with O_CREAT flag have been added to FileStream
  • Several issues have been fixed for packaging binary distributions of Syx using Scons
  • Getopt dependency has been removed
  • Desktop files for Posix systems have been added
Syx changed its logo since previous version. The Windows installer will handle .st and .sim files.
Roadmap for 0.5 version includes both internal and OS-level threads based schedulers, with possibly parallel computing support.

Thanks for all critiques and suggestions, and a special thank to everyone who's contributing to Syx.


Wednesday, August 15, 2007

Syx image recovering

lately Syx gained system signal handling. On Segmentation Violation or Illegal Instruction, a complete traceback of the execution state, the memory state and the active process contexts being entered is printed on stdout.

Sometimes, i had problems with Squeak while developing SqueakGtk, because i did interact with C and it was easy to get into an infinite loop or a segv.

In other words, sometimes these errors come just from one Process (in the above example, i'm talking about the Gtk main loop) that break things each time you start the same image.

In Syx, i managed to automatically create a copy of the image, appending the ".recover" extension, whenever SIGSEGV or SIGILL is signaled and then remove that broken Process from being scheduled.
Also, if this didn't work because the corruption involved the VM, you're still able to use the --recovery option from the command line.


Saturday, August 11, 2007

SyxGtk vs SqueakGtk

a friend requested me a screenshot of syxgtk, it's the first one here:

I would like to explain how the 'asd.st' script works:
1) Create the window, and connect buttons with something like button when:
#clicked send: self -> #onClicked
2) Gtk main
2.1) This forks a process that calls a primitive
2.1.1) The primitive create a thread in which gtk_main() will run
2.2) Semaphore new wait (won't never be signaled this semaphore, it's used
just to keep the process suspended so keeping Syx up if no other process
is running)
3) Suspend the current process. This because the console actually is in
blocking mode, so we need to suspend the process. There's a way to let the
console be asyncronous, already tested using Semaphores, but won't work
with readline (any suggestion here?)

Now, we connected signals to a special syxgtk marshaller, which does the
  • transform GValue to SyxOop
  • obtain the callback to call
  • create a new process
  • wait that process for being terminated (remember the callback is called within a OS thread)

These i think are pure Syx callbacks, really very easy to implement for
any other external loop.

How it differs from my old SqueakGtk? Just read:
  • each C call had one more redirection than in Syx, because in C calls using SWIG automatically handles self pointers by accessing instance variables
  • main loop had to be implemented in a Squeak-side method by doing the iteration manually
  • the marshaller had to forward its function to Squeak, because we can't convert from GValues to Squeak objects since we can't lookup classes
  • we save all that GValues in a special C-side stack
  • set the jump for future longjmp and call the interpreter
  • the main loop checks for callbacks, then obtain the list of arguments from that list of GValues and does its job
  • once returned from all callbacks, it's time to do the longjmp to return from the C callback

It was a pain, slow and moreover wasn't so safe to use setjmp/longjmp and a
stack of callbacks.


Wednesday, August 08, 2007

Example on how to embed Smalltalk YX

Smalltalk YX is born also to be a scripting language to embed in C/C++ applications. Lately, i was looking an article which briefly explains how to use Lua with C.

Then, i decided to remake that article for Syx, and this is the result:

The examples in the article above can be executed if you have an updated working copy of the source repository.

Other examples can be found here. Contact me if you want to contribute to this project.

Thanks to everyone, bye.

Monday, August 06, 2007

SWIG module for Syx

lately i've been trying SWIG to test how much it can be useful to interface Syx to C/C++ libraries.
I got a good starting point with a very simple module which wraps C declarations very well. For instance, i wrapped many Glib/Gtk includes entirely without any problem.

Since writing Smalltalk YX primitives is really easy, it wasn't a pain to create a SWIG module for it. In fact, today i wrapped almost all GtkLabel functions as well.

The module is still missing C++ wrapping methods and some other typemaps, but i hope it to be available very soon for normal usage.

If anyone wants to contribute to the Syx project, please let me know.

Stay tuned for the next release of Syx.