Tuesday, March 09, 2004


I've recently started using Chicken Scheme again, trying to get an onboard development environment for the Zaurus. One of the more recent additions to Chicken is the 'Easy Foreign Function Interface'. This enables you to embed C or C++ code inside your Scheme code and it gets converted to Scheme automatically. The example given in the manual uses Chicken Scheme to write a Qt application. The Qt classes get automatic wrappers generated using the object system (TinyClos). So the actual Scheme code looks like:
	(define a (apply make <QApplication> (receive (argc+argv))))
	(define hello (make <QPushButton> "hello world!" #f))
	(resize hello 100 30)
	(setMainWidget a hello)
	(show hello)
	(exec a)
	(destroy hello)
	(destroy a)

This works on both the Zaurus and the main PC.  The code that automatically generates wrappers looks like:
    #>?
    class QWidget 
    {
    public:
      void resize(int, int);
      void show();
    };
    
    class QApplication 
    {
    public:
      QApplication(int, char **);
      ~QApplication();
      void setMainWidget(QWidget *);
      void exec();
    };
    
    class QPushButton : public QWidget
    {
    public:
      QPushButton(char *, QWidget *);
      ~QPushButton();
    }
    <#

The #>? and #< are indicators that embedded C++ code follows.


1:30:09 PM    

One of the nice improvements in the latest pdaxrom is the battery applet reports a better indication of remaining battery time. In all prior ROM's for the Zaurus the applet only had 4 states: full, half, about to die, dead. This new rom reports at 1% intervals. Very nice.

1:03:50 PM