> Enclosed are my efforts to unify the escaped-sequence functions in out.c > (a2roffdeco()) and mandoc.c (mandoc_special()). > > This handles, as far as I can see, all syntaxes of the groff(7) escapes. > > When called during libmandoc validation, it will check for GLYPH_ERROR > and be followed by a search-and-replace of ASCII_HYPH for `-' in the > substring. When invoked from term.c or html.c, it will switch on the > returned type and substring value. > > This will clear up a nice big chunk of code, but it's a pretty delicate > area, so please look it over! > > If you compile this file, you can test escapes by running, e.g., > > % ./a.out s+\'\(\\f\[asdf\]\)\'123 > > to see the values of "start" and "end". Step 2. This finishes off the new escape-sequence parser and puts it into mandoc_escape (mandoc.c, mandoc.h), then makes it the underlying engine for a2roffdeco (out.c) (requiring a tiny change to term.c and html.c for bailing out on bad sequences) and roff_res (roff.c). Now all escape-sequences are being parsed with the same engine! This logic was being repeated in THREE different places, earlier (mandoc.c for validation, out.c for output, and roff.c for predefined escapes). I've run this over all manuals I know of without problems, but it can really use a close look-over with border cases. The next step is to clean out the out.c code, completely removing enum roffdeco (putting that logic into mandoc.c, perhaps). Thoughts? Kristaps