>From what I remember, tendra does something like what you want.  It's
been a while since I looked at it, though.

> Anyone know of some nice simple code to parse C prototype definitions
> and split them into nicely awk'able bits so I can generate stub functions:
> 
> I have been playing with mkptypes | awk which works well
> for simple stuff, say my source contains:
> 
>       void
>       func(int a, char *b)
> 
> 
> and I want to generate
> 
>       void
>       stub_func(int a, char *b)
>       {
>               func(a, b);
>       }
> 
> however when you get into
> 
>       int syspipe(int fd[2])
> 
> let alone
> 
>       int sysnotify(void (*func)(void*, char*))
> 
> it is starting to push at the limits of what awk is good for.
> 
> I guess I am looking for some yacc and lex which
> parses C and spits out somthing like this:
> 
>       func#a|int a#b|char *b
>       syspipe#fd|int fd[2]
>       sysnotify#func|void (*func)(void*, char*)
> 
> I understand knowledge of types is harder but if I use just basic types
> this sounds doable to me. Before I write it, does anyone seem such a beast?
> 
> -Steve
> 
-- 
John Stalker
School of Mathematics
Trinity College Dublin
tel +353 1 896 1983
fax +353 1 896 2282

Reply via email to