On 05/26/11 18:42, Colomban Wendling wrote:
Just for 5 minutes of Python fun, the guard generation would be better
with something like this:
'H_' + ''.join([c if c in 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789' else
'_' for c in '{filename}'.upper().rstrip('.H')])
advantages:
* handles any character in the filename (most importantly dashes)
* use H_ as a prefix rather than a suffix, to avoid possible name
clashes with error codes (theoretically all uppercase names starting
with E[A-Z] are reserved for them)
Meh. A filename choice of 'esrc.h', 'enetunreac.h', 'ehostunreac.h',
etc may provide an entertaining debugging session for the coder
unfortunate enough to use those filenames :)
If you feel strongly against what's on the wiki though, there's always
an 'Edit This Page' button, where you can change it :)
PS: I'm not sure that this kind of wiki pages are the best, a more
generic stuff would perhaps be better if we end up with many snippets
examples, suggestions and stuff. I mean, a page that gives general
explanation, and an hostile snippets list, maybe with some notes.
I think it may save some reading time to the user wanting more than one.
The only reason I made a separate page for 'Library Headers' was because
it was a 20-ish line snippet condensed onto one line and I thought it
needed more explanation and a screenshot.
That being said, as above, use the 'Edit this Page' button if you want
to shuffle stuff around and/or remove superfluous text or whatever.
PPS: maybe we should add some possibilities to support this with file
templates, maybe providing {NORMALIZED_FILENAME} to allow guards generation?
I'm not sure how that would work with file templates, since the 'real'
filename is unknown at the time it's created, unless I misunderstand.
Maybe better would be to make a litte Add-on plugin: 'Insert Header' or
similar.
Cheers,
Matthew Brush
_______________________________________________
Geany mailing list
[email protected]
https://lists.uvena.de/cgi-bin/mailman/listinfo/geany