[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[coldsync-hackers] Scheme conduits



	Since Python conduits were brought up, I thought I'd mention that
I've started playing around with a Scheme wrapper for libpdb, with the
eventual end goal of making it easy to write conduits in Scheme. Perhaps
even adding a Guile interpreter to ColdSync itself, if there's interest
and people think it would be useful.

	I think I have a handle on the low-level programming aspect of it
(how to call C functions from Guile, how to manipulate Scheme objects in
C, etc.), and am more interested in opinions on what the API ought to look
like: how would you like to write Scheme code to implement a conduit, or
to manipulate PDBs?

	Since I'm currently working on a libpdb wrapper, my first thought
was just to make all of libpdb's functions available in Scheme. But that
would effectively force the user to write C code rather than Scheme.
	So now I'm thinking it would be better to just have a 'read-pdb'
function that uses libpdb's pdb_Read() function to read a PDB, then parse
it into a Scheme object (probably an alist of the form
	((name . "MemoDB")
	 (ctime . 1097166453)
	 (flags RECORD_DB READ_ONLY RESET_OK)
	 (appinfo . ...)
	 (records record0 record1 ...)
	 ...)
). A corresponding write-pdb function would parse the same sort of
structure, build a 'struct pdb' from it, and write it to a file.
	This way, the Scheme programmer would be free to manipulate the
PDB in any way he likes, rather than be forced to use a possibly clumsy
API to change the PDB.
	Since the pdb-Read function will only parse PDBs down to the
record level, additional modules will be necessary to further parse
records and appinfo blocks (something similar to the Perl modules). I'm
not sure what the best way to do this is, though.

	What about conduits? Will the Perl approach work well in Scheme,
or is there a better way to do it?

-- 
Andrew Arensburger                      Actually, these _do_ represent the
arensb@ooblick.com                      opinions of ooblick.com!
                        Generic Tagline V 6.01
This message was sent through the coldsync-hackers mailing list.  To remove
yourself from this mailing list, send a message to majordomo@thedotin.net
with the words "unsubscribe coldsync-hackers" in the message body.  For more
information on Coldsync, send mail to coldsync-hackers-owner@thedotin.net.