Friday, May 23, 2008

Syx, GTK+ and threading

Hello,
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'!
true
> | 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

Hello,
I report the post on the mailing list below:

Hello,
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.
Bye.

EDIT:
The Smalltalk reference will be created automatically from Smalltalk itself.

Tuesday, April 22, 2008

Time for Debian

Hello,
I switched to Debian lately and i think it will become my preferred distribution.
I started with Slackware, then an LFS and then Gentoo. I never found them definitive for me.

I used Slackware by compiling sources most of all, then i didn't see any reason to continue using it.

The LFS came since my new PC as a test, and as long I could maintain it I had no problems and had fun with it.

I then installed Gentoo when i got my first DSL. But the updates are slow for lack of testing, I'm on an amd64. I tried to contribute someway but for the time I've been using it I never seen a open and innovative development (not in the sense that it wasn't friendly). And also, I've seen many developers leaving the project.

In other words, I "almost" used always source-based distribution. All the time I tried other binary-based distribution also to change my way of linux-life, like OpenSUSE, Ubuntu, Kubuntu, Foresight, and so on but no one satisfied me.

Then i wanted to try Debian, hoping it was different than Ubuntu. And in fact it is!
What I like of Debian is it's very high QA, how new users deal with bugs, how stable it is, how the BTS work, how the packaging works (eventough there are lots of useful tools I still don't know), the rapid updates, the security.

The thing I dislike from other distribution is that they release new stable versions but that are not so stable at first. For example i had troubles with the package manager with both Ubuntu and Foresight. Boot problems with Ubuntu, several crashes with Foresight, and so on.

But, I don't want to say Debian is now my preferred distro (I'm still afraid of binaries), but this is the good way and hopefully the last choice. Go Debian!

Tuesday, April 15, 2008

Smalltalk YX toward a new interpreter

Hello,
Smalltalk YX is currently working on refactoring a part of the interpreter, relative to contexts and stack management.
The current version uses one stack per process but always create contexts for each method or block entered.
The new branch, called newinterp, won't create those contexts anymore but they will be created only on-demand (e.g. thisContext). This means both less resources and garbage collector usage, and a possible speedup.

More informations on the mailing list here.

Monday, January 07, 2008

Smalltalk YX 0.1.6 has been released

Hello,
as usual these release notes follows.

This is a major bug fixes release, but introduce as usual many features. First of all this release put the GNU build (autotools) as first build system, and SCons as secondary which is still useful for MingW and the WinCE port.

  • Full GNU build support
  • X11 plugin
  • A basic CommandLine class for parsing the command line
  • Basic support for handling foreign C pointers and structs/unions from Smalltalk has been added
  • Several fixes for building on Sparc 64 using SCons
  • The -e option from command line has been added
  • Some help and Syx status will be printed in console mode
  • FileStream fileIn has been fixed
  • Class declaration from Smalltalk has been fixed
  • Lexer fixes for symbols, identifier and strings
  • FileStream now handles FILE* instead of file descriptors and this fixed several bugs
  • System startup has been fixed when fileing in files
  • Dictionary rehashing has been fixed
  • Basic support for handling foreign C structs and unions from Smalltalk has been added

Thanks to everyone contributing to the project.

See the ChangeLog for a complete list of things that changed.

Saturday, January 05, 2008

Google search? No thanks, Yahoo!

Hello,


lately I've been searching for "maemo emulator" and "mod_python psp" and the results weren't good to me.


If you don't trust, try the above searches (without double quotes) with both Google and Yahoo. This happens with many more searches.


In my opinion, Google lately is lacking a good page weight system and therefore it breaks results showing for example mailing lists instead of more important web pages.


Conclusion? I'm using Yahoo! as my default search engine until Google fixes these troubles.

Tuesday, December 25, 2007

Monday, December 17, 2007

Hello world in console and GTK+

Hello,
lately i received a request to show how to print Hello world from Syx and a small example on how to open a GTK+ window.

Here are the two examples:
Have fun!

Friday, December 14, 2007

Syx 0.1.5 has been released

Hello,
after a few months of low activity due to the university, i finally released the new version of Syx. Release notes follows.

This version includes yet more features, compatibility with other build systems on different platforms, important bug fixes and a great performance boost, which will be continued in next releases. A list of the major changes:

  • MSVC support has been improved
  • ANSI C and strict ISO compilation
  • External declarations for C++
  • The ST runtime compiler has been replaced with a C-side compiler
  • Class creation issues from ST has been fixed
  • Tracebacks and error reporting have been improved
  • Install desktop files on GNU/Linux platforms
  • Support for the GNU building system has been added as an alternative to SCons
  • Build under MSYS has been fixed
  • Block ensuring has been fixed
  • New examples have been added such as web code browser and a simple GTK+ application
  • Dictionary rehashing has been fixed
  • A better implentation of OrderedCollection? has been enhanced
  • Internal profiling and gprof support at compile-time
  • Created one stack per process against one stack per context

