[PATCH v8 1/3] Add support for structured output formatters.

2012-07-23 Thread craven
From: cra...@gmx.net This patch adds a new struct type sprinter_t, which is used for structured formatting, e.g. JSON or S-Expressions. The structure printer is heavily based on code from Austin Clements (id:87d34hsdx8@awakening.csail.mit.edu). It includes the following functions: /*

[PATCH v8 2/3] Add structured output formatter for JSON and plain text (but don't use them yet).

2012-07-23 Thread craven
From: cra...@gmx.net Using the new structured printer support in sprinter.h, implement sprinter_json_create, which returns a new JSON structured output formatter. The formatter prints output similar to the existing JSON, but with differences in whitespace (mostly newlines, --output=summary prints

[PATCH v8 0/3] notmuch-search: Structured Output Formatters

2012-07-23 Thread craven
From: cra...@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

[PATCH v8 3/3] Use the structured formatters in notmuch-search.c.

2012-07-23 Thread craven
From: cra...@gmx.net This patch switches from the current ad-hoc printer to the structured formatters in sprinter.h, sprinter-text.c and sprinter-json.c. The JSON tests are changed slightly in order to make them PASS for the new structured output formatter. The text tests pass without

notmuch-reply: Structured Formatters

2012-07-20 Thread craven
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

[PATCH v7 3/3] Use the structured formatters in notmuch-search.c.

2012-07-20 Thread craven
From: cra...@gmx.net This patch switches from the current ad-hoc printer to the structured formatters in sprinter.h, sprinter-text.c and sprinter-json.c. The JSON tests are changed slightly in order to make them PASS for the new structured output formatter. The text tests pass without

[PATCH v7 2/3] Add structured output formatter for JSON and plain text (but don't use them yet).

2012-07-20 Thread craven
From: cra...@gmx.net Using the new structured printer support in sprinter.h, implement sprinter_json_create, which returns a new JSON structured output formatter. The formatter prints output similar to the existing JSON, but with differences in whitespace (mostly newlines, --output=summary prints

[PATCH v7 1/3] Add support for structured output formatters.

2012-07-20 Thread craven
From: cra...@gmx.net This patch adds a new struct type sprinter_t, which is used for structured formatting, e.g. JSON or S-Expressions. The structure printer is heavily based on code from Austin Clements (id:87d34hsdx8@awakening.csail.mit.edu). It includes the following functions: /*

[PATCH v7 3/3] Use the structured formatters in notmuch-search.c.

2012-07-20 Thread craven
From: cra...@gmx.net This patch switches from the current ad-hoc printer to the structured formatters in sprinter.h, sprinter-text.c and sprinter-json.c. The JSON tests are changed slightly in order to make them PASS for the new structured output formatter. The text tests pass without

Re: [PATCH v7 1/3] Add support for structured output formatters.

2012-07-20 Thread craven
I presume the patch 3/3 emails id:1342766173-1344-4-git-send-email-cra...@gmx.net id:1342772624-23329-1-git-send-email-cra...@gmx.net have identical content ? Yes, they do, there was a problem with the Content-Type header having ^P^P, so I re-sent correctly, but the actual e-mail content

[PATCH v6 0/3] notmuch-reply: Structured Formatters

2012-07-17 Thread craven
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

[PATCH v6 2/3] Add structured output formatter for JSON and plain text.

2012-07-17 Thread craven
Using the new structured printer support in sprinter.h, implement sprinter_json_create, which returns a new JSON structured output formatter. The formatter prints output similar to the existing JSON, but with differences in whitespace (mostly newlines, --output=summary prints the entire message

[PATCH v6 1/3] Add support for structured output formatters.

2012-07-17 Thread craven
This patch adds a new struct type sprinter_t, which is used for structured formatting, e.g. JSON or S-Expressions. The structure printer is heavily based on code from Austin Clements (id:87d34hsdx8@awakening.csail.mit.edu). It includes the following functions: /* Start a new

[PATCH v6 3/3] Use the structured formatters in notmuch-search.c.

2012-07-17 Thread craven
This patch switches from the current ad-hoc printer to the structured formatters in sprinter.h, sprinter-text-search.c and sprinter-json.c. The JSON tests are changed slightly in order to make them PASS for the new structured output formatter. The text tests pass without adaptation. ---

Re: Proof of concept: S-Expression format

2012-07-13 Thread craven
This patch shows how to add a new output format to notmuch-search.c. As an example, it adds S-Expressions. The concrete formatting can easily be changed, this is meant as a proof of concept that the changes to core notmuch code are very few and all formatting state is kept inside sprinter-sexp.c.

Structured Formatters for JSON Output

2012-07-12 Thread craven
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

[PATCH v4 3/3] Use the structured format printer for JSON in notmuch search.

2012-07-12 Thread craven
This patch switches from the current ad-hoc printer to the structured output formatter in sprinter.h. It removes search_format_t, replaces it by sprinter_t and inlines the text printer where necessary. The tests are changed (only whitespaces and regular expressions) in order to make them PASS

[PATCH v4 2/3] Add structured output formatter for JSON.

2012-07-12 Thread craven
Using the new structured printer support in sprinter.h, implement sprinter_json_new, which returns a new JSON structured output formatter. The formatter prints output similar to the existing JSON, but with differences in whitespace (mostly newlines). --- Makefile.local | 1 + sprinter.c |

[PATCH v4 1/3] Add support for structured output formatters.

2012-07-12 Thread craven
This patch adds a new type sprinter_t, which is used for structured formatting, e.g. JSON or S-Expressions. The structure printer is the code from Austin Clements (id:87d34hsdx8@awakening.csail.mit.edu). The structure printer contains the following function pointers: /* start a new

Re: [PATCH v4 1/3] Add support for structured output formatters.

2012-07-12 Thread craven
what is the advantage of having this as one function rather than end_map and end_list? Indeed, my choice (but I think most other people would disagree) would be to have both functions but still keep state as this currently does and then throw an error if the code closes the wrong thing.

[PATCH v3 3/3] Use the JSON structure printer in notmuch-search.

2012-07-11 Thread craven
This patch uses the JSON structure printer for notmuch search. The changes necessary for switching to the structure printer are minor, a large part of this patch is concerned with keeping the normal unstructured text output. --- notmuch-search.c | 278

[PATCH v3 0/3] Structured Formatters

2012-07-11 Thread craven
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

[PATCH v3 1/3] Add support for structured output formatters.

2012-07-11 Thread craven
This patch adds a new type structure_printer, which is used for structured formatting, e.g. JSON or S-Expressions. The structure contains the following function pointers: - initial_state: is called to create a state object, that is passed to all invocations. This should be used to keep track

[PATCH v3 2/3] Adding a structured formatter for JSON.

2012-07-11 Thread craven
This patch adds a structured formatter that prints exactly the same JSON as the built-in JSON printer. All tests pass without change. Notice that this formatter could be simpler by changing the whitespace and line-breaks in the generated JSON. --- Makefile.local | 1 +

[PATCH] Added better support for multiple structured output formats.

2012-07-10 Thread craven
As discussed in id:20120121220407.gk16...@mit.edu, this patch adds support for new structured output formats (like s-expressions) by using stateful structure_printers. An implementation of the JSON structure printer that passes all tests is included. Structure printers have functions for starting

[PATCH] FIXED: Added better support for multiple structured output formats.

2012-07-10 Thread craven
Sorry, the original patch I sent was missing a small part, here the full patch: As discussed in id:20120121220407.gk16...@mit.edu, this patch adds support for new structured output formats (like s-expressions) by using stateful structure_printers. An implementation of the JSON structure printer

[PATCH] v2: Added better support for multiple structured output formats.

2012-07-10 Thread craven
As discussed in id:20120121220407.gk16...@mit.edu, this patch adds support for new structured output formats (like s-expressions) by using stateful structure_printers. An implementation of the JSON structure printer that passes all tests is included. The output for JSON (and text) is identical to

[PATCH v3 1/3] Add support for structured output formatters.

2012-07-10 Thread craven
This patch adds a new type structure_printer, which is used for structured formatting, e.g. JSON or S-Expressions. The structure contains the following function pointers: - initial_state: is called to create a state object, that is passed to all invocations. This should be used to keep track

[PATCH v3 2/3] Adding structured output formatter for JSON.

2012-07-10 Thread craven
This formatter prints exactly the same structure as the existing JSON formatter, but uses the newly introduced structured formatting primitives. --- structured-output.c | 159 +++ structured-output.h | 48 2 files changed, 207

[PATCH v3 3/3] Use the structured format printer in notmuch search.

2012-07-10 Thread craven
This patch uses the previously introduced structured format printer in notmuch-search. Most of this patch is necessary to keep the text output unchanged. All tests pass, both text and JSON are printed exactly the same as they were before. --- notmuch-search.c | 275