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
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
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
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
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
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
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
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
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
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 +
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
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
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 |
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
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.
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.
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
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
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
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.
---
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
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
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
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:
/*
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
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
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
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
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
29 matches
Mail list logo