Received: from eggs.gnu.org ([140.186.70.92]:51896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RBRQo-0003vi-1S for qemu-devel@nongnu.org; Wed, 05 Oct 2011 09:22:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RBRQl-0001mQ-8L for qemu-devel@nongnu.org; Wed, 05 Oct 2011 09:22:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3414) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RBRQk-0001m1-IR for qemu-devel@nongnu.org; Wed, 05 Oct 2011 09:22:39 -0400 From: Luiz Capitulino Date: Wed, 5 Oct 2011 10:21:57 -0300 Message-Id: <1317820931-25872-13-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1317820931-25872-1-git-send-email-lcapitulino@redhat.com> References: <1317820931-25872-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 12/26] qapi: Automatically generate a _MAX value for enums List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: aliguori@us.ibm.com Cc: qemu-devel@nongnu.org It's the last value in the enum and is very useful for the C implementation. Signed-off-by: Luiz Capitulino --- scripts/qapi-types.py | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/scripts/qapi-types.py b/scripts/qapi-types.py index 3bacc0c..f64d84c 100644 --- a/scripts/qapi-types.py +++ b/scripts/qapi-types.py @@ -91,8 +91,11 @@ typedef enum %(name)s ''', name=name) + # append automatically generated _MAX value + enum_values = values + [ 'MAX' ] + i = 0 - for value in values: + for value in enum_values: enum_decl += mcgen(''' %(abbrev)s_%(value)s = %(i)d, ''', -- 1.7.7.rc0.72.g4b5ea