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

[coldsync-hackers] Fwd: potential method for automating conduit generation



	This was sent to me personally, but it seems like a good idea,
so I thought I'd share (forwarded with permission):

----- Forwarded message from Charles Lepple <clepple@ghz.cc> -----

Date: Sat, 13 Jul 2002 08:20:46 -0400
Subject: potential method for automating conduit generation
From: Charles Lepple <clepple@ghz.cc>

A little while back, I ran across a nice open-source gas mileage tracker 
that supports multiple cars (palmfuellog on SourceForge). Like most 
open-source Palm apps, it doesn't have a conduit. Although the data is 
stored in a relatively simple format, I was looking for a way to automate 
the conduit generation process.

Since most Palm apps use a struct for formatting records, I ran c2ph on 
the source code to try and extract the record stucture into a Perl object.
  The way I understand it, c2ph just parses the debugging info placed in 
the assembly code from the compiler (in order to generate the object 
definition), but it also appears to be choking on the link stage (which I 
didn't figure would be necessary).

Now, in this case, I could probably write the object myself with a little 
review of Perl OOP... however, I thought this would be a neat trick, if 
only it worked...

Anyway, I'm passing this along in case you want to try making it work. The 
full command line that got me the closest:

c2ph -d -t CC=m68k-palmos-gcc DEFINES="-I `pwd`" FuelLog.c

This is on Mac OS X, so I don't know if that's a potential source of 
weirdness. (Confession: I don't actually use coldsync anymore-- I only 
have USB on the G4, and Palm came out with a native OS X version of the 
desktop software, so I just use the p5 modules to yank data out of 
backed-up PDB files.)

--
Charles Lepple <clepple@ghz.cc>
http://www.ghz.cc/charles/

----- End forwarded message -----

	Obviously, this would only be a first cut. For instance, some
database formats use a list of C-style (NUL-terminated) strings, some
of which might be empty; others use an array of C-style strings to
store the nonempty fields, and use a bitfield to determine which
fields are in the array. Still others might use Pascal-style strings.
I don't see how an automatic tool could figure out how to parse a
record just from seeing how the data is laid out. But it could be a
useful first cut.

-- 
Andrew Arensburger                      This message *does* represent the
arensb@ooblick.com                      views of ooblick.com
			  We are everywhere.

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