From: Austin Clements Date: Mon, 23 Jul 2012 13:48:30 +0000 (+2000) Subject: Re: [PATCH v8 0/3] notmuch-search: Structured Output Formatters X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=424097a10d1858dadade2b30a14d625d502613e7;p=notmuch-archives.git Re: [PATCH v8 0/3] notmuch-search: Structured Output Formatters --- diff --git a/9f/270f7706aa74e54c9f3e44a398c82aa9535a46 b/9f/270f7706aa74e54c9f3e44a398c82aa9535a46 new file mode 100644 index 000000000..5ce5702f5 --- /dev/null +++ b/9f/270f7706aa74e54c9f3e44a398c82aa9535a46 @@ -0,0 +1,127 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 41A5C431FB6 + for ; Mon, 23 Jul 2012 06:48:35 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.7 +X-Spam-Level: +X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id j1apbmqJ79fI for ; + Mon, 23 Jul 2012 06:48:34 -0700 (PDT) +Received: from dmz-mailsec-scanner-5.mit.edu (DMZ-MAILSEC-SCANNER-5.MIT.EDU + [18.7.68.34]) + by olra.theworths.org (Postfix) with ESMTP id 7F5DD431FAE + for ; Mon, 23 Jul 2012 06:48:34 -0700 (PDT) +X-AuditID: 12074422-b7f1f6d00000090b-b0-500d56312734 +Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) + by dmz-mailsec-scanner-5.mit.edu (Symantec Messaging Gateway) with SMTP + id 43.B3.02315.1365D005; Mon, 23 Jul 2012 09:48:33 -0400 (EDT) +Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) + by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q6NDmXJN004159; + Mon, 23 Jul 2012 09:48:33 -0400 +Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91]) + (authenticated bits=0) + (User authenticated as amdragon@ATHENA.MIT.EDU) + by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q6NDmVdF010846 + (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT); + Mon, 23 Jul 2012 09:48:32 -0400 (EDT) +Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77) + (envelope-from ) + id 1StIzu-0002CZ-U7; Mon, 23 Jul 2012 09:48:30 -0400 +Date: Mon, 23 Jul 2012 09:48:30 -0400 +From: Austin Clements +To: craven@gmx.net +Subject: Re: [PATCH v8 0/3] notmuch-search: Structured Output Formatters +Message-ID: <20120723134808.GF31834@mit.edu> +References: <1343039986-2732-1-git-send-email-craven@gmx.net> +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +Content-Disposition: inline +In-Reply-To: <1343039986-2732-1-git-send-email-craven@gmx.net> +User-Agent: Mutt/1.5.21 (2010-09-15) +X-Brightmail-Tracker: + H4sIAAAAAAAAA+NgFmphleLIzCtJLcpLzFFi42IR4hRV1jUM4w0weHDZ0mJvQzujxfWbM5kd + mDwWb9rP5vFs1S3mAKYoLpuU1JzMstQifbsErozLh5YwF1zhr/g47wZbA+MBni5GTg4JAROJ + +8dXsUHYYhIX7q0Hsrk4hAT2MUo8v/mMGcLZwCjxau4PFgjnJJPEvt/7WCGcJYwSy5e+ZALp + ZxFQlehf8grMZhPQkNi2fzkjiC0iICQx6csrFhCbWUBa4tvvZrAaYQEPiSfNz8HivAI6Egsm + zmQFsYUEbCX6vp5ghIgLSpyc+QSqV0vixj+QXRxgc5b/4wAJcwrYSTSt3MsMYosKqEhMObmN + bQKj0Cwk3bOQdM9C6F7AyLyKUTYlt0o3NzEzpzg1Wbc4OTEvL7VI11QvN7NELzWldBMjKLDZ + XZR2MP48qHSIUYCDUYmH17KKJ0CINbGsuDL3EKMkB5OSKG99KG+AEF9SfkplRmJxRnxRaU5q + 8SFGCQ5mJRHey9e5A4R4UxIrq1KL8mFS0hwsSuK811Ju+gsJpCeWpGanphakFsFkZTg4lCR4 + O0CGChalpqdWpGXmlCCkmTg4QYbzAA1fDVLDW1yQmFucmQ6RP8WoKCXOWwqSEABJZJTmwfXC + Es8rRnGgV4R5y0GqeIBJC677FdBgJqDB0llcIINLEhFSUg2MBf8vmRo7B/U+Xf7sot0xtvfK + n389W74x7mqRvmOEkm6u51HNv0LrD280te2U9rS7s+44268Fx7Jrg74zcSz7L6qSfXGzVfH3 + a99FWyIiNt1ijY877e7v6SJ3dUJZutOKXYcOLWoO+9oUJ6/56Zn4hMex2t9td1W4inr4imZP + +3A8uj7yqv9cJZbijERDLeai4kQAzTga7xcDAAA= +Cc: notmuch@notmuchmail.org +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 23 Jul 2012 13:48:35 -0000 + +LGTM + +Quoth craven@gmx.net on Jul 23 at 12:39 pm: +> From: +> +> 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 +>