From patchwork Tue Aug 17 05:42:05 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Lacombe X-Patchwork-Id: 119863 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o7H5jZRv015683 for ; Tue, 17 Aug 2010 05:47:23 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751413Ab0HQFrX (ORCPT ); Tue, 17 Aug 2010 01:47:23 -0400 Received: from mail-yw0-f46.google.com ([209.85.213.46]:62271 "EHLO mail-yw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751057Ab0HQFrX (ORCPT ); Tue, 17 Aug 2010 01:47:23 -0400 Received: by ywh1 with SMTP id 1so2243931ywh.19 for ; Mon, 16 Aug 2010 22:47:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=/u9jUInENs1e1nEOn6+59Cf9oiRnNBbWdd+WLAKdIj8=; b=xOeoroo+eRRvuKgmYnB96PwVdpL06jwuubLPiIsLKQBDegUJjyvxu+ccfTBQ9eseOF AHlAkz8s5O8yLIQBXJYaJYmVN4J1Z76Qi9LOLlr7kx5upAWf0guZd9jYAUDP/HiJuFZ6 LlamjzUJP+Jd3dDcebQkauWIcaHk/ElmnvrdM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=XcveABcgtm29gPMfcjM+RGW8nRG7bGsKI0t71jWUGRFYOTNkuWCu5aUBV6L3iTy1Vv mcs2l46v8faY8itABm69frW1bfcKQJCvLheirUKkv56lyxoCo0yxxa3dU1RoUTTC2Vg0 JBdsyFTm/ndaLCZxRRAkfUWBxvyjqxswH/qOY= Received: by 10.100.56.5 with SMTP id e5mr6954701ana.262.1282024042340; Mon, 16 Aug 2010 22:47:22 -0700 (PDT) Received: from localhost.localdomain (206-248-183-141.dsl.teksavvy.com [206.248.183.141]) by mx.google.com with ESMTPS id 14sm11638807ant.21.2010.08.16.22.47.20 (version=SSLv3 cipher=RC4-MD5); Mon, 16 Aug 2010 22:47:21 -0700 (PDT) From: Arnaud Lacombe To: Sam Ravnborg , Michal Marek Cc: linux-kbuild , Arnaud Lacombe Subject: [PATCH] kbuild: implement the `mainmenu' directive Date: Tue, 17 Aug 2010 01:42:05 -0400 Message-Id: <1282023725-20428-1-git-send-email-lacombar@gmail.com> X-Mailer: git-send-email 1.7.2.30.gc37d7.dirty In-Reply-To: References: Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 17 Aug 2010 05:47:24 +0000 (UTC) diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index bdf71bd..f00854f 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -94,6 +94,8 @@ static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) void kconfig_load(void); /* menu.c */ +void mainmenu_set_prompt(char *); +const char *mainmenu_get_prompt(void); void _menu_init(void); void menu_warn(struct menu *menu, const char *fmt, ...); struct menu *menu_add_menu(void); diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 4fb5902..6aa219e 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -38,6 +38,29 @@ static void prop_warn(struct property *prop, const char *fmt, ...) va_end(ap); } +static const char *mainmenu_prompt = NULL; + +void mainmenu_set_prompt(char *prompt) +{ + if (mainmenu_prompt != NULL) + fprintf(stderr, "%s:%d:warning: mainmenu redefined\n", + current_file->name, zconf_lineno()); + + if (isspace(*prompt)) { + fprintf(stderr, "%s:%d:warning: leading whitespace ignored\n", + current_file->name, zconf_lineno()); + while (isspace(*prompt)) + prompt++; + } + + mainmenu_prompt = prompt; +} + +const char *mainmenu_get_prompt(void) +{ + return mainmenu_prompt; +} + void _menu_init(void) { current_entry = current_menu = &rootmenu; diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 23dfd3b..18c9a28 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y @@ -111,7 +111,7 @@ stmt_list: | stmt_list common_stmt | stmt_list choice_stmt | stmt_list menu_stmt - | stmt_list T_MAINMENU prompt nl + | stmt_list mainmenu_stmt | stmt_list end { zconf_error("unexpected end statement"); } | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); } | stmt_list option_name error T_EOL @@ -342,6 +342,13 @@ if_block: | if_block choice_stmt ; +/* mainmenu entry */ + +mainmenu_stmt: T_MAINMENU prompt nl +{ + mainmenu_set_prompt($2); +}; + /* menu entry */ menu: T_MENU prompt T_EOL