On Mon, Jul 23 2012, craven@gmx.net wrote: > From: <craven@gmx.net> > > Currently there is no easy way to add support for different structured > formatters (like JSON). For example, adding support for S-Expressions > would result in code duplication. > > This patch series amends the situation by introducing structured > formatters, which allow different implementations of structures like > lists, maps, strings and numbers. LGTM Tomi > > The new code in sprinter.h and sprinter-json.c can be used instead of > the current ad-hoc output in all parts of notmuch, a patch for > notmuch-search.c is included. > > In a later patch, all other parts of notmuch should be adapted to the > structured formatters, and the creation of formatters should be > centralised (to make adding new formatters easier). > > A "structured" formatter is provided for notmuch-search that prints the > current text format. This removes almost all the special-casing from > notmuch-search.c. > > Changes versus v7 of this patch: > - added {} around "else" blocks (as mentioned in > id:20120722160843.GC31834@mit.edu) > - added fallback to INTERNAL_ERROR (which should never be called) in > notmuch-search.c if format is unknown (as mentioned in > id:m2r4s694ly.fsf@guru.guru-group.fi). > > Summary: > > Peter Feigl (3): > Add support for structured output formatters. > Add structured output formatter for JSON and plain text (but don't > use them yet). > Use the structured formatters in notmuch-search.c. > > Makefile.local | 2 + > notmuch-search.c | 304 ++++++++++++++--------------------------------- > sprinter-json.c | 187 +++++++++++++++++++++++++++++ > sprinter-text.c | 126 ++++++++++++++++++++ > sprinter.h | 68 +++++++++++ > test/json | 34 +++--- > 6 files changed, 489 insertions(+), 232 deletions(-) > create mode 100644 sprinter-json.c > create mode 100644 sprinter-text.c > create mode 100644 sprinter.h > > -- > 1.7.11.2 > > _______________________________________________ > notmuch mailing list > notmuch@notmuchmail.org > http://notmuchmail.org/mailman/listinfo/notmuch