Hi Andy,

On Sun, Oct 24, 2010 at 10:30:19AM +0800, Andy Stewart wrote:
> BTW, do you have special tool scan those automatically? ;p
> I use regexp search and check in GTK+ documentation. 

Unfortunately not really.

I play with Haskell trying to better understand it. I've used
TagSoup for a signicifcant time and read some stuff about how
great parsec is. So I hacked a system which:

0) parce hierarchy.list and C Objects hierarchy [0] to get a list
   of non-floating objects.

[0]: http://library.gnome.org/devel/gtk/2.22/ch01.html

1) parse C2HS files. But I don't know anything about
   lexing/parsing and I've settled with a small program which
   slices source files by paragraphs (useful with the Haskell
   indented syntax since you get the whole function body)

2) use Text.Regex.Posix.String to search for "mkNonFloatingObject"
   (well `find "foo" . words . lines` was not working on trailing
   parenthesis ')' ,-)

3) Use parsec3 to extract the C function name from
    "{#call [unsafe] [pure] gtk_foobar_get#}

4) use TagSoup to fetch the corresponding C documentation

5) prompt the user to replace by wrap/make/construct

(1) and (3) use Parsec3. It takes me a long time to get something
working. Spending almost 2 days to get a result similar to what I
could do in 2 hour of Perl :(

Worse, the C documentation was not enough to guess what to do
(replacing by wrap or not?), hence the manual action in (5).
(well honestly, it might have be possible to automate the cases
where [transfer XXX] was specified in the doc)

So basically, the only advantage of this Frankenstein monster, is
the ability to display side by side the body of the Haskell
function and the corresponding C documentation. It still takes
hours to check the hundreds of functions.

Ah yes, and running this monster eat 500Mo of memory, worried
about memory leaks ? :p

regards,
/John

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Gtk2hs-devel mailing list
Gtk2hs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gtk2hs-devel

Reply via email to