--- /dev/null
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by olra.theworths.org (Postfix) with ESMTP id CA81B431FC4\r
+ for <notmuch@notmuchmail.org>; Thu, 12 Jul 2012 15:08:17 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+ tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+ by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id 1UbJDQi0ahld for <notmuch@notmuchmail.org>;\r
+ Thu, 12 Jul 2012 15:08:16 -0700 (PDT)\r
+Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU\r
+ [18.7.68.34])\r
+ by olra.theworths.org (Postfix) with ESMTP id 61701431FAE\r
+ for <notmuch@notmuchmail.org>; Thu, 12 Jul 2012 15:08:16 -0700 (PDT)\r
+X-AuditID: 12074422-b7f1f6d00000090b-97-4fff4acfa785\r
+Received: from mailhub-auth-2.mit.edu ( [18.7.62.36])\r
+ by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP\r
+ id 3B.A7.02315.FCA4FFF4; Thu, 12 Jul 2012 18:08:15 -0400 (EDT)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+ by mailhub-auth-2.mit.edu (8.13.8/8.9.2) with ESMTP id q6CM8FcE024815; \r
+ Thu, 12 Jul 2012 18:08:15 -0400\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+ (authenticated bits=0)\r
+ (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+ by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q6CM8Ee2029131\r
+ (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+ Thu, 12 Jul 2012 18:08:14 -0400 (EDT)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
+ (envelope-from <amdragon@mit.edu>)\r
+ id 1SpRYU-0004sR-1R; Thu, 12 Jul 2012 18:08:14 -0400\r
+Date: Thu, 12 Jul 2012 18:08:14 -0400\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: craven@gmx.net\r
+Subject: Re: [PATCH v4 1/3] Add support for structured output formatters.\r
+Message-ID: <20120712220814.GJ7332@mit.edu>\r
+References: <87d34hsdx8.fsf@awakening.csail.mit.edu>\r
+ <1342079004-5300-1-git-send-email-craven@gmx.net>\r
+ <1342079004-5300-2-git-send-email-craven@gmx.net>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <1342079004-5300-2-git-send-email-craven@gmx.net>\r
+User-Agent: Mutt/1.5.21 (2010-09-15)\r
+X-Brightmail-Tracker:\r
+ H4sIAAAAAAAAA+NgFmplleLIzCtJLcpLzFFi42IRYrdT0T3v9d/fYPk6C4u9De2MFtdvzmR2\r
+ YPJYvGk/m8ezVbeYA5iiuGxSUnMyy1KL9O0SuDIebrjLVHBXpqLpwRzWBsZtYl2MnBwSAiYS\r
+ j491sEDYYhIX7q1n62Lk4hAS2McoceXcGlYIZwOjxLmvexghnJNMEk/bjzFDOEsYJZY3T2cE\r
+ 6WcRUJVY8X4DG4jNJqAhsW3/crC4iICQxKQvr8B2MAtIS3z73cwEYgsLeEqcOt0KFucV0JbY\r
+ vXgJC8TQOYwSEzsfsUIkBCVOznwC1awlcePfS6BmDrBBy/9xgIQ5BewkTk3/D7ZLVEBFYsrJ\r
+ bWwTGIVmIemehaR7FkL3AkbmVYyyKblVurmJmTnFqcm6xcmJeXmpRbqmermZJXqpKaWbGMGh\r
+ 7aK0g/HnQaVDjAIcjEo8vDvX/fUXYk0sK67MPcQoycGkJMpr7frfX4gvKT+lMiOxOCO+qDQn\r
+ tfgQowQHs5II7zp7oBxvSmJlVWpRPkxKmoNFSZz3WspNfyGB9MSS1OzU1ILUIpisDAeHkgTv\r
+ Fk+gRsGi1PTUirTMnBKENBMHJ8hwHqDhs0BqeIsLEnOLM9Mh8qcYFaXEeW+CJARAEhmleXC9\r
+ sNTzilEc6BVh3jsgVTzAtAXX/QpoMBPI4J//QAaXJCKkpBoYUw7cWa4gn3aZI7Ex6syqaVsU\r
+ php4lZYde5kuGenatdz0sYyQpVmQzqy22TM+ZbZFnjeI3r94Ddu9tef+f2C2n3Dr5+sf9RdN\r
+ bxS969q5/9qOWp8oGy3pFUzlsR+/hJ+4wrcyp0TjzPZL/NMEP0ce3xt4UOH+I5fQloIy3tRJ\r
+ 1rZrGmfoudfVKLEUZyQaajEXFScCAItFvqMYAwAA\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Thu, 12 Jul 2012 22:08:17 -0000\r
+\r
+Quoth craven@gmx.net on Jul 12 at 9:43 am:\r
+> This patch adds a new type sprinter_t, which is used for structured\r
+> formatting, e.g. JSON or S-Expressions. The structure printer is the\r
+> code from Austin Clements (id:87d34hsdx8.fsf@awakening.csail.mit.edu).\r
+> \r
+> The structure printer contains the following function pointers:\r
+> \r
+> /* start a new map/dictionary structure.\r
+> */\r
+> void (*begin_map) (struct sprinter *);\r
+> \r
+> /* start a new list/array structure\r
+> */\r
+> void (*begin_list) (struct sprinter *);\r
+> \r
+> /* end the last opened list or map structure\r
+> */\r
+> void (*end) (struct sprinter *);\r
+> \r
+> /* print one string/integer/boolean/null element (possibly inside a\r
+> * list or map\r
+> */\r
+> void (*string) (struct sprinter *, const char *);\r
+> void (*integer) (struct sprinter *, int);\r
+> void (*boolean) (struct sprinter *, notmuch_bool_t);\r
+> void (*null) (struct sprinter *);\r
+> \r
+> /* print the key of a map's key/value pair.\r
+> */\r
+> void (*map_key) (struct sprinter *, const char *);\r
+> \r
+> /* print a frame delimiter (such as a newline or extra whitespace)\r
+> */\r
+> void (*frame) (struct sprinter *);\r
+> \r
+> The printer can (and should) use internal state to insert delimiters and\r
+> syntax at the correct places.\r
+> \r
+> Example:\r
+> \r
+> format->begin_map(format);\r
+> format->map_key(format, "foo");\r
+> format->begin_list(format);\r
+> format->integer(format, 1);\r
+> format->integer(format, 2);\r
+> format->integer(format, 3);\r
+> format->end(format);\r
+> format->map_key(format, "bar");\r
+> format->begin_map(format);\r
+> format->map_key(format, "baaz");\r
+> format->string(format, "hello world");\r
+> format->end(format);\r
+> format->end(format);\r
+> \r
+> would output JSON as follows:\r
+> \r
+> {"foo": [1, 2, 3], "bar": { "baaz": "hello world"}}\r
+> ---\r
+> sprinter.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++++\r
+> 1 file changed, 49 insertions(+)\r
+> create mode 100644 sprinter.h\r
+> \r
+> diff --git a/sprinter.h b/sprinter.h\r
+> new file mode 100644\r
+> index 0000000..1dad9a0\r
+> --- /dev/null\r
+> +++ b/sprinter.h\r
+> @@ -0,0 +1,49 @@\r
+> +#ifndef NOTMUCH_SPRINTER_H\r
+> +#define NOTMUCH_SPRINTER_H\r
+> +\r
+> +/* for notmuch_bool_t */\r
+> +#include "notmuch-client.h"\r
+> +\r
+> +/* Structure printer interface */\r
+> +typedef struct sprinter\r
+> +{\r
+> + /* start a new map/dictionary structure.\r
+> + */\r
+> + void (*begin_map) (struct sprinter *);\r
+> +\r
+> + /* start a new list/array structure\r
+> + */\r
+> + void (*begin_list) (struct sprinter *);\r
+> +\r
+> + /* end the last opened list or map structure\r
+> + */\r
+> + void (*end) (struct sprinter *);\r
+> +\r
+> + /* print one string/integer/boolean/null element (possibly inside a\r
+> + * list or map\r
+> + */\r
+> + void (*string) (struct sprinter *, const char *);\r
+\r
+Oh, also, the documentation for string should mention the string\r
+argument should be UTF-8 encoded.\r
+\r
+> + void (*integer) (struct sprinter *, int);\r
+> + void (*boolean) (struct sprinter *, notmuch_bool_t);\r
+> + void (*null) (struct sprinter *);\r
+> +\r
+> + /* print the key of a map's key/value pair.\r
+> + */\r
+> + void (*map_key) (struct sprinter *, const char *);\r
+> +\r
+> + /* print a frame delimiter (such as a newline or extra whitespace)\r
+> + */\r
+> + void (*frame) (struct sprinter *);\r
+> +} sprinter_t;\r
+> +\r
+> +/* Create a new structure printer that emits JSON */\r
+> +struct sprinter *\r
+> +sprinter_json_new(const void *ctx, FILE *stream);\r
+> +\r
+> +/* A dummy structure printer that signifies that standard text output is\r
+> + * to be used instead of any structured format.\r
+> + */\r
+> +struct sprinter *\r
+> +sprinter_text;\r
+> +\r
+> +#endif // NOTMUCH_SPRINTER_H\r