This version breaks the API for creating new processes and contexts from C and ST too. Thanks for anyone who contributed to Syx.

Tuesday, November 20, 2007

Finally ADSL then Gentoo

Hello,


i was a strong Linux From Scratch user since years.


My small city didn't have ADSL until now. ADSL came here with the Wireless technology.


OK, I've a low 256kb but it's better than a 56k, don't you think so? Then i started getting gentoo and compiling everything, and now I've got a complete Gnome desktop with all network working as well.


Yes, my first ADSL, my first distro!

Thursday, November 01, 2007

Syx to run code browser over CGI

Hello,
lately Dominic Letz in the Syx mailing list showed his simple version of a code browser for Syx for CGI. It has been added in the examples if you want to try it on your web server.

You can find an online working version on its site: http://dominicletz.de/cgi-bin/syx
You can also view the source code from the SVN repository: http://syx.googlecode.com/svn/trunk/examples/web/

Currently i'm not working on Syx so much because of lack of time, but remember the project is not dead and won't be.
Stay tuned, a new release of Syx is coming.

Thanks to everyone.

Saturday, October 13, 2007

Syx architecture

Hello,
did you forget Syx already?
After many months of inactivity (that will continue unfortunately) due to my lack of time, i created two images that briefly explains how the initialization and the scheduler of Smalltalk YX work.

The initialization is explained here: http://code.google.com/p/syx/wiki/InitArch
The scheduler here: http://code.google.com/p/syx/wiki/SchedulerArch

I hope to obtain more time to spend on Syx, i won't leave the project anyway.

Bye.

Tuesday, August 28, 2007

Syx on NAS Linux

Hello,
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.

Bye.

Monday, August 20, 2007

Syx 0.1.4 has been released

Hello,
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.

Bye.

Wednesday, August 15, 2007

Syx image recovering

Hello,
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.

Bye.

Saturday, August 11, 2007

SyxGtk vs SqueakGtk

Hello,
a friend requested me a screenshot of syxgtk, it's the first one here:
http://code.google.com/p/syx/wiki/ScreenShots.

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
following:
  • 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.

Bye.

Wednesday, August 08, 2007

Example on how to embed Smalltalk YX

Hello,
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:
http://code.google.com/p/syx/wiki/ExampleEmbeddingLua

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

Hello,
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.
Bye!

Monday, July 30, 2007

Syx 0.1.3 has been released

Hello,
this new release of Smalltalk YX adds yet more support for other platforms (Windows CE), a bunch of bug fixes, and many features like the ST compiler. This is a list of what changed since previous release:
  • Fractions, division methods and some other match functions (floor, ceiling, quo, trunc, ...) have been added
  • Some lexer issues (quotes, minus, ...) have been fixed
  • Fixed garbage collection while finalizing objects
  • Many ANSI methods for Character have been covered
  • First attempt to reach endianness image compatibility
  • String to Number methods and viceversa have been added
  • Super messages have been fixed
  • Syntax shortucts such as Object>>#caseOf:otherwise: have been added
  • Fixed cascading parsing
  • A complete Smalltalk compiler has been added
  • Support for cross-compiling and with more options have been added to Scons
  • Save text of methods
  • Increased initial memory size from 20000 objects to 100000 objects
  • More C functions have been documented
  • An important issue in ArrayedCollection?>>#replace:From:To:With: primitive has been fixed
  • Access mode (read, write, read and write) to Streams and more methods to FileStreams? have been added
  • CompiledMethod? and CompiledBlock? inheritance has been reorganized
  • Run Smalltalk scripts from command line
  • New plugin to wrap native Win API to create a simple WinWorkspace
  • Build Syx for Windows CE with WinWorkspace running on the device
  • Support for user-defined startup sequence has been added
  • Support for wide-character strings has been added
  • getopt, errno, fstat, access, getenv and perror are now optional functions

Cross-compiling to Windows CE has been done with host=arm-wince-mingw32ce using CeGCC by disabling all configuration options. Endianness compatibility is not perfectly reached yet.

See the ChangeLog for a complete list of things that changed.

Sunday, July 29, 2007

Smalltalk YX to run on PocketPC

Hello,
Smalltalk YX is known to work on many platforms at this time. However, lately i've been working to port it on PocketPC with a small graphical workspace.
It took me about 3 days of work but now it works very well. Cross compilation has been easily done using CeGCC on Windows with just some changes in the VM.

The only problem is that Syx needs to be installed into the root device to work, it's not working in other directories, but i think this is the last problem to care about.

A plugin has been added, called WinWorkspace, which is a native Windows GUI containing a text box for both the input and the Transcript, and a DoIt button to evaluate the code. This plugin also works on Win32.
I think Syx can be easily ported to Smartphone as well without many changes.

Here you can find some screenshots: http://code.google.com/p/syx/wiki/ScreenShots

Stay tuned with the next 0.1.3 release, bye.