Hallo, Hans-Christoph Steiner hat gesagt: // Hans-Christoph Steiner wrote:
So... Frank... feel like writing some fearsome regex for this? Let's see what cases I can come up with:
Well, as those are from different packages using different idioms, several regexps would be the easiest. In Pd itself everything is done the same way.
This is my format:
PACKAGE: HELP FILE NAME SETHELPSYMBOL
ext13: *.pd class_sethelpsymbol(*_class, gensym("*"));
replace 'class_sethelpsymbol(*_class, gensym("' with for example 'class_sethelpsymbol(*_class, gensym("help-' to add "help-" It's not really hard.
ggee: *.pd (no class_sethelpsymbol)
Uses the default, so nothing to do.
maxlib: help-*.pd #ifndef MAXLIB class_sethelpsymbol(*_class, gensym("help-*.pd")); #else class_sethelpsymbol(*_class, gensym("maxlib/help-*.pd")); #endif
This is tricky at a first look. But basically it also just is: s/(class_sethelpsymbol.*?)help-*.pd/$1*.pd/ or similar.
To append "-help" to the end of the file use:
$ perl -pi.bak -e 's/(class_sethelpsymbol.*?)help-*.pd/$1*-help.pd/' maxlib/*.c
This is a bit naive in that it assumes that the help-symbol definition is on one line. It's too late here to think about how to do multiline regexps. You probably just have to search for a closing brace.
unauthorized: help-*.pd class_sethelpsymbol(*_class, gensym("help-*.pd"));
See maxlib.
zexy: *.pd class_sethelpsymbol(*_class, gensym("zexy/*"));
See maxlib.
There are other cases, but that's just what I came up with quickly.
I think, external packages should be fixed by the maintainers. If there is a consensus, things should be rather easy to adapt.
ciao