From patchwork Mon May 6 14:45:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Seiderer X-Patchwork-Id: 1932043 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VY43L3hz2z1xnT for ; Tue, 7 May 2024 00:46:06 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id C46EE608A6; Mon, 6 May 2024 14:46:04 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id dR5KXEiawWWa; Mon, 6 May 2024 14:46:03 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 15DB3608B1 Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 15DB3608B1; Mon, 6 May 2024 14:46:03 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 478E61BF59D for ; Mon, 6 May 2024 14:46:00 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id A344381B01 for ; Mon, 6 May 2024 14:45:59 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id JnNyB0E6fXUY for ; Mon, 6 May 2024 14:45:59 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=212.227.15.18; helo=mout.gmx.net; envelope-from=ps.report@gmx.net; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 6539E81E07 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 6539E81E07 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by smtp1.osuosl.org (Postfix) with ESMTPS id 6539E81E07 for ; Mon, 6 May 2024 14:45:57 +0000 (UTC) X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from localhost.fritz.box ([82.135.81.65]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MvsEn-1swVOd0YkR-00sxsz for ; Mon, 06 May 2024 16:45:56 +0200 To: buildroot@busybox.net Date: Mon, 6 May 2024 16:45:44 +0200 Message-ID: <20240506144555.31709-2-ps.report@gmx.net> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240506144555.31709-1-ps.report@gmx.net> References: <20240506144555.31709-1-ps.report@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:iHTssDnghNCB7SoKU9MdKCxLQr6RTb2CjGdyORqFrSNwooBdT7q sesGNV26Sb4ztcAyVzI6spaeUadPuJqNg51/wwlFPwkOtr6LlI2HFogJUj6zPyP3RO2Tccg Kbcd1UKr8goGt4nDgi7hFhuT3LqytPy43xgELVvyQwA1hhdCXNUHkdPLd1wxorEomV53YkF ryKDNS86HkjyRTZnpoFtw== UI-OutboundReport: notjunk:1;M01:P0:AyUwe6QRKOQ=;QqWe0p7VEfQFBDxtRCjJZi1q4u9 pK8KbJStUJAO1jksVJuPP6QS3W5QkSPZoBYCciROrZahgELGbRiN5cf5/cV1+5Bm90EZjMJQj JQdifCQsrbNQONhtsie21YLACNwR11usrwJJR+MS3KpMsG8p3ofd3QSvzxj7Xjk5KKlL9Qcbt fzcgaTc1ZaOSDFgv+neWdtlKRL+teadjnVBYvu4bfGImA+KGKexnuKAhdRbabfDVa3F/5KEMY KTwsJUpWgTfPp2EHgrV0Ljwm5Ec8p3Sgb5rjGsFAMbaP1q6Qtww2KWxh81nXcySJaJxG3wJJ4 zdnOblapcyqHAWzdtzffNgTI1NKNFpC68kdE47jIJ5a9L7xPXZ3JByr6YujzNQ39g1juQGhb6 NllBVWjaMzUsmQ0v47Zi+X+kKpzj9Fx/KJeIyEfscAphIS5YhmReuVhewZBev/hQUUP46jYu4 tFiwPQB5AL8uytZRZcHSf+PClpmRs1cDNgCSSyGn1qtjT5w+/1kgFRVFExmwoIELbI2BXr64U LBH2i3QgJkPcxe5F/scqkGnk9Km46G55X0Oce6yCj4YkMjDFoBYg5ZZ6YAKqywFFmtSqVpSy8 S2kjSWQ3NgyeT258HUyy3/IKOJwjilbTh/qzqPgLfQhRuv3FJvxJsQB3YJ5B0v0oow/F+RaXL MjGrg7h8nk8W4SZmIjrJydyihVLT5r7C0KdqqBvx57DbVUgioRMaVGZOOCYPkPQBi6H1Hjgcq uyl9h/yoGU1VrE8JQnptRg3mpB+a4141+PyAU44BdVjiFmwHEB+ZGguydmGSP/cHDpifEtfdK A3bEbAt13hk4bvVGFHXvznzEyEk8DzoJbOcb05tgYhsvA= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1715006756; x=1715611556; i=ps.report@gmx.net; bh=80rSJ4wR4mCWetfDsIYIfKlIHdyow4gJWEku34WVukU=; h=X-UI-Sender-Class:From:To:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=AYETiSc8qWjyjr1y3tKMmL7ood6j+DIUgICb8ObBGyEAPO1tl2TQBSqR8htR1N1N xlLTMuphJD4aN5dCBV9IPlnktv4hUGLIcWVzhH/A1U69/tE04xmHrSbllpdxNUAki X2GhpJuPoIUeGTUtQaSmGa8npc+B5eYR/4C592YsHU54jFgGGD/hjNtOVXh6x4TQ8 2jfqfjNSeIeVo6CMntTxiXT862USUhLR8vdhvZjVsg0TEIzqNL8kk2L4NGIYDiRoF /JGZSjNmlM1DMkdEmU50TqMLb9Q8gC6+aQRkZgz7U6MmEZEpTCzG5m3bAV1A39FJO xx6kElU8AQD3RbdyvA== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.net X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=gmx.net header.i=ps.report@gmx.net header.a=rsa-sha256 header.s=s31663417 header.b=AYETiSc8 Subject: [Buildroot] [PATCH v1 1/8] boot/barebox/Config.in: source argument needs quotation marks X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Peter Seiderer via buildroot From: Peter Seiderer Reply-To: Peter Seiderer Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Fixes the following error/warnings with kconfig from linux-6.9-rc5: boot/barebox/Config.in:79: syntax error boot/barebox/Config.in:79:warning: ignoring unsupported character '/' boot/barebox/Config.in:79:warning: ignoring unsupported character '/' boot/barebox/Config.in:79:warning: ignoring unsupported character '/' boot/barebox/Config.in:79:warning: ignoring unsupported character '.' boot/barebox/Config.in:79: invalid statement boot/barebox/Config.in:93: syntax error boot/barebox/Config.in:93:warning: ignoring unsupported character '/' boot/barebox/Config.in:93:warning: ignoring unsupported character '/' boot/barebox/Config.in:93:warning: ignoring unsupported character '/' boot/barebox/Config.in:93:warning: ignoring unsupported character '.' boot/barebox/Config.in:93: invalid statement Signed-off-by: Peter Seiderer --- boot/barebox/Config.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/boot/barebox/Config.in b/boot/barebox/Config.in index dba4a1a8d6..0bd3386795 100644 --- a/boot/barebox/Config.in +++ b/boot/barebox/Config.in @@ -76,7 +76,7 @@ config BR2_TARGET_BAREBOX_CUSTOM_GIT_VERSION endif -source boot/barebox/barebox/Config.in +source "boot/barebox/barebox/Config.in" menuconfig BR2_TARGET_BAREBOX_AUX bool "Build barebox with an auxiliary config" @@ -90,7 +90,7 @@ menuconfig BR2_TARGET_BAREBOX_AUX if BR2_TARGET_BAREBOX_AUX -source boot/barebox/barebox-aux/Config.in +source "boot/barebox/barebox-aux/Config.in" endif From patchwork Mon May 6 14:45:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Seiderer X-Patchwork-Id: 1932045 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VY43T4X8jz1xnT for ; Tue, 7 May 2024 00:46:13 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id D377C608D1; Mon, 6 May 2024 14:46:11 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 647b-iUAPG6Y; Mon, 6 May 2024 14:46:10 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org BC886608DA Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id BC886608DA; Mon, 6 May 2024 14:46:09 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 54BF11BF59D for ; Mon, 6 May 2024 14:46:02 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 343C08202C for ; Mon, 6 May 2024 14:46:00 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id ckvZg8dfrhYL for ; Mon, 6 May 2024 14:45:59 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=212.227.15.18; helo=mout.gmx.net; envelope-from=ps.report@gmx.net; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 5CDA481DEA DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 5CDA481DEA Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by smtp1.osuosl.org (Postfix) with ESMTPS id 5CDA481DEA for ; Mon, 6 May 2024 14:45:57 +0000 (UTC) X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from localhost.fritz.box ([82.135.81.65]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MeU4s-1se9IW0vZc-00aTAE for ; Mon, 06 May 2024 16:45:56 +0200 To: buildroot@busybox.net Date: Mon, 6 May 2024 16:45:45 +0200 Message-ID: <20240506144555.31709-3-ps.report@gmx.net> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240506144555.31709-1-ps.report@gmx.net> References: <20240506144555.31709-1-ps.report@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:SSLeaJ4AT8m2MY+jbpHKT7U92CyVlWZBjRCwhliXIwfnzht/Thp XOunkpLmWpGzk00qprQ8EtWS+W1uchPFuYO7skY+yIDqBW1OE5tuO6c8jqJExGaHm5ehfAU gSbKVfx+1qjP/wvx8U/D5OeB1ZR3vixjAP31idOg2ykLIF68x26stjlzNXES9ZHNgv4vDdy 2G4FvhA+49gvdiOC00jjA== UI-OutboundReport: notjunk:1;M01:P0:DU0XXKi77i4=;Lwwp1tK0MXal40uocGOSwtpRNdj h1IJnhieFrSvQrFYDYRgq2kBseDwVyNB2I8W05y3AW5ATmQ/VuKVdaTaPdikvhZPzeTGcX39j x8yYqnRyPZmIDRa08y4J6ADvNt5A66nQad3I94rMpxOSWEJlyc543tQW20ackyVrmG2FaHJes QBo2XY2Ai3At8uKejK1oHxQ8EUClPBMhuIM3Llm0Ma3U+x9Vgr1JlA5Av3OfgiTwXy5OvP2yX jnlqQ4CCrOtHv6AbMqB9aIjWwrcrRWzurRpJF/V5j9dn/vPoRz0Y1X8/YMihylS62T9C5sP3u Xf9y+MjArj2R052Xhznjho6l+FdMAgBG1qxaZ/04GNy1P3Taegm20yPA8po2iiPP/C405JB2+ TpxUfHYBAl6gTCaD+g/ZEVj5tHVD3XgOsJkn9Axe7uK2sxPGS9bXZuqEgFyhVtHBx8Z5Zq23F 0bPCbLG2S44yY/XsE/MtPJQrOgMGw3Ps2GfX8vWe1vT7wNqMfPq1gtKQBpWtj6M2xJvfI40rw 541ELK/t2EfZAaxJExw6pjfbEwB9dYnbmyfgQim8gm4s4lmf8e6F4YMw+FzBuBoK7wWpnNTYc Yfp2KiqBrVCK8YZ5jHTrdxrwCBiMxLG43IY7NAMtvmNEaV+VTioucsF1nMgZ8yU8n4FPfVyLo ZSYAMZQXhl4xlPWxNg1kHLawy6BfoNnhYrQmEGj8RzeMo7pwoBe0vzyYIXKpPPucTBq9JCPQz uux/5+NacDpnaLIsLoD9C7hkOAC9GhH7qKFOIYm7QaIMz4JQf40bGTmoUAGrZZLhyzOxVNHNY Z7JldEU41RQHUyKwURM3pZ9C6S8ENWFuH5AxblNIEPuw4= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1715006756; x=1715611556; i=ps.report@gmx.net; bh=V9McQtN0hTEeX8a4JMWo0hgcw5XPKcoz1SUAPcz8qBE=; h=X-UI-Sender-Class:From:To:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=eqbZ2Asjo85s9j+EiNG66YInSNHeHJPj9bp64pgtJXZ2c7TN3//oPzP10kMSyO7q ZiXE4RwkVOQk2qrP5qlB4+0TGxy4Mt3qlpfowm44lIuDaB8pVHo1jgIGEHUDZIfnw t4UqC4/N/CshAaxPfobLmivgwpbasqbCOJ5ujsZdkpg9eXeHeAdAVWtQzmS4hjwo5 RE1/+Q7N9PG1TUk8dD3PS39MFhxE6UP+sNBn1s2e512fkuaHFJekEI+lcrG50JnNX Jhy/EXokIY9AcF6Q4eSFnQqBQDrx2FIbqZP0MIN7yVltwgB07QjUa+yGvQEHKqgIE EyLD/4DaZA5qZDr8AA== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.net X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=gmx.net header.i=ps.report@gmx.net header.a=rsa-sha256 header.s=s31663417 header.b=eqbZ2Asj Subject: [Buildroot] [PATCH v1 2/8] package/cmocka/Config.in: bool argument needs quotation marks X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Peter Seiderer via buildroot From: Peter Seiderer Reply-To: Peter Seiderer Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Fixes the following error/warnings with kconfig from linux-6.9-rc5: package/cmocka/Config.in:2: syntax error package/cmocka/Config.in:2: invalid statement package/cmocka/Config.in:3: invalid statement package/cmocka/Config.in:4: invalid statement [...] Signed-off-by: Peter Seiderer --- package/cmocka/Config.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/cmocka/Config.in b/package/cmocka/Config.in index cf49d0f6be..80e29778d3 100644 --- a/package/cmocka/Config.in +++ b/package/cmocka/Config.in @@ -1,5 +1,5 @@ config BR2_PACKAGE_CMOCKA - bool cmocka + bool "cmocka" depends on !BR2_STATIC_LIBS help cmocka is an elegant unit testing framework for C with support From patchwork Mon May 6 14:45:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Seiderer X-Patchwork-Id: 1932044 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VY43Q3XqJz1xnT for ; Tue, 7 May 2024 00:46:10 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id A80EA608D3; Mon, 6 May 2024 14:46:08 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id YpJEuE2q_-TT; Mon, 6 May 2024 14:46:07 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 44D62608C9 Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 44D62608C9; Mon, 6 May 2024 14:46:06 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 1B7141BF59D for ; Mon, 6 May 2024 14:46:01 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id C4EC281E07 for ; Mon, 6 May 2024 14:45:59 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id B9eC6IOyve71 for ; Mon, 6 May 2024 14:45:59 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=212.227.15.15; helo=mout.gmx.net; envelope-from=ps.report@gmx.net; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 75EE082024 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 75EE082024 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by smtp1.osuosl.org (Postfix) with ESMTPS id 75EE082024 for ; Mon, 6 May 2024 14:45:58 +0000 (UTC) X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from localhost.fritz.box ([82.135.81.65]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1M9FjR-1s1X1v1VZf-006NXp for ; Mon, 06 May 2024 16:45:56 +0200 To: buildroot@busybox.net Date: Mon, 6 May 2024 16:45:46 +0200 Message-ID: <20240506144555.31709-4-ps.report@gmx.net> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240506144555.31709-1-ps.report@gmx.net> References: <20240506144555.31709-1-ps.report@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:EHIzcEfDGd2m7o0bJRsTRrnGaFgCmNsbK0TXMSCZlJf2R4mf+6F lgc5ZBCJg5Ou6ow6wP6q2K2NL0OhdqrQ2aJ82FqtniZDJTW1qYrUn+iyVWbgbMasdNVI7W/ w4yWLpfbCshLT1vep6DYMM9PZ5MUeZ013KLdFBsIOT485PDs7WcsGGBwN0Sb9CT1ZEwgMtk J2huCn0uAT9b2kmicrtDw== UI-OutboundReport: notjunk:1;M01:P0:l6U5v0TUJ4Q=;suZbzeCGK1K0FXAFLs1azY0RkKw wogmLtneecUHGT5TL130Eh/ymxdqIqfSeIt3wYY+FOS7TS4iJWCFMZq9uxk1mW+N2x4agPFF4 89v1birK2ICLOCG5TdKDZ8gswRLumXDJ97gYdjCxeWPs+VS1D6VVY2+7eq7zV5AxN9UyyNNBT AlW8i3Cgf9rB58FypVoMmUkNyCc+aHNBMd/VIkZaTbrmCazCXeMOdmTEwhcChPGcu/iBvWbIW WezlvgneMq1Ad16QjXLbXvaFlQ27NVM0858flLDbeP19dC2O+xv+mqL5dR1KFJIGs9CUY1DjG q/2KSk/FEyplvydvKLlcisX7w+XCK+TdH71AKPmeiuiuMp8H0P9WEkimA8U9e4ockozAMvhYi 2yaxdRD0sHwPMzO2Xu6mSqHZ7dj1AyYS26gMqysYZocv8Fnavkm75Dx3Cjh2HwYfBkypbE3PW +lUet1rybCzqaQgk/re3PDNiz2TKYr3FSukRoGtKXKWAE+J/nEJh5qyfiCcX4vMAUtkinzyHv DxBT++oNZuBbWv9RXDf/dg8agN+iFQtX04SJ58lCFbFKKbX0MnvQUqmrIeMg/qQDWRP11Oi06 Bb32SK2irybBWozjlwdDpBT9EeJCmVtLGpDcMCuecU8FihhSS2GgLbe1s25JMKD4cO+Il9Em+ xea30CDB/laIpZ5Obz4U2c6Oqoasco2enHhbdhOUZWlcofN6JhwRBy8e/Lxqc4FAF/LRN3IsT SIQrCXc0e+3Vbb83rgCb6oz1SGaGxR5XPqwSLf5FUUC6nk/Pt1cIXn7mt4tLw1uLzpNbxNiq3 vB62jxgvVuw7FqQ4AaG3QBACU+VS3aAwOsg5AHvtCkneo= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1715006756; x=1715611556; i=ps.report@gmx.net; bh=aZdmbhg9iF9i3sXexmZqKfYZ+7Nux60M81fip+tpWhw=; h=X-UI-Sender-Class:From:To:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=sOWV3xnk3vTBhYdq6eAD/xGSM8mFVf6ePj5NwuRih98Iv+ygkDIF4wKOpiomtZbG rrQQcq1xO9T4YavnwkQJvnga93rL1MRXWgoXG+vqaEnw4YVg5i2weiihdQP7pSylC CcTc/VKV0L4K/YX2EiEO12AKzS/94hi31dfaLcAdqodnjKBeS0xhFlazvsM6DqtQd zjtgLaJDI68Ey3E8Cvng+KSp4BucnZ4u506cvksU/WLOQrmMCL+r9LkpkKP3Sevvw LhG3hxlGS+aU4BcCgLV+nXbZR2Zk+5UiaRPbj3CMC98FtGePovyKQwM3cCNOmTDq7 s5OTrIm91o8Z1kOekw== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.net X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=gmx.net header.i=ps.report@gmx.net header.a=rsa-sha256 header.s=s31663417 header.b=sOWV3xnk Subject: [Buildroot] [PATCH v1 3/8] package/dovecot/Config.in: source argument needs quotation marks X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Peter Seiderer via buildroot From: Peter Seiderer Reply-To: Peter Seiderer Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Fixes the following error/warnings with kconfig from linux-6.9-rc5: package/dovecot/Config.in:36: syntax error package/dovecot/Config.in:36:warning: ignoring unsupported character '/' package/dovecot/Config.in:36:warning: ignoring unsupported character '/' package/dovecot/Config.in:36:warning: ignoring unsupported character '.' package/dovecot/Config.in:36: invalid statement Signed-off-by: Peter Seiderer --- package/dovecot/Config.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/dovecot/Config.in b/package/dovecot/Config.in index c94421526f..034dcc175f 100644 --- a/package/dovecot/Config.in +++ b/package/dovecot/Config.in @@ -33,7 +33,7 @@ config BR2_PACKAGE_DOVECOT_SQLITE help Enable SQLite support. -source package/dovecot-pigeonhole/Config.in +source "package/dovecot-pigeonhole/Config.in" endif # BR2_PACKAGE_DOVECOT From patchwork Mon May 6 14:45:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Seiderer X-Patchwork-Id: 1932042 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VY43H2ZLfz1ydY for ; Tue, 7 May 2024 00:46:03 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id CDD0E6087A; Mon, 6 May 2024 14:46:01 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id bhwvwRAZk1PQ; Mon, 6 May 2024 14:46:01 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org E321960883 Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id E321960883; Mon, 6 May 2024 14:46:00 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 9152B1BF59D for ; Mon, 6 May 2024 14:45:59 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 8A8BC8202B for ; Mon, 6 May 2024 14:45:59 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id BOh9L_ulXihq for ; Mon, 6 May 2024 14:45:59 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=212.227.15.18; helo=mout.gmx.net; envelope-from=ps.report@gmx.net; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 5B69C81B01 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 5B69C81B01 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by smtp1.osuosl.org (Postfix) with ESMTPS id 5B69C81B01 for ; Mon, 6 May 2024 14:45:58 +0000 (UTC) X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from localhost.fritz.box ([82.135.81.65]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Mkpav-1sTvsx1teh-00mGsH for ; Mon, 06 May 2024 16:45:56 +0200 To: buildroot@busybox.net Date: Mon, 6 May 2024 16:45:47 +0200 Message-ID: <20240506144555.31709-5-ps.report@gmx.net> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240506144555.31709-1-ps.report@gmx.net> References: <20240506144555.31709-1-ps.report@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:LbKppcwEFQud6JOqQgeQAw+bzaY2h/dve1V2Vrfsu80TfwsyyDg roLvpk1NLBXGPaDjHNSp8oqh8SqsXOGIMdErVFh37NFyiZys1j0c5J2HtuvXCTOXeNAX85t pU680+nADlJgrL1Yh2yTx8f03RaaPRjl4EiG0U8E7+PefVjIhJXEdN9gCm6FBu2E4YV8aVo i47m1g2tvR+Zh5PeMX7SQ== UI-OutboundReport: notjunk:1;M01:P0:+RP3Dh982tI=;kGY9B/xgodB7GjrWJJ7562xKNNA VjO1vrPyCu9pVYJLvNfCCzfBjixpYy4C8naY7OE2GqTpz7uFdMwVt0GNGGDc9pEnJpQlPt32b CcOVoHCXz1Vtxy1I5YdRH2Fs2Zg4DNivnj+oTO/oNH6EGeS9FtQbcW9pK/yMUj/udAS0Wy/bN B28lzAvzSBC4spF4lIF+tNCvaPcuHQV+3++eth0+zdH709ooUNkJTxsbEF8dQr2IGTHnAcwE6 S6wlB1RGWhUm5rH/fSJ6P/4xaRCIeB5mF2tpQXqbvrYz12uYrBR3FK5GSDFsrtItQEqvMAmn8 hS6CAl+nKXQp3nzXK/fVvUTGSmImCZ5C6fvb2CKWRca0m+nun/HBv0iX1FIkkDneGjSinZVB7 sMmzWKph0tWF52cMBufzXJHeERkpBYtWM7FUjE4ZmKsZ85wGlhPk0lR6KuQQrB8ML7q96rKKG UlSzPjNE0Hv3sFBgjxxwTHkor0qmOVNO/5ZhPHL662DpW8OvvGFrejKdtfvuqHQdKpJq4kXeJ e/MC/pot7MLu2hwI1z8GM1gadAUy4zD4ksrwqTENKJPCvblG6tLhdOcsMCdMMbLtitLvOBfK5 AxR5uKWWirzT8Lyw7xJVGX5fZX9Rfo8nJpZEbLTcZb9ThJ8Qp+xLu3CyWPNQQ9CEpNWcZ1Mue QQ/5xItBLebnalmZ3Cq0YFdp73kXSyqkzRm9pTaGapYiyAX1FDyLOExmPmmmvtQAMqVP93fTz JE49KkRn8g/jaOqR4G6aLayzoaRF+iTwcj4eaXc4aqc90IJ/xPSSRWbKnxSGUDscWacG1pDEb 8V3x9R21qGLmqQ3NOtP90ATVKdrr/oKBtWrPqjS9dkIXU= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1715006756; x=1715611556; i=ps.report@gmx.net; bh=uvrid6M3gNXMqC7eBjn0XgtsAeKYQa3nwW/3op5Jk4g=; h=X-UI-Sender-Class:From:To:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=TNUHd8P7bAnfNWr3AmMO1gm4E4sE46mrNrHQ/3zSvYyPTnoAoC/hyMyVzV6eA4fG o/N7tNknzqkoAlJBodlp0xNIHFigpywRwKqYaYlREoFoohLjXjOlo0d2gFyEs8NEE 4L481r3AiLVG1rTyogYotYs7zwbVmPnE75GtlHld3+eJlF4FqsUB4vmBWonGF7z9Z dhZQuOJNzbP266xfXurP3CmdcUshz2AtXaIjPdO4+9eST2gCtQIhe7pvDxneCkyCy TMK0ioLjDw6g9h1cg1BILkWHMW/LHIi2j4RmHn1CTkVcvTBiVUSMza86072NXGA7v RmX/kiJVcwAce3kurw== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.net X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key, unprotected) header.d=gmx.net header.i=ps.report@gmx.net header.a=rsa-sha256 header.s=s31663417 header.b=TNUHd8P7 Subject: [Buildroot] [PATCH v1 4/8] package/python-pydal/Config.in: bool argument needs quotation marks X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Peter Seiderer via buildroot From: Peter Seiderer Reply-To: Peter Seiderer Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Fixes the following error/warnings with kconfig from linux-6.9-rc5: package/python-pydal/Config.in:2: syntax error package/python-pydal/Config.in:2: invalid statement package/python-pydal/Config.in:3: invalid statement [...] Signed-off-by: Peter Seiderer --- package/python-pydal/Config.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/python-pydal/Config.in b/package/python-pydal/Config.in index f1c97f91a0..204b47a09a 100644 --- a/package/python-pydal/Config.in +++ b/package/python-pydal/Config.in @@ -1,5 +1,5 @@ config BR2_PACKAGE_PYTHON_PYDAL - bool python-pydal + bool "python-pydal" help pyDAL is a pure Python Database Abstraction Layer. It dynamically generates the SQL in real time using the From patchwork Mon May 6 14:45:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Seiderer X-Patchwork-Id: 1932046 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VY43Y4nC7z1xnT for ; Tue, 7 May 2024 00:46:17 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 6C2C8608CD; Mon, 6 May 2024 14:46:15 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id PtGYXOzPWix6; Mon, 6 May 2024 14:46:13 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 186B3608E7 Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 186B3608E7; Mon, 6 May 2024 14:46:13 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id DA6B21BF59D for ; Mon, 6 May 2024 14:46:03 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id B564C81DEA for ; Mon, 6 May 2024 14:46:00 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 0-y5JoeroIhL for ; Mon, 6 May 2024 14:45:59 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=212.227.15.18; helo=mout.gmx.net; envelope-from=ps.report@gmx.net; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 79D1F8202A DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 79D1F8202A Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by smtp1.osuosl.org (Postfix) with ESMTPS id 79D1F8202A for ; Mon, 6 May 2024 14:45:58 +0000 (UTC) X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from localhost.fritz.box ([82.135.81.65]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MPog5-1sHxzD2IXT-00MwzR for ; Mon, 06 May 2024 16:45:56 +0200 To: buildroot@busybox.net Date: Mon, 6 May 2024 16:45:48 +0200 Message-ID: <20240506144555.31709-6-ps.report@gmx.net> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240506144555.31709-1-ps.report@gmx.net> References: <20240506144555.31709-1-ps.report@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:82sMfeVngZ0p6oYNsM8pbpP9wkSlQiPLYWJik/14VfuUzL2NGom v6VqVNVe9CHpQz/s39yXDa3tiUdAFP2RR2MjFYhKW9JXxTou2319hyhrjYpknp8c/05MBPM YR4ZhsekMK4Ixo8/7J7N9eD+94eupOf39kD3uA0xKw20e2l7GwsfpXDEJd6jJcB0HIPnwQv F/AJR1gG9J5Lu78Fodzgg== UI-OutboundReport: notjunk:1;M01:P0:K/2XShLupiA=;wA11vkNnGbVuok9nP6OdRTtNPIC rV0+di+yzn0/0gIa+g4klGDVaq0BI8KWfMNS6R1TYHDedHRVuAe6w1Iyjhmc7MsRgU1Gxsnxo 8FV1IMfnx7BqaksvVbC4z6cdO8Ut4crsuDx1vYg32Pl6kKKvq6oBTRFKW9ccLF+ZZzUwzi3sp WtO9kgH3lNtGXucks1q2mEc53NFPixo+eSsq9iQZMc1osJ7MXuqPLmzvbA8gGUh1VlgAycRAy pOcaqW5LioLoEuKI2F06fwSZUjKyH/RKFJ3DtJqtD+ulDhsM8Q1V9voqUcON+da9LdP4STRf3 H29Wugd/pqfgdlHoL4a0zJ2/HWvlvpzx4o0xdnCOJ10r2eP2WA3FkiKIHgoMqjHx1Q4K4o/V0 gLIZePfTIXQrYvpqQQisoPVFz191y3G6FBGAKnAy2zfKZyQV3tkg6XRrIeQV4G5AfMBaRjbw6 i6wtm9rwsBJsvsuvbTqeH3+rh4YzjWAxli5DRYHMJsxSPczQUK704RZwA0xWqlEDhUy6tlzqs EO7v3VIAo5JpZtMcpt5E47t4ytG+aOIvPpNnC4gnvrE1h8q0vncjIyD6SieHWl9osHCiFk3Ns AbgtzItwefy8jWgHZtuqMRbW4vHKX62ZmU5npGjIlu7Zu2k2ppl6THiYXzdCWOdTyH5pMtFDk vTuPUAjAX/HXYlu2btMOEb56L01YCuBUh1yBl3K5pgZRquxiN1l9ccH8dZCiQCtokSFV/nmMt +Y4Ic5LgLmpoIJGUwS3mhnPop6+jK8atpW9K2GUwlCSf5pq/zW+tI1rM33gwUsmhcAI+02bBT G4WTfxQNJkjz43tSBMpE98eqBcelHxR3dZKG9vEV2G5sc= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1715006756; x=1715611556; i=ps.report@gmx.net; bh=pTgF9T+hSoFs6Sy42zyKLz1n4bI9FIZ3xZLI+cWxgQY=; h=X-UI-Sender-Class:From:To:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=LMvC1E/kwjXnjowVcvCSYamssH2yxYPBNsgZd2QPmzNbyHuoLuzV3vY8x31Ma7co 7bhZXgGtDczS2JKnyfo/NyifVUfRuKft64X8COej1X87Y0OTCPtp+FNMR72pZc2V+ gAvZR7OPAEUcfub7f+mF/oiT+NjhPuBuJNi9VA5o7KI60tzlWrufFdLzUbV35pqJn lpgAW0dYvb7plkLEqgvcSLY1TFBbjrh6gz+QLkCkcuBA+x3z9G3UvaOAVZfC9rrdQ xYPMoFPIK54VGqtjtImEKMJkOjgPLlXadfUCFSUTJ7nuCbFc1UW0MDJA8dHNtsMvw 1qV4dhhtKGHNu8n+Ag== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.net X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=gmx.net header.i=ps.report@gmx.net header.a=rsa-sha256 header.s=s31663417 header.b=LMvC1E/k Subject: [Buildroot] [PATCH v1 5/8] package/x11r7/Config.in: source argument needs quotation marks X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Peter Seiderer via buildroot From: Peter Seiderer Reply-To: Peter Seiderer Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Fixes the following error/warnings with kconfig from linux-6.9-rc5: package/x11r7/Config.in:14: syntax error package/x11r7/Config.in:14:warning: ignoring unsupported character '/' package/x11r7/Config.in:14:warning: ignoring unsupported character '/' package/x11r7/Config.in:14:warning: ignoring unsupported character '/' package/x11r7/Config.in:14:warning: ignoring unsupported character '.' package/x11r7/Config.in:14: invalid statement [...] Signed-off-by: Peter Seiderer --- package/x11r7/Config.in | 420 ++++++++++++++++++++-------------------- 1 file changed, 210 insertions(+), 210 deletions(-) diff --git a/package/x11r7/Config.in b/package/x11r7/Config.in index b91f97bb34..0002dfe598 100644 --- a/package/x11r7/Config.in +++ b/package/x11r7/Config.in @@ -11,232 +11,232 @@ menuconfig BR2_PACKAGE_XORG7 if BR2_PACKAGE_XORG7 menu "X11R7 Servers" - source package/x11r7/xserver_xorg-server/Config.in - source package/x11r7/xwayland/Config.in + source "package/x11r7/xserver_xorg-server/Config.in" + source "package/x11r7/xwayland/Config.in" endmenu menu "X11R7 Libraries" - source package/x11r7/libxcb/Config.in - source package/x11r7/xcb-util/Config.in - source package/x11r7/xcb-util-cursor/Config.in - source package/x11r7/xcb-util-image/Config.in - source package/x11r7/xcb-util-keysyms/Config.in - source package/x11r7/xcb-util-renderutil/Config.in - source package/x11r7/xcb-util-wm/Config.in - source package/x11r7/xlib_libFS/Config.in - source package/x11r7/xlib_libICE/Config.in - source package/x11r7/xlib_libSM/Config.in - source package/x11r7/xlib_libX11/Config.in - source package/x11r7/xlib_libXScrnSaver/Config.in - source package/x11r7/xlib_libXau/Config.in - source package/x11r7/xlib_libXaw/Config.in - source package/x11r7/xlib_libXcomposite/Config.in - source package/x11r7/xlib_libXcursor/Config.in - source package/x11r7/xlib_libXdamage/Config.in - source package/x11r7/xlib_libXdmcp/Config.in - source package/x11r7/xlib_libXext/Config.in - source package/x11r7/xlib_libXfixes/Config.in - source package/x11r7/xlib_libXfont/Config.in - source package/x11r7/xlib_libXfont2/Config.in - source package/x11r7/xlib_libXft/Config.in - source package/x11r7/xlib_libXi/Config.in - source package/x11r7/xlib_libXinerama/Config.in - source package/x11r7/xlib_libXmu/Config.in - source package/x11r7/xlib_libXpm/Config.in - source package/x11r7/xlib_libXpresent/Config.in - source package/x11r7/xlib_libXrandr/Config.in - source package/x11r7/xlib_libXrender/Config.in - source package/x11r7/xlib_libXres/Config.in - source package/x11r7/xlib_libXt/Config.in - source package/x11r7/xlib_libXtst/Config.in - source package/x11r7/xlib_libXv/Config.in - source package/x11r7/xlib_libXvMC/Config.in - source package/x11r7/xlib_libXxf86dga/Config.in - source package/x11r7/xlib_libXxf86vm/Config.in - source package/x11r7/xlib_libdmx/Config.in - source package/x11r7/xlib_libfontenc/Config.in - source package/x11r7/xlib_libxcvt/Config.in - source package/x11r7/xlib_libxkbfile/Config.in - source package/x11r7/xlib_libxshmfence/Config.in - source package/x11r7/xlib_xtrans/Config.in + source "package/x11r7/libxcb/Config.in" + source "package/x11r7/xcb-util/Config.in" + source "package/x11r7/xcb-util-cursor/Config.in" + source "package/x11r7/xcb-util-image/Config.in" + source "package/x11r7/xcb-util-keysyms/Config.in" + source "package/x11r7/xcb-util-renderutil/Config.in" + source "package/x11r7/xcb-util-wm/Config.in" + source "package/x11r7/xlib_libFS/Config.in" + source "package/x11r7/xlib_libICE/Config.in" + source "package/x11r7/xlib_libSM/Config.in" + source "package/x11r7/xlib_libX11/Config.in" + source "package/x11r7/xlib_libXScrnSaver/Config.in" + source "package/x11r7/xlib_libXau/Config.in" + source "package/x11r7/xlib_libXaw/Config.in" + source "package/x11r7/xlib_libXcomposite/Config.in" + source "package/x11r7/xlib_libXcursor/Config.in" + source "package/x11r7/xlib_libXdamage/Config.in" + source "package/x11r7/xlib_libXdmcp/Config.in" + source "package/x11r7/xlib_libXext/Config.in" + source "package/x11r7/xlib_libXfixes/Config.in" + source "package/x11r7/xlib_libXfont/Config.in" + source "package/x11r7/xlib_libXfont2/Config.in" + source "package/x11r7/xlib_libXft/Config.in" + source "package/x11r7/xlib_libXi/Config.in" + source "package/x11r7/xlib_libXinerama/Config.in" + source "package/x11r7/xlib_libXmu/Config.in" + source "package/x11r7/xlib_libXpm/Config.in" + source "package/x11r7/xlib_libXpresent/Config.in" + source "package/x11r7/xlib_libXrandr/Config.in" + source "package/x11r7/xlib_libXrender/Config.in" + source "package/x11r7/xlib_libXres/Config.in" + source "package/x11r7/xlib_libXt/Config.in" + source "package/x11r7/xlib_libXtst/Config.in" + source "package/x11r7/xlib_libXv/Config.in" + source "package/x11r7/xlib_libXvMC/Config.in" + source "package/x11r7/xlib_libXxf86dga/Config.in" + source "package/x11r7/xlib_libXxf86vm/Config.in" + source "package/x11r7/xlib_libdmx/Config.in" + source "package/x11r7/xlib_libfontenc/Config.in" + source "package/x11r7/xlib_libxcvt/Config.in" + source "package/x11r7/xlib_libxkbfile/Config.in" + source "package/x11r7/xlib_libxshmfence/Config.in" + source "package/x11r7/xlib_xtrans/Config.in" endmenu menu "X11R7 Applications" - source package/x11r7/xapp_appres/Config.in - source package/x11r7/xapp_bdftopcf/Config.in - source package/x11r7/xapp_beforelight/Config.in - source package/x11r7/xapp_bitmap/Config.in - source package/x11r7/xapp_editres/Config.in - source package/x11r7/xapp_fonttosfnt/Config.in - source package/x11r7/xapp_fslsfonts/Config.in - source package/x11r7/xapp_fstobdf/Config.in - source package/x11r7/xapp_iceauth/Config.in - source package/x11r7/xapp_ico/Config.in - source package/x11r7/xapp_listres/Config.in - source package/x11r7/xapp_luit/Config.in - source package/x11r7/xapp_mkfontscale/Config.in - source package/x11r7/xapp_oclock/Config.in - source package/x11r7/xapp_rgb/Config.in - source package/x11r7/xapp_rstart/Config.in - source package/x11r7/xapp_scripts/Config.in - source package/x11r7/xapp_sessreg/Config.in - source package/x11r7/xapp_setxkbmap/Config.in - source package/x11r7/xapp_showfont/Config.in - source package/x11r7/xapp_smproxy/Config.in - source package/x11r7/xapp_twm/Config.in - source package/x11r7/xapp_viewres/Config.in - source package/x11r7/xapp_x11perf/Config.in - source package/x11r7/xapp_xauth/Config.in - source package/x11r7/xapp_xbacklight/Config.in - source package/x11r7/xapp_xbiff/Config.in - source package/x11r7/xapp_xcalc/Config.in - source package/x11r7/xapp_xclipboard/Config.in - source package/x11r7/xapp_xclock/Config.in - source package/x11r7/xapp_xcmsdb/Config.in - source package/x11r7/xapp_xcompmgr/Config.in - source package/x11r7/xapp_xconsole/Config.in - source package/x11r7/xapp_xcursorgen/Config.in - source package/x11r7/xapp_xdbedizzy/Config.in - source package/x11r7/xapp_xditview/Config.in - source package/x11r7/xapp_xdm/Config.in - source package/x11r7/xapp_xdpyinfo/Config.in - source package/x11r7/xapp_xdriinfo/Config.in - source package/x11r7/xapp_xedit/Config.in - source package/x11r7/xapp_xev/Config.in - source package/x11r7/xapp_xeyes/Config.in - source package/x11r7/xapp_xf86dga/Config.in - source package/x11r7/xapp_xfd/Config.in - source package/x11r7/xapp_xfindproxy/Config.in - source package/x11r7/xapp_xfontsel/Config.in - source package/x11r7/xapp_xfs/Config.in - source package/x11r7/xapp_xfsinfo/Config.in - source package/x11r7/xapp_xgamma/Config.in - source package/x11r7/xapp_xgc/Config.in - source package/x11r7/xapp_xhost/Config.in - source package/x11r7/xapp_xinit/Config.in - source package/x11r7/xapp_xinput/Config.in - source package/x11r7/xapp_xinput-calibrator/Config.in - source package/x11r7/xapp_xkbcomp/Config.in - source package/x11r7/xapp_xkbevd/Config.in - source package/x11r7/xapp_xkbprint/Config.in - source package/x11r7/xapp_xkbutils/Config.in - source package/x11r7/xapp_xkill/Config.in - source package/x11r7/xapp_xload/Config.in - source package/x11r7/xapp_xlogo/Config.in - source package/x11r7/xapp_xlsatoms/Config.in - source package/x11r7/xapp_xlsclients/Config.in - source package/x11r7/xapp_xlsfonts/Config.in - source package/x11r7/xapp_xmag/Config.in - source package/x11r7/xapp_xman/Config.in - source package/x11r7/xapp_xmessage/Config.in - source package/x11r7/xapp_xmh/Config.in - source package/x11r7/xapp_xmodmap/Config.in - source package/x11r7/xapp_xmore/Config.in - source package/x11r7/xapp_xpr/Config.in - source package/x11r7/xapp_xprop/Config.in - source package/x11r7/xapp_xrandr/Config.in - source package/x11r7/xapp_xrdb/Config.in - source package/x11r7/xapp_xrefresh/Config.in - source package/x11r7/xapp_xset/Config.in - source package/x11r7/xapp_xsetmode/Config.in - source package/x11r7/xapp_xsetpointer/Config.in - source package/x11r7/xapp_xsetroot/Config.in - source package/x11r7/xapp_xsm/Config.in - source package/x11r7/xapp_xstdcmap/Config.in - source package/x11r7/xapp_xvidtune/Config.in - source package/x11r7/xapp_xvinfo/Config.in - source package/x11r7/xapp_xwd/Config.in - source package/x11r7/xapp_xwininfo/Config.in - source package/x11r7/xapp_xwud/Config.in + source "package/x11r7/xapp_appres/Config.in" + source "package/x11r7/xapp_bdftopcf/Config.in" + source "package/x11r7/xapp_beforelight/Config.in" + source "package/x11r7/xapp_bitmap/Config.in" + source "package/x11r7/xapp_editres/Config.in" + source "package/x11r7/xapp_fonttosfnt/Config.in" + source "package/x11r7/xapp_fslsfonts/Config.in" + source "package/x11r7/xapp_fstobdf/Config.in" + source "package/x11r7/xapp_iceauth/Config.in" + source "package/x11r7/xapp_ico/Config.in" + source "package/x11r7/xapp_listres/Config.in" + source "package/x11r7/xapp_luit/Config.in" + source "package/x11r7/xapp_mkfontscale/Config.in" + source "package/x11r7/xapp_oclock/Config.in" + source "package/x11r7/xapp_rgb/Config.in" + source "package/x11r7/xapp_rstart/Config.in" + source "package/x11r7/xapp_scripts/Config.in" + source "package/x11r7/xapp_sessreg/Config.in" + source "package/x11r7/xapp_setxkbmap/Config.in" + source "package/x11r7/xapp_showfont/Config.in" + source "package/x11r7/xapp_smproxy/Config.in" + source "package/x11r7/xapp_twm/Config.in" + source "package/x11r7/xapp_viewres/Config.in" + source "package/x11r7/xapp_x11perf/Config.in" + source "package/x11r7/xapp_xauth/Config.in" + source "package/x11r7/xapp_xbacklight/Config.in" + source "package/x11r7/xapp_xbiff/Config.in" + source "package/x11r7/xapp_xcalc/Config.in" + source "package/x11r7/xapp_xclipboard/Config.in" + source "package/x11r7/xapp_xclock/Config.in" + source "package/x11r7/xapp_xcmsdb/Config.in" + source "package/x11r7/xapp_xcompmgr/Config.in" + source "package/x11r7/xapp_xconsole/Config.in" + source "package/x11r7/xapp_xcursorgen/Config.in" + source "package/x11r7/xapp_xdbedizzy/Config.in" + source "package/x11r7/xapp_xditview/Config.in" + source "package/x11r7/xapp_xdm/Config.in" + source "package/x11r7/xapp_xdpyinfo/Config.in" + source "package/x11r7/xapp_xdriinfo/Config.in" + source "package/x11r7/xapp_xedit/Config.in" + source "package/x11r7/xapp_xev/Config.in" + source "package/x11r7/xapp_xeyes/Config.in" + source "package/x11r7/xapp_xf86dga/Config.in" + source "package/x11r7/xapp_xfd/Config.in" + source "package/x11r7/xapp_xfindproxy/Config.in" + source "package/x11r7/xapp_xfontsel/Config.in" + source "package/x11r7/xapp_xfs/Config.in" + source "package/x11r7/xapp_xfsinfo/Config.in" + source "package/x11r7/xapp_xgamma/Config.in" + source "package/x11r7/xapp_xgc/Config.in" + source "package/x11r7/xapp_xhost/Config.in" + source "package/x11r7/xapp_xinit/Config.in" + source "package/x11r7/xapp_xinput/Config.in" + source "package/x11r7/xapp_xinput-calibrator/Config.in" + source "package/x11r7/xapp_xkbcomp/Config.in" + source "package/x11r7/xapp_xkbevd/Config.in" + source "package/x11r7/xapp_xkbprint/Config.in" + source "package/x11r7/xapp_xkbutils/Config.in" + source "package/x11r7/xapp_xkill/Config.in" + source "package/x11r7/xapp_xload/Config.in" + source "package/x11r7/xapp_xlogo/Config.in" + source "package/x11r7/xapp_xlsatoms/Config.in" + source "package/x11r7/xapp_xlsclients/Config.in" + source "package/x11r7/xapp_xlsfonts/Config.in" + source "package/x11r7/xapp_xmag/Config.in" + source "package/x11r7/xapp_xman/Config.in" + source "package/x11r7/xapp_xmessage/Config.in" + source "package/x11r7/xapp_xmh/Config.in" + source "package/x11r7/xapp_xmodmap/Config.in" + source "package/x11r7/xapp_xmore/Config.in" + source "package/x11r7/xapp_xpr/Config.in" + source "package/x11r7/xapp_xprop/Config.in" + source "package/x11r7/xapp_xrandr/Config.in" + source "package/x11r7/xapp_xrdb/Config.in" + source "package/x11r7/xapp_xrefresh/Config.in" + source "package/x11r7/xapp_xset/Config.in" + source "package/x11r7/xapp_xsetmode/Config.in" + source "package/x11r7/xapp_xsetpointer/Config.in" + source "package/x11r7/xapp_xsetroot/Config.in" + source "package/x11r7/xapp_xsm/Config.in" + source "package/x11r7/xapp_xstdcmap/Config.in" + source "package/x11r7/xapp_xvidtune/Config.in" + source "package/x11r7/xapp_xvinfo/Config.in" + source "package/x11r7/xapp_xwd/Config.in" + source "package/x11r7/xapp_xwininfo/Config.in" + source "package/x11r7/xapp_xwud/Config.in" endmenu if BR2_PACKAGE_XSERVER_XORG_SERVER_MODULAR menu "X11R7 Drivers" - source package/x11r7/xdriver_xf86-input-evdev/Config.in - source package/x11r7/xdriver_xf86-input-joystick/Config.in - source package/x11r7/xdriver_xf86-input-libinput/Config.in - source package/x11r7/xdriver_xf86-input-mouse/Config.in - source package/x11r7/xdriver_xf86-input-synaptics/Config.in - source package/x11r7/xdriver_xf86-input-tslib/Config.in - source package/x11r7/xdriver_xf86-input-vmmouse/Config.in - source package/x11r7/xdriver_xf86-video-amdgpu/Config.in - source package/x11r7/xdriver_xf86-video-ark/Config.in - source package/x11r7/xdriver_xf86-video-ast/Config.in - source package/x11r7/xdriver_xf86-video-ati/Config.in - source package/x11r7/xdriver_xf86-video-cirrus/Config.in - source package/x11r7/xdriver_xf86-video-dummy/Config.in - source package/x11r7/xdriver_xf86-video-fbdev/Config.in - source package/x11r7/xdriver_xf86-video-fbturbo/Config.in - source package/x11r7/xdriver_xf86-video-geode/Config.in - source package/x11r7/xdriver_xf86-video-i128/Config.in - source package/x11r7/xdriver_xf86-video-imx/Config.in - source package/x11r7/xdriver_xf86-video-intel/Config.in - source package/x11r7/xdriver_xf86-video-mach64/Config.in - source package/x11r7/xdriver_xf86-video-mga/Config.in - source package/x11r7/xdriver_xf86-video-neomagic/Config.in - source package/x11r7/xdriver_xf86-video-nouveau/Config.in - source package/x11r7/xdriver_xf86-video-nv/Config.in - source package/x11r7/xdriver_xf86-video-openchrome/Config.in - source package/x11r7/xdriver_xf86-video-qxl/Config.in - source package/x11r7/xdriver_xf86-video-r128/Config.in - source package/x11r7/xdriver_xf86-video-savage/Config.in - source package/x11r7/xdriver_xf86-video-siliconmotion/Config.in - source package/x11r7/xdriver_xf86-video-sis/Config.in - source package/x11r7/xdriver_xf86-video-tdfx/Config.in - source package/x11r7/xdriver_xf86-video-trident/Config.in - source package/x11r7/xdriver_xf86-video-vesa/Config.in - source package/x11r7/xdriver_xf86-video-vmware/Config.in - source package/x11r7/xdriver_xf86-video-voodoo/Config.in + source "package/x11r7/xdriver_xf86-input-evdev/Config.in" + source "package/x11r7/xdriver_xf86-input-joystick/Config.in" + source "package/x11r7/xdriver_xf86-input-libinput/Config.in" + source "package/x11r7/xdriver_xf86-input-mouse/Config.in" + source "package/x11r7/xdriver_xf86-input-synaptics/Config.in" + source "package/x11r7/xdriver_xf86-input-tslib/Config.in" + source "package/x11r7/xdriver_xf86-input-vmmouse/Config.in" + source "package/x11r7/xdriver_xf86-video-amdgpu/Config.in" + source "package/x11r7/xdriver_xf86-video-ark/Config.in" + source "package/x11r7/xdriver_xf86-video-ast/Config.in" + source "package/x11r7/xdriver_xf86-video-ati/Config.in" + source "package/x11r7/xdriver_xf86-video-cirrus/Config.in" + source "package/x11r7/xdriver_xf86-video-dummy/Config.in" + source "package/x11r7/xdriver_xf86-video-fbdev/Config.in" + source "package/x11r7/xdriver_xf86-video-fbturbo/Config.in" + source "package/x11r7/xdriver_xf86-video-geode/Config.in" + source "package/x11r7/xdriver_xf86-video-i128/Config.in" + source "package/x11r7/xdriver_xf86-video-imx/Config.in" + source "package/x11r7/xdriver_xf86-video-intel/Config.in" + source "package/x11r7/xdriver_xf86-video-mach64/Config.in" + source "package/x11r7/xdriver_xf86-video-mga/Config.in" + source "package/x11r7/xdriver_xf86-video-neomagic/Config.in" + source "package/x11r7/xdriver_xf86-video-nouveau/Config.in" + source "package/x11r7/xdriver_xf86-video-nv/Config.in" + source "package/x11r7/xdriver_xf86-video-openchrome/Config.in" + source "package/x11r7/xdriver_xf86-video-qxl/Config.in" + source "package/x11r7/xdriver_xf86-video-r128/Config.in" + source "package/x11r7/xdriver_xf86-video-savage/Config.in" + source "package/x11r7/xdriver_xf86-video-siliconmotion/Config.in" + source "package/x11r7/xdriver_xf86-video-sis/Config.in" + source "package/x11r7/xdriver_xf86-video-tdfx/Config.in" + source "package/x11r7/xdriver_xf86-video-trident/Config.in" + source "package/x11r7/xdriver_xf86-video-vesa/Config.in" + source "package/x11r7/xdriver_xf86-video-vmware/Config.in" + source "package/x11r7/xdriver_xf86-video-voodoo/Config.in" endmenu endif menu "X11R7 Fonts" - source package/x11r7/xfont_font-util/Config.in - source package/x11r7/xfont_encodings/Config.in - source package/x11r7/xfont_font-adobe-100dpi/Config.in - source package/x11r7/xfont_font-adobe-75dpi/Config.in - source package/x11r7/xfont_font-adobe-utopia-100dpi/Config.in - source package/x11r7/xfont_font-adobe-utopia-75dpi/Config.in - source package/x11r7/xfont_font-adobe-utopia-type1/Config.in - source package/x11r7/xfont_font-alias/Config.in - source package/x11r7/xfont_font-arabic-misc/Config.in - source package/x11r7/xfont_font-bh-100dpi/Config.in - source package/x11r7/xfont_font-bh-75dpi/Config.in - source package/x11r7/xfont_font-bh-lucidatypewriter-100dpi/Config.in - source package/x11r7/xfont_font-bh-lucidatypewriter-75dpi/Config.in - source package/x11r7/xfont_font-bh-ttf/Config.in - source package/x11r7/xfont_font-bh-type1/Config.in - source package/x11r7/xfont_font-bitstream-100dpi/Config.in - source package/x11r7/xfont_font-bitstream-75dpi/Config.in - source package/x11r7/xfont_font-bitstream-type1/Config.in - source package/x11r7/xfont_font-cronyx-cyrillic/Config.in - source package/x11r7/xfont_font-cursor-misc/Config.in - source package/x11r7/xfont_font-daewoo-misc/Config.in - source package/x11r7/xfont_font-dec-misc/Config.in - source package/x11r7/xfont_font-ibm-type1/Config.in - source package/x11r7/xfont_font-isas-misc/Config.in - source package/x11r7/xfont_font-jis-misc/Config.in - source package/x11r7/xfont_font-micro-misc/Config.in - source package/x11r7/xfont_font-misc-cyrillic/Config.in - source package/x11r7/xfont_font-misc-ethiopic/Config.in - source package/x11r7/xfont_font-misc-meltho/Config.in - source package/x11r7/xfont_font-misc-misc/Config.in - source package/x11r7/xfont_font-mutt-misc/Config.in - source package/x11r7/xfont_font-schumacher-misc/Config.in - source package/x11r7/xfont_font-screen-cyrillic/Config.in - source package/x11r7/xfont_font-sony-misc/Config.in - source package/x11r7/xfont_font-sun-misc/Config.in - source package/x11r7/xfont_font-winitzki-cyrillic/Config.in - source package/x11r7/xfont_font-xfree86-type1/Config.in + source "package/x11r7/xfont_font-util/Config.in" + source "package/x11r7/xfont_encodings/Config.in" + source "package/x11r7/xfont_font-adobe-100dpi/Config.in" + source "package/x11r7/xfont_font-adobe-75dpi/Config.in" + source "package/x11r7/xfont_font-adobe-utopia-100dpi/Config.in" + source "package/x11r7/xfont_font-adobe-utopia-75dpi/Config.in" + source "package/x11r7/xfont_font-adobe-utopia-type1/Config.in" + source "package/x11r7/xfont_font-alias/Config.in" + source "package/x11r7/xfont_font-arabic-misc/Config.in" + source "package/x11r7/xfont_font-bh-100dpi/Config.in" + source "package/x11r7/xfont_font-bh-75dpi/Config.in" + source "package/x11r7/xfont_font-bh-lucidatypewriter-100dpi/Config.in" + source "package/x11r7/xfont_font-bh-lucidatypewriter-75dpi/Config.in" + source "package/x11r7/xfont_font-bh-ttf/Config.in" + source "package/x11r7/xfont_font-bh-type1/Config.in" + source "package/x11r7/xfont_font-bitstream-100dpi/Config.in" + source "package/x11r7/xfont_font-bitstream-75dpi/Config.in" + source "package/x11r7/xfont_font-bitstream-type1/Config.in" + source "package/x11r7/xfont_font-cronyx-cyrillic/Config.in" + source "package/x11r7/xfont_font-cursor-misc/Config.in" + source "package/x11r7/xfont_font-daewoo-misc/Config.in" + source "package/x11r7/xfont_font-dec-misc/Config.in" + source "package/x11r7/xfont_font-ibm-type1/Config.in" + source "package/x11r7/xfont_font-isas-misc/Config.in" + source "package/x11r7/xfont_font-jis-misc/Config.in" + source "package/x11r7/xfont_font-micro-misc/Config.in" + source "package/x11r7/xfont_font-misc-cyrillic/Config.in" + source "package/x11r7/xfont_font-misc-ethiopic/Config.in" + source "package/x11r7/xfont_font-misc-meltho/Config.in" + source "package/x11r7/xfont_font-misc-misc/Config.in" + source "package/x11r7/xfont_font-mutt-misc/Config.in" + source "package/x11r7/xfont_font-schumacher-misc/Config.in" + source "package/x11r7/xfont_font-screen-cyrillic/Config.in" + source "package/x11r7/xfont_font-sony-misc/Config.in" + source "package/x11r7/xfont_font-sun-misc/Config.in" + source "package/x11r7/xfont_font-winitzki-cyrillic/Config.in" + source "package/x11r7/xfont_font-xfree86-type1/Config.in" endmenu menu "X11R7 X protocols" - source package/x11r7/xcb-proto/Config.in - source package/x11r7/xorgproto/Config.in + source "package/x11r7/xcb-proto/Config.in" + source "package/x11r7/xorgproto/Config.in" endmenu menu "X11R7 Utilities" - source package/x11r7/xutil_makedepend/Config.in - source package/x11r7/mcookie/Config.in + source "package/x11r7/xutil_makedepend/Config.in" + source "package/x11r7/mcookie/Config.in" endmenu menu "X11R7 Other data" - source package/x11r7/xdata_xbitmaps/Config.in - source package/x11r7/xdata_xcursor-themes/Config.in - source package/x11r7/xcursor-transparent-theme/Config.in + source "package/x11r7/xdata_xbitmaps/Config.in" + source "package/x11r7/xdata_xcursor-themes/Config.in" + source "package/x11r7/xcursor-transparent-theme/Config.in" endmenu endif From patchwork Mon May 6 14:45:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Seiderer X-Patchwork-Id: 1932136 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VY9m36Zv3z1ydW for ; Tue, 7 May 2024 05:03:15 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id E57AE41452; Mon, 6 May 2024 19:03:13 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id jWKucPDKcr5J; Mon, 6 May 2024 19:03:05 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org A496E41451 Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp2.osuosl.org (Postfix) with ESMTP id A496E41451; Mon, 6 May 2024 19:03:05 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id E71681BF59D for ; Mon, 6 May 2024 14:46:07 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id C24B381DEA for ; Mon, 6 May 2024 14:46:07 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id lWgg2U-n4FGm for ; Mon, 6 May 2024 14:46:02 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=212.227.15.15; helo=mout.gmx.net; envelope-from=ps.report@gmx.net; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org A81CF81B01 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org A81CF81B01 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by smtp1.osuosl.org (Postfix) with ESMTPS id A81CF81B01 for ; Mon, 6 May 2024 14:46:00 +0000 (UTC) X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from localhost.fritz.box ([82.135.81.65]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MHoRA-1rsQLK2qpS-00Ers4 for ; Mon, 06 May 2024 16:45:57 +0200 To: buildroot@busybox.net Date: Mon, 6 May 2024 16:45:49 +0200 Message-ID: <20240506144555.31709-7-ps.report@gmx.net> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240506144555.31709-1-ps.report@gmx.net> References: <20240506144555.31709-1-ps.report@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:fl2Hh7pfaAjdtabCRxCWFbnu1NOYptnGWsPVDN45LHk1PWD5C0L 8/xhY0elWHKA8POinzgBJ5MOPW+nwyo6TMimoCj5X9LcegozhVdgg6uA06vRMQxsRES+nhK yvfJmq+ojxz1vF0HBWRyhrbhfmaHIq8zEwnXucEzgFff8lbJlqfbPAQHjFy25TThJ3F15zQ VZj8EMTLy/TAk4AykZdCA== UI-OutboundReport: notjunk:1;M01:P0:lcr7pfeqqxo=;s/8MJJadaD+1b3o16jyw8Fe3Q8R rmplgicSzvs/b162mD2jlQaf6sM393fDj6SlHi3Y5/hE0KG6fidPl1Jwwbj5rOIAw7EBRlznz ahwUVw6QUpY8AJ4Y0eWnoOlCTolKoZwoS7THtL8HiO0RSBYaar0YAVtbdr1UmH+TLsdGwLSFG ReVcZwPaIaXiyGJGwR/janYw03Lk/cJfbvkwwj6i9EpZJXAVXQ9Us5na0UNyjULE0Ix7CQyZX srTs+NeXr+pcv2A7A8NAtkYHOazMHokdk3V9hcEF4LEOAgtrYmbklyuXHgHAlLp4tHg5c1qiP PN7Xzj7WOJvwdkCYSG/79KXbimjSEqsFnEAXjL24/xO5dS6FD3rbHJzeiTnJy3B1dPRExcyE7 CxSa98Wv1ACsbynoqXsyXqKn9CduXr7pMp0au8c5FCX+rKkx9neuUdliQgNrB13wlxj1DkvyS f0vZ2daim3NOsAFz+2EexnwM7nfUZ5KfgD+Okn36E8kVYqmFWqBxr5PGQRnR/+oRBn6sDgmua k0YZzwrajxS3glOkrK4WU+ipHLGFGbYk4pqMdq1+OpeuCsrVveWxnDRh7HYatdm8Bltifi5at wuPvcwOS1vPcTzHME3evN1Me5sKKKJBPxqbm2ZJjih1/t1ivj7qZkvVwOLOfC1B4wbVCE0tsa 0rDEJzwHaVetLAIjB53Iidua0c7Eo6vO7xWSNdt9yCaM2U8AtWHIF7AoKpQF/X8g9ndG/YaaU w/sueiWupc7m3/KVvxOKfvdgGTW5eX76GxkhG50fvZBBpPN7GGt+yALf0e7+vdlePIyWba38W OdLh3j09xUU5RBDq3AK/kjYxOtzzDDVNfQjnHKqRfUg/2rRXKloKbxjMhLJPqt6MT8bL4nHJD lCB7J+gXFTaShWw== X-Mailman-Approved-At: Mon, 06 May 2024 19:03:03 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1715006758; x=1715611558; i=ps.report@gmx.net; bh=BSz2gYf9rbZRpP1XSOE2A5AaG/LM1v9vWTu9HFpmykM=; h=X-UI-Sender-Class:From:To:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Type:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=EerQSz9gSmCtp+n2eondA0m0PPi7qNbluyXFqeg2saibDBtkp4IxjuFZBRdgjX3y Vpn4dmnLGeNK257Oh9QkuU5eYQHz03kzwcbSnubJ10PbV2Igm9qdkGKc0aJV1WPiB 3nSNOuTYMy4Cxz4MXRIooILWkzTeumPe+HnM5EIRX/IKWRjMBlU4jLRNHO8W3uyAp jsCNlMLFBzqwQb37XbynLEZuzc/TOZyKniNWalMKv8TD1JDf4Vqi6tDIX5FnBjie4 t/tejJJoHhloih3koOaD9CUwjL84b+lyfeyYYx5AjerlDpVprLGmvE+5LPdwah7x7 dPqvDUiUCqY2Ih19Ig== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.net X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=gmx.net header.i=ps.report@gmx.net header.a=rsa-sha256 header.s=s31663417 header.b=EerQSz9g Subject: [Buildroot] [PATCH v1 6/8] support/kconfig: bump to linux-v6.9-rc5 version X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Peter Seiderer via buildroot From: Peter Seiderer Reply-To: Peter Seiderer Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" - update RAEDME.buildroot (add copy step for kconfig.new, update copy steps for *_shipped files - rebased 01-kconfig-kernel-to-buildroot.patch - rebased 06-br-build-system-integration.patch - updated 10-br-build-system.patch - removed 11-use-mktemp-for-lxdialog.patch (no longer applicable) - rebased 12-fix-glade-file-path.patch - rebased 14-support-out-of-tree-config.patch - rebased 16-fix-space-to-de-select-options.patch - removed 17-backport-kecho.patch (use complete Kbuild.include instead of backporting single parts) - rebased 18-merge-config.sh-create-temporary-files-in-tmp.patch - rebased 19-merge_config.sh-add-br2-external-support.patch - removed 20-merge_config.sh-Allow-to-define-config-prefix.patch (already upstream included) - removed 21-Avoid-false-positive-matches-from-comment-lines.patch (already upstream included) - removed 22-kconfig-lxdialog-fix-check-with-GCC14.patch (no longer applicable) - new 23-Revert-kconfig-allow-only-config-comment-and-if-insi.patch (revert to re-enable source statement inside of choice, as suggested by Yann E. MORIN, see [1]) [1] https://lore.kernel.org/buildroot/Zhdu7zT3FZl7sk1q@landeda/ Signed-off-by: Peter Seiderer --- support/kconfig/Kbuild.include | 273 ++ support/kconfig/Makefile | 375 +- support/kconfig/Makefile.br | 10 +- support/kconfig/POTFILES.in | 12 - support/kconfig/README.buildroot | 9 +- support/kconfig/array_size.h | 11 + support/kconfig/check.sh | 14 - support/kconfig/conf.c | 562 ++- support/kconfig/confdata.c | 1358 +++--- support/kconfig/expr.c | 29 +- support/kconfig/expr.h | 49 +- support/kconfig/foo.h | 12 - support/kconfig/gconf-cfg.sh | 33 + support/kconfig/gconf.c | 100 +- support/kconfig/hashtable.h | 48 + support/kconfig/images.c | 34 +- support/kconfig/images.h | 33 + support/kconfig/internal.h | 21 + support/kconfig/kconf_id.c | 53 - support/kconfig/kxgettext.c | 235 - support/kconfig/lexer.l | 460 ++ support/kconfig/lexer.lex.c_shipped | 4103 +++++++++++++++++ support/kconfig/list.h | 254 +- support/kconfig/list_types.h | 17 + support/kconfig/lkc.h | 117 +- support/kconfig/lkc_proto.h | 33 +- support/kconfig/lxdialog/.gitignore | 4 - support/kconfig/lxdialog/BIG.FAT.WARNING | 2 +- support/kconfig/lxdialog/check-lxdialog.sh | 93 - support/kconfig/lxdialog/checklist.c | 26 +- support/kconfig/lxdialog/dialog.h | 76 +- support/kconfig/lxdialog/inputbox.c | 24 +- support/kconfig/lxdialog/menubox.c | 35 +- support/kconfig/lxdialog/textbox.c | 330 +- support/kconfig/lxdialog/util.c | 41 +- support/kconfig/lxdialog/yesno.c | 21 +- support/kconfig/mconf-cfg.sh | 55 + support/kconfig/mconf.c | 529 +-- support/kconfig/menu.c | 345 +- support/kconfig/merge_config.sh | 91 +- support/kconfig/mnconf-common.c | 53 + support/kconfig/mnconf-common.h | 18 + support/kconfig/nconf-cfg.sh | 53 + support/kconfig/nconf.c | 297 +- support/kconfig/nconf.gui.c | 329 +- support/kconfig/nconf.h | 62 +- support/kconfig/parser.tab.c_shipped | 2189 +++++++++ support/kconfig/parser.tab.h_shipped | 134 + support/kconfig/{zconf.y => parser.y} | 467 +- .../01-kconfig-kernel-to-buildroot.patch | 115 +- .../06-br-build-system-integration.patch | 103 +- .../kconfig/patches/10-br-build-system.patch | 66 +- .../patches/11-use-mktemp-for-lxdialog.patch | 17 - .../patches/12-fix-glade-file-path.patch | 14 +- .../14-support-out-of-tree-config.patch | 202 +- .../16-fix-space-to-de-select-options.patch | 19 +- .../kconfig/patches/17-backport-kecho.patch | 26 - ...fig.sh-create-temporary-files-in-tmp.patch | 19 +- ...e_config.sh-add-br2-external-support.patch | 24 +- ...fig.sh-Allow-to-define-config-prefix.patch | 31 - ...-positive-matches-from-comment-lines.patch | 32 - ...config-lxdialog-fix-check-with-GCC14.patch | 43 - ...llow-only-config-comment-and-if-insi.patch | 956 ++++ support/kconfig/patches/series | 6 +- support/kconfig/preprocess.c | 580 +++ support/kconfig/preprocess.h | 19 + support/kconfig/qconf-cfg.sh | 40 + support/kconfig/qconf.cc | 1199 ++--- support/kconfig/qconf.h | 163 +- support/kconfig/streamline_config.pl | 104 +- support/kconfig/symbol.c | 374 +- support/kconfig/util.c | 122 +- support/kconfig/zconf.l | 372 -- support/kconfig/zconf.lex.c_shipped | 2500 ---------- support/kconfig/zconf.tab.c_shipped | 2488 ---------- 75 files changed, 12875 insertions(+), 10288 deletions(-) create mode 100644 support/kconfig/Kbuild.include delete mode 100644 support/kconfig/POTFILES.in create mode 100644 support/kconfig/array_size.h delete mode 100755 support/kconfig/check.sh delete mode 100644 support/kconfig/foo.h create mode 100755 support/kconfig/gconf-cfg.sh create mode 100644 support/kconfig/hashtable.h create mode 100644 support/kconfig/images.h create mode 100644 support/kconfig/internal.h delete mode 100644 support/kconfig/kconf_id.c delete mode 100644 support/kconfig/kxgettext.c create mode 100644 support/kconfig/lexer.l create mode 100644 support/kconfig/lexer.lex.c_shipped create mode 100644 support/kconfig/list_types.h delete mode 100644 support/kconfig/lxdialog/.gitignore delete mode 100755 support/kconfig/lxdialog/check-lxdialog.sh create mode 100755 support/kconfig/mconf-cfg.sh create mode 100644 support/kconfig/mnconf-common.c create mode 100644 support/kconfig/mnconf-common.h create mode 100755 support/kconfig/nconf-cfg.sh create mode 100644 support/kconfig/parser.tab.c_shipped create mode 100644 support/kconfig/parser.tab.h_shipped rename support/kconfig/{zconf.y => parser.y} (56%) delete mode 100644 support/kconfig/patches/11-use-mktemp-for-lxdialog.patch delete mode 100644 support/kconfig/patches/17-backport-kecho.patch delete mode 100644 support/kconfig/patches/20-merge_config.sh-Allow-to-define-config-prefix.patch delete mode 100644 support/kconfig/patches/21-Avoid-false-positive-matches-from-comment-lines.patch delete mode 100644 support/kconfig/patches/22-kconfig-lxdialog-fix-check-with-GCC14.patch create mode 100644 support/kconfig/patches/23-Revert-kconfig-allow-only-config-comment-and-if-insi.patch create mode 100644 support/kconfig/preprocess.c create mode 100644 support/kconfig/preprocess.h create mode 100755 support/kconfig/qconf-cfg.sh delete mode 100644 support/kconfig/zconf.l delete mode 100644 support/kconfig/zconf.lex.c_shipped delete mode 100644 support/kconfig/zconf.tab.c_shipped diff --git a/support/kconfig/Kbuild.include b/support/kconfig/Kbuild.include new file mode 100644 index 0000000000..2f33187981 --- /dev/null +++ b/support/kconfig/Kbuild.include @@ -0,0 +1,273 @@ +# SPDX-License-Identifier: GPL-2.0 +#### +# kbuild: Generic definitions + +# Convenient variables +comma := , +quote := " +squote := ' +empty := +space := $(empty) $(empty) +space_escape := _-_SPACE_-_ +pound := \# +define newline + + +endef + +### +# Comparison macros. +# Usage: $(call test-lt, $(CONFIG_LLD_VERSION), 150000) +# +# Use $(intcmp ...) if supported. (Make >= 4.4) +# Otherwise, fall back to the 'test' shell command. +ifeq ($(intcmp 1,0,,,y),y) +test-ge = $(intcmp $(strip $1)0, $(strip $2)0,,y,y) +test-gt = $(intcmp $(strip $1)0, $(strip $2)0,,,y) +else +test-ge = $(shell test $(strip $1)0 -ge $(strip $2)0 && echo y) +test-gt = $(shell test $(strip $1)0 -gt $(strip $2)0 && echo y) +endif +test-le = $(call test-ge, $2, $1) +test-lt = $(call test-gt, $2, $1) + +### +# Name of target with a '.' as filename prefix. foo/bar.o => foo/.bar.o +dot-target = $(dir $@).$(notdir $@) + +### +# Name of target with a '.tmp_' as filename prefix. foo/bar.o => foo/.tmp_bar.o +tmp-target = $(dir $@).tmp_$(notdir $@) + +### +# The temporary file to save gcc -MMD generated dependencies must not +# contain a comma +depfile = $(subst $(comma),_,$(dot-target).d) + +### +# filename of target with directory and extension stripped +basetarget = $(basename $(notdir $@)) + +### +# real prerequisites without phony targets +real-prereqs = $(filter-out $(PHONY), $^) + +### +# Escape single quote for use in echo statements +escsq = $(subst $(squote),'\$(squote)',$1) + +### +# Quote a string to pass it to C files. foo => '"foo"' +stringify = $(squote)$(quote)$1$(quote)$(squote) + +### +# The path to Kbuild or Makefile. Kbuild has precedence over Makefile. +kbuild-dir = $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) +kbuild-file = $(or $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Makefile) + +### +# Read a file, replacing newlines with spaces +# +# Make 4.2 or later can read a file by using its builtin function. +ifneq ($(filter-out 3.% 4.0 4.1, $(MAKE_VERSION)),) +read-file = $(subst $(newline),$(space),$(file < $1)) +else +read-file = $(shell cat $1 2>/dev/null) +endif + +### +# Easy method for doing a status message + kecho := : + quiet_kecho := echo +silent_kecho := : +kecho := $($(quiet)kecho) + +### +# filechk is used to check if the content of a generated file is updated. +# Sample usage: +# +# filechk_sample = echo $(KERNELRELEASE) +# version.h: FORCE +# $(call filechk,sample) +# +# The rule defined shall write to stdout the content of the new file. +# The existing file will be compared with the new one. +# - If no file exist it is created +# - If the content differ the new file is used +# - If they are equal no change, and no timestamp update +define filechk + $(check-FORCE) + $(Q)set -e; \ + mkdir -p $(dir $@); \ + trap "rm -f $(tmp-target)" EXIT; \ + { $(filechk_$(1)); } > $(tmp-target); \ + if [ ! -r $@ ] || ! cmp -s $@ $(tmp-target); then \ + $(kecho) ' UPD $@'; \ + mv -f $(tmp-target) $@; \ + fi +endef + +### +# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= +# Usage: +# $(Q)$(MAKE) $(build)=dir +build := -f $(srctree)/scripts/Makefile.build obj + +### +# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj= +# Usage: +# $(Q)$(MAKE) $(clean)=dir +clean := -f $(srctree)/scripts/Makefile.clean obj + +# pring log +# +# If quiet is "silent_", print nothing and sink stdout +# If quiet is "quiet_", print short log +# If quiet is empty, print short log and whole command +silent_log_print = exec >/dev/null; + quiet_log_print = $(if $(quiet_cmd_$1), echo ' $(call escsq,$(quiet_cmd_$1)$(why))';) + log_print = echo '$(pound) $(call escsq,$(or $(quiet_cmd_$1),cmd_$1 $@)$(why))'; \ + echo ' $(call escsq,$(cmd_$1))'; + +# Delete the target on interruption +# +# GNU Make automatically deletes the target if it has already been changed by +# the interrupted recipe. So, you can safely stop the build by Ctrl-C (Make +# will delete incomplete targets), and resume it later. +# +# However, this does not work when the stderr is piped to another program, like +# $ make >&2 | tee log +# Make dies with SIGPIPE before cleaning the targets. +# +# To address it, we clean the target in signal traps. +# +# Make deletes the target when it catches SIGHUP, SIGINT, SIGQUIT, SIGTERM. +# So, we cover them, and also SIGPIPE just in case. +# +# Of course, this is unneeded for phony targets. +delete-on-interrupt = \ + $(if $(filter-out $(PHONY), $@), \ + $(foreach sig, HUP INT QUIT TERM PIPE, \ + trap 'rm -f $@; trap - $(sig); kill -s $(sig) $$$$' $(sig);)) + +# print and execute commands +cmd = @$(if $(cmd_$(1)),set -e; $($(quiet)log_print) $(delete-on-interrupt) $(cmd_$(1)),:) + +### +# if_changed - execute command if any prerequisite is newer than +# target, or command line has changed +# if_changed_dep - as if_changed, but uses fixdep to reveal dependencies +# including used config symbols +# if_changed_rule - as if_changed but execute rule instead +# See Documentation/kbuild/makefiles.rst for more info + +ifneq ($(KBUILD_NOCMDDEP),1) +# Check if both commands are the same including their order. Result is empty +# string if equal. User may override this check using make KBUILD_NOCMDDEP=1 +# If the target does not exist, the *.cmd file should not be included so +# $(savedcmd_$@) gets empty. Then, target will be built even if $(newer-prereqs) +# happens to become empty. +cmd-check = $(filter-out $(subst $(space),$(space_escape),$(strip $(savedcmd_$@))), \ + $(subst $(space),$(space_escape),$(strip $(cmd_$1)))) +else +# We still need to detect missing targets. +cmd-check = $(if $(strip $(savedcmd_$@)),,1) +endif + +# Replace >$< with >$$< to preserve $ when reloading the .cmd file +# (needed for make) +# Replace >#< with >$(pound)< to avoid starting a comment in the .cmd file +# (needed for make) +# Replace >'< with >'\''< to be able to enclose the whole string in '...' +# (needed for the shell) +make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1))))) + +# Find any prerequisites that are newer than target or that do not exist. +# PHONY targets skipped in both cases. +# If there is no prerequisite other than phony targets, $(newer-prereqs) becomes +# empty even if the target does not exist. cmd-check saves this corner case. +newer-prereqs = $(filter-out $(PHONY),$?) + +# It is a typical mistake to forget the FORCE prerequisite. Check it here so +# no more breakage will slip in. +check-FORCE = $(if $(filter FORCE, $^),,$(warning FORCE prerequisite is missing)) + +if-changed-cond = $(newer-prereqs)$(cmd-check)$(check-FORCE) + +# Execute command if command has changed or prerequisite(s) are updated. +if_changed = $(if $(if-changed-cond),$(cmd_and_savecmd),@:) + +cmd_and_savecmd = \ + $(cmd); \ + printf '%s\n' 'savedcmd_$@ := $(make-cmd)' > $(dot-target).cmd + +# Execute the command and also postprocess generated .d dependencies file. +if_changed_dep = $(if $(if-changed-cond),$(cmd_and_fixdep),@:) + +cmd_and_fixdep = \ + $(cmd); \ + scripts/basic/fixdep $(depfile) $@ '$(make-cmd)' > $(dot-target).cmd;\ + rm -f $(depfile) + +# Usage: $(call if_changed_rule,foo) +# Will check if $(cmd_foo) or any of the prerequisites changed, +# and if so will execute $(rule_foo). +if_changed_rule = $(if $(if-changed-cond),$(rule_$(1)),@:) + +### +# why - tell why a target got built +# enabled by make V=2 +# Output (listed in the order they are checked): +# (1) - due to target is PHONY +# (2) - due to target missing +# (3) - due to: file1.h file2.h +# (4) - due to command line change +# (5) - due to missing .cmd file +# (6) - due to target not in $(targets) +# (1) PHONY targets are always build +# (2) No target, so we better build it +# (3) Prerequisite is newer than target +# (4) The command line stored in the file named dir/.target.cmd +# differed from actual command line. This happens when compiler +# options changes +# (5) No dir/.target.cmd file (used to store command line) +# (6) No dir/.target.cmd file and target not listed in $(targets) +# This is a good hint that there is a bug in the kbuild file +ifneq ($(findstring 2, $(KBUILD_VERBOSE)),) +_why = \ + $(if $(filter $@, $(PHONY)),- due to target is PHONY, \ + $(if $(wildcard $@), \ + $(if $(newer-prereqs),- due to: $(newer-prereqs), \ + $(if $(cmd-check), \ + $(if $(savedcmd_$@),- due to command line change, \ + $(if $(filter $@, $(targets)), \ + - due to missing .cmd file, \ + - due to $(notdir $@) not in $$(targets) \ + ) \ + ) \ + ) \ + ), \ + - due to target missing \ + ) \ + ) + +why = $(space)$(strip $(_why)) +endif + +############################################################################### + +# delete partially updated (i.e. corrupted) files on error +.DELETE_ON_ERROR: + +# do not delete intermediate files automatically +# +# .NOTINTERMEDIATE is more correct, but only available on newer Make versions. +# Make 4.4 introduced .NOTINTERMEDIATE, and it appears in .FEATURES, but the +# global .NOTINTERMEDIATE does not work. We can use it on Make > 4.4. +# Use .SECONDARY for older Make versions, but "newer-prereq" cannot detect +# deleted files. +ifneq ($(and $(filter notintermediate, $(.FEATURES)),$(filter-out 4.4,$(MAKE_VERSION))),) +.NOTINTERMEDIATE: +else +.SECONDARY: +endif diff --git a/support/kconfig/Makefile b/support/kconfig/Makefile index b0bcc2627a..f5f934d644 100644 --- a/support/kconfig/Makefile +++ b/support/kconfig/Makefile @@ -3,14 +3,10 @@ # Kernel configuration targets # These targets are used from top-level makefile -PHONY += xconfig gconfig menuconfig config syncconfig update-po-config \ - localmodconfig localyesconfig +HOSTPKG_CONFIG = pkg-config +export HOSTPKG_CONFIG -# Easy method for doing a status message - kecho := : - quiet_kecho := echo -silent_kecho := : -kecho := $($(quiet)kecho) +include $(src)/Kbuild.include ifdef KBUILD_KCONFIG Kconfig := $(KBUILD_KCONFIG) @@ -18,103 +14,87 @@ else Kconfig := Kconfig endif +ifndef KBUILD_DEFCONFIG +KBUILD_DEFCONFIG := defconfig +endif + ifeq ($(quiet),silent_) silent := -s endif -# We need this, in case the user has it in its environment -unexport CONFIG_ +export KCONFIG_DEFCONFIG_LIST := +ifndef cross_compiling +kernel-release := $(shell uname -r) +KCONFIG_DEFCONFIG_LIST += \ + /lib/modules/$(kernel-release)/.config \ + /etc/kernel-config \ + /boot/config-$(kernel-release) +endif +KCONFIG_DEFCONFIG_LIST += arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) -xconfig: $(obj)/qconf - $< $(silent) $(Kconfig) +ifneq ($(findstring c, $(KBUILD_EXTRA_WARN)),) +export KCONFIG_WARN_UNKNOWN_SYMBOLS=1 +endif -gconfig: $(obj)/gconf - $< $(silent) $(Kconfig) +ifneq ($(findstring e, $(KBUILD_EXTRA_WARN)),) +export KCONFIG_WERROR=1 +endif -menuconfig: $(obj)/mconf - $< $(silent) $(Kconfig) +# We need this, in case the user has it in its environment +unexport CONFIG_ -config: $(obj)/conf - $< $(silent) --oldaskconfig $(Kconfig) +config-prog := conf +menuconfig-prog := mconf +nconfig-prog := nconf +gconfig-prog := gconf +xconfig-prog := qconf -nconfig: $(obj)/nconf - $< $(silent) $(Kconfig) +define config_rule +PHONY += $(1) +$(1): $(obj)/$($(1)-prog) + $(Q)$$< $(silent) $(Kconfig) -# This has become an internal implementation detail and is now deprecated -# for external use. -syncconfig: $(obj)/conf - $(Q)mkdir -p include/config include/generated - $< $(silent) --$@ $(Kconfig) +PHONY += build_$(1) +build_$(1): $(obj)/$($(1)-prog) +endef +$(foreach c, config menuconfig nconfig gconfig xconfig, $(eval $(call config_rule,$(c)))) + +PHONY += localmodconfig localyesconfig localyesconfig localmodconfig: $(obj)/conf - $(Q)mkdir -p include/config include/generated - $(Q)perl $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config - $(Q)if [ -f .config ]; then \ - cmp -s .tmp.config .config || \ - (mv -f .config .config.old.1; \ - mv -f .tmp.config .config; \ - $< $(silent) --oldconfig $(Kconfig); \ - mv -f .config.old.1 .config.old) \ - else \ - mv -f .tmp.config .config; \ - $< $(silent) --oldconfig $(Kconfig); \ + $(Q)$(PERL) $(srctree)/$(src)/streamline_config.pl --$@ $(srctree) $(Kconfig) > .tmp.config + $(Q)if [ -f .config ]; then \ + cmp -s .tmp.config .config || \ + (mv -f .config .config.old.1; \ + mv -f .tmp.config .config; \ + $< $(silent) --oldconfig $(Kconfig); \ + mv -f .config.old.1 .config.old) \ + else \ + mv -f .tmp.config .config; \ + $< $(silent) --oldconfig $(Kconfig); \ fi $(Q)rm -f .tmp.config -# Create new linux.pot file -# Adjust charset to UTF-8 in .po file to accept UTF-8 in Kconfig files -update-po-config: $(obj)/kxgettext $(obj)/gconf.glade.h - $(Q)$(kecho) " GEN config.pot" - $(Q)xgettext --default-domain=linux \ - --add-comments --keyword=_ --keyword=N_ \ - --from-code=UTF-8 \ - --files-from=$(srctree)/scripts/kconfig/POTFILES.in \ - --directory=$(srctree) --directory=$(objtree) \ - --output $(obj)/config.pot - $(Q)sed -i s/CHARSET/UTF-8/ $(obj)/config.pot - $(Q)(for i in `ls $(srctree)/arch/*/Kconfig \ - $(srctree)/arch/*/um/Kconfig`; \ - do \ - $(kecho) " GEN $$i"; \ - $(obj)/kxgettext $$i \ - >> $(obj)/config.pot; \ - done ) - $(Q)$(kecho) " GEN linux.pot" - $(Q)msguniq --sort-by-file --to-code=UTF-8 $(obj)/config.pot \ - --output $(obj)/linux.pot - $(Q)rm -f $(obj)/config.pot - # These targets map 1:1 to the commandline options of 'conf' +# +# Note: +# syncconfig has become an internal implementation detail and is now +# deprecated for external use simple-targets := oldconfig allnoconfig allyesconfig allmodconfig \ - alldefconfig randconfig listnewconfig olddefconfig + alldefconfig randconfig listnewconfig olddefconfig syncconfig \ + helpnewconfig yes2modconfig mod2yesconfig mod2noconfig + PHONY += $(simple-targets) $(simple-targets): $(obj)/conf - $< $(silent) --$@ $(Kconfig) - -PHONY += oldnoconfig silentoldconfig savedefconfig defconfig - -# oldnoconfig is an alias of olddefconfig, because people already are dependent -# on its behavior (sets new symbols to their default value but not 'n') with the -# counter-intuitive name. -oldnoconfig: olddefconfig - @echo " WARNING: \"oldnoconfig\" target will be removed after Linux 4.19" - @echo " Please use \"olddefconfig\" instead, which is an alias." + $(Q)$< $(silent) --$@ $(Kconfig) -# We do not expect manual invokcation of "silentoldcofig" (or "syncconfig"). -silentoldconfig: syncconfig - @echo " WARNING: \"silentoldconfig\" has been renamed to \"syncconfig\"" - @echo " and is now an internal implementation detail." - @echo " What you want is probably \"oldconfig\"." - @echo " \"silentoldconfig\" will be removed after Linux 4.19" +PHONY += savedefconfig defconfig savedefconfig: $(obj)/conf - $< $(silent) --$@=defconfig $(Kconfig) + $(Q)$< $(silent) --$@=defconfig $(Kconfig) defconfig: $(obj)/conf -ifeq ($(KBUILD_DEFCONFIG),) - $< $(silent) --defconfig $(Kconfig) -else ifneq ($(wildcard $(srctree)/arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG)),) @$(kecho) "*** Default configuration is based on '$(KBUILD_DEFCONFIG)'" $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$(KBUILD_DEFCONFIG) $(Kconfig) @@ -122,49 +102,45 @@ else @$(kecho) "*** Default configuration is based on target '$(KBUILD_DEFCONFIG)'" $(Q)$(MAKE) -f $(srctree)/Makefile $(KBUILD_DEFCONFIG) endif -endif %_defconfig: $(obj)/conf $(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig) -configfiles=$(wildcard $(srctree)/kernel/configs/$@ $(srctree)/arch/$(SRCARCH)/configs/$@) +configfiles = $(wildcard $(srctree)/kernel/configs/$(1) $(srctree)/arch/$(SRCARCH)/configs/$(1)) +all-config-fragments = $(call configfiles,*.config) +config-fragments = $(call configfiles,$@) %.config: $(obj)/conf - $(if $(call configfiles),, $(error No configuration exists for this target on this architecture)) - $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m .config $(configfiles) - +$(Q)yes "" | $(MAKE) -f $(srctree)/Makefile oldconfig - -PHONY += kvmconfig -kvmconfig: kvm_guest.config - @: - -PHONY += xenconfig -xenconfig: xen.config - @: + $(if $(config-fragments),, $(error $@ fragment does not exists on this architecture)) + $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m $(KCONFIG_CONFIG) $(config-fragments) + $(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig PHONY += tinyconfig tinyconfig: - $(Q)$(MAKE) -f $(srctree)/Makefile allnoconfig tiny.config + $(Q)KCONFIG_ALLCONFIG=kernel/configs/tiny-base.config $(MAKE) -f $(srctree)/Makefile allnoconfig + $(Q)$(MAKE) -f $(srctree)/Makefile tiny.config # CHECK: -o cache_dir= working? PHONY += testconfig testconfig: $(obj)/conf - $(PYTHON3) -B -m pytest $(srctree)/$(src)/tests \ + $(Q)$(PYTHON3) -B -m pytest $(srctree)/$(src)/tests \ -o cache_dir=$(abspath $(obj)/tests/.cache) \ $(if $(findstring 1,$(KBUILD_VERBOSE)),--capture=no) -clean-dirs += tests/.cache +clean-files += tests/.cache # Help text used by make help help: + @echo 'Configuration targets:' @echo ' config - Update current config utilising a line-oriented program' - @echo ' nconfig - Update current config utilising a ncurses menu based' - @echo ' program' + @echo ' nconfig - Update current config utilising a ncurses menu based program' @echo ' menuconfig - Update current config utilising a menu based program' @echo ' xconfig - Update current config utilising a Qt based front-end' @echo ' gconfig - Update current config utilising a GTK+ based front-end' @echo ' oldconfig - Update current config utilising a provided .config as base' @echo ' localmodconfig - Update current config disabling modules not loaded' + @echo ' except those preserved by LMC_KEEP environment variable' @echo ' localyesconfig - Update current config converting local mods to core' + @echo ' except those preserved by LMC_KEEP environment variable' @echo ' defconfig - New config with default from ARCH supplied defconfig' @echo ' savedefconfig - Save current config as ./defconfig (minimal config)' @echo ' allnoconfig - New config where all options are answered with no' @@ -172,171 +148,100 @@ help: @echo ' allmodconfig - New config selecting modules when possible' @echo ' alldefconfig - New config with all symbols set to default' @echo ' randconfig - New config with random answer to all options' + @echo ' yes2modconfig - Change answers from yes to mod if possible' + @echo ' mod2yesconfig - Change answers from mod to yes if possible' + @echo ' mod2noconfig - Change answers from mod to no if possible' @echo ' listnewconfig - List new options' + @echo ' helpnewconfig - List new options and help text' @echo ' olddefconfig - Same as oldconfig but sets new symbols to their' @echo ' default value without prompting' - @echo ' kvmconfig - Enable additional options for kvm guest kernel support' - @echo ' xenconfig - Enable additional options for xen dom0 and guest kernel support' @echo ' tinyconfig - Configure the tiniest possible kernel' - -# lxdialog stuff -check-lxdialog := $(srctree)/$(src)/lxdialog/check-lxdialog.sh - -# Use recursively expanded variables so we do not call gcc unless -# we really need to do so. (Do not call gcc as part of make mrproper) -HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(check-lxdialog) -ccflags) \ - -DLOCALE + @echo ' testconfig - Run Kconfig unit tests (requires python3 and pytest)' + @echo '' + @echo 'Configuration topic targets:' + @$(foreach f, $(all-config-fragments), \ + if help=$$(grep -m1 '^# Help: ' $(f)); then \ + printf ' %-25s - %s\n' '$(notdir $(f))' "$${help#*: }"; \ + fi;) # =========================================================================== -# Shared Makefile for the various kconfig executables: -# conf: Used for defconfig, oldconfig and related targets -# nconf: Used for the nconfig target. -# Utilizes ncurses -# mconf: Used for the menuconfig target -# Utilizes the lxdialog package -# qconf: Used for the xconfig target -# Based on Qt which needs to be installed to compile it -# gconf: Used for the gconfig target -# Based on GTK+ which needs to be installed to compile it # object files used by all kconfig flavours +common-objs := confdata.o expr.o lexer.lex.o menu.o parser.tab.o \ + preprocess.o symbol.o util.o -lxdialog := lxdialog/checklist.o lxdialog/util.o lxdialog/inputbox.o -lxdialog += lxdialog/textbox.o lxdialog/yesno.o lxdialog/menubox.o - -conf-objs := conf.o zconf.tab.o -mconf-objs := mconf.o zconf.tab.o $(lxdialog) -nconf-objs := nconf.o zconf.tab.o nconf.gui.o -kxgettext-objs := kxgettext.o zconf.tab.o -qconf-cxxobjs := qconf.o -qconf-objs := zconf.tab.o -gconf-objs := gconf.o zconf.tab.o +$(obj)/lexer.lex.o: $(obj)/parser.tab.h +HOSTCFLAGS_lexer.lex.o := -I $(srctree)/$(src) +HOSTCFLAGS_parser.tab.o := -I $(srctree)/$(src) -hostprogs-y := conf +# conf: Used for defconfig, oldconfig and related targets +hostprogs += conf +conf-objs := conf.o $(common-objs) +# nconf: Used for the nconfig target based on ncurses ifeq ($(MAKECMDGOALS),nconf) - hostprogs-y += nconf -endif - -ifeq ($(MAKECMDGOALS),mconf) - hostprogs-y += mconf -endif +hostprogs += nconf +nconf-objs := nconf.o nconf.gui.o mnconf-common.o $(common-objs) -ifeq ($(MAKECMDGOALS),update-po-config) - hostprogs-y += kxgettext -endif +HOSTLDLIBS_nconf = $(call read-file, $(obj)/nconf-libs) +HOSTCFLAGS_nconf.o = $(call read-file, $(obj)/nconf-cflags) +HOSTCFLAGS_nconf.gui.o = $(call read-file, $(obj)/nconf-cflags) -ifeq ($(MAKECMDGOALS),qconf) - qconf-target := 1 +$(obj)/nconf: | $(obj)/nconf-libs +$(obj)/nconf.o $(obj)/nconf.gui.o: | $(obj)/nconf-cflags endif -ifeq ($(MAKECMDGOALS),gconf) - gconf-target := 1 -endif +# mconf: Used for the menuconfig target based on lxdialog +ifeq ($(MAKECMDGOALS),mconf) +hostprogs += mconf +lxdialog := $(addprefix lxdialog/, \ + checklist.o inputbox.o menubox.o textbox.o util.o yesno.o) +mconf-objs := mconf.o $(lxdialog) mnconf-common.o $(common-objs) -ifeq ($(qconf-target),1) - hostprogs-y += qconf -endif +HOSTLDLIBS_mconf = $(call read-file, $(obj)/mconf-libs) +$(foreach f, mconf.o $(lxdialog), \ + $(eval HOSTCFLAGS_$f = $$(call read-file, $(obj)/mconf-cflags))) -ifeq ($(gconf-target),1) - hostprogs-y += gconf +$(obj)/mconf: | $(obj)/mconf-libs +$(addprefix $(obj)/, mconf.o $(lxdialog)): | $(obj)/mconf-cflags endif -targets += zconf.lex.c -clean-files := qconf.moc .tmp_qtcheck .tmp_gtkcheck -clean-files += gconf.glade.h -clean-files += config.pot linux.pot - -# Check that we have the required ncurses stuff installed for lxdialog (menuconfig) -PHONY += $(obj)/dochecklxdialog -$(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/dochecklxdialog -$(obj)/dochecklxdialog: - $(Q)$(CONFIG_SHELL) $(check-lxdialog) -check $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTLOADLIBES_mconf) - -always := dochecklxdialog - -# Add environment specific flags -HOST_EXTRACFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCC) $(HOSTCFLAGS)) -HOST_EXTRACXXFLAGS += $(shell $(CONFIG_SHELL) $(srctree)/$(src)/check.sh $(HOSTCXX) $(HOSTCXXFLAGS)) - -# generated files seem to need this to find local include files -HOSTCFLAGS_zconf.lex.o := -I$(src) -HOSTCFLAGS_zconf.tab.o := -I$(src) - -HOSTLOADLIBES_qconf = $(KC_QT_LIBS) -HOSTCXXFLAGS_qconf.o = $(KC_QT_CFLAGS) +# qconf: Used for the xconfig target based on Qt +ifeq ($(MAKECMDGOALS),qconf) +hostprogs += qconf +qconf-cxxobjs := qconf.o qconf-moc.o +qconf-objs := images.o $(common-objs) -HOSTLOADLIBES_gconf = `pkg-config --libs gtk+-2.0 gmodule-2.0 libglade-2.0` -HOSTCFLAGS_gconf.o = `pkg-config --cflags gtk+-2.0 gmodule-2.0 libglade-2.0` \ - -Wno-missing-prototypes +HOSTLDLIBS_qconf = $(call read-file, $(obj)/qconf-libs) +HOSTCXXFLAGS_qconf.o = -std=c++11 -fPIC $(call read-file, $(obj)/qconf-cflags) +HOSTCXXFLAGS_qconf-moc.o = -std=c++11 -fPIC $(call read-file, $(obj)/qconf-cflags) +$(obj)/qconf: | $(obj)/qconf-libs +$(obj)/qconf.o $(obj)/qconf-moc.o: | $(obj)/qconf-cflags -HOSTLOADLIBES_mconf = $(shell $(CONFIG_SHELL) $(check-lxdialog) -ldflags $(HOSTCC)) +quiet_cmd_moc = MOC $@ + cmd_moc = $(call read-file, $(obj)/qconf-bin)/moc $< -o $@ -HOSTLOADLIBES_nconf = $(shell \ - pkg-config --libs menuw panelw ncursesw 2>/dev/null \ - || pkg-config --libs menu panel ncurses 2>/dev/null \ - || echo "-lmenu -lpanel -lncurses" ) -$(obj)/qconf.o: $(obj)/.tmp_qtcheck +$(obj)/qconf-moc.cc: $(src)/qconf.h FORCE | $(obj)/qconf-bin + $(call if_changed,moc) -ifeq ($(MAKECMDGOALS),qconf) -$(obj)/.tmp_qtcheck: $(src)/Makefile --include $(obj)/.tmp_qtcheck - -# Qt needs some extra effort... -$(obj)/.tmp_qtcheck: - @set -e; $(kecho) " CHECK qt"; \ - if pkg-config --exists Qt5Core; then \ - cflags="-std=c++11 -fPIC `pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets`"; \ - libs=`pkg-config --libs Qt5Core Qt5Gui Qt5Widgets`; \ - moc=`pkg-config --variable=host_bins Qt5Core`/moc; \ - elif pkg-config --exists QtCore; then \ - cflags=`pkg-config --cflags QtCore QtGui`; \ - libs=`pkg-config --libs QtCore QtGui`; \ - moc=`pkg-config --variable=moc_location QtCore`; \ - else \ - echo >&2 "*"; \ - echo >&2 "* Could not find Qt via pkg-config."; \ - echo >&2 "* Please install either Qt 4.8 or 5.x. and make sure it's in PKG_CONFIG_PATH"; \ - echo >&2 "*"; \ - exit 1; \ - fi; \ - echo "KC_QT_CFLAGS=$$cflags" > $@; \ - echo "KC_QT_LIBS=$$libs" >> $@; \ - echo "KC_QT_MOC=$$moc" >> $@ +targets += qconf-moc.cc endif +# gconf: Used for the gconfig target based on GTK+ ifeq ($(MAKECMDGOALS),gconf) -$(obj)/gconf.o: $(obj)/.tmp_gtkcheck --include $(obj)/.tmp_gtkcheck - -# GTK+ needs some extra effort, too... -$(obj)/.tmp_gtkcheck: - @if `pkg-config --exists gtk+-2.0 gmodule-2.0 libglade-2.0`; then \ - if `pkg-config --atleast-version=2.0.0 gtk+-2.0`; then \ - touch $@; \ - else \ - echo >&2 "*"; \ - echo >&2 "* GTK+ is present but version >= 2.0.0 is required."; \ - echo >&2 "*"; \ - false; \ - fi \ - else \ - echo >&2 "*"; \ - echo >&2 "* Unable to find the GTK+ installation. Please make sure that"; \ - echo >&2 "* the GTK+ 2.0 development package is correctly installed..."; \ - echo >&2 "* You need gtk+-2.0, glib-2.0 and libglade-2.0."; \ - echo >&2 "*"; \ - false; \ - fi -endif +hostprogs += gconf +gconf-objs := gconf.o images.o $(common-objs) -$(obj)/zconf.tab.o: $(obj)/zconf.lex.c +HOSTLDLIBS_gconf = $(call read-file, $(obj)/gconf-libs) +HOSTCFLAGS_gconf.o = $(call read-file, $(obj)/gconf-cflags) + +$(obj)/gconf: | $(obj)/gconf-libs +$(obj)/gconf.o: | $(obj)/gconf-cflags +endif -$(obj)/qconf.o: $(obj)/qconf.moc +# check if necessary packages are available, and configure build flags +cmd_conf_cfg = $(src)/$< $(addprefix $(obj)/$*conf-, cflags libs bin); touch $(obj)/$*conf-bin -$(obj)/%.moc: $(src)/%.h $(obj)/.tmp_qtcheck - $(KC_QT_MOC) -i $< -o $@ +$(obj)/%conf-cflags $(obj)/%conf-libs $(obj)/%conf-bin: $(src)/%conf-cfg.sh + $(call cmd,conf_cfg) -# Extract gconf menu items for i18n support -$(obj)/gconf.glade.h: $(obj)/gconf.glade - $(Q)intltool-extract --type=gettext/glade --srcdir=$(srctree) \ - $(obj)/gconf.glade +clean-files += *conf-cflags *conf-libs *conf-bin diff --git a/support/kconfig/Makefile.br b/support/kconfig/Makefile.br index 41c5ce165d..d163256846 100644 --- a/support/kconfig/Makefile.br +++ b/support/kconfig/Makefile.br @@ -5,12 +5,11 @@ srctree := . obj ?= . include Makefile -#HOSTCFLAGS+=-Dinline="" -include foo.h -include $(obj)/.depend $(obj)/.depend: $(wildcard *.h *.c) $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) -MM *.c > $@ 2>/dev/null || : -__hostprogs := $(sort $(hostprogs-y) $(hostprogs-m)) +__hostprogs := $(sort $(hostprogs)) host-csingle := $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m))) host-cmulti := $(foreach m,$(__hostprogs),\ $(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m)))) @@ -25,10 +24,10 @@ $(host-csingle): %: %.c $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $< -o $(obj)/$@ $(host-cmulti): %: $(host-cobjs) $(host-cshlib) - $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs)) $(HOSTLOADLIBES_$(@F)) -o $(obj)/$@ + $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs)) $(HOSTLDLIBS_$(@F)) -o $(obj)/$@ $(host-cxxmulti): %: $(host-cxxobjs) $(host-cobjs) $(host-cshlib) - $(HOSTCXX) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCXXFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs) $($(@F)-cxxobjs)) $(HOSTLOADLIBES_$(@F)) -o $(obj)/$@ + $(HOSTCXX) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCXXFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs) $($(@F)-cxxobjs)) $(HOSTLDLIBS_$(@F)) -o $(obj)/$@ $(obj)/%.o: %.c $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$(@F)) -c $< -o $@ @@ -39,6 +38,9 @@ $(obj)/%.o: $(obj)/%.c $(obj)/%.o: %.cc $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCXXFLAGS_$(@F)) -c $< -o $@ +$(obj)/%.o: $(obj)/%.cc + $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCXXFLAGS_$(@F)) -c $< -o $@ + $(obj)/%:: $(src)/%_shipped $(Q)cat $< > $@ diff --git a/support/kconfig/POTFILES.in b/support/kconfig/POTFILES.in deleted file mode 100644 index 9674573969..0000000000 --- a/support/kconfig/POTFILES.in +++ /dev/null @@ -1,12 +0,0 @@ -scripts/kconfig/lxdialog/checklist.c -scripts/kconfig/lxdialog/inputbox.c -scripts/kconfig/lxdialog/menubox.c -scripts/kconfig/lxdialog/textbox.c -scripts/kconfig/lxdialog/util.c -scripts/kconfig/lxdialog/yesno.c -scripts/kconfig/mconf.c -scripts/kconfig/conf.c -scripts/kconfig/confdata.c -scripts/kconfig/gconf.c -scripts/kconfig/gconf.glade.h -scripts/kconfig/qconf.cc diff --git a/support/kconfig/README.buildroot b/support/kconfig/README.buildroot index 76808f85b4..82bb855d01 100644 --- a/support/kconfig/README.buildroot +++ b/support/kconfig/README.buildroot @@ -3,10 +3,13 @@ to suit Buildroot. To update: cp -r /usr/src/linux/scripts/kconfig support/kconfig.new + cp /usr/src/linux/scripts/Kbuild.include support/kconfig.new cd support/kconfig.new - # zconf.lex.c and zconf.tab.c needs to be generated by 'make menuconfig' - mv zconf.lex.c zconf.lex.c_shipped - mv zconf.tab.c zconf.tab.c_shipped + # lexer.lex.c, parser.tab.c and parser.tab.h needs to be generated + # by 'make menuconfig' + mv lexer.lex.c lexer.lex.c_shipped + mv parser.tab.c parser.tab.c_shipped + mv parser.tab.h parser.tab.h_shipped rm -rf tests/ cp -a ../kconfig/patches ../kconfig/README.buildroot ../kconfig/.gitignore . quilt push -a diff --git a/support/kconfig/array_size.h b/support/kconfig/array_size.h new file mode 100644 index 0000000000..26ba78d867 --- /dev/null +++ b/support/kconfig/array_size.h @@ -0,0 +1,11 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef ARRAY_SIZE_H +#define ARRAY_SIZE_H + +/** + * ARRAY_SIZE - get the number of elements in array @arr + * @arr: array to be sized + */ +#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) + +#endif /* ARRAY_SIZE_H */ diff --git a/support/kconfig/check.sh b/support/kconfig/check.sh deleted file mode 100755 index 97f0fee7d1..0000000000 --- a/support/kconfig/check.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0 -# Needed for systems without gettext -$* -x c -o /dev/null - > /dev/null 2>&1 << EOF -#include -int main() -{ - gettext(""); - return 0; -} -EOF -if [ ! "$?" -eq "0" ]; then - echo -DKBUILD_NO_NLS; -fi diff --git a/support/kconfig/conf.c b/support/kconfig/conf.c index 2d7a7ac437..965bb40c50 100644 --- a/support/kconfig/conf.c +++ b/support/kconfig/conf.c @@ -1,9 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2002 Roman Zippel - * Released under the terms of the GNU GPL v2.0. */ -#include #include #include #include @@ -12,10 +11,10 @@ #include #include #include -#include #include #include +#include "internal.h" #include "lkc.h" static void conf(struct menu *menu); @@ -33,10 +32,14 @@ enum input_mode { defconfig, savedefconfig, listnewconfig, + helpnewconfig, olddefconfig, + yes2modconfig, + mod2yesconfig, + mod2noconfig, }; static enum input_mode input_mode = oldaskconfig; - +static int input_mode_opt; static int indent = 1; static int tty_stdio; static int sync_kconfig; @@ -81,17 +84,245 @@ static void xfgets(char *str, int size, FILE *in) printf("%s", str); } -static int conf_askvalue(struct symbol *sym, const char *def) +static void set_randconfig_seed(void) +{ + unsigned int seed; + char *env; + bool seed_set = false; + + env = getenv("KCONFIG_SEED"); + if (env && *env) { + char *endp; + + seed = strtol(env, &endp, 0); + if (*endp == '\0') + seed_set = true; + } + + if (!seed_set) { + struct timeval now; + + /* + * Use microseconds derived seed, compensate for systems where it may + * be zero. + */ + gettimeofday(&now, NULL); + seed = (now.tv_sec + 1) * (now.tv_usec + 1); + } + + printf("KCONFIG_SEED=0x%X\n", seed); + srand(seed); +} + +static bool randomize_choice_values(struct symbol *csym) +{ + struct property *prop; + struct symbol *sym; + struct expr *e; + int cnt, def; + + /* + * If choice is mod then we may have more items selected + * and if no then no-one. + * In both cases stop. + */ + if (csym->curr.tri != yes) + return false; + + prop = sym_get_choice_prop(csym); + + /* count entries in choice block */ + cnt = 0; + expr_list_for_each_sym(prop->expr, e, sym) + cnt++; + + /* + * find a random value and set it to yes, + * set the rest to no so we have only one set + */ + def = rand() % cnt; + + cnt = 0; + expr_list_for_each_sym(prop->expr, e, sym) { + if (def == cnt++) { + sym->def[S_DEF_USER].tri = yes; + csym->def[S_DEF_USER].val = sym; + } else { + sym->def[S_DEF_USER].tri = no; + } + sym->flags |= SYMBOL_DEF_USER; + /* clear VALID to get value calculated */ + sym->flags &= ~SYMBOL_VALID; + } + csym->flags |= SYMBOL_DEF_USER; + /* clear VALID to get value calculated */ + csym->flags &= ~SYMBOL_VALID; + + return true; +} + +enum conf_def_mode { + def_default, + def_yes, + def_mod, + def_no, + def_random +}; + +static bool conf_set_all_new_symbols(enum conf_def_mode mode) +{ + struct symbol *sym, *csym; + int cnt; + /* + * can't go as the default in switch-case below, otherwise gcc whines + * about -Wmaybe-uninitialized + */ + int pby = 50; /* probability of bool = y */ + int pty = 33; /* probability of tristate = y */ + int ptm = 33; /* probability of tristate = m */ + bool has_changed = false; + + if (mode == def_random) { + int n, p[3]; + char *env = getenv("KCONFIG_PROBABILITY"); + + n = 0; + while (env && *env) { + char *endp; + int tmp = strtol(env, &endp, 10); + + if (tmp >= 0 && tmp <= 100) { + p[n++] = tmp; + } else { + errno = ERANGE; + perror("KCONFIG_PROBABILITY"); + exit(1); + } + env = (*endp == ':') ? endp + 1 : endp; + if (n >= 3) + break; + } + switch (n) { + case 1: + pby = p[0]; + ptm = pby / 2; + pty = pby - ptm; + break; + case 2: + pty = p[0]; + ptm = p[1]; + pby = pty + ptm; + break; + case 3: + pby = p[0]; + pty = p[1]; + ptm = p[2]; + break; + } + + if (pty + ptm > 100) { + errno = ERANGE; + perror("KCONFIG_PROBABILITY"); + exit(1); + } + } + + for_all_symbols(sym) { + if (sym_has_value(sym) || sym->flags & SYMBOL_VALID) + continue; + switch (sym_get_type(sym)) { + case S_BOOLEAN: + case S_TRISTATE: + has_changed = true; + switch (mode) { + case def_yes: + sym->def[S_DEF_USER].tri = yes; + break; + case def_mod: + sym->def[S_DEF_USER].tri = mod; + break; + case def_no: + sym->def[S_DEF_USER].tri = no; + break; + case def_random: + sym->def[S_DEF_USER].tri = no; + cnt = rand() % 100; + if (sym->type == S_TRISTATE) { + if (cnt < pty) + sym->def[S_DEF_USER].tri = yes; + else if (cnt < pty + ptm) + sym->def[S_DEF_USER].tri = mod; + } else if (cnt < pby) + sym->def[S_DEF_USER].tri = yes; + break; + default: + continue; + } + if (!(sym_is_choice(sym) && mode == def_random)) + sym->flags |= SYMBOL_DEF_USER; + break; + default: + break; + } + + } + + sym_clear_all_valid(); + + /* + * We have different type of choice blocks. + * If curr.tri equals to mod then we can select several + * choice symbols in one block. + * In this case we do nothing. + * If curr.tri equals yes then only one symbol can be + * selected in a choice block and we set it to yes, + * and the rest to no. + */ + if (mode != def_random) { + for_all_symbols(csym) { + if ((sym_is_choice(csym) && !sym_has_value(csym)) || + sym_is_choice_value(csym)) + csym->flags |= SYMBOL_NEED_SET_CHOICE_VALUES; + } + } + + for_all_symbols(csym) { + if (sym_has_value(csym) || !sym_is_choice(csym)) + continue; + + sym_calc_value(csym); + if (mode == def_random) + has_changed |= randomize_choice_values(csym); + else { + set_all_choice_values(csym); + has_changed = true; + } + } + + return has_changed; +} + +static void conf_rewrite_tristates(tristate old_val, tristate new_val) { - enum symbol_type type = sym_get_type(sym); + struct symbol *sym; + for_all_symbols(sym) { + if (sym_get_type(sym) == S_TRISTATE && + sym->def[S_DEF_USER].tri == old_val) + sym->def[S_DEF_USER].tri = new_val; + } + sym_clear_all_valid(); +} + +static int conf_askvalue(struct symbol *sym, const char *def) +{ if (!sym_has_value(sym)) - printf(_("(NEW) ")); + printf("(NEW) "); line[0] = '\n'; line[1] = 0; - if (!sym_is_changable(sym)) { + if (!sym_is_changeable(sym)) { printf("%s\n", def); line[0] = '\n'; line[1] = 0; @@ -106,24 +337,12 @@ static int conf_askvalue(struct symbol *sym, const char *def) return 0; } /* fall through */ - case oldaskconfig: + default: fflush(stdout); xfgets(line, sizeof(line), stdin); - return 1; - default: break; } - switch (type) { - case S_INT: - case S_HEX: - case S_STRING: - printf("%s\n", def); - return 1; - default: - ; - } - printf("%s", line); return 1; } @@ -133,10 +352,10 @@ static int conf_string(struct menu *menu) const char *def; while (1) { - printf("%*s%s ", indent - 1, "", _(menu->prompt->text)); + printf("%*s%s ", indent - 1, "", menu->prompt->text); printf("(%s) ", sym->name); def = sym_get_string_value(sym); - if (sym_get_string_value(sym)) + if (def) printf("[%s] ", def); if (!conf_askvalue(sym, def)) return 0; @@ -166,7 +385,7 @@ static int conf_sym(struct menu *menu) tristate oldval, newval; while (1) { - printf("%*s%s ", indent - 1, "", _(menu->prompt->text)); + printf("%*s%s ", indent - 1, "", menu->prompt->text); if (sym->name) printf("(%s) ", sym->name); putchar('['); @@ -235,7 +454,7 @@ static int conf_choice(struct menu *menu) sym = menu->sym; is_new = !sym_has_value(sym); - if (sym_is_changable(sym)) { + if (sym_is_changeable(sym)) { conf_sym(menu); sym_calc_value(sym); switch (sym_get_tristate_value(sym)) { @@ -251,7 +470,7 @@ static int conf_choice(struct menu *menu) case no: return 1; case mod: - printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu))); + printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); return 0; case yes: break; @@ -261,7 +480,7 @@ static int conf_choice(struct menu *menu) while (1) { int cnt, def; - printf("%*s%s\n", indent - 1, "", _(menu_get_prompt(menu))); + printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); def_sym = sym_get_choice_value(sym); cnt = def = 0; line[0] = 0; @@ -269,7 +488,7 @@ static int conf_choice(struct menu *menu) if (!menu_is_visible(child)) continue; if (!child->sym) { - printf("%*c %s\n", indent, '*', _(menu_get_prompt(child))); + printf("%*c %s\n", indent, '*', menu_get_prompt(child)); continue; } cnt++; @@ -278,14 +497,14 @@ static int conf_choice(struct menu *menu) printf("%*c", indent, '>'); } else printf("%*c", indent, ' '); - printf(" %d. %s", cnt, _(menu_get_prompt(child))); + printf(" %d. %s", cnt, menu_get_prompt(child)); if (child->sym->name) printf(" (%s)", child->sym->name); if (!sym_has_value(child->sym)) - printf(_(" (NEW)")); + printf(" (NEW)"); printf("\n"); } - printf(_("%*schoice"), indent - 1, ""); + printf("%*schoice", indent - 1, ""); if (cnt == 1) { printf("[1]: 1\n"); goto conf_childs; @@ -332,12 +551,7 @@ static int conf_choice(struct menu *menu) print_help(child); continue; } - sym_set_choice_value(sym, child->sym); - for (child = child->list; child; child = child->next) { - indent += 2; - conf(child); - indent -= 2; - } + sym_set_tristate_value(child->sym, yes); return 1; } } @@ -372,7 +586,7 @@ static void conf(struct menu *menu) if (prompt) printf("%*c\n%*c %s\n%*c\n", indent, '*', - indent, '*', _(prompt), + indent, '*', prompt, indent, '*'); default: ; @@ -418,29 +632,26 @@ static void check_conf(struct menu *menu) return; sym = menu->sym; - if (sym && !sym_has_value(sym)) { - if (sym_is_changable(sym) || - (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { - if (input_mode == listnewconfig) { - if (sym->name) { - const char *str; - - if (sym->type == S_STRING) { - str = sym_get_string_value(sym); - str = sym_escape_string_value(str); - printf("%s%s=%s\n", CONFIG_, sym->name, str); - free((void *)str); - } else { - str = sym_get_string_value(sym); - printf("%s%s=%s\n", CONFIG_, sym->name, str); - } - } - } else { - if (!conf_cnt++) - printf(_("*\n* Restart config...\n*\n")); - rootEntry = menu_get_parent_menu(menu); - conf(rootEntry); - } + if (sym && !sym_has_value(sym) && + (sym_is_changeable(sym) || + (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes))) { + + switch (input_mode) { + case listnewconfig: + if (sym->name) + print_symbol_for_listconfig(sym); + break; + case helpnewconfig: + printf("-----\n"); + print_help(menu); + printf("-----\n"); + break; + default: + if (!conf_cnt++) + printf("*\n* Restart config...\n*\n"); + rootEntry = menu_get_parent_menu(menu); + conf(rootEntry); + break; } } @@ -448,40 +659,44 @@ static void check_conf(struct menu *menu) check_conf(child); } -static struct option long_opts[] = { - {"oldaskconfig", no_argument, NULL, oldaskconfig}, - {"oldconfig", no_argument, NULL, oldconfig}, - {"syncconfig", no_argument, NULL, syncconfig}, - {"defconfig", optional_argument, NULL, defconfig}, - {"savedefconfig", required_argument, NULL, savedefconfig}, - {"allnoconfig", no_argument, NULL, allnoconfig}, - {"allyesconfig", no_argument, NULL, allyesconfig}, - {"allmodconfig", no_argument, NULL, allmodconfig}, - {"alldefconfig", no_argument, NULL, alldefconfig}, - {"randconfig", no_argument, NULL, randconfig}, - {"listnewconfig", no_argument, NULL, listnewconfig}, - {"olddefconfig", no_argument, NULL, olddefconfig}, - /* - * oldnoconfig is an alias of olddefconfig, because people already - * are dependent on its behavior(sets new symbols to their default - * value but not 'n') with the counter-intuitive name. - */ - {"oldnoconfig", no_argument, NULL, olddefconfig}, +static const struct option long_opts[] = { + {"help", no_argument, NULL, 'h'}, + {"silent", no_argument, NULL, 's'}, + {"oldaskconfig", no_argument, &input_mode_opt, oldaskconfig}, + {"oldconfig", no_argument, &input_mode_opt, oldconfig}, + {"syncconfig", no_argument, &input_mode_opt, syncconfig}, + {"defconfig", required_argument, &input_mode_opt, defconfig}, + {"savedefconfig", required_argument, &input_mode_opt, savedefconfig}, + {"allnoconfig", no_argument, &input_mode_opt, allnoconfig}, + {"allyesconfig", no_argument, &input_mode_opt, allyesconfig}, + {"allmodconfig", no_argument, &input_mode_opt, allmodconfig}, + {"alldefconfig", no_argument, &input_mode_opt, alldefconfig}, + {"randconfig", no_argument, &input_mode_opt, randconfig}, + {"listnewconfig", no_argument, &input_mode_opt, listnewconfig}, + {"helpnewconfig", no_argument, &input_mode_opt, helpnewconfig}, + {"olddefconfig", no_argument, &input_mode_opt, olddefconfig}, + {"yes2modconfig", no_argument, &input_mode_opt, yes2modconfig}, + {"mod2yesconfig", no_argument, &input_mode_opt, mod2yesconfig}, + {"mod2noconfig", no_argument, &input_mode_opt, mod2noconfig}, {NULL, 0, NULL, 0} }; static void conf_usage(const char *progname) { - - printf("Usage: %s [-s] [option] \n", progname); - printf("[option] is _one_ of the following:\n"); + printf("Usage: %s [options] \n", progname); + printf("\n"); + printf("Generic options:\n"); + printf(" -h, --help Print this message and exit.\n"); + printf(" -s, --silent Do not print log.\n"); + printf("\n"); + printf("Mode options:\n"); printf(" --listnewconfig List new options\n"); + printf(" --helpnewconfig List new options and help text\n"); printf(" --oldaskconfig Start a new configuration using a line-oriented program\n"); printf(" --oldconfig Update a configuration using a provided .config as base\n"); printf(" --syncconfig Similar to oldconfig but generates configuration in\n" " include/{generated/,config/}\n"); printf(" --olddefconfig Same as oldconfig but sets new symbols to their default value\n"); - printf(" --oldnoconfig An alias of olddefconfig\n"); printf(" --defconfig New config with default defined in \n"); printf(" --savedefconfig Save the minimal current configuration to \n"); printf(" --allnoconfig New config where all options are answered with no\n"); @@ -489,6 +704,10 @@ static void conf_usage(const char *progname) printf(" --allmodconfig New config where all options are answered with mod\n"); printf(" --alldefconfig New config with all symbols set to default\n"); printf(" --randconfig New config with random answer to all options\n"); + printf(" --yes2modconfig Change answers from yes to mod if possible\n"); + printf(" --mod2yesconfig Change answers from mod to yes if possible\n"); + printf(" --mod2noconfig Change answers from mod to no if possible\n"); + printf(" (If none of the above is given, --oldaskconfig is the default)\n"); } int main(int ac, char **av) @@ -496,97 +715,60 @@ int main(int ac, char **av) const char *progname = av[0]; int opt; const char *name, *defconfig_file = NULL /* gcc uninit */; - struct stat tmpstat; - - setlocale(LC_ALL, ""); - bindtextdomain(PACKAGE, LOCALEDIR); - textdomain(PACKAGE); + int no_conf_write = 0; tty_stdio = isatty(0) && isatty(1); - while ((opt = getopt_long(ac, av, "s", long_opts, NULL)) != -1) { - if (opt == 's') { - conf_set_message_callback(NULL); - continue; - } - input_mode = (enum input_mode)opt; + while ((opt = getopt_long(ac, av, "hs", long_opts, NULL)) != -1) { switch (opt) { - case syncconfig: - sync_kconfig = 1; + case 'h': + conf_usage(progname); + exit(1); break; - case defconfig: - case savedefconfig: - defconfig_file = optarg; + case 's': + conf_set_message_callback(NULL); break; - case randconfig: - { - struct timeval now; - unsigned int seed; - char *seed_env; - - /* - * Use microseconds derived seed, - * compensate for systems where it may be zero - */ - gettimeofday(&now, NULL); - seed = (unsigned int)((now.tv_sec + 1) * (now.tv_usec + 1)); - - seed_env = getenv("KCONFIG_SEED"); - if( seed_env && *seed_env ) { - char *endp; - int tmp = (int)strtol(seed_env, &endp, 0); - if (*endp == '\0') { - seed = tmp; - } + case 0: + input_mode = input_mode_opt; + switch (input_mode) { + case syncconfig: + /* + * syncconfig is invoked during the build stage. + * Suppress distracting + * "configuration written to ..." + */ + conf_set_message_callback(NULL); + sync_kconfig = 1; + break; + case defconfig: + case savedefconfig: + defconfig_file = optarg; + break; + case randconfig: + set_randconfig_seed(); + break; + default: + break; } - fprintf( stderr, "KCONFIG_SEED=0x%X\n", seed ); - srand(seed); - break; - } - case oldaskconfig: - case oldconfig: - case allnoconfig: - case allyesconfig: - case allmodconfig: - case alldefconfig: - case listnewconfig: - case olddefconfig: - break; - case '?': - conf_usage(progname); - exit(1); + default: break; } } if (ac == optind) { - fprintf(stderr, _("%s: Kconfig file missing\n"), av[0]); + fprintf(stderr, "%s: Kconfig file missing\n", av[0]); conf_usage(progname); exit(1); } - name = av[optind]; - conf_parse(name); - if (sync_kconfig) { - name = conf_get_configname(); - if (stat(name, &tmpstat)) { - fprintf(stderr, _("***\n" - "*** Configuration file \"%s\" not found!\n" - "***\n" - "*** Please run some configurator (e.g. \"make oldconfig\" or\n" - "*** \"make menuconfig\" or \"make xconfig\").\n" - "***\n"), name); - exit(1); - } - } + conf_parse(av[optind]); + //zconfdump(stdout); switch (input_mode) { case defconfig: - if (!defconfig_file) - defconfig_file = conf_get_default_confname(); if (conf_read(defconfig_file)) { fprintf(stderr, - _("***\n" + "***\n" "*** Can't find default configuration \"%s\"!\n" - "***\n"), + "***\n", defconfig_file); exit(1); } @@ -596,7 +778,11 @@ int main(int ac, char **av) case oldaskconfig: case oldconfig: case listnewconfig: + case helpnewconfig: case olddefconfig: + case yes2modconfig: + case mod2yesconfig: + case mod2noconfig: conf_read(NULL); break; case allnoconfig: @@ -610,7 +796,7 @@ int main(int ac, char **av) if ((strcmp(name, "") != 0) && (strcmp(name, "1") != 0)) { if (conf_read_simple(name, S_DEF_USER)) { fprintf(stderr, - _("*** Can't read seed configuration \"%s\"!\n"), + "*** Can't read seed configuration \"%s\"!\n", name); exit(1); } @@ -627,7 +813,7 @@ int main(int ac, char **av) if (conf_read_simple(name, S_DEF_USER) && conf_read_simple("all.config", S_DEF_USER)) { fprintf(stderr, - _("*** KCONFIG_ALLCONFIG set, but no \"%s\" or \"all.config\" file found\n"), + "*** KCONFIG_ALLCONFIG set, but no \"%s\" or \"all.config\" file found\n", name); exit(1); } @@ -636,14 +822,18 @@ int main(int ac, char **av) break; } + if (conf_errors()) + exit(1); + if (sync_kconfig) { - if (conf_get_changed()) { - name = getenv("KCONFIG_NOSILENTUPDATE"); - if (name && *name) { + name = getenv("KCONFIG_NOSILENTUPDATE"); + if (name && *name) { + if (conf_get_changed()) { fprintf(stderr, - _("\n*** The configuration requires explicit update.\n\n")); + "\n*** The configuration requires explicit update.\n\n"); return 1; } + no_conf_write = 1; } } @@ -669,6 +859,15 @@ int main(int ac, char **av) break; case savedefconfig: break; + case yes2modconfig: + conf_rewrite_tristates(yes, mod); + break; + case mod2yesconfig: + conf_rewrite_tristates(mod, yes); + break; + case mod2noconfig: + conf_rewrite_tristates(mod, no); + break; case oldaskconfig: rootEntry = &rootmenu; conf(&rootmenu); @@ -676,6 +875,7 @@ int main(int ac, char **av) /* fall through */ case oldconfig: case listnewconfig: + case helpnewconfig: case syncconfig: /* Update until a loop caused no more changes */ do { @@ -688,29 +888,35 @@ int main(int ac, char **av) break; } - if (sync_kconfig) { - /* syncconfig is used during the build so we shall update autoconf. - * All other commands are only used to generate a config. - */ - if (conf_get_changed() && conf_write(NULL)) { - fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n")); - exit(1); - } - if (conf_write_autoconf()) { - fprintf(stderr, _("\n*** Error during update of the configuration.\n\n")); - return 1; - } - } else if (input_mode == savedefconfig) { + if (sym_dep_errors()) + exit(1); + + if (input_mode == savedefconfig) { if (conf_write_defconfig(defconfig_file)) { - fprintf(stderr, _("n*** Error while saving defconfig to: %s\n\n"), + fprintf(stderr, "n*** Error while saving defconfig to: %s\n\n", defconfig_file); return 1; } - } else if (input_mode != listnewconfig) { - if (conf_write(NULL)) { - fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n")); + } else if (input_mode != listnewconfig && input_mode != helpnewconfig) { + if (!no_conf_write && conf_write(NULL)) { + fprintf(stderr, "\n*** Error during writing of the configuration.\n\n"); exit(1); } + + /* + * Create auto.conf if it does not exist. + * This prevents GNU Make 4.1 or older from emitting + * "include/config/auto.conf: No such file or directory" + * in the top-level Makefile + * + * syncconfig always creates or updates auto.conf because it is + * used during the build. + */ + if (conf_write_autoconf(sync_kconfig) && sync_kconfig) { + fprintf(stderr, + "\n*** Error during sync of the configuration.\n\n"); + return 1; + } } return 0; } diff --git a/support/kconfig/confdata.c b/support/kconfig/confdata.c index 9ab980edd8..eb952e89ac 100644 --- a/support/kconfig/confdata.c +++ b/support/kconfig/confdata.c @@ -1,13 +1,17 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2002 Roman Zippel - * Released under the terms of the GNU GPL v2.0. */ +#include #include +#include #include #include #include +#include #include +#include #include #include #include @@ -15,12 +19,136 @@ #include #include +#include "internal.h" #include "lkc.h" -struct conf_printer { - void (*print_symbol)(FILE *, struct symbol *, const char *, void *); - void (*print_comment)(FILE *, const char *, void *); -}; +struct gstr autoconf_cmd; + +/* return true if 'path' exists, false otherwise */ +static bool is_present(const char *path) +{ + struct stat st; + + return !stat(path, &st); +} + +/* return true if 'path' exists and it is a directory, false otherwise */ +static bool is_dir(const char *path) +{ + struct stat st; + + if (stat(path, &st)) + return false; + + return S_ISDIR(st.st_mode); +} + +/* return true if the given two files are the same, false otherwise */ +static bool is_same(const char *file1, const char *file2) +{ + int fd1, fd2; + struct stat st1, st2; + void *map1, *map2; + bool ret = false; + + fd1 = open(file1, O_RDONLY); + if (fd1 < 0) + return ret; + + fd2 = open(file2, O_RDONLY); + if (fd2 < 0) + goto close1; + + ret = fstat(fd1, &st1); + if (ret) + goto close2; + ret = fstat(fd2, &st2); + if (ret) + goto close2; + + if (st1.st_size != st2.st_size) + goto close2; + + map1 = mmap(NULL, st1.st_size, PROT_READ, MAP_PRIVATE, fd1, 0); + if (map1 == MAP_FAILED) + goto close2; + + map2 = mmap(NULL, st2.st_size, PROT_READ, MAP_PRIVATE, fd2, 0); + if (map2 == MAP_FAILED) + goto close2; + + if (bcmp(map1, map2, st1.st_size)) + goto close2; + + ret = true; +close2: + close(fd2); +close1: + close(fd1); + + return ret; +} + +/* + * Create the parent directory of the given path. + * + * For example, if 'include/config/auto.conf' is given, create 'include/config'. + */ +static int make_parent_dir(const char *path) +{ + char tmp[PATH_MAX + 1]; + char *p; + + strncpy(tmp, path, sizeof(tmp)); + tmp[sizeof(tmp) - 1] = 0; + + /* Remove the base name. Just return if nothing is left */ + p = strrchr(tmp, '/'); + if (!p) + return 0; + *(p + 1) = 0; + + /* Just in case it is an absolute path */ + p = tmp; + while (*p == '/') + p++; + + while ((p = strchr(p, '/'))) { + *p = 0; + + /* skip if the directory exists */ + if (!is_dir(tmp) && mkdir(tmp, 0755)) + return -1; + + *p = '/'; + while (*p == '/') + p++; + } + + return 0; +} + +static char depfile_path[PATH_MAX]; +static size_t depfile_prefix_len; + +/* touch depfile for symbol 'name' */ +static int conf_touch_dep(const char *name) +{ + int fd; + + /* check overflow: prefix + name + '\0' must fit in buffer. */ + if (depfile_prefix_len + strlen(name) + 1 > sizeof(depfile_path)) + return -1; + + strcpy(depfile_path + depfile_prefix_len, name); + + fd = open(depfile_path, O_WRONLY | O_CREAT | O_TRUNC, 0644); + if (fd == -1) + return -1; + close(fd); + + return 0; +} static void conf_warning(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); @@ -31,7 +159,12 @@ static void conf_message(const char *fmt, ...) static const char *conf_filename; static int conf_lineno, conf_warnings; -const char conf_defname[] = ".defconfig"; +bool conf_errors(void) +{ + if (conf_warnings) + return getenv("KCONFIG_WERROR"); + return false; +} static void conf_warning(const char *fmt, ...) { @@ -44,16 +177,16 @@ static void conf_warning(const char *fmt, ...) conf_warnings++; } -static void conf_default_message_callback(const char *fmt, va_list ap) +static void conf_default_message_callback(const char *s) { printf("#\n# "); - vprintf(fmt, ap); + printf("%s", s); printf("\n#\n"); } -static void (*conf_message_callback) (const char *fmt, va_list ap) = +static void (*conf_message_callback)(const char *s) = conf_default_message_callback; -void conf_set_message_callback(void (*fn) (const char *fmt, va_list ap)) +void conf_set_message_callback(void (*fn)(const char *s)) { conf_message_callback = fn; } @@ -61,10 +194,15 @@ void conf_set_message_callback(void (*fn) (const char *fmt, va_list ap)) static void conf_message(const char *fmt, ...) { va_list ap; + char buf[4096]; + + if (!conf_message_callback) + return; va_start(ap, fmt); - if (conf_message_callback) - conf_message_callback(fmt, ap); + + vsnprintf(buf, sizeof(buf), fmt, ap); + conf_message_callback(buf); va_end(ap); } @@ -75,51 +213,23 @@ const char *conf_get_configname(void) return name ? name : ".config"; } -const char *conf_get_autoconfig_name(void) +static const char *conf_get_autoconfig_name(void) { return getenv("KCONFIG_AUTOCONFIG"); } -static char *conf_expand_value(const char *in) +static const char *conf_get_autoheader_name(void) { - struct symbol *sym; - const char *src; - static char res_value[SYMBOL_MAXLENGTH]; - char *dst, name[SYMBOL_MAXLENGTH]; - - res_value[0] = 0; - dst = name; - while ((src = strchr(in, '$'))) { - strncat(res_value, in, src - in); - src++; - dst = name; - while (isalnum(*src) || *src == '_') - *dst++ = *src++; - *dst = 0; - sym = sym_lookup(name, 0); - sym_calc_value(sym); - strcat(res_value, sym_get_string_value(sym)); - in = src; - } - strcat(res_value, in); + char *name = getenv("KCONFIG_AUTOHEADER"); - return res_value; + return name ? name : "include/generated/autoconf.h"; } -char *conf_get_default_confname(void) +static const char *conf_get_rustccfg_name(void) { - struct stat buf; - static char fullname[PATH_MAX+1]; - char *env, *name; - - name = conf_expand_value(conf_defname); - env = getenv(SRCTREE); - if (env) { - sprintf(fullname, "%s/%s", env, name); - if (!stat(fullname, &buf)) - return fullname; - } - return name; + char *name = getenv("KCONFIG_RUSTCCFG"); + + return name ? name : "include/generated/rustc_cfg"; } static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) @@ -149,33 +259,26 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) conf_warning("symbol value '%s' invalid for %s", p, sym->name); return 1; - case S_OTHER: - if (*p != '"') { - for (p2 = p; *p2 && !isspace(*p2); p2++) - ; - sym->type = S_STRING; - goto done; - } - /* fall through */ case S_STRING: - if (*p++ != '"') - break; - for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) { - if (*p2 == '"') { - *p2 = 0; + /* No escaping for S_DEF_AUTO (include/config/auto.conf) */ + if (def != S_DEF_AUTO) { + if (*p++ != '"') break; + for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) { + if (*p2 == '"') { + *p2 = 0; + break; + } + memmove(p2, p2 + 1, strlen(p2)); } - memmove(p2, p2 + 1, strlen(p2)); - } - if (!p2) { - if (def != S_DEF_AUTO) + if (!p2) { conf_warning("invalid string found"); - return 1; + return 1; + } } /* fall through */ case S_INT: case S_HEX: - done: if (sym_string_valid(sym, p)) { sym->def[def].val = xstrdup(p); sym->flags |= def_flags; @@ -192,59 +295,24 @@ static int conf_set_sym_val(struct symbol *sym, int def, int def_flags, char *p) return 0; } -#define LINE_GROWTH 16 -static int add_byte(int c, char **lineptr, size_t slen, size_t *n) +/* like getline(), but the newline character is stripped away */ +static ssize_t getline_stripped(char **lineptr, size_t *n, FILE *stream) { - char *nline; - size_t new_size = slen + 1; - if (new_size > *n) { - new_size += LINE_GROWTH - 1; - new_size *= 2; - nline = xrealloc(*lineptr, new_size); - if (!nline) - return -1; + ssize_t len; - *lineptr = nline; - *n = new_size; - } - - (*lineptr)[slen] = c; - - return 0; -} - -static ssize_t compat_getline(char **lineptr, size_t *n, FILE *stream) -{ - char *line = *lineptr; - size_t slen = 0; + len = getline(lineptr, n, stream); - for (;;) { - int c = getc(stream); + if (len > 0 && (*lineptr)[len - 1] == '\n') { + len--; + (*lineptr)[len] = '\0'; - switch (c) { - case '\n': - if (add_byte(c, &line, slen, n) < 0) - goto e_out; - slen++; - /* fall through */ - case EOF: - if (add_byte('\0', &line, slen, n) < 0) - goto e_out; - *lineptr = line; - if (slen == 0) - return -1; - return slen; - default: - if (add_byte(c, &line, slen, n) < 0) - goto e_out; - slen++; + if (len > 0 && (*lineptr)[len - 1] == '\r') { + len--; + (*lineptr)[len] = '\0'; } } -e_out: - line[slen-1] = '\0'; - *lineptr = line; - return -1; + return len; } int conf_read_simple(const char *name, int def) @@ -252,34 +320,55 @@ int conf_read_simple(const char *name, int def) FILE *in = NULL; char *line = NULL; size_t line_asize = 0; - char *p, *p2; + char *p, *val; struct symbol *sym; - int i, def_flags; + int def_flags; + const char *warn_unknown, *sym_name; + warn_unknown = getenv("KCONFIG_WARN_UNKNOWN_SYMBOLS"); if (name) { in = zconf_fopen(name); } else { - struct property *prop; + char *env; name = conf_get_configname(); in = zconf_fopen(name); if (in) goto load; - sym_add_change_count(1); - if (!sym_defconfig_list) + conf_set_changed(true); + + env = getenv("KCONFIG_DEFCONFIG_LIST"); + if (!env) return 1; - for_all_defaults(sym_defconfig_list, prop) { - if (expr_calc_value(prop->visible.expr) == no || - prop->expr->type != E_SYMBOL) - continue; - name = conf_expand_value(prop->expr->left.sym->name); - in = zconf_fopen(name); + while (1) { + bool is_last; + + while (isspace(*env)) + env++; + + if (!*env) + break; + + p = env; + while (*p && !isspace(*p)) + p++; + + is_last = (*p == '\0'); + + *p = '\0'; + + in = zconf_fopen(env); if (in) { - conf_message(_("using defaults found in %s"), - name); + conf_message("using defaults found in %s", + env); goto load; } + + if (is_last) + break; + + env = p + 1; } } if (!in) @@ -291,7 +380,7 @@ load: conf_warnings = 0; def_flags = SYMBOL_DEF << def; - for_all_symbols(i, sym) { + for_all_symbols(sym) { sym->flags |= SYMBOL_CHANGED; sym->flags &= ~(def_flags|SYMBOL_VALID); if (sym_is_choice(sym)) @@ -300,8 +389,7 @@ load: case S_INT: case S_HEX: case S_STRING: - if (sym->def[def].val) - free(sym->def[def].val); + free(sym->def[def].val); /* fall through */ default: sym->def[def].val = NULL; @@ -309,76 +397,68 @@ load: } } - while (compat_getline(&line, &line_asize, in) != -1) { + while (getline_stripped(&line, &line_asize, in) != -1) { conf_lineno++; - sym = NULL; + + if (!line[0]) /* blank line */ + continue; + if (line[0] == '#') { - if (memcmp(line + 2, CONFIG_, strlen(CONFIG_))) + if (line[1] != ' ') continue; - p = strchr(line + 2 + strlen(CONFIG_), ' '); + p = line + 2; + if (memcmp(p, CONFIG_, strlen(CONFIG_))) + continue; + sym_name = p + strlen(CONFIG_); + p = strchr(sym_name, ' '); if (!p) continue; *p++ = 0; - if (strncmp(p, "is not set", 10)) + if (strcmp(p, "is not set")) + continue; + + val = "n"; + } else { + if (memcmp(line, CONFIG_, strlen(CONFIG_))) { + conf_warning("unexpected data: %s", line); continue; - if (def == S_DEF_USER) { - sym = sym_find(line + 2 + strlen(CONFIG_)); - if (!sym) { - sym_add_change_count(1); - goto setsym; - } - } else { - sym = sym_lookup(line + 2 + strlen(CONFIG_), 0); - if (sym->type == S_UNKNOWN) - sym->type = S_BOOLEAN; - } - if (sym->flags & def_flags) { - conf_warning("override: reassigning to symbol %s", sym->name); - } - switch (sym->type) { - case S_BOOLEAN: - case S_TRISTATE: - sym->def[def].tri = no; - sym->flags |= def_flags; - break; - default: - ; } - } else if (memcmp(line, CONFIG_, strlen(CONFIG_)) == 0) { - p = strchr(line + strlen(CONFIG_), '='); - if (!p) + + sym_name = line + strlen(CONFIG_); + p = strchr(sym_name, '='); + if (!p) { + conf_warning("unexpected data: %s", line); continue; - *p++ = 0; - p2 = strchr(p, '\n'); - if (p2) { - *p2-- = 0; - if (*p2 == '\r') - *p2 = 0; } - if (def == S_DEF_USER) { - sym = sym_find(line + strlen(CONFIG_)); - if (!sym) { - sym_add_change_count(1); - goto setsym; - } + *p = 0; + val = p + 1; + } + + sym = sym_find(sym_name); + if (!sym) { + if (def == S_DEF_AUTO) { + /* + * Reading from include/config/auto.conf. + * If CONFIG_FOO previously existed in auto.conf + * but it is missing now, include/config/FOO + * must be touched. + */ + conf_touch_dep(sym_name); } else { - sym = sym_lookup(line + strlen(CONFIG_), 0); - if (sym->type == S_UNKNOWN) - sym->type = S_OTHER; - } - if (sym->flags & def_flags) { - conf_warning("override: reassigning to symbol %s", sym->name); - } - if (conf_set_sym_val(sym, def, def_flags, p)) - continue; - } else { - if (line[0] != '\r' && line[0] != '\n') - conf_warning("unexpected data: %.*s", - (int)strcspn(line, "\r\n"), line); + if (warn_unknown) + conf_warning("unknown symbol: %s", sym_name); + conf_set_changed(true); + } continue; } -setsym: + + if (sym->flags & def_flags) + conf_warning("override: reassigning to symbol %s", sym->name); + + if (conf_set_sym_val(sym, def, def_flags, val)) + continue; + if (sym && sym_is_choice_value(sym)) { struct symbol *cs = prop_get_symbol(sym_get_choice_prop(sym)); switch (sym->def[def].tri) { @@ -401,6 +481,7 @@ setsym: } free(line); fclose(in); + return 0; } @@ -408,9 +489,8 @@ int conf_read(const char *name) { struct symbol *sym; int conf_unsaved = 0; - int i; - sym_set_change_count(0); + conf_set_changed(false); if (conf_read_simple(name, S_DEF_USER)) { sym_calc_value(modules_sym); @@ -419,20 +499,18 @@ int conf_read(const char *name) sym_calc_value(modules_sym); - for_all_symbols(i, sym) { + for_all_symbols(sym) { sym_calc_value(sym); - if (sym_is_choice(sym) || (sym->flags & SYMBOL_AUTO)) + if (sym_is_choice(sym) || (sym->flags & SYMBOL_NO_WRITE)) continue; if (sym_has_value(sym) && (sym->flags & SYMBOL_WRITE)) { /* check that calculated value agrees with saved value */ switch (sym->type) { case S_BOOLEAN: case S_TRISTATE: - if (sym->def[S_DEF_USER].tri != sym_get_tristate_value(sym)) - break; - if (!sym_is_choice(sym)) + if (sym->def[S_DEF_USER].tri == sym_get_tristate_value(sym)) continue; - /* fall through */ + break; default: if (!strcmp(sym->curr.val, sym->def[S_DEF_USER].val)) continue; @@ -445,7 +523,7 @@ int conf_read(const char *name) /* maybe print value in verbose mode... */ } - for_all_symbols(i, sym) { + for_all_symbols(sym) { if (sym_has_value(sym) && !sym_is_choice_value(sym)) { /* Reset values of generates values, so they'll appear * as new, if they should become visible, but that @@ -461,7 +539,7 @@ int conf_read(const char *name) /* Reset a string value if it's out of range */ if (sym_string_within_range(sym, sym->def[S_DEF_USER].val)) break; - sym->flags &= ~(SYMBOL_VALID|SYMBOL_DEF_USER); + sym->flags &= ~SYMBOL_VALID; conf_unsaved++; break; default: @@ -470,194 +548,232 @@ int conf_read(const char *name) } } - sym_add_change_count(conf_warnings || conf_unsaved); + if (conf_warnings || conf_unsaved) + conf_set_changed(true); return 0; } -/* - * Kconfig configuration printer - * - * This printer is used when generating the resulting configuration after - * kconfig invocation and `defconfig' files. Unset symbol might be omitted by - * passing a non-NULL argument to the printer. - * - */ -static void -kconfig_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) +struct comment_style { + const char *decoration; + const char *prefix; + const char *postfix; +}; + +static const struct comment_style comment_style_pound = { + .decoration = "#", + .prefix = "#", + .postfix = "#", +}; + +static const struct comment_style comment_style_c = { + .decoration = " *", + .prefix = "/*", + .postfix = " */", +}; + +static void conf_write_heading(FILE *fp, const struct comment_style *cs) { + if (!cs) + return; - switch (sym->type) { - case S_BOOLEAN: - case S_TRISTATE: - if (*value == 'n') { - bool skip_unset = (arg != NULL); + fprintf(fp, "%s\n", cs->prefix); - if (!skip_unset) - fprintf(fp, "# %s%s is not set\n", - CONFIG_, sym->name); - return; - } - break; - default: - break; - } + fprintf(fp, "%s Automatically generated file; DO NOT EDIT.\n", + cs->decoration); + + fprintf(fp, "%s %s\n", cs->decoration, rootmenu.prompt->text); - fprintf(fp, "%s%s=%s\n", CONFIG_, sym->name, value); + fprintf(fp, "%s\n", cs->postfix); } -static void -kconfig_print_comment(FILE *fp, const char *value, void *arg) +/* The returned pointer must be freed on the caller side */ +static char *escape_string_value(const char *in) { - const char *p = value; - size_t l; - - for (;;) { - l = strcspn(p, "\n"); - fprintf(fp, "#"); - if (l) { - fprintf(fp, " "); - xfwrite(p, l, 1, fp); - p += l; - } - fprintf(fp, "\n"); - if (*p++ == '\0') + const char *p; + char *out; + size_t len; + + len = strlen(in) + strlen("\"\"") + 1; + + p = in; + while (1) { + p += strcspn(p, "\"\\"); + + if (p[0] == '\0') + break; + + len++; + p++; + } + + out = xmalloc(len); + out[0] = '\0'; + + strcat(out, "\""); + + p = in; + while (1) { + len = strcspn(p, "\"\\"); + strncat(out, p, len); + p += len; + + if (p[0] == '\0') break; + + strcat(out, "\\"); + strncat(out, p++, 1); } + + strcat(out, "\""); + + return out; } -static struct conf_printer kconfig_printer_cb = +enum output_n { OUTPUT_N, OUTPUT_N_AS_UNSET, OUTPUT_N_NONE }; + +static void __print_symbol(FILE *fp, struct symbol *sym, enum output_n output_n, + bool escape_string) { - .print_symbol = kconfig_print_symbol, - .print_comment = kconfig_print_comment, -}; + const char *val; + char *escaped = NULL; -/* - * Header printer - * - * This printer is used when generating the `include/generated/autoconf.h' file. - */ -static void -header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) + if (sym->type == S_UNKNOWN) + return; + + val = sym_get_string_value(sym); + + if ((sym->type == S_BOOLEAN || sym->type == S_TRISTATE) && + output_n != OUTPUT_N && *val == 'n') { + if (output_n == OUTPUT_N_AS_UNSET) + fprintf(fp, "# %s%s is not set\n", CONFIG_, sym->name); + return; + } + + if (sym->type == S_STRING && escape_string) { + escaped = escape_string_value(val); + val = escaped; + } + + fprintf(fp, "%s%s=%s\n", CONFIG_, sym->name, val); + + free(escaped); +} + +static void print_symbol_for_dotconfig(FILE *fp, struct symbol *sym) +{ + __print_symbol(fp, sym, OUTPUT_N_AS_UNSET, true); +} + +static void print_symbol_for_autoconf(FILE *fp, struct symbol *sym) +{ + __print_symbol(fp, sym, OUTPUT_N_NONE, false); +} + +void print_symbol_for_listconfig(struct symbol *sym) +{ + __print_symbol(stdout, sym, OUTPUT_N, true); +} + +static void print_symbol_for_c(FILE *fp, struct symbol *sym) { + const char *val; + const char *sym_suffix = ""; + const char *val_prefix = ""; + char *escaped = NULL; + + if (sym->type == S_UNKNOWN) + return; + + val = sym_get_string_value(sym); switch (sym->type) { case S_BOOLEAN: - case S_TRISTATE: { - const char *suffix = ""; - - switch (*value) { + case S_TRISTATE: + switch (*val) { case 'n': - break; + return; case 'm': - suffix = "_MODULE"; + sym_suffix = "_MODULE"; /* fall through */ default: - fprintf(fp, "#define %s%s%s 1\n", - CONFIG_, sym->name, suffix); + val = "1"; } break; - } - case S_HEX: { - const char *prefix = ""; - - if (value[0] != '0' || (value[1] != 'x' && value[1] != 'X')) - prefix = "0x"; - fprintf(fp, "#define %s%s %s%s\n", - CONFIG_, sym->name, prefix, value); + case S_HEX: + if (val[0] != '0' || (val[1] != 'x' && val[1] != 'X')) + val_prefix = "0x"; break; - } case S_STRING: - case S_INT: - fprintf(fp, "#define %s%s %s\n", - CONFIG_, sym->name, value); - break; + escaped = escape_string_value(val); + val = escaped; default: break; } -} + fprintf(fp, "#define %s%s%s %s%s\n", CONFIG_, sym->name, sym_suffix, + val_prefix, val); -static void -header_print_comment(FILE *fp, const char *value, void *arg) -{ - const char *p = value; - size_t l; - - fprintf(fp, "/*\n"); - for (;;) { - l = strcspn(p, "\n"); - fprintf(fp, " *"); - if (l) { - fprintf(fp, " "); - xfwrite(p, l, 1, fp); - p += l; - } - fprintf(fp, "\n"); - if (*p++ == '\0') - break; - } - fprintf(fp, " */\n"); + free(escaped); } -static struct conf_printer header_printer_cb = -{ - .print_symbol = header_print_symbol, - .print_comment = header_print_comment, -}; - -/* - * Tristate printer - * - * This printer is used when generating the `include/config/tristate.conf' file. - */ -static void -tristate_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) +static void print_symbol_for_rustccfg(FILE *fp, struct symbol *sym) { + const char *val; + const char *val_prefix = ""; + char *val_prefixed = NULL; + size_t val_prefixed_len; + char *escaped = NULL; - if (sym->type == S_TRISTATE && *value != 'n') - fprintf(fp, "%s%s=%c\n", CONFIG_, sym->name, (char)toupper(*value)); -} - -static struct conf_printer tristate_printer_cb = -{ - .print_symbol = tristate_print_symbol, - .print_comment = kconfig_print_comment, -}; + if (sym->type == S_UNKNOWN) + return; -static void conf_write_symbol(FILE *fp, struct symbol *sym, - struct conf_printer *printer, void *printer_arg) -{ - const char *str; + val = sym_get_string_value(sym); switch (sym->type) { - case S_OTHER: - case S_UNKNOWN: + case S_BOOLEAN: + case S_TRISTATE: + /* + * We do not care about disabled ones, i.e. no need for + * what otherwise are "comments" in other printers. + */ + if (*val == 'n') + return; + + /* + * To have similar functionality to the C macro `IS_ENABLED()` + * we provide an empty `--cfg CONFIG_X` here in both `y` + * and `m` cases. + * + * Then, the common `fprintf()` below will also give us + * a `--cfg CONFIG_X="y"` or `--cfg CONFIG_X="m"`, which can + * be used as the equivalent of `IS_BUILTIN()`/`IS_MODULE()`. + */ + fprintf(fp, "--cfg=%s%s\n", CONFIG_, sym->name); break; - case S_STRING: - str = sym_get_string_value(sym); - str = sym_escape_string_value(str); - printer->print_symbol(fp, sym, str, printer_arg); - free((void *)str); + case S_HEX: + if (val[0] != '0' || (val[1] != 'x' && val[1] != 'X')) + val_prefix = "0x"; break; default: - str = sym_get_string_value(sym); - printer->print_symbol(fp, sym, str, printer_arg); + break; } -} -static void -conf_write_heading(FILE *fp, struct conf_printer *printer, void *printer_arg) -{ - char buf[256]; + if (strlen(val_prefix) > 0) { + val_prefixed_len = strlen(val) + strlen(val_prefix) + 1; + val_prefixed = xmalloc(val_prefixed_len); + snprintf(val_prefixed, val_prefixed_len, "%s%s", val_prefix, val); + val = val_prefixed; + } + + /* All values get escaped: the `--cfg` option only takes strings */ + escaped = escape_string_value(val); + val = escaped; - snprintf(buf, sizeof(buf), - "\n" - "Automatically generated file; DO NOT EDIT.\n" - "%s\n", - rootmenu.prompt->text); + fprintf(fp, "--cfg=%s%s=%s\n", CONFIG_, sym->name, val); - printer->print_comment(fp, buf, printer_arg); + free(escaped); + free(val_prefixed); } /* @@ -682,16 +798,13 @@ int conf_write_defconfig(const char *filename) while (menu != NULL) { sym = menu->sym; - if (sym == NULL) { - if (!menu_is_visible(menu)) - goto next_menu; - } else if (!sym_is_choice(sym)) { + if (sym && !sym_is_choice(sym)) { sym_calc_value(sym); if (!(sym->flags & SYMBOL_WRITE)) goto next_menu; sym->flags &= ~SYMBOL_WRITE; /* If we cannot change the symbol - skip */ - if (!sym_is_changable(sym)) + if (!sym_is_changeable(sym)) goto next_menu; /* If symbol equals to default value - skip */ if (strcmp(sym_get_string_value(sym), sym_get_string_default(sym)) == 0) @@ -716,7 +829,7 @@ int conf_write_defconfig(const char *filename) goto next_menu; } } - conf_write_symbol(out, sym, &kconfig_printer_cb, NULL); + print_symbol_for_dotconfig(out, sym); } next_menu: if (menu->list != NULL) { @@ -742,49 +855,40 @@ int conf_write(const char *name) FILE *out; struct symbol *sym; struct menu *menu; - const char *basename; const char *str; - char dirname[PATH_MAX+1], tmpname[PATH_MAX+20], newname[PATH_MAX+1]; + char tmpname[PATH_MAX + 1], oldname[PATH_MAX + 1]; char *env; + bool need_newline = false; if (!name) name = conf_get_configname(); - dirname[0] = 0; - if (name && name[0]) { - struct stat st; - char *slash; - - if (!stat(name, &st) && S_ISDIR(st.st_mode)) { - strcpy(dirname, name); - strcat(dirname, "/"); - basename = conf_get_configname(); - } else if ((slash = strrchr(name, '/'))) { - int size = slash - name + 1; - memcpy(dirname, name, size); - dirname[size] = 0; - if (slash[1]) - basename = slash + 1; - else - basename = conf_get_configname(); - } else - basename = name; - } else - basename = conf_get_configname(); - - sprintf(newname, "%s%s", dirname, basename); + if (!*name) { + fprintf(stderr, "config name is empty\n"); + return -1; + } + + if (is_dir(name)) { + fprintf(stderr, "%s: Is a directory\n", name); + return -1; + } + + if (make_parent_dir(name)) + return -1; + env = getenv("KCONFIG_OVERWRITECONFIG"); - if (!env || !*env) { - sprintf(tmpname, "%s.tmpconfig.%d", dirname, (int)getpid()); - out = fopen(tmpname, "w"); - } else { + if (env && *env) { *tmpname = 0; - out = fopen(newname, "w"); + out = fopen(name, "w"); + } else { + snprintf(tmpname, sizeof(tmpname), "%s.%d.tmp", + name, (int)getpid()); + out = fopen(tmpname, "w"); } if (!out) return 1; - conf_write_heading(out, &kconfig_printer_cb, NULL); + conf_write_heading(out, &comment_style_pound); if (!conf_get_changed()) sym_clear_all_valid(); @@ -800,13 +904,18 @@ int conf_write(const char *name) "#\n" "# %s\n" "#\n", str); - } else if (!(sym->flags & SYMBOL_CHOICE)) { + need_newline = false; + } else if (!(sym->flags & SYMBOL_CHOICE) && + !(sym->flags & SYMBOL_WRITTEN)) { sym_calc_value(sym); if (!(sym->flags & SYMBOL_WRITE)) goto next; - sym->flags &= ~SYMBOL_WRITE; - - conf_write_symbol(out, sym, &kconfig_printer_cb, NULL); + if (need_newline) { + fprintf(out, "\n"); + need_newline = false; + } + sym->flags |= SYMBOL_WRITTEN; + print_symbol_for_dotconfig(out, sym); } next: @@ -814,65 +923,111 @@ next: menu = menu->list; continue; } - if (menu->next) + +end_check: + if (!menu->sym && menu_is_visible(menu) && menu != &rootmenu && + menu->prompt->type == P_MENU) { + fprintf(out, "# end of %s\n", menu_get_prompt(menu)); + need_newline = true; + } + + if (menu->next) { menu = menu->next; - else while ((menu = menu->parent)) { - if (menu->next) { - menu = menu->next; - break; - } + } else { + menu = menu->parent; + if (menu) + goto end_check; } } fclose(out); + for_all_symbols(sym) + sym->flags &= ~SYMBOL_WRITTEN; + if (*tmpname) { - strcat(dirname, basename); - strcat(dirname, ".old"); - rename(newname, dirname); - if (rename(tmpname, newname)) + if (is_same(name, tmpname)) { + conf_message("No change to %s", name); + unlink(tmpname); + conf_set_changed(false); + return 0; + } + + snprintf(oldname, sizeof(oldname), "%s.old", name); + rename(name, oldname); + if (rename(tmpname, name)) return 1; } - conf_message(_("configuration written to %s"), newname); + conf_message("configuration written to %s", name); + + conf_set_changed(false); + + return 0; +} + +/* write a dependency file as used by kbuild to track dependencies */ +static int conf_write_autoconf_cmd(const char *autoconf_name) +{ + char name[PATH_MAX], tmp[PATH_MAX]; + FILE *out; + int ret; + + ret = snprintf(name, sizeof(name), "%s.cmd", autoconf_name); + if (ret >= sizeof(name)) /* check truncation */ + return -1; + + if (make_parent_dir(name)) + return -1; + + ret = snprintf(tmp, sizeof(tmp), "%s.cmd.tmp", autoconf_name); + if (ret >= sizeof(tmp)) /* check truncation */ + return -1; + + out = fopen(tmp, "w"); + if (!out) { + perror("fopen"); + return -1; + } + + fprintf(out, "autoconfig := %s\n", autoconf_name); + + fputs(str_get(&autoconf_cmd), out); + + fflush(out); + ret = ferror(out); /* error check for all fprintf() calls */ + fclose(out); + if (ret) + return -1; - sym_set_change_count(0); + if (rename(tmp, name)) { + perror("rename"); + return -1; + } return 0; } -static int conf_split_config(void) +static int conf_touch_deps(void) { - const char *name; - char path[PATH_MAX+1]; - char *opwd, *dir, *_name; - char *s, *d, c; + const char *name, *tmp; struct symbol *sym; - struct stat sb; - int res, i, fd; + int res; name = conf_get_autoconfig_name(); + tmp = strrchr(name, '/'); + depfile_prefix_len = tmp ? tmp - name + 1 : 0; + if (depfile_prefix_len + 1 > sizeof(depfile_path)) + return -1; + + strncpy(depfile_path, name, depfile_prefix_len); + depfile_path[depfile_prefix_len] = 0; + conf_read_simple(name, S_DEF_AUTO); sym_calc_value(modules_sym); - opwd = malloc(256); - _name = strdup(name); - if (opwd == NULL || _name == NULL) - return 1; - opwd = getcwd(opwd, 256); - dir = dirname(_name); - if (dir == NULL) { - res = 1; - goto err; - } - if (chdir(dir)) { - res = 1; - goto err; - } - - res = 0; - for_all_symbols(i, sym) { + for_all_symbols(sym) { sym_calc_value(sym); - if ((sym->flags & SYMBOL_AUTO) || !sym->name) + if ((sym->flags & SYMBOL_NO_WRITE) || !sym->name) continue; if (sym->flags & SYMBOL_WRITE) { if (sym->flags & SYMBOL_DEF_AUTO) { @@ -921,163 +1076,118 @@ static int conf_split_config(void) * different from 'no'). */ - /* Replace all '_' and append ".h" */ - s = sym->name; - d = path; - while ((c = *s++)) { - c = tolower(c); - *d++ = (c == '_') ? '/' : c; - } - strcpy(d, ".h"); - - /* Assume directory path already exists. */ - fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644); - if (fd == -1) { - if (errno != ENOENT) { - res = 1; - break; - } - /* - * Create directory components, - * unless they exist already. - */ - d = path; - while ((d = strchr(d, '/'))) { - *d = 0; - if (stat(path, &sb) && mkdir(path, 0755)) { - res = 1; - goto out; - } - *d++ = '/'; - } - /* Try it again. */ - fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644); - if (fd == -1) { - res = 1; - break; - } - } - close(fd); + res = conf_touch_dep(sym->name); + if (res) + return res; } -out: - if (chdir(opwd)) - res = 1; -err: - free(opwd); - free(_name); - return res; + + return 0; } -int conf_write_autoconf(void) +static int __conf_write_autoconf(const char *filename, + void (*print_symbol)(FILE *, struct symbol *), + const struct comment_style *comment_style) { + char tmp[PATH_MAX]; + FILE *file; struct symbol *sym; - const char *name; - FILE *out, *tristate, *out_h; - int i; - char dir[PATH_MAX+1], buf[PATH_MAX+20]; - char *s; - - strcpy(dir, conf_get_configname()); - s = strrchr(dir, '/'); - if (s) - s[1] = 0; - else - dir[0] = 0; + int ret; - sym_clear_all_valid(); + if (make_parent_dir(filename)) + return -1; - sprintf(buf, "%s.config.cmd", dir); - file_write_dep(buf); + ret = snprintf(tmp, sizeof(tmp), "%s.tmp", filename); + if (ret >= sizeof(tmp)) /* check truncation */ + return -1; - if (conf_split_config()) - return 1; + file = fopen(tmp, "w"); + if (!file) { + perror("fopen"); + return -1; + } - sprintf(buf, "%s.tmpconfig", dir); - out = fopen(buf, "w"); - if (!out) - return 1; + conf_write_heading(file, comment_style); - sprintf(buf, "%s.tmpconfig_tristate", dir); - tristate = fopen(buf, "w"); - if (!tristate) { - fclose(out); - return 1; - } + for_all_symbols(sym) + if ((sym->flags & SYMBOL_WRITE) && sym->name) + print_symbol(file, sym); - sprintf(buf, "%s.tmpconfig.h", dir); - out_h = fopen(buf, "w"); - if (!out_h) { - fclose(out); - fclose(tristate); - return 1; + fflush(file); + /* check possible errors in conf_write_heading() and print_symbol() */ + ret = ferror(file); + fclose(file); + if (ret) + return -1; + + if (rename(tmp, filename)) { + perror("rename"); + return -1; } - conf_write_heading(out, &kconfig_printer_cb, NULL); + return 0; +} - conf_write_heading(tristate, &tristate_printer_cb, NULL); +int conf_write_autoconf(int overwrite) +{ + struct symbol *sym; + const char *autoconf_name = conf_get_autoconfig_name(); + int ret; - conf_write_heading(out_h, &header_printer_cb, NULL); + if (!overwrite && is_present(autoconf_name)) + return 0; - for_all_symbols(i, sym) { - sym_calc_value(sym); - if (!(sym->flags & SYMBOL_WRITE) || !sym->name) - continue; + ret = conf_write_autoconf_cmd(autoconf_name); + if (ret) + return -1; - /* write symbol to auto.conf, tristate and header files */ - conf_write_symbol(out, sym, &kconfig_printer_cb, (void *)1); + if (conf_touch_deps()) + return 1; - conf_write_symbol(tristate, sym, &tristate_printer_cb, (void *)1); + for_all_symbols(sym) + sym_calc_value(sym); - conf_write_symbol(out_h, sym, &header_printer_cb, NULL); - } - fclose(out); - fclose(tristate); - fclose(out_h); + ret = __conf_write_autoconf(conf_get_autoheader_name(), + print_symbol_for_c, + &comment_style_c); + if (ret) + return ret; + + ret = __conf_write_autoconf(conf_get_rustccfg_name(), + print_symbol_for_rustccfg, + NULL); + if (ret) + return ret; - name = getenv("KCONFIG_AUTOHEADER"); - if (!name) - name = "include/generated/autoconf.h"; - sprintf(buf, "%s.tmpconfig.h", dir); - if (rename(buf, name)) - return 1; - name = getenv("KCONFIG_TRISTATE"); - if (!name) - name = "include/config/tristate.conf"; - sprintf(buf, "%s.tmpconfig_tristate", dir); - if (rename(buf, name)) - return 1; - name = conf_get_autoconfig_name(); /* - * This must be the last step, kbuild has a dependency on auto.conf - * and this marks the successful completion of the previous steps. + * Create include/config/auto.conf. This must be the last step because + * Kbuild has a dependency on auto.conf and this marks the successful + * completion of the previous steps. */ - sprintf(buf, "%s.tmpconfig", dir); - if (rename(buf, name)) - return 1; + ret = __conf_write_autoconf(conf_get_autoconfig_name(), + print_symbol_for_autoconf, + &comment_style_pound); + if (ret) + return ret; return 0; } -static int sym_change_count; +static bool conf_changed; static void (*conf_changed_callback)(void); -void sym_set_change_count(int count) +void conf_set_changed(bool val) { - int _sym_change_count = sym_change_count; - sym_change_count = count; - if (conf_changed_callback && - (bool)_sym_change_count != (bool)count) - conf_changed_callback(); -} + bool changed = conf_changed != val; -void sym_add_change_count(int count) -{ - sym_set_change_count(count + sym_change_count); + conf_changed = val; + + if (conf_changed_callback && changed) + conf_changed_callback(); } bool conf_get_changed(void) { - return sym_change_count; + return conf_changed; } void conf_set_changed_callback(void (*fn)(void)) @@ -1085,54 +1195,6 @@ void conf_set_changed_callback(void (*fn)(void)) conf_changed_callback = fn; } -static bool randomize_choice_values(struct symbol *csym) -{ - struct property *prop; - struct symbol *sym; - struct expr *e; - int cnt, def; - - /* - * If choice is mod then we may have more items selected - * and if no then no-one. - * In both cases stop. - */ - if (csym->curr.tri != yes) - return false; - - prop = sym_get_choice_prop(csym); - - /* count entries in choice block */ - cnt = 0; - expr_list_for_each_sym(prop->expr, e, sym) - cnt++; - - /* - * find a random value and set it to yes, - * set the rest to no so we have only one set - */ - def = (rand() % cnt); - - cnt = 0; - expr_list_for_each_sym(prop->expr, e, sym) { - if (def == cnt++) { - sym->def[S_DEF_USER].tri = yes; - csym->def[S_DEF_USER].val = sym; - } - else { - sym->def[S_DEF_USER].tri = no; - } - sym->flags |= SYMBOL_DEF_USER; - /* clear VALID to get value calculated */ - sym->flags &= ~SYMBOL_VALID; - } - csym->flags |= SYMBOL_DEF_USER; - /* clear VALID to get value calculated */ - csym->flags &= ~(SYMBOL_VALID); - - return true; -} - void set_all_choice_values(struct symbol *csym) { struct property *prop; @@ -1152,131 +1214,3 @@ void set_all_choice_values(struct symbol *csym) /* clear VALID to get value calculated */ csym->flags &= ~(SYMBOL_VALID | SYMBOL_NEED_SET_CHOICE_VALUES); } - -bool conf_set_all_new_symbols(enum conf_def_mode mode) -{ - struct symbol *sym, *csym; - int i, cnt, pby, pty, ptm; /* pby: probability of bool = y - * pty: probability of tristate = y - * ptm: probability of tristate = m - */ - - pby = 50; pty = ptm = 33; /* can't go as the default in switch-case - * below, otherwise gcc whines about - * -Wmaybe-uninitialized */ - if (mode == def_random) { - int n, p[3]; - char *env = getenv("KCONFIG_PROBABILITY"); - n = 0; - while( env && *env ) { - char *endp; - int tmp = strtol( env, &endp, 10 ); - if( tmp >= 0 && tmp <= 100 ) { - p[n++] = tmp; - } else { - errno = ERANGE; - perror( "KCONFIG_PROBABILITY" ); - exit( 1 ); - } - env = (*endp == ':') ? endp+1 : endp; - if( n >=3 ) { - break; - } - } - switch( n ) { - case 1: - pby = p[0]; ptm = pby/2; pty = pby-ptm; - break; - case 2: - pty = p[0]; ptm = p[1]; pby = pty + ptm; - break; - case 3: - pby = p[0]; pty = p[1]; ptm = p[2]; - break; - } - - if( pty+ptm > 100 ) { - errno = ERANGE; - perror( "KCONFIG_PROBABILITY" ); - exit( 1 ); - } - } - bool has_changed = false; - - for_all_symbols(i, sym) { - if (sym_has_value(sym) || (sym->flags & SYMBOL_VALID)) - continue; - switch (sym_get_type(sym)) { - case S_BOOLEAN: - case S_TRISTATE: - has_changed = true; - switch (mode) { - case def_yes: - sym->def[S_DEF_USER].tri = yes; - break; - case def_mod: - sym->def[S_DEF_USER].tri = mod; - break; - case def_no: - if (sym->flags & SYMBOL_ALLNOCONFIG_Y) - sym->def[S_DEF_USER].tri = yes; - else - sym->def[S_DEF_USER].tri = no; - break; - case def_random: - sym->def[S_DEF_USER].tri = no; - cnt = rand() % 100; - if (sym->type == S_TRISTATE) { - if (cnt < pty) - sym->def[S_DEF_USER].tri = yes; - else if (cnt < (pty+ptm)) - sym->def[S_DEF_USER].tri = mod; - } else if (cnt < pby) - sym->def[S_DEF_USER].tri = yes; - break; - default: - continue; - } - if (!(sym_is_choice(sym) && mode == def_random)) - sym->flags |= SYMBOL_DEF_USER; - break; - default: - break; - } - - } - - sym_clear_all_valid(); - - /* - * We have different type of choice blocks. - * If curr.tri equals to mod then we can select several - * choice symbols in one block. - * In this case we do nothing. - * If curr.tri equals yes then only one symbol can be - * selected in a choice block and we set it to yes, - * and the rest to no. - */ - if (mode != def_random) { - for_all_symbols(i, csym) { - if ((sym_is_choice(csym) && !sym_has_value(csym)) || - sym_is_choice_value(csym)) - csym->flags |= SYMBOL_NEED_SET_CHOICE_VALUES; - } - } - - for_all_symbols(i, csym) { - if (sym_has_value(csym) || !sym_is_choice(csym)) - continue; - - sym_calc_value(csym); - if (mode == def_random) - has_changed = randomize_choice_values(csym); - else { - set_all_choice_values(csym); - has_changed = true; - } - } - - return has_changed; -} diff --git a/support/kconfig/expr.c b/support/kconfig/expr.c index e1a39e9084..a290de3630 100644 --- a/support/kconfig/expr.c +++ b/support/kconfig/expr.c @@ -1,8 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2002 Roman Zippel - * Released under the terms of the GNU GPL v2.0. */ +#include +#include #include #include #include @@ -11,7 +13,6 @@ #define DEBUG_EXPR 0 -static int expr_eq(struct expr *e1, struct expr *e2); static struct expr *expr_eliminate_yn(struct expr *e); struct expr *expr_alloc_symbol(struct symbol *sym) @@ -248,10 +249,17 @@ void expr_eliminate_eq(struct expr **ep1, struct expr **ep2) * equals some operand in the other (operands do not need to appear in the same * order), recursively. */ -static int expr_eq(struct expr *e1, struct expr *e2) +int expr_eq(struct expr *e1, struct expr *e2) { int res, old_count; + /* + * A NULL expr is taken to be yes, but there's also a different way to + * represent yes. expr_is_yes() checks for either representation. + */ + if (!e1 || !e2) + return expr_is_yes(e1) && expr_is_yes(e2); + if (e1->type != e2->type) return 0; switch (e1->type) { @@ -980,7 +988,6 @@ enum string_value_kind { k_string, k_signed, k_unsigned, - k_invalid }; union string_value { @@ -1011,13 +1018,10 @@ static enum string_value_kind expr_parse_string(const char *str, val->u = strtoull(str, &tail, 16); kind = k_unsigned; break; - case S_STRING: - case S_UNKNOWN: + default: val->s = strtoll(str, &tail, 0); kind = k_signed; break; - default: - return k_invalid; } return !errno && !*tail && tail > str && isxdigit(tail[-1]) ? kind : k_string; @@ -1073,13 +1077,7 @@ tristate expr_calc_value(struct expr *e) if (k1 == k_string || k2 == k_string) res = strcmp(str1, str2); - else if (k1 == k_invalid || k2 == k_invalid) { - if (e->type != E_EQUAL && e->type != E_UNEQUAL) { - printf("Cannot compare \"%s\" and \"%s\"\n", str1, str2); - return no; - } - res = strcmp(str1, str2); - } else if (k1 == k_unsigned || k2 == k_unsigned) + else if (k1 == k_unsigned || k2 == k_unsigned) res = (lval.u > rval.u) - (lval.u < rval.u); else /* if (k1 == k_signed && k2 == k_signed) */ res = (lval.s > rval.s) - (lval.s < rval.s); @@ -1133,7 +1131,6 @@ static int expr_compare_type(enum expr_type t1, enum expr_type t2) default: return -1; } - printf("[%dgt%d?]", t1, t2); return 0; } diff --git a/support/kconfig/expr.h b/support/kconfig/expr.h index 94a383b21d..0158f5eac4 100644 --- a/support/kconfig/expr.h +++ b/support/kconfig/expr.h @@ -1,6 +1,6 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (C) 2002 Roman Zippel - * Released under the terms of the GNU GPL v2.0. */ #ifndef EXPR_H @@ -12,17 +12,12 @@ extern "C" { #include #include -#include "list.h" +#include "list_types.h" #ifndef __cplusplus #include #endif -struct file { - struct file *next; - struct file *parent; - const char *name; - int lineno; -}; +#include "list_types.h" typedef enum tristate { no, mod, yes @@ -62,7 +57,7 @@ struct symbol_value { }; enum symbol_type { - S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER + S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING }; /* enum values are used as index to symbol.def[] */ @@ -81,8 +76,8 @@ enum { * SYMBOL_CHOICE bit set in 'flags'. */ struct symbol { - /* The next symbol in the same bucket in the symbol hash table */ - struct symbol *next; + /* link node for the hash table */ + struct hlist_node node; /* The name of the symbol, e.g. "FOO" for 'config FOO' */ char *name; @@ -113,6 +108,9 @@ struct symbol { */ tristate visible; + /* config entries associated with this symbol */ + struct list_head menus; + /* SYMBOL_* flags */ int flags; @@ -131,8 +129,6 @@ struct symbol { struct expr_value implied; }; -#define for_all_symbols(i, sym) for (i = 0; i < SYMBOL_HASHSIZE; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER) - #define SYMBOL_CONST 0x0001 /* symbol is const */ #define SYMBOL_CHECK 0x0008 /* used during dependency checking */ #define SYMBOL_CHOICE 0x0010 /* start of a choice block (null name) */ @@ -141,7 +137,8 @@ struct symbol { #define SYMBOL_OPTIONAL 0x0100 /* choice is optional - values can be 'n' */ #define SYMBOL_WRITE 0x0200 /* write symbol to file (KCONFIG_CONFIG) */ #define SYMBOL_CHANGED 0x0400 /* ? */ -#define SYMBOL_AUTO 0x1000 /* value from environment variable */ +#define SYMBOL_WRITTEN 0x0800 /* track info to avoid double-write to .config */ +#define SYMBOL_NO_WRITE 0x1000 /* Symbol for internal use only; it will not be written */ #define SYMBOL_CHECKED 0x2000 /* used during dependency checking */ #define SYMBOL_WARNED 0x8000 /* warning has been issued */ @@ -155,11 +152,7 @@ struct symbol { /* choice values need to be set before calculating this symbol value */ #define SYMBOL_NEED_SET_CHOICE_VALUES 0x100000 -/* Set symbol to y if allnoconfig; used for symbols that hide others */ -#define SYMBOL_ALLNOCONFIG_Y 0x200000 - #define SYMBOL_MAXLENGTH 256 -#define SYMBOL_HASHSIZE 9973 /* A property represent the config options that can be associated * with a config "symbol". @@ -171,6 +164,9 @@ struct symbol { * config BAZ * int "BAZ Value" * range 1..255 + * + * Please, also check parser.y:print_symbol() when modifying the + * list of property types! */ enum prop_type { P_UNKNOWN, @@ -182,13 +178,11 @@ enum prop_type { P_SELECT, /* select BAR */ P_IMPLY, /* imply BAR */ P_RANGE, /* range 7..100 (for a symbol) */ - P_ENV, /* value from environment variable */ P_SYMBOL, /* where a symbol is defined */ }; struct property { struct property *next; /* next property - null if last */ - struct symbol *sym; /* the symbol for which the property is associated */ enum prop_type type; /* type of property */ const char *text; /* the prompt value - P_PROMPT, P_MENU, P_COMMENT */ struct expr_value visible; @@ -196,7 +190,7 @@ struct property { struct menu *menu; /* the menu the property are associated with * valid for: P_SELECT, P_RANGE, P_CHOICE, * P_PROMPT, P_DEFAULT, P_MENU, P_COMMENT */ - struct file *file; /* what file was this property defined */ + const char *filename; /* what file was this property defined */ int lineno; /* what lineno was this property defined */ }; @@ -231,6 +225,8 @@ struct menu { */ struct symbol *sym; + struct list_head link; /* link to symbol::menus */ + /* * The prompt associated with the node. This holds the prompt for a * symbol as well as the text for a menu or comment, along with the @@ -257,7 +253,7 @@ struct menu { char *help; /* The location where the menu node appears in the Kconfig files */ - struct file *file; + const char *filename; int lineno; /* For use by front ends that need to store auxiliary data */ @@ -276,18 +272,10 @@ struct jump_key { struct list_head entries; size_t offset; struct menu *target; - int index; }; -#define JUMP_NB 9 - -extern struct file *file_list; -extern struct file *current_file; -struct file *lookup_file(const char *name); - extern struct symbol symbol_yes, symbol_no, symbol_mod; extern struct symbol *modules_sym; -extern struct symbol *sym_defconfig_list; extern int cdebug; struct expr *expr_alloc_symbol(struct symbol *sym); struct expr *expr_alloc_one(enum expr_type type, struct expr *ce); @@ -298,6 +286,7 @@ struct expr *expr_alloc_or(struct expr *e1, struct expr *e2); struct expr *expr_copy(const struct expr *org); void expr_free(struct expr *e); void expr_eliminate_eq(struct expr **ep1, struct expr **ep2); +int expr_eq(struct expr *e1, struct expr *e2); tristate expr_calc_value(struct expr *e); struct expr *expr_trans_bool(struct expr *e); struct expr *expr_eliminate_dups(struct expr *e); diff --git a/support/kconfig/foo.h b/support/kconfig/foo.h deleted file mode 100644 index b9cfdf8312..0000000000 --- a/support/kconfig/foo.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef __KCONFIG_FOO_H -#define __KCONFIG_FOO_H - -#ifndef __APPLE__ -#include -#endif -#include - -#ifndef PATH_MAX -#define PATH_MAX 1024 -#endif -#endif /* __KCONFIG_FOO_H */ diff --git a/support/kconfig/gconf-cfg.sh b/support/kconfig/gconf-cfg.sh new file mode 100755 index 0000000000..040d8f3388 --- /dev/null +++ b/support/kconfig/gconf-cfg.sh @@ -0,0 +1,33 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 + +cflags=$1 +libs=$2 + +PKG="gtk+-2.0 gmodule-2.0 libglade-2.0" + +if [ -z "$(command -v ${HOSTPKG_CONFIG})" ]; then + echo >&2 "*" + echo >&2 "* 'make gconfig' requires '${HOSTPKG_CONFIG}'. Please install it." + echo >&2 "*" + exit 1 +fi + +if ! ${HOSTPKG_CONFIG} --exists $PKG; then + echo >&2 "*" + echo >&2 "* Unable to find the GTK+ installation. Please make sure that" + echo >&2 "* the GTK+ 2.0 development package is correctly installed." + echo >&2 "* You need $PKG" + echo >&2 "*" + exit 1 +fi + +if ! ${HOSTPKG_CONFIG} --atleast-version=2.0.0 gtk+-2.0; then + echo >&2 "*" + echo >&2 "* GTK+ is present but version >= 2.0.0 is required." + echo >&2 "*" + exit 1 +fi + +${HOSTPKG_CONFIG} --cflags ${PKG} > ${cflags} +${HOSTPKG_CONFIG} --libs ${PKG} > ${libs} diff --git a/support/kconfig/gconf.c b/support/kconfig/gconf.c index 0c2d1c18f9..d24cebd974 100644 --- a/support/kconfig/gconf.c +++ b/support/kconfig/gconf.c @@ -1,18 +1,11 @@ -/* Hey EMACS -*- linux-c -*- */ +// SPDX-License-Identifier: GPL-2.0 /* - * * Copyright (C) 2002-2003 Romain Lievin - * Released under the terms of the GNU GPL v2.0. - * */ -#ifdef HAVE_CONFIG_H -# include -#endif - #include #include "lkc.h" -#include "images.c" +#include "images.h" #include #include @@ -21,6 +14,7 @@ #include #include +#include #include #include @@ -78,8 +72,8 @@ static gchar **fill_row(struct menu *menu); static void conf_changed(void); /* Helping/Debugging Functions */ - -const char *dbg_sym_flags(int val) +#ifdef DEBUG +static const char *dbg_sym_flags(int val) { static char buf[256]; @@ -101,16 +95,17 @@ const char *dbg_sym_flags(int val) strcat(buf, "write/"); if (val & SYMBOL_CHANGED) strcat(buf, "changed/"); - if (val & SYMBOL_AUTO) - strcat(buf, "auto/"); + if (val & SYMBOL_NO_WRITE) + strcat(buf, "no_write/"); buf[strlen(buf) - 1] = '\0'; return buf; } +#endif -void replace_button_icon(GladeXML * xml, GdkDrawable * window, - GtkStyle * style, gchar * btn_name, gchar ** xpm) +static void replace_button_icon(GladeXML *xml, GdkDrawable *window, + GtkStyle *style, gchar *btn_name, gchar **xpm) { GdkPixmap *pixmap; GdkBitmap *mask; @@ -128,7 +123,7 @@ void replace_button_icon(GladeXML * xml, GdkDrawable * window, } /* Main Window Initialization */ -void init_main_window(const gchar * glade_file) +static void init_main_window(const gchar *glade_file) { GladeXML *xml; GtkWidget *widget; @@ -137,7 +132,7 @@ void init_main_window(const gchar * glade_file) xml = glade_xml_new(glade_file, "window1", NULL); if (!xml) - g_error(_("GUI loading failed !\n")); + g_error("GUI loading failed !\n"); glade_xml_signal_autoconnect(xml); main_wnd = glade_xml_get_widget(xml, "window1"); @@ -190,7 +185,7 @@ void init_main_window(const gchar * glade_file) gtk_widget_show(main_wnd); } -void init_tree_model(void) +static void init_tree_model(void) { gint i; @@ -220,7 +215,7 @@ void init_tree_model(void) model1 = GTK_TREE_MODEL(tree1); } -void init_left_tree(void) +static void init_left_tree(void) { GtkTreeView *view = GTK_TREE_VIEW(tree1_w); GtkCellRenderer *renderer; @@ -233,7 +228,7 @@ void init_left_tree(void) column = gtk_tree_view_column_new(); gtk_tree_view_append_column(view, column); - gtk_tree_view_column_set_title(column, _("Options")); + gtk_tree_view_column_set_title(column, "Options"); renderer = gtk_cell_renderer_toggle_new(); gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), @@ -262,7 +257,7 @@ static void renderer_edited(GtkCellRendererText * cell, const gchar * path_string, const gchar * new_text, gpointer user_data); -void init_right_tree(void) +static void init_right_tree(void) { GtkTreeView *view = GTK_TREE_VIEW(tree2_w); GtkCellRenderer *renderer; @@ -276,7 +271,7 @@ void init_right_tree(void) column = gtk_tree_view_column_new(); gtk_tree_view_append_column(view, column); - gtk_tree_view_column_set_title(column, _("Options")); + gtk_tree_view_column_set_title(column, "Options"); renderer = gtk_cell_renderer_pixbuf_new(); gtk_tree_view_column_pack_start(GTK_TREE_VIEW_COLUMN(column), @@ -305,7 +300,7 @@ void init_right_tree(void) renderer = gtk_cell_renderer_text_new(); gtk_tree_view_insert_column_with_attributes(view, -1, - _("Name"), renderer, + "Name", renderer, "text", COL_NAME, "foreground-gdk", COL_COLOR, NULL); @@ -329,7 +324,7 @@ void init_right_tree(void) COL_COLOR, NULL); renderer = gtk_cell_renderer_text_new(); gtk_tree_view_insert_column_with_attributes(view, -1, - _("Value"), renderer, + "Value", renderer, "text", COL_VALUE, "editable", COL_EDIT, @@ -368,7 +363,7 @@ static void text_insert_help(struct menu *menu) { GtkTextBuffer *buffer; GtkTextIter start, end; - const char *prompt = _(menu_get_prompt(menu)); + const char *prompt = menu_get_prompt(menu); struct gstr help = str_new(); menu_get_ext_help(menu, &help); @@ -422,7 +417,7 @@ gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event, if (!conf_get_changed()) return FALSE; - dialog = gtk_dialog_new_with_buttons(_("Warning !"), + dialog = gtk_dialog_new_with_buttons("Warning !", GTK_WINDOW(main_wnd), (GtkDialogFlags) (GTK_DIALOG_MODAL | @@ -436,7 +431,7 @@ gboolean on_window1_delete_event(GtkWidget * widget, GdkEvent * event, gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_CANCEL); - label = gtk_label_new(_("\nSave configuration ?\n")); + label = gtk_label_new("\nSave configuration ?\n"); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), label); gtk_widget_show(label); @@ -496,7 +491,7 @@ load_filename(GtkFileSelection * file_selector, gpointer user_data) (user_data)); if (conf_read(fn)) - text_insert_msg(_("Error"), _("Unable to load configuration !")); + text_insert_msg("Error", "Unable to load configuration !"); else display_tree(&rootmenu); } @@ -505,7 +500,7 @@ void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data) { GtkWidget *fs; - fs = gtk_file_selection_new(_("Load file...")); + fs = gtk_file_selection_new("Load file..."); g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button), "clicked", G_CALLBACK(load_filename), (gpointer) fs); @@ -524,7 +519,8 @@ void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data) void on_save_activate(GtkMenuItem * menuitem, gpointer user_data) { if (conf_write(NULL)) - text_insert_msg(_("Error"), _("Unable to save configuration !")); + text_insert_msg("Error", "Unable to save configuration !"); + conf_write_autoconf(0); } @@ -537,7 +533,7 @@ store_filename(GtkFileSelection * file_selector, gpointer user_data) (user_data)); if (conf_write(fn)) - text_insert_msg(_("Error"), _("Unable to save configuration !")); + text_insert_msg("Error", "Unable to save configuration !"); gtk_widget_destroy(GTK_WIDGET(user_data)); } @@ -546,7 +542,7 @@ void on_save_as1_activate(GtkMenuItem * menuitem, gpointer user_data) { GtkWidget *fs; - fs = gtk_file_selection_new(_("Save file as...")); + fs = gtk_file_selection_new("Save file as..."); g_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(fs)->ok_button), "clicked", G_CALLBACK(store_filename), (gpointer) fs); @@ -639,8 +635,8 @@ on_set_option_mode3_activate(GtkMenuItem *menuitem, gpointer user_data) void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data) { GtkWidget *dialog; - const gchar *intro_text = _( - "Welcome to gkc, the GTK+ graphical configuration tool\n" + const gchar *intro_text = + "Welcome to gconfig, the GTK+ graphical configuration tool.\n" "For each option, a blank box indicates the feature is disabled, a\n" "check indicates it is enabled, and a dot indicates that it is to\n" "be compiled as a module. Clicking on the box will cycle through the three states.\n" @@ -651,10 +647,7 @@ void on_introduction1_activate(GtkMenuItem * menuitem, gpointer user_data) "Although there is no cross reference yet to help you figure out\n" "what other options must be enabled to support the option you\n" "are interested in, you can still view the help of a grayed-out\n" - "option.\n" - "\n" - "Toggling Show Debug Info under the Options menu will show \n" - "the dependencies, which you can then match by examining other options."); + "option."; dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), GTK_DIALOG_DESTROY_WITH_PARENT, @@ -671,8 +664,8 @@ void on_about1_activate(GtkMenuItem * menuitem, gpointer user_data) { GtkWidget *dialog; const gchar *about_text = - _("gkc is copyright (c) 2002 Romain Lievin .\n" - "Based on the source code from Roman Zippel.\n"); + "gconfig is copyright (c) 2002 Romain Lievin .\n" + "Based on the source code from Roman Zippel.\n"; dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), GTK_DIALOG_DESTROY_WITH_PARENT, @@ -689,9 +682,9 @@ void on_license1_activate(GtkMenuItem * menuitem, gpointer user_data) { GtkWidget *dialog; const gchar *license_text = - _("gkc is released under the terms of the GNU GPL v2.\n" + "gconfig is released under the terms of the GNU GPL v2.\n" "For more information, please see the source code or\n" - "visit http://www.fsf.org/licenses/licenses.html\n"); + "visit http://www.fsf.org/licenses/licenses.html\n"; dialog = gtk_message_dialog_new(GTK_WINDOW(main_wnd), GTK_DIALOG_DESTROY_WITH_PARENT, @@ -1048,8 +1041,13 @@ static gchar **fill_row(struct menu *menu) g_free(row[i]); bzero(row, sizeof(row)); + ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; + row[COL_OPTION] = - g_strdup_printf("%s %s", _(menu_get_prompt(menu)), + g_strdup_printf("%s %s %s %s", + ptype == P_COMMENT ? "***" : "", + menu_get_prompt(menu), + ptype == P_COMMENT ? "***" : "", sym && !sym_has_value(sym) ? "(NEW)" : ""); if (opt_mode == OPT_ALL && !menu_is_visible(menu)) @@ -1060,7 +1058,6 @@ static gchar **fill_row(struct menu *menu) else row[COL_COLOR] = g_strdup("Black"); - ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; switch (ptype) { case P_MENU: row[COL_PIXBUF] = (gchar *) xpm_menu; @@ -1102,7 +1099,7 @@ static gchar **fill_row(struct menu *menu) if (def_menu) row[COL_VALUE] = - g_strdup(_(menu_get_prompt(def_menu))); + g_strdup(menu_get_prompt(def_menu)); } if (sym->flags & SYMBOL_CHOICEVAL) row[COL_BTNRAD] = GINT_TO_POINTER(TRUE); @@ -1211,8 +1208,8 @@ static GtkTreeIter found; /* * Find a menu in the GtkTree starting at parent. */ -GtkTreeIter *gtktree_iter_find_node(GtkTreeIter * parent, - struct menu *tofind) +static GtkTreeIter *gtktree_iter_find_node(GtkTreeIter *parent, + struct menu *tofind) { GtkTreeIter iter; GtkTreeIter *child = &iter; @@ -1423,7 +1420,7 @@ static void display_list(void) tree = tree2; } -void fixup_rootmenu(struct menu *menu) +static void fixup_rootmenu(struct menu *menu) { struct menu *child; static int menu_cnt = 0; @@ -1447,18 +1444,11 @@ int main(int ac, char *av[]) char *env; gchar *glade_file; - bindtextdomain(PACKAGE, LOCALEDIR); - bind_textdomain_codeset(PACKAGE, "UTF-8"); - textdomain(PACKAGE); - /* GTK stuffs */ gtk_set_locale(); gtk_init(&ac, &av); glade_init(); - //add_pixmap_directory (PACKAGE_DATA_DIR "/" PACKAGE "/pixmaps"); - //add_pixmap_directory (PACKAGE_SOURCE_DIR "/pixmaps"); - /* Determine GUI path */ env = getenv(SRCTREE); if (env) diff --git a/support/kconfig/hashtable.h b/support/kconfig/hashtable.h new file mode 100644 index 0000000000..a0a2c8f5f6 --- /dev/null +++ b/support/kconfig/hashtable.h @@ -0,0 +1,48 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef HASHTABLE_H +#define HASHTABLE_H + +#include "array_size.h" +#include "list.h" + +#define HASH_SIZE(name) (ARRAY_SIZE(name)) + +#define HASHTABLE_DECLARE(name, size) struct hlist_head name[size] + +#define HASHTABLE_DEFINE(name, size) \ + HASHTABLE_DECLARE(name, size) = \ + { [0 ... ((size) - 1)] = HLIST_HEAD_INIT } + +#define hash_head(table, key) (&(table)[(key) % HASH_SIZE(table)]) + +/** + * hash_add - add an object to a hashtable + * @table: hashtable to add to + * @node: the &struct hlist_node of the object to be added + * @key: the key of the object to be added + */ +#define hash_add(table, node, key) \ + hlist_add_head(node, hash_head(table, key)) + +/** + * hash_for_each - iterate over a hashtable + * @table: hashtable to iterate + * @obj: the type * to use as a loop cursor for each entry + * @member: the name of the hlist_node within the struct + */ +#define hash_for_each(table, obj, member) \ + for (int _bkt = 0; _bkt < HASH_SIZE(table); _bkt++) \ + hlist_for_each_entry(obj, &table[_bkt], member) + +/** + * hash_for_each_possible - iterate over all possible objects hashing to the + * same bucket + * @table: hashtable to iterate + * @obj: the type * to use as a loop cursor for each entry + * @member: the name of the hlist_node within the struct + * @key: the key of the objects to iterate over + */ +#define hash_for_each_possible(table, obj, member, key) \ + hlist_for_each_entry(obj, hash_head(table, key), member) + +#endif /* HASHTABLE_H */ diff --git a/support/kconfig/images.c b/support/kconfig/images.c index d4f84bd4a9..2f9afffa5d 100644 --- a/support/kconfig/images.c +++ b/support/kconfig/images.c @@ -1,9 +1,11 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2002 Roman Zippel - * Released under the terms of the GNU GPL v2.0. */ -static const char *xpm_load[] = { +#include "images.h" + +const char * const xpm_load[] = { "22 22 5 1", ". c None", "# c #000000", @@ -33,7 +35,7 @@ static const char *xpm_load[] = { "###############.......", "......................"}; -static const char *xpm_save[] = { +const char * const xpm_save[] = { "22 22 5 1", ". c None", "# c #000000", @@ -63,7 +65,7 @@ static const char *xpm_save[] = { "..##################..", "......................"}; -static const char *xpm_back[] = { +const char * const xpm_back[] = { "22 22 3 1", ". c None", "# c #000083", @@ -91,7 +93,7 @@ static const char *xpm_back[] = { "......................", "......................"}; -static const char *xpm_tree_view[] = { +const char * const xpm_tree_view[] = { "22 22 2 1", ". c None", "# c #000000", @@ -118,7 +120,7 @@ static const char *xpm_tree_view[] = { "......................", "......................"}; -static const char *xpm_single_view[] = { +const char * const xpm_single_view[] = { "22 22 2 1", ". c None", "# c #000000", @@ -145,7 +147,7 @@ static const char *xpm_single_view[] = { "......................", "......................"}; -static const char *xpm_split_view[] = { +const char * const xpm_split_view[] = { "22 22 2 1", ". c None", "# c #000000", @@ -172,7 +174,7 @@ static const char *xpm_split_view[] = { "......................", "......................"}; -static const char *xpm_symbol_no[] = { +const char * const xpm_symbol_no[] = { "12 12 2 1", " c white", ". c black", @@ -189,7 +191,7 @@ static const char *xpm_symbol_no[] = { " .......... ", " "}; -static const char *xpm_symbol_mod[] = { +const char * const xpm_symbol_mod[] = { "12 12 2 1", " c white", ". c black", @@ -206,7 +208,7 @@ static const char *xpm_symbol_mod[] = { " .......... ", " "}; -static const char *xpm_symbol_yes[] = { +const char * const xpm_symbol_yes[] = { "12 12 2 1", " c white", ". c black", @@ -223,7 +225,7 @@ static const char *xpm_symbol_yes[] = { " .......... ", " "}; -static const char *xpm_choice_no[] = { +const char * const xpm_choice_no[] = { "12 12 2 1", " c white", ". c black", @@ -240,7 +242,7 @@ static const char *xpm_choice_no[] = { " .... ", " "}; -static const char *xpm_choice_yes[] = { +const char * const xpm_choice_yes[] = { "12 12 2 1", " c white", ". c black", @@ -257,7 +259,7 @@ static const char *xpm_choice_yes[] = { " .... ", " "}; -static const char *xpm_menu[] = { +const char * const xpm_menu[] = { "12 12 2 1", " c white", ". c black", @@ -274,7 +276,7 @@ static const char *xpm_menu[] = { " .......... ", " "}; -static const char *xpm_menu_inv[] = { +const char * const xpm_menu_inv[] = { "12 12 2 1", " c white", ". c black", @@ -291,7 +293,7 @@ static const char *xpm_menu_inv[] = { " .......... ", " "}; -static const char *xpm_menuback[] = { +const char * const xpm_menuback[] = { "12 12 2 1", " c white", ". c black", @@ -308,7 +310,7 @@ static const char *xpm_menuback[] = { " .......... ", " "}; -static const char *xpm_void[] = { +const char * const xpm_void[] = { "12 12 2 1", " c white", ". c black", diff --git a/support/kconfig/images.h b/support/kconfig/images.h new file mode 100644 index 0000000000..7212dec200 --- /dev/null +++ b/support/kconfig/images.h @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2002 Roman Zippel + */ + +#ifndef IMAGES_H +#define IMAGES_H + +#ifdef __cplusplus +extern "C" { +#endif + +extern const char * const xpm_load[]; +extern const char * const xpm_save[]; +extern const char * const xpm_back[]; +extern const char * const xpm_tree_view[]; +extern const char * const xpm_single_view[]; +extern const char * const xpm_split_view[]; +extern const char * const xpm_symbol_no[]; +extern const char * const xpm_symbol_mod[]; +extern const char * const xpm_symbol_yes[]; +extern const char * const xpm_choice_no[]; +extern const char * const xpm_choice_yes[]; +extern const char * const xpm_menu[]; +extern const char * const xpm_menu_inv[]; +extern const char * const xpm_menuback[]; +extern const char * const xpm_void[]; + +#ifdef __cplusplus +} +#endif + +#endif /* IMAGES_H */ diff --git a/support/kconfig/internal.h b/support/kconfig/internal.h new file mode 100644 index 0000000000..6c721c4cfd --- /dev/null +++ b/support/kconfig/internal.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef INTERNAL_H +#define INTERNAL_H + +#include "hashtable.h" + +#define SYMBOL_HASHSIZE (1U << 14) + +extern HASHTABLE_DECLARE(sym_hashtable, SYMBOL_HASHSIZE); + +#define for_all_symbols(sym) \ + hash_for_each(sym_hashtable, sym, node) + +struct menu; + +extern struct menu *current_menu, *current_entry; + +extern const char *cur_filename; +extern int cur_lineno; + +#endif /* INTERNAL_H */ diff --git a/support/kconfig/kconf_id.c b/support/kconfig/kconf_id.c deleted file mode 100644 index 3ea9c5f9f7..0000000000 --- a/support/kconfig/kconf_id.c +++ /dev/null @@ -1,53 +0,0 @@ - -static struct kconf_id kconf_id_array[] = { - { "mainmenu", T_MAINMENU, TF_COMMAND }, - { "menu", T_MENU, TF_COMMAND }, - { "endmenu", T_ENDMENU, TF_COMMAND }, - { "source", T_SOURCE, TF_COMMAND }, - { "choice", T_CHOICE, TF_COMMAND }, - { "endchoice", T_ENDCHOICE, TF_COMMAND }, - { "comment", T_COMMENT, TF_COMMAND }, - { "config", T_CONFIG, TF_COMMAND }, - { "menuconfig", T_MENUCONFIG, TF_COMMAND }, - { "help", T_HELP, TF_COMMAND }, - { "---help---", T_HELP, TF_COMMAND }, - { "if", T_IF, TF_COMMAND|TF_PARAM }, - { "endif", T_ENDIF, TF_COMMAND }, - { "depends", T_DEPENDS, TF_COMMAND }, - { "optional", T_OPTIONAL, TF_COMMAND }, - { "default", T_DEFAULT, TF_COMMAND, S_UNKNOWN }, - { "prompt", T_PROMPT, TF_COMMAND }, - { "tristate", T_TYPE, TF_COMMAND, S_TRISTATE }, - { "def_tristate", T_DEFAULT, TF_COMMAND, S_TRISTATE }, - { "bool", T_TYPE, TF_COMMAND, S_BOOLEAN }, - { "def_bool", T_DEFAULT, TF_COMMAND, S_BOOLEAN }, - { "int", T_TYPE, TF_COMMAND, S_INT }, - { "hex", T_TYPE, TF_COMMAND, S_HEX }, - { "string", T_TYPE, TF_COMMAND, S_STRING }, - { "select", T_SELECT, TF_COMMAND }, - { "imply", T_IMPLY, TF_COMMAND }, - { "range", T_RANGE, TF_COMMAND }, - { "visible", T_VISIBLE, TF_COMMAND }, - { "option", T_OPTION, TF_COMMAND }, - { "on", T_ON, TF_PARAM }, - { "modules", T_OPT_MODULES, TF_OPTION }, - { "defconfig_list", T_OPT_DEFCONFIG_LIST, TF_OPTION }, - { "env", T_OPT_ENV, TF_OPTION }, - { "allnoconfig_y", T_OPT_ALLNOCONFIG_Y, TF_OPTION }, -}; - -#define KCONF_ID_ARRAY_SIZE (sizeof(kconf_id_array)/sizeof(struct kconf_id)) - -static const struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len) -{ - int i; - - for (i = 0; i < KCONF_ID_ARRAY_SIZE; i++) { - struct kconf_id *id = kconf_id_array+i; - int l = strlen(id->name); - - if (len == l && !memcmp(str, id->name, len)) - return id; - } - return NULL; -} diff --git a/support/kconfig/kxgettext.c b/support/kconfig/kxgettext.c deleted file mode 100644 index 240880a891..0000000000 --- a/support/kconfig/kxgettext.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Arnaldo Carvalho de Melo , 2005 - * - * Released under the terms of the GNU GPL v2.0 - */ - -#include -#include - -#include "lkc.h" - -static char *escape(const char* text, char *bf, int len) -{ - char *bfp = bf; - int multiline = strchr(text, '\n') != NULL; - int eol = 0; - int textlen = strlen(text); - - if ((textlen > 0) && (text[textlen-1] == '\n')) - eol = 1; - - *bfp++ = '"'; - --len; - - if (multiline) { - *bfp++ = '"'; - *bfp++ = '\n'; - *bfp++ = '"'; - len -= 3; - } - - while (*text != '\0' && len > 1) { - if (*text == '"') - *bfp++ = '\\'; - else if (*text == '\n') { - *bfp++ = '\\'; - *bfp++ = 'n'; - *bfp++ = '"'; - *bfp++ = '\n'; - *bfp++ = '"'; - len -= 5; - ++text; - goto next; - } - else if (*text == '\\') { - *bfp++ = '\\'; - len--; - } - *bfp++ = *text++; -next: - --len; - } - - if (multiline && eol) - bfp -= 3; - - *bfp++ = '"'; - *bfp = '\0'; - - return bf; -} - -struct file_line { - struct file_line *next; - const char *file; - int lineno; -}; - -static struct file_line *file_line__new(const char *file, int lineno) -{ - struct file_line *self = malloc(sizeof(*self)); - - if (self == NULL) - goto out; - - self->file = file; - self->lineno = lineno; - self->next = NULL; -out: - return self; -} - -struct message { - const char *msg; - const char *option; - struct message *next; - struct file_line *files; -}; - -static struct message *message__list; - -static struct message *message__new(const char *msg, char *option, - const char *file, int lineno) -{ - struct message *self = malloc(sizeof(*self)); - - if (self == NULL) - goto out; - - self->files = file_line__new(file, lineno); - if (self->files == NULL) - goto out_fail; - - self->msg = xstrdup(msg); - if (self->msg == NULL) - goto out_fail_msg; - - self->option = option; - self->next = NULL; -out: - return self; -out_fail_msg: - free(self->files); -out_fail: - free(self); - self = NULL; - goto out; -} - -static struct message *mesage__find(const char *msg) -{ - struct message *m = message__list; - - while (m != NULL) { - if (strcmp(m->msg, msg) == 0) - break; - m = m->next; - } - - return m; -} - -static int message__add_file_line(struct message *self, const char *file, - int lineno) -{ - int rc = -1; - struct file_line *fl = file_line__new(file, lineno); - - if (fl == NULL) - goto out; - - fl->next = self->files; - self->files = fl; - rc = 0; -out: - return rc; -} - -static int message__add(const char *msg, char *option, const char *file, - int lineno) -{ - int rc = 0; - char bf[16384]; - char *escaped = escape(msg, bf, sizeof(bf)); - struct message *m = mesage__find(escaped); - - if (m != NULL) - rc = message__add_file_line(m, file, lineno); - else { - m = message__new(escaped, option, file, lineno); - - if (m != NULL) { - m->next = message__list; - message__list = m; - } else - rc = -1; - } - return rc; -} - -static void menu_build_message_list(struct menu *menu) -{ - struct menu *child; - - message__add(menu_get_prompt(menu), NULL, - menu->file == NULL ? "Root Menu" : menu->file->name, - menu->lineno); - - if (menu->sym != NULL && menu_has_help(menu)) - message__add(menu_get_help(menu), menu->sym->name, - menu->file == NULL ? "Root Menu" : menu->file->name, - menu->lineno); - - for (child = menu->list; child != NULL; child = child->next) - if (child->prompt != NULL) - menu_build_message_list(child); -} - -static void message__print_file_lineno(struct message *self) -{ - struct file_line *fl = self->files; - - putchar('\n'); - if (self->option != NULL) - printf("# %s:00000\n", self->option); - - printf("#: %s:%d", fl->file, fl->lineno); - fl = fl->next; - - while (fl != NULL) { - printf(", %s:%d", fl->file, fl->lineno); - fl = fl->next; - } - - putchar('\n'); -} - -static void message__print_gettext_msgid_msgstr(struct message *self) -{ - message__print_file_lineno(self); - - printf("msgid %s\n" - "msgstr \"\"\n", self->msg); -} - -static void menu__xgettext(void) -{ - struct message *m = message__list; - - while (m != NULL) { - /* skip empty lines ("") */ - if (strlen(m->msg) > sizeof("\"\"")) - message__print_gettext_msgid_msgstr(m); - m = m->next; - } -} - -int main(int ac, char **av) -{ - conf_parse(av[1]); - - menu_build_message_list(menu_get_root_menu(NULL)); - menu__xgettext(); - return 0; -} diff --git a/support/kconfig/lexer.l b/support/kconfig/lexer.l new file mode 100644 index 0000000000..89544c3a1a --- /dev/null +++ b/support/kconfig/lexer.l @@ -0,0 +1,460 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2002 Roman Zippel + */ +%option nostdinit noyywrap never-interactive full ecs +%option 8bit nodefault yylineno +%x ASSIGN_VAL HELP STRING +%{ + +#include +#include +#include +#include +#include + +#include "lkc.h" +#include "preprocess.h" + +#include "parser.tab.h" + +#define YY_DECL static int yylex1(void) + +#define START_STRSIZE 16 + +/* The Kconfig file currently being parsed. */ +const char *cur_filename; + +/* + * The line number of the current statement. This does not match yylineno. + * yylineno is used by the lexer, while cur_lineno is used by the parser. + */ +int cur_lineno; + +static int prev_prev_token = T_EOL; +static int prev_token = T_EOL; +static char *text; +static int text_size, text_asize; + +struct buffer { + struct buffer *parent; + YY_BUFFER_STATE state; + int yylineno; + const char *filename; + int source_lineno; +}; + +static struct buffer *current_buf; + +static int last_ts, first_ts; + +static char *expand_token(const char *in, size_t n); +static void append_expanded_string(const char *in); +static void zconf_endhelp(void); +static void zconf_endfile(void); + +static void new_string(void) +{ + text = xmalloc(START_STRSIZE); + text_asize = START_STRSIZE; + text_size = 0; + *text = 0; +} + +static void append_string(const char *str, int size) +{ + int new_size = text_size + size + 1; + if (new_size > text_asize) { + new_size += START_STRSIZE - 1; + new_size &= -START_STRSIZE; + text = xrealloc(text, new_size); + text_asize = new_size; + } + memcpy(text + text_size, str, size); + text_size += size; + text[text_size] = 0; +} + +static void alloc_string(const char *str, int size) +{ + text = xmalloc(size + 1); + memcpy(text, str, size); + text[size] = 0; +} + +static void warn_ignored_character(char chr) +{ + fprintf(stderr, + "%s:%d:warning: ignoring unsupported character '%c'\n", + cur_filename, yylineno, chr); +} +%} + +n [A-Za-z0-9_-] + +%% + char open_quote = 0; + +#.* /* ignore comment */ +[ \t]* /* whitespaces */ +\\\n /* escaped new line */ +\n return T_EOL; +"bool" return T_BOOL; +"choice" return T_CHOICE; +"comment" return T_COMMENT; +"config" return T_CONFIG; +"def_bool" return T_DEF_BOOL; +"def_tristate" return T_DEF_TRISTATE; +"default" return T_DEFAULT; +"depends" return T_DEPENDS; +"endchoice" return T_ENDCHOICE; +"endif" return T_ENDIF; +"endmenu" return T_ENDMENU; +"help" return T_HELP; +"hex" return T_HEX; +"if" return T_IF; +"imply" return T_IMPLY; +"int" return T_INT; +"mainmenu" return T_MAINMENU; +"menu" return T_MENU; +"menuconfig" return T_MENUCONFIG; +"modules" return T_MODULES; +"on" return T_ON; +"optional" return T_OPTIONAL; +"prompt" return T_PROMPT; +"range" return T_RANGE; +"select" return T_SELECT; +"source" return T_SOURCE; +"string" return T_STRING; +"tristate" return T_TRISTATE; +"visible" return T_VISIBLE; +"||" return T_OR; +"&&" return T_AND; +"=" return T_EQUAL; +"!=" return T_UNEQUAL; +"<" return T_LESS; +"<=" return T_LESS_EQUAL; +">" return T_GREATER; +">=" return T_GREATER_EQUAL; +"!" return T_NOT; +"(" return T_OPEN_PAREN; +")" return T_CLOSE_PAREN; +":=" return T_COLON_EQUAL; +"+=" return T_PLUS_EQUAL; +\"|\' { + open_quote = yytext[0]; + new_string(); + BEGIN(STRING); + } +{n}+ { + alloc_string(yytext, yyleng); + yylval.string = text; + return T_WORD; + } +({n}|$)+ { + /* this token includes at least one '$' */ + yylval.string = expand_token(yytext, yyleng); + if (strlen(yylval.string)) + return T_WORD; + free(yylval.string); + } +. warn_ignored_character(*yytext); + +{ + [^[:blank:]\n]+.* { + alloc_string(yytext, yyleng); + yylval.string = text; + return T_ASSIGN_VAL; + } + \n { BEGIN(INITIAL); return T_EOL; } + . +} + +{ + "$".* append_expanded_string(yytext); + [^$'"\\\n]+ { + append_string(yytext, yyleng); + } + \\.? { + append_string(yytext + 1, yyleng - 1); + } + \'|\" { + if (open_quote == yytext[0]) { + BEGIN(INITIAL); + yylval.string = text; + return T_WORD_QUOTE; + } else + append_string(yytext, 1); + } + \n { + fprintf(stderr, + "%s:%d:warning: multi-line strings not supported\n", + cur_filename, cur_lineno); + unput('\n'); + BEGIN(INITIAL); + yylval.string = text; + return T_WORD_QUOTE; + } + <> { + BEGIN(INITIAL); + yylval.string = text; + return T_WORD_QUOTE; + } +} + +{ + [ \t]+ { + int ts, i; + + ts = 0; + for (i = 0; i < yyleng; i++) { + if (yytext[i] == '\t') + ts = (ts & ~7) + 8; + else + ts++; + } + last_ts = ts; + if (first_ts) { + if (ts < first_ts) { + zconf_endhelp(); + return T_HELPTEXT; + } + ts -= first_ts; + while (ts > 8) { + append_string(" ", 8); + ts -= 8; + } + append_string(" ", ts); + } + } + [ \t]*\n/[^ \t\n] { + zconf_endhelp(); + return T_HELPTEXT; + } + [ \t]*\n { + append_string("\n", 1); + } + [^ \t\n].* { + while (yyleng) { + if ((yytext[yyleng-1] != ' ') && (yytext[yyleng-1] != '\t')) + break; + yyleng--; + } + append_string(yytext, yyleng); + if (!first_ts) + first_ts = last_ts; + } + <> { + zconf_endhelp(); + return T_HELPTEXT; + } +} + +<> { + BEGIN(INITIAL); + + if (prev_token != T_EOL && prev_token != T_HELPTEXT) + fprintf(stderr, "%s:%d:warning: no new line at end of file\n", + cur_filename, yylineno); + + if (current_buf) { + zconf_endfile(); + return T_EOL; + } + fclose(yyin); + yyterminate(); +} + +%% + +/* second stage lexer */ +int yylex(void) +{ + int token; + +repeat: + token = yylex1(); + + if (prev_token == T_EOL || prev_token == T_HELPTEXT) { + if (token == T_EOL) + /* Do not pass unneeded T_EOL to the parser. */ + goto repeat; + else + /* + * For the parser, update lineno at the first token + * of each statement. Generally, \n is a statement + * terminator in Kconfig, but it is not always true + * because \n could be escaped by a backslash. + */ + cur_lineno = yylineno; + } + + if (prev_prev_token == T_EOL && prev_token == T_WORD && + (token == T_EQUAL || token == T_COLON_EQUAL || token == T_PLUS_EQUAL)) + BEGIN(ASSIGN_VAL); + + prev_prev_token = prev_token; + prev_token = token; + + return token; +} + +static char *expand_token(const char *in, size_t n) +{ + char *out; + int c; + char c2; + const char *rest, *end; + + new_string(); + append_string(in, n); + + /* + * get the whole line because we do not know the end of token. + * input() returns 0 (not EOF!) when it reachs the end of file. + */ + while ((c = input()) != 0) { + if (c == '\n') { + unput(c); + break; + } + c2 = c; + append_string(&c2, 1); + } + + rest = text; + out = expand_one_token(&rest); + + /* push back unused characters to the input stream */ + end = rest + strlen(rest); + while (end > rest) + unput(*--end); + + free(text); + + return out; +} + +static void append_expanded_string(const char *str) +{ + const char *end; + char *res; + + str++; + + res = expand_dollar(&str); + + /* push back unused characters to the input stream */ + end = str + strlen(str); + while (end > str) + unput(*--end); + + append_string(res, strlen(res)); + + free(res); +} + +void zconf_starthelp(void) +{ + new_string(); + last_ts = first_ts = 0; + BEGIN(HELP); +} + +static void zconf_endhelp(void) +{ + yylval.string = text; + BEGIN(INITIAL); +} + + +/* + * Try to open specified file with following names: + * ./name + * $(srctree)/name + * The latter is used when srctree is separate from objtree + * when compiling the kernel. + * Return NULL if file is not found. + */ +FILE *zconf_fopen(const char *name) +{ + char *env, fullname[PATH_MAX+1]; + FILE *f; + + f = fopen(name, "r"); + if (!f && name != NULL && name[0] != '/') { + env = getenv(SRCTREE); + if (env) { + snprintf(fullname, sizeof(fullname), + "%s/%s", env, name); + f = fopen(fullname, "r"); + } + } + return f; +} + +void zconf_initscan(const char *name) +{ + yyin = zconf_fopen(name); + if (!yyin) { + fprintf(stderr, "can't find file %s\n", name); + exit(1); + } + + cur_filename = file_lookup(name); + yylineno = 1; +} + +void zconf_nextfile(const char *name) +{ + struct buffer *buf = xmalloc(sizeof(*buf)); + bool recur_include = false; + + buf->state = YY_CURRENT_BUFFER; + buf->yylineno = yylineno; + buf->filename = cur_filename; + buf->source_lineno = cur_lineno; + buf->parent = current_buf; + current_buf = buf; + yyin = zconf_fopen(name); + if (!yyin) { + fprintf(stderr, "%s:%d: can't open file \"%s\"\n", + cur_filename, cur_lineno, name); + exit(1); + } + yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); + + for (buf = current_buf; buf; buf = buf->parent) { + if (!strcmp(buf->filename, name)) + recur_include = true; + } + + if (recur_include) { + fprintf(stderr, + "Recursive inclusion detected.\n" + "Inclusion path:\n" + " current file : %s\n", name); + + for (buf = current_buf; buf; buf = buf->parent) + fprintf(stderr, " included from: %s:%d\n", + buf->filename, buf->source_lineno); + exit(1); + } + + yylineno = 1; + cur_filename = file_lookup(name); +} + +static void zconf_endfile(void) +{ + struct buffer *tmp; + + fclose(yyin); + yy_delete_buffer(YY_CURRENT_BUFFER); + yy_switch_to_buffer(current_buf->state); + yylineno = current_buf->yylineno; + cur_filename = current_buf->filename; + tmp = current_buf; + current_buf = current_buf->parent; + free(tmp); +} diff --git a/support/kconfig/lexer.lex.c_shipped b/support/kconfig/lexer.lex.c_shipped new file mode 100644 index 0000000000..8d29983b47 --- /dev/null +++ b/support/kconfig/lexer.lex.c_shipped @@ -0,0 +1,4103 @@ + +#define YY_INT_ALIGNED short int + +/* A lexical scanner generated by flex */ + +#define FLEX_SCANNER +#define YY_FLEX_MAJOR_VERSION 2 +#define YY_FLEX_MINOR_VERSION 6 +#define YY_FLEX_SUBMINOR_VERSION 4 +#if YY_FLEX_SUBMINOR_VERSION > 0 +#define FLEX_BETA +#endif + +/* First, we deal with platform-specific or compiler-specific issues. */ + +/* begin standard C headers. */ +#include +#include +#include +#include + +/* end standard C headers. */ + +/* flex integer type definitions */ + +#ifndef FLEXINT_H +#define FLEXINT_H + +/* C99 systems have . Non-C99 systems may or may not. */ + +#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + +/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, + * if you want the limit (max/min) macros for int types. + */ +#ifndef __STDC_LIMIT_MACROS +#define __STDC_LIMIT_MACROS 1 +#endif + +#include +typedef int8_t flex_int8_t; +typedef uint8_t flex_uint8_t; +typedef int16_t flex_int16_t; +typedef uint16_t flex_uint16_t; +typedef int32_t flex_int32_t; +typedef uint32_t flex_uint32_t; +#else +typedef signed char flex_int8_t; +typedef short int flex_int16_t; +typedef int flex_int32_t; +typedef unsigned char flex_uint8_t; +typedef unsigned short int flex_uint16_t; +typedef unsigned int flex_uint32_t; + +/* Limits of integral types. */ +#ifndef INT8_MIN +#define INT8_MIN (-128) +#endif +#ifndef INT16_MIN +#define INT16_MIN (-32767-1) +#endif +#ifndef INT32_MIN +#define INT32_MIN (-2147483647-1) +#endif +#ifndef INT8_MAX +#define INT8_MAX (127) +#endif +#ifndef INT16_MAX +#define INT16_MAX (32767) +#endif +#ifndef INT32_MAX +#define INT32_MAX (2147483647) +#endif +#ifndef UINT8_MAX +#define UINT8_MAX (255U) +#endif +#ifndef UINT16_MAX +#define UINT16_MAX (65535U) +#endif +#ifndef UINT32_MAX +#define UINT32_MAX (4294967295U) +#endif + +#ifndef SIZE_MAX +#define SIZE_MAX (~(size_t)0) +#endif + +#endif /* ! C99 */ + +#endif /* ! FLEXINT_H */ + +/* begin standard C++ headers. */ + +/* TODO: this is always defined, so inline it */ +#define yyconst const + +#if defined(__GNUC__) && __GNUC__ >= 3 +#define yynoreturn __attribute__((__noreturn__)) +#else +#define yynoreturn +#endif + +/* Returned upon end-of-file. */ +#define YY_NULL 0 + +/* Promotes a possibly negative, possibly signed char to an + * integer in range [0..255] for use as an array index. + */ +#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) + +/* Enter a start condition. This macro really ought to take a parameter, + * but we do it the disgusting crufty way forced on us by the ()-less + * definition of BEGIN. + */ +#define BEGIN (yy_start) = 1 + 2 * +/* Translate the current start state into a value that can be later handed + * to BEGIN to return to the state. The YYSTATE alias is for lex + * compatibility. + */ +#define YY_START (((yy_start) - 1) / 2) +#define YYSTATE YY_START +/* Action number for EOF rule of a given start state. */ +#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) +/* Special action meaning "start processing a new file". */ +#define YY_NEW_FILE yyrestart( yyin ) +#define YY_END_OF_BUFFER_CHAR 0 + +/* Size of default input buffer. */ +#ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else +#define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ +#endif + +/* The state buf must be large enough to hold one state per character in the main buffer. + */ +#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) + +#ifndef YY_TYPEDEF_YY_BUFFER_STATE +#define YY_TYPEDEF_YY_BUFFER_STATE +typedef struct yy_buffer_state *YY_BUFFER_STATE; +#endif + +#ifndef YY_TYPEDEF_YY_SIZE_T +#define YY_TYPEDEF_YY_SIZE_T +typedef size_t yy_size_t; +#endif + +extern int yyleng; + +extern FILE *yyin, *yyout; + +#define EOB_ACT_CONTINUE_SCAN 0 +#define EOB_ACT_END_OF_FILE 1 +#define EOB_ACT_LAST_MATCH 2 + + /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires + * access to the local variable yy_act. Since yyless() is a macro, it would break + * existing scanners that call yyless() from OUTSIDE yylex. + * One obvious solution it to make yy_act a global. I tried that, and saw + * a 5% performance hit in a non-yylineno scanner, because yy_act is + * normally declared as a register variable-- so it is not worth it. + */ + #define YY_LESS_LINENO(n) \ + do { \ + int yyl;\ + for ( yyl = n; yyl < yyleng; ++yyl )\ + if ( yytext[yyl] == '\n' )\ + --yylineno;\ + }while(0) + #define YY_LINENO_REWIND_TO(dst) \ + do {\ + const char *p;\ + for ( p = yy_cp-1; p >= (dst); --p)\ + if ( *p == '\n' )\ + --yylineno;\ + }while(0) + +/* Return all but the first "n" matched characters back to the input stream. */ +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + *yy_cp = (yy_hold_char); \ + YY_RESTORE_YY_MORE_OFFSET \ + (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( 0 ) +#define unput(c) yyunput( c, (yytext_ptr) ) + +#ifndef YY_STRUCT_YY_BUFFER_STATE +#define YY_STRUCT_YY_BUFFER_STATE +struct yy_buffer_state + { + FILE *yy_input_file; + + char *yy_ch_buf; /* input buffer */ + char *yy_buf_pos; /* current position in input buffer */ + + /* Size of input buffer in bytes, not including room for EOB + * characters. + */ + int yy_buf_size; + + /* Number of characters read into yy_ch_buf, not including EOB + * characters. + */ + int yy_n_chars; + + /* Whether we "own" the buffer - i.e., we know we created it, + * and can realloc() it to grow it, and should free() it to + * delete it. + */ + int yy_is_our_buffer; + + /* Whether this is an "interactive" input source; if so, and + * if we're using stdio for input, then we want to use getc() + * instead of fread(), to make sure we stop fetching input after + * each newline. + */ + int yy_is_interactive; + + /* Whether we're considered to be at the beginning of a line. + * If so, '^' rules will be active on the next match, otherwise + * not. + */ + int yy_at_bol; + + int yy_bs_lineno; /**< The line count. */ + int yy_bs_column; /**< The column count. */ + + /* Whether to try to fill the input buffer when we reach the + * end of it. + */ + int yy_fill_buffer; + + int yy_buffer_status; + +#define YY_BUFFER_NEW 0 +#define YY_BUFFER_NORMAL 1 + /* When an EOF's been seen but there's still some text to process + * then we mark the buffer as YY_EOF_PENDING, to indicate that we + * shouldn't try reading from the input source any more. We might + * still have a bunch of tokens to match, though, because of + * possible backing-up. + * + * When we actually see the EOF, we change the status to "new" + * (via yyrestart()), so that the user can continue scanning by + * just pointing yyin at a new input file. + */ +#define YY_BUFFER_EOF_PENDING 2 + + }; +#endif /* !YY_STRUCT_YY_BUFFER_STATE */ + +/* Stack of input buffers. */ +static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ +static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ +static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ + +/* We provide macros for accessing buffer states in case in the + * future we want to put the buffer states in a more general + * "scanner state". + * + * Returns the top of the stack, or NULL. + */ +#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ + ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ + : NULL) +/* Same as previous macro, but useful when we know that the buffer stack is not + * NULL or when we need an lvalue. For internal use only. + */ +#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] + +/* yy_hold_char holds the character lost when yytext is formed. */ +static char yy_hold_char; +static int yy_n_chars; /* number of characters read into yy_ch_buf */ +int yyleng; + +/* Points to current character in buffer. */ +static char *yy_c_buf_p = NULL; +static int yy_init = 0; /* whether we need to initialize */ +static int yy_start = 0; /* start state number */ + +/* Flag which is used to allow yywrap()'s to do buffer switches + * instead of setting up a fresh yyin. A bit of a hack ... + */ +static int yy_did_buffer_switch_on_eof; + +void yyrestart ( FILE *input_file ); +void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); +void yy_delete_buffer ( YY_BUFFER_STATE b ); +void yy_flush_buffer ( YY_BUFFER_STATE b ); +void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); +void yypop_buffer_state ( void ); + +static void yyensure_buffer_stack ( void ); +static void yy_load_buffer_state ( void ); +static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); +#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) + +YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); +YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); +YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); + +void *yyalloc ( yy_size_t ); +void *yyrealloc ( void *, yy_size_t ); +void yyfree ( void * ); + +#define yy_new_buffer yy_create_buffer +#define yy_set_interactive(is_interactive) \ + { \ + if ( ! YY_CURRENT_BUFFER ){ \ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ + } +#define yy_set_bol(at_bol) \ + { \ + if ( ! YY_CURRENT_BUFFER ){\ + yyensure_buffer_stack (); \ + YY_CURRENT_BUFFER_LVALUE = \ + yy_create_buffer( yyin, YY_BUF_SIZE ); \ + } \ + YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ + } +#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) + +/* Begin user sect3 */ + +#define yywrap() (/*CONSTCOND*/1) +#define YY_SKIP_YYWRAP +typedef flex_uint8_t YY_CHAR; + +FILE *yyin = NULL, *yyout = NULL; + +typedef int yy_state_type; + +extern int yylineno; +int yylineno = 1; + +extern char *yytext; +#ifdef yytext_ptr +#undef yytext_ptr +#endif +#define yytext_ptr yytext + +static const flex_int16_t yy_nxt[][42] = + { + { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0 + }, + + { + 9, 10, 11, 12, 13, 14, 15, 16, 17, 14, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 21, + 21, 27, 28, 29, 30, 21, 21, 31, 32, 21, + 33, 21, 34, 35, 36, 37, 38, 21, 39, 21, + 21, 40 + + }, + + { + 9, 10, 11, 12, 13, 14, 15, 16, 17, 14, + 18, 19, 20, 21, 22, 23, 24, 25, 26, 21, + 21, 27, 28, 29, 30, 21, 21, 31, 32, 21, + 33, 21, 34, 35, 36, 37, 38, 21, 39, 21, + 21, 40 + }, + + { + 9, 41, 42, 43, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41 + + }, + + { + 9, 41, 42, 43, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 41, 41 + }, + + { + 9, 44, 45, 46, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44 + + }, + + { + 9, 44, 45, 46, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, + 44, 44 + }, + + { + 9, 47, 47, 48, 47, 49, 47, 50, 47, 49, + 47, 47, 47, 47, 47, 47, 47, 47, 51, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47 + + }, + + { + 9, 47, 47, 48, 47, 49, 47, 50, 47, 49, + 47, 47, 47, 47, 47, 47, 47, 47, 51, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, + 47, 47 + }, + + { + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, + -9, -9, -9, -9, -9, -9, -9, -9, -9, -9, + -9, -9 + + }, + + { + 9, -10, -10, -10, -10, -10, -10, -10, -10, -10, + -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, + -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, + -10, -10, -10, -10, -10, -10, -10, -10, -10, -10, + -10, -10 + }, + + { + 9, -11, 52, -11, -11, -11, -11, -11, -11, -11, + -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, + -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, + -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, + -11, -11 + + }, + + { + 9, -12, -12, -12, -12, -12, -12, -12, -12, -12, + -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, + -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, + -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, + -12, -12 + }, + + { + 9, -13, -13, -13, -13, -13, -13, -13, -13, -13, + -13, -13, -13, -13, -13, -13, 53, -13, -13, -13, + -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, + -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, + -13, -13 + + }, + + { + 9, -14, -14, -14, -14, -14, -14, -14, -14, -14, + -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, + -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, + -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, + -14, -14 + }, + + { + 9, 54, 54, -15, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54 + + }, + + { + 9, -16, -16, -16, -16, -16, -16, 55, -16, -16, + -16, -16, -16, 55, -16, -16, -16, -16, -16, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, -16 + }, + + { + 9, -17, -17, -17, -17, -17, -17, -17, 56, -17, + -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, + -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, + -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, + -17, -17 + + }, + + { + 9, -18, -18, -18, -18, -18, -18, -18, -18, -18, + -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, + -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, + -18, -18, -18, -18, -18, -18, -18, -18, -18, -18, + -18, -18 + }, + + { + 9, -19, -19, -19, -19, -19, -19, -19, -19, -19, + -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, + -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, + -19, -19, -19, -19, -19, -19, -19, -19, -19, -19, + -19, -19 + + }, + + { + 9, -20, -20, -20, -20, -20, -20, -20, -20, -20, + -20, -20, -20, -20, -20, -20, 57, -20, -20, -20, + -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, + -20, -20, -20, -20, -20, -20, -20, -20, -20, -20, + -20, -20 + }, + + { + 9, -21, -21, -21, -21, -21, -21, 55, -21, -21, + -21, -21, -21, 58, -21, -21, -21, -21, -21, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -21 + + }, + + { + 9, -22, -22, -22, -22, -22, -22, -22, -22, -22, + -22, -22, -22, -22, -22, -22, 59, -22, -22, -22, + -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, + -22, -22, -22, -22, -22, -22, -22, -22, -22, -22, + -22, -22 + }, + + { + 9, -23, -23, -23, -23, -23, -23, -23, -23, -23, + -23, -23, -23, -23, -23, -23, 60, -23, -23, -23, + -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, + -23, -23, -23, -23, -23, -23, -23, -23, -23, -23, + -23, -23 + + }, + + { + 9, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24, -24, -24, -24, -24, -24, -24, -24, -24, + -24, -24 + }, + + { + 9, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, 61, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25, -25, -25, -25, -25, -25, -25, -25, -25, + -25, -25 + + }, + + { + 9, -26, -26, 62, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26, -26, -26, -26, -26, -26, -26, -26, -26, + -26, -26 + }, + + { + 9, -27, -27, -27, -27, -27, -27, 55, -27, -27, + -27, -27, -27, 58, -27, -27, -27, -27, -27, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 63, 58, 58, 58, 58, 58, 58, 58, + 58, -27 + + }, + + { + 9, -28, -28, -28, -28, -28, -28, 55, -28, -28, + -28, -28, -28, 58, -28, -28, -28, -28, -28, 58, + 58, 58, 58, 58, 58, 58, 58, 64, 58, 58, + 58, 58, 65, 58, 58, 58, 58, 58, 58, 58, + 58, -28 + }, + + { + 9, -29, -29, -29, -29, -29, -29, 55, -29, -29, + -29, -29, -29, 58, -29, -29, -29, -29, -29, 58, + 58, 58, 58, 58, 66, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -29 + + }, + + { + 9, -30, -30, -30, -30, -30, -30, 55, -30, -30, + -30, -30, -30, 58, -30, -30, -30, -30, -30, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 67, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -30 + }, + + { + 9, -31, -31, -31, -31, -31, -31, 55, -31, -31, + -31, -31, -31, 58, -31, -31, -31, -31, -31, 58, + 58, 58, 58, 58, 68, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -31 + + }, + + { + 9, -32, -32, -32, -32, -32, -32, 55, -32, -32, + -32, -32, -32, 58, -32, -32, -32, -32, -32, 58, + 58, 58, 58, 58, 58, 69, 58, 58, 58, 58, + 70, 71, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -32 + }, + + { + 9, -33, -33, -33, -33, -33, -33, 55, -33, -33, + -33, -33, -33, 58, -33, -33, -33, -33, -33, 58, + 72, 58, 58, 58, 73, 58, 58, 58, 58, 58, + 58, 58, 74, 58, 58, 58, 58, 58, 58, 58, + 58, -33 + + }, + + { + 9, -34, -34, -34, -34, -34, -34, 55, -34, -34, + -34, -34, -34, 58, -34, -34, -34, -34, -34, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 75, 58, 76, 58, 58, 58, 58, 58, 58, + 58, -34 + }, + + { + 9, -35, -35, -35, -35, -35, -35, 55, -35, -35, + -35, -35, -35, 58, -35, -35, -35, -35, -35, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 77, 58, 58, 58, 58, 58, + 58, -35 + + }, + + { + 9, -36, -36, -36, -36, -36, -36, 55, -36, -36, + -36, -36, -36, 58, -36, -36, -36, -36, -36, 58, + 78, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -36 + }, + + { + 9, -37, -37, -37, -37, -37, -37, 55, -37, -37, + -37, -37, -37, 58, -37, -37, -37, -37, -37, 58, + 58, 58, 58, 58, 79, 58, 58, 58, 58, 58, + 58, 58, 80, 58, 58, 58, 81, 58, 58, 58, + 58, -37 + + }, + + { + 9, -38, -38, -38, -38, -38, -38, 55, -38, -38, + -38, -38, -38, 58, -38, -38, -38, -38, -38, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 82, 58, 58, 58, 58, 58, + 58, -38 + }, + + { + 9, -39, -39, -39, -39, -39, -39, 55, -39, -39, + -39, -39, -39, 58, -39, -39, -39, -39, -39, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 83, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -39 + + }, + + { + 9, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, + -40, 84 + }, + + { + 9, 85, 86, -41, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85 + + }, + + { + 9, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, + -42, -42 + }, + + { + 9, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, + -43, -43 + + }, + + { + 9, 87, 87, -44, 87, 87, 87, 87, 87, 87, + 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, + 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, + 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, + 87, 87 + }, + + { + 9, -45, 88, 89, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45, -45, -45, -45, -45, -45, -45, -45, -45, + -45, -45 + + }, + + { + 9, 90, -46, -46, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90 + }, + + { + 9, 91, 91, -47, 91, -47, 91, -47, 91, -47, + 91, 91, 91, 91, 91, 91, 91, 91, -47, 91, + 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, + 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, + 91, 91 + + }, + + { + 9, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48, -48, -48, -48, -48, -48, -48, -48, -48, + -48, -48 + }, + + { + 9, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49, -49, -49, -49, -49, -49, -49, -49, -49, + -49, -49 + + }, + + { + 9, 92, 92, -50, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92 + }, + + { + 9, 93, 93, -51, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, + 93, 93, 93, 93, 93, 93, 93, 93, 93, 93, + 93, 93 + + }, + + { + 9, -52, 52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, + -52, -52 + }, + + { + 9, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53, -53, -53, -53, -53, -53, -53, -53, -53, + -53, -53 + + }, + + { + 9, 54, 54, -54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, + 54, 54 + }, + + { + 9, -55, -55, -55, -55, -55, -55, 55, -55, -55, + -55, -55, -55, 55, -55, -55, -55, -55, -55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, + 55, -55 + + }, + + { + 9, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56, -56, -56, -56, -56, -56, -56, -56, -56, + -56, -56 + }, + + { + 9, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57, -57, -57, -57, -57, -57, -57, -57, -57, + -57, -57 + + }, + + { + 9, -58, -58, -58, -58, -58, -58, 55, -58, -58, + -58, -58, -58, 58, -58, -58, -58, -58, -58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -58 + }, + + { + 9, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59, -59, -59, -59, -59, -59, -59, -59, -59, + -59, -59 + + }, + + { + 9, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60, -60, -60, -60, -60, -60, -60, -60, -60, + -60, -60 + }, + + { + 9, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61, -61, -61, -61, -61, -61, -61, -61, -61, + -61, -61 + + }, + + { + 9, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, + -62, -62 + }, + + { + 9, -63, -63, -63, -63, -63, -63, 55, -63, -63, + -63, -63, -63, 58, -63, -63, -63, -63, -63, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 94, 58, 58, 58, 58, 58, 58, 58, + 58, -63 + + }, + + { + 9, -64, -64, -64, -64, -64, -64, 55, -64, -64, + -64, -64, -64, 58, -64, -64, -64, -64, -64, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 95, 58, 58, 58, 58, 58, 58, 58, + 58, -64 + }, + + { + 9, -65, -65, -65, -65, -65, -65, 55, -65, -65, + -65, -65, -65, 58, -65, -65, -65, -65, -65, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 96, 97, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -65 + + }, + + { + 9, -66, -66, -66, -66, -66, -66, 55, -66, -66, + -66, -66, -66, 58, -66, -66, -66, -66, -66, 58, + 58, 58, 58, 58, 58, 98, 58, 58, 58, 58, + 58, 58, 58, 99, 58, 58, 58, 58, 58, 58, + 58, -66 + }, + + { + 9, -67, -67, -67, -67, -67, -67, 55, -67, -67, + -67, -67, -67, 58, -67, -67, -67, -67, -67, 58, + 58, 58, 58, 100, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -67 + + }, + + { + 9, -68, -68, -68, -68, -68, -68, 55, -68, -68, + -68, -68, -68, 58, -68, -68, -68, -68, -68, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 101, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 102, + 58, -68 + }, + + { + 9, -69, -69, -69, -69, -69, -69, 55, -69, -69, + -69, -69, -69, 58, -69, -69, -69, -69, -69, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -69 + + }, + + { + 9, -70, -70, -70, -70, -70, -70, 55, -70, -70, + -70, -70, -70, 58, -70, -70, -70, -70, -70, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 103, 58, 58, 58, 58, 58, 58, + 58, -70 + }, + + { + 9, -71, -71, -71, -71, -71, -71, 55, -71, -71, + -71, -71, -71, 58, -71, -71, -71, -71, -71, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 104, 58, 58, 58, + 58, -71 + + }, + + { + 9, -72, -72, -72, -72, -72, -72, 55, -72, -72, + -72, -72, -72, 58, -72, -72, -72, -72, -72, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 105, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -72 + }, + + { + 9, -73, -73, -73, -73, -73, -73, 55, -73, -73, + -73, -73, -73, 58, -73, -73, -73, -73, -73, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 106, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -73 + + }, + + { + 9, -74, -74, -74, -74, -74, -74, 55, -74, -74, + -74, -74, -74, 58, -74, -74, -74, -74, -74, 58, + 58, 58, 58, 107, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -74 + }, + + { + 9, -75, -75, -75, -75, -75, -75, 55, -75, -75, + -75, -75, -75, 58, -75, -75, -75, -75, -75, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -75 + + }, + + { + 9, -76, -76, -76, -76, -76, -76, 55, -76, -76, + -76, -76, -76, 58, -76, -76, -76, -76, -76, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 108, 58, 58, 58, + 58, -76 + }, + + { + 9, -77, -77, -77, -77, -77, -77, 55, -77, -77, + -77, -77, -77, 58, -77, -77, -77, -77, -77, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 109, 58, 58, 58, 58, 58, 58, 58, + 58, -77 + + }, + + { + 9, -78, -78, -78, -78, -78, -78, 55, -78, -78, + -78, -78, -78, 58, -78, -78, -78, -78, -78, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 110, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -78 + }, + + { + 9, -79, -79, -79, -79, -79, -79, 55, -79, -79, + -79, -79, -79, 58, -79, -79, -79, -79, -79, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 111, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -79 + + }, + + { + 9, -80, -80, -80, -80, -80, -80, 55, -80, -80, + -80, -80, -80, 58, -80, -80, -80, -80, -80, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 112, 58, 58, + 58, -80 + }, + + { + 9, -81, -81, -81, -81, -81, -81, 55, -81, -81, + -81, -81, -81, 58, -81, -81, -81, -81, -81, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 113, 58, 58, 58, 58, 58, + 58, -81 + + }, + + { + 9, -82, -82, -82, -82, -82, -82, 55, -82, -82, + -82, -82, -82, 58, -82, -82, -82, -82, -82, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 114, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -82 + }, + + { + 9, -83, -83, -83, -83, -83, -83, 55, -83, -83, + -83, -83, -83, 58, -83, -83, -83, -83, -83, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 115, 58, 58, 58, 58, + 58, -83 + + }, + + { + 9, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84, -84, -84, -84, -84, -84, -84, -84, -84, + -84, -84 + }, + + { + 9, 85, 86, -85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, + 85, 85 + + }, + + { + 9, 86, 86, -86, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, + 86, 86 + }, + + { + 9, 87, 87, -87, 87, 87, 87, 87, 87, 87, + 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, + 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, + 87, 87, 87, 87, 87, 87, 87, 87, 87, 87, + 87, 87 + + }, + + { + 9, -88, 88, 89, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88, -88, -88, -88, -88, -88, -88, -88, -88, + -88, -88 + }, + + { + 9, 90, -89, -89, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90 + + }, + + { + 9, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90, -90, -90, -90, -90, -90, -90, -90, -90, + -90, -90 + }, + + { + 9, 91, 91, -91, 91, -91, 91, -91, 91, -91, + 91, 91, 91, 91, 91, 91, 91, 91, -91, 91, + 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, + 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, + 91, 91 + + }, + + { + 9, 92, 92, -92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, + 92, 92 + }, + + { + 9, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93, -93, -93, -93, -93, -93, -93, -93, -93, + -93, -93 + + }, + + { + 9, -94, -94, -94, -94, -94, -94, 55, -94, -94, + -94, -94, -94, 58, -94, -94, -94, -94, -94, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 116, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -94 + }, + + { + 9, -95, -95, -95, -95, -95, -95, 55, -95, -95, + -95, -95, -95, 58, -95, -95, -95, -95, -95, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 117, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -95 + + }, + + { + 9, -96, -96, -96, -96, -96, -96, 55, -96, -96, + -96, -96, -96, 58, -96, -96, -96, -96, -96, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 118, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -96 + }, + + { + 9, -97, -97, -97, -97, -97, -97, 55, -97, -97, + -97, -97, -97, 58, -97, -97, -97, -97, -97, 58, + 58, 58, 58, 58, 58, 119, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -97 + + }, + + { + 9, -98, -98, -98, -98, -98, -98, 55, -98, -98, + -98, -98, -98, 58, -98, -98, -98, -98, -98, 120, + 121, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -98 + }, + + { + 9, -99, -99, -99, -99, -99, -99, 55, -99, -99, + -99, -99, -99, 58, -99, -99, -99, -99, -99, 58, + 58, 58, 58, 58, 122, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -99 + + }, + + { + 9, -100, -100, -100, -100, -100, -100, 55, -100, -100, + -100, -100, -100, 58, -100, -100, -100, -100, -100, 58, + 58, 58, 123, 58, 58, 58, 58, 58, 124, 58, + 125, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -100 + }, + + { + 9, -101, -101, -101, -101, -101, -101, 55, -101, -101, + -101, -101, -101, 58, -101, -101, -101, -101, -101, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 126, 58, 58, 58, 58, 58, 58, + 58, -101 + + }, + + { + 9, -102, -102, -102, -102, -102, -102, 55, -102, -102, + -102, -102, -102, 58, -102, -102, -102, -102, -102, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -102 + }, + + { + 9, -103, -103, -103, -103, -103, -103, 55, -103, -103, + -103, -103, -103, 58, -103, -103, -103, -103, -103, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 127, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -103 + + }, + + { + 9, -104, -104, -104, -104, -104, -104, 55, -104, -104, + -104, -104, -104, 58, -104, -104, -104, -104, -104, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -104 + }, + + { + 9, -105, -105, -105, -105, -105, -105, 55, -105, -105, + -105, -105, -105, 58, -105, -105, -105, -105, -105, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 128, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -105 + + }, + + { + 9, -106, -106, -106, -106, -106, -106, 55, -106, -106, + -106, -106, -106, 58, -106, -106, -106, -106, -106, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 129, 58, 58, + 58, -106 + }, + + { + 9, -107, -107, -107, -107, -107, -107, 55, -107, -107, + -107, -107, -107, 58, -107, -107, -107, -107, -107, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 130, 58, 58, + 58, -107 + + }, + + { + 9, -108, -108, -108, -108, -108, -108, 55, -108, -108, + -108, -108, -108, 58, -108, -108, -108, -108, -108, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 131, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -108 + }, + + { + 9, -109, -109, -109, -109, -109, -109, 55, -109, -109, + -109, -109, -109, 58, -109, -109, -109, -109, -109, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 132, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -109 + + }, + + { + 9, -110, -110, -110, -110, -110, -110, 55, -110, -110, + -110, -110, -110, 58, -110, -110, -110, -110, -110, 58, + 58, 58, 58, 58, 58, 58, 133, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -110 + }, + + { + 9, -111, -111, -111, -111, -111, -111, 55, -111, -111, + -111, -111, -111, 58, -111, -111, -111, -111, -111, 58, + 58, 58, 58, 58, 134, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -111 + + }, + + { + 9, -112, -112, -112, -112, -112, -112, 55, -112, -112, + -112, -112, -112, 58, -112, -112, -112, -112, -112, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 135, 58, 58, 58, 58, 58, + 58, -112 + }, + + { + 9, -113, -113, -113, -113, -113, -113, 55, -113, -113, + -113, -113, -113, 58, -113, -113, -113, -113, -113, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 136, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -113 + + }, + + { + 9, -114, -114, -114, -114, -114, -114, 55, -114, -114, + -114, -114, -114, 58, -114, -114, -114, -114, -114, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 137, 58, 58, 58, 58, + 58, -114 + }, + + { + 9, -115, -115, -115, -115, -115, -115, 55, -115, -115, + -115, -115, -115, 58, -115, -115, -115, -115, -115, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 138, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -115 + + }, + + { + 9, -116, -116, -116, -116, -116, -116, 55, -116, -116, + -116, -116, -116, 58, -116, -116, -116, -116, -116, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -116 + }, + + { + 9, -117, -117, -117, -117, -117, -117, 55, -117, -117, + -117, -117, -117, 58, -117, -117, -117, -117, -117, 58, + 58, 58, 139, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -117 + + }, + + { + 9, -118, -118, -118, -118, -118, -118, 55, -118, -118, + -118, -118, -118, 58, -118, -118, -118, -118, -118, 58, + 58, 58, 58, 58, 140, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -118 + }, + + { + 9, -119, -119, -119, -119, -119, -119, 55, -119, -119, + -119, -119, -119, 58, -119, -119, -119, -119, -119, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 141, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -119 + + }, + + { + 9, -120, -120, -120, -120, -120, -120, 55, -120, -120, + -120, -120, -120, 58, -120, -120, -120, -120, -120, 58, + 58, 142, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 143, 58, 58, 58, + 58, -120 + }, + + { + 9, -121, -121, -121, -121, -121, -121, 55, -121, -121, + -121, -121, -121, 58, -121, -121, -121, -121, -121, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 144, 58, 58, + 58, -121 + + }, + + { + 9, -122, -122, -122, -122, -122, -122, 55, -122, -122, + -122, -122, -122, 58, -122, -122, -122, -122, -122, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 145, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -122 + }, + + { + 9, -123, -123, -123, -123, -123, -123, 55, -123, -123, + -123, -123, -123, 58, -123, -123, -123, -123, -123, 58, + 58, 58, 58, 58, 58, 58, 58, 146, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -123 + + }, + + { + 9, -124, -124, -124, -124, -124, -124, 55, -124, -124, + -124, -124, -124, 58, -124, -124, -124, -124, -124, 58, + 58, 58, 58, 58, 58, 147, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -124 + }, + + { + 9, -125, -125, -125, -125, -125, -125, 55, -125, -125, + -125, -125, -125, 58, -125, -125, -125, -125, -125, 58, + 58, 58, 58, 58, 148, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -125 + + }, + + { + 9, -126, -126, -126, -126, -126, -126, 55, -126, -126, + -126, -126, -126, 58, -126, -126, -126, -126, -126, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -126 + }, + + { + 9, -127, -127, -127, -127, -127, -127, 55, -127, -127, + -127, -127, -127, 58, -127, -127, -127, -127, -127, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 149, -127 + + }, + + { + 9, -128, -128, -128, -128, -128, -128, 55, -128, -128, + -128, -128, -128, 58, -128, -128, -128, -128, -128, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 150, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -128 + }, + + { + 9, -129, -129, -129, -129, -129, -129, 55, -129, -129, + -129, -129, -129, 58, -129, -129, -129, -129, -129, 58, + 58, 58, 151, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -129 + + }, + + { + 9, -130, -130, -130, -130, -130, -130, 55, -130, -130, + -130, -130, -130, 58, -130, -130, -130, -130, -130, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 152, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -130 + }, + + { + 9, -131, -131, -131, -131, -131, -131, 55, -131, -131, + -131, -131, -131, 58, -131, -131, -131, -131, -131, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 153, 58, 58, 58, 58, 58, 58, 58, + 58, -131 + + }, + + { + 9, -132, -132, -132, -132, -132, -132, 55, -132, -132, + -132, -132, -132, 58, -132, -132, -132, -132, -132, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 154, 58, 58, 58, 58, 58, 58, + 58, -132 + }, + + { + 9, -133, -133, -133, -133, -133, -133, 55, -133, -133, + -133, -133, -133, 58, -133, -133, -133, -133, -133, 58, + 58, 58, 58, 58, 155, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -133 + + }, + + { + 9, -134, -134, -134, -134, -134, -134, 55, -134, -134, + -134, -134, -134, 58, -134, -134, -134, -134, -134, 58, + 58, 58, 156, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -134 + }, + + { + 9, -135, -135, -135, -135, -135, -135, 55, -135, -135, + -135, -135, -135, 58, -135, -135, -135, -135, -135, 58, + 58, 58, 157, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -135 + + }, + + { + 9, -136, -136, -136, -136, -136, -136, 55, -136, -136, + -136, -136, -136, 58, -136, -136, -136, -136, -136, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 158, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -136 + }, + + { + 9, -137, -137, -137, -137, -137, -137, 55, -137, -137, + -137, -137, -137, 58, -137, -137, -137, -137, -137, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 159, 58, 58, 58, + 58, -137 + + }, + + { + 9, -138, -138, -138, -138, -138, -138, 55, -138, -138, + -138, -138, -138, 58, -138, -138, -138, -138, -138, 58, + 58, 160, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -138 + }, + + { + 9, -139, -139, -139, -139, -139, -139, 55, -139, -139, + -139, -139, -139, 58, -139, -139, -139, -139, -139, 58, + 58, 58, 58, 58, 161, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -139 + + }, + + { + 9, -140, -140, -140, -140, -140, -140, 55, -140, -140, + -140, -140, -140, 58, -140, -140, -140, -140, -140, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 162, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -140 + }, + + { + 9, -141, -141, -141, -141, -141, -141, 55, -141, -141, + -141, -141, -141, 58, -141, -141, -141, -141, -141, 58, + 58, 58, 58, 58, 58, 58, 163, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -141 + + }, + + { + 9, -142, -142, -142, -142, -142, -142, 55, -142, -142, + -142, -142, -142, 58, -142, -142, -142, -142, -142, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 164, 58, 58, 58, 58, 58, 58, 58, + 58, -142 + }, + + { + 9, -143, -143, -143, -143, -143, -143, 55, -143, -143, + -143, -143, -143, 58, -143, -143, -143, -143, -143, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 165, 58, 58, 58, 58, 58, + 58, -143 + + }, + + { + 9, -144, -144, -144, -144, -144, -144, 55, -144, -144, + -144, -144, -144, 58, -144, -144, -144, -144, -144, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 166, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -144 + }, + + { + 9, -145, -145, -145, -145, -145, -145, 55, -145, -145, + -145, -145, -145, 58, -145, -145, -145, -145, -145, 58, + 58, 58, 58, 167, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -145 + + }, + + { + 9, -146, -146, -146, -146, -146, -146, 55, -146, -146, + -146, -146, -146, 58, -146, -146, -146, -146, -146, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 168, 58, 58, 58, 58, 58, 58, 58, + 58, -146 + }, + + { + 9, -147, -147, -147, -147, -147, -147, 55, -147, -147, + -147, -147, -147, 58, -147, -147, -147, -147, -147, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -147 + + }, + + { + 9, -148, -148, -148, -148, -148, -148, 55, -148, -148, + -148, -148, -148, 58, -148, -148, -148, -148, -148, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 169, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -148 + }, + + { + 9, -149, -149, -149, -149, -149, -149, 55, -149, -149, + -149, -149, -149, 58, -149, -149, -149, -149, -149, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -149 + + }, + + { + 9, -150, -150, -150, -150, -150, -150, 55, -150, -150, + -150, -150, -150, 58, -150, -150, -150, -150, -150, 58, + 58, 58, 58, 58, 170, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -150 + }, + + { + 9, -151, -151, -151, -151, -151, -151, 55, -151, -151, + -151, -151, -151, 58, -151, -151, -151, -151, -151, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 171, 58, 58, 58, 58, 58, 58, 58, + 58, -151 + + }, + + { + 9, -152, -152, -152, -152, -152, -152, 55, -152, -152, + -152, -152, -152, 58, -152, -152, -152, -152, -152, 58, + 58, 58, 58, 58, 172, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -152 + }, + + { + 9, -153, -153, -153, -153, -153, -153, 55, -153, -153, + -153, -153, -153, 58, -153, -153, -153, -153, -153, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 173, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -153 + + }, + + { + 9, -154, -154, -154, -154, -154, -154, 55, -154, -154, + -154, -154, -154, 58, -154, -154, -154, -154, -154, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 174, 58, 58, 58, + 58, -154 + }, + + { + 9, -155, -155, -155, -155, -155, -155, 55, -155, -155, + -155, -155, -155, 58, -155, -155, -155, -155, -155, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -155 + + }, + + { + 9, -156, -156, -156, -156, -156, -156, 55, -156, -156, + -156, -156, -156, 58, -156, -156, -156, -156, -156, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 175, 58, 58, 58, + 58, -156 + }, + + { + 9, -157, -157, -157, -157, -157, -157, 55, -157, -157, + -157, -157, -157, 58, -157, -157, -157, -157, -157, 58, + 58, 58, 58, 58, 176, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -157 + + }, + + { + 9, -158, -158, -158, -158, -158, -158, 55, -158, -158, + -158, -158, -158, 58, -158, -158, -158, -158, -158, 58, + 58, 58, 58, 58, 58, 58, 177, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -158 + }, + + { + 9, -159, -159, -159, -159, -159, -159, 55, -159, -159, + -159, -159, -159, 58, -159, -159, -159, -159, -159, 58, + 178, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -159 + + }, + + { + 9, -160, -160, -160, -160, -160, -160, 55, -160, -160, + -160, -160, -160, 58, -160, -160, -160, -160, -160, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 179, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -160 + }, + + { + 9, -161, -161, -161, -161, -161, -161, 55, -161, -161, + -161, -161, -161, 58, -161, -161, -161, -161, -161, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -161 + + }, + + { + 9, -162, -162, -162, -162, -162, -162, 55, -162, -162, + -162, -162, -162, 58, -162, -162, -162, -162, -162, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 180, 58, 58, 58, + 58, -162 + }, + + { + 9, -163, -163, -163, -163, -163, -163, 55, -163, -163, + -163, -163, -163, 58, -163, -163, -163, -163, -163, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -163 + + }, + + { + 9, -164, -164, -164, -164, -164, -164, 55, -164, -164, + -164, -164, -164, 58, -164, -164, -164, -164, -164, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 181, 58, 58, 58, 58, 58, 58, 58, + 58, -164 + }, + + { + 9, -165, -165, -165, -165, -165, -165, 55, -165, -165, + -165, -165, -165, 58, -165, -165, -165, -165, -165, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 182, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -165 + + }, + + { + 9, -166, -166, -166, -166, -166, -166, 55, -166, -166, + -166, -166, -166, 58, -166, -166, -166, -166, -166, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 183, 58, 58, 58, + 58, -166 + }, + + { + 9, -167, -167, -167, -167, -167, -167, 55, -167, -167, + -167, -167, -167, 58, -167, -167, -167, -167, -167, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 184, 58, 58, 58, 58, + 58, -167 + + }, + + { + 9, -168, -168, -168, -168, -168, -168, 55, -168, -168, + -168, -168, -168, 58, -168, -168, -168, -168, -168, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 185, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -168 + }, + + { + 9, -169, -169, -169, -169, -169, -169, 55, -169, -169, + -169, -169, -169, 58, -169, -169, -169, -169, -169, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 186, 58, 58, + 58, -169 + + }, + + { + 9, -170, -170, -170, -170, -170, -170, 55, -170, -170, + -170, -170, -170, 58, -170, -170, -170, -170, -170, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 187, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -170 + }, + + { + 9, -171, -171, -171, -171, -171, -171, 55, -171, -171, + -171, -171, -171, 58, -171, -171, -171, -171, -171, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 188, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -171 + + }, + + { + 9, -172, -172, -172, -172, -172, -172, 55, -172, -172, + -172, -172, -172, 58, -172, -172, -172, -172, -172, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 189, 58, 58, 58, 58, + 58, -172 + }, + + { + 9, -173, -173, -173, -173, -173, -173, 55, -173, -173, + -173, -173, -173, 58, -173, -173, -173, -173, -173, 58, + 190, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -173 + + }, + + { + 9, -174, -174, -174, -174, -174, -174, 55, -174, -174, + -174, -174, -174, 58, -174, -174, -174, -174, -174, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -174 + }, + + { + 9, -175, -175, -175, -175, -175, -175, 55, -175, -175, + -175, -175, -175, 58, -175, -175, -175, -175, -175, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -175 + + }, + + { + 9, -176, -176, -176, -176, -176, -176, 55, -176, -176, + -176, -176, -176, 58, -176, -176, -176, -176, -176, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -176 + }, + + { + 9, -177, -177, -177, -177, -177, -177, 55, -177, -177, + -177, -177, -177, 58, -177, -177, -177, -177, -177, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -177 + + }, + + { + 9, -178, -178, -178, -178, -178, -178, 55, -178, -178, + -178, -178, -178, 58, -178, -178, -178, -178, -178, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 191, 58, 58, 58, + 58, -178 + }, + + { + 9, -179, -179, -179, -179, -179, -179, 55, -179, -179, + -179, -179, -179, 58, -179, -179, -179, -179, -179, 58, + 58, 58, 58, 58, 192, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -179 + + }, + + { + 9, -180, -180, -180, -180, -180, -180, 55, -180, -180, + -180, -180, -180, 58, -180, -180, -180, -180, -180, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -180 + }, + + { + 9, -181, -181, -181, -181, -181, -181, 55, -181, -181, + -181, -181, -181, 58, -181, -181, -181, -181, -181, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 193, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -181 + + }, + + { + 9, -182, -182, -182, -182, -182, -182, 55, -182, -182, + -182, -182, -182, 58, -182, -182, -182, -182, -182, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 194, 58, 58, 58, 58, + 58, -182 + }, + + { + 9, -183, -183, -183, -183, -183, -183, 55, -183, -183, + -183, -183, -183, 58, -183, -183, -183, -183, -183, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -183 + + }, + + { + 9, -184, -184, -184, -184, -184, -184, 55, -184, -184, + -184, -184, -184, 58, -184, -184, -184, -184, -184, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -184 + }, + + { + 9, -185, -185, -185, -185, -185, -185, 55, -185, -185, + -185, -185, -185, 58, -185, -185, -185, -185, -185, 58, + 58, 58, 195, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -185 + + }, + + { + 9, -186, -186, -186, -186, -186, -186, 55, -186, -186, + -186, -186, -186, 58, -186, -186, -186, -186, -186, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -186 + }, + + { + 9, -187, -187, -187, -187, -187, -187, 55, -187, -187, + -187, -187, -187, 58, -187, -187, -187, -187, -187, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 196, 58, 58, + 58, -187 + + }, + + { + 9, -188, -188, -188, -188, -188, -188, 55, -188, -188, + -188, -188, -188, 58, -188, -188, -188, -188, -188, 58, + 58, 58, 58, 58, 58, 197, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -188 + }, + + { + 9, -189, -189, -189, -189, -189, -189, 55, -189, -189, + -189, -189, -189, 58, -189, -189, -189, -189, -189, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -189 + + }, + + { + 9, -190, -190, -190, -190, -190, -190, 55, -190, -190, + -190, -190, -190, 58, -190, -190, -190, -190, -190, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 198, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -190 + }, + + { + 9, -191, -191, -191, -191, -191, -191, 55, -191, -191, + -191, -191, -191, 58, -191, -191, -191, -191, -191, 58, + 58, 58, 58, 58, 199, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -191 + + }, + + { + 9, -192, -192, -192, -192, -192, -192, 55, -192, -192, + -192, -192, -192, 58, -192, -192, -192, -192, -192, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -192 + }, + + { + 9, -193, -193, -193, -193, -193, -193, 55, -193, -193, + -193, -193, -193, 58, -193, -193, -193, -193, -193, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -193 + + }, + + { + 9, -194, -194, -194, -194, -194, -194, 55, -194, -194, + -194, -194, -194, 58, -194, -194, -194, -194, -194, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 200, 58, 58, 58, + 58, -194 + }, + + { + 9, -195, -195, -195, -195, -195, -195, 55, -195, -195, + -195, -195, -195, 58, -195, -195, -195, -195, -195, 58, + 58, 58, 58, 58, 201, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -195 + + }, + + { + 9, -196, -196, -196, -196, -196, -196, 55, -196, -196, + -196, -196, -196, 58, -196, -196, -196, -196, -196, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -196 + }, + + { + 9, -197, -197, -197, -197, -197, -197, 55, -197, -197, + -197, -197, -197, 58, -197, -197, -197, -197, -197, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 202, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -197 + + }, + + { + 9, -198, -198, -198, -198, -198, -198, 55, -198, -198, + -198, -198, -198, 58, -198, -198, -198, -198, -198, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -198 + }, + + { + 9, -199, -199, -199, -199, -199, -199, 55, -199, -199, + -199, -199, -199, 58, -199, -199, -199, -199, -199, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -199 + + }, + + { + 9, -200, -200, -200, -200, -200, -200, 55, -200, -200, + -200, -200, -200, 58, -200, -200, -200, -200, -200, 58, + 203, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -200 + }, + + { + 9, -201, -201, -201, -201, -201, -201, 55, -201, -201, + -201, -201, -201, 58, -201, -201, -201, -201, -201, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -201 + + }, + + { + 9, -202, -202, -202, -202, -202, -202, 55, -202, -202, + -202, -202, -202, 58, -202, -202, -202, -202, -202, 58, + 58, 58, 58, 58, 58, 58, 204, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -202 + }, + + { + 9, -203, -203, -203, -203, -203, -203, 55, -203, -203, + -203, -203, -203, 58, -203, -203, -203, -203, -203, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 205, 58, 58, 58, + 58, -203 + + }, + + { + 9, -204, -204, -204, -204, -204, -204, 55, -204, -204, + -204, -204, -204, 58, -204, -204, -204, -204, -204, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -204 + }, + + { + 9, -205, -205, -205, -205, -205, -205, 55, -205, -205, + -205, -205, -205, 58, -205, -205, -205, -205, -205, 58, + 58, 58, 58, 58, 206, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -205 + + }, + + { + 9, -206, -206, -206, -206, -206, -206, 55, -206, -206, + -206, -206, -206, 58, -206, -206, -206, -206, -206, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, -206 + }, + + } ; + +static yy_state_type yy_get_previous_state ( void ); +static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); +static int yy_get_next_buffer ( void ); +static void yynoreturn yy_fatal_error ( const char* msg ); + +/* Done after the current pattern has been matched and before the + * corresponding action - sets up yytext. + */ +#define YY_DO_BEFORE_ACTION \ + (yytext_ptr) = yy_bp; \ + yyleng = (int) (yy_cp - yy_bp); \ + (yy_hold_char) = *yy_cp; \ + *yy_cp = '\0'; \ + (yy_c_buf_p) = yy_cp; +#define YY_NUM_RULES 63 +#define YY_END_OF_BUFFER 64 +/* This struct is not used in this scanner, + but its presence is necessary. */ +struct yy_trans_info + { + flex_int32_t yy_verify; + flex_int32_t yy_nxt; + }; +static const flex_int16_t yy_accept[207] = + { 0, + 2, 2, 0, 0, 0, 0, 0, 0, 64, 50, + 2, 4, 42, 47, 1, 49, 50, 43, 44, 50, + 48, 50, 38, 36, 40, 50, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 50, + 51, 53, 52, 62, 59, 61, 55, 58, 57, 54, + 56, 2, 37, 1, 49, 35, 46, 48, 45, 39, + 41, 3, 48, 48, 48, 48, 48, 48, 18, 48, + 48, 48, 48, 48, 25, 48, 48, 48, 48, 48, + 48, 48, 48, 34, 51, 51, 62, 59, 61, 60, + 55, 54, 56, 48, 48, 48, 48, 48, 48, 48, + + 48, 17, 48, 20, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 5, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 16, 48, 48, 22, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 14, 48, 19, 48, + 48, 48, 48, 48, 28, 48, 48, 48, 48, 48, + 6, 48, 8, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 27, 29, 30, 31, 48, 48, 7, + 48, 48, 11, 12, 48, 15, 48, 48, 24, 48, + 48, 33, 9, 48, 48, 21, 48, 26, 32, 48, + + 13, 48, 48, 23, 48, 10 + } ; + +static const YY_CHAR yy_ec[256] = + { 0, + 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 2, 4, 5, 6, 7, 1, 8, 9, 10, + 11, 1, 12, 1, 13, 1, 1, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 14, 1, 15, + 16, 17, 1, 1, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, + 1, 18, 1, 1, 19, 1, 20, 21, 22, 23, + + 24, 25, 26, 27, 28, 13, 13, 29, 30, 31, + 32, 33, 13, 34, 35, 36, 37, 38, 13, 39, + 40, 13, 1, 41, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 + } ; + +/* Table of booleans, true if rule could match eol. */ +static const flex_int32_t yy_rule_can_match_eol[64] = + { 0, +0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, + 1, 1, 0, 0, }; + +extern int yy_flex_debug; +int yy_flex_debug = 0; + +/* The intent behind this definition is that it'll catch + * any uses of REJECT which flex missed. + */ +#define REJECT reject_used_but_not_detected +#define yymore() yymore_used_but_not_detected +#define YY_MORE_ADJ 0 +#define YY_RESTORE_YY_MORE_OFFSET +char *yytext; +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2002 Roman Zippel + */ + +#include +#include +#include +#include +#include + +#include "lkc.h" +#include "preprocess.h" + +#include "parser.tab.h" + +#define YY_DECL static int yylex1(void) + +#define START_STRSIZE 16 + +/* The Kconfig file currently being parsed. */ +const char *cur_filename; + +/* + * The line number of the current statement. This does not match yylineno. + * yylineno is used by the lexer, while cur_lineno is used by the parser. + */ +int cur_lineno; + +static int prev_prev_token = T_EOL; +static int prev_token = T_EOL; +static char *text; +static int text_size, text_asize; + +struct buffer { + struct buffer *parent; + YY_BUFFER_STATE state; + int yylineno; + const char *filename; + int source_lineno; +}; + +static struct buffer *current_buf; + +static int last_ts, first_ts; + +static char *expand_token(const char *in, size_t n); +static void append_expanded_string(const char *in); +static void zconf_endhelp(void); +static void zconf_endfile(void); + +static void new_string(void) +{ + text = xmalloc(START_STRSIZE); + text_asize = START_STRSIZE; + text_size = 0; + *text = 0; +} + +static void append_string(const char *str, int size) +{ + int new_size = text_size + size + 1; + if (new_size > text_asize) { + new_size += START_STRSIZE - 1; + new_size &= -START_STRSIZE; + text = xrealloc(text, new_size); + text_asize = new_size; + } + memcpy(text + text_size, str, size); + text_size += size; + text[text_size] = 0; +} + +static void alloc_string(const char *str, int size) +{ + text = xmalloc(size + 1); + memcpy(text, str, size); + text[size] = 0; +} + +static void warn_ignored_character(char chr) +{ + fprintf(stderr, + "%s:%d:warning: ignoring unsupported character '%c'\n", + cur_filename, yylineno, chr); +} + +#define INITIAL 0 +#define ASSIGN_VAL 1 +#define HELP 2 +#define STRING 3 + +#ifndef YY_NO_UNISTD_H +/* Special case for "unistd.h", since it is non-ANSI. We include it way + * down here because we want the user's section 1 to have been scanned first. + * The user has a chance to override it with an option. + */ +#include +#endif + +#ifndef YY_EXTRA_TYPE +#define YY_EXTRA_TYPE void * +#endif + +static int yy_init_globals ( void ); + +/* Accessor methods to globals. + These are made visible to non-reentrant scanners for convenience. */ + +int yylex_destroy ( void ); + +int yyget_debug ( void ); + +void yyset_debug ( int debug_flag ); + +YY_EXTRA_TYPE yyget_extra ( void ); + +void yyset_extra ( YY_EXTRA_TYPE user_defined ); + +FILE *yyget_in ( void ); + +void yyset_in ( FILE * _in_str ); + +FILE *yyget_out ( void ); + +void yyset_out ( FILE * _out_str ); + + int yyget_leng ( void ); + +char *yyget_text ( void ); + +int yyget_lineno ( void ); + +void yyset_lineno ( int _line_number ); + +/* Macros after this point can all be overridden by user definitions in + * section 1. + */ + +#ifndef YY_SKIP_YYWRAP +#ifdef __cplusplus +extern "C" int yywrap ( void ); +#else +extern int yywrap ( void ); +#endif +#endif + +#ifndef YY_NO_UNPUT + + static void yyunput ( int c, char *buf_ptr ); + +#endif + +#ifndef yytext_ptr +static void yy_flex_strncpy ( char *, const char *, int ); +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen ( const char * ); +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus +static int yyinput ( void ); +#else +static int input ( void ); +#endif + +#endif + +/* Amount of stuff to slurp up with each read. */ +#ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else +#define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ +#endif + +/* Copy whatever the last rule matched to the standard output. */ +#ifndef ECHO +/* This used to be an fputs(), but since the string might contain NUL's, + * we now use fwrite(). + */ +#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) +#endif + +/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, + * is returned in "result". + */ +#ifndef YY_INPUT +#define YY_INPUT(buf,result,max_size) \ + errno=0; \ + while ( (result = (int) read( fileno(yyin), buf, (yy_size_t) max_size )) < 0 ) \ + { \ + if( errno != EINTR) \ + { \ + YY_FATAL_ERROR( "input in flex scanner failed" ); \ + break; \ + } \ + errno=0; \ + clearerr(yyin); \ + }\ +\ + +#endif + +/* No semi-colon after return; correct usage is to write "yyterminate();" - + * we don't want an extra ';' after the "return" because that will cause + * some compilers to complain about unreachable statements. + */ +#ifndef yyterminate +#define yyterminate() return YY_NULL +#endif + +/* Number of entries by which start-condition stack grows. */ +#ifndef YY_START_STACK_INCR +#define YY_START_STACK_INCR 25 +#endif + +/* Report a fatal error. */ +#ifndef YY_FATAL_ERROR +#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) +#endif + +/* end tables serialization structures and prototypes */ + +/* Default declaration of generated scanner - a define so the user can + * easily add parameters. + */ +#ifndef YY_DECL +#define YY_DECL_IS_OURS 1 + +extern int yylex (void); + +#define YY_DECL int yylex (void) +#endif /* !YY_DECL */ + +/* Code executed at the beginning of each rule, after yytext and yyleng + * have been set up. + */ +#ifndef YY_USER_ACTION +#define YY_USER_ACTION +#endif + +/* Code executed at the end of each rule. */ +#ifndef YY_BREAK +#define YY_BREAK /*LINTED*/break; +#endif + +#define YY_RULE_SETUP \ + YY_USER_ACTION + +/** The main scanner function which does all the work. + */ +YY_DECL +{ + yy_state_type yy_current_state; + char *yy_cp, *yy_bp; + int yy_act; + + if ( !(yy_init) ) + { + (yy_init) = 1; + +#ifdef YY_USER_INIT + YY_USER_INIT; +#endif + + if ( ! (yy_start) ) + (yy_start) = 1; /* first start state */ + + if ( ! yyin ) + yyin = stdin; + + if ( ! yyout ) + yyout = stdout; + + if ( ! YY_CURRENT_BUFFER ) { + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } + + yy_load_buffer_state( ); + } + + { + + char open_quote = 0; + + while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ + { + yy_cp = (yy_c_buf_p); + + /* Support of yytext. */ + *yy_cp = (yy_hold_char); + + /* yy_bp points to the position in yy_ch_buf of the start of + * the current run. + */ + yy_bp = yy_cp; + + yy_current_state = (yy_start); +yy_match: + while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 ) + ++yy_cp; + + yy_current_state = -yy_current_state; + +yy_find_action: + yy_act = yy_accept[yy_current_state]; + + YY_DO_BEFORE_ACTION; + + if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) + { + int yyl; + for ( yyl = 0; yyl < yyleng; ++yyl ) + if ( yytext[yyl] == '\n' ) + + yylineno++; +; + } + +do_action: /* This label is used only to access EOF actions. */ + + switch ( yy_act ) + { /* beginning of action switch */ +case 1: +YY_RULE_SETUP +/* ignore comment */ + YY_BREAK +case 2: +YY_RULE_SETUP +/* whitespaces */ + YY_BREAK +case 3: +/* rule 3 can match eol */ +YY_RULE_SETUP +/* escaped new line */ + YY_BREAK +case 4: +/* rule 4 can match eol */ +YY_RULE_SETUP +return T_EOL; + YY_BREAK +case 5: +YY_RULE_SETUP +return T_BOOL; + YY_BREAK +case 6: +YY_RULE_SETUP +return T_CHOICE; + YY_BREAK +case 7: +YY_RULE_SETUP +return T_COMMENT; + YY_BREAK +case 8: +YY_RULE_SETUP +return T_CONFIG; + YY_BREAK +case 9: +YY_RULE_SETUP +return T_DEF_BOOL; + YY_BREAK +case 10: +YY_RULE_SETUP +return T_DEF_TRISTATE; + YY_BREAK +case 11: +YY_RULE_SETUP +return T_DEFAULT; + YY_BREAK +case 12: +YY_RULE_SETUP +return T_DEPENDS; + YY_BREAK +case 13: +YY_RULE_SETUP +return T_ENDCHOICE; + YY_BREAK +case 14: +YY_RULE_SETUP +return T_ENDIF; + YY_BREAK +case 15: +YY_RULE_SETUP +return T_ENDMENU; + YY_BREAK +case 16: +YY_RULE_SETUP +return T_HELP; + YY_BREAK +case 17: +YY_RULE_SETUP +return T_HEX; + YY_BREAK +case 18: +YY_RULE_SETUP +return T_IF; + YY_BREAK +case 19: +YY_RULE_SETUP +return T_IMPLY; + YY_BREAK +case 20: +YY_RULE_SETUP +return T_INT; + YY_BREAK +case 21: +YY_RULE_SETUP +return T_MAINMENU; + YY_BREAK +case 22: +YY_RULE_SETUP +return T_MENU; + YY_BREAK +case 23: +YY_RULE_SETUP +return T_MENUCONFIG; + YY_BREAK +case 24: +YY_RULE_SETUP +return T_MODULES; + YY_BREAK +case 25: +YY_RULE_SETUP +return T_ON; + YY_BREAK +case 26: +YY_RULE_SETUP +return T_OPTIONAL; + YY_BREAK +case 27: +YY_RULE_SETUP +return T_PROMPT; + YY_BREAK +case 28: +YY_RULE_SETUP +return T_RANGE; + YY_BREAK +case 29: +YY_RULE_SETUP +return T_SELECT; + YY_BREAK +case 30: +YY_RULE_SETUP +return T_SOURCE; + YY_BREAK +case 31: +YY_RULE_SETUP +return T_STRING; + YY_BREAK +case 32: +YY_RULE_SETUP +return T_TRISTATE; + YY_BREAK +case 33: +YY_RULE_SETUP +return T_VISIBLE; + YY_BREAK +case 34: +YY_RULE_SETUP +return T_OR; + YY_BREAK +case 35: +YY_RULE_SETUP +return T_AND; + YY_BREAK +case 36: +YY_RULE_SETUP +return T_EQUAL; + YY_BREAK +case 37: +YY_RULE_SETUP +return T_UNEQUAL; + YY_BREAK +case 38: +YY_RULE_SETUP +return T_LESS; + YY_BREAK +case 39: +YY_RULE_SETUP +return T_LESS_EQUAL; + YY_BREAK +case 40: +YY_RULE_SETUP +return T_GREATER; + YY_BREAK +case 41: +YY_RULE_SETUP +return T_GREATER_EQUAL; + YY_BREAK +case 42: +YY_RULE_SETUP +return T_NOT; + YY_BREAK +case 43: +YY_RULE_SETUP +return T_OPEN_PAREN; + YY_BREAK +case 44: +YY_RULE_SETUP +return T_CLOSE_PAREN; + YY_BREAK +case 45: +YY_RULE_SETUP +return T_COLON_EQUAL; + YY_BREAK +case 46: +YY_RULE_SETUP +return T_PLUS_EQUAL; + YY_BREAK +case 47: +YY_RULE_SETUP +{ + open_quote = yytext[0]; + new_string(); + BEGIN(STRING); + } + YY_BREAK +case 48: +YY_RULE_SETUP +{ + alloc_string(yytext, yyleng); + yylval.string = text; + return T_WORD; + } + YY_BREAK +case 49: +YY_RULE_SETUP +{ + /* this token includes at least one '$' */ + yylval.string = expand_token(yytext, yyleng); + if (strlen(yylval.string)) + return T_WORD; + free(yylval.string); + } + YY_BREAK +case 50: +YY_RULE_SETUP +warn_ignored_character(*yytext); + YY_BREAK + +case 51: +YY_RULE_SETUP +{ + alloc_string(yytext, yyleng); + yylval.string = text; + return T_ASSIGN_VAL; + } + YY_BREAK +case 52: +/* rule 52 can match eol */ +YY_RULE_SETUP +{ BEGIN(INITIAL); return T_EOL; } + YY_BREAK +case 53: +YY_RULE_SETUP + + YY_BREAK + +case 54: +YY_RULE_SETUP +append_expanded_string(yytext); + YY_BREAK +case 55: +YY_RULE_SETUP +{ + append_string(yytext, yyleng); + } + YY_BREAK +case 56: +YY_RULE_SETUP +{ + append_string(yytext + 1, yyleng - 1); + } + YY_BREAK +case 57: +YY_RULE_SETUP +{ + if (open_quote == yytext[0]) { + BEGIN(INITIAL); + yylval.string = text; + return T_WORD_QUOTE; + } else + append_string(yytext, 1); + } + YY_BREAK +case 58: +/* rule 58 can match eol */ +YY_RULE_SETUP +{ + fprintf(stderr, + "%s:%d:warning: multi-line strings not supported\n", + cur_filename, cur_lineno); + unput('\n'); + BEGIN(INITIAL); + yylval.string = text; + return T_WORD_QUOTE; + } + YY_BREAK +case YY_STATE_EOF(STRING): +{ + BEGIN(INITIAL); + yylval.string = text; + return T_WORD_QUOTE; + } + YY_BREAK + +case 59: +YY_RULE_SETUP +{ + int ts, i; + + ts = 0; + for (i = 0; i < yyleng; i++) { + if (yytext[i] == '\t') + ts = (ts & ~7) + 8; + else + ts++; + } + last_ts = ts; + if (first_ts) { + if (ts < first_ts) { + zconf_endhelp(); + return T_HELPTEXT; + } + ts -= first_ts; + while (ts > 8) { + append_string(" ", 8); + ts -= 8; + } + append_string(" ", ts); + } + } + YY_BREAK +case 60: +/* rule 60 can match eol */ +*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ +YY_LINENO_REWIND_TO(yy_cp - 1); +(yy_c_buf_p) = yy_cp -= 1; +YY_DO_BEFORE_ACTION; /* set up yytext again */ +YY_RULE_SETUP +{ + zconf_endhelp(); + return T_HELPTEXT; + } + YY_BREAK +case 61: +/* rule 61 can match eol */ +YY_RULE_SETUP +{ + append_string("\n", 1); + } + YY_BREAK +case 62: +YY_RULE_SETUP +{ + while (yyleng) { + if ((yytext[yyleng-1] != ' ') && (yytext[yyleng-1] != '\t')) + break; + yyleng--; + } + append_string(yytext, yyleng); + if (!first_ts) + first_ts = last_ts; + } + YY_BREAK +case YY_STATE_EOF(HELP): +{ + zconf_endhelp(); + return T_HELPTEXT; + } + YY_BREAK + +case YY_STATE_EOF(INITIAL): +case YY_STATE_EOF(ASSIGN_VAL): +{ + BEGIN(INITIAL); + + if (prev_token != T_EOL && prev_token != T_HELPTEXT) + fprintf(stderr, "%s:%d:warning: no new line at end of file\n", + cur_filename, yylineno); + + if (current_buf) { + zconf_endfile(); + return T_EOL; + } + fclose(yyin); + yyterminate(); +} + YY_BREAK +case 63: +YY_RULE_SETUP +YY_FATAL_ERROR( "flex scanner jammed" ); + YY_BREAK + + case YY_END_OF_BUFFER: + { + /* Amount of text matched not including the EOB char. */ + int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; + + /* Undo the effects of YY_DO_BEFORE_ACTION. */ + *yy_cp = (yy_hold_char); + YY_RESTORE_YY_MORE_OFFSET + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) + { + /* We're scanning a new file or input source. It's + * possible that this happened because the user + * just pointed yyin at a new source and called + * yylex(). If so, then we have to assure + * consistency between YY_CURRENT_BUFFER and our + * globals. Here is the right place to do so, because + * this is the first action (other than possibly a + * back-up) that will match for the new input source. + */ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; + } + + /* Note that here we test for yy_c_buf_p "<=" to the position + * of the first EOB in the buffer, since yy_c_buf_p will + * already have been incremented past the NUL character + * (since all states make transitions on EOB to the + * end-of-buffer state). Contrast this with the test + * in input(). + */ + if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + { /* This was really a NUL. */ + yy_state_type yy_next_state; + + (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + /* Okay, we're now positioned to make the NUL + * transition. We couldn't have + * yy_get_previous_state() go ahead and do it + * for us because it doesn't know how to deal + * with the possibility of jamming (and we don't + * want to build jamming into it because then it + * will run more slowly). + */ + + yy_next_state = yy_try_NUL_trans( yy_current_state ); + + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + + if ( yy_next_state ) + { + /* Consume the NUL. */ + yy_cp = ++(yy_c_buf_p); + yy_current_state = yy_next_state; + goto yy_match; + } + + else + { + yy_cp = (yy_c_buf_p); + goto yy_find_action; + } + } + + else switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_END_OF_FILE: + { + (yy_did_buffer_switch_on_eof) = 0; + + if ( yywrap( ) ) + { + /* Note: because we've taken care in + * yy_get_next_buffer() to have set up + * yytext, we can now set up + * yy_c_buf_p so that if some total + * hoser (like flex itself) wants to + * call the scanner after we return the + * YY_NULL, it'll still work - another + * YY_NULL will get returned. + */ + (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; + + yy_act = YY_STATE_EOF(YY_START); + goto do_action; + } + + else + { + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; + } + break; + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = + (yytext_ptr) + yy_amount_of_matched_text; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_match; + + case EOB_ACT_LAST_MATCH: + (yy_c_buf_p) = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; + + yy_current_state = yy_get_previous_state( ); + + yy_cp = (yy_c_buf_p); + yy_bp = (yytext_ptr) + YY_MORE_ADJ; + goto yy_find_action; + } + break; + } + + default: + YY_FATAL_ERROR( + "fatal flex scanner internal error--no action found" ); + } /* end of action switch */ + } /* end of scanning one token */ + } /* end of user's declarations */ +} /* end of yylex */ + +/* yy_get_next_buffer - try to read in a new buffer + * + * Returns a code representing an action: + * EOB_ACT_LAST_MATCH - + * EOB_ACT_CONTINUE_SCAN - continue scanning from current position + * EOB_ACT_END_OF_FILE - end of file + */ +static int yy_get_next_buffer (void) +{ + char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; + char *source = (yytext_ptr); + int number_to_move, i; + int ret_val; + + if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) + YY_FATAL_ERROR( + "fatal flex scanner internal error--end of buffer missed" ); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) + { /* Don't try to fill the buffer, so this is an EOF. */ + if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) + { + /* We matched a single character, the EOB, so + * treat this as a final EOF. + */ + return EOB_ACT_END_OF_FILE; + } + + else + { + /* We matched some text prior to the EOB, first + * process it. + */ + return EOB_ACT_LAST_MATCH; + } + } + + /* Try to read more data. */ + + /* First move last chars to start of buffer. */ + number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); + + for ( i = 0; i < number_to_move; ++i ) + *(dest++) = *(source++); + + if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) + /* don't do the read, it's not guaranteed to return an EOF, + * just force an EOF + */ + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; + + else + { + int num_to_read = + YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; + + while ( num_to_read <= 0 ) + { /* Not enough room in the buffer - grow it. */ + + /* just a shorter name for the current buffer */ + YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; + + int yy_c_buf_p_offset = + (int) ((yy_c_buf_p) - b->yy_ch_buf); + + if ( b->yy_is_our_buffer ) + { + int new_size = b->yy_buf_size * 2; + + if ( new_size <= 0 ) + b->yy_buf_size += b->yy_buf_size / 8; + else + b->yy_buf_size *= 2; + + b->yy_ch_buf = (char *) + /* Include room in for 2 EOB chars. */ + yyrealloc( (void *) b->yy_ch_buf, + (yy_size_t) (b->yy_buf_size + 2) ); + } + else + /* Can't grow it, we don't own it. */ + b->yy_ch_buf = NULL; + + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( + "fatal error - scanner input buffer overflow" ); + + (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; + + num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - + number_to_move - 1; + + } + + if ( num_to_read > YY_READ_BUF_SIZE ) + num_to_read = YY_READ_BUF_SIZE; + + /* Read in more data. */ + YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), + (yy_n_chars), num_to_read ); + + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + if ( (yy_n_chars) == 0 ) + { + if ( number_to_move == YY_MORE_ADJ ) + { + ret_val = EOB_ACT_END_OF_FILE; + yyrestart( yyin ); + } + + else + { + ret_val = EOB_ACT_LAST_MATCH; + YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = + YY_BUFFER_EOF_PENDING; + } + } + + else + ret_val = EOB_ACT_CONTINUE_SCAN; + + if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + /* Extend the array by 50%, plus the number we really need. */ + int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( + (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); + if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); + /* "- 2" to take care of EOB's */ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); + } + + (yy_n_chars) += number_to_move; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; + + (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; + + return ret_val; +} + +/* yy_get_previous_state - get the state just before the EOB char was reached */ + + static yy_state_type yy_get_previous_state (void) +{ + yy_state_type yy_current_state; + char *yy_cp; + + yy_current_state = (yy_start); + + for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) + { + yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)]; + } + + return yy_current_state; +} + +/* yy_try_NUL_trans - try to make a transition on the NUL character + * + * synopsis + * next_state = yy_try_NUL_trans( current_state ); + */ + static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) +{ + int yy_is_jam; + + yy_current_state = yy_nxt[yy_current_state][1]; + yy_is_jam = (yy_current_state <= 0); + + return yy_is_jam ? 0 : yy_current_state; +} + +#ifndef YY_NO_UNPUT + + static void yyunput (int c, char * yy_bp ) +{ + char *yy_cp; + + yy_cp = (yy_c_buf_p); + + /* undo effects of setting up yytext */ + *yy_cp = (yy_hold_char); + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + { /* need to shift things up to make room */ + /* +2 for EOB chars. */ + int number_to_move = (yy_n_chars) + 2; + char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ + YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; + char *source = + &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; + + while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) + *--dest = *--source; + + yy_cp += (int) (dest - source); + yy_bp += (int) (dest - source); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = + (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + + if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) + YY_FATAL_ERROR( "flex scanner push-back overflow" ); + } + + *--yy_cp = (char) c; + + if ( c == '\n' ){ + --yylineno; + } + + (yytext_ptr) = yy_bp; + (yy_hold_char) = *yy_cp; + (yy_c_buf_p) = yy_cp; +} + +#endif + +#ifndef YY_NO_INPUT +#ifdef __cplusplus + static int yyinput (void) +#else + static int input (void) +#endif + +{ + int c; + + *(yy_c_buf_p) = (yy_hold_char); + + if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) + { + /* yy_c_buf_p now points to the character we want to return. + * If this occurs *before* the EOB characters, then it's a + * valid NUL; if not, then we've hit the end of the buffer. + */ + if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) + /* This was really a NUL. */ + *(yy_c_buf_p) = '\0'; + + else + { /* need more input */ + int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); + ++(yy_c_buf_p); + + switch ( yy_get_next_buffer( ) ) + { + case EOB_ACT_LAST_MATCH: + /* This happens because yy_g_n_b() + * sees that we've accumulated a + * token and flags that we need to + * try matching the token before + * proceeding. But for input(), + * there's no matching to consider. + * So convert the EOB_ACT_LAST_MATCH + * to EOB_ACT_END_OF_FILE. + */ + + /* Reset buffer status. */ + yyrestart( yyin ); + + /*FALLTHROUGH*/ + + case EOB_ACT_END_OF_FILE: + { + if ( yywrap( ) ) + return 0; + + if ( ! (yy_did_buffer_switch_on_eof) ) + YY_NEW_FILE; +#ifdef __cplusplus + return yyinput(); +#else + return input(); +#endif + } + + case EOB_ACT_CONTINUE_SCAN: + (yy_c_buf_p) = (yytext_ptr) + offset; + break; + } + } + } + + c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ + *(yy_c_buf_p) = '\0'; /* preserve yytext */ + (yy_hold_char) = *++(yy_c_buf_p); + + if ( c == '\n' ) + + yylineno++; +; + + return c; +} +#endif /* ifndef YY_NO_INPUT */ + +/** Immediately switch to a different input stream. + * @param input_file A readable stream. + * + * @note This function does not reset the start condition to @c INITIAL . + */ + void yyrestart (FILE * input_file ) +{ + + if ( ! YY_CURRENT_BUFFER ){ + yyensure_buffer_stack (); + YY_CURRENT_BUFFER_LVALUE = + yy_create_buffer( yyin, YY_BUF_SIZE ); + } + + yy_init_buffer( YY_CURRENT_BUFFER, input_file ); + yy_load_buffer_state( ); +} + +/** Switch to a different input buffer. + * @param new_buffer The new input buffer. + * + */ + void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) +{ + + /* TODO. We should be able to replace this entire function body + * with + * yypop_buffer_state(); + * yypush_buffer_state(new_buffer); + */ + yyensure_buffer_stack (); + if ( YY_CURRENT_BUFFER == new_buffer ) + return; + + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + YY_CURRENT_BUFFER_LVALUE = new_buffer; + yy_load_buffer_state( ); + + /* We don't actually know whether we did this switch during + * EOF (yywrap()) processing, but the only time this flag + * is looked at is after yywrap() is called, so it's safe + * to go ahead and always set it. + */ + (yy_did_buffer_switch_on_eof) = 1; +} + +static void yy_load_buffer_state (void) +{ + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; + (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; + yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + (yy_hold_char) = *(yy_c_buf_p); +} + +/** Allocate and initialize an input buffer state. + * @param file A readable stream. + * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + * + * @return the allocated buffer state. + */ + YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) +{ + YY_BUFFER_STATE b; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_buf_size = size; + + /* yy_ch_buf has to be 2 characters longer than the size given because + * we need to put in 2 end-of-buffer characters. + */ + b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); + if ( ! b->yy_ch_buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + + b->yy_is_our_buffer = 1; + + yy_init_buffer( b, file ); + + return b; +} + +/** Destroy the buffer. + * @param b a buffer created with yy_create_buffer() + * + */ + void yy_delete_buffer (YY_BUFFER_STATE b ) +{ + + if ( ! b ) + return; + + if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ + YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; + + if ( b->yy_is_our_buffer ) + yyfree( (void *) b->yy_ch_buf ); + + yyfree( (void *) b ); +} + +/* Initializes or reinitializes a buffer. + * This function is sometimes called more than once on the same buffer, + * such as during a yyrestart() or at EOF. + */ + static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + +{ + int oerrno = errno; + + yy_flush_buffer( b ); + + b->yy_input_file = file; + b->yy_fill_buffer = 1; + + /* If b is the current buffer, then yy_init_buffer was _probably_ + * called from yyrestart() or through yy_get_next_buffer. + * In that case, we don't want to reset the lineno or column. + */ + if (b != YY_CURRENT_BUFFER){ + b->yy_bs_lineno = 1; + b->yy_bs_column = 0; + } + + b->yy_is_interactive = 0; + + errno = oerrno; +} + +/** Discard all buffered characters. On the next scan, YY_INPUT will be called. + * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + * + */ + void yy_flush_buffer (YY_BUFFER_STATE b ) +{ + if ( ! b ) + return; + + b->yy_n_chars = 0; + + /* We always need two end-of-buffer characters. The first causes + * a transition to the end-of-buffer state. The second causes + * a jam in that state. + */ + b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; + b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; + + b->yy_buf_pos = &b->yy_ch_buf[0]; + + b->yy_at_bol = 1; + b->yy_buffer_status = YY_BUFFER_NEW; + + if ( b == YY_CURRENT_BUFFER ) + yy_load_buffer_state( ); +} + +/** Pushes the new state onto the stack. The new state becomes + * the current state. This function will allocate the stack + * if necessary. + * @param new_buffer The new state. + * + */ +void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +{ + if (new_buffer == NULL) + return; + + yyensure_buffer_stack(); + + /* This block is copied from yy_switch_to_buffer. */ + if ( YY_CURRENT_BUFFER ) + { + /* Flush out information for old buffer. */ + *(yy_c_buf_p) = (yy_hold_char); + YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); + YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); + } + + /* Only push if top exists. Otherwise, replace top. */ + if (YY_CURRENT_BUFFER) + (yy_buffer_stack_top)++; + YY_CURRENT_BUFFER_LVALUE = new_buffer; + + /* copied from yy_switch_to_buffer. */ + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; +} + +/** Removes and deletes the top of the stack, if present. + * The next element becomes the new top. + * + */ +void yypop_buffer_state (void) +{ + if (!YY_CURRENT_BUFFER) + return; + + yy_delete_buffer(YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + if ((yy_buffer_stack_top) > 0) + --(yy_buffer_stack_top); + + if (YY_CURRENT_BUFFER) { + yy_load_buffer_state( ); + (yy_did_buffer_switch_on_eof) = 1; + } +} + +/* Allocates the stack if it does not exist. + * Guarantees space for at least one push. + */ +static void yyensure_buffer_stack (void) +{ + yy_size_t num_to_alloc; + + if (!(yy_buffer_stack)) { + + /* First allocation is just for 2 elements, since we don't know if this + * scanner will even need a stack. We use 2 instead of 1 to avoid an + * immediate realloc on the next call. + */ + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + (num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); + + (yy_buffer_stack_max) = num_to_alloc; + (yy_buffer_stack_top) = 0; + return; + } + + if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ + + /* Increase the buffer to prepare for a possible push. */ + yy_size_t grow_size = 8 /* arbitrary grow size */; + + num_to_alloc = (yy_buffer_stack_max) + grow_size; + (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + ((yy_buffer_stack), + num_to_alloc * sizeof(struct yy_buffer_state*) + ); + if ( ! (yy_buffer_stack) ) + YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + + /* zero only the new slots.*/ + memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); + (yy_buffer_stack_max) = num_to_alloc; + } +} + +/** Setup the input buffer state to scan directly from a user-specified character buffer. + * @param base the character buffer + * @param size the size in bytes of the character buffer + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +{ + YY_BUFFER_STATE b; + + if ( size < 2 || + base[size-2] != YY_END_OF_BUFFER_CHAR || + base[size-1] != YY_END_OF_BUFFER_CHAR ) + /* They forgot to leave room for the EOB's. */ + return NULL; + + b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + if ( ! b ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + + b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ + b->yy_buf_pos = b->yy_ch_buf = base; + b->yy_is_our_buffer = 0; + b->yy_input_file = NULL; + b->yy_n_chars = b->yy_buf_size; + b->yy_is_interactive = 0; + b->yy_at_bol = 1; + b->yy_fill_buffer = 0; + b->yy_buffer_status = YY_BUFFER_NEW; + + yy_switch_to_buffer( b ); + + return b; +} + +/** Setup the input buffer state to scan a string. The next call to yylex() will + * scan from a @e copy of @a str. + * @param yystr a NUL-terminated string to scan + * + * @return the newly allocated buffer state object. + * @note If you want to scan bytes that may contain NUL values, then use + * yy_scan_bytes() instead. + */ +YY_BUFFER_STATE yy_scan_string (const char * yystr ) +{ + + return yy_scan_bytes( yystr, (int) strlen(yystr) ); +} + +/** Setup the input buffer state to scan the given bytes. The next call to yylex() will + * scan from a @e copy of @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * + * @return the newly allocated buffer state object. + */ +YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) +{ + YY_BUFFER_STATE b; + char *buf; + yy_size_t n; + int i; + + /* Get memory for full buffer, including space for trailing EOB's. */ + n = (yy_size_t) (_yybytes_len + 2); + buf = (char *) yyalloc( n ); + if ( ! buf ) + YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + + for ( i = 0; i < _yybytes_len; ++i ) + buf[i] = yybytes[i]; + + buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + + b = yy_scan_buffer( buf, n ); + if ( ! b ) + YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + + /* It's okay to grow etc. this buffer, and we should throw it + * away when we're done. + */ + b->yy_is_our_buffer = 1; + + return b; +} + +#ifndef YY_EXIT_FAILURE +#define YY_EXIT_FAILURE 2 +#endif + +static void yynoreturn yy_fatal_error (const char* msg ) +{ + fprintf( stderr, "%s\n", msg ); + exit( YY_EXIT_FAILURE ); +} + +/* Redefine yyless() so it works in section 3 code. */ + +#undef yyless +#define yyless(n) \ + do \ + { \ + /* Undo effects of setting up yytext. */ \ + int yyless_macro_arg = (n); \ + YY_LESS_LINENO(yyless_macro_arg);\ + yytext[yyleng] = (yy_hold_char); \ + (yy_c_buf_p) = yytext + yyless_macro_arg; \ + (yy_hold_char) = *(yy_c_buf_p); \ + *(yy_c_buf_p) = '\0'; \ + yyleng = yyless_macro_arg; \ + } \ + while ( 0 ) + +/* Accessor methods (get/set functions) to struct members. */ + +/** Get the current line number. + * + */ +int yyget_lineno (void) +{ + + return yylineno; +} + +/** Get the input stream. + * + */ +FILE *yyget_in (void) +{ + return yyin; +} + +/** Get the output stream. + * + */ +FILE *yyget_out (void) +{ + return yyout; +} + +/** Get the length of the current token. + * + */ +int yyget_leng (void) +{ + return yyleng; +} + +/** Get the current token. + * + */ + +char *yyget_text (void) +{ + return yytext; +} + +/** Set the current line number. + * @param _line_number line number + * + */ +void yyset_lineno (int _line_number ) +{ + + yylineno = _line_number; +} + +/** Set the input stream. This does not discard the current + * input buffer. + * @param _in_str A readable stream. + * + * @see yy_switch_to_buffer + */ +void yyset_in (FILE * _in_str ) +{ + yyin = _in_str ; +} + +void yyset_out (FILE * _out_str ) +{ + yyout = _out_str ; +} + +int yyget_debug (void) +{ + return yy_flex_debug; +} + +void yyset_debug (int _bdebug ) +{ + yy_flex_debug = _bdebug ; +} + +static int yy_init_globals (void) +{ + /* Initialization is the same as for the non-reentrant scanner. + * This function is called from yylex_destroy(), so don't allocate here. + */ + + /* We do not touch yylineno unless the option is enabled. */ + yylineno = 1; + + (yy_buffer_stack) = NULL; + (yy_buffer_stack_top) = 0; + (yy_buffer_stack_max) = 0; + (yy_c_buf_p) = NULL; + (yy_init) = 0; + (yy_start) = 0; + +/* Defined in main.c */ +#ifdef YY_STDINIT + yyin = stdin; + yyout = stdout; +#else + yyin = NULL; + yyout = NULL; +#endif + + /* For future reference: Set errno on error, since we are called by + * yylex_init() + */ + return 0; +} + +/* yylex_destroy is for both reentrant and non-reentrant scanners. */ +int yylex_destroy (void) +{ + + /* Pop the buffer stack, destroying each element. */ + while(YY_CURRENT_BUFFER){ + yy_delete_buffer( YY_CURRENT_BUFFER ); + YY_CURRENT_BUFFER_LVALUE = NULL; + yypop_buffer_state(); + } + + /* Destroy the stack itself. */ + yyfree((yy_buffer_stack) ); + (yy_buffer_stack) = NULL; + + /* Reset the globals. This is important in a non-reentrant scanner so the next time + * yylex() is called, initialization will occur. */ + yy_init_globals( ); + + return 0; +} + +/* + * Internal utility routines. + */ + +#ifndef yytext_ptr +static void yy_flex_strncpy (char* s1, const char * s2, int n ) +{ + + int i; + for ( i = 0; i < n; ++i ) + s1[i] = s2[i]; +} +#endif + +#ifdef YY_NEED_STRLEN +static int yy_flex_strlen (const char * s ) +{ + int n; + for ( n = 0; s[n]; ++n ) + ; + + return n; +} +#endif + +void *yyalloc (yy_size_t size ) +{ + return malloc(size); +} + +void *yyrealloc (void * ptr, yy_size_t size ) +{ + + /* The cast to (char *) in the following accommodates both + * implementations that use char* generic pointers, and those + * that use void* generic pointers. It works with the latter + * because both ANSI C and C++ allow castless assignment from + * any pointer type to void*, and deal with argument conversions + * as though doing an assignment. + */ + return realloc(ptr, size); +} + +void yyfree (void * ptr ) +{ + free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ +} + +#define YYTABLES_NAME "yytables" + +/* second stage lexer */ +int yylex(void) +{ + int token; + +repeat: + token = yylex1(); + + if (prev_token == T_EOL || prev_token == T_HELPTEXT) { + if (token == T_EOL) + /* Do not pass unneeded T_EOL to the parser. */ + goto repeat; + else + /* + * For the parser, update lineno at the first token + * of each statement. Generally, \n is a statement + * terminator in Kconfig, but it is not always true + * because \n could be escaped by a backslash. + */ + cur_lineno = yylineno; + } + + if (prev_prev_token == T_EOL && prev_token == T_WORD && + (token == T_EQUAL || token == T_COLON_EQUAL || token == T_PLUS_EQUAL)) + BEGIN(ASSIGN_VAL); + + prev_prev_token = prev_token; + prev_token = token; + + return token; +} + +static char *expand_token(const char *in, size_t n) +{ + char *out; + int c; + char c2; + const char *rest, *end; + + new_string(); + append_string(in, n); + + /* + * get the whole line because we do not know the end of token. + * input() returns 0 (not EOF!) when it reachs the end of file. + */ + while ((c = input()) != 0) { + if (c == '\n') { + unput(c); + break; + } + c2 = c; + append_string(&c2, 1); + } + + rest = text; + out = expand_one_token(&rest); + + /* push back unused characters to the input stream */ + end = rest + strlen(rest); + while (end > rest) + unput(*--end); + + free(text); + + return out; +} + +static void append_expanded_string(const char *str) +{ + const char *end; + char *res; + + str++; + + res = expand_dollar(&str); + + /* push back unused characters to the input stream */ + end = str + strlen(str); + while (end > str) + unput(*--end); + + append_string(res, strlen(res)); + + free(res); +} + +void zconf_starthelp(void) +{ + new_string(); + last_ts = first_ts = 0; + BEGIN(HELP); +} + +static void zconf_endhelp(void) +{ + yylval.string = text; + BEGIN(INITIAL); +} + +/* + * Try to open specified file with following names: + * ./name + * $(srctree)/name + * The latter is used when srctree is separate from objtree + * when compiling the kernel. + * Return NULL if file is not found. + */ +FILE *zconf_fopen(const char *name) +{ + char *env, fullname[PATH_MAX+1]; + FILE *f; + + f = fopen(name, "r"); + if (!f && name != NULL && name[0] != '/') { + env = getenv(SRCTREE); + if (env) { + snprintf(fullname, sizeof(fullname), + "%s/%s", env, name); + f = fopen(fullname, "r"); + } + } + return f; +} + +void zconf_initscan(const char *name) +{ + yyin = zconf_fopen(name); + if (!yyin) { + fprintf(stderr, "can't find file %s\n", name); + exit(1); + } + + cur_filename = file_lookup(name); + yylineno = 1; +} + +void zconf_nextfile(const char *name) +{ + struct buffer *buf = xmalloc(sizeof(*buf)); + bool recur_include = false; + + buf->state = YY_CURRENT_BUFFER; + buf->yylineno = yylineno; + buf->filename = cur_filename; + buf->source_lineno = cur_lineno; + buf->parent = current_buf; + current_buf = buf; + yyin = zconf_fopen(name); + if (!yyin) { + fprintf(stderr, "%s:%d: can't open file \"%s\"\n", + cur_filename, cur_lineno, name); + exit(1); + } + yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); + + for (buf = current_buf; buf; buf = buf->parent) { + if (!strcmp(buf->filename, name)) + recur_include = true; + } + + if (recur_include) { + fprintf(stderr, + "Recursive inclusion detected.\n" + "Inclusion path:\n" + " current file : %s\n", name); + + for (buf = current_buf; buf; buf = buf->parent) + fprintf(stderr, " included from: %s:%d\n", + buf->filename, buf->source_lineno); + exit(1); + } + + yylineno = 1; + cur_filename = file_lookup(name); +} + +static void zconf_endfile(void) +{ + struct buffer *tmp; + + fclose(yyin); + yy_delete_buffer(YY_CURRENT_BUFFER); + yy_switch_to_buffer(current_buf->state); + yylineno = current_buf->yylineno; + cur_filename = current_buf->filename; + tmp = current_buf; + current_buf = current_buf->parent; + free(tmp); +} + diff --git a/support/kconfig/list.h b/support/kconfig/list.h index 45cb237ab7..882859ddf9 100644 --- a/support/kconfig/list.h +++ b/support/kconfig/list.h @@ -2,29 +2,39 @@ #ifndef LIST_H #define LIST_H -/* - * Copied from include/linux/... - */ +#include -#undef offsetof -#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER) +#include "list_types.h" + +/* Are two types/vars the same type (ignoring qualifiers)? */ +#define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) /** * container_of - cast a member of a structure out to the containing structure - * @ptr: the pointer to the member. - * @type: the type of the container struct this is embedded in. - * @member: the name of the member within the struct. + * @ptr: the pointer to the member. + * @type: the type of the container struct this is embedded in. + * @member: the name of the member within the struct. * */ -#define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) - +#define container_of(ptr, type, member) ({ \ + void *__mptr = (void *)(ptr); \ + _Static_assert(__same_type(*(ptr), ((type *)0)->member) || \ + __same_type(*(ptr), void), \ + "pointer type mismatch in container_of()"); \ + ((type *)(__mptr - offsetof(type, member))); }) -struct list_head { - struct list_head *next, *prev; -}; +#define LIST_POISON1 ((void *) 0x100) +#define LIST_POISON2 ((void *) 0x122) +/* + * Circular doubly linked list implementation. + * + * Some of the internal functions ("__xxx") are useful when + * manipulating whole lists rather than single entries, as + * sometimes we already know the next/prev entries and we can + * generate better code by using them directly rather than + * using the generic single-entry routines. + */ #define LIST_HEAD_INIT(name) { &(name), &(name) } @@ -32,45 +42,16 @@ struct list_head { struct list_head name = LIST_HEAD_INIT(name) /** - * list_entry - get the struct for this entry - * @ptr: the &struct list_head pointer. - * @type: the type of the struct this is embedded in. - * @member: the name of the list_head within the struct. - */ -#define list_entry(ptr, type, member) \ - container_of(ptr, type, member) - -/** - * list_for_each_entry - iterate over list of given type - * @pos: the type * to use as a loop cursor. - * @head: the head for your list. - * @member: the name of the list_head within the struct. - */ -#define list_for_each_entry(pos, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = list_entry(pos->member.next, typeof(*pos), member)) - -/** - * list_for_each_entry_safe - iterate over list of given type safe against removal of list entry - * @pos: the type * to use as a loop cursor. - * @n: another type * to use as temporary storage - * @head: the head for your list. - * @member: the name of the list_head within the struct. - */ -#define list_for_each_entry_safe(pos, n, head, member) \ - for (pos = list_entry((head)->next, typeof(*pos), member), \ - n = list_entry(pos->member.next, typeof(*pos), member); \ - &pos->member != (head); \ - pos = n, n = list_entry(n->member.next, typeof(*n), member)) - -/** - * list_empty - tests whether a list is empty - * @head: the list to test. + * INIT_LIST_HEAD - Initialize a list_head structure + * @list: list_head structure to be initialized. + * + * Initializes the list_head to point to itself. If it is a list header, + * the result is an empty list. */ -static inline int list_empty(const struct list_head *head) +static inline void INIT_LIST_HEAD(struct list_head *list) { - return head->next == head; + list->next = list; + list->prev = list; } /* @@ -79,14 +60,27 @@ static inline int list_empty(const struct list_head *head) * This is only for internal list manipulation where we know * the prev/next entries already! */ -static inline void __list_add(struct list_head *_new, +static inline void __list_add(struct list_head *new, struct list_head *prev, struct list_head *next) { - next->prev = _new; - _new->next = next; - _new->prev = prev; - prev->next = _new; + next->prev = new; + new->next = next; + new->prev = prev; + prev->next = new; +} + +/** + * list_add - add a new entry + * @new: new entry to be added + * @head: list head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +static inline void list_add(struct list_head *new, struct list_head *head) +{ + __list_add(new, head, head->next); } /** @@ -97,9 +91,9 @@ static inline void __list_add(struct list_head *_new, * Insert a new entry before the specified head. * This is useful for implementing queues. */ -static inline void list_add_tail(struct list_head *_new, struct list_head *head) +static inline void list_add_tail(struct list_head *new, struct list_head *head) { - __list_add(_new, head->prev, head); + __list_add(new, head->prev, head); } /* @@ -115,8 +109,11 @@ static inline void __list_del(struct list_head *prev, struct list_head *next) prev->next = next; } -#define LIST_POISON1 ((void *) 0x00100100) -#define LIST_POISON2 ((void *) 0x00200200) +static inline void __list_del_entry(struct list_head *entry) +{ + __list_del(entry->prev, entry->next); +} + /** * list_del - deletes entry from list. * @entry: the element to delete from the list. @@ -125,8 +122,135 @@ static inline void __list_del(struct list_head *prev, struct list_head *next) */ static inline void list_del(struct list_head *entry) { - __list_del(entry->prev, entry->next); - entry->next = (struct list_head*)LIST_POISON1; - entry->prev = (struct list_head*)LIST_POISON2; + __list_del_entry(entry); + entry->next = LIST_POISON1; + entry->prev = LIST_POISON2; +} + +/** + * list_is_head - tests whether @list is the list @head + * @list: the entry to test + * @head: the head of the list + */ +static inline int list_is_head(const struct list_head *list, const struct list_head *head) +{ + return list == head; +} + +/** + * list_empty - tests whether a list is empty + * @head: the list to test. + */ +static inline int list_empty(const struct list_head *head) +{ + return head->next == head; +} + +/** + * list_entry - get the struct for this entry + * @ptr: the &struct list_head pointer. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_head within the struct. + */ +#define list_entry(ptr, type, member) \ + container_of(ptr, type, member) + +/** + * list_first_entry - get the first element from a list + * @ptr: the list head to take the element from. + * @type: the type of the struct this is embedded in. + * @member: the name of the list_head within the struct. + * + * Note, that list is expected to be not empty. + */ +#define list_first_entry(ptr, type, member) \ + list_entry((ptr)->next, type, member) + +/** + * list_next_entry - get the next element in list + * @pos: the type * to cursor + * @member: the name of the list_head within the struct. + */ +#define list_next_entry(pos, member) \ + list_entry((pos)->member.next, typeof(*(pos)), member) + +/** + * list_entry_is_head - test if the entry points to the head of the list + * @pos: the type * to cursor + * @head: the head for your list. + * @member: the name of the list_head within the struct. + */ +#define list_entry_is_head(pos, head, member) \ + (&pos->member == (head)) + +/** + * list_for_each_entry - iterate over list of given type + * @pos: the type * to use as a loop cursor. + * @head: the head for your list. + * @member: the name of the list_head within the struct. + */ +#define list_for_each_entry(pos, head, member) \ + for (pos = list_first_entry(head, typeof(*pos), member); \ + !list_entry_is_head(pos, head, member); \ + pos = list_next_entry(pos, member)) + +/** + * list_for_each_entry_safe - iterate over list of given type. Safe against removal of list entry + * @pos: the type * to use as a loop cursor. + * @n: another type * to use as temporary storage + * @head: the head for your list. + * @member: the name of the list_head within the struct. + */ +#define list_for_each_entry_safe(pos, n, head, member) \ + for (pos = list_first_entry(head, typeof(*pos), member), \ + n = list_next_entry(pos, member); \ + !list_entry_is_head(pos, head, member); \ + pos = n, n = list_next_entry(n, member)) + +/* + * Double linked lists with a single pointer list head. + * Mostly useful for hash tables where the two pointer list head is + * too wasteful. + * You lose the ability to access the tail in O(1). + */ + +#define HLIST_HEAD_INIT { .first = NULL } + +/** + * hlist_add_head - add a new entry at the beginning of the hlist + * @n: new entry to be added + * @h: hlist head to add it after + * + * Insert a new entry after the specified head. + * This is good for implementing stacks. + */ +static inline void hlist_add_head(struct hlist_node *n, struct hlist_head *h) +{ + struct hlist_node *first = h->first; + + n->next = first; + if (first) + first->pprev = &n->next; + h->first = n; + n->pprev = &h->first; } -#endif + +#define hlist_entry(ptr, type, member) container_of(ptr, type, member) + +#define hlist_entry_safe(ptr, type, member) \ + ({ typeof(ptr) ____ptr = (ptr); \ + ____ptr ? hlist_entry(____ptr, type, member) : NULL; \ + }) + +/** + * hlist_for_each_entry - iterate over list of given type + * @pos: the type * to use as a loop cursor. + * @head: the head for your list. + * @member: the name of the hlist_node within the struct. + */ +#define hlist_for_each_entry(pos, head, member) \ + for (pos = hlist_entry_safe((head)->first, typeof(*(pos)), member);\ + pos; \ + pos = hlist_entry_safe((pos)->member.next, typeof(*(pos)), member)) + +#endif /* LIST_H */ diff --git a/support/kconfig/list_types.h b/support/kconfig/list_types.h new file mode 100644 index 0000000000..d935b7c5aa --- /dev/null +++ b/support/kconfig/list_types.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef LIST_TYPES_H +#define LIST_TYPES_H + +struct list_head { + struct list_head *next, *prev; +}; + +struct hlist_head { + struct hlist_node *first; +}; + +struct hlist_node { + struct hlist_node *next, **pprev; +}; + +#endif /* LIST_TYPES_H */ diff --git a/support/kconfig/lkc.h b/support/kconfig/lkc.h index f4394af6e4..e7cc9e985c 100644 --- a/support/kconfig/lkc.h +++ b/support/kconfig/lkc.h @@ -1,21 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (C) 2002 Roman Zippel - * Released under the terms of the GNU GPL v2.0. */ #ifndef LKC_H #define LKC_H -#include "expr.h" +#include +#include +#include -#ifndef KBUILD_NO_NLS -# include -#else -static inline const char *gettext(const char *txt) { return txt; } -static inline void textdomain(const char *domainname) {} -static inline void bindtextdomain(const char *name, const char *dir) {} -static inline char *bind_textdomain_codeset(const char *dn, char *c) { return c; } -#endif +#include "expr.h" #ifdef __cplusplus extern "C" { @@ -25,15 +20,6 @@ extern "C" { #define SRCTREE "srctree" -#ifndef PACKAGE -#define PACKAGE "linux" -#endif - -#define LOCALEDIR "/usr/share/locale" - -#define _(text) gettext(text) -#define N_(text) (text) - #ifndef CONFIG_ #define CONFIG_ "CONFIG_" #endif @@ -44,46 +30,16 @@ static inline const char *CONFIG_prefix(void) #undef CONFIG_ #define CONFIG_ CONFIG_prefix() -#define TF_COMMAND 0x0001 -#define TF_PARAM 0x0002 -#define TF_OPTION 0x0004 - -enum conf_def_mode { - def_default, - def_yes, - def_mod, - def_no, - def_random -}; - -#define T_OPT_MODULES 1 -#define T_OPT_DEFCONFIG_LIST 2 -#define T_OPT_ENV 3 -#define T_OPT_ALLNOCONFIG_Y 4 - -struct kconf_id { - const char *name; - int token; - unsigned int flags; - enum symbol_type stype; -}; - extern int yylineno; void zconfdump(FILE *out); void zconf_starthelp(void); FILE *zconf_fopen(const char *name); void zconf_initscan(const char *name); void zconf_nextfile(const char *name); -int zconf_lineno(void); -const char *zconf_curname(void); /* confdata.c */ +extern struct gstr autoconf_cmd; const char *conf_get_configname(void); -const char *conf_get_autoconfig_name(void); -char *conf_get_default_confname(void); -void sym_set_change_count(int count); -void sym_add_change_count(int count); -bool conf_set_all_new_symbols(enum conf_def_mode mode); void set_all_choice_values(struct symbol *csym); /* confdata.c and expr.c */ @@ -95,28 +51,17 @@ static inline void xfwrite(const void *str, size_t len, size_t count, FILE *out) fprintf(stderr, "Error in writing or end of file.\n"); } -/* menu.c */ -void _menu_init(void); -void menu_warn(struct menu *menu, const char *fmt, ...); -struct menu *menu_add_menu(void); -void menu_end_menu(void); -void menu_add_entry(struct symbol *sym); -void menu_add_dep(struct expr *dep); -void menu_add_visibility(struct expr *dep); -struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); -void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); -void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep); -void menu_add_option(int token, char *arg); -void menu_finalize(struct menu *parent); -void menu_set_type(int type); - /* util.c */ -struct file *file_lookup(const char *name); -int file_write_dep(const char *name); +unsigned int strhash(const char *s); +const char *file_lookup(const char *name); void *xmalloc(size_t size); void *xcalloc(size_t nmemb, size_t size); void *xrealloc(void *p, size_t size); char *xstrdup(const char *s); +char *xstrndup(const char *s, size_t n); + +/* lexer.l */ +int yylex(void); struct gstr { size_t len; @@ -131,19 +76,40 @@ struct gstr str_new(void); void str_free(struct gstr *gs); void str_append(struct gstr *gs, const char *s); void str_printf(struct gstr *gs, const char *fmt, ...); -const char *str_get(struct gstr *gs); +char *str_get(struct gstr *gs); -/* symbol.c */ -extern struct expr *sym_env_list; +/* menu.c */ +void _menu_init(void); +void menu_warn(struct menu *menu, const char *fmt, ...); +struct menu *menu_add_menu(void); +void menu_end_menu(void); +void menu_add_entry(struct symbol *sym); +void menu_add_dep(struct expr *dep); +void menu_add_visibility(struct expr *dep); +struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); +void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); +void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep); +void menu_finalize(void); +void menu_set_type(int type); + +extern struct menu rootmenu; -void sym_init(void); +bool menu_is_empty(struct menu *menu); +bool menu_is_visible(struct menu *menu); +bool menu_has_prompt(struct menu *menu); +const char *menu_get_prompt(struct menu *menu); +struct menu *menu_get_parent_menu(struct menu *menu); +int get_jump_key_char(void); +struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head); +void menu_get_ext_help(struct menu *menu, struct gstr *help); + +/* symbol.c */ void sym_clear_all_valid(void); struct symbol *sym_choice_default(struct symbol *sym); +struct property *sym_get_range_prop(struct symbol *sym); const char *sym_get_string_default(struct symbol *sym); struct symbol *sym_check_deps(struct symbol *sym); -struct property *prop_alloc(enum prop_type type, struct symbol *sym); struct symbol *prop_get_symbol(struct property *prop); -struct property *sym_get_env_prop(struct symbol *sym); static inline tristate sym_get_tristate_value(struct symbol *sym) { @@ -156,11 +122,6 @@ static inline struct symbol *sym_get_choice_value(struct symbol *sym) return (struct symbol *)sym->curr.val; } -static inline bool sym_set_choice_value(struct symbol *ch, struct symbol *chval) -{ - return sym_set_tristate_value(chval, yes); -} - static inline bool sym_is_choice(struct symbol *sym) { return sym->flags & SYMBOL_CHOICE ? true : false; diff --git a/support/kconfig/lkc_proto.h b/support/kconfig/lkc_proto.h index 9dc8abfb1d..2807fa584c 100644 --- a/support/kconfig/lkc_proto.h +++ b/support/kconfig/lkc_proto.h @@ -1,4 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0 */ +#ifndef LKC_PROTO_H +#define LKC_PROTO_H + #include /* confdata.c */ @@ -7,35 +10,21 @@ int conf_read(const char *name); int conf_read_simple(const char *name, int); int conf_write_defconfig(const char *name); int conf_write(const char *name); -int conf_write_autoconf(void); +int conf_write_autoconf(int overwrite); +void conf_set_changed(bool val); bool conf_get_changed(void); void conf_set_changed_callback(void (*fn)(void)); -void conf_set_message_callback(void (*fn)(const char *fmt, va_list ap)); - -/* menu.c */ -extern struct menu rootmenu; - -bool menu_is_empty(struct menu *menu); -bool menu_is_visible(struct menu *menu); -bool menu_has_prompt(struct menu *menu); -const char * menu_get_prompt(struct menu *menu); -struct menu * menu_get_root_menu(struct menu *menu); -struct menu * menu_get_parent_menu(struct menu *menu); -bool menu_has_help(struct menu *menu); -const char * menu_get_help(struct menu *menu); -struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head); -void menu_get_ext_help(struct menu *menu, struct gstr *help); +void conf_set_message_callback(void (*fn)(const char *s)); +bool conf_errors(void); /* symbol.c */ -extern struct symbol * symbol_hash[SYMBOL_HASHSIZE]; - struct symbol * sym_lookup(const char *name, int flags); struct symbol * sym_find(const char *name); -char *sym_expand_string_value(const char *in); -const char * sym_escape_string_value(const char *in); +void print_symbol_for_listconfig(struct symbol *sym); struct symbol ** sym_re_search(const char *pattern); const char * sym_type_name(enum symbol_type type); void sym_calc_value(struct symbol *sym); +bool sym_dep_errors(void); enum symbol_type sym_get_type(struct symbol *sym); bool sym_tristate_within_range(struct symbol *sym,tristate tri); bool sym_set_tristate_value(struct symbol *sym,tristate tri); @@ -43,7 +32,7 @@ tristate sym_toggle_tristate_value(struct symbol *sym); bool sym_string_valid(struct symbol *sym, const char *newval); bool sym_string_within_range(struct symbol *sym, const char *str); bool sym_set_string_value(struct symbol *sym, const char *newval); -bool sym_is_changable(struct symbol *sym); +bool sym_is_changeable(struct symbol *sym); struct property * sym_get_choice_prop(struct symbol *sym); const char * sym_get_string_value(struct symbol *sym); @@ -51,3 +40,5 @@ const char * prop_get_type_name(enum prop_type type); /* expr.c */ void expr_print(struct expr *e, void (*fn)(void *, struct symbol *, const char *), void *data, int prevtoken); + +#endif /* LKC_PROTO_H */ diff --git a/support/kconfig/lxdialog/.gitignore b/support/kconfig/lxdialog/.gitignore deleted file mode 100644 index 90b08ff025..0000000000 --- a/support/kconfig/lxdialog/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# -# Generated files -# -lxdialog diff --git a/support/kconfig/lxdialog/BIG.FAT.WARNING b/support/kconfig/lxdialog/BIG.FAT.WARNING index a8999d82bd..7cb5a7ec93 100644 --- a/support/kconfig/lxdialog/BIG.FAT.WARNING +++ b/support/kconfig/lxdialog/BIG.FAT.WARNING @@ -1,4 +1,4 @@ This is NOT the official version of dialog. This version has been significantly modified from the original. It is for use by the Linux -kernel configuration script. Please do not bother Savio Lam with +kernel configuration script. Please do not bother Savio Lam with questions about this program. diff --git a/support/kconfig/lxdialog/check-lxdialog.sh b/support/kconfig/lxdialog/check-lxdialog.sh deleted file mode 100755 index 27d6c30a57..0000000000 --- a/support/kconfig/lxdialog/check-lxdialog.sh +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/sh -# SPDX-License-Identifier: GPL-2.0 -# Check ncurses compatibility - -# What library to link -ldflags() -{ - pkg-config --libs ncursesw 2>/dev/null && exit - pkg-config --libs ncurses 2>/dev/null && exit - for ext in so a dll.a dylib ; do - for lib in ncursesw ncurses curses ; do - $cc -print-file-name=lib${lib}.${ext} | grep -q / - if [ $? -eq 0 ]; then - echo "-l${lib}" - exit - fi - done - done - exit 1 -} - -# Where is ncurses.h? -ccflags() -{ - if pkg-config --cflags ncursesw 2>/dev/null; then - echo '-DCURSES_LOC="" -DNCURSES_WIDECHAR=1' - elif pkg-config --cflags ncurses 2>/dev/null; then - echo '-DCURSES_LOC=""' - elif [ -f /usr/include/ncursesw/curses.h ]; then - echo '-I/usr/include/ncursesw -DCURSES_LOC=""' - echo ' -DNCURSES_WIDECHAR=1' - elif [ -f /usr/include/ncurses/ncurses.h ]; then - echo '-I/usr/include/ncurses -DCURSES_LOC=""' - elif [ -f /usr/include/ncurses/curses.h ]; then - echo '-I/usr/include/ncurses -DCURSES_LOC=""' - elif [ -f /usr/include/ncurses.h ]; then - echo '-DCURSES_LOC=""' - else - echo '-DCURSES_LOC=""' - fi -} - -# Temp file, try to clean up after us -tmp=$(mktemp) -trap "rm -f $tmp" 0 1 2 3 15 - -# Check if we can link to ncurses -check() { - $cc -x c - -o $tmp 2>/dev/null <<'EOF' -#include CURSES_LOC -int main() {} -EOF - if [ $? != 0 ]; then - echo " *** Unable to find the ncurses libraries or the" 1>&2 - echo " *** required header files." 1>&2 - echo " *** 'make menuconfig' requires the ncurses libraries." 1>&2 - echo " *** " 1>&2 - echo " *** Install ncurses (ncurses-devel or libncurses-dev " 1>&2 - echo " *** depending on your distribution) and try again." 1>&2 - echo " *** " 1>&2 - exit 1 - fi -} - -usage() { - printf "Usage: $0 [-check compiler options|-ccflags|-ldflags compiler options]\n" -} - -if [ $# -eq 0 ]; then - usage - exit 1 -fi - -cc="" -case "$1" in - "-check") - shift - cc="$@" - check - ;; - "-ccflags") - ccflags - ;; - "-ldflags") - shift - cc="$@" - ldflags - ;; - "*") - usage - exit 1 - ;; -esac diff --git a/support/kconfig/lxdialog/checklist.c b/support/kconfig/lxdialog/checklist.c index 8d016faa28..75493302fb 100644 --- a/support/kconfig/lxdialog/checklist.c +++ b/support/kconfig/lxdialog/checklist.c @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * checklist.c -- implements the checklist box * @@ -5,20 +6,6 @@ * Stuart Herbert - S.Herbert@sheffield.ac.uk: radiolist extension * Alessandro Rubini - rubini@ipvvis.unipv.it: merged the two * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "dialog.h" @@ -103,8 +90,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) int x = width / 2 - 11; int y = height - 2; - print_button(dialog, gettext("Select"), y, x, selected == 0); - print_button(dialog, gettext(" Help "), y, x + 14, selected == 1); + print_button(dialog, "Select", y, x, selected == 0); + print_button(dialog, " Help ", y, x + 14, selected == 1); wmove(dialog, y, x + 1 + 14 * selected); wrefresh(dialog); @@ -132,7 +119,7 @@ int dialog_checklist(const char *title, const char *prompt, int height, } do_resize: - if (getmaxy(stdscr) < (height + CHECKLIST_HEIGTH_MIN)) + if (getmaxy(stdscr) < (height + CHECKLIST_HEIGHT_MIN)) return -ERRDISPLAYTOOSMALL; if (getmaxx(stdscr) < (width + CHECKLIST_WIDTH_MIN)) return -ERRDISPLAYTOOSMALL; @@ -201,9 +188,8 @@ do_resize: print_buttons(dialog, height, width, 0); - wnoutrefresh(dialog); - wnoutrefresh(list); - doupdate(); + wmove(list, choice, check_x + 1); + wrefresh(list); while (key != KEY_ESC) { key = wgetch(dialog); diff --git a/support/kconfig/lxdialog/dialog.h b/support/kconfig/lxdialog/dialog.h index fcffd5b41f..f6c2ebe6d1 100644 --- a/support/kconfig/lxdialog/dialog.h +++ b/support/kconfig/lxdialog/dialog.h @@ -1,21 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * dialog.h -- common declarations for all dialog modules * * AUTHOR: Savio Lam (lam836@cs.cuhk.hk) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -26,32 +13,10 @@ #include #include -#ifndef KBUILD_NO_NLS -# include -#else -# define gettext(Msgid) ((const char *) (Msgid)) -#endif - #ifdef __sun__ #define CURS_MACROS #endif -#include CURSES_LOC - -/* - * Colors in ncurses 1.9.9e do not work properly since foreground and - * background colors are OR'd rather than separately masked. This version - * of dialog was hacked to work with ncurses 1.9.9e, making it incompatible - * with standard curses. The simplest fix (to make this work with standard - * curses) uses the wbkgdset() function, not used in the original hack. - * Turn it off if we're building with 1.9.9e, since it just confuses things. - */ -#if defined(NCURSES_VERSION) && defined(_NEED_WRAP) && !defined(GCC_PRINTFLIKE) -#define OLD_NCURSES 1 -#undef wbkgdset -#define wbkgdset(w,p) /*nothing */ -#else -#define OLD_NCURSES 0 -#endif +#include #define TR(params) _tracef params @@ -126,10 +91,6 @@ struct dialog_info { struct dialog_color button_label_active; struct dialog_color button_label_inactive; struct dialog_color inputbox; - struct dialog_color inputbox_border; - struct dialog_color searchbox; - struct dialog_color searchbox_title; - struct dialog_color searchbox_border; struct dialog_color position_indicator; struct dialog_color menubox; struct dialog_color menubox_border; @@ -201,17 +162,17 @@ int on_key_esc(WINDOW *win); int on_key_resize(void); /* minimum (re)size values */ -#define CHECKLIST_HEIGTH_MIN 6 /* For dialog_checklist() */ +#define CHECKLIST_HEIGHT_MIN 6 /* For dialog_checklist() */ #define CHECKLIST_WIDTH_MIN 6 -#define INPUTBOX_HEIGTH_MIN 2 /* For dialog_inputbox() */ +#define INPUTBOX_HEIGHT_MIN 2 /* For dialog_inputbox() */ #define INPUTBOX_WIDTH_MIN 2 -#define MENUBOX_HEIGTH_MIN 15 /* For dialog_menu() */ +#define MENUBOX_HEIGHT_MIN 15 /* For dialog_menu() */ #define MENUBOX_WIDTH_MIN 65 -#define TEXTBOX_HEIGTH_MIN 8 /* For dialog_textbox() */ +#define TEXTBOX_HEIGHT_MIN 8 /* For dialog_textbox() */ #define TEXTBOX_WIDTH_MIN 8 -#define YESNO_HEIGTH_MIN 4 /* For dialog_yesno() */ +#define YESNO_HEIGHT_MIN 4 /* For dialog_yesno() */ #define YESNO_WIDTH_MIN 4 -#define WINDOW_HEIGTH_MIN 19 /* For init_dialog() */ +#define WINDOW_HEIGHT_MIN 19 /* For init_dialog() */ #define WINDOW_WIDTH_MIN 80 int init_dialog(const char *backtitle); @@ -231,27 +192,12 @@ int first_alpha(const char *string, const char *exempt); int dialog_yesno(const char *title, const char *prompt, int height, int width); int dialog_msgbox(const char *title, const char *prompt, int height, int width, int pause); - - -typedef void (*update_text_fn)(char *buf, size_t start, size_t end, void - *_data); -int dialog_textbox(const char *title, char *tbuf, int initial_height, - int initial_width, int *keys, int *_vscroll, int *_hscroll, - update_text_fn update_text, void *data); +int dialog_textbox(const char *title, const char *tbuf, int initial_height, + int initial_width, int *_vscroll, int *_hscroll, + int (*extra_key_cb)(int, size_t, size_t, void *), void *data); int dialog_menu(const char *title, const char *prompt, const void *selected, int *s_scroll); int dialog_checklist(const char *title, const char *prompt, int height, int width, int list_height); int dialog_inputbox(const char *title, const char *prompt, int height, int width, const char *init); - -/* - * This is the base for fictitious keys, which activate - * the buttons. - * - * Mouse-generated keys are the following: - * -- the first 32 are used as numbers, in addition to '0'-'9' - * -- the lowercase are used to signal mouse-enter events (M_EVENT + 'o') - * -- uppercase chars are used to invoke the button (M_EVENT + 'O') - */ -#define M_EVENT (KEY_MAX+1) diff --git a/support/kconfig/lxdialog/inputbox.c b/support/kconfig/lxdialog/inputbox.c index d58de1dc53..3c6e24b20f 100644 --- a/support/kconfig/lxdialog/inputbox.c +++ b/support/kconfig/lxdialog/inputbox.c @@ -1,22 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * inputbox.c -- implements the input box * * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "dialog.h" @@ -31,8 +18,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) int x = width / 2 - 11; int y = height - 2; - print_button(dialog, gettext(" Ok "), y, x, selected == 0); - print_button(dialog, gettext(" Help "), y, x + 14, selected == 1); + print_button(dialog, " Ok ", y, x, selected == 0); + print_button(dialog, " Help ", y, x + 14, selected == 1); wmove(dialog, y, x + 1 + 14 * selected); wrefresh(dialog); @@ -56,7 +43,7 @@ int dialog_inputbox(const char *title, const char *prompt, int height, int width strcpy(instr, init); do_resize: - if (getmaxy(stdscr) <= (height - INPUTBOX_HEIGTH_MIN)) + if (getmaxy(stdscr) <= (height - INPUTBOX_HEIGHT_MIN)) return -ERRDISPLAYTOOSMALL; if (getmaxx(stdscr) <= (width - INPUTBOX_WIDTH_MIN)) return -ERRDISPLAYTOOSMALL; @@ -126,7 +113,8 @@ do_resize: case KEY_DOWN: break; case KEY_BACKSPACE: - case 127: + case 8: /* ^H */ + case 127: /* ^? */ if (pos) { wattrset(dialog, dlg.inputbox.atr); if (input_x == 0) { diff --git a/support/kconfig/lxdialog/menubox.c b/support/kconfig/lxdialog/menubox.c index 185524901d..d4c19b7bee 100644 --- a/support/kconfig/lxdialog/menubox.c +++ b/support/kconfig/lxdialog/menubox.c @@ -1,22 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * menubox.c -- implements the menu box * * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcapw@cfw.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* @@ -76,15 +63,7 @@ static void do_print_item(WINDOW * win, const char *item, int line_y, /* Clear 'residue' of last item */ wattrset(win, dlg.menubox.atr); wmove(win, line_y, 0); -#if OLD_NCURSES - { - int i; - for (i = 0; i < menu_width; i++) - waddch(win, ' '); - } -#else wclrtoeol(win); -#endif wattrset(win, selected ? dlg.item_selected.atr : dlg.item.atr); mvwaddstr(win, line_y, item_x, menu_item); if (hotkey) { @@ -157,11 +136,11 @@ static void print_buttons(WINDOW * win, int height, int width, int selected) int x = width / 2 - 28; int y = height - 2; - print_button(win, gettext("Select"), y, x, selected == 0); - print_button(win, gettext(" Exit "), y, x + 12, selected == 1); - print_button(win, gettext(" Help "), y, x + 24, selected == 2); - print_button(win, gettext(" Save "), y, x + 36, selected == 3); - print_button(win, gettext(" Load "), y, x + 48, selected == 4); + print_button(win, "Select", y, x, selected == 0); + print_button(win, " Exit ", y, x + 12, selected == 1); + print_button(win, " Help ", y, x + 24, selected == 2); + print_button(win, " Save ", y, x + 36, selected == 3); + print_button(win, " Load ", y, x + 48, selected == 4); wmove(win, y, x + 1 + 12 * selected); wrefresh(win); @@ -193,7 +172,7 @@ int dialog_menu(const char *title, const char *prompt, do_resize: height = getmaxy(stdscr); width = getmaxx(stdscr); - if (height < MENUBOX_HEIGTH_MIN || width < MENUBOX_WIDTH_MIN) + if (height < MENUBOX_HEIGHT_MIN || width < MENUBOX_WIDTH_MIN) return -ERRDISPLAYTOOSMALL; height -= 4; diff --git a/support/kconfig/lxdialog/textbox.c b/support/kconfig/lxdialog/textbox.c index 1773319b95..0abaf63597 100644 --- a/support/kconfig/lxdialog/textbox.c +++ b/support/kconfig/lxdialog/textbox.c @@ -1,61 +1,156 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * textbox.c -- implements the text box * * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "dialog.h" -static void back_lines(int n); -static void print_page(WINDOW *win, int height, int width, update_text_fn - update_text, void *data); -static void print_line(WINDOW *win, int row, int width); -static char *get_line(void); -static void print_position(WINDOW * win); - static int hscroll; static int begin_reached, end_reached, page_length; -static char *buf; -static char *page; +static const char *buf, *page; +static size_t start, end; + +/* + * Go back 'n' lines in text. Called by dialog_textbox(). + * 'page' will be updated to point to the desired line in 'buf'. + */ +static void back_lines(int n) +{ + int i; + + begin_reached = 0; + /* Go back 'n' lines */ + for (i = 0; i < n; i++) { + if (*page == '\0') { + if (end_reached) { + end_reached = 0; + continue; + } + } + if (page == buf) { + begin_reached = 1; + return; + } + page--; + do { + if (page == buf) { + begin_reached = 1; + return; + } + page--; + } while (*page != '\n'); + page++; + } +} + +/* + * Return current line of text. Called by dialog_textbox() and print_line(). + * 'page' should point to start of current line before calling, and will be + * updated to point to start of next line. + */ +static char *get_line(void) +{ + int i = 0; + static char line[MAX_LEN + 1]; + + end_reached = 0; + while (*page != '\n') { + if (*page == '\0') { + end_reached = 1; + break; + } else if (i < MAX_LEN) + line[i++] = *(page++); + else { + /* Truncate lines longer than MAX_LEN characters */ + if (i == MAX_LEN) + line[i++] = '\0'; + page++; + } + } + if (i <= MAX_LEN) + line[i] = '\0'; + if (!end_reached) + page++; /* move past '\n' */ + + return line; +} + +/* + * Print a new line of text. + */ +static void print_line(WINDOW *win, int row, int width) +{ + char *line; + + line = get_line(); + line += MIN(strlen(line), hscroll); /* Scroll horizontally */ + wmove(win, row, 0); /* move cursor to correct line */ + waddch(win, ' '); + waddnstr(win, line, MIN(strlen(line), width - 2)); + + /* Clear 'residue' of previous line */ + wclrtoeol(win); +} + +/* + * Print a new page of text. + */ +static void print_page(WINDOW *win, int height, int width) +{ + int i, passed_end = 0; + + page_length = 0; + for (i = 0; i < height; i++) { + print_line(win, i, width); + if (!passed_end) + page_length++; + if (end_reached && !passed_end) + passed_end = 1; + } + wnoutrefresh(win); +} + +/* + * Print current position + */ +static void print_position(WINDOW *win) +{ + int percent; + + wattrset(win, dlg.position_indicator.atr); + wbkgdset(win, dlg.position_indicator.atr & A_COLOR); + percent = (page - buf) * 100 / strlen(buf); + wmove(win, getmaxy(win) - 3, getmaxx(win) - 9); + wprintw(win, "(%3d%%)", percent); +} /* * refresh window content */ static void refresh_text_box(WINDOW *dialog, WINDOW *box, int boxh, int boxw, - int cur_y, int cur_x, update_text_fn update_text, - void *data) + int cur_y, int cur_x) { - print_page(box, boxh, boxw, update_text, data); + start = page - buf; + + print_page(box, boxh, boxw); print_position(dialog); wmove(dialog, cur_y, cur_x); /* Restore cursor position */ wrefresh(dialog); -} + end = page - buf; +} /* * Display text from a file in a dialog box. * * keys is a null-terminated array - * update_text() may not add or remove any '\n' or '\0' in tbuf */ -int dialog_textbox(const char *title, char *tbuf, int initial_height, - int initial_width, int *keys, int *_vscroll, int *_hscroll, - update_text_fn update_text, void *data) +int dialog_textbox(const char *title, const char *tbuf, int initial_height, + int initial_width, int *_vscroll, int *_hscroll, + int (*extra_key_cb)(int, size_t, size_t, void *), void *data) { int i, x, y, cur_x, cur_y, key = 0; int height, width, boxh, boxw; @@ -80,7 +175,7 @@ int dialog_textbox(const char *title, char *tbuf, int initial_height, do_resize: getmaxyx(stdscr, height, width); - if (height < TEXTBOX_HEIGTH_MIN || width < TEXTBOX_WIDTH_MIN) + if (height < TEXTBOX_HEIGHT_MIN || width < TEXTBOX_WIDTH_MIN) return -ERRDISPLAYTOOSMALL; if (initial_height != 0) height = initial_height; @@ -129,14 +224,13 @@ do_resize: print_title(dialog, title, width); - print_button(dialog, gettext(" Exit "), height - 2, width / 2 - 4, TRUE); + print_button(dialog, " Exit ", height - 2, width / 2 - 4, TRUE); wnoutrefresh(dialog); getyx(dialog, cur_y, cur_x); /* Save cursor position */ /* Print first page of text */ attr_clear(box, boxh, boxw, dlg.dialog.atr); - refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x, update_text, - data); + refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); while (!done) { key = wgetch(dialog); @@ -155,8 +249,7 @@ do_resize: begin_reached = 1; page = buf; refresh_text_box(dialog, box, boxh, boxw, - cur_y, cur_x, update_text, - data); + cur_y, cur_x); } break; case 'G': /* Last page */ @@ -166,8 +259,7 @@ do_resize: /* point to last char in buf */ page = buf + strlen(buf); back_lines(boxh); - refresh_text_box(dialog, box, boxh, boxw, cur_y, - cur_x, update_text, data); + refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); break; case 'K': /* Previous line */ case 'k': @@ -176,8 +268,7 @@ do_resize: break; back_lines(page_length + 1); - refresh_text_box(dialog, box, boxh, boxw, cur_y, - cur_x, update_text, data); + refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); break; case 'B': /* Previous page */ case 'b': @@ -186,8 +277,7 @@ do_resize: if (begin_reached) break; back_lines(page_length + boxh); - refresh_text_box(dialog, box, boxh, boxw, cur_y, - cur_x, update_text, data); + refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); break; case 'J': /* Next line */ case 'j': @@ -196,8 +286,7 @@ do_resize: break; back_lines(page_length - 1); - refresh_text_box(dialog, box, boxh, boxw, cur_y, - cur_x, update_text, data); + refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); break; case KEY_NPAGE: /* Next page */ case ' ': @@ -206,8 +295,7 @@ do_resize: break; begin_reached = 0; - refresh_text_box(dialog, box, boxh, boxw, cur_y, - cur_x, update_text, data); + refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); break; case '0': /* Beginning of line */ case 'H': /* Scroll left */ @@ -222,8 +310,7 @@ do_resize: hscroll--; /* Reprint current page to scroll horizontally */ back_lines(page_length); - refresh_text_box(dialog, box, boxh, boxw, cur_y, - cur_x, update_text, data); + refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); break; case 'L': /* Scroll right */ case 'l': @@ -233,8 +320,7 @@ do_resize: hscroll++; /* Reprint current page to scroll horizontally */ back_lines(page_length); - refresh_text_box(dialog, box, boxh, boxw, cur_y, - cur_x, update_text, data); + refresh_text_box(dialog, box, boxh, boxw, cur_y, cur_x); break; case KEY_ESC: if (on_key_esc(dialog) == KEY_ESC) @@ -247,11 +333,9 @@ do_resize: on_key_resize(); goto do_resize; default: - for (i = 0; keys[i]; i++) { - if (key == keys[i]) { - done = true; - break; - } + if (extra_key_cb && extra_key_cb(key, start, end, data)) { + done = true; + break; } } } @@ -272,137 +356,3 @@ do_resize: *_hscroll = hscroll; return key; } - -/* - * Go back 'n' lines in text. Called by dialog_textbox(). - * 'page' will be updated to point to the desired line in 'buf'. - */ -static void back_lines(int n) -{ - int i; - - begin_reached = 0; - /* Go back 'n' lines */ - for (i = 0; i < n; i++) { - if (*page == '\0') { - if (end_reached) { - end_reached = 0; - continue; - } - } - if (page == buf) { - begin_reached = 1; - return; - } - page--; - do { - if (page == buf) { - begin_reached = 1; - return; - } - page--; - } while (*page != '\n'); - page++; - } -} - -/* - * Print a new page of text. - */ -static void print_page(WINDOW *win, int height, int width, update_text_fn - update_text, void *data) -{ - int i, passed_end = 0; - - if (update_text) { - char *end; - - for (i = 0; i < height; i++) - get_line(); - end = page; - back_lines(height); - update_text(buf, page - buf, end - buf, data); - } - - page_length = 0; - for (i = 0; i < height; i++) { - print_line(win, i, width); - if (!passed_end) - page_length++; - if (end_reached && !passed_end) - passed_end = 1; - } - wnoutrefresh(win); -} - -/* - * Print a new line of text. - */ -static void print_line(WINDOW * win, int row, int width) -{ - char *line; - - line = get_line(); - line += MIN(strlen(line), hscroll); /* Scroll horizontally */ - wmove(win, row, 0); /* move cursor to correct line */ - waddch(win, ' '); - waddnstr(win, line, MIN(strlen(line), width - 2)); - - /* Clear 'residue' of previous line */ -#if OLD_NCURSES - { - int x = getcurx(win); - int i; - for (i = 0; i < width - x; i++) - waddch(win, ' '); - } -#else - wclrtoeol(win); -#endif -} - -/* - * Return current line of text. Called by dialog_textbox() and print_line(). - * 'page' should point to start of current line before calling, and will be - * updated to point to start of next line. - */ -static char *get_line(void) -{ - int i = 0; - static char line[MAX_LEN + 1]; - - end_reached = 0; - while (*page != '\n') { - if (*page == '\0') { - end_reached = 1; - break; - } else if (i < MAX_LEN) - line[i++] = *(page++); - else { - /* Truncate lines longer than MAX_LEN characters */ - if (i == MAX_LEN) - line[i++] = '\0'; - page++; - } - } - if (i <= MAX_LEN) - line[i] = '\0'; - if (!end_reached) - page++; /* move past '\n' */ - - return line; -} - -/* - * Print current position - */ -static void print_position(WINDOW * win) -{ - int percent; - - wattrset(win, dlg.position_indicator.atr); - wbkgdset(win, dlg.position_indicator.atr & A_COLOR); - percent = (page - buf) * 100 / strlen(buf); - wmove(win, getmaxy(win) - 3, getmaxx(win) - 9); - wprintw(win, "(%3d%%)", percent); -} diff --git a/support/kconfig/lxdialog/util.c b/support/kconfig/lxdialog/util.c index f7abdeb92a..f18e2a89f6 100644 --- a/support/kconfig/lxdialog/util.c +++ b/support/kconfig/lxdialog/util.c @@ -1,22 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * util.c * * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include @@ -42,10 +29,6 @@ static void set_mono_theme(void) dlg.button_label_active.atr = A_REVERSE; dlg.button_label_inactive.atr = A_NORMAL; dlg.inputbox.atr = A_NORMAL; - dlg.inputbox_border.atr = A_NORMAL; - dlg.searchbox.atr = A_NORMAL; - dlg.searchbox_title.atr = A_BOLD; - dlg.searchbox_border.atr = A_NORMAL; dlg.position_indicator.atr = A_BOLD; dlg.menubox.atr = A_NORMAL; dlg.menubox_border.atr = A_NORMAL; @@ -82,10 +65,6 @@ static void set_classic_theme(void) DLG_COLOR(button_label_active, COLOR_YELLOW, COLOR_BLUE, true); DLG_COLOR(button_label_inactive, COLOR_BLACK, COLOR_WHITE, true); DLG_COLOR(inputbox, COLOR_BLACK, COLOR_WHITE, false); - DLG_COLOR(inputbox_border, COLOR_BLACK, COLOR_WHITE, false); - DLG_COLOR(searchbox, COLOR_BLACK, COLOR_WHITE, false); - DLG_COLOR(searchbox_title, COLOR_YELLOW, COLOR_WHITE, true); - DLG_COLOR(searchbox_border, COLOR_WHITE, COLOR_WHITE, true); DLG_COLOR(position_indicator, COLOR_YELLOW, COLOR_WHITE, true); DLG_COLOR(menubox, COLOR_BLACK, COLOR_WHITE, false); DLG_COLOR(menubox_border, COLOR_WHITE, COLOR_WHITE, true); @@ -114,14 +93,9 @@ static void set_blackbg_theme(void) DLG_COLOR(button_key_active, COLOR_YELLOW, COLOR_RED, true); DLG_COLOR(button_key_inactive, COLOR_RED, COLOR_BLACK, false); DLG_COLOR(button_label_active, COLOR_WHITE, COLOR_RED, false); - DLG_COLOR(button_label_inactive, COLOR_BLACK, COLOR_BLACK, true); + DLG_COLOR(button_label_inactive, COLOR_WHITE, COLOR_BLACK, false); DLG_COLOR(inputbox, COLOR_YELLOW, COLOR_BLACK, false); - DLG_COLOR(inputbox_border, COLOR_YELLOW, COLOR_BLACK, false); - - DLG_COLOR(searchbox, COLOR_YELLOW, COLOR_BLACK, false); - DLG_COLOR(searchbox_title, COLOR_YELLOW, COLOR_BLACK, true); - DLG_COLOR(searchbox_border, COLOR_BLACK, COLOR_BLACK, true); DLG_COLOR(position_indicator, COLOR_RED, COLOR_BLACK, false); @@ -149,7 +123,6 @@ static void set_bluetitle_theme(void) DLG_COLOR(title, COLOR_BLUE, COLOR_WHITE, true); DLG_COLOR(button_key_active, COLOR_YELLOW, COLOR_BLUE, true); DLG_COLOR(button_label_active, COLOR_WHITE, COLOR_BLUE, true); - DLG_COLOR(searchbox_title, COLOR_BLUE, COLOR_WHITE, true); DLG_COLOR(position_indicator, COLOR_BLUE, COLOR_WHITE, true); DLG_COLOR(tag, COLOR_BLUE, COLOR_WHITE, true); DLG_COLOR(tag_key, COLOR_BLUE, COLOR_WHITE, true); @@ -202,10 +175,6 @@ static void init_dialog_colors(void) init_one_color(&dlg.button_label_active); init_one_color(&dlg.button_label_inactive); init_one_color(&dlg.inputbox); - init_one_color(&dlg.inputbox_border); - init_one_color(&dlg.searchbox); - init_one_color(&dlg.searchbox_title); - init_one_color(&dlg.searchbox_border); init_one_color(&dlg.position_indicator); init_one_color(&dlg.menubox); init_one_color(&dlg.menubox_border); @@ -322,7 +291,7 @@ int init_dialog(const char *backtitle) getyx(stdscr, saved_y, saved_x); getmaxyx(stdscr, height, width); - if (height < WINDOW_HEIGTH_MIN || width < WINDOW_WIDTH_MIN) { + if (height < WINDOW_HEIGHT_MIN || width < WINDOW_WIDTH_MIN) { endwin(); return -ERRDISPLAYTOOSMALL; } @@ -376,7 +345,7 @@ void print_title(WINDOW *dialog, const char *title, int width) /* * Print a string of text in a window, automatically wrap around to the * next line if the string is too long to fit on one line. Newline - * characters '\n' are propperly processed. We start on a new line + * characters '\n' are properly processed. We start on a new line * if there is no room for at least 4 nonblanks following a double-space. */ void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x) @@ -554,7 +523,7 @@ int first_alpha(const char *string, const char *exempt) * lxdialog suggest which is correctly translated to two * times esc. But then we need to ignore the second esc to avoid stepping * out one menu too much. Filter away all escaped key sequences since - * keypad(FALSE) turn off ncurses support for escape sequences - and thats + * keypad(FALSE) turn off ncurses support for escape sequences - and that's * needed to make notimeout() do as expected. */ int on_key_esc(WINDOW *win) diff --git a/support/kconfig/lxdialog/yesno.c b/support/kconfig/lxdialog/yesno.c index 676fb2f824..b57d25e154 100644 --- a/support/kconfig/lxdialog/yesno.c +++ b/support/kconfig/lxdialog/yesno.c @@ -1,22 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * yesno.c -- implements the yes/no box * * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "dialog.h" @@ -29,8 +16,8 @@ static void print_buttons(WINDOW * dialog, int height, int width, int selected) int x = width / 2 - 10; int y = height - 2; - print_button(dialog, gettext(" Yes "), y, x, selected == 0); - print_button(dialog, gettext(" No "), y, x + 13, selected == 1); + print_button(dialog, " Yes ", y, x, selected == 0); + print_button(dialog, " No ", y, x + 13, selected == 1); wmove(dialog, y, x + 1 + 13 * selected); wrefresh(dialog); @@ -45,7 +32,7 @@ int dialog_yesno(const char *title, const char *prompt, int height, int width) WINDOW *dialog; do_resize: - if (getmaxy(stdscr) < (height + YESNO_HEIGTH_MIN)) + if (getmaxy(stdscr) < (height + YESNO_HEIGHT_MIN)) return -ERRDISPLAYTOOSMALL; if (getmaxx(stdscr) < (width + YESNO_WIDTH_MIN)) return -ERRDISPLAYTOOSMALL; diff --git a/support/kconfig/mconf-cfg.sh b/support/kconfig/mconf-cfg.sh new file mode 100755 index 0000000000..1e61f50a59 --- /dev/null +++ b/support/kconfig/mconf-cfg.sh @@ -0,0 +1,55 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 + +cflags=$1 +libs=$2 + +PKG="ncursesw" +PKG2="ncurses" + +if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then + if ${HOSTPKG_CONFIG} --exists $PKG; then + ${HOSTPKG_CONFIG} --cflags ${PKG} > ${cflags} + ${HOSTPKG_CONFIG} --libs ${PKG} > ${libs} + exit 0 + fi + + if ${HOSTPKG_CONFIG} --exists ${PKG2}; then + ${HOSTPKG_CONFIG} --cflags ${PKG2} > ${cflags} + ${HOSTPKG_CONFIG} --libs ${PKG2} > ${libs} + exit 0 + fi +fi + +# Check the default paths in case pkg-config is not installed. +# (Even if it is installed, some distributions such as openSUSE cannot +# find ncurses by pkg-config.) +if [ -f /usr/include/ncursesw/ncurses.h ]; then + echo -D_GNU_SOURCE -I/usr/include/ncursesw > ${cflags} + echo -lncursesw > ${libs} + exit 0 +fi + +if [ -f /usr/include/ncurses/ncurses.h ]; then + echo -D_GNU_SOURCE -I/usr/include/ncurses > ${cflags} + echo -lncurses > ${libs} + exit 0 +fi + +# As a final fallback before giving up, check if $HOSTCC knows of a default +# ncurses installation (e.g. from a vendor-specific sysroot). +if echo '#include ' | ${HOSTCC} -E - >/dev/null 2>&1; then + echo -D_GNU_SOURCE > ${cflags} + echo -lncurses > ${libs} + exit 0 +fi + +echo >&2 "*" +echo >&2 "* Unable to find the ncurses package." +echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev" +echo >&2 "* depending on your distribution)." +echo >&2 "*" +echo >&2 "* You may also need to install ${HOSTPKG_CONFIG} to find the" +echo >&2 "* ncurses installed in a non-default location." +echo >&2 "*" +exit 1 diff --git a/support/kconfig/mconf.c b/support/kconfig/mconf.c index 279f4552a1..420e173e4f 100644 --- a/support/kconfig/mconf.c +++ b/support/kconfig/mconf.c @@ -1,6 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2002 Roman Zippel - * Released under the terms of the GNU GPL v2.0. * * Introduced single menu mode (show all sub-menus in one large tree). * 2002-11-06 Petr Baudis @@ -15,14 +15,16 @@ #include #include #include +#include #include #include -#include +#include "list.h" #include "lkc.h" #include "lxdialog/dialog.h" +#include "mnconf-common.h" -static const char mconf_readme[] = N_( +static const char mconf_readme[] = "Overview\n" "--------\n" "This interface lets you select features and parameters for the build.\n" @@ -159,6 +161,12 @@ static const char mconf_readme[] = N_( "(especially with a larger number of unrolled categories) than the\n" "default mode.\n" "\n" + +"Search\n" +"-------\n" +"Pressing the forward-slash (/) anywhere brings up a search dialog box.\n" +"\n" + "Different color themes available\n" "--------------------------------\n" "It is possible to select different color themes using the variable\n" @@ -171,37 +179,37 @@ static const char mconf_readme[] = N_( " blackbg => selects a color scheme with black background\n" " classic => theme with blue background. The classic look\n" " bluetitle => an LCD friendly version of classic. (default)\n" -"\n"), -menu_instructions[] = N_( +"\n", +menu_instructions[] = "Arrow keys navigate the menu. " " selects submenus ---> (or empty submenus ----). " "Highlighted letters are hotkeys. " - "Pressing selects a feature, while excludes a feature. " + "Pressing selects a feature, while excludes a features. " "Press to exit, for Help, for Search. " - "Legend: [*] feature is selected [ ] feature is excluded"), -radiolist_instructions[] = N_( + "Legend: [*] feature is selected [ ] feature is excluded", +radiolist_instructions[] = "Use the arrow keys to navigate this window or " "press the hotkey of the item you wish to select " "followed by the . " - "Press for additional information about this option."), -inputbox_instructions_int[] = N_( + "Press for additional information about this option.", +inputbox_instructions_int[] = "Please enter a decimal value. " "Fractions will not be accepted. " - "Use the key to move from the input field to the buttons below it."), -inputbox_instructions_hex[] = N_( + "Use the key to move from the input field to the buttons below it.", +inputbox_instructions_hex[] = "Please enter a hexadecimal value. " - "Use the key to move from the input field to the buttons below it."), -inputbox_instructions_string[] = N_( + "Use the key to move from the input field to the buttons below it.", +inputbox_instructions_string[] = "Please enter a string value. " - "Use the key to move from the input field to the buttons below it."), -setmod_text[] = N_( + "Use the key to move from the input field to the buttons below it.", +setmod_text[] = "This feature depends on another which has been configured as a module.\n" - "As a result, this feature will be built as a module."), -load_config_text[] = N_( + "As a result, this feature will be built as a module.", +load_config_text[] = "Enter the name of the configuration file you wish to load. " "Accept the name shown to restore the configuration you " - "last retrieved. Leave blank to abort."), -load_config_help[] = N_( + "last retrieved. Leave blank to abort.", +load_config_help[] = "\n" "For various reasons, one may wish to keep several different\n" "configurations available on a single machine.\n" @@ -211,11 +219,11 @@ load_config_help[] = N_( "configuration.\n" "\n" "If you are uncertain, then you have probably never used alternate\n" - "configuration files. You should therefore leave this blank to abort.\n"), -save_config_text[] = N_( + "configuration files. You should therefore leave this blank to abort.\n", +save_config_text[] = "Enter a filename to which this configuration should be saved " - "as an alternate. Leave blank to abort."), -save_config_help[] = N_( + "as an alternate. Leave blank to abort.", +save_config_help[] = "\n" "For various reasons, one may wish to keep different configurations\n" "available on a single machine.\n" @@ -225,8 +233,8 @@ save_config_help[] = N_( "configuration options you have selected at that time.\n" "\n" "If you are uncertain what all this means then you should probably\n" - "leave this blank.\n"), -search_help[] = N_( + "leave this blank.\n", +search_help[] = "\n" "Search for symbols and display their relations.\n" "Regular expressions are allowed.\n" @@ -241,7 +249,7 @@ search_help[] = N_( " -> PCI support (PCI [=y])\n" "(1) -> PCI access mode ( [=y])\n" " Defined at drivers/pci/Kconfig:47\n" - " Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n" + " Depends on: X86_LOCAL_APIC && X86_IO_APIC\n" " Selects: LIBCRC32\n" " Selected by: BAR [=n]\n" "-----------------------------------------------------------------\n" @@ -271,7 +279,7 @@ search_help[] = N_( "Examples: USB => find all symbols containing USB\n" " ^USB => find all symbols starting with USB\n" " USB$ => find all symbols ending with USB\n" - "\n"); + "\n"; static int indent; static struct menu *current_menu; @@ -282,32 +290,17 @@ static int save_and_exit; static int silent; static void conf(struct menu *menu, struct menu *active_menu); -static void conf_choice(struct menu *menu); -static void conf_string(struct menu *menu); -static void conf_load(void); -static void conf_save(void); -static int show_textbox_ext(const char *title, char *text, int r, int c, - int *keys, int *vscroll, int *hscroll, - update_text_fn update_text, void *data); -static void show_textbox(const char *title, const char *text, int r, int c); -static void show_helptext(const char *title, const char *text); -static void show_help(struct menu *menu); static char filename[PATH_MAX+1]; static void set_config_filename(const char *config_filename) { static char menu_backtitle[PATH_MAX+128]; - int size; - size = snprintf(menu_backtitle, sizeof(menu_backtitle), - "%s - %s", config_filename, rootmenu.prompt->text); - if (size >= sizeof(menu_backtitle)) - menu_backtitle[sizeof(menu_backtitle)-1] = '\0'; + snprintf(menu_backtitle, sizeof(menu_backtitle), "%s - %s", + config_filename, rootmenu.prompt->text); set_dialog_backtitle(menu_backtitle); - size = snprintf(filename, sizeof(filename), "%s", config_filename); - if (size >= sizeof(filename)) - filename[sizeof(filename)-1] = '\0'; + snprintf(filename, sizeof(filename), "%s", config_filename); } struct subtitle_part { @@ -355,37 +348,35 @@ static void reset_subtitle(void) set_dialog_subtitles(subtitles); } -struct search_data { - struct list_head *head; - struct menu **targets; - int *keys; -}; +static int show_textbox_ext(const char *title, const char *text, int r, int c, + int *vscroll, int *hscroll, + int (*extra_key_cb)(int, size_t, size_t, void *), + void *data) +{ + dialog_clear(); + return dialog_textbox(title, text, r, c, vscroll, hscroll, + extra_key_cb, data); +} -static void update_text(char *buf, size_t start, size_t end, void *_data) +static void show_textbox(const char *title, const char *text, int r, int c) { - struct search_data *data = _data; - struct jump_key *pos; - int k = 0; + show_textbox_ext(title, text, r, c, NULL, NULL, NULL, NULL); +} - list_for_each_entry(pos, data->head, entries) { - if (pos->offset >= start && pos->offset < end) { - char header[4]; +static void show_helptext(const char *title, const char *text) +{ + show_textbox(title, text, 0, 0); +} - if (k < JUMP_NB) { - int key = '0' + (pos->index % JUMP_NB) + 1; +static void show_help(struct menu *menu) +{ + struct gstr help = str_new(); - sprintf(header, "(%c)", key); - data->keys[k] = key; - data->targets[k] = pos->target; - k++; - } else { - sprintf(header, " "); - } + help.max_width = getmaxx(stdscr) - 10; + menu_get_ext_help(menu, &help); - memcpy(buf + pos->offset, header, sizeof(header) - 1); - } - } - data->keys[k] = 0; + show_helptext(menu_get_prompt(menu), str_get(&help)); + str_free(&help); } static void search_conf(void) @@ -400,19 +391,19 @@ static void search_conf(void) struct subtitle_part stpart; title = str_new(); - str_printf( &title, _("Enter (sub)string or regexp to search for " - "(with or without \"%s\")"), CONFIG_); + str_printf( &title, "Enter (sub)string or regexp to search for " + "(with or without \"%s\")", CONFIG_); again: dialog_clear(); - dres = dialog_inputbox(_("Search Configuration Parameter"), + dres = dialog_inputbox("Search Configuration Parameter", str_get(&title), 10, 75, ""); switch (dres) { case 0: break; case 1: - show_helptext(_("Search Configuration"), search_help); + show_helptext("Search Configuration", search_help); goto again; default: str_free(&title); @@ -432,27 +423,23 @@ again: sym_arr = sym_re_search(dialog_input); do { LIST_HEAD(head); - struct menu *targets[JUMP_NB]; - int keys[JUMP_NB + 1], i; struct search_data data = { .head = &head, - .targets = targets, - .keys = keys, }; struct jump_key *pos, *tmp; + jump_key_char = 0; res = get_relations_str(sym_arr, &head); set_subtitle(); - dres = show_textbox_ext(_("Search Results"), (char *) - str_get(&res), 0, 0, keys, &vscroll, - &hscroll, &update_text, (void *) - &data); + dres = show_textbox_ext("Search Results", str_get(&res), 0, 0, + &vscroll, &hscroll, + handle_search_keys, &data); again = false; - for (i = 0; i < JUMP_NB && keys[i]; i++) - if (dres == keys[i]) { - conf(targets[i]->parent, targets[i]); - again = true; - } + if (dres >= '1' && dres <= '9') { + assert(data.target != NULL); + conf(data.target->parent, data.target); + again = true; + } str_free(&res); list_for_each_entry_safe(pos, tmp, &head, entries) free(pos); @@ -491,7 +478,6 @@ static void build_conf(struct menu *menu) switch (prop->type) { case P_MENU: child_count++; - prompt = _(prompt); if (single_menu_mode) { item_make("%s%*c%s", menu->data ? "-->" : "++>", @@ -508,7 +494,7 @@ static void build_conf(struct menu *menu) case P_COMMENT: if (prompt) { child_count++; - item_make(" %*c*** %s ***", indent + 1, ' ', _(prompt)); + item_make(" %*c*** %s ***", indent + 1, ' ', prompt); item_set_tag(':'); item_set_data(menu); } @@ -516,7 +502,7 @@ static void build_conf(struct menu *menu) default: if (prompt) { child_count++; - item_make("---%*c%s", indent + 1, ' ', _(prompt)); + item_make("---%*c%s", indent + 1, ' ', prompt); item_set_tag(':'); item_set_data(menu); } @@ -538,7 +524,7 @@ static void build_conf(struct menu *menu) } val = sym_get_tristate_value(sym); - if (sym_is_changable(sym)) { + if (sym_is_changeable(sym)) { switch (type) { case S_BOOLEAN: item_make("[%c]", val == no ? ' ' : '*'); @@ -560,10 +546,10 @@ static void build_conf(struct menu *menu) item_set_data(menu); } - item_add_str("%*c%s", indent + 1, ' ', _(menu_get_prompt(menu))); + item_add_str("%*c%s", indent + 1, ' ', menu_get_prompt(menu)); if (val == yes) { if (def_menu) { - item_add_str(" (%s)", _(menu_get_prompt(def_menu))); + item_add_str(" (%s)", menu_get_prompt(def_menu)); item_add_str(" --->"); if (def_menu->list) { indent += 2; @@ -575,7 +561,7 @@ static void build_conf(struct menu *menu) } } else { if (menu == current_menu) { - item_make("---%*c%s", indent + 1, ' ', _(menu_get_prompt(menu))); + item_make("---%*c%s", indent + 1, ' ', menu_get_prompt(menu)); item_set_tag(':'); item_set_data(menu); goto conf_childs; @@ -589,7 +575,7 @@ static void build_conf(struct menu *menu) } else { switch (type) { case S_BOOLEAN: - if (sym_is_changable(sym)) + if (sym_is_changeable(sym)) item_make("[%c]", val == no ? ' ' : '*'); else item_make("-%c-", val == no ? ' ' : '*'); @@ -602,7 +588,7 @@ static void build_conf(struct menu *menu) case mod: ch = 'M'; break; default: ch = ' '; break; } - if (sym_is_changable(sym)) { + if (sym_is_changeable(sym)) { if (sym->rev_dep.tri == mod) item_make("{%c}", ch); else @@ -618,17 +604,17 @@ static void build_conf(struct menu *menu) tmp = indent - tmp + 4; if (tmp < 0) tmp = 0; - item_add_str("%*c%s%s", tmp, ' ', _(menu_get_prompt(menu)), - (sym_has_value(sym) || !sym_is_changable(sym)) ? - "" : _(" (NEW)")); + item_add_str("%*c%s%s", tmp, ' ', menu_get_prompt(menu), + (sym_has_value(sym) || !sym_is_changeable(sym)) ? + "" : " (NEW)"); item_set_tag('s'); item_set_data(menu); goto conf_childs; } } - item_add_str("%*c%s%s", indent + 1, ' ', _(menu_get_prompt(menu)), - (sym_has_value(sym) || !sym_is_changable(sym)) ? - "" : _(" (NEW)")); + item_add_str("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu), + (sym_has_value(sym) || !sym_is_changeable(sym)) ? + "" : " (NEW)"); if (menu->prompt->type == P_MENU) { item_add_str(" %s", menu_is_empty(menu) ? "----" : "--->"); return; @@ -642,164 +628,9 @@ conf_childs: indent -= doint; } -static void conf(struct menu *menu, struct menu *active_menu) -{ - struct menu *submenu; - const char *prompt = menu_get_prompt(menu); - struct subtitle_part stpart; - struct symbol *sym; - int res; - int s_scroll = 0; - - if (menu != &rootmenu) - stpart.text = menu_get_prompt(menu); - else - stpart.text = NULL; - list_add_tail(&stpart.entries, &trail); - - while (1) { - item_reset(); - current_menu = menu; - build_conf(menu); - if (!child_count) - break; - set_subtitle(); - dialog_clear(); - res = dialog_menu(prompt ? _(prompt) : _("Main Menu"), - _(menu_instructions), - active_menu, &s_scroll); - if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL) - break; - if (item_count() != 0) { - if (!item_activate_selected()) - continue; - if (!item_tag()) - continue; - } - submenu = item_data(); - active_menu = item_data(); - if (submenu) - sym = submenu->sym; - else - sym = NULL; - - switch (res) { - case 0: - switch (item_tag()) { - case 'm': - if (single_menu_mode) - submenu->data = (void *) (long) !submenu->data; - else - conf(submenu, NULL); - break; - case 't': - if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes) - conf_choice(submenu); - else if (submenu->prompt->type == P_MENU) - conf(submenu, NULL); - break; - case 's': - conf_string(submenu); - break; - } - break; - case 2: - if (sym) - show_help(submenu); - else { - reset_subtitle(); - show_helptext(_("README"), _(mconf_readme)); - } - break; - case 3: - reset_subtitle(); - conf_save(); - break; - case 4: - reset_subtitle(); - conf_load(); - break; - case 5: - if (item_is_tag('t')) { - if (sym_set_tristate_value(sym, yes)) - break; - if (sym_set_tristate_value(sym, mod)) - show_textbox(NULL, setmod_text, 6, 74); - } - break; - case 6: - if (item_is_tag('t')) - sym_set_tristate_value(sym, no); - break; - case 7: - if (item_is_tag('t')) - sym_set_tristate_value(sym, mod); - break; - case 8: - if (item_is_tag('t')) - sym_toggle_tristate_value(sym); - else if (item_is_tag('m')) - conf(submenu, NULL); - break; - case 9: - search_conf(); - break; - case 10: - show_all_options = !show_all_options; - break; - } - } - - list_del(trail.prev); -} - -static int show_textbox_ext(const char *title, char *text, int r, int c, int - *keys, int *vscroll, int *hscroll, update_text_fn - update_text, void *data) -{ - dialog_clear(); - return dialog_textbox(title, text, r, c, keys, vscroll, hscroll, - update_text, data); -} - -static void show_textbox(const char *title, const char *text, int r, int c) -{ - show_textbox_ext(title, (char *) text, r, c, (int []) {0}, NULL, NULL, - NULL, NULL); -} - -static void show_helptext(const char *title, const char *text) -{ - show_textbox(title, text, 0, 0); -} - -static void conf_message_callback(const char *fmt, va_list ap) -{ - char buf[PATH_MAX+1]; - - vsnprintf(buf, sizeof(buf), fmt, ap); - if (save_and_exit) { - if (!silent) - printf("%s", buf); - } else { - show_textbox(NULL, buf, 6, 60); - } -} - -static void show_help(struct menu *menu) -{ - struct gstr help = str_new(); - - help.max_width = getmaxx(stdscr) - 10; - menu_get_ext_help(menu, &help); - - show_helptext(_(menu_get_prompt(menu)), str_get(&help)); - str_free(&help); -} - static void conf_choice(struct menu *menu) { - const char *prompt = _(menu_get_prompt(menu)); + const char *prompt = menu_get_prompt(menu); struct menu *child; struct symbol *active; @@ -814,9 +645,9 @@ static void conf_choice(struct menu *menu) if (!menu_is_visible(child)) continue; if (child->sym) - item_make("%s", _(menu_get_prompt(child))); + item_make("%s", menu_get_prompt(child)); else { - item_make("*** %s ***", _(menu_get_prompt(child))); + item_make("*** %s ***", menu_get_prompt(child)); item_set_tag(':'); } item_set_data(child); @@ -826,11 +657,11 @@ static void conf_choice(struct menu *menu) item_set_tag('X'); } dialog_clear(); - res = dialog_checklist(prompt ? _(prompt) : _("Main Menu"), - _(radiolist_instructions), - MENUBOX_HEIGTH_MIN, + res = dialog_checklist(prompt ? prompt : "Main Menu", + radiolist_instructions, + MENUBOX_HEIGHT_MIN, MENUBOX_WIDTH_MIN, - CHECKLIST_HEIGTH_MIN); + CHECKLIST_HEIGHT_MIN); selected = item_activate_selected(); switch (res) { case 0: @@ -868,26 +699,26 @@ static void conf_string(struct menu *menu) switch (sym_get_type(menu->sym)) { case S_INT: - heading = _(inputbox_instructions_int); + heading = inputbox_instructions_int; break; case S_HEX: - heading = _(inputbox_instructions_hex); + heading = inputbox_instructions_hex; break; case S_STRING: - heading = _(inputbox_instructions_string); + heading = inputbox_instructions_string; break; default: - heading = _("Internal mconf error!"); + heading = "Internal mconf error!"; } dialog_clear(); - res = dialog_inputbox(prompt ? _(prompt) : _("Main Menu"), + res = dialog_inputbox(prompt ? prompt : "Main Menu", heading, 10, 75, sym_get_string_value(menu->sym)); switch (res) { case 0: if (sym_set_string_value(menu->sym, dialog_input_result)) return; - show_textbox(NULL, _("You have made an invalid entry."), 5, 43); + show_textbox(NULL, "You have made an invalid entry.", 5, 43); break; case 1: show_help(menu); @@ -912,13 +743,13 @@ static void conf_load(void) return; if (!conf_read(dialog_input_result)) { set_config_filename(dialog_input_result); - sym_set_change_count(1); + conf_set_changed(true); return; } - show_textbox(NULL, _("File does not exist!"), 5, 38); + show_textbox(NULL, "File does not exist!", 5, 38); break; case 1: - show_helptext(_("Load Alternate Configuration"), load_config_help); + show_helptext("Load Alternate Configuration", load_config_help); break; case KEY_ESC: return; @@ -941,10 +772,10 @@ static void conf_save(void) set_config_filename(dialog_input_result); return; } - show_textbox(NULL, _("Can't create file! Probably a nonexistent directory."), 5, 60); + show_textbox(NULL, "Can't create file!", 5, 60); break; case 1: - show_helptext(_("Save Alternate Configuration"), save_config_help); + show_helptext("Save Alternate Configuration", save_config_help); break; case KEY_ESC: return; @@ -952,6 +783,127 @@ static void conf_save(void) } } +static void conf(struct menu *menu, struct menu *active_menu) +{ + struct menu *submenu; + const char *prompt = menu_get_prompt(menu); + struct subtitle_part stpart; + struct symbol *sym; + int res; + int s_scroll = 0; + + if (menu != &rootmenu) + stpart.text = menu_get_prompt(menu); + else + stpart.text = NULL; + list_add_tail(&stpart.entries, &trail); + + while (1) { + item_reset(); + current_menu = menu; + build_conf(menu); + if (!child_count) + break; + set_subtitle(); + dialog_clear(); + res = dialog_menu(prompt ? prompt : "Main Menu", + menu_instructions, + active_menu, &s_scroll); + if (res == 1 || res == KEY_ESC || res == -ERRDISPLAYTOOSMALL) + break; + if (item_count() != 0) { + if (!item_activate_selected()) + continue; + if (!item_tag()) + continue; + } + submenu = item_data(); + active_menu = item_data(); + if (submenu) + sym = submenu->sym; + else + sym = NULL; + + switch (res) { + case 0: + switch (item_tag()) { + case 'm': + if (single_menu_mode) + submenu->data = (void *) (long) !submenu->data; + else + conf(submenu, NULL); + break; + case 't': + if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes) + conf_choice(submenu); + else if (submenu->prompt->type == P_MENU) + conf(submenu, NULL); + break; + case 's': + conf_string(submenu); + break; + } + break; + case 2: + if (sym) + show_help(submenu); + else { + reset_subtitle(); + show_helptext("README", mconf_readme); + } + break; + case 3: + reset_subtitle(); + conf_save(); + break; + case 4: + reset_subtitle(); + conf_load(); + break; + case 5: + if (item_is_tag('t')) { + if (sym_set_tristate_value(sym, yes)) + break; + if (sym_set_tristate_value(sym, mod)) + show_textbox(NULL, setmod_text, 6, 74); + } + break; + case 6: + if (item_is_tag('t')) + sym_set_tristate_value(sym, no); + break; + case 7: + if (item_is_tag('t')) + sym_set_tristate_value(sym, mod); + break; + case 8: + if (item_is_tag('t')) + sym_toggle_tristate_value(sym); + else if (item_is_tag('m')) + conf(submenu, NULL); + break; + case 9: + search_conf(); + break; + case 10: + show_all_options = !show_all_options; + break; + } + } + + list_del(trail.prev); +} + +static void conf_message_callback(const char *s) +{ + if (save_and_exit) { + if (!silent) + printf("%s", s); + } else { + show_textbox(NULL, s, 6, 60); + } +} + static int handle_exit(void) { int res; @@ -961,8 +913,8 @@ static int handle_exit(void) dialog_clear(); if (conf_get_changed()) res = dialog_yesno(NULL, - _("Do you wish to save your new configuration?\n" - "(Press to continue Buildroot configuration.)"), + "Do you wish to save your new configuration?\n" + "(Press to continue Buildroot configuration.)", 6, 60); else res = -1; @@ -972,26 +924,27 @@ static int handle_exit(void) switch (res) { case 0: if (conf_write(filename)) { - fprintf(stderr, _("\n\n" + fprintf(stderr, "\n\n" "Error while writing of the configuration.\n" "Your configuration changes were NOT saved." - "\n\n")); + "\n\n"); return 1; } + conf_write_autoconf(0); /* fall through */ case -1: if (!silent) - printf(_("\n\n" + printf("\n\n" "*** End of the configuration.\n" "*** Execute 'make' to start the build or try 'make help'." - "\n\n")); + "\n\n"); res = 0; break; default: if (!silent) - fprintf(stderr, _("\n\n" + fprintf(stderr, "\n\n" "Your configuration changes were NOT saved." - "\n\n")); + "\n\n"); if (res != KEY_ESC) res = 0; } @@ -1009,10 +962,6 @@ int main(int ac, char **av) char *mode; int res; - setlocale(LC_ALL, ""); - bindtextdomain(PACKAGE, LOCALEDIR); - textdomain(PACKAGE); - signal(SIGINT, sig_handler); if (ac > 1 && strcmp(av[1], "-s") == 0) { @@ -1031,8 +980,8 @@ int main(int ac, char **av) } if (init_dialog(NULL)) { - fprintf(stderr, N_("Your display is too small to run Menuconfig!\n")); - fprintf(stderr, N_("It must be at least 19 lines by 80 columns.\n")); + fprintf(stderr, "Your display is too small to run Menuconfig!\n"); + fprintf(stderr, "It must be at least 19 lines by 80 columns.\n"); return 1; } diff --git a/support/kconfig/menu.c b/support/kconfig/menu.c index 5c5c1374b1..3b822cd110 100644 --- a/support/kconfig/menu.c +++ b/support/kconfig/menu.c @@ -1,6 +1,6 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2002 Roman Zippel - * Released under the terms of the GNU GPL v2.0. */ #include @@ -9,20 +9,19 @@ #include #include "lkc.h" +#include "internal.h" +#include "list.h" static const char nohelp_text[] = "There is no help available for this option."; struct menu rootmenu; static struct menu **last_entry_ptr; -struct file *file_list; -struct file *current_file; - void menu_warn(struct menu *menu, const char *fmt, ...) { va_list ap; va_start(ap, fmt); - fprintf(stderr, "%s:%d:warning: ", menu->file->name, menu->lineno); + fprintf(stderr, "%s:%d:warning: ", menu->filename, menu->lineno); vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); va_end(ap); @@ -32,7 +31,7 @@ static void prop_warn(struct property *prop, const char *fmt, ...) { va_list ap; va_start(ap, fmt); - fprintf(stderr, "%s:%d:warning: ", prop->file->name, prop->lineno); + fprintf(stderr, "%s:%d:warning: ", prop->filename, prop->lineno); vfprintf(stderr, fmt, ap); fprintf(stderr, "\n"); va_end(ap); @@ -52,20 +51,23 @@ void menu_add_entry(struct symbol *sym) memset(menu, 0, sizeof(*menu)); menu->sym = sym; menu->parent = current_menu; - menu->file = current_file; - menu->lineno = zconf_lineno(); + menu->filename = cur_filename; + menu->lineno = cur_lineno; *last_entry_ptr = menu; last_entry_ptr = &menu->next; current_entry = menu; - if (sym) + if (sym) { menu_add_symbol(P_SYMBOL, sym, NULL); + list_add_tail(&menu->link, &sym->menus); + } } struct menu *menu_add_menu(void) { last_entry_ptr = ¤t_entry->list; - return current_menu = current_entry; + current_menu = current_entry; + return current_menu; } void menu_end_menu(void) @@ -124,61 +126,76 @@ void menu_set_type(int type) sym_type_name(sym->type), sym_type_name(type)); } -static struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep) +static struct property *menu_add_prop(enum prop_type type, struct expr *expr, + struct expr *dep) { - struct property *prop = prop_alloc(type, current_entry->sym); + struct property *prop; + prop = xmalloc(sizeof(*prop)); + memset(prop, 0, sizeof(*prop)); + prop->type = type; + prop->filename = cur_filename; + prop->lineno = cur_lineno; prop->menu = current_entry; prop->expr = expr; prop->visible.expr = dep; - if (prompt) { - if (isspace(*prompt)) { - prop_warn(prop, "leading whitespace ignored"); - while (isspace(*prompt)) - prompt++; - } - if (current_entry->prompt && current_entry != &rootmenu) - prop_warn(prop, "prompt redefined"); + /* append property to the prop list of symbol */ + if (current_entry->sym) { + struct property **propp; - /* Apply all upper menus' visibilities to actual prompts. */ - if(type == P_PROMPT) { - struct menu *menu = current_entry; + for (propp = ¤t_entry->sym->prop; + *propp; + propp = &(*propp)->next) + ; + *propp = prop; + } - while ((menu = menu->parent) != NULL) { - struct expr *dup_expr; + return prop; +} - if (!menu->visibility) - continue; - /* - * Do not add a reference to the - * menu's visibility expression but - * use a copy of it. Otherwise the - * expression reduction functions - * will modify expressions that have - * multiple references which can - * cause unwanted side effects. - */ - dup_expr = expr_copy(menu->visibility); +struct property *menu_add_prompt(enum prop_type type, char *prompt, + struct expr *dep) +{ + struct property *prop = menu_add_prop(type, NULL, dep); - prop->visible.expr - = expr_alloc_and(prop->visible.expr, - dup_expr); - } - } + if (isspace(*prompt)) { + prop_warn(prop, "leading whitespace ignored"); + while (isspace(*prompt)) + prompt++; + } + if (current_entry->prompt) + prop_warn(prop, "prompt redefined"); + + /* Apply all upper menus' visibilities to actual prompts. */ + if (type == P_PROMPT) { + struct menu *menu = current_entry; + + while ((menu = menu->parent) != NULL) { + struct expr *dup_expr; - current_entry->prompt = prop; + if (!menu->visibility) + continue; + /* + * Do not add a reference to the menu's visibility + * expression but use a copy of it. Otherwise the + * expression reduction functions will modify + * expressions that have multiple references which + * can cause unwanted side effects. + */ + dup_expr = expr_copy(menu->visibility); + + prop->visible.expr = expr_alloc_and(prop->visible.expr, + dup_expr); + } } + + current_entry->prompt = prop; prop->text = prompt; return prop; } -struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep) -{ - return menu_add_prop(type, prompt, NULL, dep); -} - void menu_add_visibility(struct expr *expr) { current_entry->visibility = expr_alloc_and(current_entry->visibility, @@ -187,40 +204,12 @@ void menu_add_visibility(struct expr *expr) void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep) { - menu_add_prop(type, NULL, expr, dep); + menu_add_prop(type, expr, dep); } void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep) { - menu_add_prop(type, NULL, expr_alloc_symbol(sym), dep); -} - -void menu_add_option(int token, char *arg) -{ - switch (token) { - case T_OPT_MODULES: - if (modules_sym) - zconf_error("symbol '%s' redefines option 'modules'" - " already defined by symbol '%s'", - current_entry->sym->name, - modules_sym->name - ); - modules_sym = current_entry->sym; - break; - case T_OPT_DEFCONFIG_LIST: - if (!sym_defconfig_list) - sym_defconfig_list = current_entry->sym; - else if (sym_defconfig_list != current_entry->sym) - zconf_error("trying to redefine defconfig symbol"); - sym_defconfig_list->flags |= SYMBOL_AUTO; - break; - case T_OPT_ENV: - prop_add_env(arg); - break; - case T_OPT_ALLNOCONFIG_Y: - current_entry->sym->flags |= SYMBOL_ALLNOCONFIG_Y; - break; - } + menu_add_prop(type, expr_alloc_symbol(sym), dep); } static int menu_validate_number(struct symbol *sym, struct symbol *sym2) @@ -293,7 +282,7 @@ static void sym_check_prop(struct symbol *sym) } } -void menu_finalize(struct menu *parent) +static void _menu_finalize(struct menu *parent, bool inside_choice) { struct menu *menu, *last_menu; struct symbol *sym; @@ -307,7 +296,12 @@ void menu_finalize(struct menu *parent) * and propagate parent dependencies before moving on. */ - if (sym && sym_is_choice(sym)) { + bool is_choice = false; + + if (sym && sym_is_choice(sym)) + is_choice = true; + + if (is_choice) { if (sym->type == S_UNKNOWN) { /* find the first choice value to find out choice type */ current_entry = parent; @@ -318,12 +312,6 @@ void menu_finalize(struct menu *parent) } } } - /* set the type of the remaining choice values */ - for (menu = parent->list; menu; menu = menu->next) { - current_entry = menu; - if (menu->sym && menu->sym->type == S_UNKNOWN) - menu_set_type(sym->type); - } /* * Use the choice itself as the parent dependency of @@ -332,12 +320,10 @@ void menu_finalize(struct menu *parent) * choice value symbols. */ parentdep = expr_alloc_symbol(sym); - } else if (parent->prompt) - /* Menu node for 'menu' */ - parentdep = parent->prompt->visible.expr; - else - /* Menu node for 'if' */ + } else { + /* Menu node for 'menu', 'if' */ parentdep = parent->dep; + } /* For each child menu node... */ for (menu = parent->list; menu; menu = menu->next) { @@ -413,7 +399,7 @@ void menu_finalize(struct menu *parent) } } - if (sym && sym_is_choice(sym)) + if (is_choice) expr_free(parentdep); /* @@ -421,8 +407,8 @@ void menu_finalize(struct menu *parent) * moving on */ for (menu = parent->list; menu; menu = menu->next) - menu_finalize(menu); - } else if (sym) { + _menu_finalize(menu, is_choice); + } else if (!inside_choice && sym) { /* * Automatic submenu creation. If sym is a symbol and A, B, C, * ... are consecutive items (symbols, menus, ifs, etc.) that @@ -482,7 +468,7 @@ void menu_finalize(struct menu *parent) /* Superset, put in submenu */ expr_free(dep2); next: - menu_finalize(menu); + _menu_finalize(menu, false); menu->parent = parent; last_menu = menu; } @@ -580,9 +566,6 @@ void menu_finalize(struct menu *parent) if (sym->type == S_UNKNOWN) menu_warn(parent, "config symbol defined without type"); - if (sym_is_choice(sym) && !parent->prompt) - menu_warn(parent, "choice must have a prompt"); - /* Check properties connected to this symbol */ sym_check_prop(sym); sym->flags |= SYMBOL_WARNED; @@ -604,6 +587,11 @@ void menu_finalize(struct menu *parent) } } +void menu_finalize(void) +{ + _menu_finalize(&rootmenu, false); +} + bool menu_has_prompt(struct menu *menu) { if (!menu->prompt) @@ -674,11 +662,6 @@ const char *menu_get_prompt(struct menu *menu) return NULL; } -struct menu *menu_get_root_menu(struct menu *menu) -{ - return &rootmenu; -} - struct menu *menu_get_parent_menu(struct menu *menu) { enum prop_type type; @@ -691,17 +674,24 @@ struct menu *menu_get_parent_menu(struct menu *menu) return menu; } -bool menu_has_help(struct menu *menu) +static void get_def_str(struct gstr *r, struct menu *menu) { - return menu->help != NULL; + str_printf(r, "Defined at %s:%d\n", + menu->filename, menu->lineno); } -const char *menu_get_help(struct menu *menu) +static void get_dep_str(struct gstr *r, struct expr *expr, const char *prefix) { - if (menu->help) - return menu->help; - else - return ""; + if (!expr_is_yes(expr)) { + str_append(r, prefix); + expr_gstr_print(expr, r); + str_append(r, "\n"); + } +} + +int __attribute__((weak)) get_jump_key_char(void) +{ + return -1; } static void get_prompt_str(struct gstr *r, struct property *prop, @@ -711,66 +701,56 @@ static void get_prompt_str(struct gstr *r, struct property *prop, struct menu *submenu[8], *menu, *location = NULL; struct jump_key *jump = NULL; - str_printf(r, _("Prompt: %s\n"), _(prop->text)); - menu = prop->menu->parent; - for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) { - bool accessible = menu_is_visible(menu); + str_printf(r, " Prompt: %s\n", prop->text); + + get_dep_str(r, prop->menu->dep, " Depends on: "); + /* + * Most prompts in Linux have visibility that exactly matches their + * dependencies. For these, we print only the dependencies to improve + * readability. However, prompts with inline "if" expressions and + * prompts with a parent that has a "visible if" expression have + * differing dependencies and visibility. In these rare cases, we + * print both. + */ + if (!expr_eq(prop->menu->dep, prop->visible.expr)) + get_dep_str(r, prop->visible.expr, " Visible if: "); + menu = prop->menu; + for (i = 0; menu != &rootmenu && i < 8; menu = menu->parent) { submenu[i++] = menu; - if (location == NULL && accessible) + if (location == NULL && menu_is_visible(menu)) location = menu; } if (head && location) { jump = xmalloc(sizeof(struct jump_key)); - - if (menu_is_visible(prop->menu)) { - /* - * There is not enough room to put the hint at the - * beginning of the "Prompt" line. Put the hint on the - * last "Location" line even when it would belong on - * the former. - */ - jump->target = prop->menu; - } else - jump->target = location; - - if (list_empty(head)) - jump->index = 0; - else - jump->index = list_entry(head->prev, struct jump_key, - entries)->index + 1; - + jump->target = location; list_add_tail(&jump->entries, head); } - if (i > 0) { - str_printf(r, _(" Location:\n")); - for (j = 4; --i >= 0; j += 2) { - menu = submenu[i]; - if (jump && menu == location) - jump->offset = strlen(r->s); - str_printf(r, "%*c-> %s", j, ' ', - _(menu_get_prompt(menu))); - if (menu->sym) { - str_printf(r, " (%s [=%s])", menu->sym->name ? - menu->sym->name : _(""), - sym_get_string_value(menu->sym)); - } - str_append(r, "\n"); + str_printf(r, " Location:\n"); + for (j = 0; --i >= 0; j++) { + int jk = -1; + int indent = 2 * j + 4; + + menu = submenu[i]; + if (jump && menu == location) { + jump->offset = strlen(r->s); + jk = get_jump_key_char(); } - } -} -/* - * get property of type P_SYMBOL - */ -static struct property *get_symbol_prop(struct symbol *sym) -{ - struct property *prop = NULL; + if (jk >= 0) { + str_printf(r, "(%c)", jk); + indent -= 3; + } - for_all_properties(sym, prop, P_SYMBOL) - break; - return prop; + str_printf(r, "%*c-> %s", indent, ' ', menu_get_prompt(menu)); + if (menu->sym) { + str_printf(r, " (%s [=%s])", menu->sym->name ? + menu->sym->name : "", + sym_get_string_value(menu->sym)); + } + str_append(r, "\n"); + } } static void get_symbol_props_str(struct gstr *r, struct symbol *sym, @@ -798,6 +778,7 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym, struct list_head *head) { struct property *prop; + struct menu *menu; if (sym && sym->name) { str_printf(r, "Symbol: %s [=%s]\n", sym->name, @@ -812,32 +793,34 @@ static void get_symbol_str(struct gstr *r, struct symbol *sym, } } } - for_all_prompts(sym, prop) - get_prompt_str(r, prop, head); - - prop = get_symbol_prop(sym); - if (prop) { - str_printf(r, _(" Defined at %s:%d\n"), prop->menu->file->name, - prop->menu->lineno); - if (!expr_is_yes(prop->visible.expr)) { - str_append(r, _(" Depends on: ")); - expr_gstr_print(prop->visible.expr, r); - str_append(r, "\n"); + + /* Print the definitions with prompts before the ones without */ + list_for_each_entry(menu, &sym->menus, link) { + if (menu->prompt) { + get_def_str(r, menu); + get_prompt_str(r, menu->prompt, head); + } + } + + list_for_each_entry(menu, &sym->menus, link) { + if (!menu->prompt) { + get_def_str(r, menu); + get_dep_str(r, menu->dep, " Depends on: "); } } - get_symbol_props_str(r, sym, P_SELECT, _(" Selects: ")); + get_symbol_props_str(r, sym, P_SELECT, "Selects: "); if (sym->rev_dep.expr) { - expr_gstr_print_revdep(sym->rev_dep.expr, r, yes, " Selected by [y]:\n"); - expr_gstr_print_revdep(sym->rev_dep.expr, r, mod, " Selected by [m]:\n"); - expr_gstr_print_revdep(sym->rev_dep.expr, r, no, " Selected by [n]:\n"); + expr_gstr_print_revdep(sym->rev_dep.expr, r, yes, "Selected by [y]:\n"); + expr_gstr_print_revdep(sym->rev_dep.expr, r, mod, "Selected by [m]:\n"); + expr_gstr_print_revdep(sym->rev_dep.expr, r, no, "Selected by [n]:\n"); } - get_symbol_props_str(r, sym, P_IMPLY, _(" Implies: ")); + get_symbol_props_str(r, sym, P_IMPLY, "Implies: "); if (sym->implied.expr) { - expr_gstr_print_revdep(sym->implied.expr, r, yes, " Implied by [y]:\n"); - expr_gstr_print_revdep(sym->implied.expr, r, mod, " Implied by [m]:\n"); - expr_gstr_print_revdep(sym->implied.expr, r, no, " Implied by [n]:\n"); + expr_gstr_print_revdep(sym->implied.expr, r, yes, "Implied by [y]:\n"); + expr_gstr_print_revdep(sym->implied.expr, r, mod, "Implied by [m]:\n"); + expr_gstr_print_revdep(sym->implied.expr, r, no, "Implied by [n]:\n"); } str_append(r, "\n\n"); @@ -852,7 +835,7 @@ struct gstr get_relations_str(struct symbol **sym_arr, struct list_head *head) for (i = 0; sym_arr && (sym = sym_arr[i]); i++) get_symbol_str(&res, sym, head); if (!i) - str_append(&res, _("No matches found.\n")); + str_append(&res, "No matches found.\n"); return res; } @@ -862,12 +845,12 @@ void menu_get_ext_help(struct menu *menu, struct gstr *help) struct symbol *sym = menu->sym; const char *help_text = nohelp_text; - if (menu_has_help(menu)) { + if (menu->help) { if (sym->name) str_printf(help, "%s%s:\n\n", CONFIG_, sym->name); - help_text = menu_get_help(menu); + help_text = menu->help; } - str_printf(help, "%s\n", _(help_text)); + str_printf(help, "%s\n", help_text); if (sym) get_symbol_str(help, sym, NULL); } diff --git a/support/kconfig/merge_config.sh b/support/kconfig/merge_config.sh index 14917806a3..a5c03487c3 100755 --- a/support/kconfig/merge_config.sh +++ b/support/kconfig/merge_config.sh @@ -1,4 +1,6 @@ #!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# # merge_config.sh - Takes a list of config fragment values, and merges # them one by one. Provides warnings on overridden values, and specified # values that did not make it to the resulting .config file (due to missed @@ -10,21 +12,13 @@ # # Copyright (c) 2009-2010 Wind River Systems, Inc. # Copyright 2011 Linaro -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 2 as -# published by the Free Software Foundation. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. + +set -e clean_up() { rm -f $TMP_FILE - exit + rm -f $MERGE_FILE } -trap clean_up HUP INT TERM usage() { echo "Usage: $0 [OPTIONS] [CONFIG [...]]" @@ -32,18 +26,23 @@ usage() { echo " -m only merge the fragments, do not execute the make command" echo " -n use allnoconfig instead of alldefconfig" echo " -r list redundant entries when merging fragments" + echo " -y make builtin have precedence over modules" echo " -O dir to put generated output files. Consider setting \$KCONFIG_CONFIG instead." + echo " -s strict mode. Fail if the fragment redefines any value." + echo " -Q disable warning messages for overridden options." echo " -e colon-separated list of br2-external trees to use (optional)" echo - echo "Used prefix: '$CONFIG_PREFIX'. You can redefine it with \$CONFIG_ - environment variable." + echo "Used prefix: '$CONFIG_PREFIX'. You can redefine it with \$CONFIG_ environment variable." } RUNMAKE=true ALLTARGET=alldefconfig WARNREDUN=false +BUILTIN=false OUTPUT=. +STRICT=false CONFIG_PREFIX=${CONFIG_-CONFIG_} +WARNOVERRIDE=echo while true; do case $1 in @@ -66,6 +65,11 @@ while true; do shift continue ;; + "-y") + BUILTIN=true + shift + continue + ;; "-O") if [ -d $2 ];then OUTPUT=$(echo $2 | sed 's/\/*$//') @@ -76,6 +80,16 @@ while true; do shift 2 continue ;; + "-s") + STRICT=true + shift + continue + ;; + "-Q") + WARNOVERRIDE=true + shift + continue + ;; "-e") EXTERNAL_ARG="BR2_EXTERNAL=$2" shift 2 @@ -113,42 +127,65 @@ SED_CONFIG_EXP1="s/^\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)=.*/\1/p" SED_CONFIG_EXP2="s/^# \(${CONFIG_PREFIX}[a-zA-Z0-9_]*\) is not set$/\1/p" TMP_FILE=$(mktemp -t .tmp.config.XXXXXXXXXX) +MERGE_FILE=$(mktemp -t .merge_tmp.config.XXXXXXXXXX) echo "Using $INITFILE as base" + +trap clean_up EXIT + cat $INITFILE > $TMP_FILE # Merge files, printing warnings on overridden values -for MERGE_FILE in $MERGE_LIST ; do - echo "Merging $MERGE_FILE" - if [ ! -r "$MERGE_FILE" ]; then - echo "The merge file '$MERGE_FILE' does not exist. Exit." >&2 +for ORIG_MERGE_FILE in $MERGE_LIST ; do + echo "Merging $ORIG_MERGE_FILE" + if [ ! -r "$ORIG_MERGE_FILE" ]; then + echo "The merge file '$ORIG_MERGE_FILE' does not exist. Exit." >&2 exit 1 fi + cat $ORIG_MERGE_FILE > $MERGE_FILE CFG_LIST=$(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $MERGE_FILE) for CFG in $CFG_LIST ; do grep -q -w $CFG $TMP_FILE || continue PREV_VAL=$(grep -w $CFG $TMP_FILE) NEW_VAL=$(grep -w $CFG $MERGE_FILE) - if [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then - echo Value of $CFG is redefined by fragment $MERGE_FILE: - echo Previous value: $PREV_VAL - echo New value: $NEW_VAL - echo + BUILTIN_FLAG=false + if [ "$BUILTIN" = "true" ] && [ "${NEW_VAL#CONFIG_*=}" = "m" ] && [ "${PREV_VAL#CONFIG_*=}" = "y" ]; then + ${WARNOVERRIDE} Previous value: $PREV_VAL + ${WARNOVERRIDE} New value: $NEW_VAL + ${WARNOVERRIDE} -y passed, will not demote y to m + ${WARNOVERRIDE} + BUILTIN_FLAG=true + elif [ "x$PREV_VAL" != "x$NEW_VAL" ] ; then + ${WARNOVERRIDE} Value of $CFG is redefined by fragment $ORIG_MERGE_FILE: + ${WARNOVERRIDE} Previous value: $PREV_VAL + ${WARNOVERRIDE} New value: $NEW_VAL + ${WARNOVERRIDE} + if [ "$STRICT" = "true" ]; then + STRICT_MODE_VIOLATED=true + fi elif [ "$WARNREDUN" = "true" ]; then - echo Value of $CFG is redundant by fragment $MERGE_FILE: + ${WARNOVERRIDE} Value of $CFG is redundant by fragment $ORIG_MERGE_FILE: + fi + if [ "$BUILTIN_FLAG" = "false" ]; then + sed -i "/$CFG[ =]/d" $TMP_FILE + else + sed -i "/$CFG[ =]/d" $MERGE_FILE fi - sed -i "/$CFG[ =]/d" $TMP_FILE done cat $MERGE_FILE >> $TMP_FILE done +if [ "$STRICT_MODE_VIOLATED" = "true" ]; then + echo "The fragment redefined a value and strict mode had been passed." + exit 1 +fi + if [ "$RUNMAKE" = "false" ]; then cp -T -- "$TMP_FILE" "$KCONFIG_CONFIG" echo "#" echo "# merged configuration written to $KCONFIG_CONFIG (needs make)" echo "#" - clean_up exit fi @@ -170,7 +207,7 @@ make KCONFIG_ALLCONFIG=$TMP_FILE $EXTERNAL_ARG $OUTPUT_ARG $ALLTARGET for CFG in $(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $TMP_FILE); do REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) - ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG") + ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG" || true) if [ "x$REQUESTED_VAL" != "x$ACTUAL_VAL" ] ; then echo "Value requested for $CFG not in final .config" echo "Requested value: $REQUESTED_VAL" @@ -178,5 +215,3 @@ for CFG in $(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $TMP_FILE); do echo "" fi done - -clean_up diff --git a/support/kconfig/mnconf-common.c b/support/kconfig/mnconf-common.c new file mode 100644 index 0000000000..18cb9a6c5a --- /dev/null +++ b/support/kconfig/mnconf-common.c @@ -0,0 +1,53 @@ +// SPDX-License-Identifier: GPL-2.0-only +#include "expr.h" +#include "list.h" +#include "mnconf-common.h" + +int jump_key_char; + +int next_jump_key(int key) +{ + if (key < '1' || key > '9') + return '1'; + + key++; + + if (key > '9') + key = '1'; + + return key; +} + +int handle_search_keys(int key, size_t start, size_t end, void *_data) +{ + struct search_data *data = _data; + struct jump_key *pos; + int index = 0; + + if (key < '1' || key > '9') + return 0; + + list_for_each_entry(pos, data->head, entries) { + index = next_jump_key(index); + + if (pos->offset < start) + continue; + + if (pos->offset >= end) + break; + + if (key == index) { + data->target = pos->target; + return 1; + } + } + + return 0; +} + +int get_jump_key_char(void) +{ + jump_key_char = next_jump_key(jump_key_char); + + return jump_key_char; +} diff --git a/support/kconfig/mnconf-common.h b/support/kconfig/mnconf-common.h new file mode 100644 index 0000000000..ab6292cc4b --- /dev/null +++ b/support/kconfig/mnconf-common.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef MNCONF_COMMON_H +#define MNCONF_COMMON_H + +#include + +struct search_data { + struct list_head *head; + struct menu *target; +}; + +extern int jump_key_char; + +int next_jump_key(int key); +int handle_search_keys(int key, size_t start, size_t end, void *_data); +int get_jump_key_char(void); + +#endif /* MNCONF_COMMON_H */ diff --git a/support/kconfig/nconf-cfg.sh b/support/kconfig/nconf-cfg.sh new file mode 100755 index 0000000000..f871a2160e --- /dev/null +++ b/support/kconfig/nconf-cfg.sh @@ -0,0 +1,53 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 + +cflags=$1 +libs=$2 + +PKG="ncursesw menuw panelw" +PKG2="ncurses menu panel" + +if [ -n "$(command -v ${HOSTPKG_CONFIG})" ]; then + if ${HOSTPKG_CONFIG} --exists $PKG; then + ${HOSTPKG_CONFIG} --cflags ${PKG} > ${cflags} + ${HOSTPKG_CONFIG} --libs ${PKG} > ${libs} + exit 0 + fi + + if ${HOSTPKG_CONFIG} --exists $PKG2; then + ${HOSTPKG_CONFIG} --cflags ${PKG2} > ${cflags} + ${HOSTPKG_CONFIG} --libs ${PKG2} > ${libs} + exit 0 + fi +fi + +# Check the default paths in case pkg-config is not installed. +# (Even if it is installed, some distributions such as openSUSE cannot +# find ncurses by pkg-config.) +if [ -f /usr/include/ncursesw/ncurses.h ]; then + echo -D_GNU_SOURCE -I/usr/include/ncursesw > ${cflags} + echo -lncursesw -lmenuw -lpanelw > ${libs} + exit 0 +fi + +if [ -f /usr/include/ncurses/ncurses.h ]; then + echo -D_GNU_SOURCE -I/usr/include/ncurses > ${cflags} + echo -lncurses -lmenu -lpanel > ${libs} + exit 0 +fi + +if [ -f /usr/include/ncurses.h ]; then + echo -D_GNU_SOURCE > ${cflags} + echo -lncurses -lmenu -lpanel > ${libs} + exit 0 +fi + +echo >&2 "*" +echo >&2 "* Unable to find the ncurses package." +echo >&2 "* Install ncurses (ncurses-devel or libncurses-dev" +echo >&2 "* depending on your distribution)." +echo >&2 "*" +echo >&2 "* You may also need to install ${HOSTPKG_CONFIG} to find the" +echo >&2 "* ncurses installed in a non-default location." +echo >&2 "*" +exit 1 diff --git a/support/kconfig/nconf.c b/support/kconfig/nconf.c index 0031147798..9d22b0f319 100644 --- a/support/kconfig/nconf.c +++ b/support/kconfig/nconf.c @@ -1,21 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0 /* - * Copyright (C) 2008 Nir Tzachar * * Derived from menuconfig. - * */ #ifndef _GNU_SOURCE #define _GNU_SOURCE #endif #include +#include #include +#include "list.h" #include "lkc.h" +#include "mnconf-common.h" #include "nconf.h" #include -static const char nconf_global_help[] = N_( +static const char nconf_global_help[] = "Help windows\n" "------------\n" "o Global help: Unless in a data entry window, pressing will give \n" @@ -52,8 +54,8 @@ static const char nconf_global_help[] = N_( "\n" "Menu navigation keys\n" "----------------------------------------------------------------------\n" -"Linewise up \n" -"Linewise down \n" +"Linewise up \n" +"Linewise down \n" "Pagewise up \n" "Pagewise down \n" "First entry \n" @@ -130,8 +132,8 @@ static const char nconf_global_help[] = N_( "\n" "Note that this mode can eventually be a little more CPU expensive than\n" "the default mode, especially with a larger number of unfolded submenus.\n" -"\n"), -menu_no_f_instructions[] = N_( +"\n", +menu_no_f_instructions[] = "Legend: [*] built-in [ ] excluded module < > module capable.\n" "Submenus are designated by a trailing \"--->\", empty ones by \"----\".\n" "\n" @@ -147,8 +149,8 @@ menu_no_f_instructions[] = N_( "You do not have function keys support.\n" "Press <1> instead of , <2> instead of , etc.\n" "For verbose global help use key <1>.\n" -"For help related to the current menu entry press or .\n"), -menu_instructions[] = N_( +"For help related to the current menu entry press or .\n", +menu_instructions[] = "Legend: [*] built-in [ ] excluded module < > module capable.\n" "Submenus are designated by a trailing \"--->\", empty ones by \"----\".\n" "\n" @@ -163,30 +165,30 @@ menu_instructions[] = N_( "\n" "Pressing <1> may be used instead of , <2> instead of , etc.\n" "For verbose global help press .\n" -"For help related to the current menu entry press or .\n"), -radiolist_instructions[] = N_( +"For help related to the current menu entry press or .\n", +radiolist_instructions[] = "Press , , or to navigate a radiolist, select\n" "with .\n" "For help related to the current entry press or .\n" -"For global help press .\n"), -inputbox_instructions_int[] = N_( +"For global help press .\n", +inputbox_instructions_int[] = "Please enter a decimal value.\n" "Fractions will not be accepted.\n" -"Press to apply, to cancel."), -inputbox_instructions_hex[] = N_( +"Press to apply, to cancel.", +inputbox_instructions_hex[] = "Please enter a hexadecimal value.\n" -"Press to apply, to cancel."), -inputbox_instructions_string[] = N_( +"Press to apply, to cancel.", +inputbox_instructions_string[] = "Please enter a string value.\n" -"Press to apply, to cancel."), -setmod_text[] = N_( +"Press to apply, to cancel.", +setmod_text[] = "This feature depends on another feature which has been configured as a\n" -"module. As a result, the current feature will be built as a module too."), -load_config_text[] = N_( +"module. As a result, the current feature will be built as a module too.", +load_config_text[] = "Enter the name of the configuration file you wish to load.\n" "Accept the name shown to restore the configuration you last\n" -"retrieved. Leave empty to abort."), -load_config_help[] = N_( +"retrieved. Leave empty to abort.", +load_config_help[] = "For various reasons, one may wish to keep several different\n" "configurations available on a single machine.\n" "\n" @@ -194,11 +196,11 @@ load_config_help[] = N_( "default one, entering its name here will allow you to load and modify\n" "that configuration.\n" "\n" -"Leave empty to abort.\n"), -save_config_text[] = N_( +"Leave empty to abort.\n", +save_config_text[] = "Enter a filename to which this configuration should be saved\n" -"as an alternate. Leave empty to abort."), -save_config_help[] = N_( +"as an alternate. Leave empty to abort.", +save_config_help[] = "For various reasons, one may wish to keep several different\n" "configurations available on a single machine.\n" "\n" @@ -206,8 +208,8 @@ save_config_help[] = N_( "and use the current configuration as an alternate to whatever\n" "configuration options you have selected at that time.\n" "\n" -"Leave empty to abort.\n"), -search_help[] = N_( +"Leave empty to abort.\n", +search_help[] = "Search for symbols (configuration variable names CONFIG_*) and display\n" "their relations. Regular expressions are supported.\n" "Example: Search for \"^FOO\".\n" @@ -216,11 +218,11 @@ search_help[] = N_( "Symbol: FOO [ = m]\n" "Prompt: Foo bus is used to drive the bar HW\n" "Defined at drivers/pci/Kconfig:47\n" -"Depends on: X86_LOCAL_APIC && X86_IO_APIC || IA64\n" +"Depends on: X86_LOCAL_APIC && X86_IO_APIC\n" "Location:\n" " -> Bus options (PCI, PCMCIA, EISA, ISA)\n" " -> PCI support (PCI [ = y])\n" -" -> PCI access mode ( [ = y])\n" +"(1) -> PCI access mode ( [ = y])\n" "Selects: LIBCRC32\n" "Selected by: BAR\n" "-----------------------------------------------------------------\n" @@ -231,9 +233,13 @@ search_help[] = N_( "o The 'Depends on:' line lists symbols that need to be defined for\n" " this symbol to be visible and selectable in the menu.\n" "o The 'Location:' lines tell, where in the menu structure this symbol\n" -" is located. A location followed by a [ = y] indicates that this is\n" -" a selectable menu item, and the current value is displayed inside\n" -" brackets.\n" +" is located.\n" +" A location followed by a [ = y] indicates that this is\n" +" a selectable menu item, and the current value is displayed inside\n" +" brackets.\n" +" Press the key in the (#) prefix to jump directly to that\n" +" location. You will be returned to the current search results\n" +" after exiting this new menu.\n" "o The 'Selects:' line tells, what symbol will be automatically selected\n" " if this symbol is selected (y or m).\n" "o The 'Selected by' line tells what symbol has selected this symbol.\n" @@ -244,7 +250,7 @@ search_help[] = N_( "USB => find all symbols containing USB\n" "^USB => find all symbols starting with USB\n" "USB$ => find all symbols ending with USB\n" -"\n"); +"\n"; struct mitem { char str[256]; @@ -268,7 +274,7 @@ static int mwin_max_cols; static MENU *curses_menu; static ITEM *curses_menu_items[MAX_MENU_ITEMS]; static struct mitem k_menu_items[MAX_MENU_ITEMS]; -static int items_num; +static unsigned int items_num; static int global_exit; /* the currently selected button */ static const char *current_instructions = menu_instructions; @@ -276,6 +282,7 @@ static const char *current_instructions = menu_instructions; static char *dialog_input_result; static int dialog_input_result_len; +static void selected_conf(struct menu *menu, struct menu *active_menu); static void conf(struct menu *menu); static void conf_choice(struct menu *menu); static void conf_string(struct menu *menu); @@ -370,25 +377,25 @@ static void print_function_line(void) int lines = getmaxy(stdscr); for (i = 0; i < function_keys_num; i++) { - (void) wattrset(main_window, attributes[FUNCTION_HIGHLIGHT]); + wattrset(main_window, attr_function_highlight); mvwprintw(main_window, lines-3, offset, "%s", function_keys[i].key_str); - (void) wattrset(main_window, attributes[FUNCTION_TEXT]); + wattrset(main_window, attr_function_text); offset += strlen(function_keys[i].key_str); mvwprintw(main_window, lines-3, offset, "%s", function_keys[i].func); offset += strlen(function_keys[i].func) + skip; } - (void) wattrset(main_window, attributes[NORMAL]); + wattrset(main_window, attr_normal); } /* help */ static void handle_f1(int *key, struct menu *current_item) { show_scroll_win(main_window, - _("Global help"), _(nconf_global_help)); + "Global help", nconf_global_help); return; } @@ -403,8 +410,8 @@ static void handle_f2(int *key, struct menu *current_item) static void handle_f3(int *key, struct menu *current_item) { show_scroll_win(main_window, - _("Short help"), - _(current_instructions)); + "Short help", + current_instructions); return; } @@ -412,7 +419,7 @@ static void handle_f3(int *key, struct menu *current_item) static void handle_f4(int *key, struct menu *current_item) { int res = btn_dialog(main_window, - _("Show all symbols?"), + "Show all symbols?", 2, " ", ""); @@ -496,16 +503,20 @@ typedef enum {MATCH_TINKER_PATTERN_UP, MATCH_TINKER_PATTERN_DOWN, /* return the index of the matched item, or -1 if no such item exists */ static int get_mext_match(const char *match_str, match_f flag) { - int match_start = item_index(current_item(curses_menu)); - int index; + int match_start, index; + + /* Do not search if the menu is empty (i.e. items_num == 0) */ + match_start = item_index(current_item(curses_menu)); + if (match_start == ERR) + return -1; if (flag == FIND_NEXT_MATCH_DOWN) ++match_start; else if (flag == FIND_NEXT_MATCH_UP) --match_start; + match_start = (match_start + items_num) % items_num; index = match_start; - index = (index + items_num) % items_num; while (true) { char *str = k_menu_items[index].str; if (strcasestr(str, match_str) != NULL) @@ -627,19 +638,12 @@ static int item_is_tag(char tag) static char filename[PATH_MAX+1]; static char menu_backtitle[PATH_MAX+128]; -static const char *set_config_filename(const char *config_filename) +static void set_config_filename(const char *config_filename) { - int size; + snprintf(menu_backtitle, sizeof(menu_backtitle), "%s - %s", + config_filename, rootmenu.prompt->text); - size = snprintf(menu_backtitle, sizeof(menu_backtitle), - "%s - %s", config_filename, rootmenu.prompt->text); - if (size >= sizeof(menu_backtitle)) - menu_backtitle[sizeof(menu_backtitle)-1] = '\0'; - - size = snprintf(filename, sizeof(filename), "%s", config_filename); - if (size >= sizeof(filename)) - filename[sizeof(filename)-1] = '\0'; - return menu_backtitle; + snprintf(filename, sizeof(filename), "%s", config_filename); } /* return = 0 means we are successful. @@ -653,8 +657,8 @@ static int do_exit(void) return 0; } res = btn_dialog(main_window, - _("Do you wish to save your new configuration?\n" - " to cancel and resume nconfig."), + "Do you wish to save your new configuration?\n" + " to cancel and resume nconfig.", 2, " ", ""); @@ -670,15 +674,16 @@ static int do_exit(void) if (res) btn_dialog( main_window, - _("Error during writing of configuration.\n" - "Your configuration changes were NOT saved."), + "Error during writing of configuration.\n" + "Your configuration changes were NOT saved.", 1, ""); + conf_write_autoconf(0); break; default: btn_dialog( main_window, - _("Your configuration changes were NOT saved."), + "Your configuration changes were NOT saved.", 1, ""); break; @@ -694,15 +699,16 @@ static void search_conf(void) struct gstr res; struct gstr title; char *dialog_input; - int dres; + int dres, vscroll = 0, hscroll = 0; + bool again; title = str_new(); - str_printf( &title, _("Enter (sub)string or regexp to search for " - "(with or without \"%s\")"), CONFIG_); + str_printf( &title, "Enter (sub)string or regexp to search for " + "(with or without \"%s\")", CONFIG_); again: dres = dialog_inputbox(main_window, - _("Search Configuration Parameter"), + "Search Configuration Parameter", str_get(&title), "", &dialog_input_result, &dialog_input_result_len); switch (dres) { @@ -710,7 +716,7 @@ again: break; case 1: show_scroll_win(main_window, - _("Search Configuration"), search_help); + "Search Configuration", search_help); goto again; default: str_free(&title); @@ -723,11 +729,28 @@ again: dialog_input += strlen(CONFIG_); sym_arr = sym_re_search(dialog_input); - res = get_relations_str(sym_arr, NULL); + + do { + LIST_HEAD(head); + struct search_data data = { + .head = &head, + .target = NULL, + }; + jump_key_char = 0; + res = get_relations_str(sym_arr, &head); + dres = show_scroll_win_ext(main_window, + "Search Results", str_get(&res), + &vscroll, &hscroll, + handle_search_keys, &data); + again = false; + if (dres >= '1' && dres <= '9') { + assert(data.target != NULL); + selected_conf(data.target->parent, data.target); + again = true; + } + str_free(&res); + } while (again); free(sym_arr); - show_scroll_win(main_window, - _("Search Results"), str_get(&res)); - str_free(&res); str_free(&title); } @@ -754,7 +777,6 @@ static void build_conf(struct menu *menu) switch (ptype) { case P_MENU: child_count++; - prompt = _(prompt); if (single_menu_mode) { item_make(menu, 'm', "%s%*c%s", @@ -775,7 +797,7 @@ static void build_conf(struct menu *menu) item_make(menu, ':', " %*c*** %s ***", indent + 1, ' ', - _(prompt)); + prompt); } break; default: @@ -783,7 +805,7 @@ static void build_conf(struct menu *menu) child_count++; item_make(menu, ':', "---%*c%s", indent + 1, ' ', - _(prompt)); + prompt); } } } else @@ -803,7 +825,7 @@ static void build_conf(struct menu *menu) } val = sym_get_tristate_value(sym); - if (sym_is_changable(sym)) { + if (sym_is_changeable(sym)) { switch (type) { case S_BOOLEAN: item_make(menu, 't', "[%c]", @@ -829,11 +851,11 @@ static void build_conf(struct menu *menu) } item_add_str("%*c%s", indent + 1, - ' ', _(menu_get_prompt(menu))); + ' ', menu_get_prompt(menu)); if (val == yes) { if (def_menu) { item_add_str(" (%s)", - _(menu_get_prompt(def_menu))); + menu_get_prompt(def_menu)); item_add_str(" --->"); if (def_menu->list) { indent += 2; @@ -847,7 +869,7 @@ static void build_conf(struct menu *menu) if (menu == current_menu) { item_make(menu, ':', "---%*c%s", indent + 1, - ' ', _(menu_get_prompt(menu))); + ' ', menu_get_prompt(menu)); goto conf_childs; } child_count++; @@ -857,7 +879,7 @@ static void build_conf(struct menu *menu) } else { switch (type) { case S_BOOLEAN: - if (sym_is_changable(sym)) + if (sym_is_changeable(sym)) item_make(menu, 't', "[%c]", val == no ? ' ' : '*'); else @@ -876,7 +898,7 @@ static void build_conf(struct menu *menu) ch = ' '; break; } - if (sym_is_changable(sym)) { + if (sym_is_changeable(sym)) { if (sym->rev_dep.tri == mod) item_make(menu, 't', "{%c}", ch); @@ -894,17 +916,17 @@ static void build_conf(struct menu *menu) if (tmp < 0) tmp = 0; item_add_str("%*c%s%s", tmp, ' ', - _(menu_get_prompt(menu)), + menu_get_prompt(menu), (sym_has_value(sym) || - !sym_is_changable(sym)) ? "" : - _(" (NEW)")); + !sym_is_changeable(sym)) ? "" : + " (NEW)"); goto conf_childs; } } item_add_str("%*c%s%s", indent + 1, ' ', - _(menu_get_prompt(menu)), - (sym_has_value(sym) || !sym_is_changable(sym)) ? - "" : _(" (NEW)")); + menu_get_prompt(menu), + (sym_has_value(sym) || !sym_is_changeable(sym)) ? + "" : " (NEW)"); if (menu->prompt && menu->prompt->type == P_MENU) { item_add_str(" %s", menu_is_empty(menu) ? "----" : "--->"); return; @@ -956,16 +978,15 @@ static void show_menu(const char *prompt, const char *instructions, current_instructions = instructions; clear(); - (void) wattrset(main_window, attributes[NORMAL]); - print_in_middle(stdscr, 1, 0, getmaxx(stdscr), + print_in_middle(stdscr, 1, getmaxx(stdscr), menu_backtitle, - attributes[MAIN_HEADING]); + attr_main_heading); - (void) wattrset(main_window, attributes[MAIN_MENU_BOX]); + wattrset(main_window, attr_main_menu_box); box(main_window, 0, 0); - (void) wattrset(main_window, attributes[MAIN_MENU_HEADING]); + wattrset(main_window, attr_main_menu_heading); mvwprintw(main_window, 0, 3, " %s ", prompt); - (void) wattrset(main_window, attributes[NORMAL]); + wattrset(main_window, attr_normal); set_menu_items(curses_menu, curses_menu_items); @@ -1048,7 +1069,7 @@ static int do_match(int key, struct match_state *state, int *ans) state->match_direction = FIND_NEXT_MATCH_UP; *ans = get_mext_match(state->pattern, state->match_direction); - } else if (key == KEY_BACKSPACE || key == 127) { + } else if (key == KEY_BACKSPACE || key == 8 || key == 127) { state->pattern[strlen(state->pattern)-1] = '\0'; adj_match_dir(&state->match_direction); } else @@ -1066,11 +1087,15 @@ static int do_match(int key, struct match_state *state, int *ans) } static void conf(struct menu *menu) +{ + selected_conf(menu, NULL); +} + +static void selected_conf(struct menu *menu, struct menu *active_menu) { struct menu *submenu = NULL; - const char *prompt = menu_get_prompt(menu); struct symbol *sym; - int res; + int i, res; int current_index = 0; int last_top_row = 0; struct match_state match_state = { @@ -1086,9 +1111,21 @@ static void conf(struct menu *menu) if (!child_count) break; - show_menu(prompt ? _(prompt) : _("Main Menu"), - _(menu_instructions), - current_index, &last_top_row); + if (active_menu != NULL) { + for (i = 0; i < items_num; i++) { + struct mitem *mcur; + + mcur = (struct mitem *) item_userptr(curses_menu_items[i]); + if ((struct menu *) mcur->usrptr == active_menu) { + current_index = i; + break; + } + } + active_menu = NULL; + } + + show_menu(menu_get_prompt(menu), menu_instructions, + current_index, &last_top_row); keypad((menu_win(curses_menu)), TRUE); while (!global_exit) { if (match_state.in_search) { @@ -1111,9 +1148,11 @@ static void conf(struct menu *menu) break; switch (res) { case KEY_DOWN: + case 'j': menu_driver(curses_menu, REQ_DOWN_ITEM); break; case KEY_UP: + case 'k': menu_driver(curses_menu, REQ_UP_ITEM); break; case KEY_NPAGE: @@ -1210,12 +1249,9 @@ static void conf(struct menu *menu) } } -static void conf_message_callback(const char *fmt, va_list ap) +static void conf_message_callback(const char *s) { - char buf[1024]; - - vsnprintf(buf, sizeof(buf), fmt, ap); - btn_dialog(main_window, buf, 1, ""); + btn_dialog(main_window, s, 1, ""); } static void show_help(struct menu *menu) @@ -1227,13 +1263,13 @@ static void show_help(struct menu *menu) help = str_new(); menu_get_ext_help(menu, &help); - show_scroll_win(main_window, _(menu_get_prompt(menu)), str_get(&help)); + show_scroll_win(main_window, menu_get_prompt(menu), str_get(&help)); str_free(&help); } static void conf_choice(struct menu *menu) { - const char *prompt = _(menu_get_prompt(menu)); + const char *prompt = menu_get_prompt(menu); struct menu *child = NULL; struct symbol *active; int selected_index = 0; @@ -1256,13 +1292,13 @@ static void conf_choice(struct menu *menu) if (child->sym == sym_get_choice_value(menu->sym)) item_make(child, ':', " %s", - _(menu_get_prompt(child))); + menu_get_prompt(child)); else if (child->sym) item_make(child, ':', " %s", - _(menu_get_prompt(child))); + menu_get_prompt(child)); else item_make(child, ':', "*** %s ***", - _(menu_get_prompt(child))); + menu_get_prompt(child)); if (child->sym == active){ last_top_row = top_row(curses_menu); @@ -1270,8 +1306,8 @@ static void conf_choice(struct menu *menu) } i++; } - show_menu(prompt ? _(prompt) : _("Choice Menu"), - _(radiolist_instructions), + show_menu(prompt ? prompt : "Choice Menu", + radiolist_instructions, selected_index, &last_top_row); while (!global_exit) { @@ -1296,9 +1332,11 @@ static void conf_choice(struct menu *menu) break; switch (res) { case KEY_DOWN: + case 'j': menu_driver(curses_menu, REQ_DOWN_ITEM); break; case KEY_UP: + case 'k': menu_driver(curses_menu, REQ_UP_ITEM); break; case KEY_NPAGE: @@ -1358,19 +1396,19 @@ static void conf_string(struct menu *menu) switch (sym_get_type(menu->sym)) { case S_INT: - heading = _(inputbox_instructions_int); + heading = inputbox_instructions_int; break; case S_HEX: - heading = _(inputbox_instructions_hex); + heading = inputbox_instructions_hex; break; case S_STRING: - heading = _(inputbox_instructions_string); + heading = inputbox_instructions_string; break; default: - heading = _("Internal nconf error!"); + heading = "Internal nconf error!"; } res = dialog_inputbox(main_window, - prompt ? _(prompt) : _("Main Menu"), + prompt ? prompt : "Main Menu", heading, sym_get_string_value(menu->sym), &dialog_input_result, @@ -1381,7 +1419,7 @@ static void conf_string(struct menu *menu) dialog_input_result)) return; btn_dialog(main_window, - _("You have made an invalid entry."), 0); + "You have made an invalid entry.", 0); break; case 1: show_help(menu); @@ -1407,14 +1445,14 @@ static void conf_load(void) return; if (!conf_read(dialog_input_result)) { set_config_filename(dialog_input_result); - sym_set_change_count(1); + conf_set_changed(true); return; } - btn_dialog(main_window, _("File does not exist!"), 0); + btn_dialog(main_window, "File does not exist!", 0); break; case 1: show_scroll_win(main_window, - _("Load Alternate Configuration"), + "Load Alternate Configuration", load_config_help); break; case KEY_EXIT: @@ -1441,13 +1479,12 @@ static void conf_save(void) set_config_filename(dialog_input_result); return; } - btn_dialog(main_window, _("Can't create file! " - "Probably a nonexistent directory."), + btn_dialog(main_window, "Can't create file!", 1, ""); break; case 1: show_scroll_win(main_window, - _("Save Alternate Configuration"), + "Save Alternate Configuration", save_config_help); break; case KEY_EXIT: @@ -1480,10 +1517,6 @@ int main(int ac, char **av) int lines, columns; char *mode; - setlocale(LC_ALL, ""); - bindtextdomain(PACKAGE, LOCALEDIR); - textdomain(PACKAGE); - if (ac > 1 && strcmp(av[1], "-s") == 0) { /* Silence conf_read() until the real callback is set up */ conf_set_message_callback(NULL); @@ -1531,9 +1564,9 @@ int main(int ac, char **av) menu_opts_on(curses_menu, O_NONCYCLIC); menu_opts_on(curses_menu, O_IGNORECASE); set_menu_mark(curses_menu, " "); - set_menu_fore(curses_menu, attributes[MAIN_MENU_FORE]); - set_menu_back(curses_menu, attributes[MAIN_MENU_BACK]); - set_menu_grey(curses_menu, attributes[MAIN_MENU_GREY]); + set_menu_fore(curses_menu, attr_main_menu_fore); + set_menu_back(curses_menu, attr_main_menu_back); + set_menu_grey(curses_menu, attr_main_menu_grey); set_config_filename(conf_get_configname()); setup_windows(); @@ -1541,8 +1574,8 @@ int main(int ac, char **av) /* check for KEY_FUNC(1) */ if (has_key(KEY_F(1)) == FALSE) { show_scroll_win(main_window, - _("Instructions"), - _(menu_no_f_instructions)); + "Instructions", + menu_no_f_instructions); } conf_set_message_callback(conf_message_callback); diff --git a/support/kconfig/nconf.gui.c b/support/kconfig/nconf.gui.c index 88874acfda..25a7263ef3 100644 --- a/support/kconfig/nconf.gui.c +++ b/support/kconfig/nconf.gui.c @@ -1,176 +1,126 @@ +// SPDX-License-Identifier: GPL-2.0 /* - * Copyright (C) 2008 Nir Tzachar * * Derived from menuconfig. - * */ #include "nconf.h" #include "lkc.h" -/* a list of all the different widgets we use */ -attributes_t attributes[ATTR_MAX+1] = {0}; - -/* available colors: - COLOR_BLACK 0 - COLOR_RED 1 - COLOR_GREEN 2 - COLOR_YELLOW 3 - COLOR_BLUE 4 - COLOR_MAGENTA 5 - COLOR_CYAN 6 - COLOR_WHITE 7 - */ -static void set_normal_colors(void) -{ - init_pair(NORMAL, -1, -1); - init_pair(MAIN_HEADING, COLOR_MAGENTA, -1); - - /* FORE is for the selected item */ - init_pair(MAIN_MENU_FORE, -1, -1); - /* BACK for all the rest */ - init_pair(MAIN_MENU_BACK, -1, -1); - init_pair(MAIN_MENU_GREY, -1, -1); - init_pair(MAIN_MENU_HEADING, COLOR_GREEN, -1); - init_pair(MAIN_MENU_BOX, COLOR_YELLOW, -1); - - init_pair(SCROLLWIN_TEXT, -1, -1); - init_pair(SCROLLWIN_HEADING, COLOR_GREEN, -1); - init_pair(SCROLLWIN_BOX, COLOR_YELLOW, -1); - - init_pair(DIALOG_TEXT, -1, -1); - init_pair(DIALOG_BOX, COLOR_YELLOW, -1); - init_pair(DIALOG_MENU_BACK, COLOR_YELLOW, -1); - init_pair(DIALOG_MENU_FORE, COLOR_RED, -1); - - init_pair(INPUT_BOX, COLOR_YELLOW, -1); - init_pair(INPUT_HEADING, COLOR_GREEN, -1); - init_pair(INPUT_TEXT, -1, -1); - init_pair(INPUT_FIELD, -1, -1); - - init_pair(FUNCTION_HIGHLIGHT, -1, -1); - init_pair(FUNCTION_TEXT, COLOR_YELLOW, -1); -} - -/* available attributes: - A_NORMAL Normal display (no highlight) - A_STANDOUT Best highlighting mode of the terminal. - A_UNDERLINE Underlining - A_REVERSE Reverse video - A_BLINK Blinking - A_DIM Half bright - A_BOLD Extra bright or bold - A_PROTECT Protected mode - A_INVIS Invisible or blank mode - A_ALTCHARSET Alternate character set - A_CHARTEXT Bit-mask to extract a character - COLOR_PAIR(n) Color-pair number n - */ -static void normal_color_theme(void) -{ - /* automatically add color... */ -#define mkattr(name, attr) do { \ -attributes[name] = attr | COLOR_PAIR(name); } while (0) - mkattr(NORMAL, NORMAL); - mkattr(MAIN_HEADING, A_BOLD | A_UNDERLINE); - - mkattr(MAIN_MENU_FORE, A_REVERSE); - mkattr(MAIN_MENU_BACK, A_NORMAL); - mkattr(MAIN_MENU_GREY, A_NORMAL); - mkattr(MAIN_MENU_HEADING, A_BOLD); - mkattr(MAIN_MENU_BOX, A_NORMAL); - - mkattr(SCROLLWIN_TEXT, A_NORMAL); - mkattr(SCROLLWIN_HEADING, A_BOLD); - mkattr(SCROLLWIN_BOX, A_BOLD); - - mkattr(DIALOG_TEXT, A_BOLD); - mkattr(DIALOG_BOX, A_BOLD); - mkattr(DIALOG_MENU_FORE, A_STANDOUT); - mkattr(DIALOG_MENU_BACK, A_NORMAL); - - mkattr(INPUT_BOX, A_NORMAL); - mkattr(INPUT_HEADING, A_BOLD); - mkattr(INPUT_TEXT, A_NORMAL); - mkattr(INPUT_FIELD, A_UNDERLINE); - - mkattr(FUNCTION_HIGHLIGHT, A_BOLD); - mkattr(FUNCTION_TEXT, A_REVERSE); -} - -static void no_colors_theme(void) -{ - /* automatically add highlight, no color */ -#define mkattrn(name, attr) { attributes[name] = attr; } - - mkattrn(NORMAL, NORMAL); - mkattrn(MAIN_HEADING, A_BOLD | A_UNDERLINE); - - mkattrn(MAIN_MENU_FORE, A_STANDOUT); - mkattrn(MAIN_MENU_BACK, A_NORMAL); - mkattrn(MAIN_MENU_GREY, A_NORMAL); - mkattrn(MAIN_MENU_HEADING, A_BOLD); - mkattrn(MAIN_MENU_BOX, A_NORMAL); - - mkattrn(SCROLLWIN_TEXT, A_NORMAL); - mkattrn(SCROLLWIN_HEADING, A_BOLD); - mkattrn(SCROLLWIN_BOX, A_BOLD); - - mkattrn(DIALOG_TEXT, A_NORMAL); - mkattrn(DIALOG_BOX, A_BOLD); - mkattrn(DIALOG_MENU_FORE, A_STANDOUT); - mkattrn(DIALOG_MENU_BACK, A_NORMAL); - - mkattrn(INPUT_BOX, A_BOLD); - mkattrn(INPUT_HEADING, A_BOLD); - mkattrn(INPUT_TEXT, A_NORMAL); - mkattrn(INPUT_FIELD, A_UNDERLINE); - - mkattrn(FUNCTION_HIGHLIGHT, A_BOLD); - mkattrn(FUNCTION_TEXT, A_REVERSE); -} +int attr_normal; +int attr_main_heading; +int attr_main_menu_box; +int attr_main_menu_fore; +int attr_main_menu_back; +int attr_main_menu_grey; +int attr_main_menu_heading; +int attr_scrollwin_text; +int attr_scrollwin_heading; +int attr_scrollwin_box; +int attr_dialog_text; +int attr_dialog_menu_fore; +int attr_dialog_menu_back; +int attr_dialog_box; +int attr_input_box; +int attr_input_heading; +int attr_input_text; +int attr_input_field; +int attr_function_text; +int attr_function_highlight; + +#define COLOR_ATTR(_at, _fg, _bg, _hl) \ + { .attr = &(_at), .has_color = true, .color_fg = _fg, .color_bg = _bg, .highlight = _hl } +#define NO_COLOR_ATTR(_at, _hl) \ + { .attr = &(_at), .has_color = false, .highlight = _hl } +#define COLOR_DEFAULT -1 + +struct nconf_attr_param { + int *attr; + bool has_color; + int color_fg; + int color_bg; + int highlight; +}; + +static const struct nconf_attr_param color_theme_params[] = { + COLOR_ATTR(attr_normal, COLOR_DEFAULT, COLOR_DEFAULT, A_NORMAL), + COLOR_ATTR(attr_main_heading, COLOR_MAGENTA, COLOR_DEFAULT, A_BOLD | A_UNDERLINE), + COLOR_ATTR(attr_main_menu_box, COLOR_YELLOW, COLOR_DEFAULT, A_NORMAL), + COLOR_ATTR(attr_main_menu_fore, COLOR_DEFAULT, COLOR_DEFAULT, A_REVERSE), + COLOR_ATTR(attr_main_menu_back, COLOR_DEFAULT, COLOR_DEFAULT, A_NORMAL), + COLOR_ATTR(attr_main_menu_grey, COLOR_DEFAULT, COLOR_DEFAULT, A_NORMAL), + COLOR_ATTR(attr_main_menu_heading, COLOR_GREEN, COLOR_DEFAULT, A_BOLD), + COLOR_ATTR(attr_scrollwin_text, COLOR_DEFAULT, COLOR_DEFAULT, A_NORMAL), + COLOR_ATTR(attr_scrollwin_heading, COLOR_GREEN, COLOR_DEFAULT, A_BOLD), + COLOR_ATTR(attr_scrollwin_box, COLOR_YELLOW, COLOR_DEFAULT, A_BOLD), + COLOR_ATTR(attr_dialog_text, COLOR_DEFAULT, COLOR_DEFAULT, A_BOLD), + COLOR_ATTR(attr_dialog_menu_fore, COLOR_RED, COLOR_DEFAULT, A_STANDOUT), + COLOR_ATTR(attr_dialog_menu_back, COLOR_YELLOW, COLOR_DEFAULT, A_NORMAL), + COLOR_ATTR(attr_dialog_box, COLOR_YELLOW, COLOR_DEFAULT, A_BOLD), + COLOR_ATTR(attr_input_box, COLOR_YELLOW, COLOR_DEFAULT, A_NORMAL), + COLOR_ATTR(attr_input_heading, COLOR_GREEN, COLOR_DEFAULT, A_BOLD), + COLOR_ATTR(attr_input_text, COLOR_DEFAULT, COLOR_DEFAULT, A_NORMAL), + COLOR_ATTR(attr_input_field, COLOR_DEFAULT, COLOR_DEFAULT, A_UNDERLINE), + COLOR_ATTR(attr_function_text, COLOR_YELLOW, COLOR_DEFAULT, A_REVERSE), + COLOR_ATTR(attr_function_highlight, COLOR_DEFAULT, COLOR_DEFAULT, A_BOLD), + { /* sentinel */ } +}; + +static const struct nconf_attr_param no_color_theme_params[] = { + NO_COLOR_ATTR(attr_normal, A_NORMAL), + NO_COLOR_ATTR(attr_main_heading, A_BOLD | A_UNDERLINE), + NO_COLOR_ATTR(attr_main_menu_box, A_NORMAL), + NO_COLOR_ATTR(attr_main_menu_fore, A_STANDOUT), + NO_COLOR_ATTR(attr_main_menu_back, A_NORMAL), + NO_COLOR_ATTR(attr_main_menu_grey, A_NORMAL), + NO_COLOR_ATTR(attr_main_menu_heading, A_BOLD), + NO_COLOR_ATTR(attr_scrollwin_text, A_NORMAL), + NO_COLOR_ATTR(attr_scrollwin_heading, A_BOLD), + NO_COLOR_ATTR(attr_scrollwin_box, A_BOLD), + NO_COLOR_ATTR(attr_dialog_text, A_NORMAL), + NO_COLOR_ATTR(attr_dialog_menu_fore, A_STANDOUT), + NO_COLOR_ATTR(attr_dialog_menu_back, A_NORMAL), + NO_COLOR_ATTR(attr_dialog_box, A_BOLD), + NO_COLOR_ATTR(attr_input_box, A_BOLD), + NO_COLOR_ATTR(attr_input_heading, A_BOLD), + NO_COLOR_ATTR(attr_input_text, A_NORMAL), + NO_COLOR_ATTR(attr_input_field, A_UNDERLINE), + NO_COLOR_ATTR(attr_function_text, A_REVERSE), + NO_COLOR_ATTR(attr_function_highlight, A_BOLD), + { /* sentinel */ } +}; void set_colors(void) { - start_color(); - use_default_colors(); - set_normal_colors(); + const struct nconf_attr_param *p; + int pair = 0; + if (has_colors()) { - normal_color_theme(); + start_color(); + use_default_colors(); + p = color_theme_params; } else { - /* give defaults */ - no_colors_theme(); + p = no_color_theme_params; } -} + for (; p->attr; p++) { + int attr = p->highlight; + + if (p->has_color) { + pair++; + init_pair(pair, p->color_fg, p->color_bg); + attr |= COLOR_PAIR(pair); + } + + *p->attr = attr; + } +} /* this changes the windows attributes !!! */ -void print_in_middle(WINDOW *win, - int starty, - int startx, - int width, - const char *string, - chtype color) -{ int length, x, y; - float temp; - - - if (win == NULL) - win = stdscr; - getyx(win, y, x); - if (startx != 0) - x = startx; - if (starty != 0) - y = starty; - if (width == 0) - width = 80; - - length = strlen(string); - temp = (width - length) / 2; - x = startx + (int)temp; - (void) wattrset(win, color); - mvwprintw(win, y, x, "%s", string); - refresh(); +void print_in_middle(WINDOW *win, int y, int width, const char *str, int attrs) +{ + wattrset(win, attrs); + mvwprintw(win, y, (width - strlen(str)) / 2, "%s", str); } int get_line_no(const char *text) @@ -295,14 +245,14 @@ int btn_dialog(WINDOW *main_window, const char *msg, int btn_num, ...) msg_win = derwin(win, win_rows-2, msg_width, 1, 1+(total_width+2-msg_width)/2); - set_menu_fore(menu, attributes[DIALOG_MENU_FORE]); - set_menu_back(menu, attributes[DIALOG_MENU_BACK]); + set_menu_fore(menu, attr_dialog_menu_fore); + set_menu_back(menu, attr_dialog_menu_back); - (void) wattrset(win, attributes[DIALOG_BOX]); + wattrset(win, attr_dialog_box); box(win, 0, 0); /* print message */ - (void) wattrset(msg_win, attributes[DIALOG_TEXT]); + wattrset(msg_win, attr_dialog_text); fill_window(msg_win, msg); set_menu_win(menu, win); @@ -406,16 +356,16 @@ int dialog_inputbox(WINDOW *main_window, form_win = derwin(win, 1, prompt_width, prompt_lines+3, 2); keypad(form_win, TRUE); - (void) wattrset(form_win, attributes[INPUT_FIELD]); + wattrset(form_win, attr_input_field); - (void) wattrset(win, attributes[INPUT_BOX]); + wattrset(win, attr_input_box); box(win, 0, 0); - (void) wattrset(win, attributes[INPUT_HEADING]); + wattrset(win, attr_input_heading); if (title) mvwprintw(win, 0, 3, "%s", title); /* print message */ - (void) wattrset(prompt_win, attributes[INPUT_TEXT]); + wattrset(prompt_win, attr_input_text); fill_window(prompt_win, prompt); mvwprintw(form_win, 0, 0, "%*s", prompt_width, " "); @@ -440,7 +390,8 @@ int dialog_inputbox(WINDOW *main_window, case KEY_F(F_EXIT): case KEY_F(F_BACK): break; - case 127: + case 8: /* ^H */ + case 127: /* ^? */ case KEY_BACKSPACE: if (cursor_position > 0) { memmove(&result[cursor_position-1], @@ -546,10 +497,17 @@ void refresh_all_windows(WINDOW *main_window) refresh(); } -/* layman's scrollable window... */ void show_scroll_win(WINDOW *main_window, const char *title, const char *text) +{ + (void)show_scroll_win_ext(main_window, title, (char *)text, NULL, NULL, NULL, NULL); +} + +/* layman's scrollable window... */ +int show_scroll_win_ext(WINDOW *main_window, const char *title, char *text, + int *vscroll, int *hscroll, + extra_key_cb_fn extra_key_cb, void *data) { int res; int total_lines = get_line_no(text); @@ -563,6 +521,12 @@ void show_scroll_win(WINDOW *main_window, WINDOW *win; WINDOW *pad; PANEL *panel; + bool done = false; + + if (hscroll) + start_x = *hscroll; + if (vscroll) + start_y = *vscroll; getmaxyx(stdscr, lines, columns); @@ -576,7 +540,7 @@ void show_scroll_win(WINDOW *main_window, /* create the pad */ pad = newpad(total_lines+10, total_cols+10); - (void) wattrset(pad, attributes[SCROLLWIN_TEXT]); + wattrset(pad, attr_scrollwin_text); fill_window(pad, text); win_lines = min(total_lines+4, lines-2); @@ -591,23 +555,21 @@ void show_scroll_win(WINDOW *main_window, win = newwin(win_lines, win_cols, y, x); keypad(win, TRUE); /* show the help in the help window, and show the help panel */ - (void) wattrset(win, attributes[SCROLLWIN_BOX]); + wattrset(win, attr_scrollwin_box); box(win, 0, 0); - (void) wattrset(win, attributes[SCROLLWIN_HEADING]); + wattrset(win, attr_scrollwin_heading); mvwprintw(win, 0, 3, " %s ", title); panel = new_panel(win); /* handle scrolling */ - do { - + while (!done) { copywin(pad, win, start_y, start_x, 2, 2, text_lines, text_cols, 0); print_in_middle(win, text_lines+2, - 0, text_cols, "", - attributes[DIALOG_MENU_FORE]); + attr_dialog_menu_fore); wrefresh(win); res = wgetch(win); @@ -643,8 +605,18 @@ void show_scroll_win(WINDOW *main_window, case 'l': start_x++; break; + default: + if (extra_key_cb) { + size_t start = (get_line(text, start_y) - text); + size_t end = (get_line(text, start_y + text_lines) - text); + + if (extra_key_cb(res, start, end, data)) { + done = true; + break; + } + } } - if (res == 10 || res == 27 || res == 'q' || + if (res == 0 || res == 10 || res == 27 || res == 'q' || res == KEY_F(F_HELP) || res == KEY_F(F_BACK) || res == KEY_F(F_EXIT)) break; @@ -656,9 +628,14 @@ void show_scroll_win(WINDOW *main_window, start_x = 0; if (start_x >= total_cols-text_cols) start_x = total_cols-text_cols; - } while (res); + } + if (hscroll) + *hscroll = start_x; + if (vscroll) + *vscroll = start_y; del_panel(panel); delwin(win); refresh_all_windows(main_window); + return res; } diff --git a/support/kconfig/nconf.h b/support/kconfig/nconf.h index 9f6f21d3b0..ab836d5826 100644 --- a/support/kconfig/nconf.h +++ b/support/kconfig/nconf.h @@ -1,9 +1,8 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* - * Copyright (C) 2008 Nir Tzachar * * Derived from menuconfig. - * */ #include @@ -14,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -34,30 +32,26 @@ typeof(b) _b = b;\ _a < _b ? _a : _b; }) -typedef enum { - NORMAL = 1, - MAIN_HEADING, - MAIN_MENU_BOX, - MAIN_MENU_FORE, - MAIN_MENU_BACK, - MAIN_MENU_GREY, - MAIN_MENU_HEADING, - SCROLLWIN_TEXT, - SCROLLWIN_HEADING, - SCROLLWIN_BOX, - DIALOG_TEXT, - DIALOG_MENU_FORE, - DIALOG_MENU_BACK, - DIALOG_BOX, - INPUT_BOX, - INPUT_HEADING, - INPUT_TEXT, - INPUT_FIELD, - FUNCTION_TEXT, - FUNCTION_HIGHLIGHT, - ATTR_MAX -} attributes_t; -extern attributes_t attributes[]; +extern int attr_normal; +extern int attr_main_heading; +extern int attr_main_menu_box; +extern int attr_main_menu_fore; +extern int attr_main_menu_back; +extern int attr_main_menu_grey; +extern int attr_main_menu_heading; +extern int attr_scrollwin_text; +extern int attr_scrollwin_heading; +extern int attr_scrollwin_box; +extern int attr_dialog_text; +extern int attr_dialog_menu_fore; +extern int attr_dialog_menu_back; +extern int attr_dialog_box; +extern int attr_input_box; +extern int attr_input_heading; +extern int attr_input_text; +extern int attr_input_field; +extern int attr_function_text; +extern int attr_function_highlight; typedef enum { F_HELP = 1, @@ -73,13 +67,10 @@ typedef enum { void set_colors(void); +typedef int (*extra_key_cb_fn)(int, size_t, size_t, void *); + /* this changes the windows attributes !!! */ -void print_in_middle(WINDOW *win, - int starty, - int startx, - int width, - const char *string, - chtype color); +void print_in_middle(WINDOW *win, int y, int width, const char *str, int attrs); int get_line_length(const char *line); int get_line_no(const char *text); const char *get_line(const char *text, int line_no); @@ -89,6 +80,9 @@ int dialog_inputbox(WINDOW *main_window, const char *title, const char *prompt, const char *init, char **resultp, int *result_len); void refresh_all_windows(WINDOW *main_window); +int show_scroll_win_ext(WINDOW *main_window, const char *title, char *text, + int *vscroll, int *hscroll, + extra_key_cb_fn extra_key_cb, void *data); void show_scroll_win(WINDOW *main_window, const char *title, const char *text); diff --git a/support/kconfig/parser.tab.c_shipped b/support/kconfig/parser.tab.c_shipped new file mode 100644 index 0000000000..092da33306 --- /dev/null +++ b/support/kconfig/parser.tab.c_shipped @@ -0,0 +1,2189 @@ +/* A Bison parser, made by GNU Bison 3.8.2. */ + +/* Bison implementation for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* C LALR(1) parser skeleton written by Richard Stallman, by + simplifying the original so-called "semantic" parser. */ + +/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + especially those whose name start with YY_ or yy_. They are + private implementation details that can be changed or removed. */ + +/* All symbols defined below should begin with yy or YY, to avoid + infringing on user name space. This should be done even for local + variables, as they might otherwise be expanded by user macros. + There are some unavoidable exceptions within include files to + define necessary library symbols; they are noted "INFRINGES ON + USER NAME SPACE" below. */ + +/* Identify Bison output, and Bison version. */ +#define YYBISON 30802 + +/* Bison version string. */ +#define YYBISON_VERSION "3.8.2" + +/* Skeleton name. */ +#define YYSKELETON_NAME "yacc.c" + +/* Pure parsers. */ +#define YYPURE 0 + +/* Push parsers. */ +#define YYPUSH 0 + +/* Pull parsers. */ +#define YYPULL 1 + + + + +/* First part of user prologue. */ + + +#include +#include +#include +#include +#include +#include + +#include "lkc.h" +#include "internal.h" +#include "preprocess.h" + +#define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) + +#define PRINTD 0x0001 +#define DEBUG_PARSE 0x0002 + +int cdebug = PRINTD; + +static void yyerror(const char *err); +static void zconfprint(const char *err, ...); +static void zconf_error(const char *err, ...); +static bool zconf_endtoken(const char *tokenname, + const char *expected_tokenname); + +struct menu *current_menu, *current_entry; + + + +# ifndef YY_CAST +# ifdef __cplusplus +# define YY_CAST(Type, Val) static_cast (Val) +# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast (Val) +# else +# define YY_CAST(Type, Val) ((Type) (Val)) +# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val)) +# endif +# endif +# ifndef YY_NULLPTR +# if defined __cplusplus +# if 201103L <= __cplusplus +# define YY_NULLPTR nullptr +# else +# define YY_NULLPTR 0 +# endif +# else +# define YY_NULLPTR ((void*)0) +# endif +# endif + +#include "parser.tab.h" +/* Symbol kind. */ +enum yysymbol_kind_t +{ + YYSYMBOL_YYEMPTY = -2, + YYSYMBOL_YYEOF = 0, /* "end of file" */ + YYSYMBOL_YYerror = 1, /* error */ + YYSYMBOL_YYUNDEF = 2, /* "invalid token" */ + YYSYMBOL_T_HELPTEXT = 3, /* T_HELPTEXT */ + YYSYMBOL_T_WORD = 4, /* T_WORD */ + YYSYMBOL_T_WORD_QUOTE = 5, /* T_WORD_QUOTE */ + YYSYMBOL_T_BOOL = 6, /* T_BOOL */ + YYSYMBOL_T_CHOICE = 7, /* T_CHOICE */ + YYSYMBOL_T_CLOSE_PAREN = 8, /* T_CLOSE_PAREN */ + YYSYMBOL_T_COLON_EQUAL = 9, /* T_COLON_EQUAL */ + YYSYMBOL_T_COMMENT = 10, /* T_COMMENT */ + YYSYMBOL_T_CONFIG = 11, /* T_CONFIG */ + YYSYMBOL_T_DEFAULT = 12, /* T_DEFAULT */ + YYSYMBOL_T_DEF_BOOL = 13, /* T_DEF_BOOL */ + YYSYMBOL_T_DEF_TRISTATE = 14, /* T_DEF_TRISTATE */ + YYSYMBOL_T_DEPENDS = 15, /* T_DEPENDS */ + YYSYMBOL_T_ENDCHOICE = 16, /* T_ENDCHOICE */ + YYSYMBOL_T_ENDIF = 17, /* T_ENDIF */ + YYSYMBOL_T_ENDMENU = 18, /* T_ENDMENU */ + YYSYMBOL_T_HELP = 19, /* T_HELP */ + YYSYMBOL_T_HEX = 20, /* T_HEX */ + YYSYMBOL_T_IF = 21, /* T_IF */ + YYSYMBOL_T_IMPLY = 22, /* T_IMPLY */ + YYSYMBOL_T_INT = 23, /* T_INT */ + YYSYMBOL_T_MAINMENU = 24, /* T_MAINMENU */ + YYSYMBOL_T_MENU = 25, /* T_MENU */ + YYSYMBOL_T_MENUCONFIG = 26, /* T_MENUCONFIG */ + YYSYMBOL_T_MODULES = 27, /* T_MODULES */ + YYSYMBOL_T_ON = 28, /* T_ON */ + YYSYMBOL_T_OPEN_PAREN = 29, /* T_OPEN_PAREN */ + YYSYMBOL_T_OPTIONAL = 30, /* T_OPTIONAL */ + YYSYMBOL_T_PLUS_EQUAL = 31, /* T_PLUS_EQUAL */ + YYSYMBOL_T_PROMPT = 32, /* T_PROMPT */ + YYSYMBOL_T_RANGE = 33, /* T_RANGE */ + YYSYMBOL_T_SELECT = 34, /* T_SELECT */ + YYSYMBOL_T_SOURCE = 35, /* T_SOURCE */ + YYSYMBOL_T_STRING = 36, /* T_STRING */ + YYSYMBOL_T_TRISTATE = 37, /* T_TRISTATE */ + YYSYMBOL_T_VISIBLE = 38, /* T_VISIBLE */ + YYSYMBOL_T_EOL = 39, /* T_EOL */ + YYSYMBOL_T_ASSIGN_VAL = 40, /* T_ASSIGN_VAL */ + YYSYMBOL_T_OR = 41, /* T_OR */ + YYSYMBOL_T_AND = 42, /* T_AND */ + YYSYMBOL_T_EQUAL = 43, /* T_EQUAL */ + YYSYMBOL_T_UNEQUAL = 44, /* T_UNEQUAL */ + YYSYMBOL_T_LESS = 45, /* T_LESS */ + YYSYMBOL_T_LESS_EQUAL = 46, /* T_LESS_EQUAL */ + YYSYMBOL_T_GREATER = 47, /* T_GREATER */ + YYSYMBOL_T_GREATER_EQUAL = 48, /* T_GREATER_EQUAL */ + YYSYMBOL_T_NOT = 49, /* T_NOT */ + YYSYMBOL_YYACCEPT = 50, /* $accept */ + YYSYMBOL_input = 51, /* input */ + YYSYMBOL_mainmenu_stmt = 52, /* mainmenu_stmt */ + YYSYMBOL_stmt_list = 53, /* stmt_list */ + YYSYMBOL_common_stmt = 54, /* common_stmt */ + YYSYMBOL_config_entry_start = 55, /* config_entry_start */ + YYSYMBOL_config_stmt = 56, /* config_stmt */ + YYSYMBOL_menuconfig_entry_start = 57, /* menuconfig_entry_start */ + YYSYMBOL_menuconfig_stmt = 58, /* menuconfig_stmt */ + YYSYMBOL_config_option_list = 59, /* config_option_list */ + YYSYMBOL_config_option = 60, /* config_option */ + YYSYMBOL_choice = 61, /* choice */ + YYSYMBOL_choice_entry = 62, /* choice_entry */ + YYSYMBOL_choice_end = 63, /* choice_end */ + YYSYMBOL_choice_stmt = 64, /* choice_stmt */ + YYSYMBOL_choice_option_list = 65, /* choice_option_list */ + YYSYMBOL_choice_option = 66, /* choice_option */ + YYSYMBOL_type = 67, /* type */ + YYSYMBOL_logic_type = 68, /* logic_type */ + YYSYMBOL_default = 69, /* default */ + YYSYMBOL_choice_block = 70, /* choice_block */ + YYSYMBOL_if_entry = 71, /* if_entry */ + YYSYMBOL_if_end = 72, /* if_end */ + YYSYMBOL_if_stmt = 73, /* if_stmt */ + YYSYMBOL_menu = 74, /* menu */ + YYSYMBOL_menu_entry = 75, /* menu_entry */ + YYSYMBOL_menu_end = 76, /* menu_end */ + YYSYMBOL_menu_stmt = 77, /* menu_stmt */ + YYSYMBOL_menu_option_list = 78, /* menu_option_list */ + YYSYMBOL_source_stmt = 79, /* source_stmt */ + YYSYMBOL_comment = 80, /* comment */ + YYSYMBOL_comment_stmt = 81, /* comment_stmt */ + YYSYMBOL_comment_option_list = 82, /* comment_option_list */ + YYSYMBOL_help_start = 83, /* help_start */ + YYSYMBOL_help = 84, /* help */ + YYSYMBOL_depends = 85, /* depends */ + YYSYMBOL_visible = 86, /* visible */ + YYSYMBOL_prompt_stmt_opt = 87, /* prompt_stmt_opt */ + YYSYMBOL_end = 88, /* end */ + YYSYMBOL_if_expr = 89, /* if_expr */ + YYSYMBOL_expr = 90, /* expr */ + YYSYMBOL_nonconst_symbol = 91, /* nonconst_symbol */ + YYSYMBOL_symbol = 92, /* symbol */ + YYSYMBOL_assignment_stmt = 93, /* assignment_stmt */ + YYSYMBOL_assign_op = 94, /* assign_op */ + YYSYMBOL_assign_val = 95 /* assign_val */ +}; +typedef enum yysymbol_kind_t yysymbol_kind_t; + + + + +#ifdef short +# undef short +#endif + +/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure + and (if available) are included + so that the code can choose integer types of a good width. */ + +#ifndef __PTRDIFF_MAX__ +# include /* INFRINGES ON USER NAME SPACE */ +# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_STDINT_H +# endif +#endif + +/* Narrow types that promote to a signed type and that can represent a + signed or unsigned integer of at least N bits. In tables they can + save space and decrease cache pressure. Promoting to a signed type + helps avoid bugs in integer arithmetic. */ + +#ifdef __INT_LEAST8_MAX__ +typedef __INT_LEAST8_TYPE__ yytype_int8; +#elif defined YY_STDINT_H +typedef int_least8_t yytype_int8; +#else +typedef signed char yytype_int8; +#endif + +#ifdef __INT_LEAST16_MAX__ +typedef __INT_LEAST16_TYPE__ yytype_int16; +#elif defined YY_STDINT_H +typedef int_least16_t yytype_int16; +#else +typedef short yytype_int16; +#endif + +/* Work around bug in HP-UX 11.23, which defines these macros + incorrectly for preprocessor constants. This workaround can likely + be removed in 2023, as HPE has promised support for HP-UX 11.23 + (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of + . */ +#ifdef __hpux +# undef UINT_LEAST8_MAX +# undef UINT_LEAST16_MAX +# define UINT_LEAST8_MAX 255 +# define UINT_LEAST16_MAX 65535 +#endif + +#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST8_TYPE__ yytype_uint8; +#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST8_MAX <= INT_MAX) +typedef uint_least8_t yytype_uint8; +#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX +typedef unsigned char yytype_uint8; +#else +typedef short yytype_uint8; +#endif + +#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__ +typedef __UINT_LEAST16_TYPE__ yytype_uint16; +#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \ + && UINT_LEAST16_MAX <= INT_MAX) +typedef uint_least16_t yytype_uint16; +#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX +typedef unsigned short yytype_uint16; +#else +typedef int yytype_uint16; +#endif + +#ifndef YYPTRDIFF_T +# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__ +# define YYPTRDIFF_T __PTRDIFF_TYPE__ +# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__ +# elif defined PTRDIFF_MAX +# ifndef ptrdiff_t +# include /* INFRINGES ON USER NAME SPACE */ +# endif +# define YYPTRDIFF_T ptrdiff_t +# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX +# else +# define YYPTRDIFF_T long +# define YYPTRDIFF_MAXIMUM LONG_MAX +# endif +#endif + +#ifndef YYSIZE_T +# ifdef __SIZE_TYPE__ +# define YYSIZE_T __SIZE_TYPE__ +# elif defined size_t +# define YYSIZE_T size_t +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ +# include /* INFRINGES ON USER NAME SPACE */ +# define YYSIZE_T size_t +# else +# define YYSIZE_T unsigned +# endif +#endif + +#define YYSIZE_MAXIMUM \ + YY_CAST (YYPTRDIFF_T, \ + (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \ + ? YYPTRDIFF_MAXIMUM \ + : YY_CAST (YYSIZE_T, -1))) + +#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X)) + + +/* Stored state numbers (used for stacks). */ +typedef yytype_uint8 yy_state_t; + +/* State numbers in computations. */ +typedef int yy_state_fast_t; + +#ifndef YY_ +# if defined YYENABLE_NLS && YYENABLE_NLS +# if ENABLE_NLS +# include /* INFRINGES ON USER NAME SPACE */ +# define YY_(Msgid) dgettext ("bison-runtime", Msgid) +# endif +# endif +# ifndef YY_ +# define YY_(Msgid) Msgid +# endif +#endif + + +#ifndef YY_ATTRIBUTE_PURE +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) +# else +# define YY_ATTRIBUTE_PURE +# endif +#endif + +#ifndef YY_ATTRIBUTE_UNUSED +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +# else +# define YY_ATTRIBUTE_UNUSED +# endif +#endif + +/* Suppress unused-variable warnings by "using" E. */ +#if ! defined lint || defined __GNUC__ +# define YY_USE(E) ((void) (E)) +#else +# define YY_USE(E) /* empty */ +#endif + +/* Suppress an incorrect diagnostic about yylval being uninitialized. */ +#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__ +# if __GNUC__ * 100 + __GNUC_MINOR__ < 407 +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") +# else +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \ + _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") +# endif +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ + _Pragma ("GCC diagnostic pop") +#else +# define YY_INITIAL_VALUE(Value) Value +#endif +#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN +# define YY_IGNORE_MAYBE_UNINITIALIZED_END +#endif +#ifndef YY_INITIAL_VALUE +# define YY_INITIAL_VALUE(Value) /* Nothing. */ +#endif + +#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__ +# define YY_IGNORE_USELESS_CAST_BEGIN \ + _Pragma ("GCC diagnostic push") \ + _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"") +# define YY_IGNORE_USELESS_CAST_END \ + _Pragma ("GCC diagnostic pop") +#endif +#ifndef YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_BEGIN +# define YY_IGNORE_USELESS_CAST_END +#endif + + +#define YY_ASSERT(E) ((void) (0 && (E))) + +#if !defined yyoverflow + +/* The parser invokes alloca or malloc; define the necessary symbols. */ + +# ifdef YYSTACK_USE_ALLOCA +# if YYSTACK_USE_ALLOCA +# ifdef __GNUC__ +# define YYSTACK_ALLOC __builtin_alloca +# elif defined __BUILTIN_VA_ARG_INCR +# include /* INFRINGES ON USER NAME SPACE */ +# elif defined _AIX +# define YYSTACK_ALLOC __alloca +# elif defined _MSC_VER +# include /* INFRINGES ON USER NAME SPACE */ +# define alloca _alloca +# else +# define YYSTACK_ALLOC alloca +# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS +# include /* INFRINGES ON USER NAME SPACE */ + /* Use EXIT_SUCCESS as a witness for stdlib.h. */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# endif +# endif +# endif + +# ifdef YYSTACK_ALLOC + /* Pacify GCC's 'empty if-body' warning. */ +# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) +# ifndef YYSTACK_ALLOC_MAXIMUM + /* The OS might guarantee only one guard page at the bottom of the stack, + and a page size can be as small as 4096 bytes. So we cannot safely + invoke alloca (N) if N exceeds 4096. Use a slightly smaller number + to allow for a few compiler-allocated temporary stack slots. */ +# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ +# endif +# else +# define YYSTACK_ALLOC YYMALLOC +# define YYSTACK_FREE YYFREE +# ifndef YYSTACK_ALLOC_MAXIMUM +# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM +# endif +# if (defined __cplusplus && ! defined EXIT_SUCCESS \ + && ! ((defined YYMALLOC || defined malloc) \ + && (defined YYFREE || defined free))) +# include /* INFRINGES ON USER NAME SPACE */ +# ifndef EXIT_SUCCESS +# define EXIT_SUCCESS 0 +# endif +# endif +# ifndef YYMALLOC +# define YYMALLOC malloc +# if ! defined malloc && ! defined EXIT_SUCCESS +void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# ifndef YYFREE +# define YYFREE free +# if ! defined free && ! defined EXIT_SUCCESS +void free (void *); /* INFRINGES ON USER NAME SPACE */ +# endif +# endif +# endif +#endif /* !defined yyoverflow */ + +#if (! defined yyoverflow \ + && (! defined __cplusplus \ + || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) + +/* A type that is properly aligned for any stack member. */ +union yyalloc +{ + yy_state_t yyss_alloc; + YYSTYPE yyvs_alloc; +}; + +/* The size of the maximum gap between one aligned stack and the next. */ +# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1) + +/* The size of an array large to enough to hold all stacks, each with + N elements. */ +# define YYSTACK_BYTES(N) \ + ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + + YYSTACK_GAP_MAXIMUM) + +# define YYCOPY_NEEDED 1 + +/* Relocate STACK from its old location to the new one. The + local variables YYSIZE and YYSTACKSIZE give the old and new number of + elements in the stack, and YYPTR gives the new location of the + stack. Advance YYPTR to a properly aligned location for the next + stack. */ +# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ + do \ + { \ + YYPTRDIFF_T yynewbytes; \ + YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ + Stack = &yyptr->Stack_alloc; \ + yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / YYSIZEOF (*yyptr); \ + } \ + while (0) + +#endif + +#if defined YYCOPY_NEEDED && YYCOPY_NEEDED +/* Copy COUNT objects from SRC to DST. The source and destination do + not overlap. */ +# ifndef YYCOPY +# if defined __GNUC__ && 1 < __GNUC__ +# define YYCOPY(Dst, Src, Count) \ + __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) +# else +# define YYCOPY(Dst, Src, Count) \ + do \ + { \ + YYPTRDIFF_T yyi; \ + for (yyi = 0; yyi < (Count); yyi++) \ + (Dst)[yyi] = (Src)[yyi]; \ + } \ + while (0) +# endif +# endif +#endif /* !YYCOPY_NEEDED */ + +/* YYFINAL -- State number of the termination state. */ +#define YYFINAL 6 +/* YYLAST -- Last index in YYTABLE. */ +#define YYLAST 189 + +/* YYNTOKENS -- Number of terminals. */ +#define YYNTOKENS 50 +/* YYNNTS -- Number of nonterminals. */ +#define YYNNTS 46 +/* YYNRULES -- Number of rules. */ +#define YYNRULES 100 +/* YYNSTATES -- Number of states. */ +#define YYNSTATES 177 + +/* YYMAXUTOK -- Last valid token kind. */ +#define YYMAXUTOK 304 + + +/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM + as returned by yylex, with out-of-bounds checking. */ +#define YYTRANSLATE(YYX) \ + (0 <= (YYX) && (YYX) <= YYMAXUTOK \ + ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \ + : YYSYMBOL_YYUNDEF) + +/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM + as returned by yylex. */ +static const yytype_int8 yytranslate[] = +{ + 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, + 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, + 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, + 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, + 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, + 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, + 45, 46, 47, 48, 49 +}; + +#if YYDEBUG +/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ +static const yytype_int16 yyrline[] = +{ + 0, 108, 108, 108, 112, 117, 119, 120, 121, 122, + 123, 127, 128, 129, 130, 131, 132, 137, 144, 149, + 156, 165, 167, 168, 169, 172, 178, 184, 193, 199, + 205, 211, 221, 230, 241, 249, 252, 254, 255, 256, + 259, 265, 271, 277, 284, 285, 286, 287, 290, 291, + 294, 295, 296, 298, 300, 305, 313, 321, 326, 333, + 338, 346, 349, 351, 352, 355, 364, 371, 374, 376, + 381, 387, 405, 412, 419, 421, 426, 427, 428, 431, + 432, 435, 436, 437, 438, 439, 440, 441, 442, 443, + 444, 445, 449, 451, 452, 457, 460, 461, 462, 466, + 467 +}; +#endif + +/** Accessing symbol of state STATE. */ +#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State]) + +#if YYDEBUG || 0 +/* The user-facing name of the symbol whose (internal) number is + YYSYMBOL. No bounds checking. */ +static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED; + +/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. + First, the terminals, then, starting at YYNTOKENS, nonterminals. */ +static const char *const yytname[] = +{ + "\"end of file\"", "error", "\"invalid token\"", "T_HELPTEXT", "T_WORD", + "T_WORD_QUOTE", "T_BOOL", "T_CHOICE", "T_CLOSE_PAREN", "T_COLON_EQUAL", + "T_COMMENT", "T_CONFIG", "T_DEFAULT", "T_DEF_BOOL", "T_DEF_TRISTATE", + "T_DEPENDS", "T_ENDCHOICE", "T_ENDIF", "T_ENDMENU", "T_HELP", "T_HEX", + "T_IF", "T_IMPLY", "T_INT", "T_MAINMENU", "T_MENU", "T_MENUCONFIG", + "T_MODULES", "T_ON", "T_OPEN_PAREN", "T_OPTIONAL", "T_PLUS_EQUAL", + "T_PROMPT", "T_RANGE", "T_SELECT", "T_SOURCE", "T_STRING", "T_TRISTATE", + "T_VISIBLE", "T_EOL", "T_ASSIGN_VAL", "T_OR", "T_AND", "T_EQUAL", + "T_UNEQUAL", "T_LESS", "T_LESS_EQUAL", "T_GREATER", "T_GREATER_EQUAL", + "T_NOT", "$accept", "input", "mainmenu_stmt", "stmt_list", "common_stmt", + "config_entry_start", "config_stmt", "menuconfig_entry_start", + "menuconfig_stmt", "config_option_list", "config_option", "choice", + "choice_entry", "choice_end", "choice_stmt", "choice_option_list", + "choice_option", "type", "logic_type", "default", "choice_block", + "if_entry", "if_end", "if_stmt", "menu", "menu_entry", "menu_end", + "menu_stmt", "menu_option_list", "source_stmt", "comment", + "comment_stmt", "comment_option_list", "help_start", "help", "depends", + "visible", "prompt_stmt_opt", "end", "if_expr", "expr", + "nonconst_symbol", "symbol", "assignment_stmt", "assign_op", + "assign_val", YY_NULLPTR +}; + +static const char * +yysymbol_name (yysymbol_kind_t yysymbol) +{ + return yytname[yysymbol]; +} +#endif + +#define YYPACT_NINF (-67) + +#define yypact_value_is_default(Yyn) \ + ((Yyn) == YYPACT_NINF) + +#define YYTABLE_NINF (-4) + +#define yytable_value_is_error(Yyn) \ + 0 + +/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing + STATE-NUM. */ +static const yytype_int16 yypact[] = +{ + 15, 13, 29, -67, 30, 19, -67, 59, 22, 11, + 23, 52, 60, -1, 62, 60, 63, -67, -67, -67, + -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, + -67, -67, -67, -67, -67, -67, 32, -67, -67, -67, + 37, -67, 33, -67, 47, -67, -1, -1, 34, -67, + 141, 48, 49, 53, 111, 111, 84, 142, 94, 6, + 94, 76, -67, -67, 58, -67, -67, 5, -67, -67, + -1, -1, 18, 18, 18, 18, 18, 18, -67, -67, + -67, -67, -67, -67, -67, 72, 67, -67, 60, -67, + 69, 97, 18, 60, -67, -67, -67, 104, -67, -1, + 110, -67, -67, 60, 79, 117, -67, 104, -67, -67, + 7, 88, 89, 93, -67, -67, -67, -67, -67, 114, + -67, -67, -67, -67, -67, -67, -67, 95, -67, -67, + -67, -67, -67, -67, -67, -1, -67, 114, -67, 114, + 18, 114, 114, 100, -6, -67, 114, -67, 114, 101, + -67, -67, -67, -1, 102, 40, 103, 112, 114, 115, + -67, -67, 116, 118, 122, -67, -9, -67, -67, -67, + -67, 126, -67, -67, -67, -67, -67 +}; + +/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. + Performed when YYTABLE does not specify something else to do. Zero + means the default is an error. */ +static const yytype_int8 yydefact[] = +{ + 5, 0, 0, 5, 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 6, 21, 13, + 21, 14, 36, 53, 7, 5, 11, 62, 5, 8, + 15, 68, 12, 16, 4, 10, 0, 97, 98, 96, + 99, 32, 0, 92, 0, 94, 0, 0, 0, 93, + 81, 0, 0, 0, 18, 20, 33, 0, 0, 59, + 0, 67, 9, 100, 0, 66, 17, 0, 89, 55, + 0, 0, 0, 0, 0, 0, 0, 0, 58, 19, + 65, 48, 50, 51, 52, 0, 0, 46, 0, 45, + 0, 0, 0, 0, 47, 49, 22, 74, 44, 0, + 0, 24, 23, 0, 0, 0, 37, 74, 39, 38, + 0, 0, 0, 0, 54, 35, 34, 57, 56, 79, + 64, 63, 61, 60, 69, 95, 88, 90, 91, 86, + 87, 82, 83, 84, 85, 0, 70, 79, 31, 79, + 0, 79, 79, 0, 79, 71, 79, 42, 79, 0, + 77, 78, 76, 0, 0, 0, 0, 0, 79, 0, + 75, 25, 0, 0, 0, 41, 80, 73, 72, 29, + 26, 0, 28, 27, 43, 40, 30 +}; + +/* YYPGOTO[NTERM-NUM]. */ +static const yytype_int16 yypgoto[] = +{ + -67, -67, -67, 24, 92, -67, -67, -67, -67, 130, + -67, -67, -67, -67, -67, -67, -67, -67, 80, -67, + -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, + -67, -67, -67, -67, 119, -42, -67, 65, -15, 25, + -46, -10, -66, -67, -67, -67 +}; + +/* YYDEFGOTO[NTERM-NUM]. */ +static const yytype_uint8 yydefgoto[] = +{ + 0, 2, 3, 4, 17, 18, 19, 20, 21, 54, + 96, 22, 23, 115, 24, 56, 106, 97, 98, 99, + 57, 25, 117, 26, 27, 28, 122, 29, 59, 30, + 31, 32, 61, 100, 101, 102, 121, 143, 116, 154, + 48, 49, 50, 33, 40, 64 +}; + +/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If + positive, shift that token. If negative, reduce the rule whose + number is the opposite. If YYTABLE_NINF, syntax error. */ +static const yytype_int16 yytable[] = +{ + 67, 68, 44, 43, 45, 52, 129, 130, 131, 132, + 133, 134, 36, 126, 109, 153, 37, 120, 5, 124, + 37, 85, 43, 45, 127, 128, 140, 7, 46, 6, + -3, 8, 70, 71, 9, 70, 71, 10, 38, 1, + 11, 12, 38, 118, 119, 123, 70, 71, 47, 58, + 39, 13, 60, 144, 39, 14, 15, 42, 34, -2, + 8, 35, 41, 9, 43, 16, 10, 51, 53, 11, + 12, 62, 65, 69, 158, 70, 71, 63, 137, 168, + 13, 70, 71, 141, 14, 15, 66, 78, 79, 155, + 81, 85, 80, 146, 16, 8, 103, 125, 9, 85, + 135, 10, 139, 86, 11, 12, 136, 166, 138, 142, + 111, 112, 113, 145, 104, 13, 105, 81, 147, 14, + 15, 95, 148, 82, 83, 84, 85, 150, 151, 16, + 86, 87, 152, 88, 89, 153, 107, 71, 90, 161, + 165, 167, 169, 91, 92, 93, 110, 94, 95, 114, + 55, 170, 11, 12, 172, 173, 0, 174, 111, 112, + 113, 175, 156, 13, 157, 176, 159, 160, 15, 162, + 0, 163, 149, 164, 0, 108, 0, 16, 0, 0, + 0, 0, 0, 171, 72, 73, 74, 75, 76, 77 +}; + +static const yytype_int16 yycheck[] = +{ + 46, 47, 12, 4, 5, 15, 72, 73, 74, 75, + 76, 77, 1, 8, 56, 21, 9, 59, 5, 61, + 9, 15, 4, 5, 70, 71, 92, 3, 29, 0, + 0, 1, 41, 42, 4, 41, 42, 7, 31, 24, + 10, 11, 31, 58, 38, 60, 41, 42, 49, 25, + 43, 21, 28, 99, 43, 25, 26, 5, 39, 0, + 1, 39, 39, 4, 4, 35, 7, 5, 5, 10, + 11, 39, 39, 39, 140, 41, 42, 40, 88, 39, + 21, 41, 42, 93, 25, 26, 39, 39, 39, 135, + 6, 15, 39, 103, 35, 1, 12, 39, 4, 15, + 28, 7, 5, 19, 10, 11, 39, 153, 39, 5, + 16, 17, 18, 3, 30, 21, 32, 6, 39, 25, + 26, 37, 5, 12, 13, 14, 15, 39, 39, 35, + 19, 20, 39, 22, 23, 21, 56, 42, 27, 39, + 39, 39, 39, 32, 33, 34, 4, 36, 37, 57, + 20, 39, 10, 11, 39, 39, -1, 39, 16, 17, + 18, 39, 137, 21, 139, 39, 141, 142, 26, 144, + -1, 146, 107, 148, -1, 56, -1, 35, -1, -1, + -1, -1, -1, 158, 43, 44, 45, 46, 47, 48 +}; + +/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of + state STATE-NUM. */ +static const yytype_int8 yystos[] = +{ + 0, 24, 51, 52, 53, 5, 0, 53, 1, 4, + 7, 10, 11, 21, 25, 26, 35, 54, 55, 56, + 57, 58, 61, 62, 64, 71, 73, 74, 75, 77, + 79, 80, 81, 93, 39, 39, 1, 9, 31, 43, + 94, 39, 5, 4, 91, 5, 29, 49, 90, 91, + 92, 5, 91, 5, 59, 59, 65, 70, 53, 78, + 53, 82, 39, 40, 95, 39, 39, 90, 90, 39, + 41, 42, 43, 44, 45, 46, 47, 48, 39, 39, + 39, 6, 12, 13, 14, 15, 19, 20, 22, 23, + 27, 32, 33, 34, 36, 37, 60, 67, 68, 69, + 83, 84, 85, 12, 30, 32, 66, 68, 84, 85, + 4, 16, 17, 18, 54, 63, 88, 72, 88, 38, + 85, 86, 76, 88, 85, 39, 8, 90, 90, 92, + 92, 92, 92, 92, 92, 28, 39, 91, 39, 5, + 92, 91, 5, 87, 90, 3, 91, 39, 5, 87, + 39, 39, 39, 21, 89, 90, 89, 89, 92, 89, + 89, 39, 89, 89, 89, 39, 90, 39, 39, 39, + 39, 89, 39, 39, 39, 39, 39 +}; + +/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ +static const yytype_int8 yyr1[] = +{ + 0, 50, 51, 51, 52, 53, 53, 53, 53, 53, + 53, 54, 54, 54, 54, 54, 54, 55, 56, 57, + 58, 59, 59, 59, 59, 60, 60, 60, 60, 60, + 60, 60, 61, 62, 63, 64, 65, 65, 65, 65, + 66, 66, 66, 66, 67, 67, 67, 67, 68, 68, + 69, 69, 69, 70, 70, 71, 72, 73, 74, 75, + 76, 77, 78, 78, 78, 79, 80, 81, 82, 82, + 83, 84, 85, 86, 87, 87, 88, 88, 88, 89, + 89, 90, 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 91, 92, 92, 93, 94, 94, 94, 95, + 95 +}; + +/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ +static const yytype_int8 yyr2[] = +{ + 0, 2, 2, 1, 3, 0, 2, 2, 2, 4, + 3, 1, 1, 1, 1, 1, 1, 3, 2, 3, + 2, 0, 2, 2, 2, 3, 4, 4, 4, 4, + 5, 2, 2, 2, 1, 3, 0, 2, 2, 2, + 4, 3, 2, 4, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 0, 2, 3, 1, 3, 3, 2, + 1, 3, 0, 2, 2, 3, 3, 2, 0, 2, + 2, 2, 4, 3, 0, 2, 2, 2, 2, 0, + 2, 1, 3, 3, 3, 3, 3, 3, 3, 2, + 3, 3, 1, 1, 1, 4, 1, 1, 1, 0, + 1 +}; + + +enum { YYENOMEM = -2 }; + +#define yyerrok (yyerrstatus = 0) +#define yyclearin (yychar = YYEMPTY) + +#define YYACCEPT goto yyacceptlab +#define YYABORT goto yyabortlab +#define YYERROR goto yyerrorlab +#define YYNOMEM goto yyexhaustedlab + + +#define YYRECOVERING() (!!yyerrstatus) + +#define YYBACKUP(Token, Value) \ + do \ + if (yychar == YYEMPTY) \ + { \ + yychar = (Token); \ + yylval = (Value); \ + YYPOPSTACK (yylen); \ + yystate = *yyssp; \ + goto yybackup; \ + } \ + else \ + { \ + yyerror (YY_("syntax error: cannot back up")); \ + YYERROR; \ + } \ + while (0) + +/* Backward compatibility with an undocumented macro. + Use YYerror or YYUNDEF. */ +#define YYERRCODE YYUNDEF + + +/* Enable debugging if requested. */ +#if YYDEBUG + +# ifndef YYFPRINTF +# include /* INFRINGES ON USER NAME SPACE */ +# define YYFPRINTF fprintf +# endif + +# define YYDPRINTF(Args) \ +do { \ + if (yydebug) \ + YYFPRINTF Args; \ +} while (0) + + + + +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ +do { \ + if (yydebug) \ + { \ + YYFPRINTF (stderr, "%s ", Title); \ + yy_symbol_print (stderr, \ + Kind, Value); \ + YYFPRINTF (stderr, "\n"); \ + } \ +} while (0) + + +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ + +static void +yy_symbol_value_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) +{ + FILE *yyoutput = yyo; + YY_USE (yyoutput); + if (!yyvaluep) + return; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YY_USE (yykind); + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ + +static void +yy_symbol_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) +{ + YYFPRINTF (yyo, "%s %s (", + yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); + + yy_symbol_value_print (yyo, yykind, yyvaluep); + YYFPRINTF (yyo, ")"); +} + +/*------------------------------------------------------------------. +| yy_stack_print -- Print the state stack from its BOTTOM up to its | +| TOP (included). | +`------------------------------------------------------------------*/ + +static void +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) +{ + YYFPRINTF (stderr, "Stack now"); + for (; yybottom <= yytop; yybottom++) + { + int yybot = *yybottom; + YYFPRINTF (stderr, " %d", yybot); + } + YYFPRINTF (stderr, "\n"); +} + +# define YY_STACK_PRINT(Bottom, Top) \ +do { \ + if (yydebug) \ + yy_stack_print ((Bottom), (Top)); \ +} while (0) + + +/*------------------------------------------------. +| Report that the YYRULE is going to be reduced. | +`------------------------------------------------*/ + +static void +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, + int yyrule) +{ + int yylno = yyrline[yyrule]; + int yynrhs = yyr2[yyrule]; + int yyi; + YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n", + yyrule - 1, yylno); + /* The symbols being reduced. */ + for (yyi = 0; yyi < yynrhs; yyi++) + { + YYFPRINTF (stderr, " $%d = ", yyi + 1); + yy_symbol_print (stderr, + YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), + &yyvsp[(yyi + 1) - (yynrhs)]); + YYFPRINTF (stderr, "\n"); + } +} + +# define YY_REDUCE_PRINT(Rule) \ +do { \ + if (yydebug) \ + yy_reduce_print (yyssp, yyvsp, Rule); \ +} while (0) + +/* Nonzero means print parse trace. It is left uninitialized so that + multiple parsers can coexist. */ +int yydebug; +#else /* !YYDEBUG */ +# define YYDPRINTF(Args) ((void) 0) +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) +# define YY_STACK_PRINT(Bottom, Top) +# define YY_REDUCE_PRINT(Rule) +#endif /* !YYDEBUG */ + + +/* YYINITDEPTH -- initial size of the parser's stacks. */ +#ifndef YYINITDEPTH +# define YYINITDEPTH 200 +#endif + +/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only + if the built-in stack extension method is used). + + Do not make this value too large; the results are undefined if + YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) + evaluated with infinite-precision integer arithmetic. */ + +#ifndef YYMAXDEPTH +# define YYMAXDEPTH 10000 +#endif + + + + + + +/*-----------------------------------------------. +| Release the memory associated to this symbol. | +`-----------------------------------------------*/ + +static void +yydestruct (const char *yymsg, + yysymbol_kind_t yykind, YYSTYPE *yyvaluep) +{ + YY_USE (yyvaluep); + if (!yymsg) + yymsg = "Deleting"; + YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + switch (yykind) + { + case YYSYMBOL_choice_entry: /* choice_entry */ + { + fprintf(stderr, "%s:%d: missing end statement for this entry\n", + ((*yyvaluep).menu)->filename, ((*yyvaluep).menu)->lineno); + if (current_menu == ((*yyvaluep).menu)) + menu_end_menu(); +} + break; + + case YYSYMBOL_if_entry: /* if_entry */ + { + fprintf(stderr, "%s:%d: missing end statement for this entry\n", + ((*yyvaluep).menu)->filename, ((*yyvaluep).menu)->lineno); + if (current_menu == ((*yyvaluep).menu)) + menu_end_menu(); +} + break; + + case YYSYMBOL_menu_entry: /* menu_entry */ + { + fprintf(stderr, "%s:%d: missing end statement for this entry\n", + ((*yyvaluep).menu)->filename, ((*yyvaluep).menu)->lineno); + if (current_menu == ((*yyvaluep).menu)) + menu_end_menu(); +} + break; + + default: + break; + } + YY_IGNORE_MAYBE_UNINITIALIZED_END +} + + +/* Lookahead token kind. */ +int yychar; + +/* The semantic value of the lookahead symbol. */ +YYSTYPE yylval; +/* Number of syntax errors so far. */ +int yynerrs; + + + + +/*----------. +| yyparse. | +`----------*/ + +int +yyparse (void) +{ + yy_state_fast_t yystate = 0; + /* Number of tokens to shift before error messages enabled. */ + int yyerrstatus = 0; + + /* Refer to the stacks through separate pointers, to allow yyoverflow + to reallocate them elsewhere. */ + + /* Their size. */ + YYPTRDIFF_T yystacksize = YYINITDEPTH; + + /* The state stack: array, bottom, top. */ + yy_state_t yyssa[YYINITDEPTH]; + yy_state_t *yyss = yyssa; + yy_state_t *yyssp = yyss; + + /* The semantic value stack: array, bottom, top. */ + YYSTYPE yyvsa[YYINITDEPTH]; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp = yyvs; + + int yyn; + /* The return value of yyparse. */ + int yyresult; + /* Lookahead symbol kind. */ + yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; + /* The variables used to return semantic value and location from the + action routines. */ + YYSTYPE yyval; + + + +#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) + + /* The number of symbols on the RHS of the reduced rule. + Keep to zero when no symbol should be popped. */ + int yylen = 0; + + YYDPRINTF ((stderr, "Starting parse\n")); + + yychar = YYEMPTY; /* Cause a token to be read. */ + + goto yysetstate; + + +/*------------------------------------------------------------. +| yynewstate -- push a new state, which is found in yystate. | +`------------------------------------------------------------*/ +yynewstate: + /* In all cases, when you get here, the value and location stacks + have just been pushed. So pushing a state here evens the stacks. */ + yyssp++; + + +/*--------------------------------------------------------------------. +| yysetstate -- set current state (the top of the stack) to yystate. | +`--------------------------------------------------------------------*/ +yysetstate: + YYDPRINTF ((stderr, "Entering state %d\n", yystate)); + YY_ASSERT (0 <= yystate && yystate < YYNSTATES); + YY_IGNORE_USELESS_CAST_BEGIN + *yyssp = YY_CAST (yy_state_t, yystate); + YY_IGNORE_USELESS_CAST_END + YY_STACK_PRINT (yyss, yyssp); + + if (yyss + yystacksize - 1 <= yyssp) +#if !defined yyoverflow && !defined YYSTACK_RELOCATE + YYNOMEM; +#else + { + /* Get the current used size of the three stacks, in elements. */ + YYPTRDIFF_T yysize = yyssp - yyss + 1; + +# if defined yyoverflow + { + /* Give user a chance to reallocate the stack. Use copies of + these so that the &'s don't force the real ones into + memory. */ + yy_state_t *yyss1 = yyss; + YYSTYPE *yyvs1 = yyvs; + + /* Each stack pointer address is followed by the size of the + data in use in that stack, in bytes. This used to be a + conditional around just the two extra args, but that might + be undefined if yyoverflow is a macro. */ + yyoverflow (YY_("memory exhausted"), + &yyss1, yysize * YYSIZEOF (*yyssp), + &yyvs1, yysize * YYSIZEOF (*yyvsp), + &yystacksize); + yyss = yyss1; + yyvs = yyvs1; + } +# else /* defined YYSTACK_RELOCATE */ + /* Extend the stack our own way. */ + if (YYMAXDEPTH <= yystacksize) + YYNOMEM; + yystacksize *= 2; + if (YYMAXDEPTH < yystacksize) + yystacksize = YYMAXDEPTH; + + { + yy_state_t *yyss1 = yyss; + union yyalloc *yyptr = + YY_CAST (union yyalloc *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); + if (! yyptr) + YYNOMEM; + YYSTACK_RELOCATE (yyss_alloc, yyss); + YYSTACK_RELOCATE (yyvs_alloc, yyvs); +# undef YYSTACK_RELOCATE + if (yyss1 != yyssa) + YYSTACK_FREE (yyss1); + } +# endif + + yyssp = yyss + yysize - 1; + yyvsp = yyvs + yysize - 1; + + YY_IGNORE_USELESS_CAST_BEGIN + YYDPRINTF ((stderr, "Stack size increased to %ld\n", + YY_CAST (long, yystacksize))); + YY_IGNORE_USELESS_CAST_END + + if (yyss + yystacksize - 1 <= yyssp) + YYABORT; + } +#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */ + + + if (yystate == YYFINAL) + YYACCEPT; + + goto yybackup; + + +/*-----------. +| yybackup. | +`-----------*/ +yybackup: + /* Do appropriate processing given the current state. Read a + lookahead token if we need one and don't already have one. */ + + /* First try to decide what to do without reference to lookahead token. */ + yyn = yypact[yystate]; + if (yypact_value_is_default (yyn)) + goto yydefault; + + /* Not known => get a lookahead token if don't already have one. */ + + /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ + if (yychar == YYEMPTY) + { + YYDPRINTF ((stderr, "Reading a token\n")); + yychar = yylex (); + } + + if (yychar <= YYEOF) + { + yychar = YYEOF; + yytoken = YYSYMBOL_YYEOF; + YYDPRINTF ((stderr, "Now at end of input.\n")); + } + else if (yychar == YYerror) + { + /* The scanner already issued an error message, process directly + to error recovery. But do not keep the error token as + lookahead, it is too special and may lead us to an endless + loop in error recovery. */ + yychar = YYUNDEF; + yytoken = YYSYMBOL_YYerror; + goto yyerrlab1; + } + else + { + yytoken = YYTRANSLATE (yychar); + YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); + } + + /* If the proper action on seeing token YYTOKEN is to reduce or to + detect an error, take that action. */ + yyn += yytoken; + if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) + goto yydefault; + yyn = yytable[yyn]; + if (yyn <= 0) + { + if (yytable_value_is_error (yyn)) + goto yyerrlab; + yyn = -yyn; + goto yyreduce; + } + + /* Count tokens shifted since error; after three, turn off error + status. */ + if (yyerrstatus) + yyerrstatus--; + + /* Shift the lookahead token. */ + YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); + yystate = yyn; + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + /* Discard the shifted token. */ + yychar = YYEMPTY; + goto yynewstate; + + +/*-----------------------------------------------------------. +| yydefault -- do the default action for the current state. | +`-----------------------------------------------------------*/ +yydefault: + yyn = yydefact[yystate]; + if (yyn == 0) + goto yyerrlab; + goto yyreduce; + + +/*-----------------------------. +| yyreduce -- do a reduction. | +`-----------------------------*/ +yyreduce: + /* yyn is the number of a rule to reduce with. */ + yylen = yyr2[yyn]; + + /* If YYLEN is nonzero, implement the default value of the action: + '$$ = $1'. + + Otherwise, the following line sets YYVAL to garbage. + This behavior is undocumented and Bison + users should not rely upon it. Assigning to YYVAL + unconditionally makes the parser a bit smaller, and it avoids a + GCC warning that YYVAL may be used uninitialized. */ + yyval = yyvsp[1-yylen]; + + + YY_REDUCE_PRINT (yyn); + switch (yyn) + { + case 4: /* mainmenu_stmt: T_MAINMENU T_WORD_QUOTE T_EOL */ +{ + menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL); +} + break; + + case 9: /* stmt_list: stmt_list T_WORD error T_EOL */ + { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); } + break; + + case 10: /* stmt_list: stmt_list error T_EOL */ + { zconf_error("invalid statement"); } + break; + + case 17: /* config_entry_start: T_CONFIG nonconst_symbol T_EOL */ +{ + (yyvsp[-1].symbol)->flags |= SYMBOL_OPTIONAL; + menu_add_entry((yyvsp[-1].symbol)); + printd(DEBUG_PARSE, "%s:%d:config %s\n", cur_filename, cur_lineno, (yyvsp[-1].symbol)->name); +} + break; + + case 18: /* config_stmt: config_entry_start config_option_list */ +{ + printd(DEBUG_PARSE, "%s:%d:endconfig\n", cur_filename, cur_lineno); +} + break; + + case 19: /* menuconfig_entry_start: T_MENUCONFIG nonconst_symbol T_EOL */ +{ + (yyvsp[-1].symbol)->flags |= SYMBOL_OPTIONAL; + menu_add_entry((yyvsp[-1].symbol)); + printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", cur_filename, cur_lineno, (yyvsp[-1].symbol)->name); +} + break; + + case 20: /* menuconfig_stmt: menuconfig_entry_start config_option_list */ +{ + if (current_entry->prompt) + current_entry->prompt->type = P_MENU; + else + zconfprint("warning: menuconfig statement without prompt"); + printd(DEBUG_PARSE, "%s:%d:endconfig\n", cur_filename, cur_lineno); +} + break; + + case 25: /* config_option: type prompt_stmt_opt T_EOL */ +{ + menu_set_type((yyvsp[-2].type)); + printd(DEBUG_PARSE, "%s:%d:type(%u)\n", cur_filename, cur_lineno, (yyvsp[-2].type)); +} + break; + + case 26: /* config_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL */ +{ + menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); + printd(DEBUG_PARSE, "%s:%d:prompt\n", cur_filename, cur_lineno); +} + break; + + case 27: /* config_option: default expr if_expr T_EOL */ +{ + menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr)); + if ((yyvsp[-3].type) != S_UNKNOWN) + menu_set_type((yyvsp[-3].type)); + printd(DEBUG_PARSE, "%s:%d:default(%u)\n", cur_filename, cur_lineno, + (yyvsp[-3].type)); +} + break; + + case 28: /* config_option: T_SELECT nonconst_symbol if_expr T_EOL */ +{ + menu_add_symbol(P_SELECT, (yyvsp[-2].symbol), (yyvsp[-1].expr)); + printd(DEBUG_PARSE, "%s:%d:select\n", cur_filename, cur_lineno); +} + break; + + case 29: /* config_option: T_IMPLY nonconst_symbol if_expr T_EOL */ +{ + menu_add_symbol(P_IMPLY, (yyvsp[-2].symbol), (yyvsp[-1].expr)); + printd(DEBUG_PARSE, "%s:%d:imply\n", cur_filename, cur_lineno); +} + break; + + case 30: /* config_option: T_RANGE symbol symbol if_expr T_EOL */ +{ + menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr)); + printd(DEBUG_PARSE, "%s:%d:range\n", cur_filename, cur_lineno); +} + break; + + case 31: /* config_option: T_MODULES T_EOL */ +{ + if (modules_sym) + zconf_error("symbol '%s' redefines option 'modules' already defined by symbol '%s'", + current_entry->sym->name, modules_sym->name); + modules_sym = current_entry->sym; +} + break; + + case 32: /* choice: T_CHOICE T_EOL */ +{ + struct symbol *sym = sym_lookup(NULL, SYMBOL_CHOICE); + sym->flags |= SYMBOL_NO_WRITE; + menu_add_entry(sym); + menu_add_expr(P_CHOICE, NULL, NULL); + printd(DEBUG_PARSE, "%s:%d:choice\n", cur_filename, cur_lineno); +} + break; + + case 33: /* choice_entry: choice choice_option_list */ +{ + if (!current_entry->prompt) { + fprintf(stderr, "%s:%d: error: choice must have a prompt\n", + current_entry->filename, current_entry->lineno); + yynerrs++; + } + + (yyval.menu) = menu_add_menu(); +} + break; + + case 34: /* choice_end: end */ +{ + if (zconf_endtoken((yyvsp[0].string), "choice")) { + menu_end_menu(); + printd(DEBUG_PARSE, "%s:%d:endchoice\n", cur_filename, cur_lineno); + } +} + break; + + case 40: /* choice_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL */ +{ + menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); + printd(DEBUG_PARSE, "%s:%d:prompt\n", cur_filename, cur_lineno); +} + break; + + case 41: /* choice_option: logic_type prompt_stmt_opt T_EOL */ +{ + menu_set_type((yyvsp[-2].type)); + printd(DEBUG_PARSE, "%s:%d:type(%u)\n", cur_filename, cur_lineno, (yyvsp[-2].type)); +} + break; + + case 42: /* choice_option: T_OPTIONAL T_EOL */ +{ + current_entry->sym->flags |= SYMBOL_OPTIONAL; + printd(DEBUG_PARSE, "%s:%d:optional\n", cur_filename, cur_lineno); +} + break; + + case 43: /* choice_option: T_DEFAULT nonconst_symbol if_expr T_EOL */ +{ + menu_add_symbol(P_DEFAULT, (yyvsp[-2].symbol), (yyvsp[-1].expr)); + printd(DEBUG_PARSE, "%s:%d:default\n", cur_filename, cur_lineno); +} + break; + + case 45: /* type: T_INT */ + { (yyval.type) = S_INT; } + break; + + case 46: /* type: T_HEX */ + { (yyval.type) = S_HEX; } + break; + + case 47: /* type: T_STRING */ + { (yyval.type) = S_STRING; } + break; + + case 48: /* logic_type: T_BOOL */ + { (yyval.type) = S_BOOLEAN; } + break; + + case 49: /* logic_type: T_TRISTATE */ + { (yyval.type) = S_TRISTATE; } + break; + + case 50: /* default: T_DEFAULT */ + { (yyval.type) = S_UNKNOWN; } + break; + + case 51: /* default: T_DEF_BOOL */ + { (yyval.type) = S_BOOLEAN; } + break; + + case 52: /* default: T_DEF_TRISTATE */ + { (yyval.type) = S_TRISTATE; } + break; + + case 55: /* if_entry: T_IF expr T_EOL */ +{ + printd(DEBUG_PARSE, "%s:%d:if\n", cur_filename, cur_lineno); + menu_add_entry(NULL); + menu_add_dep((yyvsp[-1].expr)); + (yyval.menu) = menu_add_menu(); +} + break; + + case 56: /* if_end: end */ +{ + if (zconf_endtoken((yyvsp[0].string), "if")) { + menu_end_menu(); + printd(DEBUG_PARSE, "%s:%d:endif\n", cur_filename, cur_lineno); + } +} + break; + + case 58: /* menu: T_MENU T_WORD_QUOTE T_EOL */ +{ + menu_add_entry(NULL); + menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL); + printd(DEBUG_PARSE, "%s:%d:menu\n", cur_filename, cur_lineno); +} + break; + + case 59: /* menu_entry: menu menu_option_list */ +{ + (yyval.menu) = menu_add_menu(); +} + break; + + case 60: /* menu_end: end */ +{ + if (zconf_endtoken((yyvsp[0].string), "menu")) { + menu_end_menu(); + printd(DEBUG_PARSE, "%s:%d:endmenu\n", cur_filename, cur_lineno); + } +} + break; + + case 65: /* source_stmt: T_SOURCE T_WORD_QUOTE T_EOL */ +{ + printd(DEBUG_PARSE, "%s:%d:source %s\n", cur_filename, cur_lineno, (yyvsp[-1].string)); + zconf_nextfile((yyvsp[-1].string)); + free((yyvsp[-1].string)); +} + break; + + case 66: /* comment: T_COMMENT T_WORD_QUOTE T_EOL */ +{ + menu_add_entry(NULL); + menu_add_prompt(P_COMMENT, (yyvsp[-1].string), NULL); + printd(DEBUG_PARSE, "%s:%d:comment\n", cur_filename, cur_lineno); +} + break; + + case 70: /* help_start: T_HELP T_EOL */ +{ + printd(DEBUG_PARSE, "%s:%d:help\n", cur_filename, cur_lineno); + zconf_starthelp(); +} + break; + + case 71: /* help: help_start T_HELPTEXT */ +{ + if (current_entry->help) { + free(current_entry->help); + zconfprint("warning: '%s' defined with more than one help text -- only the last one will be used", + current_entry->sym->name ?: ""); + } + + /* Is the help text empty or all whitespace? */ + if ((yyvsp[0].string)[strspn((yyvsp[0].string), " \f\n\r\t\v")] == '\0') + zconfprint("warning: '%s' defined with blank help text", + current_entry->sym->name ?: ""); + + current_entry->help = (yyvsp[0].string); +} + break; + + case 72: /* depends: T_DEPENDS T_ON expr T_EOL */ +{ + menu_add_dep((yyvsp[-1].expr)); + printd(DEBUG_PARSE, "%s:%d:depends on\n", cur_filename, cur_lineno); +} + break; + + case 73: /* visible: T_VISIBLE if_expr T_EOL */ +{ + menu_add_visibility((yyvsp[-1].expr)); +} + break; + + case 75: /* prompt_stmt_opt: T_WORD_QUOTE if_expr */ +{ + menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr)); +} + break; + + case 76: /* end: T_ENDMENU T_EOL */ + { (yyval.string) = "menu"; } + break; + + case 77: /* end: T_ENDCHOICE T_EOL */ + { (yyval.string) = "choice"; } + break; + + case 78: /* end: T_ENDIF T_EOL */ + { (yyval.string) = "if"; } + break; + + case 79: /* if_expr: %empty */ + { (yyval.expr) = NULL; } + break; + + case 80: /* if_expr: T_IF expr */ + { (yyval.expr) = (yyvsp[0].expr); } + break; + + case 81: /* expr: symbol */ + { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); } + break; + + case 82: /* expr: symbol T_LESS symbol */ + { (yyval.expr) = expr_alloc_comp(E_LTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } + break; + + case 83: /* expr: symbol T_LESS_EQUAL symbol */ + { (yyval.expr) = expr_alloc_comp(E_LEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } + break; + + case 84: /* expr: symbol T_GREATER symbol */ + { (yyval.expr) = expr_alloc_comp(E_GTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } + break; + + case 85: /* expr: symbol T_GREATER_EQUAL symbol */ + { (yyval.expr) = expr_alloc_comp(E_GEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } + break; + + case 86: /* expr: symbol T_EQUAL symbol */ + { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } + break; + + case 87: /* expr: symbol T_UNEQUAL symbol */ + { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } + break; + + case 88: /* expr: T_OPEN_PAREN expr T_CLOSE_PAREN */ + { (yyval.expr) = (yyvsp[-1].expr); } + break; + + case 89: /* expr: T_NOT expr */ + { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); } + break; + + case 90: /* expr: expr T_OR expr */ + { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); } + break; + + case 91: /* expr: expr T_AND expr */ + { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); } + break; + + case 92: /* nonconst_symbol: T_WORD */ + { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); } + break; + + case 94: /* symbol: T_WORD_QUOTE */ + { (yyval.symbol) = sym_lookup((yyvsp[0].string), SYMBOL_CONST); free((yyvsp[0].string)); } + break; + + case 95: /* assignment_stmt: T_WORD assign_op assign_val T_EOL */ + { variable_add((yyvsp[-3].string), (yyvsp[-1].string), (yyvsp[-2].flavor)); free((yyvsp[-3].string)); free((yyvsp[-1].string)); } + break; + + case 96: /* assign_op: T_EQUAL */ + { (yyval.flavor) = VAR_RECURSIVE; } + break; + + case 97: /* assign_op: T_COLON_EQUAL */ + { (yyval.flavor) = VAR_SIMPLE; } + break; + + case 98: /* assign_op: T_PLUS_EQUAL */ + { (yyval.flavor) = VAR_APPEND; } + break; + + case 99: /* assign_val: %empty */ + { (yyval.string) = xstrdup(""); } + break; + + + + default: break; + } + /* User semantic actions sometimes alter yychar, and that requires + that yytoken be updated with the new translation. We take the + approach of translating immediately before every use of yytoken. + One alternative is translating here after every semantic action, + but that translation would be missed if the semantic action invokes + YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or + if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an + incorrect destructor might then be invoked immediately. In the + case of YYERROR or YYBACKUP, subsequent parser actions might lead + to an incorrect destructor call or verbose syntax error message + before the lookahead is translated. */ + YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc); + + YYPOPSTACK (yylen); + yylen = 0; + + *++yyvsp = yyval; + + /* Now 'shift' the result of the reduction. Determine what state + that goes to, based on the state we popped back to and the rule + number reduced by. */ + { + const int yylhs = yyr1[yyn] - YYNTOKENS; + const int yyi = yypgoto[yylhs] + *yyssp; + yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp + ? yytable[yyi] + : yydefgoto[yylhs]); + } + + goto yynewstate; + + +/*--------------------------------------. +| yyerrlab -- here on detecting error. | +`--------------------------------------*/ +yyerrlab: + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar); + /* If not already recovering from an error, report this error. */ + if (!yyerrstatus) + { + ++yynerrs; + yyerror (YY_("syntax error")); + } + + if (yyerrstatus == 3) + { + /* If just tried and failed to reuse lookahead token after an + error, discard it. */ + + if (yychar <= YYEOF) + { + /* Return failure if at end of input. */ + if (yychar == YYEOF) + YYABORT; + } + else + { + yydestruct ("Error: discarding", + yytoken, &yylval); + yychar = YYEMPTY; + } + } + + /* Else will try to reuse lookahead token after shifting the error + token. */ + goto yyerrlab1; + + +/*---------------------------------------------------. +| yyerrorlab -- error raised explicitly by YYERROR. | +`---------------------------------------------------*/ +yyerrorlab: + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; + ++yynerrs; + + /* Do not reclaim the symbols of the rule whose action triggered + this YYERROR. */ + YYPOPSTACK (yylen); + yylen = 0; + YY_STACK_PRINT (yyss, yyssp); + yystate = *yyssp; + goto yyerrlab1; + + +/*-------------------------------------------------------------. +| yyerrlab1 -- common code for both syntax error and YYERROR. | +`-------------------------------------------------------------*/ +yyerrlab1: + yyerrstatus = 3; /* Each real token shifted decrements this. */ + + /* Pop stack until we find a state that shifts the error token. */ + for (;;) + { + yyn = yypact[yystate]; + if (!yypact_value_is_default (yyn)) + { + yyn += YYSYMBOL_YYerror; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) + { + yyn = yytable[yyn]; + if (0 < yyn) + break; + } + } + + /* Pop the current state because it cannot handle the error token. */ + if (yyssp == yyss) + YYABORT; + + + yydestruct ("Error: popping", + YY_ACCESSING_SYMBOL (yystate), yyvsp); + YYPOPSTACK (1); + yystate = *yyssp; + YY_STACK_PRINT (yyss, yyssp); + } + + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + *++yyvsp = yylval; + YY_IGNORE_MAYBE_UNINITIALIZED_END + + + /* Shift the error token. */ + YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); + + yystate = yyn; + goto yynewstate; + + +/*-------------------------------------. +| yyacceptlab -- YYACCEPT comes here. | +`-------------------------------------*/ +yyacceptlab: + yyresult = 0; + goto yyreturnlab; + + +/*-----------------------------------. +| yyabortlab -- YYABORT comes here. | +`-----------------------------------*/ +yyabortlab: + yyresult = 1; + goto yyreturnlab; + + +/*-----------------------------------------------------------. +| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. | +`-----------------------------------------------------------*/ +yyexhaustedlab: + yyerror (YY_("memory exhausted")); + yyresult = 2; + goto yyreturnlab; + + +/*----------------------------------------------------------. +| yyreturnlab -- parsing is finished, clean up and return. | +`----------------------------------------------------------*/ +yyreturnlab: + if (yychar != YYEMPTY) + { + /* Make sure we have latest lookahead translation. See comments at + user semantic actions for why this is necessary. */ + yytoken = YYTRANSLATE (yychar); + yydestruct ("Cleanup: discarding lookahead", + yytoken, &yylval); + } + /* Do not reclaim the symbols of the rule whose action triggered + this YYABORT or YYACCEPT. */ + YYPOPSTACK (yylen); + YY_STACK_PRINT (yyss, yyssp); + while (yyssp != yyss) + { + yydestruct ("Cleanup: popping", + YY_ACCESSING_SYMBOL (+*yyssp), yyvsp); + YYPOPSTACK (1); + } +#ifndef yyoverflow + if (yyss != yyssa) + YYSTACK_FREE (yyss); +#endif + + return yyresult; +} + + + +void conf_parse(const char *name) +{ + struct menu *menu; + + autoconf_cmd = str_new(); + + str_printf(&autoconf_cmd, "\ndeps_config := \\\n"); + + zconf_initscan(name); + + _menu_init(); + + if (getenv("ZCONF_DEBUG")) + yydebug = 1; + yyparse(); + + /* + * FIXME: + * cur_filename and cur_lineno are used even after yyparse(); + * menu_finalize() calls menu_add_symbol(). This should be fixed. + */ + cur_filename = ""; + cur_lineno = 0; + + str_printf(&autoconf_cmd, + "\n" + "$(autoconfig): $(deps_config)\n" + "$(deps_config): ;\n"); + + env_write_dep(&autoconf_cmd); + + /* Variables are expanded in the parse phase. We can free them here. */ + variable_all_del(); + + if (yynerrs) + exit(1); + if (!modules_sym) + modules_sym = &symbol_no; + + if (!menu_has_prompt(&rootmenu)) { + current_entry = &rootmenu; + menu_add_prompt(P_MENU, "Main menu", NULL); + } + + menu_finalize(); + + menu = &rootmenu; + while (menu) { + if (menu->sym && sym_check_deps(menu->sym)) + yynerrs++; + + if (menu->list) { + menu = menu->list; + continue; + } + + while (!menu->next && menu->parent) + menu = menu->parent; + + menu = menu->next; + } + + if (yynerrs) + exit(1); + conf_set_changed(true); +} + +static bool zconf_endtoken(const char *tokenname, + const char *expected_tokenname) +{ + if (strcmp(tokenname, expected_tokenname)) { + zconf_error("unexpected '%s' within %s block", + tokenname, expected_tokenname); + yynerrs++; + return false; + } + if (strcmp(current_menu->filename, cur_filename)) { + zconf_error("'%s' in different file than '%s'", + tokenname, expected_tokenname); + fprintf(stderr, "%s:%d: location of the '%s'\n", + current_menu->filename, current_menu->lineno, + expected_tokenname); + yynerrs++; + return false; + } + return true; +} + +static void zconfprint(const char *err, ...) +{ + va_list ap; + + fprintf(stderr, "%s:%d: ", cur_filename, cur_lineno); + va_start(ap, err); + vfprintf(stderr, err, ap); + va_end(ap); + fprintf(stderr, "\n"); +} + +static void zconf_error(const char *err, ...) +{ + va_list ap; + + yynerrs++; + fprintf(stderr, "%s:%d: ", cur_filename, cur_lineno); + va_start(ap, err); + vfprintf(stderr, err, ap); + va_end(ap); + fprintf(stderr, "\n"); +} + +static void yyerror(const char *err) +{ + fprintf(stderr, "%s:%d: %s\n", cur_filename, cur_lineno, err); +} + +static void print_quoted_string(FILE *out, const char *str) +{ + const char *p; + int len; + + putc('"', out); + while ((p = strchr(str, '"'))) { + len = p - str; + if (len) + fprintf(out, "%.*s", len, str); + fputs("\\\"", out); + str = p + 1; + } + fputs(str, out); + putc('"', out); +} + +static void print_symbol(FILE *out, struct menu *menu) +{ + struct symbol *sym = menu->sym; + struct property *prop; + + if (sym_is_choice(sym)) + fprintf(out, "\nchoice\n"); + else + fprintf(out, "\nconfig %s\n", sym->name); + switch (sym->type) { + case S_BOOLEAN: + fputs(" bool\n", out); + break; + case S_TRISTATE: + fputs(" tristate\n", out); + break; + case S_STRING: + fputs(" string\n", out); + break; + case S_INT: + fputs(" integer\n", out); + break; + case S_HEX: + fputs(" hex\n", out); + break; + default: + fputs(" ???\n", out); + break; + } + for (prop = sym->prop; prop; prop = prop->next) { + if (prop->menu != menu) + continue; + switch (prop->type) { + case P_PROMPT: + fputs(" prompt ", out); + print_quoted_string(out, prop->text); + if (!expr_is_yes(prop->visible.expr)) { + fputs(" if ", out); + expr_fprint(prop->visible.expr, out); + } + fputc('\n', out); + break; + case P_DEFAULT: + fputs( " default ", out); + expr_fprint(prop->expr, out); + if (!expr_is_yes(prop->visible.expr)) { + fputs(" if ", out); + expr_fprint(prop->visible.expr, out); + } + fputc('\n', out); + break; + case P_CHOICE: + fputs(" #choice value\n", out); + break; + case P_SELECT: + fputs( " select ", out); + expr_fprint(prop->expr, out); + fputc('\n', out); + break; + case P_IMPLY: + fputs( " imply ", out); + expr_fprint(prop->expr, out); + fputc('\n', out); + break; + case P_RANGE: + fputs( " range ", out); + expr_fprint(prop->expr, out); + fputc('\n', out); + break; + case P_MENU: + fputs( " menu ", out); + print_quoted_string(out, prop->text); + fputc('\n', out); + break; + case P_SYMBOL: + fputs( " symbol ", out); + fprintf(out, "%s\n", prop->menu->sym->name); + break; + default: + fprintf(out, " unknown prop %d!\n", prop->type); + break; + } + } + if (menu->help) { + int len = strlen(menu->help); + while (menu->help[--len] == '\n') + menu->help[len] = 0; + fprintf(out, " help\n%s\n", menu->help); + } +} + +void zconfdump(FILE *out) +{ + struct property *prop; + struct symbol *sym; + struct menu *menu; + + menu = rootmenu.list; + while (menu) { + if ((sym = menu->sym)) + print_symbol(out, menu); + else if ((prop = menu->prompt)) { + switch (prop->type) { + case P_COMMENT: + fputs("\ncomment ", out); + print_quoted_string(out, prop->text); + fputs("\n", out); + break; + case P_MENU: + fputs("\nmenu ", out); + print_quoted_string(out, prop->text); + fputs("\n", out); + break; + default: + ; + } + if (!expr_is_yes(prop->visible.expr)) { + fputs(" depends ", out); + expr_fprint(prop->visible.expr, out); + fputc('\n', out); + } + } + + if (menu->list) + menu = menu->list; + else if (menu->next) + menu = menu->next; + else while ((menu = menu->parent)) { + if (menu->prompt && menu->prompt->type == P_MENU) + fputs("\nendmenu\n", out); + if (menu->next) { + menu = menu->next; + break; + } + } + } +} diff --git a/support/kconfig/parser.tab.h_shipped b/support/kconfig/parser.tab.h_shipped new file mode 100644 index 0000000000..6459d79928 --- /dev/null +++ b/support/kconfig/parser.tab.h_shipped @@ -0,0 +1,134 @@ +/* A Bison parser, made by GNU Bison 3.8.2. */ + +/* Bison interface for Yacc-like parsers in C + + Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation, + Inc. + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +/* As a special exception, you may create a larger work that contains + part or all of the Bison parser skeleton and distribute that work + under terms of your choice, so long as that work isn't itself a + parser generator using the skeleton or a modified version thereof + as a parser skeleton. Alternatively, if you modify or redistribute + the parser skeleton itself, you may (at your option) remove this + special exception, which will cause the skeleton and the resulting + Bison output files to be licensed under the GNU General Public + License without this special exception. + + This special exception was added by the Free Software Foundation in + version 2.2 of Bison. */ + +/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual, + especially those whose name start with YY_ or yy_. They are + private implementation details that can be changed or removed. */ + +#ifndef YY_YY_SCRIPTS_KCONFIG_PARSER_TAB_H_INCLUDED +# define YY_YY_SCRIPTS_KCONFIG_PARSER_TAB_H_INCLUDED +/* Debug traces. */ +#ifndef YYDEBUG +# define YYDEBUG 1 +#endif +#if YYDEBUG +extern int yydebug; +#endif + +/* Token kinds. */ +#ifndef YYTOKENTYPE +# define YYTOKENTYPE + enum yytokentype + { + YYEMPTY = -2, + YYEOF = 0, /* "end of file" */ + YYerror = 256, /* error */ + YYUNDEF = 257, /* "invalid token" */ + T_HELPTEXT = 258, /* T_HELPTEXT */ + T_WORD = 259, /* T_WORD */ + T_WORD_QUOTE = 260, /* T_WORD_QUOTE */ + T_BOOL = 261, /* T_BOOL */ + T_CHOICE = 262, /* T_CHOICE */ + T_CLOSE_PAREN = 263, /* T_CLOSE_PAREN */ + T_COLON_EQUAL = 264, /* T_COLON_EQUAL */ + T_COMMENT = 265, /* T_COMMENT */ + T_CONFIG = 266, /* T_CONFIG */ + T_DEFAULT = 267, /* T_DEFAULT */ + T_DEF_BOOL = 268, /* T_DEF_BOOL */ + T_DEF_TRISTATE = 269, /* T_DEF_TRISTATE */ + T_DEPENDS = 270, /* T_DEPENDS */ + T_ENDCHOICE = 271, /* T_ENDCHOICE */ + T_ENDIF = 272, /* T_ENDIF */ + T_ENDMENU = 273, /* T_ENDMENU */ + T_HELP = 274, /* T_HELP */ + T_HEX = 275, /* T_HEX */ + T_IF = 276, /* T_IF */ + T_IMPLY = 277, /* T_IMPLY */ + T_INT = 278, /* T_INT */ + T_MAINMENU = 279, /* T_MAINMENU */ + T_MENU = 280, /* T_MENU */ + T_MENUCONFIG = 281, /* T_MENUCONFIG */ + T_MODULES = 282, /* T_MODULES */ + T_ON = 283, /* T_ON */ + T_OPEN_PAREN = 284, /* T_OPEN_PAREN */ + T_OPTIONAL = 285, /* T_OPTIONAL */ + T_PLUS_EQUAL = 286, /* T_PLUS_EQUAL */ + T_PROMPT = 287, /* T_PROMPT */ + T_RANGE = 288, /* T_RANGE */ + T_SELECT = 289, /* T_SELECT */ + T_SOURCE = 290, /* T_SOURCE */ + T_STRING = 291, /* T_STRING */ + T_TRISTATE = 292, /* T_TRISTATE */ + T_VISIBLE = 293, /* T_VISIBLE */ + T_EOL = 294, /* T_EOL */ + T_ASSIGN_VAL = 295, /* T_ASSIGN_VAL */ + T_OR = 296, /* T_OR */ + T_AND = 297, /* T_AND */ + T_EQUAL = 298, /* T_EQUAL */ + T_UNEQUAL = 299, /* T_UNEQUAL */ + T_LESS = 300, /* T_LESS */ + T_LESS_EQUAL = 301, /* T_LESS_EQUAL */ + T_GREATER = 302, /* T_GREATER */ + T_GREATER_EQUAL = 303, /* T_GREATER_EQUAL */ + T_NOT = 304 /* T_NOT */ + }; + typedef enum yytokentype yytoken_kind_t; +#endif + +/* Value type. */ +#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED +union YYSTYPE +{ + + char *string; + struct symbol *symbol; + struct expr *expr; + struct menu *menu; + enum symbol_type type; + enum variable_flavor flavor; + + +}; +typedef union YYSTYPE YYSTYPE; +# define YYSTYPE_IS_TRIVIAL 1 +# define YYSTYPE_IS_DECLARED 1 +#endif + + +extern YYSTYPE yylval; + + +int yyparse (void); + + +#endif /* !YY_YY_SCRIPTS_KCONFIG_PARSER_TAB_H_INCLUDED */ diff --git a/support/kconfig/zconf.y b/support/kconfig/parser.y similarity index 56% rename from support/kconfig/zconf.y rename to support/kconfig/parser.y index 7b34de28a6..9873e84b1b 100644 --- a/support/kconfig/zconf.y +++ b/support/kconfig/parser.y @@ -1,8 +1,8 @@ -%{ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (C) 2002 Roman Zippel - * Released under the terms of the GNU GPL v2.0. */ +%{ #include #include @@ -12,6 +12,8 @@ #include #include "lkc.h" +#include "internal.h" +#include "preprocess.h" #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) @@ -20,63 +22,64 @@ int cdebug = PRINTD; -int yylex(void); static void yyerror(const char *err); static void zconfprint(const char *err, ...); static void zconf_error(const char *err, ...); -static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken); - -struct symbol *symbol_hash[SYMBOL_HASHSIZE]; +static bool zconf_endtoken(const char *tokenname, + const char *expected_tokenname); -static struct menu *current_menu, *current_entry; +struct menu *current_menu, *current_entry; %} -%expect 32 %union { char *string; - struct file *file; struct symbol *symbol; struct expr *expr; struct menu *menu; - const struct kconf_id *id; + enum symbol_type type; + enum variable_flavor flavor; } -%token T_MAINMENU -%token T_MENU -%token T_ENDMENU -%token T_SOURCE -%token T_CHOICE -%token T_ENDCHOICE -%token T_COMMENT -%token T_CONFIG -%token T_MENUCONFIG -%token T_HELP %token T_HELPTEXT -%token T_IF -%token T_ENDIF -%token T_DEPENDS -%token T_OPTIONAL -%token T_PROMPT -%token T_TYPE -%token T_DEFAULT -%token T_SELECT -%token T_IMPLY -%token T_RANGE -%token T_VISIBLE -%token T_OPTION -%token T_ON %token T_WORD %token T_WORD_QUOTE -%token T_UNEQUAL -%token T_LESS -%token T_LESS_EQUAL -%token T_GREATER -%token T_GREATER_EQUAL +%token T_BOOL +%token T_CHOICE %token T_CLOSE_PAREN +%token T_COLON_EQUAL +%token T_COMMENT +%token T_CONFIG +%token T_DEFAULT +%token T_DEF_BOOL +%token T_DEF_TRISTATE +%token T_DEPENDS +%token T_ENDCHOICE +%token T_ENDIF +%token T_ENDMENU +%token T_HELP +%token T_HEX +%token T_IF +%token T_IMPLY +%token T_INT +%token T_MAINMENU +%token T_MENU +%token T_MENUCONFIG +%token T_MODULES +%token T_ON %token T_OPEN_PAREN +%token T_OPTIONAL +%token T_PLUS_EQUAL +%token T_PROMPT +%token T_RANGE +%token T_SELECT +%token T_SOURCE +%token T_STRING +%token T_TRISTATE +%token T_VISIBLE %token T_EOL +%token T_ASSIGN_VAL %left T_OR %left T_AND @@ -84,105 +87,70 @@ static struct menu *current_menu, *current_entry; %left T_LESS T_LESS_EQUAL T_GREATER T_GREATER_EQUAL %nonassoc T_NOT -%type prompt %type nonconst_symbol %type symbol +%type type logic_type default %type expr %type if_expr -%type end -%type option_name +%type end %type if_entry menu_entry choice_entry -%type symbol_option_arg word_opt +%type assign_val +%type assign_op %destructor { fprintf(stderr, "%s:%d: missing end statement for this entry\n", - $$->file->name, $$->lineno); + $$->filename, $$->lineno); if (current_menu == $$) menu_end_menu(); } if_entry menu_entry choice_entry -%{ -/* Include kconf_id.c here so it can see the token constants. */ -#include "kconf_id.c" -%} - %% -input: nl start | start; - -start: mainmenu_stmt stmt_list | no_mainmenu_stmt stmt_list; +input: mainmenu_stmt stmt_list | stmt_list; /* mainmenu entry */ -mainmenu_stmt: T_MAINMENU prompt nl +mainmenu_stmt: T_MAINMENU T_WORD_QUOTE T_EOL { menu_add_prompt(P_MENU, $2, NULL); }; -/* Default main menu, if there's no mainmenu entry */ - -no_mainmenu_stmt: /* empty */ -{ - /* - * Hack: Keep the main menu title on the heap so we can safely free it - * later regardless of whether it comes from the 'prompt' in - * mainmenu_stmt or here - */ - menu_add_prompt(P_MENU, xstrdup("Buildroot Configuration"), NULL); -}; - - stmt_list: /* empty */ | stmt_list common_stmt | stmt_list choice_stmt | stmt_list menu_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 -{ - zconf_error("unexpected option \"%s\"", $2->name); -} | stmt_list error T_EOL { zconf_error("invalid statement"); } ; -option_name: - T_DEPENDS | T_PROMPT | T_TYPE | T_SELECT | T_IMPLY | T_OPTIONAL | T_RANGE | T_DEFAULT | T_VISIBLE -; - common_stmt: - T_EOL - | if_stmt + if_stmt | comment_stmt | config_stmt | menuconfig_stmt | source_stmt + | assignment_stmt ; -option_error: - T_WORD error T_EOL { zconf_error("unknown option \"%s\"", $1); } - | error T_EOL { zconf_error("invalid option"); } -; - - /* config/menuconfig entry */ config_entry_start: T_CONFIG nonconst_symbol T_EOL { $2->flags |= SYMBOL_OPTIONAL; menu_add_entry($2); - printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), $2->name); + printd(DEBUG_PARSE, "%s:%d:config %s\n", cur_filename, cur_lineno, $2->name); }; config_stmt: config_entry_start config_option_list { - printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); + printd(DEBUG_PARSE, "%s:%d:endconfig\n", cur_filename, cur_lineno); }; menuconfig_entry_start: T_MENUCONFIG nonconst_symbol T_EOL { $2->flags |= SYMBOL_OPTIONAL; menu_add_entry($2); - printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), $2->name); + printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", cur_filename, cur_lineno, $2->name); }; menuconfig_stmt: menuconfig_entry_start config_option_list @@ -191,105 +159,90 @@ menuconfig_stmt: menuconfig_entry_start config_option_list current_entry->prompt->type = P_MENU; else zconfprint("warning: menuconfig statement without prompt"); - printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); + printd(DEBUG_PARSE, "%s:%d:endconfig\n", cur_filename, cur_lineno); }; config_option_list: /* empty */ | config_option_list config_option - | config_option_list symbol_option | config_option_list depends | config_option_list help - | config_option_list option_error - | config_option_list T_EOL ; -config_option: T_TYPE prompt_stmt_opt T_EOL +config_option: type prompt_stmt_opt T_EOL { - menu_set_type($1->stype); - printd(DEBUG_PARSE, "%s:%d:type(%u)\n", - zconf_curname(), zconf_lineno(), - $1->stype); + menu_set_type($1); + printd(DEBUG_PARSE, "%s:%d:type(%u)\n", cur_filename, cur_lineno, $1); }; -config_option: T_PROMPT prompt if_expr T_EOL +config_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL { menu_add_prompt(P_PROMPT, $2, $3); - printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); + printd(DEBUG_PARSE, "%s:%d:prompt\n", cur_filename, cur_lineno); }; -config_option: T_DEFAULT expr if_expr T_EOL +config_option: default expr if_expr T_EOL { menu_add_expr(P_DEFAULT, $2, $3); - if ($1->stype != S_UNKNOWN) - menu_set_type($1->stype); - printd(DEBUG_PARSE, "%s:%d:default(%u)\n", - zconf_curname(), zconf_lineno(), - $1->stype); + if ($1 != S_UNKNOWN) + menu_set_type($1); + printd(DEBUG_PARSE, "%s:%d:default(%u)\n", cur_filename, cur_lineno, + $1); }; config_option: T_SELECT nonconst_symbol if_expr T_EOL { menu_add_symbol(P_SELECT, $2, $3); - printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno()); + printd(DEBUG_PARSE, "%s:%d:select\n", cur_filename, cur_lineno); }; config_option: T_IMPLY nonconst_symbol if_expr T_EOL { menu_add_symbol(P_IMPLY, $2, $3); - printd(DEBUG_PARSE, "%s:%d:imply\n", zconf_curname(), zconf_lineno()); + printd(DEBUG_PARSE, "%s:%d:imply\n", cur_filename, cur_lineno); }; config_option: T_RANGE symbol symbol if_expr T_EOL { menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,$2, $3), $4); - printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno()); + printd(DEBUG_PARSE, "%s:%d:range\n", cur_filename, cur_lineno); }; -symbol_option: T_OPTION symbol_option_list T_EOL -; - -symbol_option_list: - /* empty */ - | symbol_option_list T_WORD symbol_option_arg +config_option: T_MODULES T_EOL { - const struct kconf_id *id = kconf_id_lookup($2, strlen($2)); - if (id && id->flags & TF_OPTION) { - menu_add_option(id->token, $3); - free($3); - } - else - zconfprint("warning: ignoring unknown option %s", $2); - free($2); + if (modules_sym) + zconf_error("symbol '%s' redefines option 'modules' already defined by symbol '%s'", + current_entry->sym->name, modules_sym->name); + modules_sym = current_entry->sym; }; -symbol_option_arg: - /* empty */ { $$ = NULL; } - | T_EQUAL prompt { $$ = $2; } -; - /* choice entry */ -choice: T_CHOICE word_opt T_EOL +choice: T_CHOICE T_EOL { - struct symbol *sym = sym_lookup($2, SYMBOL_CHOICE); - sym->flags |= SYMBOL_AUTO; + struct symbol *sym = sym_lookup(NULL, SYMBOL_CHOICE); + sym->flags |= SYMBOL_NO_WRITE; menu_add_entry(sym); menu_add_expr(P_CHOICE, NULL, NULL); - free($2); - printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); + printd(DEBUG_PARSE, "%s:%d:choice\n", cur_filename, cur_lineno); }; choice_entry: choice choice_option_list { + if (!current_entry->prompt) { + fprintf(stderr, "%s:%d: error: choice must have a prompt\n", + current_entry->filename, current_entry->lineno); + yynerrs++; + } + $$ = menu_add_menu(); }; choice_end: end { - if (zconf_endtoken($1, T_CHOICE, T_ENDCHOICE)) { + if (zconf_endtoken($1, "choice")) { menu_end_menu(); - printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno()); + printd(DEBUG_PARSE, "%s:%d:endchoice\n", cur_filename, cur_lineno); } }; @@ -301,43 +254,47 @@ choice_option_list: | choice_option_list choice_option | choice_option_list depends | choice_option_list help - | choice_option_list T_EOL - | choice_option_list option_error ; -choice_option: T_PROMPT prompt if_expr T_EOL +choice_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL { menu_add_prompt(P_PROMPT, $2, $3); - printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); + printd(DEBUG_PARSE, "%s:%d:prompt\n", cur_filename, cur_lineno); }; -choice_option: T_TYPE prompt_stmt_opt T_EOL +choice_option: logic_type prompt_stmt_opt T_EOL { - if ($1->stype == S_BOOLEAN || $1->stype == S_TRISTATE) { - menu_set_type($1->stype); - printd(DEBUG_PARSE, "%s:%d:type(%u)\n", - zconf_curname(), zconf_lineno(), - $1->stype); - } else - YYERROR; + menu_set_type($1); + printd(DEBUG_PARSE, "%s:%d:type(%u)\n", cur_filename, cur_lineno, $1); }; choice_option: T_OPTIONAL T_EOL { current_entry->sym->flags |= SYMBOL_OPTIONAL; - printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno()); + printd(DEBUG_PARSE, "%s:%d:optional\n", cur_filename, cur_lineno); }; choice_option: T_DEFAULT nonconst_symbol if_expr T_EOL { - if ($1->stype == S_UNKNOWN) { - menu_add_symbol(P_DEFAULT, $2, $3); - printd(DEBUG_PARSE, "%s:%d:default\n", - zconf_curname(), zconf_lineno()); - } else - YYERROR; + menu_add_symbol(P_DEFAULT, $2, $3); + printd(DEBUG_PARSE, "%s:%d:default\n", cur_filename, cur_lineno); }; +type: + logic_type + | T_INT { $$ = S_INT; } + | T_HEX { $$ = S_HEX; } + | T_STRING { $$ = S_STRING; } + +logic_type: + T_BOOL { $$ = S_BOOLEAN; } + | T_TRISTATE { $$ = S_TRISTATE; } + +default: + T_DEFAULT { $$ = S_UNKNOWN; } + | T_DEF_BOOL { $$ = S_BOOLEAN; } + | T_DEF_TRISTATE { $$ = S_TRISTATE; } + choice_block: /* empty */ | choice_block common_stmt @@ -345,9 +302,9 @@ choice_block: /* if entry */ -if_entry: T_IF expr nl +if_entry: T_IF expr T_EOL { - printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); + printd(DEBUG_PARSE, "%s:%d:if\n", cur_filename, cur_lineno); menu_add_entry(NULL); menu_add_dep($2); $$ = menu_add_menu(); @@ -355,78 +312,75 @@ if_entry: T_IF expr nl if_end: end { - if (zconf_endtoken($1, T_IF, T_ENDIF)) { + if (zconf_endtoken($1, "if")) { menu_end_menu(); - printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno()); + printd(DEBUG_PARSE, "%s:%d:endif\n", cur_filename, cur_lineno); } }; -if_stmt: if_entry if_block if_end -; - -if_block: - /* empty */ - | if_block common_stmt - | if_block menu_stmt - | if_block choice_stmt +if_stmt: if_entry stmt_list if_end ; /* menu entry */ -menu: T_MENU prompt T_EOL +menu: T_MENU T_WORD_QUOTE T_EOL { menu_add_entry(NULL); menu_add_prompt(P_MENU, $2, NULL); - printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); + printd(DEBUG_PARSE, "%s:%d:menu\n", cur_filename, cur_lineno); }; -menu_entry: menu visibility_list depends_list +menu_entry: menu menu_option_list { $$ = menu_add_menu(); }; menu_end: end { - if (zconf_endtoken($1, T_MENU, T_ENDMENU)) { + if (zconf_endtoken($1, "menu")) { menu_end_menu(); - printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno()); + printd(DEBUG_PARSE, "%s:%d:endmenu\n", cur_filename, cur_lineno); } }; -menu_stmt: menu_entry menu_block menu_end +menu_stmt: menu_entry stmt_list menu_end ; -menu_block: +menu_option_list: /* empty */ - | menu_block common_stmt - | menu_block menu_stmt - | menu_block choice_stmt + | menu_option_list visible + | menu_option_list depends ; -source_stmt: T_SOURCE prompt T_EOL +source_stmt: T_SOURCE T_WORD_QUOTE T_EOL { - printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2); + printd(DEBUG_PARSE, "%s:%d:source %s\n", cur_filename, cur_lineno, $2); zconf_nextfile($2); free($2); }; /* comment entry */ -comment: T_COMMENT prompt T_EOL +comment: T_COMMENT T_WORD_QUOTE T_EOL { menu_add_entry(NULL); menu_add_prompt(P_COMMENT, $2, NULL); - printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); + printd(DEBUG_PARSE, "%s:%d:comment\n", cur_filename, cur_lineno); }; -comment_stmt: comment depends_list +comment_stmt: comment comment_option_list +; + +comment_option_list: + /* empty */ + | comment_option_list depends ; /* help option */ help_start: T_HELP T_EOL { - printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); + printd(DEBUG_PARSE, "%s:%d:help\n", cur_filename, cur_lineno); zconf_starthelp(); }; @@ -448,28 +402,14 @@ help: help_start T_HELPTEXT /* depends option */ -depends_list: - /* empty */ - | depends_list depends - | depends_list T_EOL - | depends_list option_error -; - depends: T_DEPENDS T_ON expr T_EOL { menu_add_dep($3); - printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); + printd(DEBUG_PARSE, "%s:%d:depends on\n", cur_filename, cur_lineno); }; /* visibility option */ - -visibility_list: - /* empty */ - | visibility_list visible - | visibility_list T_EOL -; - -visible: T_VISIBLE if_expr +visible: T_VISIBLE if_expr T_EOL { menu_add_visibility($2); }; @@ -478,23 +418,14 @@ visible: T_VISIBLE if_expr prompt_stmt_opt: /* empty */ - | prompt if_expr + | T_WORD_QUOTE if_expr { menu_add_prompt(P_PROMPT, $1, $2); }; -prompt: T_WORD - | T_WORD_QUOTE -; - -end: T_ENDMENU T_EOL { $$ = $1; } - | T_ENDCHOICE T_EOL { $$ = $1; } - | T_ENDIF T_EOL { $$ = $1; } -; - -nl: - T_EOL - | nl T_EOL +end: T_ENDMENU T_EOL { $$ = "menu"; } + | T_ENDCHOICE T_EOL { $$ = "choice"; } + | T_ENDIF T_EOL { $$ = "if"; } ; if_expr: /* empty */ { $$ = NULL; } @@ -521,74 +452,105 @@ symbol: nonconst_symbol | T_WORD_QUOTE { $$ = sym_lookup($1, SYMBOL_CONST); free($1); } ; -word_opt: /* empty */ { $$ = NULL; } - | T_WORD +/* assignment statement */ + +assignment_stmt: T_WORD assign_op assign_val T_EOL { variable_add($1, $3, $2); free($1); free($3); } + +assign_op: + T_EQUAL { $$ = VAR_RECURSIVE; } + | T_COLON_EQUAL { $$ = VAR_SIMPLE; } + | T_PLUS_EQUAL { $$ = VAR_APPEND; } +; + +assign_val: + /* empty */ { $$ = xstrdup(""); }; + | T_ASSIGN_VAL +; %% void conf_parse(const char *name) { - const char *tmp; - struct symbol *sym; - int i; + struct menu *menu; + + autoconf_cmd = str_new(); + + str_printf(&autoconf_cmd, "\ndeps_config := \\\n"); zconf_initscan(name); - sym_init(); _menu_init(); if (getenv("ZCONF_DEBUG")) yydebug = 1; yyparse(); + + /* + * FIXME: + * cur_filename and cur_lineno are used even after yyparse(); + * menu_finalize() calls menu_add_symbol(). This should be fixed. + */ + cur_filename = ""; + cur_lineno = 0; + + str_printf(&autoconf_cmd, + "\n" + "$(autoconfig): $(deps_config)\n" + "$(deps_config): ;\n"); + + env_write_dep(&autoconf_cmd); + + /* Variables are expanded in the parse phase. We can free them here. */ + variable_all_del(); + if (yynerrs) exit(1); if (!modules_sym) - modules_sym = sym_find( "n" ); + modules_sym = &symbol_no; - tmp = rootmenu.prompt->text; - rootmenu.prompt->text = _(rootmenu.prompt->text); - rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text); - free((char*)tmp); + if (!menu_has_prompt(&rootmenu)) { + current_entry = &rootmenu; + menu_add_prompt(P_MENU, "Main menu", NULL); + } + + menu_finalize(); - menu_finalize(&rootmenu); - for_all_symbols(i, sym) { - if (sym_check_deps(sym)) + menu = &rootmenu; + while (menu) { + if (menu->sym && sym_check_deps(menu->sym)) yynerrs++; + + if (menu->list) { + menu = menu->list; + continue; + } + + while (!menu->next && menu->parent) + menu = menu->parent; + + menu = menu->next; } + if (yynerrs) exit(1); - sym_set_change_count(1); + conf_set_changed(true); } -static const char *zconf_tokenname(int token) -{ - switch (token) { - case T_MENU: return "menu"; - case T_ENDMENU: return "endmenu"; - case T_CHOICE: return "choice"; - case T_ENDCHOICE: return "endchoice"; - case T_IF: return "if"; - case T_ENDIF: return "endif"; - case T_DEPENDS: return "depends"; - case T_VISIBLE: return "visible"; - } - return ""; -} - -static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken) +static bool zconf_endtoken(const char *tokenname, + const char *expected_tokenname) { - if (id->token != endtoken) { + if (strcmp(tokenname, expected_tokenname)) { zconf_error("unexpected '%s' within %s block", - id->name, zconf_tokenname(starttoken)); + tokenname, expected_tokenname); yynerrs++; return false; } - if (current_menu->file != current_file) { + if (strcmp(current_menu->filename, cur_filename)) { zconf_error("'%s' in different file than '%s'", - id->name, zconf_tokenname(starttoken)); + tokenname, expected_tokenname); fprintf(stderr, "%s:%d: location of the '%s'\n", - current_menu->file->name, current_menu->lineno, - zconf_tokenname(starttoken)); + current_menu->filename, current_menu->lineno, + expected_tokenname); yynerrs++; return false; } @@ -599,7 +561,7 @@ static void zconfprint(const char *err, ...) { va_list ap; - fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); + fprintf(stderr, "%s:%d: ", cur_filename, cur_lineno); va_start(ap, err); vfprintf(stderr, err, ap); va_end(ap); @@ -611,7 +573,7 @@ static void zconf_error(const char *err, ...) va_list ap; yynerrs++; - fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); + fprintf(stderr, "%s:%d: ", cur_filename, cur_lineno); va_start(ap, err); vfprintf(stderr, err, ap); va_end(ap); @@ -620,7 +582,7 @@ static void zconf_error(const char *err, ...) static void yyerror(const char *err) { - fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); + fprintf(stderr, "%s:%d: %s\n", cur_filename, cur_lineno, err); } static void print_quoted_string(FILE *out, const char *str) @@ -714,6 +676,10 @@ static void print_symbol(FILE *out, struct menu *menu) print_quoted_string(out, prop->text); fputc('\n', out); break; + case P_SYMBOL: + fputs( " symbol ", out); + fprintf(out, "%s\n", prop->menu->sym->name); + break; default: fprintf(out, " unknown prop %d!\n", prop->type); break; @@ -773,10 +739,3 @@ void zconfdump(FILE *out) } } } - -#include "zconf.lex.c" -#include "util.c" -#include "confdata.c" -#include "expr.c" -#include "symbol.c" -#include "menu.c" diff --git a/support/kconfig/patches/01-kconfig-kernel-to-buildroot.patch b/support/kconfig/patches/01-kconfig-kernel-to-buildroot.patch index 43ae61a9c7..57d2488f9a 100644 --- a/support/kconfig/patches/01-kconfig-kernel-to-buildroot.patch +++ b/support/kconfig/patches/01-kconfig-kernel-to-buildroot.patch @@ -1,15 +1,20 @@ ---- - confdata.c | 4 ++-- - gconf.glade | 2 +- - mconf.c | 4 ++-- - zconf.tab.c_shipped | 2 +- - zconf.y | 2 +- - 5 files changed, 7 insertions(+), 7 deletions(-) - -Index: kconfig/gconf.glade -=================================================================== ---- kconfig.orig/gconf.glade -+++ kconfig/gconf.glade +diff --git a/confdata.c b/confdata.c +index 0e35c48..00a629b 100644 +--- a/confdata.c ++++ b/confdata.c +@@ -207,7 +207,7 @@ static void conf_message(const char *fmt, ...) + + const char *conf_get_configname(void) + { +- char *name = getenv("KCONFIG_CONFIG"); ++ char *name = getenv("BR2_CONFIG"); + + return name ? name : ".config"; + } +diff --git a/gconf.glade b/gconf.glade +index aa483cb..6cbc1bb 100644 +--- a/gconf.glade ++++ b/gconf.glade @@ -4,7 +4,7 @@ @@ -19,85 +24,37 @@ Index: kconfig/gconf.glade GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE False -Index: kconfig/mconf.c -=================================================================== ---- kconfig.orig/mconf.c -+++ kconfig/mconf.c -@@ -176,9 +176,9 @@ menu_instructions[] = N_( +diff --git a/mconf.c b/mconf.c +index c096909..420e173 100644 +--- a/mconf.c ++++ b/mconf.c +@@ -184,9 +184,9 @@ menu_instructions[] = "Arrow keys navigate the menu. " " selects submenus ---> (or empty submenus ----). " "Highlighted letters are hotkeys. " - "Pressing includes, excludes, modularizes features. " -+ "Pressing selects a feature, while excludes a feature. " ++ "Pressing selects a feature, while excludes a features. " "Press to exit, for Help, for Search. " -- "Legend: [*] built-in [ ] excluded module < > module capable"), -+ "Legend: [*] feature is selected [ ] feature is excluded"), - radiolist_instructions[] = N_( +- "Legend: [*] built-in [ ] excluded module < > module capable", ++ "Legend: [*] feature is selected [ ] feature is excluded", + radiolist_instructions[] = "Use the arrow keys to navigate this window or " "press the hotkey of the item you wish to select " -@@ -962,7 +962,7 @@ static int handle_exit(void) +@@ -914,7 +914,7 @@ static int handle_exit(void) if (conf_get_changed()) res = dialog_yesno(NULL, - _("Do you wish to save your new configuration?\n" -- "(Press to continue kernel configuration.)"), -+ "(Press to continue Buildroot configuration.)"), + "Do you wish to save your new configuration?\n" +- "(Press to continue kernel configuration.)", ++ "(Press to continue Buildroot configuration.)", 6, 60); else res = -1; -Index: kconfig/zconf.tab.c_shipped -=================================================================== ---- kconfig.orig/zconf.tab.c_shipped -+++ kconfig/zconf.tab.c_shipped -@@ -1515,7 +1515,7 @@ yyreduce: - * later regardless of whether it comes from the 'prompt' in - * mainmenu_stmt or here - */ -- menu_add_prompt(P_MENU, xstrdup("Linux Kernel Configuration"), NULL); -+ menu_add_prompt(P_MENU, xstrdup("Buildroot Configuration"), NULL); - } - - break; -Index: kconfig/zconf.y -=================================================================== ---- kconfig.orig/zconf.y -+++ kconfig/zconf.y -@@ -127,7 +127,7 @@ no_mainmenu_stmt: /* empty */ - * later regardless of whether it comes from the 'prompt' in - * mainmenu_stmt or here - */ -- menu_add_prompt(P_MENU, xstrdup("Linux Kernel Configuration"), NULL); -+ menu_add_prompt(P_MENU, xstrdup("Buildroot Configuration"), NULL); - }; - - -Index: kconfig/confdata.c -=================================================================== ---- kconfig.orig/confdata.c -+++ kconfig/confdata.c -@@ -30,7 +30,7 @@ static void conf_message(const char *fmt - static const char *conf_filename; - static int conf_lineno, conf_warnings; - --const char conf_defname[] = "arch/$ARCH/defconfig"; -+const char conf_defname[] = ".defconfig"; - - static void conf_warning(const char *fmt, ...) - { -@@ -69,7 +69,7 @@ static void conf_message(const char *fmt - - const char *conf_get_configname(void) - { -- char *name = getenv("KCONFIG_CONFIG"); -+ char *name = getenv("BR2_CONFIG"); - - return name ? name : ".config"; - } -Index: kconfig/qconf.cc -=================================================================== ---- kconfig.orig/qconf.cc -+++ kconfig/qconf.cc -@@ -55,7 +55,7 @@ static inline QString qgettext(const QSt - } +diff --git a/qconf.cc b/qconf.cc +index c6c42c0..50c3ccd 100644 +--- a/qconf.cc ++++ b/qconf.cc +@@ -34,7 +34,7 @@ static ConfigSettings *configSettings; + QAction *ConfigMainWindow::saveAction; ConfigSettings::ConfigSettings() - : QSettings("kernel.org", "qconf") diff --git a/support/kconfig/patches/06-br-build-system-integration.patch b/support/kconfig/patches/06-br-build-system-integration.patch index 35420cbb15..b021ebf5c9 100644 --- a/support/kconfig/patches/06-br-build-system-integration.patch +++ b/support/kconfig/patches/06-br-build-system-integration.patch @@ -1,74 +1,53 @@ -Index: kconfig/Makefile -=================================================================== ---- kconfig.orig/Makefile -+++ kconfig/Makefile -@@ -205,7 +205,35 @@ qconf-cxxobjs := qconf.o - qconf-objs := zconf.tab.o - gconf-objs := gconf.o zconf.tab.o - --hostprogs-y := conf nconf mconf kxgettext qconf gconf -+hostprogs-y := conf -+ +diff --git a/Makefile b/Makefile +index ea1bf3b..5697d38 100644 +--- a/Makefile ++++ b/Makefile +@@ -173,6 +173,7 @@ hostprogs += conf + conf-objs := conf.o $(common-objs) + + # nconf: Used for the nconfig target based on ncurses +ifeq ($(MAKECMDGOALS),nconf) -+ hostprogs-y += nconf + hostprogs += nconf + nconf-objs := nconf.o nconf.gui.o mnconf-common.o $(common-objs) + +@@ -182,8 +183,10 @@ HOSTCFLAGS_nconf.gui.o = $(call read-file, $(obj)/nconf-cflags) + + $(obj)/nconf: | $(obj)/nconf-libs + $(obj)/nconf.o $(obj)/nconf.gui.o: | $(obj)/nconf-cflags +endif -+ + + # mconf: Used for the menuconfig target based on lxdialog +ifeq ($(MAKECMDGOALS),mconf) -+ hostprogs-y += mconf -+endif -+ -+ifeq ($(MAKECMDGOALS),update-po-config) -+ hostprogs-y += kxgettext -+endif -+ -+ifeq ($(MAKECMDGOALS),qconf) -+ qconf-target := 1 -+endif -+ -+ifeq ($(MAKECMDGOALS),gconf) -+ gconf-target := 1 -+endif -+ -+ifeq ($(qconf-target),1) -+ hostprogs-y += qconf -+endif -+ -+ifeq ($(gconf-target),1) -+ hostprogs-y += gconf -+endif + hostprogs += mconf + lxdialog := $(addprefix lxdialog/, \ + checklist.o inputbox.o menubox.o textbox.o util.o yesno.o) +@@ -195,8 +198,10 @@ $(foreach f, mconf.o $(lxdialog), \ - targets += zconf.lex.c - clean-files := qconf.moc .tmp_qtcheck .tmp_gtkcheck -@@ -243,7 +271,7 @@ HOSTLOADLIBES_nconf = $(shell \ - || echo "-lmenu -lpanel -lncurses" ) - $(obj)/qconf.o: $(obj)/.tmp_qtcheck + $(obj)/mconf: | $(obj)/mconf-libs + $(addprefix $(obj)/, mconf.o $(lxdialog)): | $(obj)/mconf-cflags ++endif --ifeq ($(MAKECMDGOALS),xconfig) + # qconf: Used for the xconfig target based on Qt +ifeq ($(MAKECMDGOALS),qconf) - $(obj)/.tmp_qtcheck: $(src)/Makefile - -include $(obj)/.tmp_qtcheck + hostprogs += qconf + qconf-cxxobjs := qconf.o qconf-moc.o + qconf-objs := images.o $(common-objs) +@@ -214,8 +219,10 @@ $(obj)/qconf-moc.cc: $(src)/qconf.h FORCE | $(obj)/qconf-bin + $(call if_changed,moc) -@@ -270,9 +298,8 @@ $(obj)/.tmp_qtcheck: - echo "KC_QT_MOC=$$moc" >> $@ - endif + targets += qconf-moc.cc ++endif + # gconf: Used for the gconfig target based on GTK+ +ifeq ($(MAKECMDGOALS),gconf) - $(obj)/gconf.o: $(obj)/.tmp_gtkcheck -- --ifeq ($(MAKECMDGOALS),gconfig) - -include $(obj)/.tmp_gtkcheck + hostprogs += gconf + gconf-objs := gconf.o images.o $(common-objs) - # GTK+ needs some extra effort, too... -@@ -300,11 +327,8 @@ $(obj)/zconf.tab.o: $(obj)/zconf.lex.c +@@ -224,6 +231,7 @@ HOSTCFLAGS_gconf.o = $(call read-file, $(obj)/gconf-cflags) - $(obj)/qconf.o: $(obj)/qconf.moc - --quiet_cmd_moc = MOC $@ -- cmd_moc = $(KC_QT_MOC) -i $< -o $@ -- - $(obj)/%.moc: $(src)/%.h $(obj)/.tmp_qtcheck -- $(call cmd,moc) -+ $(KC_QT_MOC) -i $< -o $@ + $(obj)/gconf: | $(obj)/gconf-libs + $(obj)/gconf.o: | $(obj)/gconf-cflags ++endif - # Extract gconf menu items for i18n support - $(obj)/gconf.glade.h: $(obj)/gconf.glade + # check if necessary packages are available, and configure build flags + cmd_conf_cfg = $< $(addprefix $(obj)/$*conf-, cflags libs bin); touch $(obj)/$*conf-bin diff --git a/support/kconfig/patches/10-br-build-system.patch b/support/kconfig/patches/10-br-build-system.patch index abf2463691..b40e5e9160 100644 --- a/support/kconfig/patches/10-br-build-system.patch +++ b/support/kconfig/patches/10-br-build-system.patch @@ -1,13 +1,34 @@ ---- - Makefile.br | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ - foo.h | 12 ++++++++++++ - 2 files changed, 65 insertions(+) - -Index: kconfig/Makefile.br -=================================================================== +diff --git a/Makefile b/Makefile +index 5697d38..f5f934d 100644 +--- a/Makefile ++++ b/Makefile +@@ -3,6 +3,11 @@ + # Kernel configuration targets + # These targets are used from top-level makefile + ++HOSTPKG_CONFIG = pkg-config ++export HOSTPKG_CONFIG ++ ++include $(src)/Kbuild.include ++ + ifdef KBUILD_KCONFIG + Kconfig := $(KBUILD_KCONFIG) + else +@@ -234,7 +239,7 @@ $(obj)/gconf.o: | $(obj)/gconf-cflags + endif + + # check if necessary packages are available, and configure build flags +-cmd_conf_cfg = $< $(addprefix $(obj)/$*conf-, cflags libs bin); touch $(obj)/$*conf-bin ++cmd_conf_cfg = $(src)/$< $(addprefix $(obj)/$*conf-, cflags libs bin); touch $(obj)/$*conf-bin + + $(obj)/%conf-cflags $(obj)/%conf-libs $(obj)/%conf-bin: $(src)/%conf-cfg.sh + $(call cmd,conf_cfg) +diff --git a/Makefile.br b/Makefile.br +new file mode 100644 +index 0000000..d163256 --- /dev/null -+++ kconfig/Makefile.br -@@ -0,0 +1,53 @@ ++++ b/Makefile.br +@@ -0,0 +1,55 @@ +src := . +top_srcdir=../../ +top_builddir=../../ @@ -15,12 +36,11 @@ Index: kconfig/Makefile.br +obj ?= . + +include Makefile -+#HOSTCFLAGS+=-Dinline="" -include foo.h +-include $(obj)/.depend +$(obj)/.depend: $(wildcard *.h *.c) + $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) -MM *.c > $@ 2>/dev/null || : + -+__hostprogs := $(sort $(hostprogs-y) $(hostprogs-m)) ++__hostprogs := $(sort $(hostprogs)) +host-csingle := $(foreach m,$(__hostprogs),$(if $($(m)-objs),,$(m))) +host-cmulti := $(foreach m,$(__hostprogs),\ + $(if $($(m)-cxxobjs),,$(if $($(m)-objs),$(m)))) @@ -35,10 +55,10 @@ Index: kconfig/Makefile.br + $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $< -o $(obj)/$@ + +$(host-cmulti): %: $(host-cobjs) $(host-cshlib) -+ $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs)) $(HOSTLOADLIBES_$(@F)) -o $(obj)/$@ ++ $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs)) $(HOSTLDLIBS_$(@F)) -o $(obj)/$@ + +$(host-cxxmulti): %: $(host-cxxobjs) $(host-cobjs) $(host-cshlib) -+ $(HOSTCXX) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCXXFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs) $($(@F)-cxxobjs)) $(HOSTLOADLIBES_$(@F)) -o $(obj)/$@ ++ $(HOSTCXX) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCXXFLAGS_$@) $(addprefix $(obj)/,$($(@F)-objs) $($(@F)-cxxobjs)) $(HOSTLDLIBS_$(@F)) -o $(obj)/$@ + +$(obj)/%.o: %.c + $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCFLAGS_$(@F)) -c $< -o $@ @@ -49,6 +69,9 @@ Index: kconfig/Makefile.br +$(obj)/%.o: %.cc + $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCXXFLAGS_$(@F)) -c $< -o $@ + ++$(obj)/%.o: $(obj)/%.cc ++ $(HOSTCC) $(HOST_EXTRACFLAGS) $(HOSTCFLAGS) $(HOSTCXXFLAGS_$(@F)) -c $< -o $@ ++ +$(obj)/%:: $(src)/%_shipped + $(Q)cat $< > $@ + @@ -61,20 +84,3 @@ Index: kconfig/Makefile.br + +FORCE: +.PHONY: FORCE clean distclean -Index: kconfig/foo.h -=================================================================== ---- /dev/null -+++ kconfig/foo.h -@@ -0,0 +1,12 @@ -+#ifndef __KCONFIG_FOO_H -+#define __KCONFIG_FOO_H -+ -+#ifndef __APPLE__ -+#include -+#endif -+#include -+ -+#ifndef PATH_MAX -+#define PATH_MAX 1024 -+#endif -+#endif /* __KCONFIG_FOO_H */ diff --git a/support/kconfig/patches/11-use-mktemp-for-lxdialog.patch b/support/kconfig/patches/11-use-mktemp-for-lxdialog.patch deleted file mode 100644 index 387c633ae2..0000000000 --- a/support/kconfig/patches/11-use-mktemp-for-lxdialog.patch +++ /dev/null @@ -1,17 +0,0 @@ ---- - lxdialog/check-lxdialog.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: kconfig/lxdialog/check-lxdialog.sh -=================================================================== ---- kconfig.orig/lxdialog/check-lxdialog.sh -+++ kconfig/lxdialog/check-lxdialog.sh -@@ -41,7 +41,7 @@ ccflags() - } - - # Temp file, try to clean up after us --tmp=.lxdialog.tmp -+tmp=$(mktemp) - trap "rm -f $tmp" 0 1 2 3 15 - - # Check if we can link to ncurses diff --git a/support/kconfig/patches/12-fix-glade-file-path.patch b/support/kconfig/patches/12-fix-glade-file-path.patch index 7d5941fc9e..0bcb04e62d 100644 --- a/support/kconfig/patches/12-fix-glade-file-path.patch +++ b/support/kconfig/patches/12-fix-glade-file-path.patch @@ -1,12 +1,8 @@ ---- - gconf.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -Index: kconfig/gconf.c -=================================================================== ---- kconfig.orig/gconf.c -+++ kconfig/gconf.c -@@ -1462,7 +1462,7 @@ int main(int ac, char *av[]) +diff --git a/gconf.c b/gconf.c +index 9709aca..d24cebd 100644 +--- a/gconf.c ++++ b/gconf.c +@@ -1452,7 +1452,7 @@ int main(int ac, char *av[]) /* Determine GUI path */ env = getenv(SRCTREE); if (env) diff --git a/support/kconfig/patches/14-support-out-of-tree-config.patch b/support/kconfig/patches/14-support-out-of-tree-config.patch index a3b33ba688..02d438429e 100644 --- a/support/kconfig/patches/14-support-out-of-tree-config.patch +++ b/support/kconfig/patches/14-support-out-of-tree-config.patch @@ -1,36 +1,18 @@ ---- - conf.c | 1 - confdata.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++--------------- - util.c | 16 +++++++++++++-- - 3 files changed, 61 insertions(+), 18 deletions(-) - -Index: kconfig/conf.c -=================================================================== ---- kconfig.orig/conf.c -+++ kconfig/conf.c -@@ -565,7 +565,6 @@ int main(int ac, char **av) - } - name = av[optind]; - conf_parse(name); -- //zconfdump(stdout); - if (sync_kconfig) { - name = conf_get_configname(); - if (stat(name, &tmpstat)) { -Index: kconfig/confdata.c -=================================================================== ---- kconfig.orig/confdata.c -+++ kconfig/confdata.c -@@ -13,6 +13,7 @@ +diff --git a/confdata.c b/confdata.c +index 00a629b..eb952e8 100644 +--- a/confdata.c ++++ b/confdata.c +@@ -17,6 +17,7 @@ #include #include #include +#include + #include "internal.h" #include "lkc.h" +@@ -214,9 +215,7 @@ const char *conf_get_configname(void) -@@ -76,9 +77,7 @@ const char *conf_get_configname(void) - - const char *conf_get_autoconfig_name(void) + static const char *conf_get_autoconfig_name(void) { - char *name = getenv("KCONFIG_AUTOCONFIG"); - @@ -38,170 +20,4 @@ Index: kconfig/confdata.c + return getenv("KCONFIG_AUTOCONFIG"); } - static char *conf_expand_value(const char *in) -@@ -748,6 +747,9 @@ int conf_write(const char *name) - char dirname[PATH_MAX+1], tmpname[PATH_MAX+1], newname[PATH_MAX+1]; - char *env; - -+ if (!name) -+ name = conf_get_configname(); -+ - dirname[0] = 0; - if (name && name[0]) { - struct stat st; -@@ -842,6 +844,7 @@ static int conf_split_config(void) - { - const char *name; - char path[PATH_MAX+1]; -+ char *opwd, *dir, *_name; - char *s, *d, c; - struct symbol *sym; - struct stat sb; -@@ -851,8 +854,20 @@ static int conf_split_config(void) - conf_read_simple(name, S_DEF_AUTO); - sym_calc_value(modules_sym); - -- if (chdir("include/config")) -- return 1; -+ opwd = malloc(256); -+ _name = strdup(name); -+ if (opwd == NULL || _name == NULL) -+ return 1; -+ opwd = getcwd(opwd, 256); -+ dir = dirname(_name); -+ if (dir == NULL) { -+ res = 1; -+ goto err; -+ } -+ if (chdir(dir)) { -+ res = 1; -+ goto err; -+ } - - res = 0; - for_all_symbols(i, sym) { -@@ -945,9 +960,11 @@ static int conf_split_config(void) - close(fd); - } - out: -- if (chdir("../..")) -- return 1; -- -+ if (chdir(opwd)) -+ res = 1; -+err: -+ free(opwd); -+ free(_name); - return res; - } - -@@ -957,25 +974,38 @@ int conf_write_autoconf(void) - const char *name; - FILE *out, *tristate, *out_h; - int i; -+ char dir[PATH_MAX+1], buf[PATH_MAX+1]; -+ char *s; -+ -+ strcpy(dir, conf_get_configname()); -+ s = strrchr(dir, '/'); -+ if (s) -+ s[1] = 0; -+ else -+ dir[0] = 0; - - sym_clear_all_valid(); - -- file_write_dep("include/config/auto.conf.cmd"); -+ sprintf(buf, "%s.config.cmd", dir); -+ file_write_dep(buf); - - if (conf_split_config()) - return 1; - -- out = fopen(".tmpconfig", "w"); -+ sprintf(buf, "%s.tmpconfig", dir); -+ out = fopen(buf, "w"); - if (!out) - return 1; - -- tristate = fopen(".tmpconfig_tristate", "w"); -+ sprintf(buf, "%s.tmpconfig_tristate", dir); -+ tristate = fopen(buf, "w"); - if (!tristate) { - fclose(out); - return 1; - } - -- out_h = fopen(".tmpconfig.h", "w"); -+ sprintf(buf, "%s.tmpconfig.h", dir); -+ out_h = fopen(buf, "w"); - if (!out_h) { - fclose(out); - fclose(tristate); -@@ -1007,19 +1037,22 @@ int conf_write_autoconf(void) - name = getenv("KCONFIG_AUTOHEADER"); - if (!name) - name = "include/generated/autoconf.h"; -- if (rename(".tmpconfig.h", name)) -+ sprintf(buf, "%s.tmpconfig.h", dir); -+ if (rename(buf, name)) - return 1; - name = getenv("KCONFIG_TRISTATE"); - if (!name) - name = "include/config/tristate.conf"; -- if (rename(".tmpconfig_tristate", name)) -+ sprintf(buf, "%s.tmpconfig_tristate", dir); -+ if (rename(buf, name)) - return 1; - name = conf_get_autoconfig_name(); - /* - * This must be the last step, kbuild has a dependency on auto.conf - * and this marks the successful completion of the previous steps. - */ -- if (rename(".tmpconfig", name)) -+ sprintf(buf, "%s.tmpconfig", dir); -+ if (rename(buf, name)) - return 1; - - return 0; -Index: kconfig/util.c -=================================================================== ---- kconfig.orig/util.c -+++ kconfig/util.c -@@ -34,6 +34,8 @@ struct file *file_lookup(const char *nam - /* write a dependency file as used by kbuild to track dependencies */ - int file_write_dep(const char *name) - { -+ char *str; -+ char buf[PATH_MAX+1], buf2[PATH_MAX+1], dir[PATH_MAX+1]; - struct symbol *sym, *env_sym; - struct expr *e; - struct file *file; -@@ -41,7 +43,16 @@ int file_write_dep(const char *name) - - if (!name) - name = ".kconfig.d"; -- out = fopen("..config.tmp", "w"); -+ -+ strcpy(dir, conf_get_configname()); -+ str = strrchr(dir, '/'); -+ if (str) -+ str[1] = 0; -+ else -+ dir[0] = 0; -+ -+ sprintf(buf, "%s..config.tmp", dir); -+ out = fopen(buf, "w"); - if (!out) - return 1; - fprintf(out, "deps_config := \\\n"); -@@ -72,7 +83,8 @@ int file_write_dep(const char *name) - - fprintf(out, "\n$(deps_config): ;\n"); - fclose(out); -- rename("..config.tmp", name); -+ sprintf(buf2, "%s%s", dir, name); -+ rename(buf, buf2); - return 0; - } - + static const char *conf_get_autoheader_name(void) diff --git a/support/kconfig/patches/16-fix-space-to-de-select-options.patch b/support/kconfig/patches/16-fix-space-to-de-select-options.patch index 08f7ec5d95..2b7a4f5655 100644 --- a/support/kconfig/patches/16-fix-space-to-de-select-options.patch +++ b/support/kconfig/patches/16-fix-space-to-de-select-options.patch @@ -3,21 +3,21 @@ Author: Yann E. MORIN Date: Wed Nov 13 22:45:02 2013 +0100 support/kconfig: fix 'space' to (de)select options - + In case a menu has comment without letters/numbers (eg. characters matching the regexp '^[^[:alpha:][:digit:]]+$', for example - or *), hitting space will cycle through those comments, rather than selecting/deselecting the currently-highlighted option. - + This is the behaviour of hitting any letter/digit: jump to the next option which prompt starts with that letter. The only letters that do not behave as such are 'y' 'm' and 'n'. Prompts that start with one of those three letters are instead matched on the first letter that is not 'y', 'm' or 'n'. - + Fix that by treating 'space' as we treat y/m/n, ie. as an action key, not as shortcut to jump to prompt. - + Signed-off-by: "Yann E. MORIN" Cc: Thomas Petazzoni Cc: Peter Korsgaard @@ -25,12 +25,11 @@ Date: Wed Nov 13 22:45:02 2013 +0100 Cc: Thomas De Schampheleire --- Note: I'll be running this upstream soonish. - -Index: kconfig/lxdialog/menubox.c -=================================================================== ---- kconfig.orig/lxdialog/menubox.c -+++ kconfig/lxdialog/menubox.c -@@ -285,7 +285,7 @@ do_resize: +diff --git a/lxdialog/menubox.c b/lxdialog/menubox.c +index 6e6244d..d4c19b7 100644 +--- a/lxdialog/menubox.c ++++ b/lxdialog/menubox.c +@@ -264,7 +264,7 @@ do_resize: if (key < 256 && isalpha(key)) key = tolower(key); diff --git a/support/kconfig/patches/17-backport-kecho.patch b/support/kconfig/patches/17-backport-kecho.patch deleted file mode 100644 index 9d13876616..0000000000 --- a/support/kconfig/patches/17-backport-kecho.patch +++ /dev/null @@ -1,26 +0,0 @@ -This commit added kecho to scripts/Kbuild.include (and doc). -Backported just Kbuild.include part to Makefile - -commit 5410ecc0def8955ab99810c5626cc7e156991896 -Author: Mike Frysinger -Date: Thu Nov 6 03:31:34 2008 -0500 - - kbuild: introduce $(kecho) convenience echo - -Index: kconfig/Makefile -=================================================================== ---- kconfig.orig/Makefile -+++ kconfig/Makefile -@@ -6,6 +6,12 @@ - PHONY += xconfig gconfig menuconfig config syncconfig update-po-config \ - localmodconfig localyesconfig - -+# Easy method for doing a status message -+ kecho := : -+ quiet_kecho := echo -+silent_kecho := : -+kecho := $($(quiet)kecho) -+ - ifdef KBUILD_KCONFIG - Kconfig := $(KBUILD_KCONFIG) - else diff --git a/support/kconfig/patches/18-merge-config.sh-create-temporary-files-in-tmp.patch b/support/kconfig/patches/18-merge-config.sh-create-temporary-files-in-tmp.patch index f2a261f308..342d6359f6 100644 --- a/support/kconfig/patches/18-merge-config.sh-create-temporary-files-in-tmp.patch +++ b/support/kconfig/patches/18-merge-config.sh-create-temporary-files-in-tmp.patch @@ -11,17 +11,18 @@ Date: Mon, 7 Dec 2015 12:08:45 -0200 Signed-off-by: Henrique Marks Signed-off-by: Carlos Santos Signed-off-by: Peter Korsgaard - -Index: kconfig/merge_config.sh -=================================================================== ---- kconfig.orig/merge_config.sh -+++ kconfig/merge_config.sh -@@ -100,7 +100,7 @@ fi +diff --git a/merge_config.sh b/merge_config.sh +index 902eb42..05737ba 100755 +--- a/merge_config.sh ++++ b/merge_config.sh +@@ -120,8 +120,8 @@ MERGE_LIST=$* + SED_CONFIG_EXP1="s/^\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)=.*/\1/p" + SED_CONFIG_EXP2="s/^# \(${CONFIG_PREFIX}[a-zA-Z0-9_]*\) is not set$/\1/p" - MERGE_LIST=$* - SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p" -TMP_FILE=$(mktemp ./.tmp.config.XXXXXXXXXX) +-MERGE_FILE=$(mktemp ./.merge_tmp.config.XXXXXXXXXX) +TMP_FILE=$(mktemp -t .tmp.config.XXXXXXXXXX) ++MERGE_FILE=$(mktemp -t .merge_tmp.config.XXXXXXXXXX) echo "Using $INITFILE as base" - cat $INITFILE > $TMP_FILE + diff --git a/support/kconfig/patches/19-merge_config.sh-add-br2-external-support.patch b/support/kconfig/patches/19-merge_config.sh-add-br2-external-support.patch index 1d0ef323bd..0b4814da1e 100644 --- a/support/kconfig/patches/19-merge_config.sh-add-br2-external-support.patch +++ b/support/kconfig/patches/19-merge_config.sh-add-br2-external-support.patch @@ -12,20 +12,20 @@ Date: Tue, 9 Jan 2018 14:37:43 +0300 Acked-by: "Yann E. MORIN" Signed-off-by: Peter Korsgaard -Index: kconfig/merge_config.sh -=================================================================== ---- kconfig.orig/merge_config.sh -+++ kconfig/merge_config.sh -@@ -33,6 +33,7 @@ usage() { - echo " -n use allnoconfig instead of alldefconfig" - echo " -r list redundant entries when merging fragments" +diff --git a/merge_config.sh b/merge_config.sh +index 05737ba..a5c0348 100755 +--- a/merge_config.sh ++++ b/merge_config.sh +@@ -30,6 +30,7 @@ usage() { echo " -O dir to put generated output files. Consider setting \$KCONFIG_CONFIG instead." + echo " -s strict mode. Fail if the fragment redefines any value." + echo " -Q disable warning messages for overridden options." + echo " -e colon-separated list of br2-external trees to use (optional)" + echo + echo "Used prefix: '$CONFIG_PREFIX'. You can redefine it with \$CONFIG_ environment variable." } - - RUNMAKE=true -@@ -71,6 +72,11 @@ while true; do - shift 2 +@@ -89,6 +90,11 @@ while true; do + shift continue ;; + "-e") @@ -36,7 +36,7 @@ Index: kconfig/merge_config.sh *) break ;; -@@ -151,7 +157,7 @@ fi +@@ -194,7 +200,7 @@ fi # Use the merged file as the starting point for: # alldefconfig: Fills in any missing symbols with Kconfig default # allnoconfig: Fills in any missing symbols with # CONFIG_* is not set diff --git a/support/kconfig/patches/20-merge_config.sh-Allow-to-define-config-prefix.patch b/support/kconfig/patches/20-merge_config.sh-Allow-to-define-config-prefix.patch deleted file mode 100644 index 645043b163..0000000000 --- a/support/kconfig/patches/20-merge_config.sh-Allow-to-define-config-prefix.patch +++ /dev/null @@ -1,31 +0,0 @@ -Index: kconfig/merge_config.sh -=================================================================== ---- kconfig.orig/merge_config.sh -+++ kconfig/merge_config.sh -@@ -34,12 +34,16 @@ usage() { - echo " -r list redundant entries when merging fragments" - echo " -O dir to put generated output files. Consider setting \$KCONFIG_CONFIG instead." - echo " -e colon-separated list of br2-external trees to use (optional)" -+ echo -+ echo "Used prefix: '$CONFIG_PREFIX'. You can redefine it with \$CONFIG_ -+ environment variable." - } - - RUNMAKE=true - ALLTARGET=alldefconfig - WARNREDUN=false - OUTPUT=. -+CONFIG_PREFIX=${CONFIG_-CONFIG_} - - while true; do - case $1 in -@@ -105,7 +109,8 @@ if [ ! -r "$INITFILE" ]; then - fi - - MERGE_LIST=$* --SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(CONFIG_[a-zA-Z0-9_]*\)[= ].*/\2/p" -+SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)[= ].*/\2/p" -+ - TMP_FILE=$(mktemp -t .tmp.config.XXXXXXXXXX) - - echo "Using $INITFILE as base" diff --git a/support/kconfig/patches/21-Avoid-false-positive-matches-from-comment-lines.patch b/support/kconfig/patches/21-Avoid-false-positive-matches-from-comment-lines.patch deleted file mode 100644 index c11144e47e..0000000000 --- a/support/kconfig/patches/21-Avoid-false-positive-matches-from-comment-lines.patch +++ /dev/null @@ -1,32 +0,0 @@ -Index: kconfig/merge_config.sh -=================================================================== ---- kconfig.orig/merge_config.sh -+++ kconfig/merge_config.sh -@@ -109,7 +109,8 @@ if [ ! -r "$INITFILE" ]; then - fi - - MERGE_LIST=$* --SED_CONFIG_EXP="s/^\(# \)\{0,1\}\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)[= ].*/\2/p" -+SED_CONFIG_EXP1="s/^\(${CONFIG_PREFIX}[a-zA-Z0-9_]*\)=.*/\1/p" -+SED_CONFIG_EXP2="s/^# \(${CONFIG_PREFIX}[a-zA-Z0-9_]*\) is not set$/\1/p" - - TMP_FILE=$(mktemp -t .tmp.config.XXXXXXXXXX) - -@@ -123,7 +124,7 @@ for MERGE_FILE in $MERGE_LIST ; do - echo "The merge file '$MERGE_FILE' does not exist. Exit." >&2 - exit 1 - fi -- CFG_LIST=$(sed -n "$SED_CONFIG_EXP" $MERGE_FILE) -+ CFG_LIST=$(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $MERGE_FILE) - - for CFG in $CFG_LIST ; do - grep -q -w $CFG $TMP_FILE || continue -@@ -166,7 +167,7 @@ make KCONFIG_ALLCONFIG=$TMP_FILE $EXTERN - - - # Check all specified config values took (might have missed-dependency issues) --for CFG in $(sed -n "$SED_CONFIG_EXP" $TMP_FILE); do -+for CFG in $(sed -n -e "$SED_CONFIG_EXP1" -e "$SED_CONFIG_EXP2" $TMP_FILE); do - - REQUESTED_VAL=$(grep -w -e "$CFG" $TMP_FILE) - ACTUAL_VAL=$(grep -w -e "$CFG" "$KCONFIG_CONFIG") diff --git a/support/kconfig/patches/22-kconfig-lxdialog-fix-check-with-GCC14.patch b/support/kconfig/patches/22-kconfig-lxdialog-fix-check-with-GCC14.patch deleted file mode 100644 index 41081bb45d..0000000000 --- a/support/kconfig/patches/22-kconfig-lxdialog-fix-check-with-GCC14.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 3ae91337b53fa3ccf0bad7f181fcaf483fab22ee Mon Sep 17 00:00:00 2001 -From: Robert Marko -Date: Wed, 3 Apr 2024 14:18:07 +0200 -Subject: [PATCH] kconfig/lxdialog: fix check() with GCC14 -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -GCC14 now treats implicit int types as error so when check() from -check-lxdialog.sh is called to check whether we can link against ncurses -it will fail silently and the help text indicating to install ncurses is -printed. - -However, this is not due to missing ncurses but once the stderr redirect -to /dev/null is removed we can see the root cause: -:2:1: error: return type defaults to ‘int’ [-Wimplicit-int] - -So, in order for menuconfig to work with GCC14 lets just specify the -return type of main() as int. - -Signed-off-by: Robert Marko -Reviewed-by: Petr Vorel -Tested-by: Petr Vorel ---- - kconfig/lxdialog/check-lxdialog.sh | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/kconfig/lxdialog/check-lxdialog.sh b/kconfig/lxdialog/check-lxdialog.sh -index 16cd9a3186..27d6c30a57 100755 ---- a/kconfig/lxdialog/check-lxdialog.sh -+++ b/kconfig/lxdialog/check-lxdialog.sh -@@ -48,7 +48,7 @@ trap "rm -f $tmp" 0 1 2 3 15 - check() { - $cc -x c - -o $tmp 2>/dev/null <<'EOF' - #include CURSES_LOC --main() {} -+int main() {} - EOF - if [ $? != 0 ]; then - echo " *** Unable to find the ncurses libraries or the" 1>&2 --- -2.44.0 - diff --git a/support/kconfig/patches/23-Revert-kconfig-allow-only-config-comment-and-if-insi.patch b/support/kconfig/patches/23-Revert-kconfig-allow-only-config-comment-and-if-insi.patch new file mode 100644 index 0000000000..d5a011bb6e --- /dev/null +++ b/support/kconfig/patches/23-Revert-kconfig-allow-only-config-comment-and-if-insi.patch @@ -0,0 +1,956 @@ +Revert "kconfig: allow only 'config', 'comment', and 'if' inside 'choice'" + +This reverts linux mainline commit 09d5873e4d1f70202314b5fe40160f9b14b9d2d0 +as applied to buildroot support/kconfig (additional update imported +parser.tab.c_shipped). + +Original patch header: + +The code block surrounded by 'if' ... 'endif' is reduced into if_stmt, +which is accepted in the 'choice' context. Therefore, you can write any +statements within a choice block by wrapping 'if y' ... 'end'. + +For example, you can create a menu inside a choice, like follows: + +---------------->8---------------- + choice + prompt "choice" + + config A + bool "A" + + config B + bool "B" + + if y + + menu "strange menu" + + config C + bool "C" + + endmenu + + endif + + endchoice +---------------->8---------------- + +I want to change such a weird structure into a syntax error. + +In fact, the USB gadget Kconfig had used nested 'choice' for no good +reason until commit df8df5e4bc37 ("usb: get rid of 'choice' for +legacy gadget drivers") killed it. + +I think the 'source' inside 'choice' is on the fence. It is at least +gramatically sensible as long as the included file contains only +bool/tristate configs. However, it makes the code unreadable, and people +tend to forget the fact that the file is included from the choice +block. Commit 10e5e6c24963 ("usb: gadget: move choice ... endchoice to +legacy/Kconfig") got rid of the only usecase. + +Going forward, you can only use 'config', 'comment', and 'if' inside +'choice'. This also recursively applies to 'if' blocks inside 'choice'. + +Signed-off-by: Masahiro Yamada +[Revert and applied to buildroot support/kconfig] +Signed-off-by: Peter Seiderer +diff --git a/parser.tab.c_shipped b/parser.tab.c_shipped +index 85234d0..092da33 100644 +--- a/parser.tab.c_shipped ++++ b/parser.tab.c_shipped +@@ -177,7 +177,7 @@ enum yysymbol_kind_t + YYSYMBOL_input = 51, /* input */ + YYSYMBOL_mainmenu_stmt = 52, /* mainmenu_stmt */ + YYSYMBOL_stmt_list = 53, /* stmt_list */ +- YYSYMBOL_stmt_list_in_choice = 54, /* stmt_list_in_choice */ ++ YYSYMBOL_common_stmt = 54, /* common_stmt */ + YYSYMBOL_config_entry_start = 55, /* config_entry_start */ + YYSYMBOL_config_stmt = 56, /* config_stmt */ + YYSYMBOL_menuconfig_entry_start = 57, /* menuconfig_entry_start */ +@@ -193,10 +193,10 @@ enum yysymbol_kind_t + YYSYMBOL_type = 67, /* type */ + YYSYMBOL_logic_type = 68, /* logic_type */ + YYSYMBOL_default = 69, /* default */ +- YYSYMBOL_if_entry = 70, /* if_entry */ +- YYSYMBOL_if_end = 71, /* if_end */ +- YYSYMBOL_if_stmt = 72, /* if_stmt */ +- YYSYMBOL_if_stmt_in_choice = 73, /* if_stmt_in_choice */ ++ YYSYMBOL_choice_block = 70, /* choice_block */ ++ YYSYMBOL_if_entry = 71, /* if_entry */ ++ YYSYMBOL_if_end = 72, /* if_end */ ++ YYSYMBOL_if_stmt = 73, /* if_stmt */ + YYSYMBOL_menu = 74, /* menu */ + YYSYMBOL_menu_entry = 75, /* menu_entry */ + YYSYMBOL_menu_end = 76, /* menu_end */ +@@ -546,16 +546,16 @@ union yyalloc + /* YYFINAL -- State number of the termination state. */ + #define YYFINAL 6 + /* YYLAST -- Last index in YYTABLE. */ +-#define YYLAST 186 ++#define YYLAST 189 + + /* YYNTOKENS -- Number of terminals. */ + #define YYNTOKENS 50 + /* YYNNTS -- Number of nonterminals. */ + #define YYNNTS 46 + /* YYNRULES -- Number of rules. */ +-#define YYNRULES 103 ++#define YYNRULES 100 + /* YYNSTATES -- Number of states. */ +-#define YYNSTATES 182 ++#define YYNSTATES 177 + + /* YYMAXUTOK -- Last valid token kind. */ + #define YYMAXUTOK 304 +@@ -610,16 +610,16 @@ static const yytype_int8 yytranslate[] = + static const yytype_int16 yyrline[] = + { + 0, 108, 108, 108, 112, 117, 119, 120, 121, 122, +- 123, 124, 125, 126, 127, 128, 131, 133, 134, 135, +- 136, 141, 148, 153, 160, 169, 171, 172, 173, 176, +- 182, 188, 197, 203, 209, 215, 225, 234, 245, 253, +- 256, 258, 259, 260, 263, 269, 275, 281, 288, 289, +- 290, 291, 294, 295, 298, 299, 300, 304, 312, 320, +- 323, 328, 335, 340, 348, 351, 353, 354, 357, 366, +- 373, 376, 378, 383, 389, 407, 414, 421, 423, 428, +- 429, 430, 433, 434, 437, 438, 439, 440, 441, 442, +- 443, 444, 445, 446, 447, 451, 453, 454, 459, 462, +- 463, 464, 468, 469 ++ 123, 127, 128, 129, 130, 131, 132, 137, 144, 149, ++ 156, 165, 167, 168, 169, 172, 178, 184, 193, 199, ++ 205, 211, 221, 230, 241, 249, 252, 254, 255, 256, ++ 259, 265, 271, 277, 284, 285, 286, 287, 290, 291, ++ 294, 295, 296, 298, 300, 305, 313, 321, 326, 333, ++ 338, 346, 349, 351, 352, 355, 364, 371, 374, 376, ++ 381, 387, 405, 412, 419, 421, 426, 427, 428, 431, ++ 432, 435, 436, 437, 438, 439, 440, 441, 442, 443, ++ 444, 445, 449, 451, 452, 457, 460, 461, 462, 466, ++ 467 + }; + #endif + +@@ -644,15 +644,15 @@ static const char *const yytname[] = + "T_PROMPT", "T_RANGE", "T_SELECT", "T_SOURCE", "T_STRING", "T_TRISTATE", + "T_VISIBLE", "T_EOL", "T_ASSIGN_VAL", "T_OR", "T_AND", "T_EQUAL", + "T_UNEQUAL", "T_LESS", "T_LESS_EQUAL", "T_GREATER", "T_GREATER_EQUAL", +- "T_NOT", "$accept", "input", "mainmenu_stmt", "stmt_list", +- "stmt_list_in_choice", "config_entry_start", "config_stmt", +- "menuconfig_entry_start", "menuconfig_stmt", "config_option_list", +- "config_option", "choice", "choice_entry", "choice_end", "choice_stmt", +- "choice_option_list", "choice_option", "type", "logic_type", "default", +- "if_entry", "if_end", "if_stmt", "if_stmt_in_choice", "menu", +- "menu_entry", "menu_end", "menu_stmt", "menu_option_list", "source_stmt", +- "comment", "comment_stmt", "comment_option_list", "help_start", "help", +- "depends", "visible", "prompt_stmt_opt", "end", "if_expr", "expr", ++ "T_NOT", "$accept", "input", "mainmenu_stmt", "stmt_list", "common_stmt", ++ "config_entry_start", "config_stmt", "menuconfig_entry_start", ++ "menuconfig_stmt", "config_option_list", "config_option", "choice", ++ "choice_entry", "choice_end", "choice_stmt", "choice_option_list", ++ "choice_option", "type", "logic_type", "default", "choice_block", ++ "if_entry", "if_end", "if_stmt", "menu", "menu_entry", "menu_end", ++ "menu_stmt", "menu_option_list", "source_stmt", "comment", ++ "comment_stmt", "comment_option_list", "help_start", "help", "depends", ++ "visible", "prompt_stmt_opt", "end", "if_expr", "expr", + "nonconst_symbol", "symbol", "assignment_stmt", "assign_op", + "assign_val", YY_NULLPTR + }; +@@ -664,7 +664,7 @@ yysymbol_name (yysymbol_kind_t yysymbol) + } + #endif + +-#define YYPACT_NINF (-62) ++#define YYPACT_NINF (-67) + + #define yypact_value_is_default(Yyn) \ + ((Yyn) == YYPACT_NINF) +@@ -678,25 +678,24 @@ yysymbol_name (yysymbol_kind_t yysymbol) + STATE-NUM. */ + static const yytype_int16 yypact[] = + { +- 5, 30, 39, -62, 33, 13, -62, 62, 16, 17, +- 22, 41, 60, 2, 77, 60, 79, -62, -62, -62, +- -62, -62, -62, -62, -62, -62, -62, -62, -62, -62, +- -62, -62, -62, -62, -62, 26, -62, -62, -62, 27, +- -62, 47, -62, 50, -62, 2, 2, -20, -62, 31, +- 52, 55, 59, 107, 107, 130, 155, 89, -6, 89, +- 86, -62, -62, 69, -62, -62, 8, -62, -62, 2, +- 2, 23, 23, 23, 23, 23, 23, -62, -62, -62, +- -62, -62, -62, -62, 81, 72, -62, 60, -62, 78, +- 111, 23, 60, -62, -62, -62, 113, -62, 2, 120, +- -62, -62, 60, 92, 123, -62, 113, -62, -62, 93, +- 94, 108, 115, -62, -62, -62, -62, -62, -62, -62, +- -62, 104, -62, -62, -62, -62, -62, -62, -62, 110, +- -62, -62, -62, -62, -62, -62, -62, 2, -62, 104, +- -62, 104, 23, 104, 104, 119, 15, -62, 104, -62, +- 104, 122, -62, -62, -62, -62, 155, 2, 124, 96, +- 125, 129, 104, 131, -62, -62, 135, 136, 138, -62, +- -62, 29, -62, -62, -62, -62, 139, -62, -62, -62, +- -62, -62 ++ 15, 13, 29, -67, 30, 19, -67, 59, 22, 11, ++ 23, 52, 60, -1, 62, 60, 63, -67, -67, -67, ++ -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, ++ -67, -67, -67, -67, -67, -67, 32, -67, -67, -67, ++ 37, -67, 33, -67, 47, -67, -1, -1, 34, -67, ++ 141, 48, 49, 53, 111, 111, 84, 142, 94, 6, ++ 94, 76, -67, -67, 58, -67, -67, 5, -67, -67, ++ -1, -1, 18, 18, 18, 18, 18, 18, -67, -67, ++ -67, -67, -67, -67, -67, 72, 67, -67, 60, -67, ++ 69, 97, 18, 60, -67, -67, -67, 104, -67, -1, ++ 110, -67, -67, 60, 79, 117, -67, 104, -67, -67, ++ 7, 88, 89, 93, -67, -67, -67, -67, -67, 114, ++ -67, -67, -67, -67, -67, -67, -67, 95, -67, -67, ++ -67, -67, -67, -67, -67, -1, -67, 114, -67, 114, ++ 18, 114, 114, 100, -6, -67, 114, -67, 114, 101, ++ -67, -67, -67, -1, 102, 40, 103, 112, 114, 115, ++ -67, -67, 116, 118, 122, -67, -9, -67, -67, -67, ++ -67, 126, -67, -67, -67, -67, -67 + }; + + /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. +@@ -705,44 +704,43 @@ static const yytype_int16 yypact[] = + static const yytype_int8 yydefact[] = + { + 5, 0, 0, 5, 0, 0, 1, 0, 0, 0, +- 0, 0, 0, 0, 0, 0, 0, 25, 9, 25, +- 12, 40, 16, 7, 5, 10, 65, 5, 11, 13, +- 71, 8, 6, 4, 15, 0, 100, 101, 99, 102, +- 36, 0, 95, 0, 97, 0, 0, 0, 96, 84, +- 0, 0, 0, 22, 24, 37, 0, 0, 62, 0, +- 70, 14, 103, 0, 69, 21, 0, 92, 57, 0, +- 0, 0, 0, 0, 0, 0, 0, 61, 23, 68, +- 52, 54, 55, 56, 0, 0, 50, 0, 49, 0, +- 0, 0, 0, 51, 53, 26, 77, 48, 0, 0, +- 28, 27, 0, 0, 0, 41, 77, 43, 42, 0, +- 0, 0, 0, 18, 39, 16, 19, 17, 38, 59, +- 58, 82, 67, 66, 64, 63, 72, 98, 91, 93, +- 94, 89, 90, 85, 86, 87, 88, 0, 73, 82, +- 35, 82, 0, 82, 82, 0, 82, 74, 82, 46, +- 82, 0, 20, 80, 81, 79, 0, 0, 0, 0, +- 0, 0, 82, 0, 78, 29, 0, 0, 0, 45, +- 60, 83, 76, 75, 33, 30, 0, 32, 31, 47, +- 44, 34 ++ 0, 0, 0, 0, 0, 0, 0, 6, 21, 13, ++ 21, 14, 36, 53, 7, 5, 11, 62, 5, 8, ++ 15, 68, 12, 16, 4, 10, 0, 97, 98, 96, ++ 99, 32, 0, 92, 0, 94, 0, 0, 0, 93, ++ 81, 0, 0, 0, 18, 20, 33, 0, 0, 59, ++ 0, 67, 9, 100, 0, 66, 17, 0, 89, 55, ++ 0, 0, 0, 0, 0, 0, 0, 0, 58, 19, ++ 65, 48, 50, 51, 52, 0, 0, 46, 0, 45, ++ 0, 0, 0, 0, 47, 49, 22, 74, 44, 0, ++ 0, 24, 23, 0, 0, 0, 37, 74, 39, 38, ++ 0, 0, 0, 0, 54, 35, 34, 57, 56, 79, ++ 64, 63, 61, 60, 69, 95, 88, 90, 91, 86, ++ 87, 82, 83, 84, 85, 0, 70, 79, 31, 79, ++ 0, 79, 79, 0, 79, 71, 79, 42, 79, 0, ++ 77, 78, 76, 0, 0, 0, 0, 0, 79, 0, ++ 75, 25, 0, 0, 0, 41, 80, 73, 72, 29, ++ 26, 0, 28, 27, 43, 40, 30 + }; + + /* YYPGOTO[NTERM-NUM]. */ + static const yytype_int16 yypgoto[] = + { +- -62, -62, -62, 14, 44, -62, -54, -62, -62, 160, +- -62, -62, -62, -62, -62, -62, -62, -62, 126, -62, +- -53, 24, -62, -62, -62, -62, -62, -62, -62, -62, +- -62, -52, -62, -62, 127, -13, -62, 80, -36, 7, +- -45, -7, -61, -62, -62, -62 ++ -67, -67, -67, 24, 92, -67, -67, -67, -67, 130, ++ -67, -67, -67, -67, -67, -67, -67, -67, 80, -67, ++ -67, -67, -67, -67, -67, -67, -67, -67, -67, -67, ++ -67, -67, -67, -67, 119, -42, -67, 65, -15, 25, ++ -46, -10, -66, -67, -67, -67 + }; + + /* YYDEFGOTO[NTERM-NUM]. */ + static const yytype_uint8 yydefgoto[] = + { +- 0, 2, 3, 4, 56, 17, 18, 19, 20, 53, +- 95, 21, 22, 114, 23, 55, 105, 96, 97, 98, +- 24, 119, 25, 116, 26, 27, 124, 28, 58, 29, +- 30, 31, 60, 99, 100, 101, 123, 145, 120, 158, +- 47, 48, 49, 32, 39, 63 ++ 0, 2, 3, 4, 17, 18, 19, 20, 21, 54, ++ 96, 22, 23, 115, 24, 56, 106, 97, 98, 99, ++ 57, 25, 117, 26, 27, 28, 122, 29, 59, 30, ++ 31, 32, 61, 100, 101, 102, 121, 143, 116, 154, ++ 48, 49, 50, 33, 40, 64 + }; + + /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If +@@ -750,48 +748,48 @@ static const yytype_uint8 yydefgoto[] = + number is the opposite. If YYTABLE_NINF, syntax error. */ + static const yytype_int16 yytable[] = + { +- 66, 67, 113, 115, 117, 43, 42, 44, 51, 84, +- 131, 132, 133, 134, 135, 136, 128, 7, 35, 68, +- 118, 69, 70, 125, 129, 130, 36, 42, 44, 1, +- 142, 45, 121, -3, 8, 5, 157, 9, 57, 6, +- 10, 59, 108, 11, 12, 122, 41, 126, 37, 69, +- 70, 46, 33, 146, 13, 34, 69, 70, 14, 15, +- 38, 40, -2, 8, 42, 61, 9, 62, 16, 10, +- 69, 70, 11, 12, 71, 72, 73, 74, 75, 76, +- 139, 162, 50, 13, 52, 143, 64, 14, 15, 65, +- 8, 77, 159, 9, 78, 148, 10, 16, 79, 11, +- 12, 84, 113, 115, 117, 110, 111, 112, 127, 137, +- 13, 138, 171, 80, 14, 15, 141, 140, 144, 81, +- 82, 83, 84, 147, 16, 157, 85, 86, 150, 87, +- 88, 149, 152, 153, 89, 173, 80, 69, 70, 90, +- 91, 92, 102, 93, 94, 84, 160, 154, 161, 85, +- 163, 164, 70, 166, 155, 167, 109, 168, 165, 156, +- 103, 169, 104, 172, 174, 11, 12, 94, 175, 176, +- 177, 110, 111, 112, 178, 179, 13, 180, 181, 54, +- 170, 106, 107, 0, 0, 0, 151 ++ 67, 68, 44, 43, 45, 52, 129, 130, 131, 132, ++ 133, 134, 36, 126, 109, 153, 37, 120, 5, 124, ++ 37, 85, 43, 45, 127, 128, 140, 7, 46, 6, ++ -3, 8, 70, 71, 9, 70, 71, 10, 38, 1, ++ 11, 12, 38, 118, 119, 123, 70, 71, 47, 58, ++ 39, 13, 60, 144, 39, 14, 15, 42, 34, -2, ++ 8, 35, 41, 9, 43, 16, 10, 51, 53, 11, ++ 12, 62, 65, 69, 158, 70, 71, 63, 137, 168, ++ 13, 70, 71, 141, 14, 15, 66, 78, 79, 155, ++ 81, 85, 80, 146, 16, 8, 103, 125, 9, 85, ++ 135, 10, 139, 86, 11, 12, 136, 166, 138, 142, ++ 111, 112, 113, 145, 104, 13, 105, 81, 147, 14, ++ 15, 95, 148, 82, 83, 84, 85, 150, 151, 16, ++ 86, 87, 152, 88, 89, 153, 107, 71, 90, 161, ++ 165, 167, 169, 91, 92, 93, 110, 94, 95, 114, ++ 55, 170, 11, 12, 172, 173, 0, 174, 111, 112, ++ 113, 175, 156, 13, 157, 176, 159, 160, 15, 162, ++ 0, 163, 149, 164, 0, 108, 0, 16, 0, 0, ++ 0, 0, 0, 171, 72, 73, 74, 75, 76, 77 + }; + + static const yytype_int16 yycheck[] = + { +- 45, 46, 56, 56, 56, 12, 4, 5, 15, 15, +- 71, 72, 73, 74, 75, 76, 8, 3, 1, 39, +- 56, 41, 42, 59, 69, 70, 9, 4, 5, 24, +- 91, 29, 38, 0, 1, 5, 21, 4, 24, 0, +- 7, 27, 55, 10, 11, 58, 5, 60, 31, 41, +- 42, 49, 39, 98, 21, 39, 41, 42, 25, 26, +- 43, 39, 0, 1, 4, 39, 4, 40, 35, 7, +- 41, 42, 10, 11, 43, 44, 45, 46, 47, 48, +- 87, 142, 5, 21, 5, 92, 39, 25, 26, 39, +- 1, 39, 137, 4, 39, 102, 7, 35, 39, 10, +- 11, 15, 156, 156, 156, 16, 17, 18, 39, 28, +- 21, 39, 157, 6, 25, 26, 5, 39, 5, 12, +- 13, 14, 15, 3, 35, 21, 19, 20, 5, 22, +- 23, 39, 39, 39, 27, 39, 6, 41, 42, 32, +- 33, 34, 12, 36, 37, 15, 139, 39, 141, 19, +- 143, 144, 42, 146, 39, 148, 1, 150, 39, 115, +- 30, 39, 32, 39, 39, 10, 11, 37, 39, 162, +- 39, 16, 17, 18, 39, 39, 21, 39, 39, 19, +- 156, 55, 55, -1, -1, -1, 106 ++ 46, 47, 12, 4, 5, 15, 72, 73, 74, 75, ++ 76, 77, 1, 8, 56, 21, 9, 59, 5, 61, ++ 9, 15, 4, 5, 70, 71, 92, 3, 29, 0, ++ 0, 1, 41, 42, 4, 41, 42, 7, 31, 24, ++ 10, 11, 31, 58, 38, 60, 41, 42, 49, 25, ++ 43, 21, 28, 99, 43, 25, 26, 5, 39, 0, ++ 1, 39, 39, 4, 4, 35, 7, 5, 5, 10, ++ 11, 39, 39, 39, 140, 41, 42, 40, 88, 39, ++ 21, 41, 42, 93, 25, 26, 39, 39, 39, 135, ++ 6, 15, 39, 103, 35, 1, 12, 39, 4, 15, ++ 28, 7, 5, 19, 10, 11, 39, 153, 39, 5, ++ 16, 17, 18, 3, 30, 21, 32, 6, 39, 25, ++ 26, 37, 5, 12, 13, 14, 15, 39, 39, 35, ++ 19, 20, 39, 22, 23, 21, 56, 42, 27, 39, ++ 39, 39, 39, 32, 33, 34, 4, 36, 37, 57, ++ 20, 39, 10, 11, 39, 39, -1, 39, 16, 17, ++ 18, 39, 137, 21, 139, 39, 141, 142, 26, 144, ++ -1, 146, 107, 148, -1, 56, -1, 35, -1, -1, ++ -1, -1, -1, 158, 43, 44, 45, 46, 47, 48 + }; + + /* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of +@@ -799,56 +797,55 @@ static const yytype_int16 yycheck[] = + static const yytype_int8 yystos[] = + { + 0, 24, 51, 52, 53, 5, 0, 53, 1, 4, +- 7, 10, 11, 21, 25, 26, 35, 55, 56, 57, +- 58, 61, 62, 64, 70, 72, 74, 75, 77, 79, +- 80, 81, 93, 39, 39, 1, 9, 31, 43, 94, +- 39, 5, 4, 91, 5, 29, 49, 90, 91, 92, +- 5, 91, 5, 59, 59, 65, 54, 53, 78, 53, +- 82, 39, 40, 95, 39, 39, 90, 90, 39, 41, +- 42, 43, 44, 45, 46, 47, 48, 39, 39, 39, +- 6, 12, 13, 14, 15, 19, 20, 22, 23, 27, +- 32, 33, 34, 36, 37, 60, 67, 68, 69, 83, +- 84, 85, 12, 30, 32, 66, 68, 84, 85, 1, +- 16, 17, 18, 56, 63, 70, 73, 81, 88, 71, +- 88, 38, 85, 86, 76, 88, 85, 39, 8, 90, +- 90, 92, 92, 92, 92, 92, 92, 28, 39, 91, +- 39, 5, 92, 91, 5, 87, 90, 3, 91, 39, +- 5, 87, 39, 39, 39, 39, 54, 21, 89, 90, +- 89, 89, 92, 89, 89, 39, 89, 89, 89, 39, +- 71, 90, 39, 39, 39, 39, 89, 39, 39, 39, +- 39, 39 ++ 7, 10, 11, 21, 25, 26, 35, 54, 55, 56, ++ 57, 58, 61, 62, 64, 71, 73, 74, 75, 77, ++ 79, 80, 81, 93, 39, 39, 1, 9, 31, 43, ++ 94, 39, 5, 4, 91, 5, 29, 49, 90, 91, ++ 92, 5, 91, 5, 59, 59, 65, 70, 53, 78, ++ 53, 82, 39, 40, 95, 39, 39, 90, 90, 39, ++ 41, 42, 43, 44, 45, 46, 47, 48, 39, 39, ++ 39, 6, 12, 13, 14, 15, 19, 20, 22, 23, ++ 27, 32, 33, 34, 36, 37, 60, 67, 68, 69, ++ 83, 84, 85, 12, 30, 32, 66, 68, 84, 85, ++ 4, 16, 17, 18, 54, 63, 88, 72, 88, 38, ++ 85, 86, 76, 88, 85, 39, 8, 90, 90, 92, ++ 92, 92, 92, 92, 92, 28, 39, 91, 39, 5, ++ 92, 91, 5, 87, 90, 3, 91, 39, 5, 87, ++ 39, 39, 39, 21, 89, 90, 89, 89, 92, 89, ++ 89, 39, 89, 89, 89, 39, 90, 39, 39, 39, ++ 39, 89, 39, 39, 39, 39, 39 + }; + + /* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */ + static const yytype_int8 yyr1[] = + { + 0, 50, 51, 51, 52, 53, 53, 53, 53, 53, +- 53, 53, 53, 53, 53, 53, 54, 54, 54, 54, +- 54, 55, 56, 57, 58, 59, 59, 59, 59, 60, +- 60, 60, 60, 60, 60, 60, 61, 62, 63, 64, +- 65, 65, 65, 65, 66, 66, 66, 66, 67, 67, +- 67, 67, 68, 68, 69, 69, 69, 70, 71, 72, +- 73, 74, 75, 76, 77, 78, 78, 78, 79, 80, +- 81, 82, 82, 83, 84, 85, 86, 87, 87, 88, +- 88, 88, 89, 89, 90, 90, 90, 90, 90, 90, +- 90, 90, 90, 90, 90, 91, 92, 92, 93, 94, +- 94, 94, 95, 95 ++ 53, 54, 54, 54, 54, 54, 54, 55, 56, 57, ++ 58, 59, 59, 59, 59, 60, 60, 60, 60, 60, ++ 60, 60, 61, 62, 63, 64, 65, 65, 65, 65, ++ 66, 66, 66, 66, 67, 67, 67, 67, 68, 68, ++ 69, 69, 69, 70, 70, 71, 72, 73, 74, 75, ++ 76, 77, 78, 78, 78, 79, 80, 81, 82, 82, ++ 83, 84, 85, 86, 87, 87, 88, 88, 88, 89, ++ 89, 90, 90, 90, 90, 90, 90, 90, 90, 90, ++ 90, 90, 91, 92, 92, 93, 94, 94, 94, 95, ++ 95 + }; + + /* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */ + static const yytype_int8 yyr2[] = + { +- 0, 2, 2, 1, 3, 0, 2, 2, 2, 2, +- 2, 2, 2, 2, 4, 3, 0, 2, 2, 2, +- 3, 3, 2, 3, 2, 0, 2, 2, 2, 3, +- 4, 4, 4, 4, 5, 2, 2, 2, 1, 3, +- 0, 2, 2, 2, 4, 3, 2, 4, 1, 1, +- 1, 1, 1, 1, 1, 1, 1, 3, 1, 3, +- 3, 3, 2, 1, 3, 0, 2, 2, 3, 3, +- 2, 0, 2, 2, 2, 4, 3, 0, 2, 2, +- 2, 2, 0, 2, 1, 3, 3, 3, 3, 3, +- 3, 3, 2, 3, 3, 1, 1, 1, 4, 1, +- 1, 1, 0, 1 ++ 0, 2, 2, 1, 3, 0, 2, 2, 2, 4, ++ 3, 1, 1, 1, 1, 1, 1, 3, 2, 3, ++ 2, 0, 2, 2, 2, 3, 4, 4, 4, 4, ++ 5, 2, 2, 2, 1, 3, 0, 2, 2, 2, ++ 4, 3, 2, 4, 1, 1, 1, 1, 1, 1, ++ 1, 1, 1, 0, 2, 3, 1, 3, 3, 2, ++ 1, 3, 0, 2, 2, 3, 3, 2, 0, 2, ++ 2, 2, 4, 3, 0, 2, 2, 2, 2, 0, ++ 2, 1, 3, 3, 3, 3, 3, 3, 3, 2, ++ 3, 3, 1, 1, 1, 4, 1, 1, 1, 0, ++ 1 + }; + + +@@ -1348,19 +1345,15 @@ yyreduce: + } + break; + +- case 14: /* stmt_list: stmt_list T_WORD error T_EOL */ ++ case 9: /* stmt_list: stmt_list T_WORD error T_EOL */ + { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); } + break; + +- case 15: /* stmt_list: stmt_list error T_EOL */ ++ case 10: /* stmt_list: stmt_list error T_EOL */ + { zconf_error("invalid statement"); } + break; + +- case 20: /* stmt_list_in_choice: stmt_list_in_choice error T_EOL */ +- { zconf_error("invalid statement"); } +- break; +- +- case 21: /* config_entry_start: T_CONFIG nonconst_symbol T_EOL */ ++ case 17: /* config_entry_start: T_CONFIG nonconst_symbol T_EOL */ + { + (yyvsp[-1].symbol)->flags |= SYMBOL_OPTIONAL; + menu_add_entry((yyvsp[-1].symbol)); +@@ -1368,13 +1361,13 @@ yyreduce: + } + break; + +- case 22: /* config_stmt: config_entry_start config_option_list */ ++ case 18: /* config_stmt: config_entry_start config_option_list */ + { + printd(DEBUG_PARSE, "%s:%d:endconfig\n", cur_filename, cur_lineno); + } + break; + +- case 23: /* menuconfig_entry_start: T_MENUCONFIG nonconst_symbol T_EOL */ ++ case 19: /* menuconfig_entry_start: T_MENUCONFIG nonconst_symbol T_EOL */ + { + (yyvsp[-1].symbol)->flags |= SYMBOL_OPTIONAL; + menu_add_entry((yyvsp[-1].symbol)); +@@ -1382,7 +1375,7 @@ yyreduce: + } + break; + +- case 24: /* menuconfig_stmt: menuconfig_entry_start config_option_list */ ++ case 20: /* menuconfig_stmt: menuconfig_entry_start config_option_list */ + { + if (current_entry->prompt) + current_entry->prompt->type = P_MENU; +@@ -1392,21 +1385,21 @@ yyreduce: + } + break; + +- case 29: /* config_option: type prompt_stmt_opt T_EOL */ ++ case 25: /* config_option: type prompt_stmt_opt T_EOL */ + { + menu_set_type((yyvsp[-2].type)); + printd(DEBUG_PARSE, "%s:%d:type(%u)\n", cur_filename, cur_lineno, (yyvsp[-2].type)); + } + break; + +- case 30: /* config_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL */ ++ case 26: /* config_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL */ + { + menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); + printd(DEBUG_PARSE, "%s:%d:prompt\n", cur_filename, cur_lineno); + } + break; + +- case 31: /* config_option: default expr if_expr T_EOL */ ++ case 27: /* config_option: default expr if_expr T_EOL */ + { + menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr)); + if ((yyvsp[-3].type) != S_UNKNOWN) +@@ -1416,28 +1409,28 @@ yyreduce: + } + break; + +- case 32: /* config_option: T_SELECT nonconst_symbol if_expr T_EOL */ ++ case 28: /* config_option: T_SELECT nonconst_symbol if_expr T_EOL */ + { + menu_add_symbol(P_SELECT, (yyvsp[-2].symbol), (yyvsp[-1].expr)); + printd(DEBUG_PARSE, "%s:%d:select\n", cur_filename, cur_lineno); + } + break; + +- case 33: /* config_option: T_IMPLY nonconst_symbol if_expr T_EOL */ ++ case 29: /* config_option: T_IMPLY nonconst_symbol if_expr T_EOL */ + { + menu_add_symbol(P_IMPLY, (yyvsp[-2].symbol), (yyvsp[-1].expr)); + printd(DEBUG_PARSE, "%s:%d:imply\n", cur_filename, cur_lineno); + } + break; + +- case 34: /* config_option: T_RANGE symbol symbol if_expr T_EOL */ ++ case 30: /* config_option: T_RANGE symbol symbol if_expr T_EOL */ + { + menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr)); + printd(DEBUG_PARSE, "%s:%d:range\n", cur_filename, cur_lineno); + } + break; + +- case 35: /* config_option: T_MODULES T_EOL */ ++ case 31: /* config_option: T_MODULES T_EOL */ + { + if (modules_sym) + zconf_error("symbol '%s' redefines option 'modules' already defined by symbol '%s'", +@@ -1446,7 +1439,7 @@ yyreduce: + } + break; + +- case 36: /* choice: T_CHOICE T_EOL */ ++ case 32: /* choice: T_CHOICE T_EOL */ + { + struct symbol *sym = sym_lookup(NULL, SYMBOL_CHOICE); + sym->flags |= SYMBOL_NO_WRITE; +@@ -1456,7 +1449,7 @@ yyreduce: + } + break; + +- case 37: /* choice_entry: choice choice_option_list */ ++ case 33: /* choice_entry: choice choice_option_list */ + { + if (!current_entry->prompt) { + fprintf(stderr, "%s:%d: error: choice must have a prompt\n", +@@ -1468,7 +1461,7 @@ yyreduce: + } + break; + +- case 38: /* choice_end: end */ ++ case 34: /* choice_end: end */ + { + if (zconf_endtoken((yyvsp[0].string), "choice")) { + menu_end_menu(); +@@ -1477,67 +1470,67 @@ yyreduce: + } + break; + +- case 44: /* choice_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL */ ++ case 40: /* choice_option: T_PROMPT T_WORD_QUOTE if_expr T_EOL */ + { + menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); + printd(DEBUG_PARSE, "%s:%d:prompt\n", cur_filename, cur_lineno); + } + break; + +- case 45: /* choice_option: logic_type prompt_stmt_opt T_EOL */ ++ case 41: /* choice_option: logic_type prompt_stmt_opt T_EOL */ + { + menu_set_type((yyvsp[-2].type)); + printd(DEBUG_PARSE, "%s:%d:type(%u)\n", cur_filename, cur_lineno, (yyvsp[-2].type)); + } + break; + +- case 46: /* choice_option: T_OPTIONAL T_EOL */ ++ case 42: /* choice_option: T_OPTIONAL T_EOL */ + { + current_entry->sym->flags |= SYMBOL_OPTIONAL; + printd(DEBUG_PARSE, "%s:%d:optional\n", cur_filename, cur_lineno); + } + break; + +- case 47: /* choice_option: T_DEFAULT nonconst_symbol if_expr T_EOL */ ++ case 43: /* choice_option: T_DEFAULT nonconst_symbol if_expr T_EOL */ + { + menu_add_symbol(P_DEFAULT, (yyvsp[-2].symbol), (yyvsp[-1].expr)); + printd(DEBUG_PARSE, "%s:%d:default\n", cur_filename, cur_lineno); + } + break; + +- case 49: /* type: T_INT */ ++ case 45: /* type: T_INT */ + { (yyval.type) = S_INT; } + break; + +- case 50: /* type: T_HEX */ ++ case 46: /* type: T_HEX */ + { (yyval.type) = S_HEX; } + break; + +- case 51: /* type: T_STRING */ ++ case 47: /* type: T_STRING */ + { (yyval.type) = S_STRING; } + break; + +- case 52: /* logic_type: T_BOOL */ ++ case 48: /* logic_type: T_BOOL */ + { (yyval.type) = S_BOOLEAN; } + break; + +- case 53: /* logic_type: T_TRISTATE */ ++ case 49: /* logic_type: T_TRISTATE */ + { (yyval.type) = S_TRISTATE; } + break; + +- case 54: /* default: T_DEFAULT */ ++ case 50: /* default: T_DEFAULT */ + { (yyval.type) = S_UNKNOWN; } + break; + +- case 55: /* default: T_DEF_BOOL */ ++ case 51: /* default: T_DEF_BOOL */ + { (yyval.type) = S_BOOLEAN; } + break; + +- case 56: /* default: T_DEF_TRISTATE */ ++ case 52: /* default: T_DEF_TRISTATE */ + { (yyval.type) = S_TRISTATE; } + break; + +- case 57: /* if_entry: T_IF expr T_EOL */ ++ case 55: /* if_entry: T_IF expr T_EOL */ + { + printd(DEBUG_PARSE, "%s:%d:if\n", cur_filename, cur_lineno); + menu_add_entry(NULL); +@@ -1546,7 +1539,7 @@ yyreduce: + } + break; + +- case 58: /* if_end: end */ ++ case 56: /* if_end: end */ + { + if (zconf_endtoken((yyvsp[0].string), "if")) { + menu_end_menu(); +@@ -1555,7 +1548,7 @@ yyreduce: + } + break; + +- case 61: /* menu: T_MENU T_WORD_QUOTE T_EOL */ ++ case 58: /* menu: T_MENU T_WORD_QUOTE T_EOL */ + { + menu_add_entry(NULL); + menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL); +@@ -1563,13 +1556,13 @@ yyreduce: + } + break; + +- case 62: /* menu_entry: menu menu_option_list */ ++ case 59: /* menu_entry: menu menu_option_list */ + { + (yyval.menu) = menu_add_menu(); + } + break; + +- case 63: /* menu_end: end */ ++ case 60: /* menu_end: end */ + { + if (zconf_endtoken((yyvsp[0].string), "menu")) { + menu_end_menu(); +@@ -1578,7 +1571,7 @@ yyreduce: + } + break; + +- case 68: /* source_stmt: T_SOURCE T_WORD_QUOTE T_EOL */ ++ case 65: /* source_stmt: T_SOURCE T_WORD_QUOTE T_EOL */ + { + printd(DEBUG_PARSE, "%s:%d:source %s\n", cur_filename, cur_lineno, (yyvsp[-1].string)); + zconf_nextfile((yyvsp[-1].string)); +@@ -1586,7 +1579,7 @@ yyreduce: + } + break; + +- case 69: /* comment: T_COMMENT T_WORD_QUOTE T_EOL */ ++ case 66: /* comment: T_COMMENT T_WORD_QUOTE T_EOL */ + { + menu_add_entry(NULL); + menu_add_prompt(P_COMMENT, (yyvsp[-1].string), NULL); +@@ -1594,14 +1587,14 @@ yyreduce: + } + break; + +- case 73: /* help_start: T_HELP T_EOL */ ++ case 70: /* help_start: T_HELP T_EOL */ + { + printd(DEBUG_PARSE, "%s:%d:help\n", cur_filename, cur_lineno); + zconf_starthelp(); + } + break; + +- case 74: /* help: help_start T_HELPTEXT */ ++ case 71: /* help: help_start T_HELPTEXT */ + { + if (current_entry->help) { + free(current_entry->help); +@@ -1618,114 +1611,114 @@ yyreduce: + } + break; + +- case 75: /* depends: T_DEPENDS T_ON expr T_EOL */ ++ case 72: /* depends: T_DEPENDS T_ON expr T_EOL */ + { + menu_add_dep((yyvsp[-1].expr)); + printd(DEBUG_PARSE, "%s:%d:depends on\n", cur_filename, cur_lineno); + } + break; + +- case 76: /* visible: T_VISIBLE if_expr T_EOL */ ++ case 73: /* visible: T_VISIBLE if_expr T_EOL */ + { + menu_add_visibility((yyvsp[-1].expr)); + } + break; + +- case 78: /* prompt_stmt_opt: T_WORD_QUOTE if_expr */ ++ case 75: /* prompt_stmt_opt: T_WORD_QUOTE if_expr */ + { + menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr)); + } + break; + +- case 79: /* end: T_ENDMENU T_EOL */ ++ case 76: /* end: T_ENDMENU T_EOL */ + { (yyval.string) = "menu"; } + break; + +- case 80: /* end: T_ENDCHOICE T_EOL */ ++ case 77: /* end: T_ENDCHOICE T_EOL */ + { (yyval.string) = "choice"; } + break; + +- case 81: /* end: T_ENDIF T_EOL */ ++ case 78: /* end: T_ENDIF T_EOL */ + { (yyval.string) = "if"; } + break; + +- case 82: /* if_expr: %empty */ ++ case 79: /* if_expr: %empty */ + { (yyval.expr) = NULL; } + break; + +- case 83: /* if_expr: T_IF expr */ ++ case 80: /* if_expr: T_IF expr */ + { (yyval.expr) = (yyvsp[0].expr); } + break; + +- case 84: /* expr: symbol */ ++ case 81: /* expr: symbol */ + { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); } + break; + +- case 85: /* expr: symbol T_LESS symbol */ ++ case 82: /* expr: symbol T_LESS symbol */ + { (yyval.expr) = expr_alloc_comp(E_LTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } + break; + +- case 86: /* expr: symbol T_LESS_EQUAL symbol */ ++ case 83: /* expr: symbol T_LESS_EQUAL symbol */ + { (yyval.expr) = expr_alloc_comp(E_LEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } + break; + +- case 87: /* expr: symbol T_GREATER symbol */ ++ case 84: /* expr: symbol T_GREATER symbol */ + { (yyval.expr) = expr_alloc_comp(E_GTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } + break; + +- case 88: /* expr: symbol T_GREATER_EQUAL symbol */ ++ case 85: /* expr: symbol T_GREATER_EQUAL symbol */ + { (yyval.expr) = expr_alloc_comp(E_GEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } + break; + +- case 89: /* expr: symbol T_EQUAL symbol */ ++ case 86: /* expr: symbol T_EQUAL symbol */ + { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } + break; + +- case 90: /* expr: symbol T_UNEQUAL symbol */ ++ case 87: /* expr: symbol T_UNEQUAL symbol */ + { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } + break; + +- case 91: /* expr: T_OPEN_PAREN expr T_CLOSE_PAREN */ ++ case 88: /* expr: T_OPEN_PAREN expr T_CLOSE_PAREN */ + { (yyval.expr) = (yyvsp[-1].expr); } + break; + +- case 92: /* expr: T_NOT expr */ ++ case 89: /* expr: T_NOT expr */ + { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); } + break; + +- case 93: /* expr: expr T_OR expr */ ++ case 90: /* expr: expr T_OR expr */ + { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); } + break; + +- case 94: /* expr: expr T_AND expr */ ++ case 91: /* expr: expr T_AND expr */ + { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); } + break; + +- case 95: /* nonconst_symbol: T_WORD */ ++ case 92: /* nonconst_symbol: T_WORD */ + { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); } + break; + +- case 97: /* symbol: T_WORD_QUOTE */ ++ case 94: /* symbol: T_WORD_QUOTE */ + { (yyval.symbol) = sym_lookup((yyvsp[0].string), SYMBOL_CONST); free((yyvsp[0].string)); } + break; + +- case 98: /* assignment_stmt: T_WORD assign_op assign_val T_EOL */ ++ case 95: /* assignment_stmt: T_WORD assign_op assign_val T_EOL */ + { variable_add((yyvsp[-3].string), (yyvsp[-1].string), (yyvsp[-2].flavor)); free((yyvsp[-3].string)); free((yyvsp[-1].string)); } + break; + +- case 99: /* assign_op: T_EQUAL */ ++ case 96: /* assign_op: T_EQUAL */ + { (yyval.flavor) = VAR_RECURSIVE; } + break; + +- case 100: /* assign_op: T_COLON_EQUAL */ ++ case 97: /* assign_op: T_COLON_EQUAL */ + { (yyval.flavor) = VAR_SIMPLE; } + break; + +- case 101: /* assign_op: T_PLUS_EQUAL */ ++ case 98: /* assign_op: T_PLUS_EQUAL */ + { (yyval.flavor) = VAR_APPEND; } + break; + +- case 102: /* assign_val: %empty */ ++ case 99: /* assign_val: %empty */ + { (yyval.string) = xstrdup(""); } + break; + +diff --git a/parser.y b/parser.y +index 7fb9966..9873e84 100644 +--- a/parser.y ++++ b/parser.y +@@ -116,24 +116,20 @@ mainmenu_stmt: T_MAINMENU T_WORD_QUOTE T_EOL + + stmt_list: + /* empty */ +- | stmt_list assignment_stmt ++ | stmt_list common_stmt + | stmt_list choice_stmt +- | stmt_list comment_stmt +- | stmt_list config_stmt +- | stmt_list if_stmt + | stmt_list menu_stmt +- | stmt_list menuconfig_stmt +- | stmt_list source_stmt + | stmt_list T_WORD error T_EOL { zconf_error("unknown statement \"%s\"", $2); } + | stmt_list error T_EOL { zconf_error("invalid statement"); } + ; + +-stmt_list_in_choice: +- /* empty */ +- | stmt_list_in_choice comment_stmt +- | stmt_list_in_choice config_stmt +- | stmt_list_in_choice if_stmt_in_choice +- | stmt_list_in_choice error T_EOL { zconf_error("invalid statement"); } ++common_stmt: ++ if_stmt ++ | comment_stmt ++ | config_stmt ++ | menuconfig_stmt ++ | source_stmt ++ | assignment_stmt + ; + + /* config/menuconfig entry */ +@@ -250,7 +246,7 @@ choice_end: end + } + }; + +-choice_stmt: choice_entry stmt_list_in_choice choice_end ++choice_stmt: choice_entry choice_block choice_end + ; + + choice_option_list: +@@ -299,6 +295,11 @@ default: + | T_DEF_BOOL { $$ = S_BOOLEAN; } + | T_DEF_TRISTATE { $$ = S_TRISTATE; } + ++choice_block: ++ /* empty */ ++ | choice_block common_stmt ++; ++ + /* if entry */ + + if_entry: T_IF expr T_EOL +@@ -320,9 +321,6 @@ if_end: end + if_stmt: if_entry stmt_list if_end + ; + +-if_stmt_in_choice: if_entry stmt_list_in_choice if_end +-; +- + /* menu entry */ + + menu: T_MENU T_WORD_QUOTE T_EOL diff --git a/support/kconfig/patches/series b/support/kconfig/patches/series index f120e323b7..e68a83a550 100644 --- a/support/kconfig/patches/series +++ b/support/kconfig/patches/series @@ -1,13 +1,9 @@ 01-kconfig-kernel-to-buildroot.patch 06-br-build-system-integration.patch 10-br-build-system.patch -11-use-mktemp-for-lxdialog.patch 12-fix-glade-file-path.patch 14-support-out-of-tree-config.patch 16-fix-space-to-de-select-options.patch -17-backport-kecho.patch 18-merge-config.sh-create-temporary-files-in-tmp.patch 19-merge_config.sh-add-br2-external-support.patch -20-merge_config.sh-Allow-to-define-config-prefix.patch -21-Avoid-false-positive-matches-from-comment-lines.patch -22-kconfig-lxdialog-fix-check-with-GCC14.patch +23-Revert-kconfig-allow-only-config-comment-and-if-insi.patch diff --git a/support/kconfig/preprocess.c b/support/kconfig/preprocess.c new file mode 100644 index 0000000000..f0a4a218c4 --- /dev/null +++ b/support/kconfig/preprocess.c @@ -0,0 +1,580 @@ +// SPDX-License-Identifier: GPL-2.0 +// +// Copyright (C) 2018 Masahiro Yamada + +#include +#include +#include +#include +#include +#include + +#include "array_size.h" +#include "internal.h" +#include "list.h" +#include "lkc.h" +#include "preprocess.h" + +static char *expand_string_with_args(const char *in, int argc, char *argv[]); +static char *expand_string(const char *in); + +static void __attribute__((noreturn)) pperror(const char *format, ...) +{ + va_list ap; + + fprintf(stderr, "%s:%d: ", cur_filename, yylineno); + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + fprintf(stderr, "\n"); + + exit(1); +} + +/* + * Environment variables + */ +static LIST_HEAD(env_list); + +struct env { + char *name; + char *value; + struct list_head node; +}; + +static void env_add(const char *name, const char *value) +{ + struct env *e; + + e = xmalloc(sizeof(*e)); + e->name = xstrdup(name); + e->value = xstrdup(value); + + list_add_tail(&e->node, &env_list); +} + +static void env_del(struct env *e) +{ + list_del(&e->node); + free(e->name); + free(e->value); + free(e); +} + +/* The returned pointer must be freed when done */ +static char *env_expand(const char *name) +{ + struct env *e; + const char *value; + + if (!*name) + return NULL; + + list_for_each_entry(e, &env_list, node) { + if (!strcmp(name, e->name)) + return xstrdup(e->value); + } + + value = getenv(name); + if (!value) + return NULL; + + /* + * We need to remember all referenced environment variables. + * They will be written out to include/config/auto.conf.cmd + */ + env_add(name, value); + + return xstrdup(value); +} + +void env_write_dep(struct gstr *s) +{ + struct env *e, *tmp; + + list_for_each_entry_safe(e, tmp, &env_list, node) { + str_printf(s, + "\n" + "ifneq \"$(%s)\" \"%s\"\n" + "$(autoconfig): FORCE\n" + "endif\n", + e->name, e->value); + env_del(e); + } +} + +/* + * Built-in functions + */ +struct function { + const char *name; + unsigned int min_args; + unsigned int max_args; + char *(*func)(int argc, char *argv[]); +}; + +static char *do_error_if(int argc, char *argv[]) +{ + if (!strcmp(argv[0], "y")) + pperror("%s", argv[1]); + + return xstrdup(""); +} + +static char *do_filename(int argc, char *argv[]) +{ + return xstrdup(cur_filename); +} + +static char *do_info(int argc, char *argv[]) +{ + printf("%s\n", argv[0]); + + return xstrdup(""); +} + +static char *do_lineno(int argc, char *argv[]) +{ + char buf[16]; + + sprintf(buf, "%d", yylineno); + + return xstrdup(buf); +} + +static char *do_shell(int argc, char *argv[]) +{ + FILE *p; + char buf[4096]; + char *cmd; + size_t nread; + int i; + + cmd = argv[0]; + + p = popen(cmd, "r"); + if (!p) { + perror(cmd); + exit(1); + } + + nread = fread(buf, 1, sizeof(buf), p); + if (nread == sizeof(buf)) + nread--; + + /* remove trailing new lines */ + while (nread > 0 && buf[nread - 1] == '\n') + nread--; + + buf[nread] = 0; + + /* replace a new line with a space */ + for (i = 0; i < nread; i++) { + if (buf[i] == '\n') + buf[i] = ' '; + } + + if (pclose(p) == -1) { + perror(cmd); + exit(1); + } + + return xstrdup(buf); +} + +static char *do_warning_if(int argc, char *argv[]) +{ + if (!strcmp(argv[0], "y")) + fprintf(stderr, "%s:%d: %s\n", cur_filename, yylineno, argv[1]); + + return xstrdup(""); +} + +static const struct function function_table[] = { + /* Name MIN MAX Function */ + { "error-if", 2, 2, do_error_if }, + { "filename", 0, 0, do_filename }, + { "info", 1, 1, do_info }, + { "lineno", 0, 0, do_lineno }, + { "shell", 1, 1, do_shell }, + { "warning-if", 2, 2, do_warning_if }, +}; + +#define FUNCTION_MAX_ARGS 16 + +static char *function_expand(const char *name, int argc, char *argv[]) +{ + const struct function *f; + int i; + + for (i = 0; i < ARRAY_SIZE(function_table); i++) { + f = &function_table[i]; + if (strcmp(f->name, name)) + continue; + + if (argc < f->min_args) + pperror("too few function arguments passed to '%s'", + name); + + if (argc > f->max_args) + pperror("too many function arguments passed to '%s'", + name); + + return f->func(argc, argv); + } + + return NULL; +} + +/* + * Variables (and user-defined functions) + */ +static LIST_HEAD(variable_list); + +struct variable { + char *name; + char *value; + enum variable_flavor flavor; + int exp_count; + struct list_head node; +}; + +static struct variable *variable_lookup(const char *name) +{ + struct variable *v; + + list_for_each_entry(v, &variable_list, node) { + if (!strcmp(name, v->name)) + return v; + } + + return NULL; +} + +static char *variable_expand(const char *name, int argc, char *argv[]) +{ + struct variable *v; + char *res; + + v = variable_lookup(name); + if (!v) + return NULL; + + if (argc == 0 && v->exp_count) + pperror("Recursive variable '%s' references itself (eventually)", + name); + + if (v->exp_count > 1000) + pperror("Too deep recursive expansion"); + + v->exp_count++; + + if (v->flavor == VAR_RECURSIVE) + res = expand_string_with_args(v->value, argc, argv); + else + res = xstrdup(v->value); + + v->exp_count--; + + return res; +} + +void variable_add(const char *name, const char *value, + enum variable_flavor flavor) +{ + struct variable *v; + char *new_value; + bool append = false; + + v = variable_lookup(name); + if (v) { + /* For defined variables, += inherits the existing flavor */ + if (flavor == VAR_APPEND) { + flavor = v->flavor; + append = true; + } else { + free(v->value); + } + } else { + /* For undefined variables, += assumes the recursive flavor */ + if (flavor == VAR_APPEND) + flavor = VAR_RECURSIVE; + + v = xmalloc(sizeof(*v)); + v->name = xstrdup(name); + v->exp_count = 0; + list_add_tail(&v->node, &variable_list); + } + + v->flavor = flavor; + + if (flavor == VAR_SIMPLE) + new_value = expand_string(value); + else + new_value = xstrdup(value); + + if (append) { + v->value = xrealloc(v->value, + strlen(v->value) + strlen(new_value) + 2); + strcat(v->value, " "); + strcat(v->value, new_value); + free(new_value); + } else { + v->value = new_value; + } +} + +static void variable_del(struct variable *v) +{ + list_del(&v->node); + free(v->name); + free(v->value); + free(v); +} + +void variable_all_del(void) +{ + struct variable *v, *tmp; + + list_for_each_entry_safe(v, tmp, &variable_list, node) + variable_del(v); +} + +/* + * Evaluate a clause with arguments. argc/argv are arguments from the upper + * function call. + * + * Returned string must be freed when done + */ +static char *eval_clause(const char *str, size_t len, int argc, char *argv[]) +{ + char *tmp, *name, *res, *endptr, *prev, *p; + int new_argc = 0; + char *new_argv[FUNCTION_MAX_ARGS]; + int nest = 0; + int i; + unsigned long n; + + tmp = xstrndup(str, len); + + /* + * If variable name is '1', '2', etc. It is generally an argument + * from a user-function call (i.e. local-scope variable). If not + * available, then look-up global-scope variables. + */ + n = strtoul(tmp, &endptr, 10); + if (!*endptr && n > 0 && n <= argc) { + res = xstrdup(argv[n - 1]); + goto free_tmp; + } + + prev = p = tmp; + + /* + * Split into tokens + * The function name and arguments are separated by a comma. + * For example, if the function call is like this: + * $(foo,$(x),$(y)) + * + * The input string for this helper should be: + * foo,$(x),$(y) + * + * and split into: + * new_argv[0] = 'foo' + * new_argv[1] = '$(x)' + * new_argv[2] = '$(y)' + */ + while (*p) { + if (nest == 0 && *p == ',') { + *p = 0; + if (new_argc >= FUNCTION_MAX_ARGS) + pperror("too many function arguments"); + new_argv[new_argc++] = prev; + prev = p + 1; + } else if (*p == '(') { + nest++; + } else if (*p == ')') { + nest--; + } + + p++; + } + + if (new_argc >= FUNCTION_MAX_ARGS) + pperror("too many function arguments"); + new_argv[new_argc++] = prev; + + /* + * Shift arguments + * new_argv[0] represents a function name or a variable name. Put it + * into 'name', then shift the rest of the arguments. This simplifies + * 'const' handling. + */ + name = expand_string_with_args(new_argv[0], argc, argv); + new_argc--; + for (i = 0; i < new_argc; i++) + new_argv[i] = expand_string_with_args(new_argv[i + 1], + argc, argv); + + /* Search for variables */ + res = variable_expand(name, new_argc, new_argv); + if (res) + goto free; + + /* Look for built-in functions */ + res = function_expand(name, new_argc, new_argv); + if (res) + goto free; + + /* Last, try environment variable */ + if (new_argc == 0) { + res = env_expand(name); + if (res) + goto free; + } + + res = xstrdup(""); +free: + for (i = 0; i < new_argc; i++) + free(new_argv[i]); + free(name); +free_tmp: + free(tmp); + + return res; +} + +/* + * Expand a string that follows '$' + * + * For example, if the input string is + * ($(FOO)$($(BAR)))$(BAZ) + * this helper evaluates + * $($(FOO)$($(BAR))) + * and returns a new string containing the expansion (note that the string is + * recursively expanded), also advancing 'str' to point to the next character + * after the corresponding closing parenthesis, in this case, *str will be + * $(BAR) + */ +static char *expand_dollar_with_args(const char **str, int argc, char *argv[]) +{ + const char *p = *str; + const char *q; + int nest = 0; + + /* + * In Kconfig, variable/function references always start with "$(". + * Neither single-letter variables as in $A nor curly braces as in ${CC} + * are supported. '$' not followed by '(' loses its special meaning. + */ + if (*p != '(') { + *str = p; + return xstrdup("$"); + } + + p++; + q = p; + while (*q) { + if (*q == '(') { + nest++; + } else if (*q == ')') { + if (nest-- == 0) + break; + } + q++; + } + + if (!*q) + pperror("unterminated reference to '%s': missing ')'", p); + + /* Advance 'str' to after the expanded initial portion of the string */ + *str = q + 1; + + return eval_clause(p, q - p, argc, argv); +} + +char *expand_dollar(const char **str) +{ + return expand_dollar_with_args(str, 0, NULL); +} + +static char *__expand_string(const char **str, bool (*is_end)(char c), + int argc, char *argv[]) +{ + const char *in, *p; + char *expansion, *out; + size_t in_len, out_len; + + out = xmalloc(1); + *out = 0; + out_len = 1; + + p = in = *str; + + while (1) { + if (*p == '$') { + in_len = p - in; + p++; + expansion = expand_dollar_with_args(&p, argc, argv); + out_len += in_len + strlen(expansion); + out = xrealloc(out, out_len); + strncat(out, in, in_len); + strcat(out, expansion); + free(expansion); + in = p; + continue; + } + + if (is_end(*p)) + break; + + p++; + } + + in_len = p - in; + out_len += in_len; + out = xrealloc(out, out_len); + strncat(out, in, in_len); + + /* Advance 'str' to the end character */ + *str = p; + + return out; +} + +static bool is_end_of_str(char c) +{ + return !c; +} + +/* + * Expand variables and functions in the given string. Undefined variables + * expand to an empty string. + * The returned string must be freed when done. + */ +static char *expand_string_with_args(const char *in, int argc, char *argv[]) +{ + return __expand_string(&in, is_end_of_str, argc, argv); +} + +static char *expand_string(const char *in) +{ + return expand_string_with_args(in, 0, NULL); +} + +static bool is_end_of_token(char c) +{ + return !(isalnum(c) || c == '_' || c == '-'); +} + +/* + * Expand variables in a token. The parsing stops when a token separater + * (in most cases, it is a whitespace) is encountered. 'str' is updated to + * point to the next character. + * + * The returned string must be freed when done. + */ +char *expand_one_token(const char **str) +{ + return __expand_string(str, is_end_of_token, 0, NULL); +} diff --git a/support/kconfig/preprocess.h b/support/kconfig/preprocess.h new file mode 100644 index 0000000000..a7e4a55063 --- /dev/null +++ b/support/kconfig/preprocess.h @@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef PREPROCESS_H +#define PREPROCESS_H + +enum variable_flavor { + VAR_SIMPLE, + VAR_RECURSIVE, + VAR_APPEND, +}; + +struct gstr; +void env_write_dep(struct gstr *gs); +void variable_add(const char *name, const char *value, + enum variable_flavor flavor); +void variable_all_del(void); +char *expand_dollar(const char **str); +char *expand_one_token(const char **str); + +#endif /* PREPROCESS_H */ diff --git a/support/kconfig/qconf-cfg.sh b/support/kconfig/qconf-cfg.sh new file mode 100755 index 0000000000..0e113b0f24 --- /dev/null +++ b/support/kconfig/qconf-cfg.sh @@ -0,0 +1,40 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 + +cflags=$1 +libs=$2 +bin=$3 + +PKG5="Qt5Core Qt5Gui Qt5Widgets" +PKG6="Qt6Core Qt6Gui Qt6Widgets" + +if [ -z "$(command -v ${HOSTPKG_CONFIG})" ]; then + echo >&2 "*" + echo >&2 "* 'make xconfig' requires '${HOSTPKG_CONFIG}'. Please install it." + echo >&2 "*" + exit 1 +fi + +if ${HOSTPKG_CONFIG} --exists $PKG6; then + ${HOSTPKG_CONFIG} --cflags ${PKG6} > ${cflags} + # Qt6 requires C++17. + echo -std=c++17 >> ${cflags} + ${HOSTPKG_CONFIG} --libs ${PKG6} > ${libs} + ${HOSTPKG_CONFIG} --variable=libexecdir Qt6Core > ${bin} + exit 0 +fi + +if ${HOSTPKG_CONFIG} --exists $PKG5; then + ${HOSTPKG_CONFIG} --cflags ${PKG5} > ${cflags} + ${HOSTPKG_CONFIG} --libs ${PKG5} > ${libs} + ${HOSTPKG_CONFIG} --variable=host_bins Qt5Core > ${bin} + exit 0 +fi + +echo >&2 "*" +echo >&2 "* Could not find Qt6 or Qt5 via ${HOSTPKG_CONFIG}." +echo >&2 "* Please install Qt6 or Qt5 and make sure it's in PKG_CONFIG_PATH" +echo >&2 "* You need $PKG6 for Qt6" +echo >&2 "* You need $PKG5 for Qt5" +echo >&2 "*" +exit 1 diff --git a/support/kconfig/qconf.cc b/support/kconfig/qconf.cc index 7896b584c8..50c3ccd027 100644 --- a/support/kconfig/qconf.cc +++ b/support/kconfig/qconf.cc @@ -1,59 +1,38 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2002 Roman Zippel * Copyright (C) 2015 Boris Barbulovski - * Released under the terms of the GNU GPL v2.0. */ -#include - -#include -#include -#include #include +#include +#include +#include +#include #include +#include +#include +#include #include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include "lkc.h" #include "qconf.h" -#include "qconf.moc" -#include "images.c" +#include "images.h" -#ifdef _ -# undef _ -# define _ qgettext -#endif static QApplication *configApp; static ConfigSettings *configSettings; QAction *ConfigMainWindow::saveAction; -static inline QString qgettext(const char* str) -{ - return QString::fromLocal8Bit(gettext(str)); -} - -static inline QString qgettext(const QString& str) -{ - return QString::fromLocal8Bit(gettext(str.toLatin1())); -} - ConfigSettings::ConfigSettings() : QSettings("buildroot.org", "qconf") { @@ -97,14 +76,13 @@ bool ConfigSettings::writeSizes(const QString& key, const QList& value) return true; } - -/* - * set the new data - * TODO check the value - */ -void ConfigItem::okRename(int col) -{ -} +QIcon ConfigItem::symbolYesIcon; +QIcon ConfigItem::symbolModIcon; +QIcon ConfigItem::symbolNoIcon; +QIcon ConfigItem::choiceYesIcon; +QIcon ConfigItem::choiceNoIcon; +QIcon ConfigItem::menuIcon; +QIcon ConfigItem::menubackIcon; /* * update the displayed of a menu entry @@ -120,14 +98,14 @@ void ConfigItem::updateMenu(void) list = listView(); if (goParent) { - setPixmap(promptColIdx, list->menuBackPix); + setIcon(promptColIdx, menubackIcon); prompt = ".."; goto set_prompt; } sym = menu->sym; prop = menu->prompt; - prompt = _(menu_get_prompt(menu)); + prompt = menu_get_prompt(menu); if (prop) switch (prop->type) { case P_MENU: @@ -137,15 +115,16 @@ void ConfigItem::updateMenu(void) */ if (sym && list->rootEntry == menu) break; - setPixmap(promptColIdx, list->menuPix); + setIcon(promptColIdx, menuIcon); } else { if (sym) break; - setPixmap(promptColIdx, QIcon()); + setIcon(promptColIdx, QIcon()); } goto set_prompt; case P_COMMENT: - setPixmap(promptColIdx, QIcon()); + setIcon(promptColIdx, QIcon()); + prompt = "*** " + prompt + " ***"; goto set_prompt; default: ; @@ -153,7 +132,7 @@ void ConfigItem::updateMenu(void) if (!sym) goto set_prompt; - setText(nameColIdx, QString::fromLocal8Bit(sym->name)); + setText(nameColIdx, sym->name); type = sym_get_type(sym); switch (type) { @@ -161,62 +140,42 @@ void ConfigItem::updateMenu(void) case S_TRISTATE: char ch; - if (!sym_is_changable(sym) && list->optMode == normalOpt) { - setPixmap(promptColIdx, QIcon()); - setText(noColIdx, QString::null); - setText(modColIdx, QString::null); - setText(yesColIdx, QString::null); + if (!sym_is_changeable(sym) && list->optMode == normalOpt) { + setIcon(promptColIdx, QIcon()); break; } expr = sym_get_tristate_value(sym); switch (expr) { case yes: if (sym_is_choice_value(sym) && type == S_BOOLEAN) - setPixmap(promptColIdx, list->choiceYesPix); + setIcon(promptColIdx, choiceYesIcon); else - setPixmap(promptColIdx, list->symbolYesPix); - setText(yesColIdx, "Y"); + setIcon(promptColIdx, symbolYesIcon); ch = 'Y'; break; case mod: - setPixmap(promptColIdx, list->symbolModPix); - setText(modColIdx, "M"); + setIcon(promptColIdx, symbolModIcon); ch = 'M'; break; default: if (sym_is_choice_value(sym) && type == S_BOOLEAN) - setPixmap(promptColIdx, list->choiceNoPix); + setIcon(promptColIdx, choiceNoIcon); else - setPixmap(promptColIdx, list->symbolNoPix); - setText(noColIdx, "N"); + setIcon(promptColIdx, symbolNoIcon); ch = 'N'; break; } - if (expr != no) - setText(noColIdx, sym_tristate_within_range(sym, no) ? "_" : 0); - if (expr != mod) - setText(modColIdx, sym_tristate_within_range(sym, mod) ? "_" : 0); - if (expr != yes) - setText(yesColIdx, sym_tristate_within_range(sym, yes) ? "_" : 0); setText(dataColIdx, QChar(ch)); break; case S_INT: case S_HEX: case S_STRING: - const char* data; - - data = sym_get_string_value(sym); - - setText(dataColIdx, data); - if (type == S_STRING) - prompt = QString("%1: %2").arg(prompt).arg(data); - else - prompt = QString("(%2) %1").arg(prompt).arg(data); + setText(dataColIdx, sym_get_string_value(sym)); break; } if (!sym_has_value(sym) && visible) - prompt += _(" (NEW)"); + prompt += " (NEW)"; set_prompt: setText(promptColIdx, prompt); } @@ -253,6 +212,17 @@ void ConfigItem::init(void) if (list->mode != fullMode) setExpanded(true); sym_calc_value(menu->sym); + + if (menu->sym) { + enum symbol_type type = menu->sym->type; + + // Allow to edit "int", "hex", and "string" in-place in + // the data column. Unfortunately, you cannot specify + // the flags per column. Set ItemIsEditable for all + // columns here, and check the column in createEditor(). + if (type == S_INT || type == S_HEX || type == S_STRING) + setFlags(flags() | Qt::ItemIsEditable); + } } updateMenu(); } @@ -273,53 +243,67 @@ ConfigItem::~ConfigItem(void) } } -ConfigLineEdit::ConfigLineEdit(ConfigView* parent) - : Parent(parent) +QWidget *ConfigItemDelegate::createEditor(QWidget *parent, + const QStyleOptionViewItem &option, + const QModelIndex &index) const { - connect(this, SIGNAL(editingFinished()), SLOT(hide())); -} + ConfigItem *item; -void ConfigLineEdit::show(ConfigItem* i) -{ - item = i; - if (sym_get_string_value(item->menu->sym)) - setText(QString::fromLocal8Bit(sym_get_string_value(item->menu->sym))); - else - setText(QString::null); - Parent::show(); - setFocus(); + // Only the data column is editable + if (index.column() != dataColIdx) + return nullptr; + + // You cannot edit invisible menus + item = static_cast(index.internalPointer()); + if (!item || !item->menu || !menu_is_visible(item->menu)) + return nullptr; + + return QStyledItemDelegate::createEditor(parent, option, index); } -void ConfigLineEdit::keyPressEvent(QKeyEvent* e) +void ConfigItemDelegate::setModelData(QWidget *editor, + QAbstractItemModel *model, + const QModelIndex &index) const { - switch (e->key()) { - case Qt::Key_Escape: - break; - case Qt::Key_Return: - case Qt::Key_Enter: - sym_set_string_value(item->menu->sym, text().toLatin1()); - parent()->updateList(item); - break; - default: - Parent::keyPressEvent(e); - return; + QLineEdit *lineEdit; + ConfigItem *item; + struct symbol *sym; + bool success; + + lineEdit = qobject_cast(editor); + // If this is not a QLineEdit, use the parent's default. + // (does this happen?) + if (!lineEdit) + goto parent; + + item = static_cast(index.internalPointer()); + if (!item || !item->menu) + goto parent; + + sym = item->menu->sym; + if (!sym) + goto parent; + + success = sym_set_string_value(sym, lineEdit->text().toUtf8().data()); + if (success) { + ConfigList::updateListForAll(); + } else { + QMessageBox::information(editor, "qconf", + "Cannot set the data (maybe due to out of range).\n" + "Setting the old value."); + lineEdit->setText(sym_get_string_value(sym)); } - e->accept(); - parent()->list->setFocus(); - hide(); + +parent: + QStyledItemDelegate::setModelData(editor, model, index); } -ConfigList::ConfigList(ConfigView* p, const char *name) - : Parent(p), +ConfigList::ConfigList(QWidget *parent, const char *name) + : QTreeWidget(parent), updateAll(false), - symbolYesPix(xpm_symbol_yes), symbolModPix(xpm_symbol_mod), symbolNoPix(xpm_symbol_no), - choiceYesPix(xpm_choice_yes), choiceNoPix(xpm_choice_no), - menuPix(xpm_menu), menuInvPix(xpm_menu_inv), menuBackPix(xpm_menuback), voidPix(xpm_void), - showName(false), showRange(false), showData(false), mode(singleMode), optMode(normalOpt), + showName(false), mode(singleMode), optMode(normalOpt), rootEntry(0), headerPopup(0) { - int i; - setObjectName(name); setSortingEnabled(false); setRootIsDecorated(true); @@ -327,26 +311,34 @@ ConfigList::ConfigList(ConfigView* p, const char *name) setVerticalScrollMode(ScrollPerPixel); setHorizontalScrollMode(ScrollPerPixel); - setHeaderLabels(QStringList() << _("Option") << _("Name") << "N" << "M" << "Y" << _("Value")); + setHeaderLabels(QStringList() << "Option" << "Name" << "Value"); - connect(this, SIGNAL(itemSelectionChanged(void)), - SLOT(updateSelection(void))); + connect(this, &ConfigList::itemSelectionChanged, + this, &ConfigList::updateSelection); if (name) { configSettings->beginGroup(name); showName = configSettings->value("/showName", false).toBool(); - showRange = configSettings->value("/showRange", false).toBool(); - showData = configSettings->value("/showData", false).toBool(); optMode = (enum optionMode)configSettings->value("/optionMode", 0).toInt(); configSettings->endGroup(); - connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); + connect(configApp, &QApplication::aboutToQuit, + this, &ConfigList::saveSettings); } - addColumn(promptColIdx); + showColumn(promptColIdx); + + setItemDelegate(new ConfigItemDelegate(this)); + + allLists.append(this); reinit(); } +ConfigList::~ConfigList() +{ + allLists.removeOne(this); +} + bool ConfigList::menuSkip(struct menu *menu) { if (optMode == normalOpt && menu_is_visible(menu)) @@ -360,21 +352,22 @@ bool ConfigList::menuSkip(struct menu *menu) void ConfigList::reinit(void) { - removeColumn(dataColIdx); - removeColumn(yesColIdx); - removeColumn(modColIdx); - removeColumn(noColIdx); - removeColumn(nameColIdx); + hideColumn(nameColIdx); if (showName) - addColumn(nameColIdx); - if (showRange) { - addColumn(noColIdx); - addColumn(modColIdx); - addColumn(yesColIdx); - } - if (showData) - addColumn(dataColIdx); + showColumn(nameColIdx); + + updateListAll(); +} + +void ConfigList::setOptionMode(QAction *action) +{ + if (action == showNormalAction) + optMode = normalOpt; + else if (action == showAllAction) + optMode = allOpt; + else + optMode = promptOpt; updateListAll(); } @@ -384,8 +377,6 @@ void ConfigList::saveSettings(void) if (!objectName().isEmpty()) { configSettings->beginGroup(objectName()); configSettings->setValue("/showName", showName); - configSettings->setValue("/showRange", showRange); - configSettings->setValue("/showData", showData); configSettings->setValue("/optionMode", (int)optMode); configSettings->endGroup(); } @@ -424,15 +415,15 @@ void ConfigList::updateSelection(void) emit menuSelected(menu); } -void ConfigList::updateList(ConfigItem* item) +void ConfigList::updateList() { ConfigItem* last = 0; + ConfigItem *item; if (!rootEntry) { if (mode != listMode) goto update; QTreeWidgetItemIterator it(this); - ConfigItem* item; while (*it) { item = (ConfigItem*)(*it); @@ -454,7 +445,7 @@ void ConfigList::updateList(ConfigItem* item) } if ((mode == singleMode || (mode == symbolMode && !(rootEntry->flags & MENU_ROOT))) && rootEntry->sym && rootEntry->prompt) { - item = last ? last->nextSibling() : firstChild(); + item = last ? last->nextSibling() : nullptr; if (!item) item = new ConfigItem(this, last, rootEntry, true); else @@ -466,11 +457,33 @@ void ConfigList::updateList(ConfigItem* item) return; } update: - updateMenuList(this, rootEntry); + updateMenuList(rootEntry); update(); resizeColumnToContents(0); } +void ConfigList::updateListForAll() +{ + QListIterator it(allLists); + + while (it.hasNext()) { + ConfigList *list = it.next(); + + list->updateList(); + } +} + +void ConfigList::updateListAllForAll() +{ + QListIterator it(allLists); + + while (it.hasNext()) { + ConfigList *list = it.next(); + + list->updateList(); + } +} + void ConfigList::setValue(ConfigItem* item, tristate val) { struct symbol* sym; @@ -491,7 +504,7 @@ void ConfigList::setValue(ConfigItem* item, tristate val) return; if (oldval == no && item->menu->list) item->setExpanded(true); - parent()->updateList(item); + ConfigList::updateListForAll(); break; } } @@ -525,12 +538,9 @@ void ConfigList::changeValue(ConfigItem* item) item->setExpanded(true); } if (oldexpr != newexpr) - parent()->updateList(item); + ConfigList::updateListForAll(); break; - case S_INT: - case S_HEX: - case S_STRING: - parent()->lineEdit->show(item); + default: break; } } @@ -544,11 +554,11 @@ void ConfigList::setRootMenu(struct menu *menu) type = menu && menu->prompt ? menu->prompt->type : P_UNKNOWN; if (type != P_MENU) return; - updateMenuList(this, 0); + updateMenuList(0); rootEntry = menu; updateListAll(); if (currentItem()) { - currentItem()->setSelected(hasFocus()); + setSelected(currentItem(), hasFocus()); scrollToItem(currentItem()); } } @@ -636,7 +646,7 @@ void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu) last = item; continue; } - hide: +hide: if (item && item->menu == child) { last = parent->firstChild(); if (last == item) @@ -648,7 +658,7 @@ void ConfigList::updateMenuList(ConfigItem *parent, struct menu* menu) } } -void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu) +void ConfigList::updateMenuList(struct menu *menu) { struct menu* child; ConfigItem* item; @@ -657,19 +667,19 @@ void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu) enum prop_type type; if (!menu) { - while (parent->topLevelItemCount() > 0) + while (topLevelItemCount() > 0) { - delete parent->takeTopLevelItem(0); + delete takeTopLevelItem(0); } return; } - last = (ConfigItem*)parent->topLevelItem(0); + last = (ConfigItem *)topLevelItem(0); if (last && !last->goParent) last = 0; for (child = menu->list; child; child = child->next) { - item = last ? last->nextSibling() : (ConfigItem*)parent->topLevelItem(0); + item = last ? last->nextSibling() : (ConfigItem *)topLevelItem(0); type = child->prompt ? child->prompt->type : P_UNKNOWN; switch (mode) { @@ -690,7 +700,7 @@ void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu) if (!child->sym && !child->list && !child->prompt) continue; if (!item || item->menu != child) - item = new ConfigItem(parent, last, child, visible); + item = new ConfigItem(this, last, child, visible); else item->testUpdateMenu(visible); @@ -701,9 +711,9 @@ void ConfigList::updateMenuList(ConfigList *parent, struct menu* menu) last = item; continue; } - hide: +hide: if (item && item->menu == child) { - last = (ConfigItem*)parent->topLevelItem(0); + last = (ConfigItem *)topLevelItem(0); if (last == item) last = 0; else while (last->nextSibling() != item) @@ -745,7 +755,10 @@ void ConfigList::keyPressEvent(QKeyEvent* ev) type = menu->prompt ? menu->prompt->type : P_UNKNOWN; if (type == P_MENU && rootEntry != menu && mode != fullMode && mode != menuMode) { - emit menuSelected(menu); + if (mode == menuMode) + emit menuSelected(menu); + else + emit itemSelected(menu); break; } case Qt::Key_Space: @@ -791,7 +804,7 @@ void ConfigList::mouseReleaseEvent(QMouseEvent* e) idx = header()->logicalIndexAt(x); switch (idx) { case promptColIdx: - icon = item->pixmap(promptColIdx); + icon = item->icon(promptColIdx); if (!icon.isNull()) { int off = header()->sectionPosition(0) + visualRect(indexAt(p)).x() + 4; // 4 is Hardcoded image offset. There might be a way to do it properly. if (x >= off && x < off + icon.availableSizes().first().width()) { @@ -802,22 +815,14 @@ void ConfigList::mouseReleaseEvent(QMouseEvent* e) break; ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; if (ptype == P_MENU && rootEntry != menu && - mode != fullMode && mode != menuMode) + mode != fullMode && mode != menuMode && + mode != listMode) emit menuSelected(menu); else changeValue(item); } } break; - case noColIdx: - setValue(item, no); - break; - case modColIdx: - setValue(item, mod); - break; - case yesColIdx: - setValue(item, yes); - break; case dataColIdx: changeValue(item); break; @@ -837,7 +842,7 @@ void ConfigList::mouseMoveEvent(QMouseEvent* e) void ConfigList::mouseDoubleClickEvent(QMouseEvent* e) { - QPoint p = e->pos(); // TODO: Check if this works(was contentsToViewport). + QPoint p = e->pos(); ConfigItem* item = (ConfigItem*)itemAt(p); struct menu *menu; enum prop_type ptype; @@ -852,9 +857,12 @@ void ConfigList::mouseDoubleClickEvent(QMouseEvent* e) if (!menu) goto skip; ptype = menu->prompt ? menu->prompt->type : P_UNKNOWN; - if (ptype == P_MENU && (mode == singleMode || mode == symbolMode)) - emit menuSelected(menu); - else if (menu->sym) + if (ptype == P_MENU && mode != listMode) { + if (mode == singleMode) + emit itemSelected(menu); + else if (mode == symbolMode) + emit menuSelected(menu); + } else if (menu->sym) changeValue(item); skip: @@ -870,7 +878,7 @@ void ConfigList::focusInEvent(QFocusEvent *e) ConfigItem* item = (ConfigItem *)currentItem(); if (item) { - item->setSelected(true); + setSelected(item, true); menu = item->menu; } emit gotFocus(menu); @@ -878,114 +886,38 @@ void ConfigList::focusInEvent(QFocusEvent *e) void ConfigList::contextMenuEvent(QContextMenuEvent *e) { - if (e->y() <= header()->geometry().bottom()) { - if (!headerPopup) { - QAction *action; - - headerPopup = new QMenu(this); - action = new QAction(_("Show Name"), this); - action->setCheckable(true); - connect(action, SIGNAL(toggled(bool)), - parent(), SLOT(setShowName(bool))); - connect(parent(), SIGNAL(showNameChanged(bool)), - action, SLOT(setOn(bool))); - action->setChecked(showName); - headerPopup->addAction(action); - action = new QAction(_("Show Range"), this); - action->setCheckable(true); - connect(action, SIGNAL(toggled(bool)), - parent(), SLOT(setShowRange(bool))); - connect(parent(), SIGNAL(showRangeChanged(bool)), - action, SLOT(setOn(bool))); - action->setChecked(showRange); - headerPopup->addAction(action); - action = new QAction(_("Show Data"), this); - action->setCheckable(true); - connect(action, SIGNAL(toggled(bool)), - parent(), SLOT(setShowData(bool))); - connect(parent(), SIGNAL(showDataChanged(bool)), - action, SLOT(setOn(bool))); - action->setChecked(showData); - headerPopup->addAction(action); - } - headerPopup->exec(e->globalPos()); - e->accept(); - } else - e->ignore(); -} - -ConfigView*ConfigView::viewList; -QAction *ConfigView::showNormalAction; -QAction *ConfigView::showAllAction; -QAction *ConfigView::showPromptAction; - -ConfigView::ConfigView(QWidget* parent, const char *name) - : Parent(parent) -{ - setObjectName(name); - QVBoxLayout *verticalLayout = new QVBoxLayout(this); - verticalLayout->setContentsMargins(0, 0, 0, 0); - - list = new ConfigList(this); - verticalLayout->addWidget(list); - lineEdit = new ConfigLineEdit(this); - lineEdit->hide(); - verticalLayout->addWidget(lineEdit); - - this->nextView = viewList; - viewList = this; -} - -ConfigView::~ConfigView(void) -{ - ConfigView** vp; - - for (vp = &viewList; *vp; vp = &(*vp)->nextView) { - if (*vp == this) { - *vp = nextView; - break; - } + if (!headerPopup) { + QAction *action; + + headerPopup = new QMenu(this); + action = new QAction("Show Name", this); + action->setCheckable(true); + connect(action, &QAction::toggled, + this, &ConfigList::setShowName); + connect(this, &ConfigList::showNameChanged, + action, &QAction::setChecked); + action->setChecked(showName); + headerPopup->addAction(action); } -} -void ConfigView::setOptionMode(QAction *act) -{ - if (act == showNormalAction) - list->optMode = normalOpt; - else if (act == showAllAction) - list->optMode = allOpt; - else - list->optMode = promptOpt; - - list->updateListAll(); + headerPopup->exec(e->globalPos()); + e->accept(); } -void ConfigView::setShowName(bool b) +void ConfigList::setShowName(bool on) { - if (list->showName != b) { - list->showName = b; - list->reinit(); - emit showNameChanged(b); - } -} + if (showName == on) + return; -void ConfigView::setShowRange(bool b) -{ - if (list->showRange != b) { - list->showRange = b; - list->reinit(); - emit showRangeChanged(b); - } + showName = on; + reinit(); + emit showNameChanged(on); } -void ConfigView::setShowData(bool b) -{ - if (list->showData != b) { - list->showData = b; - list->reinit(); - emit showDataChanged(b); - } -} +QList ConfigList::allLists; +QAction *ConfigList::showNormalAction; +QAction *ConfigList::showAllAction; +QAction *ConfigList::showPromptAction; void ConfigList::setAllOpen(bool open) { @@ -998,34 +930,31 @@ void ConfigList::setAllOpen(bool open) } } -void ConfigView::updateList(ConfigItem* item) -{ - ConfigView* v; - - for (v = viewList; v; v = v->nextView) - v->list->updateList(item); -} - -void ConfigView::updateListAll(void) -{ - ConfigView* v; - - for (v = viewList; v; v = v->nextView) - v->list->updateListAll(); -} - ConfigInfoView::ConfigInfoView(QWidget* parent, const char *name) : Parent(parent), sym(0), _menu(0) { setObjectName(name); - + setOpenLinks(false); if (!objectName().isEmpty()) { configSettings->beginGroup(objectName()); setShowDebug(configSettings->value("/showDebug", false).toBool()); configSettings->endGroup(); - connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); + connect(configApp, &QApplication::aboutToQuit, + this, &ConfigInfoView::saveSettings); } + + contextMenu = createStandardContextMenu(); + QAction *action = new QAction("Show Debug Info", contextMenu); + + action->setCheckable(true); + connect(action, &QAction::toggled, + this, &ConfigInfoView::setShowDebug); + connect(this, &ConfigInfoView::showDebugChanged, + action, &QAction::setChecked); + action->setChecked(showDebug()); + contextMenu->addSeparator(); + contextMenu->addAction(action); } void ConfigInfoView::saveSettings(void) @@ -1080,116 +1009,126 @@ void ConfigInfoView::symbolInfo(void) void ConfigInfoView::menuInfo(void) { struct symbol* sym; - QString head, debug, help; + QString info; + QTextStream stream(&info); sym = _menu->sym; if (sym) { if (_menu->prompt) { - head += ""; - head += print_filter(_(_menu->prompt->text)); - head += ""; + stream << ""; + stream << print_filter(_menu->prompt->text); + stream << ""; if (sym->name) { - head += " ("; + stream << " ("; if (showDebug()) - head += QString().sprintf("", sym); - head += print_filter(sym->name); + stream << "name << "\">"; + stream << print_filter(sym->name); if (showDebug()) - head += ""; - head += ")"; + stream << ""; + stream << ")"; } } else if (sym->name) { - head += ""; + stream << ""; if (showDebug()) - head += QString().sprintf("", sym); - head += print_filter(sym->name); + stream << "name << "\">"; + stream << print_filter(sym->name); if (showDebug()) - head += ""; - head += ""; + stream << ""; + stream << ""; } - head += "

"; + stream << "

"; if (showDebug()) - debug = debug_info(sym); + stream << debug_info(sym); struct gstr help_gstr = str_new(); + menu_get_ext_help(_menu, &help_gstr); - help = print_filter(str_get(&help_gstr)); + stream << print_filter(str_get(&help_gstr)); str_free(&help_gstr); } else if (_menu->prompt) { - head += ""; - head += print_filter(_(_menu->prompt->text)); - head += "

"; + stream << ""; + stream << print_filter(_menu->prompt->text); + stream << "

"; if (showDebug()) { if (_menu->prompt->visible.expr) { - debug += "  dep: "; - expr_print(_menu->prompt->visible.expr, expr_print_help, &debug, E_NONE); - debug += "

"; + stream << "  dep: "; + expr_print(_menu->prompt->visible.expr, + expr_print_help, &stream, E_NONE); + stream << "

"; } + + stream << "defined at " << _menu->filename << ":" + << _menu->lineno << "

"; } } - if (showDebug()) - debug += QString().sprintf("defined at %s:%d

", _menu->file->name, _menu->lineno); - setText(head + debug + help); + setText(info); } QString ConfigInfoView::debug_info(struct symbol *sym) { QString debug; + QTextStream stream(&debug); - debug += "type: "; - debug += print_filter(sym_type_name(sym->type)); + stream << "type: "; + stream << print_filter(sym_type_name(sym->type)); if (sym_is_choice(sym)) - debug += " (choice)"; + stream << " (choice)"; debug += "
"; if (sym->rev_dep.expr) { - debug += "reverse dep: "; - expr_print(sym->rev_dep.expr, expr_print_help, &debug, E_NONE); - debug += "
"; + stream << "reverse dep: "; + expr_print(sym->rev_dep.expr, expr_print_help, &stream, E_NONE); + stream << "
"; } for (struct property *prop = sym->prop; prop; prop = prop->next) { switch (prop->type) { case P_PROMPT: case P_MENU: - debug += QString().sprintf("prompt: ", prop->menu); - debug += print_filter(_(prop->text)); - debug += "
"; + stream << "prompt: name << "\">"; + stream << print_filter(prop->text); + stream << "
"; break; case P_DEFAULT: case P_SELECT: case P_RANGE: - case P_ENV: - debug += prop_get_type_name(prop->type); - debug += ": "; - expr_print(prop->expr, expr_print_help, &debug, E_NONE); - debug += "
"; + case P_COMMENT: + case P_IMPLY: + case P_SYMBOL: + stream << prop_get_type_name(prop->type); + stream << ": "; + expr_print(prop->expr, expr_print_help, + &stream, E_NONE); + stream << "
"; break; case P_CHOICE: if (sym_is_choice(sym)) { - debug += "choice: "; - expr_print(prop->expr, expr_print_help, &debug, E_NONE); - debug += "
"; + stream << "choice: "; + expr_print(prop->expr, expr_print_help, + &stream, E_NONE); + stream << "
"; } break; default: - debug += "unknown property: "; - debug += prop_get_type_name(prop->type); - debug += "
"; + stream << "unknown property: "; + stream << prop_get_type_name(prop->type); + stream << "
"; } if (prop->visible.expr) { - debug += "    dep: "; - expr_print(prop->visible.expr, expr_print_help, &debug, E_NONE); - debug += "
"; + stream << "    dep: "; + expr_print(prop->visible.expr, expr_print_help, + &stream, E_NONE); + stream << "
"; } } - debug += "
"; + stream << "
"; return debug; } QString ConfigInfoView::print_filter(const QString &str) { - QRegExp re("[<>&\"\\n]"); + QRegularExpression re("[<>&\"\\n]"); QString res = str; for (int i = 0; (i = res.indexOf(re, i)) >= 0;) { switch (res[i].toLatin1()) { @@ -1220,88 +1159,125 @@ QString ConfigInfoView::print_filter(const QString &str) void ConfigInfoView::expr_print_help(void *data, struct symbol *sym, const char *str) { - QString* text = reinterpret_cast(data); - QString str2 = print_filter(str); + QTextStream *stream = reinterpret_cast(data); if (sym && sym->name && !(sym->flags & SYMBOL_CONST)) { - *text += QString().sprintf("", sym); - *text += str2; - *text += ""; - } else - *text += str2; + *stream << "name << "\">"; + *stream << print_filter(str); + *stream << ""; + } else { + *stream << print_filter(str); + } } -QMenu* ConfigInfoView::createStandardContextMenu(const QPoint & pos) +void ConfigInfoView::clicked(const QUrl &url) { - QMenu* popup = Parent::createStandardContextMenu(pos); - QAction* action = new QAction(_("Show Debug Info"), popup); - action->setCheckable(true); - connect(action, SIGNAL(toggled(bool)), SLOT(setShowDebug(bool))); - connect(this, SIGNAL(showDebugChanged(bool)), action, SLOT(setOn(bool))); - action->setChecked(showDebug()); - popup->addSeparator(); - popup->addAction(action); - return popup; + QByteArray str = url.toEncoded(); + const std::size_t count = str.size(); + char *data = new char[count + 1]; + struct symbol **result; + struct menu *m = NULL; + + if (count < 1) { + delete[] data; + return; + } + + memcpy(data, str.constData(), count); + data[count] = '\0'; + + /* Seek for exact match */ + data[0] = '^'; + strcat(data, "$"); + result = sym_re_search(data); + if (!result) { + delete[] data; + return; + } + + sym = *result; + + /* Seek for the menu which holds the symbol */ + for (struct property *prop = sym->prop; prop; prop = prop->next) { + if (prop->type != P_PROMPT && prop->type != P_MENU) + continue; + m = prop->menu; + break; + } + + if (!m) { + /* Symbol is not visible as a menu */ + symbolInfo(); + emit showDebugChanged(true); + } else { + emit menuSelected(m); + } + + free(result); + delete[] data; } -void ConfigInfoView::contextMenuEvent(QContextMenuEvent *e) +void ConfigInfoView::contextMenuEvent(QContextMenuEvent *event) { - Parent::contextMenuEvent(e); + contextMenu->popup(event->globalPos()); + event->accept(); } -ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow* parent, const char *name) +ConfigSearchWindow::ConfigSearchWindow(ConfigMainWindow *parent) : Parent(parent), result(NULL) { - setObjectName(name); + setObjectName("search"); setWindowTitle("Search Config"); QVBoxLayout* layout1 = new QVBoxLayout(this); layout1->setContentsMargins(11, 11, 11, 11); layout1->setSpacing(6); - QHBoxLayout* layout2 = new QHBoxLayout(0); + + QHBoxLayout* layout2 = new QHBoxLayout(); layout2->setContentsMargins(0, 0, 0, 0); layout2->setSpacing(6); - layout2->addWidget(new QLabel(_("Find:"), this)); + layout2->addWidget(new QLabel("Find:", this)); editField = new QLineEdit(this); - connect(editField, SIGNAL(returnPressed()), SLOT(search())); + connect(editField, &QLineEdit::returnPressed, + this, &ConfigSearchWindow::search); layout2->addWidget(editField); - searchButton = new QPushButton(_("Search"), this); + searchButton = new QPushButton("Search", this); searchButton->setAutoDefault(false); - connect(searchButton, SIGNAL(clicked()), SLOT(search())); + connect(searchButton, &QPushButton::clicked, + this, &ConfigSearchWindow::search); layout2->addWidget(searchButton); layout1->addLayout(layout2); split = new QSplitter(this); split->setOrientation(Qt::Vertical); - list = new ConfigView(split, name); - list->list->mode = listMode; - info = new ConfigInfoView(split, name); - connect(list->list, SIGNAL(menuChanged(struct menu *)), - info, SLOT(setInfo(struct menu *))); - connect(list->list, SIGNAL(menuChanged(struct menu *)), - parent, SLOT(setMenuLink(struct menu *))); + list = new ConfigList(split, "search"); + list->mode = listMode; + info = new ConfigInfoView(split, "search"); + connect(list, &ConfigList::menuChanged, + info, &ConfigInfoView::setInfo); + connect(list, &ConfigList::menuChanged, + parent, &ConfigMainWindow::setMenuLink); layout1->addWidget(split); - if (name) { - QVariant x, y; - int width, height; - bool ok; + QVariant x, y; + int width, height; + bool ok; - configSettings->beginGroup(name); - width = configSettings->value("/window width", parent->width() / 2).toInt(); - height = configSettings->value("/window height", parent->height() / 2).toInt(); - resize(width, height); - x = configSettings->value("/window x"); - y = configSettings->value("/window y"); - if ((x.isValid())&&(y.isValid())) - move(x.toInt(), y.toInt()); - QList sizes = configSettings->readSizes("/split", &ok); - if (ok) - split->setSizes(sizes); - configSettings->endGroup(); - connect(configApp, SIGNAL(aboutToQuit()), SLOT(saveSettings())); - } + configSettings->beginGroup("search"); + width = configSettings->value("/window width", parent->width() / 2).toInt(); + height = configSettings->value("/window height", parent->height() / 2).toInt(); + resize(width, height); + x = configSettings->value("/window x"); + y = configSettings->value("/window y"); + if (x.isValid() && y.isValid()) + move(x.toInt(), y.toInt()); + QList sizes = configSettings->readSizes("/split", &ok); + if (ok) + split->setSizes(sizes); + configSettings->endGroup(); + connect(configApp, &QApplication::aboutToQuit, + this, &ConfigSearchWindow::saveSettings); } void ConfigSearchWindow::saveSettings(void) @@ -1324,7 +1300,7 @@ void ConfigSearchWindow::search(void) ConfigItem *lastItem = NULL; free(result); - list->list->clear(); + list->clear(); info->clear(); result = sym_re_search(editField->text().toLatin1()); @@ -1332,7 +1308,7 @@ void ConfigSearchWindow::search(void) return; for (p = result; *p; p++) { for_all_prompts((*p), prop) - lastItem = new ConfigItem(list->list, lastItem, prop->menu, + lastItem = new ConfigItem(list, lastItem, prop->menu, menu_is_visible(prop->menu)); } } @@ -1343,116 +1319,143 @@ void ConfigSearchWindow::search(void) ConfigMainWindow::ConfigMainWindow(void) : searchWindow(0) { - QMenuBar* menu; bool ok = true; QVariant x, y; int width, height; char title[256]; - QDesktopWidget *d = configApp->desktop(); snprintf(title, sizeof(title), "%s%s", rootmenu.prompt->text, "" ); setWindowTitle(title); - width = configSettings->value("/window width", d->width() - 64).toInt(); - height = configSettings->value("/window height", d->height() - 64).toInt(); + QRect g = configApp->primaryScreen()->geometry(); + width = configSettings->value("/window width", g.width() - 64).toInt(); + height = configSettings->value("/window height", g.height() - 64).toInt(); resize(width, height); x = configSettings->value("/window x"); y = configSettings->value("/window y"); if ((x.isValid())&&(y.isValid())) move(x.toInt(), y.toInt()); - split1 = new QSplitter(this); + // set up icons + ConfigItem::symbolYesIcon = QIcon(QPixmap(xpm_symbol_yes)); + ConfigItem::symbolModIcon = QIcon(QPixmap(xpm_symbol_mod)); + ConfigItem::symbolNoIcon = QIcon(QPixmap(xpm_symbol_no)); + ConfigItem::choiceYesIcon = QIcon(QPixmap(xpm_choice_yes)); + ConfigItem::choiceNoIcon = QIcon(QPixmap(xpm_choice_no)); + ConfigItem::menuIcon = QIcon(QPixmap(xpm_menu)); + ConfigItem::menubackIcon = QIcon(QPixmap(xpm_menuback)); + + QWidget *widget = new QWidget(this); + QVBoxLayout *layout = new QVBoxLayout(widget); + setCentralWidget(widget); + + split1 = new QSplitter(widget); split1->setOrientation(Qt::Horizontal); - setCentralWidget(split1); + split1->setChildrenCollapsible(false); - menuView = new ConfigView(split1, "menu"); - menuList = menuView->list; + menuList = new ConfigList(widget, "menu"); - split2 = new QSplitter(split1); + split2 = new QSplitter(widget); + split2->setChildrenCollapsible(false); split2->setOrientation(Qt::Vertical); // create config tree - configView = new ConfigView(split2, "config"); - configList = configView->list; + configList = new ConfigList(widget, "config"); + + helpText = new ConfigInfoView(widget, "help"); - helpText = new ConfigInfoView(split2, "help"); + layout->addWidget(split2); + split2->addWidget(split1); + split1->addWidget(configList); + split1->addWidget(menuList); + split2->addWidget(helpText); setTabOrder(configList, helpText); configList->setFocus(); - menu = menuBar(); - toolBar = new QToolBar("Tools", this); - addToolBar(toolBar); - - backAction = new QAction(QPixmap(xpm_back), _("Back"), this); - connect(backAction, SIGNAL(triggered(bool)), SLOT(goBack())); - backAction->setEnabled(false); - QAction *quitAction = new QAction(_("&Quit"), this); - quitAction->setShortcut(Qt::CTRL + Qt::Key_Q); - connect(quitAction, SIGNAL(triggered(bool)), SLOT(close())); - QAction *loadAction = new QAction(QPixmap(xpm_load), _("&Load"), this); - loadAction->setShortcut(Qt::CTRL + Qt::Key_L); - connect(loadAction, SIGNAL(triggered(bool)), SLOT(loadConfig())); - saveAction = new QAction(QPixmap(xpm_save), _("&Save"), this); - saveAction->setShortcut(Qt::CTRL + Qt::Key_S); - connect(saveAction, SIGNAL(triggered(bool)), SLOT(saveConfig())); + backAction = new QAction(QPixmap(xpm_back), "Back", this); + connect(backAction, &QAction::triggered, + this, &ConfigMainWindow::goBack); + + QAction *quitAction = new QAction("&Quit", this); + quitAction->setShortcut(Qt::CTRL | Qt::Key_Q); + connect(quitAction, &QAction::triggered, + this, &ConfigMainWindow::close); + + QAction *loadAction = new QAction(QPixmap(xpm_load), "&Load", this); + loadAction->setShortcut(Qt::CTRL | Qt::Key_L); + connect(loadAction, &QAction::triggered, + this, &ConfigMainWindow::loadConfig); + + saveAction = new QAction(QPixmap(xpm_save), "&Save", this); + saveAction->setShortcut(Qt::CTRL | Qt::Key_S); + connect(saveAction, &QAction::triggered, + this, &ConfigMainWindow::saveConfig); + conf_set_changed_callback(conf_changed); + // Set saveAction's initial state conf_changed(); - QAction *saveAsAction = new QAction(_("Save &As..."), this); - connect(saveAsAction, SIGNAL(triggered(bool)), SLOT(saveConfigAs())); - QAction *searchAction = new QAction(_("&Find"), this); - searchAction->setShortcut(Qt::CTRL + Qt::Key_F); - connect(searchAction, SIGNAL(triggered(bool)), SLOT(searchConfig())); - singleViewAction = new QAction(QPixmap(xpm_single_view), _("Single View"), this); + configname = xstrdup(conf_get_configname()); + + QAction *saveAsAction = new QAction("Save &As...", this); + connect(saveAsAction, &QAction::triggered, + this, &ConfigMainWindow::saveConfigAs); + QAction *searchAction = new QAction("&Find", this); + searchAction->setShortcut(Qt::CTRL | Qt::Key_F); + connect(searchAction, &QAction::triggered, + this, &ConfigMainWindow::searchConfig); + singleViewAction = new QAction(QPixmap(xpm_single_view), "Single View", this); singleViewAction->setCheckable(true); - connect(singleViewAction, SIGNAL(triggered(bool)), SLOT(showSingleView())); - splitViewAction = new QAction(QPixmap(xpm_split_view), _("Split View"), this); + connect(singleViewAction, &QAction::triggered, + this, &ConfigMainWindow::showSingleView); + splitViewAction = new QAction(QPixmap(xpm_split_view), "Split View", this); splitViewAction->setCheckable(true); - connect(splitViewAction, SIGNAL(triggered(bool)), SLOT(showSplitView())); - fullViewAction = new QAction(QPixmap(xpm_tree_view), _("Full View"), this); + connect(splitViewAction, &QAction::triggered, + this, &ConfigMainWindow::showSplitView); + fullViewAction = new QAction(QPixmap(xpm_tree_view), "Full View", this); fullViewAction->setCheckable(true); - connect(fullViewAction, SIGNAL(triggered(bool)), SLOT(showFullView())); + connect(fullViewAction, &QAction::triggered, + this, &ConfigMainWindow::showFullView); - QAction *showNameAction = new QAction(_("Show Name"), this); + QAction *showNameAction = new QAction("Show Name", this); showNameAction->setCheckable(true); - connect(showNameAction, SIGNAL(toggled(bool)), configView, SLOT(setShowName(bool))); - showNameAction->setChecked(configView->showName()); - QAction *showRangeAction = new QAction(_("Show Range"), this); - showRangeAction->setCheckable(true); - connect(showRangeAction, SIGNAL(toggled(bool)), configView, SLOT(setShowRange(bool))); - QAction *showDataAction = new QAction(_("Show Data"), this); - showDataAction->setCheckable(true); - connect(showDataAction, SIGNAL(toggled(bool)), configView, SLOT(setShowData(bool))); + connect(showNameAction, &QAction::toggled, + configList, &ConfigList::setShowName); + showNameAction->setChecked(configList->showName); QActionGroup *optGroup = new QActionGroup(this); optGroup->setExclusive(true); - connect(optGroup, SIGNAL(triggered(QAction*)), configView, - SLOT(setOptionMode(QAction *))); - connect(optGroup, SIGNAL(triggered(QAction *)), menuView, - SLOT(setOptionMode(QAction *))); - - configView->showNormalAction = new QAction(_("Show Normal Options"), optGroup); - configView->showAllAction = new QAction(_("Show All Options"), optGroup); - configView->showPromptAction = new QAction(_("Show Prompt Options"), optGroup); - configView->showNormalAction->setCheckable(true); - configView->showAllAction->setCheckable(true); - configView->showPromptAction->setCheckable(true); - - QAction *showDebugAction = new QAction( _("Show Debug Info"), this); + connect(optGroup, &QActionGroup::triggered, + configList, &ConfigList::setOptionMode); + connect(optGroup, &QActionGroup::triggered, + menuList, &ConfigList::setOptionMode); + + ConfigList::showNormalAction = new QAction("Show Normal Options", optGroup); + ConfigList::showNormalAction->setCheckable(true); + ConfigList::showAllAction = new QAction("Show All Options", optGroup); + ConfigList::showAllAction->setCheckable(true); + ConfigList::showPromptAction = new QAction("Show Prompt Options", optGroup); + ConfigList::showPromptAction->setCheckable(true); + + QAction *showDebugAction = new QAction("Show Debug Info", this); showDebugAction->setCheckable(true); - connect(showDebugAction, SIGNAL(toggled(bool)), helpText, SLOT(setShowDebug(bool))); + connect(showDebugAction, &QAction::toggled, + helpText, &ConfigInfoView::setShowDebug); showDebugAction->setChecked(helpText->showDebug()); - QAction *showIntroAction = new QAction( _("Introduction"), this); - connect(showIntroAction, SIGNAL(triggered(bool)), SLOT(showIntro())); - QAction *showAboutAction = new QAction( _("About"), this); - connect(showAboutAction, SIGNAL(triggered(bool)), SLOT(showAbout())); + QAction *showIntroAction = new QAction("Introduction", this); + connect(showIntroAction, &QAction::triggered, + this, &ConfigMainWindow::showIntro); + QAction *showAboutAction = new QAction("About", this); + connect(showAboutAction, &QAction::triggered, + this, &ConfigMainWindow::showAbout); // init tool bar + QToolBar *toolBar = addToolBar("Tools"); toolBar->addAction(backAction); toolBar->addSeparator(); toolBar->addAction(loadAction); @@ -1462,53 +1465,55 @@ ConfigMainWindow::ConfigMainWindow(void) toolBar->addAction(splitViewAction); toolBar->addAction(fullViewAction); - // create config menu - QMenu* config = menu->addMenu(_("&File")); - config->addAction(loadAction); - config->addAction(saveAction); - config->addAction(saveAsAction); - config->addSeparator(); - config->addAction(quitAction); + // create file menu + QMenu *menu = menuBar()->addMenu("&File"); + menu->addAction(loadAction); + menu->addAction(saveAction); + menu->addAction(saveAsAction); + menu->addSeparator(); + menu->addAction(quitAction); // create edit menu - QMenu* editMenu = menu->addMenu(_("&Edit")); - editMenu->addAction(searchAction); + menu = menuBar()->addMenu("&Edit"); + menu->addAction(searchAction); // create options menu - QMenu* optionMenu = menu->addMenu(_("&Option")); - optionMenu->addAction(showNameAction); - optionMenu->addAction(showRangeAction); - optionMenu->addAction(showDataAction); - optionMenu->addSeparator(); - optionMenu->addActions(optGroup->actions()); - optionMenu->addSeparator(); - optionMenu->addAction(showDebugAction); + menu = menuBar()->addMenu("&Option"); + menu->addAction(showNameAction); + menu->addSeparator(); + menu->addActions(optGroup->actions()); + menu->addSeparator(); + menu->addAction(showDebugAction); // create help menu - menu->addSeparator(); - QMenu* helpMenu = menu->addMenu(_("&Help")); - helpMenu->addAction(showIntroAction); - helpMenu->addAction(showAboutAction); - - connect(configList, SIGNAL(menuChanged(struct menu *)), - helpText, SLOT(setInfo(struct menu *))); - connect(configList, SIGNAL(menuSelected(struct menu *)), - SLOT(changeMenu(struct menu *))); - connect(configList, SIGNAL(parentSelected()), - SLOT(goBack())); - connect(menuList, SIGNAL(menuChanged(struct menu *)), - helpText, SLOT(setInfo(struct menu *))); - connect(menuList, SIGNAL(menuSelected(struct menu *)), - SLOT(changeMenu(struct menu *))); - - connect(configList, SIGNAL(gotFocus(struct menu *)), - helpText, SLOT(setInfo(struct menu *))); - connect(menuList, SIGNAL(gotFocus(struct menu *)), - helpText, SLOT(setInfo(struct menu *))); - connect(menuList, SIGNAL(gotFocus(struct menu *)), - SLOT(listFocusChanged(void))); - connect(helpText, SIGNAL(menuSelected(struct menu *)), - SLOT(setMenuLink(struct menu *))); + menu = menuBar()->addMenu("&Help"); + menu->addAction(showIntroAction); + menu->addAction(showAboutAction); + + connect(helpText, &ConfigInfoView::anchorClicked, + helpText, &ConfigInfoView::clicked); + + connect(configList, &ConfigList::menuChanged, + helpText, &ConfigInfoView::setInfo); + connect(configList, &ConfigList::menuSelected, + this, &ConfigMainWindow::changeMenu); + connect(configList, &ConfigList::itemSelected, + this, &ConfigMainWindow::changeItens); + connect(configList, &ConfigList::parentSelected, + this, &ConfigMainWindow::goBack); + connect(menuList, &ConfigList::menuChanged, + helpText, &ConfigInfoView::setInfo); + connect(menuList, &ConfigList::menuSelected, + this, &ConfigMainWindow::changeMenu); + + connect(configList, &ConfigList::gotFocus, + helpText, &ConfigInfoView::setInfo); + connect(menuList, &ConfigList::gotFocus, + helpText, &ConfigInfoView::setInfo); + connect(menuList, &ConfigList::gotFocus, + this, &ConfigMainWindow::listFocusChanged); + connect(helpText, &ConfigInfoView::menuSelected, + this, &ConfigMainWindow::setMenuLink); QString listMode = configSettings->value("/listMode", "symbol").toString(); if (listMode == "single") @@ -1530,45 +1535,74 @@ ConfigMainWindow::ConfigMainWindow(void) void ConfigMainWindow::loadConfig(void) { - QString s = QFileDialog::getOpenFileName(this, "", conf_get_configname()); - if (s.isNull()) + QString str; + QByteArray ba; + const char *name; + + str = QFileDialog::getOpenFileName(this, "", configname); + if (str.isNull()) return; - if (conf_read(QFile::encodeName(s))) - QMessageBox::information(this, "qconf", _("Unable to load configuration!")); - ConfigView::updateListAll(); + + ba = str.toLocal8Bit(); + name = ba.data(); + + if (conf_read(name)) + QMessageBox::information(this, "qconf", "Unable to load configuration!"); + + free(configname); + configname = xstrdup(name); + + ConfigList::updateListAllForAll(); } bool ConfigMainWindow::saveConfig(void) { - if (conf_write(NULL)) { - QMessageBox::information(this, "qconf", _("Unable to save configuration!")); + if (conf_write(configname)) { + QMessageBox::information(this, "qconf", "Unable to save configuration!"); return false; } + conf_write_autoconf(0); + return true; } void ConfigMainWindow::saveConfigAs(void) { - QString s = QFileDialog::getSaveFileName(this, "", conf_get_configname()); - if (s.isNull()) + QString str; + QByteArray ba; + const char *name; + + str = QFileDialog::getSaveFileName(this, "", configname); + if (str.isNull()) return; - saveConfig(); + + ba = str.toLocal8Bit(); + name = ba.data(); + + if (conf_write(name)) { + QMessageBox::information(this, "qconf", "Unable to save configuration!"); + } + conf_write_autoconf(0); + + free(configname); + configname = xstrdup(name); } void ConfigMainWindow::searchConfig(void) { if (!searchWindow) - searchWindow = new ConfigSearchWindow(this, "search"); + searchWindow = new ConfigSearchWindow(this); searchWindow->show(); } -void ConfigMainWindow::changeMenu(struct menu *menu) +void ConfigMainWindow::changeItens(struct menu *menu) { configList->setRootMenu(menu); - if (configList->rootEntry->parent == &rootmenu) - backAction->setEnabled(false); - else - backAction->setEnabled(true); +} + +void ConfigMainWindow::changeMenu(struct menu *menu) +{ + menuList->setRootMenu(menu); } void ConfigMainWindow::setMenuLink(struct menu *menu) @@ -1588,22 +1622,26 @@ void ConfigMainWindow::setMenuLink(struct menu *menu) return; list->setRootMenu(parent); break; - case symbolMode: + case menuMode: if (menu->flags & MENU_ROOT) { - configList->setRootMenu(menu); + menuList->setRootMenu(menu); configList->clearSelection(); - list = menuList; - } else { list = configList; + } else { parent = menu_get_parent_menu(menu->parent); if (!parent) return; - item = menuList->findConfigItem(parent); + + /* Select the config view */ + item = configList->findConfigItem(parent); if (item) { - item->setSelected(true); - menuList->scrollToItem(item); + configList->setSelected(item, true); + configList->scrollToItem(item); } - list->setRootMenu(parent); + + menuList->setRootMenu(parent); + menuList->clearSelection(); + list = menuList; } break; case fullMode: @@ -1616,9 +1654,10 @@ void ConfigMainWindow::setMenuLink(struct menu *menu) if (list) { item = list->findConfigItem(menu); if (item) { - item->setSelected(true); + list->setSelected(item, true); list->scrollToItem(item); list->setFocus(); + helpText->setInfo(menu); } } } @@ -1631,25 +1670,10 @@ void ConfigMainWindow::listFocusChanged(void) void ConfigMainWindow::goBack(void) { - ConfigItem* item, *oldSelection; - - configList->setParentMenu(); if (configList->rootEntry == &rootmenu) - backAction->setEnabled(false); - - if (menuList->selectedItems().count() == 0) return; - item = (ConfigItem*)menuList->selectedItems().first(); - oldSelection = item; - while (item) { - if (item->menu == configList->rootEntry) { - oldSelection->setSelected(false); - item->setSelected(true); - break; - } - item = (ConfigItem*)item->parent(); - } + configList->setParentMenu(); } void ConfigMainWindow::showSingleView(void) @@ -1661,7 +1685,9 @@ void ConfigMainWindow::showSingleView(void) fullViewAction->setEnabled(true); fullViewAction->setChecked(false); - menuView->hide(); + backAction->setEnabled(true); + + menuList->hide(); menuList->setRootMenu(0); configList->mode = singleMode; if (configList->rootEntry == &rootmenu) @@ -1680,17 +1706,19 @@ void ConfigMainWindow::showSplitView(void) fullViewAction->setEnabled(true); fullViewAction->setChecked(false); - configList->mode = symbolMode; + backAction->setEnabled(false); + + configList->mode = menuMode; if (configList->rootEntry == &rootmenu) configList->updateListAll(); else configList->setRootMenu(&rootmenu); configList->setAllOpen(true); configApp->processEvents(); - menuList->mode = menuMode; + menuList->mode = symbolMode; menuList->setRootMenu(&rootmenu); menuList->setAllOpen(true); - menuView->show(); + menuList->show(); menuList->setFocus(); } @@ -1703,7 +1731,9 @@ void ConfigMainWindow::showFullView(void) fullViewAction->setEnabled(false); fullViewAction->setChecked(true); - menuView->hide(); + backAction->setEnabled(false); + + menuList->hide(); menuList->setRootMenu(0); configList->mode = fullMode; if (configList->rootEntry == &rootmenu) @@ -1715,7 +1745,6 @@ void ConfigMainWindow::showFullView(void) /* * ask for saving configuration before quitting - * TODO ask only when something changed */ void ConfigMainWindow::closeEvent(QCloseEvent* e) { @@ -1723,11 +1752,21 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e) e->accept(); return; } - QMessageBox mb("qconf", _("Save configuration?"), QMessageBox::Warning, - QMessageBox::Yes | QMessageBox::Default, QMessageBox::No, QMessageBox::Cancel | QMessageBox::Escape); - mb.setButtonText(QMessageBox::Yes, _("&Save Changes")); - mb.setButtonText(QMessageBox::No, _("&Discard Changes")); - mb.setButtonText(QMessageBox::Cancel, _("Cancel Exit")); + + QMessageBox mb(QMessageBox::Icon::Warning, "qconf", + "Save configuration?"); + + QPushButton *yb = mb.addButton(QMessageBox::Yes); + QPushButton *db = mb.addButton(QMessageBox::No); + QPushButton *cb = mb.addButton(QMessageBox::Cancel); + + yb->setText("&Save Changes"); + db->setText("&Discard Changes"); + cb->setText("Cancel Exit"); + + mb.setDefaultButton(yb); + mb.setEscapeButton(cb); + switch (mb.exec()) { case QMessageBox::Yes: if (saveConfig()) @@ -1746,28 +1785,40 @@ void ConfigMainWindow::closeEvent(QCloseEvent* e) void ConfigMainWindow::showIntro(void) { - static const QString str = _("Welcome to the qconf graphical configuration tool.\n\n" - "For each option, a blank box indicates the feature is disabled, a check\n" - "indicates it is enabled, and a dot indicates that it is to be compiled\n" - "as a module. Clicking on the box will cycle through the three states.\n\n" - "If you do not see an option (e.g., a device driver) that you believe\n" - "should be present, try turning on Show All Options under the Options menu.\n" - "Although there is no cross reference yet to help you figure out what other\n" - "options must be enabled to support the option you are interested in, you can\n" - "still view the help of a grayed-out option.\n\n" - "Toggling Show Debug Info under the Options menu will show the dependencies,\n" - "which you can then match by examining other options.\n\n"); + static const QString str = + "Welcome to the qconf graphical configuration tool.\n" + "\n" + "For bool and tristate options, a blank box indicates the " + "feature is disabled, a check indicates it is enabled, and a " + "dot indicates that it is to be compiled as a module. Clicking " + "on the box will cycle through the three states. For int, hex, " + "and string options, double-clicking or pressing F2 on the " + "Value cell will allow you to edit the value.\n" + "\n" + "If you do not see an option (e.g., a device driver) that you " + "believe should be present, try turning on Show All Options " + "under the Options menu. Enabling Show Debug Info will help you" + "figure out what other options must be enabled to support the " + "option you are interested in, and hyperlinks will navigate to " + "them.\n" + "\n" + "Toggling Show Debug Info under the Options menu will show the " + "dependencies, which you can then match by examining other " + "options.\n"; QMessageBox::information(this, "qconf", str); } void ConfigMainWindow::showAbout(void) { - static const QString str = _("qconf is Copyright (C) 2002 Roman Zippel .\n" - "Copyright (C) 2015 Boris Barbulovski .\n\n" - "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n"); + static const QString str = "qconf is Copyright (C) 2002 Roman Zippel .\n" + "Copyright (C) 2015 Boris Barbulovski .\n" + "\n" + "Bug reports and feature request can also be entered at http://bugzilla.kernel.org/\n" + "\n" + "Qt Version: "; - QMessageBox::information(this, "qconf", str); + QMessageBox::information(this, "qconf", str + qVersion()); } void ConfigMainWindow::saveSettings(void) @@ -1826,7 +1877,7 @@ static const char *progname; static void usage(void) { - printf(_("%s [-s] \n").toLatin1().constData(), progname); + printf("%s [-s] \n", progname); exit(0); } @@ -1835,11 +1886,7 @@ int main(int ac, char** av) ConfigMainWindow* v; const char *name; - bindtextdomain(PACKAGE, LOCALEDIR); - textdomain(PACKAGE); - progname = av[0]; - configApp = new QApplication(ac, av); if (ac > 1 && av[1][0] == '-') { switch (av[1][1]) { case 's': @@ -1860,6 +1907,8 @@ int main(int ac, char** av) conf_read(NULL); //zconfdump(stdout); + configApp = new QApplication(ac, av); + configSettings = new ConfigSettings(); configSettings->beginGroup("/kconfig/qconf"); v = new ConfigMainWindow(); diff --git a/support/kconfig/qconf.h b/support/kconfig/qconf.h index a40036d1b0..78b0a1dfcd 100644 --- a/support/kconfig/qconf.h +++ b/support/kconfig/qconf.h @@ -1,25 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (C) 2002 Roman Zippel - * Released under the terms of the GNU GPL v2.0. */ -#include -#include -#include +#include +#include #include -#include +#include +#include #include #include -#include #include -#include -#include +#include +#include +#include + #include "expr.h" -class ConfigView; class ConfigList; class ConfigItem; -class ConfigLineEdit; class ConfigMainWindow; class ConfigSettings : public QSettings { @@ -30,7 +29,7 @@ public: }; enum colIdx { - promptColIdx, nameColIdx, noColIdx, modColIdx, yesColIdx, dataColIdx, colNr + promptColIdx, nameColIdx, dataColIdx }; enum listMode { singleMode, menuMode, symbolMode, fullMode, listMode @@ -43,13 +42,16 @@ class ConfigList : public QTreeWidget { Q_OBJECT typedef class QTreeWidget Parent; public: - ConfigList(ConfigView* p, const char *name = 0); + ConfigList(QWidget *parent, const char *name = 0); + ~ConfigList(); void reinit(void); - ConfigView* parent(void) const - { - return (ConfigView*)Parent::parent(); - } ConfigItem* findConfigItem(struct menu *); + void setSelected(QTreeWidgetItem *item, bool enable) { + for (int i = 0; i < selectedItems().size(); i++) + selectedItems().at(i)->setSelected(false); + + item->setSelected(enable); + } protected: void keyPressEvent(QKeyEvent *e); @@ -63,61 +65,52 @@ protected: public slots: void setRootMenu(struct menu *menu); - void updateList(ConfigItem *item); + void updateList(); void setValue(ConfigItem* item, tristate val); void changeValue(ConfigItem* item); void updateSelection(void); void saveSettings(void); + void setOptionMode(QAction *action); + void setShowName(bool on); + signals: void menuChanged(struct menu *menu); void menuSelected(struct menu *menu); + void itemSelected(struct menu *menu); void parentSelected(void); void gotFocus(struct menu *); + void showNameChanged(bool on); public: void updateListAll(void) { updateAll = true; - updateList(NULL); + updateList(); updateAll = false; } - ConfigList* listView() - { - return this; - } - ConfigItem* firstChild() const - { - return (ConfigItem *)children().first(); - } - void addColumn(colIdx idx) - { - showColumn(idx); - } - void removeColumn(colIdx idx) - { - hideColumn(idx); - } void setAllOpen(bool open); void setParentMenu(void); bool menuSkip(struct menu *); void updateMenuList(ConfigItem *parent, struct menu*); - void updateMenuList(ConfigList *parent, struct menu*); + void updateMenuList(struct menu *menu); bool updateAll; - QPixmap symbolYesPix, symbolModPix, symbolNoPix; - QPixmap choiceYesPix, choiceNoPix; - QPixmap menuPix, menuInvPix, menuBackPix, voidPix; - - bool showName, showRange, showData; + bool showName; enum listMode mode; enum optionMode optMode; struct menu *rootEntry; QPalette disabledColorGroup; QPalette inactivedColorGroup; QMenu* headerPopup; + + static QList allLists; + static void updateListForAll(); + static void updateListAllForAll(); + + static QAction *showNormalAction, *showAllAction, *showPromptAction; }; class ConfigItem : public QTreeWidgetItem { @@ -140,7 +133,6 @@ public: } ~ConfigItem(void); void init(void); - void okRename(int col); void updateMenu(void); void testUpdateMenu(bool v); ConfigList* listView() const @@ -165,82 +157,36 @@ public: return ret; } - void setText(colIdx idx, const QString& text) - { - Parent::setText(idx, text); - } - QString text(colIdx idx) const - { - return Parent::text(idx); - } - void setPixmap(colIdx idx, const QIcon &icon) - { - Parent::setIcon(idx, icon); - } - const QIcon pixmap(colIdx idx) const - { - return icon(idx); - } // TODO: Implement paintCell ConfigItem* nextItem; struct menu *menu; bool visible; bool goParent; -}; -class ConfigLineEdit : public QLineEdit { - Q_OBJECT - typedef class QLineEdit Parent; -public: - ConfigLineEdit(ConfigView* parent); - ConfigView* parent(void) const - { - return (ConfigView*)Parent::parent(); - } - void show(ConfigItem *i); - void keyPressEvent(QKeyEvent *e); - -public: - ConfigItem *item; + static QIcon symbolYesIcon, symbolModIcon, symbolNoIcon; + static QIcon choiceYesIcon, choiceNoIcon; + static QIcon menuIcon, menubackIcon; }; -class ConfigView : public QWidget { - Q_OBJECT - typedef class QWidget Parent; -public: - ConfigView(QWidget* parent, const char *name = 0); - ~ConfigView(void); - static void updateList(ConfigItem* item); - static void updateListAll(void); - - bool showName(void) const { return list->showName; } - bool showRange(void) const { return list->showRange; } - bool showData(void) const { return list->showData; } -public slots: - void setShowName(bool); - void setShowRange(bool); - void setShowData(bool); - void setOptionMode(QAction *); -signals: - void showNameChanged(bool); - void showRangeChanged(bool); - void showDataChanged(bool); +class ConfigItemDelegate : public QStyledItemDelegate +{ +private: + struct menu *menu; public: - ConfigList* list; - ConfigLineEdit* lineEdit; - - static ConfigView* viewList; - ConfigView* nextView; - - static QAction *showNormalAction; - static QAction *showAllAction; - static QAction *showPromptAction; + ConfigItemDelegate(QObject *parent = nullptr) + : QStyledItemDelegate(parent) {} + QWidget *createEditor(QWidget *parent, + const QStyleOptionViewItem &option, + const QModelIndex &index) const override; + void setModelData(QWidget *editor, QAbstractItemModel *model, + const QModelIndex &index) const override; }; class ConfigInfoView : public QTextBrowser { Q_OBJECT typedef class QTextBrowser Parent; + QMenu *contextMenu; public: ConfigInfoView(QWidget* parent, const char *name = 0); bool showDebug(void) const { return _showDebug; } @@ -249,6 +195,7 @@ public slots: void setInfo(struct menu *menu); void saveSettings(void); void setShowDebug(bool); + void clicked (const QUrl &url); signals: void showDebugChanged(bool); @@ -260,8 +207,7 @@ protected: QString debug_info(struct symbol *sym); static QString print_filter(const QString &str); static void expr_print_help(void *data, struct symbol *sym, const char *str); - QMenu *createStandardContextMenu(const QPoint & pos); - void contextMenuEvent(QContextMenuEvent *e); + void contextMenuEvent(QContextMenuEvent *event); struct symbol *sym; struct menu *_menu; @@ -272,7 +218,7 @@ class ConfigSearchWindow : public QDialog { Q_OBJECT typedef class QDialog Parent; public: - ConfigSearchWindow(ConfigMainWindow* parent, const char *name = 0); + ConfigSearchWindow(ConfigMainWindow *parent); public slots: void saveSettings(void); @@ -282,7 +228,7 @@ protected: QLineEdit* editField; QPushButton* searchButton; QSplitter* split; - ConfigView* list; + ConfigList *list; ConfigInfoView* info; struct symbol **result; @@ -291,12 +237,14 @@ protected: class ConfigMainWindow : public QMainWindow { Q_OBJECT + char *configname; static QAction *saveAction; static void conf_changed(void); public: ConfigMainWindow(void); public slots: void changeMenu(struct menu *); + void changeItens(struct menu *); void setMenuLink(struct menu *); void listFocusChanged(void); void goBack(void); @@ -315,12 +263,9 @@ protected: void closeEvent(QCloseEvent *e); ConfigSearchWindow *searchWindow; - ConfigView *menuView; ConfigList *menuList; - ConfigView *configView; ConfigList *configList; ConfigInfoView *helpText; - QToolBar *toolBar; QAction *backAction; QAction *singleViewAction; QAction *splitViewAction; diff --git a/support/kconfig/streamline_config.pl b/support/kconfig/streamline_config.pl index a2e83ab17d..d51cd7ac15 100755 --- a/support/kconfig/streamline_config.pl +++ b/support/kconfig/streamline_config.pl @@ -1,7 +1,7 @@ #!/usr/bin/env perl +# SPDX-License-Identifier: GPL-2.0 # # Copyright 2005-2009 - Steven Rostedt -# Licensed under the terms of the GNU GPL License version 2 # # It's simple enough to figure out how this works. # If not, then you can ask me at stripconfig@goodmis.org @@ -21,7 +21,7 @@ # 1. Boot up the kernel that you want to stream line the config on. # 2. Change directory to the directory holding the source of the # kernel that you just booted. -# 3. Copy the configuraton file to this directory as .config +# 3. Copy the configuration file to this directory as .config # 4. Have all your devices that you need modules for connected and # operational (make sure that their corresponding modules are loaded) # 5. Run this script redirecting the output to some other file @@ -56,8 +56,6 @@ sub dprint { print STDERR @_; } -my $config = ".config"; - my $uname = `uname -r`; chomp $uname; @@ -145,6 +143,7 @@ my %depends; my %selects; my %prompts; my %objects; +my %config2kfile; my $var; my $iflevel = 0; my @ifdeps; @@ -165,13 +164,13 @@ sub read_kconfig { my $last_source = ""; # Check for any environment variables used - while ($source =~ /\$(\w+)/ && $last_source ne $source) { + while ($source =~ /\$\((\w+)\)/ && $last_source ne $source) { my $env = $1; $last_source = $source; - $source =~ s/\$$env/$ENV{$env}/; + $source =~ s/\$\($env\)/$ENV{$env}/; } - open(my $kinfile, '<', $source) || die "Can't open $kconfig"; + open(my $kinfile, '<', $source) || die "Can't open $source"; while (<$kinfile>) { chomp; @@ -203,6 +202,7 @@ sub read_kconfig { if (/^\s*(menu)?config\s+(\S+)\s*$/) { $state = "NEW"; $config = $2; + $config2kfile{"CONFIG_$config"} = $kconfig; # Add depends for 'if' nesting for (my $i = 0; $i < $iflevel; $i++) { @@ -317,7 +317,7 @@ foreach my $makefile (@makefiles) { $_ = convert_vars($_, %make_vars); # collect objects after obj-$(CONFIG_FOO_BAR) - if (/obj-\$\((CONFIG_[^\)]*)\)\s*[+:]?=\s*(.*)/) { + if (/obj-\$[({](CONFIG_[^})]*)[)}]\s*[+:]?=\s*(.*)/) { $var = $1; $objs = $2; @@ -374,7 +374,7 @@ if (defined($lsmod_file)) { $lsmod = "$dir/lsmod"; last; } -} + } if (!defined($lsmod)) { # try just the path $lsmod = "lsmod"; @@ -481,7 +481,7 @@ sub parse_config_depends # The idea is we look at all the configs that select it. If one # is already in our list of configs to enable, then there's nothing # else to do. If there isn't, we pick the first config that was -# enabled in the orignal config and use that. +# enabled in the original config and use that. sub parse_config_selects { my ($config, $p) = @_; @@ -593,6 +593,23 @@ while ($repeat) { } my %setconfigs; +my @preserved_kconfigs; +if (defined($ENV{'LMC_KEEP'})) { + @preserved_kconfigs = split(/:/,$ENV{LMC_KEEP}); +} + +sub in_preserved_kconfigs { + my $kconfig = $config2kfile{$_[0]}; + if (!defined($kconfig)) { + return 0; + } + foreach my $excl (@preserved_kconfigs) { + if($kconfig =~ /^$excl/) { + return 1; + } + } + return 0; +} # Finally, read the .config file and turn off any module enabled that # we could not find a reason to keep enabled. @@ -612,47 +629,52 @@ foreach my $line (@config_file) { } if (/CONFIG_MODULE_SIG_KEY="(.+)"/) { - my $orig_cert = $1; - my $default_cert = "certs/signing_key.pem"; - - # Check that the logic in this script still matches the one in Kconfig - if (!defined($depends{"MODULE_SIG_KEY"}) || - $depends{"MODULE_SIG_KEY"} !~ /"\Q$default_cert\E"/) { - print STDERR "WARNING: MODULE_SIG_KEY assertion failure, ", - "update needed to ", __FILE__, " line ", __LINE__, "\n"; - print; - } elsif ($orig_cert ne $default_cert && ! -f $orig_cert) { - print STDERR "Module signature verification enabled but ", - "module signing key \"$orig_cert\" not found. Resetting ", - "signing key to default value.\n"; - print "CONFIG_MODULE_SIG_KEY=\"$default_cert\"\n"; - } else { - print; - } - next; + my $orig_cert = $1; + my $default_cert = "certs/signing_key.pem"; + + # Check that the logic in this script still matches the one in Kconfig + if (!defined($depends{"MODULE_SIG_KEY"}) || + $depends{"MODULE_SIG_KEY"} !~ /"\Q$default_cert\E"/) { + print STDERR "WARNING: MODULE_SIG_KEY assertion failure, ", + "update needed to ", __FILE__, " line ", __LINE__, "\n"; + print; + } elsif ($orig_cert ne $default_cert && ! -f $orig_cert) { + print STDERR "Module signature verification enabled but ", + "module signing key \"$orig_cert\" not found. Resetting ", + "signing key to default value.\n"; + print "CONFIG_MODULE_SIG_KEY=\"$default_cert\"\n"; + } else { + print; + } + next; } if (/CONFIG_SYSTEM_TRUSTED_KEYS="(.+)"/) { - my $orig_keys = $1; - - if (! -f $orig_keys) { - print STDERR "System keyring enabled but keys \"$orig_keys\" ", - "not found. Resetting keys to default value.\n"; - print "CONFIG_SYSTEM_TRUSTED_KEYS=\"\"\n"; - } else { - print; - } - next; + my $orig_keys = $1; + + if (! -f $orig_keys) { + print STDERR "System keyring enabled but keys \"$orig_keys\" ", + "not found. Resetting keys to default value.\n"; + print "CONFIG_SYSTEM_TRUSTED_KEYS=\"\"\n"; + } else { + print; + } + next; } if (/^(CONFIG.*)=(m|y)/) { + if (in_preserved_kconfigs($1)) { + dprint "Preserve config $1"; + print; + next; + } if (defined($configs{$1})) { if ($localyesconfig) { - $setconfigs{$1} = 'y'; + $setconfigs{$1} = 'y'; print "$1=y\n"; next; } else { - $setconfigs{$1} = $2; + $setconfigs{$1} = $2; } } elsif ($2 eq "m") { print "# $1 is not set\n"; @@ -680,3 +702,5 @@ foreach my $module (keys(%modules)) { print STDERR "\n"; } } + +# vim: softtabstop=4 diff --git a/support/kconfig/symbol.c b/support/kconfig/symbol.c index f0b2e3b310..81fe1884ef 100644 --- a/support/kconfig/symbol.c +++ b/support/kconfig/symbol.c @@ -1,64 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2002 Roman Zippel - * Released under the terms of the GNU GPL v2.0. */ +#include #include #include #include #include -#include +#include "internal.h" #include "lkc.h" struct symbol symbol_yes = { .name = "y", .curr = { "y", yes }, + .menus = LIST_HEAD_INIT(symbol_yes.menus), .flags = SYMBOL_CONST|SYMBOL_VALID, -}, symbol_mod = { +}; + +struct symbol symbol_mod = { .name = "m", .curr = { "m", mod }, + .menus = LIST_HEAD_INIT(symbol_mod.menus), .flags = SYMBOL_CONST|SYMBOL_VALID, -}, symbol_no = { +}; + +struct symbol symbol_no = { .name = "n", .curr = { "n", no }, + .menus = LIST_HEAD_INIT(symbol_no.menus), .flags = SYMBOL_CONST|SYMBOL_VALID, -}, symbol_empty = { - .name = "", - .curr = { "", no }, - .flags = SYMBOL_VALID, }; -struct symbol *sym_defconfig_list; struct symbol *modules_sym; -tristate modules_val; - -struct expr *sym_env_list; - -static void sym_add_default(struct symbol *sym, const char *def) -{ - struct property *prop = prop_alloc(P_DEFAULT, sym); - - prop->expr = expr_alloc_symbol(sym_lookup(def, SYMBOL_CONST)); -} - -void sym_init(void) -{ - struct symbol *sym; - struct utsname uts; - static bool inited = false; - - if (inited) - return; - inited = true; - - uname(&uts); - - sym = sym_lookup("UNAME_RELEASE", 0); - sym->type = S_STRING; - sym->flags |= SYMBOL_AUTO; - sym_add_default(sym, uts.release); -} +static tristate modules_val; +static int sym_warnings; enum symbol_type sym_get_type(struct symbol *sym) { @@ -88,8 +65,6 @@ const char *sym_type_name(enum symbol_type type) return "string"; case S_UNKNOWN: return "unknown"; - case S_OTHER: - break; } return "???"; } @@ -103,15 +78,6 @@ struct property *sym_get_choice_prop(struct symbol *sym) return NULL; } -struct property *sym_get_env_prop(struct symbol *sym) -{ - struct property *prop; - - for_all_properties(sym, prop, P_ENV) - return prop; - return NULL; -} - static struct property *sym_get_default_prop(struct symbol *sym) { struct property *prop; @@ -124,7 +90,7 @@ static struct property *sym_get_default_prop(struct symbol *sym) return NULL; } -static struct property *sym_get_range_prop(struct symbol *sym) +struct property *sym_get_range_prop(struct symbol *sym) { struct property *prop; @@ -155,9 +121,9 @@ static long long sym_get_range_val(struct symbol *sym, int base) static void sym_validate_range(struct symbol *sym) { struct property *prop; + struct symbol *range_sym; int base; long long val, val2; - char str[64]; switch (sym->type) { case S_INT: @@ -173,17 +139,15 @@ static void sym_validate_range(struct symbol *sym) if (!prop) return; val = strtoll(sym->curr.val, NULL, base); - val2 = sym_get_range_val(prop->expr->left.sym, base); + range_sym = prop->expr->left.sym; + val2 = sym_get_range_val(range_sym, base); if (val >= val2) { - val2 = sym_get_range_val(prop->expr->right.sym, base); + range_sym = prop->expr->right.sym; + val2 = sym_get_range_val(range_sym, base); if (val <= val2) return; } - if (sym->type == S_INT) - sprintf(str, "%lld", val2); - else - sprintf(str, "0x%llx", val2); - sym->curr.val = xstrdup(str); + sym->curr.val = range_sym->curr.val; } static void sym_set_changed(struct symbol *sym) @@ -200,9 +164,8 @@ static void sym_set_changed(struct symbol *sym) static void sym_set_all_changed(void) { struct symbol *sym; - int i; - for_all_symbols(i, sym) + for_all_symbols(sym) sym_set_changed(sym); } @@ -259,7 +222,7 @@ static void sym_calc_visibility(struct symbol *sym) sym_set_changed(sym); } tri = no; - if (sym->implied.expr && sym->dir_dep.tri != no) + if (sym->implied.expr) tri = expr_calc_value(sym->implied.expr); if (tri == mod && sym_get_type(sym) == S_BOOLEAN) tri = yes; @@ -352,6 +315,14 @@ static void sym_warn_unmet_dep(struct symbol *sym) " Selected by [m]:\n"); fputs(str_get(&gs), stderr); + sym_warnings++; +} + +bool sym_dep_errors(void) +{ + if (sym_warnings) + return getenv("KCONFIG_WERROR"); + return false; } void sym_calc_value(struct symbol *sym) @@ -377,15 +348,21 @@ void sym_calc_value(struct symbol *sym) oldval = sym->curr; + newval.tri = no; + switch (sym->type) { case S_INT: + newval.val = "0"; + break; case S_HEX: + newval.val = "0x0"; + break; case S_STRING: - newval = symbol_empty.curr; + newval.val = ""; break; case S_BOOLEAN: case S_TRISTATE: - newval = symbol_no.curr; + newval.val = "n"; break; default: sym->curr.val = sym->name; @@ -432,6 +409,8 @@ void sym_calc_value(struct symbol *sym) if (sym->implied.tri != no) { sym->flags |= SYMBOL_WRITE; newval.tri = EXPR_OR(newval.tri, sym->implied.tri); + newval.tri = EXPR_AND(newval.tri, + sym->dir_dep.tri); } } calc_newval: @@ -439,8 +418,7 @@ void sym_calc_value(struct symbol *sym) sym_warn_unmet_dep(sym); newval.tri = EXPR_OR(newval.tri, sym->rev_dep.tri); } - if (newval.tri == mod && - (sym_get_type(sym) == S_BOOLEAN || sym->implied.tri == yes)) + if (newval.tri == mod && sym_get_type(sym) == S_BOOLEAN) newval.tri = yes; break; case S_STRING: @@ -490,7 +468,7 @@ void sym_calc_value(struct symbol *sym) } } - if (sym->flags & SYMBOL_AUTO) + if (sym->flags & SYMBOL_NO_WRITE) sym->flags &= ~SYMBOL_WRITE; if (sym->flags & SYMBOL_NEED_SET_CHOICE_VALUES) @@ -500,11 +478,10 @@ void sym_calc_value(struct symbol *sym) void sym_clear_all_valid(void) { struct symbol *sym; - int i; - for_all_symbols(i, sym) + for_all_symbols(sym) sym->flags &= ~SYMBOL_VALID; - sym_add_change_count(1); + conf_set_changed(true); sym_calc_value(modules_sym); } @@ -522,8 +499,6 @@ bool sym_tristate_within_range(struct symbol *sym, tristate val) return false; if (sym->visible <= sym->rev_dep.tri) return false; - if (sym->implied.tri == yes && val == mod) - return false; if (sym_is_choice_value(sym) && sym->visible == yes) return val == yes; return val >= sym->rev_dep.tri && val <= sym->visible; @@ -733,13 +708,12 @@ const char *sym_get_string_default(struct symbol *sym) { struct property *prop; struct symbol *ds; - const char *str; + const char *str = ""; tristate val; sym_calc_visibility(sym); sym_calc_value(modules_sym); val = symbol_no.curr.tri; - str = symbol_empty.curr.val; /* If symbol has a default value look it up */ prop = sym_get_default_prop(sym); @@ -789,15 +763,17 @@ const char *sym_get_string_default(struct symbol *sym) case yes: return "y"; } case S_INT: + if (!str[0]) + str = "0"; + break; case S_HEX: - return str; - case S_STRING: - return str; - case S_OTHER: - case S_UNKNOWN: + if (!str[0]) + str = "0x0"; + break; + default: break; } - return ""; + return str; } const char *sym_get_string_value(struct symbol *sym) @@ -824,19 +800,12 @@ const char *sym_get_string_value(struct symbol *sym) return (const char *)sym->curr.val; } -bool sym_is_changable(struct symbol *sym) +bool sym_is_changeable(struct symbol *sym) { return sym->visible > sym->rev_dep.tri; } -static unsigned strhash(const char *s) -{ - /* fnv32 hash */ - unsigned hash = 2166136261U; - for (; *s; s++) - hash = (hash ^ *s) * 0x01000193; - return hash; -} +HASHTABLE_DEFINE(sym_hashtable, SYMBOL_HASHSIZE); struct symbol *sym_lookup(const char *name, int flags) { @@ -852,9 +821,9 @@ struct symbol *sym_lookup(const char *name, int flags) case 'n': return &symbol_no; } } - hash = strhash(name) % SYMBOL_HASHSIZE; + hash = strhash(name); - for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) { + hash_for_each_possible(sym_hashtable, symbol, node, hash) { if (symbol->name && !strcmp(symbol->name, name) && (flags ? symbol->flags & flags @@ -871,10 +840,10 @@ struct symbol *sym_lookup(const char *name, int flags) memset(symbol, 0, sizeof(*symbol)); symbol->name = new_name; symbol->type = S_UNKNOWN; - symbol->flags |= flags; + symbol->flags = flags; + INIT_LIST_HEAD(&symbol->menus); - symbol->next = symbol_hash[hash]; - symbol_hash[hash] = symbol; + hash_add(sym_hashtable, &symbol->node, hash); return symbol; } @@ -894,9 +863,9 @@ struct symbol *sym_find(const char *name) case 'n': return &symbol_no; } } - hash = strhash(name) % SYMBOL_HASHSIZE; + hash = strhash(name); - for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) { + hash_for_each_possible(sym_hashtable, symbol, node, hash) { if (symbol->name && !strcmp(symbol->name, name) && !(symbol->flags & SYMBOL_CONST)) @@ -906,102 +875,6 @@ struct symbol *sym_find(const char *name) return symbol; } -/* - * Expand symbol's names embedded in the string given in argument. Symbols' - * name to be expanded shall be prefixed by a '$'. Unknown symbol expands to - * the empty string. - */ -char *sym_expand_string_value(const char *in) -{ - const char *src; - char *res; - size_t reslen; - - /* - * Note: 'in' might come from a token that's about to be - * freed, so make sure to always allocate a new string - */ - reslen = strlen(in) + 1; - res = xmalloc(reslen); - res[0] = '\0'; - - while ((src = strchr(in, '$'))) { - char *p, name[SYMBOL_MAXLENGTH]; - const char *symval = ""; - struct symbol *sym; - size_t newlen; - - strncat(res, in, src - in); - src++; - - p = name; - while (isalnum(*src) || *src == '_') - *p++ = *src++; - *p = '\0'; - - sym = sym_find(name); - if (sym != NULL) { - sym_calc_value(sym); - symval = sym_get_string_value(sym); - } - - newlen = strlen(res) + strlen(symval) + strlen(src) + 1; - if (newlen > reslen) { - reslen = newlen; - res = xrealloc(res, reslen); - } - - strcat(res, symval); - in = src; - } - strcat(res, in); - - return res; -} - -const char *sym_escape_string_value(const char *in) -{ - const char *p; - size_t reslen; - char *res; - size_t l; - - reslen = strlen(in) + strlen("\"\"") + 1; - - p = in; - for (;;) { - l = strcspn(p, "\"\\"); - p += l; - - if (p[0] == '\0') - break; - - reslen++; - p++; - } - - res = xmalloc(reslen); - res[0] = '\0'; - - strcat(res, "\""); - - p = in; - for (;;) { - l = strcspn(p, "\"\\"); - strncat(res, p, l); - p += l; - - if (p[0] == '\0') - break; - - strcat(res, "\\"); - strncat(res, p++, 1); - } - - strcat(res, "\""); - return res; -} - struct sym_match { struct symbol *sym; off_t so, eo; @@ -1052,7 +925,7 @@ struct symbol **sym_re_search(const char *pattern) if (regcomp(&re, pattern, REG_EXTENDED|REG_ICASE)) return NULL; - for_all_symbols(i, sym) { + for_all_symbols(sym) { if (sym->flags & SYMBOL_CONST || !sym->name) continue; if (regexec(&re, sym->name, 1, match, 0)) @@ -1100,7 +973,7 @@ static struct dep_stack { struct dep_stack *prev, *next; struct symbol *sym; struct property *prop; - struct expr *expr; + struct expr **expr; } *check_top; static void dep_stack_insert(struct dep_stack *stack, struct symbol *sym) @@ -1163,39 +1036,50 @@ static void sym_check_print_recursive(struct symbol *last_sym) } if (stack->sym == last_sym) fprintf(stderr, "%s:%d:error: recursive dependency detected!\n", - prop->file->name, prop->lineno); + prop->filename, prop->lineno); - if (stack->expr) { - fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n", - prop->file->name, prop->lineno, + if (sym_is_choice(sym)) { + fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n", + menu->filename, menu->lineno, + sym->name ? sym->name : "", + next_sym->name ? next_sym->name : ""); + } else if (sym_is_choice_value(sym)) { + fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n", + menu->filename, menu->lineno, sym->name ? sym->name : "", - prop_get_type_name(prop->type), next_sym->name ? next_sym->name : ""); - } else if (stack->prop) { + } else if (stack->expr == &sym->dir_dep.expr) { fprintf(stderr, "%s:%d:\tsymbol %s depends on %s\n", - prop->file->name, prop->lineno, + prop->filename, prop->lineno, sym->name ? sym->name : "", next_sym->name ? next_sym->name : ""); - } else if (sym_is_choice(sym)) { - fprintf(stderr, "%s:%d:\tchoice %s contains symbol %s\n", - menu->file->name, menu->lineno, + } else if (stack->expr == &sym->rev_dep.expr) { + fprintf(stderr, "%s:%d:\tsymbol %s is selected by %s\n", + prop->filename, prop->lineno, sym->name ? sym->name : "", next_sym->name ? next_sym->name : ""); - } else if (sym_is_choice_value(sym)) { - fprintf(stderr, "%s:%d:\tsymbol %s is part of choice %s\n", - menu->file->name, menu->lineno, + } else if (stack->expr == &sym->implied.expr) { + fprintf(stderr, "%s:%d:\tsymbol %s is implied by %s\n", + prop->filename, prop->lineno, + sym->name ? sym->name : "", + next_sym->name ? next_sym->name : ""); + } else if (stack->expr) { + fprintf(stderr, "%s:%d:\tsymbol %s %s value contains %s\n", + prop->filename, prop->lineno, sym->name ? sym->name : "", + prop_get_type_name(prop->type), next_sym->name ? next_sym->name : ""); } else { - fprintf(stderr, "%s:%d:\tsymbol %s is selected by %s\n", - prop->file->name, prop->lineno, + fprintf(stderr, "%s:%d:\tsymbol %s %s is visible depending on %s\n", + prop->filename, prop->lineno, sym->name ? sym->name : "", + prop_get_type_name(prop->type), next_sym->name ? next_sym->name : ""); } } fprintf(stderr, - "For a resolution refer to Documentation/kbuild/kconfig-language.txt\n" + "For a resolution refer to Documentation/kbuild/kconfig-language.rst\n" "subsection \"Kconfig recursive dependency limitations\"\n" "\n"); @@ -1246,12 +1130,26 @@ static struct symbol *sym_check_sym_deps(struct symbol *sym) dep_stack_insert(&stack, sym); + stack.expr = &sym->dir_dep.expr; + sym2 = sym_check_expr_deps(sym->dir_dep.expr); + if (sym2) + goto out; + + stack.expr = &sym->rev_dep.expr; sym2 = sym_check_expr_deps(sym->rev_dep.expr); if (sym2) goto out; + stack.expr = &sym->implied.expr; + sym2 = sym_check_expr_deps(sym->implied.expr); + if (sym2) + goto out; + + stack.expr = NULL; + for (prop = sym->prop; prop; prop = prop->next) { - if (prop->type == P_CHOICE || prop->type == P_SELECT) + if (prop->type == P_CHOICE || prop->type == P_SELECT || + prop->type == P_IMPLY) continue; stack.prop = prop; sym2 = sym_check_expr_deps(prop->visible.expr); @@ -1259,7 +1157,7 @@ static struct symbol *sym_check_sym_deps(struct symbol *sym) break; if (prop->type != P_DEFAULT || sym_is_choice(sym)) continue; - stack.expr = prop->expr; + stack.expr = &prop->expr; sym2 = sym_check_expr_deps(prop->expr); if (sym2) break; @@ -1337,34 +1235,9 @@ struct symbol *sym_check_deps(struct symbol *sym) sym->flags &= ~SYMBOL_CHECK; } - if (sym2 && sym2 == sym) - sym2 = NULL; - return sym2; } -struct property *prop_alloc(enum prop_type type, struct symbol *sym) -{ - struct property *prop; - struct property **propp; - - prop = xmalloc(sizeof(*prop)); - memset(prop, 0, sizeof(*prop)); - prop->type = type; - prop->sym = sym; - prop->file = current_file; - prop->lineno = zconf_lineno(); - - /* append property to the prop list of symbol */ - if (sym) { - for (propp = &sym->prop; *propp; propp = &(*propp)->next) - ; - *propp = prop; - } - - return prop; -} - struct symbol *prop_get_symbol(struct property *prop) { if (prop->expr && (prop->expr->type == E_SYMBOL || @@ -1378,8 +1251,6 @@ const char *prop_get_type_name(enum prop_type type) switch (type) { case P_PROMPT: return "prompt"; - case P_ENV: - return "env"; case P_COMMENT: return "comment"; case P_MENU: @@ -1401,32 +1272,3 @@ const char *prop_get_type_name(enum prop_type type) } return "unknown"; } - -static void prop_add_env(const char *env) -{ - struct symbol *sym, *sym2; - struct property *prop; - char *p; - - sym = current_entry->sym; - sym->flags |= SYMBOL_AUTO; - for_all_properties(sym, prop, P_ENV) { - sym2 = prop_get_symbol(prop); - if (strcmp(sym2->name, env)) - menu_warn(current_entry, "redefining environment symbol from %s", - sym2->name); - return; - } - - prop = prop_alloc(P_ENV, sym); - prop->expr = expr_alloc_symbol(sym_lookup(env, SYMBOL_CONST)); - - sym_env_list = expr_alloc_one(E_LIST, sym_env_list); - sym_env_list->right.sym = sym; - - p = getenv(env); - if (p) - sym_add_default(sym, p); - else - menu_warn(current_entry, "environment variable %s undefined", env); -} diff --git a/support/kconfig/util.c b/support/kconfig/util.c index 8665f5bb89..439c131b42 100644 --- a/support/kconfig/util.c +++ b/support/kconfig/util.c @@ -1,93 +1,57 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Copyright (C) 2002-2005 Roman Zippel * Copyright (C) 2002-2005 Sam Ravnborg - * - * Released under the terms of the GNU GPL v2.0. */ #include #include #include + +#include "hashtable.h" #include "lkc.h" +unsigned int strhash(const char *s) +{ + /* fnv32 hash */ + unsigned int hash = 2166136261U; + + for (; *s; s++) + hash = (hash ^ *s) * 0x01000193; + return hash; +} + +/* hash table of all parsed Kconfig files */ +static HASHTABLE_DEFINE(file_hashtable, 1U << 11); + +struct file { + struct hlist_node node; + char name[]; +}; + /* file already present in list? If not add it */ -struct file *file_lookup(const char *name) +const char *file_lookup(const char *name) { struct file *file; - char *file_name = sym_expand_string_value(name); + size_t len; + int hash = strhash(name); - for (file = file_list; file; file = file->next) { - if (!strcmp(name, file->name)) { - free(file_name); - return file; - } - } + hash_for_each_possible(file_hashtable, file, node, hash) + if (!strcmp(name, file->name)) + return file->name; - file = xmalloc(sizeof(*file)); + len = strlen(name); + file = xmalloc(sizeof(*file) + len + 1); memset(file, 0, sizeof(*file)); - file->name = file_name; - file->next = file_list; - file_list = file; - return file; -} + memcpy(file->name, name, len); + file->name[len] = '\0'; -/* write a dependency file as used by kbuild to track dependencies */ -int file_write_dep(const char *name) -{ - char *str; - char buf[PATH_MAX+20], buf2[PATH_MAX+1], dir[PATH_MAX+1]; - struct symbol *sym, *env_sym; - struct expr *e; - struct file *file; - FILE *out; - - if (!name) - name = ".kconfig.d"; - - strcpy(dir, conf_get_configname()); - str = strrchr(dir, '/'); - if (str) - str[1] = 0; - else - dir[0] = 0; - - sprintf(buf, "%s..config.tmp", dir); - out = fopen(buf, "w"); - if (!out) - return 1; - fprintf(out, "deps_config := \\\n"); - for (file = file_list; file; file = file->next) { - if (file->next) - fprintf(out, "\t%s \\\n", file->name); - else - fprintf(out, "\t%s\n", file->name); - } - fprintf(out, "\n%s: \\\n" - "\t$(deps_config)\n\n", conf_get_autoconfig_name()); - - expr_list_for_each_sym(sym_env_list, e, sym) { - struct property *prop; - const char *value; - - prop = sym_get_env_prop(sym); - env_sym = prop_get_symbol(prop); - if (!env_sym) - continue; - value = getenv(env_sym->name); - if (!value) - value = ""; - fprintf(out, "ifneq \"$(%s)\" \"%s\"\n", env_sym->name, value); - fprintf(out, "%s: FORCE\n", conf_get_autoconfig_name()); - fprintf(out, "endif\n"); - } + hash_add(file_hashtable, &file->node, hash); - fprintf(out, "\n$(deps_config): ;\n"); - fclose(out); - sprintf(buf2, "%s%s", dir, name); - rename(buf, buf2); - return 0; -} + str_printf(&autoconf_cmd, "\t%s \\\n", name); + return file->name; +} /* Allocate initial growable string */ struct gstr str_new(void) @@ -103,8 +67,7 @@ struct gstr str_new(void) /* Free storage for growable string */ void str_free(struct gstr *gs) { - if (gs->s) - free(gs->s); + free(gs->s); gs->s = NULL; gs->len = 0; } @@ -135,7 +98,7 @@ void str_printf(struct gstr *gs, const char *fmt, ...) } /* Retrieve value of growable string */ -const char *str_get(struct gstr *gs) +char *str_get(struct gstr *gs) { return gs->s; } @@ -177,3 +140,14 @@ char *xstrdup(const char *s) fprintf(stderr, "Out of memory.\n"); exit(1); } + +char *xstrndup(const char *s, size_t n) +{ + char *p; + + p = strndup(s, n); + if (p) + return p; + fprintf(stderr, "Out of memory.\n"); + exit(1); +} diff --git a/support/kconfig/zconf.l b/support/kconfig/zconf.l deleted file mode 100644 index 045093d827..0000000000 --- a/support/kconfig/zconf.l +++ /dev/null @@ -1,372 +0,0 @@ -%option nostdinit noyywrap never-interactive full ecs -%option 8bit nodefault yylineno -%option noinput -%x COMMAND HELP STRING PARAM -%{ -/* - * Copyright (C) 2002 Roman Zippel - * Released under the terms of the GNU GPL v2.0. - */ - -#include -#include -#include -#include -#include - -#include "lkc.h" - -#define START_STRSIZE 16 - -static struct { - struct file *file; - int lineno; -} current_pos; - -static char *text; -static int text_size, text_asize; - -struct buffer { - struct buffer *parent; - YY_BUFFER_STATE state; -}; - -struct buffer *current_buf; - -static int last_ts, first_ts; - -static void zconf_endhelp(void); -static void zconf_endfile(void); - -static void new_string(void) -{ - text = xmalloc(START_STRSIZE); - text_asize = START_STRSIZE; - text_size = 0; - *text = 0; -} - -static void append_string(const char *str, int size) -{ - int new_size = text_size + size + 1; - if (new_size > text_asize) { - new_size += START_STRSIZE - 1; - new_size &= -START_STRSIZE; - text = xrealloc(text, new_size); - text_asize = new_size; - } - memcpy(text + text_size, str, size); - text_size += size; - text[text_size] = 0; -} - -static void alloc_string(const char *str, int size) -{ - text = xmalloc(size + 1); - memcpy(text, str, size); - text[size] = 0; -} - -static void warn_ignored_character(char chr) -{ - fprintf(stderr, - "%s:%d:warning: ignoring unsupported character '%c'\n", - zconf_curname(), zconf_lineno(), chr); -} -%} - -n [A-Za-z0-9_-] - -%% - int str = 0; - int ts, i; - -[ \t]*#.*\n | -[ \t]*\n { - return T_EOL; -} -[ \t]*#.* - - -[ \t]+ { - BEGIN(COMMAND); -} - -. { - unput(yytext[0]); - BEGIN(COMMAND); -} - - -{ - {n}+ { - const struct kconf_id *id = kconf_id_lookup(yytext, yyleng); - BEGIN(PARAM); - current_pos.file = current_file; - current_pos.lineno = yylineno; - if (id && id->flags & TF_COMMAND) { - yylval.id = id; - return id->token; - } - alloc_string(yytext, yyleng); - yylval.string = text; - return T_WORD; - } - . warn_ignored_character(*yytext); - \n { - BEGIN(INITIAL); - return T_EOL; - } -} - -{ - "&&" return T_AND; - "||" return T_OR; - "(" return T_OPEN_PAREN; - ")" return T_CLOSE_PAREN; - "!" return T_NOT; - "=" return T_EQUAL; - "!=" return T_UNEQUAL; - "<=" return T_LESS_EQUAL; - ">=" return T_GREATER_EQUAL; - "<" return T_LESS; - ">" return T_GREATER; - \"|\' { - str = yytext[0]; - new_string(); - BEGIN(STRING); - } - \n BEGIN(INITIAL); return T_EOL; - ({n}|[/.])+ { - const struct kconf_id *id = kconf_id_lookup(yytext, yyleng); - if (id && id->flags & TF_PARAM) { - yylval.id = id; - return id->token; - } - alloc_string(yytext, yyleng); - yylval.string = text; - return T_WORD; - } - #.* /* comment */ - \\\n ; - [[:blank:]]+ - . warn_ignored_character(*yytext); - <> { - BEGIN(INITIAL); - } -} - -{ - [^'"\\\n]+/\n { - append_string(yytext, yyleng); - yylval.string = text; - return T_WORD_QUOTE; - } - [^'"\\\n]+ { - append_string(yytext, yyleng); - } - \\.?/\n { - append_string(yytext + 1, yyleng - 1); - yylval.string = text; - return T_WORD_QUOTE; - } - \\.? { - append_string(yytext + 1, yyleng - 1); - } - \'|\" { - if (str == yytext[0]) { - BEGIN(PARAM); - yylval.string = text; - return T_WORD_QUOTE; - } else - append_string(yytext, 1); - } - \n { - fprintf(stderr, - "%s:%d:warning: multi-line strings not supported\n", - zconf_curname(), zconf_lineno()); - BEGIN(INITIAL); - return T_EOL; - } - <> { - BEGIN(INITIAL); - } -} - -{ - [ \t]+ { - ts = 0; - for (i = 0; i < yyleng; i++) { - if (yytext[i] == '\t') - ts = (ts & ~7) + 8; - else - ts++; - } - last_ts = ts; - if (first_ts) { - if (ts < first_ts) { - zconf_endhelp(); - return T_HELPTEXT; - } - ts -= first_ts; - while (ts > 8) { - append_string(" ", 8); - ts -= 8; - } - append_string(" ", ts); - } - } - [ \t]*\n/[^ \t\n] { - zconf_endhelp(); - return T_HELPTEXT; - } - [ \t]*\n { - append_string("\n", 1); - } - [^ \t\n].* { - while (yyleng) { - if ((yytext[yyleng-1] != ' ') && (yytext[yyleng-1] != '\t')) - break; - yyleng--; - } - append_string(yytext, yyleng); - if (!first_ts) - first_ts = last_ts; - } - <> { - zconf_endhelp(); - return T_HELPTEXT; - } -} - -<> { - if (current_file) { - zconf_endfile(); - return T_EOL; - } - fclose(yyin); - yyterminate(); -} - -%% -void zconf_starthelp(void) -{ - new_string(); - last_ts = first_ts = 0; - BEGIN(HELP); -} - -static void zconf_endhelp(void) -{ - yylval.string = text; - BEGIN(INITIAL); -} - - -/* - * Try to open specified file with following names: - * ./name - * $(srctree)/name - * The latter is used when srctree is separate from objtree - * when compiling the kernel. - * Return NULL if file is not found. - */ -FILE *zconf_fopen(const char *name) -{ - char *env, fullname[PATH_MAX+1]; - FILE *f; - - f = fopen(name, "r"); - if (!f && name != NULL && name[0] != '/') { - env = getenv(SRCTREE); - if (env) { - sprintf(fullname, "%s/%s", env, name); - f = fopen(fullname, "r"); - } - } - return f; -} - -void zconf_initscan(const char *name) -{ - yyin = zconf_fopen(name); - if (!yyin) { - fprintf(stderr, "can't find file %s\n", name); - exit(1); - } - - current_buf = xmalloc(sizeof(*current_buf)); - memset(current_buf, 0, sizeof(*current_buf)); - - current_file = file_lookup(name); - yylineno = 1; -} - -void zconf_nextfile(const char *name) -{ - struct file *iter; - struct file *file = file_lookup(name); - struct buffer *buf = xmalloc(sizeof(*buf)); - memset(buf, 0, sizeof(*buf)); - - current_buf->state = YY_CURRENT_BUFFER; - yyin = zconf_fopen(file->name); - if (!yyin) { - fprintf(stderr, "%s:%d: can't open file \"%s\"\n", - zconf_curname(), zconf_lineno(), file->name); - exit(1); - } - yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); - buf->parent = current_buf; - current_buf = buf; - - current_file->lineno = yylineno; - file->parent = current_file; - - for (iter = current_file; iter; iter = iter->parent) { - if (!strcmp(iter->name, file->name)) { - fprintf(stderr, - "Recursive inclusion detected.\n" - "Inclusion path:\n" - " current file : %s\n", file->name); - iter = file; - do { - iter = iter->parent; - fprintf(stderr, " included from: %s:%d\n", - iter->name, iter->lineno - 1); - } while (strcmp(iter->name, file->name)); - exit(1); - } - } - - yylineno = 1; - current_file = file; -} - -static void zconf_endfile(void) -{ - struct buffer *parent; - - current_file = current_file->parent; - if (current_file) - yylineno = current_file->lineno; - - parent = current_buf->parent; - if (parent) { - fclose(yyin); - yy_delete_buffer(YY_CURRENT_BUFFER); - yy_switch_to_buffer(parent->state); - } - free(current_buf); - current_buf = parent; -} - -int zconf_lineno(void) -{ - return current_pos.lineno; -} - -const char *zconf_curname(void) -{ - return current_pos.file ? current_pos.file->name : ""; -} diff --git a/support/kconfig/zconf.lex.c_shipped b/support/kconfig/zconf.lex.c_shipped deleted file mode 100644 index 33913d43c7..0000000000 --- a/support/kconfig/zconf.lex.c_shipped +++ /dev/null @@ -1,2500 +0,0 @@ - -#define YY_INT_ALIGNED short int - -/* A lexical scanner generated by flex */ - -#define FLEX_SCANNER -#define YY_FLEX_MAJOR_VERSION 2 -#define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 4 -#if YY_FLEX_SUBMINOR_VERSION > 0 -#define FLEX_BETA -#endif - -/* First, we deal with platform-specific or compiler-specific issues. */ - -/* begin standard C headers. */ -#include -#include -#include -#include - -/* end standard C headers. */ - -/* flex integer type definitions */ - -#ifndef FLEXINT_H -#define FLEXINT_H - -/* C99 systems have . Non-C99 systems may or may not. */ - -#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L - -/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - -#include -typedef int8_t flex_int8_t; -typedef uint8_t flex_uint8_t; -typedef int16_t flex_int16_t; -typedef uint16_t flex_uint16_t; -typedef int32_t flex_int32_t; -typedef uint32_t flex_uint32_t; -#else -typedef signed char flex_int8_t; -typedef short int flex_int16_t; -typedef int flex_int32_t; -typedef unsigned char flex_uint8_t; -typedef unsigned short int flex_uint16_t; -typedef unsigned int flex_uint32_t; - -/* Limits of integral types. */ -#ifndef INT8_MIN -#define INT8_MIN (-128) -#endif -#ifndef INT16_MIN -#define INT16_MIN (-32767-1) -#endif -#ifndef INT32_MIN -#define INT32_MIN (-2147483647-1) -#endif -#ifndef INT8_MAX -#define INT8_MAX (127) -#endif -#ifndef INT16_MAX -#define INT16_MAX (32767) -#endif -#ifndef INT32_MAX -#define INT32_MAX (2147483647) -#endif -#ifndef UINT8_MAX -#define UINT8_MAX (255U) -#endif -#ifndef UINT16_MAX -#define UINT16_MAX (65535U) -#endif -#ifndef UINT32_MAX -#define UINT32_MAX (4294967295U) -#endif - -#ifndef SIZE_MAX -#define SIZE_MAX (~(size_t)0) -#endif - -#endif /* ! C99 */ - -#endif /* ! FLEXINT_H */ - -/* begin standard C++ headers. */ - -/* TODO: this is always defined, so inline it */ -#define yyconst const - -#if defined(__GNUC__) && __GNUC__ >= 3 -#define yynoreturn __attribute__((__noreturn__)) -#else -#define yynoreturn -#endif - -/* Returned upon end-of-file. */ -#define YY_NULL 0 - -/* Promotes a possibly negative, possibly signed char to an - * integer in range [0..255] for use as an array index. - */ -#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) - -/* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ -#define BEGIN (yy_start) = 1 + 2 * -/* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ -#define YY_START (((yy_start) - 1) / 2) -#define YYSTATE YY_START -/* Action number for EOF rule of a given start state. */ -#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) -/* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) -#define YY_END_OF_BUFFER_CHAR 0 - -/* Size of default input buffer. */ -#ifndef YY_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ -#define YY_BUF_SIZE 32768 -#else -#define YY_BUF_SIZE 16384 -#endif /* __ia64__ */ -#endif - -/* The state buf must be large enough to hold one state per character in the main buffer. - */ -#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) - -#ifndef YY_TYPEDEF_YY_BUFFER_STATE -#define YY_TYPEDEF_YY_BUFFER_STATE -typedef struct yy_buffer_state *YY_BUFFER_STATE; -#endif - -#ifndef YY_TYPEDEF_YY_SIZE_T -#define YY_TYPEDEF_YY_SIZE_T -typedef size_t yy_size_t; -#endif - -extern int yyleng; - -extern FILE *yyin, *yyout; - -#define EOB_ACT_CONTINUE_SCAN 0 -#define EOB_ACT_END_OF_FILE 1 -#define EOB_ACT_LAST_MATCH 2 - - /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires - * access to the local variable yy_act. Since yyless() is a macro, it would break - * existing scanners that call yyless() from OUTSIDE yylex. - * One obvious solution it to make yy_act a global. I tried that, and saw - * a 5% performance hit in a non-yylineno scanner, because yy_act is - * normally declared as a register variable-- so it is not worth it. - */ - #define YY_LESS_LINENO(n) \ - do { \ - int yyl;\ - for ( yyl = n; yyl < yyleng; ++yyl )\ - if ( yytext[yyl] == '\n' )\ - --yylineno;\ - }while(0) - #define YY_LINENO_REWIND_TO(dst) \ - do {\ - const char *p;\ - for ( p = yy_cp-1; p >= (dst); --p)\ - if ( *p == '\n' )\ - --yylineno;\ - }while(0) - -/* Return all but the first "n" matched characters back to the input stream. */ -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - *yy_cp = (yy_hold_char); \ - YY_RESTORE_YY_MORE_OFFSET \ - (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ - } \ - while ( 0 ) -#define unput(c) yyunput( c, (yytext_ptr) ) - -#ifndef YY_STRUCT_YY_BUFFER_STATE -#define YY_STRUCT_YY_BUFFER_STATE -struct yy_buffer_state - { - FILE *yy_input_file; - - char *yy_ch_buf; /* input buffer */ - char *yy_buf_pos; /* current position in input buffer */ - - /* Size of input buffer in bytes, not including room for EOB - * characters. - */ - int yy_buf_size; - - /* Number of characters read into yy_ch_buf, not including EOB - * characters. - */ - int yy_n_chars; - - /* Whether we "own" the buffer - i.e., we know we created it, - * and can realloc() it to grow it, and should free() it to - * delete it. - */ - int yy_is_our_buffer; - - /* Whether this is an "interactive" input source; if so, and - * if we're using stdio for input, then we want to use getc() - * instead of fread(), to make sure we stop fetching input after - * each newline. - */ - int yy_is_interactive; - - /* Whether we're considered to be at the beginning of a line. - * If so, '^' rules will be active on the next match, otherwise - * not. - */ - int yy_at_bol; - - int yy_bs_lineno; /**< The line count. */ - int yy_bs_column; /**< The column count. */ - - /* Whether to try to fill the input buffer when we reach the - * end of it. - */ - int yy_fill_buffer; - - int yy_buffer_status; - -#define YY_BUFFER_NEW 0 -#define YY_BUFFER_NORMAL 1 - /* When an EOF's been seen but there's still some text to process - * then we mark the buffer as YY_EOF_PENDING, to indicate that we - * shouldn't try reading from the input source any more. We might - * still have a bunch of tokens to match, though, because of - * possible backing-up. - * - * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. - */ -#define YY_BUFFER_EOF_PENDING 2 - - }; -#endif /* !YY_STRUCT_YY_BUFFER_STATE */ - -/* Stack of input buffers. */ -static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ -static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ - -/* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ -#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ - ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ - : NULL) -/* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ -#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] - -/* yy_hold_char holds the character lost when yytext is formed. */ -static char yy_hold_char; -static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int yyleng; - -/* Points to current character in buffer. */ -static char *yy_c_buf_p = NULL; -static int yy_init = 0; /* whether we need to initialize */ -static int yy_start = 0; /* start state number */ - -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ -static int yy_did_buffer_switch_on_eof; - -void yyrestart ( FILE *input_file ); -void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); -void yy_delete_buffer ( YY_BUFFER_STATE b ); -void yy_flush_buffer ( YY_BUFFER_STATE b ); -void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state ( void ); - -static void yyensure_buffer_stack ( void ); -static void yy_load_buffer_state ( void ); -static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); -#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) - -YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); -YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); - -void *yyalloc ( yy_size_t ); -void *yyrealloc ( void *, yy_size_t ); -void yyfree ( void * ); - -#define yy_new_buffer yy_create_buffer -#define yy_set_interactive(is_interactive) \ - { \ - if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ - } -#define yy_set_bol(at_bol) \ - { \ - if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (); \ - YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE ); \ - } \ - YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ - } -#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) - -/* Begin user sect3 */ - -#define yywrap() (/*CONSTCOND*/1) -#define YY_SKIP_YYWRAP -typedef flex_uint8_t YY_CHAR; - -FILE *yyin = NULL, *yyout = NULL; - -typedef int yy_state_type; - -extern int yylineno; -int yylineno = 1; - -extern char *yytext; -#ifdef yytext_ptr -#undef yytext_ptr -#endif -#define yytext_ptr yytext - -static const flex_int16_t yy_nxt[][18] = - { - { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0 - }, - - { - 11, 12, 13, 14, 12, 12, 15, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12 - }, - - { - 11, 12, 13, 14, 12, 12, 15, 12, 12, 12, - 12, 12, 12, 12, 12, 12, 12, 12 - }, - - { - 11, 16, 16, 17, 16, 16, 16, 16, 16, 16, - 16, 18, 16, 16, 16, 16, 16, 16 - }, - - { - 11, 16, 16, 17, 16, 16, 16, 16, 16, 16, - 16, 18, 16, 16, 16, 16, 16, 16 - - }, - - { - 11, 19, 20, 21, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19 - }, - - { - 11, 19, 20, 21, 19, 19, 19, 19, 19, 19, - 19, 19, 19, 19, 19, 19, 19, 19 - }, - - { - 11, 22, 22, 23, 22, 24, 22, 22, 24, 22, - 22, 22, 22, 22, 22, 22, 25, 22 - }, - - { - 11, 22, 22, 23, 22, 24, 22, 22, 24, 22, - 22, 22, 22, 22, 22, 22, 25, 22 - }, - - { - 11, 26, 27, 28, 29, 30, 31, 32, 30, 33, - 34, 35, 35, 36, 37, 38, 39, 40 - - }, - - { - 11, 26, 27, 28, 29, 30, 31, 32, 30, 33, - 34, 35, 35, 36, 37, 38, 39, 40 - }, - - { - -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, - -11, -11, -11, -11, -11, -11, -11, -11 - }, - - { - 11, -12, -12, -12, -12, -12, -12, -12, -12, -12, - -12, -12, -12, -12, -12, -12, -12, -12 - }, - - { - 11, -13, 41, 42, -13, -13, 43, -13, -13, -13, - -13, -13, -13, -13, -13, -13, -13, -13 - }, - - { - 11, -14, -14, -14, -14, -14, -14, -14, -14, -14, - -14, -14, -14, -14, -14, -14, -14, -14 - - }, - - { - 11, 44, 44, 45, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44 - }, - - { - 11, -16, -16, -16, -16, -16, -16, -16, -16, -16, - -16, -16, -16, -16, -16, -16, -16, -16 - }, - - { - 11, -17, -17, -17, -17, -17, -17, -17, -17, -17, - -17, -17, -17, -17, -17, -17, -17, -17 - }, - - { - 11, -18, -18, -18, -18, -18, -18, -18, -18, -18, - -18, 46, -18, -18, -18, -18, -18, -18 - }, - - { - 11, 47, 47, -19, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47 - - }, - - { - 11, -20, 48, 49, -20, -20, -20, -20, -20, -20, - -20, -20, -20, -20, -20, -20, -20, -20 - }, - - { - 11, 50, -21, -21, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50 - }, - - { - 11, 51, 51, 52, 51, -22, 51, 51, -22, 51, - 51, 51, 51, 51, 51, 51, -22, 51 - }, - - { - 11, -23, -23, -23, -23, -23, -23, -23, -23, -23, - -23, -23, -23, -23, -23, -23, -23, -23 - }, - - { - 11, -24, -24, -24, -24, -24, -24, -24, -24, -24, - -24, -24, -24, -24, -24, -24, -24, -24 - - }, - - { - 11, 53, 53, 54, 53, 53, 53, 53, 53, 53, - 53, 53, 53, 53, 53, 53, 53, 53 - }, - - { - 11, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26 - }, - - { - 11, -27, 55, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27 - }, - - { - 11, -28, -28, -28, -28, -28, -28, -28, -28, -28, - -28, -28, -28, -28, -28, -28, -28, -28 - }, - - { - 11, -29, -29, -29, -29, -29, -29, -29, -29, -29, - -29, -29, -29, -29, 56, -29, -29, -29 - - }, - - { - 11, -30, -30, -30, -30, -30, -30, -30, -30, -30, - -30, -30, -30, -30, -30, -30, -30, -30 - }, - - { - 11, 57, 57, -31, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57 - }, - - { - 11, -32, -32, -32, -32, -32, -32, 58, -32, -32, - -32, -32, -32, -32, -32, -32, -32, -32 - }, - - { - 11, -33, -33, -33, -33, -33, -33, -33, -33, -33, - -33, -33, -33, -33, -33, -33, -33, -33 - }, - - { - 11, -34, -34, -34, -34, -34, -34, -34, -34, -34, - -34, -34, -34, -34, -34, -34, -34, -34 - - }, - - { - 11, -35, -35, -35, -35, -35, -35, -35, -35, -35, - -35, 59, 59, -35, -35, -35, -35, -35 - }, - - { - 11, -36, -36, -36, -36, -36, -36, -36, -36, -36, - -36, -36, -36, -36, 60, -36, -36, -36 - }, - - { - 11, -37, -37, -37, -37, -37, -37, -37, -37, -37, - -37, -37, -37, -37, -37, -37, -37, -37 - }, - - { - 11, -38, -38, -38, -38, -38, -38, -38, -38, -38, - -38, -38, -38, -38, 61, -38, -38, -38 - }, - - { - 11, -39, -39, 62, -39, -39, -39, -39, -39, -39, - -39, -39, -39, -39, -39, -39, -39, -39 - - }, - - { - 11, -40, -40, -40, -40, -40, -40, -40, -40, -40, - -40, -40, -40, -40, -40, -40, -40, 63 - }, - - { - 11, -41, 41, 42, -41, -41, 43, -41, -41, -41, - -41, -41, -41, -41, -41, -41, -41, -41 - }, - - { - 11, -42, -42, -42, -42, -42, -42, -42, -42, -42, - -42, -42, -42, -42, -42, -42, -42, -42 - }, - - { - 11, 44, 44, 45, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44 - }, - - { - 11, 44, 44, 45, 44, 44, 44, 44, 44, 44, - 44, 44, 44, 44, 44, 44, 44, 44 - - }, - - { - 11, -45, -45, -45, -45, -45, -45, -45, -45, -45, - -45, -45, -45, -45, -45, -45, -45, -45 - }, - - { - 11, -46, -46, -46, -46, -46, -46, -46, -46, -46, - -46, 46, -46, -46, -46, -46, -46, -46 - }, - - { - 11, 47, 47, -47, 47, 47, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 47, 47, 47 - }, - - { - 11, -48, 48, 49, -48, -48, -48, -48, -48, -48, - -48, -48, -48, -48, -48, -48, -48, -48 - }, - - { - 11, 50, -49, -49, 50, 50, 50, 50, 50, 50, - 50, 50, 50, 50, 50, 50, 50, 50 - - }, - - { - 11, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50 - }, - - { - 11, 51, 51, 52, 51, -51, 51, 51, -51, 51, - 51, 51, 51, 51, 51, 51, -51, 51 - }, - - { - 11, -52, -52, -52, -52, -52, -52, -52, -52, -52, - -52, -52, -52, -52, -52, -52, -52, -52 - }, - - { - 11, -53, -53, 54, -53, -53, -53, -53, -53, -53, - -53, -53, -53, -53, -53, -53, -53, -53 - }, - - { - 11, -54, -54, -54, -54, -54, -54, -54, -54, -54, - -54, -54, -54, -54, -54, -54, -54, -54 - - }, - - { - 11, -55, 55, -55, -55, -55, -55, -55, -55, -55, - -55, -55, -55, -55, -55, -55, -55, -55 - }, - - { - 11, -56, -56, -56, -56, -56, -56, -56, -56, -56, - -56, -56, -56, -56, -56, -56, -56, -56 - }, - - { - 11, 57, 57, -57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57 - }, - - { - 11, -58, -58, -58, -58, -58, -58, -58, -58, -58, - -58, -58, -58, -58, -58, -58, -58, -58 - }, - - { - 11, -59, -59, -59, -59, -59, -59, -59, -59, -59, - -59, 59, 59, -59, -59, -59, -59, -59 - - }, - - { - 11, -60, -60, -60, -60, -60, -60, -60, -60, -60, - -60, -60, -60, -60, -60, -60, -60, -60 - }, - - { - 11, -61, -61, -61, -61, -61, -61, -61, -61, -61, - -61, -61, -61, -61, -61, -61, -61, -61 - }, - - { - 11, -62, -62, -62, -62, -62, -62, -62, -62, -62, - -62, -62, -62, -62, -62, -62, -62, -62 - }, - - { - 11, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63 - }, - - } ; - -static yy_state_type yy_get_previous_state ( void ); -static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); -static int yy_get_next_buffer ( void ); -static void yynoreturn yy_fatal_error ( const char* msg ); - -/* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ -#define YY_DO_BEFORE_ACTION \ - (yytext_ptr) = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ - (yy_hold_char) = *yy_cp; \ - *yy_cp = '\0'; \ - (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 37 -#define YY_END_OF_BUFFER 38 -/* This struct is not used in this scanner, - but its presence is necessary. */ -struct yy_trans_info - { - flex_int32_t yy_verify; - flex_int32_t yy_nxt; - }; -static const flex_int16_t yy_accept[64] = - { 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 38, 5, 4, 2, 3, 7, 8, 6, 36, 33, - 35, 28, 32, 31, 30, 26, 25, 21, 13, 20, - 23, 26, 11, 12, 22, 18, 14, 19, 26, 26, - 4, 2, 3, 3, 1, 6, 36, 33, 35, 34, - 28, 27, 30, 29, 25, 15, 23, 9, 22, 16, - 17, 24, 10 - } ; - -static const YY_CHAR yy_ec[256] = - { 0, - 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 2, 4, 5, 6, 1, 1, 7, 8, 9, - 10, 1, 1, 1, 11, 12, 12, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 1, 1, 13, - 14, 15, 1, 1, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 1, 16, 1, 1, 11, 1, 11, 11, 11, 11, - - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, - 11, 11, 1, 17, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1 - } ; - -/* Table of booleans, true if rule could match eol. */ -static const flex_int32_t yy_rule_can_match_eol[38] = - { 0, -1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, }; - -extern int yy_flex_debug; -int yy_flex_debug = 0; - -/* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ -#define REJECT reject_used_but_not_detected -#define yymore() yymore_used_but_not_detected -#define YY_MORE_ADJ 0 -#define YY_RESTORE_YY_MORE_OFFSET -char *yytext; -#define YY_NO_INPUT 1 - -/* - * Copyright (C) 2002 Roman Zippel - * Released under the terms of the GNU GPL v2.0. - */ - -#include -#include -#include -#include -#include - -#include "lkc.h" - -#define START_STRSIZE 16 - -static struct { - struct file *file; - int lineno; -} current_pos; - -static char *text; -static int text_size, text_asize; - -struct buffer { - struct buffer *parent; - YY_BUFFER_STATE state; -}; - -struct buffer *current_buf; - -static int last_ts, first_ts; - -static void zconf_endhelp(void); -static void zconf_endfile(void); - -static void new_string(void) -{ - text = xmalloc(START_STRSIZE); - text_asize = START_STRSIZE; - text_size = 0; - *text = 0; -} - -static void append_string(const char *str, int size) -{ - int new_size = text_size + size + 1; - if (new_size > text_asize) { - new_size += START_STRSIZE - 1; - new_size &= -START_STRSIZE; - text = xrealloc(text, new_size); - text_asize = new_size; - } - memcpy(text + text_size, str, size); - text_size += size; - text[text_size] = 0; -} - -static void alloc_string(const char *str, int size) -{ - text = xmalloc(size + 1); - memcpy(text, str, size); - text[size] = 0; -} - -static void warn_ignored_character(char chr) -{ - fprintf(stderr, - "%s:%d:warning: ignoring unsupported character '%c'\n", - zconf_curname(), zconf_lineno(), chr); -} - -#define INITIAL 0 -#define COMMAND 1 -#define HELP 2 -#define STRING 3 -#define PARAM 4 - -#ifndef YY_NO_UNISTD_H -/* Special case for "unistd.h", since it is non-ANSI. We include it way - * down here because we want the user's section 1 to have been scanned first. - * The user has a chance to override it with an option. - */ -#include -#endif - -#ifndef YY_EXTRA_TYPE -#define YY_EXTRA_TYPE void * -#endif - -static int yy_init_globals ( void ); - -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int yylex_destroy ( void ); - -int yyget_debug ( void ); - -void yyset_debug ( int debug_flag ); - -YY_EXTRA_TYPE yyget_extra ( void ); - -void yyset_extra ( YY_EXTRA_TYPE user_defined ); - -FILE *yyget_in ( void ); - -void yyset_in ( FILE * _in_str ); - -FILE *yyget_out ( void ); - -void yyset_out ( FILE * _out_str ); - - int yyget_leng ( void ); - -char *yyget_text ( void ); - -int yyget_lineno ( void ); - -void yyset_lineno ( int _line_number ); - -/* Macros after this point can all be overridden by user definitions in - * section 1. - */ - -#ifndef YY_SKIP_YYWRAP -#ifdef __cplusplus -extern "C" int yywrap ( void ); -#else -extern int yywrap ( void ); -#endif -#endif - -#ifndef YY_NO_UNPUT - - static void yyunput ( int c, char *buf_ptr ); - -#endif - -#ifndef yytext_ptr -static void yy_flex_strncpy ( char *, const char *, int ); -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen ( const char * ); -#endif - -#ifndef YY_NO_INPUT -#ifdef __cplusplus -static int yyinput ( void ); -#else -static int input ( void ); -#endif - -#endif - -/* Amount of stuff to slurp up with each read. */ -#ifndef YY_READ_BUF_SIZE -#ifdef __ia64__ -/* On IA-64, the buffer size is 16k, not 8k */ -#define YY_READ_BUF_SIZE 16384 -#else -#define YY_READ_BUF_SIZE 8192 -#endif /* __ia64__ */ -#endif - -/* Copy whatever the last rule matched to the standard output. */ -#ifndef ECHO -/* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ -#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) -#endif - -/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ -#ifndef YY_INPUT -#define YY_INPUT(buf,result,max_size) \ - errno=0; \ - while ( (result = (int) read( fileno(yyin), buf, (yy_size_t) max_size )) < 0 ) \ - { \ - if( errno != EINTR) \ - { \ - YY_FATAL_ERROR( "input in flex scanner failed" ); \ - break; \ - } \ - errno=0; \ - clearerr(yyin); \ - }\ -\ - -#endif - -/* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ -#ifndef yyterminate -#define yyterminate() return YY_NULL -#endif - -/* Number of entries by which start-condition stack grows. */ -#ifndef YY_START_STACK_INCR -#define YY_START_STACK_INCR 25 -#endif - -/* Report a fatal error. */ -#ifndef YY_FATAL_ERROR -#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) -#endif - -/* end tables serialization structures and prototypes */ - -/* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ -#ifndef YY_DECL -#define YY_DECL_IS_OURS 1 - -extern int yylex (void); - -#define YY_DECL int yylex (void) -#endif /* !YY_DECL */ - -/* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ -#ifndef YY_USER_ACTION -#define YY_USER_ACTION -#endif - -/* Code executed at the end of each rule. */ -#ifndef YY_BREAK -#define YY_BREAK /*LINTED*/break; -#endif - -#define YY_RULE_SETUP \ - YY_USER_ACTION - -/** The main scanner function which does all the work. - */ -YY_DECL -{ - yy_state_type yy_current_state; - char *yy_cp, *yy_bp; - int yy_act; - - if ( !(yy_init) ) - { - (yy_init) = 1; - -#ifdef YY_USER_INIT - YY_USER_INIT; -#endif - - if ( ! (yy_start) ) - (yy_start) = 1; /* first start state */ - - if ( ! yyin ) - yyin = stdin; - - if ( ! yyout ) - yyout = stdout; - - if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE ); - } - - yy_load_buffer_state( ); - } - - { - - int str = 0; - int ts, i; - - while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ - { - yy_cp = (yy_c_buf_p); - - /* Support of yytext. */ - *yy_cp = (yy_hold_char); - - /* yy_bp points to the position in yy_ch_buf of the start of - * the current run. - */ - yy_bp = yy_cp; - - yy_current_state = (yy_start); -yy_match: - while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 ) - ++yy_cp; - - yy_current_state = -yy_current_state; - -yy_find_action: - yy_act = yy_accept[yy_current_state]; - - YY_DO_BEFORE_ACTION; - - if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] ) - { - int yyl; - for ( yyl = 0; yyl < yyleng; ++yyl ) - if ( yytext[yyl] == '\n' ) - - yylineno++; -; - } - -do_action: /* This label is used only to access EOF actions. */ - - switch ( yy_act ) - { /* beginning of action switch */ -case 1: -/* rule 1 can match eol */ -case 2: -/* rule 2 can match eol */ -YY_RULE_SETUP -{ - return T_EOL; -} - YY_BREAK -case 3: -YY_RULE_SETUP - - YY_BREAK -case 4: -YY_RULE_SETUP -{ - BEGIN(COMMAND); -} - YY_BREAK -case 5: -YY_RULE_SETUP -{ - unput(yytext[0]); - BEGIN(COMMAND); -} - YY_BREAK - -case 6: -YY_RULE_SETUP -{ - const struct kconf_id *id = kconf_id_lookup(yytext, yyleng); - BEGIN(PARAM); - current_pos.file = current_file; - current_pos.lineno = yylineno; - if (id && id->flags & TF_COMMAND) { - yylval.id = id; - return id->token; - } - alloc_string(yytext, yyleng); - yylval.string = text; - return T_WORD; - } - YY_BREAK -case 7: -YY_RULE_SETUP -warn_ignored_character(*yytext); - YY_BREAK -case 8: -/* rule 8 can match eol */ -YY_RULE_SETUP -{ - BEGIN(INITIAL); - return T_EOL; - } - YY_BREAK - -case 9: -YY_RULE_SETUP -return T_AND; - YY_BREAK -case 10: -YY_RULE_SETUP -return T_OR; - YY_BREAK -case 11: -YY_RULE_SETUP -return T_OPEN_PAREN; - YY_BREAK -case 12: -YY_RULE_SETUP -return T_CLOSE_PAREN; - YY_BREAK -case 13: -YY_RULE_SETUP -return T_NOT; - YY_BREAK -case 14: -YY_RULE_SETUP -return T_EQUAL; - YY_BREAK -case 15: -YY_RULE_SETUP -return T_UNEQUAL; - YY_BREAK -case 16: -YY_RULE_SETUP -return T_LESS_EQUAL; - YY_BREAK -case 17: -YY_RULE_SETUP -return T_GREATER_EQUAL; - YY_BREAK -case 18: -YY_RULE_SETUP -return T_LESS; - YY_BREAK -case 19: -YY_RULE_SETUP -return T_GREATER; - YY_BREAK -case 20: -YY_RULE_SETUP -{ - str = yytext[0]; - new_string(); - BEGIN(STRING); - } - YY_BREAK -case 21: -/* rule 21 can match eol */ -YY_RULE_SETUP -BEGIN(INITIAL); return T_EOL; - YY_BREAK -case 22: -YY_RULE_SETUP -{ - const struct kconf_id *id = kconf_id_lookup(yytext, yyleng); - if (id && id->flags & TF_PARAM) { - yylval.id = id; - return id->token; - } - alloc_string(yytext, yyleng); - yylval.string = text; - return T_WORD; - } - YY_BREAK -case 23: -YY_RULE_SETUP -/* comment */ - YY_BREAK -case 24: -/* rule 24 can match eol */ -YY_RULE_SETUP -; - YY_BREAK -case 25: -YY_RULE_SETUP - - YY_BREAK -case 26: -YY_RULE_SETUP -warn_ignored_character(*yytext); - YY_BREAK -case YY_STATE_EOF(PARAM): -{ - BEGIN(INITIAL); - } - YY_BREAK - -case 27: -/* rule 27 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -YY_LINENO_REWIND_TO(yy_cp - 1); -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -{ - append_string(yytext, yyleng); - yylval.string = text; - return T_WORD_QUOTE; - } - YY_BREAK -case 28: -YY_RULE_SETUP -{ - append_string(yytext, yyleng); - } - YY_BREAK -case 29: -/* rule 29 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -YY_LINENO_REWIND_TO(yy_cp - 1); -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -{ - append_string(yytext + 1, yyleng - 1); - yylval.string = text; - return T_WORD_QUOTE; - } - YY_BREAK -case 30: -YY_RULE_SETUP -{ - append_string(yytext + 1, yyleng - 1); - } - YY_BREAK -case 31: -YY_RULE_SETUP -{ - if (str == yytext[0]) { - BEGIN(PARAM); - yylval.string = text; - return T_WORD_QUOTE; - } else - append_string(yytext, 1); - } - YY_BREAK -case 32: -/* rule 32 can match eol */ -YY_RULE_SETUP -{ - fprintf(stderr, - "%s:%d:warning: multi-line strings not supported\n", - zconf_curname(), zconf_lineno()); - BEGIN(INITIAL); - return T_EOL; - } - YY_BREAK -case YY_STATE_EOF(STRING): -{ - BEGIN(INITIAL); - } - YY_BREAK - -case 33: -YY_RULE_SETUP -{ - ts = 0; - for (i = 0; i < yyleng; i++) { - if (yytext[i] == '\t') - ts = (ts & ~7) + 8; - else - ts++; - } - last_ts = ts; - if (first_ts) { - if (ts < first_ts) { - zconf_endhelp(); - return T_HELPTEXT; - } - ts -= first_ts; - while (ts > 8) { - append_string(" ", 8); - ts -= 8; - } - append_string(" ", ts); - } - } - YY_BREAK -case 34: -/* rule 34 can match eol */ -*yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ -YY_LINENO_REWIND_TO(yy_cp - 1); -(yy_c_buf_p) = yy_cp -= 1; -YY_DO_BEFORE_ACTION; /* set up yytext again */ -YY_RULE_SETUP -{ - zconf_endhelp(); - return T_HELPTEXT; - } - YY_BREAK -case 35: -/* rule 35 can match eol */ -YY_RULE_SETUP -{ - append_string("\n", 1); - } - YY_BREAK -case 36: -YY_RULE_SETUP -{ - while (yyleng) { - if ((yytext[yyleng-1] != ' ') && (yytext[yyleng-1] != '\t')) - break; - yyleng--; - } - append_string(yytext, yyleng); - if (!first_ts) - first_ts = last_ts; - } - YY_BREAK -case YY_STATE_EOF(HELP): -{ - zconf_endhelp(); - return T_HELPTEXT; - } - YY_BREAK - -case YY_STATE_EOF(INITIAL): -case YY_STATE_EOF(COMMAND): -{ - if (current_file) { - zconf_endfile(); - return T_EOL; - } - fclose(yyin); - yyterminate(); -} - YY_BREAK -case 37: -YY_RULE_SETUP -YY_FATAL_ERROR( "flex scanner jammed" ); - YY_BREAK - - case YY_END_OF_BUFFER: - { - /* Amount of text matched not including the EOB char. */ - int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; - - /* Undo the effects of YY_DO_BEFORE_ACTION. */ - *yy_cp = (yy_hold_char); - YY_RESTORE_YY_MORE_OFFSET - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) - { - /* We're scanning a new file or input source. It's - * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure - * consistency between YY_CURRENT_BUFFER and our - * globals. Here is the right place to do so, because - * this is the first action (other than possibly a - * back-up) that will match for the new input source. - */ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; - } - - /* Note that here we test for yy_c_buf_p "<=" to the position - * of the first EOB in the buffer, since yy_c_buf_p will - * already have been incremented past the NUL character - * (since all states make transitions on EOB to the - * end-of-buffer state). Contrast this with the test - * in input(). - */ - if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - { /* This was really a NUL. */ - yy_state_type yy_next_state; - - (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - /* Okay, we're now positioned to make the NUL - * transition. We couldn't have - * yy_get_previous_state() go ahead and do it - * for us because it doesn't know how to deal - * with the possibility of jamming (and we don't - * want to build jamming into it because then it - * will run more slowly). - */ - - yy_next_state = yy_try_NUL_trans( yy_current_state ); - - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - - if ( yy_next_state ) - { - /* Consume the NUL. */ - yy_cp = ++(yy_c_buf_p); - yy_current_state = yy_next_state; - goto yy_match; - } - - else - { - yy_cp = (yy_c_buf_p); - goto yy_find_action; - } - } - - else switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_END_OF_FILE: - { - (yy_did_buffer_switch_on_eof) = 0; - - if ( yywrap( ) ) - { - /* Note: because we've taken care in - * yy_get_next_buffer() to have set up - * yytext, we can now set up - * yy_c_buf_p so that if some total - * hoser (like flex itself) wants to - * call the scanner after we return the - * YY_NULL, it'll still work - another - * YY_NULL will get returned. - */ - (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; - - yy_act = YY_STATE_EOF(YY_START); - goto do_action; - } - - else - { - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; - } - break; - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = - (yytext_ptr) + yy_amount_of_matched_text; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_match; - - case EOB_ACT_LAST_MATCH: - (yy_c_buf_p) = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; - - yy_current_state = yy_get_previous_state( ); - - yy_cp = (yy_c_buf_p); - yy_bp = (yytext_ptr) + YY_MORE_ADJ; - goto yy_find_action; - } - break; - } - - default: - YY_FATAL_ERROR( - "fatal flex scanner internal error--no action found" ); - } /* end of action switch */ - } /* end of scanning one token */ - } /* end of user's declarations */ -} /* end of yylex */ - -/* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: - * EOB_ACT_LAST_MATCH - - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position - * EOB_ACT_END_OF_FILE - end of file - */ -static int yy_get_next_buffer (void) -{ - char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; - char *source = (yytext_ptr); - int number_to_move, i; - int ret_val; - - if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) - YY_FATAL_ERROR( - "fatal flex scanner internal error--end of buffer missed" ); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) - { /* Don't try to fill the buffer, so this is an EOF. */ - if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) - { - /* We matched a single character, the EOB, so - * treat this as a final EOF. - */ - return EOB_ACT_END_OF_FILE; - } - - else - { - /* We matched some text prior to the EOB, first - * process it. - */ - return EOB_ACT_LAST_MATCH; - } - } - - /* Try to read more data. */ - - /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); - - for ( i = 0; i < number_to_move; ++i ) - *(dest++) = *(source++); - - if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) - /* don't do the read, it's not guaranteed to return an EOF, - * just force an EOF - */ - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; - - else - { - int num_to_read = - YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; - - while ( num_to_read <= 0 ) - { /* Not enough room in the buffer - grow it. */ - - /* just a shorter name for the current buffer */ - YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; - - int yy_c_buf_p_offset = - (int) ((yy_c_buf_p) - b->yy_ch_buf); - - if ( b->yy_is_our_buffer ) - { - int new_size = b->yy_buf_size * 2; - - if ( new_size <= 0 ) - b->yy_buf_size += b->yy_buf_size / 8; - else - b->yy_buf_size *= 2; - - b->yy_ch_buf = (char *) - /* Include room in for 2 EOB chars. */ - yyrealloc( (void *) b->yy_ch_buf, - (yy_size_t) (b->yy_buf_size + 2) ); - } - else - /* Can't grow it, we don't own it. */ - b->yy_ch_buf = NULL; - - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( - "fatal error - scanner input buffer overflow" ); - - (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; - - num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - - number_to_move - 1; - - } - - if ( num_to_read > YY_READ_BUF_SIZE ) - num_to_read = YY_READ_BUF_SIZE; - - /* Read in more data. */ - YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - (yy_n_chars), num_to_read ); - - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - if ( (yy_n_chars) == 0 ) - { - if ( number_to_move == YY_MORE_ADJ ) - { - ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); - } - - else - { - ret_val = EOB_ACT_LAST_MATCH; - YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = - YY_BUFFER_EOF_PENDING; - } - } - - else - ret_val = EOB_ACT_CONTINUE_SCAN; - - if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { - /* Extend the array by 50%, plus the number we really need. */ - int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( - (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); - if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - /* "- 2" to take care of EOB's */ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); - } - - (yy_n_chars) += number_to_move; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; - - (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; - - return ret_val; -} - -/* yy_get_previous_state - get the state just before the EOB char was reached */ - - static yy_state_type yy_get_previous_state (void) -{ - yy_state_type yy_current_state; - char *yy_cp; - - yy_current_state = (yy_start); - - for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) - { - yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)]; - } - - return yy_current_state; -} - -/* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis - * next_state = yy_try_NUL_trans( current_state ); - */ - static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) -{ - int yy_is_jam; - - yy_current_state = yy_nxt[yy_current_state][1]; - yy_is_jam = (yy_current_state <= 0); - - return yy_is_jam ? 0 : yy_current_state; -} - -#ifndef YY_NO_UNPUT - - static void yyunput (int c, char * yy_bp ) -{ - char *yy_cp; - - yy_cp = (yy_c_buf_p); - - /* undo effects of setting up yytext */ - *yy_cp = (yy_hold_char); - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - { /* need to shift things up to make room */ - /* +2 for EOB chars. */ - int number_to_move = (yy_n_chars) + 2; - char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; - char *source = - &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]; - - while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) - *--dest = *--source; - - yy_cp += (int) (dest - source); - yy_bp += (int) (dest - source); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; - - if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) - YY_FATAL_ERROR( "flex scanner push-back overflow" ); - } - - *--yy_cp = (char) c; - - if ( c == '\n' ){ - --yylineno; - } - - (yytext_ptr) = yy_bp; - (yy_hold_char) = *yy_cp; - (yy_c_buf_p) = yy_cp; -} - -#endif - -#ifndef YY_NO_INPUT -#ifdef __cplusplus - static int yyinput (void) -#else - static int input (void) -#endif - -{ - int c; - - *(yy_c_buf_p) = (yy_hold_char); - - if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) - { - /* yy_c_buf_p now points to the character we want to return. - * If this occurs *before* the EOB characters, then it's a - * valid NUL; if not, then we've hit the end of the buffer. - */ - if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) - /* This was really a NUL. */ - *(yy_c_buf_p) = '\0'; - - else - { /* need more input */ - int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); - ++(yy_c_buf_p); - - switch ( yy_get_next_buffer( ) ) - { - case EOB_ACT_LAST_MATCH: - /* This happens because yy_g_n_b() - * sees that we've accumulated a - * token and flags that we need to - * try matching the token before - * proceeding. But for input(), - * there's no matching to consider. - * So convert the EOB_ACT_LAST_MATCH - * to EOB_ACT_END_OF_FILE. - */ - - /* Reset buffer status. */ - yyrestart( yyin ); - - /*FALLTHROUGH*/ - - case EOB_ACT_END_OF_FILE: - { - if ( yywrap( ) ) - return 0; - - if ( ! (yy_did_buffer_switch_on_eof) ) - YY_NEW_FILE; -#ifdef __cplusplus - return yyinput(); -#else - return input(); -#endif - } - - case EOB_ACT_CONTINUE_SCAN: - (yy_c_buf_p) = (yytext_ptr) + offset; - break; - } - } - } - - c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ - (yy_hold_char) = *++(yy_c_buf_p); - - if ( c == '\n' ) - - yylineno++; -; - - return c; -} -#endif /* ifndef YY_NO_INPUT */ - -/** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ - void yyrestart (FILE * input_file ) -{ - - if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); - YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE ); - } - - yy_init_buffer( YY_CURRENT_BUFFER, input_file ); - yy_load_buffer_state( ); -} - -/** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) -{ - - /* TODO. We should be able to replace this entire function body - * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); - */ - yyensure_buffer_stack (); - if ( YY_CURRENT_BUFFER == new_buffer ) - return; - - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); - - /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe - * to go ahead and always set it. - */ - (yy_did_buffer_switch_on_eof) = 1; -} - -static void yy_load_buffer_state (void) -{ - (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; - (yy_hold_char) = *(yy_c_buf_p); -} - -/** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) -{ - YY_BUFFER_STATE b; - - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_buf_size = size; - - /* yy_ch_buf has to be 2 characters longer than the size given because - * we need to put in 2 end-of-buffer characters. - */ - b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); - if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); - - b->yy_is_our_buffer = 1; - - yy_init_buffer( b, file ); - - return b; -} - -/** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ - void yy_delete_buffer (YY_BUFFER_STATE b ) -{ - - if ( ! b ) - return; - - if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ - YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; - - if ( b->yy_is_our_buffer ) - yyfree( (void *) b->yy_ch_buf ); - - yyfree( (void *) b ); -} - -/* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) - -{ - int oerrno = errno; - - yy_flush_buffer( b ); - - b->yy_input_file = file; - b->yy_fill_buffer = 1; - - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. - * In that case, we don't want to reset the lineno or column. - */ - if (b != YY_CURRENT_BUFFER){ - b->yy_bs_lineno = 1; - b->yy_bs_column = 0; - } - - b->yy_is_interactive = 0; - - errno = oerrno; -} - -/** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ - void yy_flush_buffer (YY_BUFFER_STATE b ) -{ - if ( ! b ) - return; - - b->yy_n_chars = 0; - - /* We always need two end-of-buffer characters. The first causes - * a transition to the end-of-buffer state. The second causes - * a jam in that state. - */ - b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; - b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; - - b->yy_buf_pos = &b->yy_ch_buf[0]; - - b->yy_at_bol = 1; - b->yy_buffer_status = YY_BUFFER_NEW; - - if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); -} - -/** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) -{ - if (new_buffer == NULL) - return; - - yyensure_buffer_stack(); - - /* This block is copied from yy_switch_to_buffer. */ - if ( YY_CURRENT_BUFFER ) - { - /* Flush out information for old buffer. */ - *(yy_c_buf_p) = (yy_hold_char); - YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); - YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); - } - - /* Only push if top exists. Otherwise, replace top. */ - if (YY_CURRENT_BUFFER) - (yy_buffer_stack_top)++; - YY_CURRENT_BUFFER_LVALUE = new_buffer; - - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; -} - -/** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ -void yypop_buffer_state (void) -{ - if (!YY_CURRENT_BUFFER) - return; - - yy_delete_buffer(YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - if ((yy_buffer_stack_top) > 0) - --(yy_buffer_stack_top); - - if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); - (yy_did_buffer_switch_on_eof) = 1; - } -} - -/* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ -static void yyensure_buffer_stack (void) -{ - yy_size_t num_to_alloc; - - if (!(yy_buffer_stack)) { - - /* First allocation is just for 2 elements, since we don't know if this - * scanner will even need a stack. We use 2 instead of 1 to avoid an - * immediate realloc on the next call. - */ - num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc - (num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - - (yy_buffer_stack_max) = num_to_alloc; - (yy_buffer_stack_top) = 0; - return; - } - - if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ - - /* Increase the buffer to prepare for a possible push. */ - yy_size_t grow_size = 8 /* arbitrary grow size */; - - num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc - ((yy_buffer_stack), - num_to_alloc * sizeof(struct yy_buffer_state*) - ); - if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - - /* zero only the new slots.*/ - memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); - (yy_buffer_stack_max) = num_to_alloc; - } -} - -/** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) -{ - YY_BUFFER_STATE b; - - if ( size < 2 || - base[size-2] != YY_END_OF_BUFFER_CHAR || - base[size-1] != YY_END_OF_BUFFER_CHAR ) - /* They forgot to leave room for the EOB's. */ - return NULL; - - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); - if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); - - b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ - b->yy_buf_pos = b->yy_ch_buf = base; - b->yy_is_our_buffer = 0; - b->yy_input_file = NULL; - b->yy_n_chars = b->yy_buf_size; - b->yy_is_interactive = 0; - b->yy_at_bol = 1; - b->yy_fill_buffer = 0; - b->yy_buffer_status = YY_BUFFER_NEW; - - yy_switch_to_buffer( b ); - - return b; -} - -/** Setup the input buffer state to scan a string. The next call to yylex() will - * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. - */ -YY_BUFFER_STATE yy_scan_string (const char * yystr ) -{ - - return yy_scan_bytes( yystr, (int) strlen(yystr) ); -} - -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will - * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ -YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) -{ - YY_BUFFER_STATE b; - char *buf; - yy_size_t n; - int i; - - /* Get memory for full buffer, including space for trailing EOB's. */ - n = (yy_size_t) (_yybytes_len + 2); - buf = (char *) yyalloc( n ); - if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); - - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; - - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - - b = yy_scan_buffer( buf, n ); - if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); - - /* It's okay to grow etc. this buffer, and we should throw it - * away when we're done. - */ - b->yy_is_our_buffer = 1; - - return b; -} - -#ifndef YY_EXIT_FAILURE -#define YY_EXIT_FAILURE 2 -#endif - -static void yynoreturn yy_fatal_error (const char* msg ) -{ - fprintf( stderr, "%s\n", msg ); - exit( YY_EXIT_FAILURE ); -} - -/* Redefine yyless() so it works in section 3 code. */ - -#undef yyless -#define yyless(n) \ - do \ - { \ - /* Undo effects of setting up yytext. */ \ - int yyless_macro_arg = (n); \ - YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ - (yy_hold_char) = *(yy_c_buf_p); \ - *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ - } \ - while ( 0 ) - -/* Accessor methods (get/set functions) to struct members. */ - -/** Get the current line number. - * - */ -int yyget_lineno (void) -{ - - return yylineno; -} - -/** Get the input stream. - * - */ -FILE *yyget_in (void) -{ - return yyin; -} - -/** Get the output stream. - * - */ -FILE *yyget_out (void) -{ - return yyout; -} - -/** Get the length of the current token. - * - */ -int yyget_leng (void) -{ - return yyleng; -} - -/** Get the current token. - * - */ - -char *yyget_text (void) -{ - return yytext; -} - -/** Set the current line number. - * @param _line_number line number - * - */ -void yyset_lineno (int _line_number ) -{ - - yylineno = _line_number; -} - -/** Set the input stream. This does not discard the current - * input buffer. - * @param _in_str A readable stream. - * - * @see yy_switch_to_buffer - */ -void yyset_in (FILE * _in_str ) -{ - yyin = _in_str ; -} - -void yyset_out (FILE * _out_str ) -{ - yyout = _out_str ; -} - -int yyget_debug (void) -{ - return yy_flex_debug; -} - -void yyset_debug (int _bdebug ) -{ - yy_flex_debug = _bdebug ; -} - -static int yy_init_globals (void) -{ - /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. - */ - - /* We do not touch yylineno unless the option is enabled. */ - yylineno = 1; - - (yy_buffer_stack) = NULL; - (yy_buffer_stack_top) = 0; - (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = NULL; - (yy_init) = 0; - (yy_start) = 0; - -/* Defined in main.c */ -#ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; -#else - yyin = NULL; - yyout = NULL; -#endif - - /* For future reference: Set errno on error, since we are called by - * yylex_init() - */ - return 0; -} - -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (void) -{ - - /* Pop the buffer stack, destroying each element. */ - while(YY_CURRENT_BUFFER){ - yy_delete_buffer( YY_CURRENT_BUFFER ); - YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); - } - - /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); - (yy_buffer_stack) = NULL; - - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ - yy_init_globals( ); - - return 0; -} - -/* - * Internal utility routines. - */ - -#ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, const char * s2, int n ) -{ - - int i; - for ( i = 0; i < n; ++i ) - s1[i] = s2[i]; -} -#endif - -#ifdef YY_NEED_STRLEN -static int yy_flex_strlen (const char * s ) -{ - int n; - for ( n = 0; s[n]; ++n ) - ; - - return n; -} -#endif - -void *yyalloc (yy_size_t size ) -{ - return malloc(size); -} - -void *yyrealloc (void * ptr, yy_size_t size ) -{ - - /* The cast to (char *) in the following accommodates both - * implementations that use char* generic pointers, and those - * that use void* generic pointers. It works with the latter - * because both ANSI C and C++ allow castless assignment from - * any pointer type to void*, and deal with argument conversions - * as though doing an assignment. - */ - return realloc(ptr, size); -} - -void yyfree (void * ptr ) -{ - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ -} - -#define YYTABLES_NAME "yytables" - -void zconf_starthelp(void) -{ - new_string(); - last_ts = first_ts = 0; - BEGIN(HELP); -} - -static void zconf_endhelp(void) -{ - yylval.string = text; - BEGIN(INITIAL); -} - -/* - * Try to open specified file with following names: - * ./name - * $(srctree)/name - * The latter is used when srctree is separate from objtree - * when compiling the kernel. - * Return NULL if file is not found. - */ -FILE *zconf_fopen(const char *name) -{ - char *env, fullname[PATH_MAX+1]; - FILE *f; - - f = fopen(name, "r"); - if (!f && name != NULL && name[0] != '/') { - env = getenv(SRCTREE); - if (env) { - sprintf(fullname, "%s/%s", env, name); - f = fopen(fullname, "r"); - } - } - return f; -} - -void zconf_initscan(const char *name) -{ - yyin = zconf_fopen(name); - if (!yyin) { - fprintf(stderr, "can't find file %s\n", name); - exit(1); - } - - current_buf = xmalloc(sizeof(*current_buf)); - memset(current_buf, 0, sizeof(*current_buf)); - - current_file = file_lookup(name); - yylineno = 1; -} - -void zconf_nextfile(const char *name) -{ - struct file *iter; - struct file *file = file_lookup(name); - struct buffer *buf = xmalloc(sizeof(*buf)); - memset(buf, 0, sizeof(*buf)); - - current_buf->state = YY_CURRENT_BUFFER; - yyin = zconf_fopen(file->name); - if (!yyin) { - fprintf(stderr, "%s:%d: can't open file \"%s\"\n", - zconf_curname(), zconf_lineno(), file->name); - exit(1); - } - yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); - buf->parent = current_buf; - current_buf = buf; - - current_file->lineno = yylineno; - file->parent = current_file; - - for (iter = current_file; iter; iter = iter->parent) { - if (!strcmp(iter->name, file->name)) { - fprintf(stderr, - "Recursive inclusion detected.\n" - "Inclusion path:\n" - " current file : %s\n", file->name); - iter = file; - do { - iter = iter->parent; - fprintf(stderr, " included from: %s:%d\n", - iter->name, iter->lineno - 1); - } while (strcmp(iter->name, file->name)); - exit(1); - } - } - - yylineno = 1; - current_file = file; -} - -static void zconf_endfile(void) -{ - struct buffer *parent; - - current_file = current_file->parent; - if (current_file) - yylineno = current_file->lineno; - - parent = current_buf->parent; - if (parent) { - fclose(yyin); - yy_delete_buffer(YY_CURRENT_BUFFER); - yy_switch_to_buffer(parent->state); - } - free(current_buf); - current_buf = parent; -} - -int zconf_lineno(void) -{ - return current_pos.lineno; -} - -const char *zconf_curname(void) -{ - return current_pos.file ? current_pos.file->name : ""; -} - diff --git a/support/kconfig/zconf.tab.c_shipped b/support/kconfig/zconf.tab.c_shipped deleted file mode 100644 index 4eca5b3135..0000000000 --- a/support/kconfig/zconf.tab.c_shipped +++ /dev/null @@ -1,2488 +0,0 @@ -/* A Bison parser, made by GNU Bison 3.0.4. */ - -/* Bison implementation for Yacc-like parsers in C - - Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc. - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . */ - -/* As a special exception, you may create a larger work that contains - part or all of the Bison parser skeleton and distribute that work - under terms of your choice, so long as that work isn't itself a - parser generator using the skeleton or a modified version thereof - as a parser skeleton. Alternatively, if you modify or redistribute - the parser skeleton itself, you may (at your option) remove this - special exception, which will cause the skeleton and the resulting - Bison output files to be licensed under the GNU General Public - License without this special exception. - - This special exception was added by the Free Software Foundation in - version 2.2 of Bison. */ - -/* C LALR(1) parser skeleton written by Richard Stallman, by - simplifying the original so-called "semantic" parser. */ - -/* All symbols defined below should begin with yy or YY, to avoid - infringing on user name space. This should be done even for local - variables, as they might otherwise be expanded by user macros. - There are some unavoidable exceptions within include files to - define necessary library symbols; they are noted "INFRINGES ON - USER NAME SPACE" below. */ - -/* Identify Bison output. */ -#define YYBISON 1 - -/* Bison version. */ -#define YYBISON_VERSION "3.0.4" - -/* Skeleton name. */ -#define YYSKELETON_NAME "yacc.c" - -/* Pure parsers. */ -#define YYPURE 0 - -/* Push parsers. */ -#define YYPUSH 0 - -/* Pull parsers. */ -#define YYPULL 1 - - - - -/* Copy the first part of user declarations. */ - - -/* - * Copyright (C) 2002 Roman Zippel - * Released under the terms of the GNU GPL v2.0. - */ - -#include -#include -#include -#include -#include -#include - -#include "lkc.h" - -#define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) - -#define PRINTD 0x0001 -#define DEBUG_PARSE 0x0002 - -int cdebug = PRINTD; - -int yylex(void); -static void yyerror(const char *err); -static void zconfprint(const char *err, ...); -static void zconf_error(const char *err, ...); -static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken); - -struct symbol *symbol_hash[SYMBOL_HASHSIZE]; - -static struct menu *current_menu, *current_entry; - - - - -# ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr -# else -# define YY_NULLPTR 0 -# endif -# endif - -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - - -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 1 -#endif -#if YYDEBUG -extern int yydebug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - T_MAINMENU = 258, - T_MENU = 259, - T_ENDMENU = 260, - T_SOURCE = 261, - T_CHOICE = 262, - T_ENDCHOICE = 263, - T_COMMENT = 264, - T_CONFIG = 265, - T_MENUCONFIG = 266, - T_HELP = 267, - T_HELPTEXT = 268, - T_IF = 269, - T_ENDIF = 270, - T_DEPENDS = 271, - T_OPTIONAL = 272, - T_PROMPT = 273, - T_TYPE = 274, - T_DEFAULT = 275, - T_SELECT = 276, - T_IMPLY = 277, - T_RANGE = 278, - T_VISIBLE = 279, - T_OPTION = 280, - T_ON = 281, - T_WORD = 282, - T_WORD_QUOTE = 283, - T_UNEQUAL = 284, - T_LESS = 285, - T_LESS_EQUAL = 286, - T_GREATER = 287, - T_GREATER_EQUAL = 288, - T_CLOSE_PAREN = 289, - T_OPEN_PAREN = 290, - T_EOL = 291, - T_OR = 292, - T_AND = 293, - T_EQUAL = 294, - T_NOT = 295 - }; -#endif - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - -union YYSTYPE -{ - - - char *string; - struct file *file; - struct symbol *symbol; - struct expr *expr; - struct menu *menu; - const struct kconf_id *id; - - -}; - -typedef union YYSTYPE YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - - -extern YYSTYPE yylval; - -int yyparse (void); - - - -/* Copy the second part of user declarations. */ - - -/* Include kconf_id.c here so it can see the token constants. */ -#include "kconf_id.c" - - - -#ifdef short -# undef short -#endif - -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; -#endif - -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; -#else -typedef signed char yytype_int8; -#endif - -#ifdef YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short int yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; -#else -typedef short int yytype_int16; -#endif - -#ifndef YYSIZE_T -# ifdef __SIZE_TYPE__ -# define YYSIZE_T __SIZE_TYPE__ -# elif defined size_t -# define YYSIZE_T size_t -# elif ! defined YYSIZE_T -# include /* INFRINGES ON USER NAME SPACE */ -# define YYSIZE_T size_t -# else -# define YYSIZE_T unsigned int -# endif -#endif - -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) - -#ifndef YY_ -# if defined YYENABLE_NLS && YYENABLE_NLS -# if ENABLE_NLS -# include /* INFRINGES ON USER NAME SPACE */ -# define YY_(Msgid) dgettext ("bison-runtime", Msgid) -# endif -# endif -# ifndef YY_ -# define YY_(Msgid) Msgid -# endif -#endif - -#ifndef YY_ATTRIBUTE -# if (defined __GNUC__ \ - && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \ - || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C -# define YY_ATTRIBUTE(Spec) __attribute__(Spec) -# else -# define YY_ATTRIBUTE(Spec) /* empty */ -# endif -#endif - -#ifndef YY_ATTRIBUTE_PURE -# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__)) -#endif - -#ifndef YY_ATTRIBUTE_UNUSED -# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__)) -#endif - -#if !defined _Noreturn \ - && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112) -# if defined _MSC_VER && 1200 <= _MSC_VER -# define _Noreturn __declspec (noreturn) -# else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) -# endif -#endif - -/* Suppress unused-variable warnings by "using" E. */ -#if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) -#else -# define YYUSE(E) /* empty */ -#endif - -#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__ -/* Suppress an incorrect diagnostic about yylval being uninitialized. */ -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \ - _Pragma ("GCC diagnostic push") \ - _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\ - _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"") -# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ - _Pragma ("GCC diagnostic pop") -#else -# define YY_INITIAL_VALUE(Value) Value -#endif -#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN -# define YY_IGNORE_MAYBE_UNINITIALIZED_END -#endif -#ifndef YY_INITIAL_VALUE -# define YY_INITIAL_VALUE(Value) /* Nothing. */ -#endif - - -#if ! defined yyoverflow || YYERROR_VERBOSE - -/* The parser invokes alloca or malloc; define the necessary symbols. */ - -# ifdef YYSTACK_USE_ALLOCA -# if YYSTACK_USE_ALLOCA -# ifdef __GNUC__ -# define YYSTACK_ALLOC __builtin_alloca -# elif defined __BUILTIN_VA_ARG_INCR -# include /* INFRINGES ON USER NAME SPACE */ -# elif defined _AIX -# define YYSTACK_ALLOC __alloca -# elif defined _MSC_VER -# include /* INFRINGES ON USER NAME SPACE */ -# define alloca _alloca -# else -# define YYSTACK_ALLOC alloca -# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS -# include /* INFRINGES ON USER NAME SPACE */ - /* Use EXIT_SUCCESS as a witness for stdlib.h. */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# endif -# endif -# endif - -# ifdef YYSTACK_ALLOC - /* Pacify GCC's 'empty if-body' warning. */ -# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) -# ifndef YYSTACK_ALLOC_MAXIMUM - /* The OS might guarantee only one guard page at the bottom of the stack, - and a page size can be as small as 4096 bytes. So we cannot safely - invoke alloca (N) if N exceeds 4096. Use a slightly smaller number - to allow for a few compiler-allocated temporary stack slots. */ -# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ -# endif -# else -# define YYSTACK_ALLOC YYMALLOC -# define YYSTACK_FREE YYFREE -# ifndef YYSTACK_ALLOC_MAXIMUM -# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM -# endif -# if (defined __cplusplus && ! defined EXIT_SUCCESS \ - && ! ((defined YYMALLOC || defined malloc) \ - && (defined YYFREE || defined free))) -# include /* INFRINGES ON USER NAME SPACE */ -# ifndef EXIT_SUCCESS -# define EXIT_SUCCESS 0 -# endif -# endif -# ifndef YYMALLOC -# define YYMALLOC malloc -# if ! defined malloc && ! defined EXIT_SUCCESS -void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# ifndef YYFREE -# define YYFREE free -# if ! defined free && ! defined EXIT_SUCCESS -void free (void *); /* INFRINGES ON USER NAME SPACE */ -# endif -# endif -# endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - - -#if (! defined yyoverflow \ - && (! defined __cplusplus \ - || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) - -/* A type that is properly aligned for any stack member. */ -union yyalloc -{ - yytype_int16 yyss_alloc; - YYSTYPE yyvs_alloc; -}; - -/* The size of the maximum gap between one aligned stack and the next. */ -# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) - -/* The size of an array large to enough to hold all stacks, each with - N elements. */ -# define YYSTACK_BYTES(N) \ - ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ - + YYSTACK_GAP_MAXIMUM) - -# define YYCOPY_NEEDED 1 - -/* Relocate STACK from its old location to the new one. The - local variables YYSIZE and YYSTACKSIZE give the old and new number of - elements in the stack, and YYPTR gives the new location of the - stack. Advance YYPTR to a properly aligned location for the next - stack. */ -# define YYSTACK_RELOCATE(Stack_alloc, Stack) \ - do \ - { \ - YYSIZE_T yynewbytes; \ - YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ - Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ - } \ - while (0) - -#endif - -#if defined YYCOPY_NEEDED && YYCOPY_NEEDED -/* Copy COUNT objects from SRC to DST. The source and destination do - not overlap. */ -# ifndef YYCOPY -# if defined __GNUC__ && 1 < __GNUC__ -# define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) -# else -# define YYCOPY(Dst, Src, Count) \ - do \ - { \ - YYSIZE_T yyi; \ - for (yyi = 0; yyi < (Count); yyi++) \ - (Dst)[yyi] = (Src)[yyi]; \ - } \ - while (0) -# endif -# endif -#endif /* !YYCOPY_NEEDED */ - -/* YYFINAL -- State number of the termination state. */ -#define YYFINAL 11 -/* YYLAST -- Last index in YYTABLE. */ -#define YYLAST 325 - -/* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 41 -/* YYNNTS -- Number of nonterminals. */ -#define YYNNTS 52 -/* YYNRULES -- Number of rules. */ -#define YYNRULES 126 -/* YYNSTATES -- Number of states. */ -#define YYNSTATES 206 - -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 295 - -#define YYTRANSLATE(YYX) \ - ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) - -/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM - as returned by yylex, without out-of-bounds checking. */ -static const yytype_uint8 yytranslate[] = -{ - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, - 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, - 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40 -}; - -#if YYDEBUG - /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = -{ - 0, 110, 110, 110, 112, 112, 116, 124, 134, 136, - 137, 138, 139, 140, 141, 145, 149, 149, 149, 149, - 149, 149, 149, 149, 149, 153, 154, 155, 156, 157, - 158, 162, 163, 169, 176, 181, 188, 197, 199, 200, - 201, 202, 203, 204, 207, 215, 221, 231, 237, 243, - 249, 252, 254, 267, 268, 273, 283, 288, 296, 299, - 301, 302, 303, 304, 305, 308, 314, 325, 331, 341, - 343, 348, 356, 364, 367, 369, 370, 371, 376, 383, - 388, 396, 399, 401, 402, 403, 406, 415, 422, 427, - 433, 451, 453, 454, 455, 458, 466, 468, 469, 472, - 479, 481, 486, 487, 490, 491, 492, 496, 497, 500, - 501, 504, 505, 506, 507, 508, 509, 510, 511, 512, - 513, 514, 518, 520, 521, 524, 525 -}; -#endif - -#if YYDEBUG || YYERROR_VERBOSE || 0 -/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. - First, the terminals, then, starting at YYNTOKENS, nonterminals. */ -static const char *const yytname[] = -{ - "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU", - "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG", - "T_MENUCONFIG", "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", - "T_OPTIONAL", "T_PROMPT", "T_TYPE", "T_DEFAULT", "T_SELECT", "T_IMPLY", - "T_RANGE", "T_VISIBLE", "T_OPTION", "T_ON", "T_WORD", "T_WORD_QUOTE", - "T_UNEQUAL", "T_LESS", "T_LESS_EQUAL", "T_GREATER", "T_GREATER_EQUAL", - "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_EOL", "T_OR", "T_AND", "T_EQUAL", - "T_NOT", "$accept", "input", "start", "mainmenu_stmt", - "no_mainmenu_stmt", "stmt_list", "option_name", "common_stmt", - "option_error", "config_entry_start", "config_stmt", - "menuconfig_entry_start", "menuconfig_stmt", "config_option_list", - "config_option", "symbol_option", "symbol_option_list", - "symbol_option_arg", "choice", "choice_entry", "choice_end", - "choice_stmt", "choice_option_list", "choice_option", "choice_block", - "if_entry", "if_end", "if_stmt", "if_block", "menu", "menu_entry", - "menu_end", "menu_stmt", "menu_block", "source_stmt", "comment", - "comment_stmt", "help_start", "help", "depends_list", "depends", - "visibility_list", "visible", "prompt_stmt_opt", "prompt", "end", "nl", - "if_expr", "expr", "nonconst_symbol", "symbol", "word_opt", YY_NULLPTR -}; -#endif - -# ifdef YYPRINT -/* YYTOKNUM[NUM] -- (External) token number corresponding to the - (internal) symbol number NUM (which must be that of a token). */ -static const yytype_uint16 yytoknum[] = -{ - 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, - 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, - 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, - 295 -}; -# endif - -#define YYPACT_NINF -92 - -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-92))) - -#define YYTABLE_NINF -89 - -#define yytable_value_is_error(Yytable_value) \ - 0 - - /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing - STATE-NUM. */ -static const yytype_int16 yypact[] = -{ - 20, 33, -92, 16, -92, -92, -92, 21, -92, -92, - 29, -92, 152, 186, -92, -92, 40, 67, 33, 71, - 33, 42, 80, 33, 78, 78, 31, 82, -92, -92, - -92, -92, -92, -92, -92, -92, -92, 120, -92, 131, - -92, -92, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92, -92, -92, 109, -92, - 118, -92, 128, -92, 129, -92, 141, 142, -92, 31, - 31, 74, -92, 69, -92, 144, 145, 28, 119, 248, - 286, 77, 38, 77, 219, -92, -92, -92, -92, -92, - -92, -7, -92, 31, 31, 40, 52, 52, 52, 52, - 52, 52, -92, -92, 146, 147, 158, 33, 33, 31, - 78, 78, 52, -92, 184, -92, -92, -92, -92, 176, - -92, -92, 162, 33, 33, 78, -92, -92, -92, -92, - -92, -92, -92, -92, -92, -92, -92, -92, -92, 197, - -92, 272, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, 174, -92, -92, -92, -92, -92, -92, -92, - -92, -92, 31, 197, 178, 197, 59, 197, 197, 52, - 27, 179, -92, -92, 197, 180, 197, 31, -92, 111, - 181, -92, -92, 182, 185, 195, 197, 193, -92, -92, - 208, -92, 209, 113, -92, -92, -92, -92, -92, 211, - 33, -92, -92, -92, -92, -92 -}; - - /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM. - Performed when YYTABLE does not specify something else to do. Zero - means the default is an error. */ -static const yytype_uint8 yydefact[] = -{ - 7, 0, 107, 0, 3, 8, 8, 7, 102, 103, - 0, 1, 0, 0, 108, 2, 6, 0, 0, 0, - 0, 125, 0, 0, 0, 0, 0, 0, 16, 21, - 17, 18, 23, 19, 20, 22, 24, 0, 25, 0, - 9, 37, 28, 37, 29, 59, 69, 10, 74, 26, - 96, 82, 11, 30, 91, 27, 12, 15, 0, 104, - 0, 126, 0, 105, 0, 122, 0, 0, 124, 0, - 0, 0, 123, 111, 106, 0, 0, 0, 0, 0, - 0, 0, 91, 0, 0, 78, 86, 55, 87, 33, - 35, 0, 119, 0, 0, 71, 0, 0, 0, 0, - 0, 0, 13, 14, 0, 0, 0, 0, 100, 0, - 0, 0, 0, 51, 0, 43, 42, 38, 39, 0, - 41, 40, 0, 0, 100, 0, 63, 64, 60, 62, - 61, 70, 58, 57, 75, 77, 73, 76, 72, 109, - 98, 0, 97, 83, 85, 81, 84, 80, 93, 94, - 92, 118, 120, 121, 117, 112, 113, 114, 115, 116, - 32, 89, 0, 109, 0, 109, 109, 109, 109, 0, - 0, 0, 90, 67, 109, 0, 109, 0, 99, 0, - 0, 44, 101, 0, 0, 0, 109, 53, 50, 31, - 0, 66, 0, 110, 95, 45, 46, 47, 48, 0, - 0, 52, 65, 68, 49, 54 -}; - - /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int16 yypgoto[] = -{ - -92, -92, 241, -92, -92, 244, -92, -13, -66, -92, - -92, -92, -92, 218, -92, -92, -92, -92, -92, -92, - -92, -69, -92, -92, -92, -92, -92, -92, -92, -92, - -92, -92, 12, -92, -92, -92, -92, -92, 172, 170, - -64, -92, -92, 148, -1, 34, 1, 139, -68, -21, - -91, -92 -}; - - /* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = -{ - -1, 3, 4, 5, 6, 12, 39, 40, 116, 41, - 42, 43, 44, 77, 117, 118, 170, 201, 45, 46, - 132, 47, 79, 128, 80, 48, 136, 49, 81, 50, - 51, 145, 52, 83, 53, 54, 55, 119, 120, 84, - 121, 82, 142, 164, 165, 56, 7, 178, 71, 72, - 73, 62 -}; - - /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If - positive, shift that token. If negative, reduce the rule whose - number is the opposite. If YYTABLE_NINF, syntax error. */ -static const yytype_int16 yytable[] = -{ - 10, 91, 92, 66, 67, 154, 155, 156, 157, 158, - 159, 16, 135, 127, 144, 130, 11, 58, 149, 60, - 150, 169, 64, 1, 1, 152, 153, 151, -34, 104, - 93, 94, -34, -34, -34, -34, -34, -34, -34, -34, - 105, 166, -34, -34, 106, -34, 107, 108, 109, 110, - 111, 112, -34, 113, 187, 114, 2, 14, 65, 68, - 8, 9, 139, 188, 115, 2, 69, 131, 134, 61, - 143, 70, 95, 177, 140, 149, 14, 150, 186, 65, - 68, 18, 19, 20, 21, 22, 23, 24, 25, 167, - 168, 26, 27, 137, 179, 146, 93, 94, 96, 97, - 98, 99, 100, 57, 176, 65, 163, 59, 101, 193, - 2, 93, 94, 38, 133, 138, 63, 147, 74, -36, - 104, 75, 174, -36, -36, -36, -36, -36, -36, -36, - -36, 105, 76, -36, -36, 106, -36, 107, 108, 109, - 110, 111, 112, -36, 113, 85, 114, 194, 93, 94, - 93, 94, -4, 17, 86, 115, 18, 19, 20, 21, - 22, 23, 24, 25, 87, 88, 26, 27, 28, 29, - 30, 31, 32, 33, 34, 35, 36, 89, 90, 37, - 102, 103, 160, 161, 162, 171, -5, 17, 38, 172, - 18, 19, 20, 21, 22, 23, 24, 25, 173, 205, - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 177, 94, 37, 181, 189, 191, 195, 196, -88, - 104, 197, 38, -88, -88, -88, -88, -88, -88, -88, - -88, 198, 200, -88, -88, 106, -88, -88, -88, -88, - -88, -88, -88, -88, 202, 203, 114, 204, 15, 104, - 13, 129, 141, -56, -56, 148, -56, -56, -56, -56, - 105, 78, -56, -56, 106, 122, 123, 124, 125, 0, - 0, 0, 175, 104, 0, 114, -79, -79, -79, -79, - -79, -79, -79, -79, 126, 0, -79, -79, 106, 0, - 0, 19, 20, 0, 22, 23, 24, 25, 0, 114, - 26, 27, 180, 0, 182, 183, 184, 185, 148, 0, - 0, 0, 0, 190, 0, 192, 0, 0, 0, 0, - 0, 0, 38, 0, 0, 199 -}; - -static const yytype_int16 yycheck[] = -{ - 1, 69, 70, 24, 25, 96, 97, 98, 99, 100, - 101, 10, 81, 79, 83, 79, 0, 18, 84, 20, - 84, 112, 23, 3, 3, 93, 94, 34, 0, 1, - 37, 38, 4, 5, 6, 7, 8, 9, 10, 11, - 12, 109, 14, 15, 16, 17, 18, 19, 20, 21, - 22, 23, 24, 25, 27, 27, 36, 36, 27, 28, - 27, 28, 24, 36, 36, 36, 35, 80, 81, 27, - 83, 40, 71, 14, 36, 141, 36, 141, 169, 27, - 28, 4, 5, 6, 7, 8, 9, 10, 11, 110, - 111, 14, 15, 81, 162, 83, 37, 38, 29, 30, - 31, 32, 33, 36, 125, 27, 107, 36, 39, 177, - 36, 37, 38, 36, 80, 81, 36, 83, 36, 0, - 1, 1, 123, 4, 5, 6, 7, 8, 9, 10, - 11, 12, 1, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 25, 36, 27, 36, 37, 38, - 37, 38, 0, 1, 36, 36, 4, 5, 6, 7, - 8, 9, 10, 11, 36, 36, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 36, 36, 27, - 36, 36, 36, 36, 26, 1, 0, 1, 36, 13, - 4, 5, 6, 7, 8, 9, 10, 11, 36, 200, - 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, - 24, 14, 38, 27, 36, 36, 36, 36, 36, 0, - 1, 36, 36, 4, 5, 6, 7, 8, 9, 10, - 11, 36, 39, 14, 15, 16, 17, 18, 19, 20, - 21, 22, 23, 24, 36, 36, 27, 36, 7, 1, - 6, 79, 82, 5, 6, 36, 8, 9, 10, 11, - 12, 43, 14, 15, 16, 17, 18, 19, 20, -1, - -1, -1, 124, 1, -1, 27, 4, 5, 6, 7, - 8, 9, 10, 11, 36, -1, 14, 15, 16, -1, - -1, 5, 6, -1, 8, 9, 10, 11, -1, 27, - 14, 15, 163, -1, 165, 166, 167, 168, 36, -1, - -1, -1, -1, 174, -1, 176, -1, -1, -1, -1, - -1, -1, 36, -1, -1, 186 -}; - - /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing - symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = -{ - 0, 3, 36, 42, 43, 44, 45, 87, 27, 28, - 85, 0, 46, 46, 36, 43, 87, 1, 4, 5, - 6, 7, 8, 9, 10, 11, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 27, 36, 47, - 48, 50, 51, 52, 53, 59, 60, 62, 66, 68, - 70, 71, 73, 75, 76, 77, 86, 36, 85, 36, - 85, 27, 92, 36, 85, 27, 90, 90, 28, 35, - 40, 89, 90, 91, 36, 1, 1, 54, 54, 63, - 65, 69, 82, 74, 80, 36, 36, 36, 36, 36, - 36, 89, 89, 37, 38, 87, 29, 30, 31, 32, - 33, 39, 36, 36, 1, 12, 16, 18, 19, 20, - 21, 22, 23, 25, 27, 36, 49, 55, 56, 78, - 79, 81, 17, 18, 19, 20, 36, 49, 64, 79, - 81, 48, 61, 86, 48, 62, 67, 73, 86, 24, - 36, 80, 83, 48, 62, 72, 73, 86, 36, 49, - 81, 34, 89, 89, 91, 91, 91, 91, 91, 91, - 36, 36, 26, 85, 84, 85, 89, 90, 90, 91, - 57, 1, 13, 36, 85, 84, 90, 14, 88, 89, - 88, 36, 88, 88, 88, 88, 91, 27, 36, 36, - 88, 36, 88, 89, 36, 36, 36, 36, 36, 88, - 39, 58, 36, 36, 36, 85 -}; - - /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = -{ - 0, 41, 42, 42, 43, 43, 44, 45, 46, 46, - 46, 46, 46, 46, 46, 46, 47, 47, 47, 47, - 47, 47, 47, 47, 47, 48, 48, 48, 48, 48, - 48, 49, 49, 50, 51, 52, 53, 54, 54, 54, - 54, 54, 54, 54, 55, 55, 55, 55, 55, 55, - 56, 57, 57, 58, 58, 59, 60, 61, 62, 63, - 63, 63, 63, 63, 63, 64, 64, 64, 64, 65, - 65, 66, 67, 68, 69, 69, 69, 69, 70, 71, - 72, 73, 74, 74, 74, 74, 75, 76, 77, 78, - 79, 80, 80, 80, 80, 81, 82, 82, 82, 83, - 84, 84, 85, 85, 86, 86, 86, 87, 87, 88, - 88, 89, 89, 89, 89, 89, 89, 89, 89, 89, - 89, 89, 90, 91, 91, 92, 92 -}; - - /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = -{ - 0, 2, 2, 1, 2, 2, 3, 0, 0, 2, - 2, 2, 2, 4, 4, 3, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 3, 2, 3, 2, 3, 2, 0, 2, 2, - 2, 2, 2, 2, 3, 4, 4, 4, 4, 5, - 3, 0, 3, 0, 2, 3, 2, 1, 3, 0, - 2, 2, 2, 2, 2, 4, 3, 2, 4, 0, - 2, 3, 1, 3, 0, 2, 2, 2, 3, 3, - 1, 3, 0, 2, 2, 2, 3, 3, 2, 2, - 2, 0, 2, 2, 2, 4, 0, 2, 2, 2, - 0, 2, 1, 1, 2, 2, 2, 1, 2, 0, - 2, 1, 3, 3, 3, 3, 3, 3, 3, 2, - 3, 3, 1, 1, 1, 0, 1 -}; - - -#define yyerrok (yyerrstatus = 0) -#define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 - -#define YYACCEPT goto yyacceptlab -#define YYABORT goto yyabortlab -#define YYERROR goto yyerrorlab - - -#define YYRECOVERING() (!!yyerrstatus) - -#define YYBACKUP(Token, Value) \ -do \ - if (yychar == YYEMPTY) \ - { \ - yychar = (Token); \ - yylval = (Value); \ - YYPOPSTACK (yylen); \ - yystate = *yyssp; \ - goto yybackup; \ - } \ - else \ - { \ - yyerror (YY_("syntax error: cannot back up")); \ - YYERROR; \ - } \ -while (0) - -/* Error token number */ -#define YYTERROR 1 -#define YYERRCODE 256 - - - -/* Enable debugging if requested. */ -#if YYDEBUG - -# ifndef YYFPRINTF -# include /* INFRINGES ON USER NAME SPACE */ -# define YYFPRINTF fprintf -# endif - -# define YYDPRINTF(Args) \ -do { \ - if (yydebug) \ - YYFPRINTF Args; \ -} while (0) - -/* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif - - -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ -do { \ - if (yydebug) \ - { \ - YYFPRINTF (stderr, "%s ", Title); \ - yy_symbol_print (stderr, \ - Type, Value); \ - YYFPRINTF (stderr, "\n"); \ - } \ -} while (0) - - -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ - -static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -{ - FILE *yyo = yyoutput; - YYUSE (yyo); - if (!yyvaluep) - return; -# ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); -# endif - YYUSE (yytype); -} - - -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ - -static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) -{ - YYFPRINTF (yyoutput, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); - - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); -} - -/*------------------------------------------------------------------. -| yy_stack_print -- Print the state stack from its BOTTOM up to its | -| TOP (included). | -`------------------------------------------------------------------*/ - -static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) -{ - YYFPRINTF (stderr, "Stack now"); - for (; yybottom <= yytop; yybottom++) - { - int yybot = *yybottom; - YYFPRINTF (stderr, " %d", yybot); - } - YYFPRINTF (stderr, "\n"); -} - -# define YY_STACK_PRINT(Bottom, Top) \ -do { \ - if (yydebug) \ - yy_stack_print ((Bottom), (Top)); \ -} while (0) - - -/*------------------------------------------------. -| Report that the YYRULE is going to be reduced. | -`------------------------------------------------*/ - -static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) -{ - unsigned long int yylno = yyrline[yyrule]; - int yynrhs = yyr2[yyrule]; - int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", - yyrule - 1, yylno); - /* The symbols being reduced. */ - for (yyi = 0; yyi < yynrhs; yyi++) - { - YYFPRINTF (stderr, " $%d = ", yyi + 1); - yy_symbol_print (stderr, - yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); - YYFPRINTF (stderr, "\n"); - } -} - -# define YY_REDUCE_PRINT(Rule) \ -do { \ - if (yydebug) \ - yy_reduce_print (yyssp, yyvsp, Rule); \ -} while (0) - -/* Nonzero means print parse trace. It is left uninitialized so that - multiple parsers can coexist. */ -int yydebug; -#else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) -# define YY_STACK_PRINT(Bottom, Top) -# define YY_REDUCE_PRINT(Rule) -#endif /* !YYDEBUG */ - - -/* YYINITDEPTH -- initial size of the parser's stacks. */ -#ifndef YYINITDEPTH -# define YYINITDEPTH 200 -#endif - -/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only - if the built-in stack extension method is used). - - Do not make this value too large; the results are undefined if - YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) - evaluated with infinite-precision integer arithmetic. */ - -#ifndef YYMAXDEPTH -# define YYMAXDEPTH 10000 -#endif - - -#if YYERROR_VERBOSE - -# ifndef yystrlen -# if defined __GLIBC__ && defined _STRING_H -# define yystrlen strlen -# else -/* Return the length of YYSTR. */ -static YYSIZE_T -yystrlen (const char *yystr) -{ - YYSIZE_T yylen; - for (yylen = 0; yystr[yylen]; yylen++) - continue; - return yylen; -} -# endif -# endif - -# ifndef yystpcpy -# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE -# define yystpcpy stpcpy -# else -/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in - YYDEST. */ -static char * -yystpcpy (char *yydest, const char *yysrc) -{ - char *yyd = yydest; - const char *yys = yysrc; - - while ((*yyd++ = *yys++) != '\0') - continue; - - return yyd - 1; -} -# endif -# endif - -# ifndef yytnamerr -/* Copy to YYRES the contents of YYSTR after stripping away unnecessary - quotes and backslashes, so that it's suitable for yyerror. The - heuristic is that double-quoting is unnecessary unless the string - contains an apostrophe, a comma, or backslash (other than - backslash-backslash). YYSTR is taken from yytname. If YYRES is - null, do not copy; instead, return the length of what the result - would have been. */ -static YYSIZE_T -yytnamerr (char *yyres, const char *yystr) -{ - if (*yystr == '"') - { - YYSIZE_T yyn = 0; - char const *yyp = yystr; - - for (;;) - switch (*++yyp) - { - case '\'': - case ',': - goto do_not_strip_quotes; - - case '\\': - if (*++yyp != '\\') - goto do_not_strip_quotes; - /* Fall through. */ - default: - if (yyres) - yyres[yyn] = *yyp; - yyn++; - break; - - case '"': - if (yyres) - yyres[yyn] = '\0'; - return yyn; - } - do_not_strip_quotes: ; - } - - if (! yyres) - return yystrlen (yystr); - - return yystpcpy (yyres, yystr) - yyres; -} -# endif - -/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message - about the unexpected token YYTOKEN for the state stack whose top is - YYSSP. - - Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is - not large enough to hold the message. In that case, also set - *YYMSG_ALLOC to the required number of bytes. Return 2 if the - required number of bytes is too large to store. */ -static int -yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg, - yytype_int16 *yyssp, int yytoken) -{ - YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]); - YYSIZE_T yysize = yysize0; - enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; - /* Internationalized format string. */ - const char *yyformat = YY_NULLPTR; - /* Arguments of yyformat. */ - char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; - /* Number of reported tokens (one for the "unexpected", one per - "expected"). */ - int yycount = 0; - - /* There are many possibilities here to consider: - - If this state is a consistent state with a default action, then - the only way this function was invoked is if the default action - is an error action. In that case, don't check for expected - tokens because there are none. - - The only way there can be no lookahead present (in yychar) is if - this state is a consistent state with a default action. Thus, - detecting the absence of a lookahead is sufficient to determine - that there is no unexpected or expected token to report. In that - case, just report a simple "syntax error". - - Don't assume there isn't a lookahead just because this state is a - consistent state with a default action. There might have been a - previous inconsistent state, consistent state with a non-default - action, or user semantic action that manipulated yychar. - - Of course, the expected token list depends on states to have - correct lookahead information, and it depends on the parser not - to perform extra reductions after fetching a lookahead from the - scanner and before detecting a syntax error. Thus, state merging - (from LALR or IELR) and default reductions corrupt the expected - token list. However, the list is correct for canonical LR with - one exception: it will still contain any token that will not be - accepted due to an error action in a later state. - */ - if (yytoken != YYEMPTY) - { - int yyn = yypact[*yyssp]; - yyarg[yycount++] = yytname[yytoken]; - if (!yypact_value_is_default (yyn)) - { - /* Start YYX at -YYN if negative to avoid negative indexes in - YYCHECK. In other words, skip the first -YYN actions for - this state because they are default actions. */ - int yyxbegin = yyn < 0 ? -yyn : 0; - /* Stay within bounds of both yycheck and yytname. */ - int yychecklim = YYLAST - yyn + 1; - int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; - int yyx; - - for (yyx = yyxbegin; yyx < yyxend; ++yyx) - if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR - && !yytable_value_is_error (yytable[yyx + yyn])) - { - if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) - { - yycount = 1; - yysize = yysize0; - break; - } - yyarg[yycount++] = yytname[yyx]; - { - YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]); - if (! (yysize <= yysize1 - && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - } - } - } - - switch (yycount) - { -# define YYCASE_(N, S) \ - case N: \ - yyformat = S; \ - break - YYCASE_(0, YY_("syntax error")); - YYCASE_(1, YY_("syntax error, unexpected %s")); - YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s")); - YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s")); - YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s")); - YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s")); -# undef YYCASE_ - } - - { - YYSIZE_T yysize1 = yysize + yystrlen (yyformat); - if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)) - return 2; - yysize = yysize1; - } - - if (*yymsg_alloc < yysize) - { - *yymsg_alloc = 2 * yysize; - if (! (yysize <= *yymsg_alloc - && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM)) - *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM; - return 1; - } - - /* Avoid sprintf, as that infringes on the user's name space. - Don't have undefined behavior even if the translation - produced a string with the wrong number of "%s"s. */ - { - char *yyp = *yymsg; - int yyi = 0; - while ((*yyp = *yyformat) != '\0') - if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount) - { - yyp += yytnamerr (yyp, yyarg[yyi++]); - yyformat += 2; - } - else - { - yyp++; - yyformat++; - } - } - return 0; -} -#endif /* YYERROR_VERBOSE */ - -/*-----------------------------------------------. -| Release the memory associated to this symbol. | -`-----------------------------------------------*/ - -static void -yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) -{ - YYUSE (yyvaluep); - if (!yymsg) - yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - switch (yytype) - { - case 60: /* choice_entry */ - - { - fprintf(stderr, "%s:%d: missing end statement for this entry\n", - ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno); - if (current_menu == ((*yyvaluep).menu)) - menu_end_menu(); -} - - break; - - case 66: /* if_entry */ - - { - fprintf(stderr, "%s:%d: missing end statement for this entry\n", - ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno); - if (current_menu == ((*yyvaluep).menu)) - menu_end_menu(); -} - - break; - - case 71: /* menu_entry */ - - { - fprintf(stderr, "%s:%d: missing end statement for this entry\n", - ((*yyvaluep).menu)->file->name, ((*yyvaluep).menu)->lineno); - if (current_menu == ((*yyvaluep).menu)) - menu_end_menu(); -} - - break; - - - default: - break; - } - YY_IGNORE_MAYBE_UNINITIALIZED_END -} - - - - -/* The lookahead symbol. */ -int yychar; - -/* The semantic value of the lookahead symbol. */ -YYSTYPE yylval; -/* Number of syntax errors so far. */ -int yynerrs; - - -/*----------. -| yyparse. | -`----------*/ - -int -yyparse (void) -{ - int yystate; - /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; - - /* The stacks and their tools: - 'yyss': related to states. - 'yyvs': related to semantic values. - - Refer to the stacks through separate pointers, to allow yyoverflow - to reallocate them elsewhere. */ - - /* The state stack. */ - yytype_int16 yyssa[YYINITDEPTH]; - yytype_int16 *yyss; - yytype_int16 *yyssp; - - /* The semantic value stack. */ - YYSTYPE yyvsa[YYINITDEPTH]; - YYSTYPE *yyvs; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; - - int yyn; - int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; - /* The variables used to return semantic value and location from the - action routines. */ - YYSTYPE yyval; - -#if YYERROR_VERBOSE - /* Buffer for error messages, and its allocated size. */ - char yymsgbuf[128]; - char *yymsg = yymsgbuf; - YYSIZE_T yymsg_alloc = sizeof yymsgbuf; -#endif - -#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) - - /* The number of symbols on the RHS of the reduced rule. - Keep to zero when no symbol should be popped. */ - int yylen = 0; - - yyssp = yyss = yyssa; - yyvsp = yyvs = yyvsa; - yystacksize = YYINITDEPTH; - - YYDPRINTF ((stderr, "Starting parse\n")); - - yystate = 0; - yyerrstatus = 0; - yynerrs = 0; - yychar = YYEMPTY; /* Cause a token to be read. */ - goto yysetstate; - -/*------------------------------------------------------------. -| yynewstate -- Push a new state, which is found in yystate. | -`------------------------------------------------------------*/ - yynewstate: - /* In all cases, when you get here, the value and location stacks - have just been pushed. So pushing a state here evens the stacks. */ - yyssp++; - - yysetstate: - *yyssp = yystate; - - if (yyss + yystacksize - 1 <= yyssp) - { - /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; - -#ifdef yyoverflow - { - /* Give user a chance to reallocate the stack. Use copies of - these so that the &'s don't force the real ones into - memory. */ - YYSTYPE *yyvs1 = yyvs; - yytype_int16 *yyss1 = yyss; - - /* Each stack pointer address is followed by the size of the - data in use in that stack, in bytes. This used to be a - conditional around just the two extra args, but that might - be undefined if yyoverflow is a macro. */ - yyoverflow (YY_("memory exhausted"), - &yyss1, yysize * sizeof (*yyssp), - &yyvs1, yysize * sizeof (*yyvsp), - &yystacksize); - - yyss = yyss1; - yyvs = yyvs1; - } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else - /* Extend the stack our own way. */ - if (YYMAXDEPTH <= yystacksize) - goto yyexhaustedlab; - yystacksize *= 2; - if (YYMAXDEPTH < yystacksize) - yystacksize = YYMAXDEPTH; - - { - yytype_int16 *yyss1 = yyss; - union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); - if (! yyptr) - goto yyexhaustedlab; - YYSTACK_RELOCATE (yyss_alloc, yyss); - YYSTACK_RELOCATE (yyvs_alloc, yyvs); -# undef YYSTACK_RELOCATE - if (yyss1 != yyssa) - YYSTACK_FREE (yyss1); - } -# endif -#endif /* no yyoverflow */ - - yyssp = yyss + yysize - 1; - yyvsp = yyvs + yysize - 1; - - YYDPRINTF ((stderr, "Stack size increased to %lu\n", - (unsigned long int) yystacksize)); - - if (yyss + yystacksize - 1 <= yyssp) - YYABORT; - } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); - - if (yystate == YYFINAL) - YYACCEPT; - - goto yybackup; - -/*-----------. -| yybackup. | -`-----------*/ -yybackup: - - /* Do appropriate processing given the current state. Read a - lookahead token if we need one and don't already have one. */ - - /* First try to decide what to do without reference to lookahead token. */ - yyn = yypact[yystate]; - if (yypact_value_is_default (yyn)) - goto yydefault; - - /* Not known => get a lookahead token if don't already have one. */ - - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ - if (yychar == YYEMPTY) - { - YYDPRINTF ((stderr, "Reading a token: ")); - yychar = yylex (); - } - - if (yychar <= YYEOF) - { - yychar = yytoken = YYEOF; - YYDPRINTF ((stderr, "Now at end of input.\n")); - } - else - { - yytoken = YYTRANSLATE (yychar); - YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); - } - - /* If the proper action on seeing token YYTOKEN is to reduce or to - detect an error, take that action. */ - yyn += yytoken; - if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) - goto yydefault; - yyn = yytable[yyn]; - if (yyn <= 0) - { - if (yytable_value_is_error (yyn)) - goto yyerrlab; - yyn = -yyn; - goto yyreduce; - } - - /* Count tokens shifted since error; after three, turn off error - status. */ - if (yyerrstatus) - yyerrstatus--; - - /* Shift the lookahead token. */ - YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); - - /* Discard the shifted token. */ - yychar = YYEMPTY; - - yystate = yyn; - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - goto yynewstate; - - -/*-----------------------------------------------------------. -| yydefault -- do the default action for the current state. | -`-----------------------------------------------------------*/ -yydefault: - yyn = yydefact[yystate]; - if (yyn == 0) - goto yyerrlab; - goto yyreduce; - - -/*-----------------------------. -| yyreduce -- Do a reduction. | -`-----------------------------*/ -yyreduce: - /* yyn is the number of a rule to reduce with. */ - yylen = yyr2[yyn]; - - /* If YYLEN is nonzero, implement the default value of the action: - '$$ = $1'. - - Otherwise, the following line sets YYVAL to garbage. - This behavior is undocumented and Bison - users should not rely upon it. Assigning to YYVAL - unconditionally makes the parser a bit smaller, and it avoids a - GCC warning that YYVAL may be used uninitialized. */ - yyval = yyvsp[1-yylen]; - - - YY_REDUCE_PRINT (yyn); - switch (yyn) - { - case 6: - - { - menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL); -} - - break; - - case 7: - - { - /* - * Hack: Keep the main menu title on the heap so we can safely free it - * later regardless of whether it comes from the 'prompt' in - * mainmenu_stmt or here - */ - menu_add_prompt(P_MENU, xstrdup("Buildroot Configuration"), NULL); -} - - break; - - case 12: - - { zconf_error("unexpected end statement"); } - - break; - - case 13: - - { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); } - - break; - - case 14: - - { - zconf_error("unexpected option \"%s\"", (yyvsp[-2].id)->name); -} - - break; - - case 15: - - { zconf_error("invalid statement"); } - - break; - - case 31: - - { zconf_error("unknown option \"%s\"", (yyvsp[-2].string)); } - - break; - - case 32: - - { zconf_error("invalid option"); } - - break; - - case 33: - - { - (yyvsp[-1].symbol)->flags |= SYMBOL_OPTIONAL; - menu_add_entry((yyvsp[-1].symbol)); - printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].symbol)->name); -} - - break; - - case 34: - - { - printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); -} - - break; - - case 35: - - { - (yyvsp[-1].symbol)->flags |= SYMBOL_OPTIONAL; - menu_add_entry((yyvsp[-1].symbol)); - printd(DEBUG_PARSE, "%s:%d:menuconfig %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].symbol)->name); -} - - break; - - case 36: - - { - if (current_entry->prompt) - current_entry->prompt->type = P_MENU; - else - zconfprint("warning: menuconfig statement without prompt"); - printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); -} - - break; - - case 44: - - { - menu_set_type((yyvsp[-2].id)->stype); - printd(DEBUG_PARSE, "%s:%d:type(%u)\n", - zconf_curname(), zconf_lineno(), - (yyvsp[-2].id)->stype); -} - - break; - - case 45: - - { - menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); - printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); -} - - break; - - case 46: - - { - menu_add_expr(P_DEFAULT, (yyvsp[-2].expr), (yyvsp[-1].expr)); - if ((yyvsp[-3].id)->stype != S_UNKNOWN) - menu_set_type((yyvsp[-3].id)->stype); - printd(DEBUG_PARSE, "%s:%d:default(%u)\n", - zconf_curname(), zconf_lineno(), - (yyvsp[-3].id)->stype); -} - - break; - - case 47: - - { - menu_add_symbol(P_SELECT, (yyvsp[-2].symbol), (yyvsp[-1].expr)); - printd(DEBUG_PARSE, "%s:%d:select\n", zconf_curname(), zconf_lineno()); -} - - break; - - case 48: - - { - menu_add_symbol(P_IMPLY, (yyvsp[-2].symbol), (yyvsp[-1].expr)); - printd(DEBUG_PARSE, "%s:%d:imply\n", zconf_curname(), zconf_lineno()); -} - - break; - - case 49: - - { - menu_add_expr(P_RANGE, expr_alloc_comp(E_RANGE,(yyvsp[-3].symbol), (yyvsp[-2].symbol)), (yyvsp[-1].expr)); - printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno()); -} - - break; - - case 52: - - { - const struct kconf_id *id = kconf_id_lookup((yyvsp[-1].string), strlen((yyvsp[-1].string))); - if (id && id->flags & TF_OPTION) { - menu_add_option(id->token, (yyvsp[0].string)); - free((yyvsp[0].string)); - } - else - zconfprint("warning: ignoring unknown option %s", (yyvsp[-1].string)); - free((yyvsp[-1].string)); -} - - break; - - case 53: - - { (yyval.string) = NULL; } - - break; - - case 54: - - { (yyval.string) = (yyvsp[0].string); } - - break; - - case 55: - - { - struct symbol *sym = sym_lookup((yyvsp[-1].string), SYMBOL_CHOICE); - sym->flags |= SYMBOL_AUTO; - menu_add_entry(sym); - menu_add_expr(P_CHOICE, NULL, NULL); - free((yyvsp[-1].string)); - printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); -} - - break; - - case 56: - - { - (yyval.menu) = menu_add_menu(); -} - - break; - - case 57: - - { - if (zconf_endtoken((yyvsp[0].id), T_CHOICE, T_ENDCHOICE)) { - menu_end_menu(); - printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno()); - } -} - - break; - - case 65: - - { - menu_add_prompt(P_PROMPT, (yyvsp[-2].string), (yyvsp[-1].expr)); - printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); -} - - break; - - case 66: - - { - if ((yyvsp[-2].id)->stype == S_BOOLEAN || (yyvsp[-2].id)->stype == S_TRISTATE) { - menu_set_type((yyvsp[-2].id)->stype); - printd(DEBUG_PARSE, "%s:%d:type(%u)\n", - zconf_curname(), zconf_lineno(), - (yyvsp[-2].id)->stype); - } else - YYERROR; -} - - break; - - case 67: - - { - current_entry->sym->flags |= SYMBOL_OPTIONAL; - printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno()); -} - - break; - - case 68: - - { - if ((yyvsp[-3].id)->stype == S_UNKNOWN) { - menu_add_symbol(P_DEFAULT, (yyvsp[-2].symbol), (yyvsp[-1].expr)); - printd(DEBUG_PARSE, "%s:%d:default\n", - zconf_curname(), zconf_lineno()); - } else - YYERROR; -} - - break; - - case 71: - - { - printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); - menu_add_entry(NULL); - menu_add_dep((yyvsp[-1].expr)); - (yyval.menu) = menu_add_menu(); -} - - break; - - case 72: - - { - if (zconf_endtoken((yyvsp[0].id), T_IF, T_ENDIF)) { - menu_end_menu(); - printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno()); - } -} - - break; - - case 78: - - { - menu_add_entry(NULL); - menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL); - printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); -} - - break; - - case 79: - - { - (yyval.menu) = menu_add_menu(); -} - - break; - - case 80: - - { - if (zconf_endtoken((yyvsp[0].id), T_MENU, T_ENDMENU)) { - menu_end_menu(); - printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno()); - } -} - - break; - - case 86: - - { - printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), (yyvsp[-1].string)); - zconf_nextfile((yyvsp[-1].string)); - free((yyvsp[-1].string)); -} - - break; - - case 87: - - { - menu_add_entry(NULL); - menu_add_prompt(P_COMMENT, (yyvsp[-1].string), NULL); - printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); -} - - break; - - case 89: - - { - printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); - zconf_starthelp(); -} - - break; - - case 90: - - { - if (current_entry->help) { - free(current_entry->help); - zconfprint("warning: '%s' defined with more than one help text -- only the last one will be used", - current_entry->sym->name ?: ""); - } - - /* Is the help text empty or all whitespace? */ - if ((yyvsp[0].string)[strspn((yyvsp[0].string), " \f\n\r\t\v")] == '\0') - zconfprint("warning: '%s' defined with blank help text", - current_entry->sym->name ?: ""); - - current_entry->help = (yyvsp[0].string); -} - - break; - - case 95: - - { - menu_add_dep((yyvsp[-1].expr)); - printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); -} - - break; - - case 99: - - { - menu_add_visibility((yyvsp[0].expr)); -} - - break; - - case 101: - - { - menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr)); -} - - break; - - case 104: - - { (yyval.id) = (yyvsp[-1].id); } - - break; - - case 105: - - { (yyval.id) = (yyvsp[-1].id); } - - break; - - case 106: - - { (yyval.id) = (yyvsp[-1].id); } - - break; - - case 109: - - { (yyval.expr) = NULL; } - - break; - - case 110: - - { (yyval.expr) = (yyvsp[0].expr); } - - break; - - case 111: - - { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); } - - break; - - case 112: - - { (yyval.expr) = expr_alloc_comp(E_LTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } - - break; - - case 113: - - { (yyval.expr) = expr_alloc_comp(E_LEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } - - break; - - case 114: - - { (yyval.expr) = expr_alloc_comp(E_GTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } - - break; - - case 115: - - { (yyval.expr) = expr_alloc_comp(E_GEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } - - break; - - case 116: - - { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } - - break; - - case 117: - - { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } - - break; - - case 118: - - { (yyval.expr) = (yyvsp[-1].expr); } - - break; - - case 119: - - { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); } - - break; - - case 120: - - { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); } - - break; - - case 121: - - { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); } - - break; - - case 122: - - { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); } - - break; - - case 124: - - { (yyval.symbol) = sym_lookup((yyvsp[0].string), SYMBOL_CONST); free((yyvsp[0].string)); } - - break; - - case 125: - - { (yyval.string) = NULL; } - - break; - - - - default: break; - } - /* User semantic actions sometimes alter yychar, and that requires - that yytoken be updated with the new translation. We take the - approach of translating immediately before every use of yytoken. - One alternative is translating here after every semantic action, - but that translation would be missed if the semantic action invokes - YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or - if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an - incorrect destructor might then be invoked immediately. In the - case of YYERROR or YYBACKUP, subsequent parser actions might lead - to an incorrect destructor call or verbose syntax error message - before the lookahead is translated. */ - YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); - - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - - *++yyvsp = yyval; - - /* Now 'shift' the result of the reduction. Determine what state - that goes to, based on the state we popped back to and the rule - number reduced by. */ - - yyn = yyr1[yyn]; - - yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; - if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) - yystate = yytable[yystate]; - else - yystate = yydefgoto[yyn - YYNTOKENS]; - - goto yynewstate; - - -/*--------------------------------------. -| yyerrlab -- here on detecting error. | -`--------------------------------------*/ -yyerrlab: - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar); - - /* If not already recovering from an error, report this error. */ - if (!yyerrstatus) - { - ++yynerrs; -#if ! YYERROR_VERBOSE - yyerror (YY_("syntax error")); -#else -# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \ - yyssp, yytoken) - { - char const *yymsgp = YY_("syntax error"); - int yysyntax_error_status; - yysyntax_error_status = YYSYNTAX_ERROR; - if (yysyntax_error_status == 0) - yymsgp = yymsg; - else if (yysyntax_error_status == 1) - { - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); - yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc); - if (!yymsg) - { - yymsg = yymsgbuf; - yymsg_alloc = sizeof yymsgbuf; - yysyntax_error_status = 2; - } - else - { - yysyntax_error_status = YYSYNTAX_ERROR; - yymsgp = yymsg; - } - } - yyerror (yymsgp); - if (yysyntax_error_status == 2) - goto yyexhaustedlab; - } -# undef YYSYNTAX_ERROR -#endif - } - - - - if (yyerrstatus == 3) - { - /* If just tried and failed to reuse lookahead token after an - error, discard it. */ - - if (yychar <= YYEOF) - { - /* Return failure if at end of input. */ - if (yychar == YYEOF) - YYABORT; - } - else - { - yydestruct ("Error: discarding", - yytoken, &yylval); - yychar = YYEMPTY; - } - } - - /* Else will try to reuse lookahead token after shifting the error - token. */ - goto yyerrlab1; - - -/*---------------------------------------------------. -| yyerrorlab -- error raised explicitly by YYERROR. | -`---------------------------------------------------*/ -yyerrorlab: - - /* Pacify compilers like GCC when the user code never invokes - YYERROR and the label yyerrorlab therefore never appears in user - code. */ - if (/*CONSTCOND*/ 0) - goto yyerrorlab; - - /* Do not reclaim the symbols of the rule whose action triggered - this YYERROR. */ - YYPOPSTACK (yylen); - yylen = 0; - YY_STACK_PRINT (yyss, yyssp); - yystate = *yyssp; - goto yyerrlab1; - - -/*-------------------------------------------------------------. -| yyerrlab1 -- common code for both syntax error and YYERROR. | -`-------------------------------------------------------------*/ -yyerrlab1: - yyerrstatus = 3; /* Each real token shifted decrements this. */ - - for (;;) - { - yyn = yypact[yystate]; - if (!yypact_value_is_default (yyn)) - { - yyn += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) - { - yyn = yytable[yyn]; - if (0 < yyn) - break; - } - } - - /* Pop the current state because it cannot handle the error token. */ - if (yyssp == yyss) - YYABORT; - - - yydestruct ("Error: popping", - yystos[yystate], yyvsp); - YYPOPSTACK (1); - yystate = *yyssp; - YY_STACK_PRINT (yyss, yyssp); - } - - YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - *++yyvsp = yylval; - YY_IGNORE_MAYBE_UNINITIALIZED_END - - - /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); - - yystate = yyn; - goto yynewstate; - - -/*-------------------------------------. -| yyacceptlab -- YYACCEPT comes here. | -`-------------------------------------*/ -yyacceptlab: - yyresult = 0; - goto yyreturn; - -/*-----------------------------------. -| yyabortlab -- YYABORT comes here. | -`-----------------------------------*/ -yyabortlab: - yyresult = 1; - goto yyreturn; - -#if !defined yyoverflow || YYERROR_VERBOSE -/*-------------------------------------------------. -| yyexhaustedlab -- memory exhaustion comes here. | -`-------------------------------------------------*/ -yyexhaustedlab: - yyerror (YY_("memory exhausted")); - yyresult = 2; - /* Fall through. */ -#endif - -yyreturn: - if (yychar != YYEMPTY) - { - /* Make sure we have latest lookahead translation. See comments at - user semantic actions for why this is necessary. */ - yytoken = YYTRANSLATE (yychar); - yydestruct ("Cleanup: discarding lookahead", - yytoken, &yylval); - } - /* Do not reclaim the symbols of the rule whose action triggered - this YYABORT or YYACCEPT. */ - YYPOPSTACK (yylen); - YY_STACK_PRINT (yyss, yyssp); - while (yyssp != yyss) - { - yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); - YYPOPSTACK (1); - } -#ifndef yyoverflow - if (yyss != yyssa) - YYSTACK_FREE (yyss); -#endif -#if YYERROR_VERBOSE - if (yymsg != yymsgbuf) - YYSTACK_FREE (yymsg); -#endif - return yyresult; -} - - - -void conf_parse(const char *name) -{ - const char *tmp; - struct symbol *sym; - int i; - - zconf_initscan(name); - - sym_init(); - _menu_init(); - - if (getenv("ZCONF_DEBUG")) - yydebug = 1; - yyparse(); - if (yynerrs) - exit(1); - if (!modules_sym) - modules_sym = sym_find( "n" ); - - tmp = rootmenu.prompt->text; - rootmenu.prompt->text = _(rootmenu.prompt->text); - rootmenu.prompt->text = sym_expand_string_value(rootmenu.prompt->text); - free((char*)tmp); - - menu_finalize(&rootmenu); - for_all_symbols(i, sym) { - if (sym_check_deps(sym)) - yynerrs++; - } - if (yynerrs) - exit(1); - sym_set_change_count(1); -} - -static const char *zconf_tokenname(int token) -{ - switch (token) { - case T_MENU: return "menu"; - case T_ENDMENU: return "endmenu"; - case T_CHOICE: return "choice"; - case T_ENDCHOICE: return "endchoice"; - case T_IF: return "if"; - case T_ENDIF: return "endif"; - case T_DEPENDS: return "depends"; - case T_VISIBLE: return "visible"; - } - return ""; -} - -static bool zconf_endtoken(const struct kconf_id *id, int starttoken, int endtoken) -{ - if (id->token != endtoken) { - zconf_error("unexpected '%s' within %s block", - id->name, zconf_tokenname(starttoken)); - yynerrs++; - return false; - } - if (current_menu->file != current_file) { - zconf_error("'%s' in different file than '%s'", - id->name, zconf_tokenname(starttoken)); - fprintf(stderr, "%s:%d: location of the '%s'\n", - current_menu->file->name, current_menu->lineno, - zconf_tokenname(starttoken)); - yynerrs++; - return false; - } - return true; -} - -static void zconfprint(const char *err, ...) -{ - va_list ap; - - fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); - va_start(ap, err); - vfprintf(stderr, err, ap); - va_end(ap); - fprintf(stderr, "\n"); -} - -static void zconf_error(const char *err, ...) -{ - va_list ap; - - yynerrs++; - fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); - va_start(ap, err); - vfprintf(stderr, err, ap); - va_end(ap); - fprintf(stderr, "\n"); -} - -static void yyerror(const char *err) -{ - fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno() + 1, err); -} - -static void print_quoted_string(FILE *out, const char *str) -{ - const char *p; - int len; - - putc('"', out); - while ((p = strchr(str, '"'))) { - len = p - str; - if (len) - fprintf(out, "%.*s", len, str); - fputs("\\\"", out); - str = p + 1; - } - fputs(str, out); - putc('"', out); -} - -static void print_symbol(FILE *out, struct menu *menu) -{ - struct symbol *sym = menu->sym; - struct property *prop; - - if (sym_is_choice(sym)) - fprintf(out, "\nchoice\n"); - else - fprintf(out, "\nconfig %s\n", sym->name); - switch (sym->type) { - case S_BOOLEAN: - fputs(" bool\n", out); - break; - case S_TRISTATE: - fputs(" tristate\n", out); - break; - case S_STRING: - fputs(" string\n", out); - break; - case S_INT: - fputs(" integer\n", out); - break; - case S_HEX: - fputs(" hex\n", out); - break; - default: - fputs(" ???\n", out); - break; - } - for (prop = sym->prop; prop; prop = prop->next) { - if (prop->menu != menu) - continue; - switch (prop->type) { - case P_PROMPT: - fputs(" prompt ", out); - print_quoted_string(out, prop->text); - if (!expr_is_yes(prop->visible.expr)) { - fputs(" if ", out); - expr_fprint(prop->visible.expr, out); - } - fputc('\n', out); - break; - case P_DEFAULT: - fputs( " default ", out); - expr_fprint(prop->expr, out); - if (!expr_is_yes(prop->visible.expr)) { - fputs(" if ", out); - expr_fprint(prop->visible.expr, out); - } - fputc('\n', out); - break; - case P_CHOICE: - fputs(" #choice value\n", out); - break; - case P_SELECT: - fputs( " select ", out); - expr_fprint(prop->expr, out); - fputc('\n', out); - break; - case P_IMPLY: - fputs( " imply ", out); - expr_fprint(prop->expr, out); - fputc('\n', out); - break; - case P_RANGE: - fputs( " range ", out); - expr_fprint(prop->expr, out); - fputc('\n', out); - break; - case P_MENU: - fputs( " menu ", out); - print_quoted_string(out, prop->text); - fputc('\n', out); - break; - default: - fprintf(out, " unknown prop %d!\n", prop->type); - break; - } - } - if (menu->help) { - int len = strlen(menu->help); - while (menu->help[--len] == '\n') - menu->help[len] = 0; - fprintf(out, " help\n%s\n", menu->help); - } -} - -void zconfdump(FILE *out) -{ - struct property *prop; - struct symbol *sym; - struct menu *menu; - - menu = rootmenu.list; - while (menu) { - if ((sym = menu->sym)) - print_symbol(out, menu); - else if ((prop = menu->prompt)) { - switch (prop->type) { - case P_COMMENT: - fputs("\ncomment ", out); - print_quoted_string(out, prop->text); - fputs("\n", out); - break; - case P_MENU: - fputs("\nmenu ", out); - print_quoted_string(out, prop->text); - fputs("\n", out); - break; - default: - ; - } - if (!expr_is_yes(prop->visible.expr)) { - fputs(" depends ", out); - expr_fprint(prop->visible.expr, out); - fputc('\n', out); - } - } - - if (menu->list) - menu = menu->list; - else if (menu->next) - menu = menu->next; - else while ((menu = menu->parent)) { - if (menu->prompt && menu->prompt->type == P_MENU) - fputs("\nendmenu\n", out); - if (menu->next) { - menu = menu->next; - break; - } - } - } -} - -#include "zconf.lex.c" -#include "util.c" -#include "confdata.c" -#include "expr.c" -#include "symbol.c" -#include "menu.c" From patchwork Mon May 6 14:45:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Seiderer X-Patchwork-Id: 1932048 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VY43m3Dc9z1xnT for ; Tue, 7 May 2024 00:46:28 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 66955608C7; Mon, 6 May 2024 14:46:26 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id QPjsVib52fw4; Mon, 6 May 2024 14:46:22 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org E477A608D5 Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id E477A608D5; Mon, 6 May 2024 14:46:21 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 456411BF59D for ; Mon, 6 May 2024 14:46:05 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id C808B82024 for ; Mon, 6 May 2024 14:46:02 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id ZsTcE9poyTAT for ; Mon, 6 May 2024 14:46:01 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=212.227.15.18; helo=mout.gmx.net; envelope-from=ps.report@gmx.net; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 2BC5C8202B DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 2BC5C8202B Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by smtp1.osuosl.org (Postfix) with ESMTPS id 2BC5C8202B for ; Mon, 6 May 2024 14:45:59 +0000 (UTC) X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from localhost.fritz.box ([82.135.81.65]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MQ5vW-1sH8lx3g7E-00M7dy for ; Mon, 06 May 2024 16:45:57 +0200 To: buildroot@busybox.net Date: Mon, 6 May 2024 16:45:50 +0200 Message-ID: <20240506144555.31709-8-ps.report@gmx.net> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240506144555.31709-1-ps.report@gmx.net> References: <20240506144555.31709-1-ps.report@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:VRRuBiOkDBwYfdhEYk22oHPUsALWKwI8a2MiOrRYc6S9xpY9zKJ D8tm6mqBMyjW9zBjTswNlf9KxLYq3Wv+HecLfHREDTldMvcvjRhcxKppySJPnFLUGDNl38r PPGsfL9XRetb6sTd5AVoowlNep3geOrYf9hRMsc/1tOwqIaJTWytBu8zBM05mE9t+gqsvGS ealW6SNGBaajYJviu+1Qw== UI-OutboundReport: notjunk:1;M01:P0:bTN0o0QmKSk=;I52h09/dTIB2rk8XQL20dRvDjCB TX1IfP5wsdhjM1ZCUa4OKGkiwkG0dO5mj9D8YgOhEYSDghEbrTrOL5DI/3fh7tfJTswkgB6cT Tr4sz+yoihj9oZ6Em46QA8UNIeixjYIBHnp9F1x/OIzTyomb/oTcoH3ho97eUDE/A58abm54J 6nZgxxkftMeeGQ6vHy/whqPwe/lw3U7l4bJpzhzffWTOIKlCqpET+m7mb1UGsyZzrEwkdQttz jZ2VJySjbn2Gy9gL7Ux7m+aSWH/nGjqjvwtqEMDXHDUJ37jXFMSm06xIQQ67YMlkQIsoZIgSJ TNgEk3hrv/ja5ZJs3L9af/eLKoJ16iDXZIBvHWSKuegU8XoTkhkL5bpbEcKPp3hKAQjlMzX0j yQ7fHB84C+ogetH32lccLEcckGvG+bX90yacWokgncmObuwGEkDArlUufEkEQKCi+ZrLDyYsu 8ld/g8BrTry4UJ0aV6+uD7NabMQX5sXWSeJsu6ZHKOdsmAnyyMEDLQZ2ciF/E4dzzoLQ5pm70 d90lfWzDHtfsT9YS3E33KP3/tN33VSMvrNsyZhC6kgVdDx2fSYl2Li9WnZSXIAevzmo9y8Us+ UC3f6BA6wHLAda17sYuRGxhJlmSu2I6YgSi8WeUlRJqlrvtIXv15a77chLttmyRsMAN1SmXK7 TiwO/eSUcvEUb3F1+P+kYCiYxlelSM4fFYE3q0Ju7mMepgUQjy3MyFBRXbNoMfDwV7TQlrYF3 8tzdMV+dXQeKdU9PsU71G8FjD5iEx6ii1HUh3Hwe90aR8ggMTxg3iMmhgUxEp4UtYMxCRzuYc u2tU77luyc+Xf48q8V7Oqikvc4IJ49SjsXXqGCDakVnys= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1715006758; x=1715611558; i=ps.report@gmx.net; bh=SHEsFgOgp/xQn/sZERrwXZ5RNskKg6wYYGqGd2y0ZpU=; h=X-UI-Sender-Class:From:To:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=sikJtCFgZ2cRst2xMXlqQVSWzy99M8cFtE723kuwos2YSppzpjcw/aRW2cc4If/g jZipV9oaU8vniWpEIlnhbTACXscWyIN66p+OxY2Q9losCbOaCKJHUhquJHIaVb4RI P0o8mZMwgdfosnxjxKkEbdIEIjdPw0abEPy8gYOliDXYAsb5XGqBSJQOq8rbf3Uaa qOQStYJ21eP7qSEkM0pB1kvck635LO/oirMI1dnSXYlP8AkzWtKN3Ca2G9+5O1ToC Cc0EiW9wSUDGDCL6XmEmm4RP5KsbY445+IB/rHRLYW+O00xDRjjg972wi3vfcUc91 gQaLFVRSZW9lt2clkA== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.net X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=gmx.net header.i=ps.report@gmx.net header.a=rsa-sha256 header.s=s31663417 header.b=sikJtCFg Subject: [Buildroot] [PATCH v1 7/8] support/kconfig: reference environment variables directly (remove 'option env=') X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Peter Seiderer via buildroot From: Peter Seiderer Reply-To: Peter Seiderer Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" - reference environment variables directly (remove 'option env='), see upstream commit [1]: BR2_VERSION --> BR2_VERSION_FULL BR2_HOSTARCH --> HOSTARCH BR2_SKIP_LEGACY --> SKIP_LEGACY BR2_BASE_DIR --> BASE_DIR BR2_HOST_GCC_VERSION --> HOST_GCC_VERSION BR2_DEFCONFIG_FROM_ENV --> BR2_DEFCONFIG [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=104daea149c45cc84842ce77a9bd6436d19f3dd8 Signed-off-by: Peter Seiderer --- Notes/ToDo: - take a look at BR2_HOSTARCH usage in utils/checksymbolslib/br.py - take a look at BR2_BASE_DIR usage in utils/checksymbolslib/br.py and utils/checksymbolslib/test_kconfig.py --- Config.in | 51 ++++++------------- Config.in.legacy | 6 +-- boot/arm-trusted-firmware/Config.in | 2 +- boot/beaglev-ddrinit/Config.in | 2 +- boot/beaglev-secondboot/Config.in | 2 +- boot/s500-bootloader/Config.in | 2 +- linux/Config.ext.in | 2 +- package/amlogic-boot-fip/Config.in.host | 2 +- package/erlang/Config.in | 6 +-- package/flutter-sdk-bin/Config.in.host | 2 +- package/go-bootstrap-stage1/Config.in.host | 6 +-- package/google-breakpad/Config.in.host | 12 ++--- package/jpeg/Config.in | 2 +- package/kvm-unit-tests/Config.in | 2 +- package/luajit/Config.in | 4 +- package/mono/Config.in | 4 +- package/nodejs/Config.in.host | 8 +-- package/openjdk/Config.in | 4 +- package/openssl/Config.in | 2 +- package/protobuf/Config.in | 22 ++++---- package/qt5/qt5webengine/Config.in | 2 +- package/rustc/Config.in.host | 16 +++--- package/sam-ba/Config.in.host | 2 +- package/supertuxkart/Config.in | 4 +- package/ti-cgt-pru/Config.in.host | 2 +- package/ti-gfx/Config.in | 2 +- package/wine/Config.in | 6 +-- system/Config.in | 4 +- toolchain/toolchain-external/Config.in | 2 +- .../Config.in | 2 +- .../toolchain-external-arm-aarch64/Config.in | 2 +- .../toolchain-external-arm-arm/Config.in | 2 +- .../toolchain-external-bootlin/Config.in | 2 +- .../Config.in | 2 +- .../Config.in | 2 +- .../Config.in | 2 +- .../toolchain-external-linaro-arm/Config.in | 2 +- .../toolchain-external-linaro-armeb/Config.in | 2 +- .../toolchain-external-synopsys-arc/Config.in | 2 +- 39 files changed, 89 insertions(+), 114 deletions(-) diff --git a/Config.in b/Config.in index e4f58f3f66..0d78c04f38 100644 --- a/Config.in +++ b/Config.in @@ -1,68 +1,51 @@ # -mainmenu "Buildroot $BR2_VERSION Configuration" +mainmenu "Buildroot $(BR2_VERSION_FULL) Configuration" config BR2_HAVE_DOT_CONFIG bool default y -config BR2_VERSION - string - option env="BR2_VERSION_FULL" - -config BR2_HOSTARCH - string - option env="HOSTARCH" - -config BR2_BASE_DIR - string - option env="BASE_DIR" - # br2-external paths definitions -source "$BR2_BASE_DIR/.br2-external.in.paths" - -# Hidden config symbols for packages to check system gcc version -config BR2_HOST_GCC_VERSION - string - option env="HOST_GCC_VERSION" +source "$(BASE_DIR)/.br2-external.in.paths" config BR2_HOST_GCC_AT_LEAST_4_9 bool - default y if BR2_HOST_GCC_VERSION = "4 9" + default y if "$(HOST_GCC_VERSION)" = "4 9" config BR2_HOST_GCC_AT_LEAST_5 bool - default y if BR2_HOST_GCC_VERSION = "5" + default y if "$(HOST_GCC_VERSION)" = "5" select BR2_HOST_GCC_AT_LEAST_4_9 config BR2_HOST_GCC_AT_LEAST_6 bool - default y if BR2_HOST_GCC_VERSION = "6" + default y if "$(HOST_GCC_VERSION)" = "6" select BR2_HOST_GCC_AT_LEAST_5 config BR2_HOST_GCC_AT_LEAST_7 bool - default y if BR2_HOST_GCC_VERSION = "7" + default y if "$(HOST_GCC_VERSION)" = "7" select BR2_HOST_GCC_AT_LEAST_6 config BR2_HOST_GCC_AT_LEAST_8 bool - default y if BR2_HOST_GCC_VERSION = "8" + default y if "$(HOST_GCC_VERSION)" = "8" select BR2_HOST_GCC_AT_LEAST_7 config BR2_HOST_GCC_AT_LEAST_9 bool - default y if BR2_HOST_GCC_VERSION = "9" + default y if "$(HOST_GCC_VERSION)" = "9" select BR2_HOST_GCC_AT_LEAST_8 config BR2_HOST_GCC_AT_LEAST_10 bool - default y if BR2_HOST_GCC_VERSION = "10" + default y if "$(HOST_GCC_VERSION)" = "10" select BR2_HOST_GCC_AT_LEAST_9 config BR2_HOST_GCC_AT_LEAST_11 bool - default y if BR2_HOST_GCC_VERSION = "11" + default y if "$(HOST_GCC_VERSION)" = "11" select BR2_HOST_GCC_AT_LEAST_10 # When adding new entries above, be sure to update @@ -183,13 +166,9 @@ config BR2_TAR_OPTIONS endmenu -config BR2_DEFCONFIG_FROM_ENV - string - option env="BR2_DEFCONFIG" - config BR2_DEFCONFIG string "Location to save buildroot config" - default BR2_DEFCONFIG_FROM_ENV if BR2_DEFCONFIG_FROM_ENV != "" + default "$(BR2_DEFCONFIG)" if "$(BR2_DEFCONFIG)" != "" default "$(CONFIG_DIR)/defconfig" help When running 'make savedefconfig', the defconfig file will be @@ -197,7 +176,7 @@ config BR2_DEFCONFIG config BR2_DL_DIR string "Download dir" - default "$(TOPDIR)/dl" + default "\$(TOPDIR)/dl" help Directory to store all the source files that we need to fetch. If the Linux shell environment has defined the BR2_DL_DIR @@ -211,7 +190,7 @@ config BR2_DL_DIR config BR2_HOST_DIR string "Host dir" - default "$(BASE_DIR)/host" + default "\$(BASE_DIR)/host" help Directory to store all the binary files that are built for the host. This includes the cross compilation toolchain when @@ -665,7 +644,7 @@ endchoice config BR2_PACKAGE_OVERRIDE_FILE string "location of a package override file" - default "$(CONFIG_DIR)/local.mk" + default "\$(CONFIG_DIR)/local.mk" help A package override file is a short makefile that contains variable definitions of the form _OVERRIDE_SRCDIR, which @@ -984,4 +963,4 @@ source "package/Config.in.host" source "Config.in.legacy" # br2-external menus definitions -source "$BR2_BASE_DIR/.br2-external.in.menus" +source "$(BASE_DIR)/.br2-external.in.menus" diff --git a/Config.in.legacy b/Config.in.legacy index 98a4125f4b..919c787ff9 100644 --- a/Config.in.legacy +++ b/Config.in.legacy @@ -90,11 +90,7 @@ # # [End of example] -config BR2_SKIP_LEGACY - bool - option env="SKIP_LEGACY" - -if !BR2_SKIP_LEGACY +if "$(SKIP_LEGACY)" = "" config BR2_LEGACY bool diff --git a/boot/arm-trusted-firmware/Config.in b/boot/arm-trusted-firmware/Config.in index 2fe3dd1146..6cf8e88929 100644 --- a/boot/arm-trusted-firmware/Config.in +++ b/boot/arm-trusted-firmware/Config.in @@ -243,7 +243,7 @@ config BR2_TARGET_ARM_TRUSTED_FIRMWARE_NEEDS_DTC config BR2_TARGET_ARM_TRUSTED_FIRMWARE_NEEDS_ARM32_TOOLCHAIN bool "Needs arm-none-eabi toolchain" depends on BR2_aarch64 - depends on BR2_HOSTARCH = "x86_64" + depends on "$(HOSTARCH)" = "x86_64" help Select this option if your ATF board configuration requires an ARM32 bare metal toolchain to be available. diff --git a/boot/beaglev-ddrinit/Config.in b/boot/beaglev-ddrinit/Config.in index 7ca92a7b9b..585b2ba7be 100644 --- a/boot/beaglev-ddrinit/Config.in +++ b/boot/beaglev-ddrinit/Config.in @@ -1,7 +1,7 @@ config BR2_TARGET_BEAGLEV_DDRINIT bool "beaglev-ddrinit" depends on BR2_riscv - depends on BR2_HOSTARCH = "x86_64" # host-riscv64-elf-toolchain + depends on "$(HOSTARCH)" = "x86_64" # host-riscv64-elf-toolchain help This package builds the DDRinit firmware used on the BeagleV platform. diff --git a/boot/beaglev-secondboot/Config.in b/boot/beaglev-secondboot/Config.in index a9695fc138..0616efb0c5 100644 --- a/boot/beaglev-secondboot/Config.in +++ b/boot/beaglev-secondboot/Config.in @@ -1,7 +1,7 @@ config BR2_TARGET_BEAGLEV_SECONDBOOT bool "beaglev-secondboot" depends on BR2_riscv - depends on BR2_HOSTARCH = "x86_64" # host-riscv64-elf-toolchain + depends on "$(HOSTARCH)" = "x86_64" # host-riscv64-elf-toolchain help This package builds the SecondBoot firmware used on the BeagleV platform. diff --git a/boot/s500-bootloader/Config.in b/boot/s500-bootloader/Config.in index 7bb689f305..a7d85214d4 100644 --- a/boot/s500-bootloader/Config.in +++ b/boot/s500-bootloader/Config.in @@ -1,7 +1,7 @@ config BR2_TARGET_S500_BOOTLOADER bool "s500-bootloader" depends on BR2_arm - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on "$(HOSTARCH)" = "x86_64" || "$(HOSTARCH)" = "x86" select BR2_HOSTARCH_NEEDS_IA32_LIBS help 1st level bootloader for Actions Semiconductor S500 SoC. diff --git a/linux/Config.ext.in b/linux/Config.ext.in index 3cbf42d344..301f1e642c 100644 --- a/linux/Config.ext.in +++ b/linux/Config.ext.in @@ -149,6 +149,6 @@ config BR2_LINUX_KERNEL_EXT_AUFS_VERSION endif # aufs # kernel extensions from br2-external trees, if any -source "$BR2_BASE_DIR/.br2-external.in.linux" +source "$(BASE_DIR)/.br2-external.in.linux" endmenu diff --git a/package/amlogic-boot-fip/Config.in.host b/package/amlogic-boot-fip/Config.in.host index bccc6296d1..54f4075f27 100644 --- a/package/amlogic-boot-fip/Config.in.host +++ b/package/amlogic-boot-fip/Config.in.host @@ -1,6 +1,6 @@ config BR2_PACKAGE_HOST_AMLOGIC_BOOT_FIP bool "host amlogic-boot-fip" - depends on BR2_HOSTARCH = "x86_64" + depends on "$(HOSTARCH)" = "x86_64" help Firmware Image Package (FIP) sources used to sign Amlogic u-boot binaries in LibreELEC images diff --git a/package/erlang/Config.in b/package/erlang/Config.in index 724f91123b..f3830cefad 100644 --- a/package/erlang/Config.in +++ b/package/erlang/Config.in @@ -1,8 +1,8 @@ config BR2_PACKAGE_HOST_ERLANG_ARCH_SUPPORTS bool - default y if BR2_HOSTARCH = "aarch64" - default y if BR2_HOSTARCH = "x86_64" - default y if BR2_HOSTARCH = "x86" + default y if "$(HOSTARCH)" = "aarch64" + default y if "$(HOSTARCH)" = "x86_64" + default y if "$(HOSTARCH)" = "x86" config BR2_PACKAGE_ERLANG_ARCH_SUPPORTS bool diff --git a/package/flutter-sdk-bin/Config.in.host b/package/flutter-sdk-bin/Config.in.host index 181a2ee6e5..c1c97e2ca8 100644 --- a/package/flutter-sdk-bin/Config.in.host +++ b/package/flutter-sdk-bin/Config.in.host @@ -1,6 +1,6 @@ config BR2_PACKAGE_HOST_FLUTTER_SDK_BIN_ARCH_SUPPORTS bool - default y if BR2_HOSTARCH = "x86_64" + default y if "$(HOSTARCH)" = "x86_64" config BR2_PACKAGE_HOST_FLUTTER_SDK_BIN bool "host flutter-sdk-bin" diff --git a/package/go-bootstrap-stage1/Config.in.host b/package/go-bootstrap-stage1/Config.in.host index 56a743caf9..50caad0a8b 100644 --- a/package/go-bootstrap-stage1/Config.in.host +++ b/package/go-bootstrap-stage1/Config.in.host @@ -1,6 +1,6 @@ config BR2_PACKAGE_HOST_GO_BOOTSTRAP_STAGE1_ARCH_SUPPORTS bool # See src/cmd/dist/unix.c for the list of supported architectures - default y if BR2_HOSTARCH = "x86" - default y if BR2_HOSTARCH = "x86_64" - default y if BR2_HOSTARCH = "arm" + default y if "$(HOSTARCH)" = "x86" + default y if "$(HOSTARCH)" = "x86_64" + default y if "$(HOSTARCH)" = "arm" diff --git a/package/google-breakpad/Config.in.host b/package/google-breakpad/Config.in.host index 28d304766a..84e95957b2 100644 --- a/package/google-breakpad/Config.in.host +++ b/package/google-breakpad/Config.in.host @@ -1,8 +1,8 @@ config BR2_PACKAGE_HOST_GOOGLE_BREAKPAD_ARCH_SUPPORTS bool - default y if BR2_HOSTARCH = "x86_64" - default y if BR2_HOSTARCH = "x86" - default y if BR2_HOSTARCH = "arm" - default y if BR2_HOSTARCH = "aarch64" - default y if BR2_HOSTARCH = "mips" - default y if BR2_HOSTARCH = "mipsel" + default y if "$(HOSTARCH)" = "x86_64" + default y if "$(HOSTARCH)" = "x86" + default y if "$(HOSTARCH)" = "arm" + default y if "$(HOSTARCH)" = "aarch64" + default y if "$(HOSTARCH)" = "mips" + default y if "$(HOSTARCH)" = "mipsel" diff --git a/package/jpeg/Config.in b/package/jpeg/Config.in index 371f89aa49..0a7e01d28b 100644 --- a/package/jpeg/Config.in +++ b/package/jpeg/Config.in @@ -40,7 +40,7 @@ config BR2_PACKAGE_JPEG_TURBO http://www.libjpeg-turbo.org # libjpeg from br2-external trees, if any -source "$BR2_BASE_DIR/.br2-external.in.jpeg" +source "$(BASE_DIR)/.br2-external.in.jpeg" endchoice diff --git a/package/kvm-unit-tests/Config.in b/package/kvm-unit-tests/Config.in index 02ea8dd58c..c99bad8fd5 100644 --- a/package/kvm-unit-tests/Config.in +++ b/package/kvm-unit-tests/Config.in @@ -19,7 +19,7 @@ config BR2_PACKAGE_KVM_UNIT_TESTS # gcc 4.5 at least. on i386, we use the target gcc, while on # x86-64 we use the host gcc (see .mk file for details) depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_5 || !BR2_i386 - depends on BR2_HOSTARCH = "x86_64" || !BR2_x86_64 + depends on "$(HOSTARCH)" = "x86_64" || !BR2_x86_64 select BR2_HOSTARCH_NEEDS_IA32_COMPILER if BR2_x86_64 help kvm-unit-tests is a project as old as KVM. As its name diff --git a/package/luajit/Config.in b/package/luajit/Config.in index 31e9e0243e..408032c7e8 100644 --- a/package/luajit/Config.in +++ b/package/luajit/Config.in @@ -7,9 +7,9 @@ config BR2_PACKAGE_LUAJIT_ARCH_SUPPORTS default y if BR2_powerpc # -m32 flag is used for 32bit builds and host-luajit has # limited architecture support - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on "$(HOSTARCH)" = "x86_64" || "$(HOSTARCH)" = "x86" # Building for 64-bit target requires a 64-bit host - depends on !BR2_ARCH_IS_64 || BR2_HOSTARCH = "x86_64" + depends on !BR2_ARCH_IS_64 || "$(HOSTARCH)" = "x86_64" config BR2_PACKAGE_LUAJIT bool "luajit" diff --git a/package/mono/Config.in b/package/mono/Config.in index 0152df8268..354dc56d24 100644 --- a/package/mono/Config.in +++ b/package/mono/Config.in @@ -1,7 +1,7 @@ config BR2_PACKAGE_HOST_MONO_ARCH_SUPPORTS bool - default y if BR2_HOSTARCH = "x86_64" - default y if BR2_HOSTARCH = "x86" + default y if "$(HOSTARCH)" = "x86_64" + default y if "$(HOSTARCH)" = "x86" config BR2_PACKAGE_MONO_ARCH_SUPPORTS bool diff --git a/package/nodejs/Config.in.host b/package/nodejs/Config.in.host index a8ab89176c..a8b0f3997d 100644 --- a/package/nodejs/Config.in.host +++ b/package/nodejs/Config.in.host @@ -1,9 +1,9 @@ config BR2_PACKAGE_HOST_NODEJS_BIN_ARCH_SUPPORTS bool - default y if BR2_HOSTARCH = "aarch64" - default y if BR2_HOSTARCH = "arm" - default y if BR2_HOSTARCH = "ppc64le" - default y if BR2_HOSTARCH = "x86_64" + default y if "$(HOSTARCH)" = "aarch64" + default y if "$(HOSTARCH)" = "arm" + default y if "$(HOSTARCH)" = "ppc64le" + default y if "$(HOSTARCH)" = "x86_64" comment "host nodejs needs a host gcc >= 8" depends on !BR2_PACKAGE_HOST_NODEJS_BIN_ARCH_SUPPORTS diff --git a/package/openjdk/Config.in b/package/openjdk/Config.in index 25d6960ecf..66963ed885 100644 --- a/package/openjdk/Config.in +++ b/package/openjdk/Config.in @@ -1,7 +1,7 @@ config BR2_PACKAGE_HOST_OPENJDK_BIN_ARCH_SUPPORTS bool - default y if BR2_HOSTARCH = "x86_64" - default y if BR2_HOSTARCH = "aarch64" + default y if "$(HOSTARCH)" = "x86_64" + default y if "$(HOSTARCH)" = "aarch64" # Taken from make/autoconf/platform.m4 config BR2_PACKAGE_OPENJDK_ARCH_SUPPORTS diff --git a/package/openssl/Config.in b/package/openssl/Config.in index c7641ecefa..3d14988d99 100644 --- a/package/openssl/Config.in +++ b/package/openssl/Config.in @@ -47,7 +47,7 @@ config BR2_PACKAGE_LIBRESSL source "package/libressl/Config.in" # openssl from br2-external trees, if any -source "$BR2_BASE_DIR/.br2-external.in.openssl" +source "$(BASE_DIR)/.br2-external.in.openssl" endchoice diff --git a/package/protobuf/Config.in b/package/protobuf/Config.in index 47e987fa2b..df87918273 100644 --- a/package/protobuf/Config.in +++ b/package/protobuf/Config.in @@ -16,17 +16,17 @@ # host-protobuf only builds on certain architectures config BR2_PACKAGE_HOST_PROTOBUF_ARCH_SUPPORTS bool - default y if BR2_HOSTARCH = "aarch64" - default y if BR2_HOSTARCH = "arm" - default y if BR2_HOSTARCH = "mips" - default y if BR2_HOSTARCH = "mipsel" - default y if BR2_HOSTARCH = "powerpc" - default y if BR2_HOSTARCH = "powerpc64" - default y if BR2_HOSTARCH = "powerpc64le" - default y if BR2_HOSTARCH = "sparc" - default y if BR2_HOSTARCH = "sparc64" - default y if BR2_HOSTARCH = "x86" - default y if BR2_HOSTARCH = "x86_64" + default y if "$(HOSTARCH)" = "aarch64" + default y if "$(HOSTARCH)" = "arm" + default y if "$(HOSTARCH)" = "mips" + default y if "$(HOSTARCH)" = "mipsel" + default y if "$(HOSTARCH)" = "powerpc" + default y if "$(HOSTARCH)" = "powerpc64" + default y if "$(HOSTARCH)" = "powerpc64le" + default y if "$(HOSTARCH)" = "sparc" + default y if "$(HOSTARCH)" = "sparc64" + default y if "$(HOSTARCH)" = "x86" + default y if "$(HOSTARCH)" = "x86_64" config BR2_PACKAGE_PROTOBUF_ARCH_SUPPORTS bool diff --git a/package/qt5/qt5webengine/Config.in b/package/qt5/qt5webengine/Config.in index 99a2980a25..907b7513f6 100644 --- a/package/qt5/qt5webengine/Config.in +++ b/package/qt5/qt5webengine/Config.in @@ -5,7 +5,7 @@ config BR2_PACKAGE_QT5WEBENGINE_ARCH_SUPPORTS BR2_mips || BR2_mips64 # -m32 flag is used for 32bit builds and host tools have # limited architecture support - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on "$(HOSTARCH)" = "x86_64" || "$(HOSTARCH)" = "x86" depends on BR2_PACKAGE_QT5_JSCORE_AVAILABLE # qt5declarative depends on !BR2_BINFMT_FLAT # qt5base-icu depends on BR2_USE_MMU # libglib2, qt5base-dbus diff --git a/package/rustc/Config.in.host b/package/rustc/Config.in.host index baa68994e6..77f5bf0645 100644 --- a/package/rustc/Config.in.host +++ b/package/rustc/Config.in.host @@ -1,14 +1,14 @@ # All host rust packages should depend on this option config BR2_PACKAGE_HOST_RUSTC_ARCH_SUPPORTS bool - default y if BR2_HOSTARCH = "aarch64" - default y if BR2_HOSTARCH = "powerpc" - default y if BR2_HOSTARCH = "powerpc64" - default y if BR2_HOSTARCH = "powerpc64le" - default y if BR2_HOSTARCH = "riscv64" - default y if BR2_HOSTARCH = "s390x" - default y if BR2_HOSTARCH = "x86" - default y if BR2_HOSTARCH = "x86_64" + default y if "$(HOSTARCH)" = "aarch64" + default y if "$(HOSTARCH)" = "powerpc" + default y if "$(HOSTARCH)" = "powerpc64" + default y if "$(HOSTARCH)" = "powerpc64le" + default y if "$(HOSTARCH)" = "riscv64" + default y if "$(HOSTARCH)" = "s390x" + default y if "$(HOSTARCH)" = "x86" + default y if "$(HOSTARCH)" = "x86_64" # The pre-built Rust standard library is only available for a number # of architectures/C libraries combinations, with different levels of diff --git a/package/sam-ba/Config.in.host b/package/sam-ba/Config.in.host index cd11e8633e..9b2e2afb75 100644 --- a/package/sam-ba/Config.in.host +++ b/package/sam-ba/Config.in.host @@ -1,6 +1,6 @@ config BR2_PACKAGE_HOST_SAM_BA bool "host sam-ba" - depends on BR2_HOSTARCH = "x86_64" + depends on "$(HOSTARCH)" = "x86_64" help Atmel SAM-BA software provides an open set of tools for programming the Atmel SAM3, SAM7 and SAM9 ARM-based diff --git a/package/supertuxkart/Config.in b/package/supertuxkart/Config.in index 319415754a..d442846fdd 100644 --- a/package/supertuxkart/Config.in +++ b/package/supertuxkart/Config.in @@ -1,6 +1,6 @@ config BR2_PACKAGE_SUPERTUXKART bool "supertuxkart" - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on "$(HOSTARCH)" = "x86_64" || "$(HOSTARCH)" = "x86" depends on BR2_i386 || BR2_x86_64 depends on BR2_USE_MMU # fork() depends on BR2_INSTALL_LIBSTDCPP # openal @@ -34,7 +34,7 @@ config BR2_PACKAGE_SUPERTUXKART http://supertuxkart.sourceforge.net/Main_Page comment "supertuxkart needs an OpenGL backend, a uClibc or glibc toolchain w/ NPTL, C++, gcc >= 4.9" - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on "$(HOSTARCH)" = "x86_64" || "$(HOSTARCH)" = "x86" depends on BR2_i386 || BR2_x86_64 depends on BR2_USE_MMU depends on BR2_PACKAGE_OPENAL_ARCH_SUPPORTS diff --git a/package/ti-cgt-pru/Config.in.host b/package/ti-cgt-pru/Config.in.host index eab3cd72d5..cf56854dd1 100644 --- a/package/ti-cgt-pru/Config.in.host +++ b/package/ti-cgt-pru/Config.in.host @@ -1,7 +1,7 @@ config BR2_PACKAGE_HOST_TI_CGT_PRU_ARCH_SUPPORTS bool default y - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on "$(HOSTARCH)" = "x86_64" || "$(HOSTARCH)" = "x86" depends on BR2_arm config BR2_PACKAGE_HOST_TI_CGT_PRU diff --git a/package/ti-gfx/Config.in b/package/ti-gfx/Config.in index 40f46335a3..093417fa21 100644 --- a/package/ti-gfx/Config.in +++ b/package/ti-gfx/Config.in @@ -1,7 +1,7 @@ config BR2_PACKAGE_TI_GFX bool "ti-gfx" depends on BR2_LINUX_KERNEL && BR2_TOOLCHAIN_USES_GLIBC && BR2_arm - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on "$(HOSTARCH)" = "x86_64" || "$(HOSTARCH)" = "x86" select BR2_HOSTARCH_NEEDS_IA32_LIBS select BR2_PACKAGE_HAS_LIBEGL select BR2_PACKAGE_HAS_LIBGLES diff --git a/package/wine/Config.in b/package/wine/Config.in index db3b1570ef..cb764f0c9b 100644 --- a/package/wine/Config.in +++ b/package/wine/Config.in @@ -2,9 +2,9 @@ config BR2_PACKAGE_WINE_ARCH_SUPPORTS bool default y # Wine only builds on certain architectures - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" || \ - BR2_HOSTARCH = "powerpc" || BR2_HOSTARCH = "arm" || \ - BR2_HOSTARCH = "aarch64" + depends on "$(HOSTARCH)" = "x86_64" || "$(HOSTARCH)" = "x86" || \ + "$(HOSTARCH)" = "powerpc" || "$(HOSTARCH)" = "arm" || \ + "$(HOSTARCH)" = "aarch64" # Wine has much CPU specific code and mostly makes sense on x86 depends on BR2_i386 diff --git a/system/Config.in b/system/Config.in index 3fb17ed1c6..b8db1e755f 100644 --- a/system/Config.in +++ b/system/Config.in @@ -20,7 +20,7 @@ config BR2_ROOTFS_SKELETON_CUSTOM Use custom target skeleton. # skeleton from br2-external trees, if any -source "$BR2_BASE_DIR/.br2-external.in.skeleton" +source "$(BASE_DIR)/.br2-external.in.skeleton" endchoice @@ -154,7 +154,7 @@ config BR2_INIT_NONE or with a rootfs-overlay. # Init systems from br2-external trees, if any -source "$BR2_BASE_DIR/.br2-external.in.init" +source "$(BASE_DIR)/.br2-external.in.init" endchoice diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in index e91aa16326..9067193282 100644 --- a/toolchain/toolchain-external/Config.in +++ b/toolchain/toolchain-external/Config.in @@ -38,7 +38,7 @@ source "toolchain/toolchain-external/toolchain-external-bootlin/Config.in" source "toolchain/toolchain-external/toolchain-external-custom/Config.in" # Toolchains from br2-external trees, if any -source "$BR2_BASE_DIR/.br2-external.in.toolchains" +source "$(BASE_DIR)/.br2-external.in.toolchains" endchoice diff --git a/toolchain/toolchain-external/toolchain-external-arm-aarch64-be/Config.in b/toolchain/toolchain-external/toolchain-external-arm-aarch64-be/Config.in index 1cee601a89..07d1e4b232 100644 --- a/toolchain/toolchain-external/toolchain-external-arm-aarch64-be/Config.in +++ b/toolchain/toolchain-external/toolchain-external-arm-aarch64-be/Config.in @@ -1,7 +1,7 @@ config BR2_TOOLCHAIN_EXTERNAL_ARM_AARCH64_BE bool "Arm AArch64 BE 13.2.rel1" depends on BR2_aarch64_be - depends on BR2_HOSTARCH = "x86_64" + depends on "$(HOSTARCH)" = "x86_64" depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_13 select BR2_TOOLCHAIN_EXTERNAL_GLIBC select BR2_TOOLCHAIN_HAS_SSP diff --git a/toolchain/toolchain-external/toolchain-external-arm-aarch64/Config.in b/toolchain/toolchain-external/toolchain-external-arm-aarch64/Config.in index 2565707def..65159c38bb 100644 --- a/toolchain/toolchain-external/toolchain-external-arm-aarch64/Config.in +++ b/toolchain/toolchain-external/toolchain-external-arm-aarch64/Config.in @@ -1,7 +1,7 @@ config BR2_TOOLCHAIN_EXTERNAL_ARM_AARCH64 bool "Arm AArch64 13.2.rel1" depends on BR2_aarch64 - depends on BR2_HOSTARCH = "x86_64" + depends on "$(HOSTARCH)" = "x86_64" depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_13 select BR2_TOOLCHAIN_EXTERNAL_GLIBC select BR2_TOOLCHAIN_HAS_SSP diff --git a/toolchain/toolchain-external/toolchain-external-arm-arm/Config.in b/toolchain/toolchain-external/toolchain-external-arm-arm/Config.in index bee8d61164..bbc8168160 100644 --- a/toolchain/toolchain-external/toolchain-external-arm-arm/Config.in +++ b/toolchain/toolchain-external/toolchain-external-arm-arm/Config.in @@ -7,7 +7,7 @@ config BR2_TOOLCHAIN_EXTERNAL_ARM_ARM depends on BR2_arm depends on BR2_ARM_CPU_ARMV7A || BR2_ARM_CPU_ARMV8A depends on BR2_ARM_CPU_HAS_NEON - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "aarch64" + depends on "$(HOSTARCH)" = "x86_64" || "$(HOSTARCH)" = "aarch64" depends on BR2_ARM_EABIHF depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_13 select BR2_TOOLCHAIN_EXTERNAL_GLIBC diff --git a/toolchain/toolchain-external/toolchain-external-bootlin/Config.in b/toolchain/toolchain-external/toolchain-external-bootlin/Config.in index 6552da9a84..1fa4fccb0f 100644 --- a/toolchain/toolchain-external/toolchain-external-bootlin/Config.in +++ b/toolchain/toolchain-external/toolchain-external-bootlin/Config.in @@ -1,7 +1,7 @@ config BR2_TOOLCHAIN_EXTERNAL_BOOTLIN bool "Bootlin toolchains" depends on BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_ARCH_SUPPORTS - depends on BR2_HOSTARCH = "x86_64" + depends on "$(HOSTARCH)" = "x86_64" help Bootlin toolchains are built using Buildroot for a large number of architectures and C libraries configurations. diff --git a/toolchain/toolchain-external/toolchain-external-codesourcery-mips/Config.in b/toolchain/toolchain-external/toolchain-external-codesourcery-mips/Config.in index 8e067c8ffb..1938e8f5fc 100644 --- a/toolchain/toolchain-external/toolchain-external-codesourcery-mips/Config.in +++ b/toolchain/toolchain-external/toolchain-external-codesourcery-mips/Config.in @@ -5,7 +5,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_6 # Unsupported MIPS cores depends on !BR2_mips_interaptiv - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on "$(HOSTARCH)" = "x86_64" || "$(HOSTARCH)" = "x86" depends on !BR2_MIPS_NABI32 select BR2_TOOLCHAIN_EXTERNAL_GLIBC select BR2_TOOLCHAIN_HAS_SSP diff --git a/toolchain/toolchain-external/toolchain-external-linaro-aarch64-be/Config.in b/toolchain/toolchain-external/toolchain-external-linaro-aarch64-be/Config.in index 295a8987f1..ae727ffc4c 100644 --- a/toolchain/toolchain-external/toolchain-external-linaro-aarch64-be/Config.in +++ b/toolchain/toolchain-external/toolchain-external-linaro-aarch64-be/Config.in @@ -1,7 +1,7 @@ config BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64_BE bool "Linaro AArch64 BE 2018.05" depends on BR2_aarch64_be - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on "$(HOSTARCH)" = "x86_64" || "$(HOSTARCH)" = "x86" depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_8 select BR2_TOOLCHAIN_EXTERNAL_GLIBC select BR2_TOOLCHAIN_HAS_SSP diff --git a/toolchain/toolchain-external/toolchain-external-linaro-aarch64/Config.in b/toolchain/toolchain-external/toolchain-external-linaro-aarch64/Config.in index 1b0ec7cd9f..bee49235d4 100644 --- a/toolchain/toolchain-external/toolchain-external-linaro-aarch64/Config.in +++ b/toolchain/toolchain-external/toolchain-external-linaro-aarch64/Config.in @@ -1,7 +1,7 @@ config BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64 bool "Linaro AArch64 2018.05" depends on BR2_aarch64 - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on "$(HOSTARCH)" = "x86_64" || "$(HOSTARCH)" = "x86" depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_8 select BR2_TOOLCHAIN_EXTERNAL_GLIBC select BR2_TOOLCHAIN_HAS_SSP diff --git a/toolchain/toolchain-external/toolchain-external-linaro-arm/Config.in b/toolchain/toolchain-external/toolchain-external-linaro-arm/Config.in index 8b3b4c844e..4390482ab9 100644 --- a/toolchain/toolchain-external/toolchain-external-linaro-arm/Config.in +++ b/toolchain/toolchain-external/toolchain-external-linaro-arm/Config.in @@ -6,7 +6,7 @@ config BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM bool "Linaro ARM 2018.05" depends on BR2_arm depends on BR2_ARM_CPU_ARMV7A || BR2_ARM_CPU_ARMV8A - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on "$(HOSTARCH)" = "x86_64" || "$(HOSTARCH)" = "x86" depends on BR2_ARM_EABIHF depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_8 select BR2_TOOLCHAIN_EXTERNAL_GLIBC diff --git a/toolchain/toolchain-external/toolchain-external-linaro-armeb/Config.in b/toolchain/toolchain-external/toolchain-external-linaro-armeb/Config.in index b143ee5e24..3448864e4c 100644 --- a/toolchain/toolchain-external/toolchain-external-linaro-armeb/Config.in +++ b/toolchain/toolchain-external/toolchain-external-linaro-armeb/Config.in @@ -6,7 +6,7 @@ config BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB bool "Linaro armeb 2018.05" depends on BR2_armeb depends on BR2_ARM_CPU_ARMV7A || BR2_ARM_CPU_ARMV8A - depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86" + depends on "$(HOSTARCH)" = "x86_64" || "$(HOSTARCH)" = "x86" depends on BR2_ARM_EABIHF depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_8 select BR2_TOOLCHAIN_EXTERNAL_GLIBC diff --git a/toolchain/toolchain-external/toolchain-external-synopsys-arc/Config.in b/toolchain/toolchain-external/toolchain-external-synopsys-arc/Config.in index 292e652fb0..44ff9593b3 100644 --- a/toolchain/toolchain-external/toolchain-external-synopsys-arc/Config.in +++ b/toolchain/toolchain-external/toolchain-external-synopsys-arc/Config.in @@ -1,7 +1,7 @@ config BR2_TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC bool "Synopsys ARC 2019.09 toolchain" depends on BR2_arc - depends on BR2_HOSTARCH = "x86_64" + depends on "$(HOSTARCH)" = "x86_64" depends on !BR2_ARCH_NEEDS_GCC_AT_LEAST_10 select BR2_TOOLCHAIN_EXTERNAL_UCLIBC select BR2_INSTALL_LIBSTDCPP From patchwork Mon May 6 14:45:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Seiderer X-Patchwork-Id: 1932047 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=buildroot.org (client-ip=2605:bc80:3010::136; helo=smtp3.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver=patchwork.ozlabs.org) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4VY43d6jNbz1xnT for ; Tue, 7 May 2024 00:46:21 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 5C225608DD; Mon, 6 May 2024 14:46:20 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id n2MWAla2hx2i; Mon, 6 May 2024 14:46:19 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.34; helo=ash.osuosl.org; envelope-from=buildroot-bounces@buildroot.org; receiver= DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 737E8608EB Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by smtp3.osuosl.org (Postfix) with ESMTP id 737E8608EB; Mon, 6 May 2024 14:46:18 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 983C71BF59D for ; Mon, 6 May 2024 14:46:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 8407A81E07 for ; Mon, 6 May 2024 14:46:01 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id lUcLk8NGGF1C for ; Mon, 6 May 2024 14:46:00 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=212.227.15.18; helo=mout.gmx.net; envelope-from=ps.report@gmx.net; receiver= DMARC-Filter: OpenDMARC Filter v1.4.2 smtp1.osuosl.org 0105082024 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 0105082024 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) by smtp1.osuosl.org (Postfix) with ESMTPS id 0105082024 for ; Mon, 6 May 2024 14:45:59 +0000 (UTC) X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from localhost.fritz.box ([82.135.81.65]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MAOJV-1rtmBi4BTP-00Bq7t for ; Mon, 06 May 2024 16:45:58 +0200 To: buildroot@busybox.net Date: Mon, 6 May 2024 16:45:51 +0200 Message-ID: <20240506144555.31709-9-ps.report@gmx.net> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240506144555.31709-1-ps.report@gmx.net> References: <20240506144555.31709-1-ps.report@gmx.net> MIME-Version: 1.0 X-Provags-ID: V03:K1:OIvm8XKQS6s+akRTjexoab6DbIYou30Zaicmycv0oTkwcV4257b LPctLjXi0H+yDbXsPv8OkSNiZP72Cu3x4eg1KWZJCQfAO0W8g/gSgPQyvrJk8EAR0i2LAwC 7PklRxoEMUgtrNKGkOIaead3ucpelwtyrLXvESBQcMMlYvkSdmDxhFvvEsNBqLrBhY6gkO1 HYFgqkpunbuqHFY8VDYjA== UI-OutboundReport: notjunk:1;M01:P0:F/fFtoeug28=;jhG3YB9bSDfU/GtG1JKrqF6h1yb 0D9WaU4ZsuBsJZwSDZ24p5e/89ds2teTC39pvRrt+buKa9wQkj6UgW6tPVwDas/x1ewTSHgiS SSD5cLz5OARsRaRXpmZq/HbSrs8NYpHDMrKCa8NRJNsW6JHi2GtRmxcSwL4ZQ8d+b6jtuaztP S3EhaUQ1er8Pg1AGRaXvbgahNfZeyiDPs71g6MWOYXKAJ/xiMcwVbnh0d2ytnFNTvxsCN58h7 VVn5V4VUfvzchFT7IZ0YeCJD+sEdWPImn4a2DHeXwSPKKyinS0ylXjET//wpzp/Z3JmsmBY4Y Xny6bkjFoMbk6UUpnfnnjIllq5m2MuHgx/X/ZocwFuP7a1XNoYCSVxr3OFEgvX6kQigmo8e3+ MI12NRo2BqYT5fcBHbAJ9xFT7dlQBJ55C/FUag+Cc3csjcPbREZACz+zYZnSDafS06VmJPmWX xuVZmsqHFm8/Ev1fl/kj5DLKNqn3WDhvfKZJvFPW37cnnas8j77xUWitn1XrbBwRtQIFMfe8W Fjt3GYRlCrzEgrvUsZp7iccM1yDbzOxHwQ2NBCFM5QXv4ItMHPjZsXdrC0TfyEPoq4NlfUSQI qWlf9VK6nNi1IlTP4vFBKp5dHncdJJ8MUFlj1Vy2kBNJD53Spbfo0surSl9HG0mcO9gkx7vHI P5lLpUM0cTpqjejlO3W/gL3zBm0ajPy6jqunthyeFw81aSzIY0Z7Ezjg3Fc2csyO/5bw4OyOY oa4LPb4hsZCnSwZcvw9tA0VSrfXEeEdbOcCOcnVOcTwKo46ZKurNojrKTGWSq/sf46GHuJ5Fw 1sZYGX1qKDmesssfEWThBVR3xIQsXWgsqP7iydhC+W1AY= X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmx.net; s=s31663417; t=1715006758; x=1715611558; i=ps.report@gmx.net; bh=Yjxb3cWqfv9ZVMz2IYJrLNjRDPp3o4lOys7eKyhvmhA=; h=X-UI-Sender-Class:From:To:Subject:Date:Message-ID:In-Reply-To: References:MIME-Version:Content-Transfer-Encoding:cc: content-transfer-encoding:content-type:date:from:message-id: mime-version:reply-to:subject:to; b=FqMAk/wareTZXet4PIozH9xu5Qrrt8zx9qAwxdB2fTNeAxNyDHZvXbFVJvvU8H/o ayoEUGdQBQrG6OwdSW357Z7pdMDEss392kdrFTlZUhLMed4ivTWWG2BaIp3kHiY+w AIBojHgjXkyPnjN3lSyg/Xm4DfbAdPniOQgXxkaJjqRSVoUvTGYVW8wa/sN6LeH0+ uyiXL4AEqEkbvtbUk33p4WdU7k5/YjdogbpBVZS8UtJ8ZSn0xtWNmA5ExCAlwJ7Ac UGn2rv5ksnMgQ6Mhzr1kVl8Nh5Khuf6YUGLsr0GEvUt088W2HEHlEOMisx5jzE3jJ EeOa57mDwKRo0r0MeA== X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dmarc=pass (p=quarantine dis=none) header.from=gmx.net X-Mailman-Original-Authentication-Results: smtp1.osuosl.org; dkim=pass (2048-bit key) header.d=gmx.net header.i=ps.report@gmx.net header.a=rsa-sha256 header.s=s31663417 header.b=FqMAk/wa Subject: [Buildroot] [PATCH v1 8/8] package/openssl: move libopenssl/libressl source statemetns outside of the choice X-BeenThere: buildroot@buildroot.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Peter Seiderer via buildroot From: Peter Seiderer Reply-To: Peter Seiderer Errors-To: buildroot-bounces@buildroot.org Sender: "buildroot" Fixes the following error/warnings with kconfig from linux-6.9-rc5: package/libopenssl/Config.in:5:warning: choice value must have a prompt package/libopenssl/Config.in:7:warning: defaults for choice values not supported package/libopenssl/Config.in:15:warning: choice value must have a prompt package/libopenssl/Config.in:18:warning: defaults for choice values not supported package/libopenssl/Config.in:19:warning: defaults for choice values not supported package/libopenssl/Config.in:20:warning: defaults for choice values not supported package/libopenssl/Config.in:21:warning: defaults for choice values not supported package/libopenssl/Config.in:22:warning: defaults for choice values not supported package/libopenssl/Config.in:23:warning: defaults for choice values not supported package/libopenssl/Config.in:24:warning: defaults for choice values not supported package/libopenssl/Config.in:25:warning: defaults for choice values not supported package/libopenssl/Config.in:26:warning: defaults for choice values not supported package/libopenssl/Config.in:27:warning: defaults for choice values not supported package/libopenssl/Config.in:28:warning: defaults for choice values not supported package/libopenssl/Config.in:32:warning: defaults for choice values not supported package/libopenssl/Config.in:33:warning: defaults for choice values not supported package/libopenssl/Config.in:34:warning: defaults for choice values not supported package/libopenssl/Config.in:50:warning: defaults for choice values not supported package/libopenssl/Config.in:54:warning: defaults for choice values not supported package/libopenssl/Config.in:58:warning: defaults for choice values not supported package/libopenssl/Config.in:62:warning: defaults for choice values not supported package/libopenssl/Config.in:66:warning: defaults for choice values not supported package/libopenssl/Config.in:70:warning: defaults for choice values not supported package/libopenssl/Config.in:75:warning: defaults for choice values not supported package/libopenssl/Config.in:79:warning: defaults for choice values not supported package/libopenssl/Config.in:83:warning: defaults for choice values not supported package/libopenssl/Config.in:87:warning: defaults for choice values not supported package/libopenssl/Config.in:91:warning: defaults for choice values not supported package/libopenssl/Config.in:95:warning: defaults for choice values not supported package/libopenssl/Config.in:99:warning: defaults for choice values not supported package/libopenssl/Config.in:103:warning: defaults for choice values not supported package/libopenssl/Config.in:107:warning: defaults for choice values not supported package/libopenssl/Config.in:111:warning: defaults for choice values not supported package/libopenssl/Config.in:115:warning: defaults for choice values not supported package/libopenssl/Config.in:119:warning: defaults for choice values not supported package/libopenssl/Config.in:123:warning: defaults for choice values not supported package/libopenssl/Config.in:130:warning: defaults for choice values not supported package/libopenssl/Config.in:134:warning: defaults for choice values not supported package/openssl/Config.in:12:error: recursive dependency detected! package/openssl/Config.in:12: choice contains symbol BR2_PACKAGE_LIBOPENSSL_TARGET_ARCH_LINUX_PPC package/libopenssl/Config.in:5: symbol BR2_PACKAGE_LIBOPENSSL_TARGET_ARCH_LINUX_PPC is part of choice BR2_PACKAGE_LIBOPENSSL package/openssl/Config.in:17: symbol BR2_PACKAGE_LIBOPENSSL is part of choice For a resolution refer to Documentation/kbuild/kconfig-language.rst subsection "Kconfig recursive dependency limitations" Signed-off-by: Peter Seiderer --- Notes/ToDo: - with this solution the external support needs to be splitted into two imports/lines... --- package/openssl/Config.in | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/package/openssl/Config.in b/package/openssl/Config.in index 3d14988d99..fcf996f03f 100644 --- a/package/openssl/Config.in +++ b/package/openssl/Config.in @@ -28,8 +28,6 @@ config BR2_PACKAGE_LIBOPENSSL Note: Some helper scripts need perl. -source "package/libopenssl/Config.in" - config BR2_PACKAGE_LIBRESSL bool "libressl" depends on !BR2_PACKAGE_OPENSSL_FORCE_LIBOPENSSL @@ -44,13 +42,14 @@ config BR2_PACKAGE_LIBRESSL http://www.libressl.org/ -source "package/libressl/Config.in" - # openssl from br2-external trees, if any source "$(BASE_DIR)/.br2-external.in.openssl" endchoice +source "package/libopenssl/Config.in" +source "package/libressl/Config.in" + config BR2_PACKAGE_HAS_OPENSSL bool