One of the pointless projects I've been working on is porting PHP's MySQL interface to Guile. There is already a MySQL interface for Guile: Guile-DBI. It has recently fallen into decadence and is being unoficially updated through a series of patches pushed to the guile-user mailing list. Typical Scheme story: the miniscule developer community can't keep up with the maintenence of packages. If I were a good community citizen, I'd be helping maintain the Guile-DBI package, but, since it doensn't really have a home on the web, I'm a bit leery of digging in.
Anyway, the great fun and challenge I've had in porting php_mysql.c over as a Guile library has been how to step through the debuggers. Since I want them to be essentially identical in functionality, I write short PHP and Guile scripts that should accomplish the same thing, and then step through, making sure that the are doing identical actions.
Debuggin PHP is largely written in C. But my Guile-MySQL library is mostly scheme with a very thin layer of C code mostly involved in directly calling MySQL C API functions.
On the PHP side, I compiled a CGI version of PHP with the debugging symbols in. I use libtool to call gdb on the cgi php and set my breakpoints to catch its entry into the php_mysql.c. Debugging is mostly occurs in GDB.
The trick on the scheme side is running scheme code in GDS in EMACS from within a libtool --mode=execute call to gdb.
It is turtles all the way down.
Thursday, November 06, 2008
Wednesday, October 22, 2008
Scheme/Guile Web Services
There are a few ways to call Guile webservices that I know.
The best library for helping to parse a CGI request is Guile-WWW.
There are a few ways to gracefully generate HTML from scheme.
There are a couple of ways to read information from the backend.
There are a couple of methods for on-the-fly plot generation.
- Any webserver can call a Guile script via CGI.
- mod-lisp can be used to pass CGI requests to an existing scheme process.
- Fastcgi could probably be used.
- serveez allows one to write generic servers in Guile.
- An all-scheme webservers is TTN's sizzweb. It descends from Martin Grabmueler's all-scheme webserver in his pers-scheme.
The best library for helping to parse a CGI request is Guile-WWW.
There are a few ways to gracefully generate HTML from scheme.
- Guile-lib has a copy of SSAX SXML, which can convert SXML to HTML.
- skribilo can convert from Skribe format to HTML.
There are a couple of ways to read information from the backend.
- mixp is an xml parser.
- Guile-lib, again, has a copy of SSAX SXML, which can parse XML.
- Guile-pg is a complete system for interfacing with PostgreSQL database
- guile-dbi is a simple system that interfaces with MySQL and Postgres
There are a couple of methods for on-the-fly plot generation.
Subscribe to:
Posts (Atom)