From 66d86d23716fc71e71a459f5352eee3a9caf749b Mon Sep 17 00:00:00 2001 From: coolsnowwolf Date: Wed, 19 Oct 2022 20:39:19 +0800 Subject: [PATCH] scripts: sync with upstream --- Config.in | 10 +- Makefile | 21 +- config/check-uname.sh | 1 + rules.mk | 27 +- scripts/cameo-imghdr.py | 86 + scripts/cameo-tag.py | 117 ++ scripts/cfe-partition-tag.py | 230 +-- scripts/cfe-wfi-tag.py | 211 +- scripts/check-toolchain-clean.sh | 14 + scripts/checkpatch.pl | 2 +- scripts/command_all.sh | 11 + scripts/config/.gitignore | 30 +- scripts/config/Makefile | 62 +- scripts/config/README | 9 +- scripts/config/conf.c | 449 +++-- scripts/config/confdata.c | 279 +-- scripts/config/expr.h | 6 - scripts/config/images.c | 30 +- scripts/config/images.h | 30 +- scripts/config/internal.h | 9 + scripts/config/lexer.l | 8 +- scripts/config/lexer.lex.c | 2466 +++++++++++------------- scripts/config/lkc.h | 68 +- scripts/config/lkc_proto.h | 15 +- scripts/config/lxdialog/util.c | 4 +- scripts/config/mconf-cfg.sh | 4 +- scripts/config/mconf.c | 15 +- scripts/config/menu.c | 26 +- scripts/config/nconf.c | 59 +- scripts/config/nconf.gui.c | 276 ++- scripts/config/nconf.h | 51 +- scripts/config/parser.tab.c | 1810 ++++++++--------- scripts/config/parser.tab.h | 120 +- scripts/config/parser.y | 57 +- scripts/config/preprocess.c | 2 +- scripts/config/qconf-cfg.sh | 14 +- scripts/config/qconf.cc | 1050 +++++----- scripts/config/qconf.h | 166 +- scripts/config/symbol.c | 30 +- scripts/dl_cleanup.py | 450 +++-- scripts/dl_github_archive.py | 4 +- scripts/download.pl | 59 +- scripts/dump-target-info.pl | 26 +- scripts/env | 2 +- scripts/ext-toolchain.sh | 51 +- scripts/ext-tools.sh | 98 + scripts/feeds | 42 +- scripts/flashing/eva_ramboot.py | 1 - scripts/gen-rddependencies.sh | 13 - scripts/gen_image_generic.sh | 24 +- scripts/ipkg-build | 9 +- scripts/json_add_image_info.py | 36 +- scripts/json_overview_image_info.py | 4 +- scripts/linksys-image.sh | 4 +- scripts/metadata.pm | 9 +- scripts/mkhash.c | 2 +- scripts/mkits-zyxel-fit.sh | 38 + scripts/mkits.sh | 25 +- scripts/netgear-encrypted-factory.py | 68 + scripts/package-metadata.pl | 36 + scripts/pad_image | 2 +- scripts/rstrip.sh | 1 + scripts/sercomm-kernel-header.py | 121 ++ scripts/sercomm-kernel.sh | 122 -- scripts/sercomm-pid.py | 102 + scripts/sign_images.sh | 4 +- scripts/size_compare.sh | 4 +- scripts/slugimage.pl | 4 +- scripts/target-metadata.pl | 57 +- scripts/ubinize-image.sh | 45 +- target/linux/mediatek/image/filogic.mk | 17 + 71 files changed, 4659 insertions(+), 4696 deletions(-) create mode 100755 config/check-uname.sh create mode 100755 scripts/cameo-imghdr.py create mode 100755 scripts/cameo-tag.py create mode 100755 scripts/check-toolchain-clean.sh create mode 100755 scripts/command_all.sh create mode 100644 scripts/config/internal.h create mode 100755 scripts/ext-tools.sh delete mode 100755 scripts/gen-rddependencies.sh create mode 100755 scripts/mkits-zyxel-fit.sh create mode 100755 scripts/netgear-encrypted-factory.py create mode 100755 scripts/sercomm-kernel-header.py delete mode 100755 scripts/sercomm-kernel.sh create mode 100755 scripts/sercomm-pid.py diff --git a/Config.in b/Config.in index 546e8249c..6d71d4c6e 100644 --- a/Config.in +++ b/Config.in @@ -5,7 +5,7 @@ mainmenu "OpenWrt Configuration" config MODULES - option modules + modules bool default y @@ -13,6 +13,14 @@ config HAVE_DOT_CONFIG bool default y +HOST_OS := $(shell, uname) + +config HOST_OS_LINUX + def_bool $(shell, ./config/check-uname.sh Linux) + +config HOST_OS_MACOS + def_bool $(shell, ./config/check-uname.sh Darwin) + source "target/Config.in" source "config/Config-images.in" diff --git a/Makefile b/Makefile index 5bf219335..cbf9fa2cd 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ $(if $(findstring $(space),$(TOPDIR)),$(error ERROR: The path to the OpenWrt dir world: -DISTRO_PKG_CONFIG:=$(shell which -a pkg-config | grep '/usr' -m 1) +DISTRO_PKG_CONFIG:=$(shell $(TOPDIR)/scripts/command_all.sh pkg-config | grep '/usr' -m 1) export PATH:=$(TOPDIR)/staging_dir/host/bin:$(PATH) ifneq ($(OPENWRT_BUILD),1) @@ -38,7 +38,7 @@ else include tools/Makefile include toolchain/Makefile -$(toolchain/stamp-compile): $(tools/stamp-compile) +$(toolchain/stamp-compile): $(tools/stamp-compile) $(if $(CONFIG_BUILDBOT),toolchain_rebuild_check) $(target/stamp-compile): $(toolchain/stamp-compile) $(tools/stamp-compile) $(BUILD_DIR)/.prepared $(package/stamp-compile): $(target/stamp-compile) $(package/stamp-cleanup) $(package/stamp-install): $(package/stamp-compile) @@ -50,14 +50,23 @@ printdb: prepare: $(target/stamp-compile) -clean: FORCE - rm -rf $(BUILD_DIR) $(STAGING_DIR) $(BIN_DIR) $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES) $(BUILD_LOG_DIR) $(TOPDIR)/staging_dir/packages +_clean: FORCE + rm -rf $(BUILD_DIR) $(STAGING_DIR) $(BIN_DIR) $(OUTPUT_DIR)/packages/$(ARCH_PACKAGES) $(TOPDIR)/staging_dir/packages -dirclean: clean - rm -rf $(STAGING_DIR_HOST) $(STAGING_DIR_HOSTPKG) $(TOOLCHAIN_DIR) $(BUILD_DIR_BASE)/host $(BUILD_DIR_BASE)/hostpkg $(BUILD_DIR_TOOLCHAIN) +clean: _clean + rm -rf $(BUILD_LOG_DIR) + +targetclean: _clean + rm -rf $(TOOLCHAIN_DIR) $(BUILD_DIR_BASE)/hostpkg $(BUILD_DIR_TOOLCHAIN) + +dirclean: targetclean clean + rm -rf $(STAGING_DIR_HOST) $(STAGING_DIR_HOSTPKG) $(BUILD_DIR_BASE)/host rm -rf $(TMP_DIR) $(MAKE) -C $(TOPDIR)/scripts/config clean +toolchain_rebuild_check: + $(SCRIPT_DIR)/check-toolchain-clean.sh + cacheclean: ifneq ($(CONFIG_CCACHE),) $(STAGING_DIR_HOST)/bin/ccache -C diff --git a/config/check-uname.sh b/config/check-uname.sh new file mode 100755 index 000000000..1f1bf9ee0 --- /dev/null +++ b/config/check-uname.sh @@ -0,0 +1 @@ +[ "$(uname)" = "$1" ] && echo y || echo n diff --git a/rules.mk b/rules.mk index 0463b02c2..2de43d490 100644 --- a/rules.mk +++ b/rules.mk @@ -62,7 +62,6 @@ ARCH_PACKAGES:=$(call qstrip,$(CONFIG_TARGET_ARCH_PACKAGES)) BOARD:=$(call qstrip,$(CONFIG_TARGET_BOARD)) SUBTARGET:=$(call qstrip,$(CONFIG_TARGET_SUBTARGET)) TARGET_OPTIMIZATION:=$(call qstrip,$(CONFIG_TARGET_OPTIMIZATION)) -export EXTRA_OPTIMIZATION:=$(filter-out -fno-plt,$(call qstrip,$(CONFIG_EXTRA_OPTIMIZATION))) TARGET_SUFFIX=$(call qstrip,$(CONFIG_TARGET_SUFFIX)) BUILD_SUFFIX:=$(call qstrip,$(CONFIG_BUILD_SUFFIX)) SUBDIR:=$(patsubst $(TOPDIR)/%,%,${CURDIR}) @@ -110,7 +109,7 @@ $(foreach t,$(DEFAULT_SUBDIR_TARGETS) $(1), ) endef -DL_DIR:=$(if $(call qstrip,$(CONFIG_DOWNLOAD_FOLDER)),$(call qstrip,$(CONFIG_DOWNLOAD_FOLDER)),$(TOPDIR)/dl) +DL_DIR=$(if $(call qstrip,$(CONFIG_DOWNLOAD_FOLDER)),$(call qstrip,$(CONFIG_DOWNLOAD_FOLDER)),$(TOPDIR)/dl)$(if $(DL_SUBDIR),/$(DL_SUBDIR)) OUTPUT_DIR:=$(if $(call qstrip,$(CONFIG_BINARY_FOLDER)),$(call qstrip,$(CONFIG_BINARY_FOLDER)),$(TOPDIR)/bin) BIN_DIR:=$(OUTPUT_DIR)/targets/$(BOARD)/$(SUBTARGET) INCLUDE_DIR:=$(TOPDIR)/include @@ -138,11 +137,7 @@ else endif ifeq ($(or $(CONFIG_EXTERNAL_TOOLCHAIN),$(CONFIG_TARGET_uml)),) - ifeq ($(CONFIG_GCC_USE_IREMAP),y) - iremap = -iremap$(1):$(2) - else - iremap = -f$(if $(CONFIG_REPRODUCIBLE_DEBUG_INFO),file,macro)-prefix-map=$(1)=$(2) - endif + iremap = -f$(if $(CONFIG_REPRODUCIBLE_DEBUG_INFO),file,macro)-prefix-map=$(1)=$(2) endif PACKAGE_DIR:=$(BIN_DIR)/packages @@ -213,7 +208,6 @@ ifndef DUMP ifneq ($(TOOLCHAIN_LIB_DIRS),) TARGET_LDFLAGS+= $(patsubst %,-L%,$(TOOLCHAIN_LIB_DIRS)) endif - TARGET_PATH:=$(TOOLCHAIN_DIR)/bin:$(TARGET_PATH) endif endif endif @@ -244,23 +238,17 @@ export PKG_CONFIG HOSTCC:=gcc HOSTCXX:=g++ HOST_CPPFLAGS:=-I$(STAGING_DIR_HOST)/include $(if $(IS_PACKAGE_BUILD),-I$(STAGING_DIR_HOSTPKG)/include -I$(STAGING_DIR)/host/include) +HOST_CXXFLAGS:= HOST_CFLAGS:=-O2 $(HOST_CPPFLAGS) HOST_LDFLAGS:=-L$(STAGING_DIR_HOST)/lib $(if $(IS_PACKAGE_BUILD),-L$(STAGING_DIR_HOSTPKG)/lib -L$(STAGING_DIR)/host/lib) -ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) - TARGET_AR:=$(TARGET_CROSS)gcc-ar - TARGET_RANLIB:=$(TARGET_CROSS)gcc-ranlib - TARGET_NM:=$(TARGET_CROSS)gcc-nm -else - TARGET_AR:=$(TARGET_CROSS)ar - TARGET_RANLIB:=$(TARGET_CROSS)ranlib - TARGET_NM:=$(TARGET_CROSS)nm -endif - BUILD_KEY=$(TOPDIR)/key-build FAKEROOT:=$(STAGING_DIR_HOST)/bin/fakeroot +TARGET_AR:=$(TARGET_CROSS)gcc-ar +TARGET_RANLIB:=$(TARGET_CROSS)gcc-ranlib +TARGET_NM:=$(TARGET_CROSS)gcc-nm TARGET_CC:=$(TARGET_CROSS)gcc TARGET_CXX:=$(TARGET_CROSS)g++ KPATCH:=$(SCRIPT_DIR)/patch-kernel.sh @@ -269,9 +257,6 @@ ESED:=$(STAGING_DIR_HOST)/bin/sed -E -i -e MKHASH:=$(STAGING_DIR_HOST)/bin/mkhash # MKHASH is used in /scripts, so we export it here. export MKHASH -# DOWNLOAD_CHECK_CERTIFICATE is used in /scripts, so we export it here. -DOWNLOAD_CHECK_CERTIFICATE:=$(CONFIG_DOWNLOAD_CHECK_CERTIFICATE) -export DOWNLOAD_CHECK_CERTIFICATE CP:=cp -fpR LN:=ln -sf XARGS:=xargs -r diff --git a/scripts/cameo-imghdr.py b/scripts/cameo-imghdr.py new file mode 100755 index 000000000..1f8292b90 --- /dev/null +++ b/scripts/cameo-imghdr.py @@ -0,0 +1,86 @@ +#!/usr/bin/python3 +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2022 Luiz Angelo Daros de Luca +# +# Cameo Image header geneator, used by some D-Link DGS-1210 switches +# and APRESIA ApresiaLightGS series +# +import argparse +import pathlib +import socket +import struct + +MODEL_LEN = 20 +SIGNATURE_LEN = 16 +LINUXLOAD_LEN = 10 +BUFSIZE = 4096 + +parser = argparse.ArgumentParser(description='Generate Cameo firmware header.') +parser.add_argument('source_file', type=argparse.FileType('rb')) +parser.add_argument('dest_file', type=argparse.FileType('wb')) +parser.add_argument('model') +parser.add_argument('signature') +parser.add_argument('partition', type=int, choices=range(0,10), + metavar="partition=[0-9]",help="partition id") +parser.add_argument('customer_signature', type=int, choices=range(0,10), + metavar="customer_signature=[0-9]", + help="customer signature") +parser.add_argument('board_version', type=int, choices=range(0,2**32), + metavar="board_version=[0-4294967295]", + help="board version") +parser.add_argument('linux_loadaddr', nargs='?', + help="Kernel start address in 0xFFFFFFFF format") +args = parser.parse_args() + +if len(args.model) > MODEL_LEN: + raise ValueError(f"Model '{args.model}' is greater than {MODEL_LEN} bytes") + +if len(args.signature) > SIGNATURE_LEN: + raise ValueError(f"Signature '{args.signature}' is greater than" + f"{SIGNATURE_LEN} bytes") + +if args.signature == "os": + if args.linux_loadaddr: + if len(args.linux_loadaddr) > LINUXLOAD_LEN: + raise ValueError(f"linux_loadaddr '{args.linux_loadaddr}' is greater" + f"than {LINUXLOAD_LEN} bytes") + if (args.linux_loadaddr[0:2] != "0x"): + raise ValueError(f"linux_loadaddr '{args.linux_loadaddr}' must use" + f"the 0x789ABCDE format") + int(args.linux_loadaddr[2:],16) + else: + raise ValueError(f"linux_loadaddr is required for signature 'os'") +else: + args.linux_loadaddr = "" + +checksum = 0 +size = 0 +while True: + buf = args.source_file.read(BUFSIZE) + if not buf: + break + checksum = sum(iter(buf),checksum) % (1<<32) + size += len(buf) + +args.dest_file.write(struct.pack('!I', checksum)) +args.dest_file.write(struct.pack(f'{MODEL_LEN}s', + args.model.encode("ascii"))) +args.dest_file.write(struct.pack(f'{SIGNATURE_LEN}s', + args.signature.encode("ascii"))) +args.dest_file.write(struct.pack('!B', args.partition)) +args.dest_file.write(struct.pack('!B', 0x40)) # ??? This header size? +args.dest_file.write(struct.pack('!B', 0x00)) # ??? Encrypted? +args.dest_file.write(struct.pack('!B', args.customer_signature)) +args.dest_file.write(struct.pack('!I', args.board_version)) +args.dest_file.write(struct.pack('!I', size)) +args.dest_file.write(struct.pack(f'{LINUXLOAD_LEN}s', + args.linux_loadaddr.encode("ascii"))) +args.dest_file.write(struct.pack('!2x')) + +args.source_file.seek(0) +while True: + buf = args.source_file.read(BUFSIZE) + if not buf: + break + args.dest_file.write(buf) diff --git a/scripts/cameo-tag.py b/scripts/cameo-tag.py new file mode 100755 index 000000000..becd69f8e --- /dev/null +++ b/scripts/cameo-tag.py @@ -0,0 +1,117 @@ +#!/usr/bin/python3 +# SPDX-License-Identifier: GPL-2.0-or-later +# +# Copyright (C) 2022 OpenWrt.org +# +# ./cameo-tag.py +# +# CAMEO tag generator used for the D-Link DGS-1210 switches. Their U-Boot +# loader checks for the string CAMEOTAG and a checksum in the kernel and +# rootfs partitions. If not found it complains about the boot image. +# Nevertheless it will boot if the tags are available in the secondary +# boot partitions. If some day we want to overwrite the original vendor +# partition we must have the tags in place. To solve this we insert the +# tag two times into the kernel image. +# +# To understand what we do here it is helpful to explain how the original +# CAMEO tag generation/checking works. The firmware consists of two parts. +# A kernel uImage (<1.5MB) and a rootfs image (<12MB) that are written to +# their respective mtd partitions. The default generator simply checksums +# both parts and appends 16 bytes [<0001>] to each part. +# The checksum is only an addition of all preceding bytes (b0+b1+b2+...). +# A tag does not interfere with any data in the images itself. During boot +# the loader will scan all primary/secondary partitions (2*kernel, 2*rootfs) +# until it finds the CAMEO tag. If checksums match everything is fine. +# If all 4 fail we are lost. Luckily the loader does not care about where +# the tags are located and ignores any data beyond a tag. +# +# The OpenWrt image consists of a kernel (>1.5MB) and a rootfs. There is +# no chance to add CAMEO tags at the default locations, since the kernel spans +# both the original kernel partition and the start of the rootfs partition. +# This would leave the kernel partition without a tag. So we must find suitable +# space. +# +# Location for original kernel partition is at the end of the uImage header. +# We will reuse the last bytes of the IH_NAME field. This is the tricky part +# because we have the header CRC and the CAMEO checksum that must match the +# whole header. uImage header CRC checksums all data except the CRC itself. The +# for CAMEO checksum in turn, checksums all preceding data except itself. +# Changing one of both results in a change of the other, but data trailing the +# CAMEO checksum only influences the CRC. +# +# Location for original rootfs partition is very simple. It is behind the +# OpenWrt compressed kernel image file that spans into the rootfs. So +# the tag will be written somewhere to the following rootfs partition and +# can be found by U-Boot. The CAMEO checksum calculation must start at the +# offset of the original rootfs partition and includes the "second" half of the +# "split" kernel uImage. + +import argparse +import os +import zlib + +READ_UNTIL_EOF = -1 +UIMAGE_HEADER_SIZE = 64 +UIMAGE_CRC_OFF = 4 +UIMAGE_CRC_END = 8 +UIMAGE_NAME_OFF = 32 +UIMAGE_NAME_END = 56 +UIMAGE_SUM_OFF = 56 +UIMAGE_SUM_END = 60 +UIMAGE_INV_OFF = 60 +UIMAGE_INV_END = 64 +CAMEO_TAG = bytes([0x43, 0x41, 0x4d, 0x45, 0x4f, 0x54, 0x41, 0x47, 0x00, 0x00, 0x00, 0x01]) +IMAGE_NAME = bytes([0x4f, 0x70, 0x65, 0x6e, 0x57, 0x72, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00]) +CRC_00 = bytes([0x00] * 4) +CRC_FF = bytes([0xff] * 4) + +def read_buffer(offset, count): + args.uimage_file.seek(offset) + return bytearray(args.uimage_file.read(count)) + +def write_buffer(whence, buf): + args.uimage_file.seek(0, whence) + args.uimage_file.write(buf) + +def cameosum(buf): + return (sum(buf) & 0xffffffff).to_bytes(4, 'big') + +def invertcrc(buf): + return (zlib.crc32(buf) ^ 0xffffffff).to_bytes(4, 'little') + +def checksum_header(buf): + # To efficently get a combination, we will make use of the following fact: + # crc32(data + littleendian(crc32(data) ^ 0xffffffff)) = 0xffffffff + # + # After manipulation the uImage header looks like this: + # [......<000000><0001>] + buf[UIMAGE_NAME_OFF:UIMAGE_NAME_END] = IMAGE_NAME + CAMEO_TAG + buf[UIMAGE_CRC_OFF:UIMAGE_CRC_END] = CRC_FF + buf[UIMAGE_SUM_OFF:UIMAGE_SUM_END] = cameosum(buf[0:UIMAGE_NAME_END]) + buf[UIMAGE_CRC_OFF:UIMAGE_CRC_END] = CRC_00 + buf[UIMAGE_INV_OFF:UIMAGE_INV_END] = invertcrc(buf[0:UIMAGE_SUM_END]) + buf[UIMAGE_CRC_OFF:UIMAGE_CRC_END] = CRC_FF + return buf + +parser = argparse.ArgumentParser(description='Insert CAMEO firmware tags.') +parser.add_argument('uimage_file', type=argparse.FileType('r+b')) +parser.add_argument('rootfs_start', type=int) +args = parser.parse_args() + +args.uimage_file.seek(0, os.SEEK_END) +if args.uimage_file.tell() <= args.rootfs_start: + raise ValueError(f"uImage must be larger than {args.rootfs_start} bytes") + +# tag for the uImage Header of 64 bytes inside the kernel +# partition. Read and mangle it so it contains a valid CAMEO tag +# and checksum that matches perfectly to the uImage header CRC. + +buf = checksum_header(read_buffer(0, UIMAGE_HEADER_SIZE)) +write_buffer(os.SEEK_SET, buf) + +# tag for the second part of the kernel that resides in the +# vendor rootfs partition. For this we will add the CAMEO tag +# and the checksum to the end of the image. + +buf = read_buffer(args.rootfs_start, READ_UNTIL_EOF) +write_buffer(os.SEEK_END, CAMEO_TAG + cameosum(buf + CAMEO_TAG)) diff --git a/scripts/cfe-partition-tag.py b/scripts/cfe-partition-tag.py index a2605d520..41495a9af 100755 --- a/scripts/cfe-partition-tag.py +++ b/scripts/cfe-partition-tag.py @@ -17,175 +17,123 @@ CFE Partition Tag import argparse import os import struct +import binascii + PART_NAME_SIZE = 33 PART_VERSION_SIZE = 21 -CRC32_INIT = 0xFFFFFFFF -CRC32_TABLE = [ - 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, - 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, - 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, - 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, - 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, - 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, - 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, - 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, - 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, - 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, - 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, - 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, - 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, - 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, - 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, - 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, - 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, - 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, - 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, - 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, - 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, - 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, - 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, - 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, - 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, - 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, - 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, - 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, - 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, - 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, - 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, - 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, - 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, - 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, - 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, - 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, - 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, - 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, - 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, - 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, - 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, - 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, - 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, - 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, - 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, - 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, - 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, - 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, - 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, - 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, - 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, - 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, - 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, - 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, - 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, - 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, - 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, - 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, - 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, - 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, - 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, - 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, - 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, - 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D -] def auto_int(x): - return int(x, 0) + return int(x, 0) -def crc32(bytes, size, crc): - i = 0 - while (i < size): - crc = (crc >> 8) ^ CRC32_TABLE[(crc ^ bytes[i]) & 0xff] - i += 1 - return crc def str_to_bytes_pad(string, size): - str_bytes = string.encode() - num_bytes = len(str_bytes) - if (num_bytes >= size): - str_bytes = str_bytes[:size - 1] + '\0'.encode() - else: - str_bytes += '\0'.encode() * (size - num_bytes) - return str_bytes + str_bytes = string.encode() + num_bytes = len(str_bytes) + if num_bytes >= size: + str_bytes = str_bytes[: size - 1] + "\0".encode() + else: + str_bytes += "\0".encode() * (size - num_bytes) + return str_bytes + def create_tag(args, in_bytes, size): - crc = crc32(in_bytes, size, CRC32_INIT) + # JAM CRC32 is bitwise not and unsigned + crc = ~binascii.crc32(in_bytes) & 0xFFFFFFFF - tag = bytearray() - tag += struct.pack('>I', args.part_id) - tag += struct.pack('>I', size) - tag += struct.pack('>H', args.part_flags) - tag += str_to_bytes_pad(args.part_name, PART_NAME_SIZE) - tag += str_to_bytes_pad(args.part_version, PART_VERSION_SIZE) - tag += struct.pack('>I', crc) + tag = bytearray() + tag += struct.pack(">I", args.part_id) + tag += struct.pack(">I", size) + tag += struct.pack(">H", args.part_flags) + tag += str_to_bytes_pad(args.part_name, PART_NAME_SIZE) + tag += str_to_bytes_pad(args.part_version, PART_VERSION_SIZE) + tag += struct.pack(">I", crc) + + return tag - return tag def create_output(args): - in_st = os.stat(args.input_file) - in_size = in_st.st_size + in_st = os.stat(args.input_file) + in_size = in_st.st_size - in_f = open(args.input_file, 'r+b') - in_bytes = in_f.read(in_size) - in_f.close() + in_f = open(args.input_file, "r+b") + in_bytes = in_f.read(in_size) + in_f.close() - tag = create_tag(args, in_bytes, in_size) + tag = create_tag(args, in_bytes, in_size) + + out_f = open(args.output_file, "w+b") + out_f.write(tag) + out_f.close() - out_f = open(args.output_file, 'w+b') - out_f.write(tag) - out_f.close() def main(): - global args + global args - parser = argparse.ArgumentParser(description='') + parser = argparse.ArgumentParser(description="") - parser.add_argument('--flags', - dest='part_flags', - action='store', - type=auto_int, - help='Partition Flags') + parser.add_argument( + "--flags", + dest="part_flags", + action="store", + type=auto_int, + help="Partition Flags", + ) - parser.add_argument('--id', - dest='part_id', - action='store', - type=auto_int, - help='Partition ID') + parser.add_argument( + "--id", + dest="part_id", + action="store", + type=auto_int, + help="Partition ID", + ) - parser.add_argument('--input-file', - dest='input_file', - action='store', - type=str, - help='Input file') + parser.add_argument( + "--input-file", + dest="input_file", + action="store", + type=str, + help="Input file", + ) - parser.add_argument('--output-file', - dest='output_file', - action='store', - type=str, - help='Output file') + parser.add_argument( + "--output-file", + dest="output_file", + action="store", + type=str, + help="Output file", + ) - parser.add_argument('--name', - dest='part_name', - action='store', - type=str, - help='Partition Name') + parser.add_argument( + "--name", + dest="part_name", + action="store", + type=str, + help="Partition Name", + ) - parser.add_argument('--version', - dest='part_version', - action='store', - type=str, - help='Partition Version') + parser.add_argument( + "--version", + dest="part_version", + action="store", + type=str, + help="Partition Version", + ) - args = parser.parse_args() + args = parser.parse_args() + + if ( + (not args.part_flags) + or (not args.part_id) + or (not args.input_file) + or (not args.output_file) + or (not args.part_name) + or (not args.part_version) + ): + parser.print_help() + else: + create_output(args) - if ((not args.part_flags) or - (not args.part_id) or - (not args.input_file) or - (not args.output_file) or - (not args.part_name) or - (not args.part_version)): - parser.print_help() - else: - create_output(args) main() diff --git a/scripts/cfe-wfi-tag.py b/scripts/cfe-wfi-tag.py index 78ae869f1..5fac8ee47 100755 --- a/scripts/cfe-wfi-tag.py +++ b/scripts/cfe-wfi-tag.py @@ -43,158 +43,107 @@ Flags: import argparse import os import struct +import binascii -CRC32_INIT = 0xFFFFFFFF -CRC32_TABLE = [ - 0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, - 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3, - 0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988, - 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91, - 0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE, - 0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7, - 0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC, - 0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5, - 0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172, - 0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B, - 0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940, - 0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59, - 0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116, - 0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F, - 0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924, - 0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D, - 0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A, - 0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433, - 0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818, - 0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01, - 0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E, - 0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457, - 0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C, - 0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65, - 0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2, - 0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB, - 0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0, - 0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9, - 0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086, - 0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F, - 0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4, - 0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD, - 0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A, - 0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683, - 0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8, - 0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1, - 0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE, - 0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7, - 0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC, - 0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5, - 0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252, - 0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B, - 0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60, - 0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79, - 0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236, - 0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F, - 0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04, - 0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D, - 0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A, - 0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713, - 0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38, - 0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21, - 0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E, - 0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777, - 0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C, - 0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45, - 0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2, - 0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB, - 0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0, - 0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9, - 0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6, - 0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF, - 0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94, - 0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D -] def auto_int(x): - return int(x, 0) + return int(x, 0) -def crc32(bytes, size, crc): - i = 0 - while (i < size): - crc = (crc >> 8) ^ CRC32_TABLE[(crc ^ bytes[i]) & 0xff] - i += 1 - return crc -def create_tag(args, in_bytes, size): - crc = crc32(in_bytes, size, CRC32_INIT) - tag = struct.pack('>IIIII', crc, args.tag_version, args.chip_id, args.flash_type, args.flags) - return tag +def create_tag(args, in_bytes): + # JAM CRC32 is bitwise not and unsigned + crc = ~binascii.crc32(in_bytes) & 0xFFFFFFFF + tag = struct.pack( + ">IIIII", + crc, + args.tag_version, + args.chip_id, + args.flash_type, + args.flags, + ) + return tag + def create_output(args): - in_st = os.stat(args.input_file) - in_size = in_st.st_size + in_st = os.stat(args.input_file) + in_size = in_st.st_size - in_f = open(args.input_file, 'r+b') - in_bytes = in_f.read(in_size) - in_f.close() + in_f = open(args.input_file, "r+b") + in_bytes = in_f.read(in_size) + in_f.close() - tag = create_tag(args, in_bytes, in_size) + tag = create_tag(args, in_bytes) + + out_f = open(args.output_file, "w+b") + out_f.write(in_bytes) + out_f.write(tag) + out_f.close() - out_f = open(args.output_file, 'w+b') - out_f.write(in_bytes) - out_f.write(tag) - out_f.close() def main(): - global args + global args - parser = argparse.ArgumentParser(description='') + parser = argparse.ArgumentParser(description="") - parser.add_argument('--input-file', - dest='input_file', - action='store', - type=str, - help='Input file') + parser.add_argument( + "--input-file", + dest="input_file", + action="store", + type=str, + help="Input file", + ) - parser.add_argument('--output-file', - dest='output_file', - action='store', - type=str, - help='Output file') + parser.add_argument( + "--output-file", + dest="output_file", + action="store", + type=str, + help="Output file", + ) - parser.add_argument('--version', - dest='tag_version', - action='store', - type=auto_int, - help='WFI Tag Version') + parser.add_argument( + "--version", + dest="tag_version", + action="store", + type=auto_int, + help="WFI Tag Version", + ) - parser.add_argument('--chip-id', - dest='chip_id', - action='store', - type=auto_int, - help='WFI Chip ID') + parser.add_argument( + "--chip-id", + dest="chip_id", + action="store", + type=auto_int, + help="WFI Chip ID", + ) - parser.add_argument('--flash-type', - dest='flash_type', - action='store', - type=auto_int, - help='WFI Flash Type') + parser.add_argument( + "--flash-type", + dest="flash_type", + action="store", + type=auto_int, + help="WFI Flash Type", + ) - parser.add_argument('--flags', - dest='flags', - action='store', - type=auto_int, - help='WFI Flags') + parser.add_argument( + "--flags", dest="flags", action="store", type=auto_int, help="WFI Flags" + ) - args = parser.parse_args() + args = parser.parse_args() - if not args.flags: - args.flags = 0 + if not args.flags: + args.flags = 0 + + if ( + (not args.input_file) + or (not args.output_file) + or (not args.tag_version) + or (not args.chip_id) + or (not args.flash_type) + ): + parser.print_help() + else: + create_output(args) - if ((not args.input_file) or - (not args.output_file) or - (not args.tag_version) or - (not args.chip_id) or - (not args.flash_type)): - parser.print_help() - else: - create_output(args) main() diff --git a/scripts/check-toolchain-clean.sh b/scripts/check-toolchain-clean.sh new file mode 100755 index 000000000..455cfb044 --- /dev/null +++ b/scripts/check-toolchain-clean.sh @@ -0,0 +1,14 @@ +#!/bin/sh +eval "$(grep CONFIG_GCC_VERSION .config)" +CONFIG_TOOLCHAIN_BUILD_VER="$CONFIG_GCC_VERSION-$(cat toolchain/build_version)" +touch .toolchain_build_ver +CURRENT_TOOLCHAIN_BUILD_VER="$(cat .toolchain_build_ver)" +[ -z "$CURRENT_TOOLCHAIN_BUILD_VER" ] && { + echo "$CONFIG_TOOLCHAIN_BUILD_VER" > .toolchain_build_ver + exit 0 +} +[ "$CONFIG_TOOLCHAIN_BUILD_VER" = "$CURRENT_TOOLCHAIN_BUILD_VER" ] && exit 0 +echo "Toolchain build version changed ($CONFIG_TOOLCHAIN_BUILD_VER != $CURRENT_TOOLCHAIN_BUILD_VER), running make targetclean" +make targetclean +echo "$CONFIG_TOOLCHAIN_BUILD_VER" > .toolchain_build_ver +exit 0 diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 81b1ffcb5..2adc5efec 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -4697,7 +4697,7 @@ sub process { ## $line !~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Type\s*$Ident.*/) { ## ## # Remove any bracketed sections to ensure we do not -## # falsly report the parameters of functions. +## # falsely report the parameters of functions. ## my $ln = $line; ## while ($ln =~ s/\([^\(\)]*\)//g) { ## } diff --git a/scripts/command_all.sh b/scripts/command_all.sh new file mode 100755 index 000000000..452b66f09 --- /dev/null +++ b/scripts/command_all.sh @@ -0,0 +1,11 @@ +#! /bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Reduced version of which -a using command utility + +case $PATH in + (*[!:]:) PATH="$PATH:" ;; +esac + +for ELEMENT in $(echo $PATH | tr ":" "\n"); do + PATH=$ELEMENT command -v "$@" +done diff --git a/scripts/config/.gitignore b/scripts/config/.gitignore index bedb9757e..05c55c3c8 100644 --- a/scripts/config/.gitignore +++ b/scripts/config/.gitignore @@ -1,22 +1,16 @@ -# -# Generated files -# -*.moc -*conf-cfg +# SPDX-License-Identifier: GPL-2.0-only +/conf +/[gmnq]conf +/[gmnq]conf-cfg +/qconf-moc.cc + +# From linux kconfig parent directories +.* + +# OpenWrt-generated files mconf_check -# -# configuration programs -# -conf -mconf -nconf -qconf -gconf - -# -# temporary files from older version. Should be removed -# +# Temporary files from older versions. They should be removed after the +# end of support for OpenWrt 19.07. zconf.???.c zconf.hash.c -.tmp_qtcheck diff --git a/scripts/config/Makefile b/scripts/config/Makefile index 89e761a45..5976a91b9 100644 --- a/scripts/config/Makefile +++ b/scripts/config/Makefile @@ -5,11 +5,11 @@ .PHONY: clean all all: conf mconf clean: - rm -f *.o lxdialog/*.o *.moc $(clean-files) conf mconf qconf nconf + rm -f *.o lxdialog/*.o *.moc .*.cmd $(clean-files) # This clean-files definition is here to ensure that temporary files from the # previous version are removed by make config-clean. -# It should be removed or emptied when this Makefile get updated again. +# It should be emptied after the end of support for OpenWrt 19.07. clean-files := zconf.tab.c zconf.lex.c zconf.hash.c .tmp_qtcheck # =========================================================================== @@ -24,9 +24,11 @@ src:=. obj:=. Q:=$(if $V,,@) cmd = $(cmd_$(1)) -dot-target = $(dir $@).$(notdir $@) -# taken from ../Kbuild.include +# some definitions taken from ../Kbuild.include +dot-target = $(dir $@).$(notdir $@) +squote := ' +escsq = $(subst $(squote),'\$(squote)',$1) define filechk $(Q)set -e; \ mkdir -p $(dir $@); \ @@ -37,23 +39,29 @@ define filechk mv -f $(dot-target).tmp $@; \ fi endef +cmd-check = $(if $(strip $(cmd_$@)),,1) +make-cmd = $(call escsq,$(subst $(pound),$$(pound),$(subst $$,$$$$,$(cmd_$(1))))) +newer-prereqs = $(filter-out $(PHONY),$?) +if_changed = $(if $(newer-prereqs)$(cmd-check), \ + $(cmd); \ + printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:) ### Stripped down upstream Makefile follows: # =========================================================================== # object files used by all kconfig flavours -common-objs := confdata.o expr.o lexer.lex.o parser.tab.o preprocess.o \ - symbol.o util.o +common-objs := confdata.o expr.o lexer.lex.o menu.o parser.tab.o \ + preprocess.o symbol.o util.o $(obj)/lexer.lex.o: $(obj)/parser.tab.h HOSTCFLAGS_lexer.lex.o := -I $(srctree)/$(src) HOSTCFLAGS_parser.tab.o := -I $(srctree)/$(src) # conf: Used for defconfig, oldconfig and related targets -hostprogs-y += conf +hostprogs += conf conf-objs := conf.o $(common-objs) # nconf: Used for the nconfig target based on ncurses -hostprogs-y += nconf +hostprogs += nconf nconf-objs := nconf.o nconf.gui.o $(common-objs) HOSTLDLIBS_nconf = $(shell . $(obj)/nconf-cfg && echo $$libs) @@ -63,7 +71,7 @@ HOSTCFLAGS_nconf.gui.o = $(shell . $(obj)/nconf-cfg && echo $$cflags) $(obj)/nconf.o $(obj)/nconf.gui.o: $(obj)/nconf-cfg # mconf: Used for the menuconfig target based on lxdialog -hostprogs-y += mconf +hostprogs += mconf lxdialog := $(addprefix lxdialog/, \ checklist.o inputbox.o menubox.o textbox.o util.o yesno.o) mconf-objs := mconf.o $(lxdialog) $(common-objs) @@ -75,20 +83,23 @@ $(foreach f, mconf.o $(lxdialog), \ $(addprefix $(obj)/, mconf.o $(lxdialog)): $(obj)/mconf-cfg # qconf: Used for the xconfig target based on Qt -hostprogs-y += qconf -qconf-cxxobjs := qconf.o +hostprogs += qconf +qconf-cxxobjs := qconf.o qconf-moc.o qconf-objs := images.o $(common-objs) HOSTLDLIBS_qconf = $(shell . $(obj)/qconf-cfg && echo $$libs) HOSTCXXFLAGS_qconf.o = $(shell . $(obj)/qconf-cfg && echo $$cflags) +HOSTCXXFLAGS_qconf-moc.o = $(shell . $(obj)/qconf-cfg && echo $$cflags) -$(obj)/qconf.o: $(obj)/qconf-cfg $(obj)/qconf.moc +$(obj)/qconf.o: $(obj)/qconf-cfg quiet_cmd_moc = MOC $@ - cmd_moc = $(shell . $(obj)/qconf-cfg && echo $$moc) -i $< -o $@ + cmd_moc = $(shell . $(obj)/qconf-cfg && echo $$moc) $< -o $@ -$(obj)/%.moc: $(src)/%.h $(obj)/qconf-cfg - $(call cmd,moc) +$(obj)/qconf-moc.cc: $(src)/qconf.h $(obj)/qconf-cfg FORCE + $(call if_changed,moc) + +targets += qconf-moc.cc # check if necessary packages are available, and configure build flags filechk_conf_cfg = $(CONFIG_SHELL) $< @@ -102,6 +113,8 @@ clean-files += *conf-cfg # OpenWrt rules and final adjustments that need to be made after reading the # full upstream Makefile +clean-files += $(targets) $(hostprogs) + FORCE: ifdef BUILD_SHIPPED_FILES @@ -117,24 +130,25 @@ clean-files += $(shipped-files) flex -L -o$@ $< endif -$(foreach f, mconf.o $(lxdialog), \ - $(eval $f: CFLAGS+=$$(HOSTCFLAGS_$f))) +$(foreach f,$(conf-objs) $(filter-out $(common-objs),$(mconf-objs) \ + $(qconf-objs) \ + $(nconf-objs)), \ + $(eval $(obj)/$f: CFLAGS+=$$(HOSTCFLAGS_$f))) -$(obj)/lexer.lex.o: CFLAGS += $(HOSTCFLAGS_lexer.lex.o) -$(obj)/parser.tab.o: CFLAGS += $(HOSTCFLAGS_parser.tab.o) -$(obj)/qconf.o: CXXFLAGS+=$(HOSTCXXFLAGS_qconf.o) +$(foreach f,$(qconf-cxxobjs), \ + $(eval $(obj)/$f: CXXFLAGS+=$$(HOSTCXXFLAGS_$f))) -conf: $(conf-objs) +$(obj)/conf: $(addprefix $(obj)/,$(conf-objs)) # The *conf-cfg file is used (then filtered out) as the first prerequisite to # avoid sourcing it before the script is built, when trying to compute CFLAGS # for the actual first prerequisite. This avoids errors like: # '/bin/sh: ./mconf-cfg: No such file or directory' -mconf: mconf-cfg $(mconf-objs) +$(obj)/mconf: mconf-cfg $(addprefix $(obj)/,$(mconf-objs)) $(CC) -o $@ $(filter-out mconf-cfg,$^) $(HOSTLDLIBS_mconf) -nconf: nconf-cfg $(nconf-objs) +$(obj)/nconf: nconf-cfg $(addprefix $(obj)/,$(nconf-objs)) $(CC) -o $@ $(filter-out nconf-cfg,$^) $(HOSTLDLIBS_nconf) -qconf: qconf-cfg $(qconf-cxxobjs) $(qconf-objs) +$(obj)/qconf: qconf-cfg $(addprefix $(obj)/,$(qconf-cxxobjs) $(qconf-objs)) $(CXX) -o $@ $(filter-out qconf-cfg,$^) $(HOSTLDLIBS_qconf) diff --git a/scripts/config/README b/scripts/config/README index f402cdc74..99a7d535a 100644 --- a/scripts/config/README +++ b/scripts/config/README @@ -1,7 +1,6 @@ -These files were taken from the Linux Kernel Configuration System at commit -089b7d890f972f6b649fedc9259f6b93a18fb970 (Feb 4, 2020) and modified for the -OpenWrt Buildroot: - - Removed gconf, tests and kernel configuration targets. +These files were taken from the Linux 5.14 Kernel Configuration System and +modified for the OpenWrt Buildroot: + - Removed nconf, gconf, tests and kernel configuration targets. - Adjusted the Makefile to compile outside the kernel. - Always use default file when running make all{no,mod,yes}config. - Added a 'reset' command to reset config when the target changes. @@ -24,4 +23,4 @@ OpenWrt Buildroot: BUILD_SHIPPED_FILES defined For a full list of changes, see the repository at: -https://github.com/cotequeiroz/linux/commits/openwrt/scripts/kconfig +https://github.com/cotequeiroz/linux/commits/openwrt-5.14/scripts/kconfig diff --git a/scripts/config/conf.c b/scripts/config/conf.c index 85902663a..978abebe6 100644 --- a/scripts/config/conf.c +++ b/scripts/config/conf.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include @@ -39,7 +38,7 @@ enum input_mode { fatalrecursive, }; static enum input_mode input_mode = oldaskconfig; - +static int input_mode_opt; static int indent = 1; static int tty_stdio; static int sync_kconfig; @@ -84,10 +83,243 @@ static void xfgets(char *str, int size, FILE *in) printf("%s", str); } +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_y2m, + def_m2y, + def_no, + def_random +}; + +static bool conf_set_all_new_symbols(enum conf_def_mode mode) +{ + struct symbol *sym, *csym; + int i, 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); + } + } + + sym_clear_all_valid(); + + 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: + 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; + } + + } + + /* + * 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; +} + +static void conf_rewrite_mod_or_yes(enum conf_def_mode mode) +{ + struct symbol *sym; + int i; + tristate old_val = (mode == def_y2m) ? yes : mod; + tristate new_val = (mode == def_y2m) ? mod : yes; + + for_all_symbols(i, 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) { - enum symbol_type type = sym_get_type(sym); - if (!sym_has_value(sym)) printf("(NEW) "); @@ -109,24 +341,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; } @@ -139,7 +359,7 @@ static int conf_string(struct menu *menu) 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; @@ -421,34 +641,37 @@ static void check_conf(struct menu *menu) return; sym = menu->sym; - if (sym && !sym_has_value(sym)) { - if (sym_is_changeable(sym) || - (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes)) { - if (input_mode == listnewconfig) { - if (sym->name) { - const char *str; + if (sym && !sym_has_value(sym) && + (sym_is_changeable(sym) || + (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes))) { - 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); - } + switch (input_mode) { + case 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 (input_mode == helpnewconfig) { - printf("-----\n"); - print_help(menu); - printf("-----\n"); - - } else { - if (!conf_cnt++) - printf("*\n* Restart config...\n*\n"); - rootEntry = menu_get_parent_menu(menu); - conf(rootEntry); } + 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; } } @@ -456,31 +679,38 @@ 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", required_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}, - {"helpnewconfig", no_argument, NULL, helpnewconfig}, - {"olddefconfig", no_argument, NULL, olddefconfig}, - {"yes2modconfig", no_argument, NULL, yes2modconfig}, - {"mod2yesconfig", no_argument, NULL, mod2yesconfig}, - {"fatalrecursive", no_argument, NULL, fatalrecursive}, +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}, + {"fatalrecursive",no_argument, NULL, fatalrecursive}, {NULL, 0, NULL, 0} }; static void conf_usage(const char *progname) { - - printf("Usage: %s [-s] [--fatalrecursive] [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(" --fatalrecursive Treat recursive depenendencies as a fatal error\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"); @@ -497,6 +727,7 @@ static void conf_usage(const char *progname) 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(" (If none of the above is given, --oldaskconfig is the default)\n"); } int main(int ac, char **av) @@ -509,84 +740,56 @@ int main(int ac, char **av) tty_stdio = isatty(0) && isatty(1); - while ((opt = getopt_long(ac, av, "r:w:s", long_opts, NULL)) != -1) { - if (opt == 's') { - conf_set_message_callback(NULL); - continue; - } + while ((opt = getopt_long(ac, av, "hr:sw:", long_opts, NULL)) != -1) { switch (opt) { - case syncconfig: - /* - * syncconfig is invoked during the build stage. - * Suppress distracting "configuration written to ..." - */ + case 'h': + conf_usage(progname); + exit(1); + break; + case 's': conf_set_message_callback(NULL); - sync_kconfig = 1; - break; - case defconfig: - case savedefconfig: - defconfig_file = optarg; - 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; - } - } - 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 helpnewconfig: - case olddefconfig: - case yes2modconfig: - case mod2yesconfig: break; case fatalrecursive: recursive_is_error = 1; continue; case 'r': input_file = optarg; - continue; + break; case 'w': output_file = optarg; - continue; - case '?': - conf_usage(progname); - exit(1); + break; + 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; + } + default: break; } - input_mode = (enum input_mode)opt; } if (ac == optind) { fprintf(stderr, "%s: Kconfig file missing\n", av[0]); conf_usage(progname); exit(1); } - name = av[optind]; - conf_parse(name); + conf_parse(av[optind]); //zconfdump(stdout); switch (input_mode) { diff --git a/scripts/config/confdata.c b/scripts/config/confdata.c index cff8d4523..dad0b471c 100644 --- a/scripts/config/confdata.c +++ b/scripts/config/confdata.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -32,7 +33,7 @@ static bool is_dir(const char *path) struct stat st; if (stat(path, &st)) - return 0; + return false; return S_ISDIR(st.st_mode); } @@ -129,19 +130,14 @@ static size_t depfile_prefix_len; static int conf_touch_dep(const char *name) { int fd, ret; - const char *s; - char *d, c; + char *d; - /* check overflow: prefix + name + ".h" + '\0' must fit in buffer. */ - if (depfile_prefix_len + strlen(name) + 3 > sizeof(depfile_path)) + /* check overflow: prefix + name + '\0' must fit in buffer. */ + if (depfile_prefix_len + strlen(name) + 1 > sizeof(depfile_path)) return -1; d = depfile_path + depfile_prefix_len; - s = name; - - while ((c = *s++)) - *d++ = (c == '_') ? '/' : tolower(c); - strcpy(d, ".h"); + strcpy(d, name); /* Assume directory path already exists. */ fd = open(depfile_path, O_WRONLY | O_CREAT | O_TRUNC, 0644); @@ -384,28 +380,46 @@ int conf_read_simple(const char *name, int def) 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; - sym_calc_value(prop->expr->left.sym); - name = sym_get_string_value(prop->expr->left.sym); - 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); + env); goto load; } + + if (is_last) + break; + + env = p + 1; } } if (!in) @@ -434,7 +448,7 @@ load: if (def == S_DEF_USER) { sym = sym_find(line + 2 + strlen(CONFIG_)); if (!sym) { - sym_add_change_count(1); + conf_set_changed(true); continue; } } else { @@ -470,11 +484,11 @@ load: * Reading from include/config/auto.conf * If CONFIG_FOO previously existed in * auto.conf but it is missing now, - * include/config/foo.h must be touched. + * include/config/FOO must be touched. */ conf_touch_dep(line + strlen(CONFIG_)); else - sym_add_change_count(1); + conf_set_changed(true); continue; } @@ -519,7 +533,7 @@ int conf_read(const char *name) 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); @@ -577,7 +591,8 @@ 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; } @@ -922,7 +937,7 @@ next: if (is_same(name, tmpname)) { conf_message("No change to %s", name); unlink(tmpname); - sym_set_change_count(0); + conf_set_changed(false); return 0; } @@ -934,7 +949,7 @@ next: conf_message("configuration written to %s", name); - sym_set_change_count(0); + conf_set_changed(false); return 0; } @@ -1105,26 +1120,20 @@ int conf_write_autoconf(int overwrite) 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) + if (conf_changed_callback && conf_changed != val) conf_changed_callback(); -} -void sym_add_change_count(int count) -{ - sym_set_change_count(count + sym_change_count); + conf_changed = val; } bool conf_get_changed(void) { - return sym_change_count; + return conf_changed; } void conf_set_changed_callback(void (*fn)(void)) @@ -1132,54 +1141,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; @@ -1199,147 +1160,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; - - sym_clear_all_valid(); - - 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; - } - - } - - /* - * 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; -} - -void conf_rewrite_mod_or_yes(enum conf_def_mode mode) -{ - struct symbol *sym; - int i; - tristate old_val = (mode == def_y2m) ? yes : mod; - tristate new_val = (mode == def_y2m) ? mod : yes; - - for_all_symbols(i, 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_add_change_count(1); - } - } -} diff --git a/scripts/config/expr.h b/scripts/config/expr.h index ae67a99d9..c2fa804fe 100644 --- a/scripts/config/expr.h +++ b/scripts/config/expr.h @@ -156,9 +156,6 @@ 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 @@ -282,15 +279,12 @@ struct jump_key { 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); diff --git a/scripts/config/images.c b/scripts/config/images.c index 3765d3356..ea3bfabd9 100644 --- a/scripts/config/images.c +++ b/scripts/config/images.c @@ -5,7 +5,7 @@ #include "images.h" -const char *xpm_load[] = { +const char * const xpm_load[] = { "22 22 5 1", ". c None", "# c #000000", @@ -35,7 +35,7 @@ const char *xpm_load[] = { "###############.......", "......................"}; -const char *xpm_save[] = { +const char * const xpm_save[] = { "22 22 5 1", ". c None", "# c #000000", @@ -65,7 +65,7 @@ const char *xpm_save[] = { "..##################..", "......................"}; -const char *xpm_back[] = { +const char * const xpm_back[] = { "22 22 3 1", ". c None", "# c #000083", @@ -93,7 +93,7 @@ const char *xpm_back[] = { "......................", "......................"}; -const char *xpm_tree_view[] = { +const char * const xpm_tree_view[] = { "22 22 2 1", ". c None", "# c #000000", @@ -120,7 +120,7 @@ const char *xpm_tree_view[] = { "......................", "......................"}; -const char *xpm_single_view[] = { +const char * const xpm_single_view[] = { "22 22 2 1", ". c None", "# c #000000", @@ -147,7 +147,7 @@ const char *xpm_single_view[] = { "......................", "......................"}; -const char *xpm_split_view[] = { +const char * const xpm_split_view[] = { "22 22 2 1", ". c None", "# c #000000", @@ -174,7 +174,7 @@ const char *xpm_split_view[] = { "......................", "......................"}; -const char *xpm_symbol_no[] = { +const char * const xpm_symbol_no[] = { "12 12 2 1", " c white", ". c black", @@ -191,7 +191,7 @@ const char *xpm_symbol_no[] = { " .......... ", " "}; -const char *xpm_symbol_mod[] = { +const char * const xpm_symbol_mod[] = { "12 12 2 1", " c white", ". c black", @@ -208,7 +208,7 @@ const char *xpm_symbol_mod[] = { " .......... ", " "}; -const char *xpm_symbol_yes[] = { +const char * const xpm_symbol_yes[] = { "12 12 2 1", " c white", ". c black", @@ -225,7 +225,7 @@ const char *xpm_symbol_yes[] = { " .......... ", " "}; -const char *xpm_choice_no[] = { +const char * const xpm_choice_no[] = { "12 12 2 1", " c white", ". c black", @@ -242,7 +242,7 @@ const char *xpm_choice_no[] = { " .... ", " "}; -const char *xpm_choice_yes[] = { +const char * const xpm_choice_yes[] = { "12 12 2 1", " c white", ". c black", @@ -259,7 +259,7 @@ const char *xpm_choice_yes[] = { " .... ", " "}; -const char *xpm_menu[] = { +const char * const xpm_menu[] = { "12 12 2 1", " c white", ". c black", @@ -276,7 +276,7 @@ const char *xpm_menu[] = { " .......... ", " "}; -const char *xpm_menu_inv[] = { +const char * const xpm_menu_inv[] = { "12 12 2 1", " c white", ". c black", @@ -293,7 +293,7 @@ const char *xpm_menu_inv[] = { " .......... ", " "}; -const char *xpm_menuback[] = { +const char * const xpm_menuback[] = { "12 12 2 1", " c white", ". c black", @@ -310,7 +310,7 @@ const char *xpm_menuback[] = { " .......... ", " "}; -const char *xpm_void[] = { +const char * const xpm_void[] = { "12 12 2 1", " c white", ". c black", diff --git a/scripts/config/images.h b/scripts/config/images.h index 565466511..1e3c73622 100644 --- a/scripts/config/images.h +++ b/scripts/config/images.h @@ -10,21 +10,21 @@ extern "C" { #endif -extern const char *xpm_load[]; -extern const char *xpm_save[]; -extern const char *xpm_back[]; -extern const char *xpm_tree_view[]; -extern const char *xpm_single_view[]; -extern const char *xpm_split_view[]; -extern const char *xpm_symbol_no[]; -extern const char *xpm_symbol_mod[]; -extern const char *xpm_symbol_yes[]; -extern const char *xpm_choice_no[]; -extern const char *xpm_choice_yes[]; -extern const char *xpm_menu[]; -extern const char *xpm_menu_inv[]; -extern const char *xpm_menuback[]; -extern const char *xpm_void[]; +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 } diff --git a/scripts/config/internal.h b/scripts/config/internal.h new file mode 100644 index 000000000..2f7298c21 --- /dev/null +++ b/scripts/config/internal.h @@ -0,0 +1,9 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ +#ifndef INTERNAL_H +#define INTERNAL_H + +struct menu; + +extern struct menu *current_menu, *current_entry; + +#endif /* INTERNAL_H */ diff --git a/scripts/config/lexer.l b/scripts/config/lexer.l index 575b679d3..0df51ec46 100644 --- a/scripts/config/lexer.l +++ b/scripts/config/lexer.l @@ -12,7 +12,6 @@ #include #include #include -#include #include #include @@ -38,7 +37,7 @@ struct buffer { YY_BUFFER_STATE state; }; -struct buffer *current_buf; +static struct buffer *current_buf; static int last_ts, first_ts; @@ -94,7 +93,6 @@ n [A-Za-z0-9_-] [ \t]* /* whitespaces */ \\\n /* escaped new line */ \n return T_EOL; -"allnoconfig_y" return T_ALLNOCONFIG_Y; "bool" return T_BOOL; "choice" return T_CHOICE; "comment" return T_COMMENT; @@ -102,12 +100,11 @@ n [A-Za-z0-9_-] "def_bool" return T_DEF_BOOL; "def_tristate" return T_DEF_TRISTATE; "default" return T_DEFAULT; -"defconfig_list" return T_DEFCONFIG_LIST; "depends" return T_DEPENDS; "endchoice" return T_ENDCHOICE; "endif" return T_ENDIF; "endmenu" return T_ENDMENU; -"help"|"---help---" return T_HELP; +"help" return T_HELP; "hex" return T_HEX; "if" return T_IF; "imply" return T_IMPLY; @@ -117,7 +114,6 @@ n [A-Za-z0-9_-] "menuconfig" return T_MENUCONFIG; "modules" return T_MODULES; "on" return T_ON; -"option" return T_OPTION; "optional" return T_OPTIONAL; "prompt" return T_PROMPT; "range" return T_RANGE; diff --git a/scripts/config/lexer.lex.c b/scripts/config/lexer.lex.c index 190928b2a..826c06e4e 100644 --- a/scripts/config/lexer.lex.c +++ b/scripts/config/lexer.lex.c @@ -357,82 +357,82 @@ extern char *yytext; #endif #define yytext_ptr yytext -static const flex_int16_t yy_nxt[][44] = +static const flex_int16_t yy_nxt[][43] = { { 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 }, { 9, 10, 11, 12, 13, 14, 15, 16, 17, 14, - 18, 19, 20, 21, 22, 22, 23, 24, 25, 26, - 27, 22, 28, 29, 30, 31, 32, 22, 22, 33, - 34, 22, 35, 22, 36, 37, 38, 39, 40, 22, - 41, 22, 22, 42 + 18, 19, 20, 21, 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, 22, 23, 24, 25, 26, - 27, 22, 28, 29, 30, 31, 32, 22, 22, 33, - 34, 22, 35, 22, 36, 37, 38, 39, 40, 22, - 41, 22, 22, 42 + 18, 19, 20, 21, 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, 43, 44, 45, 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, 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, 41 }, { - 9, 43, 44, 45, 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, 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, 41 }, { - 9, 46, 47, 48, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46 + 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, 44 }, { - 9, 46, 47, 48, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46, 46, 46, 46, 46, 46, 46, - 46, 46, 46, 46 + 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, 44 }, { - 9, 49, 49, 50, 49, 51, 49, 52, 49, 51, - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, - 53, 49, 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49 + 9, 47, 47, 48, 47, 49, 47, 50, 47, 49, + 47, 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, 49, 49, 50, 49, 51, 49, 52, 49, 51, - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, - 53, 49, 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49, 49, 49, 49, 49, 49, 49, - 49, 49, 49, 49 + 9, 47, 47, 48, 47, 49, 47, 50, 47, 49, + 47, 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 }, { @@ -440,7 +440,7 @@ static const flex_int16_t yy_nxt[][44] = -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 }, @@ -449,15 +449,15 @@ static const flex_int16_t yy_nxt[][44] = -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, 54, -11, -11, -11, -11, -11, -11, -11, + 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, -11, -11 + -11, -11, -11 }, @@ -466,15 +466,15 @@ static const flex_int16_t yy_nxt[][44] = -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, -13, -13, 55, -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, -13 + -13, -13, -13 }, @@ -483,32 +483,32 @@ static const flex_int16_t yy_nxt[][44] = -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, 56, 56, -15, 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, 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, 54 }, { - 9, -16, -16, -16, -16, -16, -16, 57, -16, -16, - -16, -16, -16, 57, 57, 57, -16, -16, -16, -16, - -16, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, - 57, 57, 57, -16 + 9, -16, -16, -16, -16, -16, -16, 55, -16, -16, + -16, -16, -16, 55, 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, 58, -17, + 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, -17, -17 + -17, -17, -17 }, @@ -517,7 +517,7 @@ static const flex_int16_t yy_nxt[][44] = -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 }, { @@ -525,194 +525,194 @@ static const flex_int16_t yy_nxt[][44] = -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, -20, -20, 59, -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, -20 + -20, -20, -20 }, { - 9, -21, -21, -21, -21, -21, -21, 57, -21, -21, - -21, -21, -21, 60, 61, 61, -21, -21, -21, -21, - -21, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -21 + 9, -21, -21, -21, -21, -21, -21, 55, -21, -21, + -21, -21, -21, 58, 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, 57, -22, -22, - -22, -22, -22, 61, 61, 61, -22, -22, -22, -22, - -22, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -22 + 9, -22, -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, -23, -23, 62, -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, -23 + -23, -23, -23 }, { 9, -24, -24, -24, -24, -24, -24, -24, -24, -24, - -24, -24, -24, -24, -24, -24, -24, -24, 63, -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, -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, -25, -25, -25, -25, -25, -25, -25, - -25, -25, -25, -25 + -25, -25, -25 }, { - 9, -26, -26, -26, -26, -26, -26, -26, -26, -26, - -26, -26, -26, -26, -26, -26, -26, -26, 64, -26, + 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, -26, -26, + -26, -26, -26 }, { - 9, -27, -27, 65, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27, -27, -27, -27, -27, -27, -27, - -27, -27, -27, -27 + 9, -27, -27, -27, -27, -27, -27, 55, -27, -27, + -27, -27, -27, 58, 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, 57, -28, -28, - -28, -28, -28, 61, 61, 61, -28, -28, -28, -28, - -28, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 66, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -28 + 9, -28, -28, -28, -28, -28, -28, 55, -28, -28, + -28, -28, -28, 58, 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, 57, -29, -29, - -29, -29, -29, 61, 61, 61, -29, -29, -29, -29, - -29, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 67, 61, 61, 61, 61, 61, - 61, 61, 61, -29 + 9, -29, -29, -29, -29, -29, -29, 55, -29, -29, + -29, -29, -29, 58, 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, 57, -30, -30, - -30, -30, -30, 61, 61, 61, -30, -30, -30, -30, - -30, 61, 61, 61, 61, 61, 61, 61, 61, 68, - 61, 61, 61, 61, 69, 61, 61, 61, 61, 61, - 61, 61, 61, -30 + 9, -30, -30, -30, -30, -30, -30, 55, -30, -30, + -30, -30, -30, 58, 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, 57, -31, -31, - -31, -31, -31, 61, 61, 61, -31, -31, -31, -31, - -31, 61, 61, 61, 61, 61, 70, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -31 + 9, -31, -31, -31, -31, -31, -31, 55, -31, -31, + -31, -31, -31, 58, 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, 57, -32, -32, - -32, -32, -32, 61, 61, 61, -32, -32, -32, -32, - -32, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 71, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -32 + 9, -32, -32, -32, -32, -32, -32, 55, -32, -32, + -32, -32, -32, 58, 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, 57, -33, -33, - -33, -33, -33, 61, 61, 61, -33, -33, -33, -33, - -33, 61, 61, 61, 61, 61, 72, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -33 + 9, -33, -33, -33, -33, -33, -33, 55, -33, -33, + -33, -33, -33, 58, 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, 57, -34, -34, - -34, -34, -34, 61, 61, 61, -34, -34, -34, -34, - -34, 61, 61, 61, 61, 61, 61, 73, 61, 61, - 61, 61, 74, 75, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -34 + 9, -34, -34, -34, -34, -34, -34, 55, -34, -34, + -34, -34, -34, 58, 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, 57, -35, -35, - -35, -35, -35, 61, 61, 61, -35, -35, -35, -35, - -35, 61, 76, 61, 61, 61, 77, 61, 61, 61, - 61, 61, 61, 61, 78, 61, 61, 61, 61, 61, - 61, 61, 61, -35 + 9, -35, -35, -35, -35, -35, -35, 55, -35, -35, + -35, -35, -35, 58, 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, 57, -36, -36, - -36, -36, -36, 61, 61, 61, -36, -36, -36, -36, - -36, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 79, 61, 80, 61, 61, 61, 61, - 61, 61, 61, -36 + 9, -36, -36, -36, -36, -36, -36, 55, -36, -36, + -36, -36, -36, 58, 58, -36, -36, -36, -36, -36, + 58, 78, 58, 58, 58, 79, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -36 }, { - 9, -37, -37, -37, -37, -37, -37, 57, -37, -37, - -37, -37, -37, 61, 61, 61, -37, -37, -37, -37, - -37, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 81, 61, 61, 61, - 61, 61, 61, -37 + 9, -37, -37, -37, -37, -37, -37, 55, -37, -37, + -37, -37, -37, 58, 58, -37, -37, -37, -37, -37, + 58, 58, 58, 58, 58, 80, 58, 58, 58, 58, + 58, 58, 58, 81, 58, 58, 58, 82, 58, 58, + 58, 58, -37 }, { - 9, -38, -38, -38, -38, -38, -38, 57, -38, -38, - -38, -38, -38, 61, 61, 61, -38, -38, -38, -38, - -38, 61, 82, 61, 61, 61, 83, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -38 + 9, -38, -38, -38, -38, -38, -38, 55, -38, -38, + -38, -38, -38, 58, 58, -38, -38, -38, -38, -38, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 83, 58, 58, 58, 58, + 58, 58, -38 }, { - 9, -39, -39, -39, -39, -39, -39, 57, -39, -39, - -39, -39, -39, 61, 61, 61, -39, -39, -39, -39, - -39, 61, 61, 61, 61, 61, 84, 61, 61, 61, - 61, 61, 61, 61, 85, 61, 61, 61, 86, 61, - 61, 61, 61, -39 + 9, -39, -39, -39, -39, -39, -39, 55, -39, -39, + -39, -39, -39, 58, 58, -39, -39, -39, -39, -39, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 84, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -39 }, { - 9, -40, -40, -40, -40, -40, -40, 57, -40, -40, - -40, -40, -40, 61, 61, 61, -40, -40, -40, -40, - -40, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 87, 61, 61, 61, - 61, 61, 61, -40 + 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, -40, 85 }, { - 9, -41, -41, -41, -41, -41, -41, 57, -41, -41, - -41, -41, -41, 61, 61, 61, -41, -41, -41, -41, - -41, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 88, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -41 + 9, 86, 87, -41, 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 }, @@ -721,143 +721,143 @@ static const flex_int16_t yy_nxt[][44] = -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, 89 + -42, -42, -42 }, { - 9, 90, 91, -43, 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, -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, -43 }, { - 9, -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, -44, - -44, -44, -44, -44 + 9, 88, 88, -44, 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, 88 }, { - 9, -45, -45, -45, -45, -45, -45, -45, -45, -45, + 9, -45, 89, 90, -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, -45, -45 + -45, -45, -45 }, { - 9, 92, 92, -46, 92, 92, 92, 92, 92, 92, + 9, 91, -46, -46, 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, -47, 92, -47, 92, -47, 92, -47, + 92, 92, 92, 92, 92, 92, 92, 92, 92, -47, 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, -47, 93, 94, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, - -47, -47, -47, -47 + 92, 92, 92 }, { - 9, 95, -48, -48, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95 + 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, -48 }, { - 9, 96, 96, -49, 96, -49, 96, -49, 96, -49, - 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, - -49, 96, 96, 96, 96, 96, 96, 96, 96, 96, - 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, - 96, 96, 96, 96 + 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, -49 }, { - 9, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, - -50, -50, -50, -50 + 9, 93, 93, -50, 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, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, - -51, -51, -51, -51 + 9, 94, 94, -51, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, + 94, 94, 94 }, { - 9, 97, 97, -52, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97 + 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, -52 }, { - 9, 98, 98, -53, 98, 98, 98, 98, 98, 98, - 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, - 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, - 98, 98, 98, 98, 98, 98, 98, 98, 98, 98, - 98, 98, 98, 98 + 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, -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, -54, -54 + 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, 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, -55, -55 + 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, -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, 56, 56 + 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, -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, 57, -57 + 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, -57 }, { - 9, -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, -58, -58, -58, -58, -58, - -58, -58, -58, -58 + 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, -58 }, { @@ -865,24 +865,24 @@ static const flex_int16_t yy_nxt[][44] = -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, 57, -60, -60, - -60, -60, -60, 99, 61, 61, -60, -60, -60, -60, - -60, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -60 + 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, -60 }, { - 9, -61, -61, -61, -61, -61, -61, 57, -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, -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, -61 }, @@ -891,1546 +891,1265 @@ static const flex_int16_t yy_nxt[][44] = -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, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63, -63, -63, -63, -63, -63, -63, - -63, -63, -63, -63 + 9, -63, -63, -63, -63, -63, -63, 55, -63, -63, + -63, -63, -63, 58, 58, -63, -63, -63, -63, -63, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 95, 58, 58, 58, 58, 58, 58, + 58, 58, -63 }, { - 9, -64, -64, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, -64, -64, -64, -64, -64, -64, -64, - -64, -64, -64, -64 + 9, -64, -64, -64, -64, -64, -64, 55, -64, -64, + -64, -64, -64, 58, 58, -64, -64, -64, -64, -64, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 96, 58, 58, 58, 58, 58, 58, + 58, 58, -64 }, { - 9, -65, -65, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, -65, -65, -65, -65, -65, -65, -65, - -65, -65, -65, -65 + 9, -65, -65, -65, -65, -65, -65, 55, -65, -65, + -65, -65, -65, 58, 58, -65, -65, -65, -65, -65, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 97, 98, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -65 }, { - 9, -66, -66, -66, -66, -66, -66, 57, -66, -66, - -66, -66, -66, 61, 61, 61, -66, -66, -66, -66, - -66, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 100, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -66 + 9, -66, -66, -66, -66, -66, -66, 55, -66, -66, + -66, -66, -66, 58, 58, -66, -66, -66, -66, -66, + 58, 58, 58, 58, 58, 58, 99, 58, 58, 58, + 58, 58, 58, 58, 100, 58, 58, 58, 58, 58, + 58, 58, -66 }, { - 9, -67, -67, -67, -67, -67, -67, 57, -67, -67, - -67, -67, -67, 61, 61, 61, -67, -67, -67, -67, - -67, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 101, 61, 61, 61, 61, 61, - 61, 61, 61, -67 + 9, -67, -67, -67, -67, -67, -67, 55, -67, -67, + -67, -67, -67, 58, 58, -67, -67, -67, -67, -67, + 58, 58, 58, 58, 101, 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, 57, -68, -68, - -68, -68, -68, 61, 61, 61, -68, -68, -68, -68, - -68, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 102, 61, 61, 61, 61, 61, - 61, 61, 61, -68 + 9, -68, -68, -68, -68, -68, -68, 55, -68, -68, + -68, -68, -68, 58, 58, -68, -68, -68, -68, -68, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 102, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 103, 58, -68 }, { - 9, -69, -69, -69, -69, -69, -69, 57, -69, -69, - -69, -69, -69, 61, 61, 61, -69, -69, -69, -69, - -69, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 103, 104, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -69 + 9, -69, -69, -69, -69, -69, -69, 55, -69, -69, + -69, -69, -69, 58, 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, 57, -70, -70, - -70, -70, -70, 61, 61, 61, -70, -70, -70, -70, - -70, 61, 61, 61, 61, 61, 61, 105, 61, 61, - 61, 61, 61, 61, 61, 106, 61, 61, 61, 61, - 61, 61, 61, -70 + 9, -70, -70, -70, -70, -70, -70, 55, -70, -70, + -70, -70, -70, 58, 58, -70, -70, -70, -70, -70, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 104, 58, 58, 58, 58, 58, + 58, 58, -70 }, { - 9, -71, -71, -71, -71, -71, -71, 57, -71, -71, - -71, -71, -71, 61, 61, 61, -71, -71, -71, -71, - -71, 61, 61, 61, 61, 107, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -71 + 9, -71, -71, -71, -71, -71, -71, 55, -71, -71, + -71, -71, -71, 58, 58, -71, -71, -71, -71, -71, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 105, 58, 58, + 58, 58, -71 }, { - 9, -72, -72, -72, -72, -72, -72, 57, -72, -72, - -72, -72, -72, 61, 61, 61, -72, -72, -72, -72, - -72, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 108, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 109, 61, -72 + 9, -72, -72, -72, -72, -72, -72, 55, -72, -72, + -72, -72, -72, 58, 58, -72, -72, -72, -72, -72, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 106, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -72 }, { - 9, -73, -73, -73, -73, -73, -73, 57, -73, -73, - -73, -73, -73, 61, 61, 61, -73, -73, -73, -73, - -73, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -73 + 9, -73, -73, -73, -73, -73, -73, 55, -73, -73, + -73, -73, -73, 58, 58, -73, -73, -73, -73, -73, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 107, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -73 }, { - 9, -74, -74, -74, -74, -74, -74, 57, -74, -74, - -74, -74, -74, 61, 61, 61, -74, -74, -74, -74, - -74, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 110, 61, 61, 61, 61, - 61, 61, 61, -74 + 9, -74, -74, -74, -74, -74, -74, 55, -74, -74, + -74, -74, -74, 58, 58, -74, -74, -74, -74, -74, + 58, 58, 58, 58, 108, 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, 57, -75, -75, - -75, -75, -75, 61, 61, 61, -75, -75, -75, -75, - -75, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 111, 61, - 61, 61, 61, -75 + 9, -75, -75, -75, -75, -75, -75, 55, -75, -75, + -75, -75, -75, 58, 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, 57, -76, -76, - -76, -76, -76, 61, 61, 61, -76, -76, -76, -76, - -76, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 112, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -76 + 9, -76, -76, -76, -76, -76, -76, 55, -76, -76, + -76, -76, -76, 58, 58, -76, -76, -76, -76, -76, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 109, 58, 58, + 58, 58, -76 }, { - 9, -77, -77, -77, -77, -77, -77, 57, -77, -77, - -77, -77, -77, 61, 61, 61, -77, -77, -77, -77, - -77, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 113, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -77 + 9, -77, -77, -77, -77, -77, -77, 55, -77, -77, + -77, -77, -77, 58, 58, -77, -77, -77, -77, -77, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 110, 58, 58, 58, 58, 58, 58, + 58, 58, -77 }, { - 9, -78, -78, -78, -78, -78, -78, 57, -78, -78, - -78, -78, -78, 61, 61, 61, -78, -78, -78, -78, - -78, 61, 61, 61, 61, 114, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -78 + 9, -78, -78, -78, -78, -78, -78, 55, -78, -78, + -78, -78, -78, 58, 58, -78, -78, -78, -78, -78, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 111, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -78 }, { - 9, -79, -79, -79, -79, -79, -79, 57, -79, -79, - -79, -79, -79, 61, 61, 61, -79, -79, -79, -79, - -79, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -79 + 9, -79, -79, -79, -79, -79, -79, 55, -79, -79, + -79, -79, -79, 58, 58, -79, -79, -79, -79, -79, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 112, 58, 58, 58, + 58, 58, -79 }, { - 9, -80, -80, -80, -80, -80, -80, 57, -80, -80, - -80, -80, -80, 61, 61, 61, -80, -80, -80, -80, - -80, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 115, 61, - 61, 61, 61, -80 + 9, -80, -80, -80, -80, -80, -80, 55, -80, -80, + -80, -80, -80, 58, 58, -80, -80, -80, -80, -80, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 113, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -80 }, { - 9, -81, -81, -81, -81, -81, -81, 57, -81, -81, - -81, -81, -81, 61, 61, 61, -81, -81, -81, -81, - -81, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 116, 61, 61, 61, 61, 61, - 61, 61, 61, -81 + 9, -81, -81, -81, -81, -81, -81, 55, -81, -81, + -81, -81, -81, 58, 58, -81, -81, -81, -81, -81, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 114, 58, + 58, 58, -81 }, { - 9, -82, -82, -82, -82, -82, -82, 57, -82, -82, - -82, -82, -82, 61, 61, 61, -82, -82, -82, -82, - -82, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 117, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -82 + 9, -82, -82, -82, -82, -82, -82, 55, -82, -82, + -82, -82, -82, 58, 58, -82, -82, -82, -82, -82, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 115, 58, 58, 58, 58, + 58, 58, -82 }, { - 9, -83, -83, -83, -83, -83, -83, 57, -83, -83, - -83, -83, -83, 61, 61, 61, -83, -83, -83, -83, - -83, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 118, 61, 61, - 61, 61, 61, -83 + 9, -83, -83, -83, -83, -83, -83, 55, -83, -83, + -83, -83, -83, 58, 58, -83, -83, -83, -83, -83, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 116, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -83 }, { - 9, -84, -84, -84, -84, -84, -84, 57, -84, -84, - -84, -84, -84, 61, 61, 61, -84, -84, -84, -84, - -84, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 119, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -84 + 9, -84, -84, -84, -84, -84, -84, 55, -84, -84, + -84, -84, -84, 58, 58, -84, -84, -84, -84, -84, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 117, 58, 58, 58, + 58, 58, -84 }, { - 9, -85, -85, -85, -85, -85, -85, 57, -85, -85, - -85, -85, -85, 61, 61, 61, -85, -85, -85, -85, - -85, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 120, - 61, 61, 61, -85 + 9, -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, + -85, -85, -85 }, { - 9, -86, -86, -86, -86, -86, -86, 57, -86, -86, - -86, -86, -86, 61, 61, 61, -86, -86, -86, -86, - -86, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 121, 61, 61, 61, - 61, 61, 61, -86 + 9, 86, 87, -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, 57, -87, -87, - -87, -87, -87, 61, 61, 61, -87, -87, -87, -87, - -87, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 122, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -87 + 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, 87 }, { - 9, -88, -88, -88, -88, -88, -88, 57, -88, -88, - -88, -88, -88, 61, 61, 61, -88, -88, -88, -88, - -88, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 123, 61, 61, - 61, 61, 61, -88 + 9, 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, 88, + 88, 88, 88 }, { - 9, -89, -89, -89, -89, -89, -89, -89, -89, -89, + 9, -89, 89, 90, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, -89, - -89, -89, -89, -89 + -89, -89, -89 }, { - 9, 90, 91, -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, + 9, 91, -90, -90, 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, 91, 91 + }, + + { + 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, -91 }, { - 9, 92, 92, -92, 92, 92, 92, 92, 92, 92, + 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, 92, 92, 92, 92, 92, 92, 92, 92, - 92, 92, 92, 92 + 92, 92, 92 }, { - 9, -93, 93, 94, -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, 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, 93 }, { - 9, 95, -94, -94, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95, 95, 95, 95, 95, 95, 95, - 95, 95, 95, 95 + 9, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94, -94, -94, -94, -94, -94, -94, -94, + -94, -94, -94 }, { - 9, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95, -95, -95, -95, -95, -95, -95, - -95, -95, -95, -95 + 9, -95, -95, -95, -95, -95, -95, 55, -95, -95, + -95, -95, -95, 58, 58, -95, -95, -95, -95, -95, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 118, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -95 }, { - 9, 96, 96, -96, 96, -96, 96, -96, 96, -96, - 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, - -96, 96, 96, 96, 96, 96, 96, 96, 96, 96, - 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, - 96, 96, 96, 96 + 9, -96, -96, -96, -96, -96, -96, 55, -96, -96, + -96, -96, -96, 58, 58, -96, -96, -96, -96, -96, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 119, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -96 }, { - 9, 97, 97, -97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, - 97, 97, 97, 97 + 9, -97, -97, -97, -97, -97, -97, 55, -97, -97, + -97, -97, -97, 58, 58, -97, -97, -97, -97, -97, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 120, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -97 }, { - 9, -98, -98, -98, -98, -98, -98, -98, -98, -98, - -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, - -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, - -98, -98, -98, -98, -98, -98, -98, -98, -98, -98, - -98, -98, -98, -98 + 9, -98, -98, -98, -98, -98, -98, 55, -98, -98, + -98, -98, -98, 58, 58, -98, -98, -98, -98, -98, + 58, 58, 58, 58, 58, 58, 121, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -98 }, { - 9, -99, -99, -99, -99, -99, -99, 57, -99, -99, - -99, -99, -99, 61, 61, 61, -99, -99, -99, -99, - -99, 61, 61, 61, 61, 61, 61, 61, 61, 124, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -99 + 9, -99, -99, -99, -99, -99, -99, 55, -99, -99, + -99, -99, -99, 58, 58, -99, -99, -99, -99, -99, + 122, 123, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -99 }, { - 9, -100, -100, -100, -100, -100, -100, 57, -100, -100, - -100, -100, -100, 61, 61, 61, -100, -100, -100, -100, - -100, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 125, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -100 + 9, -100, -100, -100, -100, -100, -100, 55, -100, -100, + -100, -100, -100, 58, 58, -100, -100, -100, -100, -100, + 58, 58, 58, 58, 58, 124, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -100 }, { - 9, -101, -101, -101, -101, -101, -101, 57, -101, -101, - -101, -101, -101, 61, 61, 61, -101, -101, -101, -101, - -101, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 126, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -101 + 9, -101, -101, -101, -101, -101, -101, 55, -101, -101, + -101, -101, -101, 58, 58, -101, -101, -101, -101, -101, + 58, 58, 58, 125, 58, 58, 58, 58, 58, 126, + 58, 127, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -101 }, { - 9, -102, -102, -102, -102, -102, -102, 57, -102, -102, - -102, -102, -102, 61, 61, 61, -102, -102, -102, -102, - -102, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 127, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -102 + 9, -102, -102, -102, -102, -102, -102, 55, -102, -102, + -102, -102, -102, 58, 58, -102, -102, -102, -102, -102, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 128, 58, 58, 58, 58, 58, + 58, 58, -102 }, { - 9, -103, -103, -103, -103, -103, -103, 57, -103, -103, - -103, -103, -103, 61, 61, 61, -103, -103, -103, -103, - -103, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 128, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -103 + 9, -103, -103, -103, -103, -103, -103, 55, -103, -103, + -103, -103, -103, 58, 58, -103, -103, -103, -103, -103, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -103 }, { - 9, -104, -104, -104, -104, -104, -104, 57, -104, -104, - -104, -104, -104, 61, 61, 61, -104, -104, -104, -104, - -104, 61, 61, 61, 61, 61, 61, 129, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -104 + 9, -104, -104, -104, -104, -104, -104, 55, -104, -104, + -104, -104, -104, 58, 58, -104, -104, -104, -104, -104, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 129, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -104 }, { - 9, -105, -105, -105, -105, -105, -105, 57, -105, -105, - -105, -105, -105, 61, 61, 61, -105, -105, -105, -105, - -105, 130, 131, 61, 132, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -105 + 9, -105, -105, -105, -105, -105, -105, 55, -105, -105, + -105, -105, -105, 58, 58, -105, -105, -105, -105, -105, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -105 }, { - 9, -106, -106, -106, -106, -106, -106, 57, -106, -106, - -106, -106, -106, 61, 61, 61, -106, -106, -106, -106, - -106, 61, 61, 61, 61, 61, 133, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -106 + 9, -106, -106, -106, -106, -106, -106, 55, -106, -106, + -106, -106, -106, 58, 58, -106, -106, -106, -106, -106, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 130, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -106 }, { - 9, -107, -107, -107, -107, -107, -107, 57, -107, -107, - -107, -107, -107, 61, 61, 61, -107, -107, -107, -107, - -107, 61, 61, 61, 134, 61, 61, 61, 61, 61, - 135, 61, 136, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -107 + 9, -107, -107, -107, -107, -107, -107, 55, -107, -107, + -107, -107, -107, 58, 58, -107, -107, -107, -107, -107, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 131, 58, + 58, 58, -107 }, { - 9, -108, -108, -108, -108, -108, -108, 57, -108, -108, - -108, -108, -108, 61, 61, 61, -108, -108, -108, -108, - -108, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 137, 61, 61, 61, 61, - 61, 61, 61, -108 + 9, -108, -108, -108, -108, -108, -108, 55, -108, -108, + -108, -108, -108, 58, 58, -108, -108, -108, -108, -108, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 132, 58, + 58, 58, -108 }, { - 9, -109, -109, -109, -109, -109, -109, 57, -109, -109, - -109, -109, -109, 61, 61, 61, -109, -109, -109, -109, - -109, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -109 + 9, -109, -109, -109, -109, -109, -109, 55, -109, -109, + -109, -109, -109, 58, 58, -109, -109, -109, -109, -109, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 133, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -109 }, { - 9, -110, -110, -110, -110, -110, -110, 57, -110, -110, - -110, -110, -110, 61, 61, 61, -110, -110, -110, -110, - -110, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 138, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -110 + 9, -110, -110, -110, -110, -110, -110, 55, -110, -110, + -110, -110, -110, 58, 58, -110, -110, -110, -110, -110, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 134, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -110 }, { - 9, -111, -111, -111, -111, -111, -111, 57, -111, -111, - -111, -111, -111, 61, 61, 61, -111, -111, -111, -111, - -111, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -111 + 9, -111, -111, -111, -111, -111, -111, 55, -111, -111, + -111, -111, -111, 58, 58, -111, -111, -111, -111, -111, + 58, 58, 58, 58, 58, 58, 58, 135, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -111 }, { - 9, -112, -112, -112, -112, -112, -112, 57, -112, -112, - -112, -112, -112, 61, 61, 61, -112, -112, -112, -112, - -112, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 139, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -112 + 9, -112, -112, -112, -112, -112, -112, 55, -112, -112, + -112, -112, -112, 58, 58, -112, -112, -112, -112, -112, + 58, 58, 58, 58, 58, 136, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -112 }, { - 9, -113, -113, -113, -113, -113, -113, 57, -113, -113, - -113, -113, -113, 61, 61, 61, -113, -113, -113, -113, - -113, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 140, - 61, 61, 61, -113 + 9, -113, -113, -113, -113, -113, -113, 55, -113, -113, + -113, -113, -113, 58, 58, -113, -113, -113, -113, -113, + 58, 58, 58, 58, 58, 137, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -113 }, { - 9, -114, -114, -114, -114, -114, -114, 57, -114, -114, - -114, -114, -114, 61, 61, 61, -114, -114, -114, -114, - -114, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 141, - 61, 61, 61, -114 + 9, -114, -114, -114, -114, -114, -114, 55, -114, -114, + -114, -114, -114, 58, 58, -114, -114, -114, -114, -114, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 138, 58, 58, 58, 58, + 58, 58, -114 }, { - 9, -115, -115, -115, -115, -115, -115, 57, -115, -115, - -115, -115, -115, 61, 61, 61, -115, -115, -115, -115, - -115, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 142, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -115 + 9, -115, -115, -115, -115, -115, -115, 55, -115, -115, + -115, -115, -115, 58, 58, -115, -115, -115, -115, -115, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 139, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -115 }, { - 9, -116, -116, -116, -116, -116, -116, 57, -116, -116, - -116, -116, -116, 61, 61, 61, -116, -116, -116, -116, - -116, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 143, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -116 + 9, -116, -116, -116, -116, -116, -116, 55, -116, -116, + -116, -116, -116, 58, 58, -116, -116, -116, -116, -116, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 140, 58, 58, 58, + 58, 58, -116 }, { - 9, -117, -117, -117, -117, -117, -117, 57, -117, -117, - -117, -117, -117, 61, 61, 61, -117, -117, -117, -117, - -117, 61, 61, 61, 61, 61, 61, 61, 144, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -117 + 9, -117, -117, -117, -117, -117, -117, 55, -117, -117, + -117, -117, -117, 58, 58, -117, -117, -117, -117, -117, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 141, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -117 }, { - 9, -118, -118, -118, -118, -118, -118, 57, -118, -118, - -118, -118, -118, 61, 61, 61, -118, -118, -118, -118, - -118, 61, 61, 61, 61, 61, 145, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -118 + 9, -118, -118, -118, -118, -118, -118, 55, -118, -118, + -118, -118, -118, 58, 58, -118, -118, -118, -118, -118, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -118 }, { - 9, -119, -119, -119, -119, -119, -119, 57, -119, -119, - -119, -119, -119, 61, 61, 61, -119, -119, -119, -119, - -119, 61, 61, 61, 61, 61, 146, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -119 + 9, -119, -119, -119, -119, -119, -119, 55, -119, -119, + -119, -119, -119, 58, 58, -119, -119, -119, -119, -119, + 58, 58, 58, 142, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -119 }, { - 9, -120, -120, -120, -120, -120, -120, 57, -120, -120, - -120, -120, -120, 61, 61, 61, -120, -120, -120, -120, - -120, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 147, 61, 61, 61, - 61, 61, 61, -120 + 9, -120, -120, -120, -120, -120, -120, 55, -120, -120, + -120, -120, -120, 58, 58, -120, -120, -120, -120, -120, + 58, 58, 58, 58, 58, 143, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -120 }, { - 9, -121, -121, -121, -121, -121, -121, 57, -121, -121, - -121, -121, -121, 61, 61, 61, -121, -121, -121, -121, - -121, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 148, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -121 + 9, -121, -121, -121, -121, -121, -121, 55, -121, -121, + -121, -121, -121, 58, 58, -121, -121, -121, -121, -121, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 144, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -121 }, { - 9, -122, -122, -122, -122, -122, -122, 57, -122, -122, - -122, -122, -122, 61, 61, 61, -122, -122, -122, -122, - -122, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 149, 61, 61, - 61, 61, 61, -122 + 9, -122, -122, -122, -122, -122, -122, 55, -122, -122, + -122, -122, -122, 58, 58, -122, -122, -122, -122, -122, + 58, 58, 145, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 146, 58, 58, + 58, 58, -122 }, { - 9, -123, -123, -123, -123, -123, -123, 57, -123, -123, - -123, -123, -123, 61, 61, 61, -123, -123, -123, -123, - -123, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 150, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -123 + 9, -123, -123, -123, -123, -123, -123, 55, -123, -123, + -123, -123, -123, 58, 58, -123, -123, -123, -123, -123, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 147, 58, + 58, 58, -123 }, { - 9, -124, -124, -124, -124, -124, -124, 57, -124, -124, - -124, -124, -124, 61, 61, 61, -124, -124, -124, -124, - -124, 61, 61, 61, 61, 61, 151, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -124 + 9, -124, -124, -124, -124, -124, -124, 55, -124, -124, + -124, -124, -124, 58, 58, -124, -124, -124, -124, -124, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 148, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -124 }, { - 9, -125, -125, -125, -125, -125, -125, 57, -125, -125, - -125, -125, -125, 61, 61, 61, -125, -125, -125, -125, - -125, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 152, 61, 61, 61, 61, 61, - 61, 61, 61, -125 + 9, -125, -125, -125, -125, -125, -125, 55, -125, -125, + -125, -125, -125, 58, 58, -125, -125, -125, -125, -125, + 58, 58, 58, 58, 58, 58, 58, 58, 149, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -125 }, { - 9, -126, -126, -126, -126, -126, -126, 57, -126, -126, - -126, -126, -126, 61, 61, 61, -126, -126, -126, -126, - -126, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -126 + 9, -126, -126, -126, -126, -126, -126, 55, -126, -126, + -126, -126, -126, 58, 58, -126, -126, -126, -126, -126, + 58, 58, 58, 58, 58, 58, 150, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -126 }, { - 9, -127, -127, -127, -127, -127, -127, 57, -127, -127, - -127, -127, -127, 61, 61, 61, -127, -127, -127, -127, - -127, 61, 61, 61, 153, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -127 + 9, -127, -127, -127, -127, -127, -127, 55, -127, -127, + -127, -127, -127, 58, 58, -127, -127, -127, -127, -127, + 58, 58, 58, 58, 58, 151, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -127 }, { - 9, -128, -128, -128, -128, -128, -128, 57, -128, -128, - -128, -128, -128, 61, 61, 61, -128, -128, -128, -128, - -128, 61, 61, 61, 61, 61, 154, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -128 + 9, -128, -128, -128, -128, -128, -128, 55, -128, -128, + -128, -128, -128, 58, 58, -128, -128, -128, -128, -128, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -128 }, { - 9, -129, -129, -129, -129, -129, -129, 57, -129, -129, - -129, -129, -129, 61, 61, 61, -129, -129, -129, -129, - -129, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 155, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -129 + 9, -129, -129, -129, -129, -129, -129, 55, -129, -129, + -129, -129, -129, 58, 58, -129, -129, -129, -129, -129, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 152, -129 }, { - 9, -130, -130, -130, -130, -130, -130, 57, -130, -130, - -130, -130, -130, 61, 61, 61, -130, -130, -130, -130, - -130, 61, 61, 156, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 157, 61, - 61, 61, 61, -130 + 9, -130, -130, -130, -130, -130, -130, 55, -130, -130, + -130, -130, -130, 58, 58, -130, -130, -130, -130, -130, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 153, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -130 }, { - 9, -131, -131, -131, -131, -131, -131, 57, -131, -131, - -131, -131, -131, 61, 61, 61, -131, -131, -131, -131, - -131, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 158, - 61, 61, 61, -131 + 9, -131, -131, -131, -131, -131, -131, 55, -131, -131, + -131, -131, -131, 58, 58, -131, -131, -131, -131, -131, + 58, 58, 58, 154, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -131 }, { - 9, -132, -132, -132, -132, -132, -132, 57, -132, -132, - -132, -132, -132, 61, 61, 61, -132, -132, -132, -132, - -132, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 159, 61, 61, 61, 61, 61, - 61, 61, 61, -132 + 9, -132, -132, -132, -132, -132, -132, 55, -132, -132, + -132, -132, -132, 58, 58, -132, -132, -132, -132, -132, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 155, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -132 }, { - 9, -133, -133, -133, -133, -133, -133, 57, -133, -133, - -133, -133, -133, 61, 61, 61, -133, -133, -133, -133, - -133, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 160, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -133 + 9, -133, -133, -133, -133, -133, -133, 55, -133, -133, + -133, -133, -133, 58, 58, -133, -133, -133, -133, -133, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 156, 58, 58, 58, 58, 58, 58, + 58, 58, -133 }, { - 9, -134, -134, -134, -134, -134, -134, 57, -134, -134, - -134, -134, -134, 61, 61, 61, -134, -134, -134, -134, - -134, 61, 61, 61, 61, 61, 61, 61, 61, 161, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -134 + 9, -134, -134, -134, -134, -134, -134, 55, -134, -134, + -134, -134, -134, 58, 58, -134, -134, -134, -134, -134, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 157, 58, 58, 58, 58, 58, + 58, 58, -134 }, { - 9, -135, -135, -135, -135, -135, -135, 57, -135, -135, - -135, -135, -135, 61, 61, 61, -135, -135, -135, -135, - -135, 61, 61, 61, 61, 61, 61, 162, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -135 + 9, -135, -135, -135, -135, -135, -135, 55, -135, -135, + -135, -135, -135, 58, 58, -135, -135, -135, -135, -135, + 58, 58, 58, 58, 58, 158, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -135 }, { - 9, -136, -136, -136, -136, -136, -136, 57, -136, -136, - -136, -136, -136, 61, 61, 61, -136, -136, -136, -136, - -136, 61, 61, 61, 61, 61, 163, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -136 + 9, -136, -136, -136, -136, -136, -136, 55, -136, -136, + -136, -136, -136, 58, 58, -136, -136, -136, -136, -136, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 159, 58, 58, + 58, 58, -136 }, { - 9, -137, -137, -137, -137, -137, -137, 57, -137, -137, - -137, -137, -137, 61, 61, 61, -137, -137, -137, -137, - -137, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -137 + 9, -137, -137, -137, -137, -137, -137, 55, -137, -137, + -137, -137, -137, 58, 58, -137, -137, -137, -137, -137, + 58, 58, 58, 160, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -137 }, { - 9, -138, -138, -138, -138, -138, -138, 57, -138, -138, - -138, -138, -138, 61, 61, 61, -138, -138, -138, -138, - -138, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 164, -138 + 9, -138, -138, -138, -138, -138, -138, 55, -138, -138, + -138, -138, -138, 58, 58, -138, -138, -138, -138, -138, + 58, 58, 58, 161, 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, 57, -139, -139, - -139, -139, -139, 61, 61, 61, -139, -139, -139, -139, - -139, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 165, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -139 + 9, -139, -139, -139, -139, -139, -139, 55, -139, -139, + -139, -139, -139, 58, 58, -139, -139, -139, -139, -139, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 162, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -139 }, { - 9, -140, -140, -140, -140, -140, -140, 57, -140, -140, - -140, -140, -140, 61, 61, 61, -140, -140, -140, -140, - -140, 61, 61, 61, 166, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -140 + 9, -140, -140, -140, -140, -140, -140, 55, -140, -140, + -140, -140, -140, 58, 58, -140, -140, -140, -140, -140, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 163, 58, 58, + 58, 58, -140 }, { - 9, -141, -141, -141, -141, -141, -141, 57, -141, -141, - -141, -141, -141, 61, 61, 61, -141, -141, -141, -141, - -141, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 167, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -141 + 9, -141, -141, -141, -141, -141, -141, 55, -141, -141, + -141, -141, -141, 58, 58, -141, -141, -141, -141, -141, + 58, 58, 164, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -141 }, { - 9, -142, -142, -142, -142, -142, -142, 57, -142, -142, - -142, -142, -142, 61, 61, 61, -142, -142, -142, -142, - -142, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 168, 61, 61, 61, 61, 61, - 61, 61, 61, -142 + 9, -142, -142, -142, -142, -142, -142, 55, -142, -142, + -142, -142, -142, 58, 58, -142, -142, -142, -142, -142, + 58, 58, 58, 58, 58, 165, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -142 }, { - 9, -143, -143, -143, -143, -143, -143, 57, -143, -143, - -143, -143, -143, 61, 61, 61, -143, -143, -143, -143, - -143, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 169, 61, 61, 61, 61, - 61, 61, 61, -143 + 9, -143, -143, -143, -143, -143, -143, 55, -143, -143, + -143, -143, -143, 58, 58, -143, -143, -143, -143, -143, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 166, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -143 }, { - 9, -144, -144, -144, -144, -144, -144, 57, -144, -144, - -144, -144, -144, 61, 61, 61, -144, -144, -144, -144, - -144, 61, 61, 61, 61, 61, 170, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -144 + 9, -144, -144, -144, -144, -144, -144, 55, -144, -144, + -144, -144, -144, 58, 58, -144, -144, -144, -144, -144, + 58, 58, 58, 58, 58, 58, 58, 167, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -144 }, { - 9, -145, -145, -145, -145, -145, -145, 57, -145, -145, - -145, -145, -145, 61, 61, 61, -145, -145, -145, -145, - -145, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 171, 61, - 61, 61, 61, -145 + 9, -145, -145, -145, -145, -145, -145, 55, -145, -145, + -145, -145, -145, 58, 58, -145, -145, -145, -145, -145, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 168, 58, 58, 58, 58, 58, 58, + 58, 58, -145 }, { - 9, -146, -146, -146, -146, -146, -146, 57, -146, -146, - -146, -146, -146, 61, 61, 61, -146, -146, -146, -146, - -146, 61, 61, 61, 172, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -146 + 9, -146, -146, -146, -146, -146, -146, 55, -146, -146, + -146, -146, -146, 58, 58, -146, -146, -146, -146, -146, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 169, 58, 58, 58, 58, + 58, 58, -146 }, { - 9, -147, -147, -147, -147, -147, -147, 57, -147, -147, - -147, -147, -147, 61, 61, 61, -147, -147, -147, -147, - -147, 61, 61, 61, 173, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -147 + 9, -147, -147, -147, -147, -147, -147, 55, -147, -147, + -147, -147, -147, 58, 58, -147, -147, -147, -147, -147, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 170, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -147 }, { - 9, -148, -148, -148, -148, -148, -148, 57, -148, -148, - -148, -148, -148, 61, 61, 61, -148, -148, -148, -148, - -148, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 174, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -148 + 9, -148, -148, -148, -148, -148, -148, 55, -148, -148, + -148, -148, -148, 58, 58, -148, -148, -148, -148, -148, + 58, 58, 58, 58, 171, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -148 }, { - 9, -149, -149, -149, -149, -149, -149, 57, -149, -149, - -149, -149, -149, 61, 61, 61, -149, -149, -149, -149, - -149, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 175, 61, - 61, 61, 61, -149 + 9, -149, -149, -149, -149, -149, -149, 55, -149, -149, + -149, -149, -149, 58, 58, -149, -149, -149, -149, -149, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 172, 58, 58, 58, 58, 58, 58, + 58, 58, -149 }, { - 9, -150, -150, -150, -150, -150, -150, 57, -150, -150, - -150, -150, -150, 61, 61, 61, -150, -150, -150, -150, - -150, 61, 61, 176, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -150 + 9, -150, -150, -150, -150, -150, -150, 55, -150, -150, + -150, -150, -150, 58, 58, -150, -150, -150, -150, -150, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -150 }, { - 9, -151, -151, -151, -151, -151, -151, 57, -151, -151, - -151, -151, -151, 61, 61, 61, -151, -151, -151, -151, - -151, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 177, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -151 + 9, -151, -151, -151, -151, -151, -151, 55, -151, -151, + -151, -151, -151, 58, 58, -151, -151, -151, -151, -151, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 173, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -151 }, { - 9, -152, -152, -152, -152, -152, -152, 57, -152, -152, - -152, -152, -152, 61, 61, 61, -152, -152, -152, -152, - -152, 61, 61, 61, 178, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -152 + 9, -152, -152, -152, -152, -152, -152, 55, -152, -152, + -152, -152, -152, 58, 58, -152, -152, -152, -152, -152, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -152 }, { - 9, -153, -153, -153, -153, -153, -153, 57, -153, -153, - -153, -153, -153, 61, 61, 61, -153, -153, -153, -153, - -153, 61, 61, 61, 61, 61, 179, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -153 + 9, -153, -153, -153, -153, -153, -153, 55, -153, -153, + -153, -153, -153, 58, 58, -153, -153, -153, -153, -153, + 58, 58, 58, 58, 58, 174, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -153 }, { - 9, -154, -154, -154, -154, -154, -154, 57, -154, -154, - -154, -154, -154, 61, 61, 61, -154, -154, -154, -154, - -154, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 180, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -154 + 9, -154, -154, -154, -154, -154, -154, 55, -154, -154, + -154, -154, -154, 58, 58, -154, -154, -154, -154, -154, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 175, 58, 58, 58, 58, 58, 58, + 58, 58, -154 }, { - 9, -155, -155, -155, -155, -155, -155, 57, -155, -155, - -155, -155, -155, 61, 61, 61, -155, -155, -155, -155, - -155, 61, 61, 61, 61, 61, 61, 61, 181, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -155 + 9, -155, -155, -155, -155, -155, -155, 55, -155, -155, + -155, -155, -155, 58, 58, -155, -155, -155, -155, -155, + 58, 58, 58, 58, 58, 176, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -155 }, { - 9, -156, -156, -156, -156, -156, -156, 57, -156, -156, - -156, -156, -156, 61, 61, 61, -156, -156, -156, -156, - -156, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 182, 61, 61, 61, 61, 61, - 61, 61, 61, -156 + 9, -156, -156, -156, -156, -156, -156, 55, -156, -156, + -156, -156, -156, 58, 58, -156, -156, -156, -156, -156, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 177, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -156 }, { - 9, -157, -157, -157, -157, -157, -157, 57, -157, -157, - -157, -157, -157, 61, 61, 61, -157, -157, -157, -157, - -157, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 183, 61, 61, 61, - 61, 61, 61, -157 + 9, -157, -157, -157, -157, -157, -157, 55, -157, -157, + -157, -157, -157, 58, 58, -157, -157, -157, -157, -157, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 178, 58, 58, + 58, 58, -157 }, { - 9, -158, -158, -158, -158, -158, -158, 57, -158, -158, - -158, -158, -158, 61, 61, 61, -158, -158, -158, -158, - -158, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 184, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -158 + 9, -158, -158, -158, -158, -158, -158, 55, -158, -158, + -158, -158, -158, 58, 58, -158, -158, -158, -158, -158, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -158 }, { - 9, -159, -159, -159, -159, -159, -159, 57, -159, -159, - -159, -159, -159, 61, 61, 61, -159, -159, -159, -159, - -159, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 185, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -159 + 9, -159, -159, -159, -159, -159, -159, 55, -159, -159, + -159, -159, -159, 58, 58, -159, -159, -159, -159, -159, + 58, 58, 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, 57, -160, -160, - -160, -160, -160, 61, 61, 61, -160, -160, -160, -160, - -160, 61, 61, 61, 61, 186, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -160 + 9, -160, -160, -160, -160, -160, -160, 55, -160, -160, + -160, -160, -160, 58, 58, -160, -160, -160, -160, -160, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 179, 58, 58, + 58, 58, -160 }, { - 9, -161, -161, -161, -161, -161, -161, 57, -161, -161, - -161, -161, -161, 61, 61, 61, -161, -161, -161, -161, - -161, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 187, 61, 61, 61, 61, 61, - 61, 61, 61, -161 + 9, -161, -161, -161, -161, -161, -161, 55, -161, -161, + -161, -161, -161, 58, 58, -161, -161, -161, -161, -161, + 58, 58, 58, 58, 58, 180, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -161 }, { - 9, -162, -162, -162, -162, -162, -162, 57, -162, -162, - -162, -162, -162, 61, 61, 61, -162, -162, -162, -162, - -162, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -162 + 9, -162, -162, -162, -162, -162, -162, 55, -162, -162, + -162, -162, -162, 58, 58, -162, -162, -162, -162, -162, + 58, 58, 58, 58, 58, 58, 58, 181, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -162 }, { - 9, -163, -163, -163, -163, -163, -163, 57, -163, -163, - -163, -163, -163, 61, 61, 61, -163, -163, -163, -163, - -163, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 188, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -163 + 9, -163, -163, -163, -163, -163, -163, 55, -163, -163, + -163, -163, -163, 58, 58, -163, -163, -163, -163, -163, + 58, 182, 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, 57, -164, -164, - -164, -164, -164, 61, 61, 61, -164, -164, -164, -164, - -164, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -164 + 9, -164, -164, -164, -164, -164, -164, 55, -164, -164, + -164, -164, -164, 58, 58, -164, -164, -164, -164, -164, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 183, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -164 }, { - 9, -165, -165, -165, -165, -165, -165, 57, -165, -165, - -165, -165, -165, 61, 61, 61, -165, -165, -165, -165, - -165, 61, 61, 61, 61, 61, 189, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -165 + 9, -165, -165, -165, -165, -165, -165, 55, -165, -165, + -165, -165, -165, 58, 58, -165, -165, -165, -165, -165, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -165 }, { - 9, -166, -166, -166, -166, -166, -166, 57, -166, -166, - -166, -166, -166, 61, 61, 61, -166, -166, -166, -166, - -166, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 190, 61, 61, 61, 61, 61, - 61, 61, 61, -166 + 9, -166, -166, -166, -166, -166, -166, 55, -166, -166, + -166, -166, -166, 58, 58, -166, -166, -166, -166, -166, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 184, 58, 58, + 58, 58, -166 }, { - 9, -167, -167, -167, -167, -167, -167, 57, -167, -167, - -167, -167, -167, 61, 61, 61, -167, -167, -167, -167, - -167, 61, 61, 61, 61, 61, 191, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -167 + 9, -167, -167, -167, -167, -167, -167, 55, -167, -167, + -167, -167, -167, 58, 58, -167, -167, -167, -167, -167, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -167 }, { - 9, -168, -168, -168, -168, -168, -168, 57, -168, -168, - -168, -168, -168, 61, 61, 61, -168, -168, -168, -168, - -168, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 192, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -168 + 9, -168, -168, -168, -168, -168, -168, 55, -168, -168, + -168, -168, -168, 58, 58, -168, -168, -168, -168, -168, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 185, 58, 58, 58, 58, 58, 58, + 58, 58, -168 }, { - 9, -169, -169, -169, -169, -169, -169, 57, -169, -169, - -169, -169, -169, 61, 61, 61, -169, -169, -169, -169, - -169, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 193, 61, - 61, 61, 61, -169 + 9, -169, -169, -169, -169, -169, -169, 55, -169, -169, + -169, -169, -169, 58, 58, -169, -169, -169, -169, -169, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 186, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -169 }, { - 9, -170, -170, -170, -170, -170, -170, 57, -170, -170, - -170, -170, -170, 61, 61, 61, -170, -170, -170, -170, - -170, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -170 + 9, -170, -170, -170, -170, -170, -170, 55, -170, -170, + -170, -170, -170, 58, 58, -170, -170, -170, -170, -170, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 187, 58, 58, + 58, 58, -170 }, { - 9, -171, -171, -171, -171, -171, -171, 57, -171, -171, - -171, -171, -171, 61, 61, 61, -171, -171, -171, -171, - -171, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -171 + 9, -171, -171, -171, -171, -171, -171, 55, -171, -171, + -171, -171, -171, 58, 58, -171, -171, -171, -171, -171, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 188, 58, 58, 58, + 58, 58, -171 }, { - 9, -172, -172, -172, -172, -172, -172, 57, -172, -172, - -172, -172, -172, 61, 61, 61, -172, -172, -172, -172, - -172, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 194, 61, - 61, 61, 61, -172 + 9, -172, -172, -172, -172, -172, -172, 55, -172, -172, + -172, -172, -172, 58, 58, -172, -172, -172, -172, -172, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 189, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -172 }, { - 9, -173, -173, -173, -173, -173, -173, 57, -173, -173, - -173, -173, -173, 61, 61, 61, -173, -173, -173, -173, - -173, 61, 61, 61, 61, 61, 195, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -173 + 9, -173, -173, -173, -173, -173, -173, 55, -173, -173, + -173, -173, -173, 58, 58, -173, -173, -173, -173, -173, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 190, 58, + 58, 58, -173 }, { - 9, -174, -174, -174, -174, -174, -174, 57, -174, -174, - -174, -174, -174, 61, 61, 61, -174, -174, -174, -174, - -174, 61, 61, 61, 61, 61, 61, 61, 196, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -174 + 9, -174, -174, -174, -174, -174, -174, 55, -174, -174, + -174, -174, -174, 58, 58, -174, -174, -174, -174, -174, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 191, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -174 }, { - 9, -175, -175, -175, -175, -175, -175, 57, -175, -175, - -175, -175, -175, 61, 61, 61, -175, -175, -175, -175, - -175, 61, 197, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -175 + 9, -175, -175, -175, -175, -175, -175, 55, -175, -175, + -175, -175, -175, 58, 58, -175, -175, -175, -175, -175, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 192, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -175 }, { - 9, -176, -176, -176, -176, -176, -176, 57, -176, -176, - -176, -176, -176, 61, 61, 61, -176, -176, -176, -176, - -176, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 198, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -176 + 9, -176, -176, -176, -176, -176, -176, 55, -176, -176, + -176, -176, -176, 58, 58, -176, -176, -176, -176, -176, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 193, 58, 58, 58, + 58, 58, -176 }, { - 9, -177, -177, -177, -177, -177, -177, 57, -177, -177, - -177, -177, -177, 61, 61, 61, -177, -177, -177, -177, - -177, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 199, 61, 61, 61, 61, - 61, 61, 61, -177 + 9, -177, -177, -177, -177, -177, -177, 55, -177, -177, + -177, -177, -177, 58, 58, -177, -177, -177, -177, -177, + 58, 194, 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, 57, -178, -178, - -178, -178, -178, 61, 61, 61, -178, -178, -178, -178, - -178, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 200, 61, 61, 61, 61, 61, - 61, 61, 61, -178 + 9, -178, -178, -178, -178, -178, -178, 55, -178, -178, + -178, -178, -178, 58, 58, -178, -178, -178, -178, -178, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -178 }, { - 9, -179, -179, -179, -179, -179, -179, 57, -179, -179, - -179, -179, -179, 61, 61, 61, -179, -179, -179, -179, - -179, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -179 + 9, -179, -179, -179, -179, -179, -179, 55, -179, -179, + -179, -179, -179, 58, 58, -179, -179, -179, -179, -179, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -179 }, { - 9, -180, -180, -180, -180, -180, -180, 57, -180, -180, - -180, -180, -180, 61, 61, 61, -180, -180, -180, -180, - -180, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 201, 61, - 61, 61, 61, -180 + 9, -180, -180, -180, -180, -180, -180, 55, -180, -180, + -180, -180, -180, 58, 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, 57, -181, -181, - -181, -181, -181, 61, 61, 61, -181, -181, -181, -181, - -181, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -181 + 9, -181, -181, -181, -181, -181, -181, 55, -181, -181, + -181, -181, -181, 58, 58, -181, -181, -181, -181, -181, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -181 }, { - 9, -182, -182, -182, -182, -182, -182, 57, -182, -182, - -182, -182, -182, 61, 61, 61, -182, -182, -182, -182, - -182, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 202, 61, 61, 61, 61, 61, - 61, 61, 61, -182 + 9, -182, -182, -182, -182, -182, -182, 55, -182, -182, + -182, -182, -182, 58, 58, -182, -182, -182, -182, -182, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 195, 58, 58, + 58, 58, -182 }, { - 9, -183, -183, -183, -183, -183, -183, 57, -183, -183, - -183, -183, -183, 61, 61, 61, -183, -183, -183, -183, - -183, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 203, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -183 + 9, -183, -183, -183, -183, -183, -183, 55, -183, -183, + -183, -183, -183, 58, 58, -183, -183, -183, -183, -183, + 58, 58, 58, 58, 58, 196, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -183 }, { - 9, -184, -184, -184, -184, -184, -184, 57, -184, -184, - -184, -184, -184, 61, 61, 61, -184, -184, -184, -184, - -184, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 204, 61, - 61, 61, 61, -184 + 9, -184, -184, -184, -184, -184, -184, 55, -184, -184, + -184, -184, -184, 58, 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, 57, -185, -185, - -185, -185, -185, 61, 61, 61, -185, -185, -185, -185, - -185, 61, 61, 61, 61, 61, 61, 205, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -185 + 9, -185, -185, -185, -185, -185, -185, 55, -185, -185, + -185, -185, -185, 58, 58, -185, -185, -185, -185, -185, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 197, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -185 }, { - 9, -186, -186, -186, -186, -186, -186, 57, -186, -186, - -186, -186, -186, 61, 61, 61, -186, -186, -186, -186, - -186, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 206, 61, 61, - 61, 61, 61, -186 + 9, -186, -186, -186, -186, -186, -186, 55, -186, -186, + -186, -186, -186, 58, 58, -186, -186, -186, -186, -186, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 198, 58, 58, 58, + 58, 58, -186 }, { - 9, -187, -187, -187, -187, -187, -187, 57, -187, -187, - -187, -187, -187, 61, 61, 61, -187, -187, -187, -187, - -187, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 207, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -187 + 9, -187, -187, -187, -187, -187, -187, 55, -187, -187, + -187, -187, -187, 58, 58, -187, -187, -187, -187, -187, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -187 }, { - 9, -188, -188, -188, -188, -188, -188, 57, -188, -188, - -188, -188, -188, 61, 61, 61, -188, -188, -188, -188, - -188, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 208, - 61, 61, 61, -188 + 9, -188, -188, -188, -188, -188, -188, 55, -188, -188, + -188, -188, -188, 58, 58, -188, -188, -188, -188, -188, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -188 }, { - 9, -189, -189, -189, -189, -189, -189, 57, -189, -189, - -189, -189, -189, 61, 61, 61, -189, -189, -189, -189, - -189, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 209, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -189 + 9, -189, -189, -189, -189, -189, -189, 55, -189, -189, + -189, -189, -189, 58, 58, -189, -189, -189, -189, -189, + 58, 58, 58, 199, 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, 57, -190, -190, - -190, -190, -190, 61, 61, 61, -190, -190, -190, -190, - -190, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 210, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -190 + 9, -190, -190, -190, -190, -190, -190, 55, -190, -190, + -190, -190, -190, 58, 58, -190, -190, -190, -190, -190, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -190 }, { - 9, -191, -191, -191, -191, -191, -191, 57, -191, -191, - -191, -191, -191, 61, 61, 61, -191, -191, -191, -191, - -191, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 211, 61, 61, - 61, 61, 61, -191 + 9, -191, -191, -191, -191, -191, -191, 55, -191, -191, + -191, -191, -191, 58, 58, -191, -191, -191, -191, -191, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 200, 58, + 58, 58, -191 }, { - 9, -192, -192, -192, -192, -192, -192, 57, -192, -192, - -192, -192, -192, 61, 61, 61, -192, -192, -192, -192, - -192, 61, 212, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -192 + 9, -192, -192, -192, -192, -192, -192, 55, -192, -192, + -192, -192, -192, 58, 58, -192, -192, -192, -192, -192, + 58, 58, 58, 58, 58, 58, 201, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -192 }, { - 9, -193, -193, -193, -193, -193, -193, 57, -193, -193, - -193, -193, -193, 61, 61, 61, -193, -193, -193, -193, - -193, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -193 + 9, -193, -193, -193, -193, -193, -193, 55, -193, -193, + -193, -193, -193, 58, 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, 57, -194, -194, - -194, -194, -194, 61, 61, 61, -194, -194, -194, -194, - -194, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -194 + 9, -194, -194, -194, -194, -194, -194, 55, -194, -194, + -194, -194, -194, 58, 58, -194, -194, -194, -194, -194, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 202, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -194 }, { - 9, -195, -195, -195, -195, -195, -195, 57, -195, -195, - -195, -195, -195, 61, 61, 61, -195, -195, -195, -195, - -195, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -195 + 9, -195, -195, -195, -195, -195, -195, 55, -195, -195, + -195, -195, -195, 58, 58, -195, -195, -195, -195, -195, + 58, 58, 58, 58, 58, 203, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -195 }, { - 9, -196, -196, -196, -196, -196, -196, 57, -196, -196, - -196, -196, -196, 61, 61, 61, -196, -196, -196, -196, - -196, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -196 + 9, -196, -196, -196, -196, -196, -196, 55, -196, -196, + -196, -196, -196, 58, 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, 57, -197, -197, - -197, -197, -197, 61, 61, 61, -197, -197, -197, -197, - -197, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 213, 61, - 61, 61, 61, -197 + 9, -197, -197, -197, -197, -197, -197, 55, -197, -197, + -197, -197, -197, 58, 58, -197, -197, -197, -197, -197, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -197 }, { - 9, -198, -198, -198, -198, -198, -198, 57, -198, -198, - -198, -198, -198, 61, 61, 61, -198, -198, -198, -198, - -198, 61, 61, 61, 61, 61, 214, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -198 + 9, -198, -198, -198, -198, -198, -198, 55, -198, -198, + -198, -198, -198, 58, 58, -198, -198, -198, -198, -198, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 204, 58, 58, + 58, 58, -198 }, { - 9, -199, -199, -199, -199, -199, -199, 57, -199, -199, - -199, -199, -199, 215, 61, 61, -199, -199, -199, -199, - -199, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -199 + 9, -199, -199, -199, -199, -199, -199, 55, -199, -199, + -199, -199, -199, 58, 58, -199, -199, -199, -199, -199, + 58, 58, 58, 58, 58, 205, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -199 }, { - 9, -200, -200, -200, -200, -200, -200, 57, -200, -200, - -200, -200, -200, 61, 61, 61, -200, -200, -200, -200, - -200, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 216, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -200 + 9, -200, -200, -200, -200, -200, -200, 55, -200, -200, + -200, -200, -200, 58, 58, -200, -200, -200, -200, -200, + 58, 58, 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, 57, -201, -201, - -201, -201, -201, 61, 61, 61, -201, -201, -201, -201, - -201, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -201 + 9, -201, -201, -201, -201, -201, -201, 55, -201, -201, + -201, -201, -201, 58, 58, -201, -201, -201, -201, -201, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 206, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -201 }, { - 9, -202, -202, -202, -202, -202, -202, 57, -202, -202, - -202, -202, -202, 61, 61, 61, -202, -202, -202, -202, - -202, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 217, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -202 + 9, -202, -202, -202, -202, -202, -202, 55, -202, -202, + -202, -202, -202, 58, 58, -202, -202, -202, -202, -202, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -202 }, { - 9, -203, -203, -203, -203, -203, -203, 57, -203, -203, - -203, -203, -203, 61, 61, 61, -203, -203, -203, -203, - -203, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 218, 61, 61, - 61, 61, 61, -203 + 9, -203, -203, -203, -203, -203, -203, 55, -203, -203, + -203, -203, -203, 58, 58, -203, -203, -203, -203, -203, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -203 }, { - 9, -204, -204, -204, -204, -204, -204, 57, -204, -204, - -204, -204, -204, 61, 61, 61, -204, -204, -204, -204, - -204, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -204 + 9, -204, -204, -204, -204, -204, -204, 55, -204, -204, + -204, -204, -204, 58, 58, -204, -204, -204, -204, -204, + 58, 207, 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, 57, -205, -205, - -205, -205, -205, 61, 61, 61, -205, -205, -205, -205, - -205, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 219, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -205 + 9, -205, -205, -205, -205, -205, -205, 55, -205, -205, + -205, -205, -205, 58, 58, -205, -205, -205, -205, -205, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -205 }, { - 9, -206, -206, -206, -206, -206, -206, 57, -206, -206, - -206, -206, -206, 61, 61, 61, -206, -206, -206, -206, - -206, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -206 + 9, -206, -206, -206, -206, -206, -206, 55, -206, -206, + -206, -206, -206, 58, 58, -206, -206, -206, -206, -206, + 58, 58, 58, 58, 58, 58, 58, 208, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -206 }, { - 9, -207, -207, -207, -207, -207, -207, 57, -207, -207, - -207, -207, -207, 61, 61, 61, -207, -207, -207, -207, - -207, 61, 61, 61, 220, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -207 + 9, -207, -207, -207, -207, -207, -207, 55, -207, -207, + -207, -207, -207, 58, 58, -207, -207, -207, -207, -207, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 209, 58, 58, + 58, 58, -207 }, { - 9, -208, -208, -208, -208, -208, -208, 57, -208, -208, - -208, -208, -208, 61, 61, 61, -208, -208, -208, -208, - -208, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -208 + 9, -208, -208, -208, -208, -208, -208, 55, -208, -208, + -208, -208, -208, 58, 58, -208, -208, -208, -208, -208, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -208 }, { - 9, -209, -209, -209, -209, -209, -209, 57, -209, -209, - -209, -209, -209, 61, 61, 61, -209, -209, -209, -209, - -209, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 221, - 61, 61, 61, -209 + 9, -209, -209, -209, -209, -209, -209, 55, -209, -209, + -209, -209, -209, 58, 58, -209, -209, -209, -209, -209, + 58, 58, 58, 58, 58, 210, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -209 }, { - 9, -210, -210, -210, -210, -210, -210, 57, -210, -210, - -210, -210, -210, 61, 61, 61, -210, -210, -210, -210, - -210, 61, 61, 61, 61, 61, 61, 222, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -210 - }, - - { - 9, -211, -211, -211, -211, -211, -211, 57, -211, -211, - -211, -211, -211, 61, 61, 61, -211, -211, -211, -211, - -211, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -211 - - }, - - { - 9, -212, -212, -212, -212, -212, -212, 57, -212, -212, - -212, -212, -212, 61, 61, 61, -212, -212, -212, -212, - -212, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 223, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -212 - }, - - { - 9, -213, -213, -213, -213, -213, -213, 57, -213, -213, - -213, -213, -213, 61, 61, 61, -213, -213, -213, -213, - -213, 61, 61, 61, 61, 61, 224, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -213 - - }, - - { - 9, -214, -214, -214, -214, -214, -214, 57, -214, -214, - -214, -214, -214, 61, 61, 61, -214, -214, -214, -214, - -214, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -214 - }, - - { - 9, -215, -215, -215, -215, -215, -215, 57, -215, -215, - -215, -215, -215, 225, 61, 61, -215, -215, -215, -215, - -215, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -215 - - }, - - { - 9, -216, -216, -216, -216, -216, -216, 57, -216, -216, - -216, -216, -216, 61, 61, 61, -216, -216, -216, -216, - -216, 61, 61, 61, 61, 61, 61, 226, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -216 - }, - - { - 9, -217, -217, -217, -217, -217, -217, 57, -217, -217, - -217, -217, -217, 61, 61, 61, -217, -217, -217, -217, - -217, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -217 - - }, - - { - 9, -218, -218, -218, -218, -218, -218, 57, -218, -218, - -218, -218, -218, 61, 61, 61, -218, -218, -218, -218, - -218, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 227, 61, - 61, 61, 61, -218 - }, - - { - 9, -219, -219, -219, -219, -219, -219, 57, -219, -219, - -219, -219, -219, 61, 61, 61, -219, -219, -219, -219, - -219, 61, 61, 61, 61, 61, 61, 61, 228, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -219 - - }, - - { - 9, -220, -220, -220, -220, -220, -220, 57, -220, -220, - -220, -220, -220, 61, 61, 61, -220, -220, -220, -220, - -220, 61, 61, 61, 61, 61, 229, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -220 - }, - - { - 9, -221, -221, -221, -221, -221, -221, 57, -221, -221, - -221, -221, -221, 61, 61, 61, -221, -221, -221, -221, - -221, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -221 - - }, - - { - 9, -222, -222, -222, -222, -222, -222, 57, -222, -222, - -222, -222, -222, 61, 61, 61, -222, -222, -222, -222, - -222, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 230, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -222 - }, - - { - 9, -223, -223, -223, -223, -223, -223, 57, -223, -223, - -223, -223, -223, 61, 61, 61, -223, -223, -223, -223, - -223, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -223 - - }, - - { - 9, -224, -224, -224, -224, -224, -224, 57, -224, -224, - -224, -224, -224, 61, 61, 61, -224, -224, -224, -224, - -224, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -224 - }, - - { - 9, -225, -225, -225, -225, -225, -225, 57, -225, -225, - -225, -225, -225, 137, 61, 61, -225, -225, -225, -225, - -225, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -225 - - }, - - { - 9, -226, -226, -226, -226, -226, -226, 57, -226, -226, - -226, -226, -226, 61, 61, 61, -226, -226, -226, -226, - -226, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 231, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -226 - }, - - { - 9, -227, -227, -227, -227, -227, -227, 57, -227, -227, - -227, -227, -227, 61, 61, 61, -227, -227, -227, -227, - -227, 61, 232, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -227 - - }, - - { - 9, -228, -228, -228, -228, -228, -228, 57, -228, -228, - -228, -228, -228, 61, 61, 61, -228, -228, -228, -228, - -228, 233, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -228 - }, - - { - 9, -229, -229, -229, -229, -229, -229, 57, -229, -229, - -229, -229, -229, 61, 61, 61, -229, -229, -229, -229, - -229, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -229 - - }, - - { - 9, -230, -230, -230, -230, -230, -230, 57, -230, -230, - -230, -230, -230, 61, 61, 61, -230, -230, -230, -230, - -230, 61, 61, 61, 61, 61, 61, 61, 234, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -230 - }, - - { - 9, -231, -231, -231, -231, -231, -231, 57, -231, -231, - -231, -231, -231, 61, 61, 61, -231, -231, -231, -231, - -231, 61, 61, 61, 61, 61, 61, 61, 235, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -231 - - }, - - { - 9, -232, -232, -232, -232, -232, -232, 57, -232, -232, - -232, -232, -232, 61, 61, 61, -232, -232, -232, -232, - -232, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 236, 61, - 61, 61, 61, -232 - }, - - { - 9, -233, -233, -233, -233, -233, -233, 57, -233, -233, - -233, -233, -233, 61, 61, 61, -233, -233, -233, -233, - -233, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 237, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -233 - - }, - - { - 9, -234, -234, -234, -234, -234, -234, 57, -234, -234, - -234, -234, -234, 61, 61, 61, -234, -234, -234, -234, - -234, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -234 - }, - - { - 9, -235, -235, -235, -235, -235, -235, 57, -235, -235, - -235, -235, -235, 61, 61, 61, -235, -235, -235, -235, - -235, 238, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -235 - - }, - - { - 9, -236, -236, -236, -236, -236, -236, 57, -236, -236, - -236, -236, -236, 61, 61, 61, -236, -236, -236, -236, - -236, 61, 61, 61, 61, 61, 239, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -236 - }, - - { - 9, -237, -237, -237, -237, -237, -237, 57, -237, -237, - -237, -237, -237, 61, 61, 61, -237, -237, -237, -237, - -237, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 240, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -237 - - }, - - { - 9, -238, -238, -238, -238, -238, -238, 57, -238, -238, - -238, -238, -238, 61, 61, 61, -238, -238, -238, -238, - -238, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 241, -238 - }, - - { - 9, -239, -239, -239, -239, -239, -239, 57, -239, -239, - -239, -239, -239, 61, 61, 61, -239, -239, -239, -239, - -239, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -239 - - }, - - { - 9, -240, -240, -240, -240, -240, -240, 57, -240, -240, - -240, -240, -240, 61, 61, 61, -240, -240, -240, -240, - -240, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 242, 61, 61, - 61, 61, 61, -240 - }, - - { - 9, -241, -241, -241, -241, -241, -241, 57, -241, -241, - -241, -241, -241, 61, 61, 61, -241, -241, -241, -241, - -241, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -241 - - }, - - { - 9, -242, -242, -242, -242, -242, -242, 57, -242, -242, - -242, -242, -242, 61, 61, 61, -242, -242, -242, -242, - -242, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 243, 61, - 61, 61, 61, -242 - }, - - { - 9, -243, -243, -243, -243, -243, -243, 57, -243, -243, - -243, -243, -243, 61, 61, 61, -243, -243, -243, -243, - -243, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, - 61, 61, 61, -243 - + 9, -210, -210, -210, -210, -210, -210, 55, -210, -210, + -210, -210, -210, 58, 58, -210, -210, -210, -210, -210, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, + 58, 58, -210 }, } ; @@ -2449,8 +2168,8 @@ static void yynoreturn yy_fatal_error ( const char* msg ); (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; -#define YY_NUM_RULES 67 -#define YY_END_OF_BUFFER 68 +#define YY_NUM_RULES 64 +#define YY_END_OF_BUFFER 65 /* This struct is not used in this scanner, but its presence is necessary. */ struct yy_trans_info @@ -2458,35 +2177,31 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[244] = +static const flex_int16_t yy_accept[211] = { 0, - 2, 2, 0, 0, 0, 0, 0, 0, 68, 54, - 2, 4, 46, 51, 1, 53, 54, 47, 48, 54, - 52, 52, 54, 42, 40, 44, 54, 52, 52, 52, - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, - 52, 54, 55, 57, 56, 66, 63, 65, 59, 62, - 61, 58, 60, 2, 41, 1, 53, 39, 50, 52, - 52, 49, 43, 45, 3, 52, 52, 52, 52, 52, - 52, 52, 20, 52, 52, 52, 52, 52, 27, 52, - 52, 52, 52, 52, 52, 52, 52, 52, 38, 55, - 55, 66, 63, 65, 64, 59, 58, 60, 52, 52, + 2, 2, 0, 0, 0, 0, 0, 0, 65, 51, + 2, 4, 43, 48, 1, 50, 51, 44, 45, 51, + 49, 51, 39, 37, 41, 51, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 51, + 52, 54, 53, 63, 60, 62, 56, 59, 58, 55, + 57, 2, 38, 1, 50, 36, 47, 49, 46, 40, + 42, 3, 49, 49, 49, 49, 49, 49, 18, 49, + 49, 49, 49, 49, 25, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 35, 52, 52, 63, 60, 62, + 61, 56, 55, 57, 49, 49, 49, 49, 49, 49, - 52, 52, 52, 52, 52, 52, 52, 52, 19, 52, - 22, 52, 52, 52, 52, 52, 52, 52, 52, 52, - 52, 52, 52, 52, 52, 6, 52, 52, 52, 52, - 52, 52, 52, 52, 52, 52, 18, 52, 52, 24, - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, - 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, - 52, 16, 52, 21, 52, 52, 52, 52, 52, 31, - 32, 52, 52, 52, 52, 52, 52, 52, 7, 52, - 9, 52, 52, 52, 52, 52, 52, 52, 52, 52, - 52, 28, 30, 33, 34, 35, 52, 52, 52, 52, + 49, 49, 17, 49, 20, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 5, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 16, 49, 49, + 22, 49, 49, 49, 49, 49, 49, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 49, 49, 14, + 49, 19, 49, 49, 49, 49, 49, 28, 29, 49, + 49, 49, 49, 49, 6, 49, 8, 49, 49, 49, + 49, 49, 49, 49, 49, 49, 49, 27, 30, 31, + 32, 49, 49, 7, 49, 49, 11, 12, 49, 15, + 49, 49, 24, 49, 49, 34, 9, 49, 49, 21, - 8, 52, 52, 12, 52, 14, 52, 17, 52, 52, - 26, 52, 52, 37, 52, 52, 10, 52, 52, 52, - 23, 52, 29, 36, 52, 52, 52, 52, 15, 52, - 52, 52, 52, 25, 52, 52, 52, 52, 11, 52, - 5, 52, 13 + 49, 26, 33, 49, 13, 49, 49, 23, 49, 10 } ; static const YY_CHAR yy_ec[256] = @@ -2495,16 +2210,16 @@ static const YY_CHAR yy_ec[256] = 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, 14, 14, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 16, 1, 17, - 18, 19, 1, 1, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, - 1, 20, 1, 1, 21, 1, 22, 23, 24, 25, + 11, 1, 12, 1, 13, 14, 14, 13, 13, 13, + 13, 13, 13, 13, 13, 13, 13, 15, 1, 16, + 17, 18, 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, 19, 1, 1, 20, 1, 21, 22, 23, 24, - 26, 27, 28, 29, 30, 15, 15, 31, 32, 33, - 34, 35, 15, 36, 37, 38, 39, 40, 15, 41, - 42, 15, 1, 43, 1, 1, 1, 1, 1, 1, + 25, 26, 27, 28, 29, 13, 13, 30, 31, 32, + 33, 34, 13, 35, 36, 37, 38, 39, 13, 40, + 41, 13, 1, 42, 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, @@ -2522,12 +2237,12 @@ static const YY_CHAR yy_ec[256] = } ; /* Table of booleans, true if rule could match eol. */ -static const flex_int32_t yy_rule_can_match_eol[68] = +static const flex_int32_t yy_rule_can_match_eol[65] = { 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, 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 1, 0, 1, 1, 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; @@ -2550,7 +2265,6 @@ char *yytext; #include #include #include -#include #include #include @@ -2576,7 +2290,7 @@ struct buffer { YY_BUFFER_STATE state; }; -struct buffer *current_buf; +static struct buffer *current_buf; static int last_ts, first_ts; @@ -2885,189 +2599,177 @@ return T_EOL; YY_BREAK case 5: YY_RULE_SETUP -return T_ALLNOCONFIG_Y; +return T_BOOL; YY_BREAK case 6: YY_RULE_SETUP -return T_BOOL; +return T_CHOICE; YY_BREAK case 7: YY_RULE_SETUP -return T_CHOICE; +return T_COMMENT; YY_BREAK case 8: YY_RULE_SETUP -return T_COMMENT; +return T_CONFIG; YY_BREAK case 9: YY_RULE_SETUP -return T_CONFIG; +return T_DEF_BOOL; YY_BREAK case 10: YY_RULE_SETUP -return T_DEF_BOOL; +return T_DEF_TRISTATE; YY_BREAK case 11: YY_RULE_SETUP -return T_DEF_TRISTATE; +return T_DEFAULT; YY_BREAK case 12: YY_RULE_SETUP -return T_DEFAULT; +return T_DEPENDS; YY_BREAK case 13: YY_RULE_SETUP -return T_DEFCONFIG_LIST; +return T_ENDCHOICE; YY_BREAK case 14: YY_RULE_SETUP -return T_DEPENDS; +return T_ENDIF; YY_BREAK case 15: YY_RULE_SETUP -return T_ENDCHOICE; +return T_ENDMENU; YY_BREAK case 16: YY_RULE_SETUP -return T_ENDIF; +return T_HELP; YY_BREAK case 17: YY_RULE_SETUP -return T_ENDMENU; +return T_HEX; YY_BREAK case 18: YY_RULE_SETUP -return T_HELP; +return T_IF; YY_BREAK case 19: YY_RULE_SETUP -return T_HEX; +return T_IMPLY; YY_BREAK case 20: YY_RULE_SETUP -return T_IF; +return T_INT; YY_BREAK case 21: YY_RULE_SETUP -return T_IMPLY; +return T_MAINMENU; YY_BREAK case 22: YY_RULE_SETUP -return T_INT; +return T_MENU; YY_BREAK case 23: YY_RULE_SETUP -return T_MAINMENU; +return T_MENUCONFIG; YY_BREAK case 24: YY_RULE_SETUP -return T_MENU; +return T_MODULES; YY_BREAK case 25: YY_RULE_SETUP -return T_MENUCONFIG; +return T_ON; YY_BREAK case 26: YY_RULE_SETUP -return T_MODULES; +return T_OPTIONAL; YY_BREAK case 27: YY_RULE_SETUP -return T_ON; +return T_PROMPT; YY_BREAK case 28: YY_RULE_SETUP -return T_OPTION; +return T_RANGE; YY_BREAK case 29: YY_RULE_SETUP -return T_OPTIONAL; +return T_RESET; YY_BREAK case 30: YY_RULE_SETUP -return T_PROMPT; +return T_SELECT; YY_BREAK case 31: YY_RULE_SETUP -return T_RANGE; +return T_SOURCE; YY_BREAK case 32: YY_RULE_SETUP -return T_RESET; +return T_STRING; YY_BREAK case 33: YY_RULE_SETUP -return T_SELECT; +return T_TRISTATE; YY_BREAK case 34: YY_RULE_SETUP -return T_SOURCE; +return T_VISIBLE; YY_BREAK case 35: YY_RULE_SETUP -return T_STRING; +return T_OR; YY_BREAK case 36: YY_RULE_SETUP -return T_TRISTATE; +return T_AND; YY_BREAK case 37: YY_RULE_SETUP -return T_VISIBLE; +return T_EQUAL; YY_BREAK case 38: YY_RULE_SETUP -return T_OR; +return T_UNEQUAL; YY_BREAK case 39: YY_RULE_SETUP -return T_AND; +return T_LESS; YY_BREAK case 40: YY_RULE_SETUP -return T_EQUAL; +return T_LESS_EQUAL; YY_BREAK case 41: YY_RULE_SETUP -return T_UNEQUAL; +return T_GREATER; YY_BREAK case 42: YY_RULE_SETUP -return T_LESS; +return T_GREATER_EQUAL; YY_BREAK case 43: YY_RULE_SETUP -return T_LESS_EQUAL; +return T_NOT; YY_BREAK case 44: YY_RULE_SETUP -return T_GREATER; +return T_OPEN_PAREN; YY_BREAK case 45: YY_RULE_SETUP -return T_GREATER_EQUAL; +return T_CLOSE_PAREN; YY_BREAK case 46: YY_RULE_SETUP -return T_NOT; +return T_COLON_EQUAL; YY_BREAK case 47: YY_RULE_SETUP -return T_OPEN_PAREN; - YY_BREAK -case 48: -YY_RULE_SETUP -return T_CLOSE_PAREN; - YY_BREAK -case 49: -YY_RULE_SETUP -return T_COLON_EQUAL; - YY_BREAK -case 50: -YY_RULE_SETUP return T_PLUS_EQUAL; YY_BREAK -case 51: +case 48: YY_RULE_SETUP { str = yytext[0]; @@ -3075,7 +2777,7 @@ YY_RULE_SETUP BEGIN(STRING); } YY_BREAK -case 52: +case 49: YY_RULE_SETUP { alloc_string(yytext, yyleng); @@ -3083,7 +2785,7 @@ YY_RULE_SETUP return T_WORD; } YY_BREAK -case 53: +case 50: YY_RULE_SETUP { /* this token includes at least one '$' */ @@ -3093,12 +2795,12 @@ YY_RULE_SETUP free(yylval.string); } YY_BREAK -case 54: +case 51: YY_RULE_SETUP warn_ignored_character(*yytext); YY_BREAK -case 55: +case 52: YY_RULE_SETUP { alloc_string(yytext, yyleng); @@ -3106,33 +2808,33 @@ YY_RULE_SETUP return T_ASSIGN_VAL; } YY_BREAK -case 56: -/* rule 56 can match eol */ +case 53: +/* rule 53 can match eol */ YY_RULE_SETUP { BEGIN(INITIAL); return T_EOL; } YY_BREAK -case 57: +case 54: YY_RULE_SETUP YY_BREAK -case 58: +case 55: YY_RULE_SETUP append_expanded_string(yytext); YY_BREAK -case 59: +case 56: YY_RULE_SETUP { append_string(yytext, yyleng); } YY_BREAK -case 60: +case 57: YY_RULE_SETUP { append_string(yytext + 1, yyleng - 1); } YY_BREAK -case 61: +case 58: YY_RULE_SETUP { if (str == yytext[0]) { @@ -3143,8 +2845,8 @@ YY_RULE_SETUP append_string(yytext, 1); } YY_BREAK -case 62: -/* rule 62 can match eol */ +case 59: +/* rule 59 can match eol */ YY_RULE_SETUP { fprintf(stderr, @@ -3164,7 +2866,7 @@ case YY_STATE_EOF(STRING): } YY_BREAK -case 63: +case 60: YY_RULE_SETUP { ts = 0; @@ -3189,8 +2891,8 @@ YY_RULE_SETUP } } YY_BREAK -case 64: -/* rule 64 can match eol */ +case 61: +/* rule 61 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; @@ -3201,14 +2903,14 @@ YY_RULE_SETUP return T_HELPTEXT; } YY_BREAK -case 65: -/* rule 65 can match eol */ +case 62: +/* rule 62 can match eol */ YY_RULE_SETUP { append_string("\n", 1); } YY_BREAK -case 66: +case 63: YY_RULE_SETUP { while (yyleng) { @@ -3245,7 +2947,7 @@ case YY_STATE_EOF(ASSIGN_VAL): yyterminate(); } YY_BREAK -case 67: +case 64: YY_RULE_SETUP YY_FATAL_ERROR( "flex scanner jammed" ); YY_BREAK diff --git a/scripts/config/lkc.h b/scripts/config/lkc.h index 64213b692..a7b18b227 100644 --- a/scripts/config/lkc.h +++ b/scripts/config/lkc.h @@ -6,6 +6,10 @@ #ifndef LKC_H #define LKC_H +#include +#include +#include + #include "expr.h" #ifdef __cplusplus @@ -16,10 +20,6 @@ extern "C" { #define SRCTREE "srctree" -#ifndef PACKAGE -#define PACKAGE "linux" -#endif - #ifndef CONFIG_ #define CONFIG_ "CONFIG_" #endif @@ -30,16 +30,6 @@ static inline const char *CONFIG_prefix(void) #undef CONFIG_ #define CONFIG_ CONFIG_prefix() -enum conf_def_mode { - def_default, - def_yes, - def_mod, - def_y2m, - def_m2y, - def_no, - def_random -}; - extern int yylineno; void zconfdump(FILE *out); void zconf_starthelp(void); @@ -52,10 +42,6 @@ extern int recursive_is_error; /* confdata.c */ const char *conf_get_configname(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 conf_rewrite_mod_or_yes(enum conf_def_mode mode); void set_all_choice_values(struct symbol *csym); /* confdata.c and expr.c */ @@ -67,24 +53,6 @@ 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_prop(enum prop_type type, struct expr *expr, 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_modules(void); -void menu_add_option_defconfig_list(void); -void menu_add_option_allnoconfig_y(void); -void menu_finalize(struct menu *parent); -void menu_set_type(int type); - /* util.c */ struct file *file_lookup(const char *name); void *xmalloc(size_t size); @@ -111,6 +79,34 @@ 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); +/* 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_prop(enum prop_type type, struct expr *expr, 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(struct menu *parent); +void menu_set_type(int type); + +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); + /* symbol.c */ void sym_clear_all_valid(void); struct symbol *sym_choice_default(struct symbol *sym); diff --git a/scripts/config/lkc_proto.h b/scripts/config/lkc_proto.h index 386b10f98..ebedd230b 100644 --- a/scripts/config/lkc_proto.h +++ b/scripts/config/lkc_proto.h @@ -9,24 +9,11 @@ void conf_reset(int def); int conf_write_defconfig(const char *name); int conf_write(const char *name); 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 *s)); -/* 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); - /* symbol.c */ extern struct symbol * symbol_hash[SYMBOL_HASHSIZE]; diff --git a/scripts/config/lxdialog/util.c b/scripts/config/lxdialog/util.c index 0de2b0535..f2bfc5cfe 100644 --- a/scripts/config/lxdialog/util.c +++ b/scripts/config/lxdialog/util.c @@ -363,7 +363,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) @@ -541,7 +541,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/scripts/config/mconf-cfg.sh b/scripts/config/mconf-cfg.sh index 0244b90b3..357236928 100755 --- a/scripts/config/mconf-cfg.sh +++ b/scripts/config/mconf-cfg.sh @@ -33,7 +33,9 @@ if [ -f /usr/include/ncurses/ncurses.h ]; then exit 0 fi -if [ -f /usr/include/ncurses.h ]; then +# 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 cflags=\"-D_GNU_SOURCE\" echo libs=\"-lncurses\" exit 0 diff --git a/scripts/config/mconf.c b/scripts/config/mconf.c index 69eb3083c..81d232b66 100644 --- a/scripts/config/mconf.c +++ b/scripts/config/mconf.c @@ -22,6 +22,8 @@ #include "lkc.h" #include "lxdialog/dialog.h" +#define JUMP_NB 9 + static const char mconf_readme[] = "OpenWrt config is based on Kernel kconfig\n" "so ipkg packages are referred here as modules.\n" @@ -300,17 +302,12 @@ 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 { @@ -921,7 +918,7 @@ 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); diff --git a/scripts/config/menu.c b/scripts/config/menu.c index 9bb5fe158..22fd26a9f 100644 --- a/scripts/config/menu.c +++ b/scripts/config/menu.c @@ -9,6 +9,7 @@ #include #include "lkc.h" +#include "internal.h" static const char nohelp_text[] = "There is no help available for this option."; @@ -65,7 +66,8 @@ void menu_add_entry(struct symbol *sym) 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) @@ -210,28 +212,6 @@ void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep) menu_add_prop(type, expr_alloc_symbol(sym), dep); } -void menu_add_option_modules(void) -{ - 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; -} - -void menu_add_option_defconfig_list(void) -{ - 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_NO_WRITE; -} - -void menu_add_option_allnoconfig_y(void) -{ - current_entry->sym->flags |= SYMBOL_ALLNOCONFIG_Y; -} - static int menu_validate_number(struct symbol *sym, struct symbol *sym2) { return sym2->type == S_INT || sym2->type == S_HEX || diff --git a/scripts/config/nconf.c b/scripts/config/nconf.c index 66c823449..b75cabe01 100644 --- a/scripts/config/nconf.c +++ b/scripts/config/nconf.c @@ -271,7 +271,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; @@ -373,18 +373,18 @@ 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 */ @@ -499,16 +499,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) @@ -630,19 +634,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. @@ -758,7 +755,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", @@ -960,16 +956,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); @@ -1072,7 +1067,6 @@ static int do_match(int key, struct match_state *state, int *ans) static void conf(struct menu *menu) { struct menu *submenu = NULL; - const char *prompt = menu_get_prompt(menu); struct symbol *sym; int res; int current_index = 0; @@ -1090,9 +1084,8 @@ static void conf(struct menu *menu) if (!child_count) break; - show_menu(prompt ? prompt : "Main Menu", - menu_instructions, - current_index, &last_top_row); + 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) { @@ -1418,7 +1411,7 @@ 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); @@ -1537,9 +1530,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(); diff --git a/scripts/config/nconf.gui.c b/scripts/config/nconf.gui.c index cd7249b31..c72d61a77 100644 --- a/scripts/config/nconf.gui.c +++ b/scripts/config/nconf.gui.c @@ -7,169 +7,120 @@ #include "nconf.h" #include "lkc.h" -/* a list of all the different widgets we use */ -attributes_t attributes[ATTR_MAX+1] = {0}; +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; -/* 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); +#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 - /* 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); +struct nconf_attr_param { + int *attr; + bool has_color; + int color_fg; + int color_bg; + int highlight; +}; - init_pair(SCROLLWIN_TEXT, -1, -1); - init_pair(SCROLLWIN_HEADING, COLOR_GREEN, -1); - init_pair(SCROLLWIN_BOX, COLOR_YELLOW, -1); +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 */ } +}; - 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); -} +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) @@ -294,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); @@ -405,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, " "); @@ -576,7 +527,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,9 +542,9 @@ 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); @@ -604,10 +555,9 @@ void show_scroll_win(WINDOW *main_window, 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); diff --git a/scripts/config/nconf.h b/scripts/config/nconf.h index eab138b30..6e127c63d 100644 --- a/scripts/config/nconf.h +++ b/scripts/config/nconf.h @@ -32,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, @@ -72,12 +68,7 @@ typedef enum { void set_colors(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); diff --git a/scripts/config/parser.tab.c b/scripts/config/parser.tab.c index 1b291145a..18137050a 100644 --- a/scripts/config/parser.tab.c +++ b/scripts/config/parser.tab.c @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.1. */ +/* A Bison parser, made by GNU Bison 3.7.6. */ /* Bison implementation for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc. + 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 @@ -15,7 +16,7 @@ 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 . */ + 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 @@ -33,6 +34,10 @@ /* 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. @@ -40,11 +45,11 @@ define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ -/* Identify Bison output. */ -#define YYBISON 1 +/* Identify Bison output, and Bison version. */ +#define YYBISON 30706 -/* Bison version. */ -#define YYBISON_VERSION "3.1" +/* Bison version string. */ +#define YYBISON_VERSION "3.7.6" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" @@ -61,8 +66,7 @@ -/* Copy the first part of user declarations. */ - +/* First part of user prologue. */ #include @@ -73,6 +77,7 @@ #include #include "lkc.h" +#include "internal.h" #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) @@ -89,128 +94,137 @@ static bool zconf_endtoken(const char *tokenname, struct symbol *symbol_hash[SYMBOL_HASHSIZE]; -static struct menu *current_menu, *current_entry; +struct menu *current_menu, *current_entry; - -# ifndef YY_NULLPTR -# if defined __cplusplus && 201103L <= __cplusplus -# define YY_NULLPTR nullptr +# 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_NULLPTR 0 +# 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 -/* Enabling verbose error messages. */ -#ifdef YYERROR_VERBOSE -# undef YYERROR_VERBOSE -# define YYERROR_VERBOSE 1 -#else -# define YYERROR_VERBOSE 0 -#endif - -/* In a future release of Bison, this section will be replaced - by #include "parser.tab.h". */ -#ifndef YY_YY_PARSER_TAB_H_INCLUDED -# define YY_YY_PARSER_TAB_H_INCLUDED -/* Debug traces. */ -#ifndef YYDEBUG -# define YYDEBUG 0 -#endif -#if YYDEBUG -extern int yydebug; -#endif - -/* Token type. */ -#ifndef YYTOKENTYPE -# define YYTOKENTYPE - enum yytokentype - { - T_HELPTEXT = 258, - T_WORD = 259, - T_WORD_QUOTE = 260, - T_ALLNOCONFIG_Y = 261, - T_BOOL = 262, - T_CHOICE = 263, - T_CLOSE_PAREN = 264, - T_COLON_EQUAL = 265, - T_COMMENT = 266, - T_CONFIG = 267, - T_DEFAULT = 268, - T_DEFCONFIG_LIST = 269, - T_DEF_BOOL = 270, - T_DEF_TRISTATE = 271, - T_DEPENDS = 272, - T_ENDCHOICE = 273, - T_ENDIF = 274, - T_ENDMENU = 275, - T_HELP = 276, - T_HEX = 277, - T_IF = 278, - T_IMPLY = 279, - T_INT = 280, - T_MAINMENU = 281, - T_MENU = 282, - T_MENUCONFIG = 283, - T_MODULES = 284, - T_ON = 285, - T_OPEN_PAREN = 286, - T_OPTION = 287, - T_OPTIONAL = 288, - T_PLUS_EQUAL = 289, - T_PROMPT = 290, - T_RANGE = 291, - T_RESET = 292, - T_SELECT = 293, - T_SOURCE = 294, - T_STRING = 295, - T_TRISTATE = 296, - T_VISIBLE = 297, - T_EOL = 298, - T_ASSIGN_VAL = 299, - T_OR = 300, - T_AND = 301, - T_EQUAL = 302, - T_UNEQUAL = 303, - T_LESS = 304, - T_LESS_EQUAL = 305, - T_GREATER = 306, - T_GREATER_EQUAL = 307, - T_NOT = 308 - }; -#endif - -/* Value type. */ -#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED - -union YYSTYPE +#include "parser.tab.h" +/* Symbol kind. */ +enum yysymbol_kind_t { - - - char *string; - struct symbol *symbol; - struct expr *expr; - struct menu *menu; - enum symbol_type type; - enum variable_flavor flavor; - - + 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_RESET = 34, /* T_RESET */ + YYSYMBOL_T_SELECT = 35, /* T_SELECT */ + YYSYMBOL_T_SOURCE = 36, /* T_SOURCE */ + YYSYMBOL_T_STRING = 37, /* T_STRING */ + YYSYMBOL_T_TRISTATE = 38, /* T_TRISTATE */ + YYSYMBOL_T_VISIBLE = 39, /* T_VISIBLE */ + YYSYMBOL_T_EOL = 40, /* T_EOL */ + YYSYMBOL_T_ASSIGN_VAL = 41, /* T_ASSIGN_VAL */ + YYSYMBOL_T_OR = 42, /* T_OR */ + YYSYMBOL_T_AND = 43, /* T_AND */ + YYSYMBOL_T_EQUAL = 44, /* T_EQUAL */ + YYSYMBOL_T_UNEQUAL = 45, /* T_UNEQUAL */ + YYSYMBOL_T_LESS = 46, /* T_LESS */ + YYSYMBOL_T_LESS_EQUAL = 47, /* T_LESS_EQUAL */ + YYSYMBOL_T_GREATER = 48, /* T_GREATER */ + YYSYMBOL_T_GREATER_EQUAL = 49, /* T_GREATER_EQUAL */ + YYSYMBOL_T_NOT = 50, /* T_NOT */ + YYSYMBOL_YYACCEPT = 51, /* $accept */ + YYSYMBOL_input = 52, /* input */ + YYSYMBOL_mainmenu_stmt = 53, /* mainmenu_stmt */ + YYSYMBOL_stmt_list = 54, /* stmt_list */ + YYSYMBOL_stmt_list_in_choice = 55, /* stmt_list_in_choice */ + YYSYMBOL_config_entry_start = 56, /* config_entry_start */ + YYSYMBOL_config_stmt = 57, /* config_stmt */ + YYSYMBOL_menuconfig_entry_start = 58, /* menuconfig_entry_start */ + YYSYMBOL_menuconfig_stmt = 59, /* menuconfig_stmt */ + YYSYMBOL_config_option_list = 60, /* config_option_list */ + YYSYMBOL_config_option = 61, /* config_option */ + YYSYMBOL_choice = 62, /* choice */ + YYSYMBOL_choice_entry = 63, /* choice_entry */ + YYSYMBOL_choice_end = 64, /* choice_end */ + YYSYMBOL_choice_stmt = 65, /* choice_stmt */ + YYSYMBOL_choice_option_list = 66, /* choice_option_list */ + YYSYMBOL_choice_option = 67, /* choice_option */ + YYSYMBOL_type = 68, /* type */ + YYSYMBOL_logic_type = 69, /* logic_type */ + YYSYMBOL_default = 70, /* default */ + YYSYMBOL_if_entry = 71, /* if_entry */ + YYSYMBOL_if_end = 72, /* if_end */ + YYSYMBOL_if_stmt = 73, /* if_stmt */ + YYSYMBOL_if_stmt_in_choice = 74, /* if_stmt_in_choice */ + YYSYMBOL_menu = 75, /* menu */ + YYSYMBOL_menu_entry = 76, /* menu_entry */ + YYSYMBOL_menu_end = 77, /* menu_end */ + YYSYMBOL_menu_stmt = 78, /* menu_stmt */ + YYSYMBOL_menu_option_list = 79, /* menu_option_list */ + YYSYMBOL_source_stmt = 80, /* source_stmt */ + YYSYMBOL_comment = 81, /* comment */ + YYSYMBOL_comment_stmt = 82, /* comment_stmt */ + YYSYMBOL_comment_option_list = 83, /* comment_option_list */ + YYSYMBOL_help_start = 84, /* help_start */ + YYSYMBOL_help = 85, /* help */ + YYSYMBOL_depends = 86, /* depends */ + YYSYMBOL_visible = 87, /* visible */ + YYSYMBOL_prompt_stmt_opt = 88, /* prompt_stmt_opt */ + YYSYMBOL_end = 89, /* end */ + YYSYMBOL_if_expr = 90, /* if_expr */ + YYSYMBOL_expr = 91, /* expr */ + YYSYMBOL_nonconst_symbol = 92, /* nonconst_symbol */ + YYSYMBOL_symbol = 93, /* symbol */ + YYSYMBOL_word_opt = 94, /* word_opt */ + YYSYMBOL_assignment_stmt = 95, /* assignment_stmt */ + YYSYMBOL_assign_op = 96, /* assign_op */ + YYSYMBOL_assign_val = 97 /* assign_val */ }; +typedef enum yysymbol_kind_t yysymbol_kind_t; -typedef union YYSTYPE YYSTYPE; -# define YYSTYPE_IS_TRIVIAL 1 -# define YYSTYPE_IS_DECLARED 1 -#endif - - -extern YYSTYPE yylval; - -int yyparse (void); - -#endif /* !YY_YY_PARSER_TAB_H_INCLUDED */ - -/* Copy the second part of user declarations. */ @@ -218,36 +232,95 @@ int yyparse (void); # undef short #endif -#ifdef YYTYPE_UINT8 -typedef YYTYPE_UINT8 yytype_uint8; -#else -typedef unsigned char yytype_uint8; +/* 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 -#ifdef YYTYPE_INT8 -typedef YYTYPE_INT8 yytype_int8; +/* 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 YYTYPE_UINT16 -typedef YYTYPE_UINT16 yytype_uint16; -#else -typedef unsigned short yytype_uint16; -#endif - -#ifdef YYTYPE_INT16 -typedef YYTYPE_INT16 yytype_int16; +#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 YYSIZE_T +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else @@ -255,7 +328,20 @@ typedef short yytype_int16; # endif #endif -#define YYSIZE_MAXIMUM ((YYSIZE_T) -1) +#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 @@ -269,47 +355,37 @@ typedef short yytype_int16; # 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) + +#ifndef YY_ATTRIBUTE_PURE +# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__)) # else -# define YY_ATTRIBUTE(Spec) /* empty */ +# define YY_ATTRIBUTE_PURE # 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) +# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__) +# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) # else -# define _Noreturn YY_ATTRIBUTE ((__noreturn__)) +# define YY_ATTRIBUTE_UNUSED # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ -# define YYUSE(E) ((void) (E)) +# define YY_USE(E) ((void) (E)) #else -# define YYUSE(E) /* empty */ +# define YY_USE(E) /* empty */ #endif #if defined __GNUC__ && ! defined __ICC && 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\"")\ +# 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 \ +# define YY_IGNORE_MAYBE_UNINITIALIZED_END \ _Pragma ("GCC diagnostic pop") #else # define YY_INITIAL_VALUE(Value) Value @@ -322,8 +398,22 @@ typedef short yytype_int16; # 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 -#if ! defined yyoverflow || YYERROR_VERBOSE + +#define YY_ASSERT(E) ((void) (0 && (E))) + +#if !defined yyoverflow /* The parser invokes alloca or malloc; define the necessary symbols. */ @@ -388,8 +478,7 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif -#endif /* ! defined yyoverflow || YYERROR_VERBOSE */ - +#endif /* !defined yyoverflow */ #if (! defined yyoverflow \ && (! defined __cplusplus \ @@ -398,17 +487,17 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ /* A type that is properly aligned for any stack member. */ union yyalloc { - yytype_int16 yyss_alloc; + 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 (sizeof (union yyalloc) - 1) +# 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) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) # define YYCOPY_NEEDED 1 @@ -421,11 +510,11 @@ union yyalloc # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ do \ { \ - YYSIZE_T yynewbytes; \ + YYPTRDIFF_T yynewbytes; \ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ Stack = &yyptr->Stack_alloc; \ - yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ - yyptr += yynewbytes / sizeof (*yyptr); \ + yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \ + yyptr += yynewbytes / YYSIZEOF (*yyptr); \ } \ while (0) @@ -437,12 +526,12 @@ union yyalloc # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(Dst, Src, Count) \ - __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src))) + __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src))) # else # define YYCOPY(Dst, Src, Count) \ do \ { \ - YYSIZE_T yyi; \ + YYPTRDIFF_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (Dst)[yyi] = (Src)[yyi]; \ } \ @@ -457,25 +546,28 @@ union yyalloc #define YYLAST 194 /* YYNTOKENS -- Number of terminals. */ -#define YYNTOKENS 54 +#define YYNTOKENS 51 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 47 /* YYNRULES -- Number of rules. */ -#define YYNRULES 105 +#define YYNRULES 106 /* YYNSTATES -- Number of states. */ #define YYNSTATES 187 -/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned - by yylex, with out-of-bounds checking. */ -#define YYUNDEFTOK 2 -#define YYMAXUTOK 308 +/* YYMAXUTOK -- Last valid token kind. */ +#define YYMAXUTOK 305 -#define YYTRANSLATE(YYX) \ - ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) + +/* 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, without out-of-bounds checking. */ -static const yytype_uint8 yytranslate[] = + 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, @@ -507,149 +599,161 @@ static const yytype_uint8 yytranslate[] = 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, 50, 51, 52, 53 + 45, 46, 47, 48, 49, 50 }; #if YYDEBUG /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ -static const yytype_uint16 yyrline[] = +static const yytype_int16 yyrline[] = { - 0, 112, 112, 112, 116, 121, 123, 124, 125, 126, - 127, 131, 132, 133, 134, 135, 136, 141, 148, 153, - 160, 169, 171, 172, 173, 176, 184, 190, 200, 206, - 212, 218, 223, 228, 235, 245, 250, 258, 261, 263, - 264, 265, 268, 274, 281, 287, 292, 300, 301, 302, - 303, 306, 307, 310, 311, 312, 314, 316, 321, 329, - 337, 342, 349, 354, 362, 365, 367, 368, 371, 380, - 387, 390, 392, 397, 403, 415, 422, 429, 431, 436, - 437, 438, 441, 442, 445, 446, 447, 448, 449, 450, - 451, 452, 453, 454, 455, 459, 461, 462, 465, 466, - 470, 473, 474, 475, 479, 480 + 0, 110, 110, 110, 114, 119, 121, 122, 123, 124, + 125, 126, 127, 128, 129, 130, 133, 135, 136, 137, + 138, 143, 150, 155, 162, 171, 173, 174, 175, 178, + 186, 192, 202, 208, 214, 220, 230, 240, 245, 253, + 256, 258, 259, 260, 263, 269, 276, 282, 287, 295, + 296, 297, 298, 301, 302, 305, 306, 307, 311, 319, + 327, 330, 335, 342, 347, 355, 358, 360, 361, 364, + 373, 380, 383, 385, 390, 396, 408, 415, 422, 424, + 429, 430, 431, 434, 435, 438, 439, 440, 441, 442, + 443, 444, 445, 446, 447, 448, 452, 454, 455, 458, + 459, 463, 466, 467, 468, 472, 473 }; #endif -#if YYDEBUG || YYERROR_VERBOSE || 0 +/** 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", "error", "$undefined", "T_HELPTEXT", "T_WORD", "T_WORD_QUOTE", - "T_ALLNOCONFIG_Y", "T_BOOL", "T_CHOICE", "T_CLOSE_PAREN", - "T_COLON_EQUAL", "T_COMMENT", "T_CONFIG", "T_DEFAULT", - "T_DEFCONFIG_LIST", "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_OPTION", "T_OPTIONAL", "T_PLUS_EQUAL", + "\"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_RESET", "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", + "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", - "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", + "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", "nonconst_symbol", "symbol", "word_opt", "assignment_stmt", "assign_op", "assign_val", YY_NULLPTR }; + +static const char * +yysymbol_name (yysymbol_kind_t yysymbol) +{ + return yytname[yysymbol]; +} #endif -# ifdef YYPRINT +#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[] = +static const yytype_int16 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, 296, 297, 298, 299, 300, 301, 302, 303, 304, - 305, 306, 307, 308 + 305 }; -# endif +#endif -#define YYPACT_NINF -107 +#define YYPACT_NINF (-105) -#define yypact_value_is_default(Yystate) \ - (!!((Yystate) == (-107))) +#define yypact_value_is_default(Yyn) \ + ((Yyn) == YYPACT_NINF) -#define YYTABLE_NINF -4 +#define YYTABLE_NINF (-4) -#define yytable_value_is_error(Yytable_value) \ +#define yytable_value_is_error(Yyn) \ 0 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ static const yytype_int16 yypact[] = { - -6, 24, 33, -107, 65, -7, -107, 71, -4, 12, - 49, 53, 63, -1, 69, 63, 76, -107, -107, -107, - -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, - -107, -107, -107, -107, -107, -107, 25, -107, -107, -107, - 26, -107, 46, 47, -107, 54, -107, -1, -1, -22, - -107, 142, 58, 60, 68, 134, 134, 147, 114, 101, - 2, 101, 67, -107, -107, 72, -107, -107, -107, 5, - -107, -107, -1, -1, 44, 44, 44, 44, 44, 44, - -107, -107, -107, -107, -107, -107, -107, 66, 73, -107, - 63, -107, 94, 109, 44, 63, -107, -107, -107, 112, - -107, -1, 103, -107, -107, 63, 79, 122, 107, -107, - 112, -107, -107, 8, 88, 92, 93, -107, -107, -107, - -107, -107, 107, -107, -107, -107, -107, -107, -107, -107, - 97, -107, -107, -107, -107, -107, -107, -107, -1, -107, - 107, 95, 96, 102, 107, 44, 107, 107, 105, 41, - -107, 107, -107, 107, -1, 118, 119, -107, -107, -107, - 120, 17, 124, -107, -107, -107, 128, 107, 130, -107, - -107, 133, 135, 136, 11, -107, -107, -107, -107, -107, - -107, 138, -107, -107, -107, -107, -107 + -5, 17, 37, -105, 57, 8, -105, 91, 39, 15, + 46, 72, 80, 10, 82, 80, 83, -105, -105, -105, + -105, -105, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -105, -105, -105, -105, 45, -105, -105, -105, 48, + -105, 50, 59, -105, 60, -105, 10, 10, -7, -105, + 25, 63, 64, 65, 132, 132, 156, 162, 114, 14, + 114, 95, -105, -105, 71, -105, -105, -105, 9, -105, + -105, 10, 10, 27, 27, 27, 27, 27, 27, -105, + -105, -105, -105, -105, -105, -105, 69, 73, -105, 80, + -105, 74, 115, 27, 80, -105, -105, -105, 117, -105, + 10, 116, -105, -105, 80, 86, 118, 107, -105, 117, + -105, -105, 89, 93, 94, 96, -105, -105, -105, -105, + -105, -105, -105, -105, 107, -105, -105, -105, -105, -105, + -105, -105, 98, -105, -105, -105, -105, -105, -105, -105, + 10, -105, 107, -105, 107, 27, 107, 107, 97, 13, + -105, 107, -105, 107, 10, 102, 103, -105, -105, -105, + -105, 162, 108, 23, 109, 113, 107, 120, -105, -105, + 121, 126, 134, 33, -105, -105, -105, -105, -105, -105, + -105, 136, -105, -105, -105, -105, -105 }; /* 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[] = +static const yytype_int8 yydefact[] = { 5, 0, 0, 5, 0, 0, 1, 0, 0, 0, - 98, 0, 0, 0, 0, 0, 0, 6, 21, 13, - 21, 14, 38, 56, 7, 5, 11, 65, 5, 8, - 15, 71, 12, 16, 4, 10, 0, 102, 103, 101, - 104, 99, 0, 0, 95, 0, 97, 0, 0, 0, - 96, 84, 0, 0, 0, 18, 20, 35, 0, 0, - 62, 0, 70, 9, 105, 0, 34, 69, 17, 0, - 92, 58, 0, 0, 0, 0, 0, 0, 0, 0, - 61, 19, 68, 51, 53, 54, 55, 0, 0, 49, - 0, 48, 0, 0, 0, 0, 50, 52, 22, 77, - 47, 0, 0, 24, 23, 0, 0, 0, 82, 39, - 77, 41, 40, 0, 0, 0, 0, 57, 37, 36, - 60, 59, 82, 67, 66, 64, 63, 72, 100, 91, - 93, 94, 89, 90, 85, 86, 87, 88, 0, 73, - 82, 0, 0, 0, 82, 0, 82, 82, 0, 82, - 74, 82, 44, 82, 0, 0, 0, 80, 81, 79, - 0, 0, 0, 33, 32, 31, 0, 82, 0, 78, - 25, 0, 0, 0, 83, 45, 43, 76, 75, 29, - 26, 0, 28, 27, 46, 42, 30 + 99, 0, 0, 0, 0, 0, 0, 25, 9, 25, + 12, 40, 16, 7, 5, 10, 66, 5, 11, 13, + 72, 8, 6, 4, 15, 0, 103, 104, 102, 105, + 100, 0, 0, 96, 0, 98, 0, 0, 0, 97, + 85, 0, 0, 0, 22, 24, 37, 0, 0, 63, + 0, 71, 14, 106, 0, 36, 70, 21, 0, 93, + 58, 0, 0, 0, 0, 0, 0, 0, 0, 62, + 23, 69, 53, 55, 56, 57, 0, 0, 51, 0, + 50, 0, 0, 0, 0, 52, 54, 26, 78, 49, + 0, 0, 28, 27, 0, 0, 0, 83, 41, 78, + 43, 42, 0, 0, 0, 0, 18, 39, 16, 19, + 17, 38, 60, 59, 83, 68, 67, 65, 64, 73, + 101, 92, 94, 95, 90, 91, 86, 87, 88, 89, + 0, 74, 83, 35, 83, 0, 83, 83, 0, 83, + 75, 83, 46, 83, 0, 0, 0, 20, 81, 82, + 80, 0, 0, 0, 0, 0, 83, 0, 79, 29, + 0, 0, 0, 84, 47, 45, 61, 77, 76, 33, + 30, 0, 32, 31, 48, 44, 34 }; /* YYPGOTO[NTERM-NUM]. */ -static const yytype_int8 yypgoto[] = +static const yytype_int16 yypgoto[] = { - -107, -107, -107, 3, 86, -107, -107, -107, -107, 126, - -107, -107, -107, -107, -107, -107, -107, -107, 100, -107, - -107, -107, -107, -107, -107, -107, -107, -107, -107, -107, - -107, -107, -107, -107, 108, -25, -107, 42, -44, -106, - -47, -10, -67, -107, -107, -107, -107 + -105, -105, -105, 3, 38, -105, -55, -105, -105, 138, + -105, -105, -105, -105, -105, -105, -105, -105, 125, -105, + -54, -3, -105, -105, -105, -105, -105, -105, -105, -105, + -105, -52, -105, -105, 128, -38, -105, 68, -16, -104, + -46, -8, -65, -105, -105, -105, -105 }; /* YYDEFGOTO[NTERM-NUM]. */ -static const yytype_int16 yydefgoto[] = +static const yytype_uint8 yydefgoto[] = { - -1, 2, 3, 4, 17, 18, 19, 20, 21, 55, - 98, 22, 23, 118, 24, 57, 109, 99, 100, 101, - 58, 25, 120, 26, 27, 28, 125, 29, 60, 30, - 31, 32, 62, 102, 103, 104, 124, 148, 119, 155, - 49, 50, 51, 42, 33, 40, 65 + 0, 2, 3, 4, 57, 17, 18, 19, 20, 54, + 97, 21, 22, 117, 23, 56, 108, 98, 99, 100, + 24, 122, 25, 119, 26, 27, 127, 28, 59, 29, + 30, 31, 61, 101, 102, 103, 126, 148, 123, 155, + 48, 49, 50, 41, 32, 39, 64 }; /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If @@ -657,114 +761,114 @@ static const yytype_int16 yydefgoto[] = number is the opposite. If YYTABLE_NINF, syntax error. */ static const yytype_int16 yytable[] = { - 69, 70, 45, 44, 46, 53, 7, 132, 133, 134, - 135, 136, 137, 36, 129, 121, 160, 126, 37, 87, - 1, 71, 37, 72, 73, 130, 131, 145, 59, 5, - 47, 61, 112, 6, 162, 123, 34, 127, 166, 35, - 168, 169, 38, 171, 122, 172, 38, 173, 44, 46, - 72, 73, 48, 41, 149, 39, 72, 73, 43, 39, - 178, 181, 72, 73, 154, -3, 8, 44, 63, 9, - 64, -2, 8, 10, 52, 9, 11, 12, 167, 10, - 140, 54, 11, 12, 87, 146, 72, 73, 13, 66, - 67, 161, 14, 15, 13, 151, 138, 68, 14, 15, - 141, 80, 8, 81, 16, 9, 150, 174, 142, 10, - 16, 82, 11, 12, 144, 128, 139, 147, 113, 114, - 115, 116, 152, 143, 13, 11, 12, 153, 14, 15, - 154, 157, 114, 115, 116, 158, 159, 13, 163, 164, - 16, 83, 15, 73, 117, 165, 56, 84, 170, 85, - 86, 87, 156, 16, 83, 88, 89, 110, 90, 91, - 105, 175, 176, 177, 87, 111, 92, 179, 88, 93, - 94, 180, 95, 182, 96, 97, 183, 0, 184, 185, - 106, 186, 107, 0, 108, 0, 0, 0, 97, 74, - 75, 76, 77, 78, 79 + 68, 69, 116, 118, 44, 120, 7, 52, 134, 135, + 136, 137, 138, 139, 43, 45, 35, 131, 111, 1, + 162, 125, 5, 129, 36, 132, 133, 58, 145, 86, + 60, 43, 45, 70, 154, 71, 72, 6, 164, 46, + 165, 121, 167, 168, 128, 170, 37, 171, 33, 172, + 40, 71, 72, 124, 149, 71, 72, -3, 8, 38, + 47, 9, 181, 178, 10, 71, 72, 11, 12, 73, + 74, 75, 76, 77, 78, 71, 72, 42, 13, 34, + 166, 142, 14, 15, 43, 62, 146, 51, 53, 63, + 65, -2, 8, 16, 163, 9, 151, 140, 10, 66, + 67, 11, 12, 79, 80, 81, 116, 118, 173, 120, + 86, 130, 13, 141, 143, 8, 14, 15, 9, 150, + 144, 10, 147, 153, 11, 12, 152, 16, 154, 157, + 113, 114, 115, 158, 159, 13, 160, 169, 82, 14, + 15, 72, 174, 175, 83, 84, 85, 86, 177, 179, + 16, 87, 88, 180, 89, 90, 161, 55, 176, 91, + 182, 183, 82, 112, 92, 93, 184, 94, 104, 95, + 96, 86, 11, 12, 185, 87, 186, 156, 113, 114, + 115, 109, 0, 13, 110, 0, 105, 0, 106, 0, + 107, 0, 0, 0, 96 }; static const yytype_int16 yycheck[] = { - 47, 48, 12, 4, 5, 15, 3, 74, 75, 76, - 77, 78, 79, 1, 9, 59, 122, 61, 10, 17, - 26, 43, 10, 45, 46, 72, 73, 94, 25, 5, - 31, 28, 57, 0, 140, 60, 43, 62, 144, 43, - 146, 147, 34, 149, 42, 151, 34, 153, 4, 5, - 45, 46, 53, 4, 101, 47, 45, 46, 5, 47, - 43, 167, 45, 46, 23, 0, 1, 4, 43, 4, - 44, 0, 1, 8, 5, 4, 11, 12, 145, 8, - 90, 5, 11, 12, 17, 95, 45, 46, 23, 43, - 43, 138, 27, 28, 23, 105, 30, 43, 27, 28, - 6, 43, 1, 43, 39, 4, 3, 154, 14, 8, - 39, 43, 11, 12, 5, 43, 43, 5, 4, 18, - 19, 20, 43, 29, 23, 11, 12, 5, 27, 28, - 23, 43, 18, 19, 20, 43, 43, 23, 43, 43, - 39, 7, 28, 46, 58, 43, 20, 13, 43, 15, - 16, 17, 110, 39, 7, 21, 22, 57, 24, 25, - 13, 43, 43, 43, 17, 57, 32, 43, 21, 35, - 36, 43, 38, 43, 40, 41, 43, -1, 43, 43, - 33, 43, 35, -1, 37, -1, -1, -1, 41, 47, - 48, 49, 50, 51, 52 + 46, 47, 57, 57, 12, 57, 3, 15, 73, 74, + 75, 76, 77, 78, 4, 5, 1, 8, 56, 24, + 124, 59, 5, 61, 9, 71, 72, 24, 93, 15, + 27, 4, 5, 40, 21, 42, 43, 0, 142, 29, + 144, 57, 146, 147, 60, 149, 31, 151, 40, 153, + 4, 42, 43, 39, 100, 42, 43, 0, 1, 44, + 50, 4, 166, 40, 7, 42, 43, 10, 11, 44, + 45, 46, 47, 48, 49, 42, 43, 5, 21, 40, + 145, 89, 25, 26, 4, 40, 94, 5, 5, 41, + 40, 0, 1, 36, 140, 4, 104, 28, 7, 40, + 40, 10, 11, 40, 40, 40, 161, 161, 154, 161, + 15, 40, 21, 40, 40, 1, 25, 26, 4, 3, + 5, 7, 5, 5, 10, 11, 40, 36, 21, 40, + 16, 17, 18, 40, 40, 21, 40, 40, 6, 25, + 26, 43, 40, 40, 12, 13, 14, 15, 40, 40, + 36, 19, 20, 40, 22, 23, 118, 19, 161, 27, + 40, 40, 6, 1, 32, 33, 40, 35, 12, 37, + 38, 15, 10, 11, 40, 19, 40, 109, 16, 17, + 18, 56, -1, 21, 56, -1, 30, -1, 32, -1, + 34, -1, -1, -1, 38 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ -static const yytype_uint8 yystos[] = +static const yytype_int8 yystos[] = { - 0, 26, 55, 56, 57, 5, 0, 57, 1, 4, - 8, 11, 12, 23, 27, 28, 39, 58, 59, 60, - 61, 62, 65, 66, 68, 75, 77, 78, 79, 81, - 83, 84, 85, 98, 43, 43, 1, 10, 34, 47, - 99, 4, 97, 5, 4, 95, 5, 31, 53, 94, - 95, 96, 5, 95, 5, 63, 63, 69, 74, 57, - 82, 57, 86, 43, 44, 100, 43, 43, 43, 94, - 94, 43, 45, 46, 47, 48, 49, 50, 51, 52, - 43, 43, 43, 7, 13, 15, 16, 17, 21, 22, - 24, 25, 32, 35, 36, 38, 40, 41, 64, 71, - 72, 73, 87, 88, 89, 13, 33, 35, 37, 70, - 72, 88, 89, 4, 18, 19, 20, 58, 67, 92, - 76, 92, 42, 89, 90, 80, 92, 89, 43, 9, - 94, 94, 96, 96, 96, 96, 96, 96, 30, 43, - 95, 6, 14, 29, 5, 96, 95, 5, 91, 94, - 3, 95, 43, 5, 23, 93, 91, 43, 43, 43, - 93, 94, 93, 43, 43, 43, 93, 96, 93, 93, - 43, 93, 93, 93, 94, 43, 43, 43, 43, 43, - 43, 93, 43, 43, 43, 43, 43 + 0, 24, 52, 53, 54, 5, 0, 54, 1, 4, + 7, 10, 11, 21, 25, 26, 36, 56, 57, 58, + 59, 62, 63, 65, 71, 73, 75, 76, 78, 80, + 81, 82, 95, 40, 40, 1, 9, 31, 44, 96, + 4, 94, 5, 4, 92, 5, 29, 50, 91, 92, + 93, 5, 92, 5, 60, 60, 66, 55, 54, 79, + 54, 83, 40, 41, 97, 40, 40, 40, 91, 91, + 40, 42, 43, 44, 45, 46, 47, 48, 49, 40, + 40, 40, 6, 12, 13, 14, 15, 19, 20, 22, + 23, 27, 32, 33, 35, 37, 38, 61, 68, 69, + 70, 84, 85, 86, 12, 30, 32, 34, 67, 69, + 85, 86, 1, 16, 17, 18, 57, 64, 71, 74, + 82, 89, 72, 89, 39, 86, 87, 77, 89, 86, + 40, 8, 91, 91, 93, 93, 93, 93, 93, 93, + 28, 40, 92, 40, 5, 93, 92, 5, 88, 91, + 3, 92, 40, 5, 21, 90, 88, 40, 40, 40, + 40, 55, 90, 91, 90, 90, 93, 90, 90, 40, + 90, 90, 90, 91, 40, 40, 72, 40, 40, 40, + 40, 90, 40, 40, 40, 40, 40 }; /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ -static const yytype_uint8 yyr1[] = +static const yytype_int8 yyr1[] = { - 0, 54, 55, 55, 56, 57, 57, 57, 57, 57, - 57, 58, 58, 58, 58, 58, 58, 59, 60, 61, - 62, 63, 63, 63, 63, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 65, 66, 67, 68, 69, 69, - 69, 69, 70, 70, 70, 70, 70, 71, 71, 71, - 71, 72, 72, 73, 73, 73, 74, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 82, 82, 83, 84, - 85, 86, 86, 87, 88, 89, 90, 91, 91, 92, - 92, 92, 93, 93, 94, 94, 94, 94, 94, 94, - 94, 94, 94, 94, 94, 95, 96, 96, 97, 97, - 98, 99, 99, 99, 100, 100 + 0, 51, 52, 52, 53, 54, 54, 54, 54, 54, + 54, 54, 54, 54, 54, 54, 55, 55, 55, 55, + 55, 56, 57, 58, 59, 60, 60, 60, 60, 61, + 61, 61, 61, 61, 61, 61, 62, 63, 64, 65, + 66, 66, 66, 66, 67, 67, 67, 67, 67, 68, + 68, 68, 68, 69, 69, 70, 70, 70, 71, 72, + 73, 74, 75, 76, 77, 78, 79, 79, 79, 80, + 81, 82, 83, 83, 84, 85, 86, 87, 88, 88, + 89, 89, 89, 90, 90, 91, 91, 91, 91, 91, + 91, 91, 91, 91, 91, 91, 92, 93, 93, 94, + 94, 95, 96, 96, 96, 97, 97 }; /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */ -static const yytype_uint8 yyr2[] = +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, 3, 3, 3, 3, 2, 1, 3, 0, 2, - 2, 2, 4, 3, 2, 3, 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, 0, 1, - 4, 1, 1, 1, 0, 1 + 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, 3, 2, 1, 3, + 0, 2, 2, 2, 4, 3, 2, 3, 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, 0, + 1, 4, 1, 1, 1, 0, 1 }; +enum { YYENOMEM = -2 }; + #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) -#define YYEMPTY (-2) -#define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab @@ -773,27 +877,26 @@ static const yytype_uint8 yyr2[] = #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 +#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. */ @@ -811,54 +914,58 @@ do { \ } while (0) /* This macro is provided for backward compatibility. */ -#ifndef YY_LOCATION_PRINT -# define YY_LOCATION_PRINT(File, Loc) ((void) 0) -#endif +# ifndef YY_LOCATION_PRINT +# define YY_LOCATION_PRINT(File, Loc) ((void) 0) +# endif -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ +# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ - Type, Value); \ + Kind, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (0) -/*----------------------------------------. -| Print this symbol's value on YYOUTPUT. | -`----------------------------------------*/ +/*-----------------------------------. +| Print this symbol's value on YYO. | +`-----------------------------------*/ static void -yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_value_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) { - FILE *yyo = yyoutput; - YYUSE (yyo); + FILE *yyoutput = yyo; + YY_USE (yyoutput); if (!yyvaluep) return; # ifdef YYPRINT - if (yytype < YYNTOKENS) - YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); + if (yykind < YYNTOKENS) + YYPRINT (yyo, yytoknum[yykind], *yyvaluep); # endif - YYUSE (yytype); + YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN + YY_USE (yykind); + YY_IGNORE_MAYBE_UNINITIALIZED_END } -/*--------------------------------. -| Print this symbol on YYOUTPUT. | -`--------------------------------*/ +/*---------------------------. +| Print this symbol on YYO. | +`---------------------------*/ static void -yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) +yy_symbol_print (FILE *yyo, + yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep) { - YYFPRINTF (yyoutput, "%s %s (", - yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]); + YYFPRINTF (yyo, "%s %s (", + yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind)); - yy_symbol_value_print (yyoutput, yytype, yyvaluep); - YYFPRINTF (yyoutput, ")"); + yy_symbol_value_print (yyo, yykind, yyvaluep); + YYFPRINTF (yyo, ")"); } /*------------------------------------------------------------------. @@ -867,7 +974,7 @@ yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) `------------------------------------------------------------------*/ static void -yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) +yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop) { YYFPRINTF (stderr, "Stack now"); for (; yybottom <= yytop; yybottom++) @@ -890,21 +997,21 @@ do { \ `------------------------------------------------*/ static void -yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule) +yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp, + int yyrule) { - unsigned long yylno = yyrline[yyrule]; + int yylno = yyrline[yyrule]; int yynrhs = yyr2[yyrule]; int yyi; - YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", + 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, - yystos[yyssp[yyi + 1 - yynrhs]], - &(yyvsp[(yyi + 1) - (yynrhs)]) - ); + YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]), + &yyvsp[(yyi + 1) - (yynrhs)]); YYFPRINTF (stderr, "\n"); } } @@ -919,8 +1026,8 @@ do { \ multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ -# define YYDPRINTF(Args) -# define YY_SYMBOL_PRINT(Title, Type, Value, Location) +# 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 */ @@ -943,278 +1050,53 @@ int yydebug; #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 - default: /* Avoid compiler warnings. */ - 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) +yydestruct (const char *yymsg, + yysymbol_kind_t yykind, YYSTYPE *yyvaluep) { - YYUSE (yyvaluep); + YY_USE (yyvaluep); if (!yymsg) yymsg = "Deleting"; - YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); + YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp); YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN - switch (yytype) + switch (yykind) { - case 66: /* choice_entry */ - - { + case YYSYMBOL_choice_entry: /* 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 75: /* if_entry */ - - { + case YYSYMBOL_if_entry: /* 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 79: /* menu_entry */ - - { + case YYSYMBOL_menu_entry: /* 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; } @@ -1222,9 +1104,7 @@ yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) } - - -/* The lookahead symbol. */ +/* Lookahead token kind. */ int yychar; /* The semantic value of the lookahead symbol. */ @@ -1233,6 +1113,8 @@ YYSTYPE yylval; int yynerrs; + + /*----------. | yyparse. | `----------*/ @@ -1240,43 +1122,36 @@ int yynerrs; int yyparse (void) { - int yystate; + yy_state_fast_t yystate = 0; /* Number of tokens to shift before error messages enabled. */ - int yyerrstatus; + int yyerrstatus = 0; - /* The stacks and their tools: - 'yyss': related to states. - 'yyvs': related to semantic values. - - Refer to the stacks through separate pointers, to allow yyoverflow + /* 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; + /* Their size. */ + YYPTRDIFF_T yystacksize = YYINITDEPTH; - /* The semantic value stack. */ + /* 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; - YYSTYPE *yyvsp; - - YYSIZE_T yystacksize; + YYSTYPE *yyvs = yyvsa; + YYSTYPE *yyvsp = yyvs; int yyn; + /* The return value of yyparse. */ int yyresult; - /* Lookahead token as an internal (translated) token number. */ - int yytoken = 0; + /* Lookahead symbol kind. */ + yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY; /* 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)) @@ -1284,58 +1159,60 @@ yyparse (void) 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 -- push a new state, which is found in yystate. | `------------------------------------------------------------*/ - yynewstate: +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; + +/*--------------------------------------------------------------------. +| 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 + goto yyexhaustedlab; +#else { /* Get the current used size of the three stacks, in elements. */ - YYSIZE_T yysize = yyssp - yyss + 1; + YYPTRDIFF_T yysize = yyssp - yyss + 1; -#ifdef yyoverflow +# 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; - 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), + &yyss1, yysize * YYSIZEOF (*yyssp), + &yyvs1, yysize * YYSIZEOF (*yyvsp), &yystacksize); - yyss = yyss1; yyvs = yyvs1; } -#else /* no yyoverflow */ -# ifndef YYSTACK_RELOCATE - goto yyexhaustedlab; -# else +# else /* defined YYSTACK_RELOCATE */ /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; @@ -1344,9 +1221,10 @@ yyparse (void) yystacksize = YYMAXDEPTH; { - yytype_int16 *yyss1 = yyss; + yy_state_t *yyss1 = yyss; union yyalloc *yyptr = - (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); + YY_CAST (union yyalloc *, + YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize)))); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); @@ -1356,30 +1234,30 @@ yyparse (void) 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) yystacksize)); + 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; } - - YYDPRINTF ((stderr, "Entering state %d\n", yystate)); +#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. */ @@ -1390,18 +1268,29 @@ yybackup: /* Not known => get a lookahead token if don't already have one. */ - /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ + /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */ if (yychar == YYEMPTY) { - YYDPRINTF ((stderr, "Reading a token: ")); + YYDPRINTF ((stderr, "Reading a token\n")); yychar = yylex (); } if (yychar <= YYEOF) { - yychar = yytoken = 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); @@ -1429,15 +1318,13 @@ yybackup: /* 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 + /* Discard the shifted token. */ + yychar = YYEMPTY; goto yynewstate; @@ -1452,7 +1339,7 @@ yydefault: /*-----------------------------. -| yyreduce -- Do a reduction. | +| yyreduce -- do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ @@ -1472,89 +1359,74 @@ yyreduce: YY_REDUCE_PRINT (yyn); switch (yyn) { - case 4: - - { + case 4: /* mainmenu_stmt: T_MAINMENU T_WORD_QUOTE T_EOL */ +{ menu_add_prompt(P_MENU, (yyvsp[-1].string), NULL); } - break; - case 9: - - { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); } - + case 14: /* stmt_list: stmt_list T_WORD error T_EOL */ + { zconf_error("unknown statement \"%s\"", (yyvsp[-2].string)); } break; - case 10: - - { zconf_error("invalid statement"); } - + case 15: /* stmt_list: stmt_list error T_EOL */ + { zconf_error("invalid statement"); } break; - case 17: + 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 */ +{ (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 18: - - { + case 22: /* config_stmt: config_entry_start config_option_list */ +{ printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); } - break; - case 19: - - { + case 23: /* 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", zconf_curname(), zconf_lineno(), (yyvsp[-1].symbol)->name); } - break; - case 20: - - { + case 24: /* 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", zconf_curname(), zconf_lineno()); } - break; - case 25: - - { + case 29: /* config_option: type prompt_stmt_opt T_EOL */ +{ menu_set_type((yyvsp[-2].type)); printd(DEBUG_PARSE, "%s:%d:type(%u)\n", zconf_curname(), zconf_lineno(), (yyvsp[-2].type)); } - break; - case 26: - - { + case 30: /* 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", zconf_curname(), zconf_lineno()); } - break; - case 27: - - { + case 31: /* 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)); @@ -1562,63 +1434,40 @@ yyreduce: zconf_curname(), zconf_lineno(), (yyvsp[-3].type)); } - break; - case 28: - - { + case 32: /* 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", zconf_curname(), zconf_lineno()); } - break; - case 29: - - { + case 33: /* 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", zconf_curname(), zconf_lineno()); } - break; - case 30: - - { + case 34: /* 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", zconf_curname(), zconf_lineno()); } - break; - case 31: - - { - menu_add_option_modules(); + case 35: /* 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: - - { - menu_add_option_defconfig_list(); -} - - break; - - case 33: - - { - menu_add_option_allnoconfig_y(); -} - - break; - - case 34: - - { + case 36: /* choice: T_CHOICE word_opt T_EOL */ +{ struct symbol *sym = sym_lookup((yyvsp[-1].string), SYMBOL_CHOICE); sym->flags |= SYMBOL_NO_WRITE; menu_add_entry(sym); @@ -1626,205 +1475,157 @@ yyreduce: free((yyvsp[-1].string)); printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); } - break; - case 35: - - { + case 37: /* choice_entry: choice choice_option_list */ +{ (yyval.menu) = menu_add_menu(); } - break; - case 36: - - { + case 38: /* choice_end: end */ +{ if (zconf_endtoken((yyvsp[0].string), "choice")) { menu_end_menu(); printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno()); } } - break; - case 42: - - { + case 44: /* 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", zconf_curname(), zconf_lineno()); } - break; - case 43: - - { + case 45: /* choice_option: logic_type prompt_stmt_opt T_EOL */ +{ menu_set_type((yyvsp[-2].type)); printd(DEBUG_PARSE, "%s:%d:type(%u)\n", zconf_curname(), zconf_lineno(), (yyvsp[-2].type)); } - break; - case 44: - - { + case 46: /* choice_option: T_OPTIONAL T_EOL */ +{ current_entry->sym->flags |= SYMBOL_OPTIONAL; printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno()); } - break; - case 45: - - { + case 47: /* choice_option: T_RESET if_expr T_EOL */ +{ menu_add_prop(P_RESET, NULL, (yyvsp[-1].expr)); } - break; - case 46: - - { + case 48: /* 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", zconf_curname(), zconf_lineno()); } - break; - case 48: - - { (yyval.type) = S_INT; } - + case 50: /* type: T_INT */ + { (yyval.type) = S_INT; } break; - case 49: - - { (yyval.type) = S_HEX; } - + case 51: /* type: T_HEX */ + { (yyval.type) = S_HEX; } break; - case 50: - - { (yyval.type) = S_STRING; } - + case 52: /* type: T_STRING */ + { (yyval.type) = S_STRING; } break; - case 51: - - { (yyval.type) = S_BOOLEAN; } - + case 53: /* logic_type: T_BOOL */ + { (yyval.type) = S_BOOLEAN; } break; - case 52: - - { (yyval.type) = S_TRISTATE; } - + case 54: /* logic_type: T_TRISTATE */ + { (yyval.type) = S_TRISTATE; } break; - case 53: - - { (yyval.type) = S_UNKNOWN; } - + case 55: /* default: T_DEFAULT */ + { (yyval.type) = S_UNKNOWN; } break; - case 54: - - { (yyval.type) = S_BOOLEAN; } - + case 56: /* default: T_DEF_BOOL */ + { (yyval.type) = S_BOOLEAN; } break; - case 55: - - { (yyval.type) = S_TRISTATE; } - + case 57: /* default: T_DEF_TRISTATE */ + { (yyval.type) = S_TRISTATE; } break; - case 58: - - { + case 58: /* if_entry: T_IF expr T_EOL */ +{ 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 59: - - { + case 59: /* if_end: end */ +{ if (zconf_endtoken((yyvsp[0].string), "if")) { menu_end_menu(); printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno()); } } - break; - case 61: - - { + case 62: /* 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", zconf_curname(), zconf_lineno()); } - break; - case 62: - - { + case 63: /* menu_entry: menu menu_option_list */ +{ (yyval.menu) = menu_add_menu(); } - break; - case 63: - - { + case 64: /* menu_end: end */ +{ if (zconf_endtoken((yyvsp[0].string), "menu")) { menu_end_menu(); printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno()); } } - break; - case 68: - - { + case 69: /* source_stmt: T_SOURCE T_WORD_QUOTE T_EOL */ +{ 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 69: - - { + case 70: /* 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", zconf_curname(), zconf_lineno()); } - break; - case 73: - - { + case 74: /* help_start: T_HELP T_EOL */ +{ printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); zconf_starthelp(); } - break; - case 74: - - { + case 75: /* help: help_start T_HELPTEXT */ +{ /* 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", @@ -1832,176 +1633,121 @@ yyreduce: current_entry->help = (yyvsp[0].string); } - break; - case 75: - - { + case 76: /* depends: T_DEPENDS T_ON expr T_EOL */ +{ menu_add_dep((yyvsp[-1].expr)); printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); } - break; - case 76: - - { + case 77: /* visible: T_VISIBLE if_expr T_EOL */ +{ menu_add_visibility((yyvsp[-1].expr)); } - break; - case 78: - - { + case 79: /* prompt_stmt_opt: T_WORD_QUOTE if_expr */ +{ menu_add_prompt(P_PROMPT, (yyvsp[-1].string), (yyvsp[0].expr)); } - break; - case 79: - - { (yyval.string) = "menu"; } - + case 80: /* end: T_ENDMENU T_EOL */ + { (yyval.string) = "menu"; } break; - case 80: - - { (yyval.string) = "choice"; } - + case 81: /* end: T_ENDCHOICE T_EOL */ + { (yyval.string) = "choice"; } break; - case 81: - - { (yyval.string) = "if"; } - + case 82: /* end: T_ENDIF T_EOL */ + { (yyval.string) = "if"; } break; - case 82: - - { (yyval.expr) = NULL; } - + case 83: /* if_expr: %empty */ + { (yyval.expr) = NULL; } break; - case 83: - - { (yyval.expr) = (yyvsp[0].expr); } - + case 84: /* if_expr: T_IF expr */ + { (yyval.expr) = (yyvsp[0].expr); } break; - case 84: - - { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); } - + case 85: /* expr: symbol */ + { (yyval.expr) = expr_alloc_symbol((yyvsp[0].symbol)); } break; - case 85: - - { (yyval.expr) = expr_alloc_comp(E_LTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } - + case 86: /* expr: symbol T_LESS symbol */ + { (yyval.expr) = expr_alloc_comp(E_LTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } break; - case 86: - - { (yyval.expr) = expr_alloc_comp(E_LEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } - + case 87: /* expr: symbol T_LESS_EQUAL symbol */ + { (yyval.expr) = expr_alloc_comp(E_LEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } break; - case 87: - - { (yyval.expr) = expr_alloc_comp(E_GTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } - + case 88: /* expr: symbol T_GREATER symbol */ + { (yyval.expr) = expr_alloc_comp(E_GTH, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } break; - case 88: - - { (yyval.expr) = expr_alloc_comp(E_GEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } - + case 89: /* expr: symbol T_GREATER_EQUAL symbol */ + { (yyval.expr) = expr_alloc_comp(E_GEQ, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } break; - case 89: - - { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } - + case 90: /* expr: symbol T_EQUAL symbol */ + { (yyval.expr) = expr_alloc_comp(E_EQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } break; - case 90: - - { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } - + case 91: /* expr: symbol T_UNEQUAL symbol */ + { (yyval.expr) = expr_alloc_comp(E_UNEQUAL, (yyvsp[-2].symbol), (yyvsp[0].symbol)); } break; - case 91: - - { (yyval.expr) = (yyvsp[-1].expr); } - + case 92: /* expr: T_OPEN_PAREN expr T_CLOSE_PAREN */ + { (yyval.expr) = (yyvsp[-1].expr); } break; - case 92: - - { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); } - + case 93: /* expr: T_NOT expr */ + { (yyval.expr) = expr_alloc_one(E_NOT, (yyvsp[0].expr)); } break; - case 93: - - { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); } - + case 94: /* expr: expr T_OR expr */ + { (yyval.expr) = expr_alloc_two(E_OR, (yyvsp[-2].expr), (yyvsp[0].expr)); } break; - case 94: - - { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); } - + case 95: /* expr: expr T_AND expr */ + { (yyval.expr) = expr_alloc_two(E_AND, (yyvsp[-2].expr), (yyvsp[0].expr)); } break; - case 95: - - { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); } - + case 96: /* nonconst_symbol: T_WORD */ + { (yyval.symbol) = sym_lookup((yyvsp[0].string), 0); free((yyvsp[0].string)); } break; - case 97: - - { (yyval.symbol) = sym_lookup((yyvsp[0].string), SYMBOL_CONST); free((yyvsp[0].string)); } - + case 98: /* symbol: T_WORD_QUOTE */ + { (yyval.symbol) = sym_lookup((yyvsp[0].string), SYMBOL_CONST); free((yyvsp[0].string)); } break; - case 98: - - { (yyval.string) = NULL; } - + case 99: /* word_opt: %empty */ + { (yyval.string) = NULL; } break; - case 100: - - { variable_add((yyvsp[-3].string), (yyvsp[-1].string), (yyvsp[-2].flavor)); free((yyvsp[-3].string)); free((yyvsp[-1].string)); } - + case 101: /* 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 101: - - { (yyval.flavor) = VAR_RECURSIVE; } - + case 102: /* assign_op: T_EQUAL */ + { (yyval.flavor) = VAR_RECURSIVE; } break; - case 102: - - { (yyval.flavor) = VAR_SIMPLE; } - + case 103: /* assign_op: T_COLON_EQUAL */ + { (yyval.flavor) = VAR_SIMPLE; } break; - case 103: - - { (yyval.flavor) = VAR_APPEND; } - + case 104: /* assign_op: T_PLUS_EQUAL */ + { (yyval.flavor) = VAR_APPEND; } break; - case 104: - - { (yyval.string) = xstrdup(""); } - + case 105: /* assign_val: %empty */ + { (yyval.string) = xstrdup(""); } break; @@ -2019,25 +1765,23 @@ yyreduce: 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); + YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, 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]; + { + 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; @@ -2048,50 +1792,14 @@ yyreduce: 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); - + yytoken = yychar == YYEMPTY ? YYSYMBOL_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 @@ -2120,12 +1828,10 @@ yyerrlab: | 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; + /* Pacify compilers when the user code never invokes YYERROR and the + label yyerrorlab therefore never appears in user code. */ + if (0) + YYERROR; /* Do not reclaim the symbols of the rule whose action triggered this YYERROR. */ @@ -2142,13 +1848,14 @@ yyerrorlab: 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 += YYTERROR; - if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) + yyn += YYSYMBOL_YYerror; + if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror) { yyn = yytable[yyn]; if (0 < yyn) @@ -2162,7 +1869,7 @@ yyerrlab1: yydestruct ("Error: popping", - yystos[yystate], yyvsp); + YY_ACCESSING_SYMBOL (yystate), yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); @@ -2174,7 +1881,7 @@ yyerrlab1: /* Shift the error token. */ - YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); + YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp); yystate = yyn; goto yynewstate; @@ -2187,6 +1894,7 @@ yyacceptlab: yyresult = 0; goto yyreturn; + /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ @@ -2194,16 +1902,21 @@ yyabortlab: yyresult = 1; goto yyreturn; -#if !defined yyoverflow || YYERROR_VERBOSE + +#if !defined yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; - /* Fall through. */ + goto yyreturn; #endif + +/*-------------------------------------------------------. +| yyreturn -- parsing is finished, clean up and return. | +`-------------------------------------------------------*/ yyreturn: if (yychar != YYEMPTY) { @@ -2220,17 +1933,14 @@ yyreturn: while (yyssp != yyss) { yydestruct ("Cleanup: popping", - yystos[*yyssp], yyvsp); + YY_ACCESSING_SYMBOL (+*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; } @@ -2271,7 +1981,7 @@ void conf_parse(const char *name) } if (yynerrs) exit(1); - sym_set_change_count(1); + conf_set_changed(true); } static bool zconf_endtoken(const char *tokenname, @@ -2477,5 +2187,3 @@ void zconfdump(FILE *out) } } } - -#include "menu.c" diff --git a/scripts/config/parser.tab.h b/scripts/config/parser.tab.h index d26b8bdcc..aac457ce3 100644 --- a/scripts/config/parser.tab.h +++ b/scripts/config/parser.tab.h @@ -1,8 +1,9 @@ -/* A Bison parser, made by GNU Bison 3.1. */ +/* A Bison parser, made by GNU Bison 3.7.6. */ /* Bison interface for Yacc-like parsers in C - Copyright (C) 1984, 1989-1990, 2000-2015, 2018 Free Software Foundation, Inc. + 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 @@ -15,7 +16,7 @@ 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 . */ + 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 @@ -30,6 +31,10 @@ 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_PARSER_TAB_H_INCLUDED # define YY_YY_PARSER_TAB_H_INCLUDED /* Debug traces. */ @@ -40,72 +45,72 @@ extern int yydebug; #endif -/* Token type. */ +/* Token kinds. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE enum yytokentype { - T_HELPTEXT = 258, - T_WORD = 259, - T_WORD_QUOTE = 260, - T_ALLNOCONFIG_Y = 261, - T_BOOL = 262, - T_CHOICE = 263, - T_CLOSE_PAREN = 264, - T_COLON_EQUAL = 265, - T_COMMENT = 266, - T_CONFIG = 267, - T_DEFAULT = 268, - T_DEFCONFIG_LIST = 269, - T_DEF_BOOL = 270, - T_DEF_TRISTATE = 271, - T_DEPENDS = 272, - T_ENDCHOICE = 273, - T_ENDIF = 274, - T_ENDMENU = 275, - T_HELP = 276, - T_HEX = 277, - T_IF = 278, - T_IMPLY = 279, - T_INT = 280, - T_MAINMENU = 281, - T_MENU = 282, - T_MENUCONFIG = 283, - T_MODULES = 284, - T_ON = 285, - T_OPEN_PAREN = 286, - T_OPTION = 287, - T_OPTIONAL = 288, - T_PLUS_EQUAL = 289, - T_PROMPT = 290, - T_RANGE = 291, - T_RESET = 292, - T_SELECT = 293, - T_SOURCE = 294, - T_STRING = 295, - T_TRISTATE = 296, - T_VISIBLE = 297, - T_EOL = 298, - T_ASSIGN_VAL = 299, - T_OR = 300, - T_AND = 301, - T_EQUAL = 302, - T_UNEQUAL = 303, - T_LESS = 304, - T_LESS_EQUAL = 305, - T_GREATER = 306, - T_GREATER_EQUAL = 307, - T_NOT = 308 + 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_RESET = 289, /* T_RESET */ + T_SELECT = 290, /* T_SELECT */ + T_SOURCE = 291, /* T_SOURCE */ + T_STRING = 292, /* T_STRING */ + T_TRISTATE = 293, /* T_TRISTATE */ + T_VISIBLE = 294, /* T_VISIBLE */ + T_EOL = 295, /* T_EOL */ + T_ASSIGN_VAL = 296, /* T_ASSIGN_VAL */ + T_OR = 297, /* T_OR */ + T_AND = 298, /* T_AND */ + T_EQUAL = 299, /* T_EQUAL */ + T_UNEQUAL = 300, /* T_UNEQUAL */ + T_LESS = 301, /* T_LESS */ + T_LESS_EQUAL = 302, /* T_LESS_EQUAL */ + T_GREATER = 303, /* T_GREATER */ + T_GREATER_EQUAL = 304, /* T_GREATER_EQUAL */ + T_NOT = 305 /* 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; @@ -115,7 +120,6 @@ union YYSTYPE }; - typedef union YYSTYPE YYSTYPE; # define YYSTYPE_IS_TRIVIAL 1 # define YYSTYPE_IS_DECLARED 1 diff --git a/scripts/config/parser.y b/scripts/config/parser.y index 6b9de46c0..523c9a95a 100644 --- a/scripts/config/parser.y +++ b/scripts/config/parser.y @@ -12,6 +12,7 @@ #include #include "lkc.h" +#include "internal.h" #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) @@ -28,7 +29,7 @@ static bool zconf_endtoken(const char *tokenname, struct symbol *symbol_hash[SYMBOL_HASHSIZE]; -static struct menu *current_menu, *current_entry; +struct menu *current_menu, *current_entry; %} @@ -45,7 +46,6 @@ static struct menu *current_menu, *current_entry; %token T_HELPTEXT %token T_WORD %token T_WORD_QUOTE -%token T_ALLNOCONFIG_Y %token T_BOOL %token T_CHOICE %token T_CLOSE_PAREN @@ -53,7 +53,6 @@ static struct menu *current_menu, *current_entry; %token T_COMMENT %token T_CONFIG %token T_DEFAULT -%token T_DEFCONFIG_LIST %token T_DEF_BOOL %token T_DEF_TRISTATE %token T_DEPENDS @@ -71,7 +70,6 @@ static struct menu *current_menu, *current_entry; %token T_MODULES %token T_ON %token T_OPEN_PAREN -%token T_OPTION %token T_OPTIONAL %token T_PLUS_EQUAL %token T_PROMPT @@ -120,20 +118,24 @@ mainmenu_stmt: T_MAINMENU T_WORD_QUOTE T_EOL stmt_list: /* empty */ - | stmt_list common_stmt + | stmt_list assignment_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"); } ; -common_stmt: - if_stmt - | comment_stmt - | config_stmt - | menuconfig_stmt - | source_stmt - | assignment_stmt +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"); } ; /* config/menuconfig entry */ @@ -215,19 +217,12 @@ config_option: T_RANGE symbol symbol if_expr T_EOL printd(DEBUG_PARSE, "%s:%d:range\n", zconf_curname(), zconf_lineno()); }; -config_option: T_OPTION T_MODULES T_EOL +config_option: T_MODULES T_EOL { - menu_add_option_modules(); -}; - -config_option: T_OPTION T_DEFCONFIG_LIST T_EOL -{ - menu_add_option_defconfig_list(); -}; - -config_option: T_OPTION T_ALLNOCONFIG_Y T_EOL -{ - menu_add_option_allnoconfig_y(); + 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; }; /* choice entry */ @@ -255,7 +250,7 @@ choice_end: end } }; -choice_stmt: choice_entry choice_block choice_end +choice_stmt: choice_entry stmt_list_in_choice choice_end ; choice_option_list: @@ -311,11 +306,6 @@ 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 @@ -337,6 +327,9 @@ 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 @@ -517,7 +510,7 @@ void conf_parse(const char *name) } if (yynerrs) exit(1); - sym_set_change_count(1); + conf_set_changed(true); } static bool zconf_endtoken(const char *tokenname, @@ -723,5 +716,3 @@ void zconfdump(FILE *out) } } } - -#include "menu.c" diff --git a/scripts/config/preprocess.c b/scripts/config/preprocess.c index 92bed1725..3c7a35a72 100644 --- a/scripts/config/preprocess.c +++ b/scripts/config/preprocess.c @@ -114,7 +114,7 @@ static char *do_error_if(int argc, char *argv[]) if (!strcmp(argv[0], "y")) pperror("%s", argv[1]); - return NULL; + return xstrdup(""); } static char *do_filename(int argc, char *argv[]) diff --git a/scripts/config/qconf-cfg.sh b/scripts/config/qconf-cfg.sh index ebbc7ab47..609bb818e 100755 --- a/scripts/config/qconf-cfg.sh +++ b/scripts/config/qconf-cfg.sh @@ -2,7 +2,6 @@ # SPDX-License-Identifier: GPL-2.0-only PKG="Qt5Core Qt5Gui Qt5Widgets" -PKG2="QtCore QtGui" if [ -z "$(command -v pkg-config)" ]; then echo >&2 "*" @@ -12,21 +11,14 @@ if [ -z "$(command -v pkg-config)" ]; then fi if pkg-config --exists $PKG; then - echo cflags=\"-std=c++11 -fPIC $(pkg-config --cflags Qt5Core Qt5Gui Qt5Widgets)\" + echo cflags=\"-std=c++11 -fPIC $(pkg-config --cflags $PKG)\" echo libs=\"$(pkg-config --libs $PKG)\" echo moc=\"$(pkg-config --variable=host_bins Qt5Core)/moc\" exit 0 fi -if pkg-config --exists $PKG2; then - echo cflags=\"$(pkg-config --cflags $PKG2)\" - echo libs=\"$(pkg-config --libs $PKG2)\" - echo moc=\"$(pkg-config --variable=moc_location QtCore)\" - exit 0 -fi - 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 "* Could not find Qt5 via pkg-config." +echo >&2 "* Please install Qt5 and make sure it's in PKG_CONFIG_PATH" echo >&2 "*" exit 1 diff --git a/scripts/config/qconf.cc b/scripts/config/qconf.cc index a1e4d263e..ed7b3e3e2 100644 --- a/scripts/config/qconf.cc +++ b/scripts/config/qconf.cc @@ -4,34 +4,25 @@ * Copyright (C) 2015 Boris Barbulovski */ -#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.h" @@ -40,11 +31,6 @@ static ConfigSettings *configSettings; QAction *ConfigMainWindow::saveAction; -static inline QString qgettext(const char* str) -{ - return QString::fromLocal8Bit(str); -} - ConfigSettings::ConfigSettings() : QSettings("kernel.org", "qconf") { @@ -88,14 +74,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 @@ -111,14 +96,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 = qgettext(menu_get_prompt(menu)); + prompt = menu_get_prompt(menu); if (prop) switch (prop->type) { case P_MENU: @@ -128,15 +113,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: ; @@ -144,7 +130,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) { @@ -153,57 +139,37 @@ void ConfigItem::updateMenu(void) char ch; if (!sym_is_changeable(sym) && list->optMode == normalOpt) { - setPixmap(promptColIdx, QIcon()); - setText(noColIdx, QString::null); - setText(modColIdx, QString::null); - setText(yesColIdx, QString::null); + 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) @@ -244,6 +210,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(); } @@ -264,53 +241,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; + + // 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::show(ConfigItem* i) +void ConfigItemDelegate::setModelData(QWidget *editor, + QAbstractItemModel *model, + const QModelIndex &index) const { - 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(); -} + QLineEdit *lineEdit; + ConfigItem *item; + struct symbol *sym; + bool success; -void ConfigLineEdit::keyPressEvent(QKeyEvent* e) -{ - 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; + 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); @@ -318,26 +309,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)) @@ -351,21 +350,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(); } @@ -375,8 +375,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(); } @@ -415,15 +413,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); @@ -445,7 +443,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 @@ -457,11 +455,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; @@ -482,7 +502,7 @@ void ConfigList::setValue(ConfigItem* item, tristate val) return; if (oldval == no && item->menu->list) item->setExpanded(true); - parent()->updateList(item); + ConfigList::updateListForAll(); break; } } @@ -516,12 +536,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; } } @@ -535,11 +552,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()); } } @@ -627,7 +644,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) @@ -639,7 +656,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; @@ -648,19 +665,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) { @@ -681,7 +698,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); @@ -692,9 +709,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) @@ -736,7 +753,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: @@ -782,7 +802,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()) { @@ -793,22 +813,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; @@ -828,7 +840,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; @@ -843,9 +855,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: @@ -861,7 +876,7 @@ void ConfigList::focusInEvent(QFocusEvent *e) ConfigItem* item = (ConfigItem *)currentItem(); if (item) { - item->setSelected(true); + setSelected(item, true); menu = item->menu; } emit gotFocus(menu); @@ -869,114 +884,38 @@ void ConfigList::focusInEvent(QFocusEvent *e) void ConfigList::contextMenuEvent(QContextMenuEvent *e) { - if (e->y() <= header()->geometry().bottom()) { - if (!headerPopup) { - QAction *action; + 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; - } + 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); } + + headerPopup->exec(e->globalPos()); + e->accept(); } -void ConfigView::setOptionMode(QAction *act) +void ConfigList::setShowName(bool on) { - if (act == showNormalAction) - list->optMode = normalOpt; - else if (act == showAllAction) - list->optMode = allOpt; - else - list->optMode = promptOpt; + if (showName == on) + return; - list->updateListAll(); + showName = on; + reinit(); + emit showNameChanged(on); } -void ConfigView::setShowName(bool b) -{ - if (list->showName != b) { - list->showName = b; - list->reinit(); - emit showNameChanged(b); - } -} - -void ConfigView::setShowRange(bool b) -{ - if (list->showRange != b) { - list->showRange = b; - list->reinit(); - emit showRangeChanged(b); - } -} - -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) { @@ -989,34 +928,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) @@ -1071,108 +1007,119 @@ 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->file->name << ":" + << _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: - 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; } @@ -1210,88 +1157,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)); 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->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) @@ -1314,7 +1298,7 @@ void ConfigSearchWindow::search(void) ConfigItem *lastItem = NULL; free(result); - list->list->clear(); + list->clear(); info->clear(); result = sym_re_search(editField->text().toLatin1()); @@ -1322,7 +1306,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)); } } @@ -1333,7 +1317,6 @@ void ConfigSearchWindow::search(void) ConfigMainWindow::ConfigMainWindow(void) : searchWindow(0) { - QMenuBar* menu; bool ok = true; QVariant x, y; int width, height; @@ -1354,97 +1337,123 @@ ConfigMainWindow::ConfigMainWindow(void) 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(split2, "help"); + helpText = new ConfigInfoView(widget, "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); + connect(backAction, &QAction::triggered, + this, &ConfigMainWindow::goBack); + QAction *quitAction = new QAction("&Quit", this); quitAction->setShortcut(Qt::CTRL + Qt::Key_Q); - connect(quitAction, SIGNAL(triggered(bool)), SLOT(close())); + 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, SIGNAL(triggered(bool)), SLOT(loadConfig())); + connect(loadAction, &QAction::triggered, + this, &ConfigMainWindow::loadConfig); + saveAction = new QAction(QPixmap(xpm_save), "&Save", this); saveAction->setShortcut(Qt::CTRL + Qt::Key_S); - connect(saveAction, SIGNAL(triggered(bool)), SLOT(saveConfig())); + connect(saveAction, &QAction::triggered, + this, &ConfigMainWindow::saveConfig); + conf_set_changed_callback(conf_changed); + // Set saveAction's initial state conf_changed(); configname = xstrdup(conf_get_configname()); QAction *saveAsAction = new QAction("Save &As...", this); - connect(saveAsAction, SIGNAL(triggered(bool)), SLOT(saveConfigAs())); + connect(saveAsAction, &QAction::triggered, + this, &ConfigMainWindow::saveConfigAs); QAction *searchAction = new QAction("&Find", this); searchAction->setShortcut(Qt::CTRL + Qt::Key_F); - connect(searchAction, SIGNAL(triggered(bool)), SLOT(searchConfig())); + 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())); + 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())); + 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); 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 *))); + connect(optGroup, &QActionGroup::triggered, + configList, &ConfigList::setOptionMode); + connect(optGroup, &QActionGroup::triggered, + menuList, &ConfigList::setOptionMode); - 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); + 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())); + connect(showIntroAction, &QAction::triggered, + this, &ConfigMainWindow::showIntro); QAction *showAboutAction = new QAction("About", this); - connect(showAboutAction, SIGNAL(triggered(bool)), SLOT(showAbout())); + connect(showAboutAction, &QAction::triggered, + this, &ConfigMainWindow::showAbout); // init tool bar + QToolBar *toolBar = addToolBar("Tools"); toolBar->addAction(backAction); toolBar->addSeparator(); toolBar->addAction(loadAction); @@ -1454,53 +1463,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); + menu = menuBar()->addMenu("&Help"); + menu->addAction(showIntroAction); + menu->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(helpText, &ConfigInfoView::anchorClicked, + helpText, &ConfigInfoView::clicked); - 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 *))); + 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") @@ -1539,7 +1550,7 @@ void ConfigMainWindow::loadConfig(void) free(configname); configname = xstrdup(name); - ConfigView::updateListAll(); + ConfigList::updateListAllForAll(); } bool ConfigMainWindow::saveConfig(void) @@ -1578,17 +1589,18 @@ void ConfigMainWindow::saveConfigAs(void) void ConfigMainWindow::searchConfig(void) { if (!searchWindow) - searchWindow = new ConfigSearchWindow(this, "search"); + searchWindow = new ConfigSearchWindow(this); searchWindow->show(); } +void ConfigMainWindow::changeItens(struct menu *menu) +{ + configList->setRootMenu(menu); +} + void ConfigMainWindow::changeMenu(struct menu *menu) { - configList->setRootMenu(menu); - if (configList->rootEntry->parent == &rootmenu) - backAction->setEnabled(false); - else - backAction->setEnabled(true); + menuList->setRootMenu(menu); } void ConfigMainWindow::setMenuLink(struct menu *menu) @@ -1608,22 +1620,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: @@ -1636,9 +1652,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); } } } @@ -1651,25 +1668,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) @@ -1681,7 +1683,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) @@ -1700,17 +1704,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(); } @@ -1723,7 +1729,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) @@ -1735,7 +1743,6 @@ void ConfigMainWindow::showFullView(void) /* * ask for saving configuration before quitting - * TODO ask only when something changed */ void ConfigMainWindow::closeEvent(QCloseEvent* e) { @@ -1766,17 +1773,26 @@ 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); } @@ -1784,10 +1800,13 @@ void ConfigMainWindow::showIntro(void) 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"; + "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) @@ -1856,7 +1875,6 @@ int main(int ac, char** av) const char *name; progname = av[0]; - configApp = new QApplication(ac, av); if (ac > 1 && av[1][0] == '-') { switch (av[1][1]) { case 's': @@ -1877,6 +1895,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/scripts/config/qconf.h b/scripts/config/qconf.h index 61ecd5bda..c50d19215 100644 --- a/scripts/config/qconf.h +++ b/scripts/config/qconf.h @@ -3,23 +3,22 @@ * Copyright (C) 2002 Roman Zippel */ -#include -#include -#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; + + static QIcon symbolYesIcon, symbolModIcon, symbolNoIcon; + static QIcon choiceYesIcon, choiceNoIcon; + static QIcon menuIcon, menubackIcon; }; -class ConfigLineEdit : public QLineEdit { - Q_OBJECT - typedef class QLineEdit Parent; +class ConfigItemDelegate : public QStyledItemDelegate +{ +private: + struct menu *menu; public: - ConfigLineEdit(ConfigView* parent); - ConfigView* parent(void) const - { - return (ConfigView*)Parent::parent(); - } - void show(ConfigItem *i); - void keyPressEvent(QKeyEvent *e); - -public: - ConfigItem *item; -}; - -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); -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; @@ -298,6 +244,7 @@ public: ConfigMainWindow(void); public slots: void changeMenu(struct menu *); + void changeItens(struct menu *); void setMenuLink(struct menu *); void listFocusChanged(void); void goBack(void); @@ -316,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/scripts/config/symbol.c b/scripts/config/symbol.c index b85e5cab7..d97b56ab0 100644 --- a/scripts/config/symbol.c +++ b/scripts/config/symbol.c @@ -3,11 +3,11 @@ * Copyright (C) 2002 Roman Zippel */ +#include #include #include #include #include -#include #include "lkc.h" @@ -15,23 +15,28 @@ struct symbol symbol_yes = { .name = "y", .curr = { "y", yes }, .flags = SYMBOL_CONST|SYMBOL_VALID, -}, symbol_mod = { +}; + +struct symbol symbol_mod = { .name = "m", .curr = { "m", mod }, .flags = SYMBOL_CONST|SYMBOL_VALID, -}, symbol_no = { +}; + +struct symbol symbol_no = { .name = "n", .curr = { "n", no }, .flags = SYMBOL_CONST|SYMBOL_VALID, -}, symbol_empty = { +}; + +static struct symbol symbol_empty = { .name = "", .curr = { "", no }, .flags = SYMBOL_VALID, }; -struct symbol *sym_defconfig_list; struct symbol *modules_sym; -tristate modules_val; +static tristate modules_val; int recursive_is_error; enum symbol_type sym_get_type(struct symbol *sym) @@ -222,7 +227,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; @@ -373,6 +378,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: @@ -381,8 +388,7 @@ void sym_calc_value(struct symbol *sym) else 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: @@ -446,7 +452,7 @@ void sym_clear_all_valid(void) for_all_symbols(i, sym) sym->flags &= ~SYMBOL_VALID; - sym_add_change_count(1); + conf_set_changed(true); sym_calc_value(modules_sym); } @@ -464,8 +470,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; @@ -812,7 +816,7 @@ 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; symbol->next = symbol_hash[hash]; symbol_hash[hash] = symbol; diff --git a/scripts/dl_cleanup.py b/scripts/dl_cleanup.py index 1acb04958..b15a9bb1a 100755 --- a/scripts/dl_cleanup.py +++ b/scripts/dl_cleanup.py @@ -13,230 +13,316 @@ import sys import os import re import getopt +import shutil # Commandline options opt_dryrun = False def parseVer_1234(match, filepath): - progname = match.group(1) - progversion = (int(match.group(2)) << 64) |\ - (int(match.group(3)) << 48) |\ - (int(match.group(4)) << 32) |\ - (int(match.group(5)) << 16) - return (progname, progversion) + progname = match.group(1) + progversion = ( + (int(match.group(2)) << 64) + | (int(match.group(3)) << 48) + | (int(match.group(4)) << 32) + | (int(match.group(5)) << 16) + ) + return (progname, progversion) + def parseVer_123(match, filepath): - progname = match.group(1) - try: - patchlevel = match.group(5) - except IndexError as e: - patchlevel = None - if patchlevel: - patchlevel = ord(patchlevel[0]) - else: - patchlevel = 0 - progversion = (int(match.group(2)) << 64) |\ - (int(match.group(3)) << 48) |\ - (int(match.group(4)) << 32) |\ - patchlevel - return (progname, progversion) + progname = match.group(1) + try: + patchlevel = match.group(5) + except IndexError as e: + patchlevel = None + if patchlevel: + patchlevel = ord(patchlevel[0]) + else: + patchlevel = 0 + progversion = ( + (int(match.group(2)) << 64) + | (int(match.group(3)) << 48) + | (int(match.group(4)) << 32) + | patchlevel + ) + return (progname, progversion) + def parseVer_12(match, filepath): - progname = match.group(1) - try: - patchlevel = match.group(4) - except IndexError as e: - patchlevel = None - if patchlevel: - patchlevel = ord(patchlevel[0]) - else: - patchlevel = 0 - progversion = (int(match.group(2)) << 64) |\ - (int(match.group(3)) << 48) |\ - patchlevel - return (progname, progversion) + progname = match.group(1) + try: + patchlevel = match.group(4) + except IndexError as e: + patchlevel = None + if patchlevel: + patchlevel = ord(patchlevel[0]) + else: + patchlevel = 0 + progversion = (int(match.group(2)) << 64) | (int(match.group(3)) << 48) | patchlevel + return (progname, progversion) + def parseVer_r(match, filepath): - progname = match.group(1) - progversion = (int(match.group(2)) << 64) - return (progname, progversion) + progname = match.group(1) + progversion = int(match.group(2)) << 64 + return (progname, progversion) + + +def parseVer_ymd_GIT_SHASUM(match, filepath): + progname = match.group(1) + progversion = ( + (int(match.group(2)) << 64) + | (int(match.group(3)) << 48) + | (int(match.group(4)) << 32) + ) + return (progname, progversion) + def parseVer_ymd(match, filepath): - progname = match.group(1) - progversion = (int(match.group(2)) << 64) |\ - (int(match.group(3)) << 48) |\ - (int(match.group(4)) << 32) - return (progname, progversion) + progname = match.group(1) + progversion = ( + (int(match.group(2)) << 64) + | (int(match.group(3)) << 48) + | (int(match.group(4)) << 32) + ) + return (progname, progversion) + def parseVer_GIT(match, filepath): - progname = match.group(1) - st = os.stat(filepath) - progversion = int(st.st_mtime) << 64 - return (progname, progversion) + progname = match.group(1) + st = os.stat(filepath) + progversion = int(st.st_mtime) << 64 + return (progname, progversion) + extensions = ( - ".tar.gz", - ".tar.bz2", - ".tar.xz", - ".orig.tar.gz", - ".orig.tar.bz2", - ".orig.tar.xz", - ".zip", - ".tgz", - ".tbz", - ".txz", + ".tar.gz", + ".tar.bz2", + ".tar.xz", + ".orig.tar.gz", + ".orig.tar.bz2", + ".orig.tar.xz", + ".zip", + ".tgz", + ".tbz", + ".txz", ) versionRegex = ( - (re.compile(r"(.+)[-_](\d+)\.(\d+)\.(\d+)\.(\d+)"), parseVer_1234), # xxx-1.2.3.4 - (re.compile(r"(.+)[-_](\d\d\d\d)-?(\d\d)-?(\d\d)"), parseVer_ymd), # xxx-YYYY-MM-DD - (re.compile(r"(.+)[-_]([0-9a-fA-F]{40,40})"), parseVer_GIT), # xxx-GIT_SHASUM - (re.compile(r"(.+)[-_](\d+)\.(\d+)\.(\d+)(\w?)"), parseVer_123), # xxx-1.2.3a - (re.compile(r"(.+)[-_](\d+)_(\d+)_(\d+)"), parseVer_123), # xxx-1_2_3 - (re.compile(r"(.+)[-_](\d+)\.(\d+)(\w?)"), parseVer_12), # xxx-1.2a - (re.compile(r"(.+)[-_]r?(\d+)"), parseVer_r), # xxx-r1111 + (re.compile(r"(gcc[-_]\d+)\.(\d+)\.(\d+)"), parseVer_12), # gcc.1.2 + (re.compile(r"(linux[-_]\d+\.\d+)\.(\d+)"), parseVer_r), # linux.1 + (re.compile(r"(.+)[-_](\d+)\.(\d+)\.(\d+)\.(\d+)"), parseVer_1234), # xxx-1.2.3.4 + ( + re.compile(r"(.+)[-_](\d\d\d\d)-?(\d\d)-?(\d\d)-"), + parseVer_ymd_GIT_SHASUM, + ), # xxx-YYYY-MM-DD-GIT_SHASUM + (re.compile(r"(.+)[-_](\d\d\d\d)-?(\d\d)-?(\d\d)"), parseVer_ymd), # xxx-YYYY-MM-DD + (re.compile(r"(.+)[-_]([0-9a-fA-F]{40,40})"), parseVer_GIT), # xxx-GIT_SHASUM + (re.compile(r"(.+)[-_](\d+)\.(\d+)\.(\d+)(\w?)"), parseVer_123), # xxx-1.2.3a + (re.compile(r"(.+)[-_]v(\d+)\.(\d+)\.(\d+)(\w?)"), parseVer_123), # xxx-v1.2.3a + (re.compile(r"(.+)[-_](\d+)_(\d+)_(\d+)"), parseVer_123), # xxx-1_2_3 + (re.compile(r"(.+)[-_](\d+)\.(\d+)(\w?)"), parseVer_12), # xxx-1.2a + (re.compile(r"(.+)[-_]v(\d+)\.(\d+)(\w?)"), parseVer_12), # xxx-v1.2a + (re.compile(r"(.+)[-_]r?(\d+)"), parseVer_r), # xxx-r1111 ) blacklist = [ - ("linux", re.compile(r"linux-\d.*")), - ("gcc", re.compile(r"gcc-.*")), - ("wl_apsta", re.compile(r"wl_apsta.*")), - (".fw", re.compile(r".*\.fw")), - (".arm", re.compile(r".*\.arm")), - (".bin", re.compile(r".*\.bin")), - ("rt-firmware", re.compile(r"RT[\d\w]+_Firmware.*")), + ("wl_apsta", re.compile(r"wl_apsta.*")), + (".fw", re.compile(r".*\.fw")), + (".arm", re.compile(r".*\.arm")), + (".bin", re.compile(r".*\.bin")), + ("rt-firmware", re.compile(r"RT[\d\w]+_Firmware.*")), ] -class EntryParseError(Exception): pass + +class EntryParseError(Exception): + pass + class Entry: - def __init__(self, directory, filename): - self.directory = directory - self.filename = filename - self.progname = "" - self.fileext = "" + def __init__(self, directory, builddir, filename): + self.directory = directory + self.filename = filename + self.builddir = builddir + self.progname = "" + self.fileext = "" + self.filenoext = "" - for ext in extensions: - if filename.endswith(ext): - filename = filename[0:0-len(ext)] - self.fileext = ext - break - else: - print(self.filename, "has an unknown file-extension") - raise EntryParseError("ext") - for (regex, parseVersion) in versionRegex: - match = regex.match(filename) - if match: - (self.progname, self.version) = parseVersion( - match, directory + "/" + filename + self.fileext) - break - else: - print(self.filename, "has an unknown version pattern") - raise EntryParseError("ver") + if os.path.isdir(self.getPath()): + self.filenoext = filename + else: + for ext in extensions: + if filename.endswith(ext): + filename = filename[0 : 0 - len(ext)] + self.filenoext = filename + self.fileext = ext + break + else: + print(self.filename, "has an unknown file-extension") + raise EntryParseError("ext") + for (regex, parseVersion) in versionRegex: + match = regex.match(filename) + if match: + (self.progname, self.version) = parseVersion( + match, directory + "/" + filename + self.fileext + ) + break + else: + print(self.filename, "has an unknown version pattern") + raise EntryParseError("ver") - def getPath(self): - return (self.directory + "/" + self.filename).replace("//", "/") + def getPath(self): + return (self.directory + "/" + self.filename).replace("//", "/") - def deleteFile(self): - path = self.getPath() - print("Deleting", path) - if not opt_dryrun: - os.unlink(path) + def getBuildPaths(self): + paths = [] + for subdir in os.scandir(self.builddir): + package_build_dir = os.path.join(subdir.path, self.filenoext) + if os.path.exists(package_build_dir): + paths.append(package_build_dir) + return paths + + def deleteFile(self): + path = self.getPath() + print("Deleting", path) + if not opt_dryrun: + if os.path.isdir(path): + shutil.rmtree(path) + else: + os.unlink(path) + + def deleteBuildDir(self): + paths = self.getBuildPaths() + for path in paths: + print("Deleting BuildDir", path) + if not opt_dryrun: + shutil.rmtree(path) + + def __ge__(self, y): + return self.version >= y.version - def __ge__(self, y): - return self.version >= y.version def usage(): - print("OpenWrt download directory cleanup utility") - print("Usage: " + sys.argv[0] + " [OPTIONS] ") - print("") - print(" -d|--dry-run Do a dry-run. Don't delete any files") - print(" -B|--show-blacklist Show the blacklist and exit") - print(" -w|--whitelist ITEM Remove ITEM from blacklist") + print("OpenWrt download directory cleanup utility") + print("Usage: " + sys.argv[0] + " [OPTIONS] ") + print("") + print(" -d|--dry-run Do a dry-run. Don't delete any files") + print(" -B|--show-blacklist Show the blacklist and exit") + print(" -w|--whitelist ITEM Remove ITEM from blacklist") + print( + " -D|--download-dir Provide path to dl dir to clean also the build directory" + ) + print( + " -b|--build-dir Provide path to build dir to clean also the build directory" + ) + def main(argv): - global opt_dryrun + global opt_dryrun - try: - (opts, args) = getopt.getopt(argv[1:], - "hdBw:", - [ "help", "dry-run", "show-blacklist", "whitelist=", ]) - if len(args) != 1: - usage() - return 1 - except getopt.GetoptError as e: - usage() - return 1 - directory = args[0] + try: + (opts, args) = getopt.getopt( + argv[1:], + "hdBwDb:", + [ + "help", + "dry-run", + "show-blacklist", + "whitelist=", + "download-dir=", + "build-dir=", + ], + ) + except getopt.GetoptError as e: + usage() + return 1 - if not os.path.exists(directory): - print("Can't find dl path", directory) - return 1 + directory = "dl/" + builddir = "build_dir/" - for (o, v) in opts: - if o in ("-h", "--help"): - usage() - return 0 - if o in ("-d", "--dry-run"): - opt_dryrun = True - if o in ("-w", "--whitelist"): - for i in range(0, len(blacklist)): - (name, regex) = blacklist[i] - if name == v: - del blacklist[i] - break - else: - print("Whitelist error: Item", v,\ - "is not in blacklist") - return 1 - if o in ("-B", "--show-blacklist"): - for (name, regex) in blacklist: - sep = "\t\t" - if len(name) >= 8: - sep = "\t" - print("%s%s(%s)" % (name, sep, regex.pattern)) - return 0 + for (o, v) in opts: + if o in ("-h", "--help"): + usage() + return 0 + if o in ("-d", "--dry-run"): + opt_dryrun = True + if o in ("-w", "--whitelist"): + for i in range(0, len(blacklist)): + (name, regex) = blacklist[i] + if name == v: + del blacklist[i] + break + else: + print("Whitelist error: Item", v, "is not in blacklist") + return 1 + if o in ("-B", "--show-blacklist"): + for (name, regex) in blacklist: + sep = "\t\t" + if len(name) >= 8: + sep = "\t" + print("%s%s(%s)" % (name, sep, regex.pattern)) + return 0 + if o in ("-D", "--download-dir"): + directory = v + if o in ("-b", "--build-dir"): + builddir = v - # Create a directory listing and parse the file names. - entries = [] - for filename in os.listdir(directory): - if filename == "." or filename == "..": - continue - for (name, regex) in blacklist: - if regex.match(filename): - if opt_dryrun: - print(filename, "is blacklisted") - break - else: - try: - entries.append(Entry(directory, filename)) - except EntryParseError as e: - pass + if not os.path.exists(directory): + print("Can't find dl path", directory) + return 1 - # Create a map of programs - progmap = {} - for entry in entries: - if entry.progname in progmap.keys(): - progmap[entry.progname].append(entry) - else: - progmap[entry.progname] = [entry,] + if not os.path.exists(builddir): + print("Can't find dl path", builddir) + return 1 - # Traverse the program map and delete everything but the last version - for prog in progmap: - lastVersion = None - versions = progmap[prog] - for version in versions: - if lastVersion is None or version >= lastVersion: - lastVersion = version - if lastVersion: - for version in versions: - if version is not lastVersion: - version.deleteFile() - if opt_dryrun: - print("Keeping", lastVersion.getPath()) + # Create a directory listing and parse the file names. + entries = [] + for filename in os.listdir(directory): + if filename == "." or filename == "..": + continue + for (name, regex) in blacklist: + if regex.match(filename): + if opt_dryrun: + print(filename, "is blacklisted") + break + else: + try: + entries.append(Entry(directory, builddir, filename)) + except EntryParseError as e: + pass + + # Create a map of programs + progmap = {} + for entry in entries: + if entry.progname in progmap.keys(): + progmap[entry.progname].append(entry) + else: + progmap[entry.progname] = [ + entry, + ] + + # Traverse the program map and delete everything but the last version + for prog in progmap: + lastVersion = None + versions = progmap[prog] + for version in versions: + if lastVersion: + if os.path.isdir(lastVersion.getPath()) and not os.path.isdir(version.getPath()): + continue + if lastVersion is None or version >= lastVersion: + lastVersion = version + if lastVersion: + for version in versions: + if version is not lastVersion: + version.deleteFile() + if builddir: + version.deleteBuildDir() + if opt_dryrun: + print("Keeping", lastVersion.getPath()) + + return 0 - return 0 if __name__ == "__main__": - sys.exit(main(sys.argv)) + sys.exit(main(sys.argv)) diff --git a/scripts/dl_github_archive.py b/scripts/dl_github_archive.py index 59fd7067b..b992227dc 100755 --- a/scripts/dl_github_archive.py +++ b/scripts/dl_github_archive.py @@ -207,7 +207,7 @@ class GitHubCommitTsCache(object): class DownloadGitHubTarball(object): - """Download and repack archive tarabll from GitHub. + """Download and repack archive tarball from GitHub. Compared with the method of packing after cloning the whole repo, this method is more friendly to users with fragile internet connection. @@ -220,7 +220,7 @@ class DownloadGitHubTarball(object): - GitHub archives do not contain source codes for submodules. - - GitHub archives seem to respect .gitattributes and ignore pathes with + - GitHub archives seem to respect .gitattributes and ignore paths with export-ignore attributes. For the first two issues, the method will fail loudly to allow fallback to diff --git a/scripts/download.pl b/scripts/download.pl index f6fdc1232..2b193ff5b 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -56,10 +56,8 @@ sub localmirrors { sub which($) { my $prog = shift; - my $res = `which $prog`; + my $res = `command -v $prog`; $res or return undef; - $res =~ /^no / and return undef; - $res =~ /not found/ and return undef; return $res; } @@ -72,29 +70,30 @@ sub hash_cmd() { return undef; } +sub tool_present { + my $tool_name = shift; + my $compare_line = shift; + my $present = 0; + + if (open TOOL, "$tool_name --version 2>/dev/null |") { + if (defined(my $line = readline TOOL)) { + $present = 1 if $line =~ /^$compare_line /; + } + close TOOL; + } + + return $present +} + sub download_cmd { my $url = shift; - my $have_curl = 0; - my $have_aria2c = 0; my $filename = shift; my $additional_mirrors = join(" ", map "$_/$filename", @_); my @chArray = ('a'..'z', 'A'..'Z', 0..9); my $rfn = join '', "${filename}_", map{ $chArray[int rand @chArray] } 0..9; - if (open CURL, '-|', 'curl', '--version') { - if (defined(my $line = readline CURL)) { - $have_curl = 1 if $line =~ /^curl /; - } - close CURL; - } - if (open ARIA2C, '-|', 'aria2c', '--version') { - if (defined(my $line = readline ARIA2C)) { - $have_aria2c = 1 if $line =~ /^aria2 /; - } - close ARIA2C; - } - if ($have_aria2c) { + if (tool_present('aria2c', 'aria2')) { @mirrors=(); return join(" ", "[ -d $ENV{'TMPDIR'}/aria2c ] || mkdir $ENV{'TMPDIR'}/aria2c;", "touch $ENV{'TMPDIR'}/aria2c/${rfn}_spp;", @@ -105,7 +104,7 @@ sub download_cmd { "-d $ENV{'TMPDIR'}/aria2c -o $rfn;", "cat $ENV{'TMPDIR'}/aria2c/$rfn;", "rm $ENV{'TMPDIR'}/aria2c/$rfn $ENV{'TMPDIR'}/aria2c/${rfn}_spp"); - } elsif ($have_curl) { + } elsif (tool_present('curl', 'curl')) { return (qw(curl -f --connect-timeout 20 --retry 5 --location), $check_certificate ? () : '--insecure', shellwords($ENV{CURL_OPTIONS} || ''), @@ -224,19 +223,17 @@ foreach my $mirror (@ARGV) { if ($mirror =~ /^\@SF\/(.+)$/) { # give sourceforge a few more tries, because it redirects to different mirrors for (1 .. 5) { - push @mirrors, "https://netix.dl.sourceforge.net/$1"; - push @mirrors, "https://freefr.dl.sourceforge.net/$1"; push @mirrors, "https://downloads.sourceforge.net/$1"; } } elsif ($mirror =~ /^\@OPENWRT$/) { # use OpenWrt source server directly } elsif ($mirror =~ /^\@DEBIAN\/(.+)$/) { - push @mirrors, "https://mirrors.tencent.com/debian/$1"; push @mirrors, "https://ftp.debian.org/debian/$1"; push @mirrors, "https://mirror.leaseweb.com/debian/$1"; push @mirrors, "https://mirror.netcologne.de/debian/$1"; + push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/debian/$1"; + push @mirrors, "https://mirrors.ustc.edu.cn/debian/$1" } elsif ($mirror =~ /^\@APACHE\/(.+)$/) { - push @mirrors, "https://mirrors.cloud.tencent.com/apache/$1"; push @mirrors, "https://mirror.netcologne.de/apache.org/$1"; push @mirrors, "https://mirror.aarnet.edu.au/pub/apache/$1"; push @mirrors, "https://mirror.csclub.uwaterloo.ca/apache/$1"; @@ -246,17 +243,14 @@ foreach my $mirror (@ARGV) { push @mirrors, "http://ftp.jaist.ac.jp/pub/apache/$1"; push @mirrors, "ftp://apache.cs.utah.edu/apache.org/$1"; push @mirrors, "ftp://apache.mirrors.ovh.net/ftp.apache.org/dist/$1"; + push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/apache/$1"; + push @mirrors, "https://mirrors.ustc.edu.cn/apache/$1"; } elsif ($mirror =~ /^\@GITHUB\/(.+)$/) { - my $dir = $1; - my $i = 0; - # replace the 2nd '/' with '@' for jsDelivr mirror - push @mirrors, "https://cdn.jsdelivr.net/gh/". $dir =~ s{\/}{++$i == 2 ? '@' : $&}ger; # give github a few more tries (different mirrors) for (1 .. 5) { - push @mirrors, "https://raw.githubusercontent.com/$dir"; + push @mirrors, "https://raw.githubusercontent.com/$1"; } } elsif ($mirror =~ /^\@GNU\/(.+)$/) { - push @mirrors, "https://mirrors.cloud.tencent.com/gnu/$1"; push @mirrors, "https://mirror.csclub.uwaterloo.ca/gnu/$1"; push @mirrors, "https://mirror.netcologne.de/gnu/$1"; push @mirrors, "http://ftp.kddilabs.jp/GNU/gnu/$1"; @@ -266,6 +260,8 @@ foreach my $mirror (@ARGV) { push @mirrors, "ftp://mirrors.rit.edu/gnu/$1"; push @mirrors, "ftp://download.xs4all.nl/pub/gnu/$1"; push @mirrors, "https://ftp.gnu.org/gnu/$1"; + push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/gnu/$1"; + push @mirrors, "https://mirrors.ustc.edu.cn/gnu/$1"; } elsif ($mirror =~ /^\@SAVANNAH\/(.+)$/) { push @mirrors, "https://mirror.netcologne.de/savannah/$1"; push @mirrors, "https://mirror.csclub.uwaterloo.ca/nongnu/$1"; @@ -282,7 +278,6 @@ foreach my $mirror (@ARGV) { push @extra, "$extra[0]/longterm/v$1"; } foreach my $dir (@extra) { - push @mirrors, "https://mirrors.ustc.edu.cn/kernel.org/$dir"; push @mirrors, "https://cdn.kernel.org/pub/$dir"; push @mirrors, "https://download.xs4all.nl/ftp.kernel.org/pub/$dir"; push @mirrors, "https://mirrors.mit.edu/kernel/$dir"; @@ -290,10 +285,11 @@ foreach my $mirror (@ARGV) { push @mirrors, "http://www.ring.gr.jp/archives/linux/kernel.org/$dir"; push @mirrors, "ftp://ftp.riken.jp/Linux/kernel.org/$dir"; push @mirrors, "ftp://www.mirrorservice.org/sites/ftp.kernel.org/pub/$dir"; + push @mirrors, "https://mirrors.tuna.tsinghua.edu.cn/kernel/$dir"; + push @mirrors, "https://mirrors.ustc.edu.cn/kernel.org/$dir"; } } elsif ($mirror =~ /^\@GNOME\/(.+)$/) { push @mirrors, "https://download.gnome.org/sources/$1"; - push @mirrors, "https://mirrors.ustc.edu.cn/gnome/sources/$1"; push @mirrors, "https://mirror.csclub.uwaterloo.ca/gnome/sources/$1"; push @mirrors, "http://ftp.acc.umu.se/pub/GNOME/sources/$1"; push @mirrors, "http://ftp.kaist.ac.kr/gnome/sources/$1"; @@ -302,6 +298,7 @@ foreach my $mirror (@ARGV) { push @mirrors, "http://ftp.belnet.be/ftp.gnome.org/sources/$1"; push @mirrors, "ftp://ftp.cse.buffalo.edu/pub/Gnome/sources/$1"; push @mirrors, "ftp://ftp.nara.wide.ad.jp/pub/X11/GNOME/sources/$1"; + push @mirrors, "https://mirrors.ustc.edu.cn/gnome/sources/$1"; } else { push @mirrors, $mirror; } diff --git a/scripts/dump-target-info.pl b/scripts/dump-target-info.pl index aa97f8d60..0e4af17fe 100755 --- a/scripts/dump-target-info.pl +++ b/scripts/dump-target-info.pl @@ -4,7 +4,7 @@ use strict; use warnings; use Cwd; -my (%targets, %architectures); +my (%targets, %architectures, %kernels); $ENV{'TOPDIR'} = Cwd::getcwd(); @@ -13,7 +13,7 @@ sub parse_targetinfo { my ($target_dir, $subtarget) = @_; if (open M, "make -C '$target_dir' --no-print-directory DUMP=1 TARGET_BUILD=1 SUBTARGET='$subtarget' |") { - my ($target_name, $target_arch, @target_features); + my ($target_name, $target_arch, $target_kernel, $target_testing_kernel, @target_features); while (defined(my $line = readline M)) { chomp $line; @@ -23,19 +23,32 @@ sub parse_targetinfo { elsif ($line =~ /^Target-Arch-Packages: (.+)$/) { $target_arch = $1; } + elsif ($line =~ /^Linux-Version: (\d\.\d+)\.\d+$/) { + $target_kernel = $1; + } + elsif ($line =~ /^Linux-Testing-Version: (\d\.\d+)\.\d+$/) { + $target_testing_kernel = $1; + } elsif ($line =~ /^Target-Features: (.+)$/) { @target_features = split /\s+/, $1; } elsif ($line =~ /^@\@$/) { - if ($target_name && $target_arch && + if ($target_name && $target_arch && $target_kernel && !grep { $_ eq 'broken' or $_ eq 'source-only' } @target_features) { $targets{$target_name} = $target_arch; $architectures{$target_arch} ||= []; push @{$architectures{$target_arch}}, $target_name; + $kernels{$target_name} ||= []; + push @{$kernels{$target_name}}, $target_kernel; + if ($target_testing_kernel) { + push @{$kernels{$target_name}}, $target_testing_kernel; + } } undef $target_name; undef $target_arch; + undef $target_kernel; + undef $target_testing_kernel; @target_features = (); } } @@ -85,7 +98,14 @@ elsif (@ARGV == 1 && $ARGV[0] eq 'architectures') { printf "%s %s\n", $target_arch, join ' ', @{$architectures{$target_arch}}; } } +elsif (@ARGV == 1 && $ARGV[0] eq 'kernels') { + get_targetinfo(); + foreach my $target_name (sort keys %targets) { + printf "%s %s\n", $target_name, join ' ', @{$kernels{$target_name}}; + } +} else { print "Usage: $0 targets\n"; print "Usage: $0 architectures\n"; + print "Usage: $0 kernels\n"; } diff --git a/scripts/env b/scripts/env index df8b486bf..5987b4160 100755 --- a/scripts/env +++ b/scripts/env @@ -61,7 +61,7 @@ env_init() { mkdir -p "$ENVDIR" || error "Failed to create the environment directory" cd "$ENVDIR" || error "Failed to switch to the environment directory" [ -d .git ] || { - git init && + git init -b master && touch .config && mkdir files && git add . && diff --git a/scripts/ext-toolchain.sh b/scripts/ext-toolchain.sh index ee7d9532f..fe1024c18 100755 --- a/scripts/ext-toolchain.sh +++ b/scripts/ext-toolchain.sh @@ -50,6 +50,7 @@ BIN_SPECS=" gdbserver: gdbserver " +OVERWRITE_CONFIG="" test_c() { cat <<-EOT | "${CC:-false}" $CFLAGS -o /dev/null -x c - 2>/dev/null @@ -281,8 +282,11 @@ print_config() { local mksubtarget local target="$("$CC" $CFLAGS -dumpmachine)" + local version="$("$CC" $CFLAGS -dumpversion)" local cpuarch="${target%%-*}" - local prefix="${CC##*/}"; prefix="${prefix%-*}-" + + # get CC; strip version; strip gcc and add - suffix + local prefix="${CC##*/}"; prefix="${prefix%-$version}"; prefix="${prefix%-*}-" local config="${0%/scripts/*}/.config" # if no target specified, print choice list and exit @@ -317,9 +321,13 @@ print_config() { fi # bail out if there is a .config already - if [ -f "${0%/scripts/*}/.config" ]; then - echo "There already is a .config file, refusing to overwrite!" >&2 - return 1 + if [ -f "$config" ]; then + if [ "$OVERWRITE_CONFIG" == "" ]; then + echo "There already is a .config file, refusing to overwrite!" >&2 + return 1 + else + echo "There already is a .config file, trying to overwrite!" + fi fi case "$mktarget" in */*) @@ -327,8 +335,11 @@ print_config() { mktarget="${mktarget%/*}" ;; esac + if [ ! -f "$config" ]; then + touch "$config" + fi - echo "CONFIG_TARGET_${mktarget}=y" > "$config" + echo "CONFIG_TARGET_${mktarget}=y" >> "$config" if [ -n "$mksubtarget" ]; then echo "CONFIG_TARGET_${mktarget}_${mksubtarget}=y" >> "$config" @@ -358,8 +369,18 @@ print_config() { echo "CONFIG_TOOLCHAIN_PREFIX=\"$prefix\"" >> "$config" echo "CONFIG_TARGET_NAME=\"$target\"" >> "$config" - if [ "$LIBC_TYPE" != glibc ]; then - echo "CONFIG_TOOLCHAIN_LIBC=\"$LIBC_TYPE\"" >> "$config" + if [ -f "$config" ]; then + sed -i '/CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL/d' "$config" + sed -i '/CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_GLIBC/d' "$config" + fi + + if [ "$LIBC_TYPE" == glibc ]; then + echo "CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_GLIBC=y" >> "$config" + elif [ "$LIBC_TYPE" == musl ]; then + echo "CONFIG_EXTERNAL_TOOLCHAIN_LIBC_USE_MUSL=y" >> "$config" + else + echo "Can't detect LIBC type. Aborting!" >&2 + return 1 fi local lib @@ -452,6 +473,13 @@ probe_cpp() { } probe_libc() { + if [ -f $TOOLCHAIN/info.mk ]; then + LIBC_TYPE=$(grep LIBC_TYPE $TOOLCHAIN/info.mk | sed 's/LIBC_TYPE=//') + return 0 + fi + + echo "Warning! Can't find info.mk, trying to detect with alternative way." + if [ -z "$LIBC_TYPE" ]; then if test_uclibc; then LIBC_TYPE="uclibc" @@ -529,8 +557,13 @@ while [ -n "$1" ]; do exit $? ;; + --overwrite-config) + OVERWRITE_CONFIG=y + ;; + --config) if probe_cc; then + probe_libc print_config "$1" exit $? fi @@ -569,7 +602,9 @@ while [ -n "$1" ]; do echo -e " Most commands also take a --cflags parameter which " >&2 echo -e " is used to specify C flags to be passed to the " >&2 echo -e " cross compiler when performing tests." >&2 - echo -e " This paremter may be repeated multiple times." >&2 + echo -e " This parameter may be repeated multiple times." >&2 + echo -e " Use --overwrite-config before --config to overwrite" >&2 + echo -e " an already present config with the required changes.">&2 exit 1 ;; diff --git a/scripts/ext-tools.sh b/scripts/ext-tools.sh new file mode 100755 index 000000000..bf56f4d9e --- /dev/null +++ b/scripts/ext-tools.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash + +TOOLS_TAR="" +HOST_BUILD_DIR=$(pwd)/"build_dir/host" +HOST_STAGING_DIR_STAMP=$(pwd)/"staging_dir/host/stamp" + +refresh_timestamps() { + find "$1" -not -type l -print0 | xargs -0 touch +} + +extract_prebuilt_tar() { + tar -xf "$1" +} + +install_prebuilt_tools() { + extract_prebuilt_tar "$TOOLS_TAR" + + if [ ! -d "$HOST_BUILD_DIR" ]; then + echo "Can't find Host Build Dir "$HOST_BUILD_DIR"" >&2 + exit 1 + fi + + refresh_timestamps "$HOST_BUILD_DIR" + sleep 1 + + if [ ! -d "$HOST_STAGING_DIR_STAMP" ]; then + echo "Can't find Host Staging Dir Stamp "$HOST_STAGING_DIR_STAMP"" >&2 + exit 1 + fi + + refresh_timestamps "$HOST_STAGING_DIR_STAMP" + + return 0 +} + +while [ -n "$1" ]; do + arg="$1"; shift + case "$arg" in + --host-build-dir) + [ -d "$1" ] || { + echo "Directory '$1' does not exist." >&2 + exit 1 + } + HOST_BUILD_DIR="$(cd "$1"; pwd)"; shift + ;; + + --host-staging-dir-stamp) + [ -d "$1" ] || { + echo "Directory '$1' does not exist." >&2 + exit 1 + } + HOST_STAGING_DIR_STAMP="$(cd "$1"; pwd)"; shift + ;; + + --tools) + [ -f "$1" ] || { + echo "Tools tar file '$1' does not exist." >&2 + exit 1 + } + TOOLS_TAR="$1"; shift + install_prebuilt_tools + + exit $? + ;; + + -h|--help) + me="$(basename "$0")" + echo -e "\nUsage:\n" >&2 + echo -e " $me --host-build-dir {directory}" >&2 + echo -e " Set to refresh timestamp of this build directory" >&2 + echo -e " with --tools." >&2 + echo -e " THIS OPTION MUST BE SET BEFORE --tools." >&2 + echo -e " If not provided the default directory is:" >&2 + echo -e " $(pwd)/build_dir/host\n" >&2 + echo -e " $me --host-staging-dir-stamp {directory}" >&2 + echo -e " Set to refresh staging timestamp present in this" >&2 + echo -e " directory with --tools." >&2 + echo -e " THIS OPTION MUST BE SET BEFORE --tools." >&2 + echo -e " If not provided the default directory is:" >&2 + echo -e " $(pwd)/staging_dir/host/stamp\n" >&2 + echo -e " $me --tools {tar}" >&2 + echo -e " Install the prebuilt tools present in the passed" >&2 + echo -e " tar and prepare them." >&2 + echo -e " To correctly use them it's needed to update the." >&2 + echo -e " timestamp of each tools to skip recompilation.\n" >&2 + echo -e " $me --help" >&2 + echo -e " Display this help text and exit.\n\n" >&2 + exit 1 + ;; + + *) + echo "Unknown argument '$arg'" >&2 + exec $0 --help + ;; + esac +done + +exec $0 --help diff --git a/scripts/feeds b/scripts/feeds index bbfd832c4..aee73e793 100755 --- a/scripts/feeds +++ b/scripts/feeds @@ -14,7 +14,7 @@ chdir $ENV{TOPDIR}; $ENV{GIT_CONFIG_PARAMETERS}="'core.autocrlf=false'"; $ENV{GREP_OPTIONS}=""; -my $mk=`which gmake 2>/dev/null`; # select the right 'make' program +my $mk=`command -v gmake 2>/dev/null`; # select the right 'make' program chomp($mk); # trim trailing newline $mk or $mk = "make"; # default to 'make' @@ -167,8 +167,8 @@ my %update_method = ( 'init' => "git clone '%s' '%s'", 'init_branch' => "git clone --branch '%s' '%s' '%s'", 'init_commit' => "git clone '%s' '%s' && cd '%s' && git checkout -b '%s' '%s' && cd -", - 'update' => "git pull --ff", - 'update_force' => "git pull --ff || (git reset --hard HEAD; git pull --ff; exit 1)", + 'update' => "git pull --ff-only", + 'update_force' => "git pull --ff-only || (git reset --hard HEAD; git pull --ff-only; exit 1)", 'post_update' => "git submodule update --init --recursive", 'controldir' => ".git", 'revision' => "git rev-parse --short HEAD | tr -d '\n'"}, @@ -434,14 +434,16 @@ sub do_install_target($) { $path =~ s/\/Makefile$//; my $name = $path; $name =~ s/.*\///; - my $dest = "./target/linux/$name"; + my $dest = "./target/linux/feeds/$name"; + + -d "./target/linux/feeds" or mkdir "./target/linux/feeds"; -e $dest and do { warn "Path $dest already exists"; return 1; }; - system("ln -sf ../../$path ./target/linux/"); + system("ln -sf ../../../$path ./target/linux/feeds/"); } else { warn "Target is not valid\n"; return 1; @@ -498,16 +500,34 @@ sub is_core_src($) { sub install_target { my $feed = shift; my $name = shift; + my $force = shift; - $installed_targets{$name} and return 0; + $feed = lookup_target($feed, $name); + my $feed_name = $feed->[1]; - $feed = $feed_cache{$feed->[1]}->[2]; + -e "target/linux/feeds/$name" and return 0; + + # enable force flag if feed src line was declared with --force + if (exists($feed->[3]{force})) { + $force = 1; + } + + $feed = $feed_cache{$feed_name}->[2]; $feed or return 0; my $target = $feed->{$name}; $target or return 0; - warn "Installing target '$name'\n"; + if (-e "target/linux/$name") { + if ($force) { + warn "Overriding target '$name' with version from '$feed_name'\n"; + } else { + warn "WARNING: Not overriding core target '$name'; use -f to force\n"; + return 0; + } + } else { + warn "Installing target '$name'\n"; + } return do_install_target($target); } @@ -618,7 +638,7 @@ sub install_target_or_package { my $force = shift; lookup_target($feed, $name) and do { - return install_target($feed, $name); + return install_target($feed, $name, $force); }; lookup_src($feed, $name) and do { @@ -734,7 +754,7 @@ sub uninstall { } get_installed(); while ($name = shift @ARGV) { - my $target = "target/linux/$name"; + my $target = "target/linux/feeds/$name"; -l "$target" and do { uninstall_target($target); $uninstall = 1; @@ -901,7 +921,7 @@ my %commands = ( 'uninstall' => \&uninstall, 'feed_config' => \&feed_config, 'clean' => sub { - system("rm -rf ./feeds ./package/feeds"); + system("rm -rf ./feeds ./package/feeds ./target/linux/feeds"); } ); diff --git a/scripts/flashing/eva_ramboot.py b/scripts/flashing/eva_ramboot.py index b182f09d2..365fceecf 100755 --- a/scripts/flashing/eva_ramboot.py +++ b/scripts/flashing/eva_ramboot.py @@ -3,7 +3,6 @@ import argparse from ftplib import FTP -from sys import argv from os import stat parser = argparse.ArgumentParser(description='Tool to boot AVM EVA ramdisk images.') diff --git a/scripts/gen-rddependencies.sh b/scripts/gen-rddependencies.sh deleted file mode 100755 index 509d6a4fa..000000000 --- a/scripts/gen-rddependencies.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -TARGETS=$* -READELF="${READELF:-readelf}" -XARGS="${XARGS:-xargs -r}" - -find $TARGETS -type f -a -exec file {} \; | \ - sed -n -e 's/^\(.*\):.*ELF.*\(executable\|shared object\).*,.*/\1/p' | \ - $XARGS -n1 $READELF -l | grep 'Requesting' | cut -d':' -f2 | tr -d ' ]' | \ - $XARGS basename - -cd `dirname ${0}` -./gen-dependencies.sh ${TARGETS} diff --git a/scripts/gen_image_generic.sh b/scripts/gen_image_generic.sh index 17888eac6..ef1362440 100755 --- a/scripts/gen_image_generic.sh +++ b/scripts/gen_image_generic.sh @@ -26,15 +26,33 @@ KERNELSIZE="$2" ROOTFSOFFSET="$(($3 / 512))" ROOTFSSIZE="$(($4 / 512))" +# Using mcopy -s ... is using READDIR(3) to iterate through the directory +# entries, hence they end up in the FAT filesystem in traversal order which +# breaks reproducibility. +# Implement recursive copy with reproducible order. +dos_dircopy() { + local entry + local baseentry + for entry in "$1"/* ; do + if [ -f "$entry" ]; then + mcopy -i "$OUTPUT.kernel" "$entry" ::"$2" + elif [ -d "$entry" ]; then + baseentry="$(basename "$entry")" + mmd -i "$OUTPUT.kernel" ::"$2""$baseentry" + dos_dircopy "$entry" "$2""$baseentry"/ + fi + done +} + [ -n "$PADDING" ] && dd if=/dev/zero of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc count="$ROOTFSSIZE" dd if="$ROOTFSIMAGE" of="$OUTPUT" bs=512 seek="$ROOTFSOFFSET" conv=notrunc if [ -n "$GUID" ]; then [ -n "$PADDING" ] && dd if=/dev/zero of="$OUTPUT" bs=512 seek="$((ROOTFSOFFSET + ROOTFSSIZE))" conv=notrunc count="$sect" - mkfs.fat -n kernel -C "$OUTPUT.kernel" -S 512 "$((KERNELSIZE / 1024))" - mcopy -s -i "$OUTPUT.kernel" "$KERNELDIR"/* ::/ + mkfs.fat --invariant -n kernel -C "$OUTPUT.kernel" -S 512 "$((KERNELSIZE / 1024))" + LC_ALL=C dos_dircopy "$KERNELDIR" / else - make_ext4fs -J -L kernel -l "$KERNELSIZE" "$OUTPUT.kernel" "$KERNELDIR" + make_ext4fs -J -L kernel -l "$KERNELSIZE" ${SOURCE_DATE_EPOCH:+-T ${SOURCE_DATE_EPOCH}} "$OUTPUT.kernel" "$KERNELDIR" fi dd if="$OUTPUT.kernel" of="$OUTPUT" bs=512 seek="$KERNELOFFSET" conv=notrunc rm -f "$OUTPUT.kernel" diff --git a/scripts/ipkg-build b/scripts/ipkg-build index c112270a2..122cca2cb 100755 --- a/scripts/ipkg-build +++ b/scripts/ipkg-build @@ -58,7 +58,8 @@ pkg_appears_sane() { rm "$CONTROL"/conffiles if [ -f "$CONTROL"/conffiles.resolved ]; then - mv "$CONTROL"/conffiles.resolved "$CONTROL"/conffiles + LC_ALL=C sort -o "$CONTROL"/conffiles "$CONTROL"/conffiles.resolved + rm "$CONTROL"/conffiles.resolved chmod 0644 "$CONTROL"/conffiles fi fi @@ -178,20 +179,20 @@ for file_mode in $file_modes; do chown "$uid:$gid" "$pkg_dir/$path" chmod "$mode" "$pkg_dir/$path" done -$TAR -X "$tmp_dir"/tarX --format=gnu --sort=name -cpf - --mtime="$TIMESTAMP" . | gzip -n - > "$tmp_dir"/data.tar.gz +$TAR -X "$tmp_dir"/tarX --format=gnu --numeric-owner --sort=name -cpf - --mtime="$TIMESTAMP" . | gzip -n - > "$tmp_dir"/data.tar.gz installed_size=$(stat -c "%s" "$tmp_dir"/data.tar.gz) sed -i -e "s/^Installed-Size: .*/Installed-Size: $installed_size/" \ "$pkg_dir"/$CONTROL/control -( cd "$pkg_dir"/$CONTROL && $TAR --format=gnu --sort=name -cf - --mtime="$TIMESTAMP" . | gzip -n - > "$tmp_dir"/control.tar.gz ) +( cd "$pkg_dir"/$CONTROL && $TAR --format=gnu --numeric-owner --sort=name -cf - --mtime="$TIMESTAMP" . | gzip -n - > "$tmp_dir"/control.tar.gz ) rm "$tmp_dir"/tarX echo "2.0" > "$tmp_dir"/debian-binary pkg_file=$dest_dir/${pkg}_${version}_${arch}.ipk rm -f "$pkg_file" -( cd "$tmp_dir" && $TAR --format=gnu --sort=name -cf - --mtime="$TIMESTAMP" ./debian-binary ./data.tar.gz ./control.tar.gz | gzip -n - > "$pkg_file" ) +( cd "$tmp_dir" && $TAR --format=gnu --numeric-owner --sort=name -cf - --mtime="$TIMESTAMP" ./debian-binary ./data.tar.gz ./control.tar.gz | gzip -n - > "$pkg_file" ) rm "$tmp_dir"/debian-binary "$tmp_dir"/data.tar.gz "$tmp_dir"/control.tar.gz rmdir "$tmp_dir" diff --git a/scripts/json_add_image_info.py b/scripts/json_add_image_info.py index 38cd3c487..9aa2a19e4 100755 --- a/scripts/json_add_image_info.py +++ b/scripts/json_add_image_info.py @@ -11,11 +11,11 @@ if len(argv) != 2: exit(1) json_path = Path(argv[1]) -bin_dir = Path(getenv("BIN_DIR")) -image_file = bin_dir / getenv("DEVICE_IMG_NAME") +file_path = Path(getenv("FILE_DIR")) / getenv("FILE_NAME") -if not image_file.is_file(): - print("Skip JSON creation for non existing image ", image_file) + +if not file_path.is_file(): + print("Skip JSON creation for non existing file", file_path) exit(0) @@ -37,23 +37,30 @@ def get_titles(): device_id = getenv("DEVICE_ID") -image_hash = hashlib.sha256(image_file.read_bytes()).hexdigest() +hash_file = hashlib.sha256(file_path.read_bytes()).hexdigest() -image_info = { +if file_path.with_suffix(file_path.suffix + ".sha256sum").exists(): + hash_unsigned = ( + file_path.with_suffix(file_path.suffix + ".sha256sum").read_text().strip() + ) +else: + hash_unsigned = hash_file + +file_info = { "metadata_version": 1, "target": "{}/{}".format(getenv("TARGET"), getenv("SUBTARGET")), "version_code": getenv("VERSION_CODE"), "version_number": getenv("VERSION_NUMBER"), - "source_date_epoch": getenv("SOURCE_DATE_EPOCH"), + "source_date_epoch": int(getenv("SOURCE_DATE_EPOCH")), "profiles": { device_id: { "image_prefix": getenv("DEVICE_IMG_PREFIX"), "images": [ { - "type": getenv("IMAGE_TYPE"), - "filesystem": getenv("IMAGE_FILESYSTEM"), - "name": getenv("DEVICE_IMG_NAME"), - "sha256": image_hash, + "type": getenv("FILE_TYPE"), + "name": getenv("FILE_NAME"), + "sha256": hash_file, + "sha256_unsigned": hash_unsigned, } ], "device_packages": getenv("DEVICE_PACKAGES").split(), @@ -63,4 +70,9 @@ image_info = { }, } -json_path.write_text(json.dumps(image_info, separators=(",", ":"))) +if getenv("FILE_FILESYSTEM"): + file_info["profiles"][device_id]["images"][0]["filesystem"] = getenv( + "FILE_FILESYSTEM" + ) + +json_path.write_text(json.dumps(file_info, separators=(",", ":"))) diff --git a/scripts/json_overview_image_info.py b/scripts/json_overview_image_info.py index 45c05012b..89b7d4fe2 100755 --- a/scripts/json_overview_image_info.py +++ b/scripts/json_overview_image_info.py @@ -7,7 +7,7 @@ from sys import argv import json if len(argv) != 2: - print("JSON info files script requires ouput file as argument") + print("JSON info files script requires output file as argument") exit(1) output_path = Path(argv[1]) @@ -42,7 +42,7 @@ for json_file in work_dir.glob("*.json"): output["profiles"][device_id]["images"].extend(profile["images"]) # make image lists unique by name, keep last/latest -for device_id, profile in output["profiles"].items(): +for device_id, profile in output.get("profiles", {}).items(): profile["images"] = list({e["name"]: e for e in profile["images"]}.values()) diff --git a/scripts/linksys-image.sh b/scripts/linksys-image.sh index 36a676d96..c3baf4484 100755 --- a/scripts/linksys-image.sh +++ b/scripts/linksys-image.sh @@ -11,11 +11,11 @@ # This is appended to the factory image and is tested by the Linksys Upgrader - as observed in civic. # The footer is 256 bytes. The format is: # .LINKSYS. This is detected by the Linksys upgrader before continuing with upgrade. (9 bytes) -# The version number of upgrade. Not checked so use arbitary value (8 bytes) +# The version number of upgrade. Not checked so use arbitrary value (8 bytes) # Model of target device, padded (0x20) to (15 bytes) # CRC checksum of the image to flash (8 byte) # Padding (0x20) (7 bytes) -# Signature of signer. Not checked so use Arbitary value (16 bytes) +# Signature of signer. Not checked so use arbitrary value (16 bytes) # Padding (0x00) (192 bytes) # 0x0A (1 byte) diff --git a/scripts/metadata.pm b/scripts/metadata.pm index 5fbb77a36..ee5a2945c 100644 --- a/scripts/metadata.pm +++ b/scripts/metadata.pm @@ -290,17 +290,24 @@ sub parse_package_metadata($) { }; /^Config:\s*(.*)\s*$/ and $pkg->{config} = "$1\n".get_multiline(*FILE, "\t"); /^Prereq-Check:/ and $pkg->{prereq} = 1; + /^Maintainer: \s*(.+)\s*$/ and $pkg->{maintainer} = [ split /, /, $1 ]; /^Require-User:\s*(.*?)\s*$/ and do { my @ugspecs = split /\s+/, $1; for my $ugspec (@ugspecs) { - my @ugspec = split /:/, $ugspec, 2; + my @ugspec = split /:/, $ugspec, 3; if ($ugspec[0]) { parse_package_metadata_usergroup($src->{makefile}, "user", \%usernames, \%userids, $ugspec[0]) or return 0; } if ($ugspec[1]) { parse_package_metadata_usergroup($src->{makefile}, "group", \%groupnames, \%groupids, $ugspec[1]) or return 0; } + if ($ugspec[2]) { + my @addngroups = split /,/, $ugspec[2]; + for my $addngroup (@addngroups) { + parse_package_metadata_usergroup($src->{makefile}, "group", \%groupnames, \%groupids, $addngroup) or return 0; + } + } } }; } diff --git a/scripts/mkhash.c b/scripts/mkhash.c index ed3d42d4c..a28d5fd53 100644 --- a/scripts/mkhash.c +++ b/scripts/mkhash.c @@ -105,7 +105,6 @@ be32enc(void *buf, uint32_t u) p[2] = ((uint8_t) ((u >> 8) & 0xff)); p[3] = ((uint8_t) (u & 0xff)); } -#endif static void be64enc(void *buf, uint64_t u) @@ -132,6 +131,7 @@ be32dec(const void *buf) return (((uint32_t) be16dec(p)) << 16) | be16dec(p + 2); } +#endif #define MD5_DIGEST_LENGTH 16 diff --git a/scripts/mkits-zyxel-fit.sh b/scripts/mkits-zyxel-fit.sh new file mode 100755 index 000000000..8ace1941e --- /dev/null +++ b/scripts/mkits-zyxel-fit.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# +# Licensed under the terms of the GNU GPL License version 2 or later. +# Author: David Bauer , based on mkits-zyxel-factory.sh. + +usage() { + echo "Usage: `basename $0` output file compat-models" + exit 1 +} + +# We need at least 3 arguments +[ "$#" -lt 3 ] && usage + +# Target output file +OUTPUT="$1"; shift +FILE="$1"; shift +MODELS="$1"; shift + +# Create a default, fully populated DTS file +echo "\ +/dts-v1/; + +/ { + description = \"Zyxel FIT (Flattened Image Tree)\"; + compat-models = [${MODELS}]; + #address-cells = <1>; + + images { + firmware { + data = /incbin/(\"${FILE}\"); + type = \"firmware\"; + compression = \"none\"; + hash@1 { + algo = \"sha1\"; + }; + }; + }; +};" > ${OUTPUT} diff --git a/scripts/mkits.sh b/scripts/mkits.sh index 1add8087b..7bf5681ad 100755 --- a/scripts/mkits.sh +++ b/scripts/mkits.sh @@ -32,12 +32,14 @@ usage() { printf "\n\t-d ==> include Device Tree Blob 'dtb'" printf "\n\t-r ==> include RootFS blob 'rootfs'" printf "\n\t-H ==> specify hash algo instead of SHA1" + printf "\n\t-l ==> legacy mode character (@ etc otherwise -)" printf "\n\t-o ==> create output file 'its_file'" printf "\n\t-O ==> create config with dt overlay 'name:dtb'" printf "\n\t\t(can be specified more than once)\n" exit 1 } +REFERENCE_CHAR='-' FDTNUM=1 ROOTFSNUM=1 INITRDNUM=1 @@ -46,7 +48,7 @@ LOADABLES= DTOVERLAY= DTADDR= -while getopts ":A:a:c:C:D:d:e:f:i:k:n:o:O:v:r:H:" OPTION +while getopts ":A:a:c:C:D:d:e:f:i:k:l:n:o:O:v:r:H:" OPTION do case $OPTION in A ) ARCH=$OPTARG;; @@ -59,6 +61,7 @@ do f ) COMPATIBLE=$OPTARG;; i ) INITRD=$OPTARG;; k ) KERNEL=$OPTARG;; + l ) REFERENCE_CHAR=$OPTARG;; n ) FDTNUM=$OPTARG;; o ) OUTPUT=$OPTARG;; O ) DTOVERLAY="$DTOVERLAY ${OPTARG}";; @@ -91,7 +94,7 @@ fi # Conditionally create fdt information if [ -n "${DTB}" ]; then FDT_NODE=" - fdt-$FDTNUM { + fdt${REFERENCE_CHAR}$FDTNUM { description = \"${ARCH_UPPER} OpenWrt ${DEVICE} device tree blob\"; ${COMPATIBLE_PROP} data = /incbin/(\"${DTB}\"); @@ -107,12 +110,12 @@ if [ -n "${DTB}" ]; then }; }; " - FDT_PROP="fdt = \"fdt-$FDTNUM\";" + FDT_PROP="fdt = \"fdt${REFERENCE_CHAR}$FDTNUM\";" fi if [ -n "${INITRD}" ]; then INITRD_NODE=" - initrd-$INITRDNUM { + initrd${REFERENCE_CHAR}$INITRDNUM { description = \"${ARCH_UPPER} OpenWrt ${DEVICE} initrd\"; ${COMPATIBLE_PROP} data = /incbin/(\"${INITRD}\"); @@ -127,14 +130,14 @@ if [ -n "${INITRD}" ]; then }; }; " - INITRD_PROP="ramdisk=\"initrd-${INITRDNUM}\";" + INITRD_PROP="ramdisk=\"initrd${REFERENCE_CHAR}${INITRDNUM}\";" fi if [ -n "${ROOTFS}" ]; then dd if="${ROOTFS}" of="${ROOTFS}.pagesync" bs=4096 conv=sync ROOTFS_NODE=" - rootfs-$ROOTFSNUM { + rootfs${REFERENCE_CHAR}$ROOTFSNUM { description = \"${ARCH_UPPER} OpenWrt ${DEVICE} rootfs\"; ${COMPATIBLE_PROP} data = /incbin/(\"${ROOTFS}.pagesync\"); @@ -149,7 +152,7 @@ if [ -n "${ROOTFS}" ]; then }; }; " - LOADABLES="${LOADABLES:+$LOADABLES, }\"rootfs-${ROOTFSNUM}\"" + LOADABLES="${LOADABLES:+$LOADABLES, }\"rootfs${REFERENCE_CHAR}${ROOTFSNUM}\"" fi # add DT overlay blobs @@ -184,8 +187,8 @@ OVCONFIGS="" config-$ovname { description = \"OpenWrt ${DEVICE} with $ovname\"; - kernel = \"kernel-1\"; - fdt = \"fdt-$FDTNUM\", \"$ovnode\"; + kernel = \"kernel${REFERENCE_CHAR}1\"; + fdt = \"fdt${REFERENCE_CHAR}$FDTNUM\", \"$ovnode\"; ${LOADABLES:+loadables = ${LOADABLES};} ${COMPATIBLE_PROP} ${INITRD_PROP} @@ -201,7 +204,7 @@ DATA="/dts-v1/; #address-cells = <1>; images { - kernel-1 { + kernel${REFERENCE_CHAR}1 { description = \"${ARCH_UPPER} OpenWrt Linux-${VERSION}\"; data = /incbin/(\"${KERNEL}\"); type = \"kernel\"; @@ -227,7 +230,7 @@ ${ROOTFS_NODE} default = \"${CONFIG}\"; ${CONFIG} { description = \"OpenWrt ${DEVICE}\"; - kernel = \"kernel-1\"; + kernel = \"kernel${REFERENCE_CHAR}1\"; ${FDT_PROP} ${LOADABLES:+loadables = ${LOADABLES};} ${COMPATIBLE_PROP} diff --git a/scripts/netgear-encrypted-factory.py b/scripts/netgear-encrypted-factory.py new file mode 100755 index 000000000..b6bb72f3b --- /dev/null +++ b/scripts/netgear-encrypted-factory.py @@ -0,0 +1,68 @@ +#!/usr/bin/env python3 + +import argparse +import re +import struct +import subprocess +import zlib + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--input-file', type=str, required=True) + parser.add_argument('--output-file', type=str, required=True) + parser.add_argument('--model', type=str, required=True) + parser.add_argument('--region', type=str, required=True) + parser.add_argument('--version', type=str, required=True) + parser.add_argument('--encryption-block-size', type=str, required=True) + parser.add_argument('--openssl-bin', type=str, required=True) + parser.add_argument('--key', type=str, required=True) + parser.add_argument('--iv', type=str, required=True) + args = parser.parse_args() + + assert re.match(r'V[0-9]\.[0-9]\.[0-9]\.[0-9]', + args.version), 'Version must start with Vx.x.x.x' + encryption_block_size = int(args.encryption_block_size, 0) + assert (encryption_block_size > 0 and encryption_block_size % 16 == + 0), 'Encryption block size must be a multiple of the AES block size (16)' + + image = open(args.input_file, 'rb').read() + image_enc = [] + for i in range(0, len(image), encryption_block_size): + chunk = image[i:i + encryption_block_size] + chunk += b'\x00' * ((-len(chunk)) % 16) # pad to AES block size (16) + res = subprocess.run([ + args.openssl_bin, + 'enc', + '-aes-256-cbc', + '-nosalt', + '-nopad', + '-K', args.key, + '-iv', args.iv + ], + check=True, input=chunk, stdout=subprocess.PIPE) + image_enc.append(res.stdout) + image_enc = b''.join(image_enc) + + image_with_header = struct.pack( + '>32s32s64s64s64s256s12sII', + args.model.encode('ascii'), + args.region.encode('ascii'), + args.version.encode('ascii'), + b'Thu Jan 1 00:00:00 1970', # static date for reproducibility + b'', # reserved + b'', # RSA signature - omitted for now + b'encrpted_img', + len(image_enc), + encryption_block_size, + ) + image_enc + + checksum = zlib.crc32(image_with_header, 0xffffffff) ^ 0xffffffff + + with open(args.output_file, 'wb') as outfile: + outfile.write(image_with_header) + outfile.write(struct.pack('>I', checksum)) + + +if __name__ == "__main__": + main() diff --git a/scripts/package-metadata.pl b/scripts/package-metadata.pl index 02102be8f..6288584d6 100755 --- a/scripts/package-metadata.pl +++ b/scripts/package-metadata.pl @@ -585,6 +585,40 @@ sub gen_usergroup_list() { } } +sub gen_package_manifest_json() { + my $json; + parse_package_metadata($ARGV[0]) or exit 1; + foreach my $name (sort {uc($a) cmp uc($b)} keys %package) { + my %depends; + my $pkg = $package{$name}; + foreach my $dep (@{$pkg->{depends} || []}) { + if ($dep =~ m!^\+?(?:[^:]+:)?([^@]+)$!) { + $depends{$1}++; + } + } + my @depends = sort keys %depends; + my $pkg_deps = join ' ', map { qq/"$_",/ } @depends; + $pkg_deps =~ s/\,$//; + + my $pkg_maintainer = join ' ', map { qq/"$_",/ } @{$pkg->{maintainer} || []}; + $pkg_maintainer =~ s/\,$//; + + $json = <<"END_JSON"; +${json}{ +"name":"$name", +"version":"$pkg->{version}", +"category":"$pkg->{category}", +"license":"$pkg->{license}", +"maintainer": [$pkg_maintainer], +"depends":[$pkg_deps]}, +END_JSON + } + + $json =~ s/[\n\r]//g; + $json =~ s/\,$//; + print "[$json]"; +} + sub parse_command() { GetOptions("ignore=s", \@ignore); my $cmd = shift @ARGV; @@ -594,6 +628,7 @@ sub parse_command() { /^kconfig/ and return gen_kconfig_overrides(); /^source$/ and return gen_package_source(); /^pkgaux$/ and return gen_package_auxiliary(); + /^pkgmanifestjson$/ and return gen_package_manifest_json(); /^license$/ and return gen_package_license(0); /^licensefull$/ and return gen_package_license(1); /^usergroup$/ and return gen_usergroup_list(); @@ -606,6 +641,7 @@ Available Commands: $0 kconfig [file] [config] [patchver] Kernel config overrides $0 source [file] Package source file information $0 pkgaux [file] Package auxiliary variables in makefile format + $0 pkgmanifestjson [file] Package manifests in JSON format $0 license [file] Package license information $0 licensefull [file] Package license information (full list) $0 usergroup [file] Package usergroup allocation list diff --git a/scripts/pad_image b/scripts/pad_image index b1941a28d..871063af3 100755 --- a/scripts/pad_image +++ b/scripts/pad_image @@ -2,7 +2,7 @@ function usage { echo "Usage: prepare_image image_type kernel_image rootfs_image header_size" - echo "Padd root and kernel image to the correct size and append the jffs2 start marker as needed" + echo "Pad root and kernel image to the correct size and append the jffs2 start marker as needed" exit 1 } diff --git a/scripts/rstrip.sh b/scripts/rstrip.sh index 59f8624df..e47960a94 100755 --- a/scripts/rstrip.sh +++ b/scripts/rstrip.sh @@ -27,6 +27,7 @@ find $TARGETS -type f -a -exec file {} \; | \ while read F S; do echo "$SELF: $F: $S" [ "${S}" = "relocatable" ] && { + [ "${F##*.}" == "o" ] && continue eval "$STRIP_KMOD $F" } || { b=$(stat -c '%a' $F) diff --git a/scripts/sercomm-kernel-header.py b/scripts/sercomm-kernel-header.py new file mode 100755 index 000000000..bfb29c6fe --- /dev/null +++ b/scripts/sercomm-kernel-header.py @@ -0,0 +1,121 @@ +#!/usr/bin/env python3 +""" +# SPDX-License-Identifier: GPL-2.0-or-later +# +# sercomm-kernel-header.py: Creates Sercomm kernel header +# +# Copyright © 2022 Mikhail Zhilkin +""" + +import argparse +import binascii +import os +import struct + +KERNEL_HEADER_SIZE = 0x100 +PADDING = 0xff +ROOTFS_FAKE_HEADER = "UBI#" + +def auto_int(x): + return int(x, 0) + +def create_kernel_header(args): + out_file = open(args.header_file, "wb") + header = get_kernel_header(args) + out_file.write(header) + out_file.close() + +def get_kernel_header(args): + header = bytearray([PADDING] * KERNEL_HEADER_SIZE) + + struct.pack_into(' -# -### -### sercomm-kernel.sh - calculates and appends a special kernel header. -### Intended for some Sercomm devices (e.g., Beeline -### SmartBox GIGA, Beeline SmartBox Turbo+, Sercomm -### S3). -# -# Credits to @kar200 for the header description. More details are here: -# https://forum.openwrt.org/t/add-support-for-sercomm-s3-on-stock-uboot -# -if [ $# -ne 3 ]; then - echo "SYNTAX: $0 " - exit 1 -fi - -FILE_TMP=$1.shdr -KERNEL_IMG=$1 -KERNEL_OFFSET=$2 -ROOTFS_OFFSET=$3 - -# Sercomm HDR (0x53657200), 0xffffffff for hdr crc32 calc -hdr_sign_offs=0x0 -hdr_sign_val=0x53657200 -# Absoulte lenght for Sercomm footer -hdr_footer_size_offs=0x4 -hdr_footer_size_val= -# Header checksum. 0xffffffff for hdr crc32 calc -hdr_head_chksum_offs=0x8 -hdr_head_chksum_val= -# Magic constant (0x2ffffff) -hdr_int04_offs=0xc -hdr_int04_val=0x2ffffff -# Kernel flash offset -hdr_kern_offs_offs=0x10 -hdr_kern_offs_val=$KERNEL_OFFSET -# Kernel lenght -hdr_kern_len_offs=0x14 -hdr_kern_len_val= -# Kernel checksum -hdr_kern_chksum_offs=0x18 -hdr_kern_chksum_val= -# Magic constant (0x0) -hdr_int08_offs=0x1c -hdr_int08_val=0x0 -# Rootfs flash offset -hdr_rootfs_offs_offs=0x28 -hdr_rootfs_offs_val=$ROOTFS_OFFSET -# Rootfs flash lenght. We're checking only first 4 bytes -hdr_rootfs_len_offs=0x2c -hdr_rootfs_len_val=0x4 -# Rootfs checksum. Checksum is a constant for UBI (first 4 bytes) -hdr_rootfs_chksum_offs=0x30 -hdr_rootfs_chksum_val=0x1cfc552d -# Magic constant (0x0) -hdr_int10_offs=0x34 -hdr_int10_val=0x0 - -pad_zeros () { - awk '{ printf "%8s\n", $0 }' | sed 's/ /0/g' -} - -# Remove leading 0x -trim_hx () { - printf "%x\n" $1 | pad_zeros -} - -# Change endian -swap_hx () { - pad_zeros | awk '{for (i=7;i>=1;i=i-2) printf "%s%s", \ - substr($1,i,2), (i>1?"":"\n")}' -} - -# Check file size -fsize () { - printf "%x\n" `stat -c "%s" $1` -} - -# Calculate checksum -chksum () { - dd if=$1 2>/dev/null | gzip -c | tail -c 8 | od -An -tx4 -N4 \ - --endian=big | tr -d ' \n' | pad_zeros -} - -# Write 4 bytes in the header by offset -write_hdr () { - echo -ne "$(echo $1 | sed 's/../\\x&/g')" | dd of=$FILE_TMP bs=1 \ - seek=$(($2)) count=4 conv=notrunc status=none 2>/dev/null -} - -# Pad a new header with 0xff -dd if=/dev/zero ibs=1 count=256 status=none | tr "\000" "\377" > \ - $FILE_TMP 2>/dev/null - -# Write constants -write_hdr $(trim_hx $hdr_int04_val) $hdr_int04_offs -write_hdr $(trim_hx $hdr_int08_val) $hdr_int08_offs -write_hdr $(trim_hx $hdr_int10_val) $hdr_int10_offs -# Write footer data -hdr_footer_size_val=$(($hdr_rootfs_offs_val + $hdr_rootfs_len_val)) -write_hdr $(trim_hx $hdr_footer_size_val | swap_hx) $hdr_footer_size_offs -# Write kernel data -write_hdr $(trim_hx $hdr_kern_offs_val | swap_hx) $hdr_kern_offs_offs -hdr_kern_len_val=$(fsize $KERNEL_IMG | pad_zeros) -write_hdr $(echo $hdr_kern_len_val | swap_hx) $hdr_kern_len_offs -hdr_kern_chksum_val=$(chksum $KERNEL_IMG) -write_hdr $hdr_kern_chksum_val $hdr_kern_chksum_offs -# Write rootfs data -write_hdr $(trim_hx $hdr_rootfs_offs_val | swap_hx) $hdr_rootfs_offs_offs -write_hdr $(trim_hx $hdr_rootfs_len_val | swap_hx) $hdr_rootfs_len_offs -write_hdr $(trim_hx $hdr_rootfs_chksum_val) $hdr_rootfs_chksum_offs -# Write header checksum -hdr_head_chksum_val=$(chksum $FILE_TMP) -write_hdr $hdr_head_chksum_val $hdr_head_chksum_offs -# Place Sercomm signature -write_hdr $(trim_hx $hdr_sign_val) $hdr_sign_offs - -dd if=$KERNEL_IMG >> $FILE_TMP -mv $FILE_TMP $KERNEL_IMG diff --git a/scripts/sercomm-pid.py b/scripts/sercomm-pid.py new file mode 100755 index 000000000..b89977a5b --- /dev/null +++ b/scripts/sercomm-pid.py @@ -0,0 +1,102 @@ +#!/usr/bin/env python3 +""" +# SPDX-License-Identifier: GPL-2.0-or-later +# +# sercomm-pid.py: Creates Sercomm device PID +# +# Copyright © 2022 Mikhail Zhilkin +""" + +import argparse +import binascii +import struct + +PID_SIZE = 0x70 +PADDING = 0x30 +PADDING_TAIL = 0x0 + +def auto_int(x): + return int(x, 0) + +def create_pid_file(args): + pid_file = open(args.pid_file, "wb") + buf = get_pid(args) + pid_file.write(buf) + pid_file.close() + +def get_pid(args): + buf = bytearray([PADDING] * PID_SIZE) + + enc = args.hw_version.rjust(8, '0').encode('ascii') + struct.pack_into('>8s', buf, 0x0, enc) + + enc = binascii.hexlify(args.hw_id.encode()) + struct.pack_into('>6s', buf, 0x8, enc) + + enc = args.sw_version.rjust(4, '0').encode('ascii') + struct.pack_into('>4s', buf, 0x64, enc) + + if (args.extra_padd_size): + tail = bytearray([PADDING_TAIL] * args.extra_padd_size) + if (args.extra_padd_byte): + struct.pack_into ('{'name'}, $filename); } - # If the next parition is before the end of the current image, then rewind. + # If the next partition is before the end of the current image, then rewind. elsif ($_->{'offset'} < $end_point) { $debug and printf("Rewound %s before <%s> in \"%s\"\n", (($end_point - $_->{'offset'}) >= $block_size ? @@ -971,7 +971,7 @@ if (!GetOptions("d|debug" => \$debug, print " [-b|--redboot] Input/Output RedBoot filename\n"; print " [-s|--sysconf] Input/Output SysConf filename\n"; print " [-L|--loader] Second stage boot loader filename\n"; - print " [-k|--kernel] Input/Ouptut Kernel filename\n"; + print " [-k|--kernel] Input/Output Kernel filename\n"; print " [-r|--ramdisk] Input/Output Ramdisk filename(s)\n"; print " [-f|--fisdir] Input/Output FIS directory filename\n"; print " [-m|--microcode] Input/Output Microcode filename\n"; diff --git a/scripts/target-metadata.pl b/scripts/target-metadata.pl index 91a201c5e..e1d4ef242 100755 --- a/scripts/target-metadata.pl +++ b/scripts/target-metadata.pl @@ -10,43 +10,44 @@ sub target_config_features(@) { while ($_ = shift @_) { /^arm_v(\w+)$/ and $ret .= "\tselect arm_v$1\n"; - /^broken$/ and $ret .= "\tdepends on BROKEN\n"; /^audio$/ and $ret .= "\tselect AUDIO_SUPPORT\n"; + /^boot-part$/ and $ret .= "\tselect USES_BOOT_PART\n"; + /^broken$/ and $ret .= "\tdepends on BROKEN\n"; + /^cpiogz$/ and $ret .= "\tselect USES_CPIOGZ\n"; /^display$/ and $ret .= "\tselect DISPLAY_SUPPORT\n"; /^dt$/ and $ret .= "\tselect USES_DEVICETREE\n"; - /^gpio$/ and $ret .= "\tselect GPIO_SUPPORT\n"; - /^pci$/ and $ret .= "\tselect PCI_SUPPORT\n"; - /^pcie$/ and $ret .= "\tselect PCIE_SUPPORT\n"; - /^usb$/ and $ret .= "\tselect USB_SUPPORT\n"; - /^usbgadget$/ and $ret .= "\tselect USB_GADGET_SUPPORT\n"; - /^pcmcia$/ and $ret .= "\tselect PCMCIA_SUPPORT\n"; - /^pwm$/ and $ret .= "\select PWM_SUPPORT\n"; - /^rtc$/ and $ret .= "\tselect RTC_SUPPORT\n"; - /^squashfs$/ and $ret .= "\tselect USES_SQUASHFS\n"; + /^dt-overlay$/ and $ret .= "\tselect HAS_DT_OVERLAY_SUPPORT\n"; /^emmc$/ and $ret .= "\tselect EMMC_SUPPORT\n"; + /^ext4$/ and $ret .= "\tselect USES_EXT4\n"; + /^fpu$/ and $ret .= "\tselect HAS_FPU\n"; + /^gpio$/ and $ret .= "\tselect GPIO_SUPPORT\n"; /^jffs2$/ and $ret .= "\tselect USES_JFFS2\n"; /^jffs2_nand$/ and $ret .= "\tselect USES_JFFS2_NAND\n"; - /^ext4$/ and $ret .= "\tselect USES_EXT4\n"; - /^targz$/ and $ret .= "\tselect USES_TARGZ\n"; - /^cpiogz$/ and $ret .= "\tselect USES_CPIOGZ\n"; - /^minor$/ and $ret .= "\tselect USES_MINOR\n"; - /^ubifs$/ and $ret .= "\tselect USES_UBIFS\n"; - /^fpu$/ and $ret .= "\tselect HAS_FPU\n"; - /^spe_fpu$/ and $ret .= "\tselect HAS_SPE_FPU\n"; - /^ramdisk$/ and $ret .= "\tselect USES_INITRAMFS\n"; - /^separate_ramdisk$/ and $ret .= "\tselect USES_INITRAMFS\n\tselect USES_SEPARATE_INITRAMFS\n"; - /^powerpc64$/ and $ret .= "\tselect powerpc64\n"; - /^nommu$/ and $ret .= "\tselect NOMMU\n"; - /^mips16$/ and $ret .= "\tselect HAS_MIPS16\n"; - /^rfkill$/ and $ret .= "\tselect RFKILL_SUPPORT\n"; + /^legacy-sdcard$/ and $ret .= "\tselect LEGACY_SDCARD_SUPPORT\n"; /^low_mem$/ and $ret .= "\tselect LOW_MEMORY_FOOTPRINT\n"; - /^small_flash$/ and $ret .= "\tselect SMALL_FLASH\n"; + /^minor$/ and $ret .= "\tselect USES_MINOR\n"; + /^mips16$/ and $ret .= "\tselect HAS_MIPS16\n"; /^nand$/ and $ret .= "\tselect NAND_SUPPORT\n"; - /^virtio$/ and $ret .= "\tselect VIRTIO_SUPPORT\n"; + /^nommu$/ and $ret .= "\tselect NOMMU\n"; + /^pci$/ and $ret .= "\tselect PCI_SUPPORT\n"; + /^pcie$/ and $ret .= "\tselect PCIE_SUPPORT\n"; + /^pcmcia$/ and $ret .= "\tselect PCMCIA_SUPPORT\n"; + /^powerpc64$/ and $ret .= "\tselect powerpc64\n"; + /^pwm$/ and $ret .= "\select PWM_SUPPORT\n"; + /^ramdisk$/ and $ret .= "\tselect USES_INITRAMFS\n"; + /^rfkill$/ and $ret .= "\tselect RFKILL_SUPPORT\n"; /^rootfs-part$/ and $ret .= "\tselect USES_ROOTFS_PART\n"; - /^boot-part$/ and $ret .= "\tselect USES_BOOT_PART\n"; + /^rtc$/ and $ret .= "\tselect RTC_SUPPORT\n"; + /^separate_ramdisk$/ and $ret .= "\tselect USES_INITRAMFS\n\tselect USES_SEPARATE_INITRAMFS\n"; + /^small_flash$/ and $ret .= "\tselect SMALL_FLASH\n"; + /^spe_fpu$/ and $ret .= "\tselect HAS_SPE_FPU\n"; + /^squashfs$/ and $ret .= "\tselect USES_SQUASHFS\n"; + /^targz$/ and $ret .= "\tselect USES_TARGZ\n"; /^testing-kernel$/ and $ret .= "\tselect HAS_TESTING_KERNEL\n"; - /^dt-overlay$/ and $ret .= "\tselect HAS_DT_OVERLAY_SUPPORT\n"; + /^ubifs$/ and $ret .= "\tselect USES_UBIFS\n"; + /^usb$/ and $ret .= "\tselect USB_SUPPORT\n"; + /^usbgadget$/ and $ret .= "\tselect USB_GADGET_SUPPORT\n"; + /^virtio$/ and $ret .= "\tselect VIRTIO_SUPPORT\n"; } return $ret; } @@ -178,7 +179,7 @@ EOF print <=] [--kernel kernelimage] rootfs out [ubinize opts]" +if [ ! -r "$rootfs" -a ! -r "$kernel" -a ! "$outfile" ]; then + echo "syntax: $0 [--uboot-env] [--part =] [--kernel kernelimage] [--rootfs rootfsimage] out [ubinize opts]" exit 1 fi -ubinize="$( which ubinize )" +ubinize="$( command -v ubinize )" if [ ! -x "$ubinize" ]; then echo "ubinize tool not found or not usable" exit 1 diff --git a/target/linux/mediatek/image/filogic.mk b/target/linux/mediatek/image/filogic.mk index 6c2decb6f..94c1e210f 100644 --- a/target/linux/mediatek/image/filogic.mk +++ b/target/linux/mediatek/image/filogic.mk @@ -38,6 +38,20 @@ define Build/mt7986-gpt rm $@.tmp endef +define Build/gen-ubi-initramfs + sh $(TOPDIR)/scripts/ubinize-image.sh \ + $(if $(UBOOTENV_IN_UBI),--uboot-env) \ + --kernel $(KDIR)/tmp/$(KERNEL_INITRAMFS_IMAGE) \ + $(foreach part,$(UBINIZE_PARTS),--part $(part)) \ + "$(1).tmp" \ + -p $(BLOCKSIZE:%k=%KiB) -m $(PAGESIZE) \ + $(if $(SUBPAGESIZE),-s $(SUBPAGESIZE)) \ + $(if $(VID_HDR_OFFSET),-O $(VID_HDR_OFFSET)) \ + $(UBINIZE_OPTS) && \ + cat "$(1).tmp" > "$(1)" && rm "$(1).tmp" && \ + $(CP) "$(1)" $(BIN_DIR)/ +endef + define Device/bananapi_bpi-r3 DEVICE_VENDOR := Bananapi DEVICE_MODEL := BPi-R3 @@ -133,6 +147,9 @@ define Device/xiaomi_redmi-router-ax6000 BLOCKSIZE := 128k PAGESIZE := 2048 KERNEL_IN_UBI := 1 + KERNEL_INITRAMFS := kernel-bin | lzma | \ + fit lzma $$(KDIR)/image-$$(firstword $$(DEVICE_DTS)).dtb with-initrd | \ + gen-ubi-initramfs $(KDIR)/tmp/$$(KERNEL_INITRAMFS_PREFIX)-factory.ubi IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata endef TARGET_DEVICES += xiaomi_redmi-router-ax6000