From e03e5386be9f56ba25f62db84fdd1adb90230ee6 Mon Sep 17 00:00:00 2001 From: Tomi Ollila Date: Mon, 23 Jul 2012 16:54:14 +0300 Subject: [PATCH] Re: [PATCH v8 0/3] notmuch-search: Structured Output Formatters --- 52/9fd72dc3c7bd7b75eeef83954b70745126edd3 | 111 ++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 52/9fd72dc3c7bd7b75eeef83954b70745126edd3 diff --git a/52/9fd72dc3c7bd7b75eeef83954b70745126edd3 b/52/9fd72dc3c7bd7b75eeef83954b70745126edd3 new file mode 100644 index 000000000..119ba06f9 --- /dev/null +++ b/52/9fd72dc3c7bd7b75eeef83954b70745126edd3 @@ -0,0 +1,111 @@ +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 0EEBD431FB6 + for ; Mon, 23 Jul 2012 06:54:17 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] + 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 EEWYekEHKuiS for ; + Mon, 23 Jul 2012 06:54:05 -0700 (PDT) +Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) + by olra.theworths.org (Postfix) with ESMTP id 6293B431FAE + for ; Mon, 23 Jul 2012 06:54:05 -0700 (PDT) +Received: by guru.guru-group.fi (Postfix, from userid 501) + id 7D57F1000E5; Mon, 23 Jul 2012 16:54:14 +0300 (EEST) +From: Tomi Ollila +To: craven@gmx.net, notmuch@notmuchmail.org +Subject: Re: [PATCH v8 0/3] notmuch-search: Structured Output Formatters +In-Reply-To: <1343039986-2732-1-git-send-email-craven@gmx.net> +References: <1343039986-2732-1-git-send-email-craven@gmx.net> +User-Agent: Notmuch/0.13.2+93~ge4fdd97 (http://notmuchmail.org) Emacs/23.1.1 + (x86_64-redhat-linux-gnu) +X-Face: HhBM'cA~ +MIME-Version: 1.0 +Content-Type: text/plain; charset=us-ascii +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:54:17 -0000 + +On Mon, Jul 23 2012, craven@gmx.net wrote: + +> 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. + +LGTM + +Tomi + +> +> 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 +> +> _______________________________________________ +> notmuch mailing list +> notmuch@notmuchmail.org +> http://notmuchmail.org/mailman/listinfo/notmuch -- 2.26.2