[Gs-devel] Summary of procedure commenting discussion (re ANSIf ication)

luke at research.canon.com.au luke at research.canon.com.au
Wed Nov 7 18:17:34 PST 2001

On  7 Nov, L. Peter Deutsch wrote:
>  Actually, that would be extremely cool.  (The tool would presumably find the 
>  procedure definition in a .c file and copy its parameter names into the 
>  prototype.)  Remember that for private procedures, the prototype (if any) 
>  and definition are in the same .c file; for almost all other procedures, the 
>  prototype is in a .h file and the definition in a .c file that #includes it, 
>  but occasionally there is an extern prototype in a .c file. 


>  I don't see how to do this for procedure-valued parameters or 
>  procedure-valued structure members without much more sophisticated analysis 
>  than an automated tool could reasonably be expected to do, so a tool that 
>  simply finds and lists the locations of prototypes without parameter names 
>  would still also be useful. 

Exactly.  It could do what it could, and avoid touching ones it
couldn't handle, e.g. leaving markers for a human to grep for and fix
up manually.

I've had a look for grammar based editors.  No joy.  And for C, the
pre-processor makes it hugely harder, unless you include its grammar
into the language too.

But wouldn't it be nice to be able to write regular expressions based on the
language tokens?  When you describe it that way, it sounds like something
amazingly useful.

Hmm, found Edgar, but it's very early development:


and http://www-2.cs.cmu.edu/~macgnome/ but it's Mac only.

My thoughts are that with an editor like this, one should be able to do
things like convert a while loop into a for loop, insert an extra
statement at the start of a set of all functions, etc. etc.  Re-write
all the old-style prototypes sucking up the parameter names and
outputting a new-style declaration.

Dream on, Luke!  Back to reality.


More information about the gs-devel mailing list