diff options
54 files changed, 4485 insertions, 3888 deletions
diff --git a/.gitignore b/.gitignore index 5014bfa48ac1..a4b576eb9c00 100644 --- a/.gitignore +++ b/.gitignore | |||
| @@ -23,6 +23,7 @@ Module.symvers | |||
| 23 | # Generated include files | 23 | # Generated include files |
| 24 | # | 24 | # |
| 25 | include/asm | 25 | include/asm |
| 26 | include/asm-*/asm-offsets.h | ||
| 26 | include/config | 27 | include/config |
| 27 | include/linux/autoconf.h | 28 | include/linux/autoconf.h |
| 28 | include/linux/compile.h | 29 | include/linux/compile.h |
diff --git a/Documentation/kbuild/modules.txt b/Documentation/kbuild/modules.txt index c91caf7eb303..1c0db652b366 100644 --- a/Documentation/kbuild/modules.txt +++ b/Documentation/kbuild/modules.txt | |||
| @@ -38,7 +38,7 @@ included in the kernel tree. | |||
| 38 | What is covered within this file is mainly information to authors | 38 | What is covered within this file is mainly information to authors |
| 39 | of modules. The author of an external modules should supply | 39 | of modules. The author of an external modules should supply |
| 40 | a makefile that hides most of the complexity so one only has to type | 40 | a makefile that hides most of the complexity so one only has to type |
| 41 | 'make' to buld the module. A complete example will be present in | 41 | 'make' to build the module. A complete example will be present in |
| 42 | chapter ¤. Creating a kbuild file for an external module". | 42 | chapter ¤. Creating a kbuild file for an external module". |
| 43 | 43 | ||
| 44 | 44 | ||
| @@ -69,7 +69,7 @@ when building an external module. | |||
| 69 | 69 | ||
| 70 | --- 2.2 Available targets | 70 | --- 2.2 Available targets |
| 71 | 71 | ||
| 72 | $KDIR refers to path to kernel source top-level directory | 72 | $KDIR refers to the path to the kernel source top-level directory |
| 73 | 73 | ||
| 74 | make -C $KDIR M=`pwd` | 74 | make -C $KDIR M=`pwd` |
| 75 | Will build the module(s) located in current directory. | 75 | Will build the module(s) located in current directory. |
| @@ -87,11 +87,11 @@ when building an external module. | |||
| 87 | make -C $KDIR M=$PWD modules_install | 87 | make -C $KDIR M=$PWD modules_install |
| 88 | Install the external module(s). | 88 | Install the external module(s). |
| 89 | Installation default is in /lib/modules/<kernel-version>/extra, | 89 | Installation default is in /lib/modules/<kernel-version>/extra, |
| 90 | but may be prefixed with INSTALL_MOD_PATH - see separate chater. | 90 | but may be prefixed with INSTALL_MOD_PATH - see separate chapter. |
| 91 | 91 | ||
| 92 | make -C $KDIR M=$PWD clean | 92 | make -C $KDIR M=$PWD clean |
| 93 | Remove all generated files for the module - the kernel | 93 | Remove all generated files for the module - the kernel |
| 94 | source directory is not moddified. | 94 | source directory is not modified. |
| 95 | 95 | ||
| 96 | make -C $KDIR M=`pwd` help | 96 | make -C $KDIR M=`pwd` help |
| 97 | help will list the available target when building external | 97 | help will list the available target when building external |
| @@ -99,7 +99,7 @@ when building an external module. | |||
| 99 | 99 | ||
| 100 | --- 2.3 Available options: | 100 | --- 2.3 Available options: |
| 101 | 101 | ||
| 102 | $KDIR refer to path to kernel src | 102 | $KDIR refers to the path to the kernel source top-level directory |
| 103 | 103 | ||
| 104 | make -C $KDIR | 104 | make -C $KDIR |
| 105 | Used to specify where to find the kernel source. | 105 | Used to specify where to find the kernel source. |
| @@ -206,11 +206,11 @@ following files: | |||
| 206 | 206 | ||
| 207 | KERNELDIR := /lib/modules/`uname -r`/build | 207 | KERNELDIR := /lib/modules/`uname -r`/build |
| 208 | all:: | 208 | all:: |
| 209 | $(MAKE) -C $KERNELDIR M=`pwd` $@ | 209 | $(MAKE) -C $(KERNELDIR) M=`pwd` $@ |
| 210 | 210 | ||
| 211 | # Module specific targets | 211 | # Module specific targets |
| 212 | genbin: | 212 | genbin: |
| 213 | echo "X" > 8123_bini.o_shipped | 213 | echo "X" > 8123_bin.o_shipped |
| 214 | 214 | ||
| 215 | endif | 215 | endif |
| 216 | 216 | ||
| @@ -341,13 +341,13 @@ directory and therefore needs to deal with this in their kbuild file. | |||
| 341 | EXTRA_CFLAGS := -Iinclude | 341 | EXTRA_CFLAGS := -Iinclude |
| 342 | 8123-y := 8123_if.o 8123_pci.o 8123_bin.o | 342 | 8123-y := 8123_if.o 8123_pci.o 8123_bin.o |
| 343 | 343 | ||
| 344 | Note that in the assingment there is no space between -I and the path. | 344 | Note that in the assignment there is no space between -I and the path. |
| 345 | This is a kbuild limitation and no space must be present. | 345 | This is a kbuild limitation: there must be no space present. |
| 346 | 346 | ||
| 347 | 347 | ||
| 348 | === 6. Module installation | 348 | === 6. Module installation |
| 349 | 349 | ||
| 350 | Modules which are included in the kernel is installed in the directory: | 350 | Modules which are included in the kernel are installed in the directory: |
| 351 | 351 | ||
| 352 | /lib/modules/$(KERNELRELEASE)/kernel | 352 | /lib/modules/$(KERNELRELEASE)/kernel |
| 353 | 353 | ||
| @@ -365,7 +365,7 @@ External modules are installed in the directory: | |||
| 365 | => Install dir: /frodo/lib/modules/$(KERNELRELEASE)/kernel | 365 | => Install dir: /frodo/lib/modules/$(KERNELRELEASE)/kernel |
| 366 | 366 | ||
| 367 | INSTALL_MOD_PATH may be set as an ordinary shell variable or as in the | 367 | INSTALL_MOD_PATH may be set as an ordinary shell variable or as in the |
| 368 | example above be specified on the commandline when calling make. | 368 | example above be specified on the command line when calling make. |
| 369 | INSTALL_MOD_PATH has effect both when installing modules included in | 369 | INSTALL_MOD_PATH has effect both when installing modules included in |
| 370 | the kernel as well as when installing external modules. | 370 | the kernel as well as when installing external modules. |
| 371 | 371 | ||
| @@ -384,7 +384,7 @@ External modules are installed in the directory: | |||
| 384 | 384 | ||
| 385 | === 7. Module versioning | 385 | === 7. Module versioning |
| 386 | 386 | ||
| 387 | Module versioning are enabled by the CONFIG_MODVERSIONS tag. | 387 | Module versioning is enabled by the CONFIG_MODVERSIONS tag. |
| 388 | 388 | ||
| 389 | Module versioning is used as a simple ABI consistency check. The Module | 389 | Module versioning is used as a simple ABI consistency check. The Module |
| 390 | versioning creates a CRC value of the full prototype for an exported symbol and | 390 | versioning creates a CRC value of the full prototype for an exported symbol and |
| @@ -286,10 +286,6 @@ export quiet Q KBUILD_VERBOSE | |||
| 286 | cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ | 286 | cc-option = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ |
| 287 | > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) | 287 | > /dev/null 2>&1; then echo "$(1)"; else echo "$(2)"; fi ;) |
| 288 | 288 | ||
| 289 | # For backward compatibility | ||
| 290 | check_gcc = $(warning check_gcc is deprecated - use cc-option) \ | ||
| 291 | $(call cc-option, $(1),$(2)) | ||
| 292 | |||
| 293 | # cc-option-yn | 289 | # cc-option-yn |
| 294 | # Usage: flag := $(call cc-option-yn, -march=winchip-c6) | 290 | # Usage: flag := $(call cc-option-yn, -march=winchip-c6) |
| 295 | cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ | 291 | cc-option-yn = $(shell if $(CC) $(CFLAGS) $(1) -S -o /dev/null -xc /dev/null \ |
| @@ -481,18 +477,20 @@ ifeq ($(dot-config),1) | |||
| 481 | 477 | ||
| 482 | # Read in dependencies to all Kconfig* files, make sure to run | 478 | # Read in dependencies to all Kconfig* files, make sure to run |
| 483 | # oldconfig if changes are detected. | 479 | # oldconfig if changes are detected. |
| 484 | -include .config.cmd | 480 | -include .kconfig.d |
| 485 | 481 | ||
| 486 | include .config | 482 | include .config |
| 487 | 483 | ||
| 488 | # If .config needs to be updated, it will be done via the dependency | 484 | # If .config needs to be updated, it will be done via the dependency |
| 489 | # that autoconf has on .config. | 485 | # that autoconf has on .config. |
| 490 | # To avoid any implicit rule to kick in, define an empty command | 486 | # To avoid any implicit rule to kick in, define an empty command |
| 491 | .config: ; | 487 | .config .kconfig.d: ; |
| 492 | 488 | ||
| 493 | # If .config is newer than include/linux/autoconf.h, someone tinkered | 489 | # If .config is newer than include/linux/autoconf.h, someone tinkered |
| 494 | # with it and forgot to run make oldconfig | 490 | # with it and forgot to run make oldconfig. |
| 495 | include/linux/autoconf.h: .config | 491 | # If kconfig.d is missing then we are probarly in a cleaned tree so |
| 492 | # we execute the config step to be sure to catch updated Kconfig files | ||
| 493 | include/linux/autoconf.h: .kconfig.d .config | ||
| 496 | $(Q)mkdir -p include/linux | 494 | $(Q)mkdir -p include/linux |
| 497 | $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig | 495 | $(Q)$(MAKE) -f $(srctree)/Makefile silentoldconfig |
| 498 | else | 496 | else |
| @@ -1066,7 +1064,7 @@ help: | |||
| 1066 | @echo ' all - Build all targets marked with [*]' | 1064 | @echo ' all - Build all targets marked with [*]' |
| 1067 | @echo '* vmlinux - Build the bare kernel' | 1065 | @echo '* vmlinux - Build the bare kernel' |
| 1068 | @echo '* modules - Build all modules' | 1066 | @echo '* modules - Build all modules' |
| 1069 | @echo ' modules_install - Install all modules' | 1067 | @echo ' modules_install - Install all modules to INSTALL_MOD_PATH (default: /)' |
| 1070 | @echo ' dir/ - Build all files in dir and below' | 1068 | @echo ' dir/ - Build all files in dir and below' |
| 1071 | @echo ' dir/file.[ois] - Build specified target only' | 1069 | @echo ' dir/file.[ois] - Build specified target only' |
| 1072 | @echo ' dir/file.ko - Build module including final link' | 1070 | @echo ' dir/file.ko - Build module including final link' |
| @@ -1240,8 +1238,11 @@ cscope: FORCE | |||
| 1240 | quiet_cmd_TAGS = MAKE $@ | 1238 | quiet_cmd_TAGS = MAKE $@ |
| 1241 | define cmd_TAGS | 1239 | define cmd_TAGS |
| 1242 | rm -f $@; \ | 1240 | rm -f $@; \ |
| 1243 | ETAGSF=`etags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_GPL --extra=+f"`; \ | 1241 | ETAGSF=`etags --version | grep -i exuberant >/dev/null && \ |
| 1244 | $(all-sources) | xargs etags $$ETAGSF -a | 1242 | echo "-I __initdata,__exitdata,__acquires,__releases \ |
| 1243 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ | ||
| 1244 | --extra=+f --c-kinds=+px"`; \ | ||
| 1245 | $(all-sources) | xargs etags $$ETAGSF -a | ||
| 1245 | endef | 1246 | endef |
| 1246 | 1247 | ||
| 1247 | TAGS: FORCE | 1248 | TAGS: FORCE |
| @@ -1251,8 +1252,11 @@ TAGS: FORCE | |||
| 1251 | quiet_cmd_tags = MAKE $@ | 1252 | quiet_cmd_tags = MAKE $@ |
| 1252 | define cmd_tags | 1253 | define cmd_tags |
| 1253 | rm -f $@; \ | 1254 | rm -f $@; \ |
| 1254 | CTAGSF=`ctags --version | grep -i exuberant >/dev/null && echo "-I __initdata,__exitdata,EXPORT_SYMBOL,EXPORT_SYMBOL_GPL --extra=+f"`; \ | 1255 | CTAGSF=`ctags --version | grep -i exuberant >/dev/null && \ |
| 1255 | $(all-sources) | xargs ctags $$CTAGSF -a | 1256 | echo "-I __initdata,__exitdata,__acquires,__releases \ |
| 1257 | -I EXPORT_SYMBOL,EXPORT_SYMBOL_GPL \ | ||
| 1258 | --extra=+f --c-kinds=+px"`; \ | ||
| 1259 | $(all-sources) | xargs ctags $$CTAGSF -a | ||
| 1256 | endef | 1260 | endef |
| 1257 | 1261 | ||
| 1258 | tags: FORCE | 1262 | tags: FORCE |
diff --git a/arch/x86_64/boot/.gitignore b/arch/x86_64/boot/.gitignore new file mode 100644 index 000000000000..495f20c085de --- /dev/null +++ b/arch/x86_64/boot/.gitignore | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | bootsect | ||
| 2 | bzImage | ||
| 3 | setup | ||
diff --git a/arch/x86_64/boot/tools/.gitignore b/arch/x86_64/boot/tools/.gitignore new file mode 100644 index 000000000000..378eac25d311 --- /dev/null +++ b/arch/x86_64/boot/tools/.gitignore | |||
| @@ -0,0 +1 @@ | |||
| build | |||
diff --git a/arch/x86_64/ia32/.gitignore b/arch/x86_64/ia32/.gitignore new file mode 100644 index 000000000000..48ab174fe5f1 --- /dev/null +++ b/arch/x86_64/ia32/.gitignore | |||
| @@ -0,0 +1 @@ | |||
| vsyscall*.so | |||
diff --git a/drivers/char/.gitignore b/drivers/char/.gitignore index 2b6b1d772ed7..73dfdcebfbba 100644 --- a/drivers/char/.gitignore +++ b/drivers/char/.gitignore | |||
| @@ -1,3 +1,3 @@ | |||
| 1 | consolemap_deftbl.c | 1 | consolemap_deftbl.c |
| 2 | defkeymap.c | 2 | defkeymap.c |
| 3 | 3 | qtronixmap.c | |
diff --git a/drivers/ieee1394/.gitignore b/drivers/ieee1394/.gitignore new file mode 100644 index 000000000000..33da10a25323 --- /dev/null +++ b/drivers/ieee1394/.gitignore | |||
| @@ -0,0 +1 @@ | |||
| oui.c | |||
diff --git a/drivers/md/.gitignore b/drivers/md/.gitignore new file mode 100644 index 000000000000..a7afec6b19c6 --- /dev/null +++ b/drivers/md/.gitignore | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | mktables | ||
| 2 | raid6altivec*.c | ||
| 3 | raid6int*.c | ||
| 4 | raid6tables.c | ||
diff --git a/drivers/net/wan/.gitignore b/drivers/net/wan/.gitignore new file mode 100644 index 000000000000..dae3ea6bb18c --- /dev/null +++ b/drivers/net/wan/.gitignore | |||
| @@ -0,0 +1 @@ | |||
| wanxlfw.inc | |||
diff --git a/drivers/scsi/.gitignore b/drivers/scsi/.gitignore new file mode 100644 index 000000000000..b385af314356 --- /dev/null +++ b/drivers/scsi/.gitignore | |||
| @@ -0,0 +1,3 @@ | |||
| 1 | 53c700_d.h | ||
| 2 | 53c7xx_d.h | ||
| 3 | 53c7xx_u.h | ||
diff --git a/drivers/scsi/aic7xxx/.gitignore b/drivers/scsi/aic7xxx/.gitignore new file mode 100644 index 000000000000..b8ee24d5748a --- /dev/null +++ b/drivers/scsi/aic7xxx/.gitignore | |||
| @@ -0,0 +1,6 @@ | |||
| 1 | aic79xx_reg.h | ||
| 2 | aic79xx_reg_print.c | ||
| 3 | aic79xx_seq.h | ||
| 4 | aic7xxx_reg.h | ||
| 5 | aic7xxx_reg_print.c | ||
| 6 | aic7xxx_seq.h | ||
diff --git a/include/asm-mips/.gitignore b/include/asm-mips/.gitignore deleted file mode 100644 index 4ec57ad5bc3c..000000000000 --- a/include/asm-mips/.gitignore +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | asm_offsets.h | ||
diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 0e9682c9def5..799be6747944 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h | |||
| @@ -59,8 +59,7 @@ | |||
| 59 | /* | 59 | /* |
| 60 | * Must define these before including other files, inline functions need them | 60 | * Must define these before including other files, inline functions need them |
| 61 | */ | 61 | */ |
| 62 | #define LOCK_SECTION_NAME \ | 62 | #define LOCK_SECTION_NAME ".text.lock."KBUILD_BASENAME |
| 63 | ".text.lock." __stringify(KBUILD_BASENAME) | ||
| 64 | 63 | ||
| 65 | #define LOCK_SECTION_START(extra) \ | 64 | #define LOCK_SECTION_START(extra) \ |
| 66 | ".subsection 1\n\t" \ | 65 | ".subsection 1\n\t" \ |
diff --git a/init/Kconfig b/init/Kconfig index 9fc0759fa942..aa29b797ca2b 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
| @@ -461,8 +461,8 @@ config OBSOLETE_MODPARM | |||
| 461 | If unsure, say Y. | 461 | If unsure, say Y. |
| 462 | 462 | ||
| 463 | config MODVERSIONS | 463 | config MODVERSIONS |
| 464 | bool "Module versioning support (EXPERIMENTAL)" | 464 | bool "Module versioning support" |
| 465 | depends on MODULES && EXPERIMENTAL | 465 | depends on MODULES |
| 466 | help | 466 | help |
| 467 | Usually, you have to use modules compiled with your kernel. | 467 | Usually, you have to use modules compiled with your kernel. |
| 468 | Saying Y here makes it sometimes possible to use modules | 468 | Saying Y here makes it sometimes possible to use modules |
diff --git a/kernel/.gitignore b/kernel/.gitignore new file mode 100644 index 000000000000..f2ab70073bd4 --- /dev/null +++ b/kernel/.gitignore | |||
| @@ -0,0 +1,5 @@ | |||
| 1 | # | ||
| 2 | # Generated files | ||
| 3 | # | ||
| 4 | config_data.h | ||
| 5 | config_data.gz | ||
diff --git a/scripts/.gitignore b/scripts/.gitignore index b46d68bb9e17..a234e524a490 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore | |||
| @@ -1,4 +1,7 @@ | |||
| 1 | # | ||
| 2 | # Generated files | ||
| 3 | # | ||
| 1 | conmakehash | 4 | conmakehash |
| 2 | kallsyms | 5 | kallsyms |
| 3 | pnmtologo | 6 | pnmtologo |
| 4 | 7 | bin2c | |
diff --git a/scripts/Makefile b/scripts/Makefile index 67763eeb8a3e..6f6b48f39f0a 100644 --- a/scripts/Makefile +++ b/scripts/Makefile | |||
| @@ -19,4 +19,4 @@ subdir-$(CONFIG_MODVERSIONS) += genksyms | |||
| 19 | subdir-$(CONFIG_MODULES) += mod | 19 | subdir-$(CONFIG_MODULES) += mod |
| 20 | 20 | ||
| 21 | # Let clean descend into subdirs | 21 | # Let clean descend into subdirs |
| 22 | subdir- += basic lxdialog kconfig package | 22 | subdir- += basic kconfig package |
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 0f81dcfd6909..550798f57da5 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib | |||
| @@ -81,8 +81,10 @@ obj-dirs := $(addprefix $(obj)/,$(obj-dirs)) | |||
| 81 | # Note: It's possible that one object gets potentially linked into more | 81 | # Note: It's possible that one object gets potentially linked into more |
| 82 | # than one module. In that case KBUILD_MODNAME will be set to foo_bar, | 82 | # than one module. In that case KBUILD_MODNAME will be set to foo_bar, |
| 83 | # where foo and bar are the name of the modules. | 83 | # where foo and bar are the name of the modules. |
| 84 | basename_flags = -DKBUILD_BASENAME=$(subst $(comma),_,$(subst -,_,$(*F))) | 84 | name-fix = $(subst $(comma),_,$(subst -,_,$1)) |
| 85 | modname_flags = $(if $(filter 1,$(words $(modname))),-DKBUILD_MODNAME=$(subst $(comma),_,$(subst -,_,$(modname)))) | 85 | basename_flags = -D"KBUILD_BASENAME=KBUILD_STR($(call name-fix,$(*F)))" |
| 86 | modname_flags = $(if $(filter 1,$(words $(modname))),\ | ||
| 87 | -D"KBUILD_MODNAME=KBUILD_STR($(call name-fix,$(modname)))") | ||
| 86 | 88 | ||
| 87 | _c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) | 89 | _c_flags = $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$(*F).o) |
| 88 | _a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) | 90 | _a_flags = $(AFLAGS) $(EXTRA_AFLAGS) $(AFLAGS_$(*F).o) |
| @@ -113,7 +115,7 @@ endif | |||
| 113 | 115 | ||
| 114 | c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ | 116 | c_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ |
| 115 | $(__c_flags) $(modkern_cflags) \ | 117 | $(__c_flags) $(modkern_cflags) \ |
| 116 | $(basename_flags) $(modname_flags) | 118 | -D"KBUILD_STR(s)=\#s" $(basename_flags) $(modname_flags) |
| 117 | 119 | ||
| 118 | a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ | 120 | a_flags = -Wp,-MD,$(depfile) $(NOSTDINC_FLAGS) $(CPPFLAGS) \ |
| 119 | $(__a_flags) $(modkern_aflags) | 121 | $(__a_flags) $(modkern_aflags) |
diff --git a/scripts/basic/fixdep.c b/scripts/basic/fixdep.c index 0b61bea869f7..679124b11e12 100644 --- a/scripts/basic/fixdep.c +++ b/scripts/basic/fixdep.c | |||
| @@ -130,9 +130,22 @@ void usage(void) | |||
| 130 | exit(1); | 130 | exit(1); |
| 131 | } | 131 | } |
| 132 | 132 | ||
| 133 | /* | ||
| 134 | * Print out the commandline prefixed with cmd_<target filename> := | ||
| 135 | * If commandline contains '#' escape with '\' so make to not see | ||
| 136 | * the '#' as a start-of-comment symbol | ||
| 137 | **/ | ||
| 133 | void print_cmdline(void) | 138 | void print_cmdline(void) |
| 134 | { | 139 | { |
| 135 | printf("cmd_%s := %s\n\n", target, cmdline); | 140 | char *p = cmdline; |
| 141 | |||
| 142 | printf("cmd_%s := ", target); | ||
| 143 | for (; *p; p++) { | ||
| 144 | if (*p == '#') | ||
| 145 | printf("\\"); | ||
| 146 | printf("%c", *p); | ||
| 147 | } | ||
| 148 | printf("\n\n"); | ||
| 136 | } | 149 | } |
| 137 | 150 | ||
| 138 | char * str_config = NULL; | 151 | char * str_config = NULL; |
diff --git a/scripts/genksyms/.gitignore b/scripts/genksyms/.gitignore new file mode 100644 index 000000000000..be5cadb1b907 --- /dev/null +++ b/scripts/genksyms/.gitignore | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | keywords.c | ||
| 2 | lex.c | ||
| 3 | parse.[ch] | ||
| 4 | genksyms | ||
diff --git a/scripts/genksyms/keywords.c_shipped b/scripts/genksyms/keywords.c_shipped index eabaf7401cd6..ee4647805c58 100644 --- a/scripts/genksyms/keywords.c_shipped +++ b/scripts/genksyms/keywords.c_shipped | |||
| @@ -1,7 +1,38 @@ | |||
| 1 | /* ANSI-C code produced by gperf version 2.7.2 */ | 1 | /* ANSI-C code produced by gperf version 3.0.1 */ |
| 2 | /* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf */ | 2 | /* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf */ |
| 3 | |||
| 4 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | ||
| 5 | && ('%' == 37) && ('&' == 38) && ('\'' == 39) && ('(' == 40) \ | ||
| 6 | && (')' == 41) && ('*' == 42) && ('+' == 43) && (',' == 44) \ | ||
| 7 | && ('-' == 45) && ('.' == 46) && ('/' == 47) && ('0' == 48) \ | ||
| 8 | && ('1' == 49) && ('2' == 50) && ('3' == 51) && ('4' == 52) \ | ||
| 9 | && ('5' == 53) && ('6' == 54) && ('7' == 55) && ('8' == 56) \ | ||
| 10 | && ('9' == 57) && (':' == 58) && (';' == 59) && ('<' == 60) \ | ||
| 11 | && ('=' == 61) && ('>' == 62) && ('?' == 63) && ('A' == 65) \ | ||
| 12 | && ('B' == 66) && ('C' == 67) && ('D' == 68) && ('E' == 69) \ | ||
| 13 | && ('F' == 70) && ('G' == 71) && ('H' == 72) && ('I' == 73) \ | ||
| 14 | && ('J' == 74) && ('K' == 75) && ('L' == 76) && ('M' == 77) \ | ||
| 15 | && ('N' == 78) && ('O' == 79) && ('P' == 80) && ('Q' == 81) \ | ||
| 16 | && ('R' == 82) && ('S' == 83) && ('T' == 84) && ('U' == 85) \ | ||
| 17 | && ('V' == 86) && ('W' == 87) && ('X' == 88) && ('Y' == 89) \ | ||
| 18 | && ('Z' == 90) && ('[' == 91) && ('\\' == 92) && (']' == 93) \ | ||
| 19 | && ('^' == 94) && ('_' == 95) && ('a' == 97) && ('b' == 98) \ | ||
| 20 | && ('c' == 99) && ('d' == 100) && ('e' == 101) && ('f' == 102) \ | ||
| 21 | && ('g' == 103) && ('h' == 104) && ('i' == 105) && ('j' == 106) \ | ||
| 22 | && ('k' == 107) && ('l' == 108) && ('m' == 109) && ('n' == 110) \ | ||
| 23 | && ('o' == 111) && ('p' == 112) && ('q' == 113) && ('r' == 114) \ | ||
| 24 | && ('s' == 115) && ('t' == 116) && ('u' == 117) && ('v' == 118) \ | ||
| 25 | && ('w' == 119) && ('x' == 120) && ('y' == 121) && ('z' == 122) \ | ||
| 26 | && ('{' == 123) && ('|' == 124) && ('}' == 125) && ('~' == 126)) | ||
| 27 | /* The character set is not based on ISO-646. */ | ||
| 28 | #error "gperf generated tables don't work with this execution character set. Please report a bug to <bug-gnu-gperf@gnu.org>." | ||
| 29 | #endif | ||
| 30 | |||
| 31 | #line 1 "scripts/genksyms/keywords.gperf" | ||
| 32 | |||
| 33 | #line 3 "scripts/genksyms/keywords.gperf" | ||
| 3 | struct resword { const char *name; int token; }; | 34 | struct resword { const char *name; int token; }; |
| 4 | /* maximum key range = 109, duplicates = 0 */ | 35 | /* maximum key range = 68, duplicates = 0 */ |
| 5 | 36 | ||
| 6 | #ifdef __GNUC__ | 37 | #ifdef __GNUC__ |
| 7 | __inline | 38 | __inline |
| @@ -15,32 +46,32 @@ is_reserved_hash (register const char *str, register unsigned int len) | |||
| 15 | { | 46 | { |
| 16 | static const unsigned char asso_values[] = | 47 | static const unsigned char asso_values[] = |
| 17 | { | 48 | { |
| 18 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, | 49 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, |
| 19 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, | 50 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, |
| 20 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, | 51 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, |
| 21 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, | 52 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, |
| 22 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, | 53 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, |
| 23 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, | 54 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, |
| 24 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 5, | 55 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 15, |
| 25 | 113, 113, 113, 113, 113, 113, 0, 113, 113, 113, | 56 | 71, 71, 71, 71, 71, 71, 15, 71, 71, 71, |
| 26 | 0, 113, 113, 113, 113, 113, 113, 113, 113, 113, | 57 | 10, 71, 71, 71, 71, 71, 71, 71, 71, 71, |
| 27 | 113, 113, 113, 113, 113, 0, 113, 0, 113, 20, | 58 | 71, 71, 71, 71, 71, 0, 71, 0, 71, 5, |
| 28 | 25, 0, 35, 30, 113, 20, 113, 113, 40, 30, | 59 | 5, 0, 10, 20, 71, 25, 71, 71, 20, 0, |
| 29 | 30, 0, 0, 113, 0, 51, 0, 15, 5, 113, | 60 | 20, 30, 25, 71, 10, 5, 0, 20, 15, 71, |
| 30 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, | 61 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, |
| 31 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, | 62 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, |
| 32 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, | 63 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, |
| 33 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, | 64 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, |
| 34 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, | 65 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, |
| 35 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, | 66 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, |
| 36 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, | 67 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, |
| 37 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, | 68 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, |
| 38 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, | 69 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, |
| 39 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, | 70 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, |
| 40 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, | 71 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, |
| 41 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, | 72 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, |
| 42 | 113, 113, 113, 113, 113, 113, 113, 113, 113, 113, | 73 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, |
| 43 | 113, 113, 113, 113, 113, 113 | 74 | 71, 71, 71, 71, 71, 71 |
| 44 | }; | 75 | }; |
| 45 | return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]]; | 76 | return len + asso_values[(unsigned char)str[2]] + asso_values[(unsigned char)str[0]] + asso_values[(unsigned char)str[len - 1]]; |
| 46 | } | 77 | } |
| @@ -56,77 +87,112 @@ is_reserved_word (register const char *str, register unsigned int len) | |||
| 56 | TOTAL_KEYWORDS = 41, | 87 | TOTAL_KEYWORDS = 41, |
| 57 | MIN_WORD_LENGTH = 3, | 88 | MIN_WORD_LENGTH = 3, |
| 58 | MAX_WORD_LENGTH = 17, | 89 | MAX_WORD_LENGTH = 17, |
| 59 | MIN_HASH_VALUE = 4, | 90 | MIN_HASH_VALUE = 3, |
| 60 | MAX_HASH_VALUE = 112 | 91 | MAX_HASH_VALUE = 70 |
| 61 | }; | 92 | }; |
| 62 | 93 | ||
| 63 | static const struct resword wordlist[] = | 94 | static const struct resword wordlist[] = |
| 64 | { | 95 | { |
| 65 | {""}, {""}, {""}, {""}, | 96 | {""}, {""}, {""}, |
| 66 | {"auto", AUTO_KEYW}, | 97 | #line 24 "scripts/genksyms/keywords.gperf" |
| 67 | {""}, {""}, | 98 | {"asm", ASM_KEYW}, |
| 99 | {""}, | ||
| 100 | #line 7 "scripts/genksyms/keywords.gperf" | ||
| 101 | {"__asm", ASM_KEYW}, | ||
| 102 | {""}, | ||
| 103 | #line 8 "scripts/genksyms/keywords.gperf" | ||
| 68 | {"__asm__", ASM_KEYW}, | 104 | {"__asm__", ASM_KEYW}, |
| 69 | {""}, | 105 | {""}, |
| 106 | #line 21 "scripts/genksyms/keywords.gperf" | ||
| 70 | {"_restrict", RESTRICT_KEYW}, | 107 | {"_restrict", RESTRICT_KEYW}, |
| 108 | #line 50 "scripts/genksyms/keywords.gperf" | ||
| 71 | {"__typeof__", TYPEOF_KEYW}, | 109 | {"__typeof__", TYPEOF_KEYW}, |
| 110 | #line 9 "scripts/genksyms/keywords.gperf" | ||
| 72 | {"__attribute", ATTRIBUTE_KEYW}, | 111 | {"__attribute", ATTRIBUTE_KEYW}, |
| 73 | {"__restrict__", RESTRICT_KEYW}, | 112 | #line 11 "scripts/genksyms/keywords.gperf" |
| 113 | {"__const", CONST_KEYW}, | ||
| 114 | #line 10 "scripts/genksyms/keywords.gperf" | ||
| 74 | {"__attribute__", ATTRIBUTE_KEYW}, | 115 | {"__attribute__", ATTRIBUTE_KEYW}, |
| 116 | #line 12 "scripts/genksyms/keywords.gperf" | ||
| 117 | {"__const__", CONST_KEYW}, | ||
| 118 | #line 16 "scripts/genksyms/keywords.gperf" | ||
| 119 | {"__signed__", SIGNED_KEYW}, | ||
| 120 | #line 42 "scripts/genksyms/keywords.gperf" | ||
| 121 | {"static", STATIC_KEYW}, | ||
| 75 | {""}, | 122 | {""}, |
| 76 | {"__volatile", VOLATILE_KEYW}, | 123 | #line 15 "scripts/genksyms/keywords.gperf" |
| 124 | {"__signed", SIGNED_KEYW}, | ||
| 125 | #line 30 "scripts/genksyms/keywords.gperf" | ||
| 126 | {"char", CHAR_KEYW}, | ||
| 77 | {""}, | 127 | {""}, |
| 128 | #line 43 "scripts/genksyms/keywords.gperf" | ||
| 129 | {"struct", STRUCT_KEYW}, | ||
| 130 | #line 22 "scripts/genksyms/keywords.gperf" | ||
| 131 | {"__restrict__", RESTRICT_KEYW}, | ||
| 132 | #line 23 "scripts/genksyms/keywords.gperf" | ||
| 133 | {"restrict", RESTRICT_KEYW}, | ||
| 134 | #line 33 "scripts/genksyms/keywords.gperf" | ||
| 135 | {"enum", ENUM_KEYW}, | ||
| 136 | #line 17 "scripts/genksyms/keywords.gperf" | ||
| 137 | {"__volatile", VOLATILE_KEYW}, | ||
| 138 | #line 34 "scripts/genksyms/keywords.gperf" | ||
| 139 | {"extern", EXTERN_KEYW}, | ||
| 140 | #line 18 "scripts/genksyms/keywords.gperf" | ||
| 78 | {"__volatile__", VOLATILE_KEYW}, | 141 | {"__volatile__", VOLATILE_KEYW}, |
| 79 | {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW}, | 142 | #line 37 "scripts/genksyms/keywords.gperf" |
| 80 | {""}, {""}, {""}, | ||
| 81 | {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, | ||
| 82 | {"int", INT_KEYW}, | 143 | {"int", INT_KEYW}, |
| 83 | {"char", CHAR_KEYW}, | 144 | {""}, |
| 84 | {""}, {""}, | 145 | #line 31 "scripts/genksyms/keywords.gperf" |
| 85 | {"__const", CONST_KEYW}, | 146 | {"const", CONST_KEYW}, |
| 147 | #line 32 "scripts/genksyms/keywords.gperf" | ||
| 148 | {"double", DOUBLE_KEYW}, | ||
| 149 | {""}, | ||
| 150 | #line 13 "scripts/genksyms/keywords.gperf" | ||
| 86 | {"__inline", INLINE_KEYW}, | 151 | {"__inline", INLINE_KEYW}, |
| 87 | {"__const__", CONST_KEYW}, | 152 | #line 29 "scripts/genksyms/keywords.gperf" |
| 153 | {"auto", AUTO_KEYW}, | ||
| 154 | #line 14 "scripts/genksyms/keywords.gperf" | ||
| 88 | {"__inline__", INLINE_KEYW}, | 155 | {"__inline__", INLINE_KEYW}, |
| 89 | {""}, {""}, {""}, {""}, | 156 | #line 41 "scripts/genksyms/keywords.gperf" |
| 90 | {"__asm", ASM_KEYW}, | 157 | {"signed", SIGNED_KEYW}, |
| 91 | {"extern", EXTERN_KEYW}, | ||
| 92 | {""}, | 158 | {""}, |
| 93 | {"register", REGISTER_KEYW}, | 159 | #line 46 "scripts/genksyms/keywords.gperf" |
| 160 | {"unsigned", UNSIGNED_KEYW}, | ||
| 94 | {""}, | 161 | {""}, |
| 95 | {"float", FLOAT_KEYW}, | 162 | #line 40 "scripts/genksyms/keywords.gperf" |
| 163 | {"short", SHORT_KEYW}, | ||
| 164 | #line 49 "scripts/genksyms/keywords.gperf" | ||
| 96 | {"typeof", TYPEOF_KEYW}, | 165 | {"typeof", TYPEOF_KEYW}, |
| 166 | #line 44 "scripts/genksyms/keywords.gperf" | ||
| 97 | {"typedef", TYPEDEF_KEYW}, | 167 | {"typedef", TYPEDEF_KEYW}, |
| 98 | {""}, {""}, | 168 | #line 48 "scripts/genksyms/keywords.gperf" |
| 99 | {"_Bool", BOOL_KEYW}, | ||
| 100 | {"double", DOUBLE_KEYW}, | ||
| 101 | {""}, {""}, | ||
| 102 | {"enum", ENUM_KEYW}, | ||
| 103 | {""}, {""}, {""}, | ||
| 104 | {"volatile", VOLATILE_KEYW}, | 169 | {"volatile", VOLATILE_KEYW}, |
| 170 | {""}, | ||
| 171 | #line 35 "scripts/genksyms/keywords.gperf" | ||
| 172 | {"float", FLOAT_KEYW}, | ||
| 173 | {""}, {""}, | ||
| 174 | #line 39 "scripts/genksyms/keywords.gperf" | ||
| 175 | {"register", REGISTER_KEYW}, | ||
| 176 | #line 47 "scripts/genksyms/keywords.gperf" | ||
| 105 | {"void", VOID_KEYW}, | 177 | {"void", VOID_KEYW}, |
| 106 | {"const", CONST_KEYW}, | ||
| 107 | {"short", SHORT_KEYW}, | ||
| 108 | {"struct", STRUCT_KEYW}, | ||
| 109 | {""}, | 178 | {""}, |
| 110 | {"restrict", RESTRICT_KEYW}, | 179 | #line 36 "scripts/genksyms/keywords.gperf" |
| 180 | {"inline", INLINE_KEYW}, | ||
| 111 | {""}, | 181 | {""}, |
| 112 | {"__signed__", SIGNED_KEYW}, | 182 | #line 5 "scripts/genksyms/keywords.gperf" |
| 183 | {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW}, | ||
| 113 | {""}, | 184 | {""}, |
| 114 | {"asm", ASM_KEYW}, | 185 | #line 20 "scripts/genksyms/keywords.gperf" |
| 115 | {""}, {""}, | 186 | {"_Bool", BOOL_KEYW}, |
| 116 | {"inline", INLINE_KEYW}, | 187 | {""}, |
| 117 | {""}, {""}, {""}, | 188 | #line 6 "scripts/genksyms/keywords.gperf" |
| 118 | {"union", UNION_KEYW}, | 189 | {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, |
| 119 | {""}, {""}, {""}, {""}, {""}, {""}, | ||
| 120 | {"static", STATIC_KEYW}, | ||
| 121 | {""}, {""}, {""}, {""}, {""}, {""}, | 190 | {""}, {""}, {""}, {""}, {""}, {""}, |
| 122 | {"__signed", SIGNED_KEYW}, | 191 | #line 38 "scripts/genksyms/keywords.gperf" |
| 123 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, {""}, | ||
| 124 | {""}, {""}, {""}, {""}, {""}, | ||
| 125 | {"unsigned", UNSIGNED_KEYW}, | ||
| 126 | {""}, {""}, {""}, {""}, | ||
| 127 | {"long", LONG_KEYW}, | 192 | {"long", LONG_KEYW}, |
| 128 | {""}, {""}, {""}, {""}, {""}, {""}, {""}, | 193 | {""}, {""}, {""}, {""}, {""}, |
| 129 | {"signed", SIGNED_KEYW} | 194 | #line 45 "scripts/genksyms/keywords.gperf" |
| 195 | {"union", UNION_KEYW} | ||
| 130 | }; | 196 | }; |
| 131 | 197 | ||
| 132 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) | 198 | if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH) |
diff --git a/scripts/genksyms/lex.c_shipped b/scripts/genksyms/lex.c_shipped index d9bfbb5948f2..1218053ee960 100644 --- a/scripts/genksyms/lex.c_shipped +++ b/scripts/genksyms/lex.c_shipped | |||
| @@ -2036,49 +2036,131 @@ fini: | |||
| 2036 | 2036 | ||
| 2037 | return token; | 2037 | return token; |
| 2038 | } | 2038 | } |
| 2039 | #ifndef YYSTYPE | 2039 | /* A Bison parser, made by GNU Bison 2.0. */ |
| 2040 | #define YYSTYPE int | ||
| 2041 | #endif | ||
| 2042 | #define ASM_KEYW 257 | ||
| 2043 | #define ATTRIBUTE_KEYW 258 | ||
| 2044 | #define AUTO_KEYW 259 | ||
| 2045 | #define BOOL_KEYW 260 | ||
| 2046 | #define CHAR_KEYW 261 | ||
| 2047 | #define CONST_KEYW 262 | ||
| 2048 | #define DOUBLE_KEYW 263 | ||
| 2049 | #define ENUM_KEYW 264 | ||
| 2050 | #define EXTERN_KEYW 265 | ||
| 2051 | #define FLOAT_KEYW 266 | ||
| 2052 | #define INLINE_KEYW 267 | ||
| 2053 | #define INT_KEYW 268 | ||
| 2054 | #define LONG_KEYW 269 | ||
| 2055 | #define REGISTER_KEYW 270 | ||
| 2056 | #define RESTRICT_KEYW 271 | ||
| 2057 | #define SHORT_KEYW 272 | ||
| 2058 | #define SIGNED_KEYW 273 | ||
| 2059 | #define STATIC_KEYW 274 | ||
| 2060 | #define STRUCT_KEYW 275 | ||
| 2061 | #define TYPEDEF_KEYW 276 | ||
| 2062 | #define UNION_KEYW 277 | ||
| 2063 | #define UNSIGNED_KEYW 278 | ||
| 2064 | #define VOID_KEYW 279 | ||
| 2065 | #define VOLATILE_KEYW 280 | ||
| 2066 | #define TYPEOF_KEYW 281 | ||
| 2067 | #define EXPORT_SYMBOL_KEYW 282 | ||
| 2068 | #define ASM_PHRASE 283 | ||
| 2069 | #define ATTRIBUTE_PHRASE 284 | ||
| 2070 | #define BRACE_PHRASE 285 | ||
| 2071 | #define BRACKET_PHRASE 286 | ||
| 2072 | #define EXPRESSION_PHRASE 287 | ||
| 2073 | #define CHAR 288 | ||
| 2074 | #define DOTS 289 | ||
| 2075 | #define IDENT 290 | ||
| 2076 | #define INT 291 | ||
| 2077 | #define REAL 292 | ||
| 2078 | #define STRING 293 | ||
| 2079 | #define TYPE 294 | ||
| 2080 | #define OTHER 295 | ||
| 2081 | #define FILENAME 296 | ||
| 2082 | 2040 | ||
| 2041 | /* Skeleton parser for Yacc-like parsing with Bison, | ||
| 2042 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. | ||
| 2043 | |||
| 2044 | This program is free software; you can redistribute it and/or modify | ||
| 2045 | it under the terms of the GNU General Public License as published by | ||
| 2046 | the Free Software Foundation; either version 2, or (at your option) | ||
| 2047 | any later version. | ||
| 2048 | |||
| 2049 | This program is distributed in the hope that it will be useful, | ||
| 2050 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 2051 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 2052 | GNU General Public License for more details. | ||
| 2053 | |||
| 2054 | You should have received a copy of the GNU General Public License | ||
| 2055 | along with this program; if not, write to the Free Software | ||
| 2056 | Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 2057 | Boston, MA 02111-1307, USA. */ | ||
| 2058 | |||
| 2059 | /* As a special exception, when this file is copied by Bison into a | ||
| 2060 | Bison output file, you may use that output file without restriction. | ||
| 2061 | This special exception was added by the Free Software Foundation | ||
| 2062 | in version 1.24 of Bison. */ | ||
| 2063 | |||
| 2064 | /* Tokens. */ | ||
| 2065 | #ifndef YYTOKENTYPE | ||
| 2066 | # define YYTOKENTYPE | ||
| 2067 | /* Put the tokens into the symbol table, so that GDB and other debuggers | ||
| 2068 | know about them. */ | ||
| 2069 | enum yytokentype { | ||
| 2070 | ASM_KEYW = 258, | ||
| 2071 | ATTRIBUTE_KEYW = 259, | ||
| 2072 | AUTO_KEYW = 260, | ||
| 2073 | BOOL_KEYW = 261, | ||
| 2074 | CHAR_KEYW = 262, | ||
| 2075 | CONST_KEYW = 263, | ||
| 2076 | DOUBLE_KEYW = 264, | ||
| 2077 | ENUM_KEYW = 265, | ||
| 2078 | EXTERN_KEYW = 266, | ||
| 2079 | FLOAT_KEYW = 267, | ||
| 2080 | INLINE_KEYW = 268, | ||
| 2081 | INT_KEYW = 269, | ||
| 2082 | LONG_KEYW = 270, | ||
| 2083 | REGISTER_KEYW = 271, | ||
| 2084 | RESTRICT_KEYW = 272, | ||
| 2085 | SHORT_KEYW = 273, | ||
| 2086 | SIGNED_KEYW = 274, | ||
| 2087 | STATIC_KEYW = 275, | ||
| 2088 | STRUCT_KEYW = 276, | ||
| 2089 | TYPEDEF_KEYW = 277, | ||
| 2090 | UNION_KEYW = 278, | ||
| 2091 | UNSIGNED_KEYW = 279, | ||
| 2092 | VOID_KEYW = 280, | ||
| 2093 | VOLATILE_KEYW = 281, | ||
| 2094 | TYPEOF_KEYW = 282, | ||
| 2095 | EXPORT_SYMBOL_KEYW = 283, | ||
| 2096 | ASM_PHRASE = 284, | ||
| 2097 | ATTRIBUTE_PHRASE = 285, | ||
| 2098 | BRACE_PHRASE = 286, | ||
| 2099 | BRACKET_PHRASE = 287, | ||
| 2100 | EXPRESSION_PHRASE = 288, | ||
| 2101 | CHAR = 289, | ||
| 2102 | DOTS = 290, | ||
| 2103 | IDENT = 291, | ||
| 2104 | INT = 292, | ||
| 2105 | REAL = 293, | ||
| 2106 | STRING = 294, | ||
| 2107 | TYPE = 295, | ||
| 2108 | OTHER = 296, | ||
| 2109 | FILENAME = 297 | ||
| 2110 | }; | ||
| 2111 | #endif | ||
| 2112 | #define ASM_KEYW 258 | ||
| 2113 | #define ATTRIBUTE_KEYW 259 | ||
| 2114 | #define AUTO_KEYW 260 | ||
| 2115 | #define BOOL_KEYW 261 | ||
| 2116 | #define CHAR_KEYW 262 | ||
| 2117 | #define CONST_KEYW 263 | ||
| 2118 | #define DOUBLE_KEYW 264 | ||
| 2119 | #define ENUM_KEYW 265 | ||
| 2120 | #define EXTERN_KEYW 266 | ||
| 2121 | #define FLOAT_KEYW 267 | ||
| 2122 | #define INLINE_KEYW 268 | ||
| 2123 | #define INT_KEYW 269 | ||
| 2124 | #define LONG_KEYW 270 | ||
| 2125 | #define REGISTER_KEYW 271 | ||
| 2126 | #define RESTRICT_KEYW 272 | ||
| 2127 | #define SHORT_KEYW 273 | ||
| 2128 | #define SIGNED_KEYW 274 | ||
| 2129 | #define STATIC_KEYW 275 | ||
| 2130 | #define STRUCT_KEYW 276 | ||
| 2131 | #define TYPEDEF_KEYW 277 | ||
| 2132 | #define UNION_KEYW 278 | ||
| 2133 | #define UNSIGNED_KEYW 279 | ||
| 2134 | #define VOID_KEYW 280 | ||
| 2135 | #define VOLATILE_KEYW 281 | ||
| 2136 | #define TYPEOF_KEYW 282 | ||
| 2137 | #define EXPORT_SYMBOL_KEYW 283 | ||
| 2138 | #define ASM_PHRASE 284 | ||
| 2139 | #define ATTRIBUTE_PHRASE 285 | ||
| 2140 | #define BRACE_PHRASE 286 | ||
| 2141 | #define BRACKET_PHRASE 287 | ||
| 2142 | #define EXPRESSION_PHRASE 288 | ||
| 2143 | #define CHAR 289 | ||
| 2144 | #define DOTS 290 | ||
| 2145 | #define IDENT 291 | ||
| 2146 | #define INT 292 | ||
| 2147 | #define REAL 293 | ||
| 2148 | #define STRING 294 | ||
| 2149 | #define TYPE 295 | ||
| 2150 | #define OTHER 296 | ||
| 2151 | #define FILENAME 297 | ||
| 2152 | |||
| 2153 | |||
| 2154 | |||
| 2155 | |||
| 2156 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) | ||
| 2157 | typedef int YYSTYPE; | ||
| 2158 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | ||
| 2159 | # define YYSTYPE_IS_DECLARED 1 | ||
| 2160 | # define YYSTYPE_IS_TRIVIAL 1 | ||
| 2161 | #endif | ||
| 2083 | 2162 | ||
| 2084 | extern YYSTYPE yylval; | 2163 | extern YYSTYPE yylval; |
| 2164 | |||
| 2165 | |||
| 2166 | |||
diff --git a/scripts/genksyms/parse.c_shipped b/scripts/genksyms/parse.c_shipped index 2c6b1286b638..99d7c258696d 100644 --- a/scripts/genksyms/parse.c_shipped +++ b/scripts/genksyms/parse.c_shipped | |||
| @@ -1,50 +1,145 @@ | |||
| 1 | /* A Bison parser, made by GNU Bison 2.0. */ | ||
| 1 | 2 | ||
| 2 | /* A Bison parser, made from scripts/genksyms/parse.y | 3 | /* Skeleton parser for Yacc-like parsing with Bison, |
| 3 | by GNU Bison version 1.28 */ | 4 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. |
| 4 | |||
| 5 | #define YYBISON 1 /* Identify Bison output. */ | ||
| 6 | |||
| 7 | #define ASM_KEYW 257 | ||
| 8 | #define ATTRIBUTE_KEYW 258 | ||
| 9 | #define AUTO_KEYW 259 | ||
| 10 | #define BOOL_KEYW 260 | ||
| 11 | #define CHAR_KEYW 261 | ||
| 12 | #define CONST_KEYW 262 | ||
| 13 | #define DOUBLE_KEYW 263 | ||
| 14 | #define ENUM_KEYW 264 | ||
| 15 | #define EXTERN_KEYW 265 | ||
| 16 | #define FLOAT_KEYW 266 | ||
| 17 | #define INLINE_KEYW 267 | ||
| 18 | #define INT_KEYW 268 | ||
| 19 | #define LONG_KEYW 269 | ||
| 20 | #define REGISTER_KEYW 270 | ||
| 21 | #define RESTRICT_KEYW 271 | ||
| 22 | #define SHORT_KEYW 272 | ||
| 23 | #define SIGNED_KEYW 273 | ||
| 24 | #define STATIC_KEYW 274 | ||
| 25 | #define STRUCT_KEYW 275 | ||
| 26 | #define TYPEDEF_KEYW 276 | ||
| 27 | #define UNION_KEYW 277 | ||
| 28 | #define UNSIGNED_KEYW 278 | ||
| 29 | #define VOID_KEYW 279 | ||
| 30 | #define VOLATILE_KEYW 280 | ||
| 31 | #define TYPEOF_KEYW 281 | ||
| 32 | #define EXPORT_SYMBOL_KEYW 282 | ||
| 33 | #define ASM_PHRASE 283 | ||
| 34 | #define ATTRIBUTE_PHRASE 284 | ||
| 35 | #define BRACE_PHRASE 285 | ||
| 36 | #define BRACKET_PHRASE 286 | ||
| 37 | #define EXPRESSION_PHRASE 287 | ||
| 38 | #define CHAR 288 | ||
| 39 | #define DOTS 289 | ||
| 40 | #define IDENT 290 | ||
| 41 | #define INT 291 | ||
| 42 | #define REAL 292 | ||
| 43 | #define STRING 293 | ||
| 44 | #define TYPE 294 | ||
| 45 | #define OTHER 295 | ||
| 46 | #define FILENAME 296 | ||
| 47 | 5 | ||
| 6 | This program is free software; you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation; either version 2, or (at your option) | ||
| 9 | any later version. | ||
| 10 | |||
| 11 | This program is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with this program; if not, write to the Free Software | ||
| 18 | Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 19 | Boston, MA 02111-1307, USA. */ | ||
| 20 | |||
| 21 | /* As a special exception, when this file is copied by Bison into a | ||
| 22 | Bison output file, you may use that output file without restriction. | ||
| 23 | This special exception was added by the Free Software Foundation | ||
| 24 | in version 1.24 of Bison. */ | ||
| 25 | |||
| 26 | /* Written by Richard Stallman by simplifying the original so called | ||
| 27 | ``semantic'' parser. */ | ||
| 28 | |||
| 29 | /* All symbols defined below should begin with yy or YY, to avoid | ||
| 30 | infringing on user name space. This should be done even for local | ||
| 31 | variables, as they might otherwise be expanded by user macros. | ||
| 32 | There are some unavoidable exceptions within include files to | ||
| 33 | define necessary library symbols; they are noted "INFRINGES ON | ||
| 34 | USER NAME SPACE" below. */ | ||
| 35 | |||
| 36 | /* Identify Bison output. */ | ||
| 37 | #define YYBISON 1 | ||
| 38 | |||
| 39 | /* Skeleton name. */ | ||
| 40 | #define YYSKELETON_NAME "yacc.c" | ||
| 41 | |||
| 42 | /* Pure parsers. */ | ||
| 43 | #define YYPURE 0 | ||
| 44 | |||
| 45 | /* Using locations. */ | ||
| 46 | #define YYLSP_NEEDED 0 | ||
| 47 | |||
| 48 | |||
| 49 | |||
| 50 | /* Tokens. */ | ||
| 51 | #ifndef YYTOKENTYPE | ||
| 52 | # define YYTOKENTYPE | ||
| 53 | /* Put the tokens into the symbol table, so that GDB and other debuggers | ||
| 54 | know about them. */ | ||
| 55 | enum yytokentype { | ||
| 56 | ASM_KEYW = 258, | ||
| 57 | ATTRIBUTE_KEYW = 259, | ||
| 58 | AUTO_KEYW = 260, | ||
| 59 | BOOL_KEYW = 261, | ||
| 60 | CHAR_KEYW = 262, | ||
| 61 | CONST_KEYW = 263, | ||
| 62 | DOUBLE_KEYW = 264, | ||
| 63 | ENUM_KEYW = 265, | ||
| 64 | EXTERN_KEYW = 266, | ||
| 65 | FLOAT_KEYW = 267, | ||
| 66 | INLINE_KEYW = 268, | ||
| 67 | INT_KEYW = 269, | ||
| 68 | LONG_KEYW = 270, | ||
| 69 | REGISTER_KEYW = 271, | ||
| 70 | RESTRICT_KEYW = 272, | ||
| 71 | SHORT_KEYW = 273, | ||
| 72 | SIGNED_KEYW = 274, | ||
| 73 | STATIC_KEYW = 275, | ||
| 74 | STRUCT_KEYW = 276, | ||
| 75 | TYPEDEF_KEYW = 277, | ||
| 76 | UNION_KEYW = 278, | ||
| 77 | UNSIGNED_KEYW = 279, | ||
| 78 | VOID_KEYW = 280, | ||
| 79 | VOLATILE_KEYW = 281, | ||
| 80 | TYPEOF_KEYW = 282, | ||
| 81 | EXPORT_SYMBOL_KEYW = 283, | ||
| 82 | ASM_PHRASE = 284, | ||
| 83 | ATTRIBUTE_PHRASE = 285, | ||
| 84 | BRACE_PHRASE = 286, | ||
| 85 | BRACKET_PHRASE = 287, | ||
| 86 | EXPRESSION_PHRASE = 288, | ||
| 87 | CHAR = 289, | ||
| 88 | DOTS = 290, | ||
| 89 | IDENT = 291, | ||
| 90 | INT = 292, | ||
| 91 | REAL = 293, | ||
| 92 | STRING = 294, | ||
| 93 | TYPE = 295, | ||
| 94 | OTHER = 296, | ||
| 95 | FILENAME = 297 | ||
| 96 | }; | ||
| 97 | #endif | ||
| 98 | #define ASM_KEYW 258 | ||
| 99 | #define ATTRIBUTE_KEYW 259 | ||
| 100 | #define AUTO_KEYW 260 | ||
| 101 | #define BOOL_KEYW 261 | ||
| 102 | #define CHAR_KEYW 262 | ||
| 103 | #define CONST_KEYW 263 | ||
| 104 | #define DOUBLE_KEYW 264 | ||
| 105 | #define ENUM_KEYW 265 | ||
| 106 | #define EXTERN_KEYW 266 | ||
| 107 | #define FLOAT_KEYW 267 | ||
| 108 | #define INLINE_KEYW 268 | ||
| 109 | #define INT_KEYW 269 | ||
| 110 | #define LONG_KEYW 270 | ||
| 111 | #define REGISTER_KEYW 271 | ||
| 112 | #define RESTRICT_KEYW 272 | ||
| 113 | #define SHORT_KEYW 273 | ||
| 114 | #define SIGNED_KEYW 274 | ||
| 115 | #define STATIC_KEYW 275 | ||
| 116 | #define STRUCT_KEYW 276 | ||
| 117 | #define TYPEDEF_KEYW 277 | ||
| 118 | #define UNION_KEYW 278 | ||
| 119 | #define UNSIGNED_KEYW 279 | ||
| 120 | #define VOID_KEYW 280 | ||
| 121 | #define VOLATILE_KEYW 281 | ||
| 122 | #define TYPEOF_KEYW 282 | ||
| 123 | #define EXPORT_SYMBOL_KEYW 283 | ||
| 124 | #define ASM_PHRASE 284 | ||
| 125 | #define ATTRIBUTE_PHRASE 285 | ||
| 126 | #define BRACE_PHRASE 286 | ||
| 127 | #define BRACKET_PHRASE 287 | ||
| 128 | #define EXPRESSION_PHRASE 288 | ||
| 129 | #define CHAR 289 | ||
| 130 | #define DOTS 290 | ||
| 131 | #define IDENT 291 | ||
| 132 | #define INT 292 | ||
| 133 | #define REAL 293 | ||
| 134 | #define STRING 294 | ||
| 135 | #define TYPE 295 | ||
| 136 | #define OTHER 296 | ||
| 137 | #define FILENAME 297 | ||
| 138 | |||
| 139 | |||
| 140 | |||
| 141 | |||
| 142 | /* Copy the first part of user declarations. */ | ||
| 48 | #line 24 "scripts/genksyms/parse.y" | 143 | #line 24 "scripts/genksyms/parse.y" |
| 49 | 144 | ||
| 50 | 145 | ||
| @@ -75,661 +170,1000 @@ remove_list(struct string_list **pb, struct string_list **pe) | |||
| 75 | free_list(b, e); | 170 | free_list(b, e); |
| 76 | } | 171 | } |
| 77 | 172 | ||
| 78 | #ifndef YYSTYPE | 173 | |
| 79 | #define YYSTYPE int | 174 | |
| 80 | #endif | 175 | /* Enabling traces. */ |
| 81 | #ifndef YYDEBUG | 176 | #ifndef YYDEBUG |
| 82 | #define YYDEBUG 1 | 177 | # define YYDEBUG 1 |
| 83 | #endif | 178 | #endif |
| 84 | 179 | ||
| 85 | #include <stdio.h> | 180 | /* Enabling verbose error messages. */ |
| 86 | 181 | #ifdef YYERROR_VERBOSE | |
| 87 | #ifndef __cplusplus | 182 | # undef YYERROR_VERBOSE |
| 88 | #ifndef __STDC__ | 183 | # define YYERROR_VERBOSE 1 |
| 89 | #define const | 184 | #else |
| 185 | # define YYERROR_VERBOSE 0 | ||
| 90 | #endif | 186 | #endif |
| 187 | |||
| 188 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) | ||
| 189 | typedef int YYSTYPE; | ||
| 190 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | ||
| 191 | # define YYSTYPE_IS_DECLARED 1 | ||
| 192 | # define YYSTYPE_IS_TRIVIAL 1 | ||
| 91 | #endif | 193 | #endif |
| 92 | 194 | ||
| 93 | 195 | ||
| 94 | 196 | ||
| 95 | #define YYFINAL 172 | 197 | /* Copy the second part of user declarations. */ |
| 96 | #define YYFLAG -32768 | ||
| 97 | #define YYNTBASE 52 | ||
| 98 | |||
| 99 | #define YYTRANSLATE(x) ((unsigned)(x) <= 296 ? yytranslate[x] : 96) | ||
| 100 | |||
| 101 | static const char yytranslate[] = { 0, | ||
| 102 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 103 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 104 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 105 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 46, | ||
| 106 | 47, 48, 2, 45, 2, 2, 2, 2, 2, 2, | ||
| 107 | 2, 2, 2, 2, 2, 2, 2, 51, 43, 2, | ||
| 108 | 49, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 109 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 110 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 111 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 112 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 113 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 114 | 2, 2, 50, 2, 44, 2, 2, 2, 2, 2, | ||
| 115 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 116 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 117 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 118 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 119 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 120 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 121 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 122 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 123 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 124 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 125 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 126 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 127 | 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, | ||
| 128 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, | ||
| 129 | 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, | ||
| 130 | 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, | ||
| 131 | 37, 38, 39, 40, 41, 42 | ||
| 132 | }; | ||
| 133 | 198 | ||
| 134 | #if YYDEBUG != 0 | ||
| 135 | static const short yyprhs[] = { 0, | ||
| 136 | 0, 2, 5, 6, 9, 10, 14, 16, 18, 20, | ||
| 137 | 22, 25, 28, 32, 33, 35, 37, 41, 46, 47, | ||
| 138 | 49, 51, 54, 56, 58, 60, 62, 64, 66, 68, | ||
| 139 | 70, 72, 77, 80, 83, 86, 90, 94, 98, 101, | ||
| 140 | 104, 107, 109, 111, 113, 115, 117, 119, 121, 123, | ||
| 141 | 125, 127, 129, 132, 133, 135, 137, 140, 142, 144, | ||
| 142 | 146, 148, 151, 153, 155, 160, 165, 168, 172, 176, | ||
| 143 | 179, 181, 183, 185, 190, 195, 198, 202, 206, 209, | ||
| 144 | 211, 215, 216, 218, 220, 224, 227, 230, 232, 233, | ||
| 145 | 235, 237, 242, 247, 250, 254, 258, 262, 263, 265, | ||
| 146 | 268, 272, 276, 277, 279, 281, 284, 288, 291, 292, | ||
| 147 | 294, 296, 300, 303, 306, 308, 311, 312, 314, 317, | ||
| 148 | 318, 320 | ||
| 149 | }; | ||
| 150 | 199 | ||
| 151 | static const short yyrhs[] = { 53, | 200 | /* Line 213 of yacc.c. */ |
| 152 | 0, 52, 53, 0, 0, 54, 55, 0, 0, 22, | 201 | #line 202 "scripts/genksyms/parse.c" |
| 153 | 56, 57, 0, 57, 0, 81, 0, 93, 0, 95, | ||
| 154 | 0, 1, 43, 0, 1, 44, 0, 61, 58, 43, | ||
| 155 | 0, 0, 59, 0, 60, 0, 59, 45, 60, 0, | ||
| 156 | 71, 94, 92, 82, 0, 0, 62, 0, 63, 0, | ||
| 157 | 62, 63, 0, 64, 0, 65, 0, 5, 0, 16, | ||
| 158 | 0, 20, 0, 11, 0, 13, 0, 66, 0, 70, | ||
| 159 | 0, 27, 46, 62, 47, 0, 21, 36, 0, 23, | ||
| 160 | 36, 0, 10, 36, 0, 21, 36, 84, 0, 23, | ||
| 161 | 36, 84, 0, 10, 36, 31, 0, 10, 31, 0, | ||
| 162 | 21, 84, 0, 23, 84, 0, 7, 0, 18, 0, | ||
| 163 | 14, 0, 15, 0, 19, 0, 24, 0, 12, 0, | ||
| 164 | 9, 0, 25, 0, 6, 0, 40, 0, 48, 68, | ||
| 165 | 0, 0, 69, 0, 70, 0, 69, 70, 0, 8, | ||
| 166 | 0, 26, 0, 30, 0, 17, 0, 67, 71, 0, | ||
| 167 | 72, 0, 36, 0, 72, 46, 75, 47, 0, 72, | ||
| 168 | 46, 1, 47, 0, 72, 32, 0, 46, 71, 47, | ||
| 169 | 0, 46, 1, 47, 0, 67, 73, 0, 74, 0, | ||
| 170 | 36, 0, 40, 0, 74, 46, 75, 47, 0, 74, | ||
| 171 | 46, 1, 47, 0, 74, 32, 0, 46, 73, 47, | ||
| 172 | 0, 46, 1, 47, 0, 76, 35, 0, 76, 0, | ||
| 173 | 77, 45, 35, 0, 0, 77, 0, 78, 0, 77, | ||
| 174 | 45, 78, 0, 62, 79, 0, 67, 79, 0, 80, | ||
| 175 | 0, 0, 36, 0, 40, 0, 80, 46, 75, 47, | ||
| 176 | 0, 80, 46, 1, 47, 0, 80, 32, 0, 46, | ||
| 177 | 79, 47, 0, 46, 1, 47, 0, 61, 71, 31, | ||
| 178 | 0, 0, 83, 0, 49, 33, 0, 50, 85, 44, | ||
| 179 | 0, 50, 1, 44, 0, 0, 86, 0, 87, 0, | ||
| 180 | 86, 87, 0, 61, 88, 43, 0, 1, 43, 0, | ||
| 181 | 0, 89, 0, 90, 0, 89, 45, 90, 0, 73, | ||
| 182 | 92, 0, 36, 91, 0, 91, 0, 51, 33, 0, | ||
| 183 | 0, 30, 0, 29, 43, 0, 0, 29, 0, 28, | ||
| 184 | 46, 36, 47, 43, 0 | ||
| 185 | }; | ||
| 186 | 202 | ||
| 187 | #endif | 203 | #if ! defined (yyoverflow) || YYERROR_VERBOSE |
| 188 | 204 | ||
| 189 | #if YYDEBUG != 0 | 205 | # ifndef YYFREE |
| 190 | static const short yyrline[] = { 0, | 206 | # define YYFREE free |
| 191 | 101, 103, 106, 109, 112, 114, 115, 116, 117, 118, | 207 | # endif |
| 192 | 119, 120, 123, 137, 139, 142, 151, 163, 169, 171, | 208 | # ifndef YYMALLOC |
| 193 | 174, 176, 179, 186, 189, 191, 192, 193, 194, 197, | 209 | # define YYMALLOC malloc |
| 194 | 199, 200, 204, 206, 208, 212, 219, 226, 235, 236, | 210 | # endif |
| 195 | 237, 240, 242, 243, 244, 245, 246, 247, 248, 249, | ||
| 196 | 250, 251, 254, 259, 261, 264, 266, 269, 270, 270, | ||
| 197 | 271, 278, 280, 283, 293, 295, 297, 299, 301, 307, | ||
| 198 | 309, 312, 314, 315, 317, 319, 321, 323, 327, 329, | ||
| 199 | 330, 333, 335, 338, 340, 344, 349, 352, 355, 357, | ||
| 200 | 365, 369, 371, 373, 375, 377, 381, 390, 392, 396, | ||
| 201 | 401, 403, 406, 408, 411, 413, 416, 419, 423, 425, | ||
| 202 | 428, 430, 433, 435, 436, 439, 443, 445, 448, 452, | ||
| 203 | 454, 457 | ||
| 204 | }; | ||
| 205 | #endif | ||
| 206 | 211 | ||
| 212 | /* The parser invokes alloca or malloc; define the necessary symbols. */ | ||
| 213 | |||
| 214 | # ifdef YYSTACK_USE_ALLOCA | ||
| 215 | # if YYSTACK_USE_ALLOCA | ||
| 216 | # ifdef __GNUC__ | ||
| 217 | # define YYSTACK_ALLOC __builtin_alloca | ||
| 218 | # else | ||
| 219 | # define YYSTACK_ALLOC alloca | ||
| 220 | # endif | ||
| 221 | # endif | ||
| 222 | # endif | ||
| 223 | |||
| 224 | # ifdef YYSTACK_ALLOC | ||
| 225 | /* Pacify GCC's `empty if-body' warning. */ | ||
| 226 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) | ||
| 227 | # else | ||
| 228 | # if defined (__STDC__) || defined (__cplusplus) | ||
| 229 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | ||
| 230 | # define YYSIZE_T size_t | ||
| 231 | # endif | ||
| 232 | # define YYSTACK_ALLOC YYMALLOC | ||
| 233 | # define YYSTACK_FREE YYFREE | ||
| 234 | # endif | ||
| 235 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ | ||
| 236 | |||
| 237 | |||
| 238 | #if (! defined (yyoverflow) \ | ||
| 239 | && (! defined (__cplusplus) \ | ||
| 240 | || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL))) | ||
| 241 | |||
| 242 | /* A type that is properly aligned for any stack member. */ | ||
| 243 | union yyalloc | ||
| 244 | { | ||
| 245 | short int yyss; | ||
| 246 | YYSTYPE yyvs; | ||
| 247 | }; | ||
| 248 | |||
| 249 | /* The size of the maximum gap between one aligned stack and the next. */ | ||
| 250 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) | ||
| 251 | |||
| 252 | /* The size of an array large to enough to hold all stacks, each with | ||
| 253 | N elements. */ | ||
| 254 | # define YYSTACK_BYTES(N) \ | ||
| 255 | ((N) * (sizeof (short int) + sizeof (YYSTYPE)) \ | ||
| 256 | + YYSTACK_GAP_MAXIMUM) | ||
| 257 | |||
| 258 | /* Copy COUNT objects from FROM to TO. The source and destination do | ||
| 259 | not overlap. */ | ||
| 260 | # ifndef YYCOPY | ||
| 261 | # if defined (__GNUC__) && 1 < __GNUC__ | ||
| 262 | # define YYCOPY(To, From, Count) \ | ||
| 263 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) | ||
| 264 | # else | ||
| 265 | # define YYCOPY(To, From, Count) \ | ||
| 266 | do \ | ||
| 267 | { \ | ||
| 268 | register YYSIZE_T yyi; \ | ||
| 269 | for (yyi = 0; yyi < (Count); yyi++) \ | ||
| 270 | (To)[yyi] = (From)[yyi]; \ | ||
| 271 | } \ | ||
| 272 | while (0) | ||
| 273 | # endif | ||
| 274 | # endif | ||
| 275 | |||
| 276 | /* Relocate STACK from its old location to the new one. The | ||
| 277 | local variables YYSIZE and YYSTACKSIZE give the old and new number of | ||
| 278 | elements in the stack, and YYPTR gives the new location of the | ||
| 279 | stack. Advance YYPTR to a properly aligned location for the next | ||
| 280 | stack. */ | ||
| 281 | # define YYSTACK_RELOCATE(Stack) \ | ||
| 282 | do \ | ||
| 283 | { \ | ||
| 284 | YYSIZE_T yynewbytes; \ | ||
| 285 | YYCOPY (&yyptr->Stack, Stack, yysize); \ | ||
| 286 | Stack = &yyptr->Stack; \ | ||
| 287 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ | ||
| 288 | yyptr += yynewbytes / sizeof (*yyptr); \ | ||
| 289 | } \ | ||
| 290 | while (0) | ||
| 207 | 291 | ||
| 208 | #if YYDEBUG != 0 || defined (YYERROR_VERBOSE) | ||
| 209 | |||
| 210 | static const char * const yytname[] = { "$","error","$undefined.","ASM_KEYW", | ||
| 211 | "ATTRIBUTE_KEYW","AUTO_KEYW","BOOL_KEYW","CHAR_KEYW","CONST_KEYW","DOUBLE_KEYW", | ||
| 212 | "ENUM_KEYW","EXTERN_KEYW","FLOAT_KEYW","INLINE_KEYW","INT_KEYW","LONG_KEYW", | ||
| 213 | "REGISTER_KEYW","RESTRICT_KEYW","SHORT_KEYW","SIGNED_KEYW","STATIC_KEYW","STRUCT_KEYW", | ||
| 214 | "TYPEDEF_KEYW","UNION_KEYW","UNSIGNED_KEYW","VOID_KEYW","VOLATILE_KEYW","TYPEOF_KEYW", | ||
| 215 | "EXPORT_SYMBOL_KEYW","ASM_PHRASE","ATTRIBUTE_PHRASE","BRACE_PHRASE","BRACKET_PHRASE", | ||
| 216 | "EXPRESSION_PHRASE","CHAR","DOTS","IDENT","INT","REAL","STRING","TYPE","OTHER", | ||
| 217 | "FILENAME","';'","'}'","','","'('","')'","'*'","'='","'{'","':'","declaration_seq", | ||
| 218 | "declaration","@1","declaration1","@2","simple_declaration","init_declarator_list_opt", | ||
| 219 | "init_declarator_list","init_declarator","decl_specifier_seq_opt","decl_specifier_seq", | ||
| 220 | "decl_specifier","storage_class_specifier","type_specifier","simple_type_specifier", | ||
| 221 | "ptr_operator","cvar_qualifier_seq_opt","cvar_qualifier_seq","cvar_qualifier", | ||
| 222 | "declarator","direct_declarator","nested_declarator","direct_nested_declarator", | ||
| 223 | "parameter_declaration_clause","parameter_declaration_list_opt","parameter_declaration_list", | ||
| 224 | "parameter_declaration","m_abstract_declarator","direct_m_abstract_declarator", | ||
| 225 | "function_definition","initializer_opt","initializer","class_body","member_specification_opt", | ||
| 226 | "member_specification","member_declaration","member_declarator_list_opt","member_declarator_list", | ||
| 227 | "member_declarator","member_bitfield_declarator","attribute_opt","asm_definition", | ||
| 228 | "asm_phrase_opt","export_definition", NULL | ||
| 229 | }; | ||
| 230 | #endif | 292 | #endif |
| 231 | 293 | ||
| 232 | static const short yyr1[] = { 0, | 294 | #if defined (__STDC__) || defined (__cplusplus) |
| 233 | 52, 52, 54, 53, 56, 55, 55, 55, 55, 55, | 295 | typedef signed char yysigned_char; |
| 234 | 55, 55, 57, 58, 58, 59, 59, 60, 61, 61, | 296 | #else |
| 235 | 62, 62, 63, 63, 64, 64, 64, 64, 64, 65, | 297 | typedef short int yysigned_char; |
| 236 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, | 298 | #endif |
| 237 | 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, | 299 | |
| 238 | 66, 66, 67, 68, 68, 69, 69, 70, 70, 70, | 300 | /* YYFINAL -- State number of the termination state. */ |
| 239 | 70, 71, 71, 72, 72, 72, 72, 72, 72, 73, | 301 | #define YYFINAL 4 |
| 240 | 73, 74, 74, 74, 74, 74, 74, 74, 75, 75, | 302 | /* YYLAST -- Last index in YYTABLE. */ |
| 241 | 75, 76, 76, 77, 77, 78, 79, 79, 80, 80, | 303 | #define YYLAST 535 |
| 242 | 80, 80, 80, 80, 80, 80, 81, 82, 82, 83, | 304 | |
| 243 | 84, 84, 85, 85, 86, 86, 87, 87, 88, 88, | 305 | /* YYNTOKENS -- Number of terminals. */ |
| 244 | 89, 89, 90, 90, 90, 91, 92, 92, 93, 94, | 306 | #define YYNTOKENS 52 |
| 245 | 94, 95 | 307 | /* YYNNTS -- Number of nonterminals. */ |
| 308 | #define YYNNTS 45 | ||
| 309 | /* YYNRULES -- Number of rules. */ | ||
| 310 | #define YYNRULES 124 | ||
| 311 | /* YYNRULES -- Number of states. */ | ||
| 312 | #define YYNSTATES 174 | ||
| 313 | |||
| 314 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ | ||
| 315 | #define YYUNDEFTOK 2 | ||
| 316 | #define YYMAXUTOK 297 | ||
| 317 | |||
| 318 | #define YYTRANSLATE(YYX) \ | ||
| 319 | ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) | ||
| 320 | |||
| 321 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ | ||
| 322 | static const unsigned char yytranslate[] = | ||
| 323 | { | ||
| 324 | 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 325 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 326 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 327 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 328 | 46, 48, 47, 2, 45, 2, 2, 2, 2, 2, | ||
| 329 | 2, 2, 2, 2, 2, 2, 2, 2, 51, 43, | ||
| 330 | 2, 49, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 331 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 332 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 333 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 334 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 335 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 336 | 2, 2, 2, 50, 2, 44, 2, 2, 2, 2, | ||
| 337 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 338 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 339 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 340 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 341 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 342 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 343 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 344 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 345 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 346 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 347 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 348 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 349 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, | ||
| 350 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | ||
| 351 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, | ||
| 352 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, | ||
| 353 | 35, 36, 37, 38, 39, 40, 41, 42 | ||
| 246 | }; | 354 | }; |
| 247 | 355 | ||
| 248 | static const short yyr2[] = { 0, | 356 | #if YYDEBUG |
| 249 | 1, 2, 0, 2, 0, 3, 1, 1, 1, 1, | 357 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in |
| 250 | 2, 2, 3, 0, 1, 1, 3, 4, 0, 1, | 358 | YYRHS. */ |
| 251 | 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, | 359 | static const unsigned short int yyprhs[] = |
| 252 | 1, 4, 2, 2, 2, 3, 3, 3, 2, 2, | 360 | { |
| 253 | 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, | 361 | 0, 0, 3, 5, 8, 9, 12, 13, 17, 19, |
| 254 | 1, 1, 2, 0, 1, 1, 2, 1, 1, 1, | 362 | 21, 23, 25, 28, 31, 35, 36, 38, 40, 44, |
| 255 | 1, 2, 1, 1, 4, 4, 2, 3, 3, 2, | 363 | 49, 50, 52, 54, 57, 59, 61, 63, 65, 67, |
| 256 | 1, 1, 1, 4, 4, 2, 3, 3, 2, 1, | 364 | 69, 71, 73, 75, 81, 86, 89, 92, 95, 99, |
| 257 | 3, 0, 1, 1, 3, 2, 2, 1, 0, 1, | 365 | 103, 107, 110, 113, 116, 118, 120, 122, 124, 126, |
| 258 | 1, 4, 4, 2, 3, 3, 3, 0, 1, 2, | 366 | 128, 130, 132, 134, 136, 138, 141, 142, 144, 146, |
| 259 | 3, 3, 0, 1, 1, 2, 3, 2, 0, 1, | 367 | 149, 151, 153, 155, 157, 160, 162, 164, 169, 174, |
| 260 | 1, 3, 2, 2, 1, 2, 0, 1, 2, 0, | 368 | 177, 181, 185, 188, 190, 192, 194, 199, 204, 207, |
| 261 | 1, 5 | 369 | 211, 215, 218, 220, 224, 225, 227, 229, 233, 236, |
| 370 | 239, 241, 242, 244, 246, 251, 256, 259, 263, 267, | ||
| 371 | 271, 272, 274, 277, 281, 285, 286, 288, 290, 293, | ||
| 372 | 297, 300, 301, 303, 305, 309, 312, 315, 317, 320, | ||
| 373 | 321, 323, 326, 327, 329 | ||
| 262 | }; | 374 | }; |
| 263 | 375 | ||
| 264 | static const short yydefact[] = { 3, | 376 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ |
| 265 | 3, 1, 0, 2, 0, 25, 51, 42, 58, 49, | 377 | static const yysigned_char yyrhs[] = |
| 266 | 0, 28, 48, 29, 44, 45, 26, 61, 43, 46, | 378 | { |
| 267 | 27, 0, 5, 0, 47, 50, 59, 0, 0, 0, | 379 | 53, 0, -1, 54, -1, 53, 54, -1, -1, 55, |
| 268 | 60, 52, 4, 7, 14, 20, 21, 23, 24, 30, | 380 | 56, -1, -1, 22, 57, 58, -1, 58, -1, 82, |
| 269 | 31, 8, 9, 10, 11, 12, 39, 35, 33, 0, | 381 | -1, 94, -1, 96, -1, 1, 43, -1, 1, 44, |
| 270 | 40, 19, 34, 41, 0, 0, 119, 64, 0, 54, | 382 | -1, 62, 59, 43, -1, -1, 60, -1, 61, -1, |
| 271 | 0, 15, 16, 0, 120, 63, 22, 38, 36, 0, | 383 | 60, 45, 61, -1, 72, 95, 93, 83, -1, -1, |
| 272 | 109, 0, 0, 105, 6, 14, 37, 0, 0, 0, | 384 | 63, -1, 64, -1, 63, 64, -1, 65, -1, 66, |
| 273 | 0, 53, 55, 56, 13, 0, 62, 121, 97, 117, | 385 | -1, 5, -1, 16, -1, 20, -1, 11, -1, 13, |
| 274 | 67, 0, 108, 102, 72, 73, 0, 0, 0, 117, | 386 | -1, 67, -1, 71, -1, 27, 46, 63, 47, 48, |
| 275 | 71, 0, 110, 111, 115, 101, 0, 106, 120, 32, | 387 | -1, 27, 46, 63, 48, -1, 21, 36, -1, 23, |
| 276 | 0, 69, 68, 57, 17, 118, 98, 0, 89, 0, | 388 | 36, -1, 10, 36, -1, 21, 36, 85, -1, 23, |
| 277 | 80, 83, 84, 114, 0, 72, 0, 116, 70, 113, | 389 | 36, 85, -1, 10, 36, 31, -1, 10, 31, -1, |
| 278 | 76, 0, 107, 0, 122, 0, 18, 99, 66, 90, | 390 | 21, 85, -1, 23, 85, -1, 7, -1, 18, -1, |
| 279 | 52, 0, 89, 86, 88, 65, 79, 0, 78, 77, | 391 | 14, -1, 15, -1, 19, -1, 24, -1, 12, -1, |
| 280 | 0, 0, 112, 100, 0, 91, 0, 87, 94, 0, | 392 | 9, -1, 25, -1, 6, -1, 40, -1, 47, 69, |
| 281 | 81, 85, 75, 74, 96, 95, 0, 0, 93, 92, | 393 | -1, -1, 70, -1, 71, -1, 70, 71, -1, 8, |
| 282 | 0, 0 | 394 | -1, 26, -1, 30, -1, 17, -1, 68, 72, -1, |
| 395 | 73, -1, 36, -1, 73, 46, 76, 48, -1, 73, | ||
| 396 | 46, 1, 48, -1, 73, 32, -1, 46, 72, 48, | ||
| 397 | -1, 46, 1, 48, -1, 68, 74, -1, 75, -1, | ||
| 398 | 36, -1, 40, -1, 75, 46, 76, 48, -1, 75, | ||
| 399 | 46, 1, 48, -1, 75, 32, -1, 46, 74, 48, | ||
| 400 | -1, 46, 1, 48, -1, 77, 35, -1, 77, -1, | ||
| 401 | 78, 45, 35, -1, -1, 78, -1, 79, -1, 78, | ||
| 402 | 45, 79, -1, 63, 80, -1, 68, 80, -1, 81, | ||
| 403 | -1, -1, 36, -1, 40, -1, 81, 46, 76, 48, | ||
| 404 | -1, 81, 46, 1, 48, -1, 81, 32, -1, 46, | ||
| 405 | 80, 48, -1, 46, 1, 48, -1, 62, 72, 31, | ||
| 406 | -1, -1, 84, -1, 49, 33, -1, 50, 86, 44, | ||
| 407 | -1, 50, 1, 44, -1, -1, 87, -1, 88, -1, | ||
| 408 | 87, 88, -1, 62, 89, 43, -1, 1, 43, -1, | ||
| 409 | -1, 90, -1, 91, -1, 90, 45, 91, -1, 74, | ||
| 410 | 93, -1, 36, 92, -1, 92, -1, 51, 33, -1, | ||
| 411 | -1, 30, -1, 29, 43, -1, -1, 29, -1, 28, | ||
| 412 | 46, 36, 48, 43, -1 | ||
| 283 | }; | 413 | }; |
| 284 | 414 | ||
| 285 | static const short yydefgoto[] = { 1, | 415 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
| 286 | 2, 3, 33, 52, 34, 61, 62, 63, 71, 36, | 416 | static const unsigned short int yyrline[] = |
| 287 | 37, 38, 39, 40, 64, 82, 83, 41, 109, 66, | 417 | { |
| 288 | 100, 101, 120, 121, 122, 123, 144, 145, 42, 137, | 418 | 0, 102, 102, 103, 107, 107, 113, 113, 115, 116, |
| 289 | 138, 51, 72, 73, 74, 102, 103, 104, 105, 117, | 419 | 117, 118, 119, 120, 124, 138, 139, 143, 151, 164, |
| 290 | 43, 90, 44 | 420 | 170, 171, 175, 176, 180, 186, 190, 191, 192, 193, |
| 421 | 194, 198, 199, 200, 201, 205, 207, 209, 213, 220, | ||
| 422 | 227, 236, 237, 238, 242, 243, 244, 245, 246, 247, | ||
| 423 | 248, 249, 250, 251, 252, 256, 261, 262, 266, 267, | ||
| 424 | 271, 271, 271, 272, 280, 281, 285, 294, 296, 298, | ||
| 425 | 300, 302, 309, 310, 314, 315, 316, 318, 320, 322, | ||
| 426 | 324, 329, 330, 331, 335, 336, 340, 341, 346, 351, | ||
| 427 | 353, 357, 358, 366, 370, 372, 374, 376, 378, 383, | ||
| 428 | 392, 393, 398, 403, 404, 408, 409, 413, 414, 418, | ||
| 429 | 420, 425, 426, 430, 431, 435, 436, 437, 441, 445, | ||
| 430 | 446, 450, 454, 455, 459 | ||
| 291 | }; | 431 | }; |
| 432 | #endif | ||
| 292 | 433 | ||
| 293 | static const short yypact[] = {-32768, | 434 | #if YYDEBUG || YYERROR_VERBOSE |
| 294 | 15,-32768, 197,-32768, 23,-32768,-32768,-32768,-32768,-32768, | 435 | /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. |
| 295 | -18,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, | 436 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ |
| 296 | -32768, -28,-32768, -25,-32768,-32768,-32768, -26, -22, -12, | 437 | static const char *const yytname[] = |
| 297 | -32768,-32768,-32768,-32768, 49, 493,-32768,-32768,-32768,-32768, | 438 | { |
| 298 | -32768,-32768,-32768,-32768,-32768,-32768,-32768, 27, -8, 101, | 439 | "$end", "error", "$undefined", "ASM_KEYW", "ATTRIBUTE_KEYW", |
| 299 | -32768, 493, -8,-32768, 493, 10,-32768,-32768, 11, 9, | 440 | "AUTO_KEYW", "BOOL_KEYW", "CHAR_KEYW", "CONST_KEYW", "DOUBLE_KEYW", |
| 300 | 18, 26,-32768, 49, -15, -13,-32768,-32768,-32768, 25, | 441 | "ENUM_KEYW", "EXTERN_KEYW", "FLOAT_KEYW", "INLINE_KEYW", "INT_KEYW", |
| 301 | 24, 48, 149,-32768,-32768, 49,-32768, 414, 39, 40, | 442 | "LONG_KEYW", "REGISTER_KEYW", "RESTRICT_KEYW", "SHORT_KEYW", |
| 302 | 47,-32768, 9,-32768,-32768, 49,-32768,-32768,-32768, 66, | 443 | "SIGNED_KEYW", "STATIC_KEYW", "STRUCT_KEYW", "TYPEDEF_KEYW", |
| 303 | -32768, 241,-32768,-32768, 50,-32768, 5, 65, 42, 66, | 444 | "UNION_KEYW", "UNSIGNED_KEYW", "VOID_KEYW", "VOLATILE_KEYW", |
| 304 | 17, 56, 55,-32768,-32768,-32768, 60,-32768, 75,-32768, | 445 | "TYPEOF_KEYW", "EXPORT_SYMBOL_KEYW", "ASM_PHRASE", "ATTRIBUTE_PHRASE", |
| 305 | 80,-32768,-32768,-32768,-32768,-32768, 81, 82, 370, 85, | 446 | "BRACE_PHRASE", "BRACKET_PHRASE", "EXPRESSION_PHRASE", "CHAR", "DOTS", |
| 306 | 98, 89,-32768,-32768, 88,-32768, 91,-32768,-32768,-32768, | 447 | "IDENT", "INT", "REAL", "STRING", "TYPE", "OTHER", "FILENAME", "';'", |
| 307 | -32768, 284,-32768, 24,-32768, 103,-32768,-32768,-32768,-32768, | 448 | "'}'", "','", "'('", "'*'", "')'", "'='", "'{'", "':'", "$accept", |
| 308 | -32768, 8, 43,-32768, 30,-32768,-32768, 457,-32768,-32768, | 449 | "declaration_seq", "declaration", "@1", "declaration1", "@2", |
| 309 | 92, 93,-32768,-32768, 95,-32768, 96,-32768,-32768, 327, | 450 | "simple_declaration", "init_declarator_list_opt", "init_declarator_list", |
| 310 | -32768,-32768,-32768,-32768,-32768,-32768, 99, 104,-32768,-32768, | 451 | "init_declarator", "decl_specifier_seq_opt", "decl_specifier_seq", |
| 311 | 148,-32768 | 452 | "decl_specifier", "storage_class_specifier", "type_specifier", |
| 453 | "simple_type_specifier", "ptr_operator", "cvar_qualifier_seq_opt", | ||
| 454 | "cvar_qualifier_seq", "cvar_qualifier", "declarator", | ||
| 455 | "direct_declarator", "nested_declarator", "direct_nested_declarator", | ||
| 456 | "parameter_declaration_clause", "parameter_declaration_list_opt", | ||
| 457 | "parameter_declaration_list", "parameter_declaration", | ||
| 458 | "m_abstract_declarator", "direct_m_abstract_declarator", | ||
| 459 | "function_definition", "initializer_opt", "initializer", "class_body", | ||
| 460 | "member_specification_opt", "member_specification", "member_declaration", | ||
| 461 | "member_declarator_list_opt", "member_declarator_list", | ||
| 462 | "member_declarator", "member_bitfield_declarator", "attribute_opt", | ||
| 463 | "asm_definition", "asm_phrase_opt", "export_definition", 0 | ||
| 312 | }; | 464 | }; |
| 465 | #endif | ||
| 313 | 466 | ||
| 314 | static const short yypgoto[] = {-32768, | 467 | # ifdef YYPRINT |
| 315 | 152,-32768,-32768,-32768, 119,-32768,-32768, 94, 0, -55, | 468 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to |
| 316 | -35,-32768,-32768,-32768, -69,-32768,-32768, -56, -30,-32768, | 469 | token YYLEX-NUM. */ |
| 317 | -76,-32768, -122,-32768,-32768, 29, -62,-32768,-32768,-32768, | 470 | static const unsigned short int yytoknum[] = |
| 318 | -32768, -17,-32768,-32768, 105,-32768,-32768, 52, 86, 83, | 471 | { |
| 319 | -32768,-32768,-32768 | 472 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, |
| 473 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, | ||
| 474 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, | ||
| 475 | 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, | ||
| 476 | 295, 296, 297, 59, 125, 44, 40, 42, 41, 61, | ||
| 477 | 123, 58 | ||
| 320 | }; | 478 | }; |
| 479 | # endif | ||
| 321 | 480 | ||
| 481 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ | ||
| 482 | static const unsigned char yyr1[] = | ||
| 483 | { | ||
| 484 | 0, 52, 53, 53, 55, 54, 57, 56, 56, 56, | ||
| 485 | 56, 56, 56, 56, 58, 59, 59, 60, 60, 61, | ||
| 486 | 62, 62, 63, 63, 64, 64, 65, 65, 65, 65, | ||
| 487 | 65, 66, 66, 66, 66, 66, 66, 66, 66, 66, | ||
| 488 | 66, 66, 66, 66, 67, 67, 67, 67, 67, 67, | ||
| 489 | 67, 67, 67, 67, 67, 68, 69, 69, 70, 70, | ||
| 490 | 71, 71, 71, 71, 72, 72, 73, 73, 73, 73, | ||
| 491 | 73, 73, 74, 74, 75, 75, 75, 75, 75, 75, | ||
| 492 | 75, 76, 76, 76, 77, 77, 78, 78, 79, 80, | ||
| 493 | 80, 81, 81, 81, 81, 81, 81, 81, 81, 82, | ||
| 494 | 83, 83, 84, 85, 85, 86, 86, 87, 87, 88, | ||
| 495 | 88, 89, 89, 90, 90, 91, 91, 91, 92, 93, | ||
| 496 | 93, 94, 95, 95, 96 | ||
| 497 | }; | ||
| 322 | 498 | ||
| 323 | #define YYLAST 533 | 499 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ |
| 324 | 500 | static const unsigned char yyr2[] = | |
| 325 | 501 | { | |
| 326 | static const short yytable[] = { 78, | 502 | 0, 2, 1, 2, 0, 2, 0, 3, 1, 1, |
| 327 | 67, 99, 35, 84, 65, 125, 54, 49, 155, 152, | 503 | 1, 1, 2, 2, 3, 0, 1, 1, 3, 4, |
| 328 | 53, 80, 47, 88, 171, 89, 9, 48, 91, 55, | 504 | 0, 1, 1, 2, 1, 1, 1, 1, 1, 1, |
| 329 | 127, 50, 129, 56, 50, 18, 114, 99, 81, 99, | 505 | 1, 1, 1, 5, 4, 2, 2, 2, 3, 3, |
| 330 | 57, 69, 92, 87, 27, 77, 119, 168, 31, -89, | 506 | 3, 2, 2, 2, 1, 1, 1, 1, 1, 1, |
| 331 | 126, 50, 67, 140, 96, 79, 58, 156, 131, 143, | 507 | 1, 1, 1, 1, 1, 2, 0, 1, 1, 2, |
| 332 | 97, 76, 60, 142, -89, 60, 59, 68, 60, 95, | 508 | 1, 1, 1, 1, 2, 1, 1, 4, 4, 2, |
| 333 | 85, 159, 132, 96, 99, 45, 46, 93, 94, 97, | 509 | 3, 3, 2, 1, 1, 1, 4, 4, 2, 3, |
| 334 | 86, 60, 143, 143, 98, 160, 119, 126, 140, 157, | 510 | 3, 2, 1, 3, 0, 1, 1, 3, 2, 2, |
| 335 | 158, 96, 156, 67, 58, 111, 112, 97, 142, 60, | 511 | 1, 0, 1, 1, 4, 4, 2, 3, 3, 3, |
| 336 | 60, 106, 119, 113, 59, 116, 60, 128, 133, 134, | 512 | 0, 1, 2, 3, 3, 0, 1, 1, 2, 3, |
| 337 | 98, 70, 93, 88, 119, 6, 7, 8, 9, 10, | 513 | 2, 0, 1, 1, 3, 2, 2, 1, 2, 0, |
| 338 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, | 514 | 1, 2, 0, 1, 5 |
| 339 | 21, 22, 135, 24, 25, 26, 27, 28, 139, 136, | ||
| 340 | 31, 146, 147, 148, 149, 154, -19, 150, 163, 164, | ||
| 341 | 32, 165, 166, -19, -103, 169, -19, 172, -19, 107, | ||
| 342 | 170, -19, 4, 6, 7, 8, 9, 10, 11, 12, | ||
| 343 | 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, | ||
| 344 | 75, 24, 25, 26, 27, 28, 162, 108, 31, 115, | ||
| 345 | 124, 0, 130, 0, -19, 153, 0, 0, 32, 0, | ||
| 346 | 0, -19, -104, 0, -19, 0, -19, 5, 0, -19, | ||
| 347 | 0, 6, 7, 8, 9, 10, 11, 12, 13, 14, | ||
| 348 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, | ||
| 349 | 25, 26, 27, 28, 29, 30, 31, 0, 0, 0, | ||
| 350 | 0, 0, -19, 0, 0, 0, 32, 0, 0, -19, | ||
| 351 | 0, 118, -19, 0, -19, 6, 7, 8, 9, 10, | ||
| 352 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, | ||
| 353 | 21, 22, 0, 24, 25, 26, 27, 28, 0, 0, | ||
| 354 | 31, 0, 0, 0, 0, -82, 0, 0, 0, 0, | ||
| 355 | 32, 0, 0, 0, 151, 0, 0, -82, 6, 7, | ||
| 356 | 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, | ||
| 357 | 18, 19, 20, 21, 22, 0, 24, 25, 26, 27, | ||
| 358 | 28, 0, 0, 31, 0, 0, 0, 0, -82, 0, | ||
| 359 | 0, 0, 0, 32, 0, 0, 0, 167, 0, 0, | ||
| 360 | -82, 6, 7, 8, 9, 10, 11, 12, 13, 14, | ||
| 361 | 15, 16, 17, 18, 19, 20, 21, 22, 0, 24, | ||
| 362 | 25, 26, 27, 28, 0, 0, 31, 0, 0, 0, | ||
| 363 | 0, -82, 0, 0, 0, 0, 32, 0, 0, 0, | ||
| 364 | 0, 0, 0, -82, 6, 7, 8, 9, 10, 11, | ||
| 365 | 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, | ||
| 366 | 22, 0, 24, 25, 26, 27, 28, 0, 0, 31, | ||
| 367 | 0, 0, 0, 0, 0, 140, 0, 0, 0, 141, | ||
| 368 | 0, 0, 0, 0, 0, 142, 0, 60, 6, 7, | ||
| 369 | 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, | ||
| 370 | 18, 19, 20, 21, 22, 0, 24, 25, 26, 27, | ||
| 371 | 28, 0, 0, 31, 0, 0, 0, 0, 0, 0, | ||
| 372 | 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, | ||
| 373 | 110, 6, 7, 8, 9, 10, 11, 12, 13, 14, | ||
| 374 | 15, 16, 17, 18, 19, 20, 21, 22, 0, 24, | ||
| 375 | 25, 26, 27, 28, 0, 0, 31, 0, 0, 0, | ||
| 376 | 0, 161, 0, 0, 0, 0, 32, 6, 7, 8, | ||
| 377 | 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, | ||
| 378 | 19, 20, 21, 22, 0, 24, 25, 26, 27, 28, | ||
| 379 | 0, 0, 31, 0, 0, 0, 0, 0, 0, 0, | ||
| 380 | 0, 0, 32 | ||
| 381 | }; | 515 | }; |
| 382 | 516 | ||
| 383 | static const short yycheck[] = { 55, | 517 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state |
| 384 | 36, 71, 3, 60, 35, 1, 24, 36, 1, 132, | 518 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero |
| 385 | 36, 1, 31, 29, 0, 31, 8, 36, 32, 46, | 519 | means the default is an error. */ |
| 386 | 97, 50, 99, 46, 50, 17, 83, 97, 59, 99, | 520 | static const unsigned char yydefact[] = |
| 387 | 43, 49, 46, 64, 26, 53, 92, 160, 30, 32, | 521 | { |
| 388 | 36, 50, 78, 36, 40, 36, 36, 40, 32, 119, | 522 | 4, 4, 2, 0, 1, 3, 0, 26, 53, 44, |
| 389 | 46, 52, 48, 46, 47, 48, 46, 31, 48, 36, | 523 | 60, 51, 0, 29, 50, 30, 46, 47, 27, 63, |
| 390 | 43, 32, 46, 40, 134, 43, 44, 43, 44, 46, | 524 | 45, 48, 28, 0, 6, 0, 49, 52, 61, 0, |
| 391 | 45, 48, 142, 143, 51, 46, 132, 36, 36, 142, | 525 | 0, 0, 62, 54, 5, 8, 15, 21, 22, 24, |
| 392 | 143, 40, 40, 119, 36, 47, 47, 46, 46, 48, | 526 | 25, 31, 32, 9, 10, 11, 12, 13, 41, 37, |
| 393 | 48, 44, 148, 47, 46, 30, 48, 33, 43, 45, | 527 | 35, 0, 42, 20, 36, 43, 0, 0, 121, 66, |
| 394 | 51, 1, 43, 29, 160, 5, 6, 7, 8, 9, | 528 | 0, 56, 0, 16, 17, 0, 122, 65, 23, 40, |
| 395 | 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, | 529 | 38, 0, 111, 0, 0, 107, 7, 15, 39, 0, |
| 396 | 20, 21, 43, 23, 24, 25, 26, 27, 47, 49, | 530 | 0, 0, 0, 55, 57, 58, 14, 0, 64, 123, |
| 397 | 30, 47, 35, 45, 47, 33, 36, 47, 47, 47, | 531 | 99, 119, 69, 0, 110, 104, 74, 75, 0, 0, |
| 398 | 40, 47, 47, 43, 44, 47, 46, 0, 48, 1, | 532 | 0, 119, 73, 0, 112, 113, 117, 103, 0, 108, |
| 399 | 47, 51, 1, 5, 6, 7, 8, 9, 10, 11, | 533 | 122, 0, 34, 0, 71, 70, 59, 18, 120, 100, |
| 400 | 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, | 534 | 0, 91, 0, 82, 85, 86, 116, 0, 74, 0, |
| 401 | 52, 23, 24, 25, 26, 27, 148, 73, 30, 86, | 535 | 118, 72, 115, 78, 0, 109, 0, 33, 124, 0, |
| 402 | 95, -1, 100, -1, 36, 134, -1, -1, 40, -1, | 536 | 19, 101, 68, 92, 54, 0, 91, 88, 90, 67, |
| 403 | -1, 43, 44, -1, 46, -1, 48, 1, -1, 51, | 537 | 81, 0, 80, 79, 0, 0, 114, 102, 0, 93, |
| 404 | -1, 5, 6, 7, 8, 9, 10, 11, 12, 13, | 538 | 0, 89, 96, 0, 83, 87, 77, 76, 98, 97, |
| 405 | 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, | 539 | 0, 0, 95, 94 |
| 406 | 24, 25, 26, 27, 28, 29, 30, -1, -1, -1, | ||
| 407 | -1, -1, 36, -1, -1, -1, 40, -1, -1, 43, | ||
| 408 | -1, 1, 46, -1, 48, 5, 6, 7, 8, 9, | ||
| 409 | 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, | ||
| 410 | 20, 21, -1, 23, 24, 25, 26, 27, -1, -1, | ||
| 411 | 30, -1, -1, -1, -1, 35, -1, -1, -1, -1, | ||
| 412 | 40, -1, -1, -1, 1, -1, -1, 47, 5, 6, | ||
| 413 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, | ||
| 414 | 17, 18, 19, 20, 21, -1, 23, 24, 25, 26, | ||
| 415 | 27, -1, -1, 30, -1, -1, -1, -1, 35, -1, | ||
| 416 | -1, -1, -1, 40, -1, -1, -1, 1, -1, -1, | ||
| 417 | 47, 5, 6, 7, 8, 9, 10, 11, 12, 13, | ||
| 418 | 14, 15, 16, 17, 18, 19, 20, 21, -1, 23, | ||
| 419 | 24, 25, 26, 27, -1, -1, 30, -1, -1, -1, | ||
| 420 | -1, 35, -1, -1, -1, -1, 40, -1, -1, -1, | ||
| 421 | -1, -1, -1, 47, 5, 6, 7, 8, 9, 10, | ||
| 422 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, | ||
| 423 | 21, -1, 23, 24, 25, 26, 27, -1, -1, 30, | ||
| 424 | -1, -1, -1, -1, -1, 36, -1, -1, -1, 40, | ||
| 425 | -1, -1, -1, -1, -1, 46, -1, 48, 5, 6, | ||
| 426 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, | ||
| 427 | 17, 18, 19, 20, 21, -1, 23, 24, 25, 26, | ||
| 428 | 27, -1, -1, 30, -1, -1, -1, -1, -1, -1, | ||
| 429 | -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, | ||
| 430 | 47, 5, 6, 7, 8, 9, 10, 11, 12, 13, | ||
| 431 | 14, 15, 16, 17, 18, 19, 20, 21, -1, 23, | ||
| 432 | 24, 25, 26, 27, -1, -1, 30, -1, -1, -1, | ||
| 433 | -1, 35, -1, -1, -1, -1, 40, 5, 6, 7, | ||
| 434 | 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, | ||
| 435 | 18, 19, 20, 21, -1, 23, 24, 25, 26, 27, | ||
| 436 | -1, -1, 30, -1, -1, -1, -1, -1, -1, -1, | ||
| 437 | -1, -1, 40 | ||
| 438 | }; | 540 | }; |
| 439 | /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ | ||
| 440 | #line 3 "/usr/lib/bison.simple" | ||
| 441 | /* This file comes from bison-1.28. */ | ||
| 442 | 541 | ||
| 443 | /* Skeleton output parser for bison, | 542 | /* YYDEFGOTO[NTERM-NUM]. */ |
| 444 | Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc. | 543 | static const short int yydefgoto[] = |
| 544 | { | ||
| 545 | -1, 1, 2, 3, 34, 53, 35, 62, 63, 64, | ||
| 546 | 72, 37, 38, 39, 40, 41, 65, 83, 84, 42, | ||
| 547 | 110, 67, 101, 102, 122, 123, 124, 125, 147, 148, | ||
| 548 | 43, 140, 141, 52, 73, 74, 75, 103, 104, 105, | ||
| 549 | 106, 119, 44, 91, 45 | ||
| 550 | }; | ||
| 445 | 551 | ||
| 446 | This program is free software; you can redistribute it and/or modify | 552 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing |
| 447 | it under the terms of the GNU General Public License as published by | 553 | STATE-NUM. */ |
| 448 | the Free Software Foundation; either version 2, or (at your option) | 554 | #define YYPACT_NINF -128 |
| 449 | any later version. | 555 | static const short int yypact[] = |
| 556 | { | ||
| 557 | -128, 13, -128, 329, -128, -128, 36, -128, -128, -128, | ||
| 558 | -128, -128, -16, -128, -128, -128, -128, -128, -128, -128, | ||
| 559 | -128, -128, -128, -25, -128, -24, -128, -128, -128, -29, | ||
| 560 | -4, -22, -128, -128, -128, -128, -28, 495, -128, -128, | ||
| 561 | -128, -128, -128, -128, -128, -128, -128, -128, -128, 16, | ||
| 562 | -23, 103, -128, 495, -23, -128, 495, 35, -128, -128, | ||
| 563 | 3, 15, 9, 17, -128, -28, -15, -8, -128, -128, | ||
| 564 | -128, 47, 23, 44, 150, -128, -128, -28, -128, 372, | ||
| 565 | 33, 48, 49, -128, 15, -128, -128, -28, -128, -128, | ||
| 566 | -128, 64, -128, 197, -128, -128, 50, -128, 21, 65, | ||
| 567 | 37, 64, 14, 56, 55, -128, -128, -128, 59, -128, | ||
| 568 | 74, 57, -128, 63, -128, -128, -128, -128, -128, 76, | ||
| 569 | 83, 416, 84, 99, 90, -128, -128, 88, -128, 89, | ||
| 570 | -128, -128, -128, -128, 241, -128, 23, -128, -128, 105, | ||
| 571 | -128, -128, -128, -128, -128, 8, 46, -128, 26, -128, | ||
| 572 | -128, 459, -128, -128, 92, 93, -128, -128, 94, -128, | ||
| 573 | 96, -128, -128, 285, -128, -128, -128, -128, -128, -128, | ||
| 574 | 97, 100, -128, -128 | ||
| 575 | }; | ||
| 450 | 576 | ||
| 451 | This program is distributed in the hope that it will be useful, | 577 | /* YYPGOTO[NTERM-NUM]. */ |
| 452 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 578 | static const short int yypgoto[] = |
| 453 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 579 | { |
| 454 | GNU General Public License for more details. | 580 | -128, -128, 151, -128, -128, -128, 119, -128, -128, 66, |
| 581 | 0, -56, -36, -128, -128, -128, -70, -128, -128, -51, | ||
| 582 | -31, -128, -11, -128, -127, -128, -128, 27, -81, -128, | ||
| 583 | -128, -128, -128, -19, -128, -128, 107, -128, -128, 43, | ||
| 584 | 86, 82, -128, -128, -128 | ||
| 585 | }; | ||
| 455 | 586 | ||
| 456 | You should have received a copy of the GNU General Public License | 587 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If |
| 457 | along with this program; if not, write to the Free Software | 588 | positive, shift that token. If negative, reduce the rule which |
| 458 | Foundation, Inc., 59 Temple Place - Suite 330, | 589 | number is the opposite. If zero, do what YYDEFACT says. |
| 459 | Boston, MA 02111-1307, USA. */ | 590 | If YYTABLE_NINF, syntax error. */ |
| 591 | #define YYTABLE_NINF -107 | ||
| 592 | static const short int yytable[] = | ||
| 593 | { | ||
| 594 | 79, 68, 100, 36, 81, 66, 55, 155, 59, 158, | ||
| 595 | 85, 50, 54, 4, 89, 48, 90, 56, 60, 61, | ||
| 596 | 49, 58, 127, 10, 92, 51, 51, 51, 100, 82, | ||
| 597 | 100, 70, 19, 116, 88, 78, 171, 121, 93, 59, | ||
| 598 | -91, 28, 57, 68, 143, 32, 133, 69, 159, 60, | ||
| 599 | 61, 146, 86, 77, 145, 61, -91, 128, 162, 96, | ||
| 600 | 134, 97, 87, 97, 160, 161, 100, 98, 61, 98, | ||
| 601 | 61, 80, 163, 128, 99, 146, 146, 97, 121, 46, | ||
| 602 | 47, 113, 143, 98, 61, 68, 159, 129, 107, 131, | ||
| 603 | 94, 95, 145, 61, 118, 121, 114, 115, 130, 135, | ||
| 604 | 136, 99, 94, 89, 71, 137, 138, 121, 7, 8, | ||
| 605 | 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, | ||
| 606 | 19, 20, 21, 22, 23, 139, 25, 26, 27, 28, | ||
| 607 | 29, 142, 149, 32, 150, 151, 152, 153, 157, -20, | ||
| 608 | 166, 167, 168, 33, 169, 172, -20, -105, 173, -20, | ||
| 609 | -20, 108, 5, 117, -20, 7, 8, 9, 10, 11, | ||
| 610 | 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, | ||
| 611 | 22, 23, 76, 25, 26, 27, 28, 29, 165, 156, | ||
| 612 | 32, 109, 126, 132, 0, 0, -20, 0, 0, 0, | ||
| 613 | 33, 0, 0, -20, -106, 0, -20, -20, 120, 0, | ||
| 614 | 0, -20, 7, 8, 9, 10, 11, 12, 13, 14, | ||
| 615 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 0, | ||
| 616 | 25, 26, 27, 28, 29, 0, 0, 32, 0, 0, | ||
| 617 | 0, 0, -84, 0, 0, 0, 0, 33, 0, 0, | ||
| 618 | 0, 0, 154, 0, 0, -84, 7, 8, 9, 10, | ||
| 619 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, | ||
| 620 | 21, 22, 23, 0, 25, 26, 27, 28, 29, 0, | ||
| 621 | 0, 32, 0, 0, 0, 0, -84, 0, 0, 0, | ||
| 622 | 0, 33, 0, 0, 0, 0, 170, 0, 0, -84, | ||
| 623 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, | ||
| 624 | 17, 18, 19, 20, 21, 22, 23, 0, 25, 26, | ||
| 625 | 27, 28, 29, 0, 0, 32, 0, 0, 0, 0, | ||
| 626 | -84, 0, 0, 0, 0, 33, 0, 0, 0, 0, | ||
| 627 | 6, 0, 0, -84, 7, 8, 9, 10, 11, 12, | ||
| 628 | 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, | ||
| 629 | 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, | ||
| 630 | 0, 0, 0, 0, 0, -20, 0, 0, 0, 33, | ||
| 631 | 0, 0, -20, 0, 0, -20, -20, 7, 8, 9, | ||
| 632 | 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, | ||
| 633 | 20, 21, 22, 23, 0, 25, 26, 27, 28, 29, | ||
| 634 | 0, 0, 32, 0, 0, 0, 0, 0, 0, 0, | ||
| 635 | 0, 0, 33, 0, 0, 0, 0, 0, 0, 111, | ||
| 636 | 112, 7, 8, 9, 10, 11, 12, 13, 14, 15, | ||
| 637 | 16, 17, 18, 19, 20, 21, 22, 23, 0, 25, | ||
| 638 | 26, 27, 28, 29, 0, 0, 32, 0, 0, 0, | ||
| 639 | 0, 0, 143, 0, 0, 0, 144, 0, 0, 0, | ||
| 640 | 0, 0, 145, 61, 7, 8, 9, 10, 11, 12, | ||
| 641 | 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, | ||
| 642 | 23, 0, 25, 26, 27, 28, 29, 0, 0, 32, | ||
| 643 | 0, 0, 0, 0, 164, 0, 0, 0, 0, 33, | ||
| 644 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, | ||
| 645 | 17, 18, 19, 20, 21, 22, 23, 0, 25, 26, | ||
| 646 | 27, 28, 29, 0, 0, 32, 0, 0, 0, 0, | ||
| 647 | 0, 0, 0, 0, 0, 33 | ||
| 648 | }; | ||
| 460 | 649 | ||
| 461 | /* As a special exception, when this file is copied by Bison into a | 650 | static const short int yycheck[] = |
| 462 | Bison output file, you may use that output file without restriction. | 651 | { |
| 463 | This special exception was added by the Free Software Foundation | 652 | 56, 37, 72, 3, 1, 36, 25, 134, 36, 1, |
| 464 | in version 1.24 of Bison. */ | 653 | 61, 36, 36, 0, 29, 31, 31, 46, 46, 47, |
| 654 | 36, 43, 1, 8, 32, 50, 50, 50, 98, 60, | ||
| 655 | 100, 50, 17, 84, 65, 54, 163, 93, 46, 36, | ||
| 656 | 32, 26, 46, 79, 36, 30, 32, 31, 40, 46, | ||
| 657 | 47, 121, 43, 53, 46, 47, 48, 36, 32, 36, | ||
| 658 | 46, 40, 45, 40, 145, 146, 136, 46, 47, 46, | ||
| 659 | 47, 36, 46, 36, 51, 145, 146, 40, 134, 43, | ||
| 660 | 44, 48, 36, 46, 47, 121, 40, 98, 44, 100, | ||
| 661 | 43, 44, 46, 47, 30, 151, 48, 48, 33, 43, | ||
| 662 | 45, 51, 43, 29, 1, 48, 43, 163, 5, 6, | ||
| 663 | 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, | ||
| 664 | 17, 18, 19, 20, 21, 49, 23, 24, 25, 26, | ||
| 665 | 27, 48, 48, 30, 35, 45, 48, 48, 33, 36, | ||
| 666 | 48, 48, 48, 40, 48, 48, 43, 44, 48, 46, | ||
| 667 | 47, 1, 1, 87, 51, 5, 6, 7, 8, 9, | ||
| 668 | 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, | ||
| 669 | 20, 21, 53, 23, 24, 25, 26, 27, 151, 136, | ||
| 670 | 30, 74, 96, 101, -1, -1, 36, -1, -1, -1, | ||
| 671 | 40, -1, -1, 43, 44, -1, 46, 47, 1, -1, | ||
| 672 | -1, 51, 5, 6, 7, 8, 9, 10, 11, 12, | ||
| 673 | 13, 14, 15, 16, 17, 18, 19, 20, 21, -1, | ||
| 674 | 23, 24, 25, 26, 27, -1, -1, 30, -1, -1, | ||
| 675 | -1, -1, 35, -1, -1, -1, -1, 40, -1, -1, | ||
| 676 | -1, -1, 1, -1, -1, 48, 5, 6, 7, 8, | ||
| 677 | 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, | ||
| 678 | 19, 20, 21, -1, 23, 24, 25, 26, 27, -1, | ||
| 679 | -1, 30, -1, -1, -1, -1, 35, -1, -1, -1, | ||
| 680 | -1, 40, -1, -1, -1, -1, 1, -1, -1, 48, | ||
| 681 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | ||
| 682 | 15, 16, 17, 18, 19, 20, 21, -1, 23, 24, | ||
| 683 | 25, 26, 27, -1, -1, 30, -1, -1, -1, -1, | ||
| 684 | 35, -1, -1, -1, -1, 40, -1, -1, -1, -1, | ||
| 685 | 1, -1, -1, 48, 5, 6, 7, 8, 9, 10, | ||
| 686 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, | ||
| 687 | 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, | ||
| 688 | -1, -1, -1, -1, -1, 36, -1, -1, -1, 40, | ||
| 689 | -1, -1, 43, -1, -1, 46, 47, 5, 6, 7, | ||
| 690 | 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, | ||
| 691 | 18, 19, 20, 21, -1, 23, 24, 25, 26, 27, | ||
| 692 | -1, -1, 30, -1, -1, -1, -1, -1, -1, -1, | ||
| 693 | -1, -1, 40, -1, -1, -1, -1, -1, -1, 47, | ||
| 694 | 48, 5, 6, 7, 8, 9, 10, 11, 12, 13, | ||
| 695 | 14, 15, 16, 17, 18, 19, 20, 21, -1, 23, | ||
| 696 | 24, 25, 26, 27, -1, -1, 30, -1, -1, -1, | ||
| 697 | -1, -1, 36, -1, -1, -1, 40, -1, -1, -1, | ||
| 698 | -1, -1, 46, 47, 5, 6, 7, 8, 9, 10, | ||
| 699 | 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, | ||
| 700 | 21, -1, 23, 24, 25, 26, 27, -1, -1, 30, | ||
| 701 | -1, -1, -1, -1, 35, -1, -1, -1, -1, 40, | ||
| 702 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | ||
| 703 | 15, 16, 17, 18, 19, 20, 21, -1, 23, 24, | ||
| 704 | 25, 26, 27, -1, -1, 30, -1, -1, -1, -1, | ||
| 705 | -1, -1, -1, -1, -1, 40 | ||
| 706 | }; | ||
| 465 | 707 | ||
| 466 | /* This is the parser code that is written into each bison parser | 708 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing |
| 467 | when the %semantic_parser declaration is not specified in the grammar. | 709 | symbol of state STATE-NUM. */ |
| 468 | It was written by Richard Stallman by simplifying the hairy parser | 710 | static const unsigned char yystos[] = |
| 469 | used when %semantic_parser is specified. */ | 711 | { |
| 712 | 0, 53, 54, 55, 0, 54, 1, 5, 6, 7, | ||
| 713 | 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, | ||
| 714 | 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, | ||
| 715 | 28, 29, 30, 40, 56, 58, 62, 63, 64, 65, | ||
| 716 | 66, 67, 71, 82, 94, 96, 43, 44, 31, 36, | ||
| 717 | 36, 50, 85, 57, 36, 85, 46, 46, 43, 36, | ||
| 718 | 46, 47, 59, 60, 61, 68, 72, 73, 64, 31, | ||
| 719 | 85, 1, 62, 86, 87, 88, 58, 62, 85, 63, | ||
| 720 | 36, 1, 72, 69, 70, 71, 43, 45, 72, 29, | ||
| 721 | 31, 95, 32, 46, 43, 44, 36, 40, 46, 51, | ||
| 722 | 68, 74, 75, 89, 90, 91, 92, 44, 1, 88, | ||
| 723 | 72, 47, 48, 48, 48, 48, 71, 61, 30, 93, | ||
| 724 | 1, 63, 76, 77, 78, 79, 92, 1, 36, 74, | ||
| 725 | 33, 74, 93, 32, 46, 43, 45, 48, 43, 49, | ||
| 726 | 83, 84, 48, 36, 40, 46, 68, 80, 81, 48, | ||
| 727 | 35, 45, 48, 48, 1, 76, 91, 33, 1, 40, | ||
| 728 | 80, 80, 32, 46, 35, 79, 48, 48, 48, 48, | ||
| 729 | 1, 76, 48, 48 | ||
| 730 | }; | ||
| 470 | 731 | ||
| 471 | #ifndef YYSTACK_USE_ALLOCA | 732 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) |
| 472 | #ifdef alloca | 733 | # define YYSIZE_T __SIZE_TYPE__ |
| 473 | #define YYSTACK_USE_ALLOCA | ||
| 474 | #else /* alloca not defined */ | ||
| 475 | #ifdef __GNUC__ | ||
| 476 | #define YYSTACK_USE_ALLOCA | ||
| 477 | #define alloca __builtin_alloca | ||
| 478 | #else /* not GNU C. */ | ||
| 479 | #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386)) | ||
| 480 | #define YYSTACK_USE_ALLOCA | ||
| 481 | #include <alloca.h> | ||
| 482 | #else /* not sparc */ | ||
| 483 | /* We think this test detects Watcom and Microsoft C. */ | ||
| 484 | /* This used to test MSDOS, but that is a bad idea | ||
| 485 | since that symbol is in the user namespace. */ | ||
| 486 | #if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__) | ||
| 487 | #if 0 /* No need for malloc.h, which pollutes the namespace; | ||
| 488 | instead, just don't use alloca. */ | ||
| 489 | #include <malloc.h> | ||
| 490 | #endif | 734 | #endif |
| 491 | #else /* not MSDOS, or __TURBOC__ */ | 735 | #if ! defined (YYSIZE_T) && defined (size_t) |
| 492 | #if defined(_AIX) | 736 | # define YYSIZE_T size_t |
| 493 | /* I don't know what this was needed for, but it pollutes the namespace. | ||
| 494 | So I turned it off. rms, 2 May 1997. */ | ||
| 495 | /* #include <malloc.h> */ | ||
| 496 | #pragma alloca | ||
| 497 | #define YYSTACK_USE_ALLOCA | ||
| 498 | #else /* not MSDOS, or __TURBOC__, or _AIX */ | ||
| 499 | #if 0 | ||
| 500 | #ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up, | ||
| 501 | and on HPUX 10. Eventually we can turn this on. */ | ||
| 502 | #define YYSTACK_USE_ALLOCA | ||
| 503 | #define alloca __builtin_alloca | ||
| 504 | #endif /* __hpux */ | ||
| 505 | #endif | 737 | #endif |
| 506 | #endif /* not _AIX */ | 738 | #if ! defined (YYSIZE_T) |
| 507 | #endif /* not MSDOS, or __TURBOC__ */ | 739 | # if defined (__STDC__) || defined (__cplusplus) |
| 508 | #endif /* not sparc */ | 740 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ |
| 509 | #endif /* not GNU C */ | 741 | # define YYSIZE_T size_t |
| 510 | #endif /* alloca not defined */ | 742 | # endif |
| 511 | #endif /* YYSTACK_USE_ALLOCA not defined */ | 743 | #endif |
| 512 | 744 | #if ! defined (YYSIZE_T) | |
| 513 | #ifdef YYSTACK_USE_ALLOCA | 745 | # define YYSIZE_T unsigned int |
| 514 | #define YYSTACK_ALLOC alloca | ||
| 515 | #else | ||
| 516 | #define YYSTACK_ALLOC malloc | ||
| 517 | #endif | 746 | #endif |
| 518 | |||
| 519 | /* Note: there must be only one dollar sign in this file. | ||
| 520 | It is replaced by the list of actions, each action | ||
| 521 | as one case of the switch. */ | ||
| 522 | 747 | ||
| 523 | #define yyerrok (yyerrstatus = 0) | 748 | #define yyerrok (yyerrstatus = 0) |
| 524 | #define yyclearin (yychar = YYEMPTY) | 749 | #define yyclearin (yychar = YYEMPTY) |
| 525 | #define YYEMPTY -2 | 750 | #define YYEMPTY (-2) |
| 526 | #define YYEOF 0 | 751 | #define YYEOF 0 |
| 752 | |||
| 527 | #define YYACCEPT goto yyacceptlab | 753 | #define YYACCEPT goto yyacceptlab |
| 528 | #define YYABORT goto yyabortlab | 754 | #define YYABORT goto yyabortlab |
| 529 | #define YYERROR goto yyerrlab1 | 755 | #define YYERROR goto yyerrorlab |
| 530 | /* Like YYERROR except do call yyerror. | 756 | |
| 531 | This remains here temporarily to ease the | 757 | |
| 532 | transition to the new meaning of YYERROR, for GCC. | 758 | /* Like YYERROR except do call yyerror. This remains here temporarily |
| 759 | to ease the transition to the new meaning of YYERROR, for GCC. | ||
| 533 | Once GCC version 2 has supplanted version 1, this can go. */ | 760 | Once GCC version 2 has supplanted version 1, this can go. */ |
| 761 | |||
| 534 | #define YYFAIL goto yyerrlab | 762 | #define YYFAIL goto yyerrlab |
| 763 | |||
| 535 | #define YYRECOVERING() (!!yyerrstatus) | 764 | #define YYRECOVERING() (!!yyerrstatus) |
| 536 | #define YYBACKUP(token, value) \ | 765 | |
| 766 | #define YYBACKUP(Token, Value) \ | ||
| 537 | do \ | 767 | do \ |
| 538 | if (yychar == YYEMPTY && yylen == 1) \ | 768 | if (yychar == YYEMPTY && yylen == 1) \ |
| 539 | { yychar = (token), yylval = (value); \ | 769 | { \ |
| 540 | yychar1 = YYTRANSLATE (yychar); \ | 770 | yychar = (Token); \ |
| 771 | yylval = (Value); \ | ||
| 772 | yytoken = YYTRANSLATE (yychar); \ | ||
| 541 | YYPOPSTACK; \ | 773 | YYPOPSTACK; \ |
| 542 | goto yybackup; \ | 774 | goto yybackup; \ |
| 543 | } \ | 775 | } \ |
| 544 | else \ | 776 | else \ |
| 545 | { yyerror ("syntax error: cannot back up"); YYERROR; } \ | 777 | { \ |
| 778 | yyerror ("syntax error: cannot back up");\ | ||
| 779 | YYERROR; \ | ||
| 780 | } \ | ||
| 546 | while (0) | 781 | while (0) |
| 547 | 782 | ||
| 783 | |||
| 548 | #define YYTERROR 1 | 784 | #define YYTERROR 1 |
| 549 | #define YYERRCODE 256 | 785 | #define YYERRCODE 256 |
| 550 | 786 | ||
| 551 | #ifndef YYPURE | 787 | |
| 552 | #define YYLEX yylex() | 788 | /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. |
| 789 | If N is 0, then set CURRENT to the empty location which ends | ||
| 790 | the previous symbol: RHS[0] (always defined). */ | ||
| 791 | |||
| 792 | #define YYRHSLOC(Rhs, K) ((Rhs)[K]) | ||
| 793 | #ifndef YYLLOC_DEFAULT | ||
| 794 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ | ||
| 795 | do \ | ||
| 796 | if (N) \ | ||
| 797 | { \ | ||
| 798 | (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ | ||
| 799 | (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ | ||
| 800 | (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ | ||
| 801 | (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ | ||
| 802 | } \ | ||
| 803 | else \ | ||
| 804 | { \ | ||
| 805 | (Current).first_line = (Current).last_line = \ | ||
| 806 | YYRHSLOC (Rhs, 0).last_line; \ | ||
| 807 | (Current).first_column = (Current).last_column = \ | ||
| 808 | YYRHSLOC (Rhs, 0).last_column; \ | ||
| 809 | } \ | ||
| 810 | while (0) | ||
| 553 | #endif | 811 | #endif |
| 554 | 812 | ||
| 555 | #ifdef YYPURE | 813 | |
| 556 | #ifdef YYLSP_NEEDED | 814 | /* YY_LOCATION_PRINT -- Print the location on the stream. |
| 557 | #ifdef YYLEX_PARAM | 815 | This macro was not mandated originally: define only if we know |
| 558 | #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM) | 816 | we won't break user code: when these are the locations we know. */ |
| 559 | #else | 817 | |
| 560 | #define YYLEX yylex(&yylval, &yylloc) | 818 | #ifndef YY_LOCATION_PRINT |
| 819 | # if YYLTYPE_IS_TRIVIAL | ||
| 820 | # define YY_LOCATION_PRINT(File, Loc) \ | ||
| 821 | fprintf (File, "%d.%d-%d.%d", \ | ||
| 822 | (Loc).first_line, (Loc).first_column, \ | ||
| 823 | (Loc).last_line, (Loc).last_column) | ||
| 824 | # else | ||
| 825 | # define YY_LOCATION_PRINT(File, Loc) ((void) 0) | ||
| 826 | # endif | ||
| 561 | #endif | 827 | #endif |
| 562 | #else /* not YYLSP_NEEDED */ | 828 | |
| 829 | |||
| 830 | /* YYLEX -- calling `yylex' with the right arguments. */ | ||
| 831 | |||
| 563 | #ifdef YYLEX_PARAM | 832 | #ifdef YYLEX_PARAM |
| 564 | #define YYLEX yylex(&yylval, YYLEX_PARAM) | 833 | # define YYLEX yylex (YYLEX_PARAM) |
| 565 | #else | 834 | #else |
| 566 | #define YYLEX yylex(&yylval) | 835 | # define YYLEX yylex () |
| 567 | #endif | 836 | #endif |
| 568 | #endif /* not YYLSP_NEEDED */ | 837 | |
| 838 | /* Enable debugging if requested. */ | ||
| 839 | #if YYDEBUG | ||
| 840 | |||
| 841 | # ifndef YYFPRINTF | ||
| 842 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ | ||
| 843 | # define YYFPRINTF fprintf | ||
| 844 | # endif | ||
| 845 | |||
| 846 | # define YYDPRINTF(Args) \ | ||
| 847 | do { \ | ||
| 848 | if (yydebug) \ | ||
| 849 | YYFPRINTF Args; \ | ||
| 850 | } while (0) | ||
| 851 | |||
| 852 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ | ||
| 853 | do { \ | ||
| 854 | if (yydebug) \ | ||
| 855 | { \ | ||
| 856 | YYFPRINTF (stderr, "%s ", Title); \ | ||
| 857 | yysymprint (stderr, \ | ||
| 858 | Type, Value); \ | ||
| 859 | YYFPRINTF (stderr, "\n"); \ | ||
| 860 | } \ | ||
| 861 | } while (0) | ||
| 862 | |||
| 863 | /*------------------------------------------------------------------. | ||
| 864 | | yy_stack_print -- Print the state stack from its BOTTOM up to its | | ||
| 865 | | TOP (included). | | ||
| 866 | `------------------------------------------------------------------*/ | ||
| 867 | |||
| 868 | #if defined (__STDC__) || defined (__cplusplus) | ||
| 869 | static void | ||
| 870 | yy_stack_print (short int *bottom, short int *top) | ||
| 871 | #else | ||
| 872 | static void | ||
| 873 | yy_stack_print (bottom, top) | ||
| 874 | short int *bottom; | ||
| 875 | short int *top; | ||
| 569 | #endif | 876 | #endif |
| 877 | { | ||
| 878 | YYFPRINTF (stderr, "Stack now"); | ||
| 879 | for (/* Nothing. */; bottom <= top; ++bottom) | ||
| 880 | YYFPRINTF (stderr, " %d", *bottom); | ||
| 881 | YYFPRINTF (stderr, "\n"); | ||
| 882 | } | ||
| 570 | 883 | ||
| 571 | /* If nonreentrant, generate the variables here */ | 884 | # define YY_STACK_PRINT(Bottom, Top) \ |
| 885 | do { \ | ||
| 886 | if (yydebug) \ | ||
| 887 | yy_stack_print ((Bottom), (Top)); \ | ||
| 888 | } while (0) | ||
| 572 | 889 | ||
| 573 | #ifndef YYPURE | ||
| 574 | 890 | ||
| 575 | int yychar; /* the lookahead symbol */ | 891 | /*------------------------------------------------. |
| 576 | YYSTYPE yylval; /* the semantic value of the */ | 892 | | Report that the YYRULE is going to be reduced. | |
| 577 | /* lookahead symbol */ | 893 | `------------------------------------------------*/ |
| 578 | 894 | ||
| 579 | #ifdef YYLSP_NEEDED | 895 | #if defined (__STDC__) || defined (__cplusplus) |
| 580 | YYLTYPE yylloc; /* location data for the lookahead */ | 896 | static void |
| 581 | /* symbol */ | 897 | yy_reduce_print (int yyrule) |
| 898 | #else | ||
| 899 | static void | ||
| 900 | yy_reduce_print (yyrule) | ||
| 901 | int yyrule; | ||
| 582 | #endif | 902 | #endif |
| 903 | { | ||
| 904 | int yyi; | ||
| 905 | unsigned int yylno = yyrline[yyrule]; | ||
| 906 | YYFPRINTF (stderr, "Reducing stack by rule %d (line %u), ", | ||
| 907 | yyrule - 1, yylno); | ||
| 908 | /* Print the symbols being reduced, and their result. */ | ||
| 909 | for (yyi = yyprhs[yyrule]; 0 <= yyrhs[yyi]; yyi++) | ||
| 910 | YYFPRINTF (stderr, "%s ", yytname [yyrhs[yyi]]); | ||
| 911 | YYFPRINTF (stderr, "-> %s\n", yytname [yyr1[yyrule]]); | ||
| 912 | } | ||
| 583 | 913 | ||
| 584 | int yynerrs; /* number of parse errors so far */ | 914 | # define YY_REDUCE_PRINT(Rule) \ |
| 585 | #endif /* not YYPURE */ | 915 | do { \ |
| 916 | if (yydebug) \ | ||
| 917 | yy_reduce_print (Rule); \ | ||
| 918 | } while (0) | ||
| 586 | 919 | ||
| 587 | #if YYDEBUG != 0 | 920 | /* Nonzero means print parse trace. It is left uninitialized so that |
| 588 | int yydebug; /* nonzero means print parse trace */ | 921 | multiple parsers can coexist. */ |
| 589 | /* Since this is uninitialized, it does not stop multiple parsers | 922 | int yydebug; |
| 590 | from coexisting. */ | 923 | #else /* !YYDEBUG */ |
| 591 | #endif | 924 | # define YYDPRINTF(Args) |
| 925 | # define YY_SYMBOL_PRINT(Title, Type, Value, Location) | ||
| 926 | # define YY_STACK_PRINT(Bottom, Top) | ||
| 927 | # define YY_REDUCE_PRINT(Rule) | ||
| 928 | #endif /* !YYDEBUG */ | ||
| 592 | 929 | ||
| 593 | /* YYINITDEPTH indicates the initial size of the parser's stacks */ | ||
| 594 | 930 | ||
| 931 | /* YYINITDEPTH -- initial size of the parser's stacks. */ | ||
| 595 | #ifndef YYINITDEPTH | 932 | #ifndef YYINITDEPTH |
| 596 | #define YYINITDEPTH 200 | 933 | # define YYINITDEPTH 200 |
| 597 | #endif | 934 | #endif |
| 598 | 935 | ||
| 599 | /* YYMAXDEPTH is the maximum size the stacks can grow to | 936 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only |
| 600 | (effective only if the built-in stack extension method is used). */ | 937 | if the built-in stack extension method is used). |
| 601 | 938 | ||
| 602 | #if YYMAXDEPTH == 0 | 939 | Do not make this value too large; the results are undefined if |
| 603 | #undef YYMAXDEPTH | 940 | SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) |
| 604 | #endif | 941 | evaluated with infinite-precision integer arithmetic. */ |
| 605 | 942 | ||
| 606 | #ifndef YYMAXDEPTH | 943 | #ifndef YYMAXDEPTH |
| 607 | #define YYMAXDEPTH 10000 | 944 | # define YYMAXDEPTH 10000 |
| 608 | #endif | 945 | #endif |
| 946 | |||
| 609 | 947 | ||
| 610 | /* Define __yy_memcpy. Note that the size argument | 948 | |
| 611 | should be passed with type unsigned int, because that is what the non-GCC | 949 | #if YYERROR_VERBOSE |
| 612 | definitions require. With GCC, __builtin_memcpy takes an arg | 950 | |
| 613 | of type size_t, but it can handle unsigned int. */ | 951 | # ifndef yystrlen |
| 614 | 952 | # if defined (__GLIBC__) && defined (_STRING_H) | |
| 615 | #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */ | 953 | # define yystrlen strlen |
| 616 | #define __yy_memcpy(TO,FROM,COUNT) __builtin_memcpy(TO,FROM,COUNT) | 954 | # else |
| 617 | #else /* not GNU C or C++ */ | 955 | /* Return the length of YYSTR. */ |
| 618 | #ifndef __cplusplus | 956 | static YYSIZE_T |
| 619 | 957 | # if defined (__STDC__) || defined (__cplusplus) | |
| 620 | /* This is the most reliable way to avoid incompatibilities | 958 | yystrlen (const char *yystr) |
| 621 | in available built-in functions on various systems. */ | 959 | # else |
| 622 | static void | 960 | yystrlen (yystr) |
| 623 | __yy_memcpy (to, from, count) | 961 | const char *yystr; |
| 624 | char *to; | 962 | # endif |
| 625 | char *from; | 963 | { |
| 626 | unsigned int count; | 964 | register const char *yys = yystr; |
| 965 | |||
| 966 | while (*yys++ != '\0') | ||
| 967 | continue; | ||
| 968 | |||
| 969 | return yys - yystr - 1; | ||
| 970 | } | ||
| 971 | # endif | ||
| 972 | # endif | ||
| 973 | |||
| 974 | # ifndef yystpcpy | ||
| 975 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) | ||
| 976 | # define yystpcpy stpcpy | ||
| 977 | # else | ||
| 978 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in | ||
| 979 | YYDEST. */ | ||
| 980 | static char * | ||
| 981 | # if defined (__STDC__) || defined (__cplusplus) | ||
| 982 | yystpcpy (char *yydest, const char *yysrc) | ||
| 983 | # else | ||
| 984 | yystpcpy (yydest, yysrc) | ||
| 985 | char *yydest; | ||
| 986 | const char *yysrc; | ||
| 987 | # endif | ||
| 627 | { | 988 | { |
| 628 | register char *f = from; | 989 | register char *yyd = yydest; |
| 629 | register char *t = to; | 990 | register const char *yys = yysrc; |
| 630 | register int i = count; | ||
| 631 | 991 | ||
| 632 | while (i-- > 0) | 992 | while ((*yyd++ = *yys++) != '\0') |
| 633 | *t++ = *f++; | 993 | continue; |
| 994 | |||
| 995 | return yyd - 1; | ||
| 634 | } | 996 | } |
| 997 | # endif | ||
| 998 | # endif | ||
| 999 | |||
| 1000 | #endif /* !YYERROR_VERBOSE */ | ||
| 635 | 1001 | ||
| 636 | #else /* __cplusplus */ | 1002 | |
| 1003 | |||
| 1004 | #if YYDEBUG | ||
| 1005 | /*--------------------------------. | ||
| 1006 | | Print this symbol on YYOUTPUT. | | ||
| 1007 | `--------------------------------*/ | ||
| 637 | 1008 | ||
| 638 | /* This is the most reliable way to avoid incompatibilities | 1009 | #if defined (__STDC__) || defined (__cplusplus) |
| 639 | in available built-in functions on various systems. */ | ||
| 640 | static void | 1010 | static void |
| 641 | __yy_memcpy (char *to, char *from, unsigned int count) | 1011 | yysymprint (FILE *yyoutput, int yytype, YYSTYPE *yyvaluep) |
| 1012 | #else | ||
| 1013 | static void | ||
| 1014 | yysymprint (yyoutput, yytype, yyvaluep) | ||
| 1015 | FILE *yyoutput; | ||
| 1016 | int yytype; | ||
| 1017 | YYSTYPE *yyvaluep; | ||
| 1018 | #endif | ||
| 642 | { | 1019 | { |
| 643 | register char *t = to; | 1020 | /* Pacify ``unused variable'' warnings. */ |
| 644 | register char *f = from; | 1021 | (void) yyvaluep; |
| 645 | register int i = count; | ||
| 646 | 1022 | ||
| 647 | while (i-- > 0) | 1023 | if (yytype < YYNTOKENS) |
| 648 | *t++ = *f++; | 1024 | YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); |
| 1025 | else | ||
| 1026 | YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); | ||
| 1027 | |||
| 1028 | |||
| 1029 | # ifdef YYPRINT | ||
| 1030 | if (yytype < YYNTOKENS) | ||
| 1031 | YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); | ||
| 1032 | # endif | ||
| 1033 | switch (yytype) | ||
| 1034 | { | ||
| 1035 | default: | ||
| 1036 | break; | ||
| 1037 | } | ||
| 1038 | YYFPRINTF (yyoutput, ")"); | ||
| 649 | } | 1039 | } |
| 650 | 1040 | ||
| 1041 | #endif /* ! YYDEBUG */ | ||
| 1042 | /*-----------------------------------------------. | ||
| 1043 | | Release the memory associated to this symbol. | | ||
| 1044 | `-----------------------------------------------*/ | ||
| 1045 | |||
| 1046 | #if defined (__STDC__) || defined (__cplusplus) | ||
| 1047 | static void | ||
| 1048 | yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) | ||
| 1049 | #else | ||
| 1050 | static void | ||
| 1051 | yydestruct (yymsg, yytype, yyvaluep) | ||
| 1052 | const char *yymsg; | ||
| 1053 | int yytype; | ||
| 1054 | YYSTYPE *yyvaluep; | ||
| 651 | #endif | 1055 | #endif |
| 652 | #endif | 1056 | { |
| 1057 | /* Pacify ``unused variable'' warnings. */ | ||
| 1058 | (void) yyvaluep; | ||
| 1059 | |||
| 1060 | if (!yymsg) | ||
| 1061 | yymsg = "Deleting"; | ||
| 1062 | YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); | ||
| 1063 | |||
| 1064 | switch (yytype) | ||
| 1065 | { | ||
| 1066 | |||
| 1067 | default: | ||
| 1068 | break; | ||
| 1069 | } | ||
| 1070 | } | ||
| 653 | 1071 | ||
| 654 | #line 217 "/usr/lib/bison.simple" | ||
| 655 | 1072 | ||
| 656 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed | 1073 | /* Prevent warnings from -Wmissing-prototypes. */ |
| 657 | into yyparse. The argument should have type void *. | ||
| 658 | It should actually point to an object. | ||
| 659 | Grammar actions can access the variable by casting it | ||
| 660 | to the proper pointer type. */ | ||
| 661 | 1074 | ||
| 662 | #ifdef YYPARSE_PARAM | 1075 | #ifdef YYPARSE_PARAM |
| 663 | #ifdef __cplusplus | 1076 | # if defined (__STDC__) || defined (__cplusplus) |
| 664 | #define YYPARSE_PARAM_ARG void *YYPARSE_PARAM | 1077 | int yyparse (void *YYPARSE_PARAM); |
| 665 | #define YYPARSE_PARAM_DECL | 1078 | # else |
| 666 | #else /* not __cplusplus */ | 1079 | int yyparse (); |
| 667 | #define YYPARSE_PARAM_ARG YYPARSE_PARAM | 1080 | # endif |
| 668 | #define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; | 1081 | #else /* ! YYPARSE_PARAM */ |
| 669 | #endif /* not __cplusplus */ | 1082 | #if defined (__STDC__) || defined (__cplusplus) |
| 670 | #else /* not YYPARSE_PARAM */ | ||
| 671 | #define YYPARSE_PARAM_ARG | ||
| 672 | #define YYPARSE_PARAM_DECL | ||
| 673 | #endif /* not YYPARSE_PARAM */ | ||
| 674 | |||
| 675 | /* Prevent warning if -Wstrict-prototypes. */ | ||
| 676 | #ifdef __GNUC__ | ||
| 677 | #ifdef YYPARSE_PARAM | ||
| 678 | int yyparse (void *); | ||
| 679 | #else | ||
| 680 | int yyparse (void); | 1083 | int yyparse (void); |
| 1084 | #else | ||
| 1085 | int yyparse (); | ||
| 681 | #endif | 1086 | #endif |
| 682 | #endif | 1087 | #endif /* ! YYPARSE_PARAM */ |
| 1088 | |||
| 1089 | |||
| 1090 | |||
| 1091 | /* The look-ahead symbol. */ | ||
| 1092 | int yychar; | ||
| 683 | 1093 | ||
| 1094 | /* The semantic value of the look-ahead symbol. */ | ||
| 1095 | YYSTYPE yylval; | ||
| 1096 | |||
| 1097 | /* Number of syntax errors so far. */ | ||
| 1098 | int yynerrs; | ||
| 1099 | |||
| 1100 | |||
| 1101 | |||
| 1102 | /*----------. | ||
| 1103 | | yyparse. | | ||
| 1104 | `----------*/ | ||
| 1105 | |||
| 1106 | #ifdef YYPARSE_PARAM | ||
| 1107 | # if defined (__STDC__) || defined (__cplusplus) | ||
| 1108 | int yyparse (void *YYPARSE_PARAM) | ||
| 1109 | # else | ||
| 1110 | int yyparse (YYPARSE_PARAM) | ||
| 1111 | void *YYPARSE_PARAM; | ||
| 1112 | # endif | ||
| 1113 | #else /* ! YYPARSE_PARAM */ | ||
| 1114 | #if defined (__STDC__) || defined (__cplusplus) | ||
| 1115 | int | ||
| 1116 | yyparse (void) | ||
| 1117 | #else | ||
| 684 | int | 1118 | int |
| 685 | yyparse(YYPARSE_PARAM_ARG) | 1119 | yyparse () |
| 686 | YYPARSE_PARAM_DECL | 1120 | |
| 1121 | #endif | ||
| 1122 | #endif | ||
| 687 | { | 1123 | { |
| 1124 | |||
| 688 | register int yystate; | 1125 | register int yystate; |
| 689 | register int yyn; | 1126 | register int yyn; |
| 690 | register short *yyssp; | 1127 | int yyresult; |
| 1128 | /* Number of tokens to shift before error messages enabled. */ | ||
| 1129 | int yyerrstatus; | ||
| 1130 | /* Look-ahead token as an internal (translated) token number. */ | ||
| 1131 | int yytoken = 0; | ||
| 1132 | |||
| 1133 | /* Three stacks and their tools: | ||
| 1134 | `yyss': related to states, | ||
| 1135 | `yyvs': related to semantic values, | ||
| 1136 | `yyls': related to locations. | ||
| 1137 | |||
| 1138 | Refer to the stacks thru separate pointers, to allow yyoverflow | ||
| 1139 | to reallocate them elsewhere. */ | ||
| 1140 | |||
| 1141 | /* The state stack. */ | ||
| 1142 | short int yyssa[YYINITDEPTH]; | ||
| 1143 | short int *yyss = yyssa; | ||
| 1144 | register short int *yyssp; | ||
| 1145 | |||
| 1146 | /* The semantic value stack. */ | ||
| 1147 | YYSTYPE yyvsa[YYINITDEPTH]; | ||
| 1148 | YYSTYPE *yyvs = yyvsa; | ||
| 691 | register YYSTYPE *yyvsp; | 1149 | register YYSTYPE *yyvsp; |
| 692 | int yyerrstatus; /* number of tokens to shift before error messages enabled */ | ||
| 693 | int yychar1 = 0; /* lookahead token as an internal (translated) token number */ | ||
| 694 | |||
| 695 | short yyssa[YYINITDEPTH]; /* the state stack */ | ||
| 696 | YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */ | ||
| 697 | 1150 | ||
| 698 | short *yyss = yyssa; /* refer to the stacks thru separate pointers */ | ||
| 699 | YYSTYPE *yyvs = yyvsa; /* to allow yyoverflow to reallocate them elsewhere */ | ||
| 700 | 1151 | ||
| 701 | #ifdef YYLSP_NEEDED | ||
| 702 | YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */ | ||
| 703 | YYLTYPE *yyls = yylsa; | ||
| 704 | YYLTYPE *yylsp; | ||
| 705 | 1152 | ||
| 706 | #define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) | ||
| 707 | #else | ||
| 708 | #define YYPOPSTACK (yyvsp--, yyssp--) | 1153 | #define YYPOPSTACK (yyvsp--, yyssp--) |
| 709 | #endif | ||
| 710 | 1154 | ||
| 711 | int yystacksize = YYINITDEPTH; | 1155 | YYSIZE_T yystacksize = YYINITDEPTH; |
| 712 | int yyfree_stacks = 0; | ||
| 713 | 1156 | ||
| 714 | #ifdef YYPURE | 1157 | /* The variables used to return semantic value and location from the |
| 715 | int yychar; | 1158 | action routines. */ |
| 716 | YYSTYPE yylval; | 1159 | YYSTYPE yyval; |
| 717 | int yynerrs; | ||
| 718 | #ifdef YYLSP_NEEDED | ||
| 719 | YYLTYPE yylloc; | ||
| 720 | #endif | ||
| 721 | #endif | ||
| 722 | 1160 | ||
| 723 | YYSTYPE yyval; /* the variable used to return */ | ||
| 724 | /* semantic values from the action */ | ||
| 725 | /* routines */ | ||
| 726 | 1161 | ||
| 1162 | /* When reducing, the number of symbols on the RHS of the reduced | ||
| 1163 | rule. */ | ||
| 727 | int yylen; | 1164 | int yylen; |
| 728 | 1165 | ||
| 729 | #if YYDEBUG != 0 | 1166 | YYDPRINTF ((stderr, "Starting parse\n")); |
| 730 | if (yydebug) | ||
| 731 | fprintf(stderr, "Starting parse\n"); | ||
| 732 | #endif | ||
| 733 | 1167 | ||
| 734 | yystate = 0; | 1168 | yystate = 0; |
| 735 | yyerrstatus = 0; | 1169 | yyerrstatus = 0; |
| @@ -741,833 +1175,872 @@ yyparse(YYPARSE_PARAM_ARG) | |||
| 741 | so that they stay on the same level as the state stack. | 1175 | so that they stay on the same level as the state stack. |
| 742 | The wasted elements are never initialized. */ | 1176 | The wasted elements are never initialized. */ |
| 743 | 1177 | ||
| 744 | yyssp = yyss - 1; | 1178 | yyssp = yyss; |
| 745 | yyvsp = yyvs; | 1179 | yyvsp = yyvs; |
| 746 | #ifdef YYLSP_NEEDED | ||
| 747 | yylsp = yyls; | ||
| 748 | #endif | ||
| 749 | 1180 | ||
| 750 | /* Push a new state, which is found in yystate . */ | ||
| 751 | /* In all cases, when you get here, the value and location stacks | ||
| 752 | have just been pushed. so pushing a state here evens the stacks. */ | ||
| 753 | yynewstate: | ||
| 754 | 1181 | ||
| 755 | *++yyssp = yystate; | 1182 | yyvsp[0] = yylval; |
| 756 | 1183 | ||
| 757 | if (yyssp >= yyss + yystacksize - 1) | 1184 | goto yysetstate; |
| 758 | { | ||
| 759 | /* Give user a chance to reallocate the stack */ | ||
| 760 | /* Use copies of these so that the &'s don't force the real ones into memory. */ | ||
| 761 | YYSTYPE *yyvs1 = yyvs; | ||
| 762 | short *yyss1 = yyss; | ||
| 763 | #ifdef YYLSP_NEEDED | ||
| 764 | YYLTYPE *yyls1 = yyls; | ||
| 765 | #endif | ||
| 766 | 1185 | ||
| 1186 | /*------------------------------------------------------------. | ||
| 1187 | | yynewstate -- Push a new state, which is found in yystate. | | ||
| 1188 | `------------------------------------------------------------*/ | ||
| 1189 | yynewstate: | ||
| 1190 | /* In all cases, when you get here, the value and location stacks | ||
| 1191 | have just been pushed. so pushing a state here evens the stacks. | ||
| 1192 | */ | ||
| 1193 | yyssp++; | ||
| 1194 | |||
| 1195 | yysetstate: | ||
| 1196 | *yyssp = yystate; | ||
| 1197 | |||
| 1198 | if (yyss + yystacksize - 1 <= yyssp) | ||
| 1199 | { | ||
| 767 | /* Get the current used size of the three stacks, in elements. */ | 1200 | /* Get the current used size of the three stacks, in elements. */ |
| 768 | int size = yyssp - yyss + 1; | 1201 | YYSIZE_T yysize = yyssp - yyss + 1; |
| 769 | 1202 | ||
| 770 | #ifdef yyoverflow | 1203 | #ifdef yyoverflow |
| 771 | /* Each stack pointer address is followed by the size of | 1204 | { |
| 772 | the data in use in that stack, in bytes. */ | 1205 | /* Give user a chance to reallocate the stack. Use copies of |
| 773 | #ifdef YYLSP_NEEDED | 1206 | these so that the &'s don't force the real ones into |
| 774 | /* This used to be a conditional around just the two extra args, | 1207 | memory. */ |
| 775 | but that might be undefined if yyoverflow is a macro. */ | 1208 | YYSTYPE *yyvs1 = yyvs; |
| 776 | yyoverflow("parser stack overflow", | 1209 | short int *yyss1 = yyss; |
| 777 | &yyss1, size * sizeof (*yyssp), | 1210 | |
| 778 | &yyvs1, size * sizeof (*yyvsp), | 1211 | |
| 779 | &yyls1, size * sizeof (*yylsp), | 1212 | /* Each stack pointer address is followed by the size of the |
| 780 | &yystacksize); | 1213 | data in use in that stack, in bytes. This used to be a |
| 781 | #else | 1214 | conditional around just the two extra args, but that might |
| 782 | yyoverflow("parser stack overflow", | 1215 | be undefined if yyoverflow is a macro. */ |
| 783 | &yyss1, size * sizeof (*yyssp), | 1216 | yyoverflow ("parser stack overflow", |
| 784 | &yyvs1, size * sizeof (*yyvsp), | 1217 | &yyss1, yysize * sizeof (*yyssp), |
| 785 | &yystacksize); | 1218 | &yyvs1, yysize * sizeof (*yyvsp), |
| 786 | #endif | 1219 | |
| 787 | 1220 | &yystacksize); | |
| 788 | yyss = yyss1; yyvs = yyvs1; | 1221 | |
| 789 | #ifdef YYLSP_NEEDED | 1222 | yyss = yyss1; |
| 790 | yyls = yyls1; | 1223 | yyvs = yyvs1; |
| 791 | #endif | 1224 | } |
| 792 | #else /* no yyoverflow */ | 1225 | #else /* no yyoverflow */ |
| 1226 | # ifndef YYSTACK_RELOCATE | ||
| 1227 | goto yyoverflowlab; | ||
| 1228 | # else | ||
| 793 | /* Extend the stack our own way. */ | 1229 | /* Extend the stack our own way. */ |
| 794 | if (yystacksize >= YYMAXDEPTH) | 1230 | if (YYMAXDEPTH <= yystacksize) |
| 795 | { | 1231 | goto yyoverflowlab; |
| 796 | yyerror("parser stack overflow"); | ||
| 797 | if (yyfree_stacks) | ||
| 798 | { | ||
| 799 | free (yyss); | ||
| 800 | free (yyvs); | ||
| 801 | #ifdef YYLSP_NEEDED | ||
| 802 | free (yyls); | ||
| 803 | #endif | ||
| 804 | } | ||
| 805 | return 2; | ||
| 806 | } | ||
| 807 | yystacksize *= 2; | 1232 | yystacksize *= 2; |
| 808 | if (yystacksize > YYMAXDEPTH) | 1233 | if (YYMAXDEPTH < yystacksize) |
| 809 | yystacksize = YYMAXDEPTH; | 1234 | yystacksize = YYMAXDEPTH; |
| 810 | #ifndef YYSTACK_USE_ALLOCA | 1235 | |
| 811 | yyfree_stacks = 1; | 1236 | { |
| 812 | #endif | 1237 | short int *yyss1 = yyss; |
| 813 | yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp)); | 1238 | union yyalloc *yyptr = |
| 814 | __yy_memcpy ((char *)yyss, (char *)yyss1, | 1239 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
| 815 | size * (unsigned int) sizeof (*yyssp)); | 1240 | if (! yyptr) |
| 816 | yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp)); | 1241 | goto yyoverflowlab; |
| 817 | __yy_memcpy ((char *)yyvs, (char *)yyvs1, | 1242 | YYSTACK_RELOCATE (yyss); |
| 818 | size * (unsigned int) sizeof (*yyvsp)); | 1243 | YYSTACK_RELOCATE (yyvs); |
| 819 | #ifdef YYLSP_NEEDED | 1244 | |
| 820 | yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp)); | 1245 | # undef YYSTACK_RELOCATE |
| 821 | __yy_memcpy ((char *)yyls, (char *)yyls1, | 1246 | if (yyss1 != yyssa) |
| 822 | size * (unsigned int) sizeof (*yylsp)); | 1247 | YYSTACK_FREE (yyss1); |
| 823 | #endif | 1248 | } |
| 1249 | # endif | ||
| 824 | #endif /* no yyoverflow */ | 1250 | #endif /* no yyoverflow */ |
| 825 | 1251 | ||
| 826 | yyssp = yyss + size - 1; | 1252 | yyssp = yyss + yysize - 1; |
| 827 | yyvsp = yyvs + size - 1; | 1253 | yyvsp = yyvs + yysize - 1; |
| 828 | #ifdef YYLSP_NEEDED | ||
| 829 | yylsp = yyls + size - 1; | ||
| 830 | #endif | ||
| 831 | 1254 | ||
| 832 | #if YYDEBUG != 0 | ||
| 833 | if (yydebug) | ||
| 834 | fprintf(stderr, "Stack size increased to %d\n", yystacksize); | ||
| 835 | #endif | ||
| 836 | 1255 | ||
| 837 | if (yyssp >= yyss + yystacksize - 1) | 1256 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
| 1257 | (unsigned long int) yystacksize)); | ||
| 1258 | |||
| 1259 | if (yyss + yystacksize - 1 <= yyssp) | ||
| 838 | YYABORT; | 1260 | YYABORT; |
| 839 | } | 1261 | } |
| 840 | 1262 | ||
| 841 | #if YYDEBUG != 0 | 1263 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
| 842 | if (yydebug) | ||
| 843 | fprintf(stderr, "Entering state %d\n", yystate); | ||
| 844 | #endif | ||
| 845 | 1264 | ||
| 846 | goto yybackup; | 1265 | goto yybackup; |
| 847 | yybackup: | 1266 | |
| 1267 | /*-----------. | ||
| 1268 | | yybackup. | | ||
| 1269 | `-----------*/ | ||
| 1270 | yybackup: | ||
| 848 | 1271 | ||
| 849 | /* Do appropriate processing given the current state. */ | 1272 | /* Do appropriate processing given the current state. */ |
| 850 | /* Read a lookahead token if we need one and don't already have one. */ | 1273 | /* Read a look-ahead token if we need one and don't already have one. */ |
| 851 | /* yyresume: */ | 1274 | /* yyresume: */ |
| 852 | 1275 | ||
| 853 | /* First try to decide what to do without reference to lookahead token. */ | 1276 | /* First try to decide what to do without reference to look-ahead token. */ |
| 854 | 1277 | ||
| 855 | yyn = yypact[yystate]; | 1278 | yyn = yypact[yystate]; |
| 856 | if (yyn == YYFLAG) | 1279 | if (yyn == YYPACT_NINF) |
| 857 | goto yydefault; | 1280 | goto yydefault; |
| 858 | 1281 | ||
| 859 | /* Not known => get a lookahead token if don't already have one. */ | 1282 | /* Not known => get a look-ahead token if don't already have one. */ |
| 860 | |||
| 861 | /* yychar is either YYEMPTY or YYEOF | ||
| 862 | or a valid token in external form. */ | ||
| 863 | 1283 | ||
| 1284 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ | ||
| 864 | if (yychar == YYEMPTY) | 1285 | if (yychar == YYEMPTY) |
| 865 | { | 1286 | { |
| 866 | #if YYDEBUG != 0 | 1287 | YYDPRINTF ((stderr, "Reading a token: ")); |
| 867 | if (yydebug) | ||
| 868 | fprintf(stderr, "Reading a token: "); | ||
| 869 | #endif | ||
| 870 | yychar = YYLEX; | 1288 | yychar = YYLEX; |
| 871 | } | 1289 | } |
| 872 | 1290 | ||
| 873 | /* Convert token to internal form (in yychar1) for indexing tables with */ | 1291 | if (yychar <= YYEOF) |
| 874 | |||
| 875 | if (yychar <= 0) /* This means end of input. */ | ||
| 876 | { | 1292 | { |
| 877 | yychar1 = 0; | 1293 | yychar = yytoken = YYEOF; |
| 878 | yychar = YYEOF; /* Don't call YYLEX any more */ | 1294 | YYDPRINTF ((stderr, "Now at end of input.\n")); |
| 879 | |||
| 880 | #if YYDEBUG != 0 | ||
| 881 | if (yydebug) | ||
| 882 | fprintf(stderr, "Now at end of input.\n"); | ||
| 883 | #endif | ||
| 884 | } | 1295 | } |
| 885 | else | 1296 | else |
| 886 | { | 1297 | { |
| 887 | yychar1 = YYTRANSLATE(yychar); | 1298 | yytoken = YYTRANSLATE (yychar); |
| 888 | 1299 | YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); | |
| 889 | #if YYDEBUG != 0 | ||
| 890 | if (yydebug) | ||
| 891 | { | ||
| 892 | fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); | ||
| 893 | /* Give the individual parser a way to print the precise meaning | ||
| 894 | of a token, for further debugging info. */ | ||
| 895 | #ifdef YYPRINT | ||
| 896 | YYPRINT (stderr, yychar, yylval); | ||
| 897 | #endif | ||
| 898 | fprintf (stderr, ")\n"); | ||
| 899 | } | ||
| 900 | #endif | ||
| 901 | } | 1300 | } |
| 902 | 1301 | ||
| 903 | yyn += yychar1; | 1302 | /* If the proper action on seeing token YYTOKEN is to reduce or to |
| 904 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) | 1303 | detect an error, take that action. */ |
| 1304 | yyn += yytoken; | ||
| 1305 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) | ||
| 905 | goto yydefault; | 1306 | goto yydefault; |
| 906 | |||
| 907 | yyn = yytable[yyn]; | 1307 | yyn = yytable[yyn]; |
| 908 | 1308 | if (yyn <= 0) | |
| 909 | /* yyn is what to do for this token type in this state. | ||
| 910 | Negative => reduce, -yyn is rule number. | ||
| 911 | Positive => shift, yyn is new state. | ||
| 912 | New state is final state => don't bother to shift, | ||
| 913 | just return success. | ||
| 914 | 0, or most negative number => error. */ | ||
| 915 | |||
| 916 | if (yyn < 0) | ||
| 917 | { | 1309 | { |
| 918 | if (yyn == YYFLAG) | 1310 | if (yyn == 0 || yyn == YYTABLE_NINF) |
| 919 | goto yyerrlab; | 1311 | goto yyerrlab; |
| 920 | yyn = -yyn; | 1312 | yyn = -yyn; |
| 921 | goto yyreduce; | 1313 | goto yyreduce; |
| 922 | } | 1314 | } |
| 923 | else if (yyn == 0) | ||
| 924 | goto yyerrlab; | ||
| 925 | 1315 | ||
| 926 | if (yyn == YYFINAL) | 1316 | if (yyn == YYFINAL) |
| 927 | YYACCEPT; | 1317 | YYACCEPT; |
| 928 | 1318 | ||
| 929 | /* Shift the lookahead token. */ | 1319 | /* Shift the look-ahead token. */ |
| 930 | 1320 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); | |
| 931 | #if YYDEBUG != 0 | ||
| 932 | if (yydebug) | ||
| 933 | fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]); | ||
| 934 | #endif | ||
| 935 | 1321 | ||
| 936 | /* Discard the token being shifted unless it is eof. */ | 1322 | /* Discard the token being shifted unless it is eof. */ |
| 937 | if (yychar != YYEOF) | 1323 | if (yychar != YYEOF) |
| 938 | yychar = YYEMPTY; | 1324 | yychar = YYEMPTY; |
| 939 | 1325 | ||
| 940 | *++yyvsp = yylval; | 1326 | *++yyvsp = yylval; |
| 941 | #ifdef YYLSP_NEEDED | ||
| 942 | *++yylsp = yylloc; | ||
| 943 | #endif | ||
| 944 | 1327 | ||
| 945 | /* count tokens shifted since error; after three, turn off error status. */ | 1328 | |
| 946 | if (yyerrstatus) yyerrstatus--; | 1329 | /* Count tokens shifted since error; after three, turn off error |
| 1330 | status. */ | ||
| 1331 | if (yyerrstatus) | ||
| 1332 | yyerrstatus--; | ||
| 947 | 1333 | ||
| 948 | yystate = yyn; | 1334 | yystate = yyn; |
| 949 | goto yynewstate; | 1335 | goto yynewstate; |
| 950 | 1336 | ||
| 951 | /* Do the default action for the current state. */ | ||
| 952 | yydefault: | ||
| 953 | 1337 | ||
| 1338 | /*-----------------------------------------------------------. | ||
| 1339 | | yydefault -- do the default action for the current state. | | ||
| 1340 | `-----------------------------------------------------------*/ | ||
| 1341 | yydefault: | ||
| 954 | yyn = yydefact[yystate]; | 1342 | yyn = yydefact[yystate]; |
| 955 | if (yyn == 0) | 1343 | if (yyn == 0) |
| 956 | goto yyerrlab; | 1344 | goto yyerrlab; |
| 1345 | goto yyreduce; | ||
| 957 | 1346 | ||
| 958 | /* Do a reduction. yyn is the number of a rule to reduce with. */ | 1347 | |
| 1348 | /*-----------------------------. | ||
| 1349 | | yyreduce -- Do a reduction. | | ||
| 1350 | `-----------------------------*/ | ||
| 959 | yyreduce: | 1351 | yyreduce: |
| 1352 | /* yyn is the number of a rule to reduce with. */ | ||
| 960 | yylen = yyr2[yyn]; | 1353 | yylen = yyr2[yyn]; |
| 961 | if (yylen > 0) | ||
| 962 | yyval = yyvsp[1-yylen]; /* implement default value of the action */ | ||
| 963 | |||
| 964 | #if YYDEBUG != 0 | ||
| 965 | if (yydebug) | ||
| 966 | { | ||
| 967 | int i; | ||
| 968 | 1354 | ||
| 969 | fprintf (stderr, "Reducing via rule %d (line %d), ", | 1355 | /* If YYLEN is nonzero, implement the default value of the action: |
| 970 | yyn, yyrline[yyn]); | 1356 | `$$ = $1'. |
| 971 | |||
| 972 | /* Print the symbols being reduced, and their result. */ | ||
| 973 | for (i = yyprhs[yyn]; yyrhs[i] > 0; i++) | ||
| 974 | fprintf (stderr, "%s ", yytname[yyrhs[i]]); | ||
| 975 | fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]); | ||
| 976 | } | ||
| 977 | #endif | ||
| 978 | 1357 | ||
| 1358 | Otherwise, the following line sets YYVAL to garbage. | ||
| 1359 | This behavior is undocumented and Bison | ||
| 1360 | users should not rely upon it. Assigning to YYVAL | ||
| 1361 | unconditionally makes the parser a bit smaller, and it avoids a | ||
| 1362 | GCC warning that YYVAL may be used uninitialized. */ | ||
| 1363 | yyval = yyvsp[1-yylen]; | ||
| 979 | 1364 | ||
| 980 | switch (yyn) { | ||
| 981 | 1365 | ||
| 982 | case 3: | 1366 | YY_REDUCE_PRINT (yyn); |
| 1367 | switch (yyn) | ||
| 1368 | { | ||
| 1369 | case 4: | ||
| 983 | #line 107 "scripts/genksyms/parse.y" | 1370 | #line 107 "scripts/genksyms/parse.y" |
| 984 | { is_typedef = 0; is_extern = 0; current_name = NULL; decl_spec = NULL; ; | 1371 | { is_typedef = 0; is_extern = 0; current_name = NULL; decl_spec = NULL; ;} |
| 985 | break;} | 1372 | break; |
| 986 | case 4: | 1373 | |
| 1374 | case 5: | ||
| 987 | #line 109 "scripts/genksyms/parse.y" | 1375 | #line 109 "scripts/genksyms/parse.y" |
| 988 | { free_list(*yyvsp[0], NULL); *yyvsp[0] = NULL; ; | 1376 | { free_list(*(yyvsp[0]), NULL); *(yyvsp[0]) = NULL; ;} |
| 989 | break;} | 1377 | break; |
| 990 | case 5: | 1378 | |
| 1379 | case 6: | ||
| 991 | #line 113 "scripts/genksyms/parse.y" | 1380 | #line 113 "scripts/genksyms/parse.y" |
| 992 | { is_typedef = 1; ; | 1381 | { is_typedef = 1; ;} |
| 993 | break;} | 1382 | break; |
| 994 | case 6: | 1383 | |
| 1384 | case 7: | ||
| 995 | #line 114 "scripts/genksyms/parse.y" | 1385 | #line 114 "scripts/genksyms/parse.y" |
| 996 | { yyval = yyvsp[0]; ; | 1386 | { (yyval) = (yyvsp[0]); ;} |
| 997 | break;} | 1387 | break; |
| 998 | case 11: | 1388 | |
| 1389 | case 12: | ||
| 999 | #line 119 "scripts/genksyms/parse.y" | 1390 | #line 119 "scripts/genksyms/parse.y" |
| 1000 | { yyval = yyvsp[0]; ; | 1391 | { (yyval) = (yyvsp[0]); ;} |
| 1001 | break;} | 1392 | break; |
| 1002 | case 12: | 1393 | |
| 1394 | case 13: | ||
| 1003 | #line 120 "scripts/genksyms/parse.y" | 1395 | #line 120 "scripts/genksyms/parse.y" |
| 1004 | { yyval = yyvsp[0]; ; | 1396 | { (yyval) = (yyvsp[0]); ;} |
| 1005 | break;} | 1397 | break; |
| 1006 | case 13: | 1398 | |
| 1399 | case 14: | ||
| 1007 | #line 125 "scripts/genksyms/parse.y" | 1400 | #line 125 "scripts/genksyms/parse.y" |
| 1008 | { if (current_name) { | 1401 | { if (current_name) { |
| 1009 | struct string_list *decl = (*yyvsp[0])->next; | 1402 | struct string_list *decl = (*(yyvsp[0]))->next; |
| 1010 | (*yyvsp[0])->next = NULL; | 1403 | (*(yyvsp[0]))->next = NULL; |
| 1011 | add_symbol(current_name, | 1404 | add_symbol(current_name, |
| 1012 | is_typedef ? SYM_TYPEDEF : SYM_NORMAL, | 1405 | is_typedef ? SYM_TYPEDEF : SYM_NORMAL, |
| 1013 | decl, is_extern); | 1406 | decl, is_extern); |
| 1014 | current_name = NULL; | 1407 | current_name = NULL; |
| 1015 | } | 1408 | } |
| 1016 | yyval = yyvsp[0]; | 1409 | (yyval) = (yyvsp[0]); |
| 1017 | ; | 1410 | ;} |
| 1018 | break;} | 1411 | break; |
| 1019 | case 14: | 1412 | |
| 1413 | case 15: | ||
| 1020 | #line 138 "scripts/genksyms/parse.y" | 1414 | #line 138 "scripts/genksyms/parse.y" |
| 1021 | { yyval = NULL; ; | 1415 | { (yyval) = NULL; ;} |
| 1022 | break;} | 1416 | break; |
| 1023 | case 16: | 1417 | |
| 1418 | case 17: | ||
| 1024 | #line 144 "scripts/genksyms/parse.y" | 1419 | #line 144 "scripts/genksyms/parse.y" |
| 1025 | { struct string_list *decl = *yyvsp[0]; | 1420 | { struct string_list *decl = *(yyvsp[0]); |
| 1026 | *yyvsp[0] = NULL; | 1421 | *(yyvsp[0]) = NULL; |
| 1027 | add_symbol(current_name, | 1422 | add_symbol(current_name, |
| 1028 | is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern); | 1423 | is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern); |
| 1029 | current_name = NULL; | 1424 | current_name = NULL; |
| 1030 | yyval = yyvsp[0]; | 1425 | (yyval) = (yyvsp[0]); |
| 1031 | ; | 1426 | ;} |
| 1032 | break;} | 1427 | break; |
| 1033 | case 17: | 1428 | |
| 1429 | case 18: | ||
| 1034 | #line 152 "scripts/genksyms/parse.y" | 1430 | #line 152 "scripts/genksyms/parse.y" |
| 1035 | { struct string_list *decl = *yyvsp[0]; | 1431 | { struct string_list *decl = *(yyvsp[0]); |
| 1036 | *yyvsp[0] = NULL; | 1432 | *(yyvsp[0]) = NULL; |
| 1037 | free_list(*yyvsp[-1], NULL); | 1433 | free_list(*(yyvsp[-1]), NULL); |
| 1038 | *yyvsp[-1] = decl_spec; | 1434 | *(yyvsp[-1]) = decl_spec; |
| 1039 | add_symbol(current_name, | 1435 | add_symbol(current_name, |
| 1040 | is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern); | 1436 | is_typedef ? SYM_TYPEDEF : SYM_NORMAL, decl, is_extern); |
| 1041 | current_name = NULL; | 1437 | current_name = NULL; |
| 1042 | yyval = yyvsp[0]; | 1438 | (yyval) = (yyvsp[0]); |
| 1043 | ; | 1439 | ;} |
| 1044 | break;} | 1440 | break; |
| 1045 | case 18: | 1441 | |
| 1442 | case 19: | ||
| 1046 | #line 165 "scripts/genksyms/parse.y" | 1443 | #line 165 "scripts/genksyms/parse.y" |
| 1047 | { yyval = yyvsp[0] ? yyvsp[0] : yyvsp[-1] ? yyvsp[-1] : yyvsp[-2] ? yyvsp[-2] : yyvsp[-3]; ; | 1444 | { (yyval) = (yyvsp[0]) ? (yyvsp[0]) : (yyvsp[-1]) ? (yyvsp[-1]) : (yyvsp[-2]) ? (yyvsp[-2]) : (yyvsp[-3]); ;} |
| 1048 | break;} | 1445 | break; |
| 1049 | case 19: | 1446 | |
| 1447 | case 20: | ||
| 1050 | #line 170 "scripts/genksyms/parse.y" | 1448 | #line 170 "scripts/genksyms/parse.y" |
| 1051 | { decl_spec = NULL; ; | 1449 | { decl_spec = NULL; ;} |
| 1052 | break;} | 1450 | break; |
| 1053 | case 21: | 1451 | |
| 1452 | case 22: | ||
| 1054 | #line 175 "scripts/genksyms/parse.y" | 1453 | #line 175 "scripts/genksyms/parse.y" |
| 1055 | { decl_spec = *yyvsp[0]; ; | 1454 | { decl_spec = *(yyvsp[0]); ;} |
| 1056 | break;} | 1455 | break; |
| 1057 | case 22: | 1456 | |
| 1457 | case 23: | ||
| 1058 | #line 176 "scripts/genksyms/parse.y" | 1458 | #line 176 "scripts/genksyms/parse.y" |
| 1059 | { decl_spec = *yyvsp[0]; ; | 1459 | { decl_spec = *(yyvsp[0]); ;} |
| 1060 | break;} | 1460 | break; |
| 1061 | case 23: | 1461 | |
| 1462 | case 24: | ||
| 1062 | #line 181 "scripts/genksyms/parse.y" | 1463 | #line 181 "scripts/genksyms/parse.y" |
| 1063 | { /* Version 2 checksumming ignores storage class, as that | 1464 | { /* Version 2 checksumming ignores storage class, as that |
| 1064 | is really irrelevant to the linkage. */ | 1465 | is really irrelevant to the linkage. */ |
| 1065 | remove_node(yyvsp[0]); | 1466 | remove_node((yyvsp[0])); |
| 1066 | yyval = yyvsp[0]; | 1467 | (yyval) = (yyvsp[0]); |
| 1067 | ; | 1468 | ;} |
| 1068 | break;} | 1469 | break; |
| 1069 | case 28: | 1470 | |
| 1471 | case 29: | ||
| 1070 | #line 193 "scripts/genksyms/parse.y" | 1472 | #line 193 "scripts/genksyms/parse.y" |
| 1071 | { is_extern = 1; yyval = yyvsp[0]; ; | 1473 | { is_extern = 1; (yyval) = (yyvsp[0]); ;} |
| 1072 | break;} | 1474 | break; |
| 1073 | case 29: | 1475 | |
| 1476 | case 30: | ||
| 1074 | #line 194 "scripts/genksyms/parse.y" | 1477 | #line 194 "scripts/genksyms/parse.y" |
| 1075 | { is_extern = 0; yyval = yyvsp[0]; ; | 1478 | { is_extern = 0; (yyval) = (yyvsp[0]); ;} |
| 1076 | break;} | 1479 | break; |
| 1077 | case 33: | 1480 | |
| 1078 | #line 205 "scripts/genksyms/parse.y" | 1481 | case 35: |
| 1079 | { remove_node(yyvsp[-1]); (*yyvsp[0])->tag = SYM_STRUCT; yyval = yyvsp[0]; ; | 1482 | #line 206 "scripts/genksyms/parse.y" |
| 1080 | break;} | 1483 | { remove_node((yyvsp[-1])); (*(yyvsp[0]))->tag = SYM_STRUCT; (yyval) = (yyvsp[0]); ;} |
| 1081 | case 34: | 1484 | break; |
| 1082 | #line 207 "scripts/genksyms/parse.y" | 1485 | |
| 1083 | { remove_node(yyvsp[-1]); (*yyvsp[0])->tag = SYM_UNION; yyval = yyvsp[0]; ; | 1486 | case 36: |
| 1084 | break;} | 1487 | #line 208 "scripts/genksyms/parse.y" |
| 1085 | case 35: | 1488 | { remove_node((yyvsp[-1])); (*(yyvsp[0]))->tag = SYM_UNION; (yyval) = (yyvsp[0]); ;} |
| 1086 | #line 209 "scripts/genksyms/parse.y" | 1489 | break; |
| 1087 | { remove_node(yyvsp[-1]); (*yyvsp[0])->tag = SYM_ENUM; yyval = yyvsp[0]; ; | 1490 | |
| 1088 | break;} | 1491 | case 37: |
| 1089 | case 36: | 1492 | #line 210 "scripts/genksyms/parse.y" |
| 1090 | #line 213 "scripts/genksyms/parse.y" | 1493 | { remove_node((yyvsp[-1])); (*(yyvsp[0]))->tag = SYM_ENUM; (yyval) = (yyvsp[0]); ;} |
| 1091 | { struct string_list *s = *yyvsp[0], *i = *yyvsp[-1], *r; | 1494 | break; |
| 1495 | |||
| 1496 | case 38: | ||
| 1497 | #line 214 "scripts/genksyms/parse.y" | ||
| 1498 | { struct string_list *s = *(yyvsp[0]), *i = *(yyvsp[-1]), *r; | ||
| 1092 | r = copy_node(i); r->tag = SYM_STRUCT; | 1499 | r = copy_node(i); r->tag = SYM_STRUCT; |
| 1093 | r->next = (*yyvsp[-2])->next; *yyvsp[0] = r; (*yyvsp[-2])->next = NULL; | 1500 | r->next = (*(yyvsp[-2]))->next; *(yyvsp[0]) = r; (*(yyvsp[-2]))->next = NULL; |
| 1094 | add_symbol(i->string, SYM_STRUCT, s, is_extern); | 1501 | add_symbol(i->string, SYM_STRUCT, s, is_extern); |
| 1095 | yyval = yyvsp[0]; | 1502 | (yyval) = (yyvsp[0]); |
| 1096 | ; | 1503 | ;} |
| 1097 | break;} | 1504 | break; |
| 1098 | case 37: | 1505 | |
| 1099 | #line 220 "scripts/genksyms/parse.y" | 1506 | case 39: |
| 1100 | { struct string_list *s = *yyvsp[0], *i = *yyvsp[-1], *r; | 1507 | #line 221 "scripts/genksyms/parse.y" |
| 1508 | { struct string_list *s = *(yyvsp[0]), *i = *(yyvsp[-1]), *r; | ||
| 1101 | r = copy_node(i); r->tag = SYM_UNION; | 1509 | r = copy_node(i); r->tag = SYM_UNION; |
| 1102 | r->next = (*yyvsp[-2])->next; *yyvsp[0] = r; (*yyvsp[-2])->next = NULL; | 1510 | r->next = (*(yyvsp[-2]))->next; *(yyvsp[0]) = r; (*(yyvsp[-2]))->next = NULL; |
| 1103 | add_symbol(i->string, SYM_UNION, s, is_extern); | 1511 | add_symbol(i->string, SYM_UNION, s, is_extern); |
| 1104 | yyval = yyvsp[0]; | 1512 | (yyval) = (yyvsp[0]); |
| 1105 | ; | 1513 | ;} |
| 1106 | break;} | 1514 | break; |
| 1107 | case 38: | 1515 | |
| 1108 | #line 227 "scripts/genksyms/parse.y" | 1516 | case 40: |
| 1109 | { struct string_list *s = *yyvsp[0], *i = *yyvsp[-1], *r; | 1517 | #line 228 "scripts/genksyms/parse.y" |
| 1518 | { struct string_list *s = *(yyvsp[0]), *i = *(yyvsp[-1]), *r; | ||
| 1110 | r = copy_node(i); r->tag = SYM_ENUM; | 1519 | r = copy_node(i); r->tag = SYM_ENUM; |
| 1111 | r->next = (*yyvsp[-2])->next; *yyvsp[0] = r; (*yyvsp[-2])->next = NULL; | 1520 | r->next = (*(yyvsp[-2]))->next; *(yyvsp[0]) = r; (*(yyvsp[-2]))->next = NULL; |
| 1112 | add_symbol(i->string, SYM_ENUM, s, is_extern); | 1521 | add_symbol(i->string, SYM_ENUM, s, is_extern); |
| 1113 | yyval = yyvsp[0]; | 1522 | (yyval) = (yyvsp[0]); |
| 1114 | ; | 1523 | ;} |
| 1115 | break;} | 1524 | break; |
| 1116 | case 39: | 1525 | |
| 1117 | #line 235 "scripts/genksyms/parse.y" | 1526 | case 41: |
| 1118 | { yyval = yyvsp[0]; ; | ||
| 1119 | break;} | ||
| 1120 | case 40: | ||
| 1121 | #line 236 "scripts/genksyms/parse.y" | 1527 | #line 236 "scripts/genksyms/parse.y" |
| 1122 | { yyval = yyvsp[0]; ; | 1528 | { (yyval) = (yyvsp[0]); ;} |
| 1123 | break;} | 1529 | break; |
| 1124 | case 41: | 1530 | |
| 1531 | case 42: | ||
| 1125 | #line 237 "scripts/genksyms/parse.y" | 1532 | #line 237 "scripts/genksyms/parse.y" |
| 1126 | { yyval = yyvsp[0]; ; | 1533 | { (yyval) = (yyvsp[0]); ;} |
| 1127 | break;} | 1534 | break; |
| 1128 | case 52: | 1535 | |
| 1129 | #line 251 "scripts/genksyms/parse.y" | 1536 | case 43: |
| 1130 | { (*yyvsp[0])->tag = SYM_TYPEDEF; yyval = yyvsp[0]; ; | 1537 | #line 238 "scripts/genksyms/parse.y" |
| 1131 | break;} | 1538 | { (yyval) = (yyvsp[0]); ;} |
| 1132 | case 53: | 1539 | break; |
| 1133 | #line 256 "scripts/genksyms/parse.y" | 1540 | |
| 1134 | { yyval = yyvsp[0] ? yyvsp[0] : yyvsp[-1]; ; | 1541 | case 54: |
| 1135 | break;} | 1542 | #line 252 "scripts/genksyms/parse.y" |
| 1136 | case 54: | 1543 | { (*(yyvsp[0]))->tag = SYM_TYPEDEF; (yyval) = (yyvsp[0]); ;} |
| 1137 | #line 260 "scripts/genksyms/parse.y" | 1544 | break; |
| 1138 | { yyval = NULL; ; | 1545 | |
| 1139 | break;} | 1546 | case 55: |
| 1140 | case 57: | 1547 | #line 257 "scripts/genksyms/parse.y" |
| 1141 | #line 266 "scripts/genksyms/parse.y" | 1548 | { (yyval) = (yyvsp[0]) ? (yyvsp[0]) : (yyvsp[-1]); ;} |
| 1142 | { yyval = yyvsp[0]; ; | 1549 | break; |
| 1143 | break;} | 1550 | |
| 1144 | case 61: | 1551 | case 56: |
| 1145 | #line 272 "scripts/genksyms/parse.y" | 1552 | #line 261 "scripts/genksyms/parse.y" |
| 1146 | { /* restrict has no effect in prototypes so ignore it */ | 1553 | { (yyval) = NULL; ;} |
| 1147 | remove_node(yyvsp[0]); | 1554 | break; |
| 1148 | yyval = yyvsp[0]; | 1555 | |
| 1149 | ; | 1556 | case 59: |
| 1150 | break;} | 1557 | #line 267 "scripts/genksyms/parse.y" |
| 1151 | case 62: | 1558 | { (yyval) = (yyvsp[0]); ;} |
| 1152 | #line 279 "scripts/genksyms/parse.y" | 1559 | break; |
| 1153 | { yyval = yyvsp[0]; ; | 1560 | |
| 1154 | break;} | 1561 | case 63: |
| 1155 | case 64: | 1562 | #line 273 "scripts/genksyms/parse.y" |
| 1156 | #line 285 "scripts/genksyms/parse.y" | 1563 | { /* restrict has no effect in prototypes so ignore it */ |
| 1157 | { if (current_name != NULL) { | 1564 | remove_node((yyvsp[0])); |
| 1565 | (yyval) = (yyvsp[0]); | ||
| 1566 | ;} | ||
| 1567 | break; | ||
| 1568 | |||
| 1569 | case 64: | ||
| 1570 | #line 280 "scripts/genksyms/parse.y" | ||
| 1571 | { (yyval) = (yyvsp[0]); ;} | ||
| 1572 | break; | ||
| 1573 | |||
| 1574 | case 66: | ||
| 1575 | #line 286 "scripts/genksyms/parse.y" | ||
| 1576 | { if (current_name != NULL) { | ||
| 1158 | error_with_pos("unexpected second declaration name"); | 1577 | error_with_pos("unexpected second declaration name"); |
| 1159 | YYERROR; | 1578 | YYERROR; |
| 1160 | } else { | 1579 | } else { |
| 1161 | current_name = (*yyvsp[0])->string; | 1580 | current_name = (*(yyvsp[0]))->string; |
| 1162 | yyval = yyvsp[0]; | 1581 | (yyval) = (yyvsp[0]); |
| 1163 | } | 1582 | } |
| 1164 | ; | 1583 | ;} |
| 1165 | break;} | 1584 | break; |
| 1166 | case 65: | 1585 | |
| 1167 | #line 294 "scripts/genksyms/parse.y" | 1586 | case 67: |
| 1168 | { yyval = yyvsp[0]; ; | 1587 | #line 295 "scripts/genksyms/parse.y" |
| 1169 | break;} | 1588 | { (yyval) = (yyvsp[0]); ;} |
| 1170 | case 66: | 1589 | break; |
| 1171 | #line 296 "scripts/genksyms/parse.y" | 1590 | |
| 1172 | { yyval = yyvsp[0]; ; | 1591 | case 68: |
| 1173 | break;} | 1592 | #line 297 "scripts/genksyms/parse.y" |
| 1174 | case 67: | 1593 | { (yyval) = (yyvsp[0]); ;} |
| 1175 | #line 298 "scripts/genksyms/parse.y" | 1594 | break; |
| 1176 | { yyval = yyvsp[0]; ; | 1595 | |
| 1177 | break;} | 1596 | case 69: |
| 1178 | case 68: | 1597 | #line 299 "scripts/genksyms/parse.y" |
| 1179 | #line 300 "scripts/genksyms/parse.y" | 1598 | { (yyval) = (yyvsp[0]); ;} |
| 1180 | { yyval = yyvsp[0]; ; | 1599 | break; |
| 1181 | break;} | 1600 | |
| 1182 | case 69: | 1601 | case 70: |
| 1183 | #line 302 "scripts/genksyms/parse.y" | 1602 | #line 301 "scripts/genksyms/parse.y" |
| 1184 | { yyval = yyvsp[0]; ; | 1603 | { (yyval) = (yyvsp[0]); ;} |
| 1185 | break;} | 1604 | break; |
| 1186 | case 70: | 1605 | |
| 1187 | #line 308 "scripts/genksyms/parse.y" | 1606 | case 71: |
| 1188 | { yyval = yyvsp[0]; ; | 1607 | #line 303 "scripts/genksyms/parse.y" |
| 1189 | break;} | 1608 | { (yyval) = (yyvsp[0]); ;} |
| 1190 | case 74: | 1609 | break; |
| 1191 | #line 316 "scripts/genksyms/parse.y" | 1610 | |
| 1192 | { yyval = yyvsp[0]; ; | 1611 | case 72: |
| 1193 | break;} | 1612 | #line 309 "scripts/genksyms/parse.y" |
| 1194 | case 75: | 1613 | { (yyval) = (yyvsp[0]); ;} |
| 1195 | #line 318 "scripts/genksyms/parse.y" | 1614 | break; |
| 1196 | { yyval = yyvsp[0]; ; | 1615 | |
| 1197 | break;} | 1616 | case 76: |
| 1198 | case 76: | 1617 | #line 317 "scripts/genksyms/parse.y" |
| 1199 | #line 320 "scripts/genksyms/parse.y" | 1618 | { (yyval) = (yyvsp[0]); ;} |
| 1200 | { yyval = yyvsp[0]; ; | 1619 | break; |
| 1201 | break;} | 1620 | |
| 1202 | case 77: | 1621 | case 77: |
| 1203 | #line 322 "scripts/genksyms/parse.y" | 1622 | #line 319 "scripts/genksyms/parse.y" |
| 1204 | { yyval = yyvsp[0]; ; | 1623 | { (yyval) = (yyvsp[0]); ;} |
| 1205 | break;} | 1624 | break; |
| 1206 | case 78: | 1625 | |
| 1207 | #line 324 "scripts/genksyms/parse.y" | 1626 | case 78: |
| 1208 | { yyval = yyvsp[0]; ; | 1627 | #line 321 "scripts/genksyms/parse.y" |
| 1209 | break;} | 1628 | { (yyval) = (yyvsp[0]); ;} |
| 1210 | case 79: | 1629 | break; |
| 1211 | #line 328 "scripts/genksyms/parse.y" | 1630 | |
| 1212 | { yyval = yyvsp[0]; ; | 1631 | case 79: |
| 1213 | break;} | 1632 | #line 323 "scripts/genksyms/parse.y" |
| 1214 | case 81: | 1633 | { (yyval) = (yyvsp[0]); ;} |
| 1215 | #line 330 "scripts/genksyms/parse.y" | 1634 | break; |
| 1216 | { yyval = yyvsp[0]; ; | 1635 | |
| 1217 | break;} | 1636 | case 80: |
| 1218 | case 82: | 1637 | #line 325 "scripts/genksyms/parse.y" |
| 1219 | #line 334 "scripts/genksyms/parse.y" | 1638 | { (yyval) = (yyvsp[0]); ;} |
| 1220 | { yyval = NULL; ; | 1639 | break; |
| 1221 | break;} | 1640 | |
| 1222 | case 85: | 1641 | case 81: |
| 1223 | #line 341 "scripts/genksyms/parse.y" | 1642 | #line 329 "scripts/genksyms/parse.y" |
| 1224 | { yyval = yyvsp[0]; ; | 1643 | { (yyval) = (yyvsp[0]); ;} |
| 1225 | break;} | 1644 | break; |
| 1226 | case 86: | 1645 | |
| 1227 | #line 346 "scripts/genksyms/parse.y" | 1646 | case 83: |
| 1228 | { yyval = yyvsp[0] ? yyvsp[0] : yyvsp[-1]; ; | 1647 | #line 331 "scripts/genksyms/parse.y" |
| 1229 | break;} | 1648 | { (yyval) = (yyvsp[0]); ;} |
| 1230 | case 87: | 1649 | break; |
| 1231 | #line 351 "scripts/genksyms/parse.y" | 1650 | |
| 1232 | { yyval = yyvsp[0] ? yyvsp[0] : yyvsp[-1]; ; | 1651 | case 84: |
| 1233 | break;} | 1652 | #line 335 "scripts/genksyms/parse.y" |
| 1234 | case 89: | 1653 | { (yyval) = NULL; ;} |
| 1235 | #line 356 "scripts/genksyms/parse.y" | 1654 | break; |
| 1236 | { yyval = NULL; ; | 1655 | |
| 1237 | break;} | 1656 | case 87: |
| 1238 | case 90: | 1657 | #line 342 "scripts/genksyms/parse.y" |
| 1239 | #line 358 "scripts/genksyms/parse.y" | 1658 | { (yyval) = (yyvsp[0]); ;} |
| 1240 | { /* For version 2 checksums, we don't want to remember | 1659 | break; |
| 1660 | |||
| 1661 | case 88: | ||
| 1662 | #line 347 "scripts/genksyms/parse.y" | ||
| 1663 | { (yyval) = (yyvsp[0]) ? (yyvsp[0]) : (yyvsp[-1]); ;} | ||
| 1664 | break; | ||
| 1665 | |||
| 1666 | case 89: | ||
| 1667 | #line 352 "scripts/genksyms/parse.y" | ||
| 1668 | { (yyval) = (yyvsp[0]) ? (yyvsp[0]) : (yyvsp[-1]); ;} | ||
| 1669 | break; | ||
| 1670 | |||
| 1671 | case 91: | ||
| 1672 | #line 357 "scripts/genksyms/parse.y" | ||
| 1673 | { (yyval) = NULL; ;} | ||
| 1674 | break; | ||
| 1675 | |||
| 1676 | case 92: | ||
| 1677 | #line 359 "scripts/genksyms/parse.y" | ||
| 1678 | { /* For version 2 checksums, we don't want to remember | ||
| 1241 | private parameter names. */ | 1679 | private parameter names. */ |
| 1242 | remove_node(yyvsp[0]); | 1680 | remove_node((yyvsp[0])); |
| 1243 | yyval = yyvsp[0]; | 1681 | (yyval) = (yyvsp[0]); |
| 1244 | ; | 1682 | ;} |
| 1245 | break;} | 1683 | break; |
| 1246 | case 91: | 1684 | |
| 1247 | #line 366 "scripts/genksyms/parse.y" | 1685 | case 93: |
| 1248 | { remove_node(yyvsp[0]); | 1686 | #line 367 "scripts/genksyms/parse.y" |
| 1249 | yyval = yyvsp[0]; | 1687 | { remove_node((yyvsp[0])); |
| 1250 | ; | 1688 | (yyval) = (yyvsp[0]); |
| 1251 | break;} | 1689 | ;} |
| 1252 | case 92: | 1690 | break; |
| 1253 | #line 370 "scripts/genksyms/parse.y" | 1691 | |
| 1254 | { yyval = yyvsp[0]; ; | 1692 | case 94: |
| 1255 | break;} | 1693 | #line 371 "scripts/genksyms/parse.y" |
| 1256 | case 93: | 1694 | { (yyval) = (yyvsp[0]); ;} |
| 1257 | #line 372 "scripts/genksyms/parse.y" | 1695 | break; |
| 1258 | { yyval = yyvsp[0]; ; | 1696 | |
| 1259 | break;} | 1697 | case 95: |
| 1260 | case 94: | 1698 | #line 373 "scripts/genksyms/parse.y" |
| 1261 | #line 374 "scripts/genksyms/parse.y" | 1699 | { (yyval) = (yyvsp[0]); ;} |
| 1262 | { yyval = yyvsp[0]; ; | 1700 | break; |
| 1263 | break;} | 1701 | |
| 1264 | case 95: | 1702 | case 96: |
| 1265 | #line 376 "scripts/genksyms/parse.y" | 1703 | #line 375 "scripts/genksyms/parse.y" |
| 1266 | { yyval = yyvsp[0]; ; | 1704 | { (yyval) = (yyvsp[0]); ;} |
| 1267 | break;} | 1705 | break; |
| 1268 | case 96: | 1706 | |
| 1269 | #line 378 "scripts/genksyms/parse.y" | 1707 | case 97: |
| 1270 | { yyval = yyvsp[0]; ; | 1708 | #line 377 "scripts/genksyms/parse.y" |
| 1271 | break;} | 1709 | { (yyval) = (yyvsp[0]); ;} |
| 1272 | case 97: | 1710 | break; |
| 1273 | #line 383 "scripts/genksyms/parse.y" | 1711 | |
| 1274 | { struct string_list *decl = *yyvsp[-1]; | 1712 | case 98: |
| 1275 | *yyvsp[-1] = NULL; | 1713 | #line 379 "scripts/genksyms/parse.y" |
| 1714 | { (yyval) = (yyvsp[0]); ;} | ||
| 1715 | break; | ||
| 1716 | |||
| 1717 | case 99: | ||
| 1718 | #line 384 "scripts/genksyms/parse.y" | ||
| 1719 | { struct string_list *decl = *(yyvsp[-1]); | ||
| 1720 | *(yyvsp[-1]) = NULL; | ||
| 1276 | add_symbol(current_name, SYM_NORMAL, decl, is_extern); | 1721 | add_symbol(current_name, SYM_NORMAL, decl, is_extern); |
| 1277 | yyval = yyvsp[0]; | 1722 | (yyval) = (yyvsp[0]); |
| 1278 | ; | 1723 | ;} |
| 1279 | break;} | 1724 | break; |
| 1280 | case 98: | 1725 | |
| 1281 | #line 391 "scripts/genksyms/parse.y" | 1726 | case 100: |
| 1282 | { yyval = NULL; ; | 1727 | #line 392 "scripts/genksyms/parse.y" |
| 1283 | break;} | 1728 | { (yyval) = NULL; ;} |
| 1284 | case 100: | 1729 | break; |
| 1285 | #line 398 "scripts/genksyms/parse.y" | 1730 | |
| 1286 | { remove_list(yyvsp[0], &(*yyvsp[-1])->next); yyval = yyvsp[0]; ; | 1731 | case 102: |
| 1287 | break;} | 1732 | #line 399 "scripts/genksyms/parse.y" |
| 1288 | case 101: | 1733 | { remove_list((yyvsp[0]), &(*(yyvsp[-1]))->next); (yyval) = (yyvsp[0]); ;} |
| 1289 | #line 402 "scripts/genksyms/parse.y" | 1734 | break; |
| 1290 | { yyval = yyvsp[0]; ; | 1735 | |
| 1291 | break;} | 1736 | case 103: |
| 1292 | case 102: | ||
| 1293 | #line 403 "scripts/genksyms/parse.y" | 1737 | #line 403 "scripts/genksyms/parse.y" |
| 1294 | { yyval = yyvsp[0]; ; | 1738 | { (yyval) = (yyvsp[0]); ;} |
| 1295 | break;} | 1739 | break; |
| 1296 | case 103: | 1740 | |
| 1297 | #line 407 "scripts/genksyms/parse.y" | 1741 | case 104: |
| 1298 | { yyval = NULL; ; | 1742 | #line 404 "scripts/genksyms/parse.y" |
| 1299 | break;} | 1743 | { (yyval) = (yyvsp[0]); ;} |
| 1300 | case 106: | 1744 | break; |
| 1301 | #line 413 "scripts/genksyms/parse.y" | 1745 | |
| 1302 | { yyval = yyvsp[0]; ; | 1746 | case 105: |
| 1303 | break;} | 1747 | #line 408 "scripts/genksyms/parse.y" |
| 1304 | case 107: | 1748 | { (yyval) = NULL; ;} |
| 1305 | #line 418 "scripts/genksyms/parse.y" | 1749 | break; |
| 1306 | { yyval = yyvsp[0]; ; | 1750 | |
| 1307 | break;} | 1751 | case 108: |
| 1308 | case 108: | 1752 | #line 414 "scripts/genksyms/parse.y" |
| 1309 | #line 420 "scripts/genksyms/parse.y" | 1753 | { (yyval) = (yyvsp[0]); ;} |
| 1310 | { yyval = yyvsp[0]; ; | 1754 | break; |
| 1311 | break;} | 1755 | |
| 1312 | case 109: | 1756 | case 109: |
| 1313 | #line 424 "scripts/genksyms/parse.y" | 1757 | #line 419 "scripts/genksyms/parse.y" |
| 1314 | { yyval = NULL; ; | 1758 | { (yyval) = (yyvsp[0]); ;} |
| 1315 | break;} | 1759 | break; |
| 1316 | case 112: | 1760 | |
| 1317 | #line 430 "scripts/genksyms/parse.y" | 1761 | case 110: |
| 1318 | { yyval = yyvsp[0]; ; | 1762 | #line 421 "scripts/genksyms/parse.y" |
| 1319 | break;} | 1763 | { (yyval) = (yyvsp[0]); ;} |
| 1320 | case 113: | 1764 | break; |
| 1321 | #line 434 "scripts/genksyms/parse.y" | 1765 | |
| 1322 | { yyval = yyvsp[0] ? yyvsp[0] : yyvsp[-1]; ; | 1766 | case 111: |
| 1323 | break;} | 1767 | #line 425 "scripts/genksyms/parse.y" |
| 1324 | case 114: | 1768 | { (yyval) = NULL; ;} |
| 1769 | break; | ||
| 1770 | |||
| 1771 | case 114: | ||
| 1772 | #line 431 "scripts/genksyms/parse.y" | ||
| 1773 | { (yyval) = (yyvsp[0]); ;} | ||
| 1774 | break; | ||
| 1775 | |||
| 1776 | case 115: | ||
| 1325 | #line 435 "scripts/genksyms/parse.y" | 1777 | #line 435 "scripts/genksyms/parse.y" |
| 1326 | { yyval = yyvsp[0]; ; | 1778 | { (yyval) = (yyvsp[0]) ? (yyvsp[0]) : (yyvsp[-1]); ;} |
| 1327 | break;} | 1779 | break; |
| 1328 | case 116: | 1780 | |
| 1329 | #line 440 "scripts/genksyms/parse.y" | 1781 | case 116: |
| 1330 | { yyval = yyvsp[0]; ; | 1782 | #line 436 "scripts/genksyms/parse.y" |
| 1331 | break;} | 1783 | { (yyval) = (yyvsp[0]); ;} |
| 1332 | case 117: | 1784 | break; |
| 1333 | #line 444 "scripts/genksyms/parse.y" | 1785 | |
| 1334 | { yyval = NULL; ; | 1786 | case 118: |
| 1335 | break;} | 1787 | #line 441 "scripts/genksyms/parse.y" |
| 1336 | case 119: | 1788 | { (yyval) = (yyvsp[0]); ;} |
| 1337 | #line 449 "scripts/genksyms/parse.y" | 1789 | break; |
| 1338 | { yyval = yyvsp[0]; ; | 1790 | |
| 1339 | break;} | 1791 | case 119: |
| 1340 | case 120: | 1792 | #line 445 "scripts/genksyms/parse.y" |
| 1341 | #line 453 "scripts/genksyms/parse.y" | 1793 | { (yyval) = NULL; ;} |
| 1342 | { yyval = NULL; ; | 1794 | break; |
| 1343 | break;} | 1795 | |
| 1344 | case 122: | 1796 | case 121: |
| 1345 | #line 459 "scripts/genksyms/parse.y" | 1797 | #line 450 "scripts/genksyms/parse.y" |
| 1346 | { export_symbol((*yyvsp[-2])->string); yyval = yyvsp[0]; ; | 1798 | { (yyval) = (yyvsp[0]); ;} |
| 1347 | break;} | 1799 | break; |
| 1348 | } | 1800 | |
| 1349 | /* the action file gets copied in in place of this dollarsign */ | 1801 | case 122: |
| 1350 | #line 543 "/usr/lib/bison.simple" | 1802 | #line 454 "scripts/genksyms/parse.y" |
| 1803 | { (yyval) = NULL; ;} | ||
| 1804 | break; | ||
| 1805 | |||
| 1806 | case 124: | ||
| 1807 | #line 460 "scripts/genksyms/parse.y" | ||
| 1808 | { export_symbol((*(yyvsp[-2]))->string); (yyval) = (yyvsp[0]); ;} | ||
| 1809 | break; | ||
| 1810 | |||
| 1811 | |||
| 1812 | } | ||
| 1813 | |||
| 1814 | /* Line 1037 of yacc.c. */ | ||
| 1815 | #line 1816 "scripts/genksyms/parse.c" | ||
| 1351 | 1816 | ||
| 1352 | yyvsp -= yylen; | 1817 | yyvsp -= yylen; |
| 1353 | yyssp -= yylen; | 1818 | yyssp -= yylen; |
| 1354 | #ifdef YYLSP_NEEDED | ||
| 1355 | yylsp -= yylen; | ||
| 1356 | #endif | ||
| 1357 | 1819 | ||
| 1358 | #if YYDEBUG != 0 | 1820 | |
| 1359 | if (yydebug) | 1821 | YY_STACK_PRINT (yyss, yyssp); |
| 1360 | { | ||
| 1361 | short *ssp1 = yyss - 1; | ||
| 1362 | fprintf (stderr, "state stack now"); | ||
| 1363 | while (ssp1 != yyssp) | ||
| 1364 | fprintf (stderr, " %d", *++ssp1); | ||
| 1365 | fprintf (stderr, "\n"); | ||
| 1366 | } | ||
| 1367 | #endif | ||
| 1368 | 1822 | ||
| 1369 | *++yyvsp = yyval; | 1823 | *++yyvsp = yyval; |
| 1370 | 1824 | ||
| 1371 | #ifdef YYLSP_NEEDED | ||
| 1372 | yylsp++; | ||
| 1373 | if (yylen == 0) | ||
| 1374 | { | ||
| 1375 | yylsp->first_line = yylloc.first_line; | ||
| 1376 | yylsp->first_column = yylloc.first_column; | ||
| 1377 | yylsp->last_line = (yylsp-1)->last_line; | ||
| 1378 | yylsp->last_column = (yylsp-1)->last_column; | ||
| 1379 | yylsp->text = 0; | ||
| 1380 | } | ||
| 1381 | else | ||
| 1382 | { | ||
| 1383 | yylsp->last_line = (yylsp+yylen-1)->last_line; | ||
| 1384 | yylsp->last_column = (yylsp+yylen-1)->last_column; | ||
| 1385 | } | ||
| 1386 | #endif | ||
| 1387 | 1825 | ||
| 1388 | /* Now "shift" the result of the reduction. | 1826 | /* Now `shift' the result of the reduction. Determine what state |
| 1389 | Determine what state that goes to, | 1827 | that goes to, based on the state we popped back to and the rule |
| 1390 | based on the state we popped back to | 1828 | number reduced by. */ |
| 1391 | and the rule number reduced by. */ | ||
| 1392 | 1829 | ||
| 1393 | yyn = yyr1[yyn]; | 1830 | yyn = yyr1[yyn]; |
| 1394 | 1831 | ||
| 1395 | yystate = yypgoto[yyn - YYNTBASE] + *yyssp; | 1832 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; |
| 1396 | if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) | 1833 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) |
| 1397 | yystate = yytable[yystate]; | 1834 | yystate = yytable[yystate]; |
| 1398 | else | 1835 | else |
| 1399 | yystate = yydefgoto[yyn - YYNTBASE]; | 1836 | yystate = yydefgoto[yyn - YYNTOKENS]; |
| 1400 | 1837 | ||
| 1401 | goto yynewstate; | 1838 | goto yynewstate; |
| 1402 | 1839 | ||
| 1403 | yyerrlab: /* here on detecting error */ | ||
| 1404 | 1840 | ||
| 1405 | if (! yyerrstatus) | 1841 | /*------------------------------------. |
| 1406 | /* If not already recovering from an error, report this error. */ | 1842 | | yyerrlab -- here on detecting error | |
| 1843 | `------------------------------------*/ | ||
| 1844 | yyerrlab: | ||
| 1845 | /* If not already recovering from an error, report this error. */ | ||
| 1846 | if (!yyerrstatus) | ||
| 1407 | { | 1847 | { |
| 1408 | ++yynerrs; | 1848 | ++yynerrs; |
| 1409 | 1849 | #if YYERROR_VERBOSE | |
| 1410 | #ifdef YYERROR_VERBOSE | ||
| 1411 | yyn = yypact[yystate]; | 1850 | yyn = yypact[yystate]; |
| 1412 | 1851 | ||
| 1413 | if (yyn > YYFLAG && yyn < YYLAST) | 1852 | if (YYPACT_NINF < yyn && yyn < YYLAST) |
| 1414 | { | 1853 | { |
| 1415 | int size = 0; | 1854 | YYSIZE_T yysize = 0; |
| 1416 | char *msg; | 1855 | int yytype = YYTRANSLATE (yychar); |
| 1417 | int x, count; | 1856 | const char* yyprefix; |
| 1418 | 1857 | char *yymsg; | |
| 1419 | count = 0; | 1858 | int yyx; |
| 1420 | /* Start X at -yyn if nec to avoid negative indexes in yycheck. */ | 1859 | |
| 1421 | for (x = (yyn < 0 ? -yyn : 0); | 1860 | /* Start YYX at -YYN if negative to avoid negative indexes in |
| 1422 | x < (sizeof(yytname) / sizeof(char *)); x++) | 1861 | YYCHECK. */ |
| 1423 | if (yycheck[x + yyn] == x) | 1862 | int yyxbegin = yyn < 0 ? -yyn : 0; |
| 1424 | size += strlen(yytname[x]) + 15, count++; | 1863 | |
| 1425 | msg = (char *) malloc(size + 15); | 1864 | /* Stay within bounds of both yycheck and yytname. */ |
| 1426 | if (msg != 0) | 1865 | int yychecklim = YYLAST - yyn; |
| 1866 | int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; | ||
| 1867 | int yycount = 0; | ||
| 1868 | |||
| 1869 | yyprefix = ", expecting "; | ||
| 1870 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) | ||
| 1871 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) | ||
| 1872 | { | ||
| 1873 | yysize += yystrlen (yyprefix) + yystrlen (yytname [yyx]); | ||
| 1874 | yycount += 1; | ||
| 1875 | if (yycount == 5) | ||
| 1876 | { | ||
| 1877 | yysize = 0; | ||
| 1878 | break; | ||
| 1879 | } | ||
| 1880 | } | ||
| 1881 | yysize += (sizeof ("syntax error, unexpected ") | ||
| 1882 | + yystrlen (yytname[yytype])); | ||
| 1883 | yymsg = (char *) YYSTACK_ALLOC (yysize); | ||
| 1884 | if (yymsg != 0) | ||
| 1427 | { | 1885 | { |
| 1428 | strcpy(msg, "parse error"); | 1886 | char *yyp = yystpcpy (yymsg, "syntax error, unexpected "); |
| 1887 | yyp = yystpcpy (yyp, yytname[yytype]); | ||
| 1429 | 1888 | ||
| 1430 | if (count < 5) | 1889 | if (yycount < 5) |
| 1431 | { | 1890 | { |
| 1432 | count = 0; | 1891 | yyprefix = ", expecting "; |
| 1433 | for (x = (yyn < 0 ? -yyn : 0); | 1892 | for (yyx = yyxbegin; yyx < yyxend; ++yyx) |
| 1434 | x < (sizeof(yytname) / sizeof(char *)); x++) | 1893 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) |
| 1435 | if (yycheck[x + yyn] == x) | ||
| 1436 | { | 1894 | { |
| 1437 | strcat(msg, count == 0 ? ", expecting `" : " or `"); | 1895 | yyp = yystpcpy (yyp, yyprefix); |
| 1438 | strcat(msg, yytname[x]); | 1896 | yyp = yystpcpy (yyp, yytname[yyx]); |
| 1439 | strcat(msg, "'"); | 1897 | yyprefix = " or "; |
| 1440 | count++; | ||
| 1441 | } | 1898 | } |
| 1442 | } | 1899 | } |
| 1443 | yyerror(msg); | 1900 | yyerror (yymsg); |
| 1444 | free(msg); | 1901 | YYSTACK_FREE (yymsg); |
| 1445 | } | 1902 | } |
| 1446 | else | 1903 | else |
| 1447 | yyerror ("parse error; also virtual memory exceeded"); | 1904 | yyerror ("syntax error; also virtual memory exhausted"); |
| 1448 | } | 1905 | } |
| 1449 | else | 1906 | else |
| 1450 | #endif /* YYERROR_VERBOSE */ | 1907 | #endif /* YYERROR_VERBOSE */ |
| 1451 | yyerror("parse error"); | 1908 | yyerror ("syntax error"); |
| 1452 | } | 1909 | } |
| 1453 | 1910 | ||
| 1454 | goto yyerrlab1; | 1911 | |
| 1455 | yyerrlab1: /* here on error raised explicitly by an action */ | ||
| 1456 | 1912 | ||
| 1457 | if (yyerrstatus == 3) | 1913 | if (yyerrstatus == 3) |
| 1458 | { | 1914 | { |
| 1459 | /* if just tried and failed to reuse lookahead token after an error, discard it. */ | 1915 | /* If just tried and failed to reuse look-ahead token after an |
| 1460 | 1916 | error, discard it. */ | |
| 1461 | /* return failure if at end of input */ | 1917 | |
| 1462 | if (yychar == YYEOF) | 1918 | if (yychar <= YYEOF) |
| 1463 | YYABORT; | 1919 | { |
| 1464 | 1920 | /* If at end of input, pop the error token, | |
| 1465 | #if YYDEBUG != 0 | 1921 | then the rest of the stack, then return failure. */ |
| 1466 | if (yydebug) | 1922 | if (yychar == YYEOF) |
| 1467 | fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]); | 1923 | for (;;) |
| 1468 | #endif | 1924 | { |
| 1469 | 1925 | ||
| 1470 | yychar = YYEMPTY; | 1926 | YYPOPSTACK; |
| 1927 | if (yyssp == yyss) | ||
| 1928 | YYABORT; | ||
| 1929 | yydestruct ("Error: popping", | ||
| 1930 | yystos[*yyssp], yyvsp); | ||
| 1931 | } | ||
| 1932 | } | ||
| 1933 | else | ||
| 1934 | { | ||
| 1935 | yydestruct ("Error: discarding", yytoken, &yylval); | ||
| 1936 | yychar = YYEMPTY; | ||
| 1937 | } | ||
| 1471 | } | 1938 | } |
| 1472 | 1939 | ||
| 1473 | /* Else will try to reuse lookahead token | 1940 | /* Else will try to reuse look-ahead token after shifting the error |
| 1474 | after shifting the error token. */ | 1941 | token. */ |
| 1475 | 1942 | goto yyerrlab1; | |
| 1476 | yyerrstatus = 3; /* Each real token shifted decrements this */ | ||
| 1477 | 1943 | ||
| 1478 | goto yyerrhandle; | ||
| 1479 | 1944 | ||
| 1480 | yyerrdefault: /* current state does not do anything special for the error token. */ | 1945 | /*---------------------------------------------------. |
| 1946 | | yyerrorlab -- error raised explicitly by YYERROR. | | ||
| 1947 | `---------------------------------------------------*/ | ||
| 1948 | yyerrorlab: | ||
| 1481 | 1949 | ||
| 1482 | #if 0 | 1950 | #ifdef __GNUC__ |
| 1483 | /* This is wrong; only states that explicitly want error tokens | 1951 | /* Pacify GCC when the user code never invokes YYERROR and the label |
| 1484 | should shift them. */ | 1952 | yyerrorlab therefore never appears in user code. */ |
| 1485 | yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/ | 1953 | if (0) |
| 1486 | if (yyn) goto yydefault; | 1954 | goto yyerrorlab; |
| 1487 | #endif | 1955 | #endif |
| 1488 | 1956 | ||
| 1489 | yyerrpop: /* pop the current state because it cannot handle the error token */ | 1957 | yyvsp -= yylen; |
| 1958 | yyssp -= yylen; | ||
| 1959 | yystate = *yyssp; | ||
| 1960 | goto yyerrlab1; | ||
| 1961 | |||
| 1490 | 1962 | ||
| 1491 | if (yyssp == yyss) YYABORT; | 1963 | /*-------------------------------------------------------------. |
| 1492 | yyvsp--; | 1964 | | yyerrlab1 -- common code for both syntax error and YYERROR. | |
| 1493 | yystate = *--yyssp; | 1965 | `-------------------------------------------------------------*/ |
| 1494 | #ifdef YYLSP_NEEDED | 1966 | yyerrlab1: |
| 1495 | yylsp--; | 1967 | yyerrstatus = 3; /* Each real token shifted decrements this. */ |
| 1496 | #endif | ||
| 1497 | 1968 | ||
| 1498 | #if YYDEBUG != 0 | 1969 | for (;;) |
| 1499 | if (yydebug) | ||
| 1500 | { | 1970 | { |
| 1501 | short *ssp1 = yyss - 1; | 1971 | yyn = yypact[yystate]; |
| 1502 | fprintf (stderr, "Error: state stack now"); | 1972 | if (yyn != YYPACT_NINF) |
| 1503 | while (ssp1 != yyssp) | 1973 | { |
| 1504 | fprintf (stderr, " %d", *++ssp1); | 1974 | yyn += YYTERROR; |
| 1505 | fprintf (stderr, "\n"); | 1975 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) |
| 1506 | } | 1976 | { |
| 1507 | #endif | 1977 | yyn = yytable[yyn]; |
| 1508 | 1978 | if (0 < yyn) | |
| 1509 | yyerrhandle: | 1979 | break; |
| 1980 | } | ||
| 1981 | } | ||
| 1510 | 1982 | ||
| 1511 | yyn = yypact[yystate]; | 1983 | /* Pop the current state because it cannot handle the error token. */ |
| 1512 | if (yyn == YYFLAG) | 1984 | if (yyssp == yyss) |
| 1513 | goto yyerrdefault; | 1985 | YYABORT; |
| 1514 | 1986 | ||
| 1515 | yyn += YYTERROR; | ||
| 1516 | if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) | ||
| 1517 | goto yyerrdefault; | ||
| 1518 | 1987 | ||
| 1519 | yyn = yytable[yyn]; | 1988 | yydestruct ("Error: popping", yystos[yystate], yyvsp); |
| 1520 | if (yyn < 0) | 1989 | YYPOPSTACK; |
| 1521 | { | 1990 | yystate = *yyssp; |
| 1522 | if (yyn == YYFLAG) | 1991 | YY_STACK_PRINT (yyss, yyssp); |
| 1523 | goto yyerrpop; | ||
| 1524 | yyn = -yyn; | ||
| 1525 | goto yyreduce; | ||
| 1526 | } | 1992 | } |
| 1527 | else if (yyn == 0) | ||
| 1528 | goto yyerrpop; | ||
| 1529 | 1993 | ||
| 1530 | if (yyn == YYFINAL) | 1994 | if (yyn == YYFINAL) |
| 1531 | YYACCEPT; | 1995 | YYACCEPT; |
| 1532 | 1996 | ||
| 1533 | #if YYDEBUG != 0 | ||
| 1534 | if (yydebug) | ||
| 1535 | fprintf(stderr, "Shifting error token, "); | ||
| 1536 | #endif | ||
| 1537 | |||
| 1538 | *++yyvsp = yylval; | 1997 | *++yyvsp = yylval; |
| 1539 | #ifdef YYLSP_NEEDED | 1998 | |
| 1540 | *++yylsp = yylloc; | 1999 | |
| 1541 | #endif | 2000 | /* Shift the error token. */ |
| 2001 | YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); | ||
| 1542 | 2002 | ||
| 1543 | yystate = yyn; | 2003 | yystate = yyn; |
| 1544 | goto yynewstate; | 2004 | goto yynewstate; |
| 1545 | 2005 | ||
| 1546 | yyacceptlab: | 2006 | |
| 1547 | /* YYACCEPT comes here. */ | 2007 | /*-------------------------------------. |
| 1548 | if (yyfree_stacks) | 2008 | | yyacceptlab -- YYACCEPT comes here. | |
| 1549 | { | 2009 | `-------------------------------------*/ |
| 1550 | free (yyss); | 2010 | yyacceptlab: |
| 1551 | free (yyvs); | 2011 | yyresult = 0; |
| 1552 | #ifdef YYLSP_NEEDED | 2012 | goto yyreturn; |
| 1553 | free (yyls); | 2013 | |
| 2014 | /*-----------------------------------. | ||
| 2015 | | yyabortlab -- YYABORT comes here. | | ||
| 2016 | `-----------------------------------*/ | ||
| 2017 | yyabortlab: | ||
| 2018 | yydestruct ("Error: discarding lookahead", | ||
| 2019 | yytoken, &yylval); | ||
| 2020 | yychar = YYEMPTY; | ||
| 2021 | yyresult = 1; | ||
| 2022 | goto yyreturn; | ||
| 2023 | |||
| 2024 | #ifndef yyoverflow | ||
| 2025 | /*----------------------------------------------. | ||
| 2026 | | yyoverflowlab -- parser overflow comes here. | | ||
| 2027 | `----------------------------------------------*/ | ||
| 2028 | yyoverflowlab: | ||
| 2029 | yyerror ("parser stack overflow"); | ||
| 2030 | yyresult = 2; | ||
| 2031 | /* Fall through. */ | ||
| 1554 | #endif | 2032 | #endif |
| 1555 | } | ||
| 1556 | return 0; | ||
| 1557 | 2033 | ||
| 1558 | yyabortlab: | 2034 | yyreturn: |
| 1559 | /* YYABORT comes here. */ | 2035 | #ifndef yyoverflow |
| 1560 | if (yyfree_stacks) | 2036 | if (yyss != yyssa) |
| 1561 | { | 2037 | YYSTACK_FREE (yyss); |
| 1562 | free (yyss); | ||
| 1563 | free (yyvs); | ||
| 1564 | #ifdef YYLSP_NEEDED | ||
| 1565 | free (yyls); | ||
| 1566 | #endif | 2038 | #endif |
| 1567 | } | 2039 | return yyresult; |
| 1568 | return 1; | ||
| 1569 | } | 2040 | } |
| 1570 | #line 463 "scripts/genksyms/parse.y" | 2041 | |
| 2042 | |||
| 2043 | #line 464 "scripts/genksyms/parse.y" | ||
| 1571 | 2044 | ||
| 1572 | 2045 | ||
| 1573 | static void | 2046 | static void |
| @@ -1575,3 +2048,4 @@ yyerror(const char *e) | |||
| 1575 | { | 2048 | { |
| 1576 | error_with_pos("%s", e); | 2049 | error_with_pos("%s", e); |
| 1577 | } | 2050 | } |
| 2051 | |||
diff --git a/scripts/genksyms/parse.h_shipped b/scripts/genksyms/parse.h_shipped index d5b27e3b20c4..f3fb2bb058e1 100644 --- a/scripts/genksyms/parse.h_shipped +++ b/scripts/genksyms/parse.h_shipped | |||
| @@ -1,46 +1,128 @@ | |||
| 1 | #ifndef YYSTYPE | 1 | /* A Bison parser, made by GNU Bison 2.0. */ |
| 2 | #define YYSTYPE int | 2 | |
| 3 | /* Skeleton parser for Yacc-like parsing with Bison, | ||
| 4 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. | ||
| 5 | |||
| 6 | This program is free software; you can redistribute it and/or modify | ||
| 7 | it under the terms of the GNU General Public License as published by | ||
| 8 | the Free Software Foundation; either version 2, or (at your option) | ||
| 9 | any later version. | ||
| 10 | |||
| 11 | This program is distributed in the hope that it will be useful, | ||
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | GNU General Public License for more details. | ||
| 15 | |||
| 16 | You should have received a copy of the GNU General Public License | ||
| 17 | along with this program; if not, write to the Free Software | ||
| 18 | Foundation, Inc., 59 Temple Place - Suite 330, | ||
| 19 | Boston, MA 02111-1307, USA. */ | ||
| 20 | |||
| 21 | /* As a special exception, when this file is copied by Bison into a | ||
| 22 | Bison output file, you may use that output file without restriction. | ||
| 23 | This special exception was added by the Free Software Foundation | ||
| 24 | in version 1.24 of Bison. */ | ||
| 25 | |||
| 26 | /* Tokens. */ | ||
| 27 | #ifndef YYTOKENTYPE | ||
| 28 | # define YYTOKENTYPE | ||
| 29 | /* Put the tokens into the symbol table, so that GDB and other debuggers | ||
| 30 | know about them. */ | ||
| 31 | enum yytokentype { | ||
| 32 | ASM_KEYW = 258, | ||
| 33 | ATTRIBUTE_KEYW = 259, | ||
| 34 | AUTO_KEYW = 260, | ||
| 35 | BOOL_KEYW = 261, | ||
| 36 | CHAR_KEYW = 262, | ||
| 37 | CONST_KEYW = 263, | ||
| 38 | DOUBLE_KEYW = 264, | ||
| 39 | ENUM_KEYW = 265, | ||
| 40 | EXTERN_KEYW = 266, | ||
| 41 | FLOAT_KEYW = 267, | ||
| 42 | INLINE_KEYW = 268, | ||
| 43 | INT_KEYW = 269, | ||
| 44 | LONG_KEYW = 270, | ||
| 45 | REGISTER_KEYW = 271, | ||
| 46 | RESTRICT_KEYW = 272, | ||
| 47 | SHORT_KEYW = 273, | ||
| 48 | SIGNED_KEYW = 274, | ||
| 49 | STATIC_KEYW = 275, | ||
| 50 | STRUCT_KEYW = 276, | ||
| 51 | TYPEDEF_KEYW = 277, | ||
| 52 | UNION_KEYW = 278, | ||
| 53 | UNSIGNED_KEYW = 279, | ||
| 54 | VOID_KEYW = 280, | ||
| 55 | VOLATILE_KEYW = 281, | ||
| 56 | TYPEOF_KEYW = 282, | ||
| 57 | EXPORT_SYMBOL_KEYW = 283, | ||
| 58 | ASM_PHRASE = 284, | ||
| 59 | ATTRIBUTE_PHRASE = 285, | ||
| 60 | BRACE_PHRASE = 286, | ||
| 61 | BRACKET_PHRASE = 287, | ||
| 62 | EXPRESSION_PHRASE = 288, | ||
| 63 | CHAR = 289, | ||
| 64 | DOTS = 290, | ||
| 65 | IDENT = 291, | ||
| 66 | INT = 292, | ||
| 67 | REAL = 293, | ||
| 68 | STRING = 294, | ||
| 69 | TYPE = 295, | ||
| 70 | OTHER = 296, | ||
| 71 | FILENAME = 297 | ||
| 72 | }; | ||
| 3 | #endif | 73 | #endif |
| 4 | #define ASM_KEYW 257 | 74 | #define ASM_KEYW 258 |
| 5 | #define ATTRIBUTE_KEYW 258 | 75 | #define ATTRIBUTE_KEYW 259 |
| 6 | #define AUTO_KEYW 259 | 76 | #define AUTO_KEYW 260 |
| 7 | #define BOOL_KEYW 260 | 77 | #define BOOL_KEYW 261 |
| 8 | #define CHAR_KEYW 261 | 78 | #define CHAR_KEYW 262 |
| 9 | #define CONST_KEYW 262 | 79 | #define CONST_KEYW 263 |
| 10 | #define DOUBLE_KEYW 263 | 80 | #define DOUBLE_KEYW 264 |
| 11 | #define ENUM_KEYW 264 | 81 | #define ENUM_KEYW 265 |
| 12 | #define EXTERN_KEYW 265 | 82 | #define EXTERN_KEYW 266 |
| 13 | #define FLOAT_KEYW 266 | 83 | #define FLOAT_KEYW 267 |
| 14 | #define INLINE_KEYW 267 | 84 | #define INLINE_KEYW 268 |
| 15 | #define INT_KEYW 268 | 85 | #define INT_KEYW 269 |
| 16 | #define LONG_KEYW 269 | 86 | #define LONG_KEYW 270 |
| 17 | #define REGISTER_KEYW 270 | 87 | #define REGISTER_KEYW 271 |
| 18 | #define RESTRICT_KEYW 271 | 88 | #define RESTRICT_KEYW 272 |
| 19 | #define SHORT_KEYW 272 | 89 | #define SHORT_KEYW 273 |
| 20 | #define SIGNED_KEYW 273 | 90 | #define SIGNED_KEYW 274 |
| 21 | #define STATIC_KEYW 274 | 91 | #define STATIC_KEYW 275 |
| 22 | #define STRUCT_KEYW 275 | 92 | #define STRUCT_KEYW 276 |
| 23 | #define TYPEDEF_KEYW 276 | 93 | #define TYPEDEF_KEYW 277 |
| 24 | #define UNION_KEYW 277 | 94 | #define UNION_KEYW 278 |
| 25 | #define UNSIGNED_KEYW 278 | 95 | #define UNSIGNED_KEYW 279 |
| 26 | #define VOID_KEYW 279 | 96 | #define VOID_KEYW 280 |
| 27 | #define VOLATILE_KEYW 280 | 97 | #define VOLATILE_KEYW 281 |
| 28 | #define TYPEOF_KEYW 281 | 98 | #define TYPEOF_KEYW 282 |
| 29 | #define EXPORT_SYMBOL_KEYW 282 | 99 | #define EXPORT_SYMBOL_KEYW 283 |
| 30 | #define ASM_PHRASE 283 | 100 | #define ASM_PHRASE 284 |
| 31 | #define ATTRIBUTE_PHRASE 284 | 101 | #define ATTRIBUTE_PHRASE 285 |
| 32 | #define BRACE_PHRASE 285 | 102 | #define BRACE_PHRASE 286 |
| 33 | #define BRACKET_PHRASE 286 | 103 | #define BRACKET_PHRASE 287 |
| 34 | #define EXPRESSION_PHRASE 287 | 104 | #define EXPRESSION_PHRASE 288 |
| 35 | #define CHAR 288 | 105 | #define CHAR 289 |
| 36 | #define DOTS 289 | 106 | #define DOTS 290 |
| 37 | #define IDENT 290 | 107 | #define IDENT 291 |
| 38 | #define INT 291 | 108 | #define INT 292 |
| 39 | #define REAL 292 | 109 | #define REAL 293 |
| 40 | #define STRING 293 | 110 | #define STRING 294 |
| 41 | #define TYPE 294 | 111 | #define TYPE 295 |
| 42 | #define OTHER 295 | 112 | #define OTHER 296 |
| 43 | #define FILENAME 296 | 113 | #define FILENAME 297 |
| 114 | |||
| 44 | 115 | ||
| 45 | 116 | ||
| 117 | |||
| 118 | #if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED) | ||
| 119 | typedef int YYSTYPE; | ||
| 120 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | ||
| 121 | # define YYSTYPE_IS_DECLARED 1 | ||
| 122 | # define YYSTYPE_IS_TRIVIAL 1 | ||
| 123 | #endif | ||
| 124 | |||
| 46 | extern YYSTYPE yylval; | 125 | extern YYSTYPE yylval; |
| 126 | |||
| 127 | |||
| 128 | |||
diff --git a/scripts/genksyms/parse.y b/scripts/genksyms/parse.y index 099043713db4..ca04c944b7c3 100644 --- a/scripts/genksyms/parse.y +++ b/scripts/genksyms/parse.y | |||
| @@ -197,6 +197,7 @@ storage_class_specifier: | |||
| 197 | type_specifier: | 197 | type_specifier: |
| 198 | simple_type_specifier | 198 | simple_type_specifier |
| 199 | | cvar_qualifier | 199 | | cvar_qualifier |
| 200 | | TYPEOF_KEYW '(' decl_specifier_seq '*' ')' | ||
| 200 | | TYPEOF_KEYW '(' decl_specifier_seq ')' | 201 | | TYPEOF_KEYW '(' decl_specifier_seq ')' |
| 201 | 202 | ||
| 202 | /* References to s/u/e's defined elsewhere. Rearrange things | 203 | /* References to s/u/e's defined elsewhere. Rearrange things |
diff --git a/scripts/kconfig/.gitignore b/scripts/kconfig/.gitignore index 2dac3442e0ac..e8ad1f6b3da4 100644 --- a/scripts/kconfig/.gitignore +++ b/scripts/kconfig/.gitignore | |||
| @@ -5,6 +5,7 @@ config* | |||
| 5 | lex.*.c | 5 | lex.*.c |
| 6 | *.tab.c | 6 | *.tab.c |
| 7 | *.tab.h | 7 | *.tab.h |
| 8 | zconf.hash.c | ||
| 8 | 9 | ||
| 9 | # | 10 | # |
| 10 | # configuration programs | 11 | # configuration programs |
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index a96153fc793f..3d7f1ac9e00c 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
| @@ -11,7 +11,7 @@ gconfig: $(obj)/gconf | |||
| 11 | $< arch/$(ARCH)/Kconfig | 11 | $< arch/$(ARCH)/Kconfig |
| 12 | 12 | ||
| 13 | menuconfig: $(obj)/mconf | 13 | menuconfig: $(obj)/mconf |
| 14 | $(Q)$(MAKE) $(build)=scripts/lxdialog | 14 | $(Q)$(MAKE) $(build)=scripts/kconfig/lxdialog |
| 15 | $< arch/$(ARCH)/Kconfig | 15 | $< arch/$(ARCH)/Kconfig |
| 16 | 16 | ||
| 17 | config: $(obj)/conf | 17 | config: $(obj)/conf |
| @@ -115,6 +115,7 @@ endif | |||
| 115 | 115 | ||
| 116 | clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ | 116 | clean-files := lkc_defs.h qconf.moc .tmp_qtcheck \ |
| 117 | .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c | 117 | .tmp_gtkcheck zconf.tab.c lex.zconf.c zconf.hash.c |
| 118 | subdir- += lxdialog | ||
| 118 | 119 | ||
| 119 | # Needed for systems without gettext | 120 | # Needed for systems without gettext |
| 120 | KBUILD_HAVE_NLS := $(shell \ | 121 | KBUILD_HAVE_NLS := $(shell \ |
diff --git a/scripts/kconfig/lxdialog/.gitignore b/scripts/kconfig/lxdialog/.gitignore new file mode 100644 index 000000000000..90b08ff025a6 --- /dev/null +++ b/scripts/kconfig/lxdialog/.gitignore | |||
| @@ -0,0 +1,4 @@ | |||
| 1 | # | ||
| 2 | # Generated files | ||
| 3 | # | ||
| 4 | lxdialog | ||
diff --git a/scripts/lxdialog/BIG.FAT.WARNING b/scripts/kconfig/lxdialog/BIG.FAT.WARNING index a8999d82bdb3..a8999d82bdb3 100644 --- a/scripts/lxdialog/BIG.FAT.WARNING +++ b/scripts/kconfig/lxdialog/BIG.FAT.WARNING | |||
diff --git a/scripts/lxdialog/Makefile b/scripts/kconfig/lxdialog/Makefile index a45a13fb26ed..a45a13fb26ed 100644 --- a/scripts/lxdialog/Makefile +++ b/scripts/kconfig/lxdialog/Makefile | |||
diff --git a/scripts/kconfig/lxdialog/checklist.c b/scripts/kconfig/lxdialog/checklist.c new file mode 100644 index 000000000000..db07ae73e051 --- /dev/null +++ b/scripts/kconfig/lxdialog/checklist.c | |||
| @@ -0,0 +1,334 @@ | |||
| 1 | /* | ||
| 2 | * checklist.c -- implements the checklist box | ||
| 3 | * | ||
| 4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
| 5 | * Stuart Herbert - S.Herbert@sheffield.ac.uk: radiolist extension | ||
| 6 | * Alessandro Rubini - rubini@ipvvis.unipv.it: merged the two | ||
| 7 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) | ||
| 8 | * | ||
| 9 | * This program is free software; you can redistribute it and/or | ||
| 10 | * modify it under the terms of the GNU General Public License | ||
| 11 | * as published by the Free Software Foundation; either version 2 | ||
| 12 | * of the License, or (at your option) any later version. | ||
| 13 | * | ||
| 14 | * This program is distributed in the hope that it will be useful, | ||
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | * GNU General Public License for more details. | ||
| 18 | * | ||
| 19 | * You should have received a copy of the GNU General Public License | ||
| 20 | * along with this program; if not, write to the Free Software | ||
| 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 22 | */ | ||
| 23 | |||
| 24 | #include "dialog.h" | ||
| 25 | |||
| 26 | static int list_width, check_x, item_x; | ||
| 27 | |||
| 28 | /* | ||
| 29 | * Print list item | ||
| 30 | */ | ||
| 31 | static void print_item(WINDOW * win, const char *item, int status, int choice, | ||
| 32 | int selected) | ||
| 33 | { | ||
| 34 | int i; | ||
| 35 | |||
| 36 | /* Clear 'residue' of last item */ | ||
| 37 | wattrset(win, menubox_attr); | ||
| 38 | wmove(win, choice, 0); | ||
| 39 | for (i = 0; i < list_width; i++) | ||
| 40 | waddch(win, ' '); | ||
| 41 | |||
| 42 | wmove(win, choice, check_x); | ||
| 43 | wattrset(win, selected ? check_selected_attr : check_attr); | ||
| 44 | wprintw(win, "(%c)", status ? 'X' : ' '); | ||
| 45 | |||
| 46 | wattrset(win, selected ? tag_selected_attr : tag_attr); | ||
| 47 | mvwaddch(win, choice, item_x, item[0]); | ||
| 48 | wattrset(win, selected ? item_selected_attr : item_attr); | ||
| 49 | waddstr(win, (char *)item + 1); | ||
| 50 | if (selected) { | ||
| 51 | wmove(win, choice, check_x + 1); | ||
| 52 | wrefresh(win); | ||
| 53 | } | ||
| 54 | } | ||
| 55 | |||
| 56 | /* | ||
| 57 | * Print the scroll indicators. | ||
| 58 | */ | ||
| 59 | static void print_arrows(WINDOW * win, int choice, int item_no, int scroll, | ||
| 60 | int y, int x, int height) | ||
| 61 | { | ||
| 62 | wmove(win, y, x); | ||
| 63 | |||
| 64 | if (scroll > 0) { | ||
| 65 | wattrset(win, uarrow_attr); | ||
| 66 | waddch(win, ACS_UARROW); | ||
| 67 | waddstr(win, "(-)"); | ||
| 68 | } else { | ||
| 69 | wattrset(win, menubox_attr); | ||
| 70 | waddch(win, ACS_HLINE); | ||
| 71 | waddch(win, ACS_HLINE); | ||
| 72 | waddch(win, ACS_HLINE); | ||
| 73 | waddch(win, ACS_HLINE); | ||
| 74 | } | ||
| 75 | |||
| 76 | y = y + height + 1; | ||
| 77 | wmove(win, y, x); | ||
| 78 | |||
| 79 | if ((height < item_no) && (scroll + choice < item_no - 1)) { | ||
| 80 | wattrset(win, darrow_attr); | ||
| 81 | waddch(win, ACS_DARROW); | ||
| 82 | waddstr(win, "(+)"); | ||
| 83 | } else { | ||
| 84 | wattrset(win, menubox_border_attr); | ||
| 85 | waddch(win, ACS_HLINE); | ||
| 86 | waddch(win, ACS_HLINE); | ||
| 87 | waddch(win, ACS_HLINE); | ||
| 88 | waddch(win, ACS_HLINE); | ||
| 89 | } | ||
| 90 | } | ||
| 91 | |||
| 92 | /* | ||
| 93 | * Display the termination buttons | ||
| 94 | */ | ||
| 95 | static void print_buttons(WINDOW * dialog, int height, int width, int selected) | ||
| 96 | { | ||
| 97 | int x = width / 2 - 11; | ||
| 98 | int y = height - 2; | ||
| 99 | |||
| 100 | print_button(dialog, "Select", y, x, selected == 0); | ||
| 101 | print_button(dialog, " Help ", y, x + 14, selected == 1); | ||
| 102 | |||
| 103 | wmove(dialog, y, x + 1 + 14 * selected); | ||
| 104 | wrefresh(dialog); | ||
| 105 | } | ||
| 106 | |||
| 107 | /* | ||
| 108 | * Display a dialog box with a list of options that can be turned on or off | ||
| 109 | * in the style of radiolist (only one option turned on at a time). | ||
| 110 | */ | ||
| 111 | int dialog_checklist(const char *title, const char *prompt, int height, | ||
| 112 | int width, int list_height, int item_no, | ||
| 113 | const char *const *items) | ||
| 114 | { | ||
| 115 | int i, x, y, box_x, box_y; | ||
| 116 | int key = 0, button = 0, choice = 0, scroll = 0, max_choice, *status; | ||
| 117 | WINDOW *dialog, *list; | ||
| 118 | |||
| 119 | /* Allocate space for storing item on/off status */ | ||
| 120 | if ((status = malloc(sizeof(int) * item_no)) == NULL) { | ||
| 121 | endwin(); | ||
| 122 | fprintf(stderr, | ||
| 123 | "\nCan't allocate memory in dialog_checklist().\n"); | ||
| 124 | exit(-1); | ||
| 125 | } | ||
| 126 | |||
| 127 | /* Initializes status */ | ||
| 128 | for (i = 0; i < item_no; i++) { | ||
| 129 | status[i] = !strcasecmp(items[i * 3 + 2], "on"); | ||
| 130 | if ((!choice && status[i]) | ||
| 131 | || !strcasecmp(items[i * 3 + 2], "selected")) | ||
| 132 | choice = i + 1; | ||
| 133 | } | ||
| 134 | if (choice) | ||
| 135 | choice--; | ||
| 136 | |||
| 137 | max_choice = MIN(list_height, item_no); | ||
| 138 | |||
| 139 | /* center dialog box on screen */ | ||
| 140 | x = (COLS - width) / 2; | ||
| 141 | y = (LINES - height) / 2; | ||
| 142 | |||
| 143 | draw_shadow(stdscr, y, x, height, width); | ||
| 144 | |||
| 145 | dialog = newwin(height, width, y, x); | ||
| 146 | keypad(dialog, TRUE); | ||
| 147 | |||
| 148 | draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); | ||
| 149 | wattrset(dialog, border_attr); | ||
| 150 | mvwaddch(dialog, height - 3, 0, ACS_LTEE); | ||
| 151 | for (i = 0; i < width - 2; i++) | ||
| 152 | waddch(dialog, ACS_HLINE); | ||
| 153 | wattrset(dialog, dialog_attr); | ||
| 154 | waddch(dialog, ACS_RTEE); | ||
| 155 | |||
| 156 | print_title(dialog, title, width); | ||
| 157 | |||
| 158 | wattrset(dialog, dialog_attr); | ||
| 159 | print_autowrap(dialog, prompt, width - 2, 1, 3); | ||
| 160 | |||
| 161 | list_width = width - 6; | ||
| 162 | box_y = height - list_height - 5; | ||
| 163 | box_x = (width - list_width) / 2 - 1; | ||
| 164 | |||
| 165 | /* create new window for the list */ | ||
| 166 | list = subwin(dialog, list_height, list_width, y + box_y + 1, | ||
| 167 | x + box_x + 1); | ||
| 168 | |||
| 169 | keypad(list, TRUE); | ||
| 170 | |||
| 171 | /* draw a box around the list items */ | ||
| 172 | draw_box(dialog, box_y, box_x, list_height + 2, list_width + 2, | ||
| 173 | menubox_border_attr, menubox_attr); | ||
| 174 | |||
| 175 | /* Find length of longest item in order to center checklist */ | ||
| 176 | check_x = 0; | ||
| 177 | for (i = 0; i < item_no; i++) | ||
| 178 | check_x = MAX(check_x, +strlen(items[i * 3 + 1]) + 4); | ||
| 179 | |||
| 180 | check_x = (list_width - check_x) / 2; | ||
| 181 | item_x = check_x + 4; | ||
| 182 | |||
| 183 | if (choice >= list_height) { | ||
| 184 | scroll = choice - list_height + 1; | ||
| 185 | choice -= scroll; | ||
| 186 | } | ||
| 187 | |||
| 188 | /* Print the list */ | ||
| 189 | for (i = 0; i < max_choice; i++) { | ||
| 190 | print_item(list, items[(scroll + i) * 3 + 1], | ||
| 191 | status[i + scroll], i, i == choice); | ||
| 192 | } | ||
| 193 | |||
| 194 | print_arrows(dialog, choice, item_no, scroll, | ||
| 195 | box_y, box_x + check_x + 5, list_height); | ||
| 196 | |||
| 197 | print_buttons(dialog, height, width, 0); | ||
| 198 | |||
| 199 | wnoutrefresh(list); | ||
| 200 | wnoutrefresh(dialog); | ||
| 201 | doupdate(); | ||
| 202 | |||
| 203 | while (key != ESC) { | ||
| 204 | key = wgetch(dialog); | ||
| 205 | |||
| 206 | for (i = 0; i < max_choice; i++) | ||
| 207 | if (toupper(key) == | ||
| 208 | toupper(items[(scroll + i) * 3 + 1][0])) | ||
| 209 | break; | ||
| 210 | |||
| 211 | if (i < max_choice || key == KEY_UP || key == KEY_DOWN || | ||
| 212 | key == '+' || key == '-') { | ||
| 213 | if (key == KEY_UP || key == '-') { | ||
| 214 | if (!choice) { | ||
| 215 | if (!scroll) | ||
| 216 | continue; | ||
| 217 | /* Scroll list down */ | ||
| 218 | if (list_height > 1) { | ||
| 219 | /* De-highlight current first item */ | ||
| 220 | print_item(list, items[scroll * 3 + 1], | ||
| 221 | status[scroll], 0, FALSE); | ||
| 222 | scrollok(list, TRUE); | ||
| 223 | wscrl(list, -1); | ||
| 224 | scrollok(list, FALSE); | ||
| 225 | } | ||
| 226 | scroll--; | ||
| 227 | print_item(list, items[scroll * 3 + 1], status[scroll], 0, TRUE); | ||
| 228 | wnoutrefresh(list); | ||
| 229 | |||
| 230 | print_arrows(dialog, choice, item_no, | ||
| 231 | scroll, box_y, box_x + check_x + 5, list_height); | ||
| 232 | |||
| 233 | wrefresh(dialog); | ||
| 234 | |||
| 235 | continue; /* wait for another key press */ | ||
| 236 | } else | ||
| 237 | i = choice - 1; | ||
| 238 | } else if (key == KEY_DOWN || key == '+') { | ||
| 239 | if (choice == max_choice - 1) { | ||
| 240 | if (scroll + choice >= item_no - 1) | ||
| 241 | continue; | ||
| 242 | /* Scroll list up */ | ||
| 243 | if (list_height > 1) { | ||
| 244 | /* De-highlight current last item before scrolling up */ | ||
| 245 | print_item(list, items[(scroll + max_choice - 1) * 3 + 1], | ||
| 246 | status[scroll + max_choice - 1], | ||
| 247 | max_choice - 1, FALSE); | ||
| 248 | scrollok(list, TRUE); | ||
| 249 | wscrl(list, 1); | ||
| 250 | scrollok(list, FALSE); | ||
| 251 | } | ||
| 252 | scroll++; | ||
| 253 | print_item(list, items[(scroll + max_choice - 1) * 3 + 1], | ||
| 254 | status[scroll + max_choice - 1], max_choice - 1, TRUE); | ||
| 255 | wnoutrefresh(list); | ||
| 256 | |||
| 257 | print_arrows(dialog, choice, item_no, | ||
| 258 | scroll, box_y, box_x + check_x + 5, list_height); | ||
| 259 | |||
| 260 | wrefresh(dialog); | ||
| 261 | |||
| 262 | continue; /* wait for another key press */ | ||
| 263 | } else | ||
| 264 | i = choice + 1; | ||
| 265 | } | ||
| 266 | if (i != choice) { | ||
| 267 | /* De-highlight current item */ | ||
| 268 | print_item(list, items[(scroll + choice) * 3 + 1], | ||
| 269 | status[scroll + choice], choice, FALSE); | ||
| 270 | /* Highlight new item */ | ||
| 271 | choice = i; | ||
| 272 | print_item(list, items[(scroll + choice) * 3 + 1], | ||
| 273 | status[scroll + choice], choice, TRUE); | ||
| 274 | wnoutrefresh(list); | ||
| 275 | wrefresh(dialog); | ||
| 276 | } | ||
| 277 | continue; /* wait for another key press */ | ||
| 278 | } | ||
| 279 | switch (key) { | ||
| 280 | case 'H': | ||
| 281 | case 'h': | ||
| 282 | case '?': | ||
| 283 | fprintf(stderr, "%s", items[(scroll + choice) * 3]); | ||
| 284 | delwin(dialog); | ||
| 285 | free(status); | ||
| 286 | return 1; | ||
| 287 | case TAB: | ||
| 288 | case KEY_LEFT: | ||
| 289 | case KEY_RIGHT: | ||
| 290 | button = ((key == KEY_LEFT ? --button : ++button) < 0) | ||
| 291 | ? 1 : (button > 1 ? 0 : button); | ||
| 292 | |||
| 293 | print_buttons(dialog, height, width, button); | ||
| 294 | wrefresh(dialog); | ||
| 295 | break; | ||
| 296 | case 'S': | ||
| 297 | case 's': | ||
| 298 | case ' ': | ||
| 299 | case '\n': | ||
| 300 | if (!button) { | ||
| 301 | if (!status[scroll + choice]) { | ||
| 302 | for (i = 0; i < item_no; i++) | ||
| 303 | status[i] = 0; | ||
| 304 | status[scroll + choice] = 1; | ||
| 305 | for (i = 0; i < max_choice; i++) | ||
| 306 | print_item(list, items[(scroll + i) * 3 + 1], | ||
| 307 | status[scroll + i], i, i == choice); | ||
| 308 | } | ||
| 309 | wnoutrefresh(list); | ||
| 310 | wrefresh(dialog); | ||
| 311 | |||
| 312 | for (i = 0; i < item_no; i++) | ||
| 313 | if (status[i]) | ||
| 314 | fprintf(stderr, "%s", items[i * 3]); | ||
| 315 | } else | ||
| 316 | fprintf(stderr, "%s", items[(scroll + choice) * 3]); | ||
| 317 | delwin(dialog); | ||
| 318 | free(status); | ||
| 319 | return button; | ||
| 320 | case 'X': | ||
| 321 | case 'x': | ||
| 322 | key = ESC; | ||
| 323 | case ESC: | ||
| 324 | break; | ||
| 325 | } | ||
| 326 | |||
| 327 | /* Now, update everything... */ | ||
| 328 | doupdate(); | ||
| 329 | } | ||
| 330 | |||
| 331 | delwin(dialog); | ||
| 332 | free(status); | ||
| 333 | return -1; /* ESC pressed */ | ||
| 334 | } | ||
diff --git a/scripts/lxdialog/colors.h b/scripts/kconfig/lxdialog/colors.h index 25c59528a251..db071df12bbb 100644 --- a/scripts/lxdialog/colors.h +++ b/scripts/kconfig/lxdialog/colors.h | |||
| @@ -18,7 +18,6 @@ | |||
| 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 18 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 19 | */ | 19 | */ |
| 20 | 20 | ||
| 21 | |||
| 22 | /* | 21 | /* |
| 23 | * Default color definitions | 22 | * Default color definitions |
| 24 | * | 23 | * |
diff --git a/scripts/lxdialog/dialog.h b/scripts/kconfig/lxdialog/dialog.h index eb63e1bb63a3..af3cf716e215 100644 --- a/scripts/lxdialog/dialog.h +++ b/scripts/kconfig/lxdialog/dialog.h | |||
| @@ -1,4 +1,3 @@ | |||
| 1 | |||
| 2 | /* | 1 | /* |
| 3 | * dialog.h -- common declarations for all dialog modules | 2 | * dialog.h -- common declarations for all dialog modules |
| 4 | * | 3 | * |
| @@ -42,7 +41,7 @@ | |||
| 42 | #if defined(NCURSES_VERSION) && defined(_NEED_WRAP) && !defined(GCC_PRINTFLIKE) | 41 | #if defined(NCURSES_VERSION) && defined(_NEED_WRAP) && !defined(GCC_PRINTFLIKE) |
| 43 | #define OLD_NCURSES 1 | 42 | #define OLD_NCURSES 1 |
| 44 | #undef wbkgdset | 43 | #undef wbkgdset |
| 45 | #define wbkgdset(w,p) /*nothing*/ | 44 | #define wbkgdset(w,p) /*nothing */ |
| 46 | #else | 45 | #else |
| 47 | #define OLD_NCURSES 0 | 46 | #define OLD_NCURSES 0 |
| 48 | #endif | 47 | #endif |
| @@ -56,7 +55,6 @@ | |||
| 56 | #define MIN(x,y) (x < y ? x : y) | 55 | #define MIN(x,y) (x < y ? x : y) |
| 57 | #define MAX(x,y) (x > y ? x : y) | 56 | #define MAX(x,y) (x > y ? x : y) |
| 58 | 57 | ||
| 59 | |||
| 60 | #ifndef ACS_ULCORNER | 58 | #ifndef ACS_ULCORNER |
| 61 | #define ACS_ULCORNER '+' | 59 | #define ACS_ULCORNER '+' |
| 62 | #endif | 60 | #endif |
| @@ -88,7 +86,7 @@ | |||
| 88 | #define ACS_DARROW 'v' | 86 | #define ACS_DARROW 'v' |
| 89 | #endif | 87 | #endif |
| 90 | 88 | ||
| 91 | /* | 89 | /* |
| 92 | * Attribute names | 90 | * Attribute names |
| 93 | */ | 91 | */ |
| 94 | #define screen_attr attributes[0] | 92 | #define screen_attr attributes[0] |
| @@ -137,35 +135,35 @@ extern const char *backtitle; | |||
| 137 | /* | 135 | /* |
| 138 | * Function prototypes | 136 | * Function prototypes |
| 139 | */ | 137 | */ |
| 140 | extern void create_rc (const char *filename); | 138 | extern void create_rc(const char *filename); |
| 141 | extern int parse_rc (void); | 139 | extern int parse_rc(void); |
| 142 | 140 | ||
| 143 | 141 | void init_dialog(void); | |
| 144 | void init_dialog (void); | 142 | void end_dialog(void); |
| 145 | void end_dialog (void); | 143 | void attr_clear(WINDOW * win, int height, int width, chtype attr); |
| 146 | void attr_clear (WINDOW * win, int height, int width, chtype attr); | 144 | void dialog_clear(void); |
| 147 | void dialog_clear (void); | 145 | void color_setup(void); |
| 148 | void color_setup (void); | 146 | void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x); |
| 149 | void print_autowrap (WINDOW * win, const char *prompt, int width, int y, int x); | 147 | void print_button(WINDOW * win, const char *label, int y, int x, int selected); |
| 150 | void print_button (WINDOW * win, const char *label, int y, int x, int selected); | 148 | void print_title(WINDOW *dialog, const char *title, int width); |
| 151 | void draw_box (WINDOW * win, int y, int x, int height, int width, chtype box, | 149 | void draw_box(WINDOW * win, int y, int x, int height, int width, chtype box, |
| 152 | chtype border); | 150 | chtype border); |
| 153 | void draw_shadow (WINDOW * win, int y, int x, int height, int width); | 151 | void draw_shadow(WINDOW * win, int y, int x, int height, int width); |
| 154 | 152 | ||
| 155 | int first_alpha (const char *string, const char *exempt); | 153 | int first_alpha(const char *string, const char *exempt); |
| 156 | int dialog_yesno (const char *title, const char *prompt, int height, int width); | 154 | int dialog_yesno(const char *title, const char *prompt, int height, int width); |
| 157 | int dialog_msgbox (const char *title, const char *prompt, int height, | 155 | int dialog_msgbox(const char *title, const char *prompt, int height, |
| 158 | int width, int pause); | 156 | int width, int pause); |
| 159 | int dialog_textbox (const char *title, const char *file, int height, int width); | 157 | int dialog_textbox(const char *title, const char *file, int height, int width); |
| 160 | int dialog_menu (const char *title, const char *prompt, int height, int width, | 158 | int dialog_menu(const char *title, const char *prompt, int height, int width, |
| 161 | int menu_height, const char *choice, int item_no, | 159 | int menu_height, const char *choice, int item_no, |
| 162 | const char * const * items); | 160 | const char *const *items); |
| 163 | int dialog_checklist (const char *title, const char *prompt, int height, | 161 | int dialog_checklist(const char *title, const char *prompt, int height, |
| 164 | int width, int list_height, int item_no, | 162 | int width, int list_height, int item_no, |
| 165 | const char * const * items, int flag); | 163 | const char *const *items); |
| 166 | extern char dialog_input_result[]; | 164 | extern char dialog_input_result[]; |
| 167 | int dialog_inputbox (const char *title, const char *prompt, int height, | 165 | int dialog_inputbox(const char *title, const char *prompt, int height, |
| 168 | int width, const char *init); | 166 | int width, const char *init); |
| 169 | 167 | ||
| 170 | /* | 168 | /* |
| 171 | * This is the base for fictitious keys, which activate | 169 | * This is the base for fictitious keys, which activate |
| @@ -177,11 +175,3 @@ int dialog_inputbox (const char *title, const char *prompt, int height, | |||
| 177 | * -- uppercase chars are used to invoke the button (M_EVENT + 'O') | 175 | * -- uppercase chars are used to invoke the button (M_EVENT + 'O') |
| 178 | */ | 176 | */ |
| 179 | #define M_EVENT (KEY_MAX+1) | 177 | #define M_EVENT (KEY_MAX+1) |
| 180 | |||
| 181 | |||
| 182 | /* | ||
| 183 | * The `flag' parameter in checklist is used to select between | ||
| 184 | * radiolist and checklist | ||
| 185 | */ | ||
| 186 | #define FLAG_CHECK 1 | ||
| 187 | #define FLAG_RADIO 0 | ||
diff --git a/scripts/kconfig/lxdialog/inputbox.c b/scripts/kconfig/lxdialog/inputbox.c new file mode 100644 index 000000000000..779503726b0a --- /dev/null +++ b/scripts/kconfig/lxdialog/inputbox.c | |||
| @@ -0,0 +1,224 @@ | |||
| 1 | /* | ||
| 2 | * inputbox.c -- implements the input box | ||
| 3 | * | ||
| 4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
| 5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License | ||
| 9 | * as published by the Free Software Foundation; either version 2 | ||
| 10 | * of the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "dialog.h" | ||
| 23 | |||
| 24 | char dialog_input_result[MAX_LEN + 1]; | ||
| 25 | |||
| 26 | /* | ||
| 27 | * Print the termination buttons | ||
| 28 | */ | ||
| 29 | static void print_buttons(WINDOW * dialog, int height, int width, int selected) | ||
| 30 | { | ||
| 31 | int x = width / 2 - 11; | ||
| 32 | int y = height - 2; | ||
| 33 | |||
| 34 | print_button(dialog, " Ok ", y, x, selected == 0); | ||
| 35 | print_button(dialog, " Help ", y, x + 14, selected == 1); | ||
| 36 | |||
| 37 | wmove(dialog, y, x + 1 + 14 * selected); | ||
| 38 | wrefresh(dialog); | ||
| 39 | } | ||
| 40 | |||
| 41 | /* | ||
| 42 | * Display a dialog box for inputing a string | ||
| 43 | */ | ||
| 44 | int dialog_inputbox(const char *title, const char *prompt, int height, int width, | ||
| 45 | const char *init) | ||
| 46 | { | ||
| 47 | int i, x, y, box_y, box_x, box_width; | ||
| 48 | int input_x = 0, scroll = 0, key = 0, button = -1; | ||
| 49 | char *instr = dialog_input_result; | ||
| 50 | WINDOW *dialog; | ||
| 51 | |||
| 52 | /* center dialog box on screen */ | ||
| 53 | x = (COLS - width) / 2; | ||
| 54 | y = (LINES - height) / 2; | ||
| 55 | |||
| 56 | draw_shadow(stdscr, y, x, height, width); | ||
| 57 | |||
| 58 | dialog = newwin(height, width, y, x); | ||
| 59 | keypad(dialog, TRUE); | ||
| 60 | |||
| 61 | draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); | ||
| 62 | wattrset(dialog, border_attr); | ||
| 63 | mvwaddch(dialog, height - 3, 0, ACS_LTEE); | ||
| 64 | for (i = 0; i < width - 2; i++) | ||
| 65 | waddch(dialog, ACS_HLINE); | ||
| 66 | wattrset(dialog, dialog_attr); | ||
| 67 | waddch(dialog, ACS_RTEE); | ||
| 68 | |||
| 69 | print_title(dialog, title, width); | ||
| 70 | |||
| 71 | wattrset(dialog, dialog_attr); | ||
| 72 | print_autowrap(dialog, prompt, width - 2, 1, 3); | ||
| 73 | |||
| 74 | /* Draw the input field box */ | ||
| 75 | box_width = width - 6; | ||
| 76 | getyx(dialog, y, x); | ||
| 77 | box_y = y + 2; | ||
| 78 | box_x = (width - box_width) / 2; | ||
| 79 | draw_box(dialog, y + 1, box_x - 1, 3, box_width + 2, border_attr, dialog_attr); | ||
| 80 | |||
| 81 | print_buttons(dialog, height, width, 0); | ||
| 82 | |||
| 83 | /* Set up the initial value */ | ||
| 84 | wmove(dialog, box_y, box_x); | ||
| 85 | wattrset(dialog, inputbox_attr); | ||
| 86 | |||
| 87 | if (!init) | ||
| 88 | instr[0] = '\0'; | ||
| 89 | else | ||
| 90 | strcpy(instr, init); | ||
| 91 | |||
| 92 | input_x = strlen(instr); | ||
| 93 | |||
| 94 | if (input_x >= box_width) { | ||
| 95 | scroll = input_x - box_width + 1; | ||
| 96 | input_x = box_width - 1; | ||
| 97 | for (i = 0; i < box_width - 1; i++) | ||
| 98 | waddch(dialog, instr[scroll + i]); | ||
| 99 | } else { | ||
| 100 | waddstr(dialog, instr); | ||
| 101 | } | ||
| 102 | |||
| 103 | wmove(dialog, box_y, box_x + input_x); | ||
| 104 | |||
| 105 | wrefresh(dialog); | ||
| 106 | |||
| 107 | while (key != ESC) { | ||
| 108 | key = wgetch(dialog); | ||
| 109 | |||
| 110 | if (button == -1) { /* Input box selected */ | ||
| 111 | switch (key) { | ||
| 112 | case TAB: | ||
| 113 | case KEY_UP: | ||
| 114 | case KEY_DOWN: | ||
| 115 | break; | ||
| 116 | case KEY_LEFT: | ||
| 117 | continue; | ||
| 118 | case KEY_RIGHT: | ||
| 119 | continue; | ||
| 120 | case KEY_BACKSPACE: | ||
| 121 | case 127: | ||
| 122 | if (input_x || scroll) { | ||
| 123 | wattrset(dialog, inputbox_attr); | ||
| 124 | if (!input_x) { | ||
| 125 | scroll = scroll < box_width - 1 ? 0 : scroll - (box_width - 1); | ||
| 126 | wmove(dialog, box_y, box_x); | ||
| 127 | for (i = 0; i < box_width; i++) | ||
| 128 | waddch(dialog, | ||
| 129 | instr[scroll + input_x + i] ? | ||
| 130 | instr[scroll + input_x + i] : ' '); | ||
| 131 | input_x = strlen(instr) - scroll; | ||
| 132 | } else | ||
| 133 | input_x--; | ||
| 134 | instr[scroll + input_x] = '\0'; | ||
| 135 | mvwaddch(dialog, box_y, input_x + box_x, ' '); | ||
| 136 | wmove(dialog, box_y, input_x + box_x); | ||
| 137 | wrefresh(dialog); | ||
| 138 | } | ||
| 139 | continue; | ||
| 140 | default: | ||
| 141 | if (key < 0x100 && isprint(key)) { | ||
| 142 | if (scroll + input_x < MAX_LEN) { | ||
| 143 | wattrset(dialog, inputbox_attr); | ||
| 144 | instr[scroll + input_x] = key; | ||
| 145 | instr[scroll + input_x + 1] = '\0'; | ||
| 146 | if (input_x == box_width - 1) { | ||
| 147 | scroll++; | ||
| 148 | wmove(dialog, box_y, box_x); | ||
| 149 | for (i = 0; i < box_width - 1; i++) | ||
| 150 | waddch(dialog, instr [scroll + i]); | ||
| 151 | } else { | ||
| 152 | wmove(dialog, box_y, input_x++ + box_x); | ||
| 153 | waddch(dialog, key); | ||
| 154 | } | ||
| 155 | wrefresh(dialog); | ||
| 156 | } else | ||
| 157 | flash(); /* Alarm user about overflow */ | ||
| 158 | continue; | ||
| 159 | } | ||
| 160 | } | ||
| 161 | } | ||
| 162 | switch (key) { | ||
| 163 | case 'O': | ||
| 164 | case 'o': | ||
| 165 | delwin(dialog); | ||
| 166 | return 0; | ||
| 167 | case 'H': | ||
| 168 | case 'h': | ||
| 169 | delwin(dialog); | ||
| 170 | return 1; | ||
| 171 | case KEY_UP: | ||
| 172 | case KEY_LEFT: | ||
| 173 | switch (button) { | ||
| 174 | case -1: | ||
| 175 | button = 1; /* Indicates "Cancel" button is selected */ | ||
| 176 | print_buttons(dialog, height, width, 1); | ||
| 177 | break; | ||
| 178 | case 0: | ||
| 179 | button = -1; /* Indicates input box is selected */ | ||
| 180 | print_buttons(dialog, height, width, 0); | ||
| 181 | wmove(dialog, box_y, box_x + input_x); | ||
| 182 | wrefresh(dialog); | ||
| 183 | break; | ||
| 184 | case 1: | ||
| 185 | button = 0; /* Indicates "OK" button is selected */ | ||
| 186 | print_buttons(dialog, height, width, 0); | ||
| 187 | break; | ||
| 188 | } | ||
| 189 | break; | ||
| 190 | case TAB: | ||
| 191 | case KEY_DOWN: | ||
| 192 | case KEY_RIGHT: | ||
| 193 | switch (button) { | ||
| 194 | case -1: | ||
| 195 | button = 0; /* Indicates "OK" button is selected */ | ||
| 196 | print_buttons(dialog, height, width, 0); | ||
| 197 | break; | ||
| 198 | case 0: | ||
| 199 | button = 1; /* Indicates "Cancel" button is selected */ | ||
| 200 | print_buttons(dialog, height, width, 1); | ||
| 201 | break; | ||
| 202 | case 1: | ||
| 203 | button = -1; /* Indicates input box is selected */ | ||
| 204 | print_buttons(dialog, height, width, 0); | ||
| 205 | wmove(dialog, box_y, box_x + input_x); | ||
| 206 | wrefresh(dialog); | ||
| 207 | break; | ||
| 208 | } | ||
| 209 | break; | ||
| 210 | case ' ': | ||
| 211 | case '\n': | ||
| 212 | delwin(dialog); | ||
| 213 | return (button == -1 ? 0 : button); | ||
| 214 | case 'X': | ||
| 215 | case 'x': | ||
| 216 | key = ESC; | ||
| 217 | case ESC: | ||
| 218 | break; | ||
| 219 | } | ||
| 220 | } | ||
| 221 | |||
| 222 | delwin(dialog); | ||
| 223 | return -1; /* ESC pressed */ | ||
| 224 | } | ||
diff --git a/scripts/kconfig/lxdialog/lxdialog.c b/scripts/kconfig/lxdialog/lxdialog.c new file mode 100644 index 000000000000..79f6c5fb5cef --- /dev/null +++ b/scripts/kconfig/lxdialog/lxdialog.c | |||
| @@ -0,0 +1,204 @@ | |||
| 1 | /* | ||
| 2 | * dialog - Display simple dialog boxes from shell scripts | ||
| 3 | * | ||
| 4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
| 5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License | ||
| 9 | * as published by the Free Software Foundation; either version 2 | ||
| 10 | * of the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "dialog.h" | ||
| 23 | |||
| 24 | static void Usage(const char *name); | ||
| 25 | |||
| 26 | typedef int (jumperFn) (const char *title, int argc, const char *const *argv); | ||
| 27 | |||
| 28 | struct Mode { | ||
| 29 | char *name; | ||
| 30 | int argmin, argmax, argmod; | ||
| 31 | jumperFn *jumper; | ||
| 32 | }; | ||
| 33 | |||
| 34 | jumperFn j_menu, j_radiolist, j_yesno, j_textbox, j_inputbox; | ||
| 35 | jumperFn j_msgbox, j_infobox; | ||
| 36 | |||
| 37 | static struct Mode modes[] = { | ||
| 38 | {"--menu", 9, 0, 3, j_menu}, | ||
| 39 | {"--radiolist", 9, 0, 3, j_radiolist}, | ||
| 40 | {"--yesno", 5, 5, 1, j_yesno}, | ||
| 41 | {"--textbox", 5, 5, 1, j_textbox}, | ||
| 42 | {"--inputbox", 5, 6, 1, j_inputbox}, | ||
| 43 | {"--msgbox", 5, 5, 1, j_msgbox}, | ||
| 44 | {"--infobox", 5, 5, 1, j_infobox}, | ||
| 45 | {NULL, 0, 0, 0, NULL} | ||
| 46 | }; | ||
| 47 | |||
| 48 | static struct Mode *modePtr; | ||
| 49 | |||
| 50 | #ifdef LOCALE | ||
| 51 | #include <locale.h> | ||
| 52 | #endif | ||
| 53 | |||
| 54 | int main(int argc, const char *const *argv) | ||
| 55 | { | ||
| 56 | int offset = 0, opt_clear = 0, end_common_opts = 0, retval; | ||
| 57 | const char *title = NULL; | ||
| 58 | |||
| 59 | #ifdef LOCALE | ||
| 60 | (void)setlocale(LC_ALL, ""); | ||
| 61 | #endif | ||
| 62 | |||
| 63 | #ifdef TRACE | ||
| 64 | trace(TRACE_CALLS | TRACE_UPDATE); | ||
| 65 | #endif | ||
| 66 | if (argc < 2) { | ||
| 67 | Usage(argv[0]); | ||
| 68 | exit(-1); | ||
| 69 | } | ||
| 70 | |||
| 71 | while (offset < argc - 1 && !end_common_opts) { /* Common options */ | ||
| 72 | if (!strcmp(argv[offset + 1], "--title")) { | ||
| 73 | if (argc - offset < 3 || title != NULL) { | ||
| 74 | Usage(argv[0]); | ||
| 75 | exit(-1); | ||
| 76 | } else { | ||
| 77 | title = argv[offset + 2]; | ||
| 78 | offset += 2; | ||
| 79 | } | ||
| 80 | } else if (!strcmp(argv[offset + 1], "--backtitle")) { | ||
| 81 | if (backtitle != NULL) { | ||
| 82 | Usage(argv[0]); | ||
| 83 | exit(-1); | ||
| 84 | } else { | ||
| 85 | backtitle = argv[offset + 2]; | ||
| 86 | offset += 2; | ||
| 87 | } | ||
| 88 | } else if (!strcmp(argv[offset + 1], "--clear")) { | ||
| 89 | if (opt_clear) { /* Hey, "--clear" can't appear twice! */ | ||
| 90 | Usage(argv[0]); | ||
| 91 | exit(-1); | ||
| 92 | } else if (argc == 2) { /* we only want to clear the screen */ | ||
| 93 | init_dialog(); | ||
| 94 | refresh(); /* init_dialog() will clear the screen for us */ | ||
| 95 | end_dialog(); | ||
| 96 | return 0; | ||
| 97 | } else { | ||
| 98 | opt_clear = 1; | ||
| 99 | offset++; | ||
| 100 | } | ||
| 101 | } else /* no more common options */ | ||
| 102 | end_common_opts = 1; | ||
| 103 | } | ||
| 104 | |||
| 105 | if (argc - 1 == offset) { /* no more options */ | ||
| 106 | Usage(argv[0]); | ||
| 107 | exit(-1); | ||
| 108 | } | ||
| 109 | /* use a table to look for the requested mode, to avoid code duplication */ | ||
| 110 | |||
| 111 | for (modePtr = modes; modePtr->name; modePtr++) /* look for the mode */ | ||
| 112 | if (!strcmp(argv[offset + 1], modePtr->name)) | ||
| 113 | break; | ||
| 114 | |||
| 115 | if (!modePtr->name) | ||
| 116 | Usage(argv[0]); | ||
| 117 | if (argc - offset < modePtr->argmin) | ||
| 118 | Usage(argv[0]); | ||
| 119 | if (modePtr->argmax && argc - offset > modePtr->argmax) | ||
| 120 | Usage(argv[0]); | ||
| 121 | |||
| 122 | init_dialog(); | ||
| 123 | retval = (*(modePtr->jumper)) (title, argc - offset, argv + offset); | ||
| 124 | |||
| 125 | if (opt_clear) { /* clear screen before exit */ | ||
| 126 | attr_clear(stdscr, LINES, COLS, screen_attr); | ||
| 127 | refresh(); | ||
| 128 | } | ||
| 129 | end_dialog(); | ||
| 130 | |||
| 131 | exit(retval); | ||
| 132 | } | ||
| 133 | |||
| 134 | /* | ||
| 135 | * Print program usage | ||
| 136 | */ | ||
| 137 | static void Usage(const char *name) | ||
| 138 | { | ||
| 139 | fprintf(stderr, "\ | ||
| 140 | \ndialog, by Savio Lam (lam836@cs.cuhk.hk).\ | ||
| 141 | \n patched by Stuart Herbert (S.Herbert@shef.ac.uk)\ | ||
| 142 | \n modified/gutted for use as a Linux kernel config tool by \ | ||
| 143 | \n William Roadcap (roadcapw@cfw.com)\ | ||
| 144 | \n\ | ||
| 145 | \n* Display dialog boxes from shell scripts *\ | ||
| 146 | \n\ | ||
| 147 | \nUsage: %s --clear\ | ||
| 148 | \n %s [--title <title>] [--backtitle <backtitle>] --clear <Box options>\ | ||
| 149 | \n\ | ||
| 150 | \nBox options:\ | ||
| 151 | \n\ | ||
| 152 | \n --menu <text> <height> <width> <menu height> <tag1> <item1>...\ | ||
| 153 | \n --radiolist <text> <height> <width> <list height> <tag1> <item1> <status1>...\ | ||
| 154 | \n --textbox <file> <height> <width>\ | ||
| 155 | \n --inputbox <text> <height> <width> [<init>]\ | ||
| 156 | \n --yesno <text> <height> <width>\ | ||
| 157 | \n", name, name); | ||
| 158 | exit(-1); | ||
| 159 | } | ||
| 160 | |||
| 161 | /* | ||
| 162 | * These are the program jumpers | ||
| 163 | */ | ||
| 164 | |||
| 165 | int j_menu(const char *t, int ac, const char *const *av) | ||
| 166 | { | ||
| 167 | return dialog_menu(t, av[2], atoi(av[3]), atoi(av[4]), | ||
| 168 | atoi(av[5]), av[6], (ac - 6) / 2, av + 7); | ||
| 169 | } | ||
| 170 | |||
| 171 | int j_radiolist(const char *t, int ac, const char *const *av) | ||
| 172 | { | ||
| 173 | return dialog_checklist(t, av[2], atoi(av[3]), atoi(av[4]), | ||
| 174 | atoi(av[5]), (ac - 6) / 3, av + 6); | ||
| 175 | } | ||
| 176 | |||
| 177 | int j_textbox(const char *t, int ac, const char *const *av) | ||
| 178 | { | ||
| 179 | return dialog_textbox(t, av[2], atoi(av[3]), atoi(av[4])); | ||
| 180 | } | ||
| 181 | |||
| 182 | int j_yesno(const char *t, int ac, const char *const *av) | ||
| 183 | { | ||
| 184 | return dialog_yesno(t, av[2], atoi(av[3]), atoi(av[4])); | ||
| 185 | } | ||
| 186 | |||
| 187 | int j_inputbox(const char *t, int ac, const char *const *av) | ||
| 188 | { | ||
| 189 | int ret = dialog_inputbox(t, av[2], atoi(av[3]), atoi(av[4]), | ||
| 190 | ac == 6 ? av[5] : (char *)NULL); | ||
| 191 | if (ret == 0) | ||
| 192 | fprintf(stderr, dialog_input_result); | ||
| 193 | return ret; | ||
| 194 | } | ||
| 195 | |||
| 196 | int j_msgbox(const char *t, int ac, const char *const *av) | ||
| 197 | { | ||
| 198 | return dialog_msgbox(t, av[2], atoi(av[3]), atoi(av[4]), 1); | ||
| 199 | } | ||
| 200 | |||
| 201 | int j_infobox(const char *t, int ac, const char *const *av) | ||
| 202 | { | ||
| 203 | return dialog_msgbox(t, av[2], atoi(av[3]), atoi(av[4]), 0); | ||
| 204 | } | ||
diff --git a/scripts/kconfig/lxdialog/menubox.c b/scripts/kconfig/lxdialog/menubox.c new file mode 100644 index 000000000000..09512b544375 --- /dev/null +++ b/scripts/kconfig/lxdialog/menubox.c | |||
| @@ -0,0 +1,425 @@ | |||
| 1 | /* | ||
| 2 | * menubox.c -- implements the menu box | ||
| 3 | * | ||
| 4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
| 5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcapw@cfw.com) | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License | ||
| 9 | * as published by the Free Software Foundation; either version 2 | ||
| 10 | * of the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 20 | */ | ||
| 21 | |||
| 22 | /* | ||
| 23 | * Changes by Clifford Wolf (god@clifford.at) | ||
| 24 | * | ||
| 25 | * [ 1998-06-13 ] | ||
| 26 | * | ||
| 27 | * *) A bugfix for the Page-Down problem | ||
| 28 | * | ||
| 29 | * *) Formerly when I used Page Down and Page Up, the cursor would be set | ||
| 30 | * to the first position in the menu box. Now lxdialog is a bit | ||
| 31 | * smarter and works more like other menu systems (just have a look at | ||
| 32 | * it). | ||
| 33 | * | ||
| 34 | * *) Formerly if I selected something my scrolling would be broken because | ||
| 35 | * lxdialog is re-invoked by the Menuconfig shell script, can't | ||
| 36 | * remember the last scrolling position, and just sets it so that the | ||
| 37 | * cursor is at the bottom of the box. Now it writes the temporary file | ||
| 38 | * lxdialog.scrltmp which contains this information. The file is | ||
| 39 | * deleted by lxdialog if the user leaves a submenu or enters a new | ||
| 40 | * one, but it would be nice if Menuconfig could make another "rm -f" | ||
| 41 | * just to be sure. Just try it out - you will recognise a difference! | ||
| 42 | * | ||
| 43 | * [ 1998-06-14 ] | ||
| 44 | * | ||
| 45 | * *) Now lxdialog is crash-safe against broken "lxdialog.scrltmp" files | ||
| 46 | * and menus change their size on the fly. | ||
| 47 | * | ||
| 48 | * *) If for some reason the last scrolling position is not saved by | ||
| 49 | * lxdialog, it sets the scrolling so that the selected item is in the | ||
| 50 | * middle of the menu box, not at the bottom. | ||
| 51 | * | ||
| 52 | * 02 January 1999, Michael Elizabeth Chastain (mec@shout.net) | ||
| 53 | * Reset 'scroll' to 0 if the value from lxdialog.scrltmp is bogus. | ||
| 54 | * This fixes a bug in Menuconfig where using ' ' to descend into menus | ||
| 55 | * would leave mis-synchronized lxdialog.scrltmp files lying around, | ||
| 56 | * fscanf would read in 'scroll', and eventually that value would get used. | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include "dialog.h" | ||
| 60 | |||
| 61 | #define ITEM_IDENT 1 /* Indent of menu entries. Fixed for all menus */ | ||
| 62 | static int menu_width; | ||
| 63 | |||
| 64 | /* | ||
| 65 | * Print menu item | ||
| 66 | */ | ||
| 67 | static void do_print_item(WINDOW * win, const char *item, int choice, | ||
| 68 | int selected, int hotkey) | ||
| 69 | { | ||
| 70 | int j; | ||
| 71 | char *menu_item = malloc(menu_width + 1); | ||
| 72 | |||
| 73 | strncpy(menu_item, item, menu_width - ITEM_IDENT); | ||
| 74 | menu_item[menu_width] = 0; | ||
| 75 | j = first_alpha(menu_item, "YyNnMmHh"); | ||
| 76 | |||
| 77 | /* Clear 'residue' of last item */ | ||
| 78 | wattrset(win, menubox_attr); | ||
| 79 | wmove(win, choice, 0); | ||
| 80 | #if OLD_NCURSES | ||
| 81 | { | ||
| 82 | int i; | ||
| 83 | for (i = 0; i < menu_width; i++) | ||
| 84 | waddch(win, ' '); | ||
| 85 | } | ||
| 86 | #else | ||
| 87 | wclrtoeol(win); | ||
| 88 | #endif | ||
| 89 | wattrset(win, selected ? item_selected_attr : item_attr); | ||
| 90 | mvwaddstr(win, choice, ITEM_IDENT, menu_item); | ||
| 91 | if (hotkey) { | ||
| 92 | wattrset(win, selected ? tag_key_selected_attr : tag_key_attr); | ||
| 93 | mvwaddch(win, choice, ITEM_IDENT + j, menu_item[j]); | ||
| 94 | } | ||
| 95 | if (selected) { | ||
| 96 | wmove(win, choice, ITEM_IDENT + 1); | ||
| 97 | } | ||
| 98 | free(menu_item); | ||
| 99 | wrefresh(win); | ||
| 100 | } | ||
| 101 | |||
| 102 | #define print_item(index, choice, selected) \ | ||
| 103 | do {\ | ||
| 104 | int hotkey = (items[(index) * 2][0] != ':'); \ | ||
| 105 | do_print_item(menu, items[(index) * 2 + 1], choice, selected, hotkey); \ | ||
| 106 | } while (0) | ||
| 107 | |||
| 108 | /* | ||
| 109 | * Print the scroll indicators. | ||
| 110 | */ | ||
| 111 | static void print_arrows(WINDOW * win, int item_no, int scroll, int y, int x, | ||
| 112 | int height) | ||
| 113 | { | ||
| 114 | int cur_y, cur_x; | ||
| 115 | |||
| 116 | getyx(win, cur_y, cur_x); | ||
| 117 | |||
| 118 | wmove(win, y, x); | ||
| 119 | |||
| 120 | if (scroll > 0) { | ||
| 121 | wattrset(win, uarrow_attr); | ||
| 122 | waddch(win, ACS_UARROW); | ||
| 123 | waddstr(win, "(-)"); | ||
| 124 | } else { | ||
| 125 | wattrset(win, menubox_attr); | ||
| 126 | waddch(win, ACS_HLINE); | ||
| 127 | waddch(win, ACS_HLINE); | ||
| 128 | waddch(win, ACS_HLINE); | ||
| 129 | waddch(win, ACS_HLINE); | ||
| 130 | } | ||
| 131 | |||
| 132 | y = y + height + 1; | ||
| 133 | wmove(win, y, x); | ||
| 134 | wrefresh(win); | ||
| 135 | |||
| 136 | if ((height < item_no) && (scroll + height < item_no)) { | ||
| 137 | wattrset(win, darrow_attr); | ||
| 138 | waddch(win, ACS_DARROW); | ||
| 139 | waddstr(win, "(+)"); | ||
| 140 | } else { | ||
| 141 | wattrset(win, menubox_border_attr); | ||
| 142 | waddch(win, ACS_HLINE); | ||
| 143 | waddch(win, ACS_HLINE); | ||
| 144 | waddch(win, ACS_HLINE); | ||
| 145 | waddch(win, ACS_HLINE); | ||
| 146 | } | ||
| 147 | |||
| 148 | wmove(win, cur_y, cur_x); | ||
| 149 | wrefresh(win); | ||
| 150 | } | ||
| 151 | |||
| 152 | /* | ||
| 153 | * Display the termination buttons. | ||
| 154 | */ | ||
| 155 | static void print_buttons(WINDOW * win, int height, int width, int selected) | ||
| 156 | { | ||
| 157 | int x = width / 2 - 16; | ||
| 158 | int y = height - 2; | ||
| 159 | |||
| 160 | print_button(win, "Select", y, x, selected == 0); | ||
| 161 | print_button(win, " Exit ", y, x + 12, selected == 1); | ||
| 162 | print_button(win, " Help ", y, x + 24, selected == 2); | ||
| 163 | |||
| 164 | wmove(win, y, x + 1 + 12 * selected); | ||
| 165 | wrefresh(win); | ||
| 166 | } | ||
| 167 | |||
| 168 | /* scroll up n lines (n may be negative) */ | ||
| 169 | static void do_scroll(WINDOW *win, int *scroll, int n) | ||
| 170 | { | ||
| 171 | /* Scroll menu up */ | ||
| 172 | scrollok(win, TRUE); | ||
| 173 | wscrl(win, n); | ||
| 174 | scrollok(win, FALSE); | ||
| 175 | *scroll = *scroll + n; | ||
| 176 | wrefresh(win); | ||
| 177 | } | ||
| 178 | |||
| 179 | /* | ||
| 180 | * Display a menu for choosing among a number of options | ||
| 181 | */ | ||
| 182 | int dialog_menu(const char *title, const char *prompt, int height, int width, | ||
| 183 | int menu_height, const char *current, int item_no, | ||
| 184 | const char *const *items) | ||
| 185 | { | ||
| 186 | int i, j, x, y, box_x, box_y; | ||
| 187 | int key = 0, button = 0, scroll = 0, choice = 0; | ||
| 188 | int first_item = 0, max_choice; | ||
| 189 | WINDOW *dialog, *menu; | ||
| 190 | FILE *f; | ||
| 191 | |||
| 192 | max_choice = MIN(menu_height, item_no); | ||
| 193 | |||
| 194 | /* center dialog box on screen */ | ||
| 195 | x = (COLS - width) / 2; | ||
| 196 | y = (LINES - height) / 2; | ||
| 197 | |||
| 198 | draw_shadow(stdscr, y, x, height, width); | ||
| 199 | |||
| 200 | dialog = newwin(height, width, y, x); | ||
| 201 | keypad(dialog, TRUE); | ||
| 202 | |||
| 203 | draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); | ||
| 204 | wattrset(dialog, border_attr); | ||
| 205 | mvwaddch(dialog, height - 3, 0, ACS_LTEE); | ||
| 206 | for (i = 0; i < width - 2; i++) | ||
| 207 | waddch(dialog, ACS_HLINE); | ||
| 208 | wattrset(dialog, dialog_attr); | ||
| 209 | wbkgdset(dialog, dialog_attr & A_COLOR); | ||
| 210 | waddch(dialog, ACS_RTEE); | ||
| 211 | |||
| 212 | print_title(dialog, title, width); | ||
| 213 | |||
| 214 | wattrset(dialog, dialog_attr); | ||
| 215 | print_autowrap(dialog, prompt, width - 2, 1, 3); | ||
| 216 | |||
| 217 | menu_width = width - 6; | ||
| 218 | box_y = height - menu_height - 5; | ||
| 219 | box_x = (width - menu_width) / 2 - 1; | ||
| 220 | |||
| 221 | /* create new window for the menu */ | ||
| 222 | menu = subwin(dialog, menu_height, menu_width, | ||
| 223 | y + box_y + 1, x + box_x + 1); | ||
| 224 | keypad(menu, TRUE); | ||
| 225 | |||
| 226 | /* draw a box around the menu items */ | ||
| 227 | draw_box(dialog, box_y, box_x, menu_height + 2, menu_width + 2, | ||
| 228 | menubox_border_attr, menubox_attr); | ||
| 229 | |||
| 230 | /* Set choice to default item */ | ||
| 231 | for (i = 0; i < item_no; i++) | ||
| 232 | if (strcmp(current, items[i * 2]) == 0) | ||
| 233 | choice = i; | ||
| 234 | |||
| 235 | /* get the scroll info from the temp file */ | ||
| 236 | if ((f = fopen("lxdialog.scrltmp", "r")) != NULL) { | ||
| 237 | if ((fscanf(f, "%d\n", &scroll) == 1) && (scroll <= choice) && | ||
| 238 | (scroll + max_choice > choice) && (scroll >= 0) && | ||
| 239 | (scroll + max_choice <= item_no)) { | ||
| 240 | first_item = scroll; | ||
| 241 | choice = choice - scroll; | ||
| 242 | fclose(f); | ||
| 243 | } else { | ||
| 244 | scroll = 0; | ||
| 245 | remove("lxdialog.scrltmp"); | ||
| 246 | fclose(f); | ||
| 247 | f = NULL; | ||
| 248 | } | ||
| 249 | } | ||
| 250 | if ((choice >= max_choice) || (f == NULL && choice >= max_choice / 2)) { | ||
| 251 | if (choice >= item_no - max_choice / 2) | ||
| 252 | scroll = first_item = item_no - max_choice; | ||
| 253 | else | ||
| 254 | scroll = first_item = choice - max_choice / 2; | ||
| 255 | choice = choice - scroll; | ||
| 256 | } | ||
| 257 | |||
| 258 | /* Print the menu */ | ||
| 259 | for (i = 0; i < max_choice; i++) { | ||
| 260 | print_item(first_item + i, i, i == choice); | ||
| 261 | } | ||
| 262 | |||
| 263 | wnoutrefresh(menu); | ||
| 264 | |||
| 265 | print_arrows(dialog, item_no, scroll, | ||
| 266 | box_y, box_x + ITEM_IDENT + 1, menu_height); | ||
| 267 | |||
| 268 | print_buttons(dialog, height, width, 0); | ||
| 269 | wmove(menu, choice, ITEM_IDENT + 1); | ||
| 270 | wrefresh(menu); | ||
| 271 | |||
| 272 | while (key != ESC) { | ||
| 273 | key = wgetch(menu); | ||
| 274 | |||
| 275 | if (key < 256 && isalpha(key)) | ||
| 276 | key = tolower(key); | ||
| 277 | |||
| 278 | if (strchr("ynmh", key)) | ||
| 279 | i = max_choice; | ||
| 280 | else { | ||
| 281 | for (i = choice + 1; i < max_choice; i++) { | ||
| 282 | j = first_alpha(items[(scroll + i) * 2 + 1], "YyNnMmHh"); | ||
| 283 | if (key == tolower(items[(scroll + i) * 2 + 1][j])) | ||
| 284 | break; | ||
| 285 | } | ||
| 286 | if (i == max_choice) | ||
| 287 | for (i = 0; i < max_choice; i++) { | ||
| 288 | j = first_alpha(items [(scroll + i) * 2 + 1], "YyNnMmHh"); | ||
| 289 | if (key == tolower(items[(scroll + i) * 2 + 1][j])) | ||
| 290 | break; | ||
| 291 | } | ||
| 292 | } | ||
| 293 | |||
| 294 | if (i < max_choice || | ||
| 295 | key == KEY_UP || key == KEY_DOWN || | ||
| 296 | key == '-' || key == '+' || | ||
| 297 | key == KEY_PPAGE || key == KEY_NPAGE) { | ||
| 298 | /* Remove highligt of current item */ | ||
| 299 | print_item(scroll + choice, choice, FALSE); | ||
| 300 | |||
| 301 | if (key == KEY_UP || key == '-') { | ||
| 302 | if (choice < 2 && scroll) { | ||
| 303 | /* Scroll menu down */ | ||
| 304 | do_scroll(menu, &scroll, -1); | ||
| 305 | |||
| 306 | print_item(scroll, 0, FALSE); | ||
| 307 | } else | ||
| 308 | choice = MAX(choice - 1, 0); | ||
| 309 | |||
| 310 | } else if (key == KEY_DOWN || key == '+') { | ||
| 311 | print_item(scroll+choice, choice, FALSE); | ||
| 312 | |||
| 313 | if ((choice > max_choice - 3) && | ||
| 314 | (scroll + max_choice < item_no)) { | ||
| 315 | /* Scroll menu up */ | ||
| 316 | do_scroll(menu, &scroll, 1); | ||
| 317 | |||
| 318 | print_item(scroll+max_choice - 1, | ||
| 319 | max_choice - 1, FALSE); | ||
| 320 | } else | ||
| 321 | choice = MIN(choice + 1, max_choice - 1); | ||
| 322 | |||
| 323 | } else if (key == KEY_PPAGE) { | ||
| 324 | scrollok(menu, TRUE); | ||
| 325 | for (i = 0; (i < max_choice); i++) { | ||
| 326 | if (scroll > 0) { | ||
| 327 | do_scroll(menu, &scroll, -1); | ||
| 328 | print_item(scroll, 0, FALSE); | ||
| 329 | } else { | ||
| 330 | if (choice > 0) | ||
| 331 | choice--; | ||
| 332 | } | ||
| 333 | } | ||
| 334 | |||
| 335 | } else if (key == KEY_NPAGE) { | ||
| 336 | for (i = 0; (i < max_choice); i++) { | ||
| 337 | if (scroll + max_choice < item_no) { | ||
| 338 | do_scroll(menu, &scroll, 1); | ||
| 339 | print_item(scroll+max_choice-1, | ||
| 340 | max_choice - 1, FALSE); | ||
| 341 | } else { | ||
| 342 | if (choice + 1 < max_choice) | ||
| 343 | choice++; | ||
| 344 | } | ||
| 345 | } | ||
| 346 | } else | ||
| 347 | choice = i; | ||
| 348 | |||
| 349 | print_item(scroll + choice, choice, TRUE); | ||
| 350 | |||
| 351 | print_arrows(dialog, item_no, scroll, | ||
| 352 | box_y, box_x + ITEM_IDENT + 1, menu_height); | ||
| 353 | |||
| 354 | wnoutrefresh(dialog); | ||
| 355 | wrefresh(menu); | ||
| 356 | |||
| 357 | continue; /* wait for another key press */ | ||
| 358 | } | ||
| 359 | |||
| 360 | switch (key) { | ||
| 361 | case KEY_LEFT: | ||
| 362 | case TAB: | ||
| 363 | case KEY_RIGHT: | ||
| 364 | button = ((key == KEY_LEFT ? --button : ++button) < 0) | ||
| 365 | ? 2 : (button > 2 ? 0 : button); | ||
| 366 | |||
| 367 | print_buttons(dialog, height, width, button); | ||
| 368 | wrefresh(menu); | ||
| 369 | break; | ||
| 370 | case ' ': | ||
| 371 | case 's': | ||
| 372 | case 'y': | ||
| 373 | case 'n': | ||
| 374 | case 'm': | ||
| 375 | case '/': | ||
| 376 | /* save scroll info */ | ||
| 377 | if ((f = fopen("lxdialog.scrltmp", "w")) != NULL) { | ||
| 378 | fprintf(f, "%d\n", scroll); | ||
| 379 | fclose(f); | ||
| 380 | } | ||
| 381 | delwin(dialog); | ||
| 382 | fprintf(stderr, "%s\n", items[(scroll + choice) * 2]); | ||
| 383 | switch (key) { | ||
| 384 | case 's': | ||
| 385 | return 3; | ||
| 386 | case 'y': | ||
| 387 | return 3; | ||
| 388 | case 'n': | ||
| 389 | return 4; | ||
| 390 | case 'm': | ||
| 391 | return 5; | ||
| 392 | case ' ': | ||
| 393 | return 6; | ||
| 394 | case '/': | ||
| 395 | return 7; | ||
| 396 | } | ||
| 397 | return 0; | ||
| 398 | case 'h': | ||
| 399 | case '?': | ||
| 400 | button = 2; | ||
| 401 | case '\n': | ||
| 402 | delwin(dialog); | ||
| 403 | if (button == 2) | ||
| 404 | fprintf(stderr, "%s \"%s\"\n", | ||
| 405 | items[(scroll + choice) * 2], | ||
| 406 | items[(scroll + choice) * 2 + 1] + | ||
| 407 | first_alpha(items [(scroll + choice) * 2 + 1], "")); | ||
| 408 | else | ||
| 409 | fprintf(stderr, "%s\n", | ||
| 410 | items[(scroll + choice) * 2]); | ||
| 411 | |||
| 412 | remove("lxdialog.scrltmp"); | ||
| 413 | return button; | ||
| 414 | case 'e': | ||
| 415 | case 'x': | ||
| 416 | key = ESC; | ||
| 417 | case ESC: | ||
| 418 | break; | ||
| 419 | } | ||
| 420 | } | ||
| 421 | |||
| 422 | delwin(dialog); | ||
| 423 | remove("lxdialog.scrltmp"); | ||
| 424 | return -1; /* ESC pressed */ | ||
| 425 | } | ||
diff --git a/scripts/kconfig/lxdialog/msgbox.c b/scripts/kconfig/lxdialog/msgbox.c new file mode 100644 index 000000000000..7323f5471f69 --- /dev/null +++ b/scripts/kconfig/lxdialog/msgbox.c | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | /* | ||
| 2 | * msgbox.c -- implements the message box and info box | ||
| 3 | * | ||
| 4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
| 5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcapw@cfw.com) | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License | ||
| 9 | * as published by the Free Software Foundation; either version 2 | ||
| 10 | * of the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "dialog.h" | ||
| 23 | |||
| 24 | /* | ||
| 25 | * Display a message box. Program will pause and display an "OK" button | ||
| 26 | * if the parameter 'pause' is non-zero. | ||
| 27 | */ | ||
| 28 | int dialog_msgbox(const char *title, const char *prompt, int height, int width, | ||
| 29 | int pause) | ||
| 30 | { | ||
| 31 | int i, x, y, key = 0; | ||
| 32 | WINDOW *dialog; | ||
| 33 | |||
| 34 | /* center dialog box on screen */ | ||
| 35 | x = (COLS - width) / 2; | ||
| 36 | y = (LINES - height) / 2; | ||
| 37 | |||
| 38 | draw_shadow(stdscr, y, x, height, width); | ||
| 39 | |||
| 40 | dialog = newwin(height, width, y, x); | ||
| 41 | keypad(dialog, TRUE); | ||
| 42 | |||
| 43 | draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); | ||
| 44 | |||
| 45 | print_title(dialog, title, width); | ||
| 46 | |||
| 47 | wattrset(dialog, dialog_attr); | ||
| 48 | print_autowrap(dialog, prompt, width - 2, 1, 2); | ||
| 49 | |||
| 50 | if (pause) { | ||
| 51 | wattrset(dialog, border_attr); | ||
| 52 | mvwaddch(dialog, height - 3, 0, ACS_LTEE); | ||
| 53 | for (i = 0; i < width - 2; i++) | ||
| 54 | waddch(dialog, ACS_HLINE); | ||
| 55 | wattrset(dialog, dialog_attr); | ||
| 56 | waddch(dialog, ACS_RTEE); | ||
| 57 | |||
| 58 | print_button(dialog, " Ok ", height - 2, width / 2 - 4, TRUE); | ||
| 59 | |||
| 60 | wrefresh(dialog); | ||
| 61 | while (key != ESC && key != '\n' && key != ' ' && | ||
| 62 | key != 'O' && key != 'o' && key != 'X' && key != 'x') | ||
| 63 | key = wgetch(dialog); | ||
| 64 | } else { | ||
| 65 | key = '\n'; | ||
| 66 | wrefresh(dialog); | ||
| 67 | } | ||
| 68 | |||
| 69 | delwin(dialog); | ||
| 70 | return key == ESC ? -1 : 0; | ||
| 71 | } | ||
diff --git a/scripts/kconfig/lxdialog/textbox.c b/scripts/kconfig/lxdialog/textbox.c new file mode 100644 index 000000000000..77848bb8e07f --- /dev/null +++ b/scripts/kconfig/lxdialog/textbox.c | |||
| @@ -0,0 +1,533 @@ | |||
| 1 | /* | ||
| 2 | * textbox.c -- implements the text box | ||
| 3 | * | ||
| 4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
| 5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License | ||
| 9 | * as published by the Free Software Foundation; either version 2 | ||
| 10 | * of the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "dialog.h" | ||
| 23 | |||
| 24 | static void back_lines(int n); | ||
| 25 | static void print_page(WINDOW * win, int height, int width); | ||
| 26 | static void print_line(WINDOW * win, int row, int width); | ||
| 27 | static char *get_line(void); | ||
| 28 | static void print_position(WINDOW * win, int height, int width); | ||
| 29 | |||
| 30 | static int hscroll, fd, file_size, bytes_read; | ||
| 31 | static int begin_reached = 1, end_reached, page_length; | ||
| 32 | static char *buf, *page; | ||
| 33 | |||
| 34 | /* | ||
| 35 | * Display text from a file in a dialog box. | ||
| 36 | */ | ||
| 37 | int dialog_textbox(const char *title, const char *file, int height, int width) | ||
| 38 | { | ||
| 39 | int i, x, y, cur_x, cur_y, fpos, key = 0; | ||
| 40 | int passed_end; | ||
| 41 | char search_term[MAX_LEN + 1]; | ||
| 42 | WINDOW *dialog, *text; | ||
| 43 | |||
| 44 | search_term[0] = '\0'; /* no search term entered yet */ | ||
| 45 | |||
| 46 | /* Open input file for reading */ | ||
| 47 | if ((fd = open(file, O_RDONLY)) == -1) { | ||
| 48 | endwin(); | ||
| 49 | fprintf(stderr, "\nCan't open input file in dialog_textbox().\n"); | ||
| 50 | exit(-1); | ||
| 51 | } | ||
| 52 | /* Get file size. Actually, 'file_size' is the real file size - 1, | ||
| 53 | since it's only the last byte offset from the beginning */ | ||
| 54 | if ((file_size = lseek(fd, 0, SEEK_END)) == -1) { | ||
| 55 | endwin(); | ||
| 56 | fprintf(stderr, "\nError getting file size in dialog_textbox().\n"); | ||
| 57 | exit(-1); | ||
| 58 | } | ||
| 59 | /* Restore file pointer to beginning of file after getting file size */ | ||
| 60 | if (lseek(fd, 0, SEEK_SET) == -1) { | ||
| 61 | endwin(); | ||
| 62 | fprintf(stderr, "\nError moving file pointer in dialog_textbox().\n"); | ||
| 63 | exit(-1); | ||
| 64 | } | ||
| 65 | /* Allocate space for read buffer */ | ||
| 66 | if ((buf = malloc(BUF_SIZE + 1)) == NULL) { | ||
| 67 | endwin(); | ||
| 68 | fprintf(stderr, "\nCan't allocate memory in dialog_textbox().\n"); | ||
| 69 | exit(-1); | ||
| 70 | } | ||
| 71 | if ((bytes_read = read(fd, buf, BUF_SIZE)) == -1) { | ||
| 72 | endwin(); | ||
| 73 | fprintf(stderr, "\nError reading file in dialog_textbox().\n"); | ||
| 74 | exit(-1); | ||
| 75 | } | ||
| 76 | buf[bytes_read] = '\0'; /* mark end of valid data */ | ||
| 77 | page = buf; /* page is pointer to start of page to be displayed */ | ||
| 78 | |||
| 79 | /* center dialog box on screen */ | ||
| 80 | x = (COLS - width) / 2; | ||
| 81 | y = (LINES - height) / 2; | ||
| 82 | |||
| 83 | draw_shadow(stdscr, y, x, height, width); | ||
| 84 | |||
| 85 | dialog = newwin(height, width, y, x); | ||
| 86 | keypad(dialog, TRUE); | ||
| 87 | |||
| 88 | /* Create window for text region, used for scrolling text */ | ||
| 89 | text = subwin(dialog, height - 4, width - 2, y + 1, x + 1); | ||
| 90 | wattrset(text, dialog_attr); | ||
| 91 | wbkgdset(text, dialog_attr & A_COLOR); | ||
| 92 | |||
| 93 | keypad(text, TRUE); | ||
| 94 | |||
| 95 | /* register the new window, along with its borders */ | ||
| 96 | draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); | ||
| 97 | |||
| 98 | wattrset(dialog, border_attr); | ||
| 99 | mvwaddch(dialog, height - 3, 0, ACS_LTEE); | ||
| 100 | for (i = 0; i < width - 2; i++) | ||
| 101 | waddch(dialog, ACS_HLINE); | ||
| 102 | wattrset(dialog, dialog_attr); | ||
| 103 | wbkgdset(dialog, dialog_attr & A_COLOR); | ||
| 104 | waddch(dialog, ACS_RTEE); | ||
| 105 | |||
| 106 | print_title(dialog, title, width); | ||
| 107 | |||
| 108 | print_button(dialog, " Exit ", height - 2, width / 2 - 4, TRUE); | ||
| 109 | wnoutrefresh(dialog); | ||
| 110 | getyx(dialog, cur_y, cur_x); /* Save cursor position */ | ||
| 111 | |||
| 112 | /* Print first page of text */ | ||
| 113 | attr_clear(text, height - 4, width - 2, dialog_attr); | ||
| 114 | print_page(text, height - 4, width - 2); | ||
| 115 | print_position(dialog, height, width); | ||
| 116 | wmove(dialog, cur_y, cur_x); /* Restore cursor position */ | ||
| 117 | wrefresh(dialog); | ||
| 118 | |||
| 119 | while ((key != ESC) && (key != '\n')) { | ||
| 120 | key = wgetch(dialog); | ||
| 121 | switch (key) { | ||
| 122 | case 'E': /* Exit */ | ||
| 123 | case 'e': | ||
| 124 | case 'X': | ||
| 125 | case 'x': | ||
| 126 | delwin(dialog); | ||
| 127 | free(buf); | ||
| 128 | close(fd); | ||
| 129 | return 0; | ||
| 130 | case 'g': /* First page */ | ||
| 131 | case KEY_HOME: | ||
| 132 | if (!begin_reached) { | ||
| 133 | begin_reached = 1; | ||
| 134 | /* First page not in buffer? */ | ||
| 135 | if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) { | ||
| 136 | endwin(); | ||
| 137 | fprintf(stderr, "\nError moving file pointer in dialog_textbox().\n"); | ||
| 138 | exit(-1); | ||
| 139 | } | ||
| 140 | if (fpos > bytes_read) { /* Yes, we have to read it in */ | ||
| 141 | if (lseek(fd, 0, SEEK_SET) == -1) { | ||
| 142 | endwin(); | ||
| 143 | fprintf(stderr, "\nError moving file pointer in " | ||
| 144 | "dialog_textbox().\n"); | ||
| 145 | exit(-1); | ||
| 146 | } | ||
| 147 | if ((bytes_read = | ||
| 148 | read(fd, buf, BUF_SIZE)) == -1) { | ||
| 149 | endwin(); | ||
| 150 | fprintf(stderr, "\nError reading file in dialog_textbox().\n"); | ||
| 151 | exit(-1); | ||
| 152 | } | ||
| 153 | buf[bytes_read] = '\0'; | ||
| 154 | } | ||
| 155 | page = buf; | ||
| 156 | print_page(text, height - 4, width - 2); | ||
| 157 | print_position(dialog, height, width); | ||
| 158 | wmove(dialog, cur_y, cur_x); /* Restore cursor position */ | ||
| 159 | wrefresh(dialog); | ||
| 160 | } | ||
| 161 | break; | ||
| 162 | case 'G': /* Last page */ | ||
| 163 | case KEY_END: | ||
| 164 | |||
| 165 | end_reached = 1; | ||
| 166 | /* Last page not in buffer? */ | ||
| 167 | if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) { | ||
| 168 | endwin(); | ||
| 169 | fprintf(stderr, "\nError moving file pointer in dialog_textbox().\n"); | ||
| 170 | exit(-1); | ||
| 171 | } | ||
| 172 | if (fpos < file_size) { /* Yes, we have to read it in */ | ||
| 173 | if (lseek(fd, -BUF_SIZE, SEEK_END) == -1) { | ||
| 174 | endwin(); | ||
| 175 | fprintf(stderr, "\nError moving file pointer in dialog_textbox().\n"); | ||
| 176 | exit(-1); | ||
| 177 | } | ||
| 178 | if ((bytes_read = | ||
| 179 | read(fd, buf, BUF_SIZE)) == -1) { | ||
| 180 | endwin(); | ||
| 181 | fprintf(stderr, "\nError reading file in dialog_textbox().\n"); | ||
| 182 | exit(-1); | ||
| 183 | } | ||
| 184 | buf[bytes_read] = '\0'; | ||
| 185 | } | ||
| 186 | page = buf + bytes_read; | ||
| 187 | back_lines(height - 4); | ||
| 188 | print_page(text, height - 4, width - 2); | ||
| 189 | print_position(dialog, height, width); | ||
| 190 | wmove(dialog, cur_y, cur_x); /* Restore cursor position */ | ||
| 191 | wrefresh(dialog); | ||
| 192 | break; | ||
| 193 | case 'K': /* Previous line */ | ||
| 194 | case 'k': | ||
| 195 | case KEY_UP: | ||
| 196 | if (!begin_reached) { | ||
| 197 | back_lines(page_length + 1); | ||
| 198 | |||
| 199 | /* We don't call print_page() here but use scrolling to ensure | ||
| 200 | faster screen update. However, 'end_reached' and | ||
| 201 | 'page_length' should still be updated, and 'page' should | ||
| 202 | point to start of next page. This is done by calling | ||
| 203 | get_line() in the following 'for' loop. */ | ||
| 204 | scrollok(text, TRUE); | ||
| 205 | wscrl(text, -1); /* Scroll text region down one line */ | ||
| 206 | scrollok(text, FALSE); | ||
| 207 | page_length = 0; | ||
| 208 | passed_end = 0; | ||
| 209 | for (i = 0; i < height - 4; i++) { | ||
| 210 | if (!i) { | ||
| 211 | /* print first line of page */ | ||
| 212 | print_line(text, 0, width - 2); | ||
| 213 | wnoutrefresh(text); | ||
| 214 | } else | ||
| 215 | /* Called to update 'end_reached' and 'page' */ | ||
| 216 | get_line(); | ||
| 217 | if (!passed_end) | ||
| 218 | page_length++; | ||
| 219 | if (end_reached && !passed_end) | ||
| 220 | passed_end = 1; | ||
| 221 | } | ||
| 222 | |||
| 223 | print_position(dialog, height, width); | ||
| 224 | wmove(dialog, cur_y, cur_x); /* Restore cursor position */ | ||
| 225 | wrefresh(dialog); | ||
| 226 | } | ||
| 227 | break; | ||
| 228 | case 'B': /* Previous page */ | ||
| 229 | case 'b': | ||
| 230 | case KEY_PPAGE: | ||
| 231 | if (begin_reached) | ||
| 232 | break; | ||
| 233 | back_lines(page_length + height - 4); | ||
| 234 | print_page(text, height - 4, width - 2); | ||
| 235 | print_position(dialog, height, width); | ||
| 236 | wmove(dialog, cur_y, cur_x); | ||
| 237 | wrefresh(dialog); | ||
| 238 | break; | ||
| 239 | case 'J': /* Next line */ | ||
| 240 | case 'j': | ||
| 241 | case KEY_DOWN: | ||
| 242 | if (!end_reached) { | ||
| 243 | begin_reached = 0; | ||
| 244 | scrollok(text, TRUE); | ||
| 245 | scroll(text); /* Scroll text region up one line */ | ||
| 246 | scrollok(text, FALSE); | ||
| 247 | print_line(text, height - 5, width - 2); | ||
| 248 | wnoutrefresh(text); | ||
| 249 | print_position(dialog, height, width); | ||
| 250 | wmove(dialog, cur_y, cur_x); /* Restore cursor position */ | ||
| 251 | wrefresh(dialog); | ||
| 252 | } | ||
| 253 | break; | ||
| 254 | case KEY_NPAGE: /* Next page */ | ||
| 255 | case ' ': | ||
| 256 | if (end_reached) | ||
| 257 | break; | ||
| 258 | |||
| 259 | begin_reached = 0; | ||
| 260 | print_page(text, height - 4, width - 2); | ||
| 261 | print_position(dialog, height, width); | ||
| 262 | wmove(dialog, cur_y, cur_x); | ||
| 263 | wrefresh(dialog); | ||
| 264 | break; | ||
| 265 | case '0': /* Beginning of line */ | ||
| 266 | case 'H': /* Scroll left */ | ||
| 267 | case 'h': | ||
| 268 | case KEY_LEFT: | ||
| 269 | if (hscroll <= 0) | ||
| 270 | break; | ||
| 271 | |||
| 272 | if (key == '0') | ||
| 273 | hscroll = 0; | ||
| 274 | else | ||
| 275 | hscroll--; | ||
| 276 | /* Reprint current page to scroll horizontally */ | ||
| 277 | back_lines(page_length); | ||
| 278 | print_page(text, height - 4, width - 2); | ||
| 279 | wmove(dialog, cur_y, cur_x); | ||
| 280 | wrefresh(dialog); | ||
| 281 | break; | ||
| 282 | case 'L': /* Scroll right */ | ||
| 283 | case 'l': | ||
| 284 | case KEY_RIGHT: | ||
| 285 | if (hscroll >= MAX_LEN) | ||
| 286 | break; | ||
| 287 | hscroll++; | ||
| 288 | /* Reprint current page to scroll horizontally */ | ||
| 289 | back_lines(page_length); | ||
| 290 | print_page(text, height - 4, width - 2); | ||
| 291 | wmove(dialog, cur_y, cur_x); | ||
| 292 | wrefresh(dialog); | ||
| 293 | break; | ||
| 294 | case ESC: | ||
| 295 | break; | ||
| 296 | } | ||
| 297 | } | ||
| 298 | |||
| 299 | delwin(dialog); | ||
| 300 | free(buf); | ||
| 301 | close(fd); | ||
| 302 | return -1; /* ESC pressed */ | ||
| 303 | } | ||
| 304 | |||
| 305 | /* | ||
| 306 | * Go back 'n' lines in text file. Called by dialog_textbox(). | ||
| 307 | * 'page' will be updated to point to the desired line in 'buf'. | ||
| 308 | */ | ||
| 309 | static void back_lines(int n) | ||
| 310 | { | ||
| 311 | int i, fpos; | ||
| 312 | |||
| 313 | begin_reached = 0; | ||
| 314 | /* We have to distinguish between end_reached and !end_reached | ||
| 315 | since at end of file, the line is not ended by a '\n'. | ||
| 316 | The code inside 'if' basically does a '--page' to move one | ||
| 317 | character backward so as to skip '\n' of the previous line */ | ||
| 318 | if (!end_reached) { | ||
| 319 | /* Either beginning of buffer or beginning of file reached? */ | ||
| 320 | if (page == buf) { | ||
| 321 | if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) { | ||
| 322 | endwin(); | ||
| 323 | fprintf(stderr, "\nError moving file pointer in " | ||
| 324 | "back_lines().\n"); | ||
| 325 | exit(-1); | ||
| 326 | } | ||
| 327 | if (fpos > bytes_read) { /* Not beginning of file yet */ | ||
| 328 | /* We've reached beginning of buffer, but not beginning of | ||
| 329 | file yet, so read previous part of file into buffer. | ||
| 330 | Note that we only move backward for BUF_SIZE/2 bytes, | ||
| 331 | but not BUF_SIZE bytes to avoid re-reading again in | ||
| 332 | print_page() later */ | ||
| 333 | /* Really possible to move backward BUF_SIZE/2 bytes? */ | ||
| 334 | if (fpos < BUF_SIZE / 2 + bytes_read) { | ||
| 335 | /* No, move less then */ | ||
| 336 | if (lseek(fd, 0, SEEK_SET) == -1) { | ||
| 337 | endwin(); | ||
| 338 | fprintf(stderr, "\nError moving file pointer in " | ||
| 339 | "back_lines().\n"); | ||
| 340 | exit(-1); | ||
| 341 | } | ||
| 342 | page = buf + fpos - bytes_read; | ||
| 343 | } else { /* Move backward BUF_SIZE/2 bytes */ | ||
| 344 | if (lseek (fd, -(BUF_SIZE / 2 + bytes_read), SEEK_CUR) == -1) { | ||
| 345 | endwin(); | ||
| 346 | fprintf(stderr, "\nError moving file pointer " | ||
| 347 | "in back_lines().\n"); | ||
| 348 | exit(-1); | ||
| 349 | } | ||
| 350 | page = buf + BUF_SIZE / 2; | ||
| 351 | } | ||
| 352 | if ((bytes_read = | ||
| 353 | read(fd, buf, BUF_SIZE)) == -1) { | ||
| 354 | endwin(); | ||
| 355 | fprintf(stderr, "\nError reading file in back_lines().\n"); | ||
| 356 | exit(-1); | ||
| 357 | } | ||
| 358 | buf[bytes_read] = '\0'; | ||
| 359 | } else { /* Beginning of file reached */ | ||
| 360 | begin_reached = 1; | ||
| 361 | return; | ||
| 362 | } | ||
| 363 | } | ||
| 364 | if (*(--page) != '\n') { /* '--page' here */ | ||
| 365 | /* Something's wrong... */ | ||
| 366 | endwin(); | ||
| 367 | fprintf(stderr, "\nInternal error in back_lines().\n"); | ||
| 368 | exit(-1); | ||
| 369 | } | ||
| 370 | } | ||
| 371 | /* Go back 'n' lines */ | ||
| 372 | for (i = 0; i < n; i++) | ||
| 373 | do { | ||
| 374 | if (page == buf) { | ||
| 375 | if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) { | ||
| 376 | endwin(); | ||
| 377 | fprintf(stderr, "\nError moving file pointer in back_lines().\n"); | ||
| 378 | exit(-1); | ||
| 379 | } | ||
| 380 | if (fpos > bytes_read) { | ||
| 381 | /* Really possible to move backward BUF_SIZE/2 bytes? */ | ||
| 382 | if (fpos < BUF_SIZE / 2 + bytes_read) { | ||
| 383 | /* No, move less then */ | ||
| 384 | if (lseek(fd, 0, SEEK_SET) == -1) { | ||
| 385 | endwin(); | ||
| 386 | fprintf(stderr, "\nError moving file pointer " | ||
| 387 | "in back_lines().\n"); | ||
| 388 | exit(-1); | ||
| 389 | } | ||
| 390 | page = buf + fpos - bytes_read; | ||
| 391 | } else { /* Move backward BUF_SIZE/2 bytes */ | ||
| 392 | if (lseek (fd, -(BUF_SIZE / 2 + bytes_read), SEEK_CUR) == -1) { | ||
| 393 | endwin(); | ||
| 394 | fprintf(stderr, "\nError moving file pointer" | ||
| 395 | " in back_lines().\n"); | ||
| 396 | exit(-1); | ||
| 397 | } | ||
| 398 | page = buf + BUF_SIZE / 2; | ||
| 399 | } | ||
| 400 | if ((bytes_read = | ||
| 401 | read(fd, buf, BUF_SIZE)) == -1) { | ||
| 402 | endwin(); | ||
| 403 | fprintf(stderr, "\nError reading file in " | ||
| 404 | "back_lines().\n"); | ||
| 405 | exit(-1); | ||
| 406 | } | ||
| 407 | buf[bytes_read] = '\0'; | ||
| 408 | } else { /* Beginning of file reached */ | ||
| 409 | begin_reached = 1; | ||
| 410 | return; | ||
| 411 | } | ||
| 412 | } | ||
| 413 | } while (*(--page) != '\n'); | ||
| 414 | page++; | ||
| 415 | } | ||
| 416 | |||
| 417 | /* | ||
| 418 | * Print a new page of text. Called by dialog_textbox(). | ||
| 419 | */ | ||
| 420 | static void print_page(WINDOW * win, int height, int width) | ||
| 421 | { | ||
| 422 | int i, passed_end = 0; | ||
| 423 | |||
| 424 | page_length = 0; | ||
| 425 | for (i = 0; i < height; i++) { | ||
| 426 | print_line(win, i, width); | ||
| 427 | if (!passed_end) | ||
| 428 | page_length++; | ||
| 429 | if (end_reached && !passed_end) | ||
| 430 | passed_end = 1; | ||
| 431 | } | ||
| 432 | wnoutrefresh(win); | ||
| 433 | } | ||
| 434 | |||
| 435 | /* | ||
| 436 | * Print a new line of text. Called by dialog_textbox() and print_page(). | ||
| 437 | */ | ||
| 438 | static void print_line(WINDOW * win, int row, int width) | ||
| 439 | { | ||
| 440 | int y, x; | ||
| 441 | char *line; | ||
| 442 | |||
| 443 | line = get_line(); | ||
| 444 | line += MIN(strlen(line), hscroll); /* Scroll horizontally */ | ||
| 445 | wmove(win, row, 0); /* move cursor to correct line */ | ||
| 446 | waddch(win, ' '); | ||
| 447 | waddnstr(win, line, MIN(strlen(line), width - 2)); | ||
| 448 | |||
| 449 | getyx(win, y, x); | ||
| 450 | /* Clear 'residue' of previous line */ | ||
| 451 | #if OLD_NCURSES | ||
| 452 | { | ||
| 453 | int i; | ||
| 454 | for (i = 0; i < width - x; i++) | ||
| 455 | waddch(win, ' '); | ||
| 456 | } | ||
| 457 | #else | ||
| 458 | wclrtoeol(win); | ||
| 459 | #endif | ||
| 460 | } | ||
| 461 | |||
| 462 | /* | ||
| 463 | * Return current line of text. Called by dialog_textbox() and print_line(). | ||
| 464 | * 'page' should point to start of current line before calling, and will be | ||
| 465 | * updated to point to start of next line. | ||
| 466 | */ | ||
| 467 | static char *get_line(void) | ||
| 468 | { | ||
| 469 | int i = 0, fpos; | ||
| 470 | static char line[MAX_LEN + 1]; | ||
| 471 | |||
| 472 | end_reached = 0; | ||
| 473 | while (*page != '\n') { | ||
| 474 | if (*page == '\0') { | ||
| 475 | /* Either end of file or end of buffer reached */ | ||
| 476 | if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) { | ||
| 477 | endwin(); | ||
| 478 | fprintf(stderr, "\nError moving file pointer in " | ||
| 479 | "get_line().\n"); | ||
| 480 | exit(-1); | ||
| 481 | } | ||
| 482 | if (fpos < file_size) { /* Not end of file yet */ | ||
| 483 | /* We've reached end of buffer, but not end of file yet, | ||
| 484 | so read next part of file into buffer */ | ||
| 485 | if ((bytes_read = | ||
| 486 | read(fd, buf, BUF_SIZE)) == -1) { | ||
| 487 | endwin(); | ||
| 488 | fprintf(stderr, "\nError reading file in get_line().\n"); | ||
| 489 | exit(-1); | ||
| 490 | } | ||
| 491 | buf[bytes_read] = '\0'; | ||
| 492 | page = buf; | ||
| 493 | } else { | ||
| 494 | if (!end_reached) | ||
| 495 | end_reached = 1; | ||
| 496 | break; | ||
| 497 | } | ||
| 498 | } else if (i < MAX_LEN) | ||
| 499 | line[i++] = *(page++); | ||
| 500 | else { | ||
| 501 | /* Truncate lines longer than MAX_LEN characters */ | ||
| 502 | if (i == MAX_LEN) | ||
| 503 | line[i++] = '\0'; | ||
| 504 | page++; | ||
| 505 | } | ||
| 506 | } | ||
| 507 | if (i <= MAX_LEN) | ||
| 508 | line[i] = '\0'; | ||
| 509 | if (!end_reached) | ||
| 510 | page++; /* move pass '\n' */ | ||
| 511 | |||
| 512 | return line; | ||
| 513 | } | ||
| 514 | |||
| 515 | /* | ||
| 516 | * Print current position | ||
| 517 | */ | ||
| 518 | static void print_position(WINDOW * win, int height, int width) | ||
| 519 | { | ||
| 520 | int fpos, percent; | ||
| 521 | |||
| 522 | if ((fpos = lseek(fd, 0, SEEK_CUR)) == -1) { | ||
| 523 | endwin(); | ||
| 524 | fprintf(stderr, "\nError moving file pointer in print_position().\n"); | ||
| 525 | exit(-1); | ||
| 526 | } | ||
| 527 | wattrset(win, position_indicator_attr); | ||
| 528 | wbkgdset(win, position_indicator_attr & A_COLOR); | ||
| 529 | percent = !file_size ? | ||
| 530 | 100 : ((fpos - bytes_read + page - buf) * 100) / file_size; | ||
| 531 | wmove(win, height - 3, width - 9); | ||
| 532 | wprintw(win, "(%3d%%)", percent); | ||
| 533 | } | ||
diff --git a/scripts/kconfig/lxdialog/util.c b/scripts/kconfig/lxdialog/util.c new file mode 100644 index 000000000000..f82cebb9ff06 --- /dev/null +++ b/scripts/kconfig/lxdialog/util.c | |||
| @@ -0,0 +1,362 @@ | |||
| 1 | /* | ||
| 2 | * util.c | ||
| 3 | * | ||
| 4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
| 5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License | ||
| 9 | * as published by the Free Software Foundation; either version 2 | ||
| 10 | * of the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "dialog.h" | ||
| 23 | |||
| 24 | /* use colors by default? */ | ||
| 25 | bool use_colors = 1; | ||
| 26 | |||
| 27 | const char *backtitle = NULL; | ||
| 28 | |||
| 29 | /* | ||
| 30 | * Attribute values, default is for mono display | ||
| 31 | */ | ||
| 32 | chtype attributes[] = { | ||
| 33 | A_NORMAL, /* screen_attr */ | ||
| 34 | A_NORMAL, /* shadow_attr */ | ||
| 35 | A_NORMAL, /* dialog_attr */ | ||
| 36 | A_BOLD, /* title_attr */ | ||
| 37 | A_NORMAL, /* border_attr */ | ||
| 38 | A_REVERSE, /* button_active_attr */ | ||
| 39 | A_DIM, /* button_inactive_attr */ | ||
| 40 | A_REVERSE, /* button_key_active_attr */ | ||
| 41 | A_BOLD, /* button_key_inactive_attr */ | ||
| 42 | A_REVERSE, /* button_label_active_attr */ | ||
| 43 | A_NORMAL, /* button_label_inactive_attr */ | ||
| 44 | A_NORMAL, /* inputbox_attr */ | ||
| 45 | A_NORMAL, /* inputbox_border_attr */ | ||
| 46 | A_NORMAL, /* searchbox_attr */ | ||
| 47 | A_BOLD, /* searchbox_title_attr */ | ||
| 48 | A_NORMAL, /* searchbox_border_attr */ | ||
| 49 | A_BOLD, /* position_indicator_attr */ | ||
| 50 | A_NORMAL, /* menubox_attr */ | ||
| 51 | A_NORMAL, /* menubox_border_attr */ | ||
| 52 | A_NORMAL, /* item_attr */ | ||
| 53 | A_REVERSE, /* item_selected_attr */ | ||
| 54 | A_BOLD, /* tag_attr */ | ||
| 55 | A_REVERSE, /* tag_selected_attr */ | ||
| 56 | A_BOLD, /* tag_key_attr */ | ||
| 57 | A_REVERSE, /* tag_key_selected_attr */ | ||
| 58 | A_BOLD, /* check_attr */ | ||
| 59 | A_REVERSE, /* check_selected_attr */ | ||
| 60 | A_BOLD, /* uarrow_attr */ | ||
| 61 | A_BOLD /* darrow_attr */ | ||
| 62 | }; | ||
| 63 | |||
| 64 | #include "colors.h" | ||
| 65 | |||
| 66 | /* | ||
| 67 | * Table of color values | ||
| 68 | */ | ||
| 69 | int color_table[][3] = { | ||
| 70 | {SCREEN_FG, SCREEN_BG, SCREEN_HL}, | ||
| 71 | {SHADOW_FG, SHADOW_BG, SHADOW_HL}, | ||
| 72 | {DIALOG_FG, DIALOG_BG, DIALOG_HL}, | ||
| 73 | {TITLE_FG, TITLE_BG, TITLE_HL}, | ||
| 74 | {BORDER_FG, BORDER_BG, BORDER_HL}, | ||
| 75 | {BUTTON_ACTIVE_FG, BUTTON_ACTIVE_BG, BUTTON_ACTIVE_HL}, | ||
| 76 | {BUTTON_INACTIVE_FG, BUTTON_INACTIVE_BG, BUTTON_INACTIVE_HL}, | ||
| 77 | {BUTTON_KEY_ACTIVE_FG, BUTTON_KEY_ACTIVE_BG, BUTTON_KEY_ACTIVE_HL}, | ||
| 78 | {BUTTON_KEY_INACTIVE_FG, BUTTON_KEY_INACTIVE_BG, | ||
| 79 | BUTTON_KEY_INACTIVE_HL}, | ||
| 80 | {BUTTON_LABEL_ACTIVE_FG, BUTTON_LABEL_ACTIVE_BG, | ||
| 81 | BUTTON_LABEL_ACTIVE_HL}, | ||
| 82 | {BUTTON_LABEL_INACTIVE_FG, BUTTON_LABEL_INACTIVE_BG, | ||
| 83 | BUTTON_LABEL_INACTIVE_HL}, | ||
| 84 | {INPUTBOX_FG, INPUTBOX_BG, INPUTBOX_HL}, | ||
| 85 | {INPUTBOX_BORDER_FG, INPUTBOX_BORDER_BG, INPUTBOX_BORDER_HL}, | ||
| 86 | {SEARCHBOX_FG, SEARCHBOX_BG, SEARCHBOX_HL}, | ||
| 87 | {SEARCHBOX_TITLE_FG, SEARCHBOX_TITLE_BG, SEARCHBOX_TITLE_HL}, | ||
| 88 | {SEARCHBOX_BORDER_FG, SEARCHBOX_BORDER_BG, SEARCHBOX_BORDER_HL}, | ||
| 89 | {POSITION_INDICATOR_FG, POSITION_INDICATOR_BG, POSITION_INDICATOR_HL}, | ||
| 90 | {MENUBOX_FG, MENUBOX_BG, MENUBOX_HL}, | ||
| 91 | {MENUBOX_BORDER_FG, MENUBOX_BORDER_BG, MENUBOX_BORDER_HL}, | ||
| 92 | {ITEM_FG, ITEM_BG, ITEM_HL}, | ||
| 93 | {ITEM_SELECTED_FG, ITEM_SELECTED_BG, ITEM_SELECTED_HL}, | ||
| 94 | {TAG_FG, TAG_BG, TAG_HL}, | ||
| 95 | {TAG_SELECTED_FG, TAG_SELECTED_BG, TAG_SELECTED_HL}, | ||
| 96 | {TAG_KEY_FG, TAG_KEY_BG, TAG_KEY_HL}, | ||
| 97 | {TAG_KEY_SELECTED_FG, TAG_KEY_SELECTED_BG, TAG_KEY_SELECTED_HL}, | ||
| 98 | {CHECK_FG, CHECK_BG, CHECK_HL}, | ||
| 99 | {CHECK_SELECTED_FG, CHECK_SELECTED_BG, CHECK_SELECTED_HL}, | ||
| 100 | {UARROW_FG, UARROW_BG, UARROW_HL}, | ||
| 101 | {DARROW_FG, DARROW_BG, DARROW_HL}, | ||
| 102 | }; /* color_table */ | ||
| 103 | |||
| 104 | /* | ||
| 105 | * Set window to attribute 'attr' | ||
| 106 | */ | ||
| 107 | void attr_clear(WINDOW * win, int height, int width, chtype attr) | ||
| 108 | { | ||
| 109 | int i, j; | ||
| 110 | |||
| 111 | wattrset(win, attr); | ||
| 112 | for (i = 0; i < height; i++) { | ||
| 113 | wmove(win, i, 0); | ||
| 114 | for (j = 0; j < width; j++) | ||
| 115 | waddch(win, ' '); | ||
| 116 | } | ||
| 117 | touchwin(win); | ||
| 118 | } | ||
| 119 | |||
| 120 | void dialog_clear(void) | ||
| 121 | { | ||
| 122 | attr_clear(stdscr, LINES, COLS, screen_attr); | ||
| 123 | /* Display background title if it exists ... - SLH */ | ||
| 124 | if (backtitle != NULL) { | ||
| 125 | int i; | ||
| 126 | |||
| 127 | wattrset(stdscr, screen_attr); | ||
| 128 | mvwaddstr(stdscr, 0, 1, (char *)backtitle); | ||
| 129 | wmove(stdscr, 1, 1); | ||
| 130 | for (i = 1; i < COLS - 1; i++) | ||
| 131 | waddch(stdscr, ACS_HLINE); | ||
| 132 | } | ||
| 133 | wnoutrefresh(stdscr); | ||
| 134 | } | ||
| 135 | |||
| 136 | /* | ||
| 137 | * Do some initialization for dialog | ||
| 138 | */ | ||
| 139 | void init_dialog(void) | ||
| 140 | { | ||
| 141 | initscr(); /* Init curses */ | ||
| 142 | keypad(stdscr, TRUE); | ||
| 143 | cbreak(); | ||
| 144 | noecho(); | ||
| 145 | |||
| 146 | if (use_colors) /* Set up colors */ | ||
| 147 | color_setup(); | ||
| 148 | |||
| 149 | dialog_clear(); | ||
| 150 | } | ||
| 151 | |||
| 152 | /* | ||
| 153 | * Setup for color display | ||
| 154 | */ | ||
| 155 | void color_setup(void) | ||
| 156 | { | ||
| 157 | int i; | ||
| 158 | |||
| 159 | if (has_colors()) { /* Terminal supports color? */ | ||
| 160 | start_color(); | ||
| 161 | |||
| 162 | /* Initialize color pairs */ | ||
| 163 | for (i = 0; i < ATTRIBUTE_COUNT; i++) | ||
| 164 | init_pair(i + 1, color_table[i][0], color_table[i][1]); | ||
| 165 | |||
| 166 | /* Setup color attributes */ | ||
| 167 | for (i = 0; i < ATTRIBUTE_COUNT; i++) | ||
| 168 | attributes[i] = C_ATTR(color_table[i][2], i + 1); | ||
| 169 | } | ||
| 170 | } | ||
| 171 | |||
| 172 | /* | ||
| 173 | * End using dialog functions. | ||
| 174 | */ | ||
| 175 | void end_dialog(void) | ||
| 176 | { | ||
| 177 | endwin(); | ||
| 178 | } | ||
| 179 | |||
| 180 | /* Print the title of the dialog. Center the title and truncate | ||
| 181 | * tile if wider than dialog (- 2 chars). | ||
| 182 | **/ | ||
| 183 | void print_title(WINDOW *dialog, const char *title, int width) | ||
| 184 | { | ||
| 185 | if (title) { | ||
| 186 | int tlen = MIN(width - 2, strlen(title)); | ||
| 187 | wattrset(dialog, title_attr); | ||
| 188 | mvwaddch(dialog, 0, (width - tlen) / 2 - 1, ' '); | ||
| 189 | mvwaddnstr(dialog, 0, (width - tlen)/2, title, tlen); | ||
| 190 | waddch(dialog, ' '); | ||
| 191 | } | ||
| 192 | } | ||
| 193 | |||
| 194 | /* | ||
| 195 | * Print a string of text in a window, automatically wrap around to the | ||
| 196 | * next line if the string is too long to fit on one line. Newline | ||
| 197 | * characters '\n' are replaced by spaces. We start on a new line | ||
| 198 | * if there is no room for at least 4 nonblanks following a double-space. | ||
| 199 | */ | ||
| 200 | void print_autowrap(WINDOW * win, const char *prompt, int width, int y, int x) | ||
| 201 | { | ||
| 202 | int newl, cur_x, cur_y; | ||
| 203 | int i, prompt_len, room, wlen; | ||
| 204 | char tempstr[MAX_LEN + 1], *word, *sp, *sp2; | ||
| 205 | |||
| 206 | strcpy(tempstr, prompt); | ||
| 207 | |||
| 208 | prompt_len = strlen(tempstr); | ||
| 209 | |||
| 210 | /* | ||
| 211 | * Remove newlines | ||
| 212 | */ | ||
| 213 | for (i = 0; i < prompt_len; i++) { | ||
| 214 | if (tempstr[i] == '\n') | ||
| 215 | tempstr[i] = ' '; | ||
| 216 | } | ||
| 217 | |||
| 218 | if (prompt_len <= width - x * 2) { /* If prompt is short */ | ||
| 219 | wmove(win, y, (width - prompt_len) / 2); | ||
| 220 | waddstr(win, tempstr); | ||
| 221 | } else { | ||
| 222 | cur_x = x; | ||
| 223 | cur_y = y; | ||
| 224 | newl = 1; | ||
| 225 | word = tempstr; | ||
| 226 | while (word && *word) { | ||
| 227 | sp = index(word, ' '); | ||
| 228 | if (sp) | ||
| 229 | *sp++ = 0; | ||
| 230 | |||
| 231 | /* Wrap to next line if either the word does not fit, | ||
| 232 | or it is the first word of a new sentence, and it is | ||
| 233 | short, and the next word does not fit. */ | ||
| 234 | room = width - cur_x; | ||
| 235 | wlen = strlen(word); | ||
| 236 | if (wlen > room || | ||
| 237 | (newl && wlen < 4 && sp | ||
| 238 | && wlen + 1 + strlen(sp) > room | ||
| 239 | && (!(sp2 = index(sp, ' ')) | ||
| 240 | || wlen + 1 + (sp2 - sp) > room))) { | ||
| 241 | cur_y++; | ||
| 242 | cur_x = x; | ||
| 243 | } | ||
| 244 | wmove(win, cur_y, cur_x); | ||
| 245 | waddstr(win, word); | ||
| 246 | getyx(win, cur_y, cur_x); | ||
| 247 | cur_x++; | ||
| 248 | if (sp && *sp == ' ') { | ||
| 249 | cur_x++; /* double space */ | ||
| 250 | while (*++sp == ' ') ; | ||
| 251 | newl = 1; | ||
| 252 | } else | ||
| 253 | newl = 0; | ||
| 254 | word = sp; | ||
| 255 | } | ||
| 256 | } | ||
| 257 | } | ||
| 258 | |||
| 259 | /* | ||
| 260 | * Print a button | ||
| 261 | */ | ||
| 262 | void print_button(WINDOW * win, const char *label, int y, int x, int selected) | ||
| 263 | { | ||
| 264 | int i, temp; | ||
| 265 | |||
| 266 | wmove(win, y, x); | ||
| 267 | wattrset(win, selected ? button_active_attr : button_inactive_attr); | ||
| 268 | waddstr(win, "<"); | ||
| 269 | temp = strspn(label, " "); | ||
| 270 | label += temp; | ||
| 271 | wattrset(win, selected ? button_label_active_attr | ||
| 272 | : button_label_inactive_attr); | ||
| 273 | for (i = 0; i < temp; i++) | ||
| 274 | waddch(win, ' '); | ||
| 275 | wattrset(win, selected ? button_key_active_attr | ||
| 276 | : button_key_inactive_attr); | ||
| 277 | waddch(win, label[0]); | ||
| 278 | wattrset(win, selected ? button_label_active_attr | ||
| 279 | : button_label_inactive_attr); | ||
| 280 | waddstr(win, (char *)label + 1); | ||
| 281 | wattrset(win, selected ? button_active_attr : button_inactive_attr); | ||
| 282 | waddstr(win, ">"); | ||
| 283 | wmove(win, y, x + temp + 1); | ||
| 284 | } | ||
| 285 | |||
| 286 | /* | ||
| 287 | * Draw a rectangular box with line drawing characters | ||
| 288 | */ | ||
| 289 | void | ||
| 290 | draw_box(WINDOW * win, int y, int x, int height, int width, | ||
| 291 | chtype box, chtype border) | ||
| 292 | { | ||
| 293 | int i, j; | ||
| 294 | |||
| 295 | wattrset(win, 0); | ||
| 296 | for (i = 0; i < height; i++) { | ||
| 297 | wmove(win, y + i, x); | ||
| 298 | for (j = 0; j < width; j++) | ||
| 299 | if (!i && !j) | ||
| 300 | waddch(win, border | ACS_ULCORNER); | ||
| 301 | else if (i == height - 1 && !j) | ||
| 302 | waddch(win, border | ACS_LLCORNER); | ||
| 303 | else if (!i && j == width - 1) | ||
| 304 | waddch(win, box | ACS_URCORNER); | ||
| 305 | else if (i == height - 1 && j == width - 1) | ||
| 306 | waddch(win, box | ACS_LRCORNER); | ||
| 307 | else if (!i) | ||
| 308 | waddch(win, border | ACS_HLINE); | ||
| 309 | else if (i == height - 1) | ||
| 310 | waddch(win, box | ACS_HLINE); | ||
| 311 | else if (!j) | ||
| 312 | waddch(win, border | ACS_VLINE); | ||
| 313 | else if (j == width - 1) | ||
| 314 | waddch(win, box | ACS_VLINE); | ||
| 315 | else | ||
| 316 | waddch(win, box | ' '); | ||
| 317 | } | ||
| 318 | } | ||
| 319 | |||
| 320 | /* | ||
| 321 | * Draw shadows along the right and bottom edge to give a more 3D look | ||
| 322 | * to the boxes | ||
| 323 | */ | ||
| 324 | void draw_shadow(WINDOW * win, int y, int x, int height, int width) | ||
| 325 | { | ||
| 326 | int i; | ||
| 327 | |||
| 328 | if (has_colors()) { /* Whether terminal supports color? */ | ||
| 329 | wattrset(win, shadow_attr); | ||
| 330 | wmove(win, y + height, x + 2); | ||
| 331 | for (i = 0; i < width; i++) | ||
| 332 | waddch(win, winch(win) & A_CHARTEXT); | ||
| 333 | for (i = y + 1; i < y + height + 1; i++) { | ||
| 334 | wmove(win, i, x + width); | ||
| 335 | waddch(win, winch(win) & A_CHARTEXT); | ||
| 336 | waddch(win, winch(win) & A_CHARTEXT); | ||
| 337 | } | ||
| 338 | wnoutrefresh(win); | ||
| 339 | } | ||
| 340 | } | ||
| 341 | |||
| 342 | /* | ||
| 343 | * Return the position of the first alphabetic character in a string. | ||
| 344 | */ | ||
| 345 | int first_alpha(const char *string, const char *exempt) | ||
| 346 | { | ||
| 347 | int i, in_paren = 0, c; | ||
| 348 | |||
| 349 | for (i = 0; i < strlen(string); i++) { | ||
| 350 | c = tolower(string[i]); | ||
| 351 | |||
| 352 | if (strchr("<[(", c)) | ||
| 353 | ++in_paren; | ||
| 354 | if (strchr(">])", c) && in_paren > 0) | ||
| 355 | --in_paren; | ||
| 356 | |||
| 357 | if ((!in_paren) && isalpha(c) && strchr(exempt, c) == 0) | ||
| 358 | return i; | ||
| 359 | } | ||
| 360 | |||
| 361 | return 0; | ||
| 362 | } | ||
diff --git a/scripts/kconfig/lxdialog/yesno.c b/scripts/kconfig/lxdialog/yesno.c new file mode 100644 index 000000000000..cb2568aae3ed --- /dev/null +++ b/scripts/kconfig/lxdialog/yesno.c | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | /* | ||
| 2 | * yesno.c -- implements the yes/no box | ||
| 3 | * | ||
| 4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
| 5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License | ||
| 9 | * as published by the Free Software Foundation; either version 2 | ||
| 10 | * of the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "dialog.h" | ||
| 23 | |||
| 24 | /* | ||
| 25 | * Display termination buttons | ||
| 26 | */ | ||
| 27 | static void print_buttons(WINDOW * dialog, int height, int width, int selected) | ||
| 28 | { | ||
| 29 | int x = width / 2 - 10; | ||
| 30 | int y = height - 2; | ||
| 31 | |||
| 32 | print_button(dialog, " Yes ", y, x, selected == 0); | ||
| 33 | print_button(dialog, " No ", y, x + 13, selected == 1); | ||
| 34 | |||
| 35 | wmove(dialog, y, x + 1 + 13 * selected); | ||
| 36 | wrefresh(dialog); | ||
| 37 | } | ||
| 38 | |||
| 39 | /* | ||
| 40 | * Display a dialog box with two buttons - Yes and No | ||
| 41 | */ | ||
| 42 | int dialog_yesno(const char *title, const char *prompt, int height, int width) | ||
| 43 | { | ||
| 44 | int i, x, y, key = 0, button = 0; | ||
| 45 | WINDOW *dialog; | ||
| 46 | |||
| 47 | /* center dialog box on screen */ | ||
| 48 | x = (COLS - width) / 2; | ||
| 49 | y = (LINES - height) / 2; | ||
| 50 | |||
| 51 | draw_shadow(stdscr, y, x, height, width); | ||
| 52 | |||
| 53 | dialog = newwin(height, width, y, x); | ||
| 54 | keypad(dialog, TRUE); | ||
| 55 | |||
| 56 | draw_box(dialog, 0, 0, height, width, dialog_attr, border_attr); | ||
| 57 | wattrset(dialog, border_attr); | ||
| 58 | mvwaddch(dialog, height - 3, 0, ACS_LTEE); | ||
| 59 | for (i = 0; i < width - 2; i++) | ||
| 60 | waddch(dialog, ACS_HLINE); | ||
| 61 | wattrset(dialog, dialog_attr); | ||
| 62 | waddch(dialog, ACS_RTEE); | ||
| 63 | |||
| 64 | print_title(dialog, title, width); | ||
| 65 | |||
| 66 | wattrset(dialog, dialog_attr); | ||
| 67 | print_autowrap(dialog, prompt, width - 2, 1, 3); | ||
| 68 | |||
| 69 | print_buttons(dialog, height, width, 0); | ||
| 70 | |||
| 71 | while (key != ESC) { | ||
| 72 | key = wgetch(dialog); | ||
| 73 | switch (key) { | ||
| 74 | case 'Y': | ||
| 75 | case 'y': | ||
| 76 | delwin(dialog); | ||
| 77 | return 0; | ||
| 78 | case 'N': | ||
| 79 | case 'n': | ||
| 80 | delwin(dialog); | ||
| 81 | return 1; | ||
| 82 | |||
| 83 | case TAB: | ||
| 84 | case KEY_LEFT: | ||
| 85 | case KEY_RIGHT: | ||
| 86 | button = ((key == KEY_LEFT ? --button : ++button) < 0) ? 1 : (button > 1 ? 0 : button); | ||
| 87 | |||
| 88 | print_buttons(dialog, height, width, button); | ||
| 89 | wrefresh(dialog); | ||
| 90 | break; | ||
| 91 | case ' ': | ||
| 92 | case '\n': | ||
| 93 | delwin(dialog); | ||
| 94 | return button; | ||
| 95 | case ESC: | ||
| 96 | break; | ||
| 97 | } | ||
| 98 | } | ||
| 99 | |||
| 100 | delwin(dialog); | ||
| 101 | return -1; /* ESC pressed */ | ||
| 102 | } | ||
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c index d1ad40531ee5..d63d7fb677e4 100644 --- a/scripts/kconfig/mconf.c +++ b/scripts/kconfig/mconf.c | |||
| @@ -325,7 +325,7 @@ static void cprint_init(void) | |||
| 325 | memset(args, 0, sizeof(args)); | 325 | memset(args, 0, sizeof(args)); |
| 326 | indent = 0; | 326 | indent = 0; |
| 327 | child_count = 0; | 327 | child_count = 0; |
| 328 | cprint("./scripts/lxdialog/lxdialog"); | 328 | cprint("./scripts/kconfig/lxdialog/lxdialog"); |
| 329 | cprint("--backtitle"); | 329 | cprint("--backtitle"); |
| 330 | cprint(menu_backtitle); | 330 | cprint(menu_backtitle); |
| 331 | } | 331 | } |
diff --git a/scripts/kconfig/util.c b/scripts/kconfig/util.c index 4556014f2f00..656d2c87d661 100644 --- a/scripts/kconfig/util.c +++ b/scripts/kconfig/util.c | |||
| @@ -33,7 +33,7 @@ int file_write_dep(const char *name) | |||
| 33 | FILE *out; | 33 | FILE *out; |
| 34 | 34 | ||
| 35 | if (!name) | 35 | if (!name) |
| 36 | name = ".config.cmd"; | 36 | name = ".kconfig.d"; |
| 37 | out = fopen("..config.tmp", "w"); | 37 | out = fopen("..config.tmp", "w"); |
| 38 | if (!out) | 38 | if (!out) |
| 39 | return 1; | 39 | return 1; |
diff --git a/scripts/lxdialog/checklist.c b/scripts/lxdialog/checklist.c deleted file mode 100644 index 7aba17c72e64..000000000000 --- a/scripts/lxdialog/checklist.c +++ /dev/null | |||
| @@ -1,373 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * checklist.c -- implements the checklist box | ||
| 3 | * | ||
| 4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
| 5 | * Stuart Herbert - S.Herbert@sheffield.ac.uk: radiolist extension | ||
| 6 | * Alessandro Rubini - rubini@ipvvis.unipv.it: merged the two | ||
| 7 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) | ||
| 8 | * | ||
| 9 | * This program is free software; you can redistribute it and/or | ||
| 10 | * modify it under the terms of the GNU General Public License | ||
| 11 | * as published by the Free Software Foundation; either version 2 | ||
| 12 | * of the License, or (at your option) any later version. | ||
| 13 | * | ||
| 14 | * This program is distributed in the hope that it will be useful, | ||
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 17 | * GNU General Public License for more details. | ||
| 18 | * | ||
| 19 | * You should have received a copy of the GNU General Public License | ||
| 20 | * along with this program; if not, write to the Free Software | ||
| 21 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 22 | */ | ||
| 23 | |||
| 24 | #include "dialog.h" | ||
| 25 | |||
| 26 | static int list_width, check_x, item_x, checkflag; | ||
| 27 | |||
| 28 | /* | ||
| 29 | * Print list item | ||
| 30 | */ | ||
| 31 | static void | ||
| 32 | print_item (WINDOW * win, const char *item, int status, | ||
| 33 | int choice, int selected) | ||
| 34 | { | ||
| 35 | int i; | ||
| 36 | |||
| 37 | /* Clear 'residue' of last item */ | ||
| 38 | wattrset (win, menubox_attr); | ||
| 39 | wmove (win, choice, 0); | ||
| 40 | for (i = 0; i < list_width; i++) | ||
| 41 | waddch (win, ' '); | ||
| 42 | |||
| 43 | wmove (win, choice, check_x); | ||
| 44 | wattrset (win, selected ? check_selected_attr : check_attr); | ||
| 45 | if (checkflag == FLAG_CHECK) | ||
| 46 | wprintw (win, "[%c]", status ? 'X' : ' '); | ||
| 47 | else | ||
| 48 | wprintw (win, "(%c)", status ? 'X' : ' '); | ||
| 49 | |||
| 50 | wattrset (win, selected ? tag_selected_attr : tag_attr); | ||
| 51 | mvwaddch(win, choice, item_x, item[0]); | ||
| 52 | wattrset (win, selected ? item_selected_attr : item_attr); | ||
| 53 | waddstr (win, (char *)item+1); | ||
| 54 | if (selected) { | ||
| 55 | wmove (win, choice, check_x+1); | ||
| 56 | wrefresh (win); | ||
| 57 | } | ||
| 58 | } | ||
| 59 | |||
| 60 | /* | ||
| 61 | * Print the scroll indicators. | ||
| 62 | */ | ||
| 63 | static void | ||
| 64 | print_arrows (WINDOW * win, int choice, int item_no, int scroll, | ||
| 65 | int y, int x, int height) | ||
| 66 | { | ||
| 67 | wmove(win, y, x); | ||
| 68 | |||
| 69 | if (scroll > 0) { | ||
| 70 | wattrset (win, uarrow_attr); | ||
| 71 | waddch (win, ACS_UARROW); | ||
| 72 | waddstr (win, "(-)"); | ||
| 73 | } | ||
| 74 | else { | ||
| 75 | wattrset (win, menubox_attr); | ||
| 76 | waddch (win, ACS_HLINE); | ||
| 77 | waddch (win, ACS_HLINE); | ||
| 78 | waddch (win, ACS_HLINE); | ||
| 79 | waddch (win, ACS_HLINE); | ||
| 80 | } | ||
| 81 | |||
| 82 | y = y + height + 1; | ||
| 83 | wmove(win, y, x); | ||
| 84 | |||
| 85 | if ((height < item_no) && (scroll + choice < item_no - 1)) { | ||
| 86 | wattrset (win, darrow_attr); | ||
| 87 | waddch (win, ACS_DARROW); | ||
| 88 | waddstr (win, "(+)"); | ||
| 89 | } | ||
| 90 | else { | ||
| 91 | wattrset (win, menubox_border_attr); | ||
| 92 | waddch (win, ACS_HLINE); | ||
| 93 | waddch (win, ACS_HLINE); | ||
| 94 | waddch (win, ACS_HLINE); | ||
| 95 | waddch (win, ACS_HLINE); | ||
| 96 | } | ||
| 97 | } | ||
| 98 | |||
| 99 | /* | ||
| 100 | * Display the termination buttons | ||
| 101 | */ | ||
| 102 | static void | ||
| 103 | print_buttons( WINDOW *dialog, int height, int width, int selected) | ||
| 104 | { | ||
| 105 | int x = width / 2 - 11; | ||
| 106 | int y = height - 2; | ||
| 107 | |||
| 108 | print_button (dialog, "Select", y, x, selected == 0); | ||
| 109 | print_button (dialog, " Help ", y, x + 14, selected == 1); | ||
| 110 | |||
| 111 | wmove(dialog, y, x+1 + 14*selected); | ||
| 112 | wrefresh (dialog); | ||
| 113 | } | ||
| 114 | |||
| 115 | /* | ||
| 116 | * Display a dialog box with a list of options that can be turned on or off | ||
| 117 | * The `flag' parameter is used to select between radiolist and checklist. | ||
| 118 | */ | ||
| 119 | int | ||
| 120 | dialog_checklist (const char *title, const char *prompt, int height, int width, | ||
| 121 | int list_height, int item_no, const char * const * items, int flag) | ||
| 122 | |||
| 123 | { | ||
| 124 | int i, x, y, box_x, box_y; | ||
| 125 | int key = 0, button = 0, choice = 0, scroll = 0, max_choice, *status; | ||
| 126 | WINDOW *dialog, *list; | ||
| 127 | |||
| 128 | checkflag = flag; | ||
| 129 | |||
| 130 | /* Allocate space for storing item on/off status */ | ||
| 131 | if ((status = malloc (sizeof (int) * item_no)) == NULL) { | ||
| 132 | endwin (); | ||
| 133 | fprintf (stderr, | ||
| 134 | "\nCan't allocate memory in dialog_checklist().\n"); | ||
| 135 | exit (-1); | ||
| 136 | } | ||
| 137 | |||
| 138 | /* Initializes status */ | ||
| 139 | for (i = 0; i < item_no; i++) { | ||
| 140 | status[i] = !strcasecmp (items[i * 3 + 2], "on"); | ||
| 141 | if ((!choice && status[i]) || !strcasecmp (items[i * 3 + 2], "selected")) | ||
| 142 | choice = i + 1; | ||
| 143 | } | ||
| 144 | if (choice) | ||
| 145 | choice--; | ||
| 146 | |||
| 147 | max_choice = MIN (list_height, item_no); | ||
| 148 | |||
| 149 | /* center dialog box on screen */ | ||
| 150 | x = (COLS - width) / 2; | ||
| 151 | y = (LINES - height) / 2; | ||
| 152 | |||
| 153 | draw_shadow (stdscr, y, x, height, width); | ||
| 154 | |||
| 155 | dialog = newwin (height, width, y, x); | ||
| 156 | keypad (dialog, TRUE); | ||
| 157 | |||
| 158 | draw_box (dialog, 0, 0, height, width, dialog_attr, border_attr); | ||
| 159 | wattrset (dialog, border_attr); | ||
| 160 | mvwaddch (dialog, height-3, 0, ACS_LTEE); | ||
| 161 | for (i = 0; i < width - 2; i++) | ||
| 162 | waddch (dialog, ACS_HLINE); | ||
| 163 | wattrset (dialog, dialog_attr); | ||
| 164 | waddch (dialog, ACS_RTEE); | ||
| 165 | |||
| 166 | if (title != NULL && strlen(title) >= width-2 ) { | ||
| 167 | /* truncate long title -- mec */ | ||
| 168 | char * title2 = malloc(width-2+1); | ||
| 169 | memcpy( title2, title, width-2 ); | ||
| 170 | title2[width-2] = '\0'; | ||
| 171 | title = title2; | ||
| 172 | } | ||
| 173 | |||
| 174 | if (title != NULL) { | ||
| 175 | wattrset (dialog, title_attr); | ||
| 176 | mvwaddch (dialog, 0, (width - strlen(title))/2 - 1, ' '); | ||
| 177 | waddstr (dialog, (char *)title); | ||
| 178 | waddch (dialog, ' '); | ||
| 179 | } | ||
| 180 | |||
| 181 | wattrset (dialog, dialog_attr); | ||
| 182 | print_autowrap (dialog, prompt, width - 2, 1, 3); | ||
| 183 | |||
| 184 | list_width = width - 6; | ||
| 185 | box_y = height - list_height - 5; | ||
| 186 | box_x = (width - list_width) / 2 - 1; | ||
| 187 | |||
| 188 | /* create new window for the list */ | ||
| 189 | list = subwin (dialog, list_height, list_width, y+box_y+1, x+box_x+1); | ||
| 190 | |||
| 191 | keypad (list, TRUE); | ||
| 192 | |||
| 193 | /* draw a box around the list items */ | ||
| 194 | draw_box (dialog, box_y, box_x, list_height + 2, list_width + 2, | ||
| 195 | menubox_border_attr, menubox_attr); | ||
| 196 | |||
| 197 | /* Find length of longest item in order to center checklist */ | ||
| 198 | check_x = 0; | ||
| 199 | for (i = 0; i < item_no; i++) | ||
| 200 | check_x = MAX (check_x, + strlen (items[i * 3 + 1]) + 4); | ||
| 201 | |||
| 202 | check_x = (list_width - check_x) / 2; | ||
| 203 | item_x = check_x + 4; | ||
| 204 | |||
| 205 | if (choice >= list_height) { | ||
| 206 | scroll = choice - list_height + 1; | ||
| 207 | choice -= scroll; | ||
| 208 | } | ||
| 209 | |||
| 210 | /* Print the list */ | ||
| 211 | for (i = 0; i < max_choice; i++) { | ||
| 212 | print_item (list, items[(scroll+i) * 3 + 1], | ||
| 213 | status[i+scroll], i, i == choice); | ||
| 214 | } | ||
| 215 | |||
| 216 | print_arrows(dialog, choice, item_no, scroll, | ||
| 217 | box_y, box_x + check_x + 5, list_height); | ||
| 218 | |||
| 219 | print_buttons(dialog, height, width, 0); | ||
| 220 | |||
| 221 | wnoutrefresh (list); | ||
| 222 | wnoutrefresh (dialog); | ||
| 223 | doupdate (); | ||
| 224 | |||
| 225 | while (key != ESC) { | ||
| 226 | key = wgetch (dialog); | ||
| 227 | |||
| 228 | for (i = 0; i < max_choice; i++) | ||
| 229 | if (toupper(key) == toupper(items[(scroll+i)*3+1][0])) | ||
| 230 | break; | ||
| 231 | |||
| 232 | |||
| 233 | if ( i < max_choice || key == KEY_UP || key == KEY_DOWN || | ||
| 234 | key == '+' || key == '-' ) { | ||
| 235 | if (key == KEY_UP || key == '-') { | ||
| 236 | if (!choice) { | ||
| 237 | if (!scroll) | ||
| 238 | continue; | ||
| 239 | /* Scroll list down */ | ||
| 240 | if (list_height > 1) { | ||
| 241 | /* De-highlight current first item */ | ||
| 242 | print_item (list, items[scroll * 3 + 1], | ||
| 243 | status[scroll], 0, FALSE); | ||
| 244 | scrollok (list, TRUE); | ||
| 245 | wscrl (list, -1); | ||
| 246 | scrollok (list, FALSE); | ||
| 247 | } | ||
| 248 | scroll--; | ||
| 249 | print_item (list, items[scroll * 3 + 1], | ||
| 250 | status[scroll], 0, TRUE); | ||
| 251 | wnoutrefresh (list); | ||
| 252 | |||
| 253 | print_arrows(dialog, choice, item_no, scroll, | ||
| 254 | box_y, box_x + check_x + 5, list_height); | ||
| 255 | |||
| 256 | wrefresh (dialog); | ||
| 257 | |||
| 258 | continue; /* wait for another key press */ | ||
| 259 | } else | ||
| 260 | i = choice - 1; | ||
| 261 | } else if (key == KEY_DOWN || key == '+') { | ||
| 262 | if (choice == max_choice - 1) { | ||
| 263 | if (scroll + choice >= item_no - 1) | ||
| 264 | continue; | ||
| 265 | /* Scroll list up */ | ||
| 266 | if (list_height > 1) { | ||
| 267 | /* De-highlight current last item before scrolling up */ | ||
| 268 | print_item (list, items[(scroll + max_choice - 1) * 3 + 1], | ||
| 269 | status[scroll + max_choice - 1], | ||
| 270 | max_choice - 1, FALSE); | ||
| 271 | scrollok (list, TRUE); | ||
| 272 | wscrl (list, 1); | ||
| 273 | scrollok (list, FALSE); | ||
| 274 | } | ||
| 275 | scroll++; | ||
| 276 | print_item (list, items[(scroll + max_choice - 1) * 3 + 1], | ||
| 277 | status[scroll + max_choice - 1], | ||
| 278 | max_choice - 1, TRUE); | ||
| 279 | wnoutrefresh (list); | ||
| 280 | |||
| 281 | print_arrows(dialog, choice, item_no, scroll, | ||
| 282 | box_y, box_x + check_x + 5, list_height); | ||
| 283 | |||
| 284 | wrefresh (dialog); | ||
| 285 | |||
| 286 | continue; /* wait for another key press */ | ||
| 287 | } else | ||
| 288 | i = choice + 1; | ||
| 289 | } | ||
| 290 | if (i != choice) { | ||
| 291 | /* De-highlight current item */ | ||
| 292 | print_item (list, items[(scroll + choice) * 3 + 1], | ||
| 293 | status[scroll + choice], choice, FALSE); | ||
| 294 | /* Highlight new item */ | ||
| 295 | choice = i; | ||
| 296 | print_item (list, items[(scroll + choice) * 3 + 1], | ||
| 297 | status[scroll + choice], choice, TRUE); | ||
| 298 | wnoutrefresh (list); | ||
| 299 | wrefresh (dialog); | ||
| 300 | } | ||
| 301 | continue; /* wait for another key press */ | ||
| 302 | } | ||
| 303 | switch (key) { | ||
| 304 | case 'H': | ||
| 305 | case 'h': | ||
| 306 | case '?': | ||
| 307 | fprintf (stderr, "%s", items[(scroll + choice) * 3]); | ||
| 308 | delwin (dialog); | ||
| 309 | free (status); | ||
| 310 | return 1; | ||
| 311 | case TAB: | ||
| 312 | case KEY_LEFT: | ||
| 313 | case KEY_RIGHT: | ||
| 314 | button = ((key == KEY_LEFT ? --button : ++button) < 0) | ||
| 315 | ? 1 : (button > 1 ? 0 : button); | ||
| 316 | |||
| 317 | print_buttons(dialog, height, width, button); | ||
| 318 | wrefresh (dialog); | ||
| 319 | break; | ||
| 320 | case 'S': | ||
| 321 | case 's': | ||
| 322 | case ' ': | ||
| 323 | case '\n': | ||
| 324 | if (!button) { | ||
| 325 | if (flag == FLAG_CHECK) { | ||
| 326 | status[scroll + choice] = !status[scroll + choice]; | ||
| 327 | wmove (list, choice, check_x); | ||
| 328 | wattrset (list, check_selected_attr); | ||
| 329 | wprintw (list, "[%c]", status[scroll + choice] ? 'X' : ' '); | ||
| 330 | } else { | ||
| 331 | if (!status[scroll + choice]) { | ||
| 332 | for (i = 0; i < item_no; i++) | ||
| 333 | status[i] = 0; | ||
| 334 | status[scroll + choice] = 1; | ||
| 335 | for (i = 0; i < max_choice; i++) | ||
| 336 | print_item (list, items[(scroll + i) * 3 + 1], | ||
| 337 | status[scroll + i], i, i == choice); | ||
| 338 | } | ||
| 339 | } | ||
| 340 | wnoutrefresh (list); | ||
| 341 | wrefresh (dialog); | ||
| 342 | |||
| 343 | for (i = 0; i < item_no; i++) { | ||
| 344 | if (status[i]) { | ||
| 345 | if (flag == FLAG_CHECK) { | ||
| 346 | fprintf (stderr, "\"%s\" ", items[i * 3]); | ||
| 347 | } else { | ||
| 348 | fprintf (stderr, "%s", items[i * 3]); | ||
| 349 | } | ||
| 350 | |||
| 351 | } | ||
| 352 | } | ||
| 353 | } else | ||
| 354 | fprintf (stderr, "%s", items[(scroll + choice) * 3]); | ||
| 355 | delwin (dialog); | ||
| 356 | free (status); | ||
| 357 | return button; | ||
| 358 | case 'X': | ||
| 359 | case 'x': | ||
| 360 | key = ESC; | ||
| 361 | case ESC: | ||
| 362 | break; | ||
| 363 | } | ||
| 364 | |||
| 365 | /* Now, update everything... */ | ||
| 366 | doupdate (); | ||
| 367 | } | ||
| 368 | |||
| 369 | |||
| 370 | delwin (dialog); | ||
| 371 | free (status); | ||
| 372 | return -1; /* ESC pressed */ | ||
| 373 | } | ||
diff --git a/scripts/lxdialog/inputbox.c b/scripts/lxdialog/inputbox.c deleted file mode 100644 index 074d2d68bd31..000000000000 --- a/scripts/lxdialog/inputbox.c +++ /dev/null | |||
| @@ -1,240 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * inputbox.c -- implements the input box | ||
| 3 | * | ||
| 4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
| 5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License | ||
| 9 | * as published by the Free Software Foundation; either version 2 | ||
| 10 | * of the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "dialog.h" | ||
| 23 | |||
| 24 | char dialog_input_result[MAX_LEN + 1]; | ||
| 25 | |||
| 26 | /* | ||
| 27 | * Print the termination buttons | ||
| 28 | */ | ||
| 29 | static void | ||
| 30 | print_buttons(WINDOW *dialog, int height, int width, int selected) | ||
| 31 | { | ||
| 32 | int x = width / 2 - 11; | ||
| 33 | int y = height - 2; | ||
| 34 | |||
| 35 | print_button (dialog, " Ok ", y, x, selected==0); | ||
| 36 | print_button (dialog, " Help ", y, x + 14, selected==1); | ||
| 37 | |||
| 38 | wmove(dialog, y, x+1+14*selected); | ||
| 39 | wrefresh(dialog); | ||
| 40 | } | ||
| 41 | |||
| 42 | /* | ||
| 43 | * Display a dialog box for inputing a string | ||
| 44 | */ | ||
| 45 | int | ||
| 46 | dialog_inputbox (const char *title, const char *prompt, int height, int width, | ||
| 47 | const char *init) | ||
| 48 | { | ||
| 49 | int i, x, y, box_y, box_x, box_width; | ||
| 50 | int input_x = 0, scroll = 0, key = 0, button = -1; | ||
| 51 | char *instr = dialog_input_result; | ||
| 52 | WINDOW *dialog; | ||
| 53 | |||
| 54 | /* center dialog box on screen */ | ||
| 55 | x = (COLS - width) / 2; | ||
| 56 | y = (LINES - height) / 2; | ||
| 57 | |||
| 58 | |||
| 59 | draw_shadow (stdscr, y, x, height, width); | ||
| 60 | |||
| 61 | dialog = newwin (height, width, y, x); | ||
| 62 | keypad (dialog, TRUE); | ||
| 63 | |||
| 64 | draw_box (dialog, 0, 0, height, width, dialog_attr, border_attr); | ||
| 65 | wattrset (dialog, border_attr); | ||
| 66 | mvwaddch (dialog, height-3, 0, ACS_LTEE); | ||
| 67 | for (i = 0; i < width - 2; i++) | ||
| 68 | waddch (dialog, ACS_HLINE); | ||
| 69 | wattrset (dialog, dialog_attr); | ||
| 70 | waddch (dialog, ACS_RTEE); | ||
| 71 | |||
| 72 | if (title != NULL && strlen(title) >= width-2 ) { | ||
| 73 | /* truncate long title -- mec */ | ||
| 74 | char * title2 = malloc(width-2+1); | ||
| 75 | memcpy( title2, title, width-2 ); | ||
| 76 | title2[width-2] = '\0'; | ||
| 77 | title = title2; | ||
| 78 | } | ||
| 79 | |||
| 80 | if (title != NULL) { | ||
| 81 | wattrset (dialog, title_attr); | ||
| 82 | mvwaddch (dialog, 0, (width - strlen(title))/2 - 1, ' '); | ||
| 83 | waddstr (dialog, (char *)title); | ||
| 84 | waddch (dialog, ' '); | ||
| 85 | } | ||
| 86 | |||
| 87 | wattrset (dialog, dialog_attr); | ||
| 88 | print_autowrap (dialog, prompt, width - 2, 1, 3); | ||
| 89 | |||
| 90 | /* Draw the input field box */ | ||
| 91 | box_width = width - 6; | ||
| 92 | getyx (dialog, y, x); | ||
| 93 | box_y = y + 2; | ||
| 94 | box_x = (width - box_width) / 2; | ||
| 95 | draw_box (dialog, y + 1, box_x - 1, 3, box_width + 2, | ||
| 96 | border_attr, dialog_attr); | ||
| 97 | |||
| 98 | print_buttons(dialog, height, width, 0); | ||
| 99 | |||
| 100 | /* Set up the initial value */ | ||
| 101 | wmove (dialog, box_y, box_x); | ||
| 102 | wattrset (dialog, inputbox_attr); | ||
| 103 | |||
| 104 | if (!init) | ||
| 105 | instr[0] = '\0'; | ||
| 106 | else | ||
| 107 | strcpy (instr, init); | ||
| 108 | |||
| 109 | input_x = strlen (instr); | ||
| 110 | |||
| 111 | if (input_x >= box_width) { | ||
| 112 | scroll = input_x - box_width + 1; | ||
| 113 | input_x = box_width - 1; | ||
| 114 | for (i = 0; i < box_width - 1; i++) | ||
| 115 | waddch (dialog, instr[scroll + i]); | ||
| 116 | } else | ||
| 117 | waddstr (dialog, instr); | ||
| 118 | |||
| 119 | wmove (dialog, box_y, box_x + input_x); | ||
| 120 | |||
| 121 | wrefresh (dialog); | ||
| 122 | |||
| 123 | while (key != ESC) { | ||
| 124 | key = wgetch (dialog); | ||
| 125 | |||
| 126 | if (button == -1) { /* Input box selected */ | ||
| 127 | switch (key) { | ||
| 128 | case TAB: | ||
| 129 | case KEY_UP: | ||
| 130 | case KEY_DOWN: | ||
| 131 | break; | ||
| 132 | case KEY_LEFT: | ||
| 133 | continue; | ||
| 134 | case KEY_RIGHT: | ||
| 135 | continue; | ||
| 136 | case KEY_BACKSPACE: | ||
| 137 | case 127: | ||
| 138 | if (input_x || scroll) { | ||
| 139 | wattrset (dialog, inputbox_attr); | ||
| 140 | if (!input_x) { | ||
| 141 | scroll = scroll < box_width - 1 ? | ||
| 142 | 0 : scroll - (box_width - 1); | ||
| 143 | wmove (dialog, box_y, box_x); | ||
| 144 | for (i = 0; i < box_width; i++) | ||
| 145 | waddch (dialog, instr[scroll + input_x + i] ? | ||
| 146 | instr[scroll + input_x + i] : ' '); | ||
| 147 | input_x = strlen (instr) - scroll; | ||
| 148 | } else | ||
| 149 | input_x--; | ||
| 150 | instr[scroll + input_x] = '\0'; | ||
| 151 | mvwaddch (dialog, box_y, input_x + box_x, ' '); | ||
| 152 | wmove (dialog, box_y, input_x + box_x); | ||
| 153 | wrefresh (dialog); | ||
| 154 | } | ||
| 155 | continue; | ||
| 156 | default: | ||
| 157 | if (key < 0x100 && isprint (key)) { | ||
| 158 | if (scroll + input_x < MAX_LEN) { | ||
| 159 | wattrset (dialog, inputbox_attr); | ||
| 160 | instr[scroll + input_x] = key; | ||
| 161 | instr[scroll + input_x + 1] = '\0'; | ||
| 162 | if (input_x == box_width - 1) { | ||
| 163 | scroll++; | ||
| 164 | wmove (dialog, box_y, box_x); | ||
| 165 | for (i = 0; i < box_width - 1; i++) | ||
| 166 | waddch (dialog, instr[scroll + i]); | ||
| 167 | } else { | ||
| 168 | wmove (dialog, box_y, input_x++ + box_x); | ||
| 169 | waddch (dialog, key); | ||
| 170 | } | ||
| 171 | wrefresh (dialog); | ||
| 172 | } else | ||
| 173 | flash (); /* Alarm user about overflow */ | ||
| 174 | continue; | ||
| 175 | } | ||
| 176 | } | ||
| 177 | } | ||
| 178 | switch (key) { | ||
| 179 | case 'O': | ||
| 180 | case 'o': | ||
| 181 | delwin (dialog); | ||
| 182 | return 0; | ||
| 183 | case 'H': | ||
| 184 | case 'h': | ||
| 185 | delwin (dialog); | ||
| 186 | return 1; | ||
| 187 | case KEY_UP: | ||
| 188 | case KEY_LEFT: | ||
| 189 | switch (button) { | ||
| 190 | case -1: | ||
| 191 | button = 1; /* Indicates "Cancel" button is selected */ | ||
| 192 | print_buttons(dialog, height, width, 1); | ||
| 193 | break; | ||
| 194 | case 0: | ||
| 195 | button = -1; /* Indicates input box is selected */ | ||
| 196 | print_buttons(dialog, height, width, 0); | ||
| 197 | wmove (dialog, box_y, box_x + input_x); | ||
| 198 | wrefresh (dialog); | ||
| 199 | break; | ||
| 200 | case 1: | ||
| 201 | button = 0; /* Indicates "OK" button is selected */ | ||
| 202 | print_buttons(dialog, height, width, 0); | ||
| 203 | break; | ||
| 204 | } | ||
| 205 | break; | ||
| 206 | case TAB: | ||
| 207 | case KEY_DOWN: | ||
| 208 | case KEY_RIGHT: | ||
| 209 | switch (button) { | ||
| 210 | case -1: | ||
| 211 | button = 0; /* Indicates "OK" button is selected */ | ||
| 212 | print_buttons(dialog, height, width, 0); | ||
| 213 | break; | ||
| 214 | case 0: | ||
| 215 | button = 1; /* Indicates "Cancel" button is selected */ | ||
| 216 | print_buttons(dialog, height, width, 1); | ||
| 217 | break; | ||
| 218 | case 1: | ||
| 219 | button = -1; /* Indicates input box is selected */ | ||
| 220 | print_buttons(dialog, height, width, 0); | ||
| 221 | wmove (dialog, box_y, box_x + input_x); | ||
| 222 | wrefresh (dialog); | ||
| 223 | break; | ||
| 224 | } | ||
| 225 | break; | ||
| 226 | case ' ': | ||
| 227 | case '\n': | ||
| 228 | delwin (dialog); | ||
| 229 | return (button == -1 ? 0 : button); | ||
| 230 | case 'X': | ||
| 231 | case 'x': | ||
| 232 | key = ESC; | ||
| 233 | case ESC: | ||
| 234 | break; | ||
| 235 | } | ||
| 236 | } | ||
| 237 | |||
| 238 | delwin (dialog); | ||
| 239 | return -1; /* ESC pressed */ | ||
| 240 | } | ||
diff --git a/scripts/lxdialog/lxdialog.c b/scripts/lxdialog/lxdialog.c deleted file mode 100644 index f283a8545426..000000000000 --- a/scripts/lxdialog/lxdialog.c +++ /dev/null | |||
| @@ -1,226 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * dialog - Display simple dialog boxes from shell scripts | ||
| 3 | * | ||
| 4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
| 5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License | ||
| 9 | * as published by the Free Software Foundation; either version 2 | ||
| 10 | * of the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "dialog.h" | ||
| 23 | |||
| 24 | static void Usage (const char *name); | ||
| 25 | |||
| 26 | typedef int (jumperFn) (const char *title, int argc, const char * const * argv); | ||
| 27 | |||
| 28 | struct Mode { | ||
| 29 | char *name; | ||
| 30 | int argmin, argmax, argmod; | ||
| 31 | jumperFn *jumper; | ||
| 32 | }; | ||
| 33 | |||
| 34 | jumperFn j_menu, j_checklist, j_radiolist, j_yesno, j_textbox, j_inputbox; | ||
| 35 | jumperFn j_msgbox, j_infobox; | ||
| 36 | |||
| 37 | static struct Mode modes[] = | ||
| 38 | { | ||
| 39 | {"--menu", 9, 0, 3, j_menu}, | ||
| 40 | {"--checklist", 9, 0, 3, j_checklist}, | ||
| 41 | {"--radiolist", 9, 0, 3, j_radiolist}, | ||
| 42 | {"--yesno", 5,5,1, j_yesno}, | ||
| 43 | {"--textbox", 5,5,1, j_textbox}, | ||
| 44 | {"--inputbox", 5, 6, 1, j_inputbox}, | ||
| 45 | {"--msgbox", 5, 5, 1, j_msgbox}, | ||
| 46 | {"--infobox", 5, 5, 1, j_infobox}, | ||
| 47 | {NULL, 0, 0, 0, NULL} | ||
| 48 | }; | ||
| 49 | |||
| 50 | static struct Mode *modePtr; | ||
| 51 | |||
| 52 | #ifdef LOCALE | ||
| 53 | #include <locale.h> | ||
| 54 | #endif | ||
| 55 | |||
| 56 | int | ||
| 57 | main (int argc, const char * const * argv) | ||
| 58 | { | ||
| 59 | int offset = 0, opt_clear = 0, end_common_opts = 0, retval; | ||
| 60 | const char *title = NULL; | ||
| 61 | |||
| 62 | #ifdef LOCALE | ||
| 63 | (void) setlocale (LC_ALL, ""); | ||
| 64 | #endif | ||
| 65 | |||
| 66 | #ifdef TRACE | ||
| 67 | trace(TRACE_CALLS|TRACE_UPDATE); | ||
| 68 | #endif | ||
| 69 | if (argc < 2) { | ||
| 70 | Usage (argv[0]); | ||
| 71 | exit (-1); | ||
| 72 | } | ||
| 73 | |||
| 74 | while (offset < argc - 1 && !end_common_opts) { /* Common options */ | ||
| 75 | if (!strcmp (argv[offset + 1], "--title")) { | ||
| 76 | if (argc - offset < 3 || title != NULL) { | ||
| 77 | Usage (argv[0]); | ||
| 78 | exit (-1); | ||
| 79 | } else { | ||
| 80 | title = argv[offset + 2]; | ||
| 81 | offset += 2; | ||
| 82 | } | ||
| 83 | } else if (!strcmp (argv[offset + 1], "--backtitle")) { | ||
| 84 | if (backtitle != NULL) { | ||
| 85 | Usage (argv[0]); | ||
| 86 | exit (-1); | ||
| 87 | } else { | ||
| 88 | backtitle = argv[offset + 2]; | ||
| 89 | offset += 2; | ||
| 90 | } | ||
| 91 | } else if (!strcmp (argv[offset + 1], "--clear")) { | ||
| 92 | if (opt_clear) { /* Hey, "--clear" can't appear twice! */ | ||
| 93 | Usage (argv[0]); | ||
| 94 | exit (-1); | ||
| 95 | } else if (argc == 2) { /* we only want to clear the screen */ | ||
| 96 | init_dialog (); | ||
| 97 | refresh (); /* init_dialog() will clear the screen for us */ | ||
| 98 | end_dialog (); | ||
| 99 | return 0; | ||
| 100 | } else { | ||
| 101 | opt_clear = 1; | ||
| 102 | offset++; | ||
| 103 | } | ||
| 104 | } else /* no more common options */ | ||
| 105 | end_common_opts = 1; | ||
| 106 | } | ||
| 107 | |||
| 108 | if (argc - 1 == offset) { /* no more options */ | ||
| 109 | Usage (argv[0]); | ||
| 110 | exit (-1); | ||
| 111 | } | ||
| 112 | /* use a table to look for the requested mode, to avoid code duplication */ | ||
| 113 | |||
| 114 | for (modePtr = modes; modePtr->name; modePtr++) /* look for the mode */ | ||
| 115 | if (!strcmp (argv[offset + 1], modePtr->name)) | ||
| 116 | break; | ||
| 117 | |||
| 118 | if (!modePtr->name) | ||
| 119 | Usage (argv[0]); | ||
| 120 | if (argc - offset < modePtr->argmin) | ||
| 121 | Usage (argv[0]); | ||
| 122 | if (modePtr->argmax && argc - offset > modePtr->argmax) | ||
| 123 | Usage (argv[0]); | ||
| 124 | |||
| 125 | |||
| 126 | |||
| 127 | init_dialog (); | ||
| 128 | retval = (*(modePtr->jumper)) (title, argc - offset, argv + offset); | ||
| 129 | |||
| 130 | if (opt_clear) { /* clear screen before exit */ | ||
| 131 | attr_clear (stdscr, LINES, COLS, screen_attr); | ||
| 132 | refresh (); | ||
| 133 | } | ||
| 134 | end_dialog(); | ||
| 135 | |||
| 136 | exit (retval); | ||
| 137 | } | ||
| 138 | |||
| 139 | /* | ||
| 140 | * Print program usage | ||
| 141 | */ | ||
| 142 | static void | ||
| 143 | Usage (const char *name) | ||
| 144 | { | ||
| 145 | fprintf (stderr, "\ | ||
| 146 | \ndialog, by Savio Lam (lam836@cs.cuhk.hk).\ | ||
| 147 | \n patched by Stuart Herbert (S.Herbert@shef.ac.uk)\ | ||
| 148 | \n modified/gutted for use as a Linux kernel config tool by \ | ||
| 149 | \n William Roadcap (roadcapw@cfw.com)\ | ||
| 150 | \n\ | ||
| 151 | \n* Display dialog boxes from shell scripts *\ | ||
| 152 | \n\ | ||
| 153 | \nUsage: %s --clear\ | ||
| 154 | \n %s [--title <title>] [--backtitle <backtitle>] --clear <Box options>\ | ||
| 155 | \n\ | ||
| 156 | \nBox options:\ | ||
| 157 | \n\ | ||
| 158 | \n --menu <text> <height> <width> <menu height> <tag1> <item1>...\ | ||
| 159 | \n --checklist <text> <height> <width> <list height> <tag1> <item1> <status1>...\ | ||
| 160 | \n --radiolist <text> <height> <width> <list height> <tag1> <item1> <status1>...\ | ||
| 161 | \n --textbox <file> <height> <width>\ | ||
| 162 | \n --inputbox <text> <height> <width> [<init>]\ | ||
| 163 | \n --yesno <text> <height> <width>\ | ||
| 164 | \n", name, name); | ||
| 165 | exit (-1); | ||
| 166 | } | ||
| 167 | |||
| 168 | /* | ||
| 169 | * These are the program jumpers | ||
| 170 | */ | ||
| 171 | |||
| 172 | int | ||
| 173 | j_menu (const char *t, int ac, const char * const * av) | ||
| 174 | { | ||
| 175 | return dialog_menu (t, av[2], atoi (av[3]), atoi (av[4]), | ||
| 176 | atoi (av[5]), av[6], (ac - 6) / 2, av + 7); | ||
| 177 | } | ||
| 178 | |||
| 179 | int | ||
| 180 | j_checklist (const char *t, int ac, const char * const * av) | ||
| 181 | { | ||
| 182 | return dialog_checklist (t, av[2], atoi (av[3]), atoi (av[4]), | ||
| 183 | atoi (av[5]), (ac - 6) / 3, av + 6, FLAG_CHECK); | ||
| 184 | } | ||
| 185 | |||
| 186 | int | ||
| 187 | j_radiolist (const char *t, int ac, const char * const * av) | ||
| 188 | { | ||
| 189 | return dialog_checklist (t, av[2], atoi (av[3]), atoi (av[4]), | ||
| 190 | atoi (av[5]), (ac - 6) / 3, av + 6, FLAG_RADIO); | ||
| 191 | } | ||
| 192 | |||
| 193 | int | ||
| 194 | j_textbox (const char *t, int ac, const char * const * av) | ||
| 195 | { | ||
| 196 | return dialog_textbox (t, av[2], atoi (av[3]), atoi (av[4])); | ||
| 197 | } | ||
| 198 | |||
| 199 | int | ||
| 200 | j_yesno (const char *t, int ac, const char * const * av) | ||
| 201 | { | ||
| 202 | return dialog_yesno (t, av[2], atoi (av[3]), atoi (av[4])); | ||
| 203 | } | ||
| 204 | |||
| 205 | int | ||
| 206 | j_inputbox (const char *t, int ac, const char * const * av) | ||
| 207 | { | ||
| 208 | int ret = dialog_inputbox (t, av[2], atoi (av[3]), atoi (av[4]), | ||
| 209 | ac == 6 ? av[5] : (char *) NULL); | ||
| 210 | if (ret == 0) | ||
| 211 | fprintf(stderr, dialog_input_result); | ||
| 212 | return ret; | ||
| 213 | } | ||
| 214 | |||
| 215 | int | ||
| 216 | j_msgbox (const char *t, int ac, const char * const * av) | ||
| 217 | { | ||
| 218 | return dialog_msgbox (t, av[2], atoi (av[3]), atoi (av[4]), 1); | ||
| 219 | } | ||
| 220 | |||
| 221 | int | ||
| 222 | j_infobox (const char *t, int ac, const char * const * av) | ||
| 223 | { | ||
| 224 | return dialog_msgbox (t, av[2], atoi (av[3]), atoi (av[4]), 0); | ||
| 225 | } | ||
| 226 | |||
diff --git a/scripts/lxdialog/menubox.c b/scripts/lxdialog/menubox.c deleted file mode 100644 index 91d82ba17f8d..000000000000 --- a/scripts/lxdialog/menubox.c +++ /dev/null | |||
| @@ -1,445 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * menubox.c -- implements the menu box | ||
| 3 | * | ||
| 4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
| 5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcapw@cfw.com) | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License | ||
| 9 | * as published by the Free Software Foundation; either version 2 | ||
| 10 | * of the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 20 | */ | ||
| 21 | |||
| 22 | /* | ||
| 23 | * Changes by Clifford Wolf (god@clifford.at) | ||
| 24 | * | ||
| 25 | * [ 1998-06-13 ] | ||
| 26 | * | ||
| 27 | * *) A bugfix for the Page-Down problem | ||
| 28 | * | ||
| 29 | * *) Formerly when I used Page Down and Page Up, the cursor would be set | ||
| 30 | * to the first position in the menu box. Now lxdialog is a bit | ||
| 31 | * smarter and works more like other menu systems (just have a look at | ||
| 32 | * it). | ||
| 33 | * | ||
| 34 | * *) Formerly if I selected something my scrolling would be broken because | ||
| 35 | * lxdialog is re-invoked by the Menuconfig shell script, can't | ||
| 36 | * remember the last scrolling position, and just sets it so that the | ||
| 37 | * cursor is at the bottom of the box. Now it writes the temporary file | ||
| 38 | * lxdialog.scrltmp which contains this information. The file is | ||
| 39 | * deleted by lxdialog if the user leaves a submenu or enters a new | ||
| 40 | * one, but it would be nice if Menuconfig could make another "rm -f" | ||
| 41 | * just to be sure. Just try it out - you will recognise a difference! | ||
| 42 | * | ||
| 43 | * [ 1998-06-14 ] | ||
| 44 | * | ||
| 45 | * *) Now lxdialog is crash-safe against broken "lxdialog.scrltmp" files | ||
| 46 | * and menus change their size on the fly. | ||
| 47 | * | ||
| 48 | * *) If for some reason the last scrolling position is not saved by | ||
| 49 | * lxdialog, it sets the scrolling so that the selected item is in the | ||
| 50 | * middle of the menu box, not at the bottom. | ||
| 51 | * | ||
| 52 | * 02 January 1999, Michael Elizabeth Chastain (mec@shout.net) | ||
| 53 | * Reset 'scroll' to 0 if the value from lxdialog.scrltmp is bogus. | ||
| 54 | * This fixes a bug in Menuconfig where using ' ' to descend into menus | ||
| 55 | * would leave mis-synchronized lxdialog.scrltmp files lying around, | ||
| 56 | * fscanf would read in 'scroll', and eventually that value would get used. | ||
| 57 | */ | ||
| 58 | |||
| 59 | #include "dialog.h" | ||
| 60 | |||
| 61 | static int menu_width, item_x; | ||
| 62 | |||
| 63 | /* | ||
| 64 | * Print menu item | ||
| 65 | */ | ||
| 66 | static void | ||
| 67 | print_item (WINDOW * win, const char *item, int choice, int selected, int hotkey) | ||
| 68 | { | ||
| 69 | int j; | ||
| 70 | char menu_item[menu_width+1]; | ||
| 71 | |||
| 72 | strncpy(menu_item, item, menu_width); | ||
| 73 | menu_item[menu_width] = 0; | ||
| 74 | j = first_alpha(menu_item, "YyNnMmHh"); | ||
| 75 | |||
| 76 | /* Clear 'residue' of last item */ | ||
| 77 | wattrset (win, menubox_attr); | ||
| 78 | wmove (win, choice, 0); | ||
| 79 | #if OLD_NCURSES | ||
| 80 | { | ||
| 81 | int i; | ||
| 82 | for (i = 0; i < menu_width; i++) | ||
| 83 | waddch (win, ' '); | ||
| 84 | } | ||
| 85 | #else | ||
| 86 | wclrtoeol(win); | ||
| 87 | #endif | ||
| 88 | wattrset (win, selected ? item_selected_attr : item_attr); | ||
| 89 | mvwaddstr (win, choice, item_x, menu_item); | ||
| 90 | if (hotkey) { | ||
| 91 | wattrset (win, selected ? tag_key_selected_attr : tag_key_attr); | ||
| 92 | mvwaddch(win, choice, item_x+j, menu_item[j]); | ||
| 93 | } | ||
| 94 | if (selected) { | ||
| 95 | wmove (win, choice, item_x+1); | ||
| 96 | wrefresh (win); | ||
| 97 | } | ||
| 98 | } | ||
| 99 | |||
| 100 | /* | ||
| 101 | * Print the scroll indicators. | ||
| 102 | */ | ||
| 103 | static void | ||
| 104 | print_arrows (WINDOW * win, int item_no, int scroll, | ||
| 105 | int y, int x, int height) | ||
| 106 | { | ||
| 107 | int cur_y, cur_x; | ||
| 108 | |||
| 109 | getyx(win, cur_y, cur_x); | ||
| 110 | |||
| 111 | wmove(win, y, x); | ||
| 112 | |||
| 113 | if (scroll > 0) { | ||
| 114 | wattrset (win, uarrow_attr); | ||
| 115 | waddch (win, ACS_UARROW); | ||
| 116 | waddstr (win, "(-)"); | ||
| 117 | } | ||
| 118 | else { | ||
| 119 | wattrset (win, menubox_attr); | ||
| 120 | waddch (win, ACS_HLINE); | ||
| 121 | waddch (win, ACS_HLINE); | ||
| 122 | waddch (win, ACS_HLINE); | ||
| 123 | waddch (win, ACS_HLINE); | ||
| 124 | } | ||
| 125 | |||
| 126 | y = y + height + 1; | ||
| 127 | wmove(win, y, x); | ||
| 128 | |||
| 129 | if ((height < item_no) && (scroll + height < item_no)) { | ||
| 130 | wattrset (win, darrow_attr); | ||
| 131 | waddch (win, ACS_DARROW); | ||
| 132 | waddstr (win, "(+)"); | ||
| 133 | } | ||
| 134 | else { | ||
| 135 | wattrset (win, menubox_border_attr); | ||
| 136 | waddch (win, ACS_HLINE); | ||
| 137 | waddch (win, ACS_HLINE); | ||
| 138 | waddch (win, ACS_HLINE); | ||
| 139 | waddch (win, ACS_HLINE); | ||
| 140 | } | ||
| 141 | |||
| 142 | wmove(win, cur_y, cur_x); | ||
| 143 | } | ||
| 144 | |||
| 145 | /* | ||
| 146 | * Display the termination buttons. | ||
| 147 | */ | ||
| 148 | static void | ||
| 149 | print_buttons (WINDOW *win, int height, int width, int selected) | ||
| 150 | { | ||
| 151 | int x = width / 2 - 16; | ||
| 152 | int y = height - 2; | ||
| 153 | |||
| 154 | print_button (win, "Select", y, x, selected == 0); | ||
| 155 | print_button (win, " Exit ", y, x + 12, selected == 1); | ||
| 156 | print_button (win, " Help ", y, x + 24, selected == 2); | ||
| 157 | |||
| 158 | wmove(win, y, x+1+12*selected); | ||
| 159 | wrefresh (win); | ||
| 160 | } | ||
| 161 | |||
| 162 | /* | ||
| 163 | * Display a menu for choosing among a number of options | ||
| 164 | */ | ||
| 165 | int | ||
| 166 | dialog_menu (const char *title, const char *prompt, int height, int width, | ||
| 167 | int menu_height, const char *current, int item_no, | ||
| 168 | const char * const * items) | ||
| 169 | |||
| 170 | { | ||
| 171 | int i, j, x, y, box_x, box_y; | ||
| 172 | int key = 0, button = 0, scroll = 0, choice = 0, first_item = 0, max_choice; | ||
| 173 | WINDOW *dialog, *menu; | ||
| 174 | FILE *f; | ||
| 175 | |||
| 176 | max_choice = MIN (menu_height, item_no); | ||
| 177 | |||
| 178 | /* center dialog box on screen */ | ||
| 179 | x = (COLS - width) / 2; | ||
| 180 | y = (LINES - height) / 2; | ||
| 181 | |||
| 182 | draw_shadow (stdscr, y, x, height, width); | ||
| 183 | |||
| 184 | dialog = newwin (height, width, y, x); | ||
| 185 | keypad (dialog, TRUE); | ||
| 186 | |||
| 187 | draw_box (dialog, 0, 0, height, width, dialog_attr, border_attr); | ||
| 188 | wattrset (dialog, border_attr); | ||
| 189 | mvwaddch (dialog, height - 3, 0, ACS_LTEE); | ||
| 190 | for (i = 0; i < width - 2; i++) | ||
| 191 | waddch (dialog, ACS_HLINE); | ||
| 192 | wattrset (dialog, dialog_attr); | ||
| 193 | wbkgdset (dialog, dialog_attr & A_COLOR); | ||
| 194 | waddch (dialog, ACS_RTEE); | ||
| 195 | |||
| 196 | if (title != NULL && strlen(title) >= width-2 ) { | ||
| 197 | /* truncate long title -- mec */ | ||
| 198 | char * title2 = malloc(width-2+1); | ||
| 199 | memcpy( title2, title, width-2 ); | ||
| 200 | title2[width-2] = '\0'; | ||
| 201 | title = title2; | ||
| 202 | } | ||
| 203 | |||
| 204 | if (title != NULL) { | ||
| 205 | wattrset (dialog, title_attr); | ||
| 206 | mvwaddch (dialog, 0, (width - strlen(title))/2 - 1, ' '); | ||
| 207 | waddstr (dialog, (char *)title); | ||
| 208 | waddch (dialog, ' '); | ||
| 209 | } | ||
| 210 | |||
| 211 | wattrset (dialog, dialog_attr); | ||
| 212 | print_autowrap (dialog, prompt, width - 2, 1, 3); | ||
| 213 | |||
| 214 | menu_width = width - 6; | ||
| 215 | box_y = height - menu_height - 5; | ||
| 216 | box_x = (width - menu_width) / 2 - 1; | ||
| 217 | |||
| 218 | /* create new window for the menu */ | ||
| 219 | menu = subwin (dialog, menu_height, menu_width, | ||
| 220 | y + box_y + 1, x + box_x + 1); | ||
| 221 | keypad (menu, TRUE); | ||
| 222 | |||
| 223 | /* draw a box around the menu items */ | ||
| 224 | draw_box (dialog, box_y, box_x, menu_height + 2, menu_width + 2, | ||
| 225 | menubox_border_attr, menubox_attr); | ||
| 226 | |||
| 227 | /* | ||
| 228 | * Find length of longest item in order to center menu. | ||
| 229 | * Set 'choice' to default item. | ||
| 230 | */ | ||
| 231 | item_x = 0; | ||
| 232 | for (i = 0; i < item_no; i++) { | ||
| 233 | item_x = MAX (item_x, MIN(menu_width, strlen (items[i * 2 + 1]) + 2)); | ||
| 234 | if (strcmp(current, items[i*2]) == 0) choice = i; | ||
| 235 | } | ||
| 236 | |||
| 237 | item_x = (menu_width - item_x) / 2; | ||
| 238 | |||
| 239 | /* get the scroll info from the temp file */ | ||
| 240 | if ( (f=fopen("lxdialog.scrltmp","r")) != NULL ) { | ||
| 241 | if ( (fscanf(f,"%d\n",&scroll) == 1) && (scroll <= choice) && | ||
| 242 | (scroll+max_choice > choice) && (scroll >= 0) && | ||
| 243 | (scroll+max_choice <= item_no) ) { | ||
| 244 | first_item = scroll; | ||
| 245 | choice = choice - scroll; | ||
| 246 | fclose(f); | ||
| 247 | } else { | ||
| 248 | scroll=0; | ||
| 249 | remove("lxdialog.scrltmp"); | ||
| 250 | fclose(f); | ||
| 251 | f=NULL; | ||
| 252 | } | ||
| 253 | } | ||
| 254 | if ( (choice >= max_choice) || (f==NULL && choice >= max_choice/2) ) { | ||
| 255 | if (choice >= item_no-max_choice/2) | ||
| 256 | scroll = first_item = item_no-max_choice; | ||
| 257 | else | ||
| 258 | scroll = first_item = choice - max_choice/2; | ||
| 259 | choice = choice - scroll; | ||
| 260 | } | ||
| 261 | |||
| 262 | /* Print the menu */ | ||
| 263 | for (i=0; i < max_choice; i++) { | ||
| 264 | print_item (menu, items[(first_item + i) * 2 + 1], i, i == choice, | ||
| 265 | (items[(first_item + i)*2][0] != ':')); | ||
| 266 | } | ||
| 267 | |||
| 268 | wnoutrefresh (menu); | ||
| 269 | |||
| 270 | print_arrows(dialog, item_no, scroll, | ||
| 271 | box_y, box_x+item_x+1, menu_height); | ||
| 272 | |||
| 273 | print_buttons (dialog, height, width, 0); | ||
| 274 | wmove (menu, choice, item_x+1); | ||
| 275 | wrefresh (menu); | ||
| 276 | |||
| 277 | while (key != ESC) { | ||
| 278 | key = wgetch(menu); | ||
| 279 | |||
| 280 | if (key < 256 && isalpha(key)) key = tolower(key); | ||
| 281 | |||
| 282 | if (strchr("ynmh", key)) | ||
| 283 | i = max_choice; | ||
| 284 | else { | ||
| 285 | for (i = choice+1; i < max_choice; i++) { | ||
| 286 | j = first_alpha(items[(scroll+i)*2+1], "YyNnMmHh"); | ||
| 287 | if (key == tolower(items[(scroll+i)*2+1][j])) | ||
| 288 | break; | ||
| 289 | } | ||
| 290 | if (i == max_choice) | ||
| 291 | for (i = 0; i < max_choice; i++) { | ||
| 292 | j = first_alpha(items[(scroll+i)*2+1], "YyNnMmHh"); | ||
| 293 | if (key == tolower(items[(scroll+i)*2+1][j])) | ||
| 294 | break; | ||
| 295 | } | ||
| 296 | } | ||
| 297 | |||
| 298 | if (i < max_choice || | ||
| 299 | key == KEY_UP || key == KEY_DOWN || | ||
| 300 | key == '-' || key == '+' || | ||
| 301 | key == KEY_PPAGE || key == KEY_NPAGE) { | ||
| 302 | |||
| 303 | print_item (menu, items[(scroll+choice)*2+1], choice, FALSE, | ||
| 304 | (items[(scroll+choice)*2][0] != ':')); | ||
| 305 | |||
| 306 | if (key == KEY_UP || key == '-') { | ||
| 307 | if (choice < 2 && scroll) { | ||
| 308 | /* Scroll menu down */ | ||
| 309 | scrollok (menu, TRUE); | ||
| 310 | wscrl (menu, -1); | ||
| 311 | scrollok (menu, FALSE); | ||
| 312 | |||
| 313 | scroll--; | ||
| 314 | |||
| 315 | print_item (menu, items[scroll * 2 + 1], 0, FALSE, | ||
| 316 | (items[scroll*2][0] != ':')); | ||
| 317 | } else | ||
| 318 | choice = MAX(choice - 1, 0); | ||
| 319 | |||
| 320 | } else if (key == KEY_DOWN || key == '+') { | ||
| 321 | |||
| 322 | print_item (menu, items[(scroll+choice)*2+1], choice, FALSE, | ||
| 323 | (items[(scroll+choice)*2][0] != ':')); | ||
| 324 | |||
| 325 | if ((choice > max_choice-3) && | ||
| 326 | (scroll + max_choice < item_no) | ||
| 327 | ) { | ||
| 328 | /* Scroll menu up */ | ||
| 329 | scrollok (menu, TRUE); | ||
| 330 | wscrl (menu, 1); | ||
| 331 | scrollok (menu, FALSE); | ||
| 332 | |||
| 333 | scroll++; | ||
| 334 | |||
| 335 | print_item (menu, items[(scroll+max_choice-1)*2+1], | ||
| 336 | max_choice-1, FALSE, | ||
| 337 | (items[(scroll+max_choice-1)*2][0] != ':')); | ||
| 338 | } else | ||
| 339 | choice = MIN(choice+1, max_choice-1); | ||
| 340 | |||
| 341 | } else if (key == KEY_PPAGE) { | ||
| 342 | scrollok (menu, TRUE); | ||
| 343 | for (i=0; (i < max_choice); i++) { | ||
| 344 | if (scroll > 0) { | ||
| 345 | wscrl (menu, -1); | ||
| 346 | scroll--; | ||
| 347 | print_item (menu, items[scroll * 2 + 1], 0, FALSE, | ||
| 348 | (items[scroll*2][0] != ':')); | ||
| 349 | } else { | ||
| 350 | if (choice > 0) | ||
| 351 | choice--; | ||
| 352 | } | ||
| 353 | } | ||
| 354 | scrollok (menu, FALSE); | ||
| 355 | |||
| 356 | } else if (key == KEY_NPAGE) { | ||
| 357 | for (i=0; (i < max_choice); i++) { | ||
| 358 | if (scroll+max_choice < item_no) { | ||
| 359 | scrollok (menu, TRUE); | ||
| 360 | wscrl (menu, 1); | ||
| 361 | scrollok (menu, FALSE); | ||
| 362 | scroll++; | ||
| 363 | print_item (menu, items[(scroll+max_choice-1)*2+1], | ||
| 364 | max_choice-1, FALSE, | ||
| 365 | (items[(scroll+max_choice-1)*2][0] != ':')); | ||
| 366 | } else { | ||
| 367 | if (choice+1 < max_choice) | ||
| 368 | choice++; | ||
| 369 | } | ||
| 370 | } | ||
| 371 | |||
| 372 | } else | ||
| 373 | choice = i; | ||
| 374 | |||
| 375 | print_item (menu, items[(scroll+choice)*2+1], choice, TRUE, | ||
| 376 | (items[(scroll+choice)*2][0] != ':')); | ||
| 377 | |||
| 378 | print_arrows(dialog, item_no, scroll, | ||
| 379 | box_y, box_x+item_x+1, menu_height); | ||
| 380 | |||
| 381 | wnoutrefresh (dialog); | ||
| 382 | wrefresh (menu); | ||
| 383 | |||
| 384 | continue; /* wait for another key press */ | ||
| 385 | } | ||
| 386 | |||
| 387 | switch (key) { | ||
| 388 | case KEY_LEFT: | ||
| 389 | case TAB: | ||
| 390 | case KEY_RIGHT: | ||
| 391 | button = ((key == KEY_LEFT ? --button : ++button) < 0) | ||
| 392 | ? 2 : (button > 2 ? 0 : button); | ||
| 393 | |||
| 394 | print_buttons(dialog, height, width, button); | ||
| 395 | wrefresh (menu); | ||
| 396 | break; | ||
| 397 | case ' ': | ||
| 398 | case 's': | ||
| 399 | case 'y': | ||
| 400 | case 'n': | ||
| 401 | case 'm': | ||
| 402 | case '/': | ||
| 403 | /* save scroll info */ | ||
| 404 | if ( (f=fopen("lxdialog.scrltmp","w")) != NULL ) { | ||
| 405 | fprintf(f,"%d\n",scroll); | ||
| 406 | fclose(f); | ||
| 407 | } | ||
| 408 | delwin (dialog); | ||
| 409 | fprintf(stderr, "%s\n", items[(scroll + choice) * 2]); | ||
| 410 | switch (key) { | ||
| 411 | case 's': return 3; | ||
| 412 | case 'y': return 3; | ||
| 413 | case 'n': return 4; | ||
| 414 | case 'm': return 5; | ||
| 415 | case ' ': return 6; | ||
| 416 | case '/': return 7; | ||
| 417 | } | ||
| 418 | return 0; | ||
| 419 | case 'h': | ||
| 420 | case '?': | ||
| 421 | button = 2; | ||
| 422 | case '\n': | ||
| 423 | delwin (dialog); | ||
| 424 | if (button == 2) | ||
| 425 | fprintf(stderr, "%s \"%s\"\n", | ||
| 426 | items[(scroll + choice) * 2], | ||
| 427 | items[(scroll + choice) * 2 + 1] + | ||
| 428 | first_alpha(items[(scroll + choice) * 2 + 1],"")); | ||
| 429 | else | ||
| 430 | fprintf(stderr, "%s\n", items[(scroll + choice) * 2]); | ||
| 431 | |||
| 432 | remove("lxdialog.scrltmp"); | ||
| 433 | return button; | ||
| 434 | case 'e': | ||
| 435 | case 'x': | ||
| 436 | key = ESC; | ||
| 437 | case ESC: | ||
| 438 | break; | ||
| 439 | } | ||
| 440 | } | ||
| 441 | |||
| 442 | delwin (dialog); | ||
| 443 | remove("lxdialog.scrltmp"); | ||
| 444 | return -1; /* ESC pressed */ | ||
| 445 | } | ||
diff --git a/scripts/lxdialog/msgbox.c b/scripts/lxdialog/msgbox.c deleted file mode 100644 index 93692e1fbcc2..000000000000 --- a/scripts/lxdialog/msgbox.c +++ /dev/null | |||
| @@ -1,85 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * msgbox.c -- implements the message box and info box | ||
| 3 | * | ||
| 4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
| 5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcapw@cfw.com) | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License | ||
| 9 | * as published by the Free Software Foundation; either version 2 | ||
| 10 | * of the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "dialog.h" | ||
| 23 | |||
| 24 | /* | ||
| 25 | * Display a message box. Program will pause and display an "OK" button | ||
| 26 | * if the parameter 'pause' is non-zero. | ||
| 27 | */ | ||
| 28 | int | ||
| 29 | dialog_msgbox (const char *title, const char *prompt, int height, int width, | ||
| 30 | int pause) | ||
| 31 | { | ||
| 32 | int i, x, y, key = 0; | ||
| 33 | WINDOW *dialog; | ||
| 34 | |||
| 35 | /* center dialog box on screen */ | ||
| 36 | x = (COLS - width) / 2; | ||
| 37 | y = (LINES - height) / 2; | ||
| 38 | |||
| 39 | draw_shadow (stdscr, y, x, height, width); | ||
| 40 | |||
| 41 | dialog = newwin (height, width, y, x); | ||
| 42 | keypad (dialog, TRUE); | ||
| 43 | |||
| 44 | draw_box (dialog, 0, 0, height, width, dialog_attr, border_attr); | ||
| 45 | |||
| 46 | if (title != NULL && strlen(title) >= width-2 ) { | ||
| 47 | /* truncate long title -- mec */ | ||
| 48 | char * title2 = malloc(width-2+1); | ||
| 49 | memcpy( title2, title, width-2 ); | ||
| 50 | title2[width-2] = '\0'; | ||
| 51 | title = title2; | ||
| 52 | } | ||
| 53 | |||
| 54 | if (title != NULL) { | ||
| 55 | wattrset (dialog, title_attr); | ||
| 56 | mvwaddch (dialog, 0, (width - strlen(title))/2 - 1, ' '); | ||
| 57 | waddstr (dialog, (char *)title); | ||
| 58 | waddch (dialog, ' '); | ||
| 59 | } | ||
| 60 | wattrset (dialog, dialog_attr); | ||
| 61 | print_autowrap (dialog, prompt, width - 2, 1, 2); | ||
| 62 | |||
| 63 | if (pause) { | ||
| 64 | wattrset (dialog, border_attr); | ||
| 65 | mvwaddch (dialog, height - 3, 0, ACS_LTEE); | ||
| 66 | for (i = 0; i < width - 2; i++) | ||
| 67 | waddch (dialog, ACS_HLINE); | ||
| 68 | wattrset (dialog, dialog_attr); | ||
| 69 | waddch (dialog, ACS_RTEE); | ||
| 70 | |||
| 71 | print_button (dialog, " Ok ", | ||
| 72 | height - 2, width / 2 - 4, TRUE); | ||
| 73 | |||
| 74 | wrefresh (dialog); | ||
| 75 | while (key != ESC && key != '\n' && key != ' ' && | ||
| 76 | key != 'O' && key != 'o' && key != 'X' && key != 'x') | ||
| 77 | key = wgetch (dialog); | ||
| 78 | } else { | ||
| 79 | key = '\n'; | ||
| 80 | wrefresh (dialog); | ||
| 81 | } | ||
| 82 | |||
| 83 | delwin (dialog); | ||
| 84 | return key == ESC ? -1 : 0; | ||
| 85 | } | ||
diff --git a/scripts/lxdialog/textbox.c b/scripts/lxdialog/textbox.c deleted file mode 100644 index ed23df2d096a..000000000000 --- a/scripts/lxdialog/textbox.c +++ /dev/null | |||
| @@ -1,556 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * textbox.c -- implements the text box | ||
| 3 | * | ||
| 4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
| 5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License | ||
| 9 | * as published by the Free Software Foundation; either version 2 | ||
| 10 | * of the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "dialog.h" | ||
| 23 | |||
| 24 | static void back_lines (int n); | ||
| 25 | static void print_page (WINDOW * win, int height, int width); | ||
| 26 | static void print_line (WINDOW * win, int row, int width); | ||
| 27 | static char *get_line (void); | ||
| 28 | static void print_position (WINDOW * win, int height, int width); | ||
| 29 | |||
| 30 | static int hscroll, fd, file_size, bytes_read; | ||
| 31 | static int begin_reached = 1, end_reached, page_length; | ||
| 32 | static char *buf, *page; | ||
| 33 | |||
| 34 | /* | ||
| 35 | * Display text from a file in a dialog box. | ||
| 36 | */ | ||
| 37 | int | ||
| 38 | dialog_textbox (const char *title, const char *file, int height, int width) | ||
| 39 | { | ||
| 40 | int i, x, y, cur_x, cur_y, fpos, key = 0; | ||
| 41 | int passed_end; | ||
| 42 | char search_term[MAX_LEN + 1]; | ||
| 43 | WINDOW *dialog, *text; | ||
| 44 | |||
| 45 | search_term[0] = '\0'; /* no search term entered yet */ | ||
| 46 | |||
| 47 | /* Open input file for reading */ | ||
| 48 | if ((fd = open (file, O_RDONLY)) == -1) { | ||
| 49 | endwin (); | ||
| 50 | fprintf (stderr, | ||
| 51 | "\nCan't open input file in dialog_textbox().\n"); | ||
| 52 | exit (-1); | ||
| 53 | } | ||
| 54 | /* Get file size. Actually, 'file_size' is the real file size - 1, | ||
| 55 | since it's only the last byte offset from the beginning */ | ||
| 56 | if ((file_size = lseek (fd, 0, SEEK_END)) == -1) { | ||
| 57 | endwin (); | ||
| 58 | fprintf (stderr, "\nError getting file size in dialog_textbox().\n"); | ||
| 59 | exit (-1); | ||
| 60 | } | ||
| 61 | /* Restore file pointer to beginning of file after getting file size */ | ||
| 62 | if (lseek (fd, 0, SEEK_SET) == -1) { | ||
| 63 | endwin (); | ||
| 64 | fprintf (stderr, "\nError moving file pointer in dialog_textbox().\n"); | ||
| 65 | exit (-1); | ||
| 66 | } | ||
| 67 | /* Allocate space for read buffer */ | ||
| 68 | if ((buf = malloc (BUF_SIZE + 1)) == NULL) { | ||
| 69 | endwin (); | ||
| 70 | fprintf (stderr, "\nCan't allocate memory in dialog_textbox().\n"); | ||
| 71 | exit (-1); | ||
| 72 | } | ||
| 73 | if ((bytes_read = read (fd, buf, BUF_SIZE)) == -1) { | ||
| 74 | endwin (); | ||
| 75 | fprintf (stderr, "\nError reading file in dialog_textbox().\n"); | ||
| 76 | exit (-1); | ||
| 77 | } | ||
| 78 | buf[bytes_read] = '\0'; /* mark end of valid data */ | ||
| 79 | page = buf; /* page is pointer to start of page to be displayed */ | ||
| 80 | |||
| 81 | /* center dialog box on screen */ | ||
| 82 | x = (COLS - width) / 2; | ||
| 83 | y = (LINES - height) / 2; | ||
| 84 | |||
| 85 | |||
| 86 | draw_shadow (stdscr, y, x, height, width); | ||
| 87 | |||
| 88 | dialog = newwin (height, width, y, x); | ||
| 89 | keypad (dialog, TRUE); | ||
| 90 | |||
| 91 | /* Create window for text region, used for scrolling text */ | ||
| 92 | text = subwin (dialog, height - 4, width - 2, y + 1, x + 1); | ||
| 93 | wattrset (text, dialog_attr); | ||
| 94 | wbkgdset (text, dialog_attr & A_COLOR); | ||
| 95 | |||
| 96 | keypad (text, TRUE); | ||
| 97 | |||
| 98 | /* register the new window, along with its borders */ | ||
| 99 | draw_box (dialog, 0, 0, height, width, dialog_attr, border_attr); | ||
| 100 | |||
| 101 | wattrset (dialog, border_attr); | ||
| 102 | mvwaddch (dialog, height-3, 0, ACS_LTEE); | ||
| 103 | for (i = 0; i < width - 2; i++) | ||
| 104 | waddch (dialog, ACS_HLINE); | ||
| 105 | wattrset (dialog, dialog_attr); | ||
| 106 | wbkgdset (dialog, dialog_attr & A_COLOR); | ||
| 107 | waddch (dialog, ACS_RTEE); | ||
| 108 | |||
| 109 | if (title != NULL && strlen(title) >= width-2 ) { | ||
| 110 | /* truncate long title -- mec */ | ||
| 111 | char * title2 = malloc(width-2+1); | ||
| 112 | memcpy( title2, title, width-2 ); | ||
| 113 | title2[width-2] = '\0'; | ||
| 114 | title = title2; | ||
| 115 | } | ||
| 116 | |||
| 117 | if (title != NULL) { | ||
| 118 | wattrset (dialog, title_attr); | ||
| 119 | mvwaddch (dialog, 0, (width - strlen(title))/2 - 1, ' '); | ||
| 120 | waddstr (dialog, (char *)title); | ||
| 121 | waddch (dialog, ' '); | ||
| 122 | } | ||
| 123 | print_button (dialog, " Exit ", height - 2, width / 2 - 4, TRUE); | ||
| 124 | wnoutrefresh (dialog); | ||
| 125 | getyx (dialog, cur_y, cur_x); /* Save cursor position */ | ||
| 126 | |||
| 127 | /* Print first page of text */ | ||
| 128 | attr_clear (text, height - 4, width - 2, dialog_attr); | ||
| 129 | print_page (text, height - 4, width - 2); | ||
| 130 | print_position (dialog, height, width); | ||
| 131 | wmove (dialog, cur_y, cur_x); /* Restore cursor position */ | ||
| 132 | wrefresh (dialog); | ||
| 133 | |||
| 134 | while ((key != ESC) && (key != '\n')) { | ||
| 135 | key = wgetch (dialog); | ||
| 136 | switch (key) { | ||
| 137 | case 'E': /* Exit */ | ||
| 138 | case 'e': | ||
| 139 | case 'X': | ||
| 140 | case 'x': | ||
| 141 | delwin (dialog); | ||
| 142 | free (buf); | ||
| 143 | close (fd); | ||
| 144 | return 0; | ||
| 145 | case 'g': /* First page */ | ||
| 146 | case KEY_HOME: | ||
| 147 | if (!begin_reached) { | ||
| 148 | begin_reached = 1; | ||
| 149 | /* First page not in buffer? */ | ||
| 150 | if ((fpos = lseek (fd, 0, SEEK_CUR)) == -1) { | ||
| 151 | endwin (); | ||
| 152 | fprintf (stderr, | ||
| 153 | "\nError moving file pointer in dialog_textbox().\n"); | ||
| 154 | exit (-1); | ||
| 155 | } | ||
| 156 | if (fpos > bytes_read) { /* Yes, we have to read it in */ | ||
| 157 | if (lseek (fd, 0, SEEK_SET) == -1) { | ||
| 158 | endwin (); | ||
| 159 | fprintf (stderr, "\nError moving file pointer in " | ||
| 160 | "dialog_textbox().\n"); | ||
| 161 | exit (-1); | ||
| 162 | } | ||
| 163 | if ((bytes_read = read (fd, buf, BUF_SIZE)) == -1) { | ||
| 164 | endwin (); | ||
| 165 | fprintf (stderr, | ||
| 166 | "\nError reading file in dialog_textbox().\n"); | ||
| 167 | exit (-1); | ||
| 168 | } | ||
| 169 | buf[bytes_read] = '\0'; | ||
| 170 | } | ||
| 171 | page = buf; | ||
| 172 | print_page (text, height - 4, width - 2); | ||
| 173 | print_position (dialog, height, width); | ||
| 174 | wmove (dialog, cur_y, cur_x); /* Restore cursor position */ | ||
| 175 | wrefresh (dialog); | ||
| 176 | } | ||
| 177 | break; | ||
| 178 | case 'G': /* Last page */ | ||
| 179 | case KEY_END: | ||
| 180 | |||
| 181 | end_reached = 1; | ||
| 182 | /* Last page not in buffer? */ | ||
| 183 | if ((fpos = lseek (fd, 0, SEEK_CUR)) == -1) { | ||
| 184 | endwin (); | ||
| 185 | fprintf (stderr, | ||
| 186 | "\nError moving file pointer in dialog_textbox().\n"); | ||
| 187 | exit (-1); | ||
| 188 | } | ||
| 189 | if (fpos < file_size) { /* Yes, we have to read it in */ | ||
| 190 | if (lseek (fd, -BUF_SIZE, SEEK_END) == -1) { | ||
| 191 | endwin (); | ||
| 192 | fprintf (stderr, | ||
| 193 | "\nError moving file pointer in dialog_textbox().\n"); | ||
| 194 | exit (-1); | ||
| 195 | } | ||
| 196 | if ((bytes_read = read (fd, buf, BUF_SIZE)) == -1) { | ||
| 197 | endwin (); | ||
| 198 | fprintf (stderr, | ||
| 199 | "\nError reading file in dialog_textbox().\n"); | ||
| 200 | exit (-1); | ||
| 201 | } | ||
| 202 | buf[bytes_read] = '\0'; | ||
| 203 | } | ||
| 204 | page = buf + bytes_read; | ||
| 205 | back_lines (height - 4); | ||
| 206 | print_page (text, height - 4, width - 2); | ||
| 207 | print_position (dialog, height, width); | ||
| 208 | wmove (dialog, cur_y, cur_x); /* Restore cursor position */ | ||
| 209 | wrefresh (dialog); | ||
| 210 | break; | ||
| 211 | case 'K': /* Previous line */ | ||
| 212 | case 'k': | ||
| 213 | case KEY_UP: | ||
| 214 | if (!begin_reached) { | ||
| 215 | back_lines (page_length + 1); | ||
| 216 | |||
| 217 | /* We don't call print_page() here but use scrolling to ensure | ||
| 218 | faster screen update. However, 'end_reached' and | ||
| 219 | 'page_length' should still be updated, and 'page' should | ||
| 220 | point to start of next page. This is done by calling | ||
| 221 | get_line() in the following 'for' loop. */ | ||
| 222 | scrollok (text, TRUE); | ||
| 223 | wscrl (text, -1); /* Scroll text region down one line */ | ||
| 224 | scrollok (text, FALSE); | ||
| 225 | page_length = 0; | ||
| 226 | passed_end = 0; | ||
| 227 | for (i = 0; i < height - 4; i++) { | ||
| 228 | if (!i) { | ||
| 229 | /* print first line of page */ | ||
| 230 | print_line (text, 0, width - 2); | ||
| 231 | wnoutrefresh (text); | ||
| 232 | } else | ||
| 233 | /* Called to update 'end_reached' and 'page' */ | ||
| 234 | get_line (); | ||
| 235 | if (!passed_end) | ||
| 236 | page_length++; | ||
| 237 | if (end_reached && !passed_end) | ||
| 238 | passed_end = 1; | ||
| 239 | } | ||
| 240 | |||
| 241 | print_position (dialog, height, width); | ||
| 242 | wmove (dialog, cur_y, cur_x); /* Restore cursor position */ | ||
| 243 | wrefresh (dialog); | ||
| 244 | } | ||
| 245 | break; | ||
| 246 | case 'B': /* Previous page */ | ||
| 247 | case 'b': | ||
| 248 | case KEY_PPAGE: | ||
| 249 | if (begin_reached) | ||
| 250 | break; | ||
| 251 | back_lines (page_length + height - 4); | ||
| 252 | print_page (text, height - 4, width - 2); | ||
| 253 | print_position (dialog, height, width); | ||
| 254 | wmove (dialog, cur_y, cur_x); | ||
| 255 | wrefresh (dialog); | ||
| 256 | break; | ||
| 257 | case 'J': /* Next line */ | ||
| 258 | case 'j': | ||
| 259 | case KEY_DOWN: | ||
| 260 | if (!end_reached) { | ||
| 261 | begin_reached = 0; | ||
| 262 | scrollok (text, TRUE); | ||
| 263 | scroll (text); /* Scroll text region up one line */ | ||
| 264 | scrollok (text, FALSE); | ||
| 265 | print_line (text, height - 5, width - 2); | ||
| 266 | wnoutrefresh (text); | ||
| 267 | print_position (dialog, height, width); | ||
| 268 | wmove (dialog, cur_y, cur_x); /* Restore cursor position */ | ||
| 269 | wrefresh (dialog); | ||
| 270 | } | ||
| 271 | break; | ||
| 272 | case KEY_NPAGE: /* Next page */ | ||
| 273 | case ' ': | ||
| 274 | if (end_reached) | ||
| 275 | break; | ||
| 276 | |||
| 277 | begin_reached = 0; | ||
| 278 | print_page (text, height - 4, width - 2); | ||
| 279 | print_position (dialog, height, width); | ||
| 280 | wmove (dialog, cur_y, cur_x); | ||
| 281 | wrefresh (dialog); | ||
| 282 | break; | ||
| 283 | case '0': /* Beginning of line */ | ||
| 284 | case 'H': /* Scroll left */ | ||
| 285 | case 'h': | ||
| 286 | case KEY_LEFT: | ||
| 287 | if (hscroll <= 0) | ||
| 288 | break; | ||
| 289 | |||
| 290 | if (key == '0') | ||
| 291 | hscroll = 0; | ||
| 292 | else | ||
| 293 | hscroll--; | ||
| 294 | /* Reprint current page to scroll horizontally */ | ||
| 295 | back_lines (page_length); | ||
| 296 | print_page (text, height - 4, width - 2); | ||
| 297 | wmove (dialog, cur_y, cur_x); | ||
| 298 | wrefresh (dialog); | ||
| 299 | break; | ||
| 300 | case 'L': /* Scroll right */ | ||
| 301 | case 'l': | ||
| 302 | case KEY_RIGHT: | ||
| 303 | if (hscroll >= MAX_LEN) | ||
| 304 | break; | ||
| 305 | hscroll++; | ||
| 306 | /* Reprint current page to scroll horizontally */ | ||
| 307 | back_lines (page_length); | ||
| 308 | print_page (text, height - 4, width - 2); | ||
| 309 | wmove (dialog, cur_y, cur_x); | ||
| 310 | wrefresh (dialog); | ||
| 311 | break; | ||
| 312 | case ESC: | ||
| 313 | break; | ||
| 314 | } | ||
| 315 | } | ||
| 316 | |||
| 317 | delwin (dialog); | ||
| 318 | free (buf); | ||
| 319 | close (fd); | ||
| 320 | return -1; /* ESC pressed */ | ||
| 321 | } | ||
| 322 | |||
| 323 | /* | ||
| 324 | * Go back 'n' lines in text file. Called by dialog_textbox(). | ||
| 325 | * 'page' will be updated to point to the desired line in 'buf'. | ||
| 326 | */ | ||
| 327 | static void | ||
| 328 | back_lines (int n) | ||
| 329 | { | ||
| 330 | int i, fpos; | ||
| 331 | |||
| 332 | begin_reached = 0; | ||
| 333 | /* We have to distinguish between end_reached and !end_reached | ||
| 334 | since at end of file, the line is not ended by a '\n'. | ||
| 335 | The code inside 'if' basically does a '--page' to move one | ||
| 336 | character backward so as to skip '\n' of the previous line */ | ||
| 337 | if (!end_reached) { | ||
| 338 | /* Either beginning of buffer or beginning of file reached? */ | ||
| 339 | if (page == buf) { | ||
| 340 | if ((fpos = lseek (fd, 0, SEEK_CUR)) == -1) { | ||
| 341 | endwin (); | ||
| 342 | fprintf (stderr, "\nError moving file pointer in " | ||
| 343 | "back_lines().\n"); | ||
| 344 | exit (-1); | ||
| 345 | } | ||
| 346 | if (fpos > bytes_read) { /* Not beginning of file yet */ | ||
| 347 | /* We've reached beginning of buffer, but not beginning of | ||
| 348 | file yet, so read previous part of file into buffer. | ||
| 349 | Note that we only move backward for BUF_SIZE/2 bytes, | ||
| 350 | but not BUF_SIZE bytes to avoid re-reading again in | ||
| 351 | print_page() later */ | ||
| 352 | /* Really possible to move backward BUF_SIZE/2 bytes? */ | ||
| 353 | if (fpos < BUF_SIZE / 2 + bytes_read) { | ||
| 354 | /* No, move less then */ | ||
| 355 | if (lseek (fd, 0, SEEK_SET) == -1) { | ||
| 356 | endwin (); | ||
| 357 | fprintf (stderr, "\nError moving file pointer in " | ||
| 358 | "back_lines().\n"); | ||
| 359 | exit (-1); | ||
| 360 | } | ||
| 361 | page = buf + fpos - bytes_read; | ||
| 362 | } else { /* Move backward BUF_SIZE/2 bytes */ | ||
| 363 | if (lseek (fd, -(BUF_SIZE / 2 + bytes_read), SEEK_CUR) | ||
| 364 | == -1) { | ||
| 365 | endwin (); | ||
| 366 | fprintf (stderr, "\nError moving file pointer " | ||
| 367 | "in back_lines().\n"); | ||
| 368 | exit (-1); | ||
| 369 | } | ||
| 370 | page = buf + BUF_SIZE / 2; | ||
| 371 | } | ||
| 372 | if ((bytes_read = read (fd, buf, BUF_SIZE)) == -1) { | ||
| 373 | endwin (); | ||
| 374 | fprintf (stderr, "\nError reading file in back_lines().\n"); | ||
| 375 | exit (-1); | ||
| 376 | } | ||
| 377 | buf[bytes_read] = '\0'; | ||
| 378 | } else { /* Beginning of file reached */ | ||
| 379 | begin_reached = 1; | ||
| 380 | return; | ||
| 381 | } | ||
| 382 | } | ||
| 383 | if (*(--page) != '\n') { /* '--page' here */ | ||
| 384 | /* Something's wrong... */ | ||
| 385 | endwin (); | ||
| 386 | fprintf (stderr, "\nInternal error in back_lines().\n"); | ||
| 387 | exit (-1); | ||
| 388 | } | ||
| 389 | } | ||
| 390 | /* Go back 'n' lines */ | ||
| 391 | for (i = 0; i < n; i++) | ||
| 392 | do { | ||
| 393 | if (page == buf) { | ||
| 394 | if ((fpos = lseek (fd, 0, SEEK_CUR)) == -1) { | ||
| 395 | endwin (); | ||
| 396 | fprintf (stderr, | ||
| 397 | "\nError moving file pointer in back_lines().\n"); | ||
| 398 | exit (-1); | ||
| 399 | } | ||
| 400 | if (fpos > bytes_read) { | ||
| 401 | /* Really possible to move backward BUF_SIZE/2 bytes? */ | ||
| 402 | if (fpos < BUF_SIZE / 2 + bytes_read) { | ||
| 403 | /* No, move less then */ | ||
| 404 | if (lseek (fd, 0, SEEK_SET) == -1) { | ||
| 405 | endwin (); | ||
| 406 | fprintf (stderr, "\nError moving file pointer " | ||
| 407 | "in back_lines().\n"); | ||
| 408 | exit (-1); | ||
| 409 | } | ||
| 410 | page = buf + fpos - bytes_read; | ||
| 411 | } else { /* Move backward BUF_SIZE/2 bytes */ | ||
| 412 | if (lseek (fd, -(BUF_SIZE / 2 + bytes_read), | ||
| 413 | SEEK_CUR) == -1) { | ||
| 414 | endwin (); | ||
| 415 | fprintf (stderr, "\nError moving file pointer" | ||
| 416 | " in back_lines().\n"); | ||
| 417 | exit (-1); | ||
| 418 | } | ||
| 419 | page = buf + BUF_SIZE / 2; | ||
| 420 | } | ||
| 421 | if ((bytes_read = read (fd, buf, BUF_SIZE)) == -1) { | ||
| 422 | endwin (); | ||
| 423 | fprintf (stderr, "\nError reading file in " | ||
| 424 | "back_lines().\n"); | ||
| 425 | exit (-1); | ||
| 426 | } | ||
| 427 | buf[bytes_read] = '\0'; | ||
| 428 | } else { /* Beginning of file reached */ | ||
| 429 | begin_reached = 1; | ||
| 430 | return; | ||
| 431 | } | ||
| 432 | } | ||
| 433 | } while (*(--page) != '\n'); | ||
| 434 | page++; | ||
| 435 | } | ||
| 436 | |||
| 437 | /* | ||
| 438 | * Print a new page of text. Called by dialog_textbox(). | ||
| 439 | */ | ||
| 440 | static void | ||
| 441 | print_page (WINDOW * win, int height, int width) | ||
| 442 | { | ||
| 443 | int i, passed_end = 0; | ||
| 444 | |||
| 445 | page_length = 0; | ||
| 446 | for (i = 0; i < height; i++) { | ||
| 447 | print_line (win, i, width); | ||
| 448 | if (!passed_end) | ||
| 449 | page_length++; | ||
| 450 | if (end_reached && !passed_end) | ||
| 451 | passed_end = 1; | ||
| 452 | } | ||
| 453 | wnoutrefresh (win); | ||
| 454 | } | ||
| 455 | |||
| 456 | /* | ||
| 457 | * Print a new line of text. Called by dialog_textbox() and print_page(). | ||
| 458 | */ | ||
| 459 | static void | ||
| 460 | print_line (WINDOW * win, int row, int width) | ||
| 461 | { | ||
| 462 | int y, x; | ||
| 463 | char *line; | ||
| 464 | |||
| 465 | line = get_line (); | ||
| 466 | line += MIN (strlen (line), hscroll); /* Scroll horizontally */ | ||
| 467 | wmove (win, row, 0); /* move cursor to correct line */ | ||
| 468 | waddch (win, ' '); | ||
| 469 | waddnstr (win, line, MIN (strlen (line), width - 2)); | ||
| 470 | |||
| 471 | getyx (win, y, x); | ||
| 472 | /* Clear 'residue' of previous line */ | ||
| 473 | #if OLD_NCURSES | ||
| 474 | { | ||
| 475 | int i; | ||
| 476 | for (i = 0; i < width - x; i++) | ||
| 477 | waddch (win, ' '); | ||
| 478 | } | ||
| 479 | #else | ||
| 480 | wclrtoeol(win); | ||
| 481 | #endif | ||
| 482 | } | ||
| 483 | |||
| 484 | /* | ||
| 485 | * Return current line of text. Called by dialog_textbox() and print_line(). | ||
| 486 | * 'page' should point to start of current line before calling, and will be | ||
| 487 | * updated to point to start of next line. | ||
| 488 | */ | ||
| 489 | static char * | ||
| 490 | get_line (void) | ||
| 491 | { | ||
| 492 | int i = 0, fpos; | ||
| 493 | static char line[MAX_LEN + 1]; | ||
| 494 | |||
| 495 | end_reached = 0; | ||
| 496 | while (*page != '\n') { | ||
| 497 | if (*page == '\0') { | ||
| 498 | /* Either end of file or end of buffer reached */ | ||
| 499 | if ((fpos = lseek (fd, 0, SEEK_CUR)) == -1) { | ||
| 500 | endwin (); | ||
| 501 | fprintf (stderr, "\nError moving file pointer in " | ||
| 502 | "get_line().\n"); | ||
| 503 | exit (-1); | ||
| 504 | } | ||
| 505 | if (fpos < file_size) { /* Not end of file yet */ | ||
| 506 | /* We've reached end of buffer, but not end of file yet, | ||
| 507 | so read next part of file into buffer */ | ||
| 508 | if ((bytes_read = read (fd, buf, BUF_SIZE)) == -1) { | ||
| 509 | endwin (); | ||
| 510 | fprintf (stderr, "\nError reading file in get_line().\n"); | ||
| 511 | exit (-1); | ||
| 512 | } | ||
| 513 | buf[bytes_read] = '\0'; | ||
| 514 | page = buf; | ||
| 515 | } else { | ||
| 516 | if (!end_reached) | ||
| 517 | end_reached = 1; | ||
| 518 | break; | ||
| 519 | } | ||
| 520 | } else if (i < MAX_LEN) | ||
| 521 | line[i++] = *(page++); | ||
| 522 | else { | ||
| 523 | /* Truncate lines longer than MAX_LEN characters */ | ||
| 524 | if (i == MAX_LEN) | ||
| 525 | line[i++] = '\0'; | ||
| 526 | page++; | ||
| 527 | } | ||
| 528 | } | ||
| 529 | if (i <= MAX_LEN) | ||
| 530 | line[i] = '\0'; | ||
| 531 | if (!end_reached) | ||
| 532 | page++; /* move pass '\n' */ | ||
| 533 | |||
| 534 | return line; | ||
| 535 | } | ||
| 536 | |||
| 537 | /* | ||
| 538 | * Print current position | ||
| 539 | */ | ||
| 540 | static void | ||
| 541 | print_position (WINDOW * win, int height, int width) | ||
| 542 | { | ||
| 543 | int fpos, percent; | ||
| 544 | |||
| 545 | if ((fpos = lseek (fd, 0, SEEK_CUR)) == -1) { | ||
| 546 | endwin (); | ||
| 547 | fprintf (stderr, "\nError moving file pointer in print_position().\n"); | ||
| 548 | exit (-1); | ||
| 549 | } | ||
| 550 | wattrset (win, position_indicator_attr); | ||
| 551 | wbkgdset (win, position_indicator_attr & A_COLOR); | ||
| 552 | percent = !file_size ? | ||
| 553 | 100 : ((fpos - bytes_read + page - buf) * 100) / file_size; | ||
| 554 | wmove (win, height - 3, width - 9); | ||
| 555 | wprintw (win, "(%3d%%)", percent); | ||
| 556 | } | ||
diff --git a/scripts/lxdialog/util.c b/scripts/lxdialog/util.c deleted file mode 100644 index e7bce9be69c3..000000000000 --- a/scripts/lxdialog/util.c +++ /dev/null | |||
| @@ -1,359 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * util.c | ||
| 3 | * | ||
| 4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
| 5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License | ||
| 9 | * as published by the Free Software Foundation; either version 2 | ||
| 10 | * of the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "dialog.h" | ||
| 23 | |||
| 24 | |||
| 25 | /* use colors by default? */ | ||
| 26 | bool use_colors = 1; | ||
| 27 | |||
| 28 | const char *backtitle = NULL; | ||
| 29 | |||
| 30 | const char *dialog_result; | ||
| 31 | |||
| 32 | /* | ||
| 33 | * Attribute values, default is for mono display | ||
| 34 | */ | ||
| 35 | chtype attributes[] = | ||
| 36 | { | ||
| 37 | A_NORMAL, /* screen_attr */ | ||
| 38 | A_NORMAL, /* shadow_attr */ | ||
| 39 | A_NORMAL, /* dialog_attr */ | ||
| 40 | A_BOLD, /* title_attr */ | ||
| 41 | A_NORMAL, /* border_attr */ | ||
| 42 | A_REVERSE, /* button_active_attr */ | ||
| 43 | A_DIM, /* button_inactive_attr */ | ||
| 44 | A_REVERSE, /* button_key_active_attr */ | ||
| 45 | A_BOLD, /* button_key_inactive_attr */ | ||
| 46 | A_REVERSE, /* button_label_active_attr */ | ||
| 47 | A_NORMAL, /* button_label_inactive_attr */ | ||
| 48 | A_NORMAL, /* inputbox_attr */ | ||
| 49 | A_NORMAL, /* inputbox_border_attr */ | ||
| 50 | A_NORMAL, /* searchbox_attr */ | ||
| 51 | A_BOLD, /* searchbox_title_attr */ | ||
| 52 | A_NORMAL, /* searchbox_border_attr */ | ||
| 53 | A_BOLD, /* position_indicator_attr */ | ||
| 54 | A_NORMAL, /* menubox_attr */ | ||
| 55 | A_NORMAL, /* menubox_border_attr */ | ||
| 56 | A_NORMAL, /* item_attr */ | ||
| 57 | A_REVERSE, /* item_selected_attr */ | ||
| 58 | A_BOLD, /* tag_attr */ | ||
| 59 | A_REVERSE, /* tag_selected_attr */ | ||
| 60 | A_BOLD, /* tag_key_attr */ | ||
| 61 | A_REVERSE, /* tag_key_selected_attr */ | ||
| 62 | A_BOLD, /* check_attr */ | ||
| 63 | A_REVERSE, /* check_selected_attr */ | ||
| 64 | A_BOLD, /* uarrow_attr */ | ||
| 65 | A_BOLD /* darrow_attr */ | ||
| 66 | }; | ||
| 67 | |||
| 68 | |||
| 69 | #include "colors.h" | ||
| 70 | |||
| 71 | /* | ||
| 72 | * Table of color values | ||
| 73 | */ | ||
| 74 | int color_table[][3] = | ||
| 75 | { | ||
| 76 | {SCREEN_FG, SCREEN_BG, SCREEN_HL}, | ||
| 77 | {SHADOW_FG, SHADOW_BG, SHADOW_HL}, | ||
| 78 | {DIALOG_FG, DIALOG_BG, DIALOG_HL}, | ||
| 79 | {TITLE_FG, TITLE_BG, TITLE_HL}, | ||
| 80 | {BORDER_FG, BORDER_BG, BORDER_HL}, | ||
| 81 | {BUTTON_ACTIVE_FG, BUTTON_ACTIVE_BG, BUTTON_ACTIVE_HL}, | ||
| 82 | {BUTTON_INACTIVE_FG, BUTTON_INACTIVE_BG, BUTTON_INACTIVE_HL}, | ||
| 83 | {BUTTON_KEY_ACTIVE_FG, BUTTON_KEY_ACTIVE_BG, BUTTON_KEY_ACTIVE_HL}, | ||
| 84 | {BUTTON_KEY_INACTIVE_FG, BUTTON_KEY_INACTIVE_BG, BUTTON_KEY_INACTIVE_HL}, | ||
| 85 | {BUTTON_LABEL_ACTIVE_FG, BUTTON_LABEL_ACTIVE_BG, BUTTON_LABEL_ACTIVE_HL}, | ||
| 86 | {BUTTON_LABEL_INACTIVE_FG, BUTTON_LABEL_INACTIVE_BG, | ||
| 87 | BUTTON_LABEL_INACTIVE_HL}, | ||
| 88 | {INPUTBOX_FG, INPUTBOX_BG, INPUTBOX_HL}, | ||
| 89 | {INPUTBOX_BORDER_FG, INPUTBOX_BORDER_BG, INPUTBOX_BORDER_HL}, | ||
| 90 | {SEARCHBOX_FG, SEARCHBOX_BG, SEARCHBOX_HL}, | ||
| 91 | {SEARCHBOX_TITLE_FG, SEARCHBOX_TITLE_BG, SEARCHBOX_TITLE_HL}, | ||
| 92 | {SEARCHBOX_BORDER_FG, SEARCHBOX_BORDER_BG, SEARCHBOX_BORDER_HL}, | ||
| 93 | {POSITION_INDICATOR_FG, POSITION_INDICATOR_BG, POSITION_INDICATOR_HL}, | ||
| 94 | {MENUBOX_FG, MENUBOX_BG, MENUBOX_HL}, | ||
| 95 | {MENUBOX_BORDER_FG, MENUBOX_BORDER_BG, MENUBOX_BORDER_HL}, | ||
| 96 | {ITEM_FG, ITEM_BG, ITEM_HL}, | ||
| 97 | {ITEM_SELECTED_FG, ITEM_SELECTED_BG, ITEM_SELECTED_HL}, | ||
| 98 | {TAG_FG, TAG_BG, TAG_HL}, | ||
| 99 | {TAG_SELECTED_FG, TAG_SELECTED_BG, TAG_SELECTED_HL}, | ||
| 100 | {TAG_KEY_FG, TAG_KEY_BG, TAG_KEY_HL}, | ||
| 101 | {TAG_KEY_SELECTED_FG, TAG_KEY_SELECTED_BG, TAG_KEY_SELECTED_HL}, | ||
| 102 | {CHECK_FG, CHECK_BG, CHECK_HL}, | ||
| 103 | {CHECK_SELECTED_FG, CHECK_SELECTED_BG, CHECK_SELECTED_HL}, | ||
| 104 | {UARROW_FG, UARROW_BG, UARROW_HL}, | ||
| 105 | {DARROW_FG, DARROW_BG, DARROW_HL}, | ||
| 106 | }; /* color_table */ | ||
| 107 | |||
| 108 | /* | ||
| 109 | * Set window to attribute 'attr' | ||
| 110 | */ | ||
| 111 | void | ||
| 112 | attr_clear (WINDOW * win, int height, int width, chtype attr) | ||
| 113 | { | ||
| 114 | int i, j; | ||
| 115 | |||
| 116 | wattrset (win, attr); | ||
| 117 | for (i = 0; i < height; i++) { | ||
| 118 | wmove (win, i, 0); | ||
| 119 | for (j = 0; j < width; j++) | ||
| 120 | waddch (win, ' '); | ||
| 121 | } | ||
| 122 | touchwin (win); | ||
| 123 | } | ||
| 124 | |||
| 125 | void dialog_clear (void) | ||
| 126 | { | ||
| 127 | attr_clear (stdscr, LINES, COLS, screen_attr); | ||
| 128 | /* Display background title if it exists ... - SLH */ | ||
| 129 | if (backtitle != NULL) { | ||
| 130 | int i; | ||
| 131 | |||
| 132 | wattrset (stdscr, screen_attr); | ||
| 133 | mvwaddstr (stdscr, 0, 1, (char *)backtitle); | ||
| 134 | wmove (stdscr, 1, 1); | ||
| 135 | for (i = 1; i < COLS - 1; i++) | ||
| 136 | waddch (stdscr, ACS_HLINE); | ||
| 137 | } | ||
| 138 | wnoutrefresh (stdscr); | ||
| 139 | } | ||
| 140 | |||
| 141 | /* | ||
| 142 | * Do some initialization for dialog | ||
| 143 | */ | ||
| 144 | void | ||
| 145 | init_dialog (void) | ||
| 146 | { | ||
| 147 | initscr (); /* Init curses */ | ||
| 148 | keypad (stdscr, TRUE); | ||
| 149 | cbreak (); | ||
| 150 | noecho (); | ||
| 151 | |||
| 152 | |||
| 153 | if (use_colors) /* Set up colors */ | ||
| 154 | color_setup (); | ||
| 155 | |||
| 156 | |||
| 157 | dialog_clear (); | ||
| 158 | } | ||
| 159 | |||
| 160 | /* | ||
| 161 | * Setup for color display | ||
| 162 | */ | ||
| 163 | void | ||
| 164 | color_setup (void) | ||
| 165 | { | ||
| 166 | int i; | ||
| 167 | |||
| 168 | if (has_colors ()) { /* Terminal supports color? */ | ||
| 169 | start_color (); | ||
| 170 | |||
| 171 | /* Initialize color pairs */ | ||
| 172 | for (i = 0; i < ATTRIBUTE_COUNT; i++) | ||
| 173 | init_pair (i + 1, color_table[i][0], color_table[i][1]); | ||
| 174 | |||
| 175 | /* Setup color attributes */ | ||
| 176 | for (i = 0; i < ATTRIBUTE_COUNT; i++) | ||
| 177 | attributes[i] = C_ATTR (color_table[i][2], i + 1); | ||
| 178 | } | ||
| 179 | } | ||
| 180 | |||
| 181 | /* | ||
| 182 | * End using dialog functions. | ||
| 183 | */ | ||
| 184 | void | ||
| 185 | end_dialog (void) | ||
| 186 | { | ||
| 187 | endwin (); | ||
| 188 | } | ||
| 189 | |||
| 190 | |||
| 191 | /* | ||
| 192 | * Print a string of text in a window, automatically wrap around to the | ||
| 193 | * next line if the string is too long to fit on one line. Newline | ||
| 194 | * characters '\n' are replaced by spaces. We start on a new line | ||
| 195 | * if there is no room for at least 4 nonblanks following a double-space. | ||
| 196 | */ | ||
| 197 | void | ||
| 198 | print_autowrap (WINDOW * win, const char *prompt, int width, int y, int x) | ||
| 199 | { | ||
| 200 | int newl, cur_x, cur_y; | ||
| 201 | int i, prompt_len, room, wlen; | ||
| 202 | char tempstr[MAX_LEN + 1], *word, *sp, *sp2; | ||
| 203 | |||
| 204 | strcpy (tempstr, prompt); | ||
| 205 | |||
| 206 | prompt_len = strlen(tempstr); | ||
| 207 | |||
| 208 | /* | ||
| 209 | * Remove newlines | ||
| 210 | */ | ||
| 211 | for(i=0; i<prompt_len; i++) { | ||
| 212 | if(tempstr[i] == '\n') tempstr[i] = ' '; | ||
| 213 | } | ||
| 214 | |||
| 215 | if (prompt_len <= width - x * 2) { /* If prompt is short */ | ||
| 216 | wmove (win, y, (width - prompt_len) / 2); | ||
| 217 | waddstr (win, tempstr); | ||
| 218 | } else { | ||
| 219 | cur_x = x; | ||
| 220 | cur_y = y; | ||
| 221 | newl = 1; | ||
| 222 | word = tempstr; | ||
| 223 | while (word && *word) { | ||
| 224 | sp = index(word, ' '); | ||
| 225 | if (sp) | ||
| 226 | *sp++ = 0; | ||
| 227 | |||
| 228 | /* Wrap to next line if either the word does not fit, | ||
| 229 | or it is the first word of a new sentence, and it is | ||
| 230 | short, and the next word does not fit. */ | ||
| 231 | room = width - cur_x; | ||
| 232 | wlen = strlen(word); | ||
| 233 | if (wlen > room || | ||
| 234 | (newl && wlen < 4 && sp && wlen+1+strlen(sp) > room | ||
| 235 | && (!(sp2 = index(sp, ' ')) || wlen+1+(sp2-sp) > room))) { | ||
| 236 | cur_y++; | ||
| 237 | cur_x = x; | ||
| 238 | } | ||
| 239 | wmove (win, cur_y, cur_x); | ||
| 240 | waddstr (win, word); | ||
| 241 | getyx (win, cur_y, cur_x); | ||
| 242 | cur_x++; | ||
| 243 | if (sp && *sp == ' ') { | ||
| 244 | cur_x++; /* double space */ | ||
| 245 | while (*++sp == ' '); | ||
| 246 | newl = 1; | ||
| 247 | } else | ||
| 248 | newl = 0; | ||
| 249 | word = sp; | ||
| 250 | } | ||
| 251 | } | ||
| 252 | } | ||
| 253 | |||
| 254 | /* | ||
| 255 | * Print a button | ||
| 256 | */ | ||
| 257 | void | ||
| 258 | print_button (WINDOW * win, const char *label, int y, int x, int selected) | ||
| 259 | { | ||
| 260 | int i, temp; | ||
| 261 | |||
| 262 | wmove (win, y, x); | ||
| 263 | wattrset (win, selected ? button_active_attr : button_inactive_attr); | ||
| 264 | waddstr (win, "<"); | ||
| 265 | temp = strspn (label, " "); | ||
| 266 | label += temp; | ||
| 267 | wattrset (win, selected ? button_label_active_attr | ||
| 268 | : button_label_inactive_attr); | ||
| 269 | for (i = 0; i < temp; i++) | ||
| 270 | waddch (win, ' '); | ||
| 271 | wattrset (win, selected ? button_key_active_attr | ||
| 272 | : button_key_inactive_attr); | ||
| 273 | waddch (win, label[0]); | ||
| 274 | wattrset (win, selected ? button_label_active_attr | ||
| 275 | : button_label_inactive_attr); | ||
| 276 | waddstr (win, (char *)label + 1); | ||
| 277 | wattrset (win, selected ? button_active_attr : button_inactive_attr); | ||
| 278 | waddstr (win, ">"); | ||
| 279 | wmove (win, y, x + temp + 1); | ||
| 280 | } | ||
| 281 | |||
| 282 | /* | ||
| 283 | * Draw a rectangular box with line drawing characters | ||
| 284 | */ | ||
| 285 | void | ||
| 286 | draw_box (WINDOW * win, int y, int x, int height, int width, | ||
| 287 | chtype box, chtype border) | ||
| 288 | { | ||
| 289 | int i, j; | ||
| 290 | |||
| 291 | wattrset (win, 0); | ||
| 292 | for (i = 0; i < height; i++) { | ||
| 293 | wmove (win, y + i, x); | ||
| 294 | for (j = 0; j < width; j++) | ||
| 295 | if (!i && !j) | ||
| 296 | waddch (win, border | ACS_ULCORNER); | ||
| 297 | else if (i == height - 1 && !j) | ||
| 298 | waddch (win, border | ACS_LLCORNER); | ||
| 299 | else if (!i && j == width - 1) | ||
| 300 | waddch (win, box | ACS_URCORNER); | ||
| 301 | else if (i == height - 1 && j == width - 1) | ||
| 302 | waddch (win, box | ACS_LRCORNER); | ||
| 303 | else if (!i) | ||
| 304 | waddch (win, border | ACS_HLINE); | ||
| 305 | else if (i == height - 1) | ||
| 306 | waddch (win, box | ACS_HLINE); | ||
| 307 | else if (!j) | ||
| 308 | waddch (win, border | ACS_VLINE); | ||
| 309 | else if (j == width - 1) | ||
| 310 | waddch (win, box | ACS_VLINE); | ||
| 311 | else | ||
| 312 | waddch (win, box | ' '); | ||
| 313 | } | ||
| 314 | } | ||
| 315 | |||
| 316 | /* | ||
| 317 | * Draw shadows along the right and bottom edge to give a more 3D look | ||
| 318 | * to the boxes | ||
| 319 | */ | ||
| 320 | void | ||
| 321 | draw_shadow (WINDOW * win, int y, int x, int height, int width) | ||
| 322 | { | ||
| 323 | int i; | ||
| 324 | |||
| 325 | if (has_colors ()) { /* Whether terminal supports color? */ | ||
| 326 | wattrset (win, shadow_attr); | ||
| 327 | wmove (win, y + height, x + 2); | ||
| 328 | for (i = 0; i < width; i++) | ||
| 329 | waddch (win, winch (win) & A_CHARTEXT); | ||
| 330 | for (i = y + 1; i < y + height + 1; i++) { | ||
| 331 | wmove (win, i, x + width); | ||
| 332 | waddch (win, winch (win) & A_CHARTEXT); | ||
| 333 | waddch (win, winch (win) & A_CHARTEXT); | ||
| 334 | } | ||
| 335 | wnoutrefresh (win); | ||
| 336 | } | ||
| 337 | } | ||
| 338 | |||
| 339 | /* | ||
| 340 | * Return the position of the first alphabetic character in a string. | ||
| 341 | */ | ||
| 342 | int | ||
| 343 | first_alpha(const char *string, const char *exempt) | ||
| 344 | { | ||
| 345 | int i, in_paren=0, c; | ||
| 346 | |||
| 347 | for (i = 0; i < strlen(string); i++) { | ||
| 348 | c = tolower(string[i]); | ||
| 349 | |||
| 350 | if (strchr("<[(", c)) ++in_paren; | ||
| 351 | if (strchr(">])", c) && in_paren > 0) --in_paren; | ||
| 352 | |||
| 353 | if ((! in_paren) && isalpha(c) && | ||
| 354 | strchr(exempt, c) == 0) | ||
| 355 | return i; | ||
| 356 | } | ||
| 357 | |||
| 358 | return 0; | ||
| 359 | } | ||
diff --git a/scripts/lxdialog/yesno.c b/scripts/lxdialog/yesno.c deleted file mode 100644 index 11fcc25f5159..000000000000 --- a/scripts/lxdialog/yesno.c +++ /dev/null | |||
| @@ -1,118 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * yesno.c -- implements the yes/no box | ||
| 3 | * | ||
| 4 | * ORIGINAL AUTHOR: Savio Lam (lam836@cs.cuhk.hk) | ||
| 5 | * MODIFIED FOR LINUX KERNEL CONFIG BY: William Roadcap (roadcap@cfw.com) | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or | ||
| 8 | * modify it under the terms of the GNU General Public License | ||
| 9 | * as published by the Free Software Foundation; either version 2 | ||
| 10 | * of the License, or (at your option) any later version. | ||
| 11 | * | ||
| 12 | * This program is distributed in the hope that it will be useful, | ||
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | * GNU General Public License for more details. | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License | ||
| 18 | * along with this program; if not, write to the Free Software | ||
| 19 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
| 20 | */ | ||
| 21 | |||
| 22 | #include "dialog.h" | ||
| 23 | |||
| 24 | /* | ||
| 25 | * Display termination buttons | ||
| 26 | */ | ||
| 27 | static void | ||
| 28 | print_buttons(WINDOW *dialog, int height, int width, int selected) | ||
| 29 | { | ||
| 30 | int x = width / 2 - 10; | ||
| 31 | int y = height - 2; | ||
| 32 | |||
| 33 | print_button (dialog, " Yes ", y, x, selected == 0); | ||
| 34 | print_button (dialog, " No ", y, x + 13, selected == 1); | ||
| 35 | |||
| 36 | wmove(dialog, y, x+1 + 13*selected ); | ||
| 37 | wrefresh (dialog); | ||
| 38 | } | ||
| 39 | |||
| 40 | /* | ||
| 41 | * Display a dialog box with two buttons - Yes and No | ||
| 42 | */ | ||
| 43 | int | ||
| 44 | dialog_yesno (const char *title, const char *prompt, int height, int width) | ||
| 45 | { | ||
| 46 | int i, x, y, key = 0, button = 0; | ||
| 47 | WINDOW *dialog; | ||
| 48 | |||
| 49 | /* center dialog box on screen */ | ||
| 50 | x = (COLS - width) / 2; | ||
| 51 | y = (LINES - height) / 2; | ||
| 52 | |||
| 53 | draw_shadow (stdscr, y, x, height, width); | ||
| 54 | |||
| 55 | dialog = newwin (height, width, y, x); | ||
| 56 | keypad (dialog, TRUE); | ||
| 57 | |||
| 58 | draw_box (dialog, 0, 0, height, width, dialog_attr, border_attr); | ||
| 59 | wattrset (dialog, border_attr); | ||
| 60 | mvwaddch (dialog, height-3, 0, ACS_LTEE); | ||
| 61 | for (i = 0; i < width - 2; i++) | ||
| 62 | waddch (dialog, ACS_HLINE); | ||
| 63 | wattrset (dialog, dialog_attr); | ||
| 64 | waddch (dialog, ACS_RTEE); | ||
| 65 | |||
| 66 | if (title != NULL && strlen(title) >= width-2 ) { | ||
| 67 | /* truncate long title -- mec */ | ||
| 68 | char * title2 = malloc(width-2+1); | ||
| 69 | memcpy( title2, title, width-2 ); | ||
| 70 | title2[width-2] = '\0'; | ||
| 71 | title = title2; | ||
| 72 | } | ||
| 73 | |||
| 74 | if (title != NULL) { | ||
| 75 | wattrset (dialog, title_attr); | ||
| 76 | mvwaddch (dialog, 0, (width - strlen(title))/2 - 1, ' '); | ||
| 77 | waddstr (dialog, (char *)title); | ||
| 78 | waddch (dialog, ' '); | ||
| 79 | } | ||
| 80 | |||
| 81 | wattrset (dialog, dialog_attr); | ||
| 82 | print_autowrap (dialog, prompt, width - 2, 1, 3); | ||
| 83 | |||
| 84 | print_buttons(dialog, height, width, 0); | ||
| 85 | |||
| 86 | while (key != ESC) { | ||
| 87 | key = wgetch (dialog); | ||
| 88 | switch (key) { | ||
| 89 | case 'Y': | ||
| 90 | case 'y': | ||
| 91 | delwin (dialog); | ||
| 92 | return 0; | ||
| 93 | case 'N': | ||
| 94 | case 'n': | ||
| 95 | delwin (dialog); | ||
| 96 | return 1; | ||
| 97 | |||
| 98 | case TAB: | ||
| 99 | case KEY_LEFT: | ||
| 100 | case KEY_RIGHT: | ||
| 101 | button = ((key == KEY_LEFT ? --button : ++button) < 0) | ||
| 102 | ? 1 : (button > 1 ? 0 : button); | ||
| 103 | |||
| 104 | print_buttons(dialog, height, width, button); | ||
| 105 | wrefresh (dialog); | ||
| 106 | break; | ||
| 107 | case ' ': | ||
| 108 | case '\n': | ||
| 109 | delwin (dialog); | ||
| 110 | return button; | ||
| 111 | case ESC: | ||
| 112 | break; | ||
| 113 | } | ||
| 114 | } | ||
| 115 | |||
| 116 | delwin (dialog); | ||
| 117 | return -1; /* ESC pressed */ | ||
| 118 | } | ||
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 3bed09e625c0..f70ff13d4818 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c | |||
| @@ -326,8 +326,8 @@ parse_elf_finish(struct elf_info *info) | |||
| 326 | release_file(info->hdr, info->size); | 326 | release_file(info->hdr, info->size); |
| 327 | } | 327 | } |
| 328 | 328 | ||
| 329 | #define CRC_PFX MODULE_SYMBOL_PREFIX "__crc_" | 329 | #define CRC_PFX "__crc_" |
| 330 | #define KSYMTAB_PFX MODULE_SYMBOL_PREFIX "__ksymtab_" | 330 | #define KSYMTAB_PFX "__ksymtab_" |
| 331 | 331 | ||
| 332 | void | 332 | void |
| 333 | handle_modversions(struct module *mod, struct elf_info *info, | 333 | handle_modversions(struct module *mod, struct elf_info *info, |
| @@ -539,10 +539,9 @@ add_header(struct buffer *b, struct module *mod) | |||
| 539 | buf_printf(b, "\n"); | 539 | buf_printf(b, "\n"); |
| 540 | buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n"); | 540 | buf_printf(b, "MODULE_INFO(vermagic, VERMAGIC_STRING);\n"); |
| 541 | buf_printf(b, "\n"); | 541 | buf_printf(b, "\n"); |
| 542 | buf_printf(b, "#undef unix\n"); /* We have a module called "unix" */ | ||
| 543 | buf_printf(b, "struct module __this_module\n"); | 542 | buf_printf(b, "struct module __this_module\n"); |
| 544 | buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n"); | 543 | buf_printf(b, "__attribute__((section(\".gnu.linkonce.this_module\"))) = {\n"); |
| 545 | buf_printf(b, " .name = __stringify(KBUILD_MODNAME),\n"); | 544 | buf_printf(b, " .name = KBUILD_MODNAME,\n"); |
| 546 | if (mod->has_init) | 545 | if (mod->has_init) |
| 547 | buf_printf(b, " .init = init_module,\n"); | 546 | buf_printf(b, " .init = init_module,\n"); |
| 548 | if (mod->has_cleanup) | 547 | if (mod->has_cleanup) |
diff --git a/scripts/package/Makefile b/scripts/package/Makefile index f3e7e8e4a500..c201ef001f09 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile | |||
| @@ -84,7 +84,7 @@ clean-dirs += $(objtree)/debian/ | |||
| 84 | # --------------------------------------------------------------------------- | 84 | # --------------------------------------------------------------------------- |
| 85 | .PHONY: tar%pkg | 85 | .PHONY: tar%pkg |
| 86 | tar%pkg: | 86 | tar%pkg: |
| 87 | $(MAKE) | 87 | $(MAKE) KBUILD_SRC= |
| 88 | $(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@ | 88 | $(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@ |
| 89 | 89 | ||
| 90 | clean-dirs += $(objtree)/tar-install/ | 90 | clean-dirs += $(objtree)/tar-install/ |
diff --git a/scripts/package/buildtar b/scripts/package/buildtar index d8fffe6f8906..88b5281ac41e 100644 --- a/scripts/package/buildtar +++ b/scripts/package/buildtar | |||
| @@ -1,9 +1,9 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | # | 3 | # |
| 4 | # buildtar 0.0.3 | 4 | # buildtar 0.0.4 |
| 5 | # | 5 | # |
| 6 | # (C) 2004-2005 by Jan-Benedict Glaw <jbglaw@lug-owl.de> | 6 | # (C) 2004-2006 by Jan-Benedict Glaw <jbglaw@lug-owl.de> |
| 7 | # | 7 | # |
| 8 | # This script is used to compile a tarball from the currently | 8 | # This script is used to compile a tarball from the currently |
| 9 | # prepared kernel. Based upon the builddeb script from | 9 | # prepared kernel. Based upon the builddeb script from |
| @@ -15,9 +15,8 @@ set -e | |||
| 15 | # | 15 | # |
| 16 | # Some variables and settings used throughout the script | 16 | # Some variables and settings used throughout the script |
| 17 | # | 17 | # |
| 18 | version="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}${EXTRANAME}" | ||
| 19 | tmpdir="${objtree}/tar-install" | 18 | tmpdir="${objtree}/tar-install" |
| 20 | tarball="${objtree}/linux-${version}.tar" | 19 | tarball="${objtree}/linux-${KERNELRELEASE}.tar" |
| 21 | 20 | ||
| 22 | 21 | ||
| 23 | # | 22 | # |
| @@ -53,21 +52,17 @@ mkdir -p -- "${tmpdir}/boot" | |||
| 53 | # | 52 | # |
| 54 | # Try to install modules | 53 | # Try to install modules |
| 55 | # | 54 | # |
| 56 | if ! make INSTALL_MOD_PATH="${tmpdir}" modules_install; then | 55 | if grep -q '^CONFIG_MODULES=y' "${objtree}/.config"; then |
| 57 | echo "" >&2 | 56 | make ARCH="${ARCH}" O="${objtree}" KBUILD_SRC= INSTALL_MOD_PATH="${tmpdir}" modules_install |
| 58 | echo "Ignoring error at module_install time, since that could be" >&2 | ||
| 59 | echo "a result of missing local modutils/module-init-tools," >&2 | ||
| 60 | echo "or you just didn't compile in module support at all..." >&2 | ||
| 61 | echo "" >&2 | ||
| 62 | fi | 57 | fi |
| 63 | 58 | ||
| 64 | 59 | ||
| 65 | # | 60 | # |
| 66 | # Install basic kernel files | 61 | # Install basic kernel files |
| 67 | # | 62 | # |
| 68 | cp -v -- System.map "${tmpdir}/boot/System.map-${version}" | 63 | cp -v -- "${objtree}/System.map" "${tmpdir}/boot/System.map-${KERNELRELEASE}" |
| 69 | cp -v -- .config "${tmpdir}/boot/config-${version}" | 64 | cp -v -- "${objtree}/.config" "${tmpdir}/boot/config-${KERNELRELEASE}" |
| 70 | cp -v -- vmlinux "${tmpdir}/boot/vmlinux-${version}" | 65 | cp -v -- "${objtree}/vmlinux" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}" |
| 71 | 66 | ||
| 72 | 67 | ||
| 73 | # | 68 | # |
| @@ -75,17 +70,17 @@ cp -v -- vmlinux "${tmpdir}/boot/vmlinux-${version}" | |||
| 75 | # | 70 | # |
| 76 | case "${ARCH}" in | 71 | case "${ARCH}" in |
| 77 | i386) | 72 | i386) |
| 78 | [ -f arch/i386/boot/bzImage ] && cp -v -- arch/i386/boot/bzImage "${tmpdir}/boot/vmlinuz-${version}" | 73 | [ -f "${objtree}/arch/i386/boot/bzImage" ] && cp -v -- "${objtree}/arch/i386/boot/bzImage" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}" |
| 79 | ;; | 74 | ;; |
| 80 | alpha) | 75 | alpha) |
| 81 | [ -f arch/alpha/boot/vmlinux.gz ] && cp -v -- arch/alpha/boot/vmlinux.gz "${tmpdir}/boot/vmlinuz-${version}" | 76 | [ -f "${objtree}/arch/alpha/boot/vmlinux.gz" ] && cp -v -- "${objtree}/arch/alpha/boot/vmlinux.gz" "${tmpdir}/boot/vmlinuz-${KERNELRELEASE}" |
| 82 | ;; | 77 | ;; |
| 83 | vax) | 78 | vax) |
| 84 | [ -f vmlinux.SYS ] && cp -v -- vmlinux.SYS "${tmpdir}/boot/vmlinux-${version}.SYS" | 79 | [ -f "${objtree}/vmlinux.SYS" ] && cp -v -- "${objtree}/vmlinux.SYS" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.SYS" |
| 85 | [ -f vmlinux.dsk ] && cp -v -- vmlinux.dsk "${tmpdir}/boot/vmlinux-${version}.dsk" | 80 | [ -f "${objtree}/vmlinux.dsk" ] && cp -v -- "${objtree}/vmlinux.dsk" "${tmpdir}/boot/vmlinux-${KERNELRELEASE}.dsk" |
| 86 | ;; | 81 | ;; |
| 87 | *) | 82 | *) |
| 88 | [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${version}" | 83 | [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${KERNELRELEASE}" |
| 89 | echo "" >&2 | 84 | echo "" >&2 |
| 90 | echo '** ** ** WARNING ** ** **' >&2 | 85 | echo '** ** ** WARNING ** ** **' >&2 |
| 91 | echo "" >&2 | 86 | echo "" >&2 |
