On Mon, Jun 09, 2008 at 08:13:11PM +0200, david ingamells wrote: > > > It looks to me like you're proposing something larger than indent itself! > I can't see anyone taking up the challenge, however if they do I'd suggest > that they write an independent program to generate the indent command line > from a given source file.
I don't think it would be that hard. I haven't looked at the indent source, but it seems it must include a C parser that is at least complex enough to understand what a function looks like, where a block of code that needs to be indented starts and ends, and things like that. All this new feature would require would be to keep track of whitespace in the input as well, which indent already seems to do a little bit of, at least WRT newlines. For example, when indent comes across, say, a comment in the input, it must be smart enough to know how much to indent it based on the value of the -c option. All it would need to do to fill this value in itself is see how far it is already indented in the mimicked input. Replace "look up value of -c and output indented comment" with "check consistency with existing value of -c if any, and set value of -c." I haven't gone through every option in the man page and thought about how to implement it, but skimming through them it seems they mostly fit the approach above. It would be a bit of grunt work, but not hard, and certainly not doubling the size of indent. This would require far too much duplication to justify a separate program, and would also require maintenance to be kept up-to-date with indent. _______________________________________________ bug-indent mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-indent
