diff options
| author | Eric Andersen <andersen@codepoet.org> | 2002-12-05 08:41:41 +0000 |
|---|---|---|
| committer | Eric Andersen <andersen@codepoet.org> | 2002-12-05 08:41:41 +0000 |
| commit | c9f20d9fb93c6c316518483fd103f3afab5cf1af (patch) | |
| tree | 72904548bb54dcaf78017d3b35296765437e0bd5 /scripts | |
| parent | deca106b6dad70ad0a1312a82d762aa8d8ad52ba (diff) | |
| download | busybox-w32-c9f20d9fb93c6c316518483fd103f3afab5cf1af.tar.gz busybox-w32-c9f20d9fb93c6c316518483fd103f3afab5cf1af.tar.bz2 busybox-w32-c9f20d9fb93c6c316518483fd103f3afab5cf1af.zip | |
Yet another major rework of the BusyBox config system, using the considerably
modified Kbuild system I put into uClibc. With this, there should be no more
need to modify Rules.mak since I've moved all the interesting options into the
config system. I think I've got everything updated, but you never know, I may
have made some mistakes, so watch closely.
-Erik
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/Configure | 705 | ||||
| -rw-r--r-- | scripts/Menuconfig | 1287 | ||||
| -rw-r--r-- | scripts/config/.cvsignore | 8 | ||||
| -rw-r--r-- | scripts/config/Kconfig-language.txt | 255 | ||||
| -rw-r--r-- | scripts/config/Makefile | 102 | ||||
| -rw-r--r-- | scripts/config/checklist.c (renamed from scripts/lxdialog/checklist.c) | 34 | ||||
| -rw-r--r-- | scripts/config/colors.h (renamed from scripts/lxdialog/colors.h) | 0 | ||||
| -rw-r--r-- | scripts/config/conf.c | 566 | ||||
| -rw-r--r-- | scripts/config/confdata.c | 371 | ||||
| -rw-r--r-- | scripts/config/dialog.h (renamed from scripts/lxdialog/dialog.h) | 28 | ||||
| -rw-r--r-- | scripts/config/expr.c | 1054 | ||||
| -rw-r--r-- | scripts/config/expr.h | 242 | ||||
| -rw-r--r-- | scripts/config/inputbox.c (renamed from scripts/lxdialog/inputbox.c) | 0 | ||||
| -rw-r--r-- | scripts/config/lex.zconf.c_shipped | 3280 | ||||
| -rw-r--r-- | scripts/config/lkc.h | 106 | ||||
| -rw-r--r-- | scripts/config/lkc_proto.h | 38 | ||||
| -rw-r--r-- | scripts/config/mconf.c | 669 | ||||
| -rw-r--r-- | scripts/config/menu.c | 309 | ||||
| -rw-r--r-- | scripts/config/menubox.c (renamed from scripts/lxdialog/menubox.c) | 59 | ||||
| -rw-r--r-- | scripts/config/msgbox.c (renamed from scripts/lxdialog/msgbox.c) | 0 | ||||
| -rw-r--r-- | scripts/config/symbol.c | 629 | ||||
| -rw-r--r-- | scripts/config/textbox.c (renamed from scripts/lxdialog/textbox.c) | 2 | ||||
| -rw-r--r-- | scripts/config/util.c (renamed from scripts/lxdialog/util.c) | 18 | ||||
| -rw-r--r-- | scripts/config/yesno.c (renamed from scripts/lxdialog/yesno.c) | 0 | ||||
| -rw-r--r-- | scripts/config/zconf.l | 332 | ||||
| -rw-r--r-- | scripts/config/zconf.tab.c_shipped | 2017 | ||||
| -rw-r--r-- | scripts/config/zconf.tab.h_shipped | 125 | ||||
| -rw-r--r-- | scripts/config/zconf.y | 651 | ||||
| -rw-r--r-- | scripts/lxdialog/.cvsignore | 1 | ||||
| -rw-r--r-- | scripts/lxdialog/BIG.FAT.WARNING | 4 | ||||
| -rw-r--r-- | scripts/lxdialog/Makefile | 48 | ||||
| -rw-r--r-- | scripts/lxdialog/Makefile-2.5 | 71 | ||||
| -rw-r--r-- | scripts/lxdialog/lxdialog.c | 226 |
33 files changed, 10832 insertions, 2405 deletions
diff --git a/scripts/Configure b/scripts/Configure deleted file mode 100644 index 0a73a6493..000000000 --- a/scripts/Configure +++ /dev/null | |||
| @@ -1,705 +0,0 @@ | |||
| 1 | #! /bin/sh | ||
| 2 | # | ||
| 3 | # This script is used to configure BusyBox. | ||
| 4 | # | ||
| 5 | # It was inspired by the challenge in the original Configure script | ||
| 6 | # to ``do something better'', combined with the actual need to ``do | ||
| 7 | # something better'' because the old configure script wasn't flexible | ||
| 8 | # enough. | ||
| 9 | # | ||
| 10 | # Raymond Chen was the original author of Configure. | ||
| 11 | # Michael Elizabeth Chastain (mec@shout.net) is the current maintainer. | ||
| 12 | # | ||
| 13 | # 050793 - use IFS='@' to get around a bug in a pre-version of bash-1.13 | ||
| 14 | # with an empty IFS. | ||
| 15 | # | ||
| 16 | # 030995 (storner@osiris.ping.dk) - added support for tri-state answers, | ||
| 17 | # for selecting modules to compile. | ||
| 18 | # | ||
| 19 | # 180995 Bernhard Kaindl (bkaindl@ping.at) - added dummy functions for | ||
| 20 | # use with a config.in modified for make menuconfig. | ||
| 21 | # | ||
| 22 | # 301195 (boldt@math.ucsb.edu) - added help text support | ||
| 23 | # | ||
| 24 | # 281295 Paul Gortmaker - make tri_state functions collapse to boolean | ||
| 25 | # if module support is not enabled. | ||
| 26 | # | ||
| 27 | # 010296 Aaron Ucko (ucko@vax1.rockhurst.edu) - fix int and hex to accept | ||
| 28 | # arbitrary ranges | ||
| 29 | # | ||
| 30 | # 150296 Dick Streefland (dicks@tasking.nl) - report new configuration | ||
| 31 | # items and ask for a value even when doing a "make oldconfig" | ||
| 32 | # | ||
| 33 | # 200396 Tom Dyas (tdyas@eden.rutgers.edu) - when the module option is | ||
| 34 | # chosen for an item, define the macro <option_name>_MODULE | ||
| 35 | # | ||
| 36 | # 090397 Axel Boldt (boldt@math.ucsb.edu) - avoid ? and + in regular | ||
| 37 | # expressions for GNU expr since version 1.15 and up use \? and \+. | ||
| 38 | # | ||
| 39 | # 300397 Phil Blundell (pjb27@cam.ac.uk) - added support for min/max | ||
| 40 | # arguments to "int", allow dep_tristate to take a list of dependencies | ||
| 41 | # rather than just one. | ||
| 42 | # | ||
| 43 | # 090398 Axel Boldt (boldt@math.ucsb.edu) - allow for empty lines in help | ||
| 44 | # texts. | ||
| 45 | # | ||
| 46 | # 102598 Michael Chastain (mec@shout.net) - put temporary files in | ||
| 47 | # current directory, not in /tmp. | ||
| 48 | # | ||
| 49 | # 24 January 1999, Michael Elizabeth Chastain, <mec@shout.net> | ||
| 50 | # - Improve the exit message (Jeff Ronne). | ||
| 51 | # | ||
| 52 | # 7 October 2000, Ghozlane Toumi, <gtoumi@messel.emse.fr> | ||
| 53 | # added switches for "random" , "all yes" and "all modules" | ||
| 54 | # | ||
| 55 | |||
| 56 | # | ||
| 57 | # Make sure we're really running bash. | ||
| 58 | # | ||
| 59 | # I would really have preferred to write this script in a language with | ||
| 60 | # better string handling, but alas, bash is the only scripting language | ||
| 61 | # that I can be reasonable sure everybody has on their linux machine. | ||
| 62 | # | ||
| 63 | [ -z "$BASH" ] && { echo "Configure requires bash" 1>&2; exit 1; } | ||
| 64 | |||
| 65 | # Disable filename globbing once and for all. | ||
| 66 | # Enable function cacheing. | ||
| 67 | set -f -h | ||
| 68 | |||
| 69 | # | ||
| 70 | # Dummy functions for use with a config.in modified for menuconf | ||
| 71 | # | ||
| 72 | function mainmenu_option () { | ||
| 73 | : | ||
| 74 | } | ||
| 75 | function mainmenu_name () { | ||
| 76 | : | ||
| 77 | } | ||
| 78 | function endmenu () { | ||
| 79 | : | ||
| 80 | } | ||
| 81 | |||
| 82 | # | ||
| 83 | # returns a random number between 1 and $1 | ||
| 84 | # | ||
| 85 | function rnd () { | ||
| 86 | rnd=$[ $RANDOM % $1 + 1 ] | ||
| 87 | } | ||
| 88 | |||
| 89 | # | ||
| 90 | # randomly chose a number in a config list (LIST_CONFIG_NAME) | ||
| 91 | # or in a range ( MIN_CONFIG_NAME MAX_CONFIG_NAME ) | ||
| 92 | # ONLY if there is no forced default (and we are in an "auto" mode) | ||
| 93 | # we are limited by the range of values taken by "$RANDOM" | ||
| 94 | # | ||
| 95 | # rndval CONFIG_NAME | ||
| 96 | # | ||
| 97 | |||
| 98 | function rndval () { | ||
| 99 | [ "$AUTO" != "yes" -o -n "$old" ] && return | ||
| 100 | def_list=$(eval echo "\${LIST_$1}") | ||
| 101 | def_min=$(eval echo "\${MIN_$1}") | ||
| 102 | def_max=$(eval echo "\${MAX_$1}") | ||
| 103 | |||
| 104 | if [ -n "$def_list" ]; then | ||
| 105 | set -- $(echo $def_list | sed 's/,/ /g') | ||
| 106 | rnd $# | ||
| 107 | while [ $rnd -le $# ] ; do | ||
| 108 | def=$1 | ||
| 109 | shift | ||
| 110 | done | ||
| 111 | return | ||
| 112 | fi | ||
| 113 | if [ -n "$def_min" -a -n "$def_max" ]; then | ||
| 114 | rnd $[ $def_max - $def_min ] | ||
| 115 | def=$[ $def_min + $rnd ] | ||
| 116 | fi | ||
| 117 | } | ||
| 118 | |||
| 119 | # | ||
| 120 | # help prints the corresponding help text from Configure.help to stdout | ||
| 121 | # | ||
| 122 | # help variable | ||
| 123 | # | ||
| 124 | function help () { | ||
| 125 | if [ -f docs/Configure.help ] | ||
| 126 | then | ||
| 127 | #first escape regexp special characters in the argument: | ||
| 128 | var=$(echo "$1"|sed 's/[][\/.^$*]/\\&/g') | ||
| 129 | #now pick out the right help text: | ||
| 130 | text=$(sed -n "/^$var[ ]*\$/,\${ | ||
| 131 | /^$var[ ]*\$/c\\ | ||
| 132 | ${var}:\\ | ||
| 133 | |||
| 134 | /^#/b | ||
| 135 | /^[^ ]/q | ||
| 136 | /<file:\\([^>]*\\)>/s//\\1/g | ||
| 137 | p | ||
| 138 | }" docs/Configure.help) | ||
| 139 | if [ -z "$text" ] | ||
| 140 | then | ||
| 141 | echo; echo " Sorry, no help available for this option yet.";echo | ||
| 142 | else | ||
| 143 | (echo; echo "$text") | ${PAGER:-more} | ||
| 144 | fi | ||
| 145 | else | ||
| 146 | echo; | ||
| 147 | echo " Can't access the file docs/Configure.help which" | ||
| 148 | echo " should contain the help texts." | ||
| 149 | echo | ||
| 150 | fi | ||
| 151 | } | ||
| 152 | |||
| 153 | |||
| 154 | # | ||
| 155 | # readln reads a line into $ans. | ||
| 156 | # | ||
| 157 | # readln prompt default oldval | ||
| 158 | # | ||
| 159 | function readln () { | ||
| 160 | if [ "$AUTO" = "yes" ]; then | ||
| 161 | echo -n "$1" | ||
| 162 | ans=$2 | ||
| 163 | echo $ans | ||
| 164 | elif [ "$DEFAULT" = "-d" -a -n "$3" ]; then | ||
| 165 | echo "$1" | ||
| 166 | ans=$2 | ||
| 167 | else | ||
| 168 | echo -n "$1" | ||
| 169 | [ -z "$3" ] && echo -n "(NEW) " | ||
| 170 | IFS='@' read ans || exit 1 | ||
| 171 | [ -z "$ans" ] && ans=$2 | ||
| 172 | fi | ||
| 173 | } | ||
| 174 | |||
| 175 | # | ||
| 176 | # comment does some pretty-printing | ||
| 177 | # | ||
| 178 | # comment 'xxx' | ||
| 179 | # | ||
| 180 | function comment () { | ||
| 181 | echo "*"; echo "* $1" ; echo "*" | ||
| 182 | (echo "" ; echo "#"; echo "# $1" ; echo "#") >>$CONFIG | ||
| 183 | (echo "" ; echo "/*"; echo " * $1" ; echo " */") >>$CONFIG_H | ||
| 184 | } | ||
| 185 | |||
| 186 | # | ||
| 187 | # define_bool sets the value of a boolean argument | ||
| 188 | # | ||
| 189 | # define_bool define value | ||
| 190 | # | ||
| 191 | function define_bool () { | ||
| 192 | define_tristate $1 $2 | ||
| 193 | } | ||
| 194 | |||
| 195 | function define_tristate () { | ||
| 196 | case "$2" in | ||
| 197 | "y") | ||
| 198 | echo "$1=y" >>$CONFIG | ||
| 199 | echo "#define $1 1" >>$CONFIG_H | ||
| 200 | ;; | ||
| 201 | |||
| 202 | "m") | ||
| 203 | echo "$1=m" >>$CONFIG | ||
| 204 | echo "#undef $1" >>$CONFIG_H | ||
| 205 | echo "#define $1_MODULE 1" >>$CONFIG_H | ||
| 206 | ;; | ||
| 207 | |||
| 208 | "n") | ||
| 209 | echo "# $1 is not set" >>$CONFIG | ||
| 210 | echo "#undef $1" >>$CONFIG_H | ||
| 211 | ;; | ||
| 212 | esac | ||
| 213 | eval "$1=$2" | ||
| 214 | } | ||
| 215 | |||
| 216 | # | ||
| 217 | # bool processes a boolean argument | ||
| 218 | # | ||
| 219 | # bool question define | ||
| 220 | # | ||
| 221 | function bool () { | ||
| 222 | old=$(eval echo "\${$2}") | ||
| 223 | def=${old:-'n'} | ||
| 224 | if [ "$AUTO" = "yes" -a -z "$old" ]; then | ||
| 225 | if [ "$RND" = "-r" ]; then | ||
| 226 | rnd 2 | ||
| 227 | case $rnd in | ||
| 228 | "1") def="y" ;; | ||
| 229 | "2") def="n" ;; | ||
| 230 | esac | ||
| 231 | else | ||
| 232 | def=$DEF_ANS; | ||
| 233 | fi | ||
| 234 | fi | ||
| 235 | case "$def" in | ||
| 236 | "y" | "m") defprompt="Y/n/?" | ||
| 237 | def="y" | ||
| 238 | ;; | ||
| 239 | "n") defprompt="N/y/?" | ||
| 240 | ;; | ||
| 241 | esac | ||
| 242 | while :; do | ||
| 243 | readln "$1 ($2) [$defprompt] " "$def" "$old" | ||
| 244 | case "$ans" in | ||
| 245 | [yY] | [yY]es ) define_bool "$2" "y" | ||
| 246 | break;; | ||
| 247 | [nN] | [nN]o ) define_bool "$2" "n" | ||
| 248 | break;; | ||
| 249 | * ) help "$2" | ||
| 250 | ;; | ||
| 251 | esac | ||
| 252 | done | ||
| 253 | } | ||
| 254 | |||
| 255 | # | ||
| 256 | # tristate processes a tristate argument | ||
| 257 | # | ||
| 258 | # tristate question define | ||
| 259 | # | ||
| 260 | function tristate () { | ||
| 261 | if [ "$CONFIG_MODULES" != "y" ]; then | ||
| 262 | bool "$1" "$2" | ||
| 263 | else | ||
| 264 | old=$(eval echo "\${$2}") | ||
| 265 | def=${old:-'n'} | ||
| 266 | if [ "$AUTO" = "yes" -a -z "$old" ]; then | ||
| 267 | if [ "$RND" = "-r" ]; then | ||
| 268 | rnd 3 | ||
| 269 | case $rnd in | ||
| 270 | "1") def="y" ;; | ||
| 271 | "2") def="n" ;; | ||
| 272 | "3") def="m" ;; | ||
| 273 | esac | ||
| 274 | else | ||
| 275 | def=$DEF_ANS | ||
| 276 | fi | ||
| 277 | fi | ||
| 278 | case "$def" in | ||
| 279 | "y") defprompt="Y/m/n/?" | ||
| 280 | ;; | ||
| 281 | "m") defprompt="M/n/y/?" | ||
| 282 | ;; | ||
| 283 | "n") defprompt="N/y/m/?" | ||
| 284 | ;; | ||
| 285 | esac | ||
| 286 | while :; do | ||
| 287 | readln "$1 ($2) [$defprompt] " "$def" "$old" | ||
| 288 | case "$ans" in | ||
| 289 | [yY] | [yY]es ) define_tristate "$2" "y" | ||
| 290 | break ;; | ||
| 291 | [nN] | [nN]o ) define_tristate "$2" "n" | ||
| 292 | break ;; | ||
| 293 | [mM] ) define_tristate "$2" "m" | ||
| 294 | break ;; | ||
| 295 | * ) help "$2" | ||
| 296 | ;; | ||
| 297 | esac | ||
| 298 | done | ||
| 299 | fi | ||
| 300 | } | ||
| 301 | |||
| 302 | # | ||
| 303 | # dep_tristate processes a tristate argument that depends upon | ||
| 304 | # another option or options. If any of the options we depend upon is a | ||
| 305 | # module, then the only allowable options are M or N. If all are Y, then | ||
| 306 | # this is a normal tristate. This is used in cases where modules | ||
| 307 | # are nested, and one module requires the presence of something | ||
| 308 | # else in the kernel. | ||
| 309 | # | ||
| 310 | # dep_tristate question define default ... | ||
| 311 | # | ||
| 312 | function dep_tristate () { | ||
| 313 | old=$(eval echo "\${$2}") | ||
| 314 | def=${old:-'n'} | ||
| 315 | ques=$1 | ||
| 316 | var=$2 | ||
| 317 | need_module=0 | ||
| 318 | shift 2 | ||
| 319 | while [ $# -gt 0 ]; do | ||
| 320 | case "$1" in | ||
| 321 | n) | ||
| 322 | define_tristate "$var" "n" | ||
| 323 | return | ||
| 324 | ;; | ||
| 325 | m) | ||
| 326 | need_module=1 | ||
| 327 | ;; | ||
| 328 | esac | ||
| 329 | shift | ||
| 330 | done | ||
| 331 | |||
| 332 | if [ $need_module = 1 ]; then | ||
| 333 | if [ "$CONFIG_MODULES" = "y" ]; then | ||
| 334 | if [ "$AUTO" = "yes" -a -z "$old" ]; then | ||
| 335 | if [ "$RND" = "-r" ]; then | ||
| 336 | rnd 2 | ||
| 337 | case $rnd in | ||
| 338 | "1") def="m" ;; | ||
| 339 | "2") def="n" ;; | ||
| 340 | esac | ||
| 341 | else | ||
| 342 | def=$DEF_ANS | ||
| 343 | fi | ||
| 344 | fi | ||
| 345 | case "$def" in | ||
| 346 | "y" | "m") defprompt="M/n/?" | ||
| 347 | def="m" | ||
| 348 | ;; | ||
| 349 | "n") defprompt="N/m/?" | ||
| 350 | ;; | ||
| 351 | esac | ||
| 352 | while :; do | ||
| 353 | readln "$ques ($var) [$defprompt] " "$def" "$old" | ||
| 354 | case "$ans" in | ||
| 355 | [nN] | [nN]o ) define_tristate "$var" "n" | ||
| 356 | break ;; | ||
| 357 | [mM] ) define_tristate "$var" "m" | ||
| 358 | break ;; | ||
| 359 | [yY] | [yY]es ) echo | ||
| 360 | echo " This answer is not allowed, because it is not consistent with" | ||
| 361 | echo " your other choices." | ||
| 362 | echo " This driver depends on another one which you chose to compile" | ||
| 363 | echo " as a module. This means that you can either compile this one" | ||
| 364 | echo " as a module as well (with M) or leave it out altogether (N)." | ||
| 365 | echo | ||
| 366 | ;; | ||
| 367 | * ) help "$var" | ||
| 368 | ;; | ||
| 369 | esac | ||
| 370 | done | ||
| 371 | fi | ||
| 372 | else | ||
| 373 | tristate "$ques" "$var" | ||
| 374 | fi | ||
| 375 | } | ||
| 376 | |||
| 377 | function dep_bool () { | ||
| 378 | ques=$1 | ||
| 379 | var=$2 | ||
| 380 | shift 2 | ||
| 381 | while [ $# -gt 0 ]; do | ||
| 382 | case "$1" in | ||
| 383 | m | n) | ||
| 384 | define_bool "$var" "n" | ||
| 385 | return | ||
| 386 | ;; | ||
| 387 | esac | ||
| 388 | shift | ||
| 389 | done | ||
| 390 | |||
| 391 | bool "$ques" "$var" | ||
| 392 | } | ||
| 393 | |||
| 394 | function dep_mbool () { | ||
| 395 | ques=$1 | ||
| 396 | var=$2 | ||
| 397 | shift 2 | ||
| 398 | while [ $# -gt 0 ]; do | ||
| 399 | case "$1" in | ||
| 400 | n) | ||
| 401 | define_bool "$var" "n" | ||
| 402 | return | ||
| 403 | ;; | ||
| 404 | esac | ||
| 405 | shift | ||
| 406 | done | ||
| 407 | |||
| 408 | bool "$ques" "$var" | ||
| 409 | } | ||
| 410 | |||
| 411 | # | ||
| 412 | # define_int sets the value of a integer argument | ||
| 413 | # | ||
| 414 | # define_int define value | ||
| 415 | # | ||
| 416 | function define_int () { | ||
| 417 | echo "$1=$2" >>$CONFIG | ||
| 418 | echo "#define $1 ($2)" >>$CONFIG_H | ||
| 419 | eval "$1=$2" | ||
| 420 | } | ||
| 421 | |||
| 422 | # | ||
| 423 | # int processes an integer argument with optional limits | ||
| 424 | # | ||
| 425 | # int question define default [min max] | ||
| 426 | # | ||
| 427 | function int () { | ||
| 428 | old=$(eval echo "\${$2}") | ||
| 429 | def=${old:-$3} | ||
| 430 | if [ $# -gt 3 ]; then | ||
| 431 | min=$4 | ||
| 432 | else | ||
| 433 | min=-10000000 # !! | ||
| 434 | fi | ||
| 435 | if [ $# -gt 4 ]; then | ||
| 436 | max=$5 | ||
| 437 | else | ||
| 438 | max=10000000 # !! | ||
| 439 | fi | ||
| 440 | rndval $2 | ||
| 441 | while :; do | ||
| 442 | readln "$1 ($2) [$def] " "$def" "$old" | ||
| 443 | if expr \( \( $ans + 0 \) \>= $min \) \& \( $ans \<= $max \) >/dev/null 2>&1 ; then | ||
| 444 | define_int "$2" "$ans" | ||
| 445 | break | ||
| 446 | else | ||
| 447 | help "$2" | ||
| 448 | fi | ||
| 449 | done | ||
| 450 | } | ||
| 451 | |||
| 452 | # | ||
| 453 | # define_hex sets the value of a hexadecimal argument | ||
| 454 | # | ||
| 455 | # define_hex define value | ||
| 456 | # | ||
| 457 | function define_hex () { | ||
| 458 | echo "$1=$2" >>$CONFIG | ||
| 459 | echo "#define $1 0x${2#*[x,X]}" >>$CONFIG_H | ||
| 460 | eval "$1=$2" | ||
| 461 | } | ||
| 462 | |||
| 463 | # | ||
| 464 | # hex processes an hexadecimal argument | ||
| 465 | # | ||
| 466 | # hex question define default | ||
| 467 | # | ||
| 468 | function hex () { | ||
| 469 | old=$(eval echo "\${$2}") | ||
| 470 | def=${old:-$3} | ||
| 471 | def=${def#*[x,X]} | ||
| 472 | rndval $2 | ||
| 473 | while :; do | ||
| 474 | readln "$1 ($2) [$def] " "$def" "$old" | ||
| 475 | ans=${ans#*[x,X]} | ||
| 476 | if expr "$ans" : '[0-9a-fA-F][0-9a-fA-F]*$' > /dev/null; then | ||
| 477 | define_hex "$2" "$ans" | ||
| 478 | break | ||
| 479 | else | ||
| 480 | help "$2" | ||
| 481 | fi | ||
| 482 | done | ||
| 483 | } | ||
| 484 | |||
| 485 | # | ||
| 486 | # define_string sets the value of a string argument | ||
| 487 | # | ||
| 488 | # define_string define value | ||
| 489 | # | ||
| 490 | function define_string () { | ||
| 491 | echo "$1=\"$2\"" >>$CONFIG | ||
| 492 | echo "#define $1 \"$2\"" >>$CONFIG_H | ||
| 493 | eval "$1=\"$2\"" | ||
| 494 | } | ||
| 495 | |||
| 496 | # | ||
| 497 | # string processes a string argument | ||
| 498 | # | ||
| 499 | # string question define default | ||
| 500 | # | ||
| 501 | function string () { | ||
| 502 | old=$(eval echo "\${$2}") | ||
| 503 | def=${old:-$3} | ||
| 504 | while :; do | ||
| 505 | if [ "$old" = "?" ]; then | ||
| 506 | readln "$1 ($2) [$def] " "$def" "" | ||
| 507 | else | ||
| 508 | readln "$1 ($2) [$def] " "$def" "$old" | ||
| 509 | fi | ||
| 510 | if [ "$ans" = "?" ]; then | ||
| 511 | help "$2" | ||
| 512 | else | ||
| 513 | break | ||
| 514 | fi | ||
| 515 | done | ||
| 516 | define_string "$2" "$ans" | ||
| 517 | } | ||
| 518 | # | ||
| 519 | # choice processes a choice list (1-out-of-n) | ||
| 520 | # | ||
| 521 | # choice question choice-list default | ||
| 522 | # | ||
| 523 | # The choice list has a syntax of: | ||
| 524 | # NAME WHITESPACE VALUE { WHITESPACE NAME WHITESPACE VALUE } | ||
| 525 | # The user may enter any unique prefix of one of the NAMEs and | ||
| 526 | # choice will define VALUE as if it were a boolean option. | ||
| 527 | # VALUE must be in all uppercase. Normally, VALUE is of the | ||
| 528 | # form CONFIG_<something>. Thus, if the user selects <something>, | ||
| 529 | # the CPP symbol CONFIG_<something> will be defined and the | ||
| 530 | # shell variable CONFIG_<something> will be set to "y". | ||
| 531 | # | ||
| 532 | function choice () { | ||
| 533 | question="$1" | ||
| 534 | choices="$2" | ||
| 535 | old= | ||
| 536 | def=$3 | ||
| 537 | |||
| 538 | # determine default answer: | ||
| 539 | names="" | ||
| 540 | set -- $choices | ||
| 541 | firstvar=$2 | ||
| 542 | while [ -n "$2" ]; do | ||
| 543 | if [ -n "$names" ]; then | ||
| 544 | names="$names, $1" | ||
| 545 | else | ||
| 546 | names="$1" | ||
| 547 | fi | ||
| 548 | if [ "$(eval echo \"\${$2}\")" = "y" ]; then | ||
| 549 | old=$1 | ||
| 550 | def=$1 | ||
| 551 | fi | ||
| 552 | shift; shift | ||
| 553 | done | ||
| 554 | |||
| 555 | if [ "$RND" = "-r" -a -z "$old" ] ; then | ||
| 556 | set -- $choices | ||
| 557 | rnd $# | ||
| 558 | while [ $rnd -le $# ] ; do | ||
| 559 | def=$1 | ||
| 560 | shift ; shift | ||
| 561 | done | ||
| 562 | fi | ||
| 563 | |||
| 564 | val="" | ||
| 565 | while [ -z "$val" ]; do | ||
| 566 | ambg=n | ||
| 567 | readln "$question ($names) [$def] " "$def" "$old" | ||
| 568 | ans=$(echo $ans | tr a-z A-Z) | ||
| 569 | set -- $choices | ||
| 570 | while [ -n "$1" ]; do | ||
| 571 | name=$(echo $1 | tr a-z A-Z) | ||
| 572 | case "$name" in | ||
| 573 | "$ans"* | */"$ans"* ) | ||
| 574 | case "$name" in | ||
| 575 | "$ans" | */"$ans"/* | \ | ||
| 576 | "$ans"/* | */"$ans" ) | ||
| 577 | val="$2" | ||
| 578 | break # exact match | ||
| 579 | ;; | ||
| 580 | esac | ||
| 581 | if [ -n "$val" ]; then | ||
| 582 | echo;echo \ | ||
| 583 | " Sorry, \"$ans\" is ambiguous; please enter a longer string." | ||
| 584 | echo | ||
| 585 | val="" | ||
| 586 | ambg=y | ||
| 587 | break | ||
| 588 | else | ||
| 589 | val="$2" | ||
| 590 | fi;; | ||
| 591 | esac | ||
| 592 | shift; shift | ||
| 593 | done | ||
| 594 | if [ "$val" = "" -a "$ambg" = "n" ]; then | ||
| 595 | help "$firstvar" | ||
| 596 | fi | ||
| 597 | done | ||
| 598 | set -- $choices | ||
| 599 | while [ -n "$2" ]; do | ||
| 600 | if [ "$2" = "$val" ]; then | ||
| 601 | echo " defined $val" | ||
| 602 | define_bool "$2" "y" | ||
| 603 | else | ||
| 604 | define_bool "$2" "n" | ||
| 605 | fi | ||
| 606 | shift; shift | ||
| 607 | done | ||
| 608 | } | ||
| 609 | |||
| 610 | CONFIG=.tmpconfig | ||
| 611 | CONFIG_H=.tmpconfig.h | ||
| 612 | FORCE_DEFAULT=.force_default | ||
| 613 | trap "rm -f $CONFIG $CONFIG_H ; exit 1" 1 2 | ||
| 614 | |||
| 615 | # | ||
| 616 | # Make sure we start out with a clean slate. | ||
| 617 | # | ||
| 618 | echo "#" > $CONFIG | ||
| 619 | echo "# Automatically generated make config: don't edit" >> $CONFIG | ||
| 620 | echo "#" >> $CONFIG | ||
| 621 | |||
| 622 | echo "/*" > $CONFIG_H | ||
| 623 | echo " * Automatically generated C config: don't edit" >> $CONFIG_H | ||
| 624 | echo " */" >> $CONFIG_H | ||
| 625 | echo "#define AUTOCONF_INCLUDED" >> $CONFIG_H | ||
| 626 | |||
| 627 | DEFAULT="" | ||
| 628 | if [ "$1" = "-d" ] ; then | ||
| 629 | DEFAULT="-d" | ||
| 630 | shift | ||
| 631 | fi | ||
| 632 | |||
| 633 | RND="" | ||
| 634 | DEF_ANS="" | ||
| 635 | AUTO="" | ||
| 636 | case "$1" in | ||
| 637 | -r) RND="-r" ; AUTO="yes" ; shift ;; | ||
| 638 | -y) DEF_ANS="y" ; AUTO="yes" ; shift ;; | ||
| 639 | -m) DEF_ANS="m" ; AUTO="yes" ; shift ;; | ||
| 640 | -n) DEF_ANS="n" ; AUTO="yes" ; shift ;; | ||
| 641 | esac | ||
| 642 | |||
| 643 | CONFIG_IN=./config.in | ||
| 644 | if [ "$1" != "" ] ; then | ||
| 645 | CONFIG_IN=$1 | ||
| 646 | fi | ||
| 647 | |||
| 648 | DEFAULTS=sysdeps/$TARGET_OS/defconfig | ||
| 649 | if [ -f .config ]; then | ||
| 650 | DEFAULTS=.config | ||
| 651 | fi | ||
| 652 | |||
| 653 | if [ "$AUTO" != "yes" ]; then | ||
| 654 | if [ -f $DEFAULTS ]; then | ||
| 655 | echo "#" | ||
| 656 | echo "# Using defaults found in" $DEFAULTS | ||
| 657 | echo "#" | ||
| 658 | . $DEFAULTS | ||
| 659 | sed -e 's/# \(CONFIG_[^ ]*\) is not.*/\1=n/' <$DEFAULTS >.config-is-not.$$ | ||
| 660 | . .config-is-not.$$ | ||
| 661 | rm .config-is-not.$$ | ||
| 662 | else | ||
| 663 | echo "#" | ||
| 664 | echo "# No defaults found" | ||
| 665 | echo "#" | ||
| 666 | fi | ||
| 667 | else | ||
| 668 | if [ -f $FORCE_DEFAULT ]; then | ||
| 669 | echo "#" | ||
| 670 | echo "# Forcing defaults found in $FORCE_DEFAULT" | ||
| 671 | echo "#" | ||
| 672 | sed -e ' | ||
| 673 | s/# \(CONFIG_[^ ]*\) is not.*/\1=n/; | ||
| 674 | s/# range \(CONFIG_[^ ]*\) \([^ ][^ ]*\) \([^ ][^ ]*\)/MIN_\1=\2; MAX_\1=\3/; | ||
| 675 | s/# list \(CONFIG_[^ ]*\) \([^ ][^ ]*\)/LIST_\1=\2/ | ||
| 676 | ' <$FORCE_DEFAULT >.default_val.$$ | ||
| 677 | . .default_val.$$ | ||
| 678 | rm .default_val.$$ | ||
| 679 | else | ||
| 680 | echo "#" | ||
| 681 | echo "# No defaults found" | ||
| 682 | echo "#" | ||
| 683 | fi | ||
| 684 | fi | ||
| 685 | |||
| 686 | . $CONFIG_IN | ||
| 687 | |||
| 688 | rm -f .config.old | ||
| 689 | if [ -f .config ]; then | ||
| 690 | mv .config .config.old | ||
| 691 | fi | ||
| 692 | mv .tmpconfig .config | ||
| 693 | mv .tmpconfig.h include/config.h | ||
| 694 | |||
| 695 | echo | ||
| 696 | echo "*** End of BusyBox configuration." | ||
| 697 | echo "*** Check the top-level Makefile for additional configuration." | ||
| 698 | if [ ! -f .hdepend -o "$CONFIG_MODVERSIONS" = "y" ] ; then | ||
| 699 | echo "*** Next, you must run 'make dep'." | ||
| 700 | else | ||
| 701 | echo "*** Next, you may run 'make', or 'make install'." | ||
| 702 | fi | ||
| 703 | echo | ||
| 704 | |||
| 705 | exit 0 | ||
diff --git a/scripts/Menuconfig b/scripts/Menuconfig deleted file mode 100644 index 30d06ee29..000000000 --- a/scripts/Menuconfig +++ /dev/null | |||
| @@ -1,1287 +0,0 @@ | |||
| 1 | #! /bin/sh | ||
| 2 | # | ||
| 3 | # This script is used to configure BusyBox. | ||
| 4 | # | ||
| 5 | # It was inspired by a desire to not have to hit <enter> 9 million times | ||
| 6 | # or startup the X server just to change a single kernel parameter. | ||
| 7 | # | ||
| 8 | # This script attempts to parse the configuration files, which are | ||
| 9 | # scattered throughout the kernel source tree, and creates a temporary | ||
| 10 | # set of mini scripts which are in turn used to create nested menus and | ||
| 11 | # radiolists. | ||
| 12 | # | ||
| 13 | # It uses a very modified/mutilated version of the "dialog" utility | ||
| 14 | # written by Savio Lam (lam836@cs.cuhk.hk). Savio is not responsible | ||
| 15 | # for this script or the version of dialog used by this script. | ||
| 16 | # Please do not contact him with questions. The official version of | ||
| 17 | # dialog is available at sunsite.unc.edu or a sunsite mirror. | ||
| 18 | # | ||
| 19 | # Portions of this script were borrowed from the original Configure | ||
| 20 | # script. | ||
| 21 | # | ||
| 22 | # William Roadcap was the original author of Menuconfig. | ||
| 23 | # Michael Elizabeth Chastain (mec@shout.net) is the current maintainer. | ||
| 24 | # | ||
| 25 | # 070497 Bernhard Kaindl (bkaindl@netway.at) - get default values for | ||
| 26 | # new bool, tristate and dep_tristate parameters from the defconfig file. | ||
| 27 | # new configuration parameters are marked with '(NEW)' as in make config. | ||
| 28 | # | ||
| 29 | # 180697 Bernhard Kaindl (bkaindl@netway.at) - added the needed support | ||
| 30 | # for string options. They are handled like the int and hex options. | ||
| 31 | # | ||
| 32 | # 081297 Pavel Machek (pavel@atrey.karlin.mff.cuni.cz) - better error | ||
| 33 | # handling | ||
| 34 | # | ||
| 35 | # 131197 Michael Chastain (mec@shout.net) - output all lines for a | ||
| 36 | # choice list, not just the selected one. This makes the output | ||
| 37 | # the same as Configure output, which is important for smart config | ||
| 38 | # dependencies. | ||
| 39 | # | ||
| 40 | # 101297 Michael Chastain (mec@shout.net) - remove sound driver cruft. | ||
| 41 | # | ||
| 42 | # 221297 Michael Chastain (mec@shout.net) - make define_bool actually | ||
| 43 | # define its arguments so that later tests on them work right. | ||
| 44 | # | ||
| 45 | # 160198 Michael Chastain (mec@shout.net) - fix bug with 'c' command | ||
| 46 | # (complement existing value) when used on virgin uninitialized variables. | ||
| 47 | # | ||
| 48 | # 090398 Axel Boldt (boldt@math.ucsb.edu) - allow for empty lines in help | ||
| 49 | # texts. | ||
| 50 | # | ||
| 51 | # 12 Dec 1998, Michael Elizabeth Chastain (mec@shout.net) | ||
| 52 | # Remove a /tmp security hole in get_def (also makes it faster). | ||
| 53 | # Give uninitialized variables canonical values rather than null value. | ||
| 54 | # Change a lot of places to call set_x_info uniformly. | ||
| 55 | # Take out message about preparing version (old sound driver cruft). | ||
| 56 | # | ||
| 57 | # 13 Dec 1998, Riley H Williams <rhw@memalpha.cx> | ||
| 58 | # When an error occurs, actually display the error message as well as | ||
| 59 | # our comments thereon. | ||
| 60 | # | ||
| 61 | # 31 Dec 1998, Michael Elizabeth Chastain (mec@shout.net) | ||
| 62 | # Fix mod_bool to honor $CONFIG_MODULES. | ||
| 63 | # Fix dep_tristate to call define_bool when dependency is "n". | ||
| 64 | # | ||
| 65 | # 02 January 1999, Michael Elizabeth Chastain (mec@shout.net) | ||
| 66 | # Blow away lxdialog.scrltmp on entry to activate_menu. This protects | ||
| 67 | # against people who use commands like ' ' to select menus. | ||
| 68 | # | ||
| 69 | # 24 January 1999, Michael Elizabeth Chastain, <mec@shout.net> | ||
| 70 | # - Improve the exit message (Jeff Ronne). | ||
| 71 | # | ||
| 72 | # 06 July 1999, Andrzej M. Krzysztofowicz, <ankry@mif.pg.gda.pl> | ||
| 73 | # - Support for multiple conditions in dep_tristate(). | ||
| 74 | # - Implemented new functions: define_tristate(), define_int(), define_hex(), | ||
| 75 | # define_string(), dep_bool(). | ||
| 76 | # | ||
| 77 | # 22 October 2001, Erik Andersen <andersee@debian.org> | ||
| 78 | # - Adjusted for busybox (modified hard coded kernel specific paths, | ||
| 79 | # and everything to do with modules (tristates, modbools, etc). | ||
| 80 | |||
| 81 | |||
| 82 | # | ||
| 83 | # Change this to TRUE if you prefer all options listed | ||
| 84 | # in a single menu rather than the standard menu hierarchy. | ||
| 85 | # | ||
| 86 | single_menu_mode= | ||
| 87 | |||
| 88 | # | ||
| 89 | # Make sure we're really running bash. | ||
| 90 | # | ||
| 91 | [ -z "$BASH" ] && { echo "Menuconfig requires bash" 1>&2; exit 1; } | ||
| 92 | |||
| 93 | # | ||
| 94 | # Cache function definitions, turn off posix compliance | ||
| 95 | # | ||
| 96 | set -h +o posix | ||
| 97 | |||
| 98 | |||
| 99 | |||
| 100 | # Given a configuration variable, set the global variable $x to its value, | ||
| 101 | # and the global variable $info to the string " (NEW)" if this is a new | ||
| 102 | # variable. | ||
| 103 | # | ||
| 104 | # This function looks for: (1) the current value, or (2) the default value | ||
| 105 | # from the arch-dependent defconfig file, or (3) a default passed by the caller. | ||
| 106 | |||
| 107 | function set_x_info () { | ||
| 108 | eval x=\$$1 | ||
| 109 | if [ -z "$x" ]; then | ||
| 110 | eval `sed -n -e 's/# \(.*\) is not set.*/\1=n/' -e "/^$1=/p" sysdeps/$TARGET_OS/defconfig` | ||
| 111 | eval x=\${$1:-"$2"} | ||
| 112 | eval $1=$x | ||
| 113 | eval INFO_$1="' (NEW)'" | ||
| 114 | fi | ||
| 115 | eval info="\$INFO_$1" | ||
| 116 | } | ||
| 117 | |||
| 118 | # | ||
| 119 | # Load the functions used by the config.in files. | ||
| 120 | # | ||
| 121 | # I do this because these functions must be redefined depending | ||
| 122 | # on whether they are being called for interactive use or for | ||
| 123 | # saving a configuration to a file. | ||
| 124 | # | ||
| 125 | # Thank the heavens bash supports nesting function definitions. | ||
| 126 | # | ||
| 127 | load_functions () { | ||
| 128 | |||
| 129 | # | ||
| 130 | # Additional comments | ||
| 131 | # | ||
| 132 | function comment () { | ||
| 133 | comment_ctr=$[ comment_ctr + 1 ] | ||
| 134 | echo -ne "': $comment_ctr' '--- $1' " >>MCmenu | ||
| 135 | } | ||
| 136 | |||
| 137 | # | ||
| 138 | # Define a boolean to a specific value. | ||
| 139 | # | ||
| 140 | function define_bool () { | ||
| 141 | eval $1=$2 | ||
| 142 | } | ||
| 143 | |||
| 144 | function define_hex () { | ||
| 145 | eval $1=$2 | ||
| 146 | } | ||
| 147 | |||
| 148 | function define_int () { | ||
| 149 | eval $1=$2 | ||
| 150 | } | ||
| 151 | |||
| 152 | function define_string () { | ||
| 153 | eval $1="$2" | ||
| 154 | } | ||
| 155 | |||
| 156 | # | ||
| 157 | # Create a boolean (Yes/No) function for our current menu | ||
| 158 | # which calls our local bool function. | ||
| 159 | # | ||
| 160 | function bool () { | ||
| 161 | set_x_info "$2" "n" | ||
| 162 | |||
| 163 | case $x in | ||
| 164 | y|m) flag="*" ;; | ||
| 165 | n) flag=" " ;; | ||
| 166 | esac | ||
| 167 | |||
| 168 | echo -ne "'$2' '[$flag] $1$info' " >>MCmenu | ||
| 169 | |||
| 170 | echo -e "function $2 () { l_bool '$2' \"\$1\" ;}\n" >>MCradiolists | ||
| 171 | } | ||
| 172 | |||
| 173 | # | ||
| 174 | # Same as above, but now only Y and N are allowed as dependency | ||
| 175 | # (i.e. third and next arguments). | ||
| 176 | # | ||
| 177 | function dep_bool () { | ||
| 178 | ques="$1" | ||
| 179 | var="$2" | ||
| 180 | dep=y | ||
| 181 | shift 2 | ||
| 182 | while [ $# -gt 0 ]; do | ||
| 183 | if [ "$1" = y ]; then | ||
| 184 | shift | ||
| 185 | else | ||
| 186 | dep=n | ||
| 187 | shift $# | ||
| 188 | fi | ||
| 189 | done | ||
| 190 | if [ "$dep" = y ]; then | ||
| 191 | bool "$ques" "$var" | ||
| 192 | else | ||
| 193 | define_bool "$var" n | ||
| 194 | fi | ||
| 195 | } | ||
| 196 | |||
| 197 | function dep_mbool () { | ||
| 198 | ques="$1" | ||
| 199 | var="$2" | ||
| 200 | dep=y | ||
| 201 | shift 2 | ||
| 202 | while [ $# -gt 0 ]; do | ||
| 203 | if [ "$1" = y -o "$1" = m ]; then | ||
| 204 | shift | ||
| 205 | else | ||
| 206 | dep=n | ||
| 207 | shift $# | ||
| 208 | fi | ||
| 209 | done | ||
| 210 | if [ "$dep" = y ]; then | ||
| 211 | bool "$ques" "$var" | ||
| 212 | else | ||
| 213 | define_bool "$var" n | ||
| 214 | fi | ||
| 215 | } | ||
| 216 | |||
| 217 | # | ||
| 218 | # Add a menu item which will call our local int function. | ||
| 219 | # | ||
| 220 | function int () { | ||
| 221 | set_x_info "$2" "$3" | ||
| 222 | |||
| 223 | echo -ne "'$2' '($x) $1$info' " >>MCmenu | ||
| 224 | |||
| 225 | echo -e "function $2 () { l_int '$1' '$2' '$3' '$x' ;}" >>MCradiolists | ||
| 226 | } | ||
| 227 | |||
| 228 | # | ||
| 229 | # Add a menu item which will call our local hex function. | ||
| 230 | # | ||
| 231 | function hex () { | ||
| 232 | set_x_info "$2" "$3" | ||
| 233 | x=${x##*[x,X]} | ||
| 234 | |||
| 235 | echo -ne "'$2' '($x) $1$info' " >>MCmenu | ||
| 236 | |||
| 237 | echo -e "function $2 () { l_hex '$1' '$2' '$3' '$x' ;}" >>MCradiolists | ||
| 238 | } | ||
| 239 | |||
| 240 | # | ||
| 241 | # Add a menu item which will call our local string function. | ||
| 242 | # | ||
| 243 | function string () { | ||
| 244 | set_x_info "$2" "$3" | ||
| 245 | |||
| 246 | echo -ne "'$2' ' $1: \"$x\"$info' " >>MCmenu | ||
| 247 | |||
| 248 | echo -e "function $2 () { l_string '$1' '$2' '$3' '$x' ;}" >>MCradiolists | ||
| 249 | } | ||
| 250 | |||
| 251 | # | ||
| 252 | # Add a menu item which will call our local One-of-Many choice list. | ||
| 253 | # | ||
| 254 | function choice () { | ||
| 255 | # | ||
| 256 | # Need to remember params cause they're gonna get reset. | ||
| 257 | # | ||
| 258 | title=$1 | ||
| 259 | choices=$2 | ||
| 260 | default=$3 | ||
| 261 | current= | ||
| 262 | |||
| 263 | # | ||
| 264 | # Find out if one of the choices is already set. | ||
| 265 | # If it's not then make it the default. | ||
| 266 | # | ||
| 267 | set -- $choices | ||
| 268 | firstchoice=$2 | ||
| 269 | |||
| 270 | while [ -n "$2" ] | ||
| 271 | do | ||
| 272 | if eval [ "_\$$2" = "_y" ] | ||
| 273 | then | ||
| 274 | current=$1 | ||
| 275 | break | ||
| 276 | fi | ||
| 277 | shift ; shift | ||
| 278 | done | ||
| 279 | |||
| 280 | : ${current:=$default} | ||
| 281 | |||
| 282 | echo -ne "'$firstchoice' '($current) $title' " >>MCmenu | ||
| 283 | |||
| 284 | echo -e " | ||
| 285 | function $firstchoice () \ | ||
| 286 | { l_choice '$title' \"$choices\" \"$current\" ;}" >>MCradiolists | ||
| 287 | } | ||
| 288 | |||
| 289 | } # END load_functions() | ||
| 290 | |||
| 291 | |||
| 292 | |||
| 293 | |||
| 294 | |||
| 295 | # | ||
| 296 | # Extract available help for an option from Configure.help | ||
| 297 | # and send it to standard output. | ||
| 298 | # | ||
| 299 | # Most of this function was borrowed from the original kernel | ||
| 300 | # Configure script. | ||
| 301 | # | ||
| 302 | function extract_help () { | ||
| 303 | if [ -f docs/Configure.help ] | ||
| 304 | then | ||
| 305 | #first escape regexp special characters in the argument: | ||
| 306 | var=$(echo "$1"|sed 's/[][\/.^$*]/\\&/g') | ||
| 307 | #now pick out the right help text: | ||
| 308 | text=$(sed -n "/^$var[ ]*\$/,\${ | ||
| 309 | /^$var[ ]*\$/c\\ | ||
| 310 | ${var}:\\ | ||
| 311 | |||
| 312 | /^#/b | ||
| 313 | /^[^ ]/q | ||
| 314 | s/^ // | ||
| 315 | /<file:\\([^>]*\\)>/s//\\1/g | ||
| 316 | p | ||
| 317 | }" docs/Configure.help) | ||
| 318 | |||
| 319 | if [ -z "$text" ] | ||
| 320 | then | ||
| 321 | echo "There is no help available for this option." | ||
| 322 | return 1 | ||
| 323 | else | ||
| 324 | echo "$text" | ||
| 325 | fi | ||
| 326 | else | ||
| 327 | echo "There is no help available for this option." | ||
| 328 | return 1 | ||
| 329 | fi | ||
| 330 | } | ||
| 331 | |||
| 332 | # | ||
| 333 | # Activate a help dialog. | ||
| 334 | # | ||
| 335 | function help () { | ||
| 336 | if extract_help $1 >help.out | ||
| 337 | then | ||
| 338 | $DIALOG --backtitle "$backtitle" --title "$2"\ | ||
| 339 | --textbox help.out $ROWS $COLS | ||
| 340 | else | ||
| 341 | $DIALOG --backtitle "$backtitle" \ | ||
| 342 | --textbox help.out $ROWS $COLS | ||
| 343 | fi | ||
| 344 | rm -f help.out | ||
| 345 | } | ||
| 346 | |||
| 347 | # | ||
| 348 | # Show the README file. | ||
| 349 | # | ||
| 350 | function show_readme () { | ||
| 351 | $DIALOG --backtitle "$backtitle" \ | ||
| 352 | --textbox scripts/README.Menuconfig $ROWS $COLS | ||
| 353 | } | ||
| 354 | |||
| 355 | # | ||
| 356 | # Begin building the dialog menu command and Initialize the | ||
| 357 | # Radiolist function file. | ||
| 358 | # | ||
| 359 | function menu_name () { | ||
| 360 | echo -ne "$DIALOG --title '$1'\ | ||
| 361 | --backtitle '$backtitle' \ | ||
| 362 | --menu '$menu_instructions' \ | ||
| 363 | $ROWS $COLS $((ROWS-10)) \ | ||
| 364 | '$default' " >MCmenu | ||
| 365 | >MCradiolists | ||
| 366 | } | ||
| 367 | |||
| 368 | # | ||
| 369 | # Add a submenu option to the menu currently under construction. | ||
| 370 | # | ||
| 371 | function submenu () { | ||
| 372 | echo -ne "'activate_menu $2' '$1 --->' " >>MCmenu | ||
| 373 | } | ||
| 374 | |||
| 375 | # | ||
| 376 | # Handle a boolean (Yes/No) option. | ||
| 377 | # | ||
| 378 | function l_bool () { | ||
| 379 | if [ -n "$2" ] | ||
| 380 | then | ||
| 381 | case "$2" in | ||
| 382 | y|m) eval $1=y ;; | ||
| 383 | c) eval x=\$$1 | ||
| 384 | case $x in | ||
| 385 | y) eval $1=n ;; | ||
| 386 | n) eval $1=y ;; | ||
| 387 | *) eval $1=y ;; | ||
| 388 | esac ;; | ||
| 389 | *) eval $1=n ;; | ||
| 390 | esac | ||
| 391 | else | ||
| 392 | echo -ne "\007" | ||
| 393 | fi | ||
| 394 | } | ||
| 395 | |||
| 396 | # | ||
| 397 | # Create a dialog for entering an integer into a option. | ||
| 398 | # | ||
| 399 | function l_int () { | ||
| 400 | while true | ||
| 401 | do | ||
| 402 | if $DIALOG --title "$1" \ | ||
| 403 | --backtitle "$backtitle" \ | ||
| 404 | --inputbox "$inputbox_instructions_int" \ | ||
| 405 | 10 75 "$4" 2>MCdialog.out | ||
| 406 | then | ||
| 407 | answer="`cat MCdialog.out`" | ||
| 408 | answer="${answer:-$3}" | ||
| 409 | |||
| 410 | # Semantics of + and ? in GNU expr changed, so | ||
| 411 | # we avoid them: | ||
| 412 | if expr "$answer" : '0$' '|' "$answer" : '[1-9][0-9]*$' '|' "$answer" : '-[1-9][0-9]*$' >/dev/null | ||
| 413 | then | ||
| 414 | eval $2="$answer" | ||
| 415 | else | ||
| 416 | eval $2="$3" | ||
| 417 | echo -en "\007" | ||
| 418 | ${DIALOG} --backtitle "$backtitle" \ | ||
| 419 | --infobox "You have made an invalid entry." 3 43 | ||
| 420 | sleep 2 | ||
| 421 | fi | ||
| 422 | |||
| 423 | break | ||
| 424 | fi | ||
| 425 | |||
| 426 | help "$2" "$1" | ||
| 427 | done | ||
| 428 | } | ||
| 429 | |||
| 430 | # | ||
| 431 | # Create a dialog for entering a hexadecimal into an option. | ||
| 432 | # | ||
| 433 | function l_hex () { | ||
| 434 | while true | ||
| 435 | do | ||
| 436 | if $DIALOG --title "$1" \ | ||
| 437 | --backtitle "$backtitle" \ | ||
| 438 | --inputbox "$inputbox_instructions_hex" \ | ||
| 439 | 10 75 "$4" 2>MCdialog.out | ||
| 440 | then | ||
| 441 | answer="`cat MCdialog.out`" | ||
| 442 | answer="${answer:-$3}" | ||
| 443 | answer="${answer##*[x,X]}" | ||
| 444 | |||
| 445 | if expr "$answer" : '[0-9a-fA-F][0-9a-fA-F]*$' >/dev/null | ||
| 446 | then | ||
| 447 | eval $2="$answer" | ||
| 448 | else | ||
| 449 | eval $2="$3" | ||
| 450 | echo -en "\007" | ||
| 451 | ${DIALOG} --backtitle "$backtitle" \ | ||
| 452 | --infobox "You have made an invalid entry." 3 43 | ||
| 453 | sleep 2 | ||
| 454 | fi | ||
| 455 | |||
| 456 | break | ||
| 457 | fi | ||
| 458 | |||
| 459 | help "$2" "$1" | ||
| 460 | done | ||
| 461 | } | ||
| 462 | |||
| 463 | # | ||
| 464 | # Create a dialog for entering a string into an option. | ||
| 465 | # | ||
| 466 | function l_string () { | ||
| 467 | while true | ||
| 468 | do | ||
| 469 | if $DIALOG --title "$1" \ | ||
| 470 | --backtitle "$backtitle" \ | ||
| 471 | --inputbox "$inputbox_instructions_string" \ | ||
| 472 | 10 75 "$4" 2>MCdialog.out | ||
| 473 | then | ||
| 474 | answer="`cat MCdialog.out`" | ||
| 475 | answer="${answer:-$3}" | ||
| 476 | |||
| 477 | # | ||
| 478 | # Someone may add a nice check for the entered | ||
| 479 | # string here... | ||
| 480 | # | ||
| 481 | eval $2=\"$answer\" | ||
| 482 | |||
| 483 | break | ||
| 484 | fi | ||
| 485 | |||
| 486 | help "$2" "$1" | ||
| 487 | done | ||
| 488 | } | ||
| 489 | |||
| 490 | |||
| 491 | # | ||
| 492 | # Handle a one-of-many choice list. | ||
| 493 | # | ||
| 494 | function l_choice () { | ||
| 495 | # | ||
| 496 | # Need to remember params cause they're gonna get reset. | ||
| 497 | # | ||
| 498 | title="$1" | ||
| 499 | choices="$2" | ||
| 500 | current="$3" | ||
| 501 | chosen= | ||
| 502 | |||
| 503 | # | ||
| 504 | # Scan current value of choices and set radiolist switches. | ||
| 505 | # | ||
| 506 | list= | ||
| 507 | set -- $choices | ||
| 508 | firstchoice=$2 | ||
| 509 | while [ -n "$2" ] | ||
| 510 | do | ||
| 511 | case "$1" in | ||
| 512 | "$current"*) if [ -z "$chosen" ]; then | ||
| 513 | list="$list $2 $1 ON " | ||
| 514 | chosen=1 | ||
| 515 | else | ||
| 516 | list="$list $2 $1 OFF " | ||
| 517 | fi ;; | ||
| 518 | *) list="$list $2 $1 OFF " ;; | ||
| 519 | esac | ||
| 520 | |||
| 521 | shift ; shift | ||
| 522 | done | ||
| 523 | |||
| 524 | while true | ||
| 525 | do | ||
| 526 | if $DIALOG --title "$title" \ | ||
| 527 | --backtitle "$backtitle" \ | ||
| 528 | --radiolist "$radiolist_instructions" \ | ||
| 529 | 15 70 6 $list 2>MCdialog.out | ||
| 530 | then | ||
| 531 | choice=`cat MCdialog.out` | ||
| 532 | break | ||
| 533 | fi | ||
| 534 | |||
| 535 | help "$firstchoice" "$title" | ||
| 536 | done | ||
| 537 | |||
| 538 | # | ||
| 539 | # Now set the boolean value of each option based on | ||
| 540 | # the selection made from the radiolist. | ||
| 541 | # | ||
| 542 | set -- $choices | ||
| 543 | while [ -n "$2" ] | ||
| 544 | do | ||
| 545 | if [ "$2" = "$choice" ] | ||
| 546 | then | ||
| 547 | eval $2="y" | ||
| 548 | else | ||
| 549 | eval $2="n" | ||
| 550 | fi | ||
| 551 | |||
| 552 | shift ; shift | ||
| 553 | done | ||
| 554 | } | ||
| 555 | |||
| 556 | # | ||
| 557 | # Call awk, and watch for error codes, etc. | ||
| 558 | # | ||
| 559 | function callawk () { | ||
| 560 | awk "$1" || echo "Awk died with error code $?. Giving up." || exit 1 | ||
| 561 | } | ||
| 562 | |||
| 563 | # | ||
| 564 | # A faster awk based recursive parser. (I hope) | ||
| 565 | # | ||
| 566 | function parser1 () { | ||
| 567 | callawk ' | ||
| 568 | BEGIN { | ||
| 569 | menu_no = 0 | ||
| 570 | comment_is_option = 0 | ||
| 571 | parser("'$CONFIG_IN'","MCmenu0") | ||
| 572 | } | ||
| 573 | |||
| 574 | function parser(ifile,menu) { | ||
| 575 | |||
| 576 | while (getline <ifile) { | ||
| 577 | if ($1 == "mainmenu_option") { | ||
| 578 | comment_is_option = "1" | ||
| 579 | } | ||
| 580 | else if ($1 == "comment" && comment_is_option == "1") { | ||
| 581 | comment_is_option= "0" | ||
| 582 | sub($1,"",$0) | ||
| 583 | ++menu_no | ||
| 584 | |||
| 585 | printf("submenu %s MCmenu%s\n", $0, menu_no) >>menu | ||
| 586 | |||
| 587 | newmenu = sprintf("MCmenu%d", menu_no); | ||
| 588 | printf( "function MCmenu%s () {\n"\ | ||
| 589 | "default=$1\n"\ | ||
| 590 | "menu_name %s\n",\ | ||
| 591 | menu_no, $0) >newmenu | ||
| 592 | |||
| 593 | parser(ifile, newmenu) | ||
| 594 | } | ||
| 595 | else if ($0 ~ /^#|\$MAKE|mainmenu_name/) { | ||
| 596 | printf("") >>menu | ||
| 597 | } | ||
| 598 | else if ($1 ~ "endmenu") { | ||
| 599 | printf("}\n") >>menu | ||
| 600 | return | ||
| 601 | } | ||
| 602 | else if ($1 == "source") { | ||
| 603 | parser($2,menu) | ||
| 604 | } | ||
| 605 | else { | ||
| 606 | print >>menu | ||
| 607 | } | ||
| 608 | } | ||
| 609 | }' | ||
| 610 | } | ||
| 611 | |||
| 612 | # | ||
| 613 | # Secondary parser for single menu mode. | ||
| 614 | # | ||
| 615 | function parser2 () { | ||
| 616 | callawk ' | ||
| 617 | BEGIN { | ||
| 618 | parser("'$CONFIG_IN'","MCmenu0") | ||
| 619 | } | ||
| 620 | |||
| 621 | function parser(ifile,menu) { | ||
| 622 | |||
| 623 | while (getline <ifile) { | ||
| 624 | if ($0 ~ /^#|$MAKE|mainmenu_name/) { | ||
| 625 | printf("") >>menu | ||
| 626 | } | ||
| 627 | else if ($1 ~ /mainmenu_option|endmenu/) { | ||
| 628 | printf("") >>menu | ||
| 629 | } | ||
| 630 | else if ($1 == "source") { | ||
| 631 | parser($2,menu) | ||
| 632 | } | ||
| 633 | else { | ||
| 634 | print >>menu | ||
| 635 | } | ||
| 636 | } | ||
| 637 | }' | ||
| 638 | } | ||
| 639 | |||
| 640 | # | ||
| 641 | # Parse all the config.in files into mini scripts. | ||
| 642 | # | ||
| 643 | function parse_config_files () { | ||
| 644 | rm -f MCmenu* | ||
| 645 | |||
| 646 | echo "function MCmenu0 () {" >MCmenu0 | ||
| 647 | echo 'default=$1' >>MCmenu0 | ||
| 648 | echo "menu_name 'Main Menu'" >>MCmenu0 | ||
| 649 | |||
| 650 | if [ "_$single_menu_mode" = "_TRUE" ] | ||
| 651 | then | ||
| 652 | parser2 | ||
| 653 | else | ||
| 654 | parser1 | ||
| 655 | fi | ||
| 656 | |||
| 657 | echo "comment ''" >>MCmenu0 | ||
| 658 | echo "g_alt_config" >>MCmenu0 | ||
| 659 | echo "s_alt_config" >>MCmenu0 | ||
| 660 | |||
| 661 | echo "}" >>MCmenu0 | ||
| 662 | |||
| 663 | # | ||
| 664 | # These mini scripts must be sourced into the current | ||
| 665 | # environment in order for all of this to work. Leaving | ||
| 666 | # them on the disk as executables screws up the recursion | ||
| 667 | # in activate_menu(), among other things. Once they are | ||
| 668 | # sourced we can discard them. | ||
| 669 | # | ||
| 670 | for i in MCmenu* | ||
| 671 | do | ||
| 672 | echo -n "." | ||
| 673 | source ./$i | ||
| 674 | done | ||
| 675 | rm -f MCmenu* | ||
| 676 | } | ||
| 677 | |||
| 678 | # | ||
| 679 | # This is the menu tree's bootstrap. | ||
| 680 | # | ||
| 681 | # Executes the parsed menus on demand and creates a set of functions, | ||
| 682 | # one per configuration option. These functions will in turn execute | ||
| 683 | # dialog commands or recursively call other menus. | ||
| 684 | # | ||
| 685 | function activate_menu () { | ||
| 686 | rm -f lxdialog.scrltmp | ||
| 687 | while true | ||
| 688 | do | ||
| 689 | comment_ctr=0 #So comment lines get unique tags | ||
| 690 | |||
| 691 | $1 "$default" 2> MCerror #Create the lxdialog menu & functions | ||
| 692 | |||
| 693 | if [ "$?" != "0" ] | ||
| 694 | then | ||
| 695 | clear | ||
| 696 | cat <<EOM | ||
| 697 | |||
| 698 | Menuconfig has encountered a possible error in one of BusyBox's | ||
| 699 | configuration files and is unable to continue. Here is the error | ||
| 700 | report: | ||
| 701 | |||
| 702 | EOM | ||
| 703 | sed 's/^/ Q> /' MCerror | ||
| 704 | cat <<EOM | ||
| 705 | |||
| 706 | Please report this to the maintainer <mec@shout.net>. You may also | ||
| 707 | send a problem report to <busybox@busybox.net>. | ||
| 708 | |||
| 709 | Please indicate the BusyBox version you are trying to configure and | ||
| 710 | which menu you were trying to enter when this error occurred. | ||
| 711 | |||
| 712 | EOM | ||
| 713 | cleanup | ||
| 714 | exit 1 | ||
| 715 | fi | ||
| 716 | rm -f MCerror | ||
| 717 | |||
| 718 | . ./MCradiolists #Source the menu's functions | ||
| 719 | |||
| 720 | . ./MCmenu 2>MCdialog.out #Activate the lxdialog menu | ||
| 721 | ret=$? | ||
| 722 | |||
| 723 | read selection <MCdialog.out | ||
| 724 | |||
| 725 | case "$ret" in | ||
| 726 | 0|3|4|5|6) | ||
| 727 | defaults="$selection$defaults" #pseudo stack | ||
| 728 | case "$ret" in | ||
| 729 | 0) eval $selection ;; | ||
| 730 | 3) eval $selection y ;; | ||
| 731 | 4) eval $selection n ;; | ||
| 732 | 5) eval $selection m ;; | ||
| 733 | 6) eval $selection c ;; | ||
| 734 | esac | ||
| 735 | default="${defaults%%*}" defaults="${defaults#*}" | ||
| 736 | ;; | ||
| 737 | 2) | ||
| 738 | default="${selection%%\ *}" | ||
| 739 | |||
| 740 | case "$selection" in | ||
| 741 | *"-->"*|*"alt_config"*) | ||
| 742 | show_readme ;; | ||
| 743 | *) | ||
| 744 | eval help $selection ;; | ||
| 745 | esac | ||
| 746 | ;; | ||
| 747 | 255|1) | ||
| 748 | break | ||
| 749 | ;; | ||
| 750 | 139) | ||
| 751 | stty sane | ||
| 752 | clear | ||
| 753 | cat <<EOM | ||
| 754 | |||
| 755 | There seems to be a problem with the lxdialog companion utility which is | ||
| 756 | built prior to running Menuconfig. Usually this is an indicator that you | ||
| 757 | have upgraded/downgraded your ncurses libraries and did not remove the | ||
| 758 | old ncurses header file(s) in /usr/include or /usr/include/ncurses. | ||
| 759 | |||
| 760 | It is VERY important that you have only one set of ncurses header files | ||
| 761 | and that those files are properly version matched to the ncurses libraries | ||
| 762 | installed on your machine. | ||
| 763 | |||
| 764 | You may also need to rebuild lxdialog. This can be done by moving to | ||
| 765 | the /usr/src/linux/scripts/lxdialog directory and issuing the | ||
| 766 | "make clean all" command. | ||
| 767 | |||
| 768 | If you have verified that your ncurses install is correct, you may email | ||
| 769 | the maintainer <andersen@codepoet.org> or post a message to | ||
| 770 | <busybox@busybox.net> for additional assistance. | ||
| 771 | |||
| 772 | EOM | ||
| 773 | cleanup | ||
| 774 | exit 139 | ||
| 775 | ;; | ||
| 776 | esac | ||
| 777 | done | ||
| 778 | } | ||
| 779 | |||
| 780 | # | ||
| 781 | # Create a menu item to load an alternate configuration file. | ||
| 782 | # | ||
| 783 | g_alt_config () { | ||
| 784 | echo -n "get_alt_config 'Load an Alternate Configuration File' "\ | ||
| 785 | >>MCmenu | ||
| 786 | } | ||
| 787 | |||
| 788 | # | ||
| 789 | # Get alternate config file name and load the | ||
| 790 | # configuration from it. | ||
| 791 | # | ||
| 792 | get_alt_config () { | ||
| 793 | set -f ## Switch file expansion OFF | ||
| 794 | |||
| 795 | while true | ||
| 796 | do | ||
| 797 | ALT_CONFIG="${ALT_CONFIG:-$DEFAULTS}" | ||
| 798 | |||
| 799 | $DIALOG --backtitle "$backtitle" \ | ||
| 800 | --inputbox "\ | ||
| 801 | Enter the name of the configuration file you wish to load. \ | ||
| 802 | Accept the name shown to restore the configuration you \ | ||
| 803 | last retrieved. Leave blank to abort."\ | ||
| 804 | 11 55 "$ALT_CONFIG" 2>MCdialog.out | ||
| 805 | |||
| 806 | if [ "$?" = "0" ] | ||
| 807 | then | ||
| 808 | ALT_CONFIG=`cat MCdialog.out` | ||
| 809 | |||
| 810 | [ "_" = "_$ALT_CONFIG" ] && break | ||
| 811 | |||
| 812 | if eval [ -r "$ALT_CONFIG" ] | ||
| 813 | then | ||
| 814 | eval load_config_file "$ALT_CONFIG" | ||
| 815 | break | ||
| 816 | else | ||
| 817 | echo -ne "\007" | ||
| 818 | $DIALOG --backtitle "$backtitle" \ | ||
| 819 | --infobox "File does not exist!" 3 38 | ||
| 820 | sleep 2 | ||
| 821 | fi | ||
| 822 | else | ||
| 823 | cat <<EOM >help.out | ||
| 824 | |||
| 825 | For various reasons, one may wish to keep several different BusyBox | ||
| 826 | configurations available on a single machine. | ||
| 827 | |||
| 828 | If you have saved a previous configuration in a file other than the | ||
| 829 | busybox default, entering the name of the file here will allow you | ||
| 830 | to modify that configuration. | ||
| 831 | |||
| 832 | If you are uncertain, then you have probably never used alternate | ||
| 833 | configuration files. You should therefor leave this blank to abort. | ||
| 834 | |||
| 835 | EOM | ||
| 836 | $DIALOG --backtitle "$backtitle"\ | ||
| 837 | --title "Load Alternate Configuration"\ | ||
| 838 | --textbox help.out $ROWS $COLS | ||
| 839 | fi | ||
| 840 | done | ||
| 841 | |||
| 842 | set +f ## Switch file expansion ON | ||
| 843 | rm -f help.out MCdialog.out | ||
| 844 | } | ||
| 845 | |||
| 846 | # | ||
| 847 | # Create a menu item to store an alternate config file. | ||
| 848 | # | ||
| 849 | s_alt_config () { | ||
| 850 | echo -n "save_alt_config 'Save Configuration to an Alternate File' "\ | ||
| 851 | >>MCmenu | ||
| 852 | } | ||
| 853 | |||
| 854 | # | ||
| 855 | # Get an alternate config file name and save the current | ||
| 856 | # configuration to it. | ||
| 857 | # | ||
| 858 | save_alt_config () { | ||
| 859 | set -f ## Switch file expansion OFF | ||
| 860 | |||
| 861 | while true | ||
| 862 | do | ||
| 863 | $DIALOG --backtitle "$backtitle" \ | ||
| 864 | --inputbox "\ | ||
| 865 | Enter a filename to which this configuration should be saved \ | ||
| 866 | as an alternate. Leave blank to abort."\ | ||
| 867 | 10 55 "$ALT_CONFIG" 2>MCdialog.out | ||
| 868 | |||
| 869 | if [ "$?" = "0" ] | ||
| 870 | then | ||
| 871 | ALT_CONFIG=`cat MCdialog.out` | ||
| 872 | |||
| 873 | [ "_" = "_$ALT_CONFIG" ] && break | ||
| 874 | |||
| 875 | if eval touch $ALT_CONFIG 2>/dev/null | ||
| 876 | then | ||
| 877 | eval save_configuration $ALT_CONFIG | ||
| 878 | load_functions ## RELOAD | ||
| 879 | break | ||
| 880 | else | ||
| 881 | echo -ne "\007" | ||
| 882 | $DIALOG --backtitle "$backtitle" \ | ||
| 883 | --infobox "Can't create file! Probably a nonexistent directory." 3 60 | ||
| 884 | sleep 2 | ||
| 885 | fi | ||
| 886 | else | ||
| 887 | cat <<EOM >help.out | ||
| 888 | |||
| 889 | For various reasons, one may wish to keep different BusyBox | ||
| 890 | configurations available on a single machine. | ||
| 891 | |||
| 892 | Entering a file name here will allow you to later retrieve, modify | ||
| 893 | and use the current configuration as an alternate to whatever | ||
| 894 | configuration options you have selected at that time. | ||
| 895 | |||
| 896 | If you are uncertain what all this means then you should probably | ||
| 897 | leave this blank. | ||
| 898 | EOM | ||
| 899 | $DIALOG --backtitle "$backtitle"\ | ||
| 900 | --title "Save Alternate Configuration"\ | ||
| 901 | --textbox help.out $ROWS $COLS | ||
| 902 | fi | ||
| 903 | done | ||
| 904 | |||
| 905 | set +f ## Switch file expansion ON | ||
| 906 | rm -f help.out MCdialog.out | ||
| 907 | } | ||
| 908 | |||
| 909 | # | ||
| 910 | # Load config options from a file. | ||
| 911 | # Converts all "# OPTION is not set" lines to "OPTION=n" lines | ||
| 912 | # | ||
| 913 | function load_config_file () { | ||
| 914 | awk ' | ||
| 915 | /# .* is not set.*/ { printf("%s=n\n", $2) } | ||
| 916 | ! /# .* is not set.*/ { print } | ||
| 917 | ' $1 >.tmpconfig | ||
| 918 | |||
| 919 | source ./.tmpconfig | ||
| 920 | rm -f .tmpconfig | ||
| 921 | } | ||
| 922 | |||
| 923 | # | ||
| 924 | # Just what it says. | ||
| 925 | # | ||
| 926 | save_configuration () { | ||
| 927 | echo | ||
| 928 | echo -n "Saving your BusyBox configuration." | ||
| 929 | |||
| 930 | # | ||
| 931 | # Now, let's redefine the configuration functions for final | ||
| 932 | # output to the config files. | ||
| 933 | # | ||
| 934 | # Nested function definitions, YIPEE! | ||
| 935 | # | ||
| 936 | function bool () { | ||
| 937 | set_x_info "$2" "n" | ||
| 938 | eval define_bool "$2" "$x" | ||
| 939 | } | ||
| 940 | |||
| 941 | function dep_bool () { | ||
| 942 | set_x_info "$2" "n" | ||
| 943 | var="$2" | ||
| 944 | shift 2 | ||
| 945 | while [ $# -gt 0 ]; do | ||
| 946 | if [ "$1" = y ]; then | ||
| 947 | shift | ||
| 948 | else | ||
| 949 | x=n; shift $# | ||
| 950 | fi | ||
| 951 | done | ||
| 952 | define_bool "$var" "$x" | ||
| 953 | } | ||
| 954 | |||
| 955 | function int () { | ||
| 956 | set_x_info "$2" "$3" | ||
| 957 | echo "$2=$x" >>$CONFIG | ||
| 958 | echo "#define $2 ($x)" >>$CONFIG_H | ||
| 959 | } | ||
| 960 | |||
| 961 | function hex () { | ||
| 962 | set_x_info "$2" "$3" | ||
| 963 | echo "$2=$x" >>$CONFIG | ||
| 964 | echo "#define $2 0x${x##*[x,X]}" >>$CONFIG_H | ||
| 965 | } | ||
| 966 | |||
| 967 | function string () { | ||
| 968 | set_x_info "$2" "$3" | ||
| 969 | echo "$2=\"$x\"" >>$CONFIG | ||
| 970 | echo "#define $2 \"$x\"" >>$CONFIG_H | ||
| 971 | } | ||
| 972 | |||
| 973 | function define_hex () { | ||
| 974 | eval $1="$2" | ||
| 975 | echo "$1=$2" >>$CONFIG | ||
| 976 | echo "#define $1 0x${2##*[x,X]}" >>$CONFIG_H | ||
| 977 | } | ||
| 978 | |||
| 979 | function define_int () { | ||
| 980 | eval $1="$2" | ||
| 981 | echo "$1=$2" >>$CONFIG | ||
| 982 | echo "#define $1 ($2)" >>$CONFIG_H | ||
| 983 | } | ||
| 984 | |||
| 985 | function define_string () { | ||
| 986 | eval $1="$2" | ||
| 987 | echo "$1=\"$2\"" >>$CONFIG | ||
| 988 | echo "#define $1 \"$2\"" >>$CONFIG_H | ||
| 989 | } | ||
| 990 | |||
| 991 | function define_bool () { | ||
| 992 | define_tristate "$1" "$2" | ||
| 993 | } | ||
| 994 | |||
| 995 | function define_tristate () { | ||
| 996 | eval $1="$2" | ||
| 997 | |||
| 998 | case "$2" in | ||
| 999 | y) | ||
| 1000 | echo "$1=y" >>$CONFIG | ||
| 1001 | echo "#define $1 1" >>$CONFIG_H | ||
| 1002 | ;; | ||
| 1003 | |||
| 1004 | n) | ||
| 1005 | echo "# $1 is not set" >>$CONFIG | ||
| 1006 | echo "#undef $1" >>$CONFIG_H | ||
| 1007 | ;; | ||
| 1008 | esac | ||
| 1009 | } | ||
| 1010 | |||
| 1011 | function choice () { | ||
| 1012 | # | ||
| 1013 | # Find the first choice that's already set to 'y' | ||
| 1014 | # | ||
| 1015 | choices="$2" | ||
| 1016 | default="$3" | ||
| 1017 | current= | ||
| 1018 | chosen= | ||
| 1019 | |||
| 1020 | set -- $choices | ||
| 1021 | while [ -n "$2" ] | ||
| 1022 | do | ||
| 1023 | if eval [ "_\$$2" = "_y" ] | ||
| 1024 | then | ||
| 1025 | current=$1 | ||
| 1026 | break | ||
| 1027 | fi | ||
| 1028 | shift ; shift | ||
| 1029 | done | ||
| 1030 | |||
| 1031 | # | ||
| 1032 | # Use the default if none were set. | ||
| 1033 | # | ||
| 1034 | : ${current:=$default} | ||
| 1035 | |||
| 1036 | # | ||
| 1037 | # Output all choices (to be compatible with other configs). | ||
| 1038 | # | ||
| 1039 | set -- $choices | ||
| 1040 | while [ -n "$2" ] | ||
| 1041 | do | ||
| 1042 | case "$1" in | ||
| 1043 | "$current"*) if [ -z "$chosen" ]; then | ||
| 1044 | define_bool "$2" "y" | ||
| 1045 | chosen=1 | ||
| 1046 | else | ||
| 1047 | define_bool "$2" "n" | ||
| 1048 | fi ;; | ||
| 1049 | *) define_bool "$2" "n" ;; | ||
| 1050 | esac | ||
| 1051 | shift ; shift | ||
| 1052 | done | ||
| 1053 | } | ||
| 1054 | |||
| 1055 | function mainmenu_name () { | ||
| 1056 | : | ||
| 1057 | } | ||
| 1058 | |||
| 1059 | function mainmenu_option () { | ||
| 1060 | comment_is_option=TRUE | ||
| 1061 | } | ||
| 1062 | |||
| 1063 | function endmenu () { | ||
| 1064 | : | ||
| 1065 | } | ||
| 1066 | |||
| 1067 | function comment () { | ||
| 1068 | if [ "$comment_is_option" ] | ||
| 1069 | then | ||
| 1070 | comment_is_option= | ||
| 1071 | echo >>$CONFIG | ||
| 1072 | echo "#" >>$CONFIG | ||
| 1073 | echo "# $1" >>$CONFIG | ||
| 1074 | echo "#" >>$CONFIG | ||
| 1075 | |||
| 1076 | echo >>$CONFIG_H | ||
| 1077 | echo "/*" >>$CONFIG_H | ||
| 1078 | echo " * $1" >>$CONFIG_H | ||
| 1079 | echo " */" >>$CONFIG_H | ||
| 1080 | fi | ||
| 1081 | } | ||
| 1082 | |||
| 1083 | echo -n "." | ||
| 1084 | |||
| 1085 | DEF_CONFIG="${1:-.config}" | ||
| 1086 | DEF_CONFIG_H="include/config.h" | ||
| 1087 | |||
| 1088 | CONFIG=.tmpconfig | ||
| 1089 | CONFIG_H=.tmpconfig.h | ||
| 1090 | |||
| 1091 | echo "#" >$CONFIG | ||
| 1092 | echo "# Automatically generated by make menuconfig: don't edit" >>$CONFIG | ||
| 1093 | echo "#" >>$CONFIG | ||
| 1094 | |||
| 1095 | echo "/*" >$CONFIG_H | ||
| 1096 | echo " * Automatically generated by make menuconfig: don't edit" >>$CONFIG_H | ||
| 1097 | echo " */" >>$CONFIG_H | ||
| 1098 | echo "#define AUTOCONF_INCLUDED" >> $CONFIG_H | ||
| 1099 | |||
| 1100 | echo -n "." | ||
| 1101 | if . $CONFIG_IN >>.menuconfig.log 2>&1 | ||
| 1102 | then | ||
| 1103 | if [ "$DEF_CONFIG" = ".config" ] | ||
| 1104 | then | ||
| 1105 | mv $CONFIG_H $DEF_CONFIG_H | ||
| 1106 | fi | ||
| 1107 | |||
| 1108 | if [ -f "$DEF_CONFIG" ] | ||
| 1109 | then | ||
| 1110 | rm -f ${DEF_CONFIG}.old | ||
| 1111 | mv $DEF_CONFIG ${DEF_CONFIG}.old | ||
| 1112 | fi | ||
| 1113 | |||
| 1114 | mv $CONFIG $DEF_CONFIG | ||
| 1115 | |||
| 1116 | return 0 | ||
| 1117 | else | ||
| 1118 | return 1 | ||
| 1119 | fi | ||
| 1120 | } | ||
| 1121 | |||
| 1122 | # | ||
| 1123 | # Remove temporary files | ||
| 1124 | # | ||
| 1125 | cleanup () { | ||
| 1126 | cleanup1 | ||
| 1127 | cleanup2 | ||
| 1128 | } | ||
| 1129 | |||
| 1130 | cleanup1 () { | ||
| 1131 | rm -f MCmenu* MCradiolists MCdialog.out help.out | ||
| 1132 | } | ||
| 1133 | |||
| 1134 | cleanup2 () { | ||
| 1135 | rm -f .tmpconfig .tmpconfig.h | ||
| 1136 | } | ||
| 1137 | |||
| 1138 | set_geometry () { | ||
| 1139 | # Some distributions export these with incorrect values | ||
| 1140 | # which can really screw up some ncurses programs. | ||
| 1141 | LINES= COLUMNS= | ||
| 1142 | |||
| 1143 | ROWS=${1:-24} COLS=${2:-80} | ||
| 1144 | |||
| 1145 | # Just in case the nasty rlogin bug returns. | ||
| 1146 | # | ||
| 1147 | [ $ROWS = 0 ] && ROWS=24 | ||
| 1148 | [ $COLS = 0 ] && COLS=80 | ||
| 1149 | |||
| 1150 | if [ $ROWS -lt 19 -o $COLS -lt 80 ] | ||
| 1151 | then | ||
| 1152 | echo -e "\n\007Your display is too small to run Menuconfig!" | ||
| 1153 | echo "It must be at least 19 lines by 80 columns." | ||
| 1154 | exit 1 | ||
| 1155 | fi | ||
| 1156 | |||
| 1157 | ROWS=$((ROWS-4)) COLS=$((COLS-5)) | ||
| 1158 | } | ||
| 1159 | |||
| 1160 | |||
| 1161 | set_geometry `stty size 2>/dev/null` | ||
| 1162 | |||
| 1163 | menu_instructions="\ | ||
| 1164 | Enabling options will increase the size of busybox. \ | ||
| 1165 | Arrow keys navigate the menu. \ | ||
| 1166 | Pressing <Enter> selects submenus --->. \ | ||
| 1167 | Highlighted letters are hotkeys. \ | ||
| 1168 | Pressing <Y> includes, and <N> excludes. \ | ||
| 1169 | Press <Esc><Esc> to exit, <?> for Help. \ | ||
| 1170 | Legend: [*] built-in [ ] excluded" | ||
| 1171 | |||
| 1172 | |||
| 1173 | radiolist_instructions="\ | ||
| 1174 | Use the arrow keys to navigate this window or \ | ||
| 1175 | press the hotkey of the item you wish to select \ | ||
| 1176 | followed by the <SPACE BAR>. | ||
| 1177 | Press <?> for additional information about this option." | ||
| 1178 | |||
| 1179 | inputbox_instructions_int="\ | ||
| 1180 | Please enter a decimal value. \ | ||
| 1181 | Fractions will not be accepted. \ | ||
| 1182 | Use the <TAB> key to move from the input field to the buttons below it." | ||
| 1183 | |||
| 1184 | inputbox_instructions_hex="\ | ||
| 1185 | Please enter a hexadecimal value. \ | ||
| 1186 | Use the <TAB> key to move from the input field to the buttons below it." | ||
| 1187 | |||
| 1188 | inputbox_instructions_string="\ | ||
| 1189 | Please enter a string value. \ | ||
| 1190 | Use the <TAB> key to move from the input field to the buttons below it." | ||
| 1191 | |||
| 1192 | DIALOG="./scripts/lxdialog/lxdialog" | ||
| 1193 | |||
| 1194 | bb_version="${VERSION}" | ||
| 1195 | backtitle="BusyBox v$bb_version Configuration" | ||
| 1196 | |||
| 1197 | trap "cleanup ; exit 1" 1 2 15 | ||
| 1198 | |||
| 1199 | |||
| 1200 | # | ||
| 1201 | # Locate default files. | ||
| 1202 | # | ||
| 1203 | CONFIG_IN=./config.in | ||
| 1204 | if [ "$1" != "" ] ; then | ||
| 1205 | CONFIG_IN=$1 | ||
| 1206 | fi | ||
| 1207 | |||
| 1208 | DEFAULTS=sysdeps/$TARGET_OS/defconfig | ||
| 1209 | if [ -f .config ]; then | ||
| 1210 | DEFAULTS=.config | ||
| 1211 | fi | ||
| 1212 | |||
| 1213 | if [ -f $DEFAULTS ] | ||
| 1214 | then | ||
| 1215 | echo "Using defaults found in" $DEFAULTS | ||
| 1216 | load_config_file $DEFAULTS | ||
| 1217 | else | ||
| 1218 | echo "No defaults found" | ||
| 1219 | fi | ||
| 1220 | |||
| 1221 | |||
| 1222 | # Fresh new log. | ||
| 1223 | >.menuconfig.log | ||
| 1224 | |||
| 1225 | # Load the functions used by the config.in files. | ||
| 1226 | echo -n "Preparing scripts: functions" | ||
| 1227 | load_functions | ||
| 1228 | |||
| 1229 | if [ ! -e $CONFIG_IN ] | ||
| 1230 | then | ||
| 1231 | echo "Your main config.in file ($CONFIG_IN) does not exist" | ||
| 1232 | exit 1 | ||
| 1233 | fi | ||
| 1234 | |||
| 1235 | if [ ! -x $DIALOG ] | ||
| 1236 | then | ||
| 1237 | echo "Your lxdialog utility does not exist" | ||
| 1238 | exit 1 | ||
| 1239 | fi | ||
| 1240 | |||
| 1241 | # | ||
| 1242 | # Read config.in files and parse them into one shell function per menu. | ||
| 1243 | # | ||
| 1244 | echo -n ", parsing" | ||
| 1245 | parse_config_files $CONFIG_IN | ||
| 1246 | |||
| 1247 | echo "done." | ||
| 1248 | # | ||
| 1249 | # Start the ball rolling from the top. | ||
| 1250 | # | ||
| 1251 | activate_menu MCmenu0 | ||
| 1252 | |||
| 1253 | # | ||
| 1254 | # All done! | ||
| 1255 | # | ||
| 1256 | cleanup1 | ||
| 1257 | |||
| 1258 | # | ||
| 1259 | # Confirm and Save | ||
| 1260 | # | ||
| 1261 | if $DIALOG --backtitle "$backtitle" \ | ||
| 1262 | --yesno "Do you wish to save your new BusyBox configuration?" 5 60 | ||
| 1263 | then | ||
| 1264 | save_configuration | ||
| 1265 | echo | ||
| 1266 | echo | ||
| 1267 | echo "*** End of BusyBox configuration." | ||
| 1268 | echo "*** Check the top-level Makefile for additional configuration." | ||
| 1269 | if [ ! -f .hdepend ] ; then | ||
| 1270 | echo "*** Next, you must run 'make dep'." | ||
| 1271 | else | ||
| 1272 | echo "*** Next, you should run 'make' or 'make install'." | ||
| 1273 | fi | ||
| 1274 | echo | ||
| 1275 | else | ||
| 1276 | echo | ||
| 1277 | echo | ||
| 1278 | echo Your BusyBox configuration changes were NOT saved. | ||
| 1279 | echo | ||
| 1280 | fi | ||
| 1281 | |||
| 1282 | # Remove log if empty. | ||
| 1283 | if [ ! -s .menuconfig.log ] ; then | ||
| 1284 | rm -f .menuconfig.log | ||
| 1285 | fi | ||
| 1286 | |||
| 1287 | exit 0 | ||
diff --git a/scripts/config/.cvsignore b/scripts/config/.cvsignore new file mode 100644 index 000000000..e8bf7a75b --- /dev/null +++ b/scripts/config/.cvsignore | |||
| @@ -0,0 +1,8 @@ | |||
| 1 | conf | ||
| 2 | mconf | ||
| 3 | lkc_defs.h | ||
| 4 | lex.zconf.c | ||
| 5 | zconf.tab.h | ||
| 6 | zconf.tab.c | ||
| 7 | lex.backup | ||
| 8 | zconf.output | ||
diff --git a/scripts/config/Kconfig-language.txt b/scripts/config/Kconfig-language.txt new file mode 100644 index 000000000..a3037ffcf --- /dev/null +++ b/scripts/config/Kconfig-language.txt | |||
| @@ -0,0 +1,255 @@ | |||
| 1 | Introduction | ||
| 2 | ------------ | ||
| 3 | |||
| 4 | The configuration database is collection of configuration options | ||
| 5 | organized in a tree structure: | ||
| 6 | |||
| 7 | +- Code maturity level options | ||
| 8 | | +- Prompt for development and/or incomplete code/drivers | ||
| 9 | +- General setup | ||
| 10 | | +- Networking support | ||
| 11 | | +- System V IPC | ||
| 12 | | +- BSD Process Accounting | ||
| 13 | | +- Sysctl support | ||
| 14 | +- Loadable module support | ||
| 15 | | +- Enable loadable module support | ||
| 16 | | +- Set version information on all module symbols | ||
| 17 | | +- Kernel module loader | ||
| 18 | +- ... | ||
| 19 | |||
| 20 | Every entry has its own dependencies. These dependencies are used | ||
| 21 | to determine the visible of an entry. Any child entry is only | ||
| 22 | visible if its parent entry is also visible. | ||
| 23 | |||
| 24 | Menu entries | ||
| 25 | ------------ | ||
| 26 | |||
| 27 | Most entries define a config option, all other entries help to organize | ||
| 28 | them. A single configuration option is defined like this: | ||
| 29 | |||
| 30 | config MODVERSIONS | ||
| 31 | bool "Set version information on all module symbols" | ||
| 32 | depends MODULES | ||
| 33 | help | ||
| 34 | Usually, modules have to be recompiled whenever you switch to a new | ||
| 35 | kernel. ... | ||
| 36 | |||
| 37 | Every line starts with a key word and can be followed by multiple | ||
| 38 | arguments. "config" starts a new config entry. The following lines | ||
| 39 | define attributes for this config option. Attributes can be the type of | ||
| 40 | the config option, input prompt, dependencies, help text and default | ||
| 41 | values. A config option can be defined multiple times with the same | ||
| 42 | name, but every definition can have only a single input prompt and the | ||
| 43 | type must not conflict. | ||
| 44 | |||
| 45 | Menu attributes | ||
| 46 | --------------- | ||
| 47 | |||
| 48 | A menu entry can have a number of attributes. Not all of them are | ||
| 49 | applicable everywhere (see syntax). | ||
| 50 | |||
| 51 | - type definition: "bool"/"tristate"/"string"/"hex"/"integer" | ||
| 52 | Every config option must have a type. There are only two basic types: | ||
| 53 | tristate and string, the other types base on these two. The type | ||
| 54 | definition optionally accepts an input prompt, so these two examples | ||
| 55 | are equivalent: | ||
| 56 | |||
| 57 | bool "Networking support" | ||
| 58 | and | ||
| 59 | bool | ||
| 60 | prompt "Networking support" | ||
| 61 | |||
| 62 | - input prompt: "prompt" <prompt> ["if" <expr>] | ||
| 63 | Every menu entry can have at most one prompt, which is used to display | ||
| 64 | to the user. Optionally dependencies only for this prompt can be added | ||
| 65 | with "if". | ||
| 66 | |||
| 67 | - default value: "default" <symbol> ["if" <expr>] | ||
| 68 | A config option can have any number of default values. If multiple | ||
| 69 | default values are visible, only the first defined one is active. | ||
| 70 | Default values are not limited to the menu entry, where they are | ||
| 71 | defined, this means the default can be defined somewhere else or be | ||
| 72 | overriden by an earlier definition. | ||
| 73 | The default value is only assigned to the config symbol if no other | ||
| 74 | value was set by the user (via the input prompt above). If an input | ||
| 75 | prompt is visible the default value is presented to the user and can | ||
| 76 | be overridden by him. | ||
| 77 | Optionally dependencies only for this default value can be added with | ||
| 78 | "if". | ||
| 79 | |||
| 80 | - dependencies: "depends on"/"requires" <expr> | ||
| 81 | This defines a dependency for this menu entry. If multiple | ||
| 82 | dependencies are defined they are connected with '&&'. Dependencies | ||
| 83 | are applied to all other options within this menu entry (which also | ||
| 84 | accept "if" expression), so these two examples are equivalent: | ||
| 85 | |||
| 86 | bool "foo" if BAR | ||
| 87 | default y if BAR | ||
| 88 | and | ||
| 89 | depends on BAR | ||
| 90 | bool "foo" | ||
| 91 | default y | ||
| 92 | |||
| 93 | - help text: "help" | ||
| 94 | This defines a help text. The end of the help text is determined by | ||
| 95 | the level indentation, this means it ends at the first line which has | ||
| 96 | a smaller indentation than the first line of the help text. | ||
| 97 | |||
| 98 | |||
| 99 | Menu dependencies | ||
| 100 | ----------------- | ||
| 101 | |||
| 102 | Dependencies define the visibility of a menu entry and can also reduce | ||
| 103 | the input range of tristate symbols. The tristate logic used in the | ||
| 104 | expressions uses one more state than normal boolean logic to express the | ||
| 105 | module state. Dependency expressions have the following syntax: | ||
| 106 | |||
| 107 | <expr> ::= <symbol> (1) | ||
| 108 | <symbol> '=' <symbol> (2) | ||
| 109 | <symbol> '!=' <symbol> (3) | ||
| 110 | '(' <expr> ')' (4) | ||
| 111 | '!' <expr> (5) | ||
| 112 | <expr> '||' <expr> (6) | ||
| 113 | <expr> '&&' <expr> (7) | ||
| 114 | |||
| 115 | Expressions are listed in decreasing order of precedence. | ||
| 116 | |||
| 117 | (1) Convert the symbol into an expression. Boolean and tristate symbols | ||
| 118 | are simply converted into the respective expression values. All | ||
| 119 | other symbol types result in 'n'. | ||
| 120 | (2) If the values of both symbols are equal, it returns 'y', | ||
| 121 | otherwise 'n'. | ||
| 122 | (3) If the values of both symbols are equal, it returns 'n', | ||
| 123 | otherwise 'y'. | ||
| 124 | (4) Returns the value of the expression. Used to override precedence. | ||
| 125 | (5) Returns the result of (2-/expr/). | ||
| 126 | (6) Returns the result of min(/expr/, /expr/). | ||
| 127 | (7) Returns the result of max(/expr/, /expr/). | ||
| 128 | |||
| 129 | An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2 | ||
| 130 | respectively for calculations). A menu entry becomes visible when it's | ||
| 131 | expression evaluates to 'm' or 'y'. | ||
| 132 | |||
| 133 | There are two type of symbols: constant and nonconstant symbols. | ||
| 134 | Nonconstant symbols are the most common ones and are defined with the | ||
| 135 | 'config' statement. Nonconstant symbols consist entirely of alphanumeric | ||
| 136 | characters or underscores. | ||
| 137 | Constant symbols are only part of expressions. Constant symbols are | ||
| 138 | always surrounded by single or double quotes. Within the quote any | ||
| 139 | other character is allowed and the quotes can be escaped using '\'. | ||
| 140 | |||
| 141 | Menu structure | ||
| 142 | -------------- | ||
| 143 | |||
| 144 | The position of a menu entry in the tree is determined in two ways. First | ||
| 145 | it can be specified explicitely: | ||
| 146 | |||
| 147 | menu "Network device support" | ||
| 148 | depends NET | ||
| 149 | |||
| 150 | config NETDEVICES | ||
| 151 | ... | ||
| 152 | |||
| 153 | endmenu | ||
| 154 | |||
| 155 | All entries within the "menu" ... "endmenu" block become a submenu of | ||
| 156 | "Network device support". All subentries inherit the dependencies from | ||
| 157 | the menu entry, e.g. this means the dependency "NET" is added to the | ||
| 158 | dependency list of the config option NETDEVICES. | ||
| 159 | |||
| 160 | The other way to generate the menu structure is done by analyzing the | ||
| 161 | dependencies. If a menu entry somehow depends on the previous entry, it | ||
| 162 | can be made a submenu of it. First the the previous (parent) symbol must | ||
| 163 | be part of the dependency list and then one of these two condititions | ||
| 164 | must be true: | ||
| 165 | - the child entry must become invisible, if the parent is set to 'n' | ||
| 166 | - the child entry must only be visible, if the parent is visible | ||
| 167 | |||
| 168 | config MODULES | ||
| 169 | bool "Enable loadable module support" | ||
| 170 | |||
| 171 | config MODVERSIONS | ||
| 172 | bool "Set version information on all module symbols" | ||
| 173 | depends MODULES | ||
| 174 | |||
| 175 | comment "module support disabled" | ||
| 176 | depends !MODULES | ||
| 177 | |||
| 178 | MODVERSIONS directly depends on MODULES, this means it's only visible if | ||
| 179 | MODULES is different from 'n'. The comment on the other hand is always | ||
| 180 | visible when MODULES it's visible (the (empty) dependency of MODULES is | ||
| 181 | also part of the comment dependencies). | ||
| 182 | |||
| 183 | |||
| 184 | Kconfig syntax | ||
| 185 | -------------- | ||
| 186 | |||
| 187 | The configuration file describes a series of menu entries, where every | ||
| 188 | line starts with a keyword (except help texts). The following keywords | ||
| 189 | end a menu entry: | ||
| 190 | - config | ||
| 191 | - choice/endchoice | ||
| 192 | - comment | ||
| 193 | - menu/endmenu | ||
| 194 | - if/endif | ||
| 195 | - source | ||
| 196 | The first four also start the definition of a menu entry. | ||
| 197 | |||
| 198 | config: | ||
| 199 | |||
| 200 | "config" <symbol> | ||
| 201 | <config options> | ||
| 202 | |||
| 203 | This defines a config symbol <symbol> and accepts any of above | ||
| 204 | attributes as options. | ||
| 205 | |||
| 206 | choices: | ||
| 207 | |||
| 208 | "choice" | ||
| 209 | <choice options> | ||
| 210 | <choice block> | ||
| 211 | "endchoice" | ||
| 212 | |||
| 213 | This defines a choice group and accepts any of above attributes as | ||
| 214 | options. A choice can only be of type bool or tristate, while a boolean | ||
| 215 | choice only allows a single config entry to be selected, a tristate | ||
| 216 | choice also allows any number of config entries to be set to 'm'. This | ||
| 217 | can be used if multiple drivers for a single hardware exists and only a | ||
| 218 | single driver can be compiled/loaded into the kernel, but all drivers | ||
| 219 | can be compiled as modules. | ||
| 220 | A choice accepts another option "optional", which allows to set the | ||
| 221 | choice to 'n' and no entry needs to be selected. | ||
| 222 | |||
| 223 | comment: | ||
| 224 | |||
| 225 | "comment" <prompt> | ||
| 226 | <comment options> | ||
| 227 | |||
| 228 | This defines a comment which is displayed to the user during the | ||
| 229 | configuration process and is also echoed to the output files. The only | ||
| 230 | possible options are dependencies. | ||
| 231 | |||
| 232 | menu: | ||
| 233 | |||
| 234 | "menu" <prompt> | ||
| 235 | <menu options> | ||
| 236 | <menu block> | ||
| 237 | "endmenu" | ||
| 238 | |||
| 239 | This defines a menu block, see "Menu structure" above for more | ||
| 240 | information. The only possible options are dependencies. | ||
| 241 | |||
| 242 | if: | ||
| 243 | |||
| 244 | "if" <expr> | ||
| 245 | <if block> | ||
| 246 | "endif" | ||
| 247 | |||
| 248 | This defines an if block. The dependency expression <expr> is appended | ||
| 249 | to all enclosed menu entries. | ||
| 250 | |||
| 251 | source: | ||
| 252 | |||
| 253 | "source" <prompt> | ||
| 254 | |||
| 255 | This reads the specified configuration file. This file is always parsed. | ||
diff --git a/scripts/config/Makefile b/scripts/config/Makefile new file mode 100644 index 000000000..d43c8b14f --- /dev/null +++ b/scripts/config/Makefile | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | # Makefile for BusyBox | ||
| 2 | # | ||
| 3 | # Copyright (C) 2002 Erik Andersen <andersen@codepoet.org> | ||
| 4 | |||
| 5 | TOPDIR=../../ | ||
| 6 | include $(TOPDIR)Rules.mak | ||
| 7 | |||
| 8 | |||
| 9 | all: ncurses conf mconf | ||
| 10 | |||
| 11 | #HOSTCFLAGS=-Wall -g -O0 | ||
| 12 | LIBS = -lncurses | ||
| 13 | ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h)) | ||
| 14 | HOSTCFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>" | ||
| 15 | else | ||
| 16 | ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h)) | ||
| 17 | HOSTCFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>" | ||
| 18 | else | ||
| 19 | ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h)) | ||
| 20 | HOSTCFLAGS += -DCURSES_LOC="<ncurses.h>" | ||
| 21 | else | ||
| 22 | HOSTCFLAGS += -DCURSES_LOC="<curses.h>" | ||
| 23 | endif | ||
| 24 | endif | ||
| 25 | endif | ||
| 26 | |||
| 27 | |||
| 28 | CONF_SRC =conf.c zconf.tab.c | ||
| 29 | MCONF_SRC =mconf.c zconf.tab.c | ||
| 30 | LXDLG_SRC =checklist.c menubox.c textbox.c yesno.c inputbox.c util.c msgbox.c | ||
| 31 | CONF_OBJS =$(patsubst %.c,%.o, $(CONF_SRC)) | ||
| 32 | MCONF_OBJS=$(patsubst %.c,%.o, $(MCONF_SRC)) | ||
| 33 | LXDLG_OBJS=$(patsubst %.c,%.o, $(LXDLG_SRC)) | ||
| 34 | |||
| 35 | conf: $(CONF_OBJS) | ||
| 36 | $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $^ -o $@ | ||
| 37 | |||
| 38 | mconf: $(MCONF_OBJS) $(LXDLG_OBJS) | ||
| 39 | $(HOSTCC) $(HOSTCFLAGS) $(NATIVE_LDFLAGS) $^ -o $@ $(LIBS) | ||
| 40 | |||
| 41 | lkc_deps:=lkc.h lkc_proto.h lkc_defs.h expr.h zconf.tab.h | ||
| 42 | |||
| 43 | conf.o: conf.c $(lkc_deps) | ||
| 44 | |||
| 45 | mconf.o: mconf.c $(lkc_deps) | ||
| 46 | |||
| 47 | zconf.tab.o: zconf.tab.c lex.zconf.c confdata.c expr.c symbol.c menu.c $(lkc_deps) | ||
| 48 | |||
| 49 | lex.zconf.o: lex.zconf.c $(lkc_deps) | ||
| 50 | |||
| 51 | %.o : %.c | ||
| 52 | $(HOSTCC) $(HOSTCFLAGS) -I. -c $< -o $@ | ||
| 53 | |||
| 54 | lkc_defs.h: lkc_proto.h | ||
| 55 | @sed < $< > $@ 's/P(\([^,]*\),.*/#define \1 (\*\1_p)/' | ||
| 56 | |||
| 57 | ### | ||
| 58 | # The following requires flex/bison | ||
| 59 | # By default we use the _shipped versions, uncomment the | ||
| 60 | # following line if you are modifying the flex/bison src. | ||
| 61 | #LKC_GENPARSER := 1 | ||
| 62 | |||
| 63 | ifdef LKC_GENPARSER | ||
| 64 | |||
| 65 | %.tab.c %.tab.h: %.y | ||
| 66 | bison -t -d -v -b $* -p $(notdir $*) $< | ||
| 67 | |||
| 68 | lex.%.c: %.l | ||
| 69 | flex -P$(notdir $*) -o$@ $< | ||
| 70 | else | ||
| 71 | |||
| 72 | lex.zconf.c: lex.zconf.c_shipped | ||
| 73 | cp lex.zconf.c_shipped lex.zconf.c | ||
| 74 | |||
| 75 | zconf.tab.c: zconf.tab.c_shipped | ||
| 76 | cp zconf.tab.c_shipped zconf.tab.c | ||
| 77 | |||
| 78 | zconf.tab.h: zconf.tab.h_shipped | ||
| 79 | cp zconf.tab.h_shipped zconf.tab.h | ||
| 80 | endif | ||
| 81 | |||
| 82 | .PHONY: ncurses | ||
| 83 | |||
| 84 | ncurses: | ||
| 85 | @echo "main() {}" > lxtemp.c | ||
| 86 | @if $(HOSTCC) lxtemp.c $(LIBS) ; then \ | ||
| 87 | rm -f lxtemp.c a.out; \ | ||
| 88 | else \ | ||
| 89 | rm -f lxtemp.c; \ | ||
| 90 | echo -e "\007" ;\ | ||
| 91 | echo ">> Unable to find the Ncurses libraries." ;\ | ||
| 92 | echo ">>" ;\ | ||
| 93 | echo ">> You must have Ncurses installed in order" ;\ | ||
| 94 | echo ">> to use 'make menuconfig'" ;\ | ||
| 95 | echo ;\ | ||
| 96 | exit 1 ;\ | ||
| 97 | fi | ||
| 98 | |||
| 99 | clean: | ||
| 100 | rm -f *.o *~ core $(TARGETS) $(MCONF_OBJS) $(CONF_OBJS) \ | ||
| 101 | conf mconf zconf.tab.c zconf.tab.h lex.zconf.c lkc_defs.h | ||
| 102 | |||
diff --git a/scripts/lxdialog/checklist.c b/scripts/config/checklist.c index 4f78688ed..c4a9289b9 100644 --- a/scripts/lxdialog/checklist.c +++ b/scripts/config/checklist.c | |||
| @@ -118,7 +118,8 @@ print_buttons( WINDOW *dialog, int height, int width, int selected) | |||
| 118 | */ | 118 | */ |
| 119 | int | 119 | int |
| 120 | dialog_checklist (const char *title, const char *prompt, int height, int width, | 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) | 121 | int list_height, int item_no, struct dialog_list_item ** items, |
| 122 | int flag) | ||
| 122 | 123 | ||
| 123 | { | 124 | { |
| 124 | int i, x, y, box_x, box_y; | 125 | int i, x, y, box_x, box_y; |
| @@ -137,7 +138,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
| 137 | 138 | ||
| 138 | /* Initializes status */ | 139 | /* Initializes status */ |
| 139 | for (i = 0; i < item_no; i++) { | 140 | for (i = 0; i < item_no; i++) { |
| 140 | status[i] = !strcasecmp (items[i * 3 + 2], "on"); | 141 | status[i] = items[i]->selected; |
| 141 | if (!choice && status[i]) | 142 | if (!choice && status[i]) |
| 142 | choice = i; | 143 | choice = i; |
| 143 | } | 144 | } |
| @@ -195,7 +196,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
| 195 | /* Find length of longest item in order to center checklist */ | 196 | /* Find length of longest item in order to center checklist */ |
| 196 | check_x = 0; | 197 | check_x = 0; |
| 197 | for (i = 0; i < item_no; i++) | 198 | for (i = 0; i < item_no; i++) |
| 198 | check_x = MAX (check_x, + strlen (items[i * 3 + 1]) + 4); | 199 | check_x = MAX (check_x, + strlen (items[i]->name) + 4); |
| 199 | 200 | ||
| 200 | check_x = (list_width - check_x) / 2; | 201 | check_x = (list_width - check_x) / 2; |
| 201 | item_x = check_x + 4; | 202 | item_x = check_x + 4; |
| @@ -207,7 +208,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
| 207 | 208 | ||
| 208 | /* Print the list */ | 209 | /* Print the list */ |
| 209 | for (i = 0; i < max_choice; i++) { | 210 | for (i = 0; i < max_choice; i++) { |
| 210 | print_item (list, items[(scroll+i) * 3 + 1], | 211 | print_item (list, items[scroll + i]->name, |
| 211 | status[i+scroll], i, i == choice); | 212 | status[i+scroll], i, i == choice); |
| 212 | } | 213 | } |
| 213 | 214 | ||
| @@ -224,7 +225,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
| 224 | key = wgetch (dialog); | 225 | key = wgetch (dialog); |
| 225 | 226 | ||
| 226 | for (i = 0; i < max_choice; i++) | 227 | for (i = 0; i < max_choice; i++) |
| 227 | if (toupper(key) == toupper(items[(scroll+i)*3+1][0])) | 228 | if (toupper(key) == toupper(items[scroll + i]->name[0])) |
| 228 | break; | 229 | break; |
| 229 | 230 | ||
| 230 | 231 | ||
| @@ -237,14 +238,14 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
| 237 | /* Scroll list down */ | 238 | /* Scroll list down */ |
| 238 | if (list_height > 1) { | 239 | if (list_height > 1) { |
| 239 | /* De-highlight current first item */ | 240 | /* De-highlight current first item */ |
| 240 | print_item (list, items[scroll * 3 + 1], | 241 | print_item (list, items[scroll]->name, |
| 241 | status[scroll], 0, FALSE); | 242 | status[scroll], 0, FALSE); |
| 242 | scrollok (list, TRUE); | 243 | scrollok (list, TRUE); |
| 243 | wscrl (list, -1); | 244 | wscrl (list, -1); |
| 244 | scrollok (list, FALSE); | 245 | scrollok (list, FALSE); |
| 245 | } | 246 | } |
| 246 | scroll--; | 247 | scroll--; |
| 247 | print_item (list, items[scroll * 3 + 1], | 248 | print_item (list, items[scroll]->name, |
| 248 | status[scroll], 0, TRUE); | 249 | status[scroll], 0, TRUE); |
| 249 | wnoutrefresh (list); | 250 | wnoutrefresh (list); |
| 250 | 251 | ||
| @@ -263,7 +264,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
| 263 | /* Scroll list up */ | 264 | /* Scroll list up */ |
| 264 | if (list_height > 1) { | 265 | if (list_height > 1) { |
| 265 | /* De-highlight current last item before scrolling up */ | 266 | /* De-highlight current last item before scrolling up */ |
| 266 | print_item (list, items[(scroll + max_choice - 1) * 3 + 1], | 267 | print_item (list, items[scroll + max_choice - 1]->name, |
| 267 | status[scroll + max_choice - 1], | 268 | status[scroll + max_choice - 1], |
| 268 | max_choice - 1, FALSE); | 269 | max_choice - 1, FALSE); |
| 269 | scrollok (list, TRUE); | 270 | scrollok (list, TRUE); |
| @@ -271,7 +272,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
| 271 | scrollok (list, FALSE); | 272 | scrollok (list, FALSE); |
| 272 | } | 273 | } |
| 273 | scroll++; | 274 | scroll++; |
| 274 | print_item (list, items[(scroll + max_choice - 1) * 3 + 1], | 275 | print_item (list, items[scroll + max_choice - 1]->name, |
| 275 | status[scroll + max_choice - 1], | 276 | status[scroll + max_choice - 1], |
| 276 | max_choice - 1, TRUE); | 277 | max_choice - 1, TRUE); |
| 277 | wnoutrefresh (list); | 278 | wnoutrefresh (list); |
| @@ -287,11 +288,11 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
| 287 | } | 288 | } |
| 288 | if (i != choice) { | 289 | if (i != choice) { |
| 289 | /* De-highlight current item */ | 290 | /* De-highlight current item */ |
| 290 | print_item (list, items[(scroll + choice) * 3 + 1], | 291 | print_item (list, items[scroll + choice]->name, |
| 291 | status[scroll + choice], choice, FALSE); | 292 | status[scroll + choice], choice, FALSE); |
| 292 | /* Highlight new item */ | 293 | /* Highlight new item */ |
| 293 | choice = i; | 294 | choice = i; |
| 294 | print_item (list, items[(scroll + choice) * 3 + 1], | 295 | print_item (list, items[scroll + choice]->name, |
| 295 | status[scroll + choice], choice, TRUE); | 296 | status[scroll + choice], choice, TRUE); |
| 296 | wnoutrefresh (list); | 297 | wnoutrefresh (list); |
| 297 | wrefresh (dialog); | 298 | wrefresh (dialog); |
| @@ -330,7 +331,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
| 330 | status[i] = 0; | 331 | status[i] = 0; |
| 331 | status[scroll + choice] = 1; | 332 | status[scroll + choice] = 1; |
| 332 | for (i = 0; i < max_choice; i++) | 333 | for (i = 0; i < max_choice; i++) |
| 333 | print_item (list, items[(scroll + i) * 3 + 1], | 334 | print_item (list, items[scroll + i]->name, |
| 334 | status[scroll + i], i, i == choice); | 335 | status[scroll + i], i, i == choice); |
| 335 | } | 336 | } |
| 336 | } | 337 | } |
| @@ -338,14 +339,7 @@ dialog_checklist (const char *title, const char *prompt, int height, int width, | |||
| 338 | wrefresh (dialog); | 339 | wrefresh (dialog); |
| 339 | 340 | ||
| 340 | for (i = 0; i < item_no; i++) { | 341 | for (i = 0; i < item_no; i++) { |
| 341 | if (status[i]) { | 342 | items[i]->selected = status[i]; |
| 342 | if (flag == FLAG_CHECK) { | ||
| 343 | fprintf (stderr, "\"%s\" ", items[i * 3]); | ||
| 344 | } else { | ||
| 345 | fprintf (stderr, "%s", items[i * 3]); | ||
| 346 | } | ||
| 347 | |||
| 348 | } | ||
| 349 | } | 343 | } |
| 350 | } | 344 | } |
| 351 | delwin (dialog); | 345 | delwin (dialog); |
diff --git a/scripts/lxdialog/colors.h b/scripts/config/colors.h index d34dd37c6..d34dd37c6 100644 --- a/scripts/lxdialog/colors.h +++ b/scripts/config/colors.h | |||
diff --git a/scripts/config/conf.c b/scripts/config/conf.c new file mode 100644 index 000000000..884175e54 --- /dev/null +++ b/scripts/config/conf.c | |||
| @@ -0,0 +1,566 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 3 | * Released under the terms of the GNU GPL v2.0. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <ctype.h> | ||
| 7 | #include <stdlib.h> | ||
| 8 | #include <string.h> | ||
| 9 | #include <unistd.h> | ||
| 10 | #include <time.h> | ||
| 11 | #include <sys/stat.h> | ||
| 12 | |||
| 13 | #define LKC_DIRECT_LINK | ||
| 14 | #include "lkc.h" | ||
| 15 | |||
| 16 | static void conf(struct menu *menu); | ||
| 17 | static void check_conf(struct menu *menu); | ||
| 18 | |||
| 19 | enum { | ||
| 20 | ask_all, | ||
| 21 | ask_new, | ||
| 22 | ask_silent, | ||
| 23 | set_default, | ||
| 24 | set_yes, | ||
| 25 | set_mod, | ||
| 26 | set_no, | ||
| 27 | set_random | ||
| 28 | } input_mode = ask_all; | ||
| 29 | |||
| 30 | static int indent = 1; | ||
| 31 | static int valid_stdin = 1; | ||
| 32 | static int conf_cnt; | ||
| 33 | static char line[128]; | ||
| 34 | static struct menu *rootEntry; | ||
| 35 | |||
| 36 | static char nohelp_text[] = "Sorry, no help available for this option yet.\n"; | ||
| 37 | |||
| 38 | #if 0 | ||
| 39 | static void printc(int ch) | ||
| 40 | { | ||
| 41 | static int sep = 0; | ||
| 42 | |||
| 43 | if (!sep) { | ||
| 44 | putchar('['); | ||
| 45 | sep = 1; | ||
| 46 | } else if (ch) | ||
| 47 | putchar('/'); | ||
| 48 | if (!ch) { | ||
| 49 | putchar(']'); | ||
| 50 | putchar(' '); | ||
| 51 | sep = 0; | ||
| 52 | } else | ||
| 53 | putchar(ch); | ||
| 54 | } | ||
| 55 | #endif | ||
| 56 | |||
| 57 | static void printo(const char *o) | ||
| 58 | { | ||
| 59 | static int sep = 0; | ||
| 60 | |||
| 61 | if (!sep) { | ||
| 62 | putchar('('); | ||
| 63 | sep = 1; | ||
| 64 | } else if (o) { | ||
| 65 | putchar(','); | ||
| 66 | putchar(' '); | ||
| 67 | } | ||
| 68 | if (!o) { | ||
| 69 | putchar(')'); | ||
| 70 | putchar(' '); | ||
| 71 | sep = 0; | ||
| 72 | } else | ||
| 73 | printf("%s", o); | ||
| 74 | } | ||
| 75 | |||
| 76 | static void strip(char *str) | ||
| 77 | { | ||
| 78 | char *p = str; | ||
| 79 | int l; | ||
| 80 | |||
| 81 | while ((isspace((int)*p))) | ||
| 82 | p++; | ||
| 83 | l = strlen(p); | ||
| 84 | if (p != str) | ||
| 85 | memmove(str, p, l + 1); | ||
| 86 | if (!l) | ||
| 87 | return; | ||
| 88 | p = str + l - 1; | ||
| 89 | while ((isspace((int)*p))) | ||
| 90 | *p-- = 0; | ||
| 91 | } | ||
| 92 | |||
| 93 | static void conf_askvalue(struct symbol *sym, const char *def) | ||
| 94 | { | ||
| 95 | enum symbol_type type = sym_get_type(sym); | ||
| 96 | tristate val; | ||
| 97 | |||
| 98 | if (!sym_has_value(sym)) | ||
| 99 | printf("(NEW) "); | ||
| 100 | |||
| 101 | line[0] = '\n'; | ||
| 102 | line[1] = 0; | ||
| 103 | |||
| 104 | switch (input_mode) { | ||
| 105 | case ask_new: | ||
| 106 | case ask_silent: | ||
| 107 | if (sym_has_value(sym)) { | ||
| 108 | printf("%s\n", def); | ||
| 109 | return; | ||
| 110 | } | ||
| 111 | if (!valid_stdin && input_mode == ask_silent) { | ||
| 112 | printf("aborted!\n\n"); | ||
| 113 | printf("Console input/output is redirected. "); | ||
| 114 | printf("Run 'make oldconfig' to update configuration.\n\n"); | ||
| 115 | exit(1); | ||
| 116 | } | ||
| 117 | case ask_all: | ||
| 118 | fflush(stdout); | ||
| 119 | fgets(line, 128, stdin); | ||
| 120 | return; | ||
| 121 | case set_default: | ||
| 122 | printf("%s\n", def); | ||
| 123 | return; | ||
| 124 | default: | ||
| 125 | break; | ||
| 126 | } | ||
| 127 | |||
| 128 | switch (type) { | ||
| 129 | case S_INT: | ||
| 130 | case S_HEX: | ||
| 131 | case S_STRING: | ||
| 132 | printf("%s\n", def); | ||
| 133 | return; | ||
| 134 | default: | ||
| 135 | ; | ||
| 136 | } | ||
| 137 | switch (input_mode) { | ||
| 138 | case set_yes: | ||
| 139 | if (sym_tristate_within_range(sym, yes)) { | ||
| 140 | line[0] = 'y'; | ||
| 141 | line[1] = '\n'; | ||
| 142 | line[2] = 0; | ||
| 143 | break; | ||
| 144 | } | ||
| 145 | case set_mod: | ||
| 146 | if (type == S_TRISTATE) { | ||
| 147 | if (sym_tristate_within_range(sym, mod)) { | ||
| 148 | line[0] = 'm'; | ||
| 149 | line[1] = '\n'; | ||
| 150 | line[2] = 0; | ||
| 151 | break; | ||
| 152 | } | ||
| 153 | } else { | ||
| 154 | if (sym_tristate_within_range(sym, yes)) { | ||
| 155 | line[0] = 'y'; | ||
| 156 | line[1] = '\n'; | ||
| 157 | line[2] = 0; | ||
| 158 | break; | ||
| 159 | } | ||
| 160 | } | ||
| 161 | case set_no: | ||
| 162 | if (sym_tristate_within_range(sym, no)) { | ||
| 163 | line[0] = 'n'; | ||
| 164 | line[1] = '\n'; | ||
| 165 | line[2] = 0; | ||
| 166 | break; | ||
| 167 | } | ||
| 168 | case set_random: | ||
| 169 | do { | ||
| 170 | val = (tristate)(random() % 3); | ||
| 171 | } while (!sym_tristate_within_range(sym, val)); | ||
| 172 | switch (val) { | ||
| 173 | case no: line[0] = 'n'; break; | ||
| 174 | case mod: line[0] = 'm'; break; | ||
| 175 | case yes: line[0] = 'y'; break; | ||
| 176 | } | ||
| 177 | line[1] = '\n'; | ||
| 178 | line[2] = 0; | ||
| 179 | break; | ||
| 180 | default: | ||
| 181 | break; | ||
| 182 | } | ||
| 183 | printf("%s", line); | ||
| 184 | } | ||
| 185 | |||
| 186 | int conf_string(struct menu *menu) | ||
| 187 | { | ||
| 188 | struct symbol *sym = menu->sym; | ||
| 189 | const char *def, *help; | ||
| 190 | |||
| 191 | while (1) { | ||
| 192 | printf("%*s%s ", indent - 1, "", menu->prompt->text); | ||
| 193 | printf("(%s) ", sym->name); | ||
| 194 | def = sym_get_string_value(sym); | ||
| 195 | if (sym_get_string_value(sym)) | ||
| 196 | printf("[%s] ", def); | ||
| 197 | conf_askvalue(sym, def); | ||
| 198 | switch (line[0]) { | ||
| 199 | case '\n': | ||
| 200 | break; | ||
| 201 | case '?': | ||
| 202 | /* print help */ | ||
| 203 | if (line[1] == 0) { | ||
| 204 | help = nohelp_text; | ||
| 205 | if (menu->sym->help) | ||
| 206 | help = menu->sym->help; | ||
| 207 | printf("\n%s\n", menu->sym->help); | ||
| 208 | def = NULL; | ||
| 209 | break; | ||
| 210 | } | ||
| 211 | default: | ||
| 212 | line[strlen(line)-1] = 0; | ||
| 213 | def = line; | ||
| 214 | } | ||
| 215 | if (def && sym_set_string_value(sym, def)) | ||
| 216 | return 0; | ||
| 217 | } | ||
| 218 | } | ||
| 219 | |||
| 220 | static int conf_sym(struct menu *menu) | ||
| 221 | { | ||
| 222 | struct symbol *sym = menu->sym; | ||
| 223 | int type; | ||
| 224 | tristate oldval, newval; | ||
| 225 | const char *help; | ||
| 226 | |||
| 227 | while (1) { | ||
| 228 | printf("%*s%s ", indent - 1, "", menu->prompt->text); | ||
| 229 | if (sym->name) | ||
| 230 | printf("(%s) ", sym->name); | ||
| 231 | type = sym_get_type(sym); | ||
| 232 | putchar('['); | ||
| 233 | oldval = sym_get_tristate_value(sym); | ||
| 234 | switch (oldval) { | ||
| 235 | case no: | ||
| 236 | putchar('N'); | ||
| 237 | break; | ||
| 238 | case mod: | ||
| 239 | putchar('M'); | ||
| 240 | break; | ||
| 241 | case yes: | ||
| 242 | putchar('Y'); | ||
| 243 | break; | ||
| 244 | } | ||
| 245 | if (oldval != no && sym_tristate_within_range(sym, no)) | ||
| 246 | printf("/n"); | ||
| 247 | if (oldval != mod && sym_tristate_within_range(sym, mod)) | ||
| 248 | printf("/m"); | ||
| 249 | if (oldval != yes && sym_tristate_within_range(sym, yes)) | ||
| 250 | printf("/y"); | ||
| 251 | if (sym->help) | ||
| 252 | printf("/?"); | ||
| 253 | printf("] "); | ||
| 254 | conf_askvalue(sym, sym_get_string_value(sym)); | ||
| 255 | strip(line); | ||
| 256 | |||
| 257 | switch (line[0]) { | ||
| 258 | case 'n': | ||
| 259 | case 'N': | ||
| 260 | newval = no; | ||
| 261 | if (!line[1] || !strcmp(&line[1], "o")) | ||
| 262 | break; | ||
| 263 | continue; | ||
| 264 | case 'm': | ||
| 265 | case 'M': | ||
| 266 | newval = mod; | ||
| 267 | if (!line[1]) | ||
| 268 | break; | ||
| 269 | continue; | ||
| 270 | case 'y': | ||
| 271 | case 'Y': | ||
| 272 | newval = yes; | ||
| 273 | if (!line[1] || !strcmp(&line[1], "es")) | ||
| 274 | break; | ||
| 275 | continue; | ||
| 276 | case 0: | ||
| 277 | newval = oldval; | ||
| 278 | break; | ||
| 279 | case '?': | ||
| 280 | goto help; | ||
| 281 | default: | ||
| 282 | continue; | ||
| 283 | } | ||
| 284 | if (sym_set_tristate_value(sym, newval)) | ||
| 285 | return 0; | ||
| 286 | help: | ||
| 287 | help = nohelp_text; | ||
| 288 | if (sym->help) | ||
| 289 | help = sym->help; | ||
| 290 | printf("\n%s\n", help); | ||
| 291 | } | ||
| 292 | } | ||
| 293 | |||
| 294 | static int conf_choice(struct menu *menu) | ||
| 295 | { | ||
| 296 | struct symbol *sym, *def_sym; | ||
| 297 | struct menu *cmenu, *def_menu; | ||
| 298 | const char *help; | ||
| 299 | int type, len; | ||
| 300 | bool is_new; | ||
| 301 | |||
| 302 | sym = menu->sym; | ||
| 303 | type = sym_get_type(sym); | ||
| 304 | is_new = !sym_has_value(sym); | ||
| 305 | if (sym_is_changable(sym)) { | ||
| 306 | conf_sym(menu); | ||
| 307 | sym_calc_value(sym); | ||
| 308 | switch (sym_get_tristate_value(sym)) { | ||
| 309 | case no: | ||
| 310 | return 1; | ||
| 311 | case mod: | ||
| 312 | return 0; | ||
| 313 | case yes: | ||
| 314 | break; | ||
| 315 | } | ||
| 316 | } else { | ||
| 317 | sym->def = sym->curr; | ||
| 318 | if (S_TRI(sym->curr) == mod) { | ||
| 319 | printf("%*s%s\n", indent - 1, "", menu_get_prompt(menu)); | ||
| 320 | return 0; | ||
| 321 | } | ||
| 322 | } | ||
| 323 | |||
| 324 | while (1) { | ||
| 325 | printf("%*s%s ", indent - 1, "", menu_get_prompt(menu)); | ||
| 326 | def_sym = sym_get_choice_value(sym); | ||
| 327 | def_menu = NULL; | ||
| 328 | for (cmenu = menu->list; cmenu; cmenu = cmenu->next) { | ||
| 329 | if (!menu_is_visible(cmenu)) | ||
| 330 | continue; | ||
| 331 | printo(menu_get_prompt(cmenu)); | ||
| 332 | if (cmenu->sym == def_sym) | ||
| 333 | def_menu = cmenu; | ||
| 334 | } | ||
| 335 | printo(NULL); | ||
| 336 | if (def_menu) | ||
| 337 | printf("[%s] ", menu_get_prompt(def_menu)); | ||
| 338 | else { | ||
| 339 | printf("\n"); | ||
| 340 | return 1; | ||
| 341 | } | ||
| 342 | switch (input_mode) { | ||
| 343 | case ask_new: | ||
| 344 | case ask_silent: | ||
| 345 | case ask_all: | ||
| 346 | conf_askvalue(sym, menu_get_prompt(def_menu)); | ||
| 347 | strip(line); | ||
| 348 | break; | ||
| 349 | default: | ||
| 350 | line[0] = 0; | ||
| 351 | printf("\n"); | ||
| 352 | } | ||
| 353 | if (line[0] == '?' && !line[1]) { | ||
| 354 | help = nohelp_text; | ||
| 355 | if (menu->sym->help) | ||
| 356 | help = menu->sym->help; | ||
| 357 | printf("\n%s\n", help); | ||
| 358 | continue; | ||
| 359 | } | ||
| 360 | if (line[0]) { | ||
| 361 | len = strlen(line); | ||
| 362 | line[len] = 0; | ||
| 363 | |||
| 364 | def_menu = NULL; | ||
| 365 | for (cmenu = menu->list; cmenu; cmenu = cmenu->next) { | ||
| 366 | if (!cmenu->sym || !menu_is_visible(cmenu)) | ||
| 367 | continue; | ||
| 368 | if (!strncasecmp(line, menu_get_prompt(cmenu), len)) { | ||
| 369 | def_menu = cmenu; | ||
| 370 | break; | ||
| 371 | } | ||
| 372 | } | ||
| 373 | } | ||
| 374 | if (def_menu) { | ||
| 375 | sym_set_choice_value(sym, def_menu->sym); | ||
| 376 | if (def_menu->list) { | ||
| 377 | indent += 2; | ||
| 378 | conf(def_menu->list); | ||
| 379 | indent -= 2; | ||
| 380 | } | ||
| 381 | return 1; | ||
| 382 | } | ||
| 383 | } | ||
| 384 | } | ||
| 385 | |||
| 386 | static void conf(struct menu *menu) | ||
| 387 | { | ||
| 388 | struct symbol *sym; | ||
| 389 | struct property *prop; | ||
| 390 | struct menu *child; | ||
| 391 | |||
| 392 | if (!menu_is_visible(menu)) | ||
| 393 | return; | ||
| 394 | |||
| 395 | sym = menu->sym; | ||
| 396 | prop = menu->prompt; | ||
| 397 | if (prop) { | ||
| 398 | const char *prompt; | ||
| 399 | |||
| 400 | switch (prop->type) { | ||
| 401 | case P_MENU: | ||
| 402 | if (input_mode == ask_silent && rootEntry != menu) { | ||
| 403 | check_conf(menu); | ||
| 404 | return; | ||
| 405 | } | ||
| 406 | case P_COMMENT: | ||
| 407 | prompt = menu_get_prompt(menu); | ||
| 408 | if (prompt) | ||
| 409 | printf("%*c\n%*c %s\n%*c\n", | ||
| 410 | indent, '*', | ||
| 411 | indent, '*', prompt, | ||
| 412 | indent, '*'); | ||
| 413 | default: | ||
| 414 | ; | ||
| 415 | } | ||
| 416 | } | ||
| 417 | |||
| 418 | if (!sym) | ||
| 419 | goto conf_childs; | ||
| 420 | |||
| 421 | if (sym_is_choice(sym)) { | ||
| 422 | conf_choice(menu); | ||
| 423 | if (S_TRI(sym->curr) != mod) | ||
| 424 | return; | ||
| 425 | goto conf_childs; | ||
| 426 | } | ||
| 427 | |||
| 428 | switch (sym->type) { | ||
| 429 | case S_INT: | ||
| 430 | case S_HEX: | ||
| 431 | case S_STRING: | ||
| 432 | conf_string(menu); | ||
| 433 | break; | ||
| 434 | default: | ||
| 435 | conf_sym(menu); | ||
| 436 | break; | ||
| 437 | } | ||
| 438 | |||
| 439 | conf_childs: | ||
| 440 | if (sym) | ||
| 441 | indent += 2; | ||
| 442 | for (child = menu->list; child; child = child->next) | ||
| 443 | conf(child); | ||
| 444 | if (sym) | ||
| 445 | indent -= 2; | ||
| 446 | } | ||
| 447 | |||
| 448 | static void check_conf(struct menu *menu) | ||
| 449 | { | ||
| 450 | struct symbol *sym; | ||
| 451 | struct menu *child; | ||
| 452 | |||
| 453 | if (!menu_is_visible(menu)) | ||
| 454 | return; | ||
| 455 | |||
| 456 | sym = menu->sym; | ||
| 457 | if (!sym) | ||
| 458 | goto conf_childs; | ||
| 459 | |||
| 460 | if (sym_is_choice(sym)) { | ||
| 461 | if (!sym_has_value(sym)) { | ||
| 462 | if (!conf_cnt++) | ||
| 463 | printf("*\n* Restart config...\n*\n"); | ||
| 464 | rootEntry = menu_get_parent_menu(menu); | ||
| 465 | conf(rootEntry); | ||
| 466 | } | ||
| 467 | if (sym_get_tristate_value(sym) != mod) | ||
| 468 | return; | ||
| 469 | goto conf_childs; | ||
| 470 | } | ||
| 471 | |||
| 472 | if (!sym_has_value(sym)) { | ||
| 473 | if (!conf_cnt++) | ||
| 474 | printf("*\n* Restart config...\n*\n"); | ||
| 475 | rootEntry = menu_get_parent_menu(menu); | ||
| 476 | conf(rootEntry); | ||
| 477 | } | ||
| 478 | |||
| 479 | conf_childs: | ||
| 480 | for (child = menu->list; child; child = child->next) | ||
| 481 | check_conf(child); | ||
| 482 | } | ||
| 483 | |||
| 484 | int main(int ac, char **av) | ||
| 485 | { | ||
| 486 | const char *name; | ||
| 487 | struct stat tmpstat; | ||
| 488 | |||
| 489 | if (ac > 1 && av[1][0] == '-') { | ||
| 490 | switch (av[1][1]) { | ||
| 491 | case 'o': | ||
| 492 | input_mode = ask_new; | ||
| 493 | break; | ||
| 494 | case 's': | ||
| 495 | input_mode = ask_silent; | ||
| 496 | valid_stdin = isatty(0) && isatty(1) && isatty(2); | ||
| 497 | break; | ||
| 498 | case 'd': | ||
| 499 | input_mode = set_default; | ||
| 500 | break; | ||
| 501 | case 'n': | ||
| 502 | input_mode = set_no; | ||
| 503 | break; | ||
| 504 | case 'm': | ||
| 505 | input_mode = set_mod; | ||
| 506 | break; | ||
| 507 | case 'y': | ||
| 508 | input_mode = set_yes; | ||
| 509 | break; | ||
| 510 | case 'r': | ||
| 511 | input_mode = set_random; | ||
| 512 | srandom(time(NULL)); | ||
| 513 | break; | ||
| 514 | case 'h': | ||
| 515 | case '?': | ||
| 516 | printf("%s [-o|-s] config\n", av[0]); | ||
| 517 | exit(0); | ||
| 518 | } | ||
| 519 | name = av[2]; | ||
| 520 | } else | ||
| 521 | name = av[1]; | ||
| 522 | conf_parse(name); | ||
| 523 | //zconfdump(stdout); | ||
| 524 | switch (input_mode) { | ||
| 525 | case set_default: | ||
| 526 | name = conf_get_default_confname(); | ||
| 527 | if (conf_read(name)) { | ||
| 528 | printf("***\n" | ||
| 529 | "*** Can't find default configuration \"%s\"!\n" | ||
| 530 | "***\n", name); | ||
| 531 | exit(1); | ||
| 532 | } | ||
| 533 | break; | ||
| 534 | case ask_silent: | ||
| 535 | if (stat(".config", &tmpstat)) { | ||
| 536 | printf("***\n" | ||
| 537 | "*** You have not yet configured BusyBox!\n" | ||
| 538 | "***\n" | ||
| 539 | "*** Please run some configurator (e.g. \"make oldconfig\"\n" | ||
| 540 | "*** or \"make menuconfig\").\n" | ||
| 541 | "***\n"); | ||
| 542 | exit(1); | ||
| 543 | } | ||
| 544 | case ask_all: | ||
| 545 | case ask_new: | ||
| 546 | conf_read(NULL); | ||
| 547 | break; | ||
| 548 | default: | ||
| 549 | break; | ||
| 550 | } | ||
| 551 | |||
| 552 | if (input_mode != ask_silent) { | ||
| 553 | rootEntry = &rootmenu; | ||
| 554 | conf(&rootmenu); | ||
| 555 | if (input_mode == ask_all) { | ||
| 556 | input_mode = ask_silent; | ||
| 557 | valid_stdin = 1; | ||
| 558 | } | ||
| 559 | } | ||
| 560 | do { | ||
| 561 | conf_cnt = 0; | ||
| 562 | check_conf(&rootmenu); | ||
| 563 | } while (conf_cnt); | ||
| 564 | conf_write(NULL); | ||
| 565 | return 0; | ||
| 566 | } | ||
diff --git a/scripts/config/confdata.c b/scripts/config/confdata.c new file mode 100644 index 000000000..44835bbfe --- /dev/null +++ b/scripts/config/confdata.c | |||
| @@ -0,0 +1,371 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 3 | * Released under the terms of the GNU GPL v2.0. | ||
| 4 | * | ||
| 5 | * Allow 'n' as a symbol value. | ||
| 6 | * 2002-11-05 Petr Baudis <pasky@ucw.cz> | ||
| 7 | */ | ||
| 8 | |||
| 9 | #include <ctype.h> | ||
| 10 | #include <stdio.h> | ||
| 11 | #include <stdlib.h> | ||
| 12 | #include <string.h> | ||
| 13 | #include <unistd.h> | ||
| 14 | |||
| 15 | #define LKC_DIRECT_LINK | ||
| 16 | #include "lkc.h" | ||
| 17 | |||
| 18 | const char conf_def_filename[] = ".config"; | ||
| 19 | |||
| 20 | const char conf_defname[] = "extra/Configs/Config.$TARGET_ARCH.default"; | ||
| 21 | |||
| 22 | const char *conf_confnames[] = { | ||
| 23 | ".config", | ||
| 24 | conf_defname, | ||
| 25 | NULL, | ||
| 26 | }; | ||
| 27 | |||
| 28 | static char *conf_expand_value(const char *in) | ||
| 29 | { | ||
| 30 | struct symbol *sym; | ||
| 31 | const char *src; | ||
| 32 | static char res_value[SYMBOL_MAXLENGTH]; | ||
| 33 | char *dst, name[SYMBOL_MAXLENGTH]; | ||
| 34 | |||
| 35 | res_value[0] = 0; | ||
| 36 | dst = name; | ||
| 37 | while ((src = strchr(in, '$'))) { | ||
| 38 | strncat(res_value, in, src - in); | ||
| 39 | src++; | ||
| 40 | dst = name; | ||
| 41 | while (isalnum((int)*src) || *src == '_') | ||
| 42 | *dst++ = *src++; | ||
| 43 | *dst = 0; | ||
| 44 | sym = sym_lookup(name, 0); | ||
| 45 | sym_calc_value(sym); | ||
| 46 | strcat(res_value, sym_get_string_value(sym)); | ||
| 47 | in = src; | ||
| 48 | } | ||
| 49 | strcat(res_value, in); | ||
| 50 | |||
| 51 | return res_value; | ||
| 52 | } | ||
| 53 | |||
| 54 | char *conf_get_default_confname(void) | ||
| 55 | { | ||
| 56 | return conf_expand_value(conf_defname); | ||
| 57 | } | ||
| 58 | |||
| 59 | int conf_read(const char *name) | ||
| 60 | { | ||
| 61 | FILE *in = NULL; | ||
| 62 | char line[1024]; | ||
| 63 | char *p, *p2; | ||
| 64 | int lineno = 0; | ||
| 65 | struct symbol *sym; | ||
| 66 | struct property *prop; | ||
| 67 | struct expr *e; | ||
| 68 | int i; | ||
| 69 | |||
| 70 | if (name) { | ||
| 71 | in = fopen(name, "r"); | ||
| 72 | } else { | ||
| 73 | const char **names = conf_confnames; | ||
| 74 | while ((name = *names++)) { | ||
| 75 | name = conf_expand_value(name); | ||
| 76 | in = fopen(name, "r"); | ||
| 77 | if (in) { | ||
| 78 | printf("#\n" | ||
| 79 | "# using defaults found in %s\n" | ||
| 80 | "#\n", name); | ||
| 81 | break; | ||
| 82 | } | ||
| 83 | } | ||
| 84 | } | ||
| 85 | |||
| 86 | if (!in) | ||
| 87 | return 1; | ||
| 88 | |||
| 89 | for_all_symbols(i, sym) { | ||
| 90 | sym->flags |= SYMBOL_NEW | SYMBOL_CHANGED; | ||
| 91 | sym->flags &= ~SYMBOL_VALID; | ||
| 92 | switch (sym->type) { | ||
| 93 | case S_INT: | ||
| 94 | case S_HEX: | ||
| 95 | case S_STRING: | ||
| 96 | if (S_VAL(sym->def)) | ||
| 97 | free(S_VAL(sym->def)); | ||
| 98 | default: | ||
| 99 | S_VAL(sym->def) = NULL; | ||
| 100 | S_TRI(sym->def) = no; | ||
| 101 | ; | ||
| 102 | } | ||
| 103 | } | ||
| 104 | |||
| 105 | while (fgets(line, sizeof(line), in)) { | ||
| 106 | lineno++; | ||
| 107 | switch (line[0]) { | ||
| 108 | case '\n': | ||
| 109 | break; | ||
| 110 | case ' ': | ||
| 111 | break; | ||
| 112 | case '#': | ||
| 113 | p = strchr(line, ' '); | ||
| 114 | if (!p) | ||
| 115 | continue; | ||
| 116 | *p++ = 0; | ||
| 117 | p = strchr(p, ' '); | ||
| 118 | if (!p) | ||
| 119 | continue; | ||
| 120 | *p++ = 0; | ||
| 121 | if (strncmp(p, "is not set", 10)) | ||
| 122 | continue; | ||
| 123 | sym = sym_lookup(line+2, 0); | ||
| 124 | switch (sym->type) { | ||
| 125 | case S_BOOLEAN: | ||
| 126 | case S_TRISTATE: | ||
| 127 | sym->def = symbol_no.curr; | ||
| 128 | sym->flags &= ~SYMBOL_NEW; | ||
| 129 | break; | ||
| 130 | default: | ||
| 131 | ; | ||
| 132 | } | ||
| 133 | break; | ||
| 134 | case 'A' ... 'Z': | ||
| 135 | p = strchr(line, '='); | ||
| 136 | if (!p) | ||
| 137 | continue; | ||
| 138 | *p++ = 0; | ||
| 139 | p2 = strchr(p, '\n'); | ||
| 140 | if (p2) | ||
| 141 | *p2 = 0; | ||
| 142 | sym = sym_find(line); | ||
| 143 | if (!sym) { | ||
| 144 | fprintf(stderr, "%s:%d: trying to assign nonexistent symbol %s\n", name, lineno, line); | ||
| 145 | break; | ||
| 146 | } | ||
| 147 | switch (sym->type) { | ||
| 148 | case S_TRISTATE: | ||
| 149 | if (p[0] == 'm') { | ||
| 150 | S_TRI(sym->def) = mod; | ||
| 151 | sym->flags &= ~SYMBOL_NEW; | ||
| 152 | break; | ||
| 153 | } | ||
| 154 | case S_BOOLEAN: | ||
| 155 | if (p[0] == 'y') { | ||
| 156 | S_TRI(sym->def) = yes; | ||
| 157 | sym->flags &= ~SYMBOL_NEW; | ||
| 158 | break; | ||
| 159 | } | ||
| 160 | if (p[0] == 'n') { | ||
| 161 | S_TRI(sym->def) = no; | ||
| 162 | sym->flags &= ~SYMBOL_NEW; | ||
| 163 | break; | ||
| 164 | } | ||
| 165 | break; | ||
| 166 | case S_STRING: | ||
| 167 | if (*p++ != '"') | ||
| 168 | break; | ||
| 169 | for (p2 = p; (p2 = strpbrk(p2, "\"\\")); p2++) { | ||
| 170 | if (*p2 == '"') { | ||
| 171 | *p2 = 0; | ||
| 172 | break; | ||
| 173 | } | ||
| 174 | memmove(p2, p2 + 1, strlen(p2)); | ||
| 175 | } | ||
| 176 | case S_INT: | ||
| 177 | case S_HEX: | ||
| 178 | if (sym_string_valid(sym, p)) { | ||
| 179 | S_VAL(sym->def) = strdup(p); | ||
| 180 | sym->flags &= ~SYMBOL_NEW; | ||
| 181 | } else | ||
| 182 | fprintf(stderr, "%s:%d:symbol value '%s' invalid for %s\n", name, lineno, p, sym->name); | ||
| 183 | break; | ||
| 184 | default: | ||
| 185 | ; | ||
| 186 | } | ||
| 187 | if (sym_is_choice_value(sym)) { | ||
| 188 | prop = sym_get_choice_prop(sym); | ||
| 189 | switch (S_TRI(sym->def)) { | ||
| 190 | case mod: | ||
| 191 | if (S_TRI(prop->def->def) == yes) | ||
| 192 | /* warn? */; | ||
| 193 | break; | ||
| 194 | case yes: | ||
| 195 | if (S_TRI(prop->def->def) != no) | ||
| 196 | /* warn? */; | ||
| 197 | S_VAL(prop->def->def) = sym; | ||
| 198 | break; | ||
| 199 | case no: | ||
| 200 | break; | ||
| 201 | } | ||
| 202 | S_TRI(prop->def->def) = S_TRI(sym->def); | ||
| 203 | } | ||
| 204 | break; | ||
| 205 | default: | ||
| 206 | continue; | ||
| 207 | } | ||
| 208 | } | ||
| 209 | fclose(in); | ||
| 210 | |||
| 211 | for_all_symbols(i, sym) { | ||
| 212 | if (!sym_is_choice(sym)) | ||
| 213 | continue; | ||
| 214 | prop = sym_get_choice_prop(sym); | ||
| 215 | for (e = prop->dep; e; e = e->left.expr) | ||
| 216 | sym->flags |= e->right.sym->flags & SYMBOL_NEW; | ||
| 217 | sym->flags &= ~SYMBOL_NEW; | ||
| 218 | } | ||
| 219 | |||
| 220 | sym_change_count = 1; | ||
| 221 | |||
| 222 | return 0; | ||
| 223 | } | ||
| 224 | |||
| 225 | int conf_write(const char *name) | ||
| 226 | { | ||
| 227 | FILE *out, *out_h; | ||
| 228 | struct symbol *sym; | ||
| 229 | struct menu *menu; | ||
| 230 | char oldname[128]; | ||
| 231 | int type, l; | ||
| 232 | const char *str; | ||
| 233 | |||
| 234 | out = fopen(".tmpconfig", "w"); | ||
| 235 | if (!out) | ||
| 236 | return 1; | ||
| 237 | out_h = fopen(".tmpconfig.h", "w"); | ||
| 238 | if (!out_h) | ||
| 239 | return 1; | ||
| 240 | fprintf(out, "#\n" | ||
| 241 | "# Automatically generated make config: don't edit\n" | ||
| 242 | "#\n"); | ||
| 243 | fprintf(out_h, "/*\n" | ||
| 244 | " * Automatically generated header file: don't edit\n" | ||
| 245 | " */\n\n" | ||
| 246 | "#define AUTOCONF_INCLUDED\n\n" | ||
| 247 | "/* Version Number */\n" | ||
| 248 | "#define BB_VER \"%s\"\n" | ||
| 249 | "#define BB_BT \"%s\"\n\n", | ||
| 250 | getenv("VERSION"), | ||
| 251 | getenv("BUILDTIME") | ||
| 252 | ); | ||
| 253 | |||
| 254 | if (!sym_change_count) | ||
| 255 | sym_clear_all_valid(); | ||
| 256 | |||
| 257 | menu = rootmenu.list; | ||
| 258 | while (menu) { | ||
| 259 | sym = menu->sym; | ||
| 260 | if (!sym) { | ||
| 261 | if (!menu_is_visible(menu)) | ||
| 262 | goto next; | ||
| 263 | str = menu_get_prompt(menu); | ||
| 264 | fprintf(out, "\n" | ||
| 265 | "#\n" | ||
| 266 | "# %s\n" | ||
| 267 | "#\n", str); | ||
| 268 | fprintf(out_h, "\n" | ||
| 269 | "/*\n" | ||
| 270 | " * %s\n" | ||
| 271 | " */\n", str); | ||
| 272 | } else if (!(sym->flags & SYMBOL_CHOICE)) { | ||
| 273 | sym_calc_value(sym); | ||
| 274 | if (!(sym->flags & SYMBOL_WRITE)) | ||
| 275 | goto next; | ||
| 276 | sym->flags &= ~SYMBOL_WRITE; | ||
| 277 | type = sym->type; | ||
| 278 | if (type == S_TRISTATE) { | ||
| 279 | sym_calc_value(modules_sym); | ||
| 280 | if (S_TRI(modules_sym->curr) == no) | ||
| 281 | type = S_BOOLEAN; | ||
| 282 | } | ||
| 283 | switch (type) { | ||
| 284 | case S_BOOLEAN: | ||
| 285 | case S_TRISTATE: | ||
| 286 | switch (sym_get_tristate_value(sym)) { | ||
| 287 | case no: | ||
| 288 | fprintf(out, "# %s is not set\n", sym->name); | ||
| 289 | fprintf(out_h, "#undef %s\n", sym->name); | ||
| 290 | break; | ||
| 291 | case mod: | ||
| 292 | #if 0 | ||
| 293 | fprintf(out, "%s=m\n", sym->name); | ||
| 294 | fprintf(out_h, "#define __%s__MODULE 1\n", sym->name); | ||
| 295 | #endif | ||
| 296 | break; | ||
| 297 | case yes: | ||
| 298 | fprintf(out, "%s=y\n", sym->name); | ||
| 299 | fprintf(out_h, "#define %s 1\n", sym->name); | ||
| 300 | break; | ||
| 301 | } | ||
| 302 | break; | ||
| 303 | case S_STRING: | ||
| 304 | // fix me | ||
| 305 | str = sym_get_string_value(sym); | ||
| 306 | fprintf(out, "%s=\"", sym->name); | ||
| 307 | fprintf(out_h, "#define %s \"", sym->name); | ||
| 308 | do { | ||
| 309 | l = strcspn(str, "\"\\"); | ||
| 310 | if (l) { | ||
| 311 | fwrite(str, l, 1, out); | ||
| 312 | fwrite(str, l, 1, out_h); | ||
| 313 | } | ||
| 314 | str += l; | ||
| 315 | while (*str == '\\' || *str == '"') { | ||
| 316 | fprintf(out, "\\%c", *str); | ||
| 317 | fprintf(out_h, "\\%c", *str); | ||
| 318 | str++; | ||
| 319 | } | ||
| 320 | } while (*str); | ||
| 321 | fputs("\"\n", out); | ||
| 322 | fputs("\"\n", out_h); | ||
| 323 | break; | ||
| 324 | case S_HEX: | ||
| 325 | str = sym_get_string_value(sym); | ||
| 326 | if (str[0] != '0' || (str[1] != 'x' && str[1] != 'X')) { | ||
| 327 | fprintf(out, "%s=%s\n", sym->name, str); | ||
| 328 | fprintf(out_h, "#define %s 0x%s\n", sym->name, str); | ||
| 329 | break; | ||
| 330 | } | ||
| 331 | case S_INT: | ||
| 332 | str = sym_get_string_value(sym); | ||
| 333 | fprintf(out, "%s=%s\n", sym->name, str); | ||
| 334 | fprintf(out_h, "#define %s %s\n", sym->name, str); | ||
| 335 | break; | ||
| 336 | } | ||
| 337 | } | ||
| 338 | |||
| 339 | next: | ||
| 340 | if (menu->list) { | ||
| 341 | menu = menu->list; | ||
| 342 | continue; | ||
| 343 | } | ||
| 344 | if (menu->next) | ||
| 345 | menu = menu->next; | ||
| 346 | else while ((menu = menu->parent)) { | ||
| 347 | if (menu->next) { | ||
| 348 | menu = menu->next; | ||
| 349 | break; | ||
| 350 | } | ||
| 351 | } | ||
| 352 | } | ||
| 353 | fclose(out); | ||
| 354 | fclose(out_h); | ||
| 355 | |||
| 356 | if (!name) { | ||
| 357 | rename(".tmpconfig.h", "include/config.h"); | ||
| 358 | name = conf_def_filename; | ||
| 359 | file_write_dep(NULL); | ||
| 360 | } else | ||
| 361 | unlink(".tmpconfig.h"); | ||
| 362 | |||
| 363 | sprintf(oldname, "%s.old", name); | ||
| 364 | rename(name, oldname); | ||
| 365 | if (rename(".tmpconfig", name)) | ||
| 366 | return 1; | ||
| 367 | |||
| 368 | sym_change_count = 0; | ||
| 369 | |||
| 370 | return 0; | ||
| 371 | } | ||
diff --git a/scripts/lxdialog/dialog.h b/scripts/config/dialog.h index 0e30d00d0..8116cee36 100644 --- a/scripts/lxdialog/dialog.h +++ b/scripts/config/dialog.h | |||
| @@ -26,6 +26,7 @@ | |||
| 26 | #include <stdlib.h> | 26 | #include <stdlib.h> |
| 27 | #include <string.h> | 27 | #include <string.h> |
| 28 | 28 | ||
| 29 | #ifdef CURSES_LOC | ||
| 29 | #include CURSES_LOC | 30 | #include CURSES_LOC |
| 30 | 31 | ||
| 31 | /* | 32 | /* |
| @@ -125,29 +126,35 @@ | |||
| 125 | * Global variables | 126 | * Global variables |
| 126 | */ | 127 | */ |
| 127 | extern bool use_colors; | 128 | extern bool use_colors; |
| 128 | extern bool use_shadow; | ||
| 129 | 129 | ||
| 130 | extern chtype attributes[]; | 130 | extern chtype attributes[]; |
| 131 | #endif | ||
| 132 | |||
| 133 | extern char *backtitle; | ||
| 131 | 134 | ||
| 132 | extern const char *backtitle; | 135 | struct dialog_list_item { |
| 136 | char *name; | ||
| 137 | int namelen; | ||
| 138 | char *tag; | ||
| 139 | int selected; /* Set to 1 by dialog_*() function. */ | ||
| 140 | }; | ||
| 133 | 141 | ||
| 134 | /* | 142 | /* |
| 135 | * Function prototypes | 143 | * Function prototypes |
| 136 | */ | 144 | */ |
| 137 | extern void create_rc (const char *filename); | ||
| 138 | extern int parse_rc (void); | ||
| 139 | |||
| 140 | 145 | ||
| 141 | void init_dialog (void); | 146 | void init_dialog (void); |
| 142 | void end_dialog (void); | 147 | void end_dialog (void); |
| 143 | void attr_clear (WINDOW * win, int height, int width, chtype attr); | ||
| 144 | void dialog_clear (void); | 148 | void dialog_clear (void); |
| 149 | #ifdef CURSES_LOC | ||
| 150 | void attr_clear (WINDOW * win, int height, int width, chtype attr); | ||
| 145 | void color_setup (void); | 151 | void color_setup (void); |
| 146 | void print_autowrap (WINDOW * win, const char *prompt, int width, int y, int x); | 152 | 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); | 153 | void print_button (WINDOW * win, const char *label, int y, int x, int selected); |
| 148 | void draw_box (WINDOW * win, int y, int x, int height, int width, chtype box, | 154 | void draw_box (WINDOW * win, int y, int x, int height, int width, chtype box, |
| 149 | chtype border); | 155 | chtype border); |
| 150 | void draw_shadow (WINDOW * win, int y, int x, int height, int width); | 156 | void draw_shadow (WINDOW * win, int y, int x, int height, int width); |
| 157 | #endif | ||
| 151 | 158 | ||
| 152 | int first_alpha (const char *string, const char *exempt); | 159 | int first_alpha (const char *string, const char *exempt); |
| 153 | int dialog_yesno (const char *title, const char *prompt, int height, int width); | 160 | int dialog_yesno (const char *title, const char *prompt, int height, int width); |
| @@ -156,14 +163,17 @@ int dialog_msgbox (const char *title, const char *prompt, int height, | |||
| 156 | int dialog_textbox (const char *title, const char *file, int height, int width); | 163 | int dialog_textbox (const char *title, const char *file, int height, int width); |
| 157 | int dialog_menu (const char *title, const char *prompt, int height, int width, | 164 | int dialog_menu (const char *title, const char *prompt, int height, int width, |
| 158 | int menu_height, const char *choice, int item_no, | 165 | int menu_height, const char *choice, int item_no, |
| 159 | const char * const * items); | 166 | struct dialog_list_item ** items); |
| 160 | int dialog_checklist (const char *title, const char *prompt, int height, | 167 | int dialog_checklist (const char *title, const char *prompt, int height, |
| 161 | int width, int list_height, int item_no, | 168 | int width, int list_height, int item_no, |
| 162 | const char * const * items, int flag); | 169 | struct dialog_list_item ** items, int flag); |
| 163 | extern unsigned char dialog_input_result[]; | 170 | extern unsigned char dialog_input_result[]; |
| 164 | int dialog_inputbox (const char *title, const char *prompt, int height, | 171 | int dialog_inputbox (const char *title, const char *prompt, int height, |
| 165 | int width, const char *init); | 172 | int width, const char *init); |
| 166 | 173 | ||
| 174 | struct dialog_list_item *first_sel_item(int item_no, | ||
| 175 | struct dialog_list_item ** items); | ||
| 176 | |||
| 167 | /* | 177 | /* |
| 168 | * This is the base for fictitious keys, which activate | 178 | * This is the base for fictitious keys, which activate |
| 169 | * the buttons. | 179 | * the buttons. |
| @@ -173,7 +183,9 @@ int dialog_inputbox (const char *title, const char *prompt, int height, | |||
| 173 | * -- the lowercase are used to signal mouse-enter events (M_EVENT + 'o') | 183 | * -- the lowercase are used to signal mouse-enter events (M_EVENT + 'o') |
| 174 | * -- uppercase chars are used to invoke the button (M_EVENT + 'O') | 184 | * -- uppercase chars are used to invoke the button (M_EVENT + 'O') |
| 175 | */ | 185 | */ |
| 186 | #ifdef CURSES_LOC | ||
| 176 | #define M_EVENT (KEY_MAX+1) | 187 | #define M_EVENT (KEY_MAX+1) |
| 188 | #endif | ||
| 177 | 189 | ||
| 178 | 190 | ||
| 179 | /* | 191 | /* |
diff --git a/scripts/config/expr.c b/scripts/config/expr.c new file mode 100644 index 000000000..d1af2a581 --- /dev/null +++ b/scripts/config/expr.c | |||
| @@ -0,0 +1,1054 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 3 | * Released under the terms of the GNU GPL v2.0. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <stdio.h> | ||
| 7 | #include <stdlib.h> | ||
| 8 | #include <string.h> | ||
| 9 | |||
| 10 | #define LKC_DIRECT_LINK | ||
| 11 | #include "lkc.h" | ||
| 12 | |||
| 13 | struct expr *expr_alloc_symbol(struct symbol *sym) | ||
| 14 | { | ||
| 15 | struct expr *e = malloc(sizeof(*e)); | ||
| 16 | memset(e, 0, sizeof(*e)); | ||
| 17 | e->type = E_SYMBOL; | ||
| 18 | e->left.sym = sym; | ||
| 19 | return e; | ||
| 20 | } | ||
| 21 | |||
| 22 | struct expr *expr_alloc_one(enum expr_type type, struct expr *ce) | ||
| 23 | { | ||
| 24 | struct expr *e = malloc(sizeof(*e)); | ||
| 25 | memset(e, 0, sizeof(*e)); | ||
| 26 | e->type = type; | ||
| 27 | e->left.expr = ce; | ||
| 28 | return e; | ||
| 29 | } | ||
| 30 | |||
| 31 | struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2) | ||
| 32 | { | ||
| 33 | struct expr *e = malloc(sizeof(*e)); | ||
| 34 | memset(e, 0, sizeof(*e)); | ||
| 35 | e->type = type; | ||
| 36 | e->left.expr = e1; | ||
| 37 | e->right.expr = e2; | ||
| 38 | return e; | ||
| 39 | } | ||
| 40 | |||
| 41 | struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2) | ||
| 42 | { | ||
| 43 | struct expr *e = malloc(sizeof(*e)); | ||
| 44 | memset(e, 0, sizeof(*e)); | ||
| 45 | e->type = type; | ||
| 46 | e->left.sym = s1; | ||
| 47 | e->right.sym = s2; | ||
| 48 | return e; | ||
| 49 | } | ||
| 50 | |||
| 51 | struct expr *expr_alloc_and(struct expr *e1, struct expr *e2) | ||
| 52 | { | ||
| 53 | if (!e1) | ||
| 54 | return e2; | ||
| 55 | return e2 ? expr_alloc_two(E_AND, e1, e2) : e1; | ||
| 56 | } | ||
| 57 | |||
| 58 | struct expr *expr_copy(struct expr *org) | ||
| 59 | { | ||
| 60 | struct expr *e; | ||
| 61 | |||
| 62 | if (!org) | ||
| 63 | return NULL; | ||
| 64 | |||
| 65 | e = malloc(sizeof(*org)); | ||
| 66 | memcpy(e, org, sizeof(*org)); | ||
| 67 | switch (org->type) { | ||
| 68 | case E_SYMBOL: | ||
| 69 | e->left = org->left; | ||
| 70 | break; | ||
| 71 | case E_NOT: | ||
| 72 | e->left.expr = expr_copy(org->left.expr); | ||
| 73 | break; | ||
| 74 | case E_EQUAL: | ||
| 75 | case E_UNEQUAL: | ||
| 76 | e->left.sym = org->left.sym; | ||
| 77 | e->right.sym = org->right.sym; | ||
| 78 | break; | ||
| 79 | case E_AND: | ||
| 80 | case E_OR: | ||
| 81 | case E_CHOICE: | ||
| 82 | e->left.expr = expr_copy(org->left.expr); | ||
| 83 | e->right.expr = expr_copy(org->right.expr); | ||
| 84 | break; | ||
| 85 | default: | ||
| 86 | printf("can't copy type %d\n", e->type); | ||
| 87 | free(e); | ||
| 88 | e = NULL; | ||
| 89 | break; | ||
| 90 | } | ||
| 91 | |||
| 92 | return e; | ||
| 93 | } | ||
| 94 | |||
| 95 | void expr_free(struct expr *e) | ||
| 96 | { | ||
| 97 | if (!e) | ||
| 98 | return; | ||
| 99 | |||
| 100 | switch (e->type) { | ||
| 101 | case E_SYMBOL: | ||
| 102 | break; | ||
| 103 | case E_NOT: | ||
| 104 | expr_free(e->left.expr); | ||
| 105 | return; | ||
| 106 | case E_EQUAL: | ||
| 107 | case E_UNEQUAL: | ||
| 108 | break; | ||
| 109 | case E_OR: | ||
| 110 | case E_AND: | ||
| 111 | expr_free(e->left.expr); | ||
| 112 | expr_free(e->right.expr); | ||
| 113 | break; | ||
| 114 | default: | ||
| 115 | printf("how to free type %d?\n", e->type); | ||
| 116 | break; | ||
| 117 | } | ||
| 118 | free(e); | ||
| 119 | } | ||
| 120 | |||
| 121 | static int trans_count; | ||
| 122 | |||
| 123 | #define e1 (*ep1) | ||
| 124 | #define e2 (*ep2) | ||
| 125 | |||
| 126 | static void __expr_eliminate_eq(enum expr_type type, struct expr **ep1, struct expr **ep2) | ||
| 127 | { | ||
| 128 | if (e1->type == type) { | ||
| 129 | __expr_eliminate_eq(type, &e1->left.expr, &e2); | ||
| 130 | __expr_eliminate_eq(type, &e1->right.expr, &e2); | ||
| 131 | return; | ||
| 132 | } | ||
| 133 | if (e2->type == type) { | ||
| 134 | __expr_eliminate_eq(type, &e1, &e2->left.expr); | ||
| 135 | __expr_eliminate_eq(type, &e1, &e2->right.expr); | ||
| 136 | return; | ||
| 137 | } | ||
| 138 | if (e1->type == E_SYMBOL && e2->type == E_SYMBOL && | ||
| 139 | e1->left.sym == e2->left.sym && (e1->left.sym->flags & (SYMBOL_YES|SYMBOL_NO))) | ||
| 140 | return; | ||
| 141 | if (!expr_eq(e1, e2)) | ||
| 142 | return; | ||
| 143 | trans_count++; | ||
| 144 | expr_free(e1); expr_free(e2); | ||
| 145 | switch (type) { | ||
| 146 | case E_OR: | ||
| 147 | e1 = expr_alloc_symbol(&symbol_no); | ||
| 148 | e2 = expr_alloc_symbol(&symbol_no); | ||
| 149 | break; | ||
| 150 | case E_AND: | ||
| 151 | e1 = expr_alloc_symbol(&symbol_yes); | ||
| 152 | e2 = expr_alloc_symbol(&symbol_yes); | ||
| 153 | break; | ||
| 154 | default: | ||
| 155 | ; | ||
| 156 | } | ||
| 157 | } | ||
| 158 | |||
| 159 | void expr_eliminate_eq(struct expr **ep1, struct expr **ep2) | ||
| 160 | { | ||
| 161 | if (!e1 || !e2 || e1->type != e2->type) | ||
| 162 | return; | ||
| 163 | __expr_eliminate_eq(e1->type, ep1, ep2); | ||
| 164 | e1 = expr_eliminate_yn(e1); | ||
| 165 | e2 = expr_eliminate_yn(e2); | ||
| 166 | } | ||
| 167 | |||
| 168 | #undef e1 | ||
| 169 | #undef e2 | ||
| 170 | |||
| 171 | int expr_eq(struct expr *e1, struct expr *e2) | ||
| 172 | { | ||
| 173 | int res, old_count; | ||
| 174 | |||
| 175 | if (e1->type != e2->type) | ||
| 176 | return 0; | ||
| 177 | switch (e1->type) { | ||
| 178 | case E_EQUAL: | ||
| 179 | case E_UNEQUAL: | ||
| 180 | return e1->left.sym == e2->left.sym && e1->right.sym == e2->right.sym; | ||
| 181 | case E_SYMBOL: | ||
| 182 | return e1->left.sym == e2->left.sym; | ||
| 183 | case E_NOT: | ||
| 184 | return expr_eq(e1->left.expr, e2->left.expr); | ||
| 185 | case E_AND: | ||
| 186 | case E_OR: | ||
| 187 | e1 = expr_copy(e1); | ||
| 188 | e2 = expr_copy(e2); | ||
| 189 | old_count = trans_count; | ||
| 190 | expr_eliminate_eq(&e1, &e2); | ||
| 191 | res = (e1->type == E_SYMBOL && e2->type == E_SYMBOL && | ||
| 192 | e1->left.sym == e2->left.sym); | ||
| 193 | expr_free(e1); | ||
| 194 | expr_free(e2); | ||
| 195 | trans_count = old_count; | ||
| 196 | return res; | ||
| 197 | case E_CHOICE: | ||
| 198 | case E_NONE: | ||
| 199 | /* panic */; | ||
| 200 | } | ||
| 201 | |||
| 202 | print_expr(0, e1, 0); | ||
| 203 | printf(" = "); | ||
| 204 | print_expr(0, e2, 0); | ||
| 205 | printf(" ?\n"); | ||
| 206 | |||
| 207 | return 0; | ||
| 208 | } | ||
| 209 | |||
| 210 | struct expr *expr_eliminate_yn(struct expr *e) | ||
| 211 | { | ||
| 212 | struct expr *tmp; | ||
| 213 | |||
| 214 | if (e) switch (e->type) { | ||
| 215 | case E_AND: | ||
| 216 | e->left.expr = expr_eliminate_yn(e->left.expr); | ||
| 217 | e->right.expr = expr_eliminate_yn(e->right.expr); | ||
| 218 | if (e->left.expr->type == E_SYMBOL) { | ||
| 219 | if (e->left.expr->left.sym == &symbol_no) { | ||
| 220 | expr_free(e->left.expr); | ||
| 221 | expr_free(e->right.expr); | ||
| 222 | e->type = E_SYMBOL; | ||
| 223 | e->left.sym = &symbol_no; | ||
| 224 | e->right.expr = NULL; | ||
| 225 | return e; | ||
| 226 | } else if (e->left.expr->left.sym == &symbol_yes) { | ||
| 227 | free(e->left.expr); | ||
| 228 | tmp = e->right.expr; | ||
| 229 | *e = *(e->right.expr); | ||
| 230 | free(tmp); | ||
| 231 | return e; | ||
| 232 | } | ||
| 233 | } | ||
| 234 | if (e->right.expr->type == E_SYMBOL) { | ||
| 235 | if (e->right.expr->left.sym == &symbol_no) { | ||
| 236 | expr_free(e->left.expr); | ||
| 237 | expr_free(e->right.expr); | ||
| 238 | e->type = E_SYMBOL; | ||
| 239 | e->left.sym = &symbol_no; | ||
| 240 | e->right.expr = NULL; | ||
| 241 | return e; | ||
| 242 | } else if (e->right.expr->left.sym == &symbol_yes) { | ||
| 243 | free(e->right.expr); | ||
| 244 | tmp = e->left.expr; | ||
| 245 | *e = *(e->left.expr); | ||
| 246 | free(tmp); | ||
| 247 | return e; | ||
| 248 | } | ||
| 249 | } | ||
| 250 | break; | ||
| 251 | case E_OR: | ||
| 252 | e->left.expr = expr_eliminate_yn(e->left.expr); | ||
| 253 | e->right.expr = expr_eliminate_yn(e->right.expr); | ||
| 254 | if (e->left.expr->type == E_SYMBOL) { | ||
| 255 | if (e->left.expr->left.sym == &symbol_no) { | ||
| 256 | free(e->left.expr); | ||
| 257 | tmp = e->right.expr; | ||
| 258 | *e = *(e->right.expr); | ||
| 259 | free(tmp); | ||
| 260 | return e; | ||
| 261 | } else if (e->left.expr->left.sym == &symbol_yes) { | ||
| 262 | expr_free(e->left.expr); | ||
| 263 | expr_free(e->right.expr); | ||
| 264 | e->type = E_SYMBOL; | ||
| 265 | e->left.sym = &symbol_yes; | ||
| 266 | e->right.expr = NULL; | ||
| 267 | return e; | ||
| 268 | } | ||
| 269 | } | ||
| 270 | if (e->right.expr->type == E_SYMBOL) { | ||
| 271 | if (e->right.expr->left.sym == &symbol_no) { | ||
| 272 | free(e->right.expr); | ||
| 273 | tmp = e->left.expr; | ||
| 274 | *e = *(e->left.expr); | ||
| 275 | free(tmp); | ||
| 276 | return e; | ||
| 277 | } else if (e->right.expr->left.sym == &symbol_yes) { | ||
| 278 | expr_free(e->left.expr); | ||
| 279 | expr_free(e->right.expr); | ||
| 280 | e->type = E_SYMBOL; | ||
| 281 | e->left.sym = &symbol_yes; | ||
| 282 | e->right.expr = NULL; | ||
| 283 | return e; | ||
| 284 | } | ||
| 285 | } | ||
| 286 | break; | ||
| 287 | default: | ||
| 288 | ; | ||
| 289 | } | ||
| 290 | return e; | ||
| 291 | } | ||
| 292 | |||
| 293 | /* | ||
| 294 | * bool FOO!=n => FOO | ||
| 295 | */ | ||
| 296 | struct expr *expr_trans_bool(struct expr *e) | ||
| 297 | { | ||
| 298 | if (!e) | ||
| 299 | return NULL; | ||
| 300 | switch (e->type) { | ||
| 301 | case E_AND: | ||
| 302 | case E_OR: | ||
| 303 | case E_NOT: | ||
| 304 | e->left.expr = expr_trans_bool(e->left.expr); | ||
| 305 | e->right.expr = expr_trans_bool(e->right.expr); | ||
| 306 | break; | ||
| 307 | case E_UNEQUAL: | ||
| 308 | // FOO!=n -> FOO | ||
| 309 | if (e->left.sym->type == S_TRISTATE) { | ||
| 310 | if (e->right.sym == &symbol_no) { | ||
| 311 | e->type = E_SYMBOL; | ||
| 312 | e->right.sym = NULL; | ||
| 313 | } | ||
| 314 | } | ||
| 315 | break; | ||
| 316 | default: | ||
| 317 | ; | ||
| 318 | } | ||
| 319 | return e; | ||
| 320 | } | ||
| 321 | |||
| 322 | /* | ||
| 323 | * e1 || e2 -> ? | ||
| 324 | */ | ||
| 325 | struct expr *expr_join_or(struct expr *e1, struct expr *e2) | ||
| 326 | { | ||
| 327 | struct expr *tmp; | ||
| 328 | struct symbol *sym1, *sym2; | ||
| 329 | |||
| 330 | if (expr_eq(e1, e2)) | ||
| 331 | return expr_copy(e1); | ||
| 332 | if (e1->type != E_EQUAL && e1->type != E_UNEQUAL && e1->type != E_SYMBOL && e1->type != E_NOT) | ||
| 333 | return NULL; | ||
| 334 | if (e2->type != E_EQUAL && e2->type != E_UNEQUAL && e2->type != E_SYMBOL && e2->type != E_NOT) | ||
| 335 | return NULL; | ||
| 336 | if (e1->type == E_NOT) { | ||
| 337 | tmp = e1->left.expr; | ||
| 338 | if (tmp->type != E_EQUAL && tmp->type != E_UNEQUAL && tmp->type != E_SYMBOL) | ||
| 339 | return NULL; | ||
| 340 | sym1 = tmp->left.sym; | ||
| 341 | } else | ||
| 342 | sym1 = e1->left.sym; | ||
| 343 | if (e2->type == E_NOT) { | ||
| 344 | if (e2->left.expr->type != E_SYMBOL) | ||
| 345 | return NULL; | ||
| 346 | sym2 = e2->left.expr->left.sym; | ||
| 347 | } else | ||
| 348 | sym2 = e2->left.sym; | ||
| 349 | if (sym1 != sym2) | ||
| 350 | return NULL; | ||
| 351 | if (sym1->type != S_BOOLEAN && sym1->type != S_TRISTATE) | ||
| 352 | return NULL; | ||
| 353 | if (sym1->type == S_TRISTATE) { | ||
| 354 | if (e1->type == E_EQUAL && e2->type == E_EQUAL && | ||
| 355 | ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_mod) || | ||
| 356 | (e1->right.sym == &symbol_mod && e2->right.sym == &symbol_yes))) { | ||
| 357 | // (a='y') || (a='m') -> (a!='n') | ||
| 358 | return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_no); | ||
| 359 | } | ||
| 360 | if (e1->type == E_EQUAL && e2->type == E_EQUAL && | ||
| 361 | ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_no) || | ||
| 362 | (e1->right.sym == &symbol_no && e2->right.sym == &symbol_yes))) { | ||
| 363 | // (a='y') || (a='n') -> (a!='m') | ||
| 364 | return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_mod); | ||
| 365 | } | ||
| 366 | if (e1->type == E_EQUAL && e2->type == E_EQUAL && | ||
| 367 | ((e1->right.sym == &symbol_mod && e2->right.sym == &symbol_no) || | ||
| 368 | (e1->right.sym == &symbol_no && e2->right.sym == &symbol_mod))) { | ||
| 369 | // (a='m') || (a='n') -> (a!='y') | ||
| 370 | return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_yes); | ||
| 371 | } | ||
| 372 | } | ||
| 373 | if (sym1->type == S_BOOLEAN && sym1 == sym2) { | ||
| 374 | if ((e1->type == E_NOT && e1->left.expr->type == E_SYMBOL && e2->type == E_SYMBOL) || | ||
| 375 | (e2->type == E_NOT && e2->left.expr->type == E_SYMBOL && e1->type == E_SYMBOL)) | ||
| 376 | return expr_alloc_symbol(&symbol_yes); | ||
| 377 | } | ||
| 378 | |||
| 379 | printf("optimize "); | ||
| 380 | print_expr(0, e1, 0); | ||
| 381 | printf(" || "); | ||
| 382 | print_expr(0, e2, 0); | ||
| 383 | printf(" ?\n"); | ||
| 384 | return NULL; | ||
| 385 | } | ||
| 386 | |||
| 387 | struct expr *expr_join_and(struct expr *e1, struct expr *e2) | ||
| 388 | { | ||
| 389 | struct expr *tmp; | ||
| 390 | struct symbol *sym1, *sym2; | ||
| 391 | |||
| 392 | if (expr_eq(e1, e2)) | ||
| 393 | return expr_copy(e1); | ||
| 394 | if (e1->type != E_EQUAL && e1->type != E_UNEQUAL && e1->type != E_SYMBOL && e1->type != E_NOT) | ||
| 395 | return NULL; | ||
| 396 | if (e2->type != E_EQUAL && e2->type != E_UNEQUAL && e2->type != E_SYMBOL && e2->type != E_NOT) | ||
| 397 | return NULL; | ||
| 398 | if (e1->type == E_NOT) { | ||
| 399 | tmp = e1->left.expr; | ||
| 400 | if (tmp->type != E_EQUAL && tmp->type != E_UNEQUAL && tmp->type != E_SYMBOL) | ||
| 401 | return NULL; | ||
| 402 | sym1 = tmp->left.sym; | ||
| 403 | } else | ||
| 404 | sym1 = e1->left.sym; | ||
| 405 | if (e2->type == E_NOT) { | ||
| 406 | if (e2->left.expr->type != E_SYMBOL) | ||
| 407 | return NULL; | ||
| 408 | sym2 = e2->left.expr->left.sym; | ||
| 409 | } else | ||
| 410 | sym2 = e2->left.sym; | ||
| 411 | if (sym1 != sym2) | ||
| 412 | return NULL; | ||
| 413 | if (sym1->type != S_BOOLEAN && sym1->type != S_TRISTATE) | ||
| 414 | return NULL; | ||
| 415 | |||
| 416 | if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_yes) || | ||
| 417 | (e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_yes)) | ||
| 418 | // (a) && (a='y') -> (a='y') | ||
| 419 | return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes); | ||
| 420 | |||
| 421 | if ((e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_no) || | ||
| 422 | (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_no)) | ||
| 423 | // (a) && (a!='n') -> (a) | ||
| 424 | return expr_alloc_symbol(sym1); | ||
| 425 | |||
| 426 | if (sym1->type == S_TRISTATE) { | ||
| 427 | if (e1->type == E_EQUAL && e2->type == E_UNEQUAL) { | ||
| 428 | // (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b' | ||
| 429 | sym2 = e1->right.sym; | ||
| 430 | if ((e2->right.sym->flags & SYMBOL_CONST) && (sym2->flags & SYMBOL_CONST)) | ||
| 431 | return sym2 != e2->right.sym ? expr_alloc_comp(E_EQUAL, sym1, sym2) | ||
| 432 | : expr_alloc_symbol(&symbol_no); | ||
| 433 | } | ||
| 434 | if (e1->type == E_UNEQUAL && e2->type == E_EQUAL) { | ||
| 435 | // (a='b') && (a!='c') -> 'b'='c' ? 'n' : a='b' | ||
| 436 | sym2 = e2->right.sym; | ||
| 437 | if ((e1->right.sym->flags & SYMBOL_CONST) && (sym2->flags & SYMBOL_CONST)) | ||
| 438 | return sym2 != e1->right.sym ? expr_alloc_comp(E_EQUAL, sym1, sym2) | ||
| 439 | : expr_alloc_symbol(&symbol_no); | ||
| 440 | } | ||
| 441 | if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && | ||
| 442 | ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_no) || | ||
| 443 | (e1->right.sym == &symbol_no && e2->right.sym == &symbol_yes))) | ||
| 444 | // (a!='y') && (a!='n') -> (a='m') | ||
| 445 | return expr_alloc_comp(E_EQUAL, sym1, &symbol_mod); | ||
| 446 | |||
| 447 | if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && | ||
| 448 | ((e1->right.sym == &symbol_yes && e2->right.sym == &symbol_mod) || | ||
| 449 | (e1->right.sym == &symbol_mod && e2->right.sym == &symbol_yes))) | ||
| 450 | // (a!='y') && (a!='m') -> (a='n') | ||
| 451 | return expr_alloc_comp(E_EQUAL, sym1, &symbol_no); | ||
| 452 | |||
| 453 | if (e1->type == E_UNEQUAL && e2->type == E_UNEQUAL && | ||
| 454 | ((e1->right.sym == &symbol_mod && e2->right.sym == &symbol_no) || | ||
| 455 | (e1->right.sym == &symbol_no && e2->right.sym == &symbol_mod))) | ||
| 456 | // (a!='m') && (a!='n') -> (a='m') | ||
| 457 | return expr_alloc_comp(E_EQUAL, sym1, &symbol_yes); | ||
| 458 | |||
| 459 | if ((e1->type == E_SYMBOL && e2->type == E_EQUAL && e2->right.sym == &symbol_mod) || | ||
| 460 | (e2->type == E_SYMBOL && e1->type == E_EQUAL && e1->right.sym == &symbol_mod) || | ||
| 461 | (e1->type == E_SYMBOL && e2->type == E_UNEQUAL && e2->right.sym == &symbol_yes) || | ||
| 462 | (e2->type == E_SYMBOL && e1->type == E_UNEQUAL && e1->right.sym == &symbol_yes)) | ||
| 463 | return NULL; | ||
| 464 | } | ||
| 465 | printf("optimize "); | ||
| 466 | print_expr(0, e1, 0); | ||
| 467 | printf(" && "); | ||
| 468 | print_expr(0, e2, 0); | ||
| 469 | printf(" ?\n"); | ||
| 470 | return NULL; | ||
| 471 | } | ||
| 472 | |||
| 473 | static void expr_eliminate_dups1(enum expr_type type, struct expr **ep1, struct expr **ep2) | ||
| 474 | { | ||
| 475 | #define e1 (*ep1) | ||
| 476 | #define e2 (*ep2) | ||
| 477 | struct expr *tmp; | ||
| 478 | |||
| 479 | if (e1->type == type) { | ||
| 480 | expr_eliminate_dups1(type, &e1->left.expr, &e2); | ||
| 481 | expr_eliminate_dups1(type, &e1->right.expr, &e2); | ||
| 482 | return; | ||
| 483 | } | ||
| 484 | if (e2->type == type) { | ||
| 485 | expr_eliminate_dups1(type, &e1, &e2->left.expr); | ||
| 486 | expr_eliminate_dups1(type, &e1, &e2->right.expr); | ||
| 487 | return; | ||
| 488 | } | ||
| 489 | if (e1 == e2) | ||
| 490 | return; | ||
| 491 | |||
| 492 | switch (e1->type) { | ||
| 493 | case E_OR: case E_AND: | ||
| 494 | expr_eliminate_dups1(e1->type, &e1, &e1); | ||
| 495 | default: | ||
| 496 | ; | ||
| 497 | } | ||
| 498 | |||
| 499 | switch (type) { | ||
| 500 | case E_OR: | ||
| 501 | tmp = expr_join_or(e1, e2); | ||
| 502 | if (tmp) { | ||
| 503 | expr_free(e1); expr_free(e2); | ||
| 504 | e1 = expr_alloc_symbol(&symbol_no); | ||
| 505 | e2 = tmp; | ||
| 506 | trans_count++; | ||
| 507 | } | ||
| 508 | break; | ||
| 509 | case E_AND: | ||
| 510 | tmp = expr_join_and(e1, e2); | ||
| 511 | if (tmp) { | ||
| 512 | expr_free(e1); expr_free(e2); | ||
| 513 | e1 = expr_alloc_symbol(&symbol_yes); | ||
| 514 | e2 = tmp; | ||
| 515 | trans_count++; | ||
| 516 | } | ||
| 517 | break; | ||
| 518 | default: | ||
| 519 | ; | ||
| 520 | } | ||
| 521 | #undef e1 | ||
| 522 | #undef e2 | ||
| 523 | } | ||
| 524 | |||
| 525 | static void expr_eliminate_dups2(enum expr_type type, struct expr **ep1, struct expr **ep2) | ||
| 526 | { | ||
| 527 | #define e1 (*ep1) | ||
| 528 | #define e2 (*ep2) | ||
| 529 | struct expr *tmp, *tmp1, *tmp2; | ||
| 530 | |||
| 531 | if (e1->type == type) { | ||
| 532 | expr_eliminate_dups2(type, &e1->left.expr, &e2); | ||
| 533 | expr_eliminate_dups2(type, &e1->right.expr, &e2); | ||
| 534 | return; | ||
| 535 | } | ||
| 536 | if (e2->type == type) { | ||
| 537 | expr_eliminate_dups2(type, &e1, &e2->left.expr); | ||
| 538 | expr_eliminate_dups2(type, &e1, &e2->right.expr); | ||
| 539 | } | ||
| 540 | if (e1 == e2) | ||
| 541 | return; | ||
| 542 | |||
| 543 | switch (e1->type) { | ||
| 544 | case E_OR: | ||
| 545 | expr_eliminate_dups2(e1->type, &e1, &e1); | ||
| 546 | // (FOO || BAR) && (!FOO && !BAR) -> n | ||
| 547 | tmp1 = expr_transform(expr_alloc_one(E_NOT, expr_copy(e1))); | ||
| 548 | tmp2 = expr_copy(e2); | ||
| 549 | tmp = expr_extract_eq_and(&tmp1, &tmp2); | ||
| 550 | if (expr_is_yes(tmp1)) { | ||
| 551 | expr_free(e1); | ||
| 552 | e1 = expr_alloc_symbol(&symbol_no); | ||
| 553 | trans_count++; | ||
| 554 | } | ||
| 555 | expr_free(tmp2); | ||
| 556 | expr_free(tmp1); | ||
| 557 | expr_free(tmp); | ||
| 558 | break; | ||
| 559 | case E_AND: | ||
| 560 | expr_eliminate_dups2(e1->type, &e1, &e1); | ||
| 561 | // (FOO && BAR) || (!FOO || !BAR) -> y | ||
| 562 | tmp1 = expr_transform(expr_alloc_one(E_NOT, expr_copy(e1))); | ||
| 563 | tmp2 = expr_copy(e2); | ||
| 564 | tmp = expr_extract_eq_or(&tmp1, &tmp2); | ||
| 565 | if (expr_is_no(tmp1)) { | ||
| 566 | expr_free(e1); | ||
| 567 | e1 = expr_alloc_symbol(&symbol_yes); | ||
| 568 | trans_count++; | ||
| 569 | } | ||
| 570 | expr_free(tmp2); | ||
| 571 | expr_free(tmp1); | ||
| 572 | expr_free(tmp); | ||
| 573 | break; | ||
| 574 | default: | ||
| 575 | ; | ||
| 576 | } | ||
| 577 | #undef e1 | ||
| 578 | #undef e2 | ||
| 579 | } | ||
| 580 | |||
| 581 | struct expr *expr_eliminate_dups(struct expr *e) | ||
| 582 | { | ||
| 583 | int oldcount; | ||
| 584 | if (!e) | ||
| 585 | return e; | ||
| 586 | |||
| 587 | oldcount = trans_count; | ||
| 588 | while (1) { | ||
| 589 | trans_count = 0; | ||
| 590 | switch (e->type) { | ||
| 591 | case E_OR: case E_AND: | ||
| 592 | expr_eliminate_dups1(e->type, &e, &e); | ||
| 593 | expr_eliminate_dups2(e->type, &e, &e); | ||
| 594 | default: | ||
| 595 | ; | ||
| 596 | } | ||
| 597 | if (!trans_count) | ||
| 598 | break; | ||
| 599 | e = expr_eliminate_yn(e); | ||
| 600 | } | ||
| 601 | trans_count = oldcount; | ||
| 602 | return e; | ||
| 603 | } | ||
| 604 | |||
| 605 | struct expr *expr_transform(struct expr *e) | ||
| 606 | { | ||
| 607 | struct expr *tmp; | ||
| 608 | |||
| 609 | if (!e) | ||
| 610 | return NULL; | ||
| 611 | switch (e->type) { | ||
| 612 | case E_EQUAL: | ||
| 613 | case E_UNEQUAL: | ||
| 614 | case E_SYMBOL: | ||
| 615 | case E_CHOICE: | ||
| 616 | break; | ||
| 617 | default: | ||
| 618 | e->left.expr = expr_transform(e->left.expr); | ||
| 619 | e->right.expr = expr_transform(e->right.expr); | ||
| 620 | } | ||
| 621 | |||
| 622 | switch (e->type) { | ||
| 623 | case E_EQUAL: | ||
| 624 | if (e->left.sym->type != S_BOOLEAN) | ||
| 625 | break; | ||
| 626 | if (e->right.sym == &symbol_no) { | ||
| 627 | e->type = E_NOT; | ||
| 628 | e->left.expr = expr_alloc_symbol(e->left.sym); | ||
| 629 | e->right.sym = NULL; | ||
| 630 | break; | ||
| 631 | } | ||
| 632 | if (e->right.sym == &symbol_mod) { | ||
| 633 | printf("boolean symbol %s tested for 'm'? test forced to 'n'\n", e->left.sym->name); | ||
| 634 | e->type = E_SYMBOL; | ||
| 635 | e->left.sym = &symbol_no; | ||
| 636 | e->right.sym = NULL; | ||
| 637 | break; | ||
| 638 | } | ||
| 639 | if (e->right.sym == &symbol_yes) { | ||
| 640 | e->type = E_SYMBOL; | ||
| 641 | e->right.sym = NULL; | ||
| 642 | break; | ||
| 643 | } | ||
| 644 | break; | ||
| 645 | case E_UNEQUAL: | ||
| 646 | if (e->left.sym->type != S_BOOLEAN) | ||
| 647 | break; | ||
| 648 | if (e->right.sym == &symbol_no) { | ||
| 649 | e->type = E_SYMBOL; | ||
| 650 | e->right.sym = NULL; | ||
| 651 | break; | ||
| 652 | } | ||
| 653 | if (e->right.sym == &symbol_mod) { | ||
| 654 | printf("boolean symbol %s tested for 'm'? test forced to 'y'\n", e->left.sym->name); | ||
| 655 | e->type = E_SYMBOL; | ||
| 656 | e->left.sym = &symbol_yes; | ||
| 657 | e->right.sym = NULL; | ||
| 658 | break; | ||
| 659 | } | ||
| 660 | if (e->right.sym == &symbol_yes) { | ||
| 661 | e->type = E_NOT; | ||
| 662 | e->left.expr = expr_alloc_symbol(e->left.sym); | ||
| 663 | e->right.sym = NULL; | ||
| 664 | break; | ||
| 665 | } | ||
| 666 | break; | ||
| 667 | case E_NOT: | ||
| 668 | switch (e->left.expr->type) { | ||
| 669 | case E_NOT: | ||
| 670 | // !!a -> a | ||
| 671 | tmp = e->left.expr->left.expr; | ||
| 672 | free(e->left.expr); | ||
| 673 | free(e); | ||
| 674 | e = tmp; | ||
| 675 | e = expr_transform(e); | ||
| 676 | break; | ||
| 677 | case E_EQUAL: | ||
| 678 | case E_UNEQUAL: | ||
| 679 | // !a='x' -> a!='x' | ||
| 680 | tmp = e->left.expr; | ||
| 681 | free(e); | ||
| 682 | e = tmp; | ||
| 683 | e->type = e->type == E_EQUAL ? E_UNEQUAL : E_EQUAL; | ||
| 684 | break; | ||
| 685 | case E_OR: | ||
| 686 | // !(a || b) -> !a && !b | ||
| 687 | tmp = e->left.expr; | ||
| 688 | e->type = E_AND; | ||
| 689 | e->right.expr = expr_alloc_one(E_NOT, tmp->right.expr); | ||
| 690 | tmp->type = E_NOT; | ||
| 691 | tmp->right.expr = NULL; | ||
| 692 | e = expr_transform(e); | ||
| 693 | break; | ||
| 694 | case E_AND: | ||
| 695 | // !(a && b) -> !a || !b | ||
| 696 | tmp = e->left.expr; | ||
| 697 | e->type = E_OR; | ||
| 698 | e->right.expr = expr_alloc_one(E_NOT, tmp->right.expr); | ||
| 699 | tmp->type = E_NOT; | ||
| 700 | tmp->right.expr = NULL; | ||
| 701 | e = expr_transform(e); | ||
| 702 | break; | ||
| 703 | case E_SYMBOL: | ||
| 704 | if (e->left.expr->left.sym == &symbol_yes) { | ||
| 705 | // !'y' -> 'n' | ||
| 706 | tmp = e->left.expr; | ||
| 707 | free(e); | ||
| 708 | e = tmp; | ||
| 709 | e->type = E_SYMBOL; | ||
| 710 | e->left.sym = &symbol_no; | ||
| 711 | break; | ||
| 712 | } | ||
| 713 | if (e->left.expr->left.sym == &symbol_mod) { | ||
| 714 | // !'m' -> 'm' | ||
| 715 | tmp = e->left.expr; | ||
| 716 | free(e); | ||
| 717 | e = tmp; | ||
| 718 | e->type = E_SYMBOL; | ||
| 719 | e->left.sym = &symbol_mod; | ||
| 720 | break; | ||
| 721 | } | ||
| 722 | if (e->left.expr->left.sym == &symbol_no) { | ||
| 723 | // !'n' -> 'y' | ||
| 724 | tmp = e->left.expr; | ||
| 725 | free(e); | ||
| 726 | e = tmp; | ||
| 727 | e->type = E_SYMBOL; | ||
| 728 | e->left.sym = &symbol_yes; | ||
| 729 | break; | ||
| 730 | } | ||
| 731 | break; | ||
| 732 | default: | ||
| 733 | ; | ||
| 734 | } | ||
| 735 | break; | ||
| 736 | default: | ||
| 737 | ; | ||
| 738 | } | ||
| 739 | return e; | ||
| 740 | } | ||
| 741 | |||
| 742 | int expr_contains_symbol(struct expr *dep, struct symbol *sym) | ||
| 743 | { | ||
| 744 | if (!dep) | ||
| 745 | return 0; | ||
| 746 | |||
| 747 | switch (dep->type) { | ||
| 748 | case E_AND: | ||
| 749 | case E_OR: | ||
| 750 | return expr_contains_symbol(dep->left.expr, sym) || | ||
| 751 | expr_contains_symbol(dep->right.expr, sym); | ||
| 752 | case E_SYMBOL: | ||
| 753 | return dep->left.sym == sym; | ||
| 754 | case E_EQUAL: | ||
| 755 | case E_UNEQUAL: | ||
| 756 | return dep->left.sym == sym || | ||
| 757 | dep->right.sym == sym; | ||
| 758 | case E_NOT: | ||
| 759 | return expr_contains_symbol(dep->left.expr, sym); | ||
| 760 | default: | ||
| 761 | ; | ||
| 762 | } | ||
| 763 | return 0; | ||
| 764 | } | ||
| 765 | |||
| 766 | bool expr_depends_symbol(struct expr *dep, struct symbol *sym) | ||
| 767 | { | ||
| 768 | if (!dep) | ||
| 769 | return false; | ||
| 770 | |||
| 771 | switch (dep->type) { | ||
| 772 | case E_AND: | ||
| 773 | return expr_depends_symbol(dep->left.expr, sym) || | ||
| 774 | expr_depends_symbol(dep->right.expr, sym); | ||
| 775 | case E_SYMBOL: | ||
| 776 | return dep->left.sym == sym; | ||
| 777 | case E_EQUAL: | ||
| 778 | if (dep->left.sym == sym) { | ||
| 779 | if (dep->right.sym == &symbol_yes || dep->right.sym == &symbol_mod) | ||
| 780 | return true; | ||
| 781 | } | ||
| 782 | break; | ||
| 783 | case E_UNEQUAL: | ||
| 784 | if (dep->left.sym == sym) { | ||
| 785 | if (dep->right.sym == &symbol_no) | ||
| 786 | return true; | ||
| 787 | } | ||
| 788 | break; | ||
| 789 | default: | ||
| 790 | ; | ||
| 791 | } | ||
| 792 | return false; | ||
| 793 | } | ||
| 794 | |||
| 795 | struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2) | ||
| 796 | { | ||
| 797 | struct expr *tmp = NULL; | ||
| 798 | expr_extract_eq(E_AND, &tmp, ep1, ep2); | ||
| 799 | if (tmp) { | ||
| 800 | *ep1 = expr_eliminate_yn(*ep1); | ||
| 801 | *ep2 = expr_eliminate_yn(*ep2); | ||
| 802 | } | ||
| 803 | return tmp; | ||
| 804 | } | ||
| 805 | |||
| 806 | struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2) | ||
| 807 | { | ||
| 808 | struct expr *tmp = NULL; | ||
| 809 | expr_extract_eq(E_OR, &tmp, ep1, ep2); | ||
| 810 | if (tmp) { | ||
| 811 | *ep1 = expr_eliminate_yn(*ep1); | ||
| 812 | *ep2 = expr_eliminate_yn(*ep2); | ||
| 813 | } | ||
| 814 | return tmp; | ||
| 815 | } | ||
| 816 | |||
| 817 | void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2) | ||
| 818 | { | ||
| 819 | #define e1 (*ep1) | ||
| 820 | #define e2 (*ep2) | ||
| 821 | if (e1->type == type) { | ||
| 822 | expr_extract_eq(type, ep, &e1->left.expr, &e2); | ||
| 823 | expr_extract_eq(type, ep, &e1->right.expr, &e2); | ||
| 824 | return; | ||
| 825 | } | ||
| 826 | if (e2->type == type) { | ||
| 827 | expr_extract_eq(type, ep, ep1, &e2->left.expr); | ||
| 828 | expr_extract_eq(type, ep, ep1, &e2->right.expr); | ||
| 829 | return; | ||
| 830 | } | ||
| 831 | if (expr_eq(e1, e2)) { | ||
| 832 | *ep = *ep ? expr_alloc_two(type, *ep, e1) : e1; | ||
| 833 | expr_free(e2); | ||
| 834 | if (type == E_AND) { | ||
| 835 | e1 = expr_alloc_symbol(&symbol_yes); | ||
| 836 | e2 = expr_alloc_symbol(&symbol_yes); | ||
| 837 | } else if (type == E_OR) { | ||
| 838 | e1 = expr_alloc_symbol(&symbol_no); | ||
| 839 | e2 = expr_alloc_symbol(&symbol_no); | ||
| 840 | } | ||
| 841 | } | ||
| 842 | #undef e1 | ||
| 843 | #undef e2 | ||
| 844 | } | ||
| 845 | |||
| 846 | struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym) | ||
| 847 | { | ||
| 848 | struct expr *e1, *e2; | ||
| 849 | |||
| 850 | if (!e) { | ||
| 851 | e = expr_alloc_symbol(sym); | ||
| 852 | if (type == E_UNEQUAL) | ||
| 853 | e = expr_alloc_one(E_NOT, e); | ||
| 854 | return e; | ||
| 855 | } | ||
| 856 | switch (e->type) { | ||
| 857 | case E_AND: | ||
| 858 | e1 = expr_trans_compare(e->left.expr, E_EQUAL, sym); | ||
| 859 | e2 = expr_trans_compare(e->right.expr, E_EQUAL, sym); | ||
| 860 | if (sym == &symbol_yes) | ||
| 861 | e = expr_alloc_two(E_AND, e1, e2); | ||
| 862 | if (sym == &symbol_no) | ||
| 863 | e = expr_alloc_two(E_OR, e1, e2); | ||
| 864 | if (type == E_UNEQUAL) | ||
| 865 | e = expr_alloc_one(E_NOT, e); | ||
| 866 | return e; | ||
| 867 | case E_OR: | ||
| 868 | e1 = expr_trans_compare(e->left.expr, E_EQUAL, sym); | ||
| 869 | e2 = expr_trans_compare(e->right.expr, E_EQUAL, sym); | ||
| 870 | if (sym == &symbol_yes) | ||
| 871 | e = expr_alloc_two(E_OR, e1, e2); | ||
| 872 | if (sym == &symbol_no) | ||
| 873 | e = expr_alloc_two(E_AND, e1, e2); | ||
| 874 | if (type == E_UNEQUAL) | ||
| 875 | e = expr_alloc_one(E_NOT, e); | ||
| 876 | return e; | ||
| 877 | case E_NOT: | ||
| 878 | return expr_trans_compare(e->left.expr, type == E_EQUAL ? E_UNEQUAL : E_EQUAL, sym); | ||
| 879 | case E_UNEQUAL: | ||
| 880 | case E_EQUAL: | ||
| 881 | if (type == E_EQUAL) { | ||
| 882 | if (sym == &symbol_yes) | ||
| 883 | return expr_copy(e); | ||
| 884 | if (sym == &symbol_mod) | ||
| 885 | return expr_alloc_symbol(&symbol_no); | ||
| 886 | if (sym == &symbol_no) | ||
| 887 | return expr_alloc_one(E_NOT, expr_copy(e)); | ||
| 888 | } else { | ||
| 889 | if (sym == &symbol_yes) | ||
| 890 | return expr_alloc_one(E_NOT, expr_copy(e)); | ||
| 891 | if (sym == &symbol_mod) | ||
| 892 | return expr_alloc_symbol(&symbol_yes); | ||
| 893 | if (sym == &symbol_no) | ||
| 894 | return expr_copy(e); | ||
| 895 | } | ||
| 896 | break; | ||
| 897 | case E_SYMBOL: | ||
| 898 | return expr_alloc_comp(type, e->left.sym, sym); | ||
| 899 | case E_CHOICE: | ||
| 900 | case E_NONE: | ||
| 901 | /* panic */; | ||
| 902 | } | ||
| 903 | return NULL; | ||
| 904 | } | ||
| 905 | |||
| 906 | tristate expr_calc_value(struct expr *e) | ||
| 907 | { | ||
| 908 | tristate val1, val2; | ||
| 909 | const char *str1, *str2; | ||
| 910 | |||
| 911 | if (!e) | ||
| 912 | return yes; | ||
| 913 | |||
| 914 | switch (e->type) { | ||
| 915 | case E_SYMBOL: | ||
| 916 | sym_calc_value(e->left.sym); | ||
| 917 | return S_TRI(e->left.sym->curr); | ||
| 918 | case E_AND: | ||
| 919 | val1 = expr_calc_value(e->left.expr); | ||
| 920 | val2 = expr_calc_value(e->right.expr); | ||
| 921 | return E_AND(val1, val2); | ||
| 922 | case E_OR: | ||
| 923 | val1 = expr_calc_value(e->left.expr); | ||
| 924 | val2 = expr_calc_value(e->right.expr); | ||
| 925 | return E_OR(val1, val2); | ||
| 926 | case E_NOT: | ||
| 927 | val1 = expr_calc_value(e->left.expr); | ||
| 928 | return E_NOT(val1); | ||
| 929 | case E_EQUAL: | ||
| 930 | sym_calc_value(e->left.sym); | ||
| 931 | sym_calc_value(e->right.sym); | ||
| 932 | str1 = sym_get_string_value(e->left.sym); | ||
| 933 | str2 = sym_get_string_value(e->right.sym); | ||
| 934 | return !strcmp(str1, str2) ? yes : no; | ||
| 935 | case E_UNEQUAL: | ||
| 936 | sym_calc_value(e->left.sym); | ||
| 937 | sym_calc_value(e->right.sym); | ||
| 938 | str1 = sym_get_string_value(e->left.sym); | ||
| 939 | str2 = sym_get_string_value(e->right.sym); | ||
| 940 | return !strcmp(str1, str2) ? no : yes; | ||
| 941 | default: | ||
| 942 | printf("expr_calc_value: %d?\n", e->type); | ||
| 943 | return no; | ||
| 944 | } | ||
| 945 | } | ||
| 946 | |||
| 947 | int expr_compare_type(enum expr_type t1, enum expr_type t2) | ||
| 948 | { | ||
| 949 | #if 0 | ||
| 950 | return 1; | ||
| 951 | #else | ||
| 952 | if (t1 == t2) | ||
| 953 | return 0; | ||
| 954 | switch (t1) { | ||
| 955 | case E_EQUAL: | ||
| 956 | case E_UNEQUAL: | ||
| 957 | if (t2 == E_NOT) | ||
| 958 | return 1; | ||
| 959 | case E_NOT: | ||
| 960 | if (t2 == E_AND) | ||
| 961 | return 1; | ||
| 962 | case E_AND: | ||
| 963 | if (t2 == E_OR) | ||
| 964 | return 1; | ||
| 965 | case E_OR: | ||
| 966 | if (t2 == E_CHOICE) | ||
| 967 | return 1; | ||
| 968 | case E_CHOICE: | ||
| 969 | if (t2 == 0) | ||
| 970 | return 1; | ||
| 971 | default: | ||
| 972 | return -1; | ||
| 973 | } | ||
| 974 | printf("[%dgt%d?]", t1, t2); | ||
| 975 | return 0; | ||
| 976 | #endif | ||
| 977 | } | ||
| 978 | |||
| 979 | void expr_print(struct expr *e, void (*fn)(void *, const char *), void *data, int prevtoken) | ||
| 980 | { | ||
| 981 | if (!e) { | ||
| 982 | fn(data, "y"); | ||
| 983 | return; | ||
| 984 | } | ||
| 985 | |||
| 986 | if (expr_compare_type(prevtoken, e->type) > 0) | ||
| 987 | fn(data, "("); | ||
| 988 | switch (e->type) { | ||
| 989 | case E_SYMBOL: | ||
| 990 | if (e->left.sym->name) | ||
| 991 | fn(data, e->left.sym->name); | ||
| 992 | else | ||
| 993 | fn(data, "<choice>"); | ||
| 994 | break; | ||
| 995 | case E_NOT: | ||
| 996 | fn(data, "!"); | ||
| 997 | expr_print(e->left.expr, fn, data, E_NOT); | ||
| 998 | break; | ||
| 999 | case E_EQUAL: | ||
| 1000 | fn(data, e->left.sym->name); | ||
| 1001 | fn(data, "="); | ||
| 1002 | fn(data, e->right.sym->name); | ||
| 1003 | break; | ||
| 1004 | case E_UNEQUAL: | ||
| 1005 | fn(data, e->left.sym->name); | ||
| 1006 | fn(data, "!="); | ||
| 1007 | fn(data, e->right.sym->name); | ||
| 1008 | break; | ||
| 1009 | case E_OR: | ||
| 1010 | expr_print(e->left.expr, fn, data, E_OR); | ||
| 1011 | fn(data, " || "); | ||
| 1012 | expr_print(e->right.expr, fn, data, E_OR); | ||
| 1013 | break; | ||
| 1014 | case E_AND: | ||
| 1015 | expr_print(e->left.expr, fn, data, E_AND); | ||
| 1016 | fn(data, " && "); | ||
| 1017 | expr_print(e->right.expr, fn, data, E_AND); | ||
| 1018 | break; | ||
| 1019 | case E_CHOICE: | ||
| 1020 | if (e->left.expr) { | ||
| 1021 | expr_print(e->left.expr, fn, data, E_CHOICE); | ||
| 1022 | fn(data, " ^ "); | ||
| 1023 | } | ||
| 1024 | fn(data, e->right.sym->name); | ||
| 1025 | break; | ||
| 1026 | default: | ||
| 1027 | { | ||
| 1028 | char buf[32]; | ||
| 1029 | sprintf(buf, "<unknown type %d>", e->type); | ||
| 1030 | fn(data, buf); | ||
| 1031 | break; | ||
| 1032 | } | ||
| 1033 | } | ||
| 1034 | if (expr_compare_type(prevtoken, e->type) > 0) | ||
| 1035 | fn(data, ")"); | ||
| 1036 | } | ||
| 1037 | |||
| 1038 | static void expr_print_file_helper(void *data, const char *str) | ||
| 1039 | { | ||
| 1040 | fwrite(str, strlen(str), 1, data); | ||
| 1041 | } | ||
| 1042 | |||
| 1043 | void expr_fprint(struct expr *e, FILE *out) | ||
| 1044 | { | ||
| 1045 | expr_print(e, expr_print_file_helper, out, E_NONE); | ||
| 1046 | } | ||
| 1047 | |||
| 1048 | void print_expr(int mask, struct expr *e, int prevtoken) | ||
| 1049 | { | ||
| 1050 | if (!(cdebug & mask)) | ||
| 1051 | return; | ||
| 1052 | expr_fprint(e, stdout); | ||
| 1053 | } | ||
| 1054 | |||
diff --git a/scripts/config/expr.h b/scripts/config/expr.h new file mode 100644 index 000000000..e96d03b5a --- /dev/null +++ b/scripts/config/expr.h | |||
| @@ -0,0 +1,242 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 3 | * Released under the terms of the GNU GPL v2.0. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #ifndef EXPR_H | ||
| 7 | #define EXPR_H | ||
| 8 | |||
| 9 | #ifdef __cplusplus | ||
| 10 | extern "C" { | ||
| 11 | #endif | ||
| 12 | |||
| 13 | #include <stdio.h> | ||
| 14 | #ifndef __cplusplus | ||
| 15 | #include <stdbool.h> | ||
| 16 | #endif | ||
| 17 | |||
| 18 | struct file { | ||
| 19 | struct file *next; | ||
| 20 | struct file *parent; | ||
| 21 | #ifdef CML1 | ||
| 22 | struct statement *stmt; | ||
| 23 | struct statement *last_stmt; | ||
| 24 | #endif | ||
| 25 | char *name; | ||
| 26 | int lineno; | ||
| 27 | int flags; | ||
| 28 | }; | ||
| 29 | |||
| 30 | #define FILE_BUSY 0x0001 | ||
| 31 | #define FILE_SCANNED 0x0002 | ||
| 32 | #define FILE_PRINTED 0x0004 | ||
| 33 | |||
| 34 | typedef enum tristate { | ||
| 35 | no, mod, yes | ||
| 36 | } tristate; | ||
| 37 | |||
| 38 | enum expr_type { | ||
| 39 | E_NONE, E_OR, E_AND, E_NOT, E_EQUAL, E_UNEQUAL, E_CHOICE, E_SYMBOL | ||
| 40 | }; | ||
| 41 | |||
| 42 | union expr_data { | ||
| 43 | struct expr *expr; | ||
| 44 | struct symbol *sym; | ||
| 45 | }; | ||
| 46 | |||
| 47 | struct expr { | ||
| 48 | #ifdef CML1 | ||
| 49 | int token; | ||
| 50 | #else | ||
| 51 | enum expr_type type; | ||
| 52 | #endif | ||
| 53 | union expr_data left, right; | ||
| 54 | }; | ||
| 55 | |||
| 56 | #define E_TRI(ev) ((ev).tri) | ||
| 57 | #define E_EXPR(ev) ((ev).expr) | ||
| 58 | #define E_CALC(ev) (E_TRI(ev) = expr_calc_value(E_EXPR(ev))) | ||
| 59 | |||
| 60 | #define E_OR(dep1, dep2) (((dep1)>(dep2))?(dep1):(dep2)) | ||
| 61 | #define E_AND(dep1, dep2) (((dep1)<(dep2))?(dep1):(dep2)) | ||
| 62 | #define E_NOT(dep) (2-(dep)) | ||
| 63 | |||
| 64 | struct expr_value { | ||
| 65 | struct expr *expr; | ||
| 66 | tristate tri; | ||
| 67 | }; | ||
| 68 | |||
| 69 | #define S_VAL(sv) ((sv).value) | ||
| 70 | #define S_TRI(sv) ((sv).tri) | ||
| 71 | #define S_EQ(sv1, sv2) (S_VAL(sv1) == S_VAL(sv2) || !strcmp(S_VAL(sv1), S_VAL(sv2))) | ||
| 72 | |||
| 73 | struct symbol_value { | ||
| 74 | void *value; | ||
| 75 | tristate tri; | ||
| 76 | }; | ||
| 77 | |||
| 78 | enum symbol_type { | ||
| 79 | S_UNKNOWN, S_BOOLEAN, S_TRISTATE, S_INT, S_HEX, S_STRING, S_OTHER | ||
| 80 | }; | ||
| 81 | |||
| 82 | struct symbol { | ||
| 83 | struct symbol *next; | ||
| 84 | char *name; | ||
| 85 | char *help; | ||
| 86 | #ifdef CML1 | ||
| 87 | int type; | ||
| 88 | #else | ||
| 89 | enum symbol_type type; | ||
| 90 | #endif | ||
| 91 | struct symbol_value curr, def; | ||
| 92 | tristate visible; | ||
| 93 | int flags; | ||
| 94 | struct property *prop; | ||
| 95 | struct expr *dep, *dep2; | ||
| 96 | struct menu *menu; | ||
| 97 | }; | ||
| 98 | |||
| 99 | #define for_all_symbols(i, sym) for (i = 0; i < 257; i++) for (sym = symbol_hash[i]; sym; sym = sym->next) if (sym->type != S_OTHER) | ||
| 100 | |||
| 101 | #ifdef CML1 | ||
| 102 | #define SYMBOL_UNKNOWN S_UNKNOWN | ||
| 103 | #define SYMBOL_BOOLEAN S_BOOLEAN | ||
| 104 | #define SYMBOL_TRISTATE S_TRISTATE | ||
| 105 | #define SYMBOL_INT S_INT | ||
| 106 | #define SYMBOL_HEX S_HEX | ||
| 107 | #define SYMBOL_STRING S_STRING | ||
| 108 | #define SYMBOL_OTHER S_OTHER | ||
| 109 | #endif | ||
| 110 | |||
| 111 | #define SYMBOL_YES 0x0001 | ||
| 112 | #define SYMBOL_MOD 0x0002 | ||
| 113 | #define SYMBOL_NO 0x0004 | ||
| 114 | #define SYMBOL_CONST 0x0007 | ||
| 115 | #define SYMBOL_CHECK 0x0008 | ||
| 116 | #define SYMBOL_CHOICE 0x0010 | ||
| 117 | #define SYMBOL_CHOICEVAL 0x0020 | ||
| 118 | #define SYMBOL_PRINTED 0x0040 | ||
| 119 | #define SYMBOL_VALID 0x0080 | ||
| 120 | #define SYMBOL_OPTIONAL 0x0100 | ||
| 121 | #define SYMBOL_WRITE 0x0200 | ||
| 122 | #define SYMBOL_CHANGED 0x0400 | ||
| 123 | #define SYMBOL_NEW 0x0800 | ||
| 124 | #define SYMBOL_AUTO 0x1000 | ||
| 125 | |||
| 126 | #define SYMBOL_MAXLENGTH 256 | ||
| 127 | #define SYMBOL_HASHSIZE 257 | ||
| 128 | #define SYMBOL_HASHMASK 0xff | ||
| 129 | |||
| 130 | enum prop_type { | ||
| 131 | P_UNKNOWN, P_PROMPT, P_COMMENT, P_MENU, P_ROOTMENU, P_DEFAULT, P_CHOICE | ||
| 132 | }; | ||
| 133 | |||
| 134 | struct property { | ||
| 135 | struct property *next; | ||
| 136 | struct symbol *sym; | ||
| 137 | #ifdef CML1 | ||
| 138 | int token; | ||
| 139 | #else | ||
| 140 | enum prop_type type; | ||
| 141 | #endif | ||
| 142 | const char *text; | ||
| 143 | struct symbol *def; | ||
| 144 | struct expr_value visible; | ||
| 145 | struct expr *dep; | ||
| 146 | struct expr *dep2; | ||
| 147 | struct menu *menu; | ||
| 148 | struct file *file; | ||
| 149 | int lineno; | ||
| 150 | #ifdef CML1 | ||
| 151 | struct property *next_pos; | ||
| 152 | #endif | ||
| 153 | }; | ||
| 154 | |||
| 155 | #define for_all_properties(sym, st, tok) \ | ||
| 156 | for (st = sym->prop; st; st = st->next) \ | ||
| 157 | if (st->type == (tok)) | ||
| 158 | #define for_all_prompts(sym, st) for_all_properties(sym, st, P_PROMPT) | ||
| 159 | #define for_all_defaults(sym, st) for_all_properties(sym, st, P_DEFAULT) | ||
| 160 | #define for_all_choices(sym, st) for_all_properties(sym, st, P_CHOICE) | ||
| 161 | |||
| 162 | struct menu { | ||
| 163 | struct menu *next; | ||
| 164 | struct menu *parent; | ||
| 165 | struct menu *list; | ||
| 166 | struct symbol *sym; | ||
| 167 | struct property *prompt; | ||
| 168 | struct expr *dep; | ||
| 169 | //char *help; | ||
| 170 | struct file *file; | ||
| 171 | int lineno; | ||
| 172 | void *data; | ||
| 173 | }; | ||
| 174 | |||
| 175 | #ifndef SWIG | ||
| 176 | |||
| 177 | extern struct file *file_list; | ||
| 178 | extern struct file *current_file; | ||
| 179 | struct file *lookup_file(const char *name); | ||
| 180 | |||
| 181 | extern struct symbol symbol_yes, symbol_no, symbol_mod; | ||
| 182 | extern struct symbol *modules_sym; | ||
| 183 | extern int cdebug; | ||
| 184 | extern int print_type; | ||
| 185 | struct expr *expr_alloc_symbol(struct symbol *sym); | ||
| 186 | #ifdef CML1 | ||
| 187 | struct expr *expr_alloc_one(int token, struct expr *ce); | ||
| 188 | struct expr *expr_alloc_two(int token, struct expr *e1, struct expr *e2); | ||
| 189 | struct expr *expr_alloc_comp(int token, struct symbol *s1, struct symbol *s2); | ||
| 190 | #else | ||
| 191 | struct expr *expr_alloc_one(enum expr_type type, struct expr *ce); | ||
| 192 | struct expr *expr_alloc_two(enum expr_type type, struct expr *e1, struct expr *e2); | ||
| 193 | struct expr *expr_alloc_comp(enum expr_type type, struct symbol *s1, struct symbol *s2); | ||
| 194 | #endif | ||
| 195 | struct expr *expr_alloc_and(struct expr *e1, struct expr *e2); | ||
| 196 | struct expr *expr_copy(struct expr *org); | ||
| 197 | void expr_free(struct expr *e); | ||
| 198 | int expr_eq(struct expr *e1, struct expr *e2); | ||
| 199 | void expr_eliminate_eq(struct expr **ep1, struct expr **ep2); | ||
| 200 | tristate expr_calc_value(struct expr *e); | ||
| 201 | struct expr *expr_eliminate_yn(struct expr *e); | ||
| 202 | struct expr *expr_trans_bool(struct expr *e); | ||
| 203 | struct expr *expr_eliminate_dups(struct expr *e); | ||
| 204 | struct expr *expr_transform(struct expr *e); | ||
| 205 | int expr_contains_symbol(struct expr *dep, struct symbol *sym); | ||
| 206 | bool expr_depends_symbol(struct expr *dep, struct symbol *sym); | ||
| 207 | struct expr *expr_extract_eq_and(struct expr **ep1, struct expr **ep2); | ||
| 208 | struct expr *expr_extract_eq_or(struct expr **ep1, struct expr **ep2); | ||
| 209 | void expr_extract_eq(enum expr_type type, struct expr **ep, struct expr **ep1, struct expr **ep2); | ||
| 210 | struct expr *expr_trans_compare(struct expr *e, enum expr_type type, struct symbol *sym); | ||
| 211 | |||
| 212 | void expr_fprint(struct expr *e, FILE *out); | ||
| 213 | void print_expr(int mask, struct expr *e, int prevtoken); | ||
| 214 | |||
| 215 | #ifdef CML1 | ||
| 216 | static inline int expr_is_yes(struct expr *e) | ||
| 217 | { | ||
| 218 | return !e || (e->token == WORD && e->left.sym == &symbol_yes); | ||
| 219 | } | ||
| 220 | |||
| 221 | static inline int expr_is_no(struct expr *e) | ||
| 222 | { | ||
| 223 | return e && (e->token == WORD && e->left.sym == &symbol_no); | ||
| 224 | } | ||
| 225 | #else | ||
| 226 | static inline int expr_is_yes(struct expr *e) | ||
| 227 | { | ||
| 228 | return !e || (e->type == E_SYMBOL && e->left.sym == &symbol_yes); | ||
| 229 | } | ||
| 230 | |||
| 231 | static inline int expr_is_no(struct expr *e) | ||
| 232 | { | ||
| 233 | return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no); | ||
| 234 | } | ||
| 235 | #endif | ||
| 236 | #endif | ||
| 237 | |||
| 238 | #ifdef __cplusplus | ||
| 239 | } | ||
| 240 | #endif | ||
| 241 | |||
| 242 | #endif /* EXPR_H */ | ||
diff --git a/scripts/lxdialog/inputbox.c b/scripts/config/inputbox.c index fa7bebc69..fa7bebc69 100644 --- a/scripts/lxdialog/inputbox.c +++ b/scripts/config/inputbox.c | |||
diff --git a/scripts/config/lex.zconf.c_shipped b/scripts/config/lex.zconf.c_shipped new file mode 100644 index 000000000..df102812f --- /dev/null +++ b/scripts/config/lex.zconf.c_shipped | |||
| @@ -0,0 +1,3280 @@ | |||
| 1 | #define yy_create_buffer zconf_create_buffer | ||
| 2 | #define yy_delete_buffer zconf_delete_buffer | ||
| 3 | #define yy_scan_buffer zconf_scan_buffer | ||
| 4 | #define yy_scan_string zconf_scan_string | ||
| 5 | #define yy_scan_bytes zconf_scan_bytes | ||
| 6 | #define yy_flex_debug zconf_flex_debug | ||
| 7 | #define yy_init_buffer zconf_init_buffer | ||
| 8 | #define yy_flush_buffer zconf_flush_buffer | ||
| 9 | #define yy_load_buffer_state zconf_load_buffer_state | ||
| 10 | #define yy_switch_to_buffer zconf_switch_to_buffer | ||
| 11 | #define yyin zconfin | ||
| 12 | #define yyleng zconfleng | ||
| 13 | #define yylex zconflex | ||
| 14 | #define yyout zconfout | ||
| 15 | #define yyrestart zconfrestart | ||
| 16 | #define yytext zconftext | ||
| 17 | |||
| 18 | /* A lexical scanner generated by flex */ | ||
| 19 | |||
| 20 | /* Scanner skeleton version: | ||
| 21 | * $Header: /var/cvs/busybox/scripts/config/lex.zconf.c_shipped,v 1.1 2002/12/05 08:41:07 andersen Exp $ | ||
| 22 | */ | ||
| 23 | |||
| 24 | #define FLEX_SCANNER | ||
| 25 | #define YY_FLEX_MAJOR_VERSION 2 | ||
| 26 | #define YY_FLEX_MINOR_VERSION 5 | ||
| 27 | |||
| 28 | #include <stdio.h> | ||
| 29 | #include <errno.h> | ||
| 30 | |||
| 31 | /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ | ||
| 32 | #ifdef c_plusplus | ||
| 33 | #ifndef __cplusplus | ||
| 34 | #define __cplusplus | ||
| 35 | #endif | ||
| 36 | #endif | ||
| 37 | |||
| 38 | |||
| 39 | #ifdef __cplusplus | ||
| 40 | |||
| 41 | #include <stdlib.h> | ||
| 42 | #ifndef _WIN32 | ||
| 43 | #include <unistd.h> | ||
| 44 | #endif | ||
| 45 | |||
| 46 | /* Use prototypes in function declarations. */ | ||
| 47 | #define YY_USE_PROTOS | ||
| 48 | |||
| 49 | /* The "const" storage-class-modifier is valid. */ | ||
| 50 | #define YY_USE_CONST | ||
| 51 | |||
| 52 | #else /* ! __cplusplus */ | ||
| 53 | |||
| 54 | #if __STDC__ | ||
| 55 | |||
| 56 | #define YY_USE_PROTOS | ||
| 57 | #define YY_USE_CONST | ||
| 58 | |||
| 59 | #endif /* __STDC__ */ | ||
| 60 | #endif /* ! __cplusplus */ | ||
| 61 | |||
| 62 | #ifdef __TURBOC__ | ||
| 63 | #pragma warn -rch | ||
| 64 | #pragma warn -use | ||
| 65 | #include <io.h> | ||
| 66 | #include <stdlib.h> | ||
| 67 | #define YY_USE_CONST | ||
| 68 | #define YY_USE_PROTOS | ||
| 69 | #endif | ||
| 70 | |||
| 71 | #ifdef YY_USE_CONST | ||
| 72 | #define yyconst const | ||
| 73 | #else | ||
| 74 | #define yyconst | ||
| 75 | #endif | ||
| 76 | |||
| 77 | |||
| 78 | #ifdef YY_USE_PROTOS | ||
| 79 | #define YY_PROTO(proto) proto | ||
| 80 | #else | ||
| 81 | #define YY_PROTO(proto) () | ||
| 82 | #endif | ||
| 83 | |||
| 84 | /* Returned upon end-of-file. */ | ||
| 85 | #define YY_NULL 0 | ||
| 86 | |||
| 87 | /* Promotes a possibly negative, possibly signed char to an unsigned | ||
| 88 | * integer for use as an array index. If the signed char is negative, | ||
| 89 | * we want to instead treat it as an 8-bit unsigned char, hence the | ||
| 90 | * double cast. | ||
| 91 | */ | ||
| 92 | #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) | ||
| 93 | |||
| 94 | /* Enter a start condition. This macro really ought to take a parameter, | ||
| 95 | * but we do it the disgusting crufty way forced on us by the ()-less | ||
| 96 | * definition of BEGIN. | ||
| 97 | */ | ||
| 98 | #define BEGIN yy_start = 1 + 2 * | ||
| 99 | |||
| 100 | /* Translate the current start state into a value that can be later handed | ||
| 101 | * to BEGIN to return to the state. The YYSTATE alias is for lex | ||
| 102 | * compatibility. | ||
| 103 | */ | ||
| 104 | #define YY_START ((yy_start - 1) / 2) | ||
| 105 | #define YYSTATE YY_START | ||
| 106 | |||
| 107 | /* Action number for EOF rule of a given start state. */ | ||
| 108 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) | ||
| 109 | |||
| 110 | /* Special action meaning "start processing a new file". */ | ||
| 111 | #define YY_NEW_FILE yyrestart( yyin ) | ||
| 112 | |||
| 113 | #define YY_END_OF_BUFFER_CHAR 0 | ||
| 114 | |||
| 115 | /* Size of default input buffer. */ | ||
| 116 | #define YY_BUF_SIZE 16384 | ||
| 117 | |||
| 118 | typedef struct yy_buffer_state *YY_BUFFER_STATE; | ||
| 119 | |||
| 120 | extern int yyleng; | ||
| 121 | extern FILE *yyin, *yyout; | ||
| 122 | |||
| 123 | #define EOB_ACT_CONTINUE_SCAN 0 | ||
| 124 | #define EOB_ACT_END_OF_FILE 1 | ||
| 125 | #define EOB_ACT_LAST_MATCH 2 | ||
| 126 | |||
| 127 | /* The funky do-while in the following #define is used to turn the definition | ||
| 128 | * int a single C statement (which needs a semi-colon terminator). This | ||
| 129 | * avoids problems with code like: | ||
| 130 | * | ||
| 131 | * if ( condition_holds ) | ||
| 132 | * yyless( 5 ); | ||
| 133 | * else | ||
| 134 | * do_something_else(); | ||
| 135 | * | ||
| 136 | * Prior to using the do-while the compiler would get upset at the | ||
| 137 | * "else" because it interpreted the "if" statement as being all | ||
| 138 | * done when it reached the ';' after the yyless() call. | ||
| 139 | */ | ||
| 140 | |||
| 141 | /* Return all but the first 'n' matched characters back to the input stream. */ | ||
| 142 | |||
| 143 | #define yyless(n) \ | ||
| 144 | do \ | ||
| 145 | { \ | ||
| 146 | /* Undo effects of setting up yytext. */ \ | ||
| 147 | *yy_cp = yy_hold_char; \ | ||
| 148 | YY_RESTORE_YY_MORE_OFFSET \ | ||
| 149 | yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ | ||
| 150 | YY_DO_BEFORE_ACTION; /* set up yytext again */ \ | ||
| 151 | } \ | ||
| 152 | while ( 0 ) | ||
| 153 | |||
| 154 | #define unput(c) yyunput( c, yytext_ptr ) | ||
| 155 | |||
| 156 | /* The following is because we cannot portably get our hands on size_t | ||
| 157 | * (without autoconf's help, which isn't available because we want | ||
| 158 | * flex-generated scanners to compile on their own). | ||
| 159 | */ | ||
| 160 | typedef unsigned int yy_size_t; | ||
| 161 | |||
| 162 | |||
| 163 | struct yy_buffer_state | ||
| 164 | { | ||
| 165 | FILE *yy_input_file; | ||
| 166 | |||
| 167 | char *yy_ch_buf; /* input buffer */ | ||
| 168 | char *yy_buf_pos; /* current position in input buffer */ | ||
| 169 | |||
| 170 | /* Size of input buffer in bytes, not including room for EOB | ||
| 171 | * characters. | ||
| 172 | */ | ||
| 173 | yy_size_t yy_buf_size; | ||
| 174 | |||
| 175 | /* Number of characters read into yy_ch_buf, not including EOB | ||
| 176 | * characters. | ||
| 177 | */ | ||
| 178 | int yy_n_chars; | ||
| 179 | |||
| 180 | /* Whether we "own" the buffer - i.e., we know we created it, | ||
| 181 | * and can realloc() it to grow it, and should free() it to | ||
| 182 | * delete it. | ||
| 183 | */ | ||
| 184 | int yy_is_our_buffer; | ||
| 185 | |||
| 186 | /* Whether this is an "interactive" input source; if so, and | ||
| 187 | * if we're using stdio for input, then we want to use getc() | ||
| 188 | * instead of fread(), to make sure we stop fetching input after | ||
| 189 | * each newline. | ||
| 190 | */ | ||
| 191 | int yy_is_interactive; | ||
| 192 | |||
| 193 | /* Whether we're considered to be at the beginning of a line. | ||
| 194 | * If so, '^' rules will be active on the next match, otherwise | ||
| 195 | * not. | ||
| 196 | */ | ||
| 197 | int yy_at_bol; | ||
| 198 | |||
| 199 | /* Whether to try to fill the input buffer when we reach the | ||
| 200 | * end of it. | ||
| 201 | */ | ||
| 202 | int yy_fill_buffer; | ||
| 203 | |||
| 204 | int yy_buffer_status; | ||
| 205 | #define YY_BUFFER_NEW 0 | ||
| 206 | #define YY_BUFFER_NORMAL 1 | ||
| 207 | /* When an EOF's been seen but there's still some text to process | ||
| 208 | * then we mark the buffer as YY_EOF_PENDING, to indicate that we | ||
| 209 | * shouldn't try reading from the input source any more. We might | ||
| 210 | * still have a bunch of tokens to match, though, because of | ||
| 211 | * possible backing-up. | ||
| 212 | * | ||
| 213 | * When we actually see the EOF, we change the status to "new" | ||
| 214 | * (via yyrestart()), so that the user can continue scanning by | ||
| 215 | * just pointing yyin at a new input file. | ||
| 216 | */ | ||
| 217 | #define YY_BUFFER_EOF_PENDING 2 | ||
| 218 | }; | ||
| 219 | |||
| 220 | static YY_BUFFER_STATE yy_current_buffer = 0; | ||
| 221 | |||
| 222 | /* We provide macros for accessing buffer states in case in the | ||
| 223 | * future we want to put the buffer states in a more general | ||
| 224 | * "scanner state". | ||
| 225 | */ | ||
| 226 | #define YY_CURRENT_BUFFER yy_current_buffer | ||
| 227 | |||
| 228 | |||
| 229 | /* yy_hold_char holds the character lost when yytext is formed. */ | ||
| 230 | static char yy_hold_char; | ||
| 231 | |||
| 232 | static int yy_n_chars; /* number of characters read into yy_ch_buf */ | ||
| 233 | |||
| 234 | |||
| 235 | int yyleng; | ||
| 236 | |||
| 237 | /* Points to current character in buffer. */ | ||
| 238 | static char *yy_c_buf_p = (char *) 0; | ||
| 239 | static int yy_init = 1; /* whether we need to initialize */ | ||
| 240 | static int yy_start = 0; /* start state number */ | ||
| 241 | |||
| 242 | /* Flag which is used to allow yywrap()'s to do buffer switches | ||
| 243 | * instead of setting up a fresh yyin. A bit of a hack ... | ||
| 244 | */ | ||
| 245 | static int yy_did_buffer_switch_on_eof; | ||
| 246 | |||
| 247 | void yyrestart YY_PROTO(( FILE *input_file )); | ||
| 248 | |||
| 249 | void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); | ||
| 250 | void yy_load_buffer_state YY_PROTO(( void )); | ||
| 251 | YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); | ||
| 252 | void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); | ||
| 253 | void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); | ||
| 254 | void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); | ||
| 255 | #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) | ||
| 256 | |||
| 257 | YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); | ||
| 258 | YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); | ||
| 259 | YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); | ||
| 260 | |||
| 261 | static void *yy_flex_alloc YY_PROTO(( yy_size_t )); | ||
| 262 | static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); | ||
| 263 | static void yy_flex_free YY_PROTO(( void * )); | ||
| 264 | |||
| 265 | #define yy_new_buffer yy_create_buffer | ||
| 266 | |||
| 267 | #define yy_set_interactive(is_interactive) \ | ||
| 268 | { \ | ||
| 269 | if ( ! yy_current_buffer ) \ | ||
| 270 | yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ | ||
| 271 | yy_current_buffer->yy_is_interactive = is_interactive; \ | ||
| 272 | } | ||
| 273 | |||
| 274 | #define yy_set_bol(at_bol) \ | ||
| 275 | { \ | ||
| 276 | if ( ! yy_current_buffer ) \ | ||
| 277 | yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ | ||
| 278 | yy_current_buffer->yy_at_bol = at_bol; \ | ||
| 279 | } | ||
| 280 | |||
| 281 | #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) | ||
| 282 | |||
| 283 | |||
| 284 | #define yywrap() 1 | ||
| 285 | #define YY_SKIP_YYWRAP | ||
| 286 | typedef unsigned char YY_CHAR; | ||
| 287 | FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; | ||
| 288 | typedef int yy_state_type; | ||
| 289 | extern char *yytext; | ||
| 290 | #define yytext_ptr yytext | ||
| 291 | static yyconst short yy_nxt[][37] = | ||
| 292 | { | ||
| 293 | { | ||
| 294 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 295 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 296 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 297 | 0, 0, 0, 0, 0, 0, 0 | ||
| 298 | }, | ||
| 299 | |||
| 300 | { | ||
| 301 | 11, 12, 13, 14, 12, 12, 15, 12, 12, 12, | ||
| 302 | 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, | ||
| 303 | 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, | ||
| 304 | 12, 12, 12, 12, 12, 12, 12 | ||
| 305 | }, | ||
| 306 | |||
| 307 | { | ||
| 308 | 11, 12, 13, 14, 12, 12, 15, 12, 12, 12, | ||
| 309 | 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, | ||
| 310 | |||
| 311 | 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, | ||
| 312 | 12, 12, 12, 12, 12, 12, 12 | ||
| 313 | }, | ||
| 314 | |||
| 315 | { | ||
| 316 | 11, 16, 16, 17, 16, 16, 16, 16, 16, 16, | ||
| 317 | 16, 16, 16, 18, 16, 16, 18, 19, 20, 21, | ||
| 318 | 22, 18, 18, 23, 24, 18, 25, 18, 26, 27, | ||
| 319 | 18, 28, 29, 30, 18, 18, 16 | ||
| 320 | }, | ||
| 321 | |||
| 322 | { | ||
| 323 | 11, 16, 16, 17, 16, 16, 16, 16, 16, 16, | ||
| 324 | 16, 16, 16, 18, 16, 16, 18, 19, 20, 21, | ||
| 325 | 22, 18, 18, 23, 24, 18, 25, 18, 26, 27, | ||
| 326 | 18, 28, 29, 30, 18, 18, 16 | ||
| 327 | |||
| 328 | }, | ||
| 329 | |||
| 330 | { | ||
| 331 | 11, 31, 32, 33, 31, 31, 31, 31, 31, 31, | ||
| 332 | 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, | ||
| 333 | 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, | ||
| 334 | 31, 31, 31, 31, 31, 31, 31 | ||
| 335 | }, | ||
| 336 | |||
| 337 | { | ||
| 338 | 11, 31, 32, 33, 31, 31, 31, 31, 31, 31, | ||
| 339 | 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, | ||
| 340 | 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, | ||
| 341 | 31, 31, 31, 31, 31, 31, 31 | ||
| 342 | }, | ||
| 343 | |||
| 344 | { | ||
| 345 | 11, 34, 34, 35, 34, 36, 34, 34, 36, 34, | ||
| 346 | 34, 34, 34, 34, 34, 37, 34, 34, 34, 34, | ||
| 347 | |||
| 348 | 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, | ||
| 349 | 34, 34, 34, 34, 34, 34, 34 | ||
| 350 | }, | ||
| 351 | |||
| 352 | { | ||
| 353 | 11, 34, 34, 35, 34, 36, 34, 34, 36, 34, | ||
| 354 | 34, 34, 34, 34, 34, 37, 34, 34, 34, 34, | ||
| 355 | 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, | ||
| 356 | 34, 34, 34, 34, 34, 34, 34 | ||
| 357 | }, | ||
| 358 | |||
| 359 | { | ||
| 360 | 11, 38, 38, 39, 40, 41, 38, 42, 41, 43, | ||
| 361 | 44, 45, 46, 46, 47, 38, 46, 46, 46, 46, | ||
| 362 | 46, 46, 46, 46, 48, 46, 46, 46, 49, 46, | ||
| 363 | 46, 46, 46, 46, 46, 46, 50 | ||
| 364 | |||
| 365 | }, | ||
| 366 | |||
| 367 | { | ||
| 368 | 11, 38, 38, 39, 40, 41, 38, 42, 41, 43, | ||
| 369 | 44, 45, 46, 46, 47, 38, 46, 46, 46, 46, | ||
| 370 | 46, 46, 46, 46, 48, 46, 46, 46, 49, 46, | ||
| 371 | 46, 46, 46, 46, 46, 46, 50 | ||
| 372 | }, | ||
| 373 | |||
| 374 | { | ||
| 375 | -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, | ||
| 376 | -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, | ||
| 377 | -11, -11, -11, -11, -11, -11, -11, -11, -11, -11, | ||
| 378 | -11, -11, -11, -11, -11, -11, -11 | ||
| 379 | }, | ||
| 380 | |||
| 381 | { | ||
| 382 | 11, -12, -12, -12, -12, -12, -12, -12, -12, -12, | ||
| 383 | -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, | ||
| 384 | |||
| 385 | -12, -12, -12, -12, -12, -12, -12, -12, -12, -12, | ||
| 386 | -12, -12, -12, -12, -12, -12, -12 | ||
| 387 | }, | ||
| 388 | |||
| 389 | { | ||
| 390 | 11, -13, 51, 52, -13, -13, 53, -13, -13, -13, | ||
| 391 | -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, | ||
| 392 | -13, -13, -13, -13, -13, -13, -13, -13, -13, -13, | ||
| 393 | -13, -13, -13, -13, -13, -13, -13 | ||
| 394 | }, | ||
| 395 | |||
| 396 | { | ||
| 397 | 11, -14, -14, -14, -14, -14, -14, -14, -14, -14, | ||
| 398 | -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, | ||
| 399 | -14, -14, -14, -14, -14, -14, -14, -14, -14, -14, | ||
| 400 | -14, -14, -14, -14, -14, -14, -14 | ||
| 401 | |||
| 402 | }, | ||
| 403 | |||
| 404 | { | ||
| 405 | 11, 54, 54, 55, 54, 54, 54, 54, 54, 54, | ||
| 406 | 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, | ||
| 407 | 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, | ||
| 408 | 54, 54, 54, 54, 54, 54, 54 | ||
| 409 | }, | ||
| 410 | |||
| 411 | { | ||
| 412 | 11, -16, -16, -16, -16, -16, -16, -16, -16, -16, | ||
| 413 | -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, | ||
| 414 | -16, -16, -16, -16, -16, -16, -16, -16, -16, -16, | ||
| 415 | -16, -16, -16, -16, -16, -16, -16 | ||
| 416 | }, | ||
| 417 | |||
| 418 | { | ||
| 419 | 11, -17, -17, -17, -17, -17, -17, -17, -17, -17, | ||
| 420 | -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, | ||
| 421 | |||
| 422 | -17, -17, -17, -17, -17, -17, -17, -17, -17, -17, | ||
| 423 | -17, -17, -17, -17, -17, -17, -17 | ||
| 424 | }, | ||
| 425 | |||
| 426 | { | ||
| 427 | 11, -18, -18, -18, -18, -18, -18, -18, -18, -18, | ||
| 428 | -18, -18, -18, 56, -18, -18, 56, 56, 56, 56, | ||
| 429 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 430 | 56, 56, 56, 56, 56, 56, -18 | ||
| 431 | }, | ||
| 432 | |||
| 433 | { | ||
| 434 | 11, -19, -19, -19, -19, -19, -19, -19, -19, -19, | ||
| 435 | -19, -19, -19, 56, -19, -19, 56, 56, 56, 56, | ||
| 436 | 56, 56, 56, 56, 56, 56, 56, 56, 57, 56, | ||
| 437 | 56, 56, 56, 56, 56, 56, -19 | ||
| 438 | |||
| 439 | }, | ||
| 440 | |||
| 441 | { | ||
| 442 | 11, -20, -20, -20, -20, -20, -20, -20, -20, -20, | ||
| 443 | -20, -20, -20, 56, -20, -20, 56, 56, 56, 56, | ||
| 444 | 56, 56, 56, 58, 56, 56, 56, 56, 59, 56, | ||
| 445 | 56, 56, 56, 56, 56, 56, -20 | ||
| 446 | }, | ||
| 447 | |||
| 448 | { | ||
| 449 | 11, -21, -21, -21, -21, -21, -21, -21, -21, -21, | ||
| 450 | -21, -21, -21, 56, -21, -21, 56, 56, 56, 56, | ||
| 451 | 60, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 452 | 56, 56, 56, 56, 56, 56, -21 | ||
| 453 | }, | ||
| 454 | |||
| 455 | { | ||
| 456 | 11, -22, -22, -22, -22, -22, -22, -22, -22, -22, | ||
| 457 | -22, -22, -22, 56, -22, -22, 56, 56, 56, 56, | ||
| 458 | |||
| 459 | 56, 56, 56, 56, 56, 56, 56, 61, 56, 56, | ||
| 460 | 56, 56, 56, 56, 56, 56, -22 | ||
| 461 | }, | ||
| 462 | |||
| 463 | { | ||
| 464 | 11, -23, -23, -23, -23, -23, -23, -23, -23, -23, | ||
| 465 | -23, -23, -23, 56, -23, -23, 56, 56, 56, 56, | ||
| 466 | 62, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 467 | 56, 56, 56, 56, 56, 56, -23 | ||
| 468 | }, | ||
| 469 | |||
| 470 | { | ||
| 471 | 11, -24, -24, -24, -24, -24, -24, -24, -24, -24, | ||
| 472 | -24, -24, -24, 56, -24, -24, 56, 56, 56, 56, | ||
| 473 | 56, 63, 56, 56, 56, 56, 56, 64, 56, 56, | ||
| 474 | 56, 56, 56, 56, 56, 56, -24 | ||
| 475 | |||
| 476 | }, | ||
| 477 | |||
| 478 | { | ||
| 479 | 11, -25, -25, -25, -25, -25, -25, -25, -25, -25, | ||
| 480 | -25, -25, -25, 56, -25, -25, 65, 56, 56, 56, | ||
| 481 | 66, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 482 | 56, 56, 56, 56, 56, 56, -25 | ||
| 483 | }, | ||
| 484 | |||
| 485 | { | ||
| 486 | 11, -26, -26, -26, -26, -26, -26, -26, -26, -26, | ||
| 487 | -26, -26, -26, 56, -26, -26, 56, 56, 56, 56, | ||
| 488 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 67, | ||
| 489 | 56, 56, 56, 56, 56, 56, -26 | ||
| 490 | }, | ||
| 491 | |||
| 492 | { | ||
| 493 | 11, -27, -27, -27, -27, -27, -27, -27, -27, -27, | ||
| 494 | -27, -27, -27, 56, -27, -27, 56, 56, 56, 56, | ||
| 495 | |||
| 496 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 497 | 56, 68, 56, 56, 56, 56, -27 | ||
| 498 | }, | ||
| 499 | |||
| 500 | { | ||
| 501 | 11, -28, -28, -28, -28, -28, -28, -28, -28, -28, | ||
| 502 | -28, -28, -28, 56, -28, -28, 56, 56, 56, 56, | ||
| 503 | 69, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 504 | 56, 56, 56, 56, 56, 56, -28 | ||
| 505 | }, | ||
| 506 | |||
| 507 | { | ||
| 508 | 11, -29, -29, -29, -29, -29, -29, -29, -29, -29, | ||
| 509 | -29, -29, -29, 56, -29, -29, 56, 56, 56, 56, | ||
| 510 | 56, 56, 56, 56, 56, 56, 56, 56, 70, 56, | ||
| 511 | 56, 56, 56, 71, 56, 56, -29 | ||
| 512 | |||
| 513 | }, | ||
| 514 | |||
| 515 | { | ||
| 516 | 11, -30, -30, -30, -30, -30, -30, -30, -30, -30, | ||
| 517 | -30, -30, -30, 56, -30, -30, 56, 56, 56, 56, | ||
| 518 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 519 | 56, 72, 56, 56, 56, 56, -30 | ||
| 520 | }, | ||
| 521 | |||
| 522 | { | ||
| 523 | 11, 73, 73, -31, 73, 73, 73, 73, 73, 73, | ||
| 524 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, | ||
| 525 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, | ||
| 526 | 73, 73, 73, 73, 73, 73, 73 | ||
| 527 | }, | ||
| 528 | |||
| 529 | { | ||
| 530 | 11, -32, 74, 75, -32, -32, -32, -32, -32, -32, | ||
| 531 | -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, | ||
| 532 | |||
| 533 | -32, -32, -32, -32, -32, -32, -32, -32, -32, -32, | ||
| 534 | -32, -32, -32, -32, -32, -32, -32 | ||
| 535 | }, | ||
| 536 | |||
| 537 | { | ||
| 538 | 11, 76, -33, -33, 76, 76, 76, 76, 76, 76, | ||
| 539 | 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, | ||
| 540 | 76, 76, 76, 76, 76, 76, 76, 76, 76, 76, | ||
| 541 | 76, 76, 76, 76, 76, 76, 76 | ||
| 542 | }, | ||
| 543 | |||
| 544 | { | ||
| 545 | 11, 77, 77, 78, 77, -34, 77, 77, -34, 77, | ||
| 546 | 77, 77, 77, 77, 77, -34, 77, 77, 77, 77, | ||
| 547 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
| 548 | 77, 77, 77, 77, 77, 77, 77 | ||
| 549 | |||
| 550 | }, | ||
| 551 | |||
| 552 | { | ||
| 553 | 11, -35, -35, -35, -35, -35, -35, -35, -35, -35, | ||
| 554 | -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, | ||
| 555 | -35, -35, -35, -35, -35, -35, -35, -35, -35, -35, | ||
| 556 | -35, -35, -35, -35, -35, -35, -35 | ||
| 557 | }, | ||
| 558 | |||
| 559 | { | ||
| 560 | 11, -36, -36, -36, -36, -36, -36, -36, -36, -36, | ||
| 561 | -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, | ||
| 562 | -36, -36, -36, -36, -36, -36, -36, -36, -36, -36, | ||
| 563 | -36, -36, -36, -36, -36, -36, -36 | ||
| 564 | }, | ||
| 565 | |||
| 566 | { | ||
| 567 | 11, 79, 79, 80, 79, 79, 79, 79, 79, 79, | ||
| 568 | 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, | ||
| 569 | |||
| 570 | 79, 79, 79, 79, 79, 79, 79, 79, 79, 79, | ||
| 571 | 79, 79, 79, 79, 79, 79, 79 | ||
| 572 | }, | ||
| 573 | |||
| 574 | { | ||
| 575 | 11, -38, -38, -38, -38, -38, -38, -38, -38, -38, | ||
| 576 | -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, | ||
| 577 | -38, -38, -38, -38, -38, -38, -38, -38, -38, -38, | ||
| 578 | -38, -38, -38, -38, -38, -38, -38 | ||
| 579 | }, | ||
| 580 | |||
| 581 | { | ||
| 582 | 11, -39, -39, -39, -39, -39, -39, -39, -39, -39, | ||
| 583 | -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, | ||
| 584 | -39, -39, -39, -39, -39, -39, -39, -39, -39, -39, | ||
| 585 | -39, -39, -39, -39, -39, -39, -39 | ||
| 586 | |||
| 587 | }, | ||
| 588 | |||
| 589 | { | ||
| 590 | 11, -40, -40, -40, -40, -40, -40, -40, -40, -40, | ||
| 591 | -40, -40, -40, -40, 81, -40, -40, -40, -40, -40, | ||
| 592 | -40, -40, -40, -40, -40, -40, -40, -40, -40, -40, | ||
| 593 | -40, -40, -40, -40, -40, -40, -40 | ||
| 594 | }, | ||
| 595 | |||
| 596 | { | ||
| 597 | 11, -41, -41, -41, -41, -41, -41, -41, -41, -41, | ||
| 598 | -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, | ||
| 599 | -41, -41, -41, -41, -41, -41, -41, -41, -41, -41, | ||
| 600 | -41, -41, -41, -41, -41, -41, -41 | ||
| 601 | }, | ||
| 602 | |||
| 603 | { | ||
| 604 | 11, -42, -42, -42, -42, -42, -42, 82, -42, -42, | ||
| 605 | -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, | ||
| 606 | |||
| 607 | -42, -42, -42, -42, -42, -42, -42, -42, -42, -42, | ||
| 608 | -42, -42, -42, -42, -42, -42, -42 | ||
| 609 | }, | ||
| 610 | |||
| 611 | { | ||
| 612 | 11, -43, -43, -43, -43, -43, -43, -43, -43, -43, | ||
| 613 | -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, | ||
| 614 | -43, -43, -43, -43, -43, -43, -43, -43, -43, -43, | ||
| 615 | -43, -43, -43, -43, -43, -43, -43 | ||
| 616 | }, | ||
| 617 | |||
| 618 | { | ||
| 619 | 11, -44, -44, -44, -44, -44, -44, -44, -44, -44, | ||
| 620 | -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, | ||
| 621 | -44, -44, -44, -44, -44, -44, -44, -44, -44, -44, | ||
| 622 | -44, -44, -44, -44, -44, -44, -44 | ||
| 623 | |||
| 624 | }, | ||
| 625 | |||
| 626 | { | ||
| 627 | 11, -45, -45, -45, -45, -45, -45, -45, -45, -45, | ||
| 628 | -45, 83, 84, 84, -45, -45, 84, 84, 84, 84, | ||
| 629 | 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, | ||
| 630 | 84, 84, 84, 84, 84, 84, -45 | ||
| 631 | }, | ||
| 632 | |||
| 633 | { | ||
| 634 | 11, -46, -46, -46, -46, -46, -46, -46, -46, -46, | ||
| 635 | -46, 84, 84, 84, -46, -46, 84, 84, 84, 84, | ||
| 636 | 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, | ||
| 637 | 84, 84, 84, 84, 84, 84, -46 | ||
| 638 | }, | ||
| 639 | |||
| 640 | { | ||
| 641 | 11, -47, -47, -47, -47, -47, -47, -47, -47, -47, | ||
| 642 | -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, | ||
| 643 | |||
| 644 | -47, -47, -47, -47, -47, -47, -47, -47, -47, -47, | ||
| 645 | -47, -47, -47, -47, -47, -47, -47 | ||
| 646 | }, | ||
| 647 | |||
| 648 | { | ||
| 649 | 11, -48, -48, -48, -48, -48, -48, -48, -48, -48, | ||
| 650 | -48, 84, 84, 84, -48, -48, 84, 84, 84, 84, | ||
| 651 | 84, 85, 84, 84, 84, 84, 84, 84, 84, 84, | ||
| 652 | 84, 84, 84, 84, 84, 84, -48 | ||
| 653 | }, | ||
| 654 | |||
| 655 | { | ||
| 656 | 11, -49, -49, -49, -49, -49, -49, -49, -49, -49, | ||
| 657 | -49, 84, 84, 84, -49, -49, 84, 84, 84, 84, | ||
| 658 | 84, 84, 84, 84, 84, 84, 84, 86, 84, 84, | ||
| 659 | 84, 84, 84, 84, 84, 84, -49 | ||
| 660 | |||
| 661 | }, | ||
| 662 | |||
| 663 | { | ||
| 664 | 11, -50, -50, -50, -50, -50, -50, -50, -50, -50, | ||
| 665 | -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, | ||
| 666 | -50, -50, -50, -50, -50, -50, -50, -50, -50, -50, | ||
| 667 | -50, -50, -50, -50, -50, -50, 87 | ||
| 668 | }, | ||
| 669 | |||
| 670 | { | ||
| 671 | 11, -51, 51, 52, -51, -51, 53, -51, -51, -51, | ||
| 672 | -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, | ||
| 673 | -51, -51, -51, -51, -51, -51, -51, -51, -51, -51, | ||
| 674 | -51, -51, -51, -51, -51, -51, -51 | ||
| 675 | }, | ||
| 676 | |||
| 677 | { | ||
| 678 | 11, -52, -52, -52, -52, -52, -52, -52, -52, -52, | ||
| 679 | -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, | ||
| 680 | |||
| 681 | -52, -52, -52, -52, -52, -52, -52, -52, -52, -52, | ||
| 682 | -52, -52, -52, -52, -52, -52, -52 | ||
| 683 | }, | ||
| 684 | |||
| 685 | { | ||
| 686 | 11, 54, 54, 55, 54, 54, 54, 54, 54, 54, | ||
| 687 | 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, | ||
| 688 | 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, | ||
| 689 | 54, 54, 54, 54, 54, 54, 54 | ||
| 690 | }, | ||
| 691 | |||
| 692 | { | ||
| 693 | 11, 54, 54, 55, 54, 54, 54, 54, 54, 54, | ||
| 694 | 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, | ||
| 695 | 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, | ||
| 696 | 54, 54, 54, 54, 54, 54, 54 | ||
| 697 | |||
| 698 | }, | ||
| 699 | |||
| 700 | { | ||
| 701 | 11, -55, -55, -55, -55, -55, -55, -55, -55, -55, | ||
| 702 | -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, | ||
| 703 | -55, -55, -55, -55, -55, -55, -55, -55, -55, -55, | ||
| 704 | -55, -55, -55, -55, -55, -55, -55 | ||
| 705 | }, | ||
| 706 | |||
| 707 | { | ||
| 708 | 11, -56, -56, -56, -56, -56, -56, -56, -56, -56, | ||
| 709 | -56, -56, -56, 56, -56, -56, 56, 56, 56, 56, | ||
| 710 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 711 | 56, 56, 56, 56, 56, 56, -56 | ||
| 712 | }, | ||
| 713 | |||
| 714 | { | ||
| 715 | 11, -57, -57, -57, -57, -57, -57, -57, -57, -57, | ||
| 716 | -57, -57, -57, 56, -57, -57, 56, 56, 56, 56, | ||
| 717 | |||
| 718 | 56, 56, 56, 56, 56, 56, 56, 56, 88, 56, | ||
| 719 | 56, 56, 56, 56, 56, 56, -57 | ||
| 720 | }, | ||
| 721 | |||
| 722 | { | ||
| 723 | 11, -58, -58, -58, -58, -58, -58, -58, -58, -58, | ||
| 724 | -58, -58, -58, 56, -58, -58, 56, 56, 56, 56, | ||
| 725 | 56, 56, 56, 56, 56, 56, 56, 56, 89, 56, | ||
| 726 | 56, 56, 56, 56, 56, 56, -58 | ||
| 727 | }, | ||
| 728 | |||
| 729 | { | ||
| 730 | 11, -59, -59, -59, -59, -59, -59, -59, -59, -59, | ||
| 731 | -59, -59, -59, 56, -59, -59, 56, 56, 56, 56, | ||
| 732 | 56, 56, 56, 56, 56, 56, 90, 91, 56, 56, | ||
| 733 | 56, 56, 56, 56, 56, 56, -59 | ||
| 734 | |||
| 735 | }, | ||
| 736 | |||
| 737 | { | ||
| 738 | 11, -60, -60, -60, -60, -60, -60, -60, -60, -60, | ||
| 739 | -60, -60, -60, 56, -60, -60, 56, 56, 56, 56, | ||
| 740 | 56, 92, 56, 56, 56, 56, 56, 56, 56, 93, | ||
| 741 | 56, 56, 56, 56, 56, 56, -60 | ||
| 742 | }, | ||
| 743 | |||
| 744 | { | ||
| 745 | 11, -61, -61, -61, -61, -61, -61, -61, -61, -61, | ||
| 746 | -61, -61, -61, 56, -61, -61, 56, 56, 56, 94, | ||
| 747 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 748 | 56, 56, 56, 56, 56, 56, -61 | ||
| 749 | }, | ||
| 750 | |||
| 751 | { | ||
| 752 | 11, -62, -62, -62, -62, -62, -62, -62, -62, -62, | ||
| 753 | -62, -62, -62, 56, -62, -62, 56, 56, 56, 56, | ||
| 754 | |||
| 755 | 56, 56, 56, 56, 56, 95, 56, 56, 56, 56, | ||
| 756 | 56, 56, 56, 56, 56, 96, -62 | ||
| 757 | }, | ||
| 758 | |||
| 759 | { | ||
| 760 | 11, -63, -63, -63, -63, -63, -63, -63, -63, -63, | ||
| 761 | -63, -63, -63, 56, -63, -63, 56, 56, 56, 56, | ||
| 762 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 763 | 56, 56, 56, 56, 56, 56, -63 | ||
| 764 | }, | ||
| 765 | |||
| 766 | { | ||
| 767 | 11, -64, -64, -64, -64, -64, -64, -64, -64, -64, | ||
| 768 | -64, -64, -64, 56, -64, -64, 56, 56, 56, 56, | ||
| 769 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 770 | 56, 56, 56, 97, 56, 56, -64 | ||
| 771 | |||
| 772 | }, | ||
| 773 | |||
| 774 | { | ||
| 775 | 11, -65, -65, -65, -65, -65, -65, -65, -65, -65, | ||
| 776 | -65, -65, -65, 56, -65, -65, 56, 56, 56, 56, | ||
| 777 | 56, 56, 56, 56, 98, 56, 56, 56, 56, 56, | ||
| 778 | 56, 56, 56, 56, 56, 56, -65 | ||
| 779 | }, | ||
| 780 | |||
| 781 | { | ||
| 782 | 11, -66, -66, -66, -66, -66, -66, -66, -66, -66, | ||
| 783 | -66, -66, -66, 56, -66, -66, 56, 56, 56, 56, | ||
| 784 | 56, 56, 56, 56, 56, 56, 56, 99, 56, 56, | ||
| 785 | 56, 56, 56, 56, 56, 56, -66 | ||
| 786 | }, | ||
| 787 | |||
| 788 | { | ||
| 789 | 11, -67, -67, -67, -67, -67, -67, -67, -67, -67, | ||
| 790 | -67, -67, -67, 56, -67, -67, 56, 56, 56, 56, | ||
| 791 | |||
| 792 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 793 | 56, 56, 56, 100, 56, 56, -67 | ||
| 794 | }, | ||
| 795 | |||
| 796 | { | ||
| 797 | 11, -68, -68, -68, -68, -68, -68, -68, -68, -68, | ||
| 798 | -68, -68, -68, 56, -68, -68, 56, 56, 56, 56, | ||
| 799 | 56, 56, 56, 56, 56, 56, 56, 56, 101, 56, | ||
| 800 | 56, 56, 56, 56, 56, 56, -68 | ||
| 801 | }, | ||
| 802 | |||
| 803 | { | ||
| 804 | 11, -69, -69, -69, -69, -69, -69, -69, -69, -69, | ||
| 805 | -69, -69, -69, 56, -69, -69, 56, 56, 56, 56, | ||
| 806 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 807 | 102, 56, 56, 56, 56, 56, -69 | ||
| 808 | |||
| 809 | }, | ||
| 810 | |||
| 811 | { | ||
| 812 | 11, -70, -70, -70, -70, -70, -70, -70, -70, -70, | ||
| 813 | -70, -70, -70, 56, -70, -70, 56, 56, 56, 56, | ||
| 814 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 815 | 56, 56, 56, 56, 103, 56, -70 | ||
| 816 | }, | ||
| 817 | |||
| 818 | { | ||
| 819 | 11, -71, -71, -71, -71, -71, -71, -71, -71, -71, | ||
| 820 | -71, -71, -71, 56, -71, -71, 56, 56, 56, 56, | ||
| 821 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 822 | 56, 104, 56, 56, 56, 56, -71 | ||
| 823 | }, | ||
| 824 | |||
| 825 | { | ||
| 826 | 11, -72, -72, -72, -72, -72, -72, -72, -72, -72, | ||
| 827 | -72, -72, -72, 56, -72, -72, 56, 56, 56, 56, | ||
| 828 | |||
| 829 | 56, 56, 56, 56, 105, 56, 56, 56, 56, 56, | ||
| 830 | 56, 56, 56, 56, 56, 56, -72 | ||
| 831 | }, | ||
| 832 | |||
| 833 | { | ||
| 834 | 11, 73, 73, -73, 73, 73, 73, 73, 73, 73, | ||
| 835 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, | ||
| 836 | 73, 73, 73, 73, 73, 73, 73, 73, 73, 73, | ||
| 837 | 73, 73, 73, 73, 73, 73, 73 | ||
| 838 | }, | ||
| 839 | |||
| 840 | { | ||
| 841 | 11, -74, 74, 75, -74, -74, -74, -74, -74, -74, | ||
| 842 | -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, | ||
| 843 | -74, -74, -74, -74, -74, -74, -74, -74, -74, -74, | ||
| 844 | -74, -74, -74, -74, -74, -74, -74 | ||
| 845 | |||
| 846 | }, | ||
| 847 | |||
| 848 | { | ||
| 849 | 11, -75, -75, -75, -75, -75, -75, -75, -75, -75, | ||
| 850 | -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, | ||
| 851 | -75, -75, -75, -75, -75, -75, -75, -75, -75, -75, | ||
| 852 | -75, -75, -75, -75, -75, -75, -75 | ||
| 853 | }, | ||
| 854 | |||
| 855 | { | ||
| 856 | 11, -76, -76, -76, -76, -76, -76, -76, -76, -76, | ||
| 857 | -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, | ||
| 858 | -76, -76, -76, -76, -76, -76, -76, -76, -76, -76, | ||
| 859 | -76, -76, -76, -76, -76, -76, -76 | ||
| 860 | }, | ||
| 861 | |||
| 862 | { | ||
| 863 | 11, 77, 77, 78, 77, -77, 77, 77, -77, 77, | ||
| 864 | 77, 77, 77, 77, 77, -77, 77, 77, 77, 77, | ||
| 865 | |||
| 866 | 77, 77, 77, 77, 77, 77, 77, 77, 77, 77, | ||
| 867 | 77, 77, 77, 77, 77, 77, 77 | ||
| 868 | }, | ||
| 869 | |||
| 870 | { | ||
| 871 | 11, -78, -78, -78, -78, -78, -78, -78, -78, -78, | ||
| 872 | -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, | ||
| 873 | -78, -78, -78, -78, -78, -78, -78, -78, -78, -78, | ||
| 874 | -78, -78, -78, -78, -78, -78, -78 | ||
| 875 | }, | ||
| 876 | |||
| 877 | { | ||
| 878 | 11, -79, -79, 80, -79, -79, -79, -79, -79, -79, | ||
| 879 | -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, | ||
| 880 | -79, -79, -79, -79, -79, -79, -79, -79, -79, -79, | ||
| 881 | -79, -79, -79, -79, -79, -79, -79 | ||
| 882 | |||
| 883 | }, | ||
| 884 | |||
| 885 | { | ||
| 886 | 11, -80, -80, -80, -80, -80, -80, -80, -80, -80, | ||
| 887 | -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, | ||
| 888 | -80, -80, -80, -80, -80, -80, -80, -80, -80, -80, | ||
| 889 | -80, -80, -80, -80, -80, -80, -80 | ||
| 890 | }, | ||
| 891 | |||
| 892 | { | ||
| 893 | 11, -81, -81, -81, -81, -81, -81, -81, -81, -81, | ||
| 894 | -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, | ||
| 895 | -81, -81, -81, -81, -81, -81, -81, -81, -81, -81, | ||
| 896 | -81, -81, -81, -81, -81, -81, -81 | ||
| 897 | }, | ||
| 898 | |||
| 899 | { | ||
| 900 | 11, -82, -82, -82, -82, -82, -82, -82, -82, -82, | ||
| 901 | -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, | ||
| 902 | |||
| 903 | -82, -82, -82, -82, -82, -82, -82, -82, -82, -82, | ||
| 904 | -82, -82, -82, -82, -82, -82, -82 | ||
| 905 | }, | ||
| 906 | |||
| 907 | { | ||
| 908 | 11, -83, -83, -83, -83, -83, -83, -83, -83, -83, | ||
| 909 | -83, 106, 84, 84, -83, -83, 84, 84, 84, 84, | ||
| 910 | 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, | ||
| 911 | 84, 84, 84, 84, 84, 84, -83 | ||
| 912 | }, | ||
| 913 | |||
| 914 | { | ||
| 915 | 11, -84, -84, -84, -84, -84, -84, -84, -84, -84, | ||
| 916 | -84, 84, 84, 84, -84, -84, 84, 84, 84, 84, | ||
| 917 | 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, | ||
| 918 | 84, 84, 84, 84, 84, 84, -84 | ||
| 919 | |||
| 920 | }, | ||
| 921 | |||
| 922 | { | ||
| 923 | 11, -85, -85, -85, -85, -85, -85, -85, -85, -85, | ||
| 924 | -85, 84, 84, 84, -85, -85, 84, 84, 84, 84, | ||
| 925 | 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, | ||
| 926 | 84, 84, 84, 84, 84, 84, -85 | ||
| 927 | }, | ||
| 928 | |||
| 929 | { | ||
| 930 | 11, -86, -86, -86, -86, -86, -86, -86, -86, -86, | ||
| 931 | -86, 84, 84, 84, -86, -86, 84, 84, 84, 84, | ||
| 932 | 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, | ||
| 933 | 84, 84, 84, 84, 84, 84, -86 | ||
| 934 | }, | ||
| 935 | |||
| 936 | { | ||
| 937 | 11, -87, -87, -87, -87, -87, -87, -87, -87, -87, | ||
| 938 | -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, | ||
| 939 | |||
| 940 | -87, -87, -87, -87, -87, -87, -87, -87, -87, -87, | ||
| 941 | -87, -87, -87, -87, -87, -87, -87 | ||
| 942 | }, | ||
| 943 | |||
| 944 | { | ||
| 945 | 11, -88, -88, -88, -88, -88, -88, -88, -88, -88, | ||
| 946 | -88, -88, -88, 56, -88, -88, 56, 56, 56, 56, | ||
| 947 | 56, 56, 56, 56, 56, 107, 56, 56, 56, 56, | ||
| 948 | 56, 56, 56, 56, 56, 56, -88 | ||
| 949 | }, | ||
| 950 | |||
| 951 | { | ||
| 952 | 11, -89, -89, -89, -89, -89, -89, -89, -89, -89, | ||
| 953 | -89, -89, -89, 56, -89, -89, 56, 56, 56, 56, | ||
| 954 | 56, 56, 56, 56, 108, 56, 56, 56, 56, 56, | ||
| 955 | 56, 56, 56, 56, 56, 56, -89 | ||
| 956 | |||
| 957 | }, | ||
| 958 | |||
| 959 | { | ||
| 960 | 11, -90, -90, -90, -90, -90, -90, -90, -90, -90, | ||
| 961 | -90, -90, -90, 56, -90, -90, 56, 56, 56, 56, | ||
| 962 | 56, 56, 56, 56, 56, 56, 109, 56, 56, 56, | ||
| 963 | 56, 56, 56, 56, 56, 56, -90 | ||
| 964 | }, | ||
| 965 | |||
| 966 | { | ||
| 967 | 11, -91, -91, -91, -91, -91, -91, -91, -91, -91, | ||
| 968 | -91, -91, -91, 56, -91, -91, 56, 56, 56, 56, | ||
| 969 | 56, 110, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 970 | 56, 56, 56, 56, 56, 56, -91 | ||
| 971 | }, | ||
| 972 | |||
| 973 | { | ||
| 974 | 11, -92, -92, -92, -92, -92, -92, -92, -92, -92, | ||
| 975 | -92, -92, -92, 56, -92, -92, 111, 56, 56, 56, | ||
| 976 | |||
| 977 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 978 | 56, 56, 56, 56, 56, 56, -92 | ||
| 979 | }, | ||
| 980 | |||
| 981 | { | ||
| 982 | 11, -93, -93, -93, -93, -93, -93, -93, -93, -93, | ||
| 983 | -93, -93, -93, 56, -93, -93, 56, 56, 56, 56, | ||
| 984 | 112, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 985 | 56, 56, 56, 56, 56, 56, -93 | ||
| 986 | }, | ||
| 987 | |||
| 988 | { | ||
| 989 | 11, -94, -94, -94, -94, -94, -94, -94, -94, -94, | ||
| 990 | -94, -94, -94, 56, -94, -94, 56, 56, 113, 56, | ||
| 991 | 56, 56, 56, 56, 114, 56, 115, 56, 56, 56, | ||
| 992 | 56, 56, 56, 56, 56, 56, -94 | ||
| 993 | |||
| 994 | }, | ||
| 995 | |||
| 996 | { | ||
| 997 | 11, -95, -95, -95, -95, -95, -95, -95, -95, -95, | ||
| 998 | -95, -95, -95, 56, -95, -95, 56, 56, 56, 56, | ||
| 999 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 116, | ||
| 1000 | 56, 56, 56, 56, 56, 56, -95 | ||
| 1001 | }, | ||
| 1002 | |||
| 1003 | { | ||
| 1004 | 11, -96, -96, -96, -96, -96, -96, -96, -96, -96, | ||
| 1005 | -96, -96, -96, 56, -96, -96, 56, 56, 56, 56, | ||
| 1006 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1007 | 56, 56, 56, 56, 56, 56, -96 | ||
| 1008 | }, | ||
| 1009 | |||
| 1010 | { | ||
| 1011 | 11, -97, -97, -97, -97, -97, -97, -97, -97, -97, | ||
| 1012 | -97, -97, -97, 56, -97, -97, 56, 56, 56, 56, | ||
| 1013 | |||
| 1014 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1015 | 56, 56, 56, 56, 56, 56, -97 | ||
| 1016 | }, | ||
| 1017 | |||
| 1018 | { | ||
| 1019 | 11, -98, -98, -98, -98, -98, -98, -98, -98, -98, | ||
| 1020 | -98, -98, -98, 56, -98, -98, 56, 56, 56, 56, | ||
| 1021 | 56, 56, 56, 56, 56, 56, 56, 117, 56, 56, | ||
| 1022 | 56, 56, 56, 56, 56, 56, -98 | ||
| 1023 | }, | ||
| 1024 | |||
| 1025 | { | ||
| 1026 | 11, -99, -99, -99, -99, -99, -99, -99, -99, -99, | ||
| 1027 | -99, -99, -99, 56, -99, -99, 56, 56, 56, 56, | ||
| 1028 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1029 | 56, 56, 56, 56, 118, 56, -99 | ||
| 1030 | |||
| 1031 | }, | ||
| 1032 | |||
| 1033 | { | ||
| 1034 | 11, -100, -100, -100, -100, -100, -100, -100, -100, -100, | ||
| 1035 | -100, -100, -100, 56, -100, -100, 56, 56, 56, 56, | ||
| 1036 | 56, 56, 56, 56, 119, 56, 56, 56, 56, 56, | ||
| 1037 | 56, 56, 56, 56, 56, 56, -100 | ||
| 1038 | }, | ||
| 1039 | |||
| 1040 | { | ||
| 1041 | 11, -101, -101, -101, -101, -101, -101, -101, -101, -101, | ||
| 1042 | -101, -101, -101, 56, -101, -101, 56, 56, 56, 56, | ||
| 1043 | 56, 56, 56, 56, 56, 56, 120, 56, 56, 56, | ||
| 1044 | 56, 56, 56, 56, 56, 56, -101 | ||
| 1045 | }, | ||
| 1046 | |||
| 1047 | { | ||
| 1048 | 11, -102, -102, -102, -102, -102, -102, -102, -102, -102, | ||
| 1049 | -102, -102, -102, 56, -102, -102, 56, 56, 56, 56, | ||
| 1050 | |||
| 1051 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1052 | 56, 56, 56, 56, 121, 56, -102 | ||
| 1053 | }, | ||
| 1054 | |||
| 1055 | { | ||
| 1056 | 11, -103, -103, -103, -103, -103, -103, -103, -103, -103, | ||
| 1057 | -103, -103, -103, 56, -103, -103, 56, 56, 56, 56, | ||
| 1058 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1059 | 56, 122, 56, 56, 56, 56, -103 | ||
| 1060 | }, | ||
| 1061 | |||
| 1062 | { | ||
| 1063 | 11, -104, -104, -104, -104, -104, -104, -104, -104, -104, | ||
| 1064 | -104, -104, -104, 56, -104, -104, 56, 56, 56, 56, | ||
| 1065 | 56, 56, 56, 56, 123, 56, 56, 56, 56, 56, | ||
| 1066 | 56, 56, 56, 56, 56, 56, -104 | ||
| 1067 | |||
| 1068 | }, | ||
| 1069 | |||
| 1070 | { | ||
| 1071 | 11, -105, -105, -105, -105, -105, -105, -105, -105, -105, | ||
| 1072 | -105, -105, -105, 56, -105, -105, 56, 56, 56, 56, | ||
| 1073 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1074 | 56, 56, 124, 56, 56, 56, -105 | ||
| 1075 | }, | ||
| 1076 | |||
| 1077 | { | ||
| 1078 | 11, -106, -106, -106, -106, -106, -106, -106, -106, -106, | ||
| 1079 | -106, 84, 84, 84, -106, -106, 84, 84, 84, 84, | ||
| 1080 | 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, | ||
| 1081 | 84, 84, 84, 84, 84, 84, -106 | ||
| 1082 | }, | ||
| 1083 | |||
| 1084 | { | ||
| 1085 | 11, -107, -107, -107, -107, -107, -107, -107, -107, -107, | ||
| 1086 | -107, -107, -107, 56, -107, -107, 56, 56, 56, 56, | ||
| 1087 | |||
| 1088 | 125, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1089 | 56, 56, 56, 56, 56, 56, -107 | ||
| 1090 | }, | ||
| 1091 | |||
| 1092 | { | ||
| 1093 | 11, -108, -108, -108, -108, -108, -108, -108, -108, -108, | ||
| 1094 | -108, -108, -108, 56, -108, -108, 56, 56, 126, 56, | ||
| 1095 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1096 | 56, 56, 56, 56, 56, 56, -108 | ||
| 1097 | }, | ||
| 1098 | |||
| 1099 | { | ||
| 1100 | 11, -109, -109, -109, -109, -109, -109, -109, -109, -109, | ||
| 1101 | -109, -109, -109, 56, -109, -109, 56, 56, 56, 56, | ||
| 1102 | 127, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1103 | 56, 56, 56, 56, 56, 56, -109 | ||
| 1104 | |||
| 1105 | }, | ||
| 1106 | |||
| 1107 | { | ||
| 1108 | 11, -110, -110, -110, -110, -110, -110, -110, -110, -110, | ||
| 1109 | -110, -110, -110, 56, -110, -110, 56, 56, 56, 56, | ||
| 1110 | 56, 56, 56, 56, 128, 56, 56, 56, 56, 56, | ||
| 1111 | 56, 56, 56, 56, 56, 56, -110 | ||
| 1112 | }, | ||
| 1113 | |||
| 1114 | { | ||
| 1115 | 11, -111, -111, -111, -111, -111, -111, -111, -111, -111, | ||
| 1116 | -111, -111, -111, 56, -111, -111, 56, 56, 56, 56, | ||
| 1117 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1118 | 56, 56, 56, 56, 129, 56, -111 | ||
| 1119 | }, | ||
| 1120 | |||
| 1121 | { | ||
| 1122 | 11, -112, -112, -112, -112, -112, -112, -112, -112, -112, | ||
| 1123 | -112, -112, -112, 56, -112, -112, 56, 56, 56, 56, | ||
| 1124 | |||
| 1125 | 56, 56, 56, 56, 56, 56, 56, 130, 56, 56, | ||
| 1126 | 56, 56, 56, 56, 56, 56, -112 | ||
| 1127 | }, | ||
| 1128 | |||
| 1129 | { | ||
| 1130 | 11, -113, -113, -113, -113, -113, -113, -113, -113, -113, | ||
| 1131 | -113, -113, -113, 56, -113, -113, 56, 56, 56, 56, | ||
| 1132 | 56, 56, 56, 131, 56, 56, 56, 56, 56, 56, | ||
| 1133 | 56, 56, 56, 56, 56, 56, -113 | ||
| 1134 | }, | ||
| 1135 | |||
| 1136 | { | ||
| 1137 | 11, -114, -114, -114, -114, -114, -114, -114, -114, -114, | ||
| 1138 | -114, -114, -114, 56, -114, -114, 56, 56, 56, 56, | ||
| 1139 | 56, 132, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1140 | 56, 56, 56, 56, 56, 56, -114 | ||
| 1141 | |||
| 1142 | }, | ||
| 1143 | |||
| 1144 | { | ||
| 1145 | 11, -115, -115, -115, -115, -115, -115, -115, -115, -115, | ||
| 1146 | -115, -115, -115, 56, -115, -115, 56, 56, 56, 56, | ||
| 1147 | 133, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1148 | 56, 56, 56, 56, 56, 56, -115 | ||
| 1149 | }, | ||
| 1150 | |||
| 1151 | { | ||
| 1152 | 11, -116, -116, -116, -116, -116, -116, -116, -116, -116, | ||
| 1153 | -116, -116, -116, 56, -116, -116, 56, 56, 56, 56, | ||
| 1154 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1155 | 56, 56, 56, 56, 56, 56, -116 | ||
| 1156 | }, | ||
| 1157 | |||
| 1158 | { | ||
| 1159 | 11, -117, -117, -117, -117, -117, -117, -117, -117, -117, | ||
| 1160 | -117, -117, -117, 56, -117, -117, 56, 56, 56, 56, | ||
| 1161 | |||
| 1162 | 56, 56, 56, 56, 56, 56, 134, 56, 56, 56, | ||
| 1163 | 56, 56, 56, 56, 56, 56, -117 | ||
| 1164 | }, | ||
| 1165 | |||
| 1166 | { | ||
| 1167 | 11, -118, -118, -118, -118, -118, -118, -118, -118, -118, | ||
| 1168 | -118, -118, -118, 56, -118, -118, 56, 56, 56, 56, | ||
| 1169 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1170 | 56, 56, 56, 56, 56, 56, -118 | ||
| 1171 | }, | ||
| 1172 | |||
| 1173 | { | ||
| 1174 | 11, -119, -119, -119, -119, -119, -119, -119, -119, -119, | ||
| 1175 | -119, -119, -119, 56, -119, -119, 56, 56, 56, 56, | ||
| 1176 | 56, 56, 56, 56, 56, 56, 56, 56, 135, 56, | ||
| 1177 | 56, 56, 56, 56, 56, 56, -119 | ||
| 1178 | |||
| 1179 | }, | ||
| 1180 | |||
| 1181 | { | ||
| 1182 | 11, -120, -120, -120, -120, -120, -120, -120, -120, -120, | ||
| 1183 | -120, -120, -120, 56, -120, -120, 56, 56, 56, 56, | ||
| 1184 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 136, | ||
| 1185 | 56, 56, 56, 56, 56, 56, -120 | ||
| 1186 | }, | ||
| 1187 | |||
| 1188 | { | ||
| 1189 | 11, -121, -121, -121, -121, -121, -121, -121, -121, -121, | ||
| 1190 | -121, -121, -121, 56, -121, -121, 56, 56, 56, 56, | ||
| 1191 | 56, 56, 56, 56, 137, 56, 56, 56, 56, 56, | ||
| 1192 | 56, 56, 56, 56, 56, 56, -121 | ||
| 1193 | }, | ||
| 1194 | |||
| 1195 | { | ||
| 1196 | 11, -122, -122, -122, -122, -122, -122, -122, -122, -122, | ||
| 1197 | -122, -122, -122, 56, -122, -122, 56, 56, 138, 56, | ||
| 1198 | |||
| 1199 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1200 | 56, 56, 56, 56, 56, 56, -122 | ||
| 1201 | }, | ||
| 1202 | |||
| 1203 | { | ||
| 1204 | 11, -123, -123, -123, -123, -123, -123, -123, -123, -123, | ||
| 1205 | -123, -123, -123, 56, -123, -123, 56, 56, 56, 56, | ||
| 1206 | 56, 56, 56, 56, 56, 56, 56, 139, 56, 56, | ||
| 1207 | 56, 56, 56, 56, 56, 56, -123 | ||
| 1208 | }, | ||
| 1209 | |||
| 1210 | { | ||
| 1211 | 11, -124, -124, -124, -124, -124, -124, -124, -124, -124, | ||
| 1212 | -124, -124, -124, 56, -124, -124, 56, 56, 56, 56, | ||
| 1213 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1214 | 56, 56, 56, 140, 56, 56, -124 | ||
| 1215 | |||
| 1216 | }, | ||
| 1217 | |||
| 1218 | { | ||
| 1219 | 11, -125, -125, -125, -125, -125, -125, -125, -125, -125, | ||
| 1220 | -125, -125, -125, 56, -125, -125, 141, 56, 56, 56, | ||
| 1221 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1222 | 56, 56, 56, 56, 56, 56, -125 | ||
| 1223 | }, | ||
| 1224 | |||
| 1225 | { | ||
| 1226 | 11, -126, -126, -126, -126, -126, -126, -126, -126, -126, | ||
| 1227 | -126, -126, -126, 56, -126, -126, 56, 56, 56, 56, | ||
| 1228 | 142, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1229 | 56, 56, 56, 56, 56, 56, -126 | ||
| 1230 | }, | ||
| 1231 | |||
| 1232 | { | ||
| 1233 | 11, -127, -127, -127, -127, -127, -127, -127, -127, -127, | ||
| 1234 | -127, -127, -127, 56, -127, -127, 56, 56, 56, 56, | ||
| 1235 | |||
| 1236 | 56, 56, 56, 56, 56, 56, 56, 143, 56, 56, | ||
| 1237 | 56, 56, 56, 56, 56, 56, -127 | ||
| 1238 | }, | ||
| 1239 | |||
| 1240 | { | ||
| 1241 | 11, -128, -128, -128, -128, -128, -128, -128, -128, -128, | ||
| 1242 | -128, -128, -128, 56, -128, -128, 56, 56, 56, 56, | ||
| 1243 | 56, 56, 144, 56, 56, 56, 56, 56, 56, 56, | ||
| 1244 | 56, 56, 56, 56, 56, 56, -128 | ||
| 1245 | }, | ||
| 1246 | |||
| 1247 | { | ||
| 1248 | 11, -129, -129, -129, -129, -129, -129, -129, -129, -129, | ||
| 1249 | -129, -129, -129, 56, -129, -129, 56, 56, 56, 56, | ||
| 1250 | 56, 56, 56, 56, 56, 145, 56, 56, 56, 56, | ||
| 1251 | 56, 56, 56, 56, 56, 56, -129 | ||
| 1252 | |||
| 1253 | }, | ||
| 1254 | |||
| 1255 | { | ||
| 1256 | 11, -130, -130, -130, -130, -130, -130, -130, -130, -130, | ||
| 1257 | -130, -130, -130, 56, -130, -130, 56, 56, 56, 146, | ||
| 1258 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1259 | 56, 56, 56, 56, 56, 56, -130 | ||
| 1260 | }, | ||
| 1261 | |||
| 1262 | { | ||
| 1263 | 11, -131, -131, -131, -131, -131, -131, -131, -131, -131, | ||
| 1264 | -131, -131, -131, 56, -131, -131, 56, 56, 56, 56, | ||
| 1265 | 56, 56, 56, 56, 56, 56, 56, 56, 147, 56, | ||
| 1266 | 56, 56, 56, 56, 56, 56, -131 | ||
| 1267 | }, | ||
| 1268 | |||
| 1269 | { | ||
| 1270 | 11, -132, -132, -132, -132, -132, -132, -132, -132, -132, | ||
| 1271 | -132, -132, -132, 56, -132, -132, 56, 56, 56, 56, | ||
| 1272 | |||
| 1273 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1274 | 56, 56, 56, 56, 56, 56, -132 | ||
| 1275 | }, | ||
| 1276 | |||
| 1277 | { | ||
| 1278 | 11, -133, -133, -133, -133, -133, -133, -133, -133, -133, | ||
| 1279 | -133, -133, -133, 56, -133, -133, 56, 56, 56, 56, | ||
| 1280 | 56, 56, 56, 56, 56, 56, 56, 148, 56, 56, | ||
| 1281 | 56, 56, 56, 56, 56, 56, -133 | ||
| 1282 | }, | ||
| 1283 | |||
| 1284 | { | ||
| 1285 | 11, -134, -134, -134, -134, -134, -134, -134, -134, -134, | ||
| 1286 | -134, -134, -134, 56, -134, -134, 56, 56, 56, 56, | ||
| 1287 | 149, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1288 | 56, 56, 56, 56, 56, 56, -134 | ||
| 1289 | |||
| 1290 | }, | ||
| 1291 | |||
| 1292 | { | ||
| 1293 | 11, -135, -135, -135, -135, -135, -135, -135, -135, -135, | ||
| 1294 | -135, -135, -135, 56, -135, -135, 56, 56, 56, 56, | ||
| 1295 | 56, 56, 56, 56, 56, 56, 56, 150, 56, 56, | ||
| 1296 | 56, 56, 56, 56, 56, 56, -135 | ||
| 1297 | }, | ||
| 1298 | |||
| 1299 | { | ||
| 1300 | 11, -136, -136, -136, -136, -136, -136, -136, -136, -136, | ||
| 1301 | -136, -136, -136, 56, -136, -136, 56, 56, 56, 56, | ||
| 1302 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1303 | 56, 56, 56, 151, 56, 56, -136 | ||
| 1304 | }, | ||
| 1305 | |||
| 1306 | { | ||
| 1307 | 11, -137, -137, -137, -137, -137, -137, -137, -137, -137, | ||
| 1308 | -137, -137, -137, 56, -137, -137, 56, 56, 56, 56, | ||
| 1309 | |||
| 1310 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1311 | 56, 152, 56, 56, 56, 56, -137 | ||
| 1312 | }, | ||
| 1313 | |||
| 1314 | { | ||
| 1315 | 11, -138, -138, -138, -138, -138, -138, -138, -138, -138, | ||
| 1316 | -138, -138, -138, 56, -138, -138, 56, 56, 56, 56, | ||
| 1317 | 153, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1318 | 56, 56, 56, 56, 56, 56, -138 | ||
| 1319 | }, | ||
| 1320 | |||
| 1321 | { | ||
| 1322 | 11, -139, -139, -139, -139, -139, -139, -139, -139, -139, | ||
| 1323 | -139, -139, -139, 56, -139, -139, 56, 56, 56, 56, | ||
| 1324 | 56, 56, 154, 56, 56, 56, 56, 56, 56, 56, | ||
| 1325 | 56, 56, 56, 56, 56, 56, -139 | ||
| 1326 | |||
| 1327 | }, | ||
| 1328 | |||
| 1329 | { | ||
| 1330 | 11, -140, -140, -140, -140, -140, -140, -140, -140, -140, | ||
| 1331 | -140, -140, -140, 56, -140, -140, 155, 56, 56, 56, | ||
| 1332 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1333 | 56, 56, 56, 56, 56, 56, -140 | ||
| 1334 | }, | ||
| 1335 | |||
| 1336 | { | ||
| 1337 | 11, -141, -141, -141, -141, -141, -141, -141, -141, -141, | ||
| 1338 | -141, -141, -141, 56, -141, -141, 56, 56, 56, 56, | ||
| 1339 | 56, 56, 56, 56, 56, 56, 56, 156, 56, 56, | ||
| 1340 | 56, 56, 56, 56, 56, 56, -141 | ||
| 1341 | }, | ||
| 1342 | |||
| 1343 | { | ||
| 1344 | 11, -142, -142, -142, -142, -142, -142, -142, -142, -142, | ||
| 1345 | -142, -142, -142, 56, -142, -142, 56, 56, 56, 56, | ||
| 1346 | |||
| 1347 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1348 | 56, 56, 56, 56, 56, 56, -142 | ||
| 1349 | }, | ||
| 1350 | |||
| 1351 | { | ||
| 1352 | 11, -143, -143, -143, -143, -143, -143, -143, -143, -143, | ||
| 1353 | -143, -143, -143, 56, -143, -143, 56, 56, 56, 56, | ||
| 1354 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1355 | 56, 56, 56, 157, 56, 56, -143 | ||
| 1356 | }, | ||
| 1357 | |||
| 1358 | { | ||
| 1359 | 11, -144, -144, -144, -144, -144, -144, -144, -144, -144, | ||
| 1360 | -144, -144, -144, 56, -144, -144, 56, 56, 56, 56, | ||
| 1361 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1362 | 56, 56, 56, 56, 56, 56, -144 | ||
| 1363 | |||
| 1364 | }, | ||
| 1365 | |||
| 1366 | { | ||
| 1367 | 11, -145, -145, -145, -145, -145, -145, -145, -145, -145, | ||
| 1368 | -145, -145, -145, 56, -145, -145, 56, 56, 56, 56, | ||
| 1369 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1370 | 56, 56, 56, 158, 56, 56, -145 | ||
| 1371 | }, | ||
| 1372 | |||
| 1373 | { | ||
| 1374 | 11, -146, -146, -146, -146, -146, -146, -146, -146, -146, | ||
| 1375 | -146, -146, -146, 56, -146, -146, 56, 56, 56, 56, | ||
| 1376 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1377 | 56, 56, 159, 56, 56, 56, -146 | ||
| 1378 | }, | ||
| 1379 | |||
| 1380 | { | ||
| 1381 | 11, -147, -147, -147, -147, -147, -147, -147, -147, -147, | ||
| 1382 | -147, -147, -147, 56, -147, -147, 56, 56, 56, 56, | ||
| 1383 | |||
| 1384 | 56, 56, 56, 56, 160, 56, 56, 56, 56, 56, | ||
| 1385 | 56, 56, 56, 56, 56, 56, -147 | ||
| 1386 | }, | ||
| 1387 | |||
| 1388 | { | ||
| 1389 | 11, -148, -148, -148, -148, -148, -148, -148, -148, -148, | ||
| 1390 | -148, -148, -148, 56, -148, -148, 56, 56, 56, 56, | ||
| 1391 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1392 | 56, 56, 56, 56, 161, 56, -148 | ||
| 1393 | }, | ||
| 1394 | |||
| 1395 | { | ||
| 1396 | 11, -149, -149, -149, -149, -149, -149, -149, -149, -149, | ||
| 1397 | -149, -149, -149, 56, -149, -149, 56, 56, 56, 56, | ||
| 1398 | 56, 56, 56, 56, 56, 56, 56, 162, 56, 56, | ||
| 1399 | 56, 56, 56, 56, 56, 56, -149 | ||
| 1400 | |||
| 1401 | }, | ||
| 1402 | |||
| 1403 | { | ||
| 1404 | 11, -150, -150, -150, -150, -150, -150, -150, -150, -150, | ||
| 1405 | -150, -150, -150, 56, -150, -150, 163, 56, 56, 56, | ||
| 1406 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1407 | 56, 56, 56, 56, 56, 56, -150 | ||
| 1408 | }, | ||
| 1409 | |||
| 1410 | { | ||
| 1411 | 11, -151, -151, -151, -151, -151, -151, -151, -151, -151, | ||
| 1412 | -151, -151, -151, 56, -151, -151, 56, 56, 56, 56, | ||
| 1413 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1414 | 56, 56, 56, 56, 56, 56, -151 | ||
| 1415 | }, | ||
| 1416 | |||
| 1417 | { | ||
| 1418 | 11, -152, -152, -152, -152, -152, -152, -152, -152, -152, | ||
| 1419 | -152, -152, -152, 56, -152, -152, 56, 56, 56, 56, | ||
| 1420 | |||
| 1421 | 164, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1422 | 56, 56, 56, 56, 56, 56, -152 | ||
| 1423 | }, | ||
| 1424 | |||
| 1425 | { | ||
| 1426 | 11, -153, -153, -153, -153, -153, -153, -153, -153, -153, | ||
| 1427 | -153, -153, -153, 56, -153, -153, 56, 56, 56, 56, | ||
| 1428 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1429 | 56, 56, 56, 56, 56, 56, -153 | ||
| 1430 | }, | ||
| 1431 | |||
| 1432 | { | ||
| 1433 | 11, -154, -154, -154, -154, -154, -154, -154, -154, -154, | ||
| 1434 | -154, -154, -154, 56, -154, -154, 56, 56, 56, 56, | ||
| 1435 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1436 | 56, 56, 56, 56, 56, 56, -154 | ||
| 1437 | |||
| 1438 | }, | ||
| 1439 | |||
| 1440 | { | ||
| 1441 | 11, -155, -155, -155, -155, -155, -155, -155, -155, -155, | ||
| 1442 | -155, -155, -155, 56, -155, -155, 56, 56, 56, 56, | ||
| 1443 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1444 | 56, 56, 56, 165, 56, 56, -155 | ||
| 1445 | }, | ||
| 1446 | |||
| 1447 | { | ||
| 1448 | 11, -156, -156, -156, -156, -156, -156, -156, -156, -156, | ||
| 1449 | -156, -156, -156, 56, -156, -156, 56, 56, 56, 56, | ||
| 1450 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1451 | 56, 56, 56, 56, 56, 56, -156 | ||
| 1452 | }, | ||
| 1453 | |||
| 1454 | { | ||
| 1455 | 11, -157, -157, -157, -157, -157, -157, -157, -157, -157, | ||
| 1456 | -157, -157, -157, 56, -157, -157, 56, 56, 56, 56, | ||
| 1457 | |||
| 1458 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1459 | 56, 56, 56, 56, 56, 56, -157 | ||
| 1460 | }, | ||
| 1461 | |||
| 1462 | { | ||
| 1463 | 11, -158, -158, -158, -158, -158, -158, -158, -158, -158, | ||
| 1464 | -158, -158, -158, 56, -158, -158, 56, 56, 56, 56, | ||
| 1465 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1466 | 56, 56, 56, 56, 56, 56, -158 | ||
| 1467 | }, | ||
| 1468 | |||
| 1469 | { | ||
| 1470 | 11, -159, -159, -159, -159, -159, -159, -159, -159, -159, | ||
| 1471 | -159, -159, -159, 56, -159, -159, 56, 56, 56, 56, | ||
| 1472 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1473 | 56, 56, 56, 56, 56, 56, -159 | ||
| 1474 | |||
| 1475 | }, | ||
| 1476 | |||
| 1477 | { | ||
| 1478 | 11, -160, -160, -160, -160, -160, -160, -160, -160, -160, | ||
| 1479 | -160, -160, -160, 56, -160, -160, 56, 56, 166, 56, | ||
| 1480 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1481 | 56, 56, 56, 56, 56, 56, -160 | ||
| 1482 | }, | ||
| 1483 | |||
| 1484 | { | ||
| 1485 | 11, -161, -161, -161, -161, -161, -161, -161, -161, -161, | ||
| 1486 | -161, -161, -161, 56, -161, -161, 56, 56, 56, 56, | ||
| 1487 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1488 | 56, 56, 56, 56, 56, 56, -161 | ||
| 1489 | }, | ||
| 1490 | |||
| 1491 | { | ||
| 1492 | 11, -162, -162, -162, -162, -162, -162, -162, -162, -162, | ||
| 1493 | -162, -162, -162, 56, -162, -162, 56, 56, 56, 56, | ||
| 1494 | |||
| 1495 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1496 | 56, 56, 56, 56, 167, 56, -162 | ||
| 1497 | }, | ||
| 1498 | |||
| 1499 | { | ||
| 1500 | 11, -163, -163, -163, -163, -163, -163, -163, -163, -163, | ||
| 1501 | -163, -163, -163, 56, -163, -163, 56, 56, 56, 56, | ||
| 1502 | 56, 56, 56, 56, 56, 168, 56, 56, 56, 56, | ||
| 1503 | 56, 56, 56, 56, 56, 56, -163 | ||
| 1504 | }, | ||
| 1505 | |||
| 1506 | { | ||
| 1507 | 11, -164, -164, -164, -164, -164, -164, -164, -164, -164, | ||
| 1508 | -164, -164, -164, 56, -164, -164, 56, 56, 56, 56, | ||
| 1509 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1510 | 56, 56, 169, 56, 56, 56, -164 | ||
| 1511 | |||
| 1512 | }, | ||
| 1513 | |||
| 1514 | { | ||
| 1515 | 11, -165, -165, -165, -165, -165, -165, -165, -165, -165, | ||
| 1516 | -165, -165, -165, 56, -165, -165, 56, 56, 56, 56, | ||
| 1517 | 170, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1518 | 56, 56, 56, 56, 56, 56, -165 | ||
| 1519 | }, | ||
| 1520 | |||
| 1521 | { | ||
| 1522 | 11, -166, -166, -166, -166, -166, -166, -166, -166, -166, | ||
| 1523 | -166, -166, -166, 56, -166, -166, 56, 56, 56, 56, | ||
| 1524 | 171, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1525 | 56, 56, 56, 56, 56, 56, -166 | ||
| 1526 | }, | ||
| 1527 | |||
| 1528 | { | ||
| 1529 | 11, -167, -167, -167, -167, -167, -167, -167, -167, -167, | ||
| 1530 | -167, -167, -167, 56, -167, -167, 56, 56, 56, 56, | ||
| 1531 | |||
| 1532 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1533 | 56, 56, 56, 56, 56, 56, -167 | ||
| 1534 | }, | ||
| 1535 | |||
| 1536 | { | ||
| 1537 | 11, -168, -168, -168, -168, -168, -168, -168, -168, -168, | ||
| 1538 | -168, -168, -168, 56, -168, -168, 56, 56, 56, 56, | ||
| 1539 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1540 | 56, 56, 56, 56, 56, 56, -168 | ||
| 1541 | }, | ||
| 1542 | |||
| 1543 | { | ||
| 1544 | 11, -169, -169, -169, -169, -169, -169, -169, -169, -169, | ||
| 1545 | -169, -169, -169, 56, -169, -169, 56, 56, 56, 56, | ||
| 1546 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1547 | 56, 56, 56, 56, 56, 56, -169 | ||
| 1548 | |||
| 1549 | }, | ||
| 1550 | |||
| 1551 | { | ||
| 1552 | 11, -170, -170, -170, -170, -170, -170, -170, -170, -170, | ||
| 1553 | -170, -170, -170, 56, -170, -170, 56, 56, 56, 56, | ||
| 1554 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1555 | 56, 56, 56, 56, 56, 56, -170 | ||
| 1556 | }, | ||
| 1557 | |||
| 1558 | { | ||
| 1559 | 11, -171, -171, -171, -171, -171, -171, -171, -171, -171, | ||
| 1560 | -171, -171, -171, 56, -171, -171, 56, 56, 56, 56, | ||
| 1561 | 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, | ||
| 1562 | 56, 56, 56, 56, 56, 56, -171 | ||
| 1563 | }, | ||
| 1564 | |||
| 1565 | } ; | ||
| 1566 | |||
| 1567 | |||
| 1568 | static yy_state_type yy_get_previous_state YY_PROTO(( void )); | ||
| 1569 | static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); | ||
| 1570 | static int yy_get_next_buffer YY_PROTO(( void )); | ||
| 1571 | static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); | ||
| 1572 | |||
| 1573 | /* Done after the current pattern has been matched and before the | ||
| 1574 | * corresponding action - sets up yytext. | ||
| 1575 | */ | ||
| 1576 | #define YY_DO_BEFORE_ACTION \ | ||
| 1577 | yytext_ptr = yy_bp; \ | ||
| 1578 | yyleng = (int) (yy_cp - yy_bp); \ | ||
| 1579 | yy_hold_char = *yy_cp; \ | ||
| 1580 | *yy_cp = '\0'; \ | ||
| 1581 | yy_c_buf_p = yy_cp; | ||
| 1582 | |||
| 1583 | #define YY_NUM_RULES 55 | ||
| 1584 | #define YY_END_OF_BUFFER 56 | ||
| 1585 | static yyconst short int yy_accept[172] = | ||
| 1586 | { 0, | ||
| 1587 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, | ||
| 1588 | 56, 5, 4, 3, 2, 29, 30, 28, 28, 28, | ||
| 1589 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, | ||
| 1590 | 54, 51, 53, 46, 50, 49, 48, 44, 41, 35, | ||
| 1591 | 40, 44, 33, 34, 43, 43, 36, 43, 43, 44, | ||
| 1592 | 4, 3, 2, 2, 1, 28, 28, 28, 28, 28, | ||
| 1593 | 28, 28, 15, 28, 28, 28, 28, 28, 28, 28, | ||
| 1594 | 28, 28, 54, 51, 53, 52, 46, 45, 48, 47, | ||
| 1595 | 37, 31, 43, 43, 38, 39, 32, 28, 28, 28, | ||
| 1596 | 28, 28, 28, 28, 28, 26, 25, 28, 28, 28, | ||
| 1597 | |||
| 1598 | 28, 28, 28, 28, 28, 42, 23, 28, 28, 28, | ||
| 1599 | 28, 28, 28, 28, 28, 14, 28, 7, 28, 28, | ||
| 1600 | 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, | ||
| 1601 | 28, 16, 28, 28, 28, 28, 28, 28, 28, 28, | ||
| 1602 | 28, 10, 28, 13, 28, 28, 28, 28, 28, 28, | ||
| 1603 | 21, 28, 9, 27, 28, 24, 12, 20, 17, 28, | ||
| 1604 | 8, 28, 28, 28, 28, 28, 6, 19, 18, 22, | ||
| 1605 | 11 | ||
| 1606 | } ; | ||
| 1607 | |||
| 1608 | static yyconst int yy_ec[256] = | ||
| 1609 | { 0, | ||
| 1610 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, | ||
| 1611 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1612 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1613 | 1, 2, 4, 5, 6, 1, 1, 7, 8, 9, | ||
| 1614 | 10, 1, 1, 1, 11, 12, 12, 13, 13, 13, | ||
| 1615 | 13, 13, 13, 13, 13, 13, 13, 1, 1, 1, | ||
| 1616 | 14, 1, 1, 1, 13, 13, 13, 13, 13, 13, | ||
| 1617 | 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, | ||
| 1618 | 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, | ||
| 1619 | 1, 15, 1, 1, 13, 1, 16, 17, 18, 19, | ||
| 1620 | |||
| 1621 | 20, 21, 22, 23, 24, 13, 13, 25, 26, 27, | ||
| 1622 | 28, 29, 30, 31, 32, 33, 34, 13, 13, 35, | ||
| 1623 | 13, 13, 1, 36, 1, 1, 1, 1, 1, 1, | ||
| 1624 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1625 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1626 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1627 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1628 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1629 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1630 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1631 | |||
| 1632 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1633 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1634 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1635 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1636 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, | ||
| 1637 | 1, 1, 1, 1, 1 | ||
| 1638 | } ; | ||
| 1639 | |||
| 1640 | /* The intent behind this definition is that it'll catch | ||
| 1641 | * any uses of REJECT which flex missed. | ||
| 1642 | */ | ||
| 1643 | #define REJECT reject_used_but_not_detected | ||
| 1644 | #define yymore() yymore_used_but_not_detected | ||
| 1645 | #define YY_MORE_ADJ 0 | ||
| 1646 | #define YY_RESTORE_YY_MORE_OFFSET | ||
| 1647 | char *yytext; | ||
| 1648 | #line 1 "zconf.l" | ||
| 1649 | #define INITIAL 0 | ||
| 1650 | #define YY_NEVER_INTERACTIVE 1 | ||
| 1651 | #define COMMAND 1 | ||
| 1652 | #define HELP 2 | ||
| 1653 | #define STRING 3 | ||
| 1654 | #define PARAM 4 | ||
| 1655 | |||
| 1656 | #line 5 "zconf.l" | ||
| 1657 | /* | ||
| 1658 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 1659 | * Released under the terms of the GNU GPL v2.0. | ||
| 1660 | */ | ||
| 1661 | |||
| 1662 | #include <stdio.h> | ||
| 1663 | #include <stdlib.h> | ||
| 1664 | #include <string.h> | ||
| 1665 | #include <unistd.h> | ||
| 1666 | |||
| 1667 | #define LKC_DIRECT_LINK | ||
| 1668 | #include "lkc.h" | ||
| 1669 | #include "zconf.tab.h" | ||
| 1670 | |||
| 1671 | #define START_STRSIZE 16 | ||
| 1672 | |||
| 1673 | char *text; | ||
| 1674 | static char *text_ptr; | ||
| 1675 | static int text_size, text_asize; | ||
| 1676 | |||
| 1677 | struct buffer { | ||
| 1678 | struct buffer *parent; | ||
| 1679 | YY_BUFFER_STATE state; | ||
| 1680 | }; | ||
| 1681 | |||
| 1682 | struct buffer *current_buf; | ||
| 1683 | |||
| 1684 | static int last_ts, first_ts; | ||
| 1685 | |||
| 1686 | static void zconf_endhelp(void); | ||
| 1687 | static struct buffer *zconf_endfile(void); | ||
| 1688 | |||
| 1689 | void new_string(void) | ||
| 1690 | { | ||
| 1691 | text = malloc(START_STRSIZE); | ||
| 1692 | text_asize = START_STRSIZE; | ||
| 1693 | text_ptr = text; | ||
| 1694 | text_size = 0; | ||
| 1695 | *text_ptr = 0; | ||
| 1696 | } | ||
| 1697 | |||
| 1698 | void append_string(const char *str, int size) | ||
| 1699 | { | ||
| 1700 | int new_size = text_size + size + 1; | ||
| 1701 | if (new_size > text_asize) { | ||
| 1702 | text = realloc(text, new_size); | ||
| 1703 | text_asize = new_size; | ||
| 1704 | text_ptr = text + text_size; | ||
| 1705 | } | ||
| 1706 | memcpy(text_ptr, str, size); | ||
| 1707 | text_ptr += size; | ||
| 1708 | text_size += size; | ||
| 1709 | *text_ptr = 0; | ||
| 1710 | } | ||
| 1711 | |||
| 1712 | void alloc_string(const char *str, int size) | ||
| 1713 | { | ||
| 1714 | text = malloc(size + 1); | ||
| 1715 | memcpy(text, str, size); | ||
| 1716 | text[size] = 0; | ||
| 1717 | } | ||
| 1718 | #line 1719 "lex.zconf.c" | ||
| 1719 | |||
| 1720 | /* Macros after this point can all be overridden by user definitions in | ||
| 1721 | * section 1. | ||
| 1722 | */ | ||
| 1723 | |||
| 1724 | #ifndef YY_SKIP_YYWRAP | ||
| 1725 | #ifdef __cplusplus | ||
| 1726 | extern "C" int yywrap YY_PROTO(( void )); | ||
| 1727 | #else | ||
| 1728 | extern int yywrap YY_PROTO(( void )); | ||
| 1729 | #endif | ||
| 1730 | #endif | ||
| 1731 | |||
| 1732 | #ifndef YY_NO_UNPUT | ||
| 1733 | static void yyunput YY_PROTO(( int c, char *buf_ptr )); | ||
| 1734 | #endif | ||
| 1735 | |||
| 1736 | #ifndef yytext_ptr | ||
| 1737 | static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); | ||
| 1738 | #endif | ||
| 1739 | |||
| 1740 | #ifdef YY_NEED_STRLEN | ||
| 1741 | static int yy_flex_strlen YY_PROTO(( yyconst char * )); | ||
| 1742 | #endif | ||
| 1743 | |||
| 1744 | #ifndef YY_NO_INPUT | ||
| 1745 | #ifdef __cplusplus | ||
| 1746 | static int yyinput YY_PROTO(( void )); | ||
| 1747 | #else | ||
| 1748 | static int input YY_PROTO(( void )); | ||
| 1749 | #endif | ||
| 1750 | #endif | ||
| 1751 | |||
| 1752 | #if YY_STACK_USED | ||
| 1753 | static int yy_start_stack_ptr = 0; | ||
| 1754 | static int yy_start_stack_depth = 0; | ||
| 1755 | static int *yy_start_stack = 0; | ||
| 1756 | #ifndef YY_NO_PUSH_STATE | ||
| 1757 | static void yy_push_state YY_PROTO(( int new_state )); | ||
| 1758 | #endif | ||
| 1759 | #ifndef YY_NO_POP_STATE | ||
| 1760 | static void yy_pop_state YY_PROTO(( void )); | ||
| 1761 | #endif | ||
| 1762 | #ifndef YY_NO_TOP_STATE | ||
| 1763 | static int yy_top_state YY_PROTO(( void )); | ||
| 1764 | #endif | ||
| 1765 | |||
| 1766 | #else | ||
| 1767 | #define YY_NO_PUSH_STATE 1 | ||
| 1768 | #define YY_NO_POP_STATE 1 | ||
| 1769 | #define YY_NO_TOP_STATE 1 | ||
| 1770 | #endif | ||
| 1771 | |||
| 1772 | #ifdef YY_MALLOC_DECL | ||
| 1773 | YY_MALLOC_DECL | ||
| 1774 | #else | ||
| 1775 | #if __STDC__ | ||
| 1776 | #ifndef __cplusplus | ||
| 1777 | #include <stdlib.h> | ||
| 1778 | #endif | ||
| 1779 | #else | ||
| 1780 | /* Just try to get by without declaring the routines. This will fail | ||
| 1781 | * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) | ||
| 1782 | * or sizeof(void*) != sizeof(int). | ||
| 1783 | */ | ||
| 1784 | #endif | ||
| 1785 | #endif | ||
| 1786 | |||
| 1787 | /* Amount of stuff to slurp up with each read. */ | ||
| 1788 | #ifndef YY_READ_BUF_SIZE | ||
| 1789 | #define YY_READ_BUF_SIZE 8192 | ||
| 1790 | #endif | ||
| 1791 | |||
| 1792 | /* Copy whatever the last rule matched to the standard output. */ | ||
| 1793 | |||
| 1794 | #ifndef ECHO | ||
| 1795 | /* This used to be an fputs(), but since the string might contain NUL's, | ||
| 1796 | * we now use fwrite(). | ||
| 1797 | */ | ||
| 1798 | #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) | ||
| 1799 | #endif | ||
| 1800 | |||
| 1801 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, | ||
| 1802 | * is returned in "result". | ||
| 1803 | */ | ||
| 1804 | #ifndef YY_INPUT | ||
| 1805 | #define YY_INPUT(buf,result,max_size) \ | ||
| 1806 | errno=0; \ | ||
| 1807 | while ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ | ||
| 1808 | { \ | ||
| 1809 | if( errno != EINTR) \ | ||
| 1810 | { \ | ||
| 1811 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ | ||
| 1812 | break; \ | ||
| 1813 | } \ | ||
| 1814 | errno=0; \ | ||
| 1815 | clearerr(yyin); \ | ||
| 1816 | } | ||
| 1817 | #endif | ||
| 1818 | |||
| 1819 | /* No semi-colon after return; correct usage is to write "yyterminate();" - | ||
| 1820 | * we don't want an extra ';' after the "return" because that will cause | ||
| 1821 | * some compilers to complain about unreachable statements. | ||
| 1822 | */ | ||
| 1823 | #ifndef yyterminate | ||
| 1824 | #define yyterminate() return YY_NULL | ||
| 1825 | #endif | ||
| 1826 | |||
| 1827 | /* Number of entries by which start-condition stack grows. */ | ||
| 1828 | #ifndef YY_START_STACK_INCR | ||
| 1829 | #define YY_START_STACK_INCR 25 | ||
| 1830 | #endif | ||
| 1831 | |||
| 1832 | /* Report a fatal error. */ | ||
| 1833 | #ifndef YY_FATAL_ERROR | ||
| 1834 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) | ||
| 1835 | #endif | ||
| 1836 | |||
| 1837 | /* Default declaration of generated scanner - a define so the user can | ||
| 1838 | * easily add parameters. | ||
| 1839 | */ | ||
| 1840 | #ifndef YY_DECL | ||
| 1841 | #define YY_DECL int yylex YY_PROTO(( void )) | ||
| 1842 | #endif | ||
| 1843 | |||
| 1844 | /* Code executed at the beginning of each rule, after yytext and yyleng | ||
| 1845 | * have been set up. | ||
| 1846 | */ | ||
| 1847 | #ifndef YY_USER_ACTION | ||
| 1848 | #define YY_USER_ACTION | ||
| 1849 | #endif | ||
| 1850 | |||
| 1851 | /* Code executed at the end of each rule. */ | ||
| 1852 | #ifndef YY_BREAK | ||
| 1853 | #define YY_BREAK break; | ||
| 1854 | #endif | ||
| 1855 | |||
| 1856 | #define YY_RULE_SETUP \ | ||
| 1857 | YY_USER_ACTION | ||
| 1858 | |||
| 1859 | YY_DECL | ||
| 1860 | { | ||
| 1861 | register yy_state_type yy_current_state; | ||
| 1862 | register char *yy_cp, *yy_bp; | ||
| 1863 | register int yy_act; | ||
| 1864 | |||
| 1865 | #line 71 "zconf.l" | ||
| 1866 | |||
| 1867 | int str = 0; | ||
| 1868 | int ts, i; | ||
| 1869 | |||
| 1870 | #line 1871 "lex.zconf.c" | ||
| 1871 | |||
| 1872 | if ( yy_init ) | ||
| 1873 | { | ||
| 1874 | yy_init = 0; | ||
| 1875 | |||
| 1876 | #ifdef YY_USER_INIT | ||
| 1877 | YY_USER_INIT; | ||
| 1878 | #endif | ||
| 1879 | |||
| 1880 | if ( ! yy_start ) | ||
| 1881 | yy_start = 1; /* first start state */ | ||
| 1882 | |||
| 1883 | if ( ! yyin ) | ||
| 1884 | yyin = stdin; | ||
| 1885 | |||
| 1886 | if ( ! yyout ) | ||
| 1887 | yyout = stdout; | ||
| 1888 | |||
| 1889 | if ( ! yy_current_buffer ) | ||
| 1890 | yy_current_buffer = | ||
| 1891 | yy_create_buffer( yyin, YY_BUF_SIZE ); | ||
| 1892 | |||
| 1893 | yy_load_buffer_state(); | ||
| 1894 | } | ||
| 1895 | |||
| 1896 | while ( 1 ) /* loops until end-of-file is reached */ | ||
| 1897 | { | ||
| 1898 | yy_cp = yy_c_buf_p; | ||
| 1899 | |||
| 1900 | /* Support of yytext. */ | ||
| 1901 | *yy_cp = yy_hold_char; | ||
| 1902 | |||
| 1903 | /* yy_bp points to the position in yy_ch_buf of the start of | ||
| 1904 | * the current run. | ||
| 1905 | */ | ||
| 1906 | yy_bp = yy_cp; | ||
| 1907 | |||
| 1908 | yy_current_state = yy_start; | ||
| 1909 | yy_match: | ||
| 1910 | while ( (yy_current_state = yy_nxt[yy_current_state][yy_ec[YY_SC_TO_UI(*yy_cp)]]) > 0 ) | ||
| 1911 | ++yy_cp; | ||
| 1912 | |||
| 1913 | yy_current_state = -yy_current_state; | ||
| 1914 | |||
| 1915 | yy_find_action: | ||
| 1916 | yy_act = yy_accept[yy_current_state]; | ||
| 1917 | |||
| 1918 | YY_DO_BEFORE_ACTION; | ||
| 1919 | |||
| 1920 | |||
| 1921 | do_action: /* This label is used only to access EOF actions. */ | ||
| 1922 | |||
| 1923 | |||
| 1924 | switch ( yy_act ) | ||
| 1925 | { /* beginning of action switch */ | ||
| 1926 | case 1: | ||
| 1927 | YY_RULE_SETUP | ||
| 1928 | #line 75 "zconf.l" | ||
| 1929 | current_file->lineno++; | ||
| 1930 | YY_BREAK | ||
| 1931 | case 2: | ||
| 1932 | YY_RULE_SETUP | ||
| 1933 | #line 76 "zconf.l" | ||
| 1934 | |||
| 1935 | YY_BREAK | ||
| 1936 | case 3: | ||
| 1937 | YY_RULE_SETUP | ||
| 1938 | #line 78 "zconf.l" | ||
| 1939 | current_file->lineno++; return T_EOL; | ||
| 1940 | YY_BREAK | ||
| 1941 | case 4: | ||
| 1942 | YY_RULE_SETUP | ||
| 1943 | #line 80 "zconf.l" | ||
| 1944 | { | ||
| 1945 | BEGIN(COMMAND); | ||
| 1946 | } | ||
| 1947 | YY_BREAK | ||
| 1948 | case 5: | ||
| 1949 | YY_RULE_SETUP | ||
| 1950 | #line 84 "zconf.l" | ||
| 1951 | { | ||
| 1952 | unput(yytext[0]); | ||
| 1953 | BEGIN(COMMAND); | ||
| 1954 | } | ||
| 1955 | YY_BREAK | ||
| 1956 | |||
| 1957 | case 6: | ||
| 1958 | YY_RULE_SETUP | ||
| 1959 | #line 91 "zconf.l" | ||
| 1960 | BEGIN(PARAM); return T_MAINMENU; | ||
| 1961 | YY_BREAK | ||
| 1962 | case 7: | ||
| 1963 | YY_RULE_SETUP | ||
| 1964 | #line 92 "zconf.l" | ||
| 1965 | BEGIN(PARAM); return T_MENU; | ||
| 1966 | YY_BREAK | ||
| 1967 | case 8: | ||
| 1968 | YY_RULE_SETUP | ||
| 1969 | #line 93 "zconf.l" | ||
| 1970 | BEGIN(PARAM); return T_ENDMENU; | ||
| 1971 | YY_BREAK | ||
| 1972 | case 9: | ||
| 1973 | YY_RULE_SETUP | ||
| 1974 | #line 94 "zconf.l" | ||
| 1975 | BEGIN(PARAM); return T_SOURCE; | ||
| 1976 | YY_BREAK | ||
| 1977 | case 10: | ||
| 1978 | YY_RULE_SETUP | ||
| 1979 | #line 95 "zconf.l" | ||
| 1980 | BEGIN(PARAM); return T_CHOICE; | ||
| 1981 | YY_BREAK | ||
| 1982 | case 11: | ||
| 1983 | YY_RULE_SETUP | ||
| 1984 | #line 96 "zconf.l" | ||
| 1985 | BEGIN(PARAM); return T_ENDCHOICE; | ||
| 1986 | YY_BREAK | ||
| 1987 | case 12: | ||
| 1988 | YY_RULE_SETUP | ||
| 1989 | #line 97 "zconf.l" | ||
| 1990 | BEGIN(PARAM); return T_COMMENT; | ||
| 1991 | YY_BREAK | ||
| 1992 | case 13: | ||
| 1993 | YY_RULE_SETUP | ||
| 1994 | #line 98 "zconf.l" | ||
| 1995 | BEGIN(PARAM); return T_CONFIG; | ||
| 1996 | YY_BREAK | ||
| 1997 | case 14: | ||
| 1998 | YY_RULE_SETUP | ||
| 1999 | #line 99 "zconf.l" | ||
| 2000 | BEGIN(PARAM); return T_HELP; | ||
| 2001 | YY_BREAK | ||
| 2002 | case 15: | ||
| 2003 | YY_RULE_SETUP | ||
| 2004 | #line 100 "zconf.l" | ||
| 2005 | BEGIN(PARAM); return T_IF; | ||
| 2006 | YY_BREAK | ||
| 2007 | case 16: | ||
| 2008 | YY_RULE_SETUP | ||
| 2009 | #line 101 "zconf.l" | ||
| 2010 | BEGIN(PARAM); return T_ENDIF; | ||
| 2011 | YY_BREAK | ||
| 2012 | case 17: | ||
| 2013 | YY_RULE_SETUP | ||
| 2014 | #line 102 "zconf.l" | ||
| 2015 | BEGIN(PARAM); return T_DEPENDS; | ||
| 2016 | YY_BREAK | ||
| 2017 | case 18: | ||
| 2018 | YY_RULE_SETUP | ||
| 2019 | #line 103 "zconf.l" | ||
| 2020 | BEGIN(PARAM); return T_REQUIRES; | ||
| 2021 | YY_BREAK | ||
| 2022 | case 19: | ||
| 2023 | YY_RULE_SETUP | ||
| 2024 | #line 104 "zconf.l" | ||
| 2025 | BEGIN(PARAM); return T_OPTIONAL; | ||
| 2026 | YY_BREAK | ||
| 2027 | case 20: | ||
| 2028 | YY_RULE_SETUP | ||
| 2029 | #line 105 "zconf.l" | ||
| 2030 | BEGIN(PARAM); return T_DEFAULT; | ||
| 2031 | YY_BREAK | ||
| 2032 | case 21: | ||
| 2033 | YY_RULE_SETUP | ||
| 2034 | #line 106 "zconf.l" | ||
| 2035 | BEGIN(PARAM); return T_PROMPT; | ||
| 2036 | YY_BREAK | ||
| 2037 | case 22: | ||
| 2038 | YY_RULE_SETUP | ||
| 2039 | #line 107 "zconf.l" | ||
| 2040 | BEGIN(PARAM); return T_TRISTATE; | ||
| 2041 | YY_BREAK | ||
| 2042 | case 23: | ||
| 2043 | YY_RULE_SETUP | ||
| 2044 | #line 108 "zconf.l" | ||
| 2045 | BEGIN(PARAM); return T_BOOLEAN; | ||
| 2046 | YY_BREAK | ||
| 2047 | case 24: | ||
| 2048 | YY_RULE_SETUP | ||
| 2049 | #line 109 "zconf.l" | ||
| 2050 | BEGIN(PARAM); return T_BOOLEAN; | ||
| 2051 | YY_BREAK | ||
| 2052 | case 25: | ||
| 2053 | YY_RULE_SETUP | ||
| 2054 | #line 110 "zconf.l" | ||
| 2055 | BEGIN(PARAM); return T_INT; | ||
| 2056 | YY_BREAK | ||
| 2057 | case 26: | ||
| 2058 | YY_RULE_SETUP | ||
| 2059 | #line 111 "zconf.l" | ||
| 2060 | BEGIN(PARAM); return T_HEX; | ||
| 2061 | YY_BREAK | ||
| 2062 | case 27: | ||
| 2063 | YY_RULE_SETUP | ||
| 2064 | #line 112 "zconf.l" | ||
| 2065 | BEGIN(PARAM); return T_STRING; | ||
| 2066 | YY_BREAK | ||
| 2067 | case 28: | ||
| 2068 | YY_RULE_SETUP | ||
| 2069 | #line 113 "zconf.l" | ||
| 2070 | { | ||
| 2071 | alloc_string(yytext, yyleng); | ||
| 2072 | zconflval.string = text; | ||
| 2073 | return T_WORD; | ||
| 2074 | } | ||
| 2075 | YY_BREAK | ||
| 2076 | case 29: | ||
| 2077 | YY_RULE_SETUP | ||
| 2078 | #line 118 "zconf.l" | ||
| 2079 | |||
| 2080 | YY_BREAK | ||
| 2081 | case 30: | ||
| 2082 | YY_RULE_SETUP | ||
| 2083 | #line 119 "zconf.l" | ||
| 2084 | current_file->lineno++; BEGIN(INITIAL); | ||
| 2085 | YY_BREAK | ||
| 2086 | |||
| 2087 | |||
| 2088 | case 31: | ||
| 2089 | YY_RULE_SETUP | ||
| 2090 | #line 123 "zconf.l" | ||
| 2091 | return T_AND; | ||
| 2092 | YY_BREAK | ||
| 2093 | case 32: | ||
| 2094 | YY_RULE_SETUP | ||
| 2095 | #line 124 "zconf.l" | ||
| 2096 | return T_OR; | ||
| 2097 | YY_BREAK | ||
| 2098 | case 33: | ||
| 2099 | YY_RULE_SETUP | ||
| 2100 | #line 125 "zconf.l" | ||
| 2101 | return T_OPEN_PAREN; | ||
| 2102 | YY_BREAK | ||
| 2103 | case 34: | ||
| 2104 | YY_RULE_SETUP | ||
| 2105 | #line 126 "zconf.l" | ||
| 2106 | return T_CLOSE_PAREN; | ||
| 2107 | YY_BREAK | ||
| 2108 | case 35: | ||
| 2109 | YY_RULE_SETUP | ||
| 2110 | #line 127 "zconf.l" | ||
| 2111 | return T_NOT; | ||
| 2112 | YY_BREAK | ||
| 2113 | case 36: | ||
| 2114 | YY_RULE_SETUP | ||
| 2115 | #line 128 "zconf.l" | ||
| 2116 | return T_EQUAL; | ||
| 2117 | YY_BREAK | ||
| 2118 | case 37: | ||
| 2119 | YY_RULE_SETUP | ||
| 2120 | #line 129 "zconf.l" | ||
| 2121 | return T_UNEQUAL; | ||
| 2122 | YY_BREAK | ||
| 2123 | case 38: | ||
| 2124 | YY_RULE_SETUP | ||
| 2125 | #line 130 "zconf.l" | ||
| 2126 | return T_IF; | ||
| 2127 | YY_BREAK | ||
| 2128 | case 39: | ||
| 2129 | YY_RULE_SETUP | ||
| 2130 | #line 131 "zconf.l" | ||
| 2131 | return T_ON; | ||
| 2132 | YY_BREAK | ||
| 2133 | case 40: | ||
| 2134 | YY_RULE_SETUP | ||
| 2135 | #line 132 "zconf.l" | ||
| 2136 | { | ||
| 2137 | str = yytext[0]; | ||
| 2138 | new_string(); | ||
| 2139 | BEGIN(STRING); | ||
| 2140 | } | ||
| 2141 | YY_BREAK | ||
| 2142 | case 41: | ||
| 2143 | YY_RULE_SETUP | ||
| 2144 | #line 137 "zconf.l" | ||
| 2145 | BEGIN(INITIAL); current_file->lineno++; return T_EOL; | ||
| 2146 | YY_BREAK | ||
| 2147 | case 42: | ||
| 2148 | YY_RULE_SETUP | ||
| 2149 | #line 138 "zconf.l" | ||
| 2150 | /* ignore */ | ||
| 2151 | YY_BREAK | ||
| 2152 | case 43: | ||
| 2153 | YY_RULE_SETUP | ||
| 2154 | #line 139 "zconf.l" | ||
| 2155 | { | ||
| 2156 | alloc_string(yytext, yyleng); | ||
| 2157 | zconflval.string = text; | ||
| 2158 | return T_WORD; | ||
| 2159 | } | ||
| 2160 | YY_BREAK | ||
| 2161 | case 44: | ||
| 2162 | YY_RULE_SETUP | ||
| 2163 | #line 144 "zconf.l" | ||
| 2164 | |||
| 2165 | YY_BREAK | ||
| 2166 | case YY_STATE_EOF(PARAM): | ||
| 2167 | #line 145 "zconf.l" | ||
| 2168 | { | ||
| 2169 | BEGIN(INITIAL); | ||
| 2170 | } | ||
| 2171 | YY_BREAK | ||
| 2172 | |||
| 2173 | |||
| 2174 | case 45: | ||
| 2175 | *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ | ||
| 2176 | yy_c_buf_p = yy_cp -= 1; | ||
| 2177 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | ||
| 2178 | YY_RULE_SETUP | ||
| 2179 | #line 151 "zconf.l" | ||
| 2180 | { | ||
| 2181 | append_string(yytext, yyleng); | ||
| 2182 | zconflval.string = text; | ||
| 2183 | return T_STRING; | ||
| 2184 | } | ||
| 2185 | YY_BREAK | ||
| 2186 | case 46: | ||
| 2187 | YY_RULE_SETUP | ||
| 2188 | #line 156 "zconf.l" | ||
| 2189 | { | ||
| 2190 | append_string(yytext, yyleng); | ||
| 2191 | } | ||
| 2192 | YY_BREAK | ||
| 2193 | case 47: | ||
| 2194 | *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ | ||
| 2195 | yy_c_buf_p = yy_cp -= 1; | ||
| 2196 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | ||
| 2197 | YY_RULE_SETUP | ||
| 2198 | #line 159 "zconf.l" | ||
| 2199 | { | ||
| 2200 | append_string(yytext+1, yyleng); | ||
| 2201 | zconflval.string = text; | ||
| 2202 | return T_STRING; | ||
| 2203 | } | ||
| 2204 | YY_BREAK | ||
| 2205 | case 48: | ||
| 2206 | YY_RULE_SETUP | ||
| 2207 | #line 164 "zconf.l" | ||
| 2208 | { | ||
| 2209 | append_string(yytext+1, yyleng - 1); | ||
| 2210 | } | ||
| 2211 | YY_BREAK | ||
| 2212 | case 49: | ||
| 2213 | YY_RULE_SETUP | ||
| 2214 | #line 167 "zconf.l" | ||
| 2215 | { | ||
| 2216 | if (str == yytext[0]) { | ||
| 2217 | BEGIN(PARAM); | ||
| 2218 | zconflval.string = text; | ||
| 2219 | return T_STRING; | ||
| 2220 | } else | ||
| 2221 | append_string(yytext, 1); | ||
| 2222 | } | ||
| 2223 | YY_BREAK | ||
| 2224 | case 50: | ||
| 2225 | YY_RULE_SETUP | ||
| 2226 | #line 175 "zconf.l" | ||
| 2227 | { | ||
| 2228 | printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno()); | ||
| 2229 | BEGIN(INITIAL); | ||
| 2230 | return T_EOL; | ||
| 2231 | } | ||
| 2232 | YY_BREAK | ||
| 2233 | case YY_STATE_EOF(STRING): | ||
| 2234 | #line 180 "zconf.l" | ||
| 2235 | { | ||
| 2236 | BEGIN(INITIAL); | ||
| 2237 | } | ||
| 2238 | YY_BREAK | ||
| 2239 | |||
| 2240 | |||
| 2241 | case 51: | ||
| 2242 | YY_RULE_SETUP | ||
| 2243 | #line 186 "zconf.l" | ||
| 2244 | { | ||
| 2245 | ts = 0; | ||
| 2246 | for (i = 0; i < yyleng; i++) { | ||
| 2247 | if (yytext[i] == '\t') | ||
| 2248 | ts = (ts & ~7) + 8; | ||
| 2249 | else | ||
| 2250 | ts++; | ||
| 2251 | } | ||
| 2252 | last_ts = ts; | ||
| 2253 | if (first_ts) { | ||
| 2254 | if (ts < first_ts) { | ||
| 2255 | zconf_endhelp(); | ||
| 2256 | return T_HELPTEXT; | ||
| 2257 | } | ||
| 2258 | ts -= first_ts; | ||
| 2259 | while (ts > 8) { | ||
| 2260 | append_string(" ", 8); | ||
| 2261 | ts -= 8; | ||
| 2262 | } | ||
| 2263 | append_string(" ", ts); | ||
| 2264 | } | ||
| 2265 | |||
| 2266 | } | ||
| 2267 | YY_BREAK | ||
| 2268 | case 52: | ||
| 2269 | *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ | ||
| 2270 | yy_c_buf_p = yy_cp = yy_bp + 1; | ||
| 2271 | YY_DO_BEFORE_ACTION; /* set up yytext again */ | ||
| 2272 | YY_RULE_SETUP | ||
| 2273 | #line 209 "zconf.l" | ||
| 2274 | { | ||
| 2275 | current_file->lineno++; | ||
| 2276 | zconf_endhelp(); | ||
| 2277 | return T_HELPTEXT; | ||
| 2278 | } | ||
| 2279 | YY_BREAK | ||
| 2280 | case 53: | ||
| 2281 | YY_RULE_SETUP | ||
| 2282 | #line 214 "zconf.l" | ||
| 2283 | { | ||
| 2284 | current_file->lineno++; | ||
| 2285 | append_string("\n", 1); | ||
| 2286 | } | ||
| 2287 | YY_BREAK | ||
| 2288 | case 54: | ||
| 2289 | YY_RULE_SETUP | ||
| 2290 | #line 218 "zconf.l" | ||
| 2291 | { | ||
| 2292 | append_string(yytext, yyleng); | ||
| 2293 | if (!first_ts) | ||
| 2294 | first_ts = last_ts; | ||
| 2295 | } | ||
| 2296 | YY_BREAK | ||
| 2297 | case YY_STATE_EOF(HELP): | ||
| 2298 | #line 223 "zconf.l" | ||
| 2299 | { | ||
| 2300 | zconf_endhelp(); | ||
| 2301 | return T_HELPTEXT; | ||
| 2302 | } | ||
| 2303 | YY_BREAK | ||
| 2304 | |||
| 2305 | case YY_STATE_EOF(INITIAL): | ||
| 2306 | case YY_STATE_EOF(COMMAND): | ||
| 2307 | #line 229 "zconf.l" | ||
| 2308 | { | ||
| 2309 | if (current_buf) { | ||
| 2310 | zconf_endfile(); | ||
| 2311 | return T_EOF; | ||
| 2312 | } | ||
| 2313 | fclose(yyin); | ||
| 2314 | yyterminate(); | ||
| 2315 | } | ||
| 2316 | YY_BREAK | ||
| 2317 | case 55: | ||
| 2318 | YY_RULE_SETUP | ||
| 2319 | #line 238 "zconf.l" | ||
| 2320 | YY_FATAL_ERROR( "flex scanner jammed" ); | ||
| 2321 | YY_BREAK | ||
| 2322 | #line 2323 "lex.zconf.c" | ||
| 2323 | |||
| 2324 | case YY_END_OF_BUFFER: | ||
| 2325 | { | ||
| 2326 | /* Amount of text matched not including the EOB char. */ | ||
| 2327 | int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; | ||
| 2328 | |||
| 2329 | /* Undo the effects of YY_DO_BEFORE_ACTION. */ | ||
| 2330 | *yy_cp = yy_hold_char; | ||
| 2331 | YY_RESTORE_YY_MORE_OFFSET | ||
| 2332 | |||
| 2333 | if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) | ||
| 2334 | { | ||
| 2335 | /* We're scanning a new file or input source. It's | ||
| 2336 | * possible that this happened because the user | ||
| 2337 | * just pointed yyin at a new source and called | ||
| 2338 | * yylex(). If so, then we have to assure | ||
| 2339 | * consistency between yy_current_buffer and our | ||
| 2340 | * globals. Here is the right place to do so, because | ||
| 2341 | * this is the first action (other than possibly a | ||
| 2342 | * back-up) that will match for the new input source. | ||
| 2343 | */ | ||
| 2344 | yy_n_chars = yy_current_buffer->yy_n_chars; | ||
| 2345 | yy_current_buffer->yy_input_file = yyin; | ||
| 2346 | yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; | ||
| 2347 | } | ||
| 2348 | |||
| 2349 | /* Note that here we test for yy_c_buf_p "<=" to the position | ||
| 2350 | * of the first EOB in the buffer, since yy_c_buf_p will | ||
| 2351 | * already have been incremented past the NUL character | ||
| 2352 | * (since all states make transitions on EOB to the | ||
| 2353 | * end-of-buffer state). Contrast this with the test | ||
| 2354 | * in input(). | ||
| 2355 | */ | ||
| 2356 | if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) | ||
| 2357 | { /* This was really a NUL. */ | ||
| 2358 | yy_state_type yy_next_state; | ||
| 2359 | |||
| 2360 | yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; | ||
| 2361 | |||
| 2362 | yy_current_state = yy_get_previous_state(); | ||
| 2363 | |||
| 2364 | /* Okay, we're now positioned to make the NUL | ||
| 2365 | * transition. We couldn't have | ||
| 2366 | * yy_get_previous_state() go ahead and do it | ||
| 2367 | * for us because it doesn't know how to deal | ||
| 2368 | * with the possibility of jamming (and we don't | ||
| 2369 | * want to build jamming into it because then it | ||
| 2370 | * will run more slowly). | ||
| 2371 | */ | ||
| 2372 | |||
| 2373 | yy_next_state = yy_try_NUL_trans( yy_current_state ); | ||
| 2374 | |||
| 2375 | yy_bp = yytext_ptr + YY_MORE_ADJ; | ||
| 2376 | |||
| 2377 | if ( yy_next_state ) | ||
| 2378 | { | ||
| 2379 | /* Consume the NUL. */ | ||
| 2380 | yy_cp = ++yy_c_buf_p; | ||
| 2381 | yy_current_state = yy_next_state; | ||
| 2382 | goto yy_match; | ||
| 2383 | } | ||
| 2384 | |||
| 2385 | else | ||
| 2386 | { | ||
| 2387 | yy_cp = yy_c_buf_p; | ||
| 2388 | goto yy_find_action; | ||
| 2389 | } | ||
| 2390 | } | ||
| 2391 | |||
| 2392 | else switch ( yy_get_next_buffer() ) | ||
| 2393 | { | ||
| 2394 | case EOB_ACT_END_OF_FILE: | ||
| 2395 | { | ||
| 2396 | yy_did_buffer_switch_on_eof = 0; | ||
| 2397 | |||
| 2398 | if ( yywrap() ) | ||
| 2399 | { | ||
| 2400 | /* Note: because we've taken care in | ||
| 2401 | * yy_get_next_buffer() to have set up | ||
| 2402 | * yytext, we can now set up | ||
| 2403 | * yy_c_buf_p so that if some total | ||
| 2404 | * hoser (like flex itself) wants to | ||
| 2405 | * call the scanner after we return the | ||
| 2406 | * YY_NULL, it'll still work - another | ||
| 2407 | * YY_NULL will get returned. | ||
| 2408 | */ | ||
| 2409 | yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; | ||
| 2410 | |||
| 2411 | yy_act = YY_STATE_EOF(YY_START); | ||
| 2412 | goto do_action; | ||
| 2413 | } | ||
| 2414 | |||
| 2415 | else | ||
| 2416 | { | ||
| 2417 | if ( ! yy_did_buffer_switch_on_eof ) | ||
| 2418 | YY_NEW_FILE; | ||
| 2419 | } | ||
| 2420 | break; | ||
| 2421 | } | ||
| 2422 | |||
| 2423 | case EOB_ACT_CONTINUE_SCAN: | ||
| 2424 | yy_c_buf_p = | ||
| 2425 | yytext_ptr + yy_amount_of_matched_text; | ||
| 2426 | |||
| 2427 | yy_current_state = yy_get_previous_state(); | ||
| 2428 | |||
| 2429 | yy_cp = yy_c_buf_p; | ||
| 2430 | yy_bp = yytext_ptr + YY_MORE_ADJ; | ||
| 2431 | goto yy_match; | ||
| 2432 | |||
| 2433 | case EOB_ACT_LAST_MATCH: | ||
| 2434 | yy_c_buf_p = | ||
| 2435 | &yy_current_buffer->yy_ch_buf[yy_n_chars]; | ||
| 2436 | |||
| 2437 | yy_current_state = yy_get_previous_state(); | ||
| 2438 | |||
| 2439 | yy_cp = yy_c_buf_p; | ||
| 2440 | yy_bp = yytext_ptr + YY_MORE_ADJ; | ||
| 2441 | goto yy_find_action; | ||
| 2442 | } | ||
| 2443 | break; | ||
| 2444 | } | ||
| 2445 | |||
| 2446 | default: | ||
| 2447 | YY_FATAL_ERROR( | ||
| 2448 | "fatal flex scanner internal error--no action found" ); | ||
| 2449 | } /* end of action switch */ | ||
| 2450 | } /* end of scanning one token */ | ||
| 2451 | } /* end of yylex */ | ||
| 2452 | |||
| 2453 | |||
| 2454 | /* yy_get_next_buffer - try to read in a new buffer | ||
| 2455 | * | ||
| 2456 | * Returns a code representing an action: | ||
| 2457 | * EOB_ACT_LAST_MATCH - | ||
| 2458 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position | ||
| 2459 | * EOB_ACT_END_OF_FILE - end of file | ||
| 2460 | */ | ||
| 2461 | |||
| 2462 | static int yy_get_next_buffer() | ||
| 2463 | { | ||
| 2464 | register char *dest = yy_current_buffer->yy_ch_buf; | ||
| 2465 | register char *source = yytext_ptr; | ||
| 2466 | register int number_to_move, i; | ||
| 2467 | int ret_val; | ||
| 2468 | |||
| 2469 | if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) | ||
| 2470 | YY_FATAL_ERROR( | ||
| 2471 | "fatal flex scanner internal error--end of buffer missed" ); | ||
| 2472 | |||
| 2473 | if ( yy_current_buffer->yy_fill_buffer == 0 ) | ||
| 2474 | { /* Don't try to fill the buffer, so this is an EOF. */ | ||
| 2475 | if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) | ||
| 2476 | { | ||
| 2477 | /* We matched a single character, the EOB, so | ||
| 2478 | * treat this as a final EOF. | ||
| 2479 | */ | ||
| 2480 | return EOB_ACT_END_OF_FILE; | ||
| 2481 | } | ||
| 2482 | |||
| 2483 | else | ||
| 2484 | { | ||
| 2485 | /* We matched some text prior to the EOB, first | ||
| 2486 | * process it. | ||
| 2487 | */ | ||
| 2488 | return EOB_ACT_LAST_MATCH; | ||
| 2489 | } | ||
| 2490 | } | ||
| 2491 | |||
| 2492 | /* Try to read more data. */ | ||
| 2493 | |||
| 2494 | /* First move last chars to start of buffer. */ | ||
| 2495 | number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; | ||
| 2496 | |||
| 2497 | for ( i = 0; i < number_to_move; ++i ) | ||
| 2498 | *(dest++) = *(source++); | ||
| 2499 | |||
| 2500 | if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) | ||
| 2501 | /* don't do the read, it's not guaranteed to return an EOF, | ||
| 2502 | * just force an EOF | ||
| 2503 | */ | ||
| 2504 | yy_current_buffer->yy_n_chars = yy_n_chars = 0; | ||
| 2505 | |||
| 2506 | else | ||
| 2507 | { | ||
| 2508 | int num_to_read = | ||
| 2509 | yy_current_buffer->yy_buf_size - number_to_move - 1; | ||
| 2510 | |||
| 2511 | while ( num_to_read <= 0 ) | ||
| 2512 | { /* Not enough room in the buffer - grow it. */ | ||
| 2513 | #ifdef YY_USES_REJECT | ||
| 2514 | YY_FATAL_ERROR( | ||
| 2515 | "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); | ||
| 2516 | #else | ||
| 2517 | |||
| 2518 | /* just a shorter name for the current buffer */ | ||
| 2519 | YY_BUFFER_STATE b = yy_current_buffer; | ||
| 2520 | |||
| 2521 | int yy_c_buf_p_offset = | ||
| 2522 | (int) (yy_c_buf_p - b->yy_ch_buf); | ||
| 2523 | |||
| 2524 | if ( b->yy_is_our_buffer ) | ||
| 2525 | { | ||
| 2526 | int new_size = b->yy_buf_size * 2; | ||
| 2527 | |||
| 2528 | if ( new_size <= 0 ) | ||
| 2529 | b->yy_buf_size += b->yy_buf_size / 8; | ||
| 2530 | else | ||
| 2531 | b->yy_buf_size *= 2; | ||
| 2532 | |||
| 2533 | b->yy_ch_buf = (char *) | ||
| 2534 | /* Include room in for 2 EOB chars. */ | ||
| 2535 | yy_flex_realloc( (void *) b->yy_ch_buf, | ||
| 2536 | b->yy_buf_size + 2 ); | ||
| 2537 | } | ||
| 2538 | else | ||
| 2539 | /* Can't grow it, we don't own it. */ | ||
| 2540 | b->yy_ch_buf = 0; | ||
| 2541 | |||
| 2542 | if ( ! b->yy_ch_buf ) | ||
| 2543 | YY_FATAL_ERROR( | ||
| 2544 | "fatal error - scanner input buffer overflow" ); | ||
| 2545 | |||
| 2546 | yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; | ||
| 2547 | |||
| 2548 | num_to_read = yy_current_buffer->yy_buf_size - | ||
| 2549 | number_to_move - 1; | ||
| 2550 | #endif | ||
| 2551 | } | ||
| 2552 | |||
| 2553 | if ( num_to_read > YY_READ_BUF_SIZE ) | ||
| 2554 | num_to_read = YY_READ_BUF_SIZE; | ||
| 2555 | |||
| 2556 | /* Read in more data. */ | ||
| 2557 | YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), | ||
| 2558 | yy_n_chars, num_to_read ); | ||
| 2559 | |||
| 2560 | yy_current_buffer->yy_n_chars = yy_n_chars; | ||
| 2561 | } | ||
| 2562 | |||
| 2563 | if ( yy_n_chars == 0 ) | ||
| 2564 | { | ||
| 2565 | if ( number_to_move == YY_MORE_ADJ ) | ||
| 2566 | { | ||
| 2567 | ret_val = EOB_ACT_END_OF_FILE; | ||
| 2568 | yyrestart( yyin ); | ||
| 2569 | } | ||
| 2570 | |||
| 2571 | else | ||
| 2572 | { | ||
| 2573 | ret_val = EOB_ACT_LAST_MATCH; | ||
| 2574 | yy_current_buffer->yy_buffer_status = | ||
| 2575 | YY_BUFFER_EOF_PENDING; | ||
| 2576 | } | ||
| 2577 | } | ||
| 2578 | |||
| 2579 | else | ||
| 2580 | ret_val = EOB_ACT_CONTINUE_SCAN; | ||
| 2581 | |||
| 2582 | yy_n_chars += number_to_move; | ||
| 2583 | yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; | ||
| 2584 | yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; | ||
| 2585 | |||
| 2586 | yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; | ||
| 2587 | |||
| 2588 | return ret_val; | ||
| 2589 | } | ||
| 2590 | |||
| 2591 | |||
| 2592 | /* yy_get_previous_state - get the state just before the EOB char was reached */ | ||
| 2593 | |||
| 2594 | static yy_state_type yy_get_previous_state() | ||
| 2595 | { | ||
| 2596 | register yy_state_type yy_current_state; | ||
| 2597 | register char *yy_cp; | ||
| 2598 | |||
| 2599 | yy_current_state = yy_start; | ||
| 2600 | |||
| 2601 | for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) | ||
| 2602 | { | ||
| 2603 | yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)]; | ||
| 2604 | } | ||
| 2605 | |||
| 2606 | return yy_current_state; | ||
| 2607 | } | ||
| 2608 | |||
| 2609 | |||
| 2610 | /* yy_try_NUL_trans - try to make a transition on the NUL character | ||
| 2611 | * | ||
| 2612 | * synopsis | ||
| 2613 | * next_state = yy_try_NUL_trans( current_state ); | ||
| 2614 | */ | ||
| 2615 | |||
| 2616 | #ifdef YY_USE_PROTOS | ||
| 2617 | static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) | ||
| 2618 | #else | ||
| 2619 | static yy_state_type yy_try_NUL_trans( yy_current_state ) | ||
| 2620 | yy_state_type yy_current_state; | ||
| 2621 | #endif | ||
| 2622 | { | ||
| 2623 | register int yy_is_jam; | ||
| 2624 | |||
| 2625 | yy_current_state = yy_nxt[yy_current_state][1]; | ||
| 2626 | yy_is_jam = (yy_current_state <= 0); | ||
| 2627 | |||
| 2628 | return yy_is_jam ? 0 : yy_current_state; | ||
| 2629 | } | ||
| 2630 | |||
| 2631 | |||
| 2632 | #ifndef YY_NO_UNPUT | ||
| 2633 | #ifdef YY_USE_PROTOS | ||
| 2634 | static void yyunput( int c, register char *yy_bp ) | ||
| 2635 | #else | ||
| 2636 | static void yyunput( c, yy_bp ) | ||
| 2637 | int c; | ||
| 2638 | register char *yy_bp; | ||
| 2639 | #endif | ||
| 2640 | { | ||
| 2641 | register char *yy_cp = yy_c_buf_p; | ||
| 2642 | |||
| 2643 | /* undo effects of setting up yytext */ | ||
| 2644 | *yy_cp = yy_hold_char; | ||
| 2645 | |||
| 2646 | if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) | ||
| 2647 | { /* need to shift things up to make room */ | ||
| 2648 | /* +2 for EOB chars. */ | ||
| 2649 | register int number_to_move = yy_n_chars + 2; | ||
| 2650 | register char *dest = &yy_current_buffer->yy_ch_buf[ | ||
| 2651 | yy_current_buffer->yy_buf_size + 2]; | ||
| 2652 | register char *source = | ||
| 2653 | &yy_current_buffer->yy_ch_buf[number_to_move]; | ||
| 2654 | |||
| 2655 | while ( source > yy_current_buffer->yy_ch_buf ) | ||
| 2656 | *--dest = *--source; | ||
| 2657 | |||
| 2658 | yy_cp += (int) (dest - source); | ||
| 2659 | yy_bp += (int) (dest - source); | ||
| 2660 | yy_current_buffer->yy_n_chars = | ||
| 2661 | yy_n_chars = yy_current_buffer->yy_buf_size; | ||
| 2662 | |||
| 2663 | if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) | ||
| 2664 | YY_FATAL_ERROR( "flex scanner push-back overflow" ); | ||
| 2665 | } | ||
| 2666 | |||
| 2667 | *--yy_cp = (char) c; | ||
| 2668 | |||
| 2669 | |||
| 2670 | yytext_ptr = yy_bp; | ||
| 2671 | yy_hold_char = *yy_cp; | ||
| 2672 | yy_c_buf_p = yy_cp; | ||
| 2673 | } | ||
| 2674 | #endif /* ifndef YY_NO_UNPUT */ | ||
| 2675 | |||
| 2676 | |||
| 2677 | #ifdef __cplusplus | ||
| 2678 | static int yyinput() | ||
| 2679 | #else | ||
| 2680 | static int input() | ||
| 2681 | #endif | ||
| 2682 | { | ||
| 2683 | int c; | ||
| 2684 | |||
| 2685 | *yy_c_buf_p = yy_hold_char; | ||
| 2686 | |||
| 2687 | if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) | ||
| 2688 | { | ||
| 2689 | /* yy_c_buf_p now points to the character we want to return. | ||
| 2690 | * If this occurs *before* the EOB characters, then it's a | ||
| 2691 | * valid NUL; if not, then we've hit the end of the buffer. | ||
| 2692 | */ | ||
| 2693 | if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) | ||
| 2694 | /* This was really a NUL. */ | ||
| 2695 | *yy_c_buf_p = '\0'; | ||
| 2696 | |||
| 2697 | else | ||
| 2698 | { /* need more input */ | ||
| 2699 | int offset = yy_c_buf_p - yytext_ptr; | ||
| 2700 | ++yy_c_buf_p; | ||
| 2701 | |||
| 2702 | switch ( yy_get_next_buffer() ) | ||
| 2703 | { | ||
| 2704 | case EOB_ACT_LAST_MATCH: | ||
| 2705 | /* This happens because yy_g_n_b() | ||
| 2706 | * sees that we've accumulated a | ||
| 2707 | * token and flags that we need to | ||
| 2708 | * try matching the token before | ||
| 2709 | * proceeding. But for input(), | ||
| 2710 | * there's no matching to consider. | ||
| 2711 | * So convert the EOB_ACT_LAST_MATCH | ||
| 2712 | * to EOB_ACT_END_OF_FILE. | ||
| 2713 | */ | ||
| 2714 | |||
| 2715 | /* Reset buffer status. */ | ||
| 2716 | yyrestart( yyin ); | ||
| 2717 | |||
| 2718 | /* fall through */ | ||
| 2719 | |||
| 2720 | case EOB_ACT_END_OF_FILE: | ||
| 2721 | { | ||
| 2722 | if ( yywrap() ) | ||
| 2723 | return EOF; | ||
| 2724 | |||
| 2725 | if ( ! yy_did_buffer_switch_on_eof ) | ||
| 2726 | YY_NEW_FILE; | ||
| 2727 | #ifdef __cplusplus | ||
| 2728 | return yyinput(); | ||
| 2729 | #else | ||
| 2730 | return input(); | ||
| 2731 | #endif | ||
| 2732 | } | ||
| 2733 | |||
| 2734 | case EOB_ACT_CONTINUE_SCAN: | ||
| 2735 | yy_c_buf_p = yytext_ptr + offset; | ||
| 2736 | break; | ||
| 2737 | } | ||
| 2738 | } | ||
| 2739 | } | ||
| 2740 | |||
| 2741 | c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ | ||
| 2742 | *yy_c_buf_p = '\0'; /* preserve yytext */ | ||
| 2743 | yy_hold_char = *++yy_c_buf_p; | ||
| 2744 | |||
| 2745 | |||
| 2746 | return c; | ||
| 2747 | } | ||
| 2748 | |||
| 2749 | |||
| 2750 | #ifdef YY_USE_PROTOS | ||
| 2751 | void yyrestart( FILE *input_file ) | ||
| 2752 | #else | ||
| 2753 | void yyrestart( input_file ) | ||
| 2754 | FILE *input_file; | ||
| 2755 | #endif | ||
| 2756 | { | ||
| 2757 | if ( ! yy_current_buffer ) | ||
| 2758 | yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); | ||
| 2759 | |||
| 2760 | yy_init_buffer( yy_current_buffer, input_file ); | ||
| 2761 | yy_load_buffer_state(); | ||
| 2762 | } | ||
| 2763 | |||
| 2764 | |||
| 2765 | #ifdef YY_USE_PROTOS | ||
| 2766 | void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) | ||
| 2767 | #else | ||
| 2768 | void yy_switch_to_buffer( new_buffer ) | ||
| 2769 | YY_BUFFER_STATE new_buffer; | ||
| 2770 | #endif | ||
| 2771 | { | ||
| 2772 | if ( yy_current_buffer == new_buffer ) | ||
| 2773 | return; | ||
| 2774 | |||
| 2775 | if ( yy_current_buffer ) | ||
| 2776 | { | ||
| 2777 | /* Flush out information for old buffer. */ | ||
| 2778 | *yy_c_buf_p = yy_hold_char; | ||
| 2779 | yy_current_buffer->yy_buf_pos = yy_c_buf_p; | ||
| 2780 | yy_current_buffer->yy_n_chars = yy_n_chars; | ||
| 2781 | } | ||
| 2782 | |||
| 2783 | yy_current_buffer = new_buffer; | ||
| 2784 | yy_load_buffer_state(); | ||
| 2785 | |||
| 2786 | /* We don't actually know whether we did this switch during | ||
| 2787 | * EOF (yywrap()) processing, but the only time this flag | ||
| 2788 | * is looked at is after yywrap() is called, so it's safe | ||
| 2789 | * to go ahead and always set it. | ||
| 2790 | */ | ||
| 2791 | yy_did_buffer_switch_on_eof = 1; | ||
| 2792 | } | ||
| 2793 | |||
| 2794 | |||
| 2795 | #ifdef YY_USE_PROTOS | ||
| 2796 | void yy_load_buffer_state( void ) | ||
| 2797 | #else | ||
| 2798 | void yy_load_buffer_state() | ||
| 2799 | #endif | ||
| 2800 | { | ||
| 2801 | yy_n_chars = yy_current_buffer->yy_n_chars; | ||
| 2802 | yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; | ||
| 2803 | yyin = yy_current_buffer->yy_input_file; | ||
| 2804 | yy_hold_char = *yy_c_buf_p; | ||
| 2805 | } | ||
| 2806 | |||
| 2807 | |||
| 2808 | #ifdef YY_USE_PROTOS | ||
| 2809 | YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) | ||
| 2810 | #else | ||
| 2811 | YY_BUFFER_STATE yy_create_buffer( file, size ) | ||
| 2812 | FILE *file; | ||
| 2813 | int size; | ||
| 2814 | #endif | ||
| 2815 | { | ||
| 2816 | YY_BUFFER_STATE b; | ||
| 2817 | |||
| 2818 | b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); | ||
| 2819 | if ( ! b ) | ||
| 2820 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); | ||
| 2821 | |||
| 2822 | b->yy_buf_size = size; | ||
| 2823 | |||
| 2824 | /* yy_ch_buf has to be 2 characters longer than the size given because | ||
| 2825 | * we need to put in 2 end-of-buffer characters. | ||
| 2826 | */ | ||
| 2827 | b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); | ||
| 2828 | if ( ! b->yy_ch_buf ) | ||
| 2829 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); | ||
| 2830 | |||
| 2831 | b->yy_is_our_buffer = 1; | ||
| 2832 | |||
| 2833 | yy_init_buffer( b, file ); | ||
| 2834 | |||
| 2835 | return b; | ||
| 2836 | } | ||
| 2837 | |||
| 2838 | |||
| 2839 | #ifdef YY_USE_PROTOS | ||
| 2840 | void yy_delete_buffer( YY_BUFFER_STATE b ) | ||
| 2841 | #else | ||
| 2842 | void yy_delete_buffer( b ) | ||
| 2843 | YY_BUFFER_STATE b; | ||
| 2844 | #endif | ||
| 2845 | { | ||
| 2846 | if ( ! b ) | ||
| 2847 | return; | ||
| 2848 | |||
| 2849 | if ( b == yy_current_buffer ) | ||
| 2850 | yy_current_buffer = (YY_BUFFER_STATE) 0; | ||
| 2851 | |||
| 2852 | if ( b->yy_is_our_buffer ) | ||
| 2853 | yy_flex_free( (void *) b->yy_ch_buf ); | ||
| 2854 | |||
| 2855 | yy_flex_free( (void *) b ); | ||
| 2856 | } | ||
| 2857 | |||
| 2858 | |||
| 2859 | #ifndef _WIN32 | ||
| 2860 | #include <unistd.h> | ||
| 2861 | #else | ||
| 2862 | #ifndef YY_ALWAYS_INTERACTIVE | ||
| 2863 | #ifndef YY_NEVER_INTERACTIVE | ||
| 2864 | extern int isatty YY_PROTO(( int )); | ||
| 2865 | #endif | ||
| 2866 | #endif | ||
| 2867 | #endif | ||
| 2868 | |||
| 2869 | #ifdef YY_USE_PROTOS | ||
| 2870 | void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) | ||
| 2871 | #else | ||
| 2872 | void yy_init_buffer( b, file ) | ||
| 2873 | YY_BUFFER_STATE b; | ||
| 2874 | FILE *file; | ||
| 2875 | #endif | ||
| 2876 | |||
| 2877 | |||
| 2878 | { | ||
| 2879 | yy_flush_buffer( b ); | ||
| 2880 | |||
| 2881 | b->yy_input_file = file; | ||
| 2882 | b->yy_fill_buffer = 1; | ||
| 2883 | |||
| 2884 | #if YY_ALWAYS_INTERACTIVE | ||
| 2885 | b->yy_is_interactive = 1; | ||
| 2886 | #else | ||
| 2887 | #if YY_NEVER_INTERACTIVE | ||
| 2888 | b->yy_is_interactive = 0; | ||
| 2889 | #else | ||
| 2890 | b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; | ||
| 2891 | #endif | ||
| 2892 | #endif | ||
| 2893 | } | ||
| 2894 | |||
| 2895 | |||
| 2896 | #ifdef YY_USE_PROTOS | ||
| 2897 | void yy_flush_buffer( YY_BUFFER_STATE b ) | ||
| 2898 | #else | ||
| 2899 | void yy_flush_buffer( b ) | ||
| 2900 | YY_BUFFER_STATE b; | ||
| 2901 | #endif | ||
| 2902 | |||
| 2903 | { | ||
| 2904 | if ( ! b ) | ||
| 2905 | return; | ||
| 2906 | |||
| 2907 | b->yy_n_chars = 0; | ||
| 2908 | |||
| 2909 | /* We always need two end-of-buffer characters. The first causes | ||
| 2910 | * a transition to the end-of-buffer state. The second causes | ||
| 2911 | * a jam in that state. | ||
| 2912 | */ | ||
| 2913 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; | ||
| 2914 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; | ||
| 2915 | |||
| 2916 | b->yy_buf_pos = &b->yy_ch_buf[0]; | ||
| 2917 | |||
| 2918 | b->yy_at_bol = 1; | ||
| 2919 | b->yy_buffer_status = YY_BUFFER_NEW; | ||
| 2920 | |||
| 2921 | if ( b == yy_current_buffer ) | ||
| 2922 | yy_load_buffer_state(); | ||
| 2923 | } | ||
| 2924 | |||
| 2925 | |||
| 2926 | #ifndef YY_NO_SCAN_BUFFER | ||
| 2927 | #ifdef YY_USE_PROTOS | ||
| 2928 | YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) | ||
| 2929 | #else | ||
| 2930 | YY_BUFFER_STATE yy_scan_buffer( base, size ) | ||
| 2931 | char *base; | ||
| 2932 | yy_size_t size; | ||
| 2933 | #endif | ||
| 2934 | { | ||
| 2935 | YY_BUFFER_STATE b; | ||
| 2936 | |||
| 2937 | if ( size < 2 || | ||
| 2938 | base[size-2] != YY_END_OF_BUFFER_CHAR || | ||
| 2939 | base[size-1] != YY_END_OF_BUFFER_CHAR ) | ||
| 2940 | /* They forgot to leave room for the EOB's. */ | ||
| 2941 | return 0; | ||
| 2942 | |||
| 2943 | b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); | ||
| 2944 | if ( ! b ) | ||
| 2945 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); | ||
| 2946 | |||
| 2947 | b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ | ||
| 2948 | b->yy_buf_pos = b->yy_ch_buf = base; | ||
| 2949 | b->yy_is_our_buffer = 0; | ||
| 2950 | b->yy_input_file = 0; | ||
| 2951 | b->yy_n_chars = b->yy_buf_size; | ||
| 2952 | b->yy_is_interactive = 0; | ||
| 2953 | b->yy_at_bol = 1; | ||
| 2954 | b->yy_fill_buffer = 0; | ||
| 2955 | b->yy_buffer_status = YY_BUFFER_NEW; | ||
| 2956 | |||
| 2957 | yy_switch_to_buffer( b ); | ||
| 2958 | |||
| 2959 | return b; | ||
| 2960 | } | ||
| 2961 | #endif | ||
| 2962 | |||
| 2963 | |||
| 2964 | #ifndef YY_NO_SCAN_STRING | ||
| 2965 | #ifdef YY_USE_PROTOS | ||
| 2966 | YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) | ||
| 2967 | #else | ||
| 2968 | YY_BUFFER_STATE yy_scan_string( yy_str ) | ||
| 2969 | yyconst char *yy_str; | ||
| 2970 | #endif | ||
| 2971 | { | ||
| 2972 | int len; | ||
| 2973 | for ( len = 0; yy_str[len]; ++len ) | ||
| 2974 | ; | ||
| 2975 | |||
| 2976 | return yy_scan_bytes( yy_str, len ); | ||
| 2977 | } | ||
| 2978 | #endif | ||
| 2979 | |||
| 2980 | |||
| 2981 | #ifndef YY_NO_SCAN_BYTES | ||
| 2982 | #ifdef YY_USE_PROTOS | ||
| 2983 | YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) | ||
| 2984 | #else | ||
| 2985 | YY_BUFFER_STATE yy_scan_bytes( bytes, len ) | ||
| 2986 | yyconst char *bytes; | ||
| 2987 | int len; | ||
| 2988 | #endif | ||
| 2989 | { | ||
| 2990 | YY_BUFFER_STATE b; | ||
| 2991 | char *buf; | ||
| 2992 | yy_size_t n; | ||
| 2993 | int i; | ||
| 2994 | |||
| 2995 | /* Get memory for full buffer, including space for trailing EOB's. */ | ||
| 2996 | n = len + 2; | ||
| 2997 | buf = (char *) yy_flex_alloc( n ); | ||
| 2998 | if ( ! buf ) | ||
| 2999 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); | ||
| 3000 | |||
| 3001 | for ( i = 0; i < len; ++i ) | ||
| 3002 | buf[i] = bytes[i]; | ||
| 3003 | |||
| 3004 | buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; | ||
| 3005 | |||
| 3006 | b = yy_scan_buffer( buf, n ); | ||
| 3007 | if ( ! b ) | ||
| 3008 | YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); | ||
| 3009 | |||
| 3010 | /* It's okay to grow etc. this buffer, and we should throw it | ||
| 3011 | * away when we're done. | ||
| 3012 | */ | ||
| 3013 | b->yy_is_our_buffer = 1; | ||
| 3014 | |||
| 3015 | return b; | ||
| 3016 | } | ||
| 3017 | #endif | ||
| 3018 | |||
| 3019 | |||
| 3020 | #ifndef YY_NO_PUSH_STATE | ||
| 3021 | #ifdef YY_USE_PROTOS | ||
| 3022 | static void yy_push_state( int new_state ) | ||
| 3023 | #else | ||
| 3024 | static void yy_push_state( new_state ) | ||
| 3025 | int new_state; | ||
| 3026 | #endif | ||
| 3027 | { | ||
| 3028 | if ( yy_start_stack_ptr >= yy_start_stack_depth ) | ||
| 3029 | { | ||
| 3030 | yy_size_t new_size; | ||
| 3031 | |||
| 3032 | yy_start_stack_depth += YY_START_STACK_INCR; | ||
| 3033 | new_size = yy_start_stack_depth * sizeof( int ); | ||
| 3034 | |||
| 3035 | if ( ! yy_start_stack ) | ||
| 3036 | yy_start_stack = (int *) yy_flex_alloc( new_size ); | ||
| 3037 | |||
| 3038 | else | ||
| 3039 | yy_start_stack = (int *) yy_flex_realloc( | ||
| 3040 | (void *) yy_start_stack, new_size ); | ||
| 3041 | |||
| 3042 | if ( ! yy_start_stack ) | ||
| 3043 | YY_FATAL_ERROR( | ||
| 3044 | "out of memory expanding start-condition stack" ); | ||
| 3045 | } | ||
| 3046 | |||
| 3047 | yy_start_stack[yy_start_stack_ptr++] = YY_START; | ||
| 3048 | |||
| 3049 | BEGIN(new_state); | ||
| 3050 | } | ||
| 3051 | #endif | ||
| 3052 | |||
| 3053 | |||
| 3054 | #ifndef YY_NO_POP_STATE | ||
| 3055 | static void yy_pop_state() | ||
| 3056 | { | ||
| 3057 | if ( --yy_start_stack_ptr < 0 ) | ||
| 3058 | YY_FATAL_ERROR( "start-condition stack underflow" ); | ||
| 3059 | |||
| 3060 | BEGIN(yy_start_stack[yy_start_stack_ptr]); | ||
| 3061 | } | ||
| 3062 | #endif | ||
| 3063 | |||
| 3064 | |||
| 3065 | #ifndef YY_NO_TOP_STATE | ||
| 3066 | static int yy_top_state() | ||
| 3067 | { | ||
| 3068 | return yy_start_stack[yy_start_stack_ptr - 1]; | ||
| 3069 | } | ||
| 3070 | #endif | ||
| 3071 | |||
| 3072 | #ifndef YY_EXIT_FAILURE | ||
| 3073 | #define YY_EXIT_FAILURE 2 | ||
| 3074 | #endif | ||
| 3075 | |||
| 3076 | #ifdef YY_USE_PROTOS | ||
| 3077 | static void yy_fatal_error( yyconst char msg[] ) | ||
| 3078 | #else | ||
| 3079 | static void yy_fatal_error( msg ) | ||
| 3080 | char msg[]; | ||
| 3081 | #endif | ||
| 3082 | { | ||
| 3083 | (void) fprintf( stderr, "%s\n", msg ); | ||
| 3084 | exit( YY_EXIT_FAILURE ); | ||
| 3085 | } | ||
| 3086 | |||
| 3087 | |||
| 3088 | |||
| 3089 | /* Redefine yyless() so it works in section 3 code. */ | ||
| 3090 | |||
| 3091 | #undef yyless | ||
| 3092 | #define yyless(n) \ | ||
| 3093 | do \ | ||
| 3094 | { \ | ||
| 3095 | /* Undo effects of setting up yytext. */ \ | ||
| 3096 | yytext[yyleng] = yy_hold_char; \ | ||
| 3097 | yy_c_buf_p = yytext + n; \ | ||
| 3098 | yy_hold_char = *yy_c_buf_p; \ | ||
| 3099 | *yy_c_buf_p = '\0'; \ | ||
| 3100 | yyleng = n; \ | ||
| 3101 | } \ | ||
| 3102 | while ( 0 ) | ||
| 3103 | |||
| 3104 | |||
| 3105 | /* Internal utility routines. */ | ||
| 3106 | |||
| 3107 | #ifndef yytext_ptr | ||
| 3108 | #ifdef YY_USE_PROTOS | ||
| 3109 | static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) | ||
| 3110 | #else | ||
| 3111 | static void yy_flex_strncpy( s1, s2, n ) | ||
| 3112 | char *s1; | ||
| 3113 | yyconst char *s2; | ||
| 3114 | int n; | ||
| 3115 | #endif | ||
| 3116 | { | ||
| 3117 | register int i; | ||
| 3118 | for ( i = 0; i < n; ++i ) | ||
| 3119 | s1[i] = s2[i]; | ||
| 3120 | } | ||
| 3121 | #endif | ||
| 3122 | |||
| 3123 | #ifdef YY_NEED_STRLEN | ||
| 3124 | #ifdef YY_USE_PROTOS | ||
| 3125 | static int yy_flex_strlen( yyconst char *s ) | ||
| 3126 | #else | ||
| 3127 | static int yy_flex_strlen( s ) | ||
| 3128 | yyconst char *s; | ||
| 3129 | #endif | ||
| 3130 | { | ||
| 3131 | register int n; | ||
| 3132 | for ( n = 0; s[n]; ++n ) | ||
| 3133 | ; | ||
| 3134 | |||
| 3135 | return n; | ||
| 3136 | } | ||
| 3137 | #endif | ||
| 3138 | |||
| 3139 | |||
| 3140 | #ifdef YY_USE_PROTOS | ||
| 3141 | static void *yy_flex_alloc( yy_size_t size ) | ||
| 3142 | #else | ||
| 3143 | static void *yy_flex_alloc( size ) | ||
| 3144 | yy_size_t size; | ||
| 3145 | #endif | ||
| 3146 | { | ||
| 3147 | return (void *) malloc( size ); | ||
| 3148 | } | ||
| 3149 | |||
| 3150 | #ifdef YY_USE_PROTOS | ||
| 3151 | static void *yy_flex_realloc( void *ptr, yy_size_t size ) | ||
| 3152 | #else | ||
| 3153 | static void *yy_flex_realloc( ptr, size ) | ||
| 3154 | void *ptr; | ||
| 3155 | yy_size_t size; | ||
| 3156 | #endif | ||
| 3157 | { | ||
| 3158 | /* The cast to (char *) in the following accommodates both | ||
| 3159 | * implementations that use char* generic pointers, and those | ||
| 3160 | * that use void* generic pointers. It works with the latter | ||
| 3161 | * because both ANSI C and C++ allow castless assignment from | ||
| 3162 | * any pointer type to void*, and deal with argument conversions | ||
| 3163 | * as though doing an assignment. | ||
| 3164 | */ | ||
| 3165 | return (void *) realloc( (char *) ptr, size ); | ||
| 3166 | } | ||
| 3167 | |||
| 3168 | #ifdef YY_USE_PROTOS | ||
| 3169 | static void yy_flex_free( void *ptr ) | ||
| 3170 | #else | ||
| 3171 | static void yy_flex_free( ptr ) | ||
| 3172 | void *ptr; | ||
| 3173 | #endif | ||
| 3174 | { | ||
| 3175 | free( ptr ); | ||
| 3176 | } | ||
| 3177 | |||
| 3178 | #if YY_MAIN | ||
| 3179 | int main() | ||
| 3180 | { | ||
| 3181 | yylex(); | ||
| 3182 | return 0; | ||
| 3183 | } | ||
| 3184 | #endif | ||
| 3185 | #line 238 "zconf.l" | ||
| 3186 | |||
| 3187 | void zconf_starthelp(void) | ||
| 3188 | { | ||
| 3189 | new_string(); | ||
| 3190 | last_ts = first_ts = 0; | ||
| 3191 | BEGIN(HELP); | ||
| 3192 | } | ||
| 3193 | |||
| 3194 | static void zconf_endhelp(void) | ||
| 3195 | { | ||
| 3196 | zconflval.string = text; | ||
| 3197 | BEGIN(INITIAL); | ||
| 3198 | } | ||
| 3199 | |||
| 3200 | void zconf_initscan(const char *name) | ||
| 3201 | { | ||
| 3202 | yyin = fopen(name, "r"); | ||
| 3203 | if (!yyin) { | ||
| 3204 | printf("can't find file %s\n", name); | ||
| 3205 | exit(1); | ||
| 3206 | } | ||
| 3207 | |||
| 3208 | current_buf = malloc(sizeof(*current_buf)); | ||
| 3209 | memset(current_buf, 0, sizeof(*current_buf)); | ||
| 3210 | |||
| 3211 | current_file = file_lookup(name); | ||
| 3212 | current_file->lineno = 1; | ||
| 3213 | current_file->flags = FILE_BUSY; | ||
| 3214 | } | ||
| 3215 | |||
| 3216 | void zconf_nextfile(const char *name) | ||
| 3217 | { | ||
| 3218 | struct file *file = file_lookup(name); | ||
| 3219 | struct buffer *buf = malloc(sizeof(*buf)); | ||
| 3220 | memset(buf, 0, sizeof(*buf)); | ||
| 3221 | |||
| 3222 | current_buf->state = YY_CURRENT_BUFFER; | ||
| 3223 | yyin = fopen(name, "r"); | ||
| 3224 | if (!yyin) { | ||
| 3225 | printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name); | ||
| 3226 | exit(1); | ||
| 3227 | } | ||
| 3228 | yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); | ||
| 3229 | buf->parent = current_buf; | ||
| 3230 | current_buf = buf; | ||
| 3231 | |||
| 3232 | if (file->flags & FILE_BUSY) { | ||
| 3233 | printf("recursive scan (%s)?\n", name); | ||
| 3234 | exit(1); | ||
| 3235 | } | ||
| 3236 | if (file->flags & FILE_SCANNED) { | ||
| 3237 | printf("file %s already scanned?\n", name); | ||
| 3238 | exit(1); | ||
| 3239 | } | ||
| 3240 | file->flags |= FILE_BUSY; | ||
| 3241 | file->lineno = 1; | ||
| 3242 | file->parent = current_file; | ||
| 3243 | current_file = file; | ||
| 3244 | } | ||
| 3245 | |||
| 3246 | static struct buffer *zconf_endfile(void) | ||
| 3247 | { | ||
| 3248 | struct buffer *parent; | ||
| 3249 | |||
| 3250 | current_file->flags |= FILE_SCANNED; | ||
| 3251 | current_file->flags &= ~FILE_BUSY; | ||
| 3252 | current_file = current_file->parent; | ||
| 3253 | |||
| 3254 | parent = current_buf->parent; | ||
| 3255 | if (parent) { | ||
| 3256 | fclose(yyin); | ||
| 3257 | yy_delete_buffer(YY_CURRENT_BUFFER); | ||
| 3258 | yy_switch_to_buffer(parent->state); | ||
| 3259 | } | ||
| 3260 | free(current_buf); | ||
| 3261 | current_buf = parent; | ||
| 3262 | |||
| 3263 | return parent; | ||
| 3264 | } | ||
| 3265 | |||
| 3266 | int zconf_lineno(void) | ||
| 3267 | { | ||
| 3268 | if (current_buf) | ||
| 3269 | return current_file->lineno; | ||
| 3270 | else | ||
| 3271 | return 0; | ||
| 3272 | } | ||
| 3273 | |||
| 3274 | char *zconf_curname(void) | ||
| 3275 | { | ||
| 3276 | if (current_buf) | ||
| 3277 | return current_file->name; | ||
| 3278 | else | ||
| 3279 | return "<none>"; | ||
| 3280 | } | ||
diff --git a/scripts/config/lkc.h b/scripts/config/lkc.h new file mode 100644 index 000000000..688945b87 --- /dev/null +++ b/scripts/config/lkc.h | |||
| @@ -0,0 +1,106 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 3 | * Released under the terms of the GNU GPL v2.0. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #ifndef LKC_H | ||
| 7 | #define LKC_H | ||
| 8 | |||
| 9 | #include "expr.h" | ||
| 10 | |||
| 11 | #ifdef __cplusplus | ||
| 12 | extern "C" { | ||
| 13 | #endif | ||
| 14 | |||
| 15 | #ifdef LKC_DIRECT_LINK | ||
| 16 | #define P(name,type,arg) extern type name arg | ||
| 17 | #else | ||
| 18 | #include "lkc_defs.h" | ||
| 19 | #define P(name,type,arg) extern type (*name ## _p) arg | ||
| 20 | #endif | ||
| 21 | #include "lkc_proto.h" | ||
| 22 | #undef P | ||
| 23 | |||
| 24 | void symbol_end(char *help); | ||
| 25 | int zconfparse(void); | ||
| 26 | void zconfdump(FILE *out); | ||
| 27 | |||
| 28 | extern int zconfdebug; | ||
| 29 | void zconf_starthelp(void); | ||
| 30 | void zconf_initscan(const char *name); | ||
| 31 | void zconf_nextfile(const char *name); | ||
| 32 | int zconf_lineno(void); | ||
| 33 | char *zconf_curname(void); | ||
| 34 | |||
| 35 | /* confdata.c */ | ||
| 36 | extern const char conf_def_filename[]; | ||
| 37 | extern char conf_filename[]; | ||
| 38 | |||
| 39 | char *conf_get_default_confname(void); | ||
| 40 | |||
| 41 | /* kconfig_load.c */ | ||
| 42 | void kconfig_load(void); | ||
| 43 | |||
| 44 | /* menu.c */ | ||
| 45 | void menu_init(void); | ||
| 46 | void menu_add_menu(void); | ||
| 47 | void menu_end_menu(void); | ||
| 48 | void menu_add_entry(struct symbol *sym); | ||
| 49 | void menu_end_entry(void); | ||
| 50 | struct property *create_prop(enum prop_type type); | ||
| 51 | void menu_add_dep(struct expr *dep); | ||
| 52 | struct property *menu_add_prop(int token, char *prompt, struct symbol *def, struct expr *dep); | ||
| 53 | void menu_finalize(struct menu *parent); | ||
| 54 | void menu_set_type(int type); | ||
| 55 | struct file *file_lookup(const char *name); | ||
| 56 | int file_write_dep(const char *name); | ||
| 57 | |||
| 58 | extern struct menu *current_entry; | ||
| 59 | extern struct menu *current_menu; | ||
| 60 | |||
| 61 | /* symbol.c */ | ||
| 62 | void sym_init(void); | ||
| 63 | void sym_clear_all_valid(void); | ||
| 64 | |||
| 65 | static inline tristate sym_get_tristate_value(struct symbol *sym) | ||
| 66 | { | ||
| 67 | return S_TRI(sym->curr); | ||
| 68 | } | ||
| 69 | |||
| 70 | |||
| 71 | static inline struct symbol *sym_get_choice_value(struct symbol *sym) | ||
| 72 | { | ||
| 73 | return (struct symbol *)S_VAL(sym->curr); | ||
| 74 | } | ||
| 75 | |||
| 76 | static inline bool sym_set_choice_value(struct symbol *ch, struct symbol *chval) | ||
| 77 | { | ||
| 78 | return sym_set_tristate_value(chval, yes); | ||
| 79 | } | ||
| 80 | |||
| 81 | static inline bool sym_is_choice(struct symbol *sym) | ||
| 82 | { | ||
| 83 | return sym->flags & SYMBOL_CHOICE ? true : false; | ||
| 84 | } | ||
| 85 | |||
| 86 | static inline bool sym_is_choice_value(struct symbol *sym) | ||
| 87 | { | ||
| 88 | return sym->flags & SYMBOL_CHOICEVAL ? true : false; | ||
| 89 | } | ||
| 90 | |||
| 91 | static inline bool sym_is_optional(struct symbol *sym) | ||
| 92 | { | ||
| 93 | return sym->flags & SYMBOL_OPTIONAL ? true : false; | ||
| 94 | } | ||
| 95 | |||
| 96 | static inline bool sym_has_value(struct symbol *sym) | ||
| 97 | { | ||
| 98 | //return S_VAL(sym->def) != NULL; | ||
| 99 | return sym->flags & SYMBOL_NEW ? false : true; | ||
| 100 | } | ||
| 101 | |||
| 102 | #ifdef __cplusplus | ||
| 103 | } | ||
| 104 | #endif | ||
| 105 | |||
| 106 | #endif /* LKC_H */ | ||
diff --git a/scripts/config/lkc_proto.h b/scripts/config/lkc_proto.h new file mode 100644 index 000000000..116d7593b --- /dev/null +++ b/scripts/config/lkc_proto.h | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | |||
| 2 | /* confdata.c */ | ||
| 3 | P(conf_parse,void,(const char *name)); | ||
| 4 | P(conf_read,int,(const char *name)); | ||
| 5 | P(conf_write,int,(const char *name)); | ||
| 6 | |||
| 7 | /* menu.c */ | ||
| 8 | P(rootmenu,struct menu,); | ||
| 9 | |||
| 10 | P(menu_is_visible,bool,(struct menu *menu)); | ||
| 11 | P(menu_get_prompt,const char *,(struct menu *menu)); | ||
| 12 | P(menu_get_root_menu,struct menu *,(struct menu *menu)); | ||
| 13 | P(menu_get_parent_menu,struct menu *,(struct menu *menu)); | ||
| 14 | |||
| 15 | /* symbol.c */ | ||
| 16 | P(symbol_hash,struct symbol *,[SYMBOL_HASHSIZE]); | ||
| 17 | P(sym_change_count,int,); | ||
| 18 | |||
| 19 | P(sym_lookup,struct symbol *,(const char *name, int isconst)); | ||
| 20 | P(sym_find,struct symbol *,(const char *name)); | ||
| 21 | P(sym_type_name,const char *,(int type)); | ||
| 22 | P(sym_calc_value,void,(struct symbol *sym)); | ||
| 23 | P(sym_get_type,int,(struct symbol *sym)); | ||
| 24 | P(sym_tristate_within_range,bool,(struct symbol *sym,tristate tri)); | ||
| 25 | P(sym_set_tristate_value,bool,(struct symbol *sym,tristate tri)); | ||
| 26 | P(sym_toggle_tristate_value,tristate,(struct symbol *sym)); | ||
| 27 | P(sym_string_valid,bool,(struct symbol *sym, const char *newval)); | ||
| 28 | P(sym_set_string_value,bool,(struct symbol *sym, const char *newval)); | ||
| 29 | P(sym_is_changable,bool,(struct symbol *sym)); | ||
| 30 | P(sym_get_choice_prop,struct property *,(struct symbol *sym)); | ||
| 31 | P(sym_get_default_prop,struct property *,(struct symbol *sym)); | ||
| 32 | P(sym_get_string_value,const char *,(struct symbol *sym)); | ||
| 33 | |||
| 34 | P(prop_get_type_name,const char *,(enum prop_type type)); | ||
| 35 | |||
| 36 | /* expr.c */ | ||
| 37 | P(expr_compare_type,int,(enum expr_type t1, enum expr_type t2)); | ||
| 38 | P(expr_print,void,(struct expr *e, void (*fn)(void *, const char *), void *data, int prevtoken)); | ||
diff --git a/scripts/config/mconf.c b/scripts/config/mconf.c new file mode 100644 index 000000000..476e78adc --- /dev/null +++ b/scripts/config/mconf.c | |||
| @@ -0,0 +1,669 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 3 | * Released under the terms of the GNU GPL v2.0. | ||
| 4 | * | ||
| 5 | * Introduced single menu mode (show all sub-menus in one large tree). | ||
| 6 | * 2002-11-06 Petr Baudis <pasky@ucw.cz> | ||
| 7 | * | ||
| 8 | * Directly use liblxdialog library routines. | ||
| 9 | * 2002-11-14 Petr Baudis <pasky@ucw.cz> | ||
| 10 | */ | ||
| 11 | |||
| 12 | #include <sys/ioctl.h> | ||
| 13 | #include <sys/wait.h> | ||
| 14 | #include <sys/termios.h> | ||
| 15 | #include <ctype.h> | ||
| 16 | #include <errno.h> | ||
| 17 | #include <fcntl.h> | ||
| 18 | #include <limits.h> | ||
| 19 | #include <signal.h> | ||
| 20 | #include <stdarg.h> | ||
| 21 | #include <stdlib.h> | ||
| 22 | #include <string.h> | ||
| 23 | #include <termios.h> | ||
| 24 | #include <unistd.h> | ||
| 25 | |||
| 26 | #include "dialog.h" | ||
| 27 | |||
| 28 | #define LKC_DIRECT_LINK | ||
| 29 | #include "lkc.h" | ||
| 30 | |||
| 31 | static const char menu_instructions[] = | ||
| 32 | "Arrow keys navigate the menu. " | ||
| 33 | "<Enter> selects submenus --->. " | ||
| 34 | "Highlighted letters are hotkeys. " | ||
| 35 | "Pressing <Y> selectes a feature, while <N> will exclude a feature. " | ||
| 36 | "Press <Esc><Esc> to exit, <?> for Help. " | ||
| 37 | "Legend: [*] feature is selected [ ] feature is excluded", | ||
| 38 | radiolist_instructions[] = | ||
| 39 | "Use the arrow keys to navigate this window or " | ||
| 40 | "press the hotkey of the item you wish to select " | ||
| 41 | "followed by the <SPACE BAR>. " | ||
| 42 | "Press <?> for additional information about this option.", | ||
| 43 | inputbox_instructions_int[] = | ||
| 44 | "Please enter a decimal value. " | ||
| 45 | "Fractions will not be accepted. " | ||
| 46 | "Use the <TAB> key to move from the input field to the buttons below it.", | ||
| 47 | inputbox_instructions_hex[] = | ||
| 48 | "Please enter a hexadecimal value. " | ||
| 49 | "Use the <TAB> key to move from the input field to the buttons below it.", | ||
| 50 | inputbox_instructions_string[] = | ||
| 51 | "Please enter a string value. " | ||
| 52 | "Use the <TAB> key to move from the input field to the buttons below it.", | ||
| 53 | setmod_text[] = | ||
| 54 | "This feature depends on another which has been configured as a module.\n" | ||
| 55 | "As a result, this feature will be built as a module.", | ||
| 56 | nohelp_text[] = | ||
| 57 | "There is no help available for this option.\n", | ||
| 58 | load_config_text[] = | ||
| 59 | "Enter the name of the configuration file you wish to load. " | ||
| 60 | "Accept the name shown to restore the configuration you " | ||
| 61 | "last retrieved. Leave blank to abort.", | ||
| 62 | load_config_help[] = | ||
| 63 | "\n" | ||
| 64 | "For various reasons, one may wish to keep several different BusyBox\n" | ||
| 65 | "configurations available on a single machine.\n" | ||
| 66 | "\n" | ||
| 67 | "If you have saved a previous configuration in a file other than the\n" | ||
| 68 | "BusyBox default, entering the name of the file here will allow you\n" | ||
| 69 | "to modify that configuration.\n" | ||
| 70 | "\n" | ||
| 71 | "If you are uncertain, then you have probably never used alternate\n" | ||
| 72 | "configuration files. You should therefor leave this blank to abort.\n", | ||
| 73 | save_config_text[] = | ||
| 74 | "Enter a filename to which this configuration should be saved " | ||
| 75 | "as an alternate. Leave blank to abort.", | ||
| 76 | save_config_help[] = | ||
| 77 | "\n" | ||
| 78 | "For various reasons, one may wish to keep different BusyBox\n" | ||
| 79 | "configurations available on a single machine.\n" | ||
| 80 | "\n" | ||
| 81 | "Entering a file name here will allow you to later retrieve, modify\n" | ||
| 82 | "and use the current configuration as an alternate to whatever\n" | ||
| 83 | "configuration options you have selected at that time.\n" | ||
| 84 | "\n" | ||
| 85 | "If you are uncertain what all this means then you should probably\n" | ||
| 86 | "leave this blank.\n" | ||
| 87 | ; | ||
| 88 | |||
| 89 | static char filename[PATH_MAX+1] = ".config"; | ||
| 90 | static int indent = 0; | ||
| 91 | static struct termios ios_org; | ||
| 92 | static int rows, cols; | ||
| 93 | static struct menu *current_menu; | ||
| 94 | static int child_count; | ||
| 95 | static int single_menu_mode; | ||
| 96 | |||
| 97 | static struct dialog_list_item *items[16384]; /* FIXME: This ought to be dynamic. */ | ||
| 98 | static int item_no; | ||
| 99 | |||
| 100 | static void conf(struct menu *menu); | ||
| 101 | static void conf_choice(struct menu *menu); | ||
| 102 | static void conf_string(struct menu *menu); | ||
| 103 | static void conf_load(void); | ||
| 104 | static void conf_save(void); | ||
| 105 | static void show_textbox(const char *title, const char *text, int r, int c); | ||
| 106 | static void show_helptext(const char *title, const char *text); | ||
| 107 | static void show_help(struct menu *menu); | ||
| 108 | static void show_readme(void); | ||
| 109 | |||
| 110 | static void init_wsize(void) | ||
| 111 | { | ||
| 112 | struct winsize ws; | ||
| 113 | |||
| 114 | if (ioctl(1, TIOCGWINSZ, &ws) == -1) { | ||
| 115 | rows = 24; | ||
| 116 | cols = 80; | ||
| 117 | } else { | ||
| 118 | rows = ws.ws_row; | ||
| 119 | cols = ws.ws_col; | ||
| 120 | } | ||
| 121 | |||
| 122 | if (rows < 19 || cols < 80) { | ||
| 123 | fprintf(stderr, "Your display is too small to run Menuconfig!\n"); | ||
| 124 | fprintf(stderr, "It must be at least 19 lines by 80 columns.\n"); | ||
| 125 | exit(1); | ||
| 126 | } | ||
| 127 | |||
| 128 | rows -= 4; | ||
| 129 | cols -= 5; | ||
| 130 | } | ||
| 131 | |||
| 132 | static void cinit(void) | ||
| 133 | { | ||
| 134 | item_no = 0; | ||
| 135 | } | ||
| 136 | |||
| 137 | static void cmake(void) | ||
| 138 | { | ||
| 139 | items[item_no] = malloc(sizeof(struct dialog_list_item)); | ||
| 140 | memset(items[item_no], 0, sizeof(struct dialog_list_item)); | ||
| 141 | items[item_no]->tag = malloc(32); items[item_no]->tag[0] = 0; | ||
| 142 | items[item_no]->name = malloc(512); items[item_no]->name[0] = 0; | ||
| 143 | items[item_no]->namelen = 0; | ||
| 144 | item_no++; | ||
| 145 | } | ||
| 146 | |||
| 147 | static int cprint_name(const char *fmt, ...) | ||
| 148 | { | ||
| 149 | va_list ap; | ||
| 150 | int res; | ||
| 151 | |||
| 152 | if (!item_no) | ||
| 153 | cmake(); | ||
| 154 | va_start(ap, fmt); | ||
| 155 | res = vsnprintf(items[item_no - 1]->name + items[item_no - 1]->namelen, | ||
| 156 | 512 - items[item_no - 1]->namelen, fmt, ap); | ||
| 157 | if (res > 0) | ||
| 158 | items[item_no - 1]->namelen += res; | ||
| 159 | va_end(ap); | ||
| 160 | |||
| 161 | return res; | ||
| 162 | } | ||
| 163 | |||
| 164 | static int cprint_tag(const char *fmt, ...) | ||
| 165 | { | ||
| 166 | va_list ap; | ||
| 167 | int res; | ||
| 168 | |||
| 169 | if (!item_no) | ||
| 170 | cmake(); | ||
| 171 | va_start(ap, fmt); | ||
| 172 | res = vsnprintf(items[item_no - 1]->tag, 32, fmt, ap); | ||
| 173 | va_end(ap); | ||
| 174 | |||
| 175 | return res; | ||
| 176 | } | ||
| 177 | |||
| 178 | static void cdone(void) | ||
| 179 | { | ||
| 180 | int i; | ||
| 181 | |||
| 182 | for (i = 0; i < item_no; i++) { | ||
| 183 | free(items[i]->tag); | ||
| 184 | free(items[i]->name); | ||
| 185 | free(items[i]); | ||
| 186 | } | ||
| 187 | |||
| 188 | item_no = 0; | ||
| 189 | } | ||
| 190 | |||
| 191 | static void build_conf(struct menu *menu) | ||
| 192 | { | ||
| 193 | struct symbol *sym; | ||
| 194 | struct property *prop; | ||
| 195 | struct menu *child; | ||
| 196 | int type, tmp, doint = 2; | ||
| 197 | tristate val; | ||
| 198 | char ch; | ||
| 199 | |||
| 200 | if (!menu_is_visible(menu)) | ||
| 201 | return; | ||
| 202 | |||
| 203 | sym = menu->sym; | ||
| 204 | prop = menu->prompt; | ||
| 205 | if (!sym) { | ||
| 206 | if (prop && menu != current_menu) { | ||
| 207 | const char *prompt = menu_get_prompt(menu); | ||
| 208 | switch (prop->type) { | ||
| 209 | case P_MENU: | ||
| 210 | child_count++; | ||
| 211 | cmake(); | ||
| 212 | cprint_tag("m%p", menu); | ||
| 213 | |||
| 214 | if (single_menu_mode) { | ||
| 215 | cprint_name("%s%*c%s", | ||
| 216 | menu->data ? "-->" : "++>", | ||
| 217 | indent + 1, ' ', prompt); | ||
| 218 | } else { | ||
| 219 | if (menu->parent != &rootmenu) | ||
| 220 | cprint_name(" %*c", indent + 1, ' '); | ||
| 221 | cprint_name("%s --->", prompt); | ||
| 222 | } | ||
| 223 | |||
| 224 | if (single_menu_mode && menu->data) | ||
| 225 | goto conf_childs; | ||
| 226 | return; | ||
| 227 | default: | ||
| 228 | if (prompt) { | ||
| 229 | child_count++; | ||
| 230 | cmake(); | ||
| 231 | cprint_tag(":%p", menu); | ||
| 232 | cprint_name("---%*c%s", indent + 1, ' ', prompt); | ||
| 233 | } | ||
| 234 | } | ||
| 235 | } else | ||
| 236 | doint = 0; | ||
| 237 | goto conf_childs; | ||
| 238 | } | ||
| 239 | |||
| 240 | cmake(); | ||
| 241 | type = sym_get_type(sym); | ||
| 242 | if (sym_is_choice(sym)) { | ||
| 243 | struct symbol *def_sym = sym_get_choice_value(sym); | ||
| 244 | struct menu *def_menu = NULL; | ||
| 245 | |||
| 246 | child_count++; | ||
| 247 | for (child = menu->list; child; child = child->next) { | ||
| 248 | if (menu_is_visible(child) && child->sym == def_sym) | ||
| 249 | def_menu = child; | ||
| 250 | } | ||
| 251 | |||
| 252 | val = sym_get_tristate_value(sym); | ||
| 253 | if (sym_is_changable(sym)) { | ||
| 254 | cprint_tag("t%p", menu); | ||
| 255 | switch (type) { | ||
| 256 | case S_BOOLEAN: | ||
| 257 | cprint_name("[%c]", val == no ? ' ' : '*'); | ||
| 258 | break; | ||
| 259 | case S_TRISTATE: | ||
| 260 | switch (val) { | ||
| 261 | case yes: ch = '*'; break; | ||
| 262 | case mod: ch = 'M'; break; | ||
| 263 | default: ch = ' '; break; | ||
| 264 | } | ||
| 265 | cprint_name("<%c>", ch); | ||
| 266 | break; | ||
| 267 | } | ||
| 268 | } else { | ||
| 269 | cprint_tag("%c%p", def_menu ? 't' : ':', menu); | ||
| 270 | cprint_name(" "); | ||
| 271 | } | ||
| 272 | |||
| 273 | cprint_name("%*c%s", indent + 1, ' ', menu_get_prompt(menu)); | ||
| 274 | if (val == yes) { | ||
| 275 | if (def_menu) { | ||
| 276 | cprint_name(" (%s)", menu_get_prompt(def_menu)); | ||
| 277 | cprint_name(" --->"); | ||
| 278 | if (def_menu->list) { | ||
| 279 | indent += 2; | ||
| 280 | build_conf(def_menu); | ||
| 281 | indent -= 2; | ||
| 282 | } | ||
| 283 | } | ||
| 284 | return; | ||
| 285 | } | ||
| 286 | } else { | ||
| 287 | child_count++; | ||
| 288 | val = sym_get_tristate_value(sym); | ||
| 289 | if (sym_is_choice_value(sym) && val == yes) { | ||
| 290 | cprint_tag(":%p", menu); | ||
| 291 | cprint_name(" "); | ||
| 292 | } else { | ||
| 293 | switch (type) { | ||
| 294 | case S_BOOLEAN: | ||
| 295 | cprint_tag("t%p", menu); | ||
| 296 | cprint_name("[%c]", val == no ? ' ' : '*'); | ||
| 297 | break; | ||
| 298 | case S_TRISTATE: | ||
| 299 | cprint_tag("t%p", menu); | ||
| 300 | switch (val) { | ||
| 301 | case yes: ch = '*'; break; | ||
| 302 | case mod: ch = 'M'; break; | ||
| 303 | default: ch = ' '; break; | ||
| 304 | } | ||
| 305 | cprint_name("<%c>", ch); | ||
| 306 | break; | ||
| 307 | default: | ||
| 308 | cprint_tag("s%p", menu); | ||
| 309 | tmp = cprint_name("(%s)", sym_get_string_value(sym)); | ||
| 310 | tmp = indent - tmp + 4; | ||
| 311 | if (tmp < 0) | ||
| 312 | tmp = 0; | ||
| 313 | cprint_name("%*c%s%s", tmp, ' ', menu_get_prompt(menu), | ||
| 314 | sym_has_value(sym) ? "" : " (NEW)"); | ||
| 315 | goto conf_childs; | ||
| 316 | } | ||
| 317 | } | ||
| 318 | cprint_name("%*c%s%s", indent + 1, ' ', menu_get_prompt(menu), | ||
| 319 | sym_has_value(sym) ? "" : " (NEW)"); | ||
| 320 | } | ||
| 321 | |||
| 322 | conf_childs: | ||
| 323 | indent += doint; | ||
| 324 | for (child = menu->list; child; child = child->next) | ||
| 325 | build_conf(child); | ||
| 326 | indent -= doint; | ||
| 327 | } | ||
| 328 | |||
| 329 | static void conf(struct menu *menu) | ||
| 330 | { | ||
| 331 | struct dialog_list_item *active_item = NULL; | ||
| 332 | struct menu *submenu; | ||
| 333 | const char *prompt = menu_get_prompt(menu); | ||
| 334 | struct symbol *sym; | ||
| 335 | char active_entry[40]; | ||
| 336 | int stat, type; | ||
| 337 | |||
| 338 | unlink("lxdialog.scrltmp"); | ||
| 339 | active_entry[0] = 0; | ||
| 340 | while (1) { | ||
| 341 | indent = 0; | ||
| 342 | child_count = 0; | ||
| 343 | current_menu = menu; | ||
| 344 | cdone(); cinit(); | ||
| 345 | build_conf(menu); | ||
| 346 | if (!child_count) | ||
| 347 | break; | ||
| 348 | if (menu == &rootmenu) { | ||
| 349 | cmake(); cprint_tag(":"); cprint_name("--- "); | ||
| 350 | cmake(); cprint_tag("L"); cprint_name("Load an Alternate Configuration File"); | ||
| 351 | cmake(); cprint_tag("S"); cprint_name("Save Configuration to an Alternate File"); | ||
| 352 | } | ||
| 353 | dialog_clear(); | ||
| 354 | stat = dialog_menu(prompt ? prompt : "Main Menu", | ||
| 355 | menu_instructions, rows, cols, rows - 10, | ||
| 356 | active_entry, item_no, items); | ||
| 357 | if (stat < 0) | ||
| 358 | return; | ||
| 359 | |||
| 360 | if (stat == 1 || stat == 255) | ||
| 361 | break; | ||
| 362 | |||
| 363 | active_item = first_sel_item(item_no, items); | ||
| 364 | if (!active_item) | ||
| 365 | continue; | ||
| 366 | active_item->selected = 0; | ||
| 367 | strncpy(active_entry, active_item->tag, sizeof(active_entry)); | ||
| 368 | active_entry[sizeof(active_entry)-1] = 0; | ||
| 369 | type = active_entry[0]; | ||
| 370 | if (!type) | ||
| 371 | continue; | ||
| 372 | |||
| 373 | sym = NULL; | ||
| 374 | submenu = NULL; | ||
| 375 | if (sscanf(active_entry + 1, "%p", &submenu) == 1) | ||
| 376 | sym = submenu->sym; | ||
| 377 | |||
| 378 | switch (stat) { | ||
| 379 | case 0: | ||
| 380 | switch (type) { | ||
| 381 | case 'm': | ||
| 382 | if (single_menu_mode) | ||
| 383 | submenu->data = (submenu->data)? NULL : (void *)1; | ||
| 384 | else | ||
| 385 | conf(submenu); | ||
| 386 | break; | ||
| 387 | case 't': | ||
| 388 | if (sym_is_choice(sym) && sym_get_tristate_value(sym) == yes) | ||
| 389 | conf_choice(submenu); | ||
| 390 | break; | ||
| 391 | case 's': | ||
| 392 | conf_string(submenu); | ||
| 393 | break; | ||
| 394 | case 'L': | ||
| 395 | conf_load(); | ||
| 396 | break; | ||
| 397 | case 'S': | ||
| 398 | conf_save(); | ||
| 399 | break; | ||
| 400 | } | ||
| 401 | break; | ||
| 402 | case 2: | ||
| 403 | if (sym) | ||
| 404 | show_help(submenu); | ||
| 405 | else | ||
| 406 | show_readme(); | ||
| 407 | break; | ||
| 408 | case 3: | ||
| 409 | if (type == 't') { | ||
| 410 | if (sym_set_tristate_value(sym, yes)) | ||
| 411 | break; | ||
| 412 | if (sym_set_tristate_value(sym, mod)) | ||
| 413 | show_textbox(NULL, setmod_text, 6, 74); | ||
| 414 | } | ||
| 415 | break; | ||
| 416 | case 4: | ||
| 417 | if (type == 't') | ||
| 418 | sym_set_tristate_value(sym, no); | ||
| 419 | break; | ||
| 420 | case 5: | ||
| 421 | if (type == 't') | ||
| 422 | sym_set_tristate_value(sym, mod); | ||
| 423 | break; | ||
| 424 | case 6: | ||
| 425 | if (type == 't') | ||
| 426 | sym_toggle_tristate_value(sym); | ||
| 427 | else if (type == 'm') | ||
| 428 | conf(submenu); | ||
| 429 | break; | ||
| 430 | } | ||
| 431 | } | ||
| 432 | } | ||
| 433 | |||
| 434 | static void show_textbox(const char *title, const char *text, int r, int c) | ||
| 435 | { | ||
| 436 | int fd; | ||
| 437 | |||
| 438 | fd = creat(".help.tmp", 0777); | ||
| 439 | write(fd, text, strlen(text)); | ||
| 440 | close(fd); | ||
| 441 | while (dialog_textbox(title, ".help.tmp", r, c) < 0) | ||
| 442 | ; | ||
| 443 | unlink(".help.tmp"); | ||
| 444 | } | ||
| 445 | |||
| 446 | static void show_helptext(const char *title, const char *text) | ||
| 447 | { | ||
| 448 | show_textbox(title, text, rows, cols); | ||
| 449 | } | ||
| 450 | |||
| 451 | static void show_help(struct menu *menu) | ||
| 452 | { | ||
| 453 | const char *help; | ||
| 454 | char *helptext; | ||
| 455 | struct symbol *sym = menu->sym; | ||
| 456 | |||
| 457 | help = sym->help; | ||
| 458 | if (!help) | ||
| 459 | help = nohelp_text; | ||
| 460 | if (sym->name) { | ||
| 461 | helptext = malloc(strlen(sym->name) + strlen(help) + 16); | ||
| 462 | sprintf(helptext, "%s:\n\n%s", sym->name, help); | ||
| 463 | show_helptext(menu_get_prompt(menu), helptext); | ||
| 464 | free(helptext); | ||
| 465 | } else | ||
| 466 | show_helptext(menu_get_prompt(menu), help); | ||
| 467 | } | ||
| 468 | |||
| 469 | static void show_readme(void) | ||
| 470 | { | ||
| 471 | while (dialog_textbox(NULL, "scripts/README.Menuconfig", rows, cols) < 0) | ||
| 472 | ; | ||
| 473 | } | ||
| 474 | |||
| 475 | static void conf_choice(struct menu *menu) | ||
| 476 | { | ||
| 477 | const char *prompt = menu_get_prompt(menu); | ||
| 478 | struct menu *child; | ||
| 479 | struct symbol *active; | ||
| 480 | |||
| 481 | while (1) { | ||
| 482 | current_menu = menu; | ||
| 483 | active = sym_get_choice_value(menu->sym); | ||
| 484 | cdone(); cinit(); | ||
| 485 | for (child = menu->list; child; child = child->next) { | ||
| 486 | if (!menu_is_visible(child)) | ||
| 487 | continue; | ||
| 488 | cmake(); | ||
| 489 | cprint_tag("%p", child); | ||
| 490 | cprint_name("%s", menu_get_prompt(child)); | ||
| 491 | items[item_no - 1]->selected = (child->sym == active); | ||
| 492 | } | ||
| 493 | |||
| 494 | switch (dialog_checklist(prompt ? prompt : "Main Menu", | ||
| 495 | radiolist_instructions, 15, 70, 6, | ||
| 496 | item_no, items, FLAG_RADIO)) { | ||
| 497 | case 0: | ||
| 498 | if (sscanf(first_sel_item(item_no, items)->tag, "%p", &menu) != 1) | ||
| 499 | break; | ||
| 500 | sym_set_tristate_value(menu->sym, yes); | ||
| 501 | return; | ||
| 502 | case 1: | ||
| 503 | show_help(menu); | ||
| 504 | break; | ||
| 505 | case 255: | ||
| 506 | return; | ||
| 507 | } | ||
| 508 | } | ||
| 509 | } | ||
| 510 | |||
| 511 | static void conf_string(struct menu *menu) | ||
| 512 | { | ||
| 513 | const char *prompt = menu_get_prompt(menu); | ||
| 514 | |||
| 515 | while (1) { | ||
| 516 | char *heading; | ||
| 517 | |||
| 518 | switch (sym_get_type(menu->sym)) { | ||
| 519 | case S_INT: | ||
| 520 | heading = (char *) inputbox_instructions_int; | ||
| 521 | break; | ||
| 522 | case S_HEX: | ||
| 523 | heading = (char *) inputbox_instructions_hex; | ||
| 524 | break; | ||
| 525 | case S_STRING: | ||
| 526 | heading = (char *) inputbox_instructions_string; | ||
| 527 | break; | ||
| 528 | default: | ||
| 529 | heading = "Internal mconf error!"; | ||
| 530 | /* panic? */; | ||
| 531 | } | ||
| 532 | |||
| 533 | switch (dialog_inputbox(prompt ? prompt : "Main Menu", | ||
| 534 | heading, 10, 75, | ||
| 535 | sym_get_string_value(menu->sym))) { | ||
| 536 | case 0: | ||
| 537 | if (sym_set_string_value(menu->sym, dialog_input_result)) | ||
| 538 | return; | ||
| 539 | show_textbox(NULL, "You have made an invalid entry.", 5, 43); | ||
| 540 | break; | ||
| 541 | case 1: | ||
| 542 | show_help(menu); | ||
| 543 | break; | ||
| 544 | case 255: | ||
| 545 | return; | ||
| 546 | } | ||
| 547 | } | ||
| 548 | } | ||
| 549 | |||
| 550 | static void conf_load(void) | ||
| 551 | { | ||
| 552 | while (1) { | ||
| 553 | switch (dialog_inputbox(NULL, load_config_text, 11, 55, | ||
| 554 | filename)) { | ||
| 555 | case 0: | ||
| 556 | if (!dialog_input_result[0]) | ||
| 557 | return; | ||
| 558 | if (!conf_read(dialog_input_result)) | ||
| 559 | return; | ||
| 560 | show_textbox(NULL, "File does not exist!", 5, 38); | ||
| 561 | break; | ||
| 562 | case 1: | ||
| 563 | show_helptext("Load Alternate Configuration", load_config_help); | ||
| 564 | break; | ||
| 565 | case 255: | ||
| 566 | return; | ||
| 567 | } | ||
| 568 | } | ||
| 569 | } | ||
| 570 | |||
| 571 | static void conf_save(void) | ||
| 572 | { | ||
| 573 | while (1) { | ||
| 574 | switch (dialog_inputbox(NULL, save_config_text, 11, 55, | ||
| 575 | filename)) { | ||
| 576 | case 0: | ||
| 577 | if (!dialog_input_result[0]) | ||
| 578 | return; | ||
| 579 | if (!conf_write(dialog_input_result)) | ||
| 580 | return; | ||
| 581 | show_textbox(NULL, "Can't create file! Probably a nonexistent directory.", 5, 60); | ||
| 582 | break; | ||
| 583 | case 1: | ||
| 584 | show_helptext("Save Alternate Configuration", save_config_help); | ||
| 585 | break; | ||
| 586 | case 255: | ||
| 587 | return; | ||
| 588 | } | ||
| 589 | } | ||
| 590 | } | ||
| 591 | |||
| 592 | static void conf_cleanup(void) | ||
| 593 | { | ||
| 594 | tcsetattr(1, TCSAFLUSH, &ios_org); | ||
| 595 | unlink(".help.tmp"); | ||
| 596 | unlink("lxdialog.scrltmp"); | ||
| 597 | } | ||
| 598 | |||
| 599 | static void winch_handler(int sig) | ||
| 600 | { | ||
| 601 | struct winsize ws; | ||
| 602 | |||
| 603 | if (ioctl(1, TIOCGWINSZ, &ws) == -1) { | ||
| 604 | rows = 24; | ||
| 605 | cols = 80; | ||
| 606 | } else { | ||
| 607 | rows = ws.ws_row; | ||
| 608 | cols = ws.ws_col; | ||
| 609 | } | ||
| 610 | |||
| 611 | if (rows < 19 || cols < 80) { | ||
| 612 | end_dialog(); | ||
| 613 | fprintf(stderr, "Your display is too small to run Menuconfig!\n"); | ||
| 614 | fprintf(stderr, "It must be at least 19 lines by 80 columns.\n"); | ||
| 615 | exit(1); | ||
| 616 | } | ||
| 617 | |||
| 618 | rows -= 4; | ||
| 619 | cols -= 5; | ||
| 620 | |||
| 621 | } | ||
| 622 | |||
| 623 | int main(int ac, char **av) | ||
| 624 | { | ||
| 625 | int stat; | ||
| 626 | char *mode; | ||
| 627 | struct symbol *sym; | ||
| 628 | |||
| 629 | conf_parse(av[1]); | ||
| 630 | conf_read(NULL); | ||
| 631 | |||
| 632 | backtitle = malloc(128); | ||
| 633 | sym = sym_lookup("VERSION", 0); | ||
| 634 | sym_calc_value(sym); | ||
| 635 | snprintf(backtitle, 128, "BusyBox v%s Configuration", | ||
| 636 | sym_get_string_value(sym)); | ||
| 637 | |||
| 638 | mode = getenv("MENUCONFIG_MODE"); | ||
| 639 | if (mode) { | ||
| 640 | if (!strcasecmp(mode, "single_menu")) | ||
| 641 | single_menu_mode = 1; | ||
| 642 | } | ||
| 643 | |||
| 644 | tcgetattr(1, &ios_org); | ||
| 645 | atexit(conf_cleanup); | ||
| 646 | init_wsize(); | ||
| 647 | init_dialog(); | ||
| 648 | signal(SIGWINCH, winch_handler); | ||
| 649 | conf(&rootmenu); | ||
| 650 | end_dialog(); | ||
| 651 | |||
| 652 | /* Restart dialog to act more like when lxdialog was still separate */ | ||
| 653 | init_dialog(); | ||
| 654 | do { | ||
| 655 | stat = dialog_yesno(NULL, | ||
| 656 | "Do you wish to save your new BusyBox configuration?", 5, 60); | ||
| 657 | } while (stat < 0); | ||
| 658 | end_dialog(); | ||
| 659 | |||
| 660 | if (stat == 0) { | ||
| 661 | conf_write(NULL); | ||
| 662 | printf("\n\n" | ||
| 663 | "*** End of BusyBox configuration.\n" | ||
| 664 | "*** Check the top-level Makefile for additional configuration options.\n\n"); | ||
| 665 | } else | ||
| 666 | printf("\n\nYour BusyBox configuration changes were NOT saved.\n\n"); | ||
| 667 | |||
| 668 | return 0; | ||
| 669 | } | ||
diff --git a/scripts/config/menu.c b/scripts/config/menu.c new file mode 100644 index 000000000..3d3b4d19c --- /dev/null +++ b/scripts/config/menu.c | |||
| @@ -0,0 +1,309 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 3 | * Released under the terms of the GNU GPL v2.0. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <stdlib.h> | ||
| 7 | #include <string.h> | ||
| 8 | |||
| 9 | #define LKC_DIRECT_LINK | ||
| 10 | #include "lkc.h" | ||
| 11 | |||
| 12 | struct menu rootmenu; | ||
| 13 | struct menu *current_menu, *current_entry; | ||
| 14 | static struct menu **last_entry_ptr; | ||
| 15 | |||
| 16 | struct file *file_list; | ||
| 17 | struct file *current_file; | ||
| 18 | |||
| 19 | void menu_init(void) | ||
| 20 | { | ||
| 21 | current_entry = current_menu = &rootmenu; | ||
| 22 | last_entry_ptr = &rootmenu.list; | ||
| 23 | } | ||
| 24 | |||
| 25 | void menu_add_entry(struct symbol *sym) | ||
| 26 | { | ||
| 27 | struct menu *menu; | ||
| 28 | |||
| 29 | menu = malloc(sizeof(*menu)); | ||
| 30 | memset(menu, 0, sizeof(*menu)); | ||
| 31 | menu->sym = sym; | ||
| 32 | menu->parent = current_menu; | ||
| 33 | menu->file = current_file; | ||
| 34 | menu->lineno = zconf_lineno(); | ||
| 35 | |||
| 36 | *last_entry_ptr = menu; | ||
| 37 | last_entry_ptr = &menu->next; | ||
| 38 | current_entry = menu; | ||
| 39 | } | ||
| 40 | |||
| 41 | void menu_end_entry(void) | ||
| 42 | { | ||
| 43 | } | ||
| 44 | |||
| 45 | void menu_add_menu(void) | ||
| 46 | { | ||
| 47 | current_menu = current_entry; | ||
| 48 | last_entry_ptr = ¤t_entry->list; | ||
| 49 | } | ||
| 50 | |||
| 51 | void menu_end_menu(void) | ||
| 52 | { | ||
| 53 | last_entry_ptr = ¤t_menu->next; | ||
| 54 | current_menu = current_menu->parent; | ||
| 55 | } | ||
| 56 | |||
| 57 | void menu_add_dep(struct expr *dep) | ||
| 58 | { | ||
| 59 | current_entry->dep = expr_alloc_and(current_entry->dep, dep); | ||
| 60 | } | ||
| 61 | |||
| 62 | void menu_set_type(int type) | ||
| 63 | { | ||
| 64 | struct symbol *sym = current_entry->sym; | ||
| 65 | |||
| 66 | if (sym->type == type) | ||
| 67 | return; | ||
| 68 | if (sym->type == S_UNKNOWN) { | ||
| 69 | sym->type = type; | ||
| 70 | return; | ||
| 71 | } | ||
| 72 | fprintf(stderr, "%s:%d: type of '%s' redefined from '%s' to '%s'\n", | ||
| 73 | current_entry->file->name, current_entry->lineno, | ||
| 74 | sym->name ? sym->name : "<choice>", sym_type_name(sym->type), sym_type_name(type)); | ||
| 75 | } | ||
| 76 | |||
| 77 | struct property *create_prop(enum prop_type type) | ||
| 78 | { | ||
| 79 | struct property *prop; | ||
| 80 | |||
| 81 | prop = malloc(sizeof(*prop)); | ||
| 82 | memset(prop, 0, sizeof(*prop)); | ||
| 83 | prop->type = type; | ||
| 84 | prop->file = current_file; | ||
| 85 | prop->lineno = zconf_lineno(); | ||
| 86 | |||
| 87 | return prop; | ||
| 88 | } | ||
| 89 | |||
| 90 | struct property *menu_add_prop(int token, char *prompt, struct symbol *def, struct expr *dep) | ||
| 91 | { | ||
| 92 | struct property *prop = create_prop(token); | ||
| 93 | struct property **propp; | ||
| 94 | |||
| 95 | prop->sym = current_entry->sym; | ||
| 96 | prop->menu = current_entry; | ||
| 97 | prop->text = prompt; | ||
| 98 | prop->def = def; | ||
| 99 | E_EXPR(prop->visible) = dep; | ||
| 100 | |||
| 101 | if (prompt) | ||
| 102 | current_entry->prompt = prop; | ||
| 103 | |||
| 104 | /* append property to the prop list of symbol */ | ||
| 105 | if (prop->sym) { | ||
| 106 | for (propp = &prop->sym->prop; *propp; propp = &(*propp)->next) | ||
| 107 | ; | ||
| 108 | *propp = prop; | ||
| 109 | } | ||
| 110 | |||
| 111 | return prop; | ||
| 112 | } | ||
| 113 | |||
| 114 | void menu_add_prompt(int token, char *prompt, struct expr *dep) | ||
| 115 | { | ||
| 116 | current_entry->prompt = menu_add_prop(token, prompt, NULL, dep); | ||
| 117 | } | ||
| 118 | |||
| 119 | void menu_add_default(int token, struct symbol *def, struct expr *dep) | ||
| 120 | { | ||
| 121 | current_entry->prompt = menu_add_prop(token, NULL, def, dep); | ||
| 122 | } | ||
| 123 | |||
| 124 | void menu_finalize(struct menu *parent) | ||
| 125 | { | ||
| 126 | struct menu *menu, *last_menu; | ||
| 127 | struct symbol *sym; | ||
| 128 | struct property *prop; | ||
| 129 | struct expr *parentdep, *basedep, *dep, *dep2; | ||
| 130 | |||
| 131 | sym = parent->sym; | ||
| 132 | if (parent->list) { | ||
| 133 | if (sym && sym_is_choice(sym)) { | ||
| 134 | /* find the first choice value and find out choice type */ | ||
| 135 | for (menu = parent->list; menu; menu = menu->next) { | ||
| 136 | if (menu->sym) { | ||
| 137 | current_entry = parent; | ||
| 138 | menu_set_type(menu->sym->type); | ||
| 139 | current_entry = menu; | ||
| 140 | menu_set_type(sym->type); | ||
| 141 | break; | ||
| 142 | } | ||
| 143 | } | ||
| 144 | parentdep = expr_alloc_symbol(sym); | ||
| 145 | } else if (parent->prompt) | ||
| 146 | parentdep = E_EXPR(parent->prompt->visible); | ||
| 147 | else | ||
| 148 | parentdep = parent->dep; | ||
| 149 | |||
| 150 | for (menu = parent->list; menu; menu = menu->next) { | ||
| 151 | basedep = expr_transform(menu->dep); | ||
| 152 | basedep = expr_alloc_and(expr_copy(parentdep), basedep); | ||
| 153 | basedep = expr_eliminate_dups(basedep); | ||
| 154 | menu->dep = basedep; | ||
| 155 | if (menu->sym) | ||
| 156 | prop = menu->sym->prop; | ||
| 157 | else | ||
| 158 | prop = menu->prompt; | ||
| 159 | for (; prop; prop = prop->next) { | ||
| 160 | if (prop->menu != menu) | ||
| 161 | continue; | ||
| 162 | dep = expr_transform(E_EXPR(prop->visible)); | ||
| 163 | dep = expr_alloc_and(expr_copy(basedep), dep); | ||
| 164 | dep = expr_eliminate_dups(dep); | ||
| 165 | if (menu->sym && menu->sym->type != S_TRISTATE) | ||
| 166 | dep = expr_trans_bool(dep); | ||
| 167 | E_EXPR(prop->visible) = dep; | ||
| 168 | } | ||
| 169 | } | ||
| 170 | for (menu = parent->list; menu; menu = menu->next) | ||
| 171 | menu_finalize(menu); | ||
| 172 | } else if (sym && parent->prompt) { | ||
| 173 | basedep = E_EXPR(parent->prompt->visible); | ||
| 174 | basedep = expr_trans_compare(basedep, E_UNEQUAL, &symbol_no); | ||
| 175 | basedep = expr_eliminate_dups(expr_transform(basedep)); | ||
| 176 | last_menu = NULL; | ||
| 177 | for (menu = parent->next; menu; menu = menu->next) { | ||
| 178 | dep = menu->prompt ? E_EXPR(menu->prompt->visible) : menu->dep; | ||
| 179 | if (!expr_contains_symbol(dep, sym)) | ||
| 180 | break; | ||
| 181 | if (expr_depends_symbol(dep, sym)) | ||
| 182 | goto next; | ||
| 183 | dep = expr_trans_compare(dep, E_UNEQUAL, &symbol_no); | ||
| 184 | dep = expr_eliminate_dups(expr_transform(dep)); | ||
| 185 | dep2 = expr_copy(basedep); | ||
| 186 | expr_eliminate_eq(&dep, &dep2); | ||
| 187 | expr_free(dep); | ||
| 188 | if (!expr_is_yes(dep2)) { | ||
| 189 | expr_free(dep2); | ||
| 190 | break; | ||
| 191 | } | ||
| 192 | expr_free(dep2); | ||
| 193 | next: | ||
| 194 | menu_finalize(menu); | ||
| 195 | menu->parent = parent; | ||
| 196 | last_menu = menu; | ||
| 197 | } | ||
| 198 | if (last_menu) { | ||
| 199 | parent->list = parent->next; | ||
| 200 | parent->next = last_menu->next; | ||
| 201 | last_menu->next = NULL; | ||
| 202 | } | ||
| 203 | } | ||
| 204 | for (menu = parent->list; menu; menu = menu->next) { | ||
| 205 | if (sym && sym_is_choice(sym) && menu->sym) { | ||
| 206 | menu->sym->flags |= SYMBOL_CHOICEVAL; | ||
| 207 | current_entry = menu; | ||
| 208 | menu_set_type(sym->type); | ||
| 209 | menu_add_prop(P_CHOICE, NULL, parent->sym, NULL); | ||
| 210 | prop = sym_get_choice_prop(parent->sym); | ||
| 211 | //dep = expr_alloc_one(E_CHOICE, dep); | ||
| 212 | //dep->right.sym = menu->sym; | ||
| 213 | prop->dep = expr_alloc_one(E_CHOICE, prop->dep); | ||
| 214 | prop->dep->right.sym = menu->sym; | ||
| 215 | } | ||
| 216 | if (menu->list && (!menu->prompt || !menu->prompt->text)) { | ||
| 217 | for (last_menu = menu->list; ; last_menu = last_menu->next) { | ||
| 218 | last_menu->parent = parent; | ||
| 219 | if (!last_menu->next) | ||
| 220 | break; | ||
| 221 | } | ||
| 222 | last_menu->next = menu->next; | ||
| 223 | menu->next = menu->list; | ||
| 224 | menu->list = NULL; | ||
| 225 | } | ||
| 226 | } | ||
| 227 | } | ||
| 228 | |||
| 229 | bool menu_is_visible(struct menu *menu) | ||
| 230 | { | ||
| 231 | tristate visible; | ||
| 232 | |||
| 233 | if (!menu->prompt) | ||
| 234 | return false; | ||
| 235 | if (menu->sym) { | ||
| 236 | sym_calc_value(menu->sym); | ||
| 237 | visible = E_TRI(menu->prompt->visible); | ||
| 238 | } else | ||
| 239 | visible = E_CALC(menu->prompt->visible); | ||
| 240 | return visible != no; | ||
| 241 | } | ||
| 242 | |||
| 243 | const char *menu_get_prompt(struct menu *menu) | ||
| 244 | { | ||
| 245 | if (menu->prompt) | ||
| 246 | return menu->prompt->text; | ||
| 247 | else if (menu->sym) | ||
| 248 | return menu->sym->name; | ||
| 249 | return NULL; | ||
| 250 | } | ||
| 251 | |||
| 252 | struct menu *menu_get_root_menu(struct menu *menu) | ||
| 253 | { | ||
| 254 | return &rootmenu; | ||
| 255 | } | ||
| 256 | |||
| 257 | struct menu *menu_get_parent_menu(struct menu *menu) | ||
| 258 | { | ||
| 259 | enum prop_type type; | ||
| 260 | |||
| 261 | while (menu != &rootmenu) { | ||
| 262 | menu = menu->parent; | ||
| 263 | type = menu->prompt ? menu->prompt->type : 0; | ||
| 264 | if (type == P_MENU || type == P_ROOTMENU) | ||
| 265 | break; | ||
| 266 | } | ||
| 267 | return menu; | ||
| 268 | } | ||
| 269 | |||
| 270 | struct file *file_lookup(const char *name) | ||
| 271 | { | ||
| 272 | struct file *file; | ||
| 273 | |||
| 274 | for (file = file_list; file; file = file->next) { | ||
| 275 | if (!strcmp(name, file->name)) | ||
| 276 | return file; | ||
| 277 | } | ||
| 278 | |||
| 279 | file = malloc(sizeof(*file)); | ||
| 280 | memset(file, 0, sizeof(*file)); | ||
| 281 | file->name = strdup(name); | ||
| 282 | file->next = file_list; | ||
| 283 | file_list = file; | ||
| 284 | return file; | ||
| 285 | } | ||
| 286 | |||
| 287 | int file_write_dep(const char *name) | ||
| 288 | { | ||
| 289 | struct file *file; | ||
| 290 | FILE *out; | ||
| 291 | |||
| 292 | if (!name) | ||
| 293 | name = ".config.cmd"; | ||
| 294 | out = fopen(".config.tmp", "w"); | ||
| 295 | if (!out) | ||
| 296 | return 1; | ||
| 297 | fprintf(out, "deps_config := \\\n"); | ||
| 298 | for (file = file_list; file; file = file->next) { | ||
| 299 | if (file->next) | ||
| 300 | fprintf(out, "\t%s \\\n", file->name); | ||
| 301 | else | ||
| 302 | fprintf(out, "\t%s\n", file->name); | ||
| 303 | } | ||
| 304 | fprintf(out, "\n.config include/config.h: $(deps_config)\n\n$(deps_config):\n"); | ||
| 305 | fclose(out); | ||
| 306 | rename(".config.tmp", name); | ||
| 307 | return 0; | ||
| 308 | } | ||
| 309 | |||
diff --git a/scripts/lxdialog/menubox.c b/scripts/config/menubox.c index a234e9f3b..b9cf4b6a3 100644 --- a/scripts/lxdialog/menubox.c +++ b/scripts/config/menubox.c | |||
| @@ -93,7 +93,7 @@ print_item (WINDOW * win, const char *item, int choice, int selected, int hotkey | |||
| 93 | } | 93 | } |
| 94 | if (selected) { | 94 | if (selected) { |
| 95 | wmove (win, choice, item_x+1); | 95 | wmove (win, choice, item_x+1); |
| 96 | wrefresh (win); | 96 | wnoutrefresh (win); |
| 97 | } | 97 | } |
| 98 | } | 98 | } |
| 99 | 99 | ||
| @@ -165,8 +165,7 @@ print_buttons (WINDOW *win, int height, int width, int selected) | |||
| 165 | int | 165 | int |
| 166 | dialog_menu (const char *title, const char *prompt, int height, int width, | 166 | dialog_menu (const char *title, const char *prompt, int height, int width, |
| 167 | int menu_height, const char *current, int item_no, | 167 | int menu_height, const char *current, int item_no, |
| 168 | const char * const * items) | 168 | struct dialog_list_item ** items) |
| 169 | |||
| 170 | { | 169 | { |
| 171 | int i, j, x, y, box_x, box_y; | 170 | int i, j, x, y, box_x, box_y; |
| 172 | int key = 0, button = 0, scroll = 0, choice = 0, first_item = 0, max_choice; | 171 | int key = 0, button = 0, scroll = 0, choice = 0, first_item = 0, max_choice; |
| @@ -230,8 +229,8 @@ dialog_menu (const char *title, const char *prompt, int height, int width, | |||
| 230 | */ | 229 | */ |
| 231 | item_x = 0; | 230 | item_x = 0; |
| 232 | for (i = 0; i < item_no; i++) { | 231 | for (i = 0; i < item_no; i++) { |
| 233 | item_x = MAX (item_x, MIN(menu_width, strlen (items[i * 2 + 1]) + 2)); | 232 | item_x = MAX (item_x, MIN(menu_width, strlen (items[i]->name) + 2)); |
| 234 | if (strcmp(current, items[i*2]) == 0) choice = i; | 233 | if (strcmp(current, items[i]->tag) == 0) choice = i; |
| 235 | } | 234 | } |
| 236 | 235 | ||
| 237 | item_x = (menu_width - item_x) / 2; | 236 | item_x = (menu_width - item_x) / 2; |
| @@ -261,8 +260,8 @@ dialog_menu (const char *title, const char *prompt, int height, int width, | |||
| 261 | 260 | ||
| 262 | /* Print the menu */ | 261 | /* Print the menu */ |
| 263 | for (i=0; i < max_choice; i++) { | 262 | for (i=0; i < max_choice; i++) { |
| 264 | print_item (menu, items[(first_item + i) * 2 + 1], i, i == choice, | 263 | print_item (menu, items[first_item + i]->name, i, i == choice, |
| 265 | (items[(first_item + i)*2][0] != ':')); | 264 | (items[first_item + i]->tag[0] != ':')); |
| 266 | } | 265 | } |
| 267 | 266 | ||
| 268 | wnoutrefresh (menu); | 267 | wnoutrefresh (menu); |
| @@ -283,14 +282,14 @@ dialog_menu (const char *title, const char *prompt, int height, int width, | |||
| 283 | i = max_choice; | 282 | i = max_choice; |
| 284 | else { | 283 | else { |
| 285 | for (i = choice+1; i < max_choice; i++) { | 284 | for (i = choice+1; i < max_choice; i++) { |
| 286 | j = first_alpha(items[(scroll+i)*2+1], "YyNnMm"); | 285 | j = first_alpha(items[scroll + i]->name, "YyNnMm>"); |
| 287 | if (key == tolower(items[(scroll+i)*2+1][j])) | 286 | if (key == tolower(items[scroll + i]->name[j])) |
| 288 | break; | 287 | break; |
| 289 | } | 288 | } |
| 290 | if (i == max_choice) | 289 | if (i == max_choice) |
| 291 | for (i = 0; i < max_choice; i++) { | 290 | for (i = 0; i < max_choice; i++) { |
| 292 | j = first_alpha(items[(scroll+i)*2+1], "YyNnMm"); | 291 | j = first_alpha(items[scroll + i]->name, "YyNnMm>"); |
| 293 | if (key == tolower(items[(scroll+i)*2+1][j])) | 292 | if (key == tolower(items[scroll + i]->name[j])) |
| 294 | break; | 293 | break; |
| 295 | } | 294 | } |
| 296 | } | 295 | } |
| @@ -300,8 +299,8 @@ dialog_menu (const char *title, const char *prompt, int height, int width, | |||
| 300 | key == '-' || key == '+' || | 299 | key == '-' || key == '+' || |
| 301 | key == KEY_PPAGE || key == KEY_NPAGE) { | 300 | key == KEY_PPAGE || key == KEY_NPAGE) { |
| 302 | 301 | ||
| 303 | print_item (menu, items[(scroll+choice)*2+1], choice, FALSE, | 302 | print_item (menu, items[scroll + choice]->name, choice, FALSE, |
| 304 | (items[(scroll+choice)*2][0] != ':')); | 303 | (items[scroll + choice]->tag[0] != ':')); |
| 305 | 304 | ||
| 306 | if (key == KEY_UP || key == '-') { | 305 | if (key == KEY_UP || key == '-') { |
| 307 | if (choice < 2 && scroll) { | 306 | if (choice < 2 && scroll) { |
| @@ -312,15 +311,15 @@ dialog_menu (const char *title, const char *prompt, int height, int width, | |||
| 312 | 311 | ||
| 313 | scroll--; | 312 | scroll--; |
| 314 | 313 | ||
| 315 | print_item (menu, items[scroll * 2 + 1], 0, FALSE, | 314 | print_item (menu, items[scroll * 2]->name, 0, FALSE, |
| 316 | (items[scroll*2][0] != ':')); | 315 | (items[scroll * 2]->tag[0] != ':')); |
| 317 | } else | 316 | } else |
| 318 | choice = MAX(choice - 1, 0); | 317 | choice = MAX(choice - 1, 0); |
| 319 | 318 | ||
| 320 | } else if (key == KEY_DOWN || key == '+') { | 319 | } else if (key == KEY_DOWN || key == '+') { |
| 321 | 320 | ||
| 322 | print_item (menu, items[(scroll+choice)*2+1], choice, FALSE, | 321 | print_item (menu, items[scroll + choice]->name, choice, FALSE, |
| 323 | (items[(scroll+choice)*2][0] != ':')); | 322 | (items[scroll + choice]->tag[0] != ':')); |
| 324 | 323 | ||
| 325 | if ((choice > max_choice-3) && | 324 | if ((choice > max_choice-3) && |
| 326 | (scroll + max_choice < item_no) | 325 | (scroll + max_choice < item_no) |
| @@ -332,9 +331,9 @@ dialog_menu (const char *title, const char *prompt, int height, int width, | |||
| 332 | 331 | ||
| 333 | scroll++; | 332 | scroll++; |
| 334 | 333 | ||
| 335 | print_item (menu, items[(scroll+max_choice-1)*2+1], | 334 | print_item (menu, items[scroll + max_choice - 1]->name, |
| 336 | max_choice-1, FALSE, | 335 | max_choice-1, FALSE, |
| 337 | (items[(scroll+max_choice-1)*2][0] != ':')); | 336 | (items[scroll + max_choice - 1]->tag[0] != ':')); |
| 338 | } else | 337 | } else |
| 339 | choice = MIN(choice+1, max_choice-1); | 338 | choice = MIN(choice+1, max_choice-1); |
| 340 | 339 | ||
| @@ -344,8 +343,8 @@ dialog_menu (const char *title, const char *prompt, int height, int width, | |||
| 344 | if (scroll > 0) { | 343 | if (scroll > 0) { |
| 345 | wscrl (menu, -1); | 344 | wscrl (menu, -1); |
| 346 | scroll--; | 345 | scroll--; |
| 347 | print_item (menu, items[scroll * 2 + 1], 0, FALSE, | 346 | print_item (menu, items[scroll * 2]->name, 0, FALSE, |
| 348 | (items[scroll*2][0] != ':')); | 347 | (items[scroll * 2]->tag[0] != ':')); |
| 349 | } else { | 348 | } else { |
| 350 | if (choice > 0) | 349 | if (choice > 0) |
| 351 | choice--; | 350 | choice--; |
| @@ -360,9 +359,9 @@ dialog_menu (const char *title, const char *prompt, int height, int width, | |||
| 360 | scroll(menu); | 359 | scroll(menu); |
| 361 | scrollok (menu, FALSE); | 360 | scrollok (menu, FALSE); |
| 362 | scroll++; | 361 | scroll++; |
| 363 | print_item (menu, items[(scroll+max_choice-1)*2+1], | 362 | print_item (menu, items[scroll + max_choice - 1]->name, |
| 364 | max_choice-1, FALSE, | 363 | max_choice-1, FALSE, |
| 365 | (items[(scroll+max_choice-1)*2][0] != ':')); | 364 | (items[scroll + max_choice - 1]->tag[0] != ':')); |
| 366 | } else { | 365 | } else { |
| 367 | if (choice+1 < max_choice) | 366 | if (choice+1 < max_choice) |
| 368 | choice++; | 367 | choice++; |
| @@ -372,8 +371,8 @@ dialog_menu (const char *title, const char *prompt, int height, int width, | |||
| 372 | } else | 371 | } else |
| 373 | choice = i; | 372 | choice = i; |
| 374 | 373 | ||
| 375 | print_item (menu, items[(scroll+choice)*2+1], choice, TRUE, | 374 | print_item (menu, items[scroll + choice]->name, choice, TRUE, |
| 376 | (items[(scroll+choice)*2][0] != ':')); | 375 | (items[scroll + choice]->tag[0] != ':')); |
| 377 | 376 | ||
| 378 | print_arrows(dialog, item_no, scroll, | 377 | print_arrows(dialog, item_no, scroll, |
| 379 | box_y, box_x+item_x+1, menu_height); | 378 | box_y, box_x+item_x+1, menu_height); |
| @@ -405,7 +404,7 @@ dialog_menu (const char *title, const char *prompt, int height, int width, | |||
| 405 | fclose(f); | 404 | fclose(f); |
| 406 | } | 405 | } |
| 407 | delwin (dialog); | 406 | delwin (dialog); |
| 408 | fprintf(stderr, "%s\n", items[(scroll + choice) * 2]); | 407 | items[scroll + choice]->selected = 1; |
| 409 | switch (key) { | 408 | switch (key) { |
| 410 | case 's': return 3; | 409 | case 's': return 3; |
| 411 | case 'y': return 3; | 410 | case 'y': return 3; |
| @@ -419,13 +418,7 @@ dialog_menu (const char *title, const char *prompt, int height, int width, | |||
| 419 | button = 2; | 418 | button = 2; |
| 420 | case '\n': | 419 | case '\n': |
| 421 | delwin (dialog); | 420 | delwin (dialog); |
| 422 | if (button == 2) | 421 | items[scroll + choice]->selected = 1; |
| 423 | fprintf(stderr, "%s \"%s\"\n", | ||
| 424 | items[(scroll + choice) * 2], | ||
| 425 | items[(scroll + choice) * 2 + 1] + | ||
| 426 | first_alpha(items[(scroll + choice) * 2 + 1],"")); | ||
| 427 | else | ||
| 428 | fprintf(stderr, "%s\n", items[(scroll + choice) * 2]); | ||
| 429 | 422 | ||
| 430 | remove("lxdialog.scrltmp"); | 423 | remove("lxdialog.scrltmp"); |
| 431 | return button; | 424 | return button; |
diff --git a/scripts/lxdialog/msgbox.c b/scripts/config/msgbox.c index 93692e1fb..93692e1fb 100644 --- a/scripts/lxdialog/msgbox.c +++ b/scripts/config/msgbox.c | |||
diff --git a/scripts/config/symbol.c b/scripts/config/symbol.c new file mode 100644 index 000000000..f2d0015de --- /dev/null +++ b/scripts/config/symbol.c | |||
| @@ -0,0 +1,629 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 3 | * Released under the terms of the GNU GPL v2.0. | ||
| 4 | */ | ||
| 5 | |||
| 6 | #include <ctype.h> | ||
| 7 | #include <stdlib.h> | ||
| 8 | #include <string.h> | ||
| 9 | #include <sys/utsname.h> | ||
| 10 | |||
| 11 | #define LKC_DIRECT_LINK | ||
| 12 | #include "lkc.h" | ||
| 13 | |||
| 14 | struct symbol symbol_yes = { | ||
| 15 | name: "y", | ||
| 16 | curr: { "y", yes }, | ||
| 17 | flags: SYMBOL_YES|SYMBOL_VALID, | ||
| 18 | }, symbol_mod = { | ||
| 19 | name: "m", | ||
| 20 | curr: { "m", mod }, | ||
| 21 | flags: SYMBOL_MOD|SYMBOL_VALID, | ||
| 22 | }, symbol_no = { | ||
| 23 | name: "n", | ||
| 24 | curr: { "n", no }, | ||
| 25 | flags: SYMBOL_NO|SYMBOL_VALID, | ||
| 26 | }, symbol_empty = { | ||
| 27 | name: "", | ||
| 28 | curr: { "", no }, | ||
| 29 | flags: SYMBOL_VALID, | ||
| 30 | }; | ||
| 31 | |||
| 32 | int sym_change_count; | ||
| 33 | struct symbol *modules_sym; | ||
| 34 | |||
| 35 | void sym_add_default(struct symbol *sym, const char *def) | ||
| 36 | { | ||
| 37 | struct property *prop = create_prop(P_DEFAULT); | ||
| 38 | struct property **propp; | ||
| 39 | |||
| 40 | prop->sym = sym; | ||
| 41 | prop->def = sym_lookup(def, 1); | ||
| 42 | |||
| 43 | /* append property to the prop list of symbol */ | ||
| 44 | if (prop->sym) { | ||
| 45 | for (propp = &prop->sym->prop; *propp; propp = &(*propp)->next) | ||
| 46 | ; | ||
| 47 | *propp = prop; | ||
| 48 | } | ||
| 49 | } | ||
| 50 | |||
| 51 | void sym_init(void) | ||
| 52 | { | ||
| 53 | struct symbol *sym; | ||
| 54 | struct utsname uts; | ||
| 55 | char *p; | ||
| 56 | static bool inited = false; | ||
| 57 | |||
| 58 | if (inited) | ||
| 59 | return; | ||
| 60 | inited = true; | ||
| 61 | |||
| 62 | uname(&uts); | ||
| 63 | |||
| 64 | #if 0 | ||
| 65 | sym = sym_lookup("ARCH", 0); | ||
| 66 | sym->type = S_STRING; | ||
| 67 | sym->flags |= SYMBOL_AUTO; | ||
| 68 | p = getenv("ARCH"); | ||
| 69 | if (p) | ||
| 70 | sym_add_default(sym, p); | ||
| 71 | #endif | ||
| 72 | |||
| 73 | sym = sym_lookup("VERSION", 0); | ||
| 74 | sym->type = S_STRING; | ||
| 75 | sym->flags |= SYMBOL_AUTO; | ||
| 76 | p = getenv("VERSION"); | ||
| 77 | if (p) | ||
| 78 | sym_add_default(sym, p); | ||
| 79 | |||
| 80 | #if 0 | ||
| 81 | sym = sym_lookup("UNAME_RELEASE", 0); | ||
| 82 | sym->type = S_STRING; | ||
| 83 | sym->flags |= SYMBOL_AUTO; | ||
| 84 | sym_add_default(sym, uts.release); | ||
| 85 | #endif | ||
| 86 | |||
| 87 | sym = sym_lookup("TARGET_ARCH", 0); | ||
| 88 | sym->type = S_STRING; | ||
| 89 | sym->flags |= SYMBOL_AUTO; | ||
| 90 | p = getenv("TARGET_ARCH"); | ||
| 91 | if (p) | ||
| 92 | sym_add_default(sym, p); | ||
| 93 | } | ||
| 94 | |||
| 95 | int sym_get_type(struct symbol *sym) | ||
| 96 | { | ||
| 97 | int type = sym->type; | ||
| 98 | if (type == S_TRISTATE) { | ||
| 99 | if (sym_is_choice_value(sym) && sym->visible == yes) | ||
| 100 | type = S_BOOLEAN; | ||
| 101 | else { | ||
| 102 | sym_calc_value(modules_sym); | ||
| 103 | if (S_TRI(modules_sym->curr) == no) | ||
| 104 | type = S_BOOLEAN; | ||
| 105 | } | ||
| 106 | } | ||
| 107 | return type; | ||
| 108 | } | ||
| 109 | |||
| 110 | const char *sym_type_name(int type) | ||
| 111 | { | ||
| 112 | switch (type) { | ||
| 113 | case S_BOOLEAN: | ||
| 114 | return "boolean"; | ||
| 115 | case S_TRISTATE: | ||
| 116 | return "tristate"; | ||
| 117 | case S_INT: | ||
| 118 | return "integer"; | ||
| 119 | case S_HEX: | ||
| 120 | return "hex"; | ||
| 121 | case S_STRING: | ||
| 122 | return "string"; | ||
| 123 | case S_UNKNOWN: | ||
| 124 | return "unknown"; | ||
| 125 | } | ||
| 126 | return "???"; | ||
| 127 | } | ||
| 128 | |||
| 129 | struct property *sym_get_choice_prop(struct symbol *sym) | ||
| 130 | { | ||
| 131 | struct property *prop; | ||
| 132 | |||
| 133 | for_all_choices(sym, prop) | ||
| 134 | return prop; | ||
| 135 | return NULL; | ||
| 136 | } | ||
| 137 | |||
| 138 | struct property *sym_get_default_prop(struct symbol *sym) | ||
| 139 | { | ||
| 140 | struct property *prop; | ||
| 141 | tristate visible; | ||
| 142 | |||
| 143 | for_all_defaults(sym, prop) { | ||
| 144 | visible = E_CALC(prop->visible); | ||
| 145 | if (visible != no) | ||
| 146 | return prop; | ||
| 147 | } | ||
| 148 | return NULL; | ||
| 149 | } | ||
| 150 | |||
| 151 | void sym_calc_visibility(struct symbol *sym) | ||
| 152 | { | ||
| 153 | struct property *prop; | ||
| 154 | tristate visible, oldvisible; | ||
| 155 | |||
| 156 | /* any prompt visible? */ | ||
| 157 | oldvisible = sym->visible; | ||
| 158 | visible = no; | ||
| 159 | for_all_prompts(sym, prop) | ||
| 160 | visible = E_OR(visible, E_CALC(prop->visible)); | ||
| 161 | if (oldvisible != visible) { | ||
| 162 | sym->visible = visible; | ||
| 163 | sym->flags |= SYMBOL_CHANGED; | ||
| 164 | } | ||
| 165 | } | ||
| 166 | |||
| 167 | void sym_calc_value(struct symbol *sym) | ||
| 168 | { | ||
| 169 | struct symbol_value newval, oldval; | ||
| 170 | struct property *prop, *def_prop; | ||
| 171 | struct symbol *def_sym; | ||
| 172 | struct expr *e; | ||
| 173 | |||
| 174 | if (sym->flags & SYMBOL_VALID) | ||
| 175 | return; | ||
| 176 | |||
| 177 | oldval = sym->curr; | ||
| 178 | |||
| 179 | switch (sym->type) { | ||
| 180 | case S_INT: | ||
| 181 | case S_HEX: | ||
| 182 | case S_STRING: | ||
| 183 | newval = symbol_empty.curr; | ||
| 184 | break; | ||
| 185 | case S_BOOLEAN: | ||
| 186 | case S_TRISTATE: | ||
| 187 | newval = symbol_no.curr; | ||
| 188 | break; | ||
| 189 | default: | ||
| 190 | S_VAL(newval) = sym->name; | ||
| 191 | S_TRI(newval) = no; | ||
| 192 | if (sym->flags & SYMBOL_CONST) { | ||
| 193 | goto out; | ||
| 194 | } | ||
| 195 | //newval = symbol_empty.curr; | ||
| 196 | // generate warning somewhere here later | ||
| 197 | //S_TRI(newval) = yes; | ||
| 198 | goto out; | ||
| 199 | } | ||
| 200 | sym->flags |= SYMBOL_VALID; | ||
| 201 | if (!sym_is_choice_value(sym)) | ||
| 202 | sym->flags &= ~SYMBOL_WRITE; | ||
| 203 | |||
| 204 | sym_calc_visibility(sym); | ||
| 205 | |||
| 206 | /* set default if recursively called */ | ||
| 207 | sym->curr = newval; | ||
| 208 | |||
| 209 | if (sym->visible != no) { | ||
| 210 | sym->flags |= SYMBOL_WRITE; | ||
| 211 | if (!sym_has_value(sym)) { | ||
| 212 | if (!sym_is_choice(sym)) { | ||
| 213 | prop = sym_get_default_prop(sym); | ||
| 214 | if (prop) { | ||
| 215 | sym_calc_value(prop->def); | ||
| 216 | newval = prop->def->curr; | ||
| 217 | } | ||
| 218 | } | ||
| 219 | } else | ||
| 220 | newval = sym->def; | ||
| 221 | |||
| 222 | S_TRI(newval) = E_AND(S_TRI(newval), sym->visible); | ||
| 223 | /* if the symbol is visible and not optionial, | ||
| 224 | * possibly ignore old user choice. */ | ||
| 225 | if (!sym_is_optional(sym) && S_TRI(newval) == no) | ||
| 226 | S_TRI(newval) = sym->visible; | ||
| 227 | if (sym_is_choice_value(sym) && sym->visible == yes) { | ||
| 228 | prop = sym_get_choice_prop(sym); | ||
| 229 | S_TRI(newval) = (S_VAL(prop->def->curr) == sym) ? yes : no; | ||
| 230 | } | ||
| 231 | } else { | ||
| 232 | prop = sym_get_default_prop(sym); | ||
| 233 | if (prop) { | ||
| 234 | sym->flags |= SYMBOL_WRITE; | ||
| 235 | sym_calc_value(prop->def); | ||
| 236 | newval = prop->def->curr; | ||
| 237 | } | ||
| 238 | } | ||
| 239 | |||
| 240 | switch (sym_get_type(sym)) { | ||
| 241 | case S_TRISTATE: | ||
| 242 | if (S_TRI(newval) != mod) | ||
| 243 | break; | ||
| 244 | sym_calc_value(modules_sym); | ||
| 245 | if (S_TRI(modules_sym->curr) == no) | ||
| 246 | S_TRI(newval) = yes; | ||
| 247 | break; | ||
| 248 | case S_BOOLEAN: | ||
| 249 | if (S_TRI(newval) == mod) | ||
| 250 | S_TRI(newval) = yes; | ||
| 251 | } | ||
| 252 | |||
| 253 | out: | ||
| 254 | sym->curr = newval; | ||
| 255 | |||
| 256 | if (sym_is_choice(sym) && S_TRI(newval) == yes) { | ||
| 257 | def_sym = S_VAL(sym->def); | ||
| 258 | if (def_sym) { | ||
| 259 | sym_calc_visibility(def_sym); | ||
| 260 | if (def_sym->visible == no) | ||
| 261 | def_sym = NULL; | ||
| 262 | } | ||
| 263 | if (!def_sym) { | ||
| 264 | for_all_defaults(sym, def_prop) { | ||
| 265 | if (E_CALC(def_prop->visible) == no) | ||
| 266 | continue; | ||
| 267 | sym_calc_visibility(def_prop->def); | ||
| 268 | if (def_prop->def->visible != no) { | ||
| 269 | def_sym = def_prop->def; | ||
| 270 | break; | ||
| 271 | } | ||
| 272 | } | ||
| 273 | } | ||
| 274 | |||
| 275 | if (!def_sym) { | ||
| 276 | prop = sym_get_choice_prop(sym); | ||
| 277 | for (e = prop->dep; e; e = e->left.expr) { | ||
| 278 | sym_calc_visibility(e->right.sym); | ||
| 279 | if (e->right.sym->visible != no) { | ||
| 280 | def_sym = e->right.sym; | ||
| 281 | break; | ||
| 282 | } | ||
| 283 | } | ||
| 284 | } | ||
| 285 | |||
| 286 | S_VAL(newval) = def_sym; | ||
| 287 | } | ||
| 288 | |||
| 289 | if (memcmp(&oldval, &newval, sizeof(newval))) | ||
| 290 | sym->flags |= SYMBOL_CHANGED; | ||
| 291 | sym->curr = newval; | ||
| 292 | |||
| 293 | if (sym_is_choice(sym)) { | ||
| 294 | int flags = sym->flags & (SYMBOL_CHANGED | SYMBOL_WRITE); | ||
| 295 | prop = sym_get_choice_prop(sym); | ||
| 296 | for (e = prop->dep; e; e = e->left.expr) | ||
| 297 | e->right.sym->flags |= flags; | ||
| 298 | } | ||
| 299 | } | ||
| 300 | |||
| 301 | void sym_clear_all_valid(void) | ||
| 302 | { | ||
| 303 | struct symbol *sym; | ||
| 304 | int i; | ||
| 305 | |||
| 306 | for_all_symbols(i, sym) | ||
| 307 | sym->flags &= ~SYMBOL_VALID; | ||
| 308 | sym_change_count++; | ||
| 309 | } | ||
| 310 | |||
| 311 | void sym_set_all_changed(void) | ||
| 312 | { | ||
| 313 | struct symbol *sym; | ||
| 314 | int i; | ||
| 315 | |||
| 316 | for_all_symbols(i, sym) | ||
| 317 | sym->flags |= SYMBOL_CHANGED; | ||
| 318 | } | ||
| 319 | |||
| 320 | bool sym_tristate_within_range(struct symbol *sym, tristate val) | ||
| 321 | { | ||
| 322 | int type = sym_get_type(sym); | ||
| 323 | |||
| 324 | if (sym->visible == no) | ||
| 325 | return false; | ||
| 326 | |||
| 327 | if (type != S_BOOLEAN && type != S_TRISTATE) | ||
| 328 | return false; | ||
| 329 | |||
| 330 | switch (val) { | ||
| 331 | case no: | ||
| 332 | if (sym_is_choice_value(sym) && sym->visible == yes) | ||
| 333 | return false; | ||
| 334 | return sym_is_optional(sym); | ||
| 335 | case mod: | ||
| 336 | if (sym_is_choice_value(sym) && sym->visible == yes) | ||
| 337 | return false; | ||
| 338 | return type == S_TRISTATE; | ||
| 339 | case yes: | ||
| 340 | return type == S_BOOLEAN || sym->visible == yes; | ||
| 341 | } | ||
| 342 | return false; | ||
| 343 | } | ||
| 344 | |||
| 345 | bool sym_set_tristate_value(struct symbol *sym, tristate val) | ||
| 346 | { | ||
| 347 | tristate oldval = sym_get_tristate_value(sym); | ||
| 348 | |||
| 349 | if (oldval != val && !sym_tristate_within_range(sym, val)) | ||
| 350 | return false; | ||
| 351 | |||
| 352 | if (sym->flags & SYMBOL_NEW) { | ||
| 353 | sym->flags &= ~SYMBOL_NEW; | ||
| 354 | sym->flags |= SYMBOL_CHANGED; | ||
| 355 | } | ||
| 356 | if (sym_is_choice_value(sym) && val == yes) { | ||
| 357 | struct property *prop = sym_get_choice_prop(sym); | ||
| 358 | |||
| 359 | S_VAL(prop->def->def) = sym; | ||
| 360 | prop->def->flags &= ~SYMBOL_NEW; | ||
| 361 | } | ||
| 362 | |||
| 363 | S_TRI(sym->def) = val; | ||
| 364 | if (oldval != val) { | ||
| 365 | sym_clear_all_valid(); | ||
| 366 | if (sym == modules_sym) | ||
| 367 | sym_set_all_changed(); | ||
| 368 | } | ||
| 369 | |||
| 370 | return true; | ||
| 371 | } | ||
| 372 | |||
| 373 | tristate sym_toggle_tristate_value(struct symbol *sym) | ||
| 374 | { | ||
| 375 | tristate oldval, newval; | ||
| 376 | |||
| 377 | oldval = newval = sym_get_tristate_value(sym); | ||
| 378 | do { | ||
| 379 | switch (newval) { | ||
| 380 | case no: | ||
| 381 | newval = mod; | ||
| 382 | break; | ||
| 383 | case mod: | ||
| 384 | newval = yes; | ||
| 385 | break; | ||
| 386 | case yes: | ||
| 387 | newval = no; | ||
| 388 | break; | ||
| 389 | } | ||
| 390 | if (sym_set_tristate_value(sym, newval)) | ||
| 391 | break; | ||
| 392 | } while (oldval != newval); | ||
| 393 | return newval; | ||
| 394 | } | ||
| 395 | |||
| 396 | bool sym_string_valid(struct symbol *sym, const char *str) | ||
| 397 | { | ||
| 398 | char ch; | ||
| 399 | |||
| 400 | switch (sym->type) { | ||
| 401 | case S_STRING: | ||
| 402 | return true; | ||
| 403 | case S_INT: | ||
| 404 | ch = *str++; | ||
| 405 | if (ch == '-') | ||
| 406 | ch = *str++; | ||
| 407 | if (!isdigit((int)ch)) | ||
| 408 | return false; | ||
| 409 | if (ch == '0' && *str != 0) | ||
| 410 | return false; | ||
| 411 | while ((ch = *str++)) { | ||
| 412 | if (!isdigit((int)ch)) | ||
| 413 | return false; | ||
| 414 | } | ||
| 415 | return true; | ||
| 416 | case S_HEX: | ||
| 417 | if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X')) | ||
| 418 | str += 2; | ||
| 419 | ch = *str++; | ||
| 420 | do { | ||
| 421 | if (!isxdigit((int)ch)) | ||
| 422 | return false; | ||
| 423 | } while ((ch = *str++)); | ||
| 424 | return true; | ||
| 425 | case S_BOOLEAN: | ||
| 426 | case S_TRISTATE: | ||
| 427 | switch (str[0]) { | ||
| 428 | case 'y': | ||
| 429 | case 'Y': | ||
| 430 | return sym_tristate_within_range(sym, yes); | ||
| 431 | case 'm': | ||
| 432 | case 'M': | ||
| 433 | return sym_tristate_within_range(sym, mod); | ||
| 434 | case 'n': | ||
| 435 | case 'N': | ||
| 436 | return sym_tristate_within_range(sym, no); | ||
| 437 | } | ||
| 438 | return false; | ||
| 439 | default: | ||
| 440 | return false; | ||
| 441 | } | ||
| 442 | } | ||
| 443 | |||
| 444 | bool sym_set_string_value(struct symbol *sym, const char *newval) | ||
| 445 | { | ||
| 446 | const char *oldval; | ||
| 447 | char *val; | ||
| 448 | int size; | ||
| 449 | |||
| 450 | switch (sym->type) { | ||
| 451 | case S_BOOLEAN: | ||
| 452 | case S_TRISTATE: | ||
| 453 | switch (newval[0]) { | ||
| 454 | case 'y': | ||
| 455 | case 'Y': | ||
| 456 | return sym_set_tristate_value(sym, yes); | ||
| 457 | case 'm': | ||
| 458 | case 'M': | ||
| 459 | return sym_set_tristate_value(sym, mod); | ||
| 460 | case 'n': | ||
| 461 | case 'N': | ||
| 462 | return sym_set_tristate_value(sym, no); | ||
| 463 | } | ||
| 464 | return false; | ||
| 465 | default: | ||
| 466 | ; | ||
| 467 | } | ||
| 468 | |||
| 469 | if (!sym_string_valid(sym, newval)) | ||
| 470 | return false; | ||
| 471 | |||
| 472 | if (sym->flags & SYMBOL_NEW) { | ||
| 473 | sym->flags &= ~SYMBOL_NEW; | ||
| 474 | sym->flags |= SYMBOL_CHANGED; | ||
| 475 | } | ||
| 476 | |||
| 477 | oldval = S_VAL(sym->def); | ||
| 478 | size = strlen(newval) + 1; | ||
| 479 | if (sym->type == S_HEX && (newval[0] != '0' || (newval[1] != 'x' && newval[1] != 'X'))) { | ||
| 480 | size += 2; | ||
| 481 | S_VAL(sym->def) = val = malloc(size); | ||
| 482 | *val++ = '0'; | ||
| 483 | *val++ = 'x'; | ||
| 484 | } else if (!oldval || strcmp(oldval, newval)) | ||
| 485 | S_VAL(sym->def) = val = malloc(size); | ||
| 486 | else | ||
| 487 | return true; | ||
| 488 | |||
| 489 | strcpy(val, newval); | ||
| 490 | free((void *)oldval); | ||
| 491 | sym_clear_all_valid(); | ||
| 492 | |||
| 493 | return true; | ||
| 494 | } | ||
| 495 | |||
| 496 | const char *sym_get_string_value(struct symbol *sym) | ||
| 497 | { | ||
| 498 | tristate val; | ||
| 499 | |||
| 500 | switch (sym->type) { | ||
| 501 | case S_BOOLEAN: | ||
| 502 | case S_TRISTATE: | ||
| 503 | val = sym_get_tristate_value(sym); | ||
| 504 | switch (val) { | ||
| 505 | case no: | ||
| 506 | return "n"; | ||
| 507 | case mod: | ||
| 508 | return "m"; | ||
| 509 | case yes: | ||
| 510 | return "y"; | ||
| 511 | } | ||
| 512 | break; | ||
| 513 | default: | ||
| 514 | ; | ||
| 515 | } | ||
| 516 | return (const char *)S_VAL(sym->curr); | ||
| 517 | } | ||
| 518 | |||
| 519 | bool sym_is_changable(struct symbol *sym) | ||
| 520 | { | ||
| 521 | if (sym->visible == no) | ||
| 522 | return false; | ||
| 523 | /* at least 'n' and 'y'/'m' is selectable */ | ||
| 524 | if (sym_is_optional(sym)) | ||
| 525 | return true; | ||
| 526 | /* no 'n', so 'y' and 'm' must be selectable */ | ||
| 527 | if (sym_get_type(sym) == S_TRISTATE && sym->visible == yes) | ||
| 528 | return true; | ||
| 529 | return false; | ||
| 530 | } | ||
| 531 | |||
| 532 | struct symbol *sym_lookup(const char *name, int isconst) | ||
| 533 | { | ||
| 534 | struct symbol *symbol; | ||
| 535 | const char *ptr; | ||
| 536 | char *new_name; | ||
| 537 | int hash = 0; | ||
| 538 | |||
| 539 | //printf("lookup: %s -> ", name); | ||
| 540 | if (name) { | ||
| 541 | if (name[0] && !name[1]) { | ||
| 542 | switch (name[0]) { | ||
| 543 | case 'y': return &symbol_yes; | ||
| 544 | case 'm': return &symbol_mod; | ||
| 545 | case 'n': return &symbol_no; | ||
| 546 | } | ||
| 547 | } | ||
| 548 | for (ptr = name; *ptr; ptr++) | ||
| 549 | hash += *ptr; | ||
| 550 | hash &= 0xff; | ||
| 551 | |||
| 552 | for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) { | ||
| 553 | if (!strcmp(symbol->name, name)) { | ||
| 554 | if ((isconst && symbol->flags & SYMBOL_CONST) || | ||
| 555 | (!isconst && !(symbol->flags & SYMBOL_CONST))) { | ||
| 556 | //printf("h:%p\n", symbol); | ||
| 557 | return symbol; | ||
| 558 | } | ||
| 559 | } | ||
| 560 | } | ||
| 561 | new_name = strdup(name); | ||
| 562 | } else { | ||
| 563 | new_name = NULL; | ||
| 564 | hash = 256; | ||
| 565 | } | ||
| 566 | |||
| 567 | symbol = malloc(sizeof(*symbol)); | ||
| 568 | memset(symbol, 0, sizeof(*symbol)); | ||
| 569 | symbol->name = new_name; | ||
| 570 | symbol->type = S_UNKNOWN; | ||
| 571 | symbol->flags = SYMBOL_NEW; | ||
| 572 | if (isconst) | ||
| 573 | symbol->flags |= SYMBOL_CONST; | ||
| 574 | |||
| 575 | symbol->next = symbol_hash[hash]; | ||
| 576 | symbol_hash[hash] = symbol; | ||
| 577 | |||
| 578 | //printf("n:%p\n", symbol); | ||
| 579 | return symbol; | ||
| 580 | } | ||
| 581 | |||
| 582 | struct symbol *sym_find(const char *name) | ||
| 583 | { | ||
| 584 | struct symbol *symbol = NULL; | ||
| 585 | const char *ptr; | ||
| 586 | int hash = 0; | ||
| 587 | |||
| 588 | if (!name) | ||
| 589 | return NULL; | ||
| 590 | |||
| 591 | if (name[0] && !name[1]) { | ||
| 592 | switch (name[0]) { | ||
| 593 | case 'y': return &symbol_yes; | ||
| 594 | case 'm': return &symbol_mod; | ||
| 595 | case 'n': return &symbol_no; | ||
| 596 | } | ||
| 597 | } | ||
| 598 | for (ptr = name; *ptr; ptr++) | ||
| 599 | hash += *ptr; | ||
| 600 | hash &= 0xff; | ||
| 601 | |||
| 602 | for (symbol = symbol_hash[hash]; symbol; symbol = symbol->next) { | ||
| 603 | if (!strcmp(symbol->name, name) && | ||
| 604 | !(symbol->flags & SYMBOL_CONST)) | ||
| 605 | break; | ||
| 606 | } | ||
| 607 | |||
| 608 | return symbol; | ||
| 609 | } | ||
| 610 | |||
| 611 | const char *prop_get_type_name(enum prop_type type) | ||
| 612 | { | ||
| 613 | switch (type) { | ||
| 614 | case P_PROMPT: | ||
| 615 | return "prompt"; | ||
| 616 | case P_COMMENT: | ||
| 617 | return "comment"; | ||
| 618 | case P_MENU: | ||
| 619 | return "menu"; | ||
| 620 | case P_ROOTMENU: | ||
| 621 | return "rootmenu"; | ||
| 622 | case P_DEFAULT: | ||
| 623 | return "default"; | ||
| 624 | case P_CHOICE: | ||
| 625 | return "choice"; | ||
| 626 | default: | ||
| 627 | return "unknown"; | ||
| 628 | } | ||
| 629 | } | ||
diff --git a/scripts/lxdialog/textbox.c b/scripts/config/textbox.c index ecf55410e..8fe907718 100644 --- a/scripts/lxdialog/textbox.c +++ b/scripts/config/textbox.c | |||
| @@ -317,7 +317,7 @@ dialog_textbox (const char *title, const char *file, int height, int width) | |||
| 317 | delwin (dialog); | 317 | delwin (dialog); |
| 318 | free (buf); | 318 | free (buf); |
| 319 | close (fd); | 319 | close (fd); |
| 320 | return -1; /* ESC pressed */ | 320 | return 1; /* ESC pressed */ |
| 321 | } | 321 | } |
| 322 | 322 | ||
| 323 | /* | 323 | /* |
diff --git a/scripts/lxdialog/util.c b/scripts/config/util.c index b3a7af9d2..d20730b88 100644 --- a/scripts/lxdialog/util.c +++ b/scripts/config/util.c | |||
| @@ -25,7 +25,7 @@ | |||
| 25 | /* use colors by default? */ | 25 | /* use colors by default? */ |
| 26 | bool use_colors = 1; | 26 | bool use_colors = 1; |
| 27 | 27 | ||
| 28 | const char *backtitle = NULL; | 28 | char *backtitle = NULL; |
| 29 | 29 | ||
| 30 | const char *dialog_result; | 30 | const char *dialog_result; |
| 31 | 31 | ||
| @@ -357,3 +357,19 @@ first_alpha(const char *string, const char *exempt) | |||
| 357 | 357 | ||
| 358 | return 0; | 358 | return 0; |
| 359 | } | 359 | } |
| 360 | |||
| 361 | /* | ||
| 362 | * Get the first selected item in the dialog_list_item list. | ||
| 363 | */ | ||
| 364 | struct dialog_list_item * | ||
| 365 | first_sel_item(int item_no, struct dialog_list_item ** items) | ||
| 366 | { | ||
| 367 | int i; | ||
| 368 | |||
| 369 | for (i = 0; i < item_no; i++) { | ||
| 370 | if (items[i]->selected) | ||
| 371 | return items[i]; | ||
| 372 | } | ||
| 373 | |||
| 374 | return NULL; | ||
| 375 | } | ||
diff --git a/scripts/lxdialog/yesno.c b/scripts/config/yesno.c index 11fcc25f5..11fcc25f5 100644 --- a/scripts/lxdialog/yesno.c +++ b/scripts/config/yesno.c | |||
diff --git a/scripts/config/zconf.l b/scripts/config/zconf.l new file mode 100644 index 000000000..a412bf411 --- /dev/null +++ b/scripts/config/zconf.l | |||
| @@ -0,0 +1,332 @@ | |||
| 1 | %option backup nostdinit noyywrap never-interactive full ecs | ||
| 2 | %option 8bit backup nodefault perf-report perf-report | ||
| 3 | %x COMMAND HELP STRING PARAM | ||
| 4 | %{ | ||
| 5 | /* | ||
| 6 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 7 | * Released under the terms of the GNU GPL v2.0. | ||
| 8 | */ | ||
| 9 | |||
| 10 | #include <stdio.h> | ||
| 11 | #include <stdlib.h> | ||
| 12 | #include <string.h> | ||
| 13 | #include <unistd.h> | ||
| 14 | |||
| 15 | #define LKC_DIRECT_LINK | ||
| 16 | #include "lkc.h" | ||
| 17 | #include "zconf.tab.h" | ||
| 18 | |||
| 19 | #define START_STRSIZE 16 | ||
| 20 | |||
| 21 | char *text; | ||
| 22 | static char *text_ptr; | ||
| 23 | static int text_size, text_asize; | ||
| 24 | |||
| 25 | struct buffer { | ||
| 26 | struct buffer *parent; | ||
| 27 | YY_BUFFER_STATE state; | ||
| 28 | }; | ||
| 29 | |||
| 30 | struct buffer *current_buf; | ||
| 31 | |||
| 32 | static int last_ts, first_ts; | ||
| 33 | |||
| 34 | static void zconf_endhelp(void); | ||
| 35 | static struct buffer *zconf_endfile(void); | ||
| 36 | |||
| 37 | void new_string(void) | ||
| 38 | { | ||
| 39 | text = malloc(START_STRSIZE); | ||
| 40 | text_asize = START_STRSIZE; | ||
| 41 | text_ptr = text; | ||
| 42 | text_size = 0; | ||
| 43 | *text_ptr = 0; | ||
| 44 | } | ||
| 45 | |||
| 46 | void append_string(const char *str, int size) | ||
| 47 | { | ||
| 48 | int new_size = text_size + size + 1; | ||
| 49 | if (new_size > text_asize) { | ||
| 50 | text = realloc(text, new_size); | ||
| 51 | text_asize = new_size; | ||
| 52 | text_ptr = text + text_size; | ||
| 53 | } | ||
| 54 | memcpy(text_ptr, str, size); | ||
| 55 | text_ptr += size; | ||
| 56 | text_size += size; | ||
| 57 | *text_ptr = 0; | ||
| 58 | } | ||
| 59 | |||
| 60 | void alloc_string(const char *str, int size) | ||
| 61 | { | ||
| 62 | text = malloc(size + 1); | ||
| 63 | memcpy(text, str, size); | ||
| 64 | text[size] = 0; | ||
| 65 | } | ||
| 66 | %} | ||
| 67 | |||
| 68 | ws [ \n\t] | ||
| 69 | n [A-Za-z0-9_] | ||
| 70 | |||
| 71 | %% | ||
| 72 | int str = 0; | ||
| 73 | int ts, i; | ||
| 74 | |||
| 75 | [ \t]*#.*\n current_file->lineno++; | ||
| 76 | [ \t]*#.* | ||
| 77 | |||
| 78 | [ \t]*\n current_file->lineno++; return T_EOL; | ||
| 79 | |||
| 80 | [ \t]+ { | ||
| 81 | BEGIN(COMMAND); | ||
| 82 | } | ||
| 83 | |||
| 84 | . { | ||
| 85 | unput(yytext[0]); | ||
| 86 | BEGIN(COMMAND); | ||
| 87 | } | ||
| 88 | |||
| 89 | |||
| 90 | <COMMAND>{ | ||
| 91 | "mainmenu" BEGIN(PARAM); return T_MAINMENU; | ||
| 92 | "menu" BEGIN(PARAM); return T_MENU; | ||
| 93 | "endmenu" BEGIN(PARAM); return T_ENDMENU; | ||
| 94 | "source" BEGIN(PARAM); return T_SOURCE; | ||
| 95 | "choice" BEGIN(PARAM); return T_CHOICE; | ||
| 96 | "endchoice" BEGIN(PARAM); return T_ENDCHOICE; | ||
| 97 | "comment" BEGIN(PARAM); return T_COMMENT; | ||
| 98 | "config" BEGIN(PARAM); return T_CONFIG; | ||
| 99 | "help" BEGIN(PARAM); return T_HELP; | ||
| 100 | "if" BEGIN(PARAM); return T_IF; | ||
| 101 | "endif" BEGIN(PARAM); return T_ENDIF; | ||
| 102 | "depends" BEGIN(PARAM); return T_DEPENDS; | ||
| 103 | "requires" BEGIN(PARAM); return T_REQUIRES; | ||
| 104 | "optional" BEGIN(PARAM); return T_OPTIONAL; | ||
| 105 | "default" BEGIN(PARAM); return T_DEFAULT; | ||
| 106 | "prompt" BEGIN(PARAM); return T_PROMPT; | ||
| 107 | "tristate" BEGIN(PARAM); return T_TRISTATE; | ||
| 108 | "bool" BEGIN(PARAM); return T_BOOLEAN; | ||
| 109 | "boolean" BEGIN(PARAM); return T_BOOLEAN; | ||
| 110 | "int" BEGIN(PARAM); return T_INT; | ||
| 111 | "hex" BEGIN(PARAM); return T_HEX; | ||
| 112 | "string" BEGIN(PARAM); return T_STRING; | ||
| 113 | {n}+ { | ||
| 114 | alloc_string(yytext, yyleng); | ||
| 115 | zconflval.string = text; | ||
| 116 | return T_WORD; | ||
| 117 | } | ||
| 118 | . | ||
| 119 | \n current_file->lineno++; BEGIN(INITIAL); | ||
| 120 | } | ||
| 121 | |||
| 122 | <PARAM>{ | ||
| 123 | "&&" return T_AND; | ||
| 124 | "||" return T_OR; | ||
| 125 | "(" return T_OPEN_PAREN; | ||
| 126 | ")" return T_CLOSE_PAREN; | ||
| 127 | "!" return T_NOT; | ||
| 128 | "=" return T_EQUAL; | ||
| 129 | "!=" return T_UNEQUAL; | ||
| 130 | "if" return T_IF; | ||
| 131 | "on" return T_ON; | ||
| 132 | \"|\' { | ||
| 133 | str = yytext[0]; | ||
| 134 | new_string(); | ||
| 135 | BEGIN(STRING); | ||
| 136 | } | ||
| 137 | \n BEGIN(INITIAL); current_file->lineno++; return T_EOL; | ||
| 138 | --- /* ignore */ | ||
| 139 | ({n}|[-/.])+ { | ||
| 140 | alloc_string(yytext, yyleng); | ||
| 141 | zconflval.string = text; | ||
| 142 | return T_WORD; | ||
| 143 | } | ||
| 144 | . | ||
| 145 | <<EOF>> { | ||
| 146 | BEGIN(INITIAL); | ||
| 147 | } | ||
| 148 | } | ||
| 149 | |||
| 150 | <STRING>{ | ||
| 151 | [^'"\\\n]+/\n { | ||
| 152 | append_string(yytext, yyleng); | ||
| 153 | zconflval.string = text; | ||
| 154 | return T_STRING; | ||
| 155 | } | ||
| 156 | [^'"\\\n]+ { | ||
| 157 | append_string(yytext, yyleng); | ||
| 158 | } | ||
| 159 | \\.?/\n { | ||
| 160 | append_string(yytext+1, yyleng); | ||
| 161 | zconflval.string = text; | ||
| 162 | return T_STRING; | ||
| 163 | } | ||
| 164 | \\.? { | ||
| 165 | append_string(yytext+1, yyleng); | ||
| 166 | } | ||
| 167 | \'|\" { | ||
| 168 | if (str == yytext[0]) { | ||
| 169 | BEGIN(PARAM); | ||
| 170 | zconflval.string = text; | ||
| 171 | return T_STRING; | ||
| 172 | } else | ||
| 173 | append_string(yytext, 1); | ||
| 174 | } | ||
| 175 | \n { | ||
| 176 | printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno()); | ||
| 177 | BEGIN(INITIAL); | ||
| 178 | return T_EOL; | ||
| 179 | } | ||
| 180 | <<EOF>> { | ||
| 181 | BEGIN(INITIAL); | ||
| 182 | } | ||
| 183 | } | ||
| 184 | |||
| 185 | <HELP>{ | ||
| 186 | [ \t]+ { | ||
| 187 | ts = 0; | ||
| 188 | for (i = 0; i < yyleng; i++) { | ||
| 189 | if (yytext[i] == '\t') | ||
| 190 | ts = (ts & ~7) + 8; | ||
| 191 | else | ||
| 192 | ts++; | ||
| 193 | } | ||
| 194 | last_ts = ts; | ||
| 195 | if (first_ts) { | ||
| 196 | if (ts < first_ts) { | ||
| 197 | zconf_endhelp(); | ||
| 198 | return T_HELPTEXT; | ||
| 199 | } | ||
| 200 | ts -= first_ts; | ||
| 201 | while (ts > 8) { | ||
| 202 | append_string(" ", 8); | ||
| 203 | ts -= 8; | ||
| 204 | } | ||
| 205 | append_string(" ", ts); | ||
| 206 | } | ||
| 207 | |||
| 208 | } | ||
| 209 | \n/[^ \t\n] { | ||
| 210 | current_file->lineno++; | ||
| 211 | zconf_endhelp(); | ||
| 212 | return T_HELPTEXT; | ||
| 213 | } | ||
| 214 | [ \t]*\n { | ||
| 215 | current_file->lineno++; | ||
| 216 | append_string("\n", 1); | ||
| 217 | } | ||
| 218 | [^ \t\n].* { | ||
| 219 | append_string(yytext, yyleng); | ||
| 220 | if (!first_ts) | ||
| 221 | first_ts = last_ts; | ||
| 222 | } | ||
| 223 | <<EOF>> { | ||
| 224 | zconf_endhelp(); | ||
| 225 | return T_HELPTEXT; | ||
| 226 | } | ||
| 227 | } | ||
| 228 | |||
| 229 | <<EOF>> { | ||
| 230 | if (current_buf) { | ||
| 231 | zconf_endfile(); | ||
| 232 | return T_EOF; | ||
| 233 | } | ||
| 234 | fclose(yyin); | ||
| 235 | yyterminate(); | ||
| 236 | } | ||
| 237 | |||
| 238 | %% | ||
| 239 | void zconf_starthelp(void) | ||
| 240 | { | ||
| 241 | new_string(); | ||
| 242 | last_ts = first_ts = 0; | ||
| 243 | BEGIN(HELP); | ||
| 244 | } | ||
| 245 | |||
| 246 | static void zconf_endhelp(void) | ||
| 247 | { | ||
| 248 | zconflval.string = text; | ||
| 249 | BEGIN(INITIAL); | ||
| 250 | } | ||
| 251 | |||
| 252 | void zconf_initscan(const char *name) | ||
| 253 | { | ||
| 254 | yyin = fopen(name, "r"); | ||
| 255 | if (!yyin) { | ||
| 256 | printf("can't find file %s\n", name); | ||
| 257 | exit(1); | ||
| 258 | } | ||
| 259 | |||
| 260 | current_buf = malloc(sizeof(*current_buf)); | ||
| 261 | memset(current_buf, 0, sizeof(*current_buf)); | ||
| 262 | |||
| 263 | current_file = file_lookup(name); | ||
| 264 | current_file->lineno = 1; | ||
| 265 | current_file->flags = FILE_BUSY; | ||
| 266 | } | ||
| 267 | |||
| 268 | void zconf_nextfile(const char *name) | ||
| 269 | { | ||
| 270 | struct file *file = file_lookup(name); | ||
| 271 | struct buffer *buf = malloc(sizeof(*buf)); | ||
| 272 | memset(buf, 0, sizeof(*buf)); | ||
| 273 | |||
| 274 | current_buf->state = YY_CURRENT_BUFFER; | ||
| 275 | yyin = fopen(name, "r"); | ||
| 276 | if (!yyin) { | ||
| 277 | printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name); | ||
| 278 | exit(1); | ||
| 279 | } | ||
| 280 | yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE)); | ||
| 281 | buf->parent = current_buf; | ||
| 282 | current_buf = buf; | ||
| 283 | |||
| 284 | if (file->flags & FILE_BUSY) { | ||
| 285 | printf("recursive scan (%s)?\n", name); | ||
| 286 | exit(1); | ||
| 287 | } | ||
| 288 | if (file->flags & FILE_SCANNED) { | ||
| 289 | printf("file %s already scanned?\n", name); | ||
| 290 | exit(1); | ||
| 291 | } | ||
| 292 | file->flags |= FILE_BUSY; | ||
| 293 | file->lineno = 1; | ||
| 294 | file->parent = current_file; | ||
| 295 | current_file = file; | ||
| 296 | } | ||
| 297 | |||
| 298 | static struct buffer *zconf_endfile(void) | ||
| 299 | { | ||
| 300 | struct buffer *parent; | ||
| 301 | |||
| 302 | current_file->flags |= FILE_SCANNED; | ||
| 303 | current_file->flags &= ~FILE_BUSY; | ||
| 304 | current_file = current_file->parent; | ||
| 305 | |||
| 306 | parent = current_buf->parent; | ||
| 307 | if (parent) { | ||
| 308 | fclose(yyin); | ||
| 309 | yy_delete_buffer(YY_CURRENT_BUFFER); | ||
| 310 | yy_switch_to_buffer(parent->state); | ||
| 311 | } | ||
| 312 | free(current_buf); | ||
| 313 | current_buf = parent; | ||
| 314 | |||
| 315 | return parent; | ||
| 316 | } | ||
| 317 | |||
| 318 | int zconf_lineno(void) | ||
| 319 | { | ||
| 320 | if (current_buf) | ||
| 321 | return current_file->lineno; | ||
| 322 | else | ||
| 323 | return 0; | ||
| 324 | } | ||
| 325 | |||
| 326 | char *zconf_curname(void) | ||
| 327 | { | ||
| 328 | if (current_buf) | ||
| 329 | return current_file->name; | ||
| 330 | else | ||
| 331 | return "<none>"; | ||
| 332 | } | ||
diff --git a/scripts/config/zconf.tab.c_shipped b/scripts/config/zconf.tab.c_shipped new file mode 100644 index 000000000..33b2b6f84 --- /dev/null +++ b/scripts/config/zconf.tab.c_shipped | |||
| @@ -0,0 +1,2017 @@ | |||
| 1 | /* A Bison parser, made from zconf.y, by GNU bison 1.75. */ | ||
| 2 | |||
| 3 | /* Skeleton parser for Yacc-like parsing with Bison, | ||
| 4 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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 | /* 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 | /* Pure parsers. */ | ||
| 40 | #define YYPURE 0 | ||
| 41 | |||
| 42 | /* Using locations. */ | ||
| 43 | #define YYLSP_NEEDED 0 | ||
| 44 | |||
| 45 | /* If NAME_PREFIX is specified substitute the variables and functions | ||
| 46 | names. */ | ||
| 47 | #define yyparse zconfparse | ||
| 48 | #define yylex zconflex | ||
| 49 | #define yyerror zconferror | ||
| 50 | #define yylval zconflval | ||
| 51 | #define yychar zconfchar | ||
| 52 | #define yydebug zconfdebug | ||
| 53 | #define yynerrs zconfnerrs | ||
| 54 | |||
| 55 | |||
| 56 | /* Tokens. */ | ||
| 57 | #ifndef YYTOKENTYPE | ||
| 58 | # define YYTOKENTYPE | ||
| 59 | /* Put the tokens into the symbol table, so that GDB and other debuggers | ||
| 60 | know about them. */ | ||
| 61 | enum yytokentype { | ||
| 62 | T_MAINMENU = 258, | ||
| 63 | T_MENU = 259, | ||
| 64 | T_ENDMENU = 260, | ||
| 65 | T_SOURCE = 261, | ||
| 66 | T_CHOICE = 262, | ||
| 67 | T_ENDCHOICE = 263, | ||
| 68 | T_COMMENT = 264, | ||
| 69 | T_CONFIG = 265, | ||
| 70 | T_HELP = 266, | ||
| 71 | T_HELPTEXT = 267, | ||
| 72 | T_IF = 268, | ||
| 73 | T_ENDIF = 269, | ||
| 74 | T_DEPENDS = 270, | ||
| 75 | T_REQUIRES = 271, | ||
| 76 | T_OPTIONAL = 272, | ||
| 77 | T_PROMPT = 273, | ||
| 78 | T_DEFAULT = 274, | ||
| 79 | T_TRISTATE = 275, | ||
| 80 | T_BOOLEAN = 276, | ||
| 81 | T_INT = 277, | ||
| 82 | T_HEX = 278, | ||
| 83 | T_WORD = 279, | ||
| 84 | T_STRING = 280, | ||
| 85 | T_UNEQUAL = 281, | ||
| 86 | T_EOF = 282, | ||
| 87 | T_EOL = 283, | ||
| 88 | T_CLOSE_PAREN = 284, | ||
| 89 | T_OPEN_PAREN = 285, | ||
| 90 | T_ON = 286, | ||
| 91 | T_OR = 287, | ||
| 92 | T_AND = 288, | ||
| 93 | T_EQUAL = 289, | ||
| 94 | T_NOT = 290 | ||
| 95 | }; | ||
| 96 | #endif | ||
| 97 | #define T_MAINMENU 258 | ||
| 98 | #define T_MENU 259 | ||
| 99 | #define T_ENDMENU 260 | ||
| 100 | #define T_SOURCE 261 | ||
| 101 | #define T_CHOICE 262 | ||
| 102 | #define T_ENDCHOICE 263 | ||
| 103 | #define T_COMMENT 264 | ||
| 104 | #define T_CONFIG 265 | ||
| 105 | #define T_HELP 266 | ||
| 106 | #define T_HELPTEXT 267 | ||
| 107 | #define T_IF 268 | ||
| 108 | #define T_ENDIF 269 | ||
| 109 | #define T_DEPENDS 270 | ||
| 110 | #define T_REQUIRES 271 | ||
| 111 | #define T_OPTIONAL 272 | ||
| 112 | #define T_PROMPT 273 | ||
| 113 | #define T_DEFAULT 274 | ||
| 114 | #define T_TRISTATE 275 | ||
| 115 | #define T_BOOLEAN 276 | ||
| 116 | #define T_INT 277 | ||
| 117 | #define T_HEX 278 | ||
| 118 | #define T_WORD 279 | ||
| 119 | #define T_STRING 280 | ||
| 120 | #define T_UNEQUAL 281 | ||
| 121 | #define T_EOF 282 | ||
| 122 | #define T_EOL 283 | ||
| 123 | #define T_CLOSE_PAREN 284 | ||
| 124 | #define T_OPEN_PAREN 285 | ||
| 125 | #define T_ON 286 | ||
| 126 | #define T_OR 287 | ||
| 127 | #define T_AND 288 | ||
| 128 | #define T_EQUAL 289 | ||
| 129 | #define T_NOT 290 | ||
| 130 | |||
| 131 | |||
| 132 | |||
| 133 | |||
| 134 | /* Copy the first part of user declarations. */ | ||
| 135 | #line 1 "zconf.y" | ||
| 136 | |||
| 137 | /* | ||
| 138 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 139 | * Released under the terms of the GNU GPL v2.0. | ||
| 140 | */ | ||
| 141 | |||
| 142 | #include <ctype.h> | ||
| 143 | #include <stdarg.h> | ||
| 144 | #include <stdio.h> | ||
| 145 | #include <stdlib.h> | ||
| 146 | #include <string.h> | ||
| 147 | #include <stdbool.h> | ||
| 148 | |||
| 149 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) | ||
| 150 | |||
| 151 | #define PRINTD 0x0001 | ||
| 152 | #define DEBUG_PARSE 0x0002 | ||
| 153 | |||
| 154 | int cdebug = PRINTD; | ||
| 155 | |||
| 156 | extern int zconflex(void); | ||
| 157 | static void zconfprint(const char *err, ...); | ||
| 158 | static void zconferror(const char *err); | ||
| 159 | static bool zconf_endtoken(int token, int starttoken, int endtoken); | ||
| 160 | |||
| 161 | struct symbol *symbol_hash[257]; | ||
| 162 | |||
| 163 | #define YYERROR_VERBOSE | ||
| 164 | |||
| 165 | |||
| 166 | /* Enabling traces. */ | ||
| 167 | #ifndef YYDEBUG | ||
| 168 | # define YYDEBUG 1 | ||
| 169 | #endif | ||
| 170 | |||
| 171 | /* Enabling verbose error messages. */ | ||
| 172 | #ifdef YYERROR_VERBOSE | ||
| 173 | # undef YYERROR_VERBOSE | ||
| 174 | # define YYERROR_VERBOSE 1 | ||
| 175 | #else | ||
| 176 | # define YYERROR_VERBOSE 0 | ||
| 177 | #endif | ||
| 178 | |||
| 179 | #ifndef YYSTYPE | ||
| 180 | #line 33 "zconf.y" | ||
| 181 | typedef union { | ||
| 182 | int token; | ||
| 183 | char *string; | ||
| 184 | struct symbol *symbol; | ||
| 185 | struct expr *expr; | ||
| 186 | struct menu *menu; | ||
| 187 | } yystype; | ||
| 188 | /* Line 193 of /usr/share/bison/yacc.c. */ | ||
| 189 | #line 190 "zconf.tab.c" | ||
| 190 | # define YYSTYPE yystype | ||
| 191 | # define YYSTYPE_IS_TRIVIAL 1 | ||
| 192 | #endif | ||
| 193 | |||
| 194 | #ifndef YYLTYPE | ||
| 195 | typedef struct yyltype | ||
| 196 | { | ||
| 197 | int first_line; | ||
| 198 | int first_column; | ||
| 199 | int last_line; | ||
| 200 | int last_column; | ||
| 201 | } yyltype; | ||
| 202 | # define YYLTYPE yyltype | ||
| 203 | # define YYLTYPE_IS_TRIVIAL 1 | ||
| 204 | #endif | ||
| 205 | |||
| 206 | /* Copy the second part of user declarations. */ | ||
| 207 | #line 83 "zconf.y" | ||
| 208 | |||
| 209 | #define LKC_DIRECT_LINK | ||
| 210 | #include "lkc.h" | ||
| 211 | |||
| 212 | |||
| 213 | /* Line 213 of /usr/share/bison/yacc.c. */ | ||
| 214 | #line 215 "zconf.tab.c" | ||
| 215 | |||
| 216 | #if ! defined (yyoverflow) || YYERROR_VERBOSE | ||
| 217 | |||
| 218 | /* The parser invokes alloca or malloc; define the necessary symbols. */ | ||
| 219 | |||
| 220 | # if YYSTACK_USE_ALLOCA | ||
| 221 | # define YYSTACK_ALLOC alloca | ||
| 222 | # else | ||
| 223 | # ifndef YYSTACK_USE_ALLOCA | ||
| 224 | # if defined (alloca) || defined (_ALLOCA_H) | ||
| 225 | # define YYSTACK_ALLOC alloca | ||
| 226 | # else | ||
| 227 | # ifdef __GNUC__ | ||
| 228 | # define YYSTACK_ALLOC __builtin_alloca | ||
| 229 | # endif | ||
| 230 | # endif | ||
| 231 | # endif | ||
| 232 | # endif | ||
| 233 | |||
| 234 | # ifdef YYSTACK_ALLOC | ||
| 235 | /* Pacify GCC's `empty if-body' warning. */ | ||
| 236 | # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) | ||
| 237 | # else | ||
| 238 | # if defined (__STDC__) || defined (__cplusplus) | ||
| 239 | # include <stdlib.h> /* INFRINGES ON USER NAME SPACE */ | ||
| 240 | # define YYSIZE_T size_t | ||
| 241 | # endif | ||
| 242 | # define YYSTACK_ALLOC malloc | ||
| 243 | # define YYSTACK_FREE free | ||
| 244 | # endif | ||
| 245 | #endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */ | ||
| 246 | |||
| 247 | |||
| 248 | #if (! defined (yyoverflow) \ | ||
| 249 | && (! defined (__cplusplus) \ | ||
| 250 | || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) | ||
| 251 | |||
| 252 | /* A type that is properly aligned for any stack member. */ | ||
| 253 | union yyalloc | ||
| 254 | { | ||
| 255 | short yyss; | ||
| 256 | YYSTYPE yyvs; | ||
| 257 | }; | ||
| 258 | |||
| 259 | /* The size of the maximum gap between one aligned stack and the next. */ | ||
| 260 | # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) | ||
| 261 | |||
| 262 | /* The size of an array large to enough to hold all stacks, each with | ||
| 263 | N elements. */ | ||
| 264 | # define YYSTACK_BYTES(N) \ | ||
| 265 | ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ | ||
| 266 | + YYSTACK_GAP_MAX) | ||
| 267 | |||
| 268 | /* Copy COUNT objects from FROM to TO. The source and destination do | ||
| 269 | not overlap. */ | ||
| 270 | # ifndef YYCOPY | ||
| 271 | # if 1 < __GNUC__ | ||
| 272 | # define YYCOPY(To, From, Count) \ | ||
| 273 | __builtin_memcpy (To, From, (Count) * sizeof (*(From))) | ||
| 274 | # else | ||
| 275 | # define YYCOPY(To, From, Count) \ | ||
| 276 | do \ | ||
| 277 | { \ | ||
| 278 | register YYSIZE_T yyi; \ | ||
| 279 | for (yyi = 0; yyi < (Count); yyi++) \ | ||
| 280 | (To)[yyi] = (From)[yyi]; \ | ||
| 281 | } \ | ||
| 282 | while (0) | ||
| 283 | # endif | ||
| 284 | # endif | ||
| 285 | |||
| 286 | /* Relocate STACK from its old location to the new one. The | ||
| 287 | local variables YYSIZE and YYSTACKSIZE give the old and new number of | ||
| 288 | elements in the stack, and YYPTR gives the new location of the | ||
| 289 | stack. Advance YYPTR to a properly aligned location for the next | ||
| 290 | stack. */ | ||
| 291 | # define YYSTACK_RELOCATE(Stack) \ | ||
| 292 | do \ | ||
| 293 | { \ | ||
| 294 | YYSIZE_T yynewbytes; \ | ||
| 295 | YYCOPY (&yyptr->Stack, Stack, yysize); \ | ||
| 296 | Stack = &yyptr->Stack; \ | ||
| 297 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ | ||
| 298 | yyptr += yynewbytes / sizeof (*yyptr); \ | ||
| 299 | } \ | ||
| 300 | while (0) | ||
| 301 | |||
| 302 | #endif | ||
| 303 | |||
| 304 | #if defined (__STDC__) || defined (__cplusplus) | ||
| 305 | typedef signed char yysigned_char; | ||
| 306 | #else | ||
| 307 | typedef short yysigned_char; | ||
| 308 | #endif | ||
| 309 | |||
| 310 | /* YYFINAL -- State number of the termination state. */ | ||
| 311 | #define YYFINAL 2 | ||
| 312 | #define YYLAST 151 | ||
| 313 | |||
| 314 | /* YYNTOKENS -- Number of terminals. */ | ||
| 315 | #define YYNTOKENS 36 | ||
| 316 | /* YYNNTS -- Number of nonterminals. */ | ||
| 317 | #define YYNNTS 39 | ||
| 318 | /* YYNRULES -- Number of rules. */ | ||
| 319 | #define YYNRULES 96 | ||
| 320 | /* YYNRULES -- Number of states. */ | ||
| 321 | #define YYNSTATES 145 | ||
| 322 | |||
| 323 | /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ | ||
| 324 | #define YYUNDEFTOK 2 | ||
| 325 | #define YYMAXUTOK 290 | ||
| 326 | |||
| 327 | #define YYTRANSLATE(X) \ | ||
| 328 | ((unsigned)(X) <= YYMAXUTOK ? yytranslate[X] : YYUNDEFTOK) | ||
| 329 | |||
| 330 | /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ | ||
| 331 | static const unsigned char yytranslate[] = | ||
| 332 | { | ||
| 333 | 0, 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, 2, 2, 2, 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, 2, 2, 2, 2, | ||
| 350 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 351 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 352 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 353 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 354 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 355 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 356 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 357 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, | ||
| 358 | 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, | ||
| 359 | 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, | ||
| 360 | 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, | ||
| 361 | 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, | ||
| 362 | 35 | ||
| 363 | }; | ||
| 364 | |||
| 365 | #if YYDEBUG | ||
| 366 | /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in | ||
| 367 | YYRHS. */ | ||
| 368 | static const unsigned short yyprhs[] = | ||
| 369 | { | ||
| 370 | 0, 0, 3, 4, 7, 9, 11, 13, 17, 19, | ||
| 371 | 21, 23, 26, 28, 30, 32, 34, 36, 39, 43, | ||
| 372 | 44, 48, 52, 55, 58, 61, 64, 67, 70, 73, | ||
| 373 | 77, 81, 83, 87, 89, 94, 97, 98, 102, 106, | ||
| 374 | 109, 112, 116, 118, 121, 122, 125, 128, 130, 136, | ||
| 375 | 140, 141, 144, 147, 150, 153, 157, 159, 164, 167, | ||
| 376 | 168, 171, 174, 177, 181, 184, 187, 190, 194, 197, | ||
| 377 | 200, 201, 205, 208, 212, 215, 218, 219, 221, 225, | ||
| 378 | 227, 229, 231, 233, 235, 237, 239, 240, 243, 245, | ||
| 379 | 249, 253, 257, 260, 264, 268, 270 | ||
| 380 | }; | ||
| 381 | |||
| 382 | /* YYRHS -- A `-1'-separated list of the rules' RHS. */ | ||
| 383 | static const yysigned_char yyrhs[] = | ||
| 384 | { | ||
| 385 | 37, 0, -1, -1, 37, 38, -1, 39, -1, 47, | ||
| 386 | -1, 58, -1, 3, 69, 71, -1, 5, -1, 14, | ||
| 387 | -1, 8, -1, 1, 71, -1, 53, -1, 63, -1, | ||
| 388 | 41, -1, 61, -1, 71, -1, 10, 24, -1, 40, | ||
| 389 | 28, 42, -1, -1, 42, 43, 28, -1, 42, 67, | ||
| 390 | 28, -1, 42, 65, -1, 42, 28, -1, 20, 68, | ||
| 391 | -1, 21, 68, -1, 22, 68, -1, 23, 68, -1, | ||
| 392 | 25, 68, -1, 18, 69, 72, -1, 19, 74, 72, | ||
| 393 | -1, 7, -1, 44, 28, 48, -1, 70, -1, 45, | ||
| 394 | 50, 46, 28, -1, 45, 50, -1, -1, 48, 49, | ||
| 395 | 28, -1, 48, 67, 28, -1, 48, 65, -1, 48, | ||
| 396 | 28, -1, 18, 69, 72, -1, 17, -1, 19, 74, | ||
| 397 | -1, -1, 50, 39, -1, 13, 73, -1, 70, -1, | ||
| 398 | 51, 28, 54, 52, 28, -1, 51, 28, 54, -1, | ||
| 399 | -1, 54, 39, -1, 54, 58, -1, 54, 47, -1, | ||
| 400 | 4, 69, -1, 55, 28, 66, -1, 70, -1, 56, | ||
| 401 | 59, 57, 28, -1, 56, 59, -1, -1, 59, 39, | ||
| 402 | -1, 59, 58, -1, 59, 47, -1, 59, 1, 28, | ||
| 403 | -1, 6, 69, -1, 60, 28, -1, 9, 69, -1, | ||
| 404 | 62, 28, 66, -1, 11, 28, -1, 64, 12, -1, | ||
| 405 | -1, 66, 67, 28, -1, 66, 28, -1, 15, 31, | ||
| 406 | 73, -1, 15, 73, -1, 16, 73, -1, -1, 69, | ||
| 407 | -1, 69, 13, 73, -1, 24, -1, 25, -1, 5, | ||
| 408 | -1, 8, -1, 14, -1, 28, -1, 27, -1, -1, | ||
| 409 | 13, 73, -1, 74, -1, 74, 34, 74, -1, 74, | ||
| 410 | 26, 74, -1, 30, 73, 29, -1, 35, 73, -1, | ||
| 411 | 73, 32, 73, -1, 73, 33, 73, -1, 24, -1, | ||
| 412 | 25, -1 | ||
| 413 | }; | ||
| 414 | |||
| 415 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | ||
| 416 | static const unsigned short yyrline[] = | ||
| 417 | { | ||
| 418 | 0, 88, 88, 89, 92, 93, 94, 95, 96, 97, | ||
| 419 | 98, 99, 102, 104, 105, 106, 107, 113, 121, 127, | ||
| 420 | 129, 130, 131, 132, 135, 141, 147, 153, 159, 165, | ||
| 421 | 171, 179, 188, 194, 202, 204, 210, 212, 213, 214, | ||
| 422 | 215, 218, 224, 230, 237, 239, 244, 254, 262, 264, | ||
| 423 | 270, 272, 273, 274, 279, 286, 292, 300, 302, 308, | ||
| 424 | 310, 311, 312, 313, 316, 322, 329, 336, 343, 349, | ||
| 425 | 356, 357, 358, 361, 366, 371, 379, 381, 385, 390, | ||
| 426 | 391, 394, 395, 396, 399, 400, 402, 403, 406, 407, | ||
| 427 | 408, 409, 410, 411, 412, 415, 416 | ||
| 428 | }; | ||
| 429 | #endif | ||
| 430 | |||
| 431 | #if YYDEBUG || YYERROR_VERBOSE | ||
| 432 | /* YYTNME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. | ||
| 433 | First, the terminals, then, starting at YYNTOKENS, nonterminals. */ | ||
| 434 | static const char *const yytname[] = | ||
| 435 | { | ||
| 436 | "$end", "error", "$undefined", "T_MAINMENU", "T_MENU", "T_ENDMENU", | ||
| 437 | "T_SOURCE", "T_CHOICE", "T_ENDCHOICE", "T_COMMENT", "T_CONFIG", | ||
| 438 | "T_HELP", "T_HELPTEXT", "T_IF", "T_ENDIF", "T_DEPENDS", "T_REQUIRES", | ||
| 439 | "T_OPTIONAL", "T_PROMPT", "T_DEFAULT", "T_TRISTATE", "T_BOOLEAN", | ||
| 440 | "T_INT", "T_HEX", "T_WORD", "T_STRING", "T_UNEQUAL", "T_EOF", "T_EOL", | ||
| 441 | "T_CLOSE_PAREN", "T_OPEN_PAREN", "T_ON", "T_OR", "T_AND", "T_EQUAL", | ||
| 442 | "T_NOT", "$accept", "input", "block", "common_block", | ||
| 443 | "config_entry_start", "config_stmt", "config_option_list", | ||
| 444 | "config_option", "choice", "choice_entry", "choice_end", "choice_stmt", | ||
| 445 | "choice_option_list", "choice_option", "choice_block", "if", "if_end", | ||
| 446 | "if_stmt", "if_block", "menu", "menu_entry", "menu_end", "menu_stmt", | ||
| 447 | "menu_block", "source", "source_stmt", "comment", "comment_stmt", | ||
| 448 | "help_start", "help", "depends_list", "depends", "prompt_stmt_opt", | ||
| 449 | "prompt", "end", "nl_or_eof", "if_expr", "expr", "symbol", 0 | ||
| 450 | }; | ||
| 451 | #endif | ||
| 452 | |||
| 453 | # ifdef YYPRINT | ||
| 454 | /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to | ||
| 455 | token YYLEX-NUM. */ | ||
| 456 | static const unsigned short yytoknum[] = | ||
| 457 | { | ||
| 458 | 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, | ||
| 459 | 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, | ||
| 460 | 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, | ||
| 461 | 285, 286, 287, 288, 289, 290 | ||
| 462 | }; | ||
| 463 | # endif | ||
| 464 | |||
| 465 | /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ | ||
| 466 | static const unsigned char yyr1[] = | ||
| 467 | { | ||
| 468 | 0, 36, 37, 37, 38, 38, 38, 38, 38, 38, | ||
| 469 | 38, 38, 39, 39, 39, 39, 39, 40, 41, 42, | ||
| 470 | 42, 42, 42, 42, 43, 43, 43, 43, 43, 43, | ||
| 471 | 43, 44, 45, 46, 47, 47, 48, 48, 48, 48, | ||
| 472 | 48, 49, 49, 49, 50, 50, 51, 52, 53, 53, | ||
| 473 | 54, 54, 54, 54, 55, 56, 57, 58, 58, 59, | ||
| 474 | 59, 59, 59, 59, 60, 61, 62, 63, 64, 65, | ||
| 475 | 66, 66, 66, 67, 67, 67, 68, 68, 68, 69, | ||
| 476 | 69, 70, 70, 70, 71, 71, 72, 72, 73, 73, | ||
| 477 | 73, 73, 73, 73, 73, 74, 74 | ||
| 478 | }; | ||
| 479 | |||
| 480 | /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ | ||
| 481 | static const unsigned char yyr2[] = | ||
| 482 | { | ||
| 483 | 0, 2, 0, 2, 1, 1, 1, 3, 1, 1, | ||
| 484 | 1, 2, 1, 1, 1, 1, 1, 2, 3, 0, | ||
| 485 | 3, 3, 2, 2, 2, 2, 2, 2, 2, 3, | ||
| 486 | 3, 1, 3, 1, 4, 2, 0, 3, 3, 2, | ||
| 487 | 2, 3, 1, 2, 0, 2, 2, 1, 5, 3, | ||
| 488 | 0, 2, 2, 2, 2, 3, 1, 4, 2, 0, | ||
| 489 | 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, | ||
| 490 | 0, 3, 2, 3, 2, 2, 0, 1, 3, 1, | ||
| 491 | 1, 1, 1, 1, 1, 1, 0, 2, 1, 3, | ||
| 492 | 3, 3, 2, 3, 3, 1, 1 | ||
| 493 | }; | ||
| 494 | |||
| 495 | /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state | ||
| 496 | STATE-NUM when YYTABLE doesn't specify something else to do. Zero | ||
| 497 | means the default is an error. */ | ||
| 498 | static const unsigned char yydefact[] = | ||
| 499 | { | ||
| 500 | 2, 0, 1, 0, 0, 0, 8, 0, 31, 10, | ||
| 501 | 0, 0, 0, 9, 85, 84, 3, 4, 0, 14, | ||
| 502 | 0, 44, 5, 0, 12, 0, 59, 6, 0, 15, | ||
| 503 | 0, 13, 16, 11, 79, 80, 0, 54, 64, 66, | ||
| 504 | 17, 95, 96, 0, 0, 46, 88, 19, 36, 35, | ||
| 505 | 50, 70, 0, 65, 70, 7, 0, 92, 0, 0, | ||
| 506 | 0, 0, 18, 32, 81, 82, 83, 45, 0, 33, | ||
| 507 | 49, 55, 0, 60, 62, 0, 61, 56, 67, 91, | ||
| 508 | 93, 94, 90, 89, 0, 0, 0, 0, 0, 76, | ||
| 509 | 76, 76, 76, 76, 23, 0, 0, 22, 0, 42, | ||
| 510 | 0, 0, 40, 0, 39, 0, 34, 51, 53, 0, | ||
| 511 | 52, 47, 72, 0, 63, 57, 68, 0, 74, 75, | ||
| 512 | 86, 86, 24, 77, 25, 26, 27, 28, 20, 69, | ||
| 513 | 21, 86, 43, 37, 38, 48, 71, 73, 0, 29, | ||
| 514 | 30, 0, 41, 87, 78 | ||
| 515 | }; | ||
| 516 | |||
| 517 | /* YYDEFGOTO[NTERM-NUM]. */ | ||
| 518 | static const short yydefgoto[] = | ||
| 519 | { | ||
| 520 | -1, 1, 16, 17, 18, 19, 62, 95, 20, 21, | ||
| 521 | 68, 22, 63, 103, 49, 23, 109, 24, 70, 25, | ||
| 522 | 26, 75, 27, 52, 28, 29, 30, 31, 96, 97, | ||
| 523 | 71, 113, 122, 123, 69, 32, 139, 45, 46 | ||
| 524 | }; | ||
| 525 | |||
| 526 | /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing | ||
| 527 | STATE-NUM. */ | ||
| 528 | #define YYPACT_NINF -120 | ||
| 529 | static const short yypact[] = | ||
| 530 | { | ||
| 531 | -120, 17, -120, 41, 48, 48, -120, 48, -120, -120, | ||
| 532 | 48, -11, 40, -120, -120, -120, -120, -120, 13, -120, | ||
| 533 | 23, -120, -120, 66, -120, 72, -120, -120, 77, -120, | ||
| 534 | 81, -120, -120, -120, -120, -120, 41, -120, -120, -120, | ||
| 535 | -120, -120, -120, 40, 40, 57, 59, -120, -120, 98, | ||
| 536 | -120, -120, 49, -120, -120, -120, 7, -120, 40, 40, | ||
| 537 | 67, 67, 99, 117, -120, -120, -120, -120, 85, -120, | ||
| 538 | 74, 18, 88, -120, -120, 95, -120, -120, 18, -120, | ||
| 539 | 96, -120, -120, -120, 102, 36, 40, 48, 67, 48, | ||
| 540 | 48, 48, 48, 48, -120, 103, 129, -120, 114, -120, | ||
| 541 | 48, 67, -120, 115, -120, 116, -120, -120, -120, 118, | ||
| 542 | -120, -120, -120, 119, -120, -120, -120, 40, 57, 57, | ||
| 543 | 135, 135, -120, 136, -120, -120, -120, -120, -120, -120, | ||
| 544 | -120, 135, -120, -120, -120, -120, -120, 57, 40, -120, | ||
| 545 | -120, 40, -120, 57, 57 | ||
| 546 | }; | ||
| 547 | |||
| 548 | /* YYPGOTO[NTERM-NUM]. */ | ||
| 549 | static const yysigned_char yypgoto[] = | ||
| 550 | { | ||
| 551 | -120, -120, -120, -38, -120, -120, -120, -120, -120, -120, | ||
| 552 | -120, -42, -120, -120, -120, -120, -120, -120, -120, -120, | ||
| 553 | -120, -120, -33, -120, -120, -120, -120, -120, -120, 87, | ||
| 554 | 97, 34, 47, -1, -23, 2, -119, -43, -53 | ||
| 555 | }; | ||
| 556 | |||
| 557 | /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If | ||
| 558 | positive, shift that token. If negative, reduce the rule which | ||
| 559 | number is the opposite. If zero, do what YYDEFACT says. | ||
| 560 | If YYTABLE_NINF, parse error. */ | ||
| 561 | #define YYTABLE_NINF -59 | ||
| 562 | static const short yytable[] = | ||
| 563 | { | ||
| 564 | 56, 57, 140, 36, 37, 33, 38, 82, 83, 39, | ||
| 565 | 74, 67, 142, 40, 73, 80, 81, 2, 3, 76, | ||
| 566 | 4, 5, 6, 7, 8, 9, 10, 11, 108, 77, | ||
| 567 | 12, 13, 107, 85, 86, 121, 79, 110, 55, 58, | ||
| 568 | 59, 47, 118, 119, 14, 15, 112, 111, 132, -58, | ||
| 569 | 72, 48, -58, 5, 64, 7, 8, 65, 10, 11, | ||
| 570 | 41, 42, 12, 66, 41, 42, 43, 117, 14, 15, | ||
| 571 | 43, 44, 34, 35, 137, 44, 14, 15, 5, 64, | ||
| 572 | 7, 8, 65, 10, 11, 60, 120, 12, 66, 58, | ||
| 573 | 59, 41, 42, 61, 50, 143, 98, 105, 144, 131, | ||
| 574 | 51, 14, 15, 64, 7, 53, 65, 10, 11, 54, | ||
| 575 | 84, 12, 66, 106, 85, 86, 114, 87, 88, 89, | ||
| 576 | 90, 91, 92, 115, 93, 14, 15, 94, 84, 59, | ||
| 577 | 116, 128, 85, 86, 99, 100, 101, 124, 125, 126, | ||
| 578 | 127, 129, 130, 133, 134, 102, 135, 136, 138, 141, | ||
| 579 | 104, 78 | ||
| 580 | }; | ||
| 581 | |||
| 582 | static const unsigned char yycheck[] = | ||
| 583 | { | ||
| 584 | 43, 44, 121, 4, 5, 3, 7, 60, 61, 10, | ||
| 585 | 52, 49, 131, 24, 52, 58, 59, 0, 1, 52, | ||
| 586 | 3, 4, 5, 6, 7, 8, 9, 10, 70, 52, | ||
| 587 | 13, 14, 70, 15, 16, 88, 29, 70, 36, 32, | ||
| 588 | 33, 28, 85, 86, 27, 28, 28, 70, 101, 0, | ||
| 589 | 1, 28, 3, 4, 5, 6, 7, 8, 9, 10, | ||
| 590 | 24, 25, 13, 14, 24, 25, 30, 31, 27, 28, | ||
| 591 | 30, 35, 24, 25, 117, 35, 27, 28, 4, 5, | ||
| 592 | 6, 7, 8, 9, 10, 26, 87, 13, 14, 32, | ||
| 593 | 33, 24, 25, 34, 28, 138, 62, 63, 141, 100, | ||
| 594 | 28, 27, 28, 5, 6, 28, 8, 9, 10, 28, | ||
| 595 | 11, 13, 14, 28, 15, 16, 28, 18, 19, 20, | ||
| 596 | 21, 22, 23, 28, 25, 27, 28, 28, 11, 33, | ||
| 597 | 28, 28, 15, 16, 17, 18, 19, 90, 91, 92, | ||
| 598 | 93, 12, 28, 28, 28, 28, 28, 28, 13, 13, | ||
| 599 | 63, 54 | ||
| 600 | }; | ||
| 601 | |||
| 602 | /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing | ||
| 603 | symbol of state STATE-NUM. */ | ||
| 604 | static const unsigned char yystos[] = | ||
| 605 | { | ||
| 606 | 0, 37, 0, 1, 3, 4, 5, 6, 7, 8, | ||
| 607 | 9, 10, 13, 14, 27, 28, 38, 39, 40, 41, | ||
| 608 | 44, 45, 47, 51, 53, 55, 56, 58, 60, 61, | ||
| 609 | 62, 63, 71, 71, 24, 25, 69, 69, 69, 69, | ||
| 610 | 24, 24, 25, 30, 35, 73, 74, 28, 28, 50, | ||
| 611 | 28, 28, 59, 28, 28, 71, 73, 73, 32, 33, | ||
| 612 | 26, 34, 42, 48, 5, 8, 14, 39, 46, 70, | ||
| 613 | 54, 66, 1, 39, 47, 57, 58, 70, 66, 29, | ||
| 614 | 73, 73, 74, 74, 11, 15, 16, 18, 19, 20, | ||
| 615 | 21, 22, 23, 25, 28, 43, 64, 65, 67, 17, | ||
| 616 | 18, 19, 28, 49, 65, 67, 28, 39, 47, 52, | ||
| 617 | 58, 70, 28, 67, 28, 28, 28, 31, 73, 73, | ||
| 618 | 69, 74, 68, 69, 68, 68, 68, 68, 28, 12, | ||
| 619 | 28, 69, 74, 28, 28, 28, 28, 73, 13, 72, | ||
| 620 | 72, 13, 72, 73, 73 | ||
| 621 | }; | ||
| 622 | |||
| 623 | #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) | ||
| 624 | # define YYSIZE_T __SIZE_TYPE__ | ||
| 625 | #endif | ||
| 626 | #if ! defined (YYSIZE_T) && defined (size_t) | ||
| 627 | # define YYSIZE_T size_t | ||
| 628 | #endif | ||
| 629 | #if ! defined (YYSIZE_T) | ||
| 630 | # if defined (__STDC__) || defined (__cplusplus) | ||
| 631 | # include <stddef.h> /* INFRINGES ON USER NAME SPACE */ | ||
| 632 | # define YYSIZE_T size_t | ||
| 633 | # endif | ||
| 634 | #endif | ||
| 635 | #if ! defined (YYSIZE_T) | ||
| 636 | # define YYSIZE_T unsigned int | ||
| 637 | #endif | ||
| 638 | |||
| 639 | #define yyerrok (yyerrstatus = 0) | ||
| 640 | #define yyclearin (yychar = YYEMPTY) | ||
| 641 | #define YYEMPTY -2 | ||
| 642 | #define YYEOF 0 | ||
| 643 | |||
| 644 | #define YYACCEPT goto yyacceptlab | ||
| 645 | #define YYABORT goto yyabortlab | ||
| 646 | #define YYERROR goto yyerrlab1 | ||
| 647 | |||
| 648 | /* Like YYERROR except do call yyerror. This remains here temporarily | ||
| 649 | to ease the transition to the new meaning of YYERROR, for GCC. | ||
| 650 | Once GCC version 2 has supplanted version 1, this can go. */ | ||
| 651 | |||
| 652 | #define YYFAIL goto yyerrlab | ||
| 653 | |||
| 654 | #define YYRECOVERING() (!!yyerrstatus) | ||
| 655 | |||
| 656 | #define YYBACKUP(Token, Value) \ | ||
| 657 | do \ | ||
| 658 | if (yychar == YYEMPTY && yylen == 1) \ | ||
| 659 | { \ | ||
| 660 | yychar = (Token); \ | ||
| 661 | yylval = (Value); \ | ||
| 662 | yychar1 = YYTRANSLATE (yychar); \ | ||
| 663 | YYPOPSTACK; \ | ||
| 664 | goto yybackup; \ | ||
| 665 | } \ | ||
| 666 | else \ | ||
| 667 | { \ | ||
| 668 | yyerror ("syntax error: cannot back up"); \ | ||
| 669 | YYERROR; \ | ||
| 670 | } \ | ||
| 671 | while (0) | ||
| 672 | |||
| 673 | #define YYTERROR 1 | ||
| 674 | #define YYERRCODE 256 | ||
| 675 | |||
| 676 | /* YYLLOC_DEFAULT -- Compute the default location (before the actions | ||
| 677 | are run). */ | ||
| 678 | |||
| 679 | #ifndef YYLLOC_DEFAULT | ||
| 680 | # define YYLLOC_DEFAULT(Current, Rhs, N) \ | ||
| 681 | Current.first_line = Rhs[1].first_line; \ | ||
| 682 | Current.first_column = Rhs[1].first_column; \ | ||
| 683 | Current.last_line = Rhs[N].last_line; \ | ||
| 684 | Current.last_column = Rhs[N].last_column; | ||
| 685 | #endif | ||
| 686 | |||
| 687 | /* YYLEX -- calling `yylex' with the right arguments. */ | ||
| 688 | |||
| 689 | #define YYLEX yylex () | ||
| 690 | |||
| 691 | /* Enable debugging if requested. */ | ||
| 692 | #if YYDEBUG | ||
| 693 | |||
| 694 | # ifndef YYFPRINTF | ||
| 695 | # include <stdio.h> /* INFRINGES ON USER NAME SPACE */ | ||
| 696 | # define YYFPRINTF fprintf | ||
| 697 | # endif | ||
| 698 | |||
| 699 | # define YYDPRINTF(Args) \ | ||
| 700 | do { \ | ||
| 701 | if (yydebug) \ | ||
| 702 | YYFPRINTF Args; \ | ||
| 703 | } while (0) | ||
| 704 | # define YYDSYMPRINT(Args) \ | ||
| 705 | do { \ | ||
| 706 | if (yydebug) \ | ||
| 707 | yysymprint Args; \ | ||
| 708 | } while (0) | ||
| 709 | /* Nonzero means print parse trace. It is left uninitialized so that | ||
| 710 | multiple parsers can coexist. */ | ||
| 711 | int yydebug; | ||
| 712 | #else /* !YYDEBUG */ | ||
| 713 | # define YYDPRINTF(Args) | ||
| 714 | # define YYDSYMPRINT(Args) | ||
| 715 | #endif /* !YYDEBUG */ | ||
| 716 | |||
| 717 | /* YYINITDEPTH -- initial size of the parser's stacks. */ | ||
| 718 | #ifndef YYINITDEPTH | ||
| 719 | # define YYINITDEPTH 200 | ||
| 720 | #endif | ||
| 721 | |||
| 722 | /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only | ||
| 723 | if the built-in stack extension method is used). | ||
| 724 | |||
| 725 | Do not make this value too large; the results are undefined if | ||
| 726 | SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) | ||
| 727 | evaluated with infinite-precision integer arithmetic. */ | ||
| 728 | |||
| 729 | #if YYMAXDEPTH == 0 | ||
| 730 | # undef YYMAXDEPTH | ||
| 731 | #endif | ||
| 732 | |||
| 733 | #ifndef YYMAXDEPTH | ||
| 734 | # define YYMAXDEPTH 10000 | ||
| 735 | #endif | ||
| 736 | |||
| 737 | |||
| 738 | |||
| 739 | #if YYERROR_VERBOSE | ||
| 740 | |||
| 741 | # ifndef yystrlen | ||
| 742 | # if defined (__GLIBC__) && defined (_STRING_H) | ||
| 743 | # define yystrlen strlen | ||
| 744 | # else | ||
| 745 | /* Return the length of YYSTR. */ | ||
| 746 | static YYSIZE_T | ||
| 747 | # if defined (__STDC__) || defined (__cplusplus) | ||
| 748 | yystrlen (const char *yystr) | ||
| 749 | # else | ||
| 750 | yystrlen (yystr) | ||
| 751 | const char *yystr; | ||
| 752 | # endif | ||
| 753 | { | ||
| 754 | register const char *yys = yystr; | ||
| 755 | |||
| 756 | while (*yys++ != '\0') | ||
| 757 | continue; | ||
| 758 | |||
| 759 | return yys - yystr - 1; | ||
| 760 | } | ||
| 761 | # endif | ||
| 762 | # endif | ||
| 763 | |||
| 764 | # ifndef yystpcpy | ||
| 765 | # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) | ||
| 766 | # define yystpcpy stpcpy | ||
| 767 | # else | ||
| 768 | /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in | ||
| 769 | YYDEST. */ | ||
| 770 | static char * | ||
| 771 | # if defined (__STDC__) || defined (__cplusplus) | ||
| 772 | yystpcpy (char *yydest, const char *yysrc) | ||
| 773 | # else | ||
| 774 | yystpcpy (yydest, yysrc) | ||
| 775 | char *yydest; | ||
| 776 | const char *yysrc; | ||
| 777 | # endif | ||
| 778 | { | ||
| 779 | register char *yyd = yydest; | ||
| 780 | register const char *yys = yysrc; | ||
| 781 | |||
| 782 | while ((*yyd++ = *yys++) != '\0') | ||
| 783 | continue; | ||
| 784 | |||
| 785 | return yyd - 1; | ||
| 786 | } | ||
| 787 | # endif | ||
| 788 | # endif | ||
| 789 | |||
| 790 | #endif /* !YYERROR_VERBOSE */ | ||
| 791 | |||
| 792 | |||
| 793 | |||
| 794 | #if YYDEBUG | ||
| 795 | /*-----------------------------. | ||
| 796 | | Print this symbol on YYOUT. | | ||
| 797 | `-----------------------------*/ | ||
| 798 | |||
| 799 | static void | ||
| 800 | #if defined (__STDC__) || defined (__cplusplus) | ||
| 801 | yysymprint (FILE* yyout, int yytype, YYSTYPE yyvalue) | ||
| 802 | #else | ||
| 803 | yysymprint (yyout, yytype, yyvalue) | ||
| 804 | FILE* yyout; | ||
| 805 | int yytype; | ||
| 806 | YYSTYPE yyvalue; | ||
| 807 | #endif | ||
| 808 | { | ||
| 809 | /* Pacify ``unused variable'' warnings. */ | ||
| 810 | (void) yyvalue; | ||
| 811 | |||
| 812 | if (yytype < YYNTOKENS) | ||
| 813 | { | ||
| 814 | YYFPRINTF (yyout, "token %s (", yytname[yytype]); | ||
| 815 | # ifdef YYPRINT | ||
| 816 | YYPRINT (yyout, yytoknum[yytype], yyvalue); | ||
| 817 | # endif | ||
| 818 | } | ||
| 819 | else | ||
| 820 | YYFPRINTF (yyout, "nterm %s (", yytname[yytype]); | ||
| 821 | |||
| 822 | switch (yytype) | ||
| 823 | { | ||
| 824 | default: | ||
| 825 | break; | ||
| 826 | } | ||
| 827 | YYFPRINTF (yyout, ")"); | ||
| 828 | } | ||
| 829 | #endif /* YYDEBUG. */ | ||
| 830 | |||
| 831 | |||
| 832 | /*-----------------------------------------------. | ||
| 833 | | Release the memory associated to this symbol. | | ||
| 834 | `-----------------------------------------------*/ | ||
| 835 | |||
| 836 | static void | ||
| 837 | #if defined (__STDC__) || defined (__cplusplus) | ||
| 838 | yydestruct (int yytype, YYSTYPE yyvalue) | ||
| 839 | #else | ||
| 840 | yydestruct (yytype, yyvalue) | ||
| 841 | int yytype; | ||
| 842 | YYSTYPE yyvalue; | ||
| 843 | #endif | ||
| 844 | { | ||
| 845 | /* Pacify ``unused variable'' warnings. */ | ||
| 846 | (void) yyvalue; | ||
| 847 | |||
| 848 | switch (yytype) | ||
| 849 | { | ||
| 850 | default: | ||
| 851 | break; | ||
| 852 | } | ||
| 853 | } | ||
| 854 | |||
| 855 | |||
| 856 | |||
| 857 | /* The user can define YYPARSE_PARAM as the name of an argument to be passed | ||
| 858 | into yyparse. The argument should have type void *. | ||
| 859 | It should actually point to an object. | ||
| 860 | Grammar actions can access the variable by casting it | ||
| 861 | to the proper pointer type. */ | ||
| 862 | |||
| 863 | #ifdef YYPARSE_PARAM | ||
| 864 | # if defined (__STDC__) || defined (__cplusplus) | ||
| 865 | # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM | ||
| 866 | # define YYPARSE_PARAM_DECL | ||
| 867 | # else | ||
| 868 | # define YYPARSE_PARAM_ARG YYPARSE_PARAM | ||
| 869 | # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; | ||
| 870 | # endif | ||
| 871 | #else /* !YYPARSE_PARAM */ | ||
| 872 | # define YYPARSE_PARAM_ARG | ||
| 873 | # define YYPARSE_PARAM_DECL | ||
| 874 | #endif /* !YYPARSE_PARAM */ | ||
| 875 | |||
| 876 | /* Prevent warning if -Wstrict-prototypes. */ | ||
| 877 | #ifdef __GNUC__ | ||
| 878 | # ifdef YYPARSE_PARAM | ||
| 879 | int yyparse (void *); | ||
| 880 | # else | ||
| 881 | int yyparse (void); | ||
| 882 | # endif | ||
| 883 | #endif | ||
| 884 | |||
| 885 | |||
| 886 | /* The lookahead symbol. */ | ||
| 887 | int yychar; | ||
| 888 | |||
| 889 | /* The semantic value of the lookahead symbol. */ | ||
| 890 | YYSTYPE yylval; | ||
| 891 | |||
| 892 | /* Number of parse errors so far. */ | ||
| 893 | int yynerrs; | ||
| 894 | |||
| 895 | |||
| 896 | int | ||
| 897 | yyparse (YYPARSE_PARAM_ARG) | ||
| 898 | YYPARSE_PARAM_DECL | ||
| 899 | { | ||
| 900 | |||
| 901 | register int yystate; | ||
| 902 | register int yyn; | ||
| 903 | int yyresult; | ||
| 904 | /* Number of tokens to shift before error messages enabled. */ | ||
| 905 | int yyerrstatus; | ||
| 906 | /* Lookahead token as an internal (translated) token number. */ | ||
| 907 | int yychar1 = 0; | ||
| 908 | |||
| 909 | /* Three stacks and their tools: | ||
| 910 | `yyss': related to states, | ||
| 911 | `yyvs': related to semantic values, | ||
| 912 | `yyls': related to locations. | ||
| 913 | |||
| 914 | Refer to the stacks thru separate pointers, to allow yyoverflow | ||
| 915 | to reallocate them elsewhere. */ | ||
| 916 | |||
| 917 | /* The state stack. */ | ||
| 918 | short yyssa[YYINITDEPTH]; | ||
| 919 | short *yyss = yyssa; | ||
| 920 | register short *yyssp; | ||
| 921 | |||
| 922 | /* The semantic value stack. */ | ||
| 923 | YYSTYPE yyvsa[YYINITDEPTH]; | ||
| 924 | YYSTYPE *yyvs = yyvsa; | ||
| 925 | register YYSTYPE *yyvsp; | ||
| 926 | |||
| 927 | |||
| 928 | |||
| 929 | #define YYPOPSTACK (yyvsp--, yyssp--) | ||
| 930 | |||
| 931 | YYSIZE_T yystacksize = YYINITDEPTH; | ||
| 932 | |||
| 933 | /* The variables used to return semantic value and location from the | ||
| 934 | action routines. */ | ||
| 935 | YYSTYPE yyval; | ||
| 936 | |||
| 937 | |||
| 938 | /* When reducing, the number of symbols on the RHS of the reduced | ||
| 939 | rule. */ | ||
| 940 | int yylen; | ||
| 941 | |||
| 942 | YYDPRINTF ((stderr, "Starting parse\n")); | ||
| 943 | |||
| 944 | yystate = 0; | ||
| 945 | yyerrstatus = 0; | ||
| 946 | yynerrs = 0; | ||
| 947 | yychar = YYEMPTY; /* Cause a token to be read. */ | ||
| 948 | |||
| 949 | /* Initialize stack pointers. | ||
| 950 | Waste one element of value and location stack | ||
| 951 | so that they stay on the same level as the state stack. | ||
| 952 | The wasted elements are never initialized. */ | ||
| 953 | |||
| 954 | yyssp = yyss; | ||
| 955 | yyvsp = yyvs; | ||
| 956 | |||
| 957 | goto yysetstate; | ||
| 958 | |||
| 959 | /*------------------------------------------------------------. | ||
| 960 | | yynewstate -- Push a new state, which is found in yystate. | | ||
| 961 | `------------------------------------------------------------*/ | ||
| 962 | yynewstate: | ||
| 963 | /* In all cases, when you get here, the value and location stacks | ||
| 964 | have just been pushed. so pushing a state here evens the stacks. | ||
| 965 | */ | ||
| 966 | yyssp++; | ||
| 967 | |||
| 968 | yysetstate: | ||
| 969 | *yyssp = yystate; | ||
| 970 | |||
| 971 | if (yyssp >= yyss + yystacksize - 1) | ||
| 972 | { | ||
| 973 | /* Get the current used size of the three stacks, in elements. */ | ||
| 974 | YYSIZE_T yysize = yyssp - yyss + 1; | ||
| 975 | |||
| 976 | #ifdef yyoverflow | ||
| 977 | { | ||
| 978 | /* Give user a chance to reallocate the stack. Use copies of | ||
| 979 | these so that the &'s don't force the real ones into | ||
| 980 | memory. */ | ||
| 981 | YYSTYPE *yyvs1 = yyvs; | ||
| 982 | short *yyss1 = yyss; | ||
| 983 | |||
| 984 | |||
| 985 | /* Each stack pointer address is followed by the size of the | ||
| 986 | data in use in that stack, in bytes. This used to be a | ||
| 987 | conditional around just the two extra args, but that might | ||
| 988 | be undefined if yyoverflow is a macro. */ | ||
| 989 | yyoverflow ("parser stack overflow", | ||
| 990 | &yyss1, yysize * sizeof (*yyssp), | ||
| 991 | &yyvs1, yysize * sizeof (*yyvsp), | ||
| 992 | |||
| 993 | &yystacksize); | ||
| 994 | |||
| 995 | yyss = yyss1; | ||
| 996 | yyvs = yyvs1; | ||
| 997 | } | ||
| 998 | #else /* no yyoverflow */ | ||
| 999 | # ifndef YYSTACK_RELOCATE | ||
| 1000 | goto yyoverflowlab; | ||
| 1001 | # else | ||
| 1002 | /* Extend the stack our own way. */ | ||
| 1003 | if (yystacksize >= YYMAXDEPTH) | ||
| 1004 | goto yyoverflowlab; | ||
| 1005 | yystacksize *= 2; | ||
| 1006 | if (yystacksize > YYMAXDEPTH) | ||
| 1007 | yystacksize = YYMAXDEPTH; | ||
| 1008 | |||
| 1009 | { | ||
| 1010 | short *yyss1 = yyss; | ||
| 1011 | union yyalloc *yyptr = | ||
| 1012 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | ||
| 1013 | if (! yyptr) | ||
| 1014 | goto yyoverflowlab; | ||
| 1015 | YYSTACK_RELOCATE (yyss); | ||
| 1016 | YYSTACK_RELOCATE (yyvs); | ||
| 1017 | |||
| 1018 | # undef YYSTACK_RELOCATE | ||
| 1019 | if (yyss1 != yyssa) | ||
| 1020 | YYSTACK_FREE (yyss1); | ||
| 1021 | } | ||
| 1022 | # endif | ||
| 1023 | #endif /* no yyoverflow */ | ||
| 1024 | |||
| 1025 | yyssp = yyss + yysize - 1; | ||
| 1026 | yyvsp = yyvs + yysize - 1; | ||
| 1027 | |||
| 1028 | |||
| 1029 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", | ||
| 1030 | (unsigned long int) yystacksize)); | ||
| 1031 | |||
| 1032 | if (yyssp >= yyss + yystacksize - 1) | ||
| 1033 | YYABORT; | ||
| 1034 | } | ||
| 1035 | |||
| 1036 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); | ||
| 1037 | |||
| 1038 | goto yybackup; | ||
| 1039 | |||
| 1040 | /*-----------. | ||
| 1041 | | yybackup. | | ||
| 1042 | `-----------*/ | ||
| 1043 | yybackup: | ||
| 1044 | |||
| 1045 | /* Do appropriate processing given the current state. */ | ||
| 1046 | /* Read a lookahead token if we need one and don't already have one. */ | ||
| 1047 | /* yyresume: */ | ||
| 1048 | |||
| 1049 | /* First try to decide what to do without reference to lookahead token. */ | ||
| 1050 | |||
| 1051 | yyn = yypact[yystate]; | ||
| 1052 | if (yyn == YYPACT_NINF) | ||
| 1053 | goto yydefault; | ||
| 1054 | |||
| 1055 | /* Not known => get a lookahead token if don't already have one. */ | ||
| 1056 | |||
| 1057 | /* yychar is either YYEMPTY or YYEOF | ||
| 1058 | or a valid token in external form. */ | ||
| 1059 | |||
| 1060 | if (yychar == YYEMPTY) | ||
| 1061 | { | ||
| 1062 | YYDPRINTF ((stderr, "Reading a token: ")); | ||
| 1063 | yychar = YYLEX; | ||
| 1064 | } | ||
| 1065 | |||
| 1066 | /* Convert token to internal form (in yychar1) for indexing tables with. */ | ||
| 1067 | |||
| 1068 | if (yychar <= 0) /* This means end of input. */ | ||
| 1069 | { | ||
| 1070 | yychar1 = 0; | ||
| 1071 | yychar = YYEOF; /* Don't call YYLEX any more. */ | ||
| 1072 | |||
| 1073 | YYDPRINTF ((stderr, "Now at end of input.\n")); | ||
| 1074 | } | ||
| 1075 | else | ||
| 1076 | { | ||
| 1077 | yychar1 = YYTRANSLATE (yychar); | ||
| 1078 | |||
| 1079 | /* We have to keep this `#if YYDEBUG', since we use variables | ||
| 1080 | which are defined only if `YYDEBUG' is set. */ | ||
| 1081 | YYDPRINTF ((stderr, "Next token is ")); | ||
| 1082 | YYDSYMPRINT ((stderr, yychar1, yylval)); | ||
| 1083 | YYDPRINTF ((stderr, "\n")); | ||
| 1084 | } | ||
| 1085 | |||
| 1086 | /* If the proper action on seeing token YYCHAR1 is to reduce or to | ||
| 1087 | detect an error, take that action. */ | ||
| 1088 | yyn += yychar1; | ||
| 1089 | if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yychar1) | ||
| 1090 | goto yydefault; | ||
| 1091 | yyn = yytable[yyn]; | ||
| 1092 | if (yyn <= 0) | ||
| 1093 | { | ||
| 1094 | if (yyn == 0 || yyn == YYTABLE_NINF) | ||
| 1095 | goto yyerrlab; | ||
| 1096 | yyn = -yyn; | ||
| 1097 | goto yyreduce; | ||
| 1098 | } | ||
| 1099 | |||
| 1100 | if (yyn == YYFINAL) | ||
| 1101 | YYACCEPT; | ||
| 1102 | |||
| 1103 | /* Shift the lookahead token. */ | ||
| 1104 | YYDPRINTF ((stderr, "Shifting token %d (%s), ", | ||
| 1105 | yychar, yytname[yychar1])); | ||
| 1106 | |||
| 1107 | /* Discard the token being shifted unless it is eof. */ | ||
| 1108 | if (yychar != YYEOF) | ||
| 1109 | yychar = YYEMPTY; | ||
| 1110 | |||
| 1111 | *++yyvsp = yylval; | ||
| 1112 | |||
| 1113 | |||
| 1114 | /* Count tokens shifted since error; after three, turn off error | ||
| 1115 | status. */ | ||
| 1116 | if (yyerrstatus) | ||
| 1117 | yyerrstatus--; | ||
| 1118 | |||
| 1119 | yystate = yyn; | ||
| 1120 | goto yynewstate; | ||
| 1121 | |||
| 1122 | |||
| 1123 | /*-----------------------------------------------------------. | ||
| 1124 | | yydefault -- do the default action for the current state. | | ||
| 1125 | `-----------------------------------------------------------*/ | ||
| 1126 | yydefault: | ||
| 1127 | yyn = yydefact[yystate]; | ||
| 1128 | if (yyn == 0) | ||
| 1129 | goto yyerrlab; | ||
| 1130 | goto yyreduce; | ||
| 1131 | |||
| 1132 | |||
| 1133 | /*-----------------------------. | ||
| 1134 | | yyreduce -- Do a reduction. | | ||
| 1135 | `-----------------------------*/ | ||
| 1136 | yyreduce: | ||
| 1137 | /* yyn is the number of a rule to reduce with. */ | ||
| 1138 | yylen = yyr2[yyn]; | ||
| 1139 | |||
| 1140 | /* If YYLEN is nonzero, implement the default value of the action: | ||
| 1141 | `$$ = $1'. | ||
| 1142 | |||
| 1143 | Otherwise, the following line sets YYVAL to garbage. | ||
| 1144 | This behavior is undocumented and Bison | ||
| 1145 | users should not rely upon it. Assigning to YYVAL | ||
| 1146 | unconditionally makes the parser a bit smaller, and it avoids a | ||
| 1147 | GCC warning that YYVAL may be used uninitialized. */ | ||
| 1148 | yyval = yyvsp[1-yylen]; | ||
| 1149 | |||
| 1150 | |||
| 1151 | |||
| 1152 | #if YYDEBUG | ||
| 1153 | /* We have to keep this `#if YYDEBUG', since we use variables which | ||
| 1154 | are defined only if `YYDEBUG' is set. */ | ||
| 1155 | if (yydebug) | ||
| 1156 | { | ||
| 1157 | int yyi; | ||
| 1158 | |||
| 1159 | YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", | ||
| 1160 | yyn - 1, yyrline[yyn]); | ||
| 1161 | |||
| 1162 | /* Print the symbols being reduced, and their result. */ | ||
| 1163 | for (yyi = yyprhs[yyn]; yyrhs[yyi] >= 0; yyi++) | ||
| 1164 | YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); | ||
| 1165 | YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); | ||
| 1166 | } | ||
| 1167 | #endif | ||
| 1168 | switch (yyn) | ||
| 1169 | { | ||
| 1170 | case 8: | ||
| 1171 | #line 96 "zconf.y" | ||
| 1172 | { zconfprint("unexpected 'endmenu' statement"); } | ||
| 1173 | break; | ||
| 1174 | |||
| 1175 | case 9: | ||
| 1176 | #line 97 "zconf.y" | ||
| 1177 | { zconfprint("unexpected 'endif' statement"); } | ||
| 1178 | break; | ||
| 1179 | |||
| 1180 | case 10: | ||
| 1181 | #line 98 "zconf.y" | ||
| 1182 | { zconfprint("unexpected 'endchoice' statement"); } | ||
| 1183 | break; | ||
| 1184 | |||
| 1185 | case 11: | ||
| 1186 | #line 99 "zconf.y" | ||
| 1187 | { zconfprint("syntax error"); yyerrok; } | ||
| 1188 | break; | ||
| 1189 | |||
| 1190 | case 17: | ||
| 1191 | #line 114 "zconf.y" | ||
| 1192 | { | ||
| 1193 | struct symbol *sym = sym_lookup(yyvsp[0].string, 0); | ||
| 1194 | sym->flags |= SYMBOL_OPTIONAL; | ||
| 1195 | menu_add_entry(sym); | ||
| 1196 | printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), yyvsp[0].string); | ||
| 1197 | } | ||
| 1198 | break; | ||
| 1199 | |||
| 1200 | case 18: | ||
| 1201 | #line 122 "zconf.y" | ||
| 1202 | { | ||
| 1203 | menu_end_entry(); | ||
| 1204 | printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); | ||
| 1205 | } | ||
| 1206 | break; | ||
| 1207 | |||
| 1208 | case 23: | ||
| 1209 | #line 133 "zconf.y" | ||
| 1210 | { } | ||
| 1211 | break; | ||
| 1212 | |||
| 1213 | case 24: | ||
| 1214 | #line 136 "zconf.y" | ||
| 1215 | { | ||
| 1216 | menu_set_type(S_TRISTATE); | ||
| 1217 | printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno()); | ||
| 1218 | } | ||
| 1219 | break; | ||
| 1220 | |||
| 1221 | case 25: | ||
| 1222 | #line 142 "zconf.y" | ||
| 1223 | { | ||
| 1224 | menu_set_type(S_BOOLEAN); | ||
| 1225 | printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno()); | ||
| 1226 | } | ||
| 1227 | break; | ||
| 1228 | |||
| 1229 | case 26: | ||
| 1230 | #line 148 "zconf.y" | ||
| 1231 | { | ||
| 1232 | menu_set_type(S_INT); | ||
| 1233 | printd(DEBUG_PARSE, "%s:%d:int\n", zconf_curname(), zconf_lineno()); | ||
| 1234 | } | ||
| 1235 | break; | ||
| 1236 | |||
| 1237 | case 27: | ||
| 1238 | #line 154 "zconf.y" | ||
| 1239 | { | ||
| 1240 | menu_set_type(S_HEX); | ||
| 1241 | printd(DEBUG_PARSE, "%s:%d:hex\n", zconf_curname(), zconf_lineno()); | ||
| 1242 | } | ||
| 1243 | break; | ||
| 1244 | |||
| 1245 | case 28: | ||
| 1246 | #line 160 "zconf.y" | ||
| 1247 | { | ||
| 1248 | menu_set_type(S_STRING); | ||
| 1249 | printd(DEBUG_PARSE, "%s:%d:string\n", zconf_curname(), zconf_lineno()); | ||
| 1250 | } | ||
| 1251 | break; | ||
| 1252 | |||
| 1253 | case 29: | ||
| 1254 | #line 166 "zconf.y" | ||
| 1255 | { | ||
| 1256 | menu_add_prop(P_PROMPT, yyvsp[-1].string, NULL, yyvsp[0].expr); | ||
| 1257 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); | ||
| 1258 | } | ||
| 1259 | break; | ||
| 1260 | |||
| 1261 | case 30: | ||
| 1262 | #line 172 "zconf.y" | ||
| 1263 | { | ||
| 1264 | menu_add_prop(P_DEFAULT, NULL, yyvsp[-1].symbol, yyvsp[0].expr); | ||
| 1265 | printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); | ||
| 1266 | } | ||
| 1267 | break; | ||
| 1268 | |||
| 1269 | case 31: | ||
| 1270 | #line 180 "zconf.y" | ||
| 1271 | { | ||
| 1272 | struct symbol *sym = sym_lookup(NULL, 0); | ||
| 1273 | sym->flags |= SYMBOL_CHOICE; | ||
| 1274 | menu_add_entry(sym); | ||
| 1275 | menu_add_prop(P_CHOICE, NULL, NULL, NULL); | ||
| 1276 | printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); | ||
| 1277 | } | ||
| 1278 | break; | ||
| 1279 | |||
| 1280 | case 32: | ||
| 1281 | #line 189 "zconf.y" | ||
| 1282 | { | ||
| 1283 | menu_end_entry(); | ||
| 1284 | menu_add_menu(); | ||
| 1285 | } | ||
| 1286 | break; | ||
| 1287 | |||
| 1288 | case 33: | ||
| 1289 | #line 195 "zconf.y" | ||
| 1290 | { | ||
| 1291 | if (zconf_endtoken(yyvsp[0].token, T_CHOICE, T_ENDCHOICE)) { | ||
| 1292 | menu_end_menu(); | ||
| 1293 | printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno()); | ||
| 1294 | } | ||
| 1295 | } | ||
| 1296 | break; | ||
| 1297 | |||
| 1298 | case 35: | ||
| 1299 | #line 205 "zconf.y" | ||
| 1300 | { | ||
| 1301 | printf("%s:%d: missing 'endchoice' for this 'choice' statement\n", current_menu->file->name, current_menu->lineno); | ||
| 1302 | zconfnerrs++; | ||
| 1303 | } | ||
| 1304 | break; | ||
| 1305 | |||
| 1306 | case 41: | ||
| 1307 | #line 219 "zconf.y" | ||
| 1308 | { | ||
| 1309 | menu_add_prop(P_PROMPT, yyvsp[-1].string, NULL, yyvsp[0].expr); | ||
| 1310 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); | ||
| 1311 | } | ||
| 1312 | break; | ||
| 1313 | |||
| 1314 | case 42: | ||
| 1315 | #line 225 "zconf.y" | ||
| 1316 | { | ||
| 1317 | current_entry->sym->flags |= SYMBOL_OPTIONAL; | ||
| 1318 | printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno()); | ||
| 1319 | } | ||
| 1320 | break; | ||
| 1321 | |||
| 1322 | case 43: | ||
| 1323 | #line 231 "zconf.y" | ||
| 1324 | { | ||
| 1325 | menu_add_prop(P_DEFAULT, NULL, yyvsp[0].symbol, NULL); | ||
| 1326 | //current_choice->prop->def = ; | ||
| 1327 | printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); | ||
| 1328 | } | ||
| 1329 | break; | ||
| 1330 | |||
| 1331 | case 46: | ||
| 1332 | #line 245 "zconf.y" | ||
| 1333 | { | ||
| 1334 | printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); | ||
| 1335 | menu_add_entry(NULL); | ||
| 1336 | //current_entry->prompt = menu_add_prop(T_IF, NULL, NULL, ); | ||
| 1337 | menu_add_dep(yyvsp[0].expr); | ||
| 1338 | menu_end_entry(); | ||
| 1339 | menu_add_menu(); | ||
| 1340 | } | ||
| 1341 | break; | ||
| 1342 | |||
| 1343 | case 47: | ||
| 1344 | #line 255 "zconf.y" | ||
| 1345 | { | ||
| 1346 | if (zconf_endtoken(yyvsp[0].token, T_IF, T_ENDIF)) { | ||
| 1347 | menu_end_menu(); | ||
| 1348 | printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno()); | ||
| 1349 | } | ||
| 1350 | } | ||
| 1351 | break; | ||
| 1352 | |||
| 1353 | case 49: | ||
| 1354 | #line 265 "zconf.y" | ||
| 1355 | { | ||
| 1356 | printf("%s:%d: missing 'endif' for this 'if' statement\n", current_menu->file->name, current_menu->lineno); | ||
| 1357 | zconfnerrs++; | ||
| 1358 | } | ||
| 1359 | break; | ||
| 1360 | |||
| 1361 | case 54: | ||
| 1362 | #line 280 "zconf.y" | ||
| 1363 | { | ||
| 1364 | menu_add_entry(NULL); | ||
| 1365 | menu_add_prop(P_MENU, yyvsp[0].string, NULL, NULL); | ||
| 1366 | printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); | ||
| 1367 | } | ||
| 1368 | break; | ||
| 1369 | |||
| 1370 | case 55: | ||
| 1371 | #line 287 "zconf.y" | ||
| 1372 | { | ||
| 1373 | menu_end_entry(); | ||
| 1374 | menu_add_menu(); | ||
| 1375 | } | ||
| 1376 | break; | ||
| 1377 | |||
| 1378 | case 56: | ||
| 1379 | #line 293 "zconf.y" | ||
| 1380 | { | ||
| 1381 | if (zconf_endtoken(yyvsp[0].token, T_MENU, T_ENDMENU)) { | ||
| 1382 | menu_end_menu(); | ||
| 1383 | printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno()); | ||
| 1384 | } | ||
| 1385 | } | ||
| 1386 | break; | ||
| 1387 | |||
| 1388 | case 58: | ||
| 1389 | #line 303 "zconf.y" | ||
| 1390 | { | ||
| 1391 | printf("%s:%d: missing 'endmenu' for this 'menu' statement\n", current_menu->file->name, current_menu->lineno); | ||
| 1392 | zconfnerrs++; | ||
| 1393 | } | ||
| 1394 | break; | ||
| 1395 | |||
| 1396 | case 63: | ||
| 1397 | #line 313 "zconf.y" | ||
| 1398 | { zconfprint("invalid menu option"); yyerrok; } | ||
| 1399 | break; | ||
| 1400 | |||
| 1401 | case 64: | ||
| 1402 | #line 317 "zconf.y" | ||
| 1403 | { | ||
| 1404 | yyval.string = yyvsp[0].string; | ||
| 1405 | printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), yyvsp[0].string); | ||
| 1406 | } | ||
| 1407 | break; | ||
| 1408 | |||
| 1409 | case 65: | ||
| 1410 | #line 323 "zconf.y" | ||
| 1411 | { | ||
| 1412 | zconf_nextfile(yyvsp[-1].string); | ||
| 1413 | } | ||
| 1414 | break; | ||
| 1415 | |||
| 1416 | case 66: | ||
| 1417 | #line 330 "zconf.y" | ||
| 1418 | { | ||
| 1419 | menu_add_entry(NULL); | ||
| 1420 | menu_add_prop(P_COMMENT, yyvsp[0].string, NULL, NULL); | ||
| 1421 | printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); | ||
| 1422 | } | ||
| 1423 | break; | ||
| 1424 | |||
| 1425 | case 67: | ||
| 1426 | #line 337 "zconf.y" | ||
| 1427 | { | ||
| 1428 | menu_end_entry(); | ||
| 1429 | } | ||
| 1430 | break; | ||
| 1431 | |||
| 1432 | case 68: | ||
| 1433 | #line 344 "zconf.y" | ||
| 1434 | { | ||
| 1435 | printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); | ||
| 1436 | zconf_starthelp(); | ||
| 1437 | } | ||
| 1438 | break; | ||
| 1439 | |||
| 1440 | case 69: | ||
| 1441 | #line 350 "zconf.y" | ||
| 1442 | { | ||
| 1443 | current_entry->sym->help = yyvsp[0].string; | ||
| 1444 | } | ||
| 1445 | break; | ||
| 1446 | |||
| 1447 | case 72: | ||
| 1448 | #line 359 "zconf.y" | ||
| 1449 | { } | ||
| 1450 | break; | ||
| 1451 | |||
| 1452 | case 73: | ||
| 1453 | #line 362 "zconf.y" | ||
| 1454 | { | ||
| 1455 | menu_add_dep(yyvsp[0].expr); | ||
| 1456 | printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); | ||
| 1457 | } | ||
| 1458 | break; | ||
| 1459 | |||
| 1460 | case 74: | ||
| 1461 | #line 367 "zconf.y" | ||
| 1462 | { | ||
| 1463 | menu_add_dep(yyvsp[0].expr); | ||
| 1464 | printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno()); | ||
| 1465 | } | ||
| 1466 | break; | ||
| 1467 | |||
| 1468 | case 75: | ||
| 1469 | #line 372 "zconf.y" | ||
| 1470 | { | ||
| 1471 | menu_add_dep(yyvsp[0].expr); | ||
| 1472 | printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno()); | ||
| 1473 | } | ||
| 1474 | break; | ||
| 1475 | |||
| 1476 | case 77: | ||
| 1477 | #line 382 "zconf.y" | ||
| 1478 | { | ||
| 1479 | menu_add_prop(P_PROMPT, yyvsp[0].string, NULL, NULL); | ||
| 1480 | } | ||
| 1481 | break; | ||
| 1482 | |||
| 1483 | case 78: | ||
| 1484 | #line 386 "zconf.y" | ||
| 1485 | { | ||
| 1486 | menu_add_prop(P_PROMPT, yyvsp[-2].string, NULL, yyvsp[0].expr); | ||
| 1487 | } | ||
| 1488 | break; | ||
| 1489 | |||
| 1490 | case 81: | ||
| 1491 | #line 394 "zconf.y" | ||
| 1492 | { yyval.token = T_ENDMENU; } | ||
| 1493 | break; | ||
| 1494 | |||
| 1495 | case 82: | ||
| 1496 | #line 395 "zconf.y" | ||
| 1497 | { yyval.token = T_ENDCHOICE; } | ||
| 1498 | break; | ||
| 1499 | |||
| 1500 | case 83: | ||
| 1501 | #line 396 "zconf.y" | ||
| 1502 | { yyval.token = T_ENDIF; } | ||
| 1503 | break; | ||
| 1504 | |||
| 1505 | case 86: | ||
| 1506 | #line 402 "zconf.y" | ||
| 1507 | { yyval.expr = NULL; } | ||
| 1508 | break; | ||
| 1509 | |||
| 1510 | case 87: | ||
| 1511 | #line 403 "zconf.y" | ||
| 1512 | { yyval.expr = yyvsp[0].expr; } | ||
| 1513 | break; | ||
| 1514 | |||
| 1515 | case 88: | ||
| 1516 | #line 406 "zconf.y" | ||
| 1517 | { yyval.expr = expr_alloc_symbol(yyvsp[0].symbol); } | ||
| 1518 | break; | ||
| 1519 | |||
| 1520 | case 89: | ||
| 1521 | #line 407 "zconf.y" | ||
| 1522 | { yyval.expr = expr_alloc_comp(E_EQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); } | ||
| 1523 | break; | ||
| 1524 | |||
| 1525 | case 90: | ||
| 1526 | #line 408 "zconf.y" | ||
| 1527 | { yyval.expr = expr_alloc_comp(E_UNEQUAL, yyvsp[-2].symbol, yyvsp[0].symbol); } | ||
| 1528 | break; | ||
| 1529 | |||
| 1530 | case 91: | ||
| 1531 | #line 409 "zconf.y" | ||
| 1532 | { yyval.expr = yyvsp[-1].expr; } | ||
| 1533 | break; | ||
| 1534 | |||
| 1535 | case 92: | ||
| 1536 | #line 410 "zconf.y" | ||
| 1537 | { yyval.expr = expr_alloc_one(E_NOT, yyvsp[0].expr); } | ||
| 1538 | break; | ||
| 1539 | |||
| 1540 | case 93: | ||
| 1541 | #line 411 "zconf.y" | ||
| 1542 | { yyval.expr = expr_alloc_two(E_OR, yyvsp[-2].expr, yyvsp[0].expr); } | ||
| 1543 | break; | ||
| 1544 | |||
| 1545 | case 94: | ||
| 1546 | #line 412 "zconf.y" | ||
| 1547 | { yyval.expr = expr_alloc_two(E_AND, yyvsp[-2].expr, yyvsp[0].expr); } | ||
| 1548 | break; | ||
| 1549 | |||
| 1550 | case 95: | ||
| 1551 | #line 415 "zconf.y" | ||
| 1552 | { yyval.symbol = sym_lookup(yyvsp[0].string, 0); free(yyvsp[0].string); } | ||
| 1553 | break; | ||
| 1554 | |||
| 1555 | case 96: | ||
| 1556 | #line 416 "zconf.y" | ||
| 1557 | { yyval.symbol = sym_lookup(yyvsp[0].string, 1); free(yyvsp[0].string); } | ||
| 1558 | break; | ||
| 1559 | |||
| 1560 | |||
| 1561 | } | ||
| 1562 | |||
| 1563 | /* Line 1016 of /usr/share/bison/yacc.c. */ | ||
| 1564 | #line 1565 "zconf.tab.c" | ||
| 1565 | |||
| 1566 | yyvsp -= yylen; | ||
| 1567 | yyssp -= yylen; | ||
| 1568 | |||
| 1569 | |||
| 1570 | #if YYDEBUG | ||
| 1571 | if (yydebug) | ||
| 1572 | { | ||
| 1573 | short *yyssp1 = yyss - 1; | ||
| 1574 | YYFPRINTF (stderr, "state stack now"); | ||
| 1575 | while (yyssp1 != yyssp) | ||
| 1576 | YYFPRINTF (stderr, " %d", *++yyssp1); | ||
| 1577 | YYFPRINTF (stderr, "\n"); | ||
| 1578 | } | ||
| 1579 | #endif | ||
| 1580 | |||
| 1581 | *++yyvsp = yyval; | ||
| 1582 | |||
| 1583 | |||
| 1584 | /* Now `shift' the result of the reduction. Determine what state | ||
| 1585 | that goes to, based on the state we popped back to and the rule | ||
| 1586 | number reduced by. */ | ||
| 1587 | |||
| 1588 | yyn = yyr1[yyn]; | ||
| 1589 | |||
| 1590 | yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; | ||
| 1591 | if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) | ||
| 1592 | yystate = yytable[yystate]; | ||
| 1593 | else | ||
| 1594 | yystate = yydefgoto[yyn - YYNTOKENS]; | ||
| 1595 | |||
| 1596 | goto yynewstate; | ||
| 1597 | |||
| 1598 | |||
| 1599 | /*------------------------------------. | ||
| 1600 | | yyerrlab -- here on detecting error | | ||
| 1601 | `------------------------------------*/ | ||
| 1602 | yyerrlab: | ||
| 1603 | /* If not already recovering from an error, report this error. */ | ||
| 1604 | if (!yyerrstatus) | ||
| 1605 | { | ||
| 1606 | ++yynerrs; | ||
| 1607 | #if YYERROR_VERBOSE | ||
| 1608 | yyn = yypact[yystate]; | ||
| 1609 | |||
| 1610 | if (YYPACT_NINF < yyn && yyn < YYLAST) | ||
| 1611 | { | ||
| 1612 | YYSIZE_T yysize = 0; | ||
| 1613 | int yytype = YYTRANSLATE (yychar); | ||
| 1614 | char *yymsg; | ||
| 1615 | int yyx, yycount; | ||
| 1616 | |||
| 1617 | yycount = 0; | ||
| 1618 | /* Start YYX at -YYN if negative to avoid negative indexes in | ||
| 1619 | YYCHECK. */ | ||
| 1620 | for (yyx = yyn < 0 ? -yyn : 0; | ||
| 1621 | yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) | ||
| 1622 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) | ||
| 1623 | yysize += yystrlen (yytname[yyx]) + 15, yycount++; | ||
| 1624 | yysize += yystrlen ("parse error, unexpected ") + 1; | ||
| 1625 | yysize += yystrlen (yytname[yytype]); | ||
| 1626 | yymsg = (char *) YYSTACK_ALLOC (yysize); | ||
| 1627 | if (yymsg != 0) | ||
| 1628 | { | ||
| 1629 | char *yyp = yystpcpy (yymsg, "parse error, unexpected "); | ||
| 1630 | yyp = yystpcpy (yyp, yytname[yytype]); | ||
| 1631 | |||
| 1632 | if (yycount < 5) | ||
| 1633 | { | ||
| 1634 | yycount = 0; | ||
| 1635 | for (yyx = yyn < 0 ? -yyn : 0; | ||
| 1636 | yyx < (int) (sizeof (yytname) / sizeof (char *)); | ||
| 1637 | yyx++) | ||
| 1638 | if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) | ||
| 1639 | { | ||
| 1640 | const char *yyq = ! yycount ? ", expecting " : " or "; | ||
| 1641 | yyp = yystpcpy (yyp, yyq); | ||
| 1642 | yyp = yystpcpy (yyp, yytname[yyx]); | ||
| 1643 | yycount++; | ||
| 1644 | } | ||
| 1645 | } | ||
| 1646 | yyerror (yymsg); | ||
| 1647 | YYSTACK_FREE (yymsg); | ||
| 1648 | } | ||
| 1649 | else | ||
| 1650 | yyerror ("parse error; also virtual memory exhausted"); | ||
| 1651 | } | ||
| 1652 | else | ||
| 1653 | #endif /* YYERROR_VERBOSE */ | ||
| 1654 | yyerror ("parse error"); | ||
| 1655 | } | ||
| 1656 | goto yyerrlab1; | ||
| 1657 | |||
| 1658 | |||
| 1659 | /*----------------------------------------------------. | ||
| 1660 | | yyerrlab1 -- error raised explicitly by an action. | | ||
| 1661 | `----------------------------------------------------*/ | ||
| 1662 | yyerrlab1: | ||
| 1663 | if (yyerrstatus == 3) | ||
| 1664 | { | ||
| 1665 | /* If just tried and failed to reuse lookahead token after an | ||
| 1666 | error, discard it. */ | ||
| 1667 | |||
| 1668 | /* Return failure if at end of input. */ | ||
| 1669 | if (yychar == YYEOF) | ||
| 1670 | { | ||
| 1671 | /* Pop the error token. */ | ||
| 1672 | YYPOPSTACK; | ||
| 1673 | /* Pop the rest of the stack. */ | ||
| 1674 | while (yyssp > yyss) | ||
| 1675 | { | ||
| 1676 | YYDPRINTF ((stderr, "Error: popping ")); | ||
| 1677 | YYDSYMPRINT ((stderr, | ||
| 1678 | yystos[*yyssp], | ||
| 1679 | *yyvsp)); | ||
| 1680 | YYDPRINTF ((stderr, "\n")); | ||
| 1681 | yydestruct (yystos[*yyssp], *yyvsp); | ||
| 1682 | YYPOPSTACK; | ||
| 1683 | } | ||
| 1684 | YYABORT; | ||
| 1685 | } | ||
| 1686 | |||
| 1687 | YYDPRINTF ((stderr, "Discarding token %d (%s).\n", | ||
| 1688 | yychar, yytname[yychar1])); | ||
| 1689 | yydestruct (yychar1, yylval); | ||
| 1690 | yychar = YYEMPTY; | ||
| 1691 | } | ||
| 1692 | |||
| 1693 | /* Else will try to reuse lookahead token after shifting the error | ||
| 1694 | token. */ | ||
| 1695 | |||
| 1696 | yyerrstatus = 3; /* Each real token shifted decrements this. */ | ||
| 1697 | |||
| 1698 | for (;;) | ||
| 1699 | { | ||
| 1700 | yyn = yypact[yystate]; | ||
| 1701 | if (yyn != YYPACT_NINF) | ||
| 1702 | { | ||
| 1703 | yyn += YYTERROR; | ||
| 1704 | if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) | ||
| 1705 | { | ||
| 1706 | yyn = yytable[yyn]; | ||
| 1707 | if (0 < yyn) | ||
| 1708 | break; | ||
| 1709 | } | ||
| 1710 | } | ||
| 1711 | |||
| 1712 | /* Pop the current state because it cannot handle the error token. */ | ||
| 1713 | if (yyssp == yyss) | ||
| 1714 | YYABORT; | ||
| 1715 | |||
| 1716 | YYDPRINTF ((stderr, "Error: popping ")); | ||
| 1717 | YYDSYMPRINT ((stderr, | ||
| 1718 | yystos[*yyssp], *yyvsp)); | ||
| 1719 | YYDPRINTF ((stderr, "\n")); | ||
| 1720 | |||
| 1721 | yydestruct (yystos[yystate], *yyvsp); | ||
| 1722 | yyvsp--; | ||
| 1723 | yystate = *--yyssp; | ||
| 1724 | |||
| 1725 | |||
| 1726 | #if YYDEBUG | ||
| 1727 | if (yydebug) | ||
| 1728 | { | ||
| 1729 | short *yyssp1 = yyss - 1; | ||
| 1730 | YYFPRINTF (stderr, "Error: state stack now"); | ||
| 1731 | while (yyssp1 != yyssp) | ||
| 1732 | YYFPRINTF (stderr, " %d", *++yyssp1); | ||
| 1733 | YYFPRINTF (stderr, "\n"); | ||
| 1734 | } | ||
| 1735 | #endif | ||
| 1736 | } | ||
| 1737 | |||
| 1738 | if (yyn == YYFINAL) | ||
| 1739 | YYACCEPT; | ||
| 1740 | |||
| 1741 | YYDPRINTF ((stderr, "Shifting error token, ")); | ||
| 1742 | |||
| 1743 | *++yyvsp = yylval; | ||
| 1744 | |||
| 1745 | |||
| 1746 | yystate = yyn; | ||
| 1747 | goto yynewstate; | ||
| 1748 | |||
| 1749 | |||
| 1750 | /*-------------------------------------. | ||
| 1751 | | yyacceptlab -- YYACCEPT comes here. | | ||
| 1752 | `-------------------------------------*/ | ||
| 1753 | yyacceptlab: | ||
| 1754 | yyresult = 0; | ||
| 1755 | goto yyreturn; | ||
| 1756 | |||
| 1757 | /*-----------------------------------. | ||
| 1758 | | yyabortlab -- YYABORT comes here. | | ||
| 1759 | `-----------------------------------*/ | ||
| 1760 | yyabortlab: | ||
| 1761 | yyresult = 1; | ||
| 1762 | goto yyreturn; | ||
| 1763 | |||
| 1764 | #ifndef yyoverflow | ||
| 1765 | /*----------------------------------------------. | ||
| 1766 | | yyoverflowlab -- parser overflow comes here. | | ||
| 1767 | `----------------------------------------------*/ | ||
| 1768 | yyoverflowlab: | ||
| 1769 | yyerror ("parser stack overflow"); | ||
| 1770 | yyresult = 2; | ||
| 1771 | /* Fall through. */ | ||
| 1772 | #endif | ||
| 1773 | |||
| 1774 | yyreturn: | ||
| 1775 | #ifndef yyoverflow | ||
| 1776 | if (yyss != yyssa) | ||
| 1777 | YYSTACK_FREE (yyss); | ||
| 1778 | #endif | ||
| 1779 | return yyresult; | ||
| 1780 | } | ||
| 1781 | |||
| 1782 | |||
| 1783 | #line 419 "zconf.y" | ||
| 1784 | |||
| 1785 | |||
| 1786 | void conf_parse(const char *name) | ||
| 1787 | { | ||
| 1788 | zconf_initscan(name); | ||
| 1789 | |||
| 1790 | sym_init(); | ||
| 1791 | menu_init(); | ||
| 1792 | rootmenu.prompt = menu_add_prop(P_MENU, "BusyBox Configuration", NULL, NULL); | ||
| 1793 | |||
| 1794 | //zconfdebug = 1; | ||
| 1795 | zconfparse(); | ||
| 1796 | if (zconfnerrs) | ||
| 1797 | exit(1); | ||
| 1798 | menu_finalize(&rootmenu); | ||
| 1799 | |||
| 1800 | modules_sym = sym_lookup("MODULES", 0); | ||
| 1801 | |||
| 1802 | sym_change_count = 1; | ||
| 1803 | } | ||
| 1804 | |||
| 1805 | const char *zconf_tokenname(int token) | ||
| 1806 | { | ||
| 1807 | switch (token) { | ||
| 1808 | case T_MENU: return "menu"; | ||
| 1809 | case T_ENDMENU: return "endmenu"; | ||
| 1810 | case T_CHOICE: return "choice"; | ||
| 1811 | case T_ENDCHOICE: return "endchoice"; | ||
| 1812 | case T_IF: return "if"; | ||
| 1813 | case T_ENDIF: return "endif"; | ||
| 1814 | } | ||
| 1815 | return "<token>"; | ||
| 1816 | } | ||
| 1817 | |||
| 1818 | static bool zconf_endtoken(int token, int starttoken, int endtoken) | ||
| 1819 | { | ||
| 1820 | if (token != endtoken) { | ||
| 1821 | zconfprint("unexpected '%s' within %s block", zconf_tokenname(token), zconf_tokenname(starttoken)); | ||
| 1822 | zconfnerrs++; | ||
| 1823 | return false; | ||
| 1824 | } | ||
| 1825 | if (current_menu->file != current_file) { | ||
| 1826 | zconfprint("'%s' in different file than '%s'", zconf_tokenname(token), zconf_tokenname(starttoken)); | ||
| 1827 | zconfprint("location of the '%s'", zconf_tokenname(starttoken)); | ||
| 1828 | zconfnerrs++; | ||
| 1829 | return false; | ||
| 1830 | } | ||
| 1831 | return true; | ||
| 1832 | } | ||
| 1833 | |||
| 1834 | static void zconfprint(const char *err, ...) | ||
| 1835 | { | ||
| 1836 | va_list ap; | ||
| 1837 | |||
| 1838 | fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); | ||
| 1839 | va_start(ap, err); | ||
| 1840 | vfprintf(stderr, err, ap); | ||
| 1841 | va_end(ap); | ||
| 1842 | fprintf(stderr, "\n"); | ||
| 1843 | } | ||
| 1844 | |||
| 1845 | static void zconferror(const char *err) | ||
| 1846 | { | ||
| 1847 | fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno(), err); | ||
| 1848 | } | ||
| 1849 | |||
| 1850 | void print_quoted_string(FILE *out, const char *str) | ||
| 1851 | { | ||
| 1852 | const char *p; | ||
| 1853 | int len; | ||
| 1854 | |||
| 1855 | putc('"', out); | ||
| 1856 | while ((p = strchr(str, '"'))) { | ||
| 1857 | len = p - str; | ||
| 1858 | if (len) | ||
| 1859 | fprintf(out, "%.*s", len, str); | ||
| 1860 | fputs("\\\"", out); | ||
| 1861 | str = p + 1; | ||
| 1862 | } | ||
| 1863 | fputs(str, out); | ||
| 1864 | putc('"', out); | ||
| 1865 | } | ||
| 1866 | |||
| 1867 | void print_symbol(FILE *out, struct menu *menu) | ||
| 1868 | { | ||
| 1869 | struct symbol *sym = menu->sym; | ||
| 1870 | struct property *prop; | ||
| 1871 | |||
| 1872 | //sym->flags |= SYMBOL_PRINTED; | ||
| 1873 | |||
| 1874 | if (sym_is_choice(sym)) | ||
| 1875 | fprintf(out, "choice\n"); | ||
| 1876 | else | ||
| 1877 | fprintf(out, "config %s\n", sym->name); | ||
| 1878 | switch (sym->type) { | ||
| 1879 | case S_BOOLEAN: | ||
| 1880 | fputs(" boolean\n", out); | ||
| 1881 | break; | ||
| 1882 | case S_TRISTATE: | ||
| 1883 | fputs(" tristate\n", out); | ||
| 1884 | break; | ||
| 1885 | case S_STRING: | ||
| 1886 | fputs(" string\n", out); | ||
| 1887 | break; | ||
| 1888 | case S_INT: | ||
| 1889 | fputs(" integer\n", out); | ||
| 1890 | break; | ||
| 1891 | case S_HEX: | ||
| 1892 | fputs(" hex\n", out); | ||
| 1893 | break; | ||
| 1894 | default: | ||
| 1895 | fputs(" ???\n", out); | ||
| 1896 | break; | ||
| 1897 | } | ||
| 1898 | #if 0 | ||
| 1899 | if (!expr_is_yes(sym->dep)) { | ||
| 1900 | fputs(" depends ", out); | ||
| 1901 | expr_fprint(sym->dep, out); | ||
| 1902 | fputc('\n', out); | ||
| 1903 | } | ||
| 1904 | #endif | ||
| 1905 | for (prop = sym->prop; prop; prop = prop->next) { | ||
| 1906 | if (prop->menu != menu) | ||
| 1907 | continue; | ||
| 1908 | switch (prop->type) { | ||
| 1909 | case P_PROMPT: | ||
| 1910 | fputs(" prompt ", out); | ||
| 1911 | print_quoted_string(out, prop->text); | ||
| 1912 | if (prop->def) { | ||
| 1913 | fputc(' ', out); | ||
| 1914 | if (prop->def->flags & SYMBOL_CONST) | ||
| 1915 | print_quoted_string(out, prop->def->name); | ||
| 1916 | else | ||
| 1917 | fputs(prop->def->name, out); | ||
| 1918 | } | ||
| 1919 | if (!expr_is_yes(E_EXPR(prop->visible))) { | ||
| 1920 | fputs(" if ", out); | ||
| 1921 | expr_fprint(E_EXPR(prop->visible), out); | ||
| 1922 | } | ||
| 1923 | fputc('\n', out); | ||
| 1924 | break; | ||
| 1925 | case P_DEFAULT: | ||
| 1926 | fputs( " default ", out); | ||
| 1927 | print_quoted_string(out, prop->def->name); | ||
| 1928 | if (!expr_is_yes(E_EXPR(prop->visible))) { | ||
| 1929 | fputs(" if ", out); | ||
| 1930 | expr_fprint(E_EXPR(prop->visible), out); | ||
| 1931 | } | ||
| 1932 | fputc('\n', out); | ||
| 1933 | break; | ||
| 1934 | case P_CHOICE: | ||
| 1935 | fputs(" #choice value\n", out); | ||
| 1936 | break; | ||
| 1937 | default: | ||
| 1938 | fprintf(out, " unknown prop %d!\n", prop->type); | ||
| 1939 | break; | ||
| 1940 | } | ||
| 1941 | } | ||
| 1942 | if (sym->help) { | ||
| 1943 | int len = strlen(sym->help); | ||
| 1944 | while (sym->help[--len] == '\n') | ||
| 1945 | sym->help[len] = 0; | ||
| 1946 | fprintf(out, " help\n%s\n", sym->help); | ||
| 1947 | } | ||
| 1948 | fputc('\n', out); | ||
| 1949 | } | ||
| 1950 | |||
| 1951 | void zconfdump(FILE *out) | ||
| 1952 | { | ||
| 1953 | //struct file *file; | ||
| 1954 | struct property *prop; | ||
| 1955 | struct symbol *sym; | ||
| 1956 | struct menu *menu; | ||
| 1957 | |||
| 1958 | menu = rootmenu.list; | ||
| 1959 | while (menu) { | ||
| 1960 | if ((sym = menu->sym)) | ||
| 1961 | print_symbol(out, menu); | ||
| 1962 | else if ((prop = menu->prompt)) { | ||
| 1963 | switch (prop->type) { | ||
| 1964 | //case T_MAINMENU: | ||
| 1965 | // fputs("\nmainmenu ", out); | ||
| 1966 | // print_quoted_string(out, prop->text); | ||
| 1967 | // fputs("\n", out); | ||
| 1968 | // break; | ||
| 1969 | case P_COMMENT: | ||
| 1970 | fputs("\ncomment ", out); | ||
| 1971 | print_quoted_string(out, prop->text); | ||
| 1972 | fputs("\n", out); | ||
| 1973 | break; | ||
| 1974 | case P_MENU: | ||
| 1975 | fputs("\nmenu ", out); | ||
| 1976 | print_quoted_string(out, prop->text); | ||
| 1977 | fputs("\n", out); | ||
| 1978 | break; | ||
| 1979 | //case T_SOURCE: | ||
| 1980 | // fputs("\nsource ", out); | ||
| 1981 | // print_quoted_string(out, prop->text); | ||
| 1982 | // fputs("\n", out); | ||
| 1983 | // break; | ||
| 1984 | //case T_IF: | ||
| 1985 | // fputs("\nif\n", out); | ||
| 1986 | default: | ||
| 1987 | ; | ||
| 1988 | } | ||
| 1989 | if (!expr_is_yes(E_EXPR(prop->visible))) { | ||
| 1990 | fputs(" depends ", out); | ||
| 1991 | expr_fprint(E_EXPR(prop->visible), out); | ||
| 1992 | fputc('\n', out); | ||
| 1993 | } | ||
| 1994 | fputs("\n", out); | ||
| 1995 | } | ||
| 1996 | |||
| 1997 | if (menu->list) | ||
| 1998 | menu = menu->list; | ||
| 1999 | else if (menu->next) | ||
| 2000 | menu = menu->next; | ||
| 2001 | else while ((menu = menu->parent)) { | ||
| 2002 | if (menu->prompt && menu->prompt->type == P_MENU) | ||
| 2003 | fputs("\nendmenu\n", out); | ||
| 2004 | if (menu->next) { | ||
| 2005 | menu = menu->next; | ||
| 2006 | break; | ||
| 2007 | } | ||
| 2008 | } | ||
| 2009 | } | ||
| 2010 | } | ||
| 2011 | |||
| 2012 | #include "lex.zconf.c" | ||
| 2013 | #include "confdata.c" | ||
| 2014 | #include "expr.c" | ||
| 2015 | #include "symbol.c" | ||
| 2016 | #include "menu.c" | ||
| 2017 | |||
diff --git a/scripts/config/zconf.tab.h_shipped b/scripts/config/zconf.tab.h_shipped new file mode 100644 index 000000000..3b191ef59 --- /dev/null +++ b/scripts/config/zconf.tab.h_shipped | |||
| @@ -0,0 +1,125 @@ | |||
| 1 | /* A Bison parser, made from zconf.y, by GNU bison 1.75. */ | ||
| 2 | |||
| 3 | /* Skeleton parser for Yacc-like parsing with Bison, | ||
| 4 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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 | #ifndef BISON_ZCONF_TAB_H | ||
| 27 | # define BISON_ZCONF_TAB_H | ||
| 28 | |||
| 29 | /* Tokens. */ | ||
| 30 | #ifndef YYTOKENTYPE | ||
| 31 | # define YYTOKENTYPE | ||
| 32 | /* Put the tokens into the symbol table, so that GDB and other debuggers | ||
| 33 | know about them. */ | ||
| 34 | enum yytokentype { | ||
| 35 | T_MAINMENU = 258, | ||
| 36 | T_MENU = 259, | ||
| 37 | T_ENDMENU = 260, | ||
| 38 | T_SOURCE = 261, | ||
| 39 | T_CHOICE = 262, | ||
| 40 | T_ENDCHOICE = 263, | ||
| 41 | T_COMMENT = 264, | ||
| 42 | T_CONFIG = 265, | ||
| 43 | T_HELP = 266, | ||
| 44 | T_HELPTEXT = 267, | ||
| 45 | T_IF = 268, | ||
| 46 | T_ENDIF = 269, | ||
| 47 | T_DEPENDS = 270, | ||
| 48 | T_REQUIRES = 271, | ||
| 49 | T_OPTIONAL = 272, | ||
| 50 | T_PROMPT = 273, | ||
| 51 | T_DEFAULT = 274, | ||
| 52 | T_TRISTATE = 275, | ||
| 53 | T_BOOLEAN = 276, | ||
| 54 | T_INT = 277, | ||
| 55 | T_HEX = 278, | ||
| 56 | T_WORD = 279, | ||
| 57 | T_STRING = 280, | ||
| 58 | T_UNEQUAL = 281, | ||
| 59 | T_EOF = 282, | ||
| 60 | T_EOL = 283, | ||
| 61 | T_CLOSE_PAREN = 284, | ||
| 62 | T_OPEN_PAREN = 285, | ||
| 63 | T_ON = 286, | ||
| 64 | T_OR = 287, | ||
| 65 | T_AND = 288, | ||
| 66 | T_EQUAL = 289, | ||
| 67 | T_NOT = 290 | ||
| 68 | }; | ||
| 69 | #endif | ||
| 70 | #define T_MAINMENU 258 | ||
| 71 | #define T_MENU 259 | ||
| 72 | #define T_ENDMENU 260 | ||
| 73 | #define T_SOURCE 261 | ||
| 74 | #define T_CHOICE 262 | ||
| 75 | #define T_ENDCHOICE 263 | ||
| 76 | #define T_COMMENT 264 | ||
| 77 | #define T_CONFIG 265 | ||
| 78 | #define T_HELP 266 | ||
| 79 | #define T_HELPTEXT 267 | ||
| 80 | #define T_IF 268 | ||
| 81 | #define T_ENDIF 269 | ||
| 82 | #define T_DEPENDS 270 | ||
| 83 | #define T_REQUIRES 271 | ||
| 84 | #define T_OPTIONAL 272 | ||
| 85 | #define T_PROMPT 273 | ||
| 86 | #define T_DEFAULT 274 | ||
| 87 | #define T_TRISTATE 275 | ||
| 88 | #define T_BOOLEAN 276 | ||
| 89 | #define T_INT 277 | ||
| 90 | #define T_HEX 278 | ||
| 91 | #define T_WORD 279 | ||
| 92 | #define T_STRING 280 | ||
| 93 | #define T_UNEQUAL 281 | ||
| 94 | #define T_EOF 282 | ||
| 95 | #define T_EOL 283 | ||
| 96 | #define T_CLOSE_PAREN 284 | ||
| 97 | #define T_OPEN_PAREN 285 | ||
| 98 | #define T_ON 286 | ||
| 99 | #define T_OR 287 | ||
| 100 | #define T_AND 288 | ||
| 101 | #define T_EQUAL 289 | ||
| 102 | #define T_NOT 290 | ||
| 103 | |||
| 104 | |||
| 105 | |||
| 106 | |||
| 107 | #ifndef YYSTYPE | ||
| 108 | #line 33 "zconf.y" | ||
| 109 | typedef union { | ||
| 110 | int token; | ||
| 111 | char *string; | ||
| 112 | struct symbol *symbol; | ||
| 113 | struct expr *expr; | ||
| 114 | struct menu *menu; | ||
| 115 | } yystype; | ||
| 116 | /* Line 1281 of /usr/share/bison/yacc.c. */ | ||
| 117 | #line 118 "zconf.tab.h" | ||
| 118 | # define YYSTYPE yystype | ||
| 119 | #endif | ||
| 120 | |||
| 121 | extern YYSTYPE zconflval; | ||
| 122 | |||
| 123 | |||
| 124 | #endif /* not BISON_ZCONF_TAB_H */ | ||
| 125 | |||
diff --git a/scripts/config/zconf.y b/scripts/config/zconf.y new file mode 100644 index 000000000..301d7a896 --- /dev/null +++ b/scripts/config/zconf.y | |||
| @@ -0,0 +1,651 @@ | |||
| 1 | %{ | ||
| 2 | /* | ||
| 3 | * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org> | ||
| 4 | * Released under the terms of the GNU GPL v2.0. | ||
| 5 | */ | ||
| 6 | |||
| 7 | #include <ctype.h> | ||
| 8 | #include <stdarg.h> | ||
| 9 | #include <stdio.h> | ||
| 10 | #include <stdlib.h> | ||
| 11 | #include <string.h> | ||
| 12 | #include <stdbool.h> | ||
| 13 | |||
| 14 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) | ||
| 15 | |||
| 16 | #define PRINTD 0x0001 | ||
| 17 | #define DEBUG_PARSE 0x0002 | ||
| 18 | |||
| 19 | int cdebug = PRINTD; | ||
| 20 | |||
| 21 | extern int zconflex(void); | ||
| 22 | static void zconfprint(const char *err, ...); | ||
| 23 | static void zconferror(const char *err); | ||
| 24 | static bool zconf_endtoken(int token, int starttoken, int endtoken); | ||
| 25 | |||
| 26 | struct symbol *symbol_hash[257]; | ||
| 27 | |||
| 28 | #define YYERROR_VERBOSE | ||
| 29 | %} | ||
| 30 | %expect 36 | ||
| 31 | |||
| 32 | %union | ||
| 33 | { | ||
| 34 | int token; | ||
| 35 | char *string; | ||
| 36 | struct symbol *symbol; | ||
| 37 | struct expr *expr; | ||
| 38 | struct menu *menu; | ||
| 39 | } | ||
| 40 | |||
| 41 | %token T_MAINMENU | ||
| 42 | %token T_MENU | ||
| 43 | %token T_ENDMENU | ||
| 44 | %token T_SOURCE | ||
| 45 | %token T_CHOICE | ||
| 46 | %token T_ENDCHOICE | ||
| 47 | %token T_COMMENT | ||
| 48 | %token T_CONFIG | ||
| 49 | %token T_HELP | ||
| 50 | %token <string> T_HELPTEXT | ||
| 51 | %token T_IF | ||
| 52 | %token T_ENDIF | ||
| 53 | %token T_DEPENDS | ||
| 54 | %token T_REQUIRES | ||
| 55 | %token T_OPTIONAL | ||
| 56 | %token T_PROMPT | ||
| 57 | %token T_DEFAULT | ||
| 58 | %token T_TRISTATE | ||
| 59 | %token T_BOOLEAN | ||
| 60 | %token T_INT | ||
| 61 | %token T_HEX | ||
| 62 | %token <string> T_WORD | ||
| 63 | %token <string> T_STRING | ||
| 64 | %token T_UNEQUAL | ||
| 65 | %token T_EOF | ||
| 66 | %token T_EOL | ||
| 67 | %token T_CLOSE_PAREN | ||
| 68 | %token T_OPEN_PAREN | ||
| 69 | %token T_ON | ||
| 70 | |||
| 71 | %left T_OR | ||
| 72 | %left T_AND | ||
| 73 | %left T_EQUAL T_UNEQUAL | ||
| 74 | %nonassoc T_NOT | ||
| 75 | |||
| 76 | %type <string> prompt | ||
| 77 | %type <string> source | ||
| 78 | %type <symbol> symbol | ||
| 79 | %type <expr> expr | ||
| 80 | %type <expr> if_expr | ||
| 81 | %type <token> end | ||
| 82 | |||
| 83 | %{ | ||
| 84 | #define LKC_DIRECT_LINK | ||
| 85 | #include "lkc.h" | ||
| 86 | %} | ||
| 87 | %% | ||
| 88 | input: /* empty */ | ||
| 89 | | input block | ||
| 90 | ; | ||
| 91 | |||
| 92 | block: common_block | ||
| 93 | | choice_stmt | ||
| 94 | | menu_stmt | ||
| 95 | | T_MAINMENU prompt nl_or_eof | ||
| 96 | | T_ENDMENU { zconfprint("unexpected 'endmenu' statement"); } | ||
| 97 | | T_ENDIF { zconfprint("unexpected 'endif' statement"); } | ||
| 98 | | T_ENDCHOICE { zconfprint("unexpected 'endchoice' statement"); } | ||
| 99 | | error nl_or_eof { zconfprint("syntax error"); yyerrok; } | ||
| 100 | ; | ||
| 101 | |||
| 102 | common_block: | ||
| 103 | if_stmt | ||
| 104 | | comment_stmt | ||
| 105 | | config_stmt | ||
| 106 | | source_stmt | ||
| 107 | | nl_or_eof | ||
| 108 | ; | ||
| 109 | |||
| 110 | |||
| 111 | /* config entry */ | ||
| 112 | |||
| 113 | config_entry_start: T_CONFIG T_WORD | ||
| 114 | { | ||
| 115 | struct symbol *sym = sym_lookup($2, 0); | ||
| 116 | sym->flags |= SYMBOL_OPTIONAL; | ||
| 117 | menu_add_entry(sym); | ||
| 118 | printd(DEBUG_PARSE, "%s:%d:config %s\n", zconf_curname(), zconf_lineno(), $2); | ||
| 119 | }; | ||
| 120 | |||
| 121 | config_stmt: config_entry_start T_EOL config_option_list | ||
| 122 | { | ||
| 123 | menu_end_entry(); | ||
| 124 | printd(DEBUG_PARSE, "%s:%d:endconfig\n", zconf_curname(), zconf_lineno()); | ||
| 125 | }; | ||
| 126 | |||
| 127 | config_option_list: | ||
| 128 | /* empty */ | ||
| 129 | | config_option_list config_option T_EOL | ||
| 130 | | config_option_list depends T_EOL | ||
| 131 | | config_option_list help | ||
| 132 | | config_option_list T_EOL | ||
| 133 | { }; | ||
| 134 | |||
| 135 | config_option: T_TRISTATE prompt_stmt_opt | ||
| 136 | { | ||
| 137 | menu_set_type(S_TRISTATE); | ||
| 138 | printd(DEBUG_PARSE, "%s:%d:tristate\n", zconf_curname(), zconf_lineno()); | ||
| 139 | }; | ||
| 140 | |||
| 141 | config_option: T_BOOLEAN prompt_stmt_opt | ||
| 142 | { | ||
| 143 | menu_set_type(S_BOOLEAN); | ||
| 144 | printd(DEBUG_PARSE, "%s:%d:boolean\n", zconf_curname(), zconf_lineno()); | ||
| 145 | }; | ||
| 146 | |||
| 147 | config_option: T_INT prompt_stmt_opt | ||
| 148 | { | ||
| 149 | menu_set_type(S_INT); | ||
| 150 | printd(DEBUG_PARSE, "%s:%d:int\n", zconf_curname(), zconf_lineno()); | ||
| 151 | }; | ||
| 152 | |||
| 153 | config_option: T_HEX prompt_stmt_opt | ||
| 154 | { | ||
| 155 | menu_set_type(S_HEX); | ||
| 156 | printd(DEBUG_PARSE, "%s:%d:hex\n", zconf_curname(), zconf_lineno()); | ||
| 157 | }; | ||
| 158 | |||
| 159 | config_option: T_STRING prompt_stmt_opt | ||
| 160 | { | ||
| 161 | menu_set_type(S_STRING); | ||
| 162 | printd(DEBUG_PARSE, "%s:%d:string\n", zconf_curname(), zconf_lineno()); | ||
| 163 | }; | ||
| 164 | |||
| 165 | config_option: T_PROMPT prompt if_expr | ||
| 166 | { | ||
| 167 | menu_add_prop(P_PROMPT, $2, NULL, $3); | ||
| 168 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); | ||
| 169 | }; | ||
| 170 | |||
| 171 | config_option: T_DEFAULT symbol if_expr | ||
| 172 | { | ||
| 173 | menu_add_prop(P_DEFAULT, NULL, $2, $3); | ||
| 174 | printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); | ||
| 175 | }; | ||
| 176 | |||
| 177 | /* choice entry */ | ||
| 178 | |||
| 179 | choice: T_CHOICE | ||
| 180 | { | ||
| 181 | struct symbol *sym = sym_lookup(NULL, 0); | ||
| 182 | sym->flags |= SYMBOL_CHOICE; | ||
| 183 | menu_add_entry(sym); | ||
| 184 | menu_add_prop(P_CHOICE, NULL, NULL, NULL); | ||
| 185 | printd(DEBUG_PARSE, "%s:%d:choice\n", zconf_curname(), zconf_lineno()); | ||
| 186 | }; | ||
| 187 | |||
| 188 | choice_entry: choice T_EOL choice_option_list | ||
| 189 | { | ||
| 190 | menu_end_entry(); | ||
| 191 | menu_add_menu(); | ||
| 192 | }; | ||
| 193 | |||
| 194 | choice_end: end | ||
| 195 | { | ||
| 196 | if (zconf_endtoken($1, T_CHOICE, T_ENDCHOICE)) { | ||
| 197 | menu_end_menu(); | ||
| 198 | printd(DEBUG_PARSE, "%s:%d:endchoice\n", zconf_curname(), zconf_lineno()); | ||
| 199 | } | ||
| 200 | }; | ||
| 201 | |||
| 202 | choice_stmt: | ||
| 203 | choice_entry choice_block choice_end T_EOL | ||
| 204 | | choice_entry choice_block | ||
| 205 | { | ||
| 206 | printf("%s:%d: missing 'endchoice' for this 'choice' statement\n", current_menu->file->name, current_menu->lineno); | ||
| 207 | zconfnerrs++; | ||
| 208 | }; | ||
| 209 | |||
| 210 | choice_option_list: | ||
| 211 | /* empty */ | ||
| 212 | | choice_option_list choice_option T_EOL | ||
| 213 | | choice_option_list depends T_EOL | ||
| 214 | | choice_option_list help | ||
| 215 | | choice_option_list T_EOL | ||
| 216 | ; | ||
| 217 | |||
| 218 | choice_option: T_PROMPT prompt if_expr | ||
| 219 | { | ||
| 220 | menu_add_prop(P_PROMPT, $2, NULL, $3); | ||
| 221 | printd(DEBUG_PARSE, "%s:%d:prompt\n", zconf_curname(), zconf_lineno()); | ||
| 222 | }; | ||
| 223 | |||
| 224 | choice_option: T_OPTIONAL | ||
| 225 | { | ||
| 226 | current_entry->sym->flags |= SYMBOL_OPTIONAL; | ||
| 227 | printd(DEBUG_PARSE, "%s:%d:optional\n", zconf_curname(), zconf_lineno()); | ||
| 228 | }; | ||
| 229 | |||
| 230 | choice_option: T_DEFAULT symbol | ||
| 231 | { | ||
| 232 | menu_add_prop(P_DEFAULT, NULL, $2, NULL); | ||
| 233 | //current_choice->prop->def = $2; | ||
| 234 | printd(DEBUG_PARSE, "%s:%d:default\n", zconf_curname(), zconf_lineno()); | ||
| 235 | }; | ||
| 236 | |||
| 237 | choice_block: | ||
| 238 | /* empty */ | ||
| 239 | | choice_block common_block | ||
| 240 | ; | ||
| 241 | |||
| 242 | /* if entry */ | ||
| 243 | |||
| 244 | if: T_IF expr | ||
| 245 | { | ||
| 246 | printd(DEBUG_PARSE, "%s:%d:if\n", zconf_curname(), zconf_lineno()); | ||
| 247 | menu_add_entry(NULL); | ||
| 248 | //current_entry->prompt = menu_add_prop(T_IF, NULL, NULL, $2); | ||
| 249 | menu_add_dep($2); | ||
| 250 | menu_end_entry(); | ||
| 251 | menu_add_menu(); | ||
| 252 | }; | ||
| 253 | |||
| 254 | if_end: end | ||
| 255 | { | ||
| 256 | if (zconf_endtoken($1, T_IF, T_ENDIF)) { | ||
| 257 | menu_end_menu(); | ||
| 258 | printd(DEBUG_PARSE, "%s:%d:endif\n", zconf_curname(), zconf_lineno()); | ||
| 259 | } | ||
| 260 | }; | ||
| 261 | |||
| 262 | if_stmt: | ||
| 263 | if T_EOL if_block if_end T_EOL | ||
| 264 | | if T_EOL if_block | ||
| 265 | { | ||
| 266 | printf("%s:%d: missing 'endif' for this 'if' statement\n", current_menu->file->name, current_menu->lineno); | ||
| 267 | zconfnerrs++; | ||
| 268 | }; | ||
| 269 | |||
| 270 | if_block: | ||
| 271 | /* empty */ | ||
| 272 | | if_block common_block | ||
| 273 | | if_block menu_stmt | ||
| 274 | | if_block choice_stmt | ||
| 275 | ; | ||
| 276 | |||
| 277 | /* menu entry */ | ||
| 278 | |||
| 279 | menu: T_MENU prompt | ||
| 280 | { | ||
| 281 | menu_add_entry(NULL); | ||
| 282 | menu_add_prop(P_MENU, $2, NULL, NULL); | ||
| 283 | printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); | ||
| 284 | }; | ||
| 285 | |||
| 286 | menu_entry: menu T_EOL depends_list | ||
| 287 | { | ||
| 288 | menu_end_entry(); | ||
| 289 | menu_add_menu(); | ||
| 290 | }; | ||
| 291 | |||
| 292 | menu_end: end | ||
| 293 | { | ||
| 294 | if (zconf_endtoken($1, T_MENU, T_ENDMENU)) { | ||
| 295 | menu_end_menu(); | ||
| 296 | printd(DEBUG_PARSE, "%s:%d:endmenu\n", zconf_curname(), zconf_lineno()); | ||
| 297 | } | ||
| 298 | }; | ||
| 299 | |||
| 300 | menu_stmt: | ||
| 301 | menu_entry menu_block menu_end T_EOL | ||
| 302 | | menu_entry menu_block | ||
| 303 | { | ||
| 304 | printf("%s:%d: missing 'endmenu' for this 'menu' statement\n", current_menu->file->name, current_menu->lineno); | ||
| 305 | zconfnerrs++; | ||
| 306 | }; | ||
| 307 | |||
| 308 | menu_block: | ||
| 309 | /* empty */ | ||
| 310 | | menu_block common_block | ||
| 311 | | menu_block menu_stmt | ||
| 312 | | menu_block choice_stmt | ||
| 313 | | menu_block error T_EOL { zconfprint("invalid menu option"); yyerrok; } | ||
| 314 | ; | ||
| 315 | |||
| 316 | source: T_SOURCE prompt | ||
| 317 | { | ||
| 318 | $$ = $2; | ||
| 319 | printd(DEBUG_PARSE, "%s:%d:source %s\n", zconf_curname(), zconf_lineno(), $2); | ||
| 320 | }; | ||
| 321 | |||
| 322 | source_stmt: source T_EOL | ||
| 323 | { | ||
| 324 | zconf_nextfile($1); | ||
| 325 | }; | ||
| 326 | |||
| 327 | /* comment entry */ | ||
| 328 | |||
| 329 | comment: T_COMMENT prompt | ||
| 330 | { | ||
| 331 | menu_add_entry(NULL); | ||
| 332 | menu_add_prop(P_COMMENT, $2, NULL, NULL); | ||
| 333 | printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); | ||
| 334 | }; | ||
| 335 | |||
| 336 | comment_stmt: comment T_EOL depends_list | ||
| 337 | { | ||
| 338 | menu_end_entry(); | ||
| 339 | }; | ||
| 340 | |||
| 341 | /* help option */ | ||
| 342 | |||
| 343 | help_start: T_HELP T_EOL | ||
| 344 | { | ||
| 345 | printd(DEBUG_PARSE, "%s:%d:help\n", zconf_curname(), zconf_lineno()); | ||
| 346 | zconf_starthelp(); | ||
| 347 | }; | ||
| 348 | |||
| 349 | help: help_start T_HELPTEXT | ||
| 350 | { | ||
| 351 | current_entry->sym->help = $2; | ||
| 352 | }; | ||
| 353 | |||
| 354 | /* depends option */ | ||
| 355 | |||
| 356 | depends_list: /* empty */ | ||
| 357 | | depends_list depends T_EOL | ||
| 358 | | depends_list T_EOL | ||
| 359 | { }; | ||
| 360 | |||
| 361 | depends: T_DEPENDS T_ON expr | ||
| 362 | { | ||
| 363 | menu_add_dep($3); | ||
| 364 | printd(DEBUG_PARSE, "%s:%d:depends on\n", zconf_curname(), zconf_lineno()); | ||
| 365 | } | ||
| 366 | | T_DEPENDS expr | ||
| 367 | { | ||
| 368 | menu_add_dep($2); | ||
| 369 | printd(DEBUG_PARSE, "%s:%d:depends\n", zconf_curname(), zconf_lineno()); | ||
| 370 | } | ||
| 371 | | T_REQUIRES expr | ||
| 372 | { | ||
| 373 | menu_add_dep($2); | ||
| 374 | printd(DEBUG_PARSE, "%s:%d:requires\n", zconf_curname(), zconf_lineno()); | ||
| 375 | }; | ||
| 376 | |||
| 377 | /* prompt statement */ | ||
| 378 | |||
| 379 | prompt_stmt_opt: | ||
| 380 | /* empty */ | ||
| 381 | | prompt | ||
| 382 | { | ||
| 383 | menu_add_prop(P_PROMPT, $1, NULL, NULL); | ||
| 384 | } | ||
| 385 | | prompt T_IF expr | ||
| 386 | { | ||
| 387 | menu_add_prop(P_PROMPT, $1, NULL, $3); | ||
| 388 | }; | ||
| 389 | |||
| 390 | prompt: T_WORD | ||
| 391 | | T_STRING | ||
| 392 | ; | ||
| 393 | |||
| 394 | end: T_ENDMENU { $$ = T_ENDMENU; } | ||
| 395 | | T_ENDCHOICE { $$ = T_ENDCHOICE; } | ||
| 396 | | T_ENDIF { $$ = T_ENDIF; } | ||
| 397 | ; | ||
| 398 | |||
| 399 | nl_or_eof: | ||
| 400 | T_EOL | T_EOF; | ||
| 401 | |||
| 402 | if_expr: /* empty */ { $$ = NULL; } | ||
| 403 | | T_IF expr { $$ = $2; } | ||
| 404 | ; | ||
| 405 | |||
| 406 | expr: symbol { $$ = expr_alloc_symbol($1); } | ||
| 407 | | symbol T_EQUAL symbol { $$ = expr_alloc_comp(E_EQUAL, $1, $3); } | ||
| 408 | | symbol T_UNEQUAL symbol { $$ = expr_alloc_comp(E_UNEQUAL, $1, $3); } | ||
| 409 | | T_OPEN_PAREN expr T_CLOSE_PAREN { $$ = $2; } | ||
| 410 | | T_NOT expr { $$ = expr_alloc_one(E_NOT, $2); } | ||
| 411 | | expr T_OR expr { $$ = expr_alloc_two(E_OR, $1, $3); } | ||
| 412 | | expr T_AND expr { $$ = expr_alloc_two(E_AND, $1, $3); } | ||
| 413 | ; | ||
| 414 | |||
| 415 | symbol: T_WORD { $$ = sym_lookup($1, 0); free($1); } | ||
| 416 | | T_STRING { $$ = sym_lookup($1, 1); free($1); } | ||
| 417 | ; | ||
| 418 | |||
| 419 | %% | ||
| 420 | |||
| 421 | void conf_parse(const char *name) | ||
| 422 | { | ||
| 423 | zconf_initscan(name); | ||
| 424 | |||
| 425 | sym_init(); | ||
| 426 | menu_init(); | ||
| 427 | rootmenu.prompt = menu_add_prop(P_MENU, "BusyBox Configuration", NULL, NULL); | ||
| 428 | |||
| 429 | //zconfdebug = 1; | ||
| 430 | zconfparse(); | ||
| 431 | if (zconfnerrs) | ||
| 432 | exit(1); | ||
| 433 | menu_finalize(&rootmenu); | ||
| 434 | |||
| 435 | modules_sym = sym_lookup("MODULES", 0); | ||
| 436 | |||
| 437 | sym_change_count = 1; | ||
| 438 | } | ||
| 439 | |||
| 440 | const char *zconf_tokenname(int token) | ||
| 441 | { | ||
| 442 | switch (token) { | ||
| 443 | case T_MENU: return "menu"; | ||
| 444 | case T_ENDMENU: return "endmenu"; | ||
| 445 | case T_CHOICE: return "choice"; | ||
| 446 | case T_ENDCHOICE: return "endchoice"; | ||
| 447 | case T_IF: return "if"; | ||
| 448 | case T_ENDIF: return "endif"; | ||
| 449 | } | ||
| 450 | return "<token>"; | ||
| 451 | } | ||
| 452 | |||
| 453 | static bool zconf_endtoken(int token, int starttoken, int endtoken) | ||
| 454 | { | ||
| 455 | if (token != endtoken) { | ||
| 456 | zconfprint("unexpected '%s' within %s block", zconf_tokenname(token), zconf_tokenname(starttoken)); | ||
| 457 | zconfnerrs++; | ||
| 458 | return false; | ||
| 459 | } | ||
| 460 | if (current_menu->file != current_file) { | ||
| 461 | zconfprint("'%s' in different file than '%s'", zconf_tokenname(token), zconf_tokenname(starttoken)); | ||
| 462 | zconfprint("location of the '%s'", zconf_tokenname(starttoken)); | ||
| 463 | zconfnerrs++; | ||
| 464 | return false; | ||
| 465 | } | ||
| 466 | return true; | ||
| 467 | } | ||
| 468 | |||
| 469 | static void zconfprint(const char *err, ...) | ||
| 470 | { | ||
| 471 | va_list ap; | ||
| 472 | |||
| 473 | fprintf(stderr, "%s:%d: ", zconf_curname(), zconf_lineno()); | ||
| 474 | va_start(ap, err); | ||
| 475 | vfprintf(stderr, err, ap); | ||
| 476 | va_end(ap); | ||
| 477 | fprintf(stderr, "\n"); | ||
| 478 | } | ||
| 479 | |||
| 480 | static void zconferror(const char *err) | ||
| 481 | { | ||
| 482 | fprintf(stderr, "%s:%d: %s\n", zconf_curname(), zconf_lineno(), err); | ||
| 483 | } | ||
| 484 | |||
| 485 | void print_quoted_string(FILE *out, const char *str) | ||
| 486 | { | ||
| 487 | const char *p; | ||
| 488 | int len; | ||
| 489 | |||
| 490 | putc('"', out); | ||
| 491 | while ((p = strchr(str, '"'))) { | ||
| 492 | len = p - str; | ||
| 493 | if (len) | ||
| 494 | fprintf(out, "%.*s", len, str); | ||
| 495 | fputs("\\\"", out); | ||
| 496 | str = p + 1; | ||
| 497 | } | ||
| 498 | fputs(str, out); | ||
| 499 | putc('"', out); | ||
| 500 | } | ||
| 501 | |||
| 502 | void print_symbol(FILE *out, struct menu *menu) | ||
| 503 | { | ||
| 504 | struct symbol *sym = menu->sym; | ||
| 505 | struct property *prop; | ||
| 506 | |||
| 507 | //sym->flags |= SYMBOL_PRINTED; | ||
| 508 | |||
| 509 | if (sym_is_choice(sym)) | ||
| 510 | fprintf(out, "choice\n"); | ||
| 511 | else | ||
| 512 | fprintf(out, "config %s\n", sym->name); | ||
| 513 | switch (sym->type) { | ||
| 514 | case S_BOOLEAN: | ||
| 515 | fputs(" boolean\n", out); | ||
| 516 | break; | ||
| 517 | case S_TRISTATE: | ||
| 518 | fputs(" tristate\n", out); | ||
| 519 | break; | ||
| 520 | case S_STRING: | ||
| 521 | fputs(" string\n", out); | ||
| 522 | break; | ||
| 523 | case S_INT: | ||
| 524 | fputs(" integer\n", out); | ||
| 525 | break; | ||
| 526 | case S_HEX: | ||
| 527 | fputs(" hex\n", out); | ||
| 528 | break; | ||
| 529 | default: | ||
| 530 | fputs(" ???\n", out); | ||
| 531 | break; | ||
| 532 | } | ||
| 533 | #if 0 | ||
| 534 | if (!expr_is_yes(sym->dep)) { | ||
| 535 | fputs(" depends ", out); | ||
| 536 | expr_fprint(sym->dep, out); | ||
| 537 | fputc('\n', out); | ||
| 538 | } | ||
| 539 | #endif | ||
| 540 | for (prop = sym->prop; prop; prop = prop->next) { | ||
| 541 | if (prop->menu != menu) | ||
| 542 | continue; | ||
| 543 | switch (prop->type) { | ||
| 544 | case P_PROMPT: | ||
| 545 | fputs(" prompt ", out); | ||
| 546 | print_quoted_string(out, prop->text); | ||
| 547 | if (prop->def) { | ||
| 548 | fputc(' ', out); | ||
| 549 | if (prop->def->flags & SYMBOL_CONST) | ||
| 550 | print_quoted_string(out, prop->def->name); | ||
| 551 | else | ||
| 552 | fputs(prop->def->name, out); | ||
| 553 | } | ||
| 554 | if (!expr_is_yes(E_EXPR(prop->visible))) { | ||
| 555 | fputs(" if ", out); | ||
| 556 | expr_fprint(E_EXPR(prop->visible), out); | ||
| 557 | } | ||
| 558 | fputc('\n', out); | ||
| 559 | break; | ||
| 560 | case P_DEFAULT: | ||
| 561 | fputs( " default ", out); | ||
| 562 | print_quoted_string(out, prop->def->name); | ||
| 563 | if (!expr_is_yes(E_EXPR(prop->visible))) { | ||
| 564 | fputs(" if ", out); | ||
| 565 | expr_fprint(E_EXPR(prop->visible), out); | ||
| 566 | } | ||
| 567 | fputc('\n', out); | ||
| 568 | break; | ||
| 569 | case P_CHOICE: | ||
| 570 | fputs(" #choice value\n", out); | ||
| 571 | break; | ||
| 572 | default: | ||
| 573 | fprintf(out, " unknown prop %d!\n", prop->type); | ||
| 574 | break; | ||
| 575 | } | ||
| 576 | } | ||
| 577 | if (sym->help) { | ||
| 578 | int len = strlen(sym->help); | ||
| 579 | while (sym->help[--len] == '\n') | ||
| 580 | sym->help[len] = 0; | ||
| 581 | fprintf(out, " help\n%s\n", sym->help); | ||
| 582 | } | ||
| 583 | fputc('\n', out); | ||
| 584 | } | ||
| 585 | |||
| 586 | void zconfdump(FILE *out) | ||
| 587 | { | ||
| 588 | //struct file *file; | ||
| 589 | struct property *prop; | ||
| 590 | struct symbol *sym; | ||
| 591 | struct menu *menu; | ||
| 592 | |||
| 593 | menu = rootmenu.list; | ||
| 594 | while (menu) { | ||
| 595 | if ((sym = menu->sym)) | ||
| 596 | print_symbol(out, menu); | ||
| 597 | else if ((prop = menu->prompt)) { | ||
| 598 | switch (prop->type) { | ||
| 599 | //case T_MAINMENU: | ||
| 600 | // fputs("\nmainmenu ", out); | ||
| 601 | // print_quoted_string(out, prop->text); | ||
| 602 | // fputs("\n", out); | ||
| 603 | // break; | ||
| 604 | case P_COMMENT: | ||
| 605 | fputs("\ncomment ", out); | ||
| 606 | print_quoted_string(out, prop->text); | ||
| 607 | fputs("\n", out); | ||
| 608 | break; | ||
| 609 | case P_MENU: | ||
| 610 | fputs("\nmenu ", out); | ||
| 611 | print_quoted_string(out, prop->text); | ||
| 612 | fputs("\n", out); | ||
| 613 | break; | ||
| 614 | //case T_SOURCE: | ||
| 615 | // fputs("\nsource ", out); | ||
| 616 | // print_quoted_string(out, prop->text); | ||
| 617 | // fputs("\n", out); | ||
| 618 | // break; | ||
| 619 | //case T_IF: | ||
| 620 | // fputs("\nif\n", out); | ||
| 621 | default: | ||
| 622 | ; | ||
| 623 | } | ||
| 624 | if (!expr_is_yes(E_EXPR(prop->visible))) { | ||
| 625 | fputs(" depends ", out); | ||
| 626 | expr_fprint(E_EXPR(prop->visible), out); | ||
| 627 | fputc('\n', out); | ||
| 628 | } | ||
| 629 | fputs("\n", out); | ||
| 630 | } | ||
| 631 | |||
| 632 | if (menu->list) | ||
| 633 | menu = menu->list; | ||
| 634 | else if (menu->next) | ||
| 635 | menu = menu->next; | ||
| 636 | else while ((menu = menu->parent)) { | ||
| 637 | if (menu->prompt && menu->prompt->type == P_MENU) | ||
| 638 | fputs("\nendmenu\n", out); | ||
| 639 | if (menu->next) { | ||
| 640 | menu = menu->next; | ||
| 641 | break; | ||
| 642 | } | ||
| 643 | } | ||
| 644 | } | ||
| 645 | } | ||
| 646 | |||
| 647 | #include "lex.zconf.c" | ||
| 648 | #include "confdata.c" | ||
| 649 | #include "expr.c" | ||
| 650 | #include "symbol.c" | ||
| 651 | #include "menu.c" | ||
diff --git a/scripts/lxdialog/.cvsignore b/scripts/lxdialog/.cvsignore deleted file mode 100644 index bebf29560..000000000 --- a/scripts/lxdialog/.cvsignore +++ /dev/null | |||
| @@ -1 +0,0 @@ | |||
| 1 | lxdialog | ||
diff --git a/scripts/lxdialog/BIG.FAT.WARNING b/scripts/lxdialog/BIG.FAT.WARNING deleted file mode 100644 index a8999d82b..000000000 --- a/scripts/lxdialog/BIG.FAT.WARNING +++ /dev/null | |||
| @@ -1,4 +0,0 @@ | |||
| 1 | This is NOT the official version of dialog. This version has been | ||
| 2 | significantly modified from the original. It is for use by the Linux | ||
| 3 | kernel configuration script. Please do not bother Savio Lam with | ||
| 4 | questions about this program. | ||
diff --git a/scripts/lxdialog/Makefile b/scripts/lxdialog/Makefile deleted file mode 100644 index c29b58d7b..000000000 --- a/scripts/lxdialog/Makefile +++ /dev/null | |||
| @@ -1,48 +0,0 @@ | |||
| 1 | HOSTCFLAGS += -DLOCALE | ||
| 2 | LIBS = -lncurses | ||
| 3 | |||
| 4 | ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h)) | ||
| 5 | HOSTCFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>" | ||
| 6 | else | ||
| 7 | ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h)) | ||
| 8 | HOSTCFLAGS += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>" | ||
| 9 | else | ||
| 10 | ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h)) | ||
| 11 | HOSTCFLAGS += -DCURSES_LOC="<ncurses.h>" | ||
| 12 | else | ||
| 13 | HOSTCFLAGS += -DCURSES_LOC="<curses.h>" | ||
| 14 | endif | ||
| 15 | endif | ||
| 16 | endif | ||
| 17 | |||
| 18 | |||
| 19 | OBJS = checklist.o menubox.o textbox.o yesno.o inputbox.o \ | ||
| 20 | util.o lxdialog.o msgbox.o | ||
| 21 | |||
| 22 | %.o: %.c | ||
| 23 | $(HOSTCC) $(HOSTCFLAGS) -c -o $@ $< | ||
| 24 | |||
| 25 | all: ncurses lxdialog | ||
| 26 | |||
| 27 | lxdialog: $(OBJS) | ||
| 28 | $(HOSTCC) -o lxdialog $(OBJS) $(LIBS) | ||
| 29 | |||
| 30 | .PHONY: ncurses | ||
| 31 | |||
| 32 | ncurses: | ||
| 33 | @echo "main() {}" > lxtemp.c | ||
| 34 | @if $(HOSTCC) lxtemp.c $(LIBS) ; then \ | ||
| 35 | rm -f lxtemp.c a.out; \ | ||
| 36 | else \ | ||
| 37 | rm -f lxtemp.c; \ | ||
| 38 | echo -e "\007" ;\ | ||
| 39 | echo ">> Unable to find the Ncurses libraries." ;\ | ||
| 40 | echo ">>" ;\ | ||
| 41 | echo ">> You must have Ncurses installed in order" ;\ | ||
| 42 | echo ">> to use 'make menuconfig'" ;\ | ||
| 43 | echo ;\ | ||
| 44 | exit 1 ;\ | ||
| 45 | fi | ||
| 46 | |||
| 47 | clean: | ||
| 48 | rm -f core *.o *~ lxdialog | ||
diff --git a/scripts/lxdialog/Makefile-2.5 b/scripts/lxdialog/Makefile-2.5 deleted file mode 100644 index 665205200..000000000 --- a/scripts/lxdialog/Makefile-2.5 +++ /dev/null | |||
| @@ -1,71 +0,0 @@ | |||
| 1 | lxdialog-hostcflags += -DLOCALE | ||
| 2 | lxdialog-libs = -lncurses | ||
| 3 | |||
| 4 | ifeq (/usr/include/ncurses/ncurses.h, $(wildcard /usr/include/ncurses/ncurses.h)) | ||
| 5 | lxdialog-hostcflags += -I/usr/include/ncurses -DCURSES_LOC="<ncurses.h>" | ||
| 6 | else | ||
| 7 | ifeq (/usr/include/ncurses/curses.h, $(wildcard /usr/include/ncurses/curses.h)) | ||
| 8 | lxdialog-hostcflags += -I/usr/include/ncurses -DCURSES_LOC="<ncurses/curses.h>" | ||
| 9 | else | ||
| 10 | ifeq (/usr/include/ncurses.h, $(wildcard /usr/include/ncurses.h)) | ||
| 11 | lxdialog-hostcflags += -DCURSES_LOC="<ncurses.h>" | ||
| 12 | else | ||
| 13 | lxdialog-hostcflags += -DCURSES_LOC="<curses.h>" | ||
| 14 | endif | ||
| 15 | endif | ||
| 16 | endif | ||
| 17 | |||
| 18 | $(tmp_config)lxdialog-ncurses: | ||
| 19 | @mkdir -p $(lxdialog-objtree) | ||
| 20 | @( \ | ||
| 21 | cd $(lxdialog-objtree) && \ | ||
| 22 | echo "main() {}" > lxtemp.c && \ | ||
| 23 | if $(HOSTCC) -lncurses lxtemp.c ; then \ | ||
| 24 | rm -f lxtemp.c a.out && \ | ||
| 25 | mkdir -p $(@D) && \ | ||
| 26 | touch $@; \ | ||
| 27 | else \ | ||
| 28 | rm -f lxtemp.c; \ | ||
| 29 | echo -e "\007" ;\ | ||
| 30 | echo ">> Unable to find the Ncurses libraries." ;\ | ||
| 31 | echo ">>" ;\ | ||
| 32 | echo ">> You must have Ncurses installed in order" ;\ | ||
| 33 | echo ">> to use 'make menuconfig'" ;\ | ||
| 34 | echo ;\ | ||
| 35 | exit 1 ;\ | ||
| 36 | fi ; \ | ||
| 37 | ) | ||
| 38 | |||
| 39 | lxdialog-objs := $(lxdialog-objtree)checklist.o $(lxdialog-objtree)menubox.o \ | ||
| 40 | $(lxdialog-objtree)textbox.o $(lxdialog-objtree)yesno.o \ | ||
| 41 | $(lxdialog-objtree)inputbox.o $(lxdialog-objtree)util.o \ | ||
| 42 | $(lxdialog-objtree)lxdialog.o $(lxdialog-objtree)msgbox.o | ||
| 43 | |||
| 44 | $(lxdialog-objtree)checklist.o: $(lxdialog-srctree)checklist.c $(tmp_config)lxdialog-ncurses | ||
| 45 | $(HOSTCC) $(HOSTCFLAGS) $(lxdialog-hostcflags) -c -o $@ $< | ||
| 46 | |||
| 47 | $(lxdialog-objtree)menubox.o: $(lxdialog-srctree)menubox.c $(tmp_config)lxdialog-ncurses | ||
| 48 | $(HOSTCC) $(HOSTCFLAGS) $(lxdialog-hostcflags) -c -o $@ $< | ||
| 49 | |||
| 50 | $(lxdialog-objtree)textbox.o: $(lxdialog-srctree)textbox.c $(tmp_config)lxdialog-ncurses | ||
| 51 | $(HOSTCC) $(HOSTCFLAGS) $(lxdialog-hostcflags) -c -o $@ $< | ||
| 52 | |||
| 53 | $(lxdialog-objtree)yesno.o: $(lxdialog-srctree)yesno.c $(tmp_config)lxdialog-ncurses | ||
| 54 | $(HOSTCC) $(HOSTCFLAGS) $(lxdialog-hostcflags) -c -o $@ $< | ||
| 55 | |||
| 56 | $(lxdialog-objtree)inputbox.o: $(lxdialog-srctree)inputbox.c $(tmp_config)lxdialog-ncurses | ||
| 57 | $(HOSTCC) $(HOSTCFLAGS) $(lxdialog-hostcflags) -c -o $@ $< | ||
| 58 | |||
| 59 | $(lxdialog-objtree)util.o: $(lxdialog-srctree)util.c $(tmp_config)lxdialog-ncurses | ||
| 60 | $(HOSTCC) $(HOSTCFLAGS) $(lxdialog-hostcflags) -c -o $@ $< | ||
| 61 | |||
| 62 | $(lxdialog-objtree)lxdialog.o: $(lxdialog-srctree)lxdialog.c $(tmp_config)lxdialog-ncurses | ||
| 63 | $(HOSTCC) $(HOSTCFLAGS) $(lxdialog-hostcflags) -c -o $@ $< | ||
| 64 | |||
| 65 | $(lxdialog-objtree)msgbox.o: $(lxdialog-srctree)msgbox.c $(tmp_config)lxdialog-ncurses | ||
| 66 | $(HOSTCC) $(HOSTCFLAGS) $(lxdialog-hostcflags) -c -o $@ $< | ||
| 67 | |||
| 68 | $(lxdialog-objtree)lxdialog: $(lxdialog-objs) | ||
| 69 | $(HOSTCC) -o $@ $(lxdialog-objs) $(lxdialog-libs) | ||
| 70 | |||
| 71 | MRPROPER += $(lxdialog-objtree)lxdialog | ||
diff --git a/scripts/lxdialog/lxdialog.c b/scripts/lxdialog/lxdialog.c deleted file mode 100644 index 6f4c1fd4e..000000000 --- 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, clear_screen = 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 (clear_screen) { /* 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 | clear_screen = 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 (clear_screen) { /* 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 | |||
