Updated: 11/5/2005; 6:05:31 PM.
Chris Double's Radio Weblog
        

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      

© Copyright 2005 Chris Double.
 
March 2004
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31      
Feb   Apr



Click here to visit the Radio UserLand website.

Listed on BlogShares

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.