unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH v8 0/3] notmuch-search: Structured Output Formatters
@ 2012-07-23 10:39 craven
  2012-07-23 10:39 ` [PATCH v8 1/3] Add support for structured output formatters craven
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: craven @ 2012-07-23 10:39 UTC (permalink / raw)
  To: notmuch

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.

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-07-24 12:34 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-23 10:39 [PATCH v8 0/3] notmuch-search: Structured Output Formatters craven
2012-07-23 10:39 ` [PATCH v8 1/3] Add support for structured output formatters craven
2012-07-23 10:39 ` [PATCH v8 2/3] Add structured output formatter for JSON and plain text (but don't use them yet) craven
2012-07-23 10:39 ` [PATCH v8 3/3] Use the structured formatters in notmuch-search.c craven
2012-07-23 13:48 ` [PATCH v8 0/3] notmuch-search: Structured Output Formatters Austin Clements
2012-07-23 13:54 ` Tomi Ollila
2012-07-24 12:34 ` David Bremner

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).