On 17.11.2011 20:40, Georg Baum wrote:
Uwe Stöhr wrote:
The attached patch adds support for the template "chess", "Gnumeric" and
"PDFPages".
I had to introduce a trick to overcome MSVC's limitation of 128 else-if
statements per routine. OK with it?
I like the principal idea (splitting parse_text() into smaller pieces), but
I don't like the way you do it, because the same limit will be quickly hit
again. I would propose something different: Move similar stuff into own
functions, e.g. all the font stuff (from textrm to noun could go into a bool
parse_font(), and then it would look like
... else if (t.cs() == "listof") {
...
} else if parse_font(...) {
;
} else if (t.cs() == "lyxadded" ...
The grouping of similar stuff would also increase the readability. Other
candidates would be parse_specialchar(), parse_quotes etc. You only need to
be careful with the order (the current order of if-statements is partly
arbitrary, but partly needed exactly like that).
Georg
Isn't there a better C/C++ way of solving this? For instance, couldn't it
somehow be 'transformed' into a switch/case statement?
Peter