aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Noll <nbnoll@eml.cc>2021-10-13 10:51:54 -0700
committerNicholas Noll <nbnoll@eml.cc>2021-10-13 10:51:54 -0700
commitf2efbb46ef89c7c1693400f7209113c50c959f02 (patch)
tree1c44494a9260dc270aac0a5291a7952ab0e74514
parent0385c87c8434873bdb8b86d35700cdd61286b749 (diff)
Feat(rc): working(ish) version of rc shell
Removed compile commands
-rw-r--r--compile_commands.json1668
-rw-r--r--sys/cmd/rc/code.c40
-rw-r--r--sys/cmd/rc/exec.c137
-rw-r--r--sys/cmd/rc/exec.h53
-rw-r--r--sys/cmd/rc/fns.h76
-rw-r--r--sys/cmd/rc/glob.c15
-rw-r--r--sys/cmd/rc/havefork.c14
-rw-r--r--sys/cmd/rc/here.c25
-rw-r--r--sys/cmd/rc/io.c48
-rw-r--r--sys/cmd/rc/io.h51
-rw-r--r--sys/cmd/rc/lex.c3
-rw-r--r--sys/cmd/rc/pcmd.c4
-rw-r--r--sys/cmd/rc/pfnc.c4
-rw-r--r--sys/cmd/rc/prompt.c6
-rw-r--r--sys/cmd/rc/rc.h92
-rw-r--r--sys/cmd/rc/rules.mk2
-rw-r--r--sys/cmd/rc/simple.c67
-rw-r--r--sys/cmd/rc/subr.c2
-rw-r--r--sys/cmd/rc/syn.y6
-rw-r--r--sys/cmd/rc/trap.c8
-rw-r--r--sys/cmd/rc/tree.c58
-rw-r--r--sys/cmd/rc/unix.c22
-rw-r--r--sys/cmd/rc/unix.h2
-rw-r--r--sys/cmd/rc/var.c37
-rw-r--r--sys/cmd/rc/x.tab.h2
-rw-r--r--sys/cmd/rc/y.tab.c2081
-rw-r--r--sys/cmd/rc/y.tab.h133
27 files changed, 1402 insertions, 3254 deletions
diff --git a/compile_commands.json b/compile_commands.json
deleted file mode 100644
index e77bb17..0000000
--- a/compile_commands.json
+++ /dev/null
@@ -1,1668 +0,0 @@
-[
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libn/error.o",
- "-c",
- "sys/libn/error.c"
- ],
- "file": "sys/libn/error.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libn/bufio.o",
- "-c",
- "sys/libn/bufio.c"
- ],
- "file": "sys/libn/bufio.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libn/coro.o",
- "-c",
- "sys/libn/coro.c"
- ],
- "file": "sys/libn/coro.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libn/arg.o",
- "-c",
- "sys/libn/arg.c"
- ],
- "file": "sys/libn/arg.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libn/flate.o",
- "-c",
- "sys/libn/flate.c"
- ],
- "file": "sys/libn/flate.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libn/gz.o",
- "-c",
- "sys/libn/gz.c"
- ],
- "file": "sys/libn/gz.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libn/fs.o",
- "-c",
- "sys/libn/fs.c"
- ],
- "file": "sys/libn/fs.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libn/io.o",
- "-c",
- "sys/libn/io.c"
- ],
- "file": "sys/libn/io.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libn/os.o",
- "-c",
- "sys/libn/os.c"
- ],
- "file": "sys/libn/os.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libn/memory.o",
- "-c",
- "sys/libn/memory.c"
- ],
- "file": "sys/libn/memory.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libn/mmap.o",
- "-c",
- "sys/libn/mmap.c"
- ],
- "file": "sys/libn/mmap.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libn/random.o",
- "-c",
- "sys/libn/random.c"
- ],
- "file": "sys/libn/random.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libn/string.o",
- "-c",
- "sys/libn/string.c"
- ],
- "file": "sys/libn/string.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libn/sort.o",
- "-c",
- "sys/libn/sort.c"
- ],
- "file": "sys/libn/sort.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libmath/basic.o",
- "-c",
- "sys/libmath/basic.c"
- ],
- "file": "sys/libmath/basic.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libmath/blas1.o",
- "-c",
- "sys/libmath/blas1.c"
- ],
- "file": "sys/libmath/blas1.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libmath/blas2.o",
- "-c",
- "sys/libmath/blas2.c"
- ],
- "file": "sys/libmath/blas2.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libmath/blas3.o",
- "-c",
- "sys/libmath/blas3.c"
- ],
- "file": "sys/libmath/blas3.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libbio/fasta.o",
- "-c",
- "sys/libbio/fasta.c"
- ],
- "file": "sys/libbio/fasta.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libbio/newick.o",
- "-c",
- "sys/libbio/newick.c"
- ],
- "file": "sys/libbio/newick.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libbio/phylo.o",
- "-c",
- "sys/libbio/phylo.c"
- ],
- "file": "sys/libbio/phylo.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-I",
- "include",
- "-o",
- ".build/sys/cmd/dwm/drw.o",
- "-c",
- "sys/cmd/dwm/drw.c"
- ],
- "file": "sys/cmd/dwm/drw.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-I",
- "include",
- "-o",
- ".build/sys/cmd/dwm/hook.o",
- "-c",
- "sys/cmd/dwm/hook.c"
- ],
- "file": "sys/cmd/dwm/hook.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-I",
- "include",
- "-o",
- ".build/sys/cmd/dwm/client.o",
- "-c",
- "sys/cmd/dwm/client.c"
- ],
- "file": "sys/cmd/dwm/client.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-I",
- "include",
- "-o",
- ".build/sys/cmd/dwm/util.o",
- "-c",
- "sys/cmd/dwm/util.c"
- ],
- "file": "sys/cmd/dwm/util.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-I",
- "include",
- "-o",
- ".build/sys/cmd/dwm/dwm.o",
- "-c",
- "sys/cmd/dwm/dwm.c"
- ],
- "file": "sys/cmd/dwm/dwm.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/cmd/filter/filter.o",
- "-c",
- "sys/cmd/filter/filter.c"
- ],
- "file": "sys/cmd/filter/filter.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-o",
- ".build/sys/cmd/menu/menu.o",
- "-c",
- "sys/cmd/menu/menu.c"
- ],
- "file": "sys/cmd/menu/menu.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-o",
- ".build/sys/cmd/menu/drw.o",
- "-c",
- "sys/cmd/menu/drw.c"
- ],
- "file": "sys/cmd/menu/drw.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-o",
- ".build/sys/cmd/menu/util.o",
- "-c",
- "sys/cmd/menu/util.c"
- ],
- "file": "sys/cmd/menu/util.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-I",
- "include",
- "-o",
- ".build/sys/cmd/term/term.o",
- "-c",
- "sys/cmd/term/term.c"
- ],
- "file": "sys/cmd/term/term.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/cmd/walk/walk.o",
- "-c",
- "sys/cmd/walk/walk.c"
- ],
- "file": "sys/cmd/walk/walk.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-I",
- "include",
- "-o",
- ".build/sys/cmd/term/x.o",
- "-c",
- "sys/cmd/term/x.c"
- ],
- "file": "sys/cmd/term/x.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/src/pangraph/util.o",
- "-c",
- "src/pangraph/util.c"
- ],
- "file": "src/pangraph/util.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/src/pangraph/interval.o",
- "-c",
- "src/pangraph/interval.c"
- ],
- "file": "src/pangraph/interval.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/src/pangraph/sim.o",
- "-c",
- "src/pangraph/sim.c"
- ],
- "file": "src/pangraph/sim.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/src/pangraph/sketch.o",
- "-c",
- "src/pangraph/sketch.c"
- ],
- "file": "src/pangraph/sketch.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/src/pangraph/builder.o",
- "-c",
- "src/pangraph/builder.c"
- ],
- "file": "src/pangraph/builder.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/src/pangraph/graph.o",
- "-c",
- "src/pangraph/graph.c"
- ],
- "file": "src/pangraph/graph.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/src/pangraph/io.o",
- "-c",
- "src/pangraph/io.c"
- ],
- "file": "src/pangraph/io.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/src/pangraph/build.o",
- "-c",
- "src/pangraph/build.c"
- ],
- "file": "src/pangraph/build.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/src/pangraph/generate.o",
- "-c",
- "src/pangraph/generate.c"
- ],
- "file": "src/pangraph/generate.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/src/pangraph/main.o",
- "-c",
- "src/pangraph/main.c"
- ],
- "file": "src/pangraph/main.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/src/timetree/main.o",
- "-c",
- "src/timetree/main.c"
- ],
- "file": "src/timetree/main.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I/home/nolln/root/include/vendor",
- "-I/usr/include/libdrm",
- "-I/usr/include/pixman-1",
- "-I",
- "include",
- "-I",
- "sys/cmd/wm",
- "-o",
- ".build/sys/cmd/wm/xdg-shell-protocol.o",
- "-c",
- "sys/cmd/wm/xdg-shell-protocol.c"
- ],
- "file": "sys/cmd/wm/xdg-shell-protocol.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I/home/nolln/root/include/vendor",
- "-I/usr/include/libdrm",
- "-I/usr/include/pixman-1",
- "-I",
- "include",
- "-I",
- "sys/cmd/wm",
- "-o",
- ".build/sys/cmd/wm/arg.o",
- "-c",
- "sys/cmd/wm/arg.c"
- ],
- "file": "sys/cmd/wm/arg.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I/home/nolln/root/include/vendor",
- "-I/usr/include/libdrm",
- "-I/usr/include/pixman-1",
- "-I",
- "include",
- "-I",
- "sys/cmd/wm",
- "-o",
- ".build/sys/cmd/wm/input.o",
- "-c",
- "sys/cmd/wm/input.c"
- ],
- "file": "sys/cmd/wm/input.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I/home/nolln/root/include/vendor",
- "-I/usr/include/libdrm",
- "-I/usr/include/pixman-1",
- "-I",
- "include",
- "-I",
- "sys/cmd/wm",
- "-o",
- ".build/sys/cmd/wm/xdg.o",
- "-c",
- "sys/cmd/wm/xdg.c"
- ],
- "file": "sys/cmd/wm/xdg.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I/home/nolln/root/include/vendor",
- "-I/usr/include/libdrm",
- "-I/usr/include/pixman-1",
- "-I",
- "include",
- "-I",
- "sys/cmd/wm",
- "-o",
- ".build/sys/cmd/wm/client.o",
- "-c",
- "sys/cmd/wm/client.c"
- ],
- "file": "sys/cmd/wm/client.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I/home/nolln/root/include/vendor",
- "-I/usr/include/libdrm",
- "-I/usr/include/pixman-1",
- "-I",
- "include",
- "-I",
- "sys/cmd/wm",
- "-o",
- ".build/sys/cmd/wm/main.o",
- "-c",
- "sys/cmd/wm/main.c"
- ],
- "file": "sys/cmd/wm/main.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/src/cellnorm/io.o",
- "-c",
- "src/cellnorm/io.c"
- ],
- "file": "src/cellnorm/io.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/src/cellnorm/main.o",
- "-c",
- "src/cellnorm/main.c"
- ],
- "file": "src/cellnorm/main.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/src/kmer/main.o",
- "-c",
- "src/kmer/main.c"
- ],
- "file": "src/kmer/main.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libn/test.o",
- "-c",
- "sys/libn/test.c"
- ],
- "file": "sys/libn/test.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-D_GNU_SOURCE",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libmath/blas.o",
- "-c",
- "sys/libmath/blas.c"
- ],
- "file": "sys/libmath/blas.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-D_GNU_SOURCE",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libmath/test.o",
- "-c",
- "sys/libmath/test.c"
- ],
- "file": "sys/libmath/test.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-DWLR_USE_UNSTABLE",
- "-I/home/nolln/root/include/vendor",
- "-I/usr/include/libdrm",
- "-I/usr/include/pixman-1",
- "-I",
- "include",
- "-I",
- "sys/cmd/tinywl",
- "-o",
- ".build/sys/cmd/tinywl/xdg-shell-protocol.o",
- "-c",
- "sys/cmd/tinywl/xdg-shell-protocol.c"
- ],
- "file": "sys/cmd/tinywl/xdg-shell-protocol.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-DWLR_USE_UNSTABLE",
- "-I/home/nolln/root/include/vendor",
- "-I/usr/include/libdrm",
- "-I/usr/include/pixman-1",
- "-I",
- "include",
- "-I",
- "sys/cmd/tinywl",
- "-o",
- ".build/sys/cmd/tinywl/tinywl.o",
- "-c",
- "sys/cmd/tinywl/tinywl.c"
- ],
- "file": "sys/cmd/tinywl/tinywl.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I/home/nolln/root/include/vendor",
- "-I/usr/include/libdrm",
- "-I/usr/include/pixman-1",
- "-I",
- "include",
- "-I",
- "sys/cmd/wm",
- "-o",
- ".build/sys/cmd/wm/util.o",
- "-c",
- "sys/cmd/wm/util.c"
- ],
- "file": "sys/cmd/wm/util.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I/home/nolln/root/include/vendor",
- "-I/usr/include/libdrm",
- "-I/usr/include/pixman-1",
- "-I",
- "include",
- "-I",
- "sys/cmd/wm",
- "-o",
- ".build/sys/cmd/wm/render.o",
- "-c",
- "sys/cmd/wm/render.c"
- ],
- "file": "sys/cmd/wm/render.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I/home/nolln/root/include/vendor",
- "-I/usr/include/libdrm",
- "-I/usr/include/pixman-1",
- "-I",
- "include",
- "-I",
- "sys/cmd/wm",
- "-o",
- ".build/sys/cmd/wm/monitor.o",
- "-c",
- "sys/cmd/wm/monitor.c"
- ],
- "file": "sys/cmd/wm/monitor.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I/home/nolln/root/include/vendor",
- "-I/usr/include/libdrm",
- "-I/usr/include/pixman-1",
- "-I",
- "include",
- "-I",
- "sys/cmd/wm",
- "-o",
- ".build/sys/cmd/wm/wlr-layer-shell-unstable-v1-protocol.o",
- "-c",
- "sys/cmd/wm/wlr-layer-shell-unstable-v1-protocol.c"
- ],
- "file": "sys/cmd/wm/wlr-layer-shell-unstable-v1-protocol.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-I",
- "include",
- "-isystem",
- "include/vendor/libc",
- "-o",
- ".build/sys/libfont/freetype.o",
- "-c",
- "sys/libfont/freetype.c"
- ],
- "file": "sys/libfont/freetype.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I/home/nolln/root/include/vendor",
- "-I/usr/include/libdrm",
- "-I/usr/include/pixman-1",
- "-I",
- "include",
- "-I",
- "sys/cmd/wm",
- "-o",
- ".build/sys/cmd/wm/layer.o",
- "-c",
- "sys/cmd/wm/layer.c"
- ],
- "file": "sys/cmd/wm/layer.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-I/usr/include/freetype2",
- "-I/usr/include/libpng16",
- "-I/usr/include/harfbuzz",
- "-I/usr/include/glib-2.0",
- "-I/usr/lib/glib-2.0/include",
- "-I",
- "include",
- "-o",
- ".build/sys/cmd/term/hb.o",
- "-c",
- "sys/cmd/term/hb.c"
- ],
- "file": "sys/cmd/term/hb.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-o",
- ".build/sys/cmd/term2/xdg-shell-protocol.o",
- "-c",
- "sys/cmd/term2/xdg-shell-protocol.c"
- ],
- "file": "sys/cmd/term2/xdg-shell-protocol.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-o",
- ".build/sys/cmd/term2/util.o",
- "-c",
- "sys/cmd/term2/util.c"
- ],
- "file": "sys/cmd/term2/util.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-o",
- ".build/sys/cmd/term2/term.o",
- "-c",
- "sys/cmd/term2/term.c"
- ],
- "file": "sys/cmd/term2/term.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-o",
- ".build/sys/cmd/term2/gui.o",
- "-c",
- "sys/cmd/term2/gui.c"
- ],
- "file": "sys/cmd/term2/gui.c"
- },
- {
- "directory": "/home/nolln/root",
- "arguments": [
- "gcc",
- "-MD",
- "-g",
- "-march=native",
- "-fno-strict-aliasing",
- "-fwrapv",
- "-fms-extensions",
- "-Wno-microsoft-anon-tag",
- "-I",
- "include",
- "-o",
- ".build/sys/cmd/term2/main.o",
- "-c",
- "sys/cmd/term2/main.c"
- ],
- "file": "sys/cmd/term2/main.c"
- }
-]
diff --git a/sys/cmd/rc/code.c b/sys/cmd/rc/code.c
index 81deac2..0b280ac 100644
--- a/sys/cmd/rc/code.c
+++ b/sys/cmd/rc/code.c
@@ -15,18 +15,18 @@ int codep, ncode;
#define emits(x) ((void)(codep!=ncode || morecode()), codebuf[codep].s = (x), codep++)
void stuffdot(int);
-char *fnstr(tree*);
-void outcode(tree*, int);
-void codeswitch(tree*, int);
-int iscase(tree*);
-code *codecopy(code*);
-void codefree(code*);
+char *fnstr(Tree*);
+void outcode(Tree*, int);
+void codeswitch(Tree*, int);
+int iscase(Tree*);
+Code *codecopy(Code*);
+void codefree(Code*);
int
morecode(void)
{
ncode+=100;
- codebuf = (code *)realloc((char *)codebuf, ncode*sizeof codebuf[0]);
+ codebuf = (Code *)realloc((char *)codebuf, ncode*sizeof codebuf[0]);
if(codebuf==0)
panic("Can't realloc %d bytes in morecode!",
ncode*sizeof codebuf[0]);
@@ -43,10 +43,10 @@ stuffdot(int a)
}
int
-compile(tree *t)
+compile(Tree *t)
{
ncode = 100;
- codebuf = (code *)emalloc(ncode*sizeof codebuf[0]);
+ codebuf = (Code *)emalloc(ncode*sizeof codebuf[0]);
codep = 0;
emiti(0); /* reference count */
outcode(t, flag['e']?1:0);
@@ -68,9 +68,9 @@ cleanhere(char *f)
}
char*
-fnstr(tree *t)
+fnstr(Tree *t)
{
- io *f = openstr();
+ Io *f = openstr();
char *v;
extern char nl;
char svnl = nl;
@@ -84,10 +84,10 @@ fnstr(tree *t)
}
void
-outcode(tree *t, int eflag)
+outcode(Tree *t, int eflag)
{
int p, q;
- tree *tt;
+ Tree *tt;
if(t==0)
return;
if(t->type!=NOT && t->type!=';')
@@ -404,12 +404,12 @@ outcode(tree *t, int eflag)
*/
void
-codeswitch(tree *t, int eflag)
+codeswitch(Tree *t, int eflag)
{
int leave; /* patch jump address to leave switch */
int out; /* jump here to leave switch */
int nextcase; /* patch jump address to next case */
- tree *tt;
+ Tree *tt;
if(c1->child[0]==nil
|| c1->child[0]->type!=';'
|| !iscase(c1->child[0]->child[0])){
@@ -451,7 +451,7 @@ codeswitch(tree *t, int eflag)
}
int
-iscase(tree *t)
+iscase(Tree *t)
{
if(t->type!=SIMPLE)
return 0;
@@ -459,17 +459,17 @@ iscase(tree *t)
return t->type==WORD && !t->quoted && strcmp(t->str, "case")==0;
}
-code*
-codecopy(code *cp)
+Code*
+codecopy(Code *cp)
{
cp[0].i++;
return cp;
}
void
-codefree(code *cp)
+codefree(Code *cp)
{
- code *p;
+ Code *p;
if(--cp[0].i!=0)
return;
for(p = cp+1;p->f;p++){
diff --git a/sys/cmd/rc/exec.c b/sys/cmd/rc/exec.c
index 15d1cdf..fdb63cf 100644
--- a/sys/cmd/rc/exec.c
+++ b/sys/cmd/rc/exec.c
@@ -12,21 +12,20 @@ int lastc;
int kidpid;
int mypid;
-thread *runq;
-code *codebuf; /* compiler output */
-int ntrap; /* number of outstanding traps */
-int trap[NSIG]; /* number of outstanding traps per type */
-
-int eflagok; /* kludge flag so that -e doesn't exit in startup */
+Thread *runq;
+Code *codebuf; /* compiler output */
+int ntrap; /* number of outstanding traps */
+int trap[NSIG]; /* number of outstanding traps per type */
+int eflagok; /* kludge flag so that -e doesn't exit in startup */
char **argp;
char **args;
-int nerror; /* number of errors encountered during compilation */
+int nerror; /* number of errors encountered during compilation */
void
-start(code *c, int pc, var *local)
+start(Code *c, int pc, Var *local)
{
- struct thread *p = new(struct thread);
+ struct Thread *p = new(struct Thread);
p->code = codecopy(c);
p->pc = pc;
@@ -42,10 +41,10 @@ start(code *c, int pc, var *local)
runq = p;
}
-word*
-newword(char *wd, word *next)
+Word*
+newword(char *wd, Word *next)
{
- word *p = new(word);
+ Word *p = new(Word);
p->word = strdup(wd);
p->next = next;
return p;
@@ -62,7 +61,7 @@ pushword(char *wd)
void
popword(void)
{
- word *p;
+ Word *p;
if(runq->argv==0)
panic("popword but no argv!", 0);
p = runq->argv->words;
@@ -74,9 +73,9 @@ popword(void)
}
void
-freelist(word *w)
+freelist(Word *w)
{
- word *nw;
+ Word *nw;
while(w){
nw = w->next;
efree(w->word);
@@ -88,7 +87,7 @@ freelist(word *w)
void
pushlist(void)
{
- list *p = new(list);
+ Words *p = new(Words);
p->next = runq->argv;
p->words = 0;
runq->argv = p;
@@ -97,7 +96,7 @@ pushlist(void)
void
poplist(void)
{
- list *p = runq->argv;
+ Words *p = runq->argv;
if(p==0)
panic("poplist but no argv", 0);
freelist(p->words);
@@ -106,7 +105,7 @@ poplist(void)
}
int
-count(word *w)
+count(Word *w)
{
int n;
for(n = 0;w;n++) w = w->next;
@@ -116,7 +115,7 @@ count(word *w)
void
pushredir(int type, int from, int to)
{
- redir * rp = new(redir);
+ Redir * rp = new(Redir);
rp->type = type;
rp->from = from;
rp->to = to;
@@ -124,10 +123,10 @@ pushredir(int type, int from, int to)
runq->redir = rp;
}
-var*
-newvar(char *name, var *next)
+Var*
+newvar(char *name, Var *next)
{
- var *v = new(var);
+ Var *v = new(Var);
v->name = name;
v->val = 0;
v->fn = 0;
@@ -147,7 +146,7 @@ newvar(char *name, var *next)
int
main(int argc, char *argv[])
{
- code bootstrap[32];
+ Code bootstrap[32];
char num[12], *rcmain;
int i;
@@ -166,10 +165,10 @@ main(int argc, char *argv[])
Vinit();
inttoascii(num, mypid = getpid());
pathinit();
- setvar("pid", newword(num, (word *)0));
- setvar("cflag", flag['c']?newword(flag['c'][0], (word *)0)
- :(word *)0);
- setvar("rcname", newword(argv[0], (word *)0));
+ setvar("pid", newword(num, (Word *)0));
+ setvar("cflag", flag['c']?newword(flag['c'][0], (Word *)0)
+ :(Word *)0);
+ setvar("rcname", newword(argv[0], (Word *)0));
i = 0;
memset(bootstrap, 0, sizeof bootstrap);
bootstrap[i++].i = 1;
@@ -189,7 +188,7 @@ main(int argc, char *argv[])
bootstrap[i++].f = Xsimple;
bootstrap[i++].f = Xexit;
bootstrap[i].i = 0;
- start(bootstrap, 1, (var *)0);
+ start(bootstrap, 1, (Var *)0);
/* prime bootstrap argv */
pushlist();
argv0 = strdup(argv[0]);
@@ -313,8 +312,8 @@ Xeflag(void)
void
Xexit(void)
{
- struct var *trapreq;
- struct word *starval;
+ struct Var *trapreq;
+ struct Word *starval;
static int beenhere = 0;
if(getpid()==mypid && !beenhere){
trapreq = vlook("sigexit");
@@ -322,9 +321,9 @@ Xexit(void)
beenhere = 1;
--runq->pc;
starval = vlook("*")->val;
- start(trapreq->fn, trapreq->pc, (struct var *)0);
+ start(trapreq->fn, trapreq->pc, (struct Var *)0);
runq->local = newvar(strdup("*"), runq->local);
- runq->local->val = copywords(starval, (struct word *)0);
+ runq->local->val = copywords(starval, (struct Word *)0);
runq->local->changed = 1;
runq->redir = runq->startredir = 0;
return;
@@ -431,7 +430,7 @@ turfredir(void)
void
Xpopredir(void)
{
- struct redir *rp = runq->redir;
+ struct Redir *rp = runq->redir;
if(rp==0)
panic("turfredir null!", 0);
runq->redir = rp->next;
@@ -443,7 +442,7 @@ Xpopredir(void)
void
Xreturn(void)
{
- struct thread *p = runq;
+ struct Thread *p = runq;
turfredir();
while(p->argv) poplist();
codefree(p->code);
@@ -507,11 +506,11 @@ Xwrite(void)
}
char*
-list2str(word *words)
+list2str(Word *words)
{
char *value, *s, *t;
int len = 0;
- word *ap;
+ Word *ap;
for(ap = words;ap;ap = ap->next)
len+=1+strlen(ap->word);
value = emalloc(len+1);
@@ -529,7 +528,7 @@ list2str(word *words)
void
Xmatch(void)
{
- word *p;
+ Word *p;
char *subject;
subject = list2str(runq->argv->words);
setstatus("no match");
@@ -546,7 +545,7 @@ Xmatch(void)
void
Xcase(void)
{
- word *p;
+ Word *p;
char *s;
int ok = 0;
s = list2str(runq->argv->next->words);
@@ -564,11 +563,11 @@ Xcase(void)
poplist();
}
-word*
-conclist(word *lp, word *rp, word *tail)
+Word*
+conclist(Word *lp, Word *rp, Word *tail)
{
char *buf;
- word *v;
+ Word *v;
if(lp->next || rp->next)
tail = conclist(lp->next==0?lp:lp->next, rp->next==0?rp:rp->next,
tail);
@@ -583,9 +582,9 @@ conclist(word *lp, word *rp, word *tail)
void
Xconc(void)
{
- word *lp = runq->argv->words;
- word *rp = runq->argv->next->words;
- word *vp = runq->argv->next->next->words;
+ Word *lp = runq->argv->words;
+ Word *rp = runq->argv->next->words;
+ Word *vp = runq->argv->next->next->words;
int lc = count(lp), rc = count(rp);
if(lc!=0 || rc!=0){
if(lc==0 || rc==0){
@@ -606,7 +605,7 @@ Xconc(void)
void
Xassign(void)
{
- var *v;
+ Var *v;
if(count(runq->argv->words)!=1){
Xerror1("variable name not singleton!");
return;
@@ -627,10 +626,10 @@ Xassign(void)
* copy arglist a, adding the copy to the front of tail
*/
-word*
-copywords(word *a, word *tail)
+Word*
+copywords(Word *a, Word *tail)
{
- word *v = 0, **end;
+ Word *v = 0, **end;
for(end=&v;a;a = a->next,end=&(*end)->next)
*end = newword(a->word, 0);
*end = tail;
@@ -640,7 +639,7 @@ copywords(word *a, word *tail)
void
Xdol(void)
{
- word *a, *star;
+ Word *a, *star;
char *s, *t;
int n;
if(count(runq->argv->words)!=1){
@@ -668,7 +667,7 @@ Xdol(void)
void
Xqdol(void)
{
- word *a, *p;
+ Word *a, *p;
char *s;
int n;
if(count(runq->argv->words)!=1){
@@ -699,10 +698,10 @@ Xqdol(void)
efree(s);
}
-word*
-copynwords(word *a, word *tail, int n)
+Word*
+copynwords(Word *a, Word *tail, int n)
{
- word *v, **end;
+ Word *v, **end;
v = 0;
end = &v;
@@ -715,8 +714,8 @@ copynwords(word *a, word *tail, int n)
return v;
}
-word*
-subwords(word *val, int len, word *sub, word *a)
+Word*
+subwords(Word *val, int len, Word *sub, Word *a)
{
int n, m;
char *s;
@@ -750,7 +749,7 @@ subwords(word *val, int len, word *sub, word *a)
void
Xsub(void)
{
- word *a, *v;
+ Word *a, *v;
char *s;
if(count(runq->argv->next->words)!=1){
Xerror1("variable name not singleton!");
@@ -769,7 +768,7 @@ Xsub(void)
void
Xcount(void)
{
- word *a;
+ Word *a;
char *s, *t;
int n;
char num[12];
@@ -802,7 +801,7 @@ Xlocal(void)
}
deglob(runq->argv->words->word);
runq->local = newvar(strdup(runq->argv->words->word), runq->local);
- runq->local->val = copywords(runq->argv->next->words, (word *)0);
+ runq->local->val = copywords(runq->argv->next->words, (Word *)0);
runq->local->changed = 1;
poplist();
poplist();
@@ -811,7 +810,7 @@ Xlocal(void)
void
Xunlocal(void)
{
- var *v = runq->local, *hid;
+ Var *v = runq->local, *hid;
if(v==0)
panic("Xunlocal: no locals!", 0);
runq->local = v->next;
@@ -823,9 +822,9 @@ Xunlocal(void)
}
void
-freewords(word *w)
+freewords(Word *w)
{
- word *nw;
+ Word *nw;
while(w){
efree(w->word);
nw = w->next;
@@ -837,8 +836,8 @@ freewords(word *w)
void
Xfn(void)
{
- var *v;
- word *a;
+ Var *v;
+ Word *a;
int end;
end = runq->code[runq->pc].i;
for(a = runq->argv->words;a;a = a->next){
@@ -856,8 +855,8 @@ Xfn(void)
void
Xdelfn(void)
{
- var *v;
- word *a;
+ Var *v;
+ Word *a;
for(a = runq->argv->words;a;a = a->next){
v = gvlook(a->word);
if(v->fn)
@@ -900,8 +899,8 @@ Xpipewait(void)
void
Xrdcmds(void)
{
- struct thread *p = runq;
- word *prompt;
+ struct Thread *p = runq;
+ Word *prompt;
flush(err);
nerror = 0;
if(flag['s'] && !truestatus())
@@ -964,13 +963,13 @@ Xerror1(char *s)
void
setstatus(char *s)
{
- setvar("status", newword(s, (word *)0));
+ setvar("status", newword(s, (Word *)0));
}
char*
getstatus(void)
{
- var *status = vlook("status");
+ Var *status = vlook("status");
return status->val?status->val->word:"";
}
diff --git a/sys/cmd/rc/exec.h b/sys/cmd/rc/exec.h
index 009684e..faf29a5 100644
--- a/sys/cmd/rc/exec.h
+++ b/sys/cmd/rc/exec.h
@@ -17,19 +17,24 @@ extern void Xerror1(char*);
* word lists are in correct order,
* i.e. word0->word1->word2->word3->0
*/
-struct word{
+struct Word
+{
char *word;
- word *next;
+ Word *next;
};
-struct list{
- word *words;
- list *next;
+
+struct Words {
+ Word *words;
+ Words *next;
};
-word *newword(char *, word *), *copywords(word *, word *);
-struct redir{
+
+Word *newword(char *, Word *), *copywords(Word *, Word *);
+
+struct Redir
+{
char type; /* what to do */
short from, to; /* what to do it to */
- struct redir *next; /* what else to do (reverse order) */
+ struct Redir *next; /* what else to do (reverse order) */
};
#define NSTATUS ERRMAX /* length of status (from plan 9) */
/*
@@ -38,38 +43,40 @@ struct redir{
#define ROPEN 1 /* dup2(from, to); close(from); */
#define RDUP 2 /* dup2(from, to); */
#define RCLOSE 3 /* close(from); */
-struct thread{
- union code *code; /* code for this thread */
+struct Thread
+{
+ union Code *code; /* code for this thread */
int pc; /* code[pc] is the next instruction */
- struct list *argv; /* argument stack */
- struct redir *redir; /* redirection stack */
- struct redir *startredir; /* redir inheritance point */
- struct var *local; /* list of local variables */
+ struct Words *argv; /* argument stack */
+ struct Redir *redir; /* redirection stack */
+ struct Redir *startredir; /* redir inheritance point */
+ struct Var *local; /* list of local variables */
char *cmdfile; /* file name in Xrdcmd */
- struct io *cmdfd; /* file descriptor for Xrdcmd */
+ struct Io *cmdfd; /* file descriptor for Xrdcmd */
int iflast; /* static `if not' checking */
int eof; /* is cmdfd at eof? */
int iflag; /* interactive? */
int lineno; /* linenumber */
int pid; /* process for Xpipewait to wait for */
char status[NSTATUS]; /* status for Xpipewait */
- tree *treenodes; /* tree nodes created by this process */
- thread *ret; /* who continues when this finishes */
+ Tree *treenodes; /* tree nodes created by this process */
+ Thread *ret; /* who continues when this finishes */
};
-code *codecopy(code*);
+Code *codecopy(Code*);
-extern thread *runq;
-extern code *codebuf; /* compiler output */
+extern Thread *runq;
+extern Code *codebuf; /* compiler output */
extern int ntrap; /* number of outstanding traps */
extern int trap[NSIG]; /* number of outstanding traps per type */
-struct builtin{
+struct Builtin
+{
char *name;
void (*fnc)(void);
};
-extern struct builtin Builtin[];
+extern struct Builtin builtin[];
extern int eflagok; /* kludge flag so that -e doesn't exit in startup */
extern int havefork;
@@ -78,4 +85,4 @@ void execcd(void), execwhatis(void), execeval(void), execexec(void);
int execforkexec(void);
void execexit(void), execshift(void);
void execwait(void), execumask(void), execdot(void), execflag(void);
-void execfunc(var*), execcmds(io *);
+void execfunc(Var*), execcmds(Io *);
diff --git a/sys/cmd/rc/fns.h b/sys/cmd/rc/fns.h
index 6ed2ca9..e9aa292 100644
--- a/sys/cmd/rc/fns.h
+++ b/sys/cmd/rc/fns.h
@@ -1,49 +1,49 @@
-void Abort(void);
-void Closedir(int);
-int Creat(char*);
-int Dup(int, int);
-int Dup1(int);
-int Eintr(void);
-int Executable(char*);
-void Execute(word*, word*);
-void Exit(char*);
-int ForkExecute(char*, char**, int, int, int);
-int Globsize(char*);
-int Isatty(int);
-void Memcpy(char*, char*, long);
-void Noerror(void);
-int Opendir(char*);
+void Abort(void);
+void Closedir(int);
+int Creat(char*);
+int Dup(int, int);
+int Dup1(int);
+int Eintr(void);
+int Executable(char*);
+void Execute(Word*, Word*);
+void Exit(char*);
+int ForkExecute(char*, char**, int, int, int);
+int Globsize(char*);
+int Isatty(int);
+void Memcpy(char*, char*, long);
+void Noerror(void);
+int Opendir(char*);
long Read(int, char*, long);
-int Readdir(int, char*, int);
+int Readdir(int, char*, int);
long Seek(int, long, long);
void Trapinit(void);
void Unlink(char*);
void Updenv(void);
void Vinit(void);
-int Waitfor(int, int);
+int Waitfor(int, int);
long Write(int, char*, long);
void addwaitpid(int);
-int advance(void);
-int back(int);
+int advance(void);
+int back(int);
void cleanhere(char*);
-void codefree(code*);
-int compile(tree*);
-char * list2str(word*);
-int count(word*);
+void codefree(Code*);
+int compile(Tree*);
+char *list2str(Word*);
+int count(Word*);
void deglob(char*);
void delwaitpid(int);
void dotrap(void);
void freenodes(void);
-void freewords(word*);
+void freewords(Word*);
void globlist(void);
-int havewaitpid(int);
-int idchr(int);
+int havewaitpid(int);
+int idchr(int);
void inttoascii(char*, long);
void kinit(void);
-int mapfd(int);
-int match(char*, char*, int);
-int matchfn(char*, char*);
-char** mkargv(word*);
+int mapfd(int);
+int match(char*, char*, int);
+int matchfn(char*, char*);
+char** mkargv(Word*);
void clearwaitpids(void);
void panic(char*, int);
void pathinit(void);
@@ -54,15 +54,15 @@ void pushlist(void);
void pushredir(int, int, int);
void pushword(char*);
void readhere(void);
-word* searchpath(char*);
+Word* searchpath(char*);
void setstatus(char*);
-void setvar(char*, word*);
+void setvar(char*, Word*);
void skipnl(void);
-void start(code*, int, var*);
-int truestatus(void);
+void start(Code*, int, Var*);
+int truestatus(void);
void usage(char*);
-int wordchr(int);
+int wordchr(int);
void yyerror(char*);
-int yylex(void);
-int yyparse(void);
-int octal(char*);
+int yylex(void);
+int yyparse(void);
+int octal(char*);
diff --git a/sys/cmd/rc/glob.c b/sys/cmd/rc/glob.c
index baea44d..f59be4d 100644
--- a/sys/cmd/rc/glob.c
+++ b/sys/cmd/rc/glob.c
@@ -1,8 +1,9 @@
#include "rc.h"
#include "exec.h"
#include "fns.h"
-char *globname;
-struct word *globv;
+
+struct Word *globv;
+char *globname;
/*
* delete all the GLOB marks from s, in place
*/
@@ -25,10 +26,10 @@ globcmp(const void *s, const void *t)
}
void
-globsort(word *left, word *right)
+globsort(Word *left, Word *right)
{
char **list;
- word *a;
+ Word *a;
int n = 0;
for(a = left;a!=right;a = a->next) n++;
list = (char **)emalloc(n*sizeof(char *));
@@ -90,7 +91,7 @@ globdir(char *p, char *namep)
void
glob(char *p)
{
- word *svglobv = globv;
+ Word *svglobv = globv;
int globlen = Globsize(p);
if(!globlen){
deglob(p);
@@ -243,7 +244,7 @@ match(char *s, char *p, int stop)
}
void
-globlist1(word *gl)
+globlist1(Word *gl)
{
if(gl){
globlist1(gl->next);
@@ -254,7 +255,7 @@ globlist1(word *gl)
void
globlist(void)
{
- word *a;
+ Word *a;
globv = 0;
globlist1(runq->argv->words);
poplist();
diff --git a/sys/cmd/rc/havefork.c b/sys/cmd/rc/havefork.c
index 02120e8..b59e679 100644
--- a/sys/cmd/rc/havefork.c
+++ b/sys/cmd/rc/havefork.c
@@ -67,7 +67,7 @@ Xasync(void)
close(null);
runq->pc = runq->code[runq->pc].i;
inttoascii(npid, pid);
- setvar("apid", newword(npid, (word *)0));
+ setvar("apid", newword(npid, (Word *)0));
break;
}
}
@@ -75,7 +75,7 @@ Xasync(void)
void
Xpipe(void)
{
- struct thread *p = runq;
+ struct Thread *p = runq;
int pc = p->pc, forkid;
int lfd = p->code[pc++].i;
int rfd = p->code[pc++].i;
@@ -112,13 +112,13 @@ Xpipe(void)
void
Xbackq(void)
{
- struct thread *p = runq;
+ struct Thread *p = runq;
char wd[8193];
int c, n;
char *s, *ewd=&wd[8192], *stop, *q;
- struct io *f;
- var *ifs = vlook("ifs");
- word *v, *nextv;
+ struct Io *f;
+ Var *ifs = vlook("ifs");
+ Word *v, *nextv;
int pfd[2];
int pid;
Rune r;
@@ -185,7 +185,7 @@ Xbackq(void)
void
Xpipefd(void)
{
- struct thread *p = runq;
+ struct Thread *p = runq;
int pc = p->pc, pid;
char name[40];
int pfd[2];
diff --git a/sys/cmd/rc/here.c b/sys/cmd/rc/here.c
index 17c6245..8175b04 100644
--- a/sys/cmd/rc/here.c
+++ b/sys/cmd/rc/here.c
@@ -2,12 +2,14 @@
#include "exec.h"
#include "io.h"
#include "fns.h"
-struct here *here, **ehere;
+
+struct Here *here, **ehere;
+
int ser = 0;
char tmp[]="/tmp/here0000.0000";
char hex[]="0123456789abcdef";
-void psubst(io*, char*);
-void pstrs(io*, word*);
+void psubst(Io*, char*);
+void pstrs(Io*, Word*);
void
hexnum(char *p, int n)
@@ -18,10 +20,11 @@ hexnum(char *p, int n)
*p = hex[n&0xF];
}
-tree*
-heredoc(tree *tag)
+Tree*
+heredoc(Tree *tag)
{
- struct here *h = new(struct here);
+ struct Here *h = new(struct Here);
+
if(tag->type!=WORD)
yyerror("Bad here tag");
h->next = 0;
@@ -45,8 +48,8 @@ heredoc(tree *tag)
void
readhere(void)
{
- struct here *h, *nexth;
- io *f;
+ struct Here *h, *nexth;
+ Io *f;
char *s, *tag;
int c, subst;
char line[NLINE+1];
@@ -86,11 +89,11 @@ readhere(void)
}
void
-psubst(io *f, char *s)
+psubst(Io *f, char *s)
{
char *t, *u;
int savec, n;
- word *star;
+ Word *star;
while(*s){
if(*s!='$'){
if(0xa0<=(*s&0xff) && (*s&0xff)<=0xf5){
@@ -137,7 +140,7 @@ psubst(io *f, char *s)
}
void
-pstrs(io *f, word *a)
+pstrs(Io *f, Word *a)
{
if(a){
while(a->next && a->next->word){
diff --git a/sys/cmd/rc/io.c b/sys/cmd/rc/io.c
index 3e17369..c06137c 100644
--- a/sys/cmd/rc/io.c
+++ b/sys/cmd/rc/io.c
@@ -4,11 +4,11 @@
#include "io.h"
#include "fns.h"
-io *err;
+Io *err;
int pfmtnest = 0;
void
-pfmt(io *f, char *fmt, ...)
+pfmt(Io *f, char *fmt, ...)
{
va_list ap;
char err[ERRMAX];
@@ -46,10 +46,10 @@ pfmt(io *f, char *fmt, ...)
pstr(f, va_arg(ap, char *));
break;
case 't':
- pcmd(f, va_arg(ap, struct tree *));
+ pcmd(f, va_arg(ap, struct Tree *));
break;
case 'v':
- pval(f, va_arg(ap, struct word *));
+ pval(f, va_arg(ap, struct Word *));
break;
default:
pchr(f, *fmt);
@@ -61,7 +61,7 @@ pfmt(io *f, char *fmt, ...)
}
void
-pchr(io *b, int c)
+pchr(Io *b, int c)
{
if(b->bufp==b->ebuf)
fullbuf(b, c);
@@ -69,7 +69,7 @@ pchr(io *b, int c)
}
int
-rchr(io *b)
+rchr(Io *b)
{
if(b->bufp==b->ebuf)
return emptybuf(b);
@@ -77,7 +77,7 @@ rchr(io *b)
}
void
-pquo(io *f, char *s)
+pquo(Io *f, char *s)
{
pchr(f, '\'');
for(;*s;s++)
@@ -88,7 +88,7 @@ pquo(io *f, char *s)
}
void
-pwrd(io *f, char *s)
+pwrd(Io *f, char *s)
{
char *t;
for(t = s;*t;t++) if(!wordchr(*t)) break;
@@ -98,7 +98,7 @@ pwrd(io *f, char *s)
}
void
-pptr(io *f, void *v)
+pptr(Io *f, void *v)
{
int n;
uintptr p;
@@ -111,7 +111,7 @@ pptr(io *f, void *v)
}
void
-pstr(io *f, char *s)
+pstr(Io *f, char *s)
{
if(s==0)
s="(null)";
@@ -119,7 +119,7 @@ pstr(io *f, char *s)
}
void
-pdec(io *f, int n)
+pdec(Io *f, int n)
{
if(n<0){
if(n!=INT_MIN){
@@ -140,7 +140,7 @@ pdec(io *f, int n)
}
void
-poct(io *f, unsigned n)
+poct(Io *f, unsigned n)
{
if(n>7)
poct(f, n>>3);
@@ -148,7 +148,7 @@ poct(io *f, unsigned n)
}
void
-pval(io *f, word *a)
+pval(Io *f, Word *a)
{
if(a){
while(a->next && a->next->word){
@@ -161,14 +161,14 @@ pval(io *f, word *a)
}
int
-fullbuf(io *f, int c)
+fullbuf(Io *f, int c)
{
flush(f);
return *f->bufp++=c;
}
void
-flush(io *f)
+flush(Io *f)
{
int n;
char *s;
@@ -193,20 +193,20 @@ flush(io *f)
}
}
-io*
+Io*
openfd(int fd)
{
- io *f = new(struct io);
+ Io *f = new(struct Io);
f->fd = fd;
f->bufp = f->ebuf = f->buf;
f->strp = 0;
return f;
}
-io*
+Io*
openstr(void)
{
- io *f = new(struct io);
+ Io *f = new(struct Io);
char *s;
f->fd=-1;
f->bufp = f->strp = emalloc(101);
@@ -219,10 +219,10 @@ openstr(void)
* characters from buf.
*/
-io*
+Io*
opencore(char *s, int len)
{
- io *f = new(struct io);
+ Io *f = new(struct Io);
char *buf = emalloc(len);
f->fd= -1 /*open("/dev/null", 0)*/;
f->bufp = f->strp = buf;
@@ -232,7 +232,7 @@ opencore(char *s, int len)
}
void
-iorewind(io *io)
+iorewind(Io *io)
{
if(io->fd==-1)
io->bufp = io->strp;
@@ -243,7 +243,7 @@ iorewind(io *io)
}
void
-closeio(io *io)
+closeio(Io *io)
{
if(io->fd>=0)
close(io->fd);
@@ -253,7 +253,7 @@ closeio(io *io)
}
int
-emptybuf(io *f)
+emptybuf(Io *f)
{
int n;
if(f->fd==-1 || (n = Read(f->fd, f->buf, NBUF))<=0) return EOF;
diff --git a/sys/cmd/rc/io.h b/sys/cmd/rc/io.h
index dac8b48..5457735 100644
--- a/sys/cmd/rc/io.h
+++ b/sys/cmd/rc/io.h
@@ -1,26 +1,31 @@
-#define EOF (-1)
-#define NBUF 512
-struct io{
- int fd;
- char *bufp, *ebuf, *strp, buf[NBUF];
+#define EOF (-1)
+#define NBUF 512
+
+struct Io
+{
+ int fd;
+ char *bufp, *ebuf, *strp, buf[NBUF];
};
-extern struct io *err;
+extern struct Io *err;
+
+Io *openfd(int);
+Io *openstr(void);
+Io *opencore(char *, int);
-io *openfd(int), *openstr(void), *opencore(char *, int);
-int emptybuf(io*);
-void pchr(io*, int);
-int rchr(io*);
-void closeio(io*);
-void flush(io*);
-int fullbuf(io*, int);
-void pdec(io*, int);
-void poct(io*, unsigned);
-void pptr(io*, void*);
-void pquo(io*, char*);
-void pwrd(io*, char*);
-void pstr(io*, char*);
-void pcmd(io*, tree*);
-void pval(io*, word*);
-void pfnc(io*, thread*);
-void pfmt(io*, char*, ...);
+int emptybuf(Io*);
+void pchr(Io*, int);
+int rchr(Io*);
+void closeio(Io*);
+void flush(Io*);
+int fullbuf(Io*, int);
+void pdec(Io*, int);
+void poct(Io*, unsigned);
+void pptr(Io*, void*);
+void pquo(Io*, char*);
+void pwrd(Io*, char*);
+void pstr(Io*, char*);
+void pcmd(Io*, Tree*);
+void pval(Io*, Word*);
+void pfnc(Io*, Thread*);
+void pfmt(Io*, char*, ...);
diff --git a/sys/cmd/rc/lex.c b/sys/cmd/rc/lex.c
index 253d05a..b840fff 100644
--- a/sys/cmd/rc/lex.c
+++ b/sys/cmd/rc/lex.c
@@ -176,7 +176,8 @@ yylex(void)
{
int c, d = nextc();
char *w = tok;
- struct tree *t;
+ struct Tree *t;
+
yylval.tree = 0;
/*
* Embarassing sneakiness: if the last token read was a quoted or unquoted
diff --git a/sys/cmd/rc/pcmd.c b/sys/cmd/rc/pcmd.c
index 8caf60a..44754c1 100644
--- a/sys/cmd/rc/pcmd.c
+++ b/sys/cmd/rc/pcmd.c
@@ -7,7 +7,7 @@ char nl='\n'; /* change to semicolon for bourne-proofing */
#define c2 t->child[2]
void
-pdeglob(io *f, char *s)
+pdeglob(Io *f, char *s)
{
while(*s){
if(*s==GLOB)
@@ -17,7 +17,7 @@ pdeglob(io *f, char *s)
}
void
-pcmd(io *f, tree *t)
+pcmd(Io *f, Tree *t)
{
if(t==0)
return;
diff --git a/sys/cmd/rc/pfnc.c b/sys/cmd/rc/pfnc.c
index 3f2b4c9..f6f32cd 100644
--- a/sys/cmd/rc/pfnc.c
+++ b/sys/cmd/rc/pfnc.c
@@ -53,11 +53,11 @@ struct{
0};
void
-pfnc(io *fd, thread *t)
+pfnc(Io *fd, Thread *t)
{
int i;
void (*fn)(void) = t->code[t->pc].f;
- list *a;
+ Words *a;
pfmt(fd, "pid %d cycle %p %d ", getpid(), t->code, t->pc);
for(i = 0;fname[i].f;i++) if(fname[i].f==fn){
pstr(fd, fname[i].name);
diff --git a/sys/cmd/rc/prompt.c b/sys/cmd/rc/prompt.c
index b51e509..e474c14 100644
--- a/sys/cmd/rc/prompt.c
+++ b/sys/cmd/rc/prompt.c
@@ -22,7 +22,7 @@ static
char*
completion_matches(const char *s, int i)
{
- word *w;
+ Word *w;
for(w=vlook(COMPLETE_RESULTS)->val; w; w=w->next, i--)
if(!i)
@@ -49,7 +49,7 @@ void
readline(void)
{
static int first = 1;
- io *f = runq->cmdfd;
+ Io *f = runq->cmdfd;
char *s;
long n;
@@ -85,7 +85,7 @@ readline(void)
void
pprompt(void)
{
- var *prompt;
+ Var *prompt;
if(runq->iflag){
flush(err);
diff --git a/sys/cmd/rc/rc.h b/sys/cmd/rc/rc.h
index 1f73f11..c91bdd4 100644
--- a/sys/cmd/rc/rc.h
+++ b/sys/cmd/rc/rc.h
@@ -10,48 +10,60 @@
#undef pipe /* so that /dev/fd works */
#define searchpath rcsearchpath /* avoid new libc function */
-typedef struct tree tree;
-typedef struct word word;
-typedef struct io io;
-typedef union code code;
-typedef struct var var;
-typedef struct list list;
-typedef struct redir redir;
-typedef struct thread thread;
-typedef struct builtin builtin;
-
-struct tree{
- int type;
- int rtype, fd0, fd1; /* details of REDIR PIPE DUP tokens */
- char *str;
- int quoted;
- int iskw;
- tree *child[3];
- tree *next;
+typedef struct Tree Tree;
+typedef struct Word Word;
+typedef struct Io Io;
+typedef union Code Code;
+typedef struct Var Var;
+typedef struct Words Words;
+typedef struct Redir Redir;
+typedef struct Thread Thread;
+typedef struct Builtin Builtin;
+
+struct Tree
+{
+ int type;
+ int rtype, fd0, fd1; /* details of REDIR PIPE DUP tokens */
+ char *str;
+ int quoted;
+ int iskw;
+ Tree *child[3];
+ Tree *next;
};
-tree *newtree(void);
-tree *token(char*, int), *klook(char*), *tree1(int, tree*);
-tree *tree2(int, tree*, tree*), *tree3(int, tree*, tree*, tree*);
-tree *mung1(tree*, tree*), *mung2(tree*, tree*, tree*);
-tree *mung3(tree*, tree*, tree*, tree*), *epimung(tree*, tree*);
-tree *simplemung(tree*), *heredoc(tree*);
-void freetree(tree*);
-extern tree *cmdtree;
+Tree *newtree(void);
+void freetree(Tree*);
+
+Tree *token(char*, int);
+Tree *klook(char*);
+
+Tree *tree1(int, Tree*);
+Tree *tree2(int, Tree*, Tree*);
+Tree *tree3(int, Tree*, Tree*, Tree*);
+
+Tree *mung1(Tree*, Tree*);
+Tree *mung2(Tree*, Tree*, Tree*);
+Tree *mung3(Tree*, Tree*, Tree*, Tree*);
+Tree *epimung(Tree*, Tree*);
+Tree *simplemung(Tree*);
+Tree *heredoc(Tree*);
+
+extern Tree *cmdtree;
/*
* The first word of any code vector is a reference count.
* Always create a new reference to a code vector by calling codecopy(.).
* Always call codefree(.) when deleting a reference.
*/
-union code{
+union Code
+{
void (*f)(void);
int i;
char *s;
};
extern char *promptstr;
-extern int doprompt;
+extern int doprompt;
#define NTOK 8192
extern char tok[NTOK];
@@ -63,30 +75,34 @@ extern char tok[NTOK];
#define DUPFD 5
#define CLOSE 6
#define RDWR 7
-struct var{
+
+struct Var
+{
char *name; /* ascii name */
- word *val; /* value */
+ Word *val; /* value */
int changed;
- code *fn; /* pointer to function's code vector */
+ Code *fn; /* pointer to function's code vector */
int fnchanged;
int pc; /* pc of start of function */
- var *next; /* next on hash or local list */
- void (*changefn)(var*);
+ Var *next; /* next on hash or local list */
+ void (*changefn)(Var*);
};
-var *vlook(char*), *gvlook(char*), *newvar(char*, var*);
+Var *vlook(char*), *gvlook(char*), *newvar(char*, Var*);
#define NVAR 521
-extern var *gvar[NVAR]; /* hash for globals */
+extern Var *gvar[NVAR]; /* hash for globals */
#define new(type) ((type *)emalloc(sizeof(type)))
void *emalloc(long);
void *Malloc(ulong);
void efree(void*);
#define NOFILE 128 /* should come from <param.h> */
-struct here{
- tree *tag;
+
+struct Here
+{
+ Tree *tag;
char *name;
- struct here *next;
+ struct Here *next;
};
/*
* Glob character escape in strings:
diff --git a/sys/cmd/rc/rules.mk b/sys/cmd/rc/rules.mk
index 228e15f..8c34cfd 100644
--- a/sys/cmd/rc/rules.mk
+++ b/sys/cmd/rc/rules.mk
@@ -29,7 +29,7 @@ include share/paths.mk
# Local rules
$(d)/y.tab.h $(d)/y.tab.c: $(d)/syn.y
- yacc -d $^
+ yacc --header=sys/cmd/rc/y.tab.h --output=sys/cmd/rc/y.tab.c $^
$(BINS_$(d)): TCFLAGS = \
-D_XOPEN_SOURCE=500
diff --git a/sys/cmd/rc/simple.c b/sys/cmd/rc/simple.c
index d587227..465fe43 100644
--- a/sys/cmd/rc/simple.c
+++ b/sys/cmd/rc/simple.c
@@ -11,18 +11,21 @@
*/
int
exitnext(void){
- union code *c=&runq->code[runq->pc];
- while(c->f==Xpopredir) c++;
- return c->f==Xexit;
+ union Code *c=&runq->code[runq->pc];
+
+ while(c->f==Xpopredir)
+ c++;
+
+ return c->f==Xexit;
}
void
Xsimple(void)
{
- word *a;
- thread *p = runq;
- var *v;
- struct builtin *bp;
+ Word *a;
+ Thread *p = runq;
+ Var *v;
+ struct Builtin *bp;
int pid;
globlist();
a = runq->argv->words;
@@ -46,7 +49,7 @@ Xsimple(void)
a = a->next;
popword();
}
- for(bp = Builtin;bp->name;bp++)
+ for(bp = builtin;bp->name;bp++)
if(strcmp(a->word, bp->name)==0){
(*bp->fnc)();
return;
@@ -72,10 +75,10 @@ Xsimple(void)
}
}
}
-struct word nullpath = { "", 0};
+struct Word nullpath = { "", 0};
void
-doredir(redir *rp)
+doredir(Redir *rp)
{
if(rp){
doredir(rp->next);
@@ -96,10 +99,10 @@ doredir(redir *rp)
}
}
-word*
+Word*
searchpath(char *w)
{
- word *path;
+ Word *path;
if(strncmp(w, "/", 1)==0
/* || strncmp(w, "#", 1)==0 */
|| strncmp(w, "./", 2)==0
@@ -123,9 +126,9 @@ execexec(void)
}
void
-execfunc(var *func)
+execfunc(Var *func)
{
- word *starval;
+ Word *starval;
popword();
starval = runq->argv->words;
runq->argv->words = 0;
@@ -154,8 +157,8 @@ dochdir(char *word)
void
execcd(void)
{
- word *a = runq->argv->words;
- word *cdpath;
+ Word *a = runq->argv->words;
+ Word *cdpath;
char dir[512];
setstatus("can't cd");
cdpath = vlook("cdpath")->val;
@@ -213,8 +216,8 @@ void
execshift(void)
{
int n;
- word *a;
- var *star;
+ Word *a;
+ Var *star;
switch(count(runq->argv->words)){
default:
pfmt(err, "Usage: shift [n]\n");
@@ -252,7 +255,7 @@ octal(char *s)
int
mapfd(int fd)
{
- redir *rp;
+ Redir *rp;
for(rp = runq->redir;rp;rp = rp->next){
switch(rp->type){
case RCLOSE:
@@ -268,10 +271,10 @@ mapfd(int fd)
}
return fd;
}
-union code rdcmds[4];
+union Code rdcmds[4];
void
-execcmds(io *f)
+execcmds(Io *f)
{
static int first = 1;
if(first){
@@ -290,7 +293,7 @@ execeval(void)
{
char *cmdline, *s, *t;
int len = 0;
- word *ap;
+ Word *ap;
if(count(runq->argv->words)<=1){
Xerror1("Usage: eval cmd ...");
return;
@@ -309,19 +312,19 @@ execeval(void)
execcmds(opencore(cmdline, len));
efree(cmdline);
}
-union code dotcmds[14];
+union Code dotcmds[14];
void
execdot(void)
{
int iflag = 0;
int fd;
- list *av;
- thread *p = runq;
+ Words *av;
+ Thread *p = runq;
char *zero;
static int first = 1;
char file[512];
- word *path;
+ Word *path;
if(first){
dotcmds[0].i = 1;
dotcmds[1].f = Xmark;
@@ -372,7 +375,7 @@ execdot(void)
return;
}
/* set up for a new command loop */
- start(dotcmds, 1, (struct var *)0);
+ start(dotcmds, 1, (struct Var *)0);
pushredir(RCLOSE, fd, 0);
runq->cmdfile = zero;
runq->cmdfd = openfd(fd);
@@ -421,11 +424,11 @@ execflag(void)
void
execwhatis(void){ /* mildly wrong -- should fork before writing */
- word *a, *b, *path;
- var *v;
- struct builtin *bp;
+ Word *a, *b, *path;
+ Var *v;
+ struct Builtin *bp;
char file[512];
- struct io out[1];
+ struct Io out[1];
int found, sep;
a = runq->argv->words->next;
if(a==0){
@@ -459,7 +462,7 @@ execwhatis(void){ /* mildly wrong -- should fork before writing */
if(v->fn)
pfmt(out, "fn %s %s\n", v->name, v->fn[v->pc-1].s);
else{
- for(bp = Builtin;bp->name;bp++)
+ for(bp = builtin;bp->name;bp++)
if(strcmp(a->word, bp->name)==0){
pfmt(out, "builtin %s\n", a->word);
break;
diff --git a/sys/cmd/rc/subr.c b/sys/cmd/rc/subr.c
index a2d8a18..79a945e 100644
--- a/sys/cmd/rc/subr.c
+++ b/sys/cmd/rc/subr.c
@@ -42,7 +42,7 @@ yyerror(char *m)
lastdol = 0;
while(lastc!='\n' && lastc!=EOF) advance();
nerror++;
- setvar("status", newword(m, (word *)0));
+ setvar("status", newword(m, (Word *)0));
}
char *bp;
diff --git a/sys/cmd/rc/syn.y b/sys/cmd/rc/syn.y
index c7de353..3af3254 100644
--- a/sys/cmd/rc/syn.y
+++ b/sys/cmd/rc/syn.y
@@ -14,7 +14,7 @@
#include "fns.h"
%}
%union{
- struct tree *tree;
+ struct Tree *tree;
};
%type<tree> line paren brace body cmdsa cmdsan assign epilog redir
%type<tree> cmd simple first word comword keyword words
@@ -54,7 +54,7 @@ cmd: {$$=0;}
*/
{$$=mung3($1, $3, $5 ? $5 : tree1(PAREN, $5), $8);}
| FOR '(' word ')' {skipnl();} cmd
- {$$=mung3($1, $3, (struct tree *)0, $6);}
+ {$$=mung3($1, $3, (struct Tree *)0, $6);}
| WHILE paren {skipnl();} cmd
{$$=mung2($1, $2, $4);}
| SWITCH word {skipnl();} brace
@@ -87,5 +87,5 @@ comword: '$' word {$$=tree1('$', $2);}
| '(' words ')' {$$=tree1(PAREN, $2);}
| REDIR brace {$$=mung1($1, $2); $$->type=PIPEFD;}
keyword: FOR|IN|WHILE|IF|NOT|TWIDDLE|BANG|SUBSHELL|SWITCH|FN
-words: {$$=(struct tree*)0;}
+words: {$$=(struct Tree*)0;}
| words word {$$=tree2(WORDS, $1, $2);}
diff --git a/sys/cmd/rc/trap.c b/sys/cmd/rc/trap.c
index a572cac..ef46143 100644
--- a/sys/cmd/rc/trap.c
+++ b/sys/cmd/rc/trap.c
@@ -8,8 +8,8 @@ void
dotrap(void)
{
int i;
- struct var *trapreq;
- struct word *starval;
+ struct Var *trapreq;
+ struct Word *starval;
starval = vlook("*")->val;
while(ntrap) for(i = 0;i!=NSIG;i++) while(trap[i]){
--trap[i];
@@ -17,9 +17,9 @@ dotrap(void)
if(getpid()!=mypid) Exit(getstatus());
trapreq = vlook(Signame[i]);
if(trapreq->fn){
- start(trapreq->fn, trapreq->pc, (struct var *)0);
+ start(trapreq->fn, trapreq->pc, (struct Var *)0);
runq->local = newvar(strdup("*"), runq->local);
- runq->local->val = copywords(starval, (struct word *)0);
+ runq->local->val = copywords(starval, (struct Word *)0);
runq->local->changed = 1;
runq->redir = runq->startredir = 0;
}
diff --git a/sys/cmd/rc/tree.c b/sys/cmd/rc/tree.c
index 897597e..5ab6c5d 100644
--- a/sys/cmd/rc/tree.c
+++ b/sys/cmd/rc/tree.c
@@ -2,16 +2,16 @@
#include "exec.h"
#include "io.h"
#include "fns.h"
-tree *treenodes;
+Tree *treenodes;
/*
* create and clear a new tree node, and add it
* to the node list.
*/
-tree*
+Tree*
newtree(void)
{
- tree *t = new(tree);
+ Tree *t = new(Tree);
t->iskw = 0;
t->str = 0;
t->child[0] = t->child[1] = t->child[2] = 0;
@@ -23,7 +23,7 @@ newtree(void)
void
freenodes(void)
{
- tree *t, *u;
+ Tree *t, *u;
for(t = treenodes;t;t = u){
u = t->next;
if(t->str)
@@ -33,22 +33,22 @@ freenodes(void)
treenodes = 0;
}
-tree*
-tree1(int type, tree *c0)
+Tree*
+tree1(int type, Tree *c0)
{
- return tree3(type, c0, (tree *)0, (tree *)0);
+ return tree3(type, c0, (Tree *)0, (Tree *)0);
}
-tree*
-tree2(int type, tree *c0, tree *c1)
+Tree*
+tree2(int type, Tree *c0, Tree *c1)
{
- return tree3(type, c0, c1, (tree *)0);
+ return tree3(type, c0, c1, (Tree *)0);
}
-tree*
-tree3(int type, tree *c0, tree *c1, tree *c2)
+Tree*
+tree3(int type, Tree *c0, Tree *c1, Tree *c2)
{
- tree *t;
+ Tree *t;
if(type==';'){
if(c0==0)
return c1;
@@ -63,23 +63,23 @@ tree3(int type, tree *c0, tree *c1, tree *c2)
return t;
}
-tree*
-mung1(tree *t, tree *c0)
+Tree*
+mung1(Tree *t, Tree *c0)
{
t->child[0] = c0;
return t;
}
-tree*
-mung2(tree *t, tree *c0, tree *c1)
+Tree*
+mung2(Tree *t, Tree *c0, Tree *c1)
{
t->child[0] = c0;
t->child[1] = c1;
return t;
}
-tree*
-mung3(tree *t, tree *c0, tree *c1, tree *c2)
+Tree*
+mung3(Tree *t, Tree *c0, Tree *c1, Tree *c2)
{
t->child[0] = c0;
t->child[1] = c1;
@@ -87,10 +87,10 @@ mung3(tree *t, tree *c0, tree *c1, tree *c2)
return t;
}
-tree*
-epimung(tree *comp, tree *epi)
+Tree*
+epimung(Tree *comp, Tree *epi)
{
- tree *p;
+ Tree *p;
if(epi==0)
return comp;
for(p = epi;p->child[1];p = p->child[1]);
@@ -102,11 +102,11 @@ epimung(tree *comp, tree *epi)
* up to the root.
*/
-tree*
-simplemung(tree *t)
+Tree*
+simplemung(Tree *t)
{
- tree *u;
- struct io *s;
+ Tree *u;
+ struct Io *s;
t = tree1(SIMPLE, t);
s = openstr();
pfmt(s, "%t", t);
@@ -123,17 +123,17 @@ simplemung(tree *t)
return t;
}
-tree*
+Tree*
token(char *str, int type)
{
- tree *t = newtree();
+ Tree *t = newtree();
t->type = type;
t->str = strdup(str);
return t;
}
void
-freetree(tree *p)
+freetree(Tree *p)
{
if(p==0)
return;
diff --git a/sys/cmd/rc/unix.c b/sys/cmd/rc/unix.c
index 32a744f..eb96813 100644
--- a/sys/cmd/rc/unix.c
+++ b/sys/cmd/rc/unix.c
@@ -21,7 +21,7 @@ char *Fdprefix = "/dev/fd/";
void execfinit(void);
-struct builtin Builtin[] = {
+struct Builtin builtin[] = {
"cd", execcd,
"whatis", execwhatis,
"eval", execeval,
@@ -39,15 +39,15 @@ struct builtin Builtin[] = {
#define SEP '\1'
char **environp;
-struct word*
+struct Word*
enval(register char *s)
{
char *t, c;
- struct word *v;
+ struct Word *v;
for(t = s;*t && *t!=SEP;t++);
c=*t;
*t='\0';
- v = newword(s, c=='\0'?(struct word *)0:enval(t+1));
+ v = newword(s, c=='\0'?(struct Word *)0:enval(t+1));
*t = c;
return v;
}
@@ -104,7 +104,7 @@ Xrdfn(void)
Xreturn();
}
-union code rdfns[4];
+union Code rdfns[4];
void
execfinit(void)
@@ -134,8 +134,8 @@ char **
mkenv(void)
{
char **env, **ep, *p, *q;
- struct var **h, *v;
- struct word *a;
+ struct Var **h, *v;
+ struct Word *a;
int nvar = 0, nchr = 0, sep;
/*
@@ -217,7 +217,7 @@ int
Waitfor(int pid, int persist)
{
int wpid, sig;
- struct thread *p;
+ struct Thread *p;
int wstat;
char wstatstr[12];
@@ -262,7 +262,7 @@ Waitfor(int pid, int persist)
}
char **
-mkargv(register struct word *a)
+mkargv(register struct Word *a)
{
char **argv = (char **)emalloc((count(a)+2)*sizeof(char *));
char **argp = argv+1; /* leave one at front for runcoms */
@@ -279,7 +279,7 @@ Updenv(void)
}
void
-Execute(struct word *args, struct word *path)
+Execute(struct Word *args, struct Word *path)
{
char *msg="not found";
int txtbusy = 0;
@@ -517,7 +517,7 @@ void
execumask(void) /* wrong -- should fork before writing */
{
int m;
- struct io out[1];
+ struct Io out[1];
switch(count(runq->argv->words)){
default:
pfmt(err, "Usage: umask [umask]\n");
diff --git a/sys/cmd/rc/unix.h b/sys/cmd/rc/unix.h
index 84ff25e..885c638 100644
--- a/sys/cmd/rc/unix.h
+++ b/sys/cmd/rc/unix.h
@@ -1,5 +1,3 @@
-
-
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
diff --git a/sys/cmd/rc/var.c b/sys/cmd/rc/var.c
index d48dc66..a1c60e0 100644
--- a/sys/cmd/rc/var.c
+++ b/sys/cmd/rc/var.c
@@ -2,7 +2,7 @@
#include "exec.h"
#include "fns.h"
-var *gvar[NVAR] = { 0 }; /* hash for globals */
+Var *gvar[NVAR] = { 0 }; /* hash for globals */
int
hash(char *s, int n)
@@ -45,11 +45,11 @@ kinit(void)
kenter(FN, "fn");
}
-tree*
+Tree*
klook(char *name)
{
struct kw *p;
- tree *t = token(name, WORD);
+ Tree *t = token(name, WORD);
for(p = kw[hash(name, NKW)];p;p = p->next)
if(strcmp(p->name, name)==0){
t->type = p->type;
@@ -59,19 +59,19 @@ klook(char *name)
return t;
}
-var*
+Var*
gvlook(char *name)
{
int h = hash(name, NVAR);
- var *v;
+ Var *v;
for(v = gvar[h];v;v = v->next) if(strcmp(v->name, name)==0) return v;
return gvar[h] = newvar(strdup(name), gvar[h]);
}
-var*
+Var*
vlook(char *name)
{
- var *v;
+ Var *v;
if(runq)
for(v = runq->local;v;v = v->next)
if(strcmp(v->name, name)==0) return v;
@@ -79,9 +79,10 @@ vlook(char *name)
}
void
-_setvar(char *name, word *val, int callfn)
+_setvar(char *name, Word *val, int callfn)
{
- struct var *v = vlook(name);
+ struct Var *v = vlook(name);
+
freewords(v->val);
v->val=val;
v->changed=1;
@@ -90,17 +91,17 @@ _setvar(char *name, word *val, int callfn)
}
void
-setvar(char *name, word *val)
+setvar(char *name, Word *val)
{
_setvar(name, val, 1);
}
void
-bigpath(var *v)
+bigpath(Var *v)
{
/* convert $PATH to $path */
char *p, *q;
- word **l, *w;
+ Word **l, *w;
if(v->val == nil){
_setvar("path", nil, 0);
@@ -130,11 +131,11 @@ bigpath(var *v)
}
char*
-list2strcolon(word *words)
+list2strcolon(Word *words)
{
char *value, *s, *t;
int len = 0;
- word *ap;
+ Word *ap;
for(ap = words;ap;ap = ap->next)
len+=1+strlen(ap->word);
value = emalloc(len+1);
@@ -149,14 +150,14 @@ list2strcolon(word *words)
return value;
}
void
-littlepath(var *v)
+littlepath(Var *v)
{
/* convert $path to $PATH */
char *p;
- word *w;
+ Word *w;
p = list2strcolon(v->val);
- w = new(word);
+ w = new(Word);
w->word = p;
w->next = nil;
_setvar("PATH", w, 1); /* 1: recompute $path to expose colon problems */
@@ -165,7 +166,7 @@ littlepath(var *v)
void
pathinit(void)
{
- var *v;
+ Var *v;
v = gvlook("path");
v->changefn = littlepath;
diff --git a/sys/cmd/rc/x.tab.h b/sys/cmd/rc/x.tab.h
index 0f5b1bd..6b2da03 100644
--- a/sys/cmd/rc/x.tab.h
+++ b/sys/cmd/rc/x.tab.h
@@ -100,7 +100,7 @@
typedef union YYSTYPE
#line 16 "syn.y"
{
- struct tree *tree;
+ struct Tree *tree;
}
/* Line 1529 of yacc.c. */
#line 107 "y.tab.h"
diff --git a/sys/cmd/rc/y.tab.c b/sys/cmd/rc/y.tab.c
index 744b527..a62aadc 100644
--- a/sys/cmd/rc/y.tab.c
+++ b/sys/cmd/rc/y.tab.c
@@ -1,14 +1,14 @@
-/* A Bison parser, made by GNU Bison 2.3. */
+/* A Bison parser, made by GNU Bison 3.8.2. */
-/* Skeleton implementation for Bison's Yacc-like parsers in C
+/* Bison implementation for Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
+ Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -16,9 +16,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@@ -36,6 +34,10 @@
/* C LALR(1) parser skeleton written by Richard Stallman, by
simplifying the original so-called "semantic" parser. */
+/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
+ especially those whose name start with YY_ or yy_. They are
+ private implementation details that can be changed or removed. */
+
/* All symbols defined below should begin with yy or YY, to avoid
infringing on user name space. This should be done even for local
variables, as they might otherwise be expanded by user macros.
@@ -43,11 +45,11 @@
define necessary library symbols; they are noted "INFRINGES ON
USER NAME SPACE" below. */
-/* Identify Bison output. */
-#define YYBISON 1
+/* Identify Bison output, and Bison version. */
+#define YYBISON 30802
-/* Bison version. */
-#define YYBISON_VERSION "2.3"
+/* Bison version string. */
+#define YYBISON_VERSION "3.8.2"
/* Skeleton name. */
#define YYSKELETON_NAME "yacc.c"
@@ -55,150 +57,204 @@
/* Pure parsers. */
#define YYPURE 0
-/* Using locations. */
-#define YYLSP_NEEDED 0
-
-
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- FOR = 258,
- IN = 259,
- WHILE = 260,
- IF = 261,
- NOT = 262,
- TWIDDLE = 263,
- BANG = 264,
- SUBSHELL = 265,
- SWITCH = 266,
- FN = 267,
- WORD = 268,
- REDIR = 269,
- DUP = 270,
- PIPE = 271,
- SUB = 272,
- SIMPLE = 273,
- ARGLIST = 274,
- WORDS = 275,
- BRACE = 276,
- PAREN = 277,
- PCMD = 278,
- PIPEFD = 279,
- OROR = 280,
- ANDAND = 281,
- COUNT = 282
- };
-#endif
-/* Tokens. */
-#define FOR 258
-#define IN 259
-#define WHILE 260
-#define IF 261
-#define NOT 262
-#define TWIDDLE 263
-#define BANG 264
-#define SUBSHELL 265
-#define SWITCH 266
-#define FN 267
-#define WORD 268
-#define REDIR 269
-#define DUP 270
-#define PIPE 271
-#define SUB 272
-#define SIMPLE 273
-#define ARGLIST 274
-#define WORDS 275
-#define BRACE 276
-#define PAREN 277
-#define PCMD 278
-#define PIPEFD 279
-#define OROR 280
-#define ANDAND 281
-#define COUNT 282
-
-
-
-
-/* Copy the first part of user declarations. */
-#line 12 "syn.y"
+/* Push parsers. */
+#define YYPUSH 0
-#include "rc.h"
-#include "fns.h"
+/* Pull parsers. */
+#define YYPULL 1
-/* Enabling traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-/* Enabling verbose error messages. */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-/* Enabling the token table. */
-#ifndef YYTOKEN_TABLE
-# define YYTOKEN_TABLE 0
-#endif
+/* First part of user prologue. */
+#line 12 "sys/cmd/rc/syn.y"
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
-#line 16 "syn.y"
-{
- struct tree *tree;
-}
-/* Line 193 of yacc.c. */
-#line 159 "y.tab.c"
- YYSTYPE;
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
+#include "rc.h"
+#include "fns.h"
+
+#line 76 "sys/cmd/rc/y.tab.c"
+# ifndef YY_CAST
+# ifdef __cplusplus
+# define YY_CAST(Type, Val) static_cast<Type> (Val)
+# define YY_REINTERPRET_CAST(Type, Val) reinterpret_cast<Type> (Val)
+# else
+# define YY_CAST(Type, Val) ((Type) (Val))
+# define YY_REINTERPRET_CAST(Type, Val) ((Type) (Val))
+# endif
+# endif
+# ifndef YY_NULLPTR
+# if defined __cplusplus
+# if 201103L <= __cplusplus
+# define YY_NULLPTR nullptr
+# else
+# define YY_NULLPTR 0
+# endif
+# else
+# define YY_NULLPTR ((void*)0)
+# endif
+# endif
+#include "y.tab.h"
+/* Symbol kind. */
+enum yysymbol_kind_t
+{
+ YYSYMBOL_YYEMPTY = -2,
+ YYSYMBOL_YYEOF = 0, /* "end of file" */
+ YYSYMBOL_YYerror = 1, /* error */
+ YYSYMBOL_YYUNDEF = 2, /* "invalid token" */
+ YYSYMBOL_FOR = 3, /* FOR */
+ YYSYMBOL_IN = 4, /* IN */
+ YYSYMBOL_WHILE = 5, /* WHILE */
+ YYSYMBOL_IF = 6, /* IF */
+ YYSYMBOL_NOT = 7, /* NOT */
+ YYSYMBOL_TWIDDLE = 8, /* TWIDDLE */
+ YYSYMBOL_BANG = 9, /* BANG */
+ YYSYMBOL_SUBSHELL = 10, /* SUBSHELL */
+ YYSYMBOL_SWITCH = 11, /* SWITCH */
+ YYSYMBOL_FN = 12, /* FN */
+ YYSYMBOL_WORD = 13, /* WORD */
+ YYSYMBOL_REDIR = 14, /* REDIR */
+ YYSYMBOL_DUP = 15, /* DUP */
+ YYSYMBOL_PIPE = 16, /* PIPE */
+ YYSYMBOL_SUB = 17, /* SUB */
+ YYSYMBOL_SIMPLE = 18, /* SIMPLE */
+ YYSYMBOL_ARGLIST = 19, /* ARGLIST */
+ YYSYMBOL_WORDS = 20, /* WORDS */
+ YYSYMBOL_BRACE = 21, /* BRACE */
+ YYSYMBOL_PAREN = 22, /* PAREN */
+ YYSYMBOL_PCMD = 23, /* PCMD */
+ YYSYMBOL_PIPEFD = 24, /* PIPEFD */
+ YYSYMBOL_25_ = 25, /* ')' */
+ YYSYMBOL_ANDAND = 26, /* ANDAND */
+ YYSYMBOL_OROR = 27, /* OROR */
+ YYSYMBOL_28_ = 28, /* '^' */
+ YYSYMBOL_29_ = 29, /* '$' */
+ YYSYMBOL_COUNT = 30, /* COUNT */
+ YYSYMBOL_31_ = 31, /* '"' */
+ YYSYMBOL_32_n_ = 32, /* '\n' */
+ YYSYMBOL_33_ = 33, /* ';' */
+ YYSYMBOL_34_ = 34, /* '&' */
+ YYSYMBOL_35_ = 35, /* '{' */
+ YYSYMBOL_36_ = 36, /* '}' */
+ YYSYMBOL_37_ = 37, /* '(' */
+ YYSYMBOL_38_ = 38, /* '=' */
+ YYSYMBOL_39_ = 39, /* '`' */
+ YYSYMBOL_YYACCEPT = 40, /* $accept */
+ YYSYMBOL_rc = 41, /* rc */
+ YYSYMBOL_line = 42, /* line */
+ YYSYMBOL_body = 43, /* body */
+ YYSYMBOL_cmdsa = 44, /* cmdsa */
+ YYSYMBOL_cmdsan = 45, /* cmdsan */
+ YYSYMBOL_brace = 46, /* brace */
+ YYSYMBOL_paren = 47, /* paren */
+ YYSYMBOL_assign = 48, /* assign */
+ YYSYMBOL_epilog = 49, /* epilog */
+ YYSYMBOL_redir = 50, /* redir */
+ YYSYMBOL_cmd = 51, /* cmd */
+ YYSYMBOL_52_1 = 52, /* $@1 */
+ YYSYMBOL_53_2 = 53, /* $@2 */
+ YYSYMBOL_54_3 = 54, /* $@3 */
+ YYSYMBOL_55_4 = 55, /* $@4 */
+ YYSYMBOL_56_5 = 56, /* $@5 */
+ YYSYMBOL_57_6 = 57, /* $@6 */
+ YYSYMBOL_simple = 58, /* simple */
+ YYSYMBOL_first = 59, /* first */
+ YYSYMBOL_word = 60, /* word */
+ YYSYMBOL_comword = 61, /* comword */
+ YYSYMBOL_keyword = 62, /* keyword */
+ YYSYMBOL_words = 63 /* words */
+};
+typedef enum yysymbol_kind_t yysymbol_kind_t;
-/* Copy the second part of user declarations. */
-/* Line 216 of yacc.c. */
-#line 172 "y.tab.c"
#ifdef short
# undef short
#endif
-#ifdef YYTYPE_UINT8
-typedef YYTYPE_UINT8 yytype_uint8;
-#else
-typedef unsigned char yytype_uint8;
+/* On compilers that do not define __PTRDIFF_MAX__ etc., make sure
+ <limits.h> and (if available) <stdint.h> are included
+ so that the code can choose integer types of a good width. */
+
+#ifndef __PTRDIFF_MAX__
+# include <limits.h> /* INFRINGES ON USER NAME SPACE */
+# if defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
+# include <stdint.h> /* INFRINGES ON USER NAME SPACE */
+# define YY_STDINT_H
+# endif
#endif
-#ifdef YYTYPE_INT8
-typedef YYTYPE_INT8 yytype_int8;
-#elif (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+/* Narrow types that promote to a signed type and that can represent a
+ signed or unsigned integer of at least N bits. In tables they can
+ save space and decrease cache pressure. Promoting to a signed type
+ helps avoid bugs in integer arithmetic. */
+
+#ifdef __INT_LEAST8_MAX__
+typedef __INT_LEAST8_TYPE__ yytype_int8;
+#elif defined YY_STDINT_H
+typedef int_least8_t yytype_int8;
+#else
typedef signed char yytype_int8;
+#endif
+
+#ifdef __INT_LEAST16_MAX__
+typedef __INT_LEAST16_TYPE__ yytype_int16;
+#elif defined YY_STDINT_H
+typedef int_least16_t yytype_int16;
#else
-typedef short int yytype_int8;
+typedef short yytype_int16;
#endif
-#ifdef YYTYPE_UINT16
-typedef YYTYPE_UINT16 yytype_uint16;
+/* Work around bug in HP-UX 11.23, which defines these macros
+ incorrectly for preprocessor constants. This workaround can likely
+ be removed in 2023, as HPE has promised support for HP-UX 11.23
+ (aka HP-UX 11i v2) only through the end of 2022; see Table 2 of
+ <https://h20195.www2.hpe.com/V2/getpdf.aspx/4AA4-7673ENW.pdf>. */
+#ifdef __hpux
+# undef UINT_LEAST8_MAX
+# undef UINT_LEAST16_MAX
+# define UINT_LEAST8_MAX 255
+# define UINT_LEAST16_MAX 65535
+#endif
+
+#if defined __UINT_LEAST8_MAX__ && __UINT_LEAST8_MAX__ <= __INT_MAX__
+typedef __UINT_LEAST8_TYPE__ yytype_uint8;
+#elif (!defined __UINT_LEAST8_MAX__ && defined YY_STDINT_H \
+ && UINT_LEAST8_MAX <= INT_MAX)
+typedef uint_least8_t yytype_uint8;
+#elif !defined __UINT_LEAST8_MAX__ && UCHAR_MAX <= INT_MAX
+typedef unsigned char yytype_uint8;
#else
-typedef unsigned short int yytype_uint16;
+typedef short yytype_uint8;
#endif
-#ifdef YYTYPE_INT16
-typedef YYTYPE_INT16 yytype_int16;
+#if defined __UINT_LEAST16_MAX__ && __UINT_LEAST16_MAX__ <= __INT_MAX__
+typedef __UINT_LEAST16_TYPE__ yytype_uint16;
+#elif (!defined __UINT_LEAST16_MAX__ && defined YY_STDINT_H \
+ && UINT_LEAST16_MAX <= INT_MAX)
+typedef uint_least16_t yytype_uint16;
+#elif !defined __UINT_LEAST16_MAX__ && USHRT_MAX <= INT_MAX
+typedef unsigned short yytype_uint16;
#else
-typedef short int yytype_int16;
+typedef int yytype_uint16;
+#endif
+
+#ifndef YYPTRDIFF_T
+# if defined __PTRDIFF_TYPE__ && defined __PTRDIFF_MAX__
+# define YYPTRDIFF_T __PTRDIFF_TYPE__
+# define YYPTRDIFF_MAXIMUM __PTRDIFF_MAX__
+# elif defined PTRDIFF_MAX
+# ifndef ptrdiff_t
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# endif
+# define YYPTRDIFF_T ptrdiff_t
+# define YYPTRDIFF_MAXIMUM PTRDIFF_MAX
+# else
+# define YYPTRDIFF_T long
+# define YYPTRDIFF_MAXIMUM LONG_MAX
+# endif
#endif
#ifndef YYSIZE_T
@@ -206,55 +262,106 @@ typedef short int yytype_int16;
# define YYSIZE_T __SIZE_TYPE__
# elif defined size_t
# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__
# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
# define YYSIZE_T size_t
# else
-# define YYSIZE_T unsigned int
+# define YYSIZE_T unsigned
# endif
#endif
-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
+#define YYSIZE_MAXIMUM \
+ YY_CAST (YYPTRDIFF_T, \
+ (YYPTRDIFF_MAXIMUM < YY_CAST (YYSIZE_T, -1) \
+ ? YYPTRDIFF_MAXIMUM \
+ : YY_CAST (YYSIZE_T, -1)))
+
+#define YYSIZEOF(X) YY_CAST (YYPTRDIFF_T, sizeof (X))
+
+
+/* Stored state numbers (used for stacks). */
+typedef yytype_int8 yy_state_t;
+
+/* State numbers in computations. */
+typedef int yy_state_fast_t;
#ifndef YY_
# if defined YYENABLE_NLS && YYENABLE_NLS
# if ENABLE_NLS
# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-# define YY_(msgid) dgettext ("bison-runtime", msgid)
+# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
# endif
# endif
# ifndef YY_
-# define YY_(msgid) msgid
+# define YY_(Msgid) Msgid
+# endif
+#endif
+
+
+#ifndef YY_ATTRIBUTE_PURE
+# if defined __GNUC__ && 2 < __GNUC__ + (96 <= __GNUC_MINOR__)
+# define YY_ATTRIBUTE_PURE __attribute__ ((__pure__))
+# else
+# define YY_ATTRIBUTE_PURE
+# endif
+#endif
+
+#ifndef YY_ATTRIBUTE_UNUSED
+# if defined __GNUC__ && 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
+# define YY_ATTRIBUTE_UNUSED __attribute__ ((__unused__))
+# else
+# define YY_ATTRIBUTE_UNUSED
# endif
#endif
/* Suppress unused-variable warnings by "using" E. */
#if ! defined lint || defined __GNUC__
-# define YYUSE(e) ((void) (e))
+# define YY_USE(E) ((void) (E))
#else
-# define YYUSE(e) /* empty */
+# define YY_USE(E) /* empty */
#endif
-/* Identity function, used to suppress warnings about constant conditions. */
-#ifndef lint
-# define YYID(n) (n)
-#else
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int i)
+/* Suppress an incorrect diagnostic about yylval being uninitialized. */
+#if defined __GNUC__ && ! defined __ICC && 406 <= __GNUC__ * 100 + __GNUC_MINOR__
+# if __GNUC__ * 100 + __GNUC_MINOR__ < 407
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")
+# else
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"") \
+ _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
+# endif
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
+ _Pragma ("GCC diagnostic pop")
#else
-static int
-YYID (i)
- int i;
+# define YY_INITIAL_VALUE(Value) Value
#endif
-{
- return i;
-}
+#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+# define YY_IGNORE_MAYBE_UNINITIALIZED_END
#endif
+#ifndef YY_INITIAL_VALUE
+# define YY_INITIAL_VALUE(Value) /* Nothing. */
+#endif
+
+#if defined __cplusplus && defined __GNUC__ && ! defined __ICC && 6 <= __GNUC__
+# define YY_IGNORE_USELESS_CAST_BEGIN \
+ _Pragma ("GCC diagnostic push") \
+ _Pragma ("GCC diagnostic ignored \"-Wuseless-cast\"")
+# define YY_IGNORE_USELESS_CAST_END \
+ _Pragma ("GCC diagnostic pop")
+#endif
+#ifndef YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_BEGIN
+# define YY_IGNORE_USELESS_CAST_END
+#endif
+
-#if ! defined yyoverflow || YYERROR_VERBOSE
+#define YY_ASSERT(E) ((void) (0 && (E)))
+
+#if !defined yyoverflow
/* The parser invokes alloca or malloc; define the necessary symbols. */
@@ -271,11 +378,11 @@ YYID (i)
# define alloca _alloca
# else
# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
+ /* Use EXIT_SUCCESS as a witness for stdlib.h. */
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
# endif
# endif
# endif
@@ -283,8 +390,8 @@ YYID (i)
# endif
# ifdef YYSTACK_ALLOC
- /* Pacify GCC's `empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
+ /* Pacify GCC's 'empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
# ifndef YYSTACK_ALLOC_MAXIMUM
/* The OS might guarantee only one guard page at the bottom of the stack,
and a page size can be as small as 4096 bytes. So we cannot safely
@@ -298,88 +405,89 @@ YYID (i)
# ifndef YYSTACK_ALLOC_MAXIMUM
# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
# endif
-# if (defined __cplusplus && ! defined _STDLIB_H \
+# if (defined __cplusplus && ! defined EXIT_SUCCESS \
&& ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
+ && (defined YYFREE || defined free)))
# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef _STDLIB_H
-# define _STDLIB_H 1
+# ifndef EXIT_SUCCESS
+# define EXIT_SUCCESS 0
# endif
# endif
# ifndef YYMALLOC
# define YYMALLOC malloc
-# if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined malloc && ! defined EXIT_SUCCESS
void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# ifndef YYFREE
# define YYFREE free
-# if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
+# if ! defined free && ! defined EXIT_SUCCESS
void free (void *); /* INFRINGES ON USER NAME SPACE */
# endif
# endif
# endif
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-
+#endif /* !defined yyoverflow */
#if (! defined yyoverflow \
&& (! defined __cplusplus \
- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
+ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
/* A type that is properly aligned for any stack member. */
union yyalloc
{
- yytype_int16 yyss;
- YYSTYPE yyvs;
- };
+ yy_state_t yyss_alloc;
+ YYSTYPE yyvs_alloc;
+};
/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
+# define YYSTACK_GAP_MAXIMUM (YYSIZEOF (union yyalloc) - 1)
/* The size of an array large to enough to hold all stacks, each with
N elements. */
# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
+ ((N) * (YYSIZEOF (yy_state_t) + YYSIZEOF (YYSTYPE)) \
+ YYSTACK_GAP_MAXIMUM)
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (YYID (0))
-# endif
-# endif
+# define YYCOPY_NEEDED 1
/* Relocate STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
elements in the stack, and YYPTR gives the new location of the
stack. Advance YYPTR to a properly aligned location for the next
stack. */
-# define YYSTACK_RELOCATE(Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack, Stack, yysize); \
- Stack = &yyptr->Stack; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (YYID (0))
+# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
+ do \
+ { \
+ YYPTRDIFF_T yynewbytes; \
+ YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
+ Stack = &yyptr->Stack_alloc; \
+ yynewbytes = yystacksize * YYSIZEOF (*Stack) + YYSTACK_GAP_MAXIMUM; \
+ yyptr += yynewbytes / YYSIZEOF (*yyptr); \
+ } \
+ while (0)
#endif
+#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
+/* Copy COUNT objects from SRC to DST. The source and destination do
+ not overlap. */
+# ifndef YYCOPY
+# if defined __GNUC__ && 1 < __GNUC__
+# define YYCOPY(Dst, Src, Count) \
+ __builtin_memcpy (Dst, Src, YY_CAST (YYSIZE_T, (Count)) * sizeof (*(Src)))
+# else
+# define YYCOPY(Dst, Src, Count) \
+ do \
+ { \
+ YYPTRDIFF_T yyi; \
+ for (yyi = 0; yyi < (Count); yyi++) \
+ (Dst)[yyi] = (Src)[yyi]; \
+ } \
+ while (0)
+# endif
+# endif
+#endif /* !YYCOPY_NEEDED */
+
/* YYFINAL -- State number of the termination state. */
#define YYFINAL 62
/* YYLAST -- Last index in YYTABLE. */
@@ -391,23 +499,28 @@ union yyalloc
#define YYNNTS 24
/* YYNRULES -- Number of rules. */
#define YYNRULES 71
-/* YYNRULES -- Number of states. */
+/* YYNSTATES -- Number of states. */
#define YYNSTATES 116
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
-#define YYUNDEFTOK 2
+/* YYMAXUTOK -- Last valid token kind. */
#define YYMAXUTOK 282
-#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
-static const yytype_uint8 yytranslate[] =
+/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex, with out-of-bounds checking. */
+#define YYTRANSLATE(YYX) \
+ (0 <= (YYX) && (YYX) <= YYMAXUTOK \
+ ? YY_CAST (yysymbol_kind_t, yytranslate[YYX]) \
+ : YYSYMBOL_YYUNDEF)
+
+/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
+ as returned by yylex. */
+static const yytype_int8 yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
32, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 30, 2, 29, 2, 34, 2,
+ 2, 2, 2, 2, 31, 2, 29, 2, 34, 2,
37, 25, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 33,
2, 38, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -432,52 +545,12 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 26, 27, 31
+ 26, 27, 30
};
#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
-static const yytype_uint8 yyprhs[] =
-{
- 0, 0, 3, 4, 7, 9, 12, 14, 17, 20,
- 23, 25, 28, 32, 36, 40, 41, 44, 47, 49,
- 50, 53, 54, 59, 60, 65, 66, 75, 76, 83,
- 84, 89, 90, 95, 97, 101, 105, 109, 113, 116,
- 119, 122, 125, 129, 132, 134, 137, 140, 142, 146,
- 148, 150, 154, 157, 163, 166, 169, 171, 174, 178,
- 181, 183, 185, 187, 189, 191, 193, 195, 197, 199,
- 201, 202
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const yytype_int8 yyrhs[] =
-{
- 41, 0, -1, -1, 42, 32, -1, 51, -1, 44,
- 42, -1, 51, -1, 45, 43, -1, 51, 33, -1,
- 51, 34, -1, 44, -1, 51, 32, -1, 35, 43,
- 36, -1, 37, 43, 25, -1, 59, 38, 60, -1,
- -1, 50, 49, -1, 14, 60, -1, 15, -1, -1,
- 46, 49, -1, -1, 6, 47, 52, 51, -1, -1,
- 6, 7, 53, 51, -1, -1, 3, 37, 60, 4,
- 63, 25, 54, 51, -1, -1, 3, 37, 60, 25,
- 55, 51, -1, -1, 5, 47, 56, 51, -1, -1,
- 11, 60, 57, 46, -1, 58, -1, 8, 60, 63,
- -1, 51, 27, 51, -1, 51, 26, 51, -1, 51,
- 16, 51, -1, 50, 51, -1, 48, 51, -1, 9,
- 51, -1, 10, 51, -1, 12, 63, 46, -1, 12,
- 63, -1, 59, -1, 58, 60, -1, 58, 50, -1,
- 61, -1, 59, 28, 60, -1, 62, -1, 61, -1,
- 60, 28, 60, -1, 29, 60, -1, 29, 60, 17,
- 63, 25, -1, 30, 60, -1, 31, 60, -1, 13,
- -1, 39, 46, -1, 37, 63, 25, -1, 14, 46,
- -1, 3, -1, 4, -1, 5, -1, 6, -1, 7,
- -1, 8, -1, 9, -1, 10, -1, 11, -1, 12,
- -1, -1, 63, 60, -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const yytype_uint8 yyrline[] =
+/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
+static const yytype_int8 yyrline[] =
{
0, 24, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
@@ -490,90 +563,47 @@ static const yytype_uint8 yyrline[] =
};
#endif
-#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
+/** Accessing symbol of state STATE. */
+#define YY_ACCESSING_SYMBOL(State) YY_CAST (yysymbol_kind_t, yystos[State])
+
+#if YYDEBUG || 0
+/* The user-facing name of the symbol whose (internal) number is
+ YYSYMBOL. No bounds checking. */
+static const char *yysymbol_name (yysymbol_kind_t yysymbol) YY_ATTRIBUTE_UNUSED;
+
/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
First, the terminals, then, starting at YYNTOKENS, nonterminals. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "FOR", "IN", "WHILE", "IF", "NOT",
- "TWIDDLE", "BANG", "SUBSHELL", "SWITCH", "FN", "WORD", "REDIR", "DUP",
- "PIPE", "SUB", "SIMPLE", "ARGLIST", "WORDS", "BRACE", "PAREN", "PCMD",
- "PIPEFD", "')'", "OROR", "ANDAND", "'^'", "'$'", "'\"'", "COUNT",
- "'\\n'", "';'", "'&'", "'{'", "'}'", "'('", "'='", "'`'", "$accept",
- "rc", "line", "body", "cmdsa", "cmdsan", "brace", "paren", "assign",
- "epilog", "redir", "cmd", "@1", "@2", "@3", "@4", "@5", "@6", "simple",
- "first", "word", "comword", "keyword", "words", 0
+ "\"end of file\"", "error", "\"invalid token\"", "FOR", "IN", "WHILE",
+ "IF", "NOT", "TWIDDLE", "BANG", "SUBSHELL", "SWITCH", "FN", "WORD",
+ "REDIR", "DUP", "PIPE", "SUB", "SIMPLE", "ARGLIST", "WORDS", "BRACE",
+ "PAREN", "PCMD", "PIPEFD", "')'", "ANDAND", "OROR", "'^'", "'$'",
+ "COUNT", "'\"'", "'\\n'", "';'", "'&'", "'{'", "'}'", "'('", "'='",
+ "'`'", "$accept", "rc", "line", "body", "cmdsa", "cmdsan", "brace",
+ "paren", "assign", "epilog", "redir", "cmd", "$@1", "$@2", "$@3", "$@4",
+ "$@5", "$@6", "simple", "first", "word", "comword", "keyword", "words", YY_NULLPTR
};
-#endif
-# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
- token YYLEX-NUM. */
-static const yytype_uint16 yytoknum[] =
+static const char *
+yysymbol_name (yysymbol_kind_t yysymbol)
{
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
- 275, 276, 277, 278, 279, 41, 280, 281, 94, 36,
- 34, 282, 10, 59, 38, 123, 125, 40, 61, 96
-};
-# endif
+ return yytname[yysymbol];
+}
+#endif
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] =
-{
- 0, 40, 41, 41, 42, 42, 43, 43, 44, 44,
- 45, 45, 46, 47, 48, 49, 49, 50, 50, 51,
- 51, 52, 51, 53, 51, 54, 51, 55, 51, 56,
- 51, 57, 51, 51, 51, 51, 51, 51, 51, 51,
- 51, 51, 51, 51, 58, 58, 58, 59, 59, 60,
- 60, 60, 61, 61, 61, 61, 61, 61, 61, 61,
- 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
- 63, 63
-};
+#define YYPACT_NINF (-30)
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
-{
- 0, 2, 0, 2, 1, 2, 1, 2, 2, 2,
- 1, 2, 3, 3, 3, 0, 2, 2, 1, 0,
- 2, 0, 4, 0, 4, 0, 8, 0, 6, 0,
- 4, 0, 4, 1, 3, 3, 3, 3, 2, 2,
- 2, 2, 3, 2, 1, 2, 2, 1, 3, 1,
- 1, 3, 2, 5, 2, 2, 1, 2, 3, 2,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 0, 2
-};
+#define yypact_value_is_default(Yyn) \
+ ((Yyn) == YYPACT_NINF)
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
- STATE-NUM when YYTABLE doesn't specify something else to do. Zero
- means the default is an error. */
-static const yytype_uint8 yydefact[] =
-{
- 19, 0, 0, 0, 0, 19, 19, 0, 70, 56,
- 0, 18, 0, 0, 0, 19, 70, 0, 0, 0,
- 19, 15, 19, 19, 4, 33, 44, 47, 0, 19,
- 29, 23, 21, 60, 61, 62, 63, 64, 65, 66,
- 67, 68, 69, 0, 70, 50, 49, 40, 41, 31,
- 43, 59, 17, 52, 54, 55, 0, 10, 19, 6,
- 0, 57, 1, 3, 5, 0, 20, 15, 39, 38,
- 19, 19, 19, 8, 9, 46, 45, 0, 0, 0,
- 0, 19, 19, 19, 0, 34, 0, 42, 71, 70,
- 12, 7, 11, 58, 16, 37, 36, 35, 48, 14,
- 70, 27, 13, 30, 24, 22, 51, 32, 0, 0,
- 19, 53, 25, 28, 19, 26
-};
+#define YYTABLE_NINF (-3)
-/* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int8 yydefgoto[] =
-{
- -1, 18, 19, 56, 57, 58, 21, 30, 22, 66,
- 23, 59, 83, 82, 114, 110, 81, 86, 25, 26,
- 88, 27, 46, 50
-};
+#define yytable_value_is_error(Yyn) \
+ 0
/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
STATE-NUM. */
-#define YYPACT_NINF -30
static const yytype_int16 yypact[] =
{
121, -29, -23, -6, 295, 307, 307, 295, -30, -30,
@@ -590,6 +620,25 @@ static const yytype_int16 yypact[] =
307, -30, -30, 36, 307, 36
};
+/* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
+ Performed when YYTABLE does not specify something else to do. Zero
+ means the default is an error. */
+static const yytype_int8 yydefact[] =
+{
+ 19, 0, 0, 0, 0, 19, 19, 0, 70, 56,
+ 0, 18, 0, 0, 0, 19, 70, 0, 0, 0,
+ 19, 15, 19, 19, 4, 33, 44, 47, 0, 19,
+ 29, 23, 21, 60, 61, 62, 63, 64, 65, 66,
+ 67, 68, 69, 0, 70, 50, 49, 40, 41, 31,
+ 43, 59, 17, 52, 55, 54, 0, 10, 19, 6,
+ 0, 57, 1, 3, 5, 0, 20, 15, 39, 38,
+ 19, 19, 19, 8, 9, 46, 45, 0, 0, 0,
+ 0, 19, 19, 19, 0, 34, 0, 42, 71, 70,
+ 12, 7, 11, 58, 16, 37, 35, 36, 48, 14,
+ 70, 27, 13, 30, 24, 22, 51, 32, 0, 0,
+ 19, 53, 25, 28, 19, 26
+};
+
/* YYPGOTO[NTERM-NUM]. */
static const yytype_int8 yypgoto[] =
{
@@ -598,11 +647,17 @@ static const yytype_int8 yypgoto[] =
31, 14, -30, -14
};
-/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule which
- number is the opposite. If zero, do what YYDEFACT says.
- If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -3
+/* YYDEFGOTO[NTERM-NUM]. */
+static const yytype_int8 yydefgoto[] =
+{
+ 0, 18, 19, 56, 57, 58, 21, 30, 22, 66,
+ 23, 59, 83, 82, 114, 110, 81, 86, 25, 26,
+ 88, 27, 46, 50
+};
+
+/* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
+ positive, shift that token. If negative, reduce the rule whose
+ number is the opposite. If YYTABLE_NINF, syntax error. */
static const yytype_int8 yytable[] =
{
24, 31, 60, 67, 80, 47, 48, 75, 28, 77,
@@ -681,9 +736,9 @@ static const yytype_int8 yycheck[] =
-1, -1, 35, -1, 37, -1, 39
};
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
-static const yytype_uint8 yystos[] =
+/* YYSTOS[STATE-NUM] -- The symbol kind of the accessing symbol of
+ state STATE-NUM. */
+static const yytype_int8 yystos[] =
{
0, 3, 5, 6, 8, 9, 10, 11, 12, 13,
14, 15, 29, 30, 31, 35, 37, 39, 41, 42,
@@ -699,95 +754,67 @@ static const yytype_uint8 yystos[] =
55, 25, 25, 51, 54, 51
};
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
-
-/* Like YYERROR except do call yyerror. This remains here temporarily
- to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. */
+/* YYR1[RULE-NUM] -- Symbol kind of the left-hand side of rule RULE-NUM. */
+static const yytype_int8 yyr1[] =
+{
+ 0, 40, 41, 41, 42, 42, 43, 43, 44, 44,
+ 45, 45, 46, 47, 48, 49, 49, 50, 50, 51,
+ 51, 52, 51, 53, 51, 54, 51, 55, 51, 56,
+ 51, 57, 51, 51, 51, 51, 51, 51, 51, 51,
+ 51, 51, 51, 51, 58, 58, 58, 59, 59, 60,
+ 60, 60, 61, 61, 61, 61, 61, 61, 61, 61,
+ 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
+ 63, 63
+};
-#define YYFAIL goto yyerrlab
+/* YYR2[RULE-NUM] -- Number of symbols on the right-hand side of rule RULE-NUM. */
+static const yytype_int8 yyr2[] =
+{
+ 0, 2, 0, 2, 1, 2, 1, 2, 2, 2,
+ 1, 2, 3, 3, 3, 0, 2, 2, 1, 0,
+ 2, 0, 4, 0, 4, 0, 8, 0, 6, 0,
+ 4, 0, 4, 1, 3, 3, 3, 3, 2, 2,
+ 2, 2, 3, 2, 1, 2, 2, 1, 3, 1,
+ 1, 3, 2, 5, 2, 2, 1, 2, 3, 2,
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
+ 0, 2
+};
-#define YYRECOVERING() (!!yyerrstatus)
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY && yylen == 1) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- yytoken = YYTRANSLATE (yychar); \
- YYPOPSTACK (1); \
- goto yybackup; \
- } \
- else \
- { \
- yyerror (YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (YYID (0))
-
-
-#define YYTERROR 1
-#define YYERRCODE 256
-
-
-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
- If N is 0, then set CURRENT to the empty location which ends
- the previous symbol: RHS[0] (always defined). */
-
-#define YYRHSLOC(Rhs, K) ((Rhs)[K])
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
- do \
- if (YYID (N)) \
- { \
- (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
- (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
- (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
- (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
- } \
- else \
- { \
- (Current).first_line = (Current).last_line = \
- YYRHSLOC (Rhs, 0).last_line; \
- (Current).first_column = (Current).last_column = \
- YYRHSLOC (Rhs, 0).last_column; \
- } \
- while (YYID (0))
-#endif
+enum { YYENOMEM = -2 };
+#define yyerrok (yyerrstatus = 0)
+#define yyclearin (yychar = YYEMPTY)
-/* YY_LOCATION_PRINT -- Print the location on the stream.
- This macro was not mandated originally: define only if we know
- we won't break user code: when these are the locations we know. */
+#define YYACCEPT goto yyacceptlab
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrorlab
+#define YYNOMEM goto yyexhaustedlab
-#ifndef YY_LOCATION_PRINT
-# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
-# define YY_LOCATION_PRINT(File, Loc) \
- fprintf (File, "%d.%d-%d.%d", \
- (Loc).first_line, (Loc).first_column, \
- (Loc).last_line, (Loc).last_column)
-# else
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-# endif
-#endif
+#define YYRECOVERING() (!!yyerrstatus)
-/* YYLEX -- calling `yylex' with the right arguments. */
+#define YYBACKUP(Token, Value) \
+ do \
+ if (yychar == YYEMPTY) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ YYPOPSTACK (yylen); \
+ yystate = *yyssp; \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror (YY_("syntax error: cannot back up")); \
+ YYERROR; \
+ } \
+ while (0)
+
+/* Backward compatibility with an undocumented macro.
+ Use YYerror or YYUNDEF. */
+#define YYERRCODE YYUNDEF
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (YYLEX_PARAM)
-#else
-# define YYLEX yylex ()
-#endif
/* Enable debugging if requested. */
#if YYDEBUG
@@ -797,80 +824,58 @@ while (YYID (0))
# define YYFPRINTF fprintf
# endif
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (YYID (0))
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (YYID (0))
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
-
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
-#else
+# define YYDPRINTF(Args) \
+do { \
+ if (yydebug) \
+ YYFPRINTF Args; \
+} while (0)
+
+
+
+
+# define YY_SYMBOL_PRINT(Title, Kind, Value, Location) \
+do { \
+ if (yydebug) \
+ { \
+ YYFPRINTF (stderr, "%s ", Title); \
+ yy_symbol_print (stderr, \
+ Kind, Value); \
+ YYFPRINTF (stderr, "\n"); \
+ } \
+} while (0)
+
+
+/*-----------------------------------.
+| Print this symbol's value on YYO. |
+`-----------------------------------*/
+
static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
-#endif
+yy_symbol_value_print (FILE *yyo,
+ yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
{
+ FILE *yyoutput = yyo;
+ YY_USE (yyoutput);
if (!yyvaluep)
return;
-# ifdef YYPRINT
- if (yytype < YYNTOKENS)
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# else
- YYUSE (yyoutput);
-# endif
- switch (yytype)
- {
- default:
- break;
- }
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ YY_USE (yykind);
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
}
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
+/*---------------------------.
+| Print this symbol on YYO. |
+`---------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
-#endif
+yy_symbol_print (FILE *yyo,
+ yysymbol_kind_t yykind, YYSTYPE const * const yyvaluep)
{
- if (yytype < YYNTOKENS)
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
- else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
+ YYFPRINTF (yyo, "%s %s (",
+ yykind < YYNTOKENS ? "token" : "nterm", yysymbol_name (yykind));
- yy_symbol_value_print (yyoutput, yytype, yyvaluep);
- YYFPRINTF (yyoutput, ")");
+ yy_symbol_value_print (yyo, yykind, yyvaluep);
+ YYFPRINTF (yyo, ")");
}
/*------------------------------------------------------------------.
@@ -878,80 +883,68 @@ yy_symbol_print (yyoutput, yytype, yyvaluep)
| TOP (included). |
`------------------------------------------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
-#else
static void
-yy_stack_print (bottom, top)
- yytype_int16 *bottom;
- yytype_int16 *top;
-#endif
+yy_stack_print (yy_state_t *yybottom, yy_state_t *yytop)
{
YYFPRINTF (stderr, "Stack now");
- for (; bottom <= top; ++bottom)
- YYFPRINTF (stderr, " %d", *bottom);
+ for (; yybottom <= yytop; yybottom++)
+ {
+ int yybot = *yybottom;
+ YYFPRINTF (stderr, " %d", yybot);
+ }
YYFPRINTF (stderr, "\n");
}
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (YYID (0))
+# define YY_STACK_PRINT(Bottom, Top) \
+do { \
+ if (yydebug) \
+ yy_stack_print ((Bottom), (Top)); \
+} while (0)
/*------------------------------------------------.
| Report that the YYRULE is going to be reduced. |
`------------------------------------------------*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
-#else
static void
-yy_reduce_print (yyvsp, yyrule)
- YYSTYPE *yyvsp;
- int yyrule;
-#endif
+yy_reduce_print (yy_state_t *yyssp, YYSTYPE *yyvsp,
+ int yyrule)
{
+ int yylno = yyrline[yyrule];
int yynrhs = yyr2[yyrule];
int yyi;
- unsigned long int yylno = yyrline[yyrule];
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
+ YYFPRINTF (stderr, "Reducing stack by rule %d (line %d):\n",
+ yyrule - 1, yylno);
/* The symbols being reduced. */
for (yyi = 0; yyi < yynrhs; yyi++)
{
- fprintf (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- );
- fprintf (stderr, "\n");
+ YYFPRINTF (stderr, " $%d = ", yyi + 1);
+ yy_symbol_print (stderr,
+ YY_ACCESSING_SYMBOL (+yyssp[yyi + 1 - yynrhs]),
+ &yyvsp[(yyi + 1) - (yynrhs)]);
+ YYFPRINTF (stderr, "\n");
}
}
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyvsp, Rule); \
-} while (YYID (0))
+# define YY_REDUCE_PRINT(Rule) \
+do { \
+ if (yydebug) \
+ yy_reduce_print (yyssp, yyvsp, Rule); \
+} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
int yydebug;
#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
+# define YYDPRINTF(Args) ((void) 0)
+# define YY_SYMBOL_PRINT(Title, Kind, Value, Location)
# define YY_STACK_PRINT(Bottom, Top)
# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */
/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
+#ifndef YYINITDEPTH
# define YYINITDEPTH 200
#endif
@@ -966,478 +959,219 @@ int yydebug;
# define YYMAXDEPTH 10000
#endif
-
-
-#if YYERROR_VERBOSE
-
-# ifndef yystrlen
-# if defined __GLIBC__ && defined _STRING_H
-# define yystrlen strlen
-# else
-/* Return the length of YYSTR. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static YYSIZE_T
-yystrlen (const char *yystr)
-#else
-static YYSIZE_T
-yystrlen (yystr)
- const char *yystr;
-#endif
-{
- YYSIZE_T yylen;
- for (yylen = 0; yystr[yylen]; yylen++)
- continue;
- return yylen;
-}
-# endif
-# endif
-
-# ifndef yystpcpy
-# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
-# define yystpcpy stpcpy
-# else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
- YYDEST. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static char *
-yystpcpy (char *yydest, const char *yysrc)
-#else
-static char *
-yystpcpy (yydest, yysrc)
- char *yydest;
- const char *yysrc;
-#endif
-{
- char *yyd = yydest;
- const char *yys = yysrc;
-
- while ((*yyd++ = *yys++) != '\0')
- continue;
-
- return yyd - 1;
-}
-# endif
-# endif
-
-# ifndef yytnamerr
-/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
- quotes and backslashes, so that it's suitable for yyerror. The
- heuristic is that double-quoting is unnecessary unless the string
- contains an apostrophe, a comma, or backslash (other than
- backslash-backslash). YYSTR is taken from yytname. If YYRES is
- null, do not copy; instead, return the length of what the result
- would have been. */
-static YYSIZE_T
-yytnamerr (char *yyres, const char *yystr)
-{
- if (*yystr == '"')
- {
- YYSIZE_T yyn = 0;
- char const *yyp = yystr;
-
- for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
- do_not_strip_quotes: ;
- }
- if (! yyres)
- return yystrlen (yystr);
- return yystpcpy (yyres, yystr) - yyres;
-}
-# endif
-/* Copy into YYRESULT an error message about the unexpected token
- YYCHAR while in state YYSTATE. Return the number of bytes copied,
- including the terminating null byte. If YYRESULT is null, do not
- copy anything; just return the number of bytes that would be
- copied. As a special case, return 0 if an ordinary "syntax error"
- message will do. Return YYSIZE_MAXIMUM if overflow occurs during
- size calculation. */
-static YYSIZE_T
-yysyntax_error (char *yyresult, int yystate, int yychar)
-{
- int yyn = yypact[yystate];
- if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
- return 0;
- else
- {
- int yytype = YYTRANSLATE (yychar);
- YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
- YYSIZE_T yysize = yysize0;
- YYSIZE_T yysize1;
- int yysize_overflow = 0;
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- int yyx;
-
-# if 0
- /* This is so xgettext sees the translatable formats that are
- constructed on the fly. */
- YY_("syntax error, unexpected %s");
- YY_("syntax error, unexpected %s, expecting %s");
- YY_("syntax error, unexpected %s, expecting %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s");
- YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
-# endif
- char *yyfmt;
- char const *yyf;
- static char const yyunexpected[] = "syntax error, unexpected %s";
- static char const yyexpecting[] = ", expecting %s";
- static char const yyor[] = " or %s";
- char yyformat[sizeof yyunexpected
- + sizeof yyexpecting - 1
- + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
- * (sizeof yyor - 1))];
- char const *yyprefix = yyexpecting;
-
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
-
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yycount = 1;
-
- yyarg[0] = yytname[yytype];
- yyfmt = yystpcpy (yyformat, yyunexpected);
-
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
- {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
- {
- yycount = 1;
- yysize = yysize0;
- yyformat[sizeof yyunexpected - 1] = '\0';
- break;
- }
- yyarg[yycount++] = yytname[yyx];
- yysize1 = yysize + yytnamerr (0, yytname[yyx]);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
- yyfmt = yystpcpy (yyfmt, yyprefix);
- yyprefix = yyor;
- }
-
- yyf = YY_(yyformat);
- yysize1 = yysize + yystrlen (yyf);
- yysize_overflow |= (yysize1 < yysize);
- yysize = yysize1;
-
- if (yysize_overflow)
- return YYSIZE_MAXIMUM;
-
- if (yyresult)
- {
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- char *yyp = yyresult;
- int yyi = 0;
- while ((*yyp = *yyf) != '\0')
- {
- if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
- {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyf += 2;
- }
- else
- {
- yyp++;
- yyf++;
- }
- }
- }
- return yysize;
- }
-}
-#endif /* YYERROR_VERBOSE */
-
/*-----------------------------------------------.
| Release the memory associated to this symbol. |
`-----------------------------------------------*/
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
-#else
static void
-yydestruct (yymsg, yytype, yyvaluep)
- const char *yymsg;
- int yytype;
- YYSTYPE *yyvaluep;
-#endif
+yydestruct (const char *yymsg,
+ yysymbol_kind_t yykind, YYSTYPE *yyvaluep)
{
- YYUSE (yyvaluep);
-
+ YY_USE (yyvaluep);
if (!yymsg)
yymsg = "Deleting";
- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+ YY_SYMBOL_PRINT (yymsg, yykind, yyvaluep, yylocationp);
- switch (yytype)
- {
-
- default:
- break;
- }
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
+ YY_USE (yykind);
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
}
-
-/* Prevent warnings from -Wmissing-prototypes. */
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
-
-
-
-/* The look-ahead symbol. */
+/* Lookahead token kind. */
int yychar;
-/* The semantic value of the look-ahead symbol. */
+/* The semantic value of the lookahead symbol. */
YYSTYPE yylval;
-
/* Number of syntax errors so far. */
int yynerrs;
+
/*----------.
| yyparse. |
`----------*/
-#ifdef YYPARSE_PARAM
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void *YYPARSE_PARAM)
-#else
-int
-yyparse (YYPARSE_PARAM)
- void *YYPARSE_PARAM;
-#endif
-#else /* ! YYPARSE_PARAM */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
int
yyparse (void)
-#else
-int
-yyparse ()
-
-#endif
-#endif
{
-
- int yystate;
- int yyn;
- int yyresult;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
- /* Look-ahead token as an internal (translated) token number. */
- int yytoken = 0;
-#if YYERROR_VERBOSE
- /* Buffer for error messages, and its allocated size. */
- char yymsgbuf[128];
- char *yymsg = yymsgbuf;
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
-
- /* Three stacks and their tools:
- `yyss': related to states,
- `yyvs': related to semantic values,
- `yyls': related to locations.
-
- Refer to the stacks thru separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
+ yy_state_fast_t yystate = 0;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus = 0;
- /* The state stack. */
- yytype_int16 yyssa[YYINITDEPTH];
- yytype_int16 *yyss = yyssa;
- yytype_int16 *yyssp;
+ /* Refer to the stacks through separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs = yyvsa;
- YYSTYPE *yyvsp;
+ /* Their size. */
+ YYPTRDIFF_T yystacksize = YYINITDEPTH;
+ /* The state stack: array, bottom, top. */
+ yy_state_t yyssa[YYINITDEPTH];
+ yy_state_t *yyss = yyssa;
+ yy_state_t *yyssp = yyss;
+ /* The semantic value stack: array, bottom, top. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs = yyvsa;
+ YYSTYPE *yyvsp = yyvs;
-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
-
- YYSIZE_T yystacksize = YYINITDEPTH;
-
+ int yyn;
+ /* The return value of yyparse. */
+ int yyresult;
+ /* Lookahead symbol kind. */
+ yysymbol_kind_t yytoken = YYSYMBOL_YYEMPTY;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
+
+#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
+
/* The number of symbols on the RHS of the reduced rule.
Keep to zero when no symbol should be popped. */
int yylen = 0;
YYDPRINTF ((stderr, "Starting parse\n"));
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
-
- yyssp = yyss;
- yyvsp = yyvs;
+ yychar = YYEMPTY; /* Cause a token to be read. */
goto yysetstate;
+
/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate. |
+| yynewstate -- push a new state, which is found in yystate. |
`------------------------------------------------------------*/
- yynewstate:
+yynewstate:
/* In all cases, when you get here, the value and location stacks
have just been pushed. So pushing a state here evens the stacks. */
yyssp++;
- yysetstate:
- *yyssp = yystate;
+
+/*--------------------------------------------------------------------.
+| yysetstate -- set current state (the top of the stack) to yystate. |
+`--------------------------------------------------------------------*/
+yysetstate:
+ YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+ YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
+ YY_IGNORE_USELESS_CAST_BEGIN
+ *yyssp = YY_CAST (yy_state_t, yystate);
+ YY_IGNORE_USELESS_CAST_END
+ YY_STACK_PRINT (yyss, yyssp);
if (yyss + yystacksize - 1 <= yyssp)
+#if !defined yyoverflow && !defined YYSTACK_RELOCATE
+ YYNOMEM;
+#else
{
/* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
+ YYPTRDIFF_T yysize = yyssp - yyss + 1;
-#ifdef yyoverflow
+# if defined yyoverflow
{
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
-
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
-
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
+ /* Give user a chance to reallocate the stack. Use copies of
+ these so that the &'s don't force the real ones into
+ memory. */
+ yy_state_t *yyss1 = yyss;
+ YYSTYPE *yyvs1 = yyvs;
+
+ /* Each stack pointer address is followed by the size of the
+ data in use in that stack, in bytes. This used to be a
+ conditional around just the two extra args, but that might
+ be undefined if yyoverflow is a macro. */
+ yyoverflow (YY_("memory exhausted"),
+ &yyss1, yysize * YYSIZEOF (*yyssp),
+ &yyvs1, yysize * YYSIZEOF (*yyvsp),
+ &yystacksize);
+ yyss = yyss1;
+ yyvs = yyvs1;
}
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyexhaustedlab;
-# else
+# else /* defined YYSTACK_RELOCATE */
/* Extend the stack our own way. */
if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
+ YYNOMEM;
yystacksize *= 2;
if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
+ yystacksize = YYMAXDEPTH;
{
- yytype_int16 *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss);
- YYSTACK_RELOCATE (yyvs);
-
+ yy_state_t *yyss1 = yyss;
+ union yyalloc *yyptr =
+ YY_CAST (union yyalloc *,
+ YYSTACK_ALLOC (YY_CAST (YYSIZE_T, YYSTACK_BYTES (yystacksize))));
+ if (! yyptr)
+ YYNOMEM;
+ YYSTACK_RELOCATE (yyss_alloc, yyss);
+ YYSTACK_RELOCATE (yyvs_alloc, yyvs);
# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
+ if (yyss1 != yyssa)
+ YYSTACK_FREE (yyss1);
}
# endif
-#endif /* no yyoverflow */
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
-
- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
+ YY_IGNORE_USELESS_CAST_BEGIN
+ YYDPRINTF ((stderr, "Stack size increased to %ld\n",
+ YY_CAST (long, yystacksize)));
+ YY_IGNORE_USELESS_CAST_END
if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
+ YYABORT;
}
+#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+
+ if (yystate == YYFINAL)
+ YYACCEPT;
goto yybackup;
+
/*-----------.
| yybackup. |
`-----------*/
yybackup:
-
/* Do appropriate processing given the current state. Read a
- look-ahead token if we need one and don't already have one. */
+ lookahead token if we need one and don't already have one. */
- /* First try to decide what to do without reference to look-ahead token. */
+ /* First try to decide what to do without reference to lookahead token. */
yyn = yypact[yystate];
- if (yyn == YYPACT_NINF)
+ if (yypact_value_is_default (yyn))
goto yydefault;
- /* Not known => get a look-ahead token if don't already have one. */
+ /* Not known => get a lookahead token if don't already have one. */
- /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */
+ /* YYCHAR is either empty, or end-of-input, or a valid lookahead. */
if (yychar == YYEMPTY)
{
- YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
+ YYDPRINTF ((stderr, "Reading a token\n"));
+ yychar = yylex ();
}
if (yychar <= YYEOF)
{
- yychar = yytoken = YYEOF;
+ yychar = YYEOF;
+ yytoken = YYSYMBOL_YYEOF;
YYDPRINTF ((stderr, "Now at end of input.\n"));
}
+ else if (yychar == YYerror)
+ {
+ /* The scanner already issued an error message, process directly
+ to error recovery. But do not keep the error token as
+ lookahead, it is too special and may lead us to an endless
+ loop in error recovery. */
+ yychar = YYUNDEF;
+ yytoken = YYSYMBOL_YYerror;
+ goto yyerrlab1;
+ }
else
{
yytoken = YYTRANSLATE (yychar);
@@ -1452,30 +1186,26 @@ yybackup:
yyn = yytable[yyn];
if (yyn <= 0)
{
- if (yyn == 0 || yyn == YYTABLE_NINF)
- goto yyerrlab;
+ if (yytable_value_is_error (yyn))
+ goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
- if (yyn == YYFINAL)
- YYACCEPT;
-
/* Count tokens shifted since error; after three, turn off error
status. */
if (yyerrstatus)
yyerrstatus--;
- /* Shift the look-ahead token. */
+ /* Shift the lookahead token. */
YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-
- /* Discard the shifted token unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
-
yystate = yyn;
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
+ /* Discard the shifted token. */
+ yychar = YYEMPTY;
goto yynewstate;
@@ -1490,14 +1220,14 @@ yydefault:
/*-----------------------------.
-| yyreduce -- Do a reduction. |
+| yyreduce -- do a reduction. |
`-----------------------------*/
yyreduce:
/* yyn is the number of a rule to reduce with. */
yylen = yyr2[yyn];
/* If YYLEN is nonzero, implement the default value of the action:
- `$$ = $1'.
+ '$$ = $1'.
Otherwise, the following line sets YYVAL to garbage.
This behavior is undocumented and Bison
@@ -1510,352 +1240,377 @@ yyreduce:
YY_REDUCE_PRINT (yyn);
switch (yyn)
{
- case 2:
-#line 24 "syn.y"
- { return 1;}
+ case 2: /* rc: %empty */
+#line 24 "sys/cmd/rc/syn.y"
+ { return 1;}
+#line 1247 "sys/cmd/rc/y.tab.c"
break;
- case 3:
-#line 25 "syn.y"
- {return !compile((yyvsp[(1) - (2)].tree));}
+ case 3: /* rc: line '\n' */
+#line 25 "sys/cmd/rc/syn.y"
+ {return !compile((yyvsp[-1].tree));}
+#line 1253 "sys/cmd/rc/y.tab.c"
break;
- case 5:
-#line 27 "syn.y"
- {(yyval.tree)=tree2(';', (yyvsp[(1) - (2)].tree), (yyvsp[(2) - (2)].tree));}
+ case 5: /* line: cmdsa line */
+#line 27 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree2(';', (yyvsp[-1].tree), (yyvsp[0].tree));}
+#line 1259 "sys/cmd/rc/y.tab.c"
break;
- case 7:
-#line 29 "syn.y"
- {(yyval.tree)=tree2(';', (yyvsp[(1) - (2)].tree), (yyvsp[(2) - (2)].tree));}
+ case 7: /* body: cmdsan body */
+#line 29 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree2(';', (yyvsp[-1].tree), (yyvsp[0].tree));}
+#line 1265 "sys/cmd/rc/y.tab.c"
break;
- case 9:
-#line 31 "syn.y"
- {(yyval.tree)=tree1('&', (yyvsp[(1) - (2)].tree));}
+ case 9: /* cmdsa: cmd '&' */
+#line 31 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree1('&', (yyvsp[-1].tree));}
+#line 1271 "sys/cmd/rc/y.tab.c"
break;
- case 12:
-#line 34 "syn.y"
- {(yyval.tree)=tree1(BRACE, (yyvsp[(2) - (3)].tree));}
+ case 12: /* brace: '{' body '}' */
+#line 34 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree1(BRACE, (yyvsp[-1].tree));}
+#line 1277 "sys/cmd/rc/y.tab.c"
break;
- case 13:
-#line 35 "syn.y"
- {(yyval.tree)=tree1(PCMD, (yyvsp[(2) - (3)].tree));}
+ case 13: /* paren: '(' body ')' */
+#line 35 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree1(PCMD, (yyvsp[-1].tree));}
+#line 1283 "sys/cmd/rc/y.tab.c"
break;
- case 14:
-#line 36 "syn.y"
- {(yyval.tree)=tree2('=', (yyvsp[(1) - (3)].tree), (yyvsp[(3) - (3)].tree));}
+ case 14: /* assign: first '=' word */
+#line 36 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree2('=', (yyvsp[-2].tree), (yyvsp[0].tree));}
+#line 1289 "sys/cmd/rc/y.tab.c"
break;
- case 15:
-#line 37 "syn.y"
- {(yyval.tree)=0;}
+ case 15: /* epilog: %empty */
+#line 37 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=0;}
+#line 1295 "sys/cmd/rc/y.tab.c"
break;
- case 16:
-#line 38 "syn.y"
- {(yyval.tree)=mung2((yyvsp[(1) - (2)].tree), (yyvsp[(1) - (2)].tree)->child[0], (yyvsp[(2) - (2)].tree));}
+ case 16: /* epilog: redir epilog */
+#line 38 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=mung2((yyvsp[-1].tree), (yyvsp[-1].tree)->child[0], (yyvsp[0].tree));}
+#line 1301 "sys/cmd/rc/y.tab.c"
break;
- case 17:
-#line 39 "syn.y"
- {(yyval.tree)=mung1((yyvsp[(1) - (2)].tree), (yyvsp[(1) - (2)].tree)->rtype==HERE?heredoc((yyvsp[(2) - (2)].tree)):(yyvsp[(2) - (2)].tree));}
+ case 17: /* redir: REDIR word */
+#line 39 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=mung1((yyvsp[-1].tree), (yyvsp[-1].tree)->rtype==HERE?heredoc((yyvsp[0].tree)):(yyvsp[0].tree));}
+#line 1307 "sys/cmd/rc/y.tab.c"
break;
- case 19:
-#line 41 "syn.y"
- {(yyval.tree)=0;}
+ case 19: /* cmd: %empty */
+#line 41 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=0;}
+#line 1313 "sys/cmd/rc/y.tab.c"
break;
- case 20:
-#line 42 "syn.y"
- {(yyval.tree)=epimung((yyvsp[(1) - (2)].tree), (yyvsp[(2) - (2)].tree));}
+ case 20: /* cmd: brace epilog */
+#line 42 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=epimung((yyvsp[-1].tree), (yyvsp[0].tree));}
+#line 1319 "sys/cmd/rc/y.tab.c"
break;
- case 21:
-#line 43 "syn.y"
- {skipnl();}
+ case 21: /* $@1: %empty */
+#line 43 "sys/cmd/rc/syn.y"
+ {skipnl();}
+#line 1325 "sys/cmd/rc/y.tab.c"
break;
- case 22:
-#line 44 "syn.y"
- {(yyval.tree)=mung2((yyvsp[(1) - (4)].tree), (yyvsp[(2) - (4)].tree), (yyvsp[(4) - (4)].tree));}
+ case 22: /* cmd: IF paren $@1 cmd */
+#line 44 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=mung2((yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[0].tree));}
+#line 1331 "sys/cmd/rc/y.tab.c"
break;
- case 23:
-#line 45 "syn.y"
- {skipnl();}
+ case 23: /* $@2: %empty */
+#line 45 "sys/cmd/rc/syn.y"
+ {skipnl();}
+#line 1337 "sys/cmd/rc/y.tab.c"
break;
- case 24:
-#line 45 "syn.y"
- {(yyval.tree)=mung1((yyvsp[(2) - (4)].tree), (yyvsp[(4) - (4)].tree));}
+ case 24: /* cmd: IF NOT $@2 cmd */
+#line 45 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=mung1((yyvsp[-2].tree), (yyvsp[0].tree));}
+#line 1343 "sys/cmd/rc/y.tab.c"
break;
- case 25:
-#line 46 "syn.y"
- {skipnl();}
+ case 25: /* $@3: %empty */
+#line 46 "sys/cmd/rc/syn.y"
+ {skipnl();}
+#line 1349 "sys/cmd/rc/y.tab.c"
break;
- case 26:
-#line 55 "syn.y"
- {(yyval.tree)=mung3((yyvsp[(1) - (8)].tree), (yyvsp[(3) - (8)].tree), (yyvsp[(5) - (8)].tree) ? (yyvsp[(5) - (8)].tree) : tree1(PAREN, (yyvsp[(5) - (8)].tree)), (yyvsp[(8) - (8)].tree));}
+ case 26: /* cmd: FOR '(' word IN words ')' $@3 cmd */
+#line 55 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=mung3((yyvsp[-7].tree), (yyvsp[-5].tree), (yyvsp[-3].tree) ? (yyvsp[-3].tree) : tree1(PAREN, (yyvsp[-3].tree)), (yyvsp[0].tree));}
+#line 1355 "sys/cmd/rc/y.tab.c"
break;
- case 27:
-#line 56 "syn.y"
- {skipnl();}
+ case 27: /* $@4: %empty */
+#line 56 "sys/cmd/rc/syn.y"
+ {skipnl();}
+#line 1361 "sys/cmd/rc/y.tab.c"
break;
- case 28:
-#line 57 "syn.y"
- {(yyval.tree)=mung3((yyvsp[(1) - (6)].tree), (yyvsp[(3) - (6)].tree), (struct tree *)0, (yyvsp[(6) - (6)].tree));}
+ case 28: /* cmd: FOR '(' word ')' $@4 cmd */
+#line 57 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=mung3((yyvsp[-5].tree), (yyvsp[-3].tree), (struct Tree *)0, (yyvsp[0].tree));}
+#line 1367 "sys/cmd/rc/y.tab.c"
break;
- case 29:
-#line 58 "syn.y"
- {skipnl();}
+ case 29: /* $@5: %empty */
+#line 58 "sys/cmd/rc/syn.y"
+ {skipnl();}
+#line 1373 "sys/cmd/rc/y.tab.c"
break;
- case 30:
-#line 59 "syn.y"
- {(yyval.tree)=mung2((yyvsp[(1) - (4)].tree), (yyvsp[(2) - (4)].tree), (yyvsp[(4) - (4)].tree));}
+ case 30: /* cmd: WHILE paren $@5 cmd */
+#line 59 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=mung2((yyvsp[-3].tree), (yyvsp[-2].tree), (yyvsp[0].tree));}
+#line 1379 "sys/cmd/rc/y.tab.c"
break;
- case 31:
-#line 60 "syn.y"
- {skipnl();}
+ case 31: /* $@6: %empty */
+#line 60 "sys/cmd/rc/syn.y"
+ {skipnl();}
+#line 1385 "sys/cmd/rc/y.tab.c"
break;
- case 32:
-#line 61 "syn.y"
- {(yyval.tree)=tree2(SWITCH, (yyvsp[(2) - (4)].tree), (yyvsp[(4) - (4)].tree));}
+ case 32: /* cmd: SWITCH word $@6 brace */
+#line 61 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree2(SWITCH, (yyvsp[-2].tree), (yyvsp[0].tree));}
+#line 1391 "sys/cmd/rc/y.tab.c"
break;
- case 33:
-#line 62 "syn.y"
- {(yyval.tree)=simplemung((yyvsp[(1) - (1)].tree));}
+ case 33: /* cmd: simple */
+#line 62 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=simplemung((yyvsp[0].tree));}
+#line 1397 "sys/cmd/rc/y.tab.c"
break;
- case 34:
-#line 63 "syn.y"
- {(yyval.tree)=mung2((yyvsp[(1) - (3)].tree), (yyvsp[(2) - (3)].tree), (yyvsp[(3) - (3)].tree));}
+ case 34: /* cmd: TWIDDLE word words */
+#line 63 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=mung2((yyvsp[-2].tree), (yyvsp[-1].tree), (yyvsp[0].tree));}
+#line 1403 "sys/cmd/rc/y.tab.c"
break;
- case 35:
-#line 64 "syn.y"
- {(yyval.tree)=tree2(ANDAND, (yyvsp[(1) - (3)].tree), (yyvsp[(3) - (3)].tree));}
+ case 35: /* cmd: cmd ANDAND cmd */
+#line 64 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree2(ANDAND, (yyvsp[-2].tree), (yyvsp[0].tree));}
+#line 1409 "sys/cmd/rc/y.tab.c"
break;
- case 36:
-#line 65 "syn.y"
- {(yyval.tree)=tree2(OROR, (yyvsp[(1) - (3)].tree), (yyvsp[(3) - (3)].tree));}
+ case 36: /* cmd: cmd OROR cmd */
+#line 65 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree2(OROR, (yyvsp[-2].tree), (yyvsp[0].tree));}
+#line 1415 "sys/cmd/rc/y.tab.c"
break;
- case 37:
-#line 66 "syn.y"
- {(yyval.tree)=mung2((yyvsp[(2) - (3)].tree), (yyvsp[(1) - (3)].tree), (yyvsp[(3) - (3)].tree));}
+ case 37: /* cmd: cmd PIPE cmd */
+#line 66 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=mung2((yyvsp[-1].tree), (yyvsp[-2].tree), (yyvsp[0].tree));}
+#line 1421 "sys/cmd/rc/y.tab.c"
break;
- case 38:
-#line 67 "syn.y"
- {(yyval.tree)=mung2((yyvsp[(1) - (2)].tree), (yyvsp[(1) - (2)].tree)->child[0], (yyvsp[(2) - (2)].tree));}
+ case 38: /* cmd: redir cmd */
+#line 67 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=mung2((yyvsp[-1].tree), (yyvsp[-1].tree)->child[0], (yyvsp[0].tree));}
+#line 1427 "sys/cmd/rc/y.tab.c"
break;
- case 39:
-#line 68 "syn.y"
- {(yyval.tree)=mung3((yyvsp[(1) - (2)].tree), (yyvsp[(1) - (2)].tree)->child[0], (yyvsp[(1) - (2)].tree)->child[1], (yyvsp[(2) - (2)].tree));}
+ case 39: /* cmd: assign cmd */
+#line 68 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=mung3((yyvsp[-1].tree), (yyvsp[-1].tree)->child[0], (yyvsp[-1].tree)->child[1], (yyvsp[0].tree));}
+#line 1433 "sys/cmd/rc/y.tab.c"
break;
- case 40:
-#line 69 "syn.y"
- {(yyval.tree)=mung1((yyvsp[(1) - (2)].tree), (yyvsp[(2) - (2)].tree));}
+ case 40: /* cmd: BANG cmd */
+#line 69 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=mung1((yyvsp[-1].tree), (yyvsp[0].tree));}
+#line 1439 "sys/cmd/rc/y.tab.c"
break;
- case 41:
-#line 70 "syn.y"
- {(yyval.tree)=mung1((yyvsp[(1) - (2)].tree), (yyvsp[(2) - (2)].tree));}
+ case 41: /* cmd: SUBSHELL cmd */
+#line 70 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=mung1((yyvsp[-1].tree), (yyvsp[0].tree));}
+#line 1445 "sys/cmd/rc/y.tab.c"
break;
- case 42:
-#line 71 "syn.y"
- {(yyval.tree)=tree2(FN, (yyvsp[(2) - (3)].tree), (yyvsp[(3) - (3)].tree));}
+ case 42: /* cmd: FN words brace */
+#line 71 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree2(FN, (yyvsp[-1].tree), (yyvsp[0].tree));}
+#line 1451 "sys/cmd/rc/y.tab.c"
break;
- case 43:
-#line 72 "syn.y"
- {(yyval.tree)=tree1(FN, (yyvsp[(2) - (2)].tree));}
+ case 43: /* cmd: FN words */
+#line 72 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree1(FN, (yyvsp[0].tree));}
+#line 1457 "sys/cmd/rc/y.tab.c"
break;
- case 45:
-#line 74 "syn.y"
- {(yyval.tree)=tree2(ARGLIST, (yyvsp[(1) - (2)].tree), (yyvsp[(2) - (2)].tree));}
+ case 45: /* simple: simple word */
+#line 74 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree2(ARGLIST, (yyvsp[-1].tree), (yyvsp[0].tree));}
+#line 1463 "sys/cmd/rc/y.tab.c"
break;
- case 46:
-#line 75 "syn.y"
- {(yyval.tree)=tree2(ARGLIST, (yyvsp[(1) - (2)].tree), (yyvsp[(2) - (2)].tree));}
+ case 46: /* simple: simple redir */
+#line 75 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree2(ARGLIST, (yyvsp[-1].tree), (yyvsp[0].tree));}
+#line 1469 "sys/cmd/rc/y.tab.c"
break;
- case 48:
-#line 77 "syn.y"
- {(yyval.tree)=tree2('^', (yyvsp[(1) - (3)].tree), (yyvsp[(3) - (3)].tree));}
+ case 48: /* first: first '^' word */
+#line 77 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree2('^', (yyvsp[-2].tree), (yyvsp[0].tree));}
+#line 1475 "sys/cmd/rc/y.tab.c"
break;
- case 49:
-#line 78 "syn.y"
- {lastword=1; (yyvsp[(1) - (1)].tree)->type=WORD;}
+ case 49: /* word: keyword */
+#line 78 "sys/cmd/rc/syn.y"
+ {lastword=1; (yyvsp[0].tree)->type=WORD;}
+#line 1481 "sys/cmd/rc/y.tab.c"
break;
- case 51:
-#line 80 "syn.y"
- {(yyval.tree)=tree2('^', (yyvsp[(1) - (3)].tree), (yyvsp[(3) - (3)].tree));}
+ case 51: /* word: word '^' word */
+#line 80 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree2('^', (yyvsp[-2].tree), (yyvsp[0].tree));}
+#line 1487 "sys/cmd/rc/y.tab.c"
break;
- case 52:
-#line 81 "syn.y"
- {(yyval.tree)=tree1('$', (yyvsp[(2) - (2)].tree));}
+ case 52: /* comword: '$' word */
+#line 81 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree1('$', (yyvsp[0].tree));}
+#line 1493 "sys/cmd/rc/y.tab.c"
break;
- case 53:
-#line 82 "syn.y"
- {(yyval.tree)=tree2(SUB, (yyvsp[(2) - (5)].tree), (yyvsp[(4) - (5)].tree));}
+ case 53: /* comword: '$' word SUB words ')' */
+#line 82 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree2(SUB, (yyvsp[-3].tree), (yyvsp[-1].tree));}
+#line 1499 "sys/cmd/rc/y.tab.c"
break;
- case 54:
-#line 83 "syn.y"
- {(yyval.tree)=tree1('"', (yyvsp[(2) - (2)].tree));}
+ case 54: /* comword: '"' word */
+#line 83 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree1('"', (yyvsp[0].tree));}
+#line 1505 "sys/cmd/rc/y.tab.c"
break;
- case 55:
-#line 84 "syn.y"
- {(yyval.tree)=tree1(COUNT, (yyvsp[(2) - (2)].tree));}
+ case 55: /* comword: COUNT word */
+#line 84 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree1(COUNT, (yyvsp[0].tree));}
+#line 1511 "sys/cmd/rc/y.tab.c"
break;
- case 57:
-#line 86 "syn.y"
- {(yyval.tree)=tree1('`', (yyvsp[(2) - (2)].tree));}
+ case 57: /* comword: '`' brace */
+#line 86 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree1('`', (yyvsp[0].tree));}
+#line 1517 "sys/cmd/rc/y.tab.c"
break;
- case 58:
-#line 87 "syn.y"
- {(yyval.tree)=tree1(PAREN, (yyvsp[(2) - (3)].tree));}
+ case 58: /* comword: '(' words ')' */
+#line 87 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree1(PAREN, (yyvsp[-1].tree));}
+#line 1523 "sys/cmd/rc/y.tab.c"
break;
- case 59:
-#line 88 "syn.y"
- {(yyval.tree)=mung1((yyvsp[(1) - (2)].tree), (yyvsp[(2) - (2)].tree)); (yyval.tree)->type=PIPEFD;}
+ case 59: /* comword: REDIR brace */
+#line 88 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=mung1((yyvsp[-1].tree), (yyvsp[0].tree)); (yyval.tree)->type=PIPEFD;}
+#line 1529 "sys/cmd/rc/y.tab.c"
break;
- case 70:
-#line 90 "syn.y"
- {(yyval.tree)=(struct tree*)0;}
+ case 70: /* words: %empty */
+#line 90 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=(struct Tree*)0;}
+#line 1535 "sys/cmd/rc/y.tab.c"
break;
- case 71:
-#line 91 "syn.y"
- {(yyval.tree)=tree2(WORDS, (yyvsp[(1) - (2)].tree), (yyvsp[(2) - (2)].tree));}
+ case 71: /* words: words word */
+#line 91 "sys/cmd/rc/syn.y"
+ {(yyval.tree)=tree2(WORDS, (yyvsp[-1].tree), (yyvsp[0].tree));}
+#line 1541 "sys/cmd/rc/y.tab.c"
break;
-/* Line 1267 of yacc.c. */
-#line 1766 "y.tab.c"
+#line 1545 "sys/cmd/rc/y.tab.c"
+
default: break;
}
- YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
+ /* User semantic actions sometimes alter yychar, and that requires
+ that yytoken be updated with the new translation. We take the
+ approach of translating immediately before every use of yytoken.
+ One alternative is translating here after every semantic action,
+ but that translation would be missed if the semantic action invokes
+ YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
+ if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
+ incorrect destructor might then be invoked immediately. In the
+ case of YYERROR or YYBACKUP, subsequent parser actions might lead
+ to an incorrect destructor call or verbose syntax error message
+ before the lookahead is translated. */
+ YY_SYMBOL_PRINT ("-> $$ =", YY_CAST (yysymbol_kind_t, yyr1[yyn]), &yyval, &yyloc);
YYPOPSTACK (yylen);
yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
*++yyvsp = yyval;
-
- /* Now `shift' the result of the reduction. Determine what state
+ /* Now 'shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTOKENS];
+ {
+ const int yylhs = yyr1[yyn] - YYNTOKENS;
+ const int yyi = yypgoto[yylhs] + *yyssp;
+ yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
+ ? yytable[yyi]
+ : yydefgoto[yylhs]);
+ }
goto yynewstate;
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
+/*--------------------------------------.
+| yyerrlab -- here on detecting error. |
+`--------------------------------------*/
yyerrlab:
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = yychar == YYEMPTY ? YYSYMBOL_YYEMPTY : YYTRANSLATE (yychar);
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
++yynerrs;
-#if ! YYERROR_VERBOSE
yyerror (YY_("syntax error"));
-#else
- {
- YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
- if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
- {
- YYSIZE_T yyalloc = 2 * yysize;
- if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
- yyalloc = YYSTACK_ALLOC_MAXIMUM;
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yyalloc);
- if (yymsg)
- yymsg_alloc = yyalloc;
- else
- {
- yymsg = yymsgbuf;
- yymsg_alloc = sizeof yymsgbuf;
- }
- }
-
- if (0 < yysize && yysize <= yymsg_alloc)
- {
- (void) yysyntax_error (yymsg, yystate, yychar);
- yyerror (yymsg);
- }
- else
- {
- yyerror (YY_("syntax error"));
- if (yysize != 0)
- goto yyexhaustedlab;
- }
- }
-#endif
}
-
-
if (yyerrstatus == 3)
{
- /* If just tried and failed to reuse look-ahead token after an
- error, discard it. */
+ /* If just tried and failed to reuse lookahead token after an
+ error, discard it. */
if (yychar <= YYEOF)
- {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
- }
+ {
+ /* Return failure if at end of input. */
+ if (yychar == YYEOF)
+ YYABORT;
+ }
else
- {
- yydestruct ("Error: discarding",
- yytoken, &yylval);
- yychar = YYEMPTY;
- }
+ {
+ yydestruct ("Error: discarding",
+ yytoken, &yylval);
+ yychar = YYEMPTY;
+ }
}
- /* Else will try to reuse look-ahead token after shifting the error
+ /* Else will try to reuse lookahead token after shifting the error
token. */
goto yyerrlab1;
@@ -1864,14 +1619,13 @@ yyerrlab:
| yyerrorlab -- error raised explicitly by YYERROR. |
`---------------------------------------------------*/
yyerrorlab:
+ /* Pacify compilers when the user code never invokes YYERROR and the
+ label yyerrorlab therefore never appears in user code. */
+ if (0)
+ YYERROR;
+ ++yynerrs;
- /* Pacify compilers like GCC when the user code never invokes
- YYERROR and the label yyerrorlab therefore never appears in user
- code. */
- if (/*CONSTCOND*/ 0)
- goto yyerrorlab;
-
- /* Do not reclaim the symbols of the rule which action triggered
+ /* Do not reclaim the symbols of the rule whose action triggered
this YYERROR. */
YYPOPSTACK (yylen);
yylen = 0;
@@ -1884,42 +1638,42 @@ yyerrorlab:
| yyerrlab1 -- common code for both syntax error and YYERROR. |
`-------------------------------------------------------------*/
yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
+ yyerrstatus = 3; /* Each real token shifted decrements this. */
+ /* Pop stack until we find a state that shifts the error token. */
for (;;)
{
yyn = yypact[yystate];
- if (yyn != YYPACT_NINF)
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
+ if (!yypact_value_is_default (yyn))
+ {
+ yyn += YYSYMBOL_YYerror;
+ if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYSYMBOL_YYerror)
+ {
+ yyn = yytable[yyn];
+ if (0 < yyn)
+ break;
+ }
+ }
/* Pop the current state because it cannot handle the error token. */
if (yyssp == yyss)
- YYABORT;
+ YYABORT;
yydestruct ("Error: popping",
- yystos[yystate], yyvsp);
+ YY_ACCESSING_SYMBOL (yystate), yyvsp);
YYPOPSTACK (1);
yystate = *yyssp;
YY_STACK_PRINT (yyss, yyssp);
}
- if (yyn == YYFINAL)
- YYACCEPT;
-
+ YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
+ YY_IGNORE_MAYBE_UNINITIALIZED_END
/* Shift the error token. */
- YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+ YY_SYMBOL_PRINT ("Shifting", YY_ACCESSING_SYMBOL (yyn), yyvsp, yylsp);
yystate = yyn;
goto yynewstate;
@@ -1930,50 +1684,53 @@ yyerrlab1:
`-------------------------------------*/
yyacceptlab:
yyresult = 0;
- goto yyreturn;
+ goto yyreturnlab;
+
/*-----------------------------------.
| yyabortlab -- YYABORT comes here. |
`-----------------------------------*/
yyabortlab:
yyresult = 1;
- goto yyreturn;
+ goto yyreturnlab;
-#ifndef yyoverflow
-/*-------------------------------------------------.
-| yyexhaustedlab -- memory exhaustion comes here. |
-`-------------------------------------------------*/
+
+/*-----------------------------------------------------------.
+| yyexhaustedlab -- YYNOMEM (memory exhaustion) comes here. |
+`-----------------------------------------------------------*/
yyexhaustedlab:
yyerror (YY_("memory exhausted"));
yyresult = 2;
- /* Fall through. */
-#endif
+ goto yyreturnlab;
+
-yyreturn:
- if (yychar != YYEOF && yychar != YYEMPTY)
- yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval);
- /* Do not reclaim the symbols of the rule which action triggered
+/*----------------------------------------------------------.
+| yyreturnlab -- parsing is finished, clean up and return. |
+`----------------------------------------------------------*/
+yyreturnlab:
+ if (yychar != YYEMPTY)
+ {
+ /* Make sure we have latest lookahead translation. See comments at
+ user semantic actions for why this is necessary. */
+ yytoken = YYTRANSLATE (yychar);
+ yydestruct ("Cleanup: discarding lookahead",
+ yytoken, &yylval);
+ }
+ /* Do not reclaim the symbols of the rule whose action triggered
this YYABORT or YYACCEPT. */
YYPOPSTACK (yylen);
YY_STACK_PRINT (yyss, yyssp);
while (yyssp != yyss)
{
yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp);
+ YY_ACCESSING_SYMBOL (+*yyssp), yyvsp);
YYPOPSTACK (1);
}
#ifndef yyoverflow
if (yyss != yyssa)
YYSTACK_FREE (yyss);
#endif
-#if YYERROR_VERBOSE
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
-#endif
- /* Make sure YYID is used. */
- return YYID (yyresult);
-}
-
+ return yyresult;
+}
diff --git a/sys/cmd/rc/y.tab.h b/sys/cmd/rc/y.tab.h
index 0f5b1bd..ba05ca2 100644
--- a/sys/cmd/rc/y.tab.h
+++ b/sys/cmd/rc/y.tab.h
@@ -1,14 +1,14 @@
-/* A Bison parser, made by GNU Bison 2.3. */
+/* A Bison parser, made by GNU Bison 3.8.2. */
-/* Skeleton interface for Bison's Yacc-like parsers in C
+/* Bison interface for Yacc-like parsers in C
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
- Free Software Foundation, Inc.
+ Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2021 Free Software Foundation,
+ Inc.
- This program is free software; you can redistribute it and/or modify
+ This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -16,9 +16,7 @@
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA. */
+ along with this program. If not, see <https://www.gnu.org/licenses/>. */
/* As a special exception, you may create a larger work that contains
part or all of the Bison parser skeleton and distribute that work
@@ -33,40 +31,62 @@
This special exception was added by the Free Software Foundation in
version 2.2 of Bison. */
-/* Tokens. */
+/* DO NOT RELY ON FEATURES THAT ARE NOT DOCUMENTED in the manual,
+ especially those whose name start with YY_ or yy_. They are
+ private implementation details that can be changed or removed. */
+
+#ifndef YY_YY_SYS_CMD_RC_Y_TAB_H_INCLUDED
+# define YY_YY_SYS_CMD_RC_Y_TAB_H_INCLUDED
+/* Debug traces. */
+#ifndef YYDEBUG
+# define YYDEBUG 0
+#endif
+#if YYDEBUG
+extern int yydebug;
+#endif
+
+/* Token kinds. */
#ifndef YYTOKENTYPE
# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- FOR = 258,
- IN = 259,
- WHILE = 260,
- IF = 261,
- NOT = 262,
- TWIDDLE = 263,
- BANG = 264,
- SUBSHELL = 265,
- SWITCH = 266,
- FN = 267,
- WORD = 268,
- REDIR = 269,
- DUP = 270,
- PIPE = 271,
- SUB = 272,
- SIMPLE = 273,
- ARGLIST = 274,
- WORDS = 275,
- BRACE = 276,
- PAREN = 277,
- PCMD = 278,
- PIPEFD = 279,
- OROR = 280,
- ANDAND = 281,
- COUNT = 282
- };
+ enum yytokentype
+ {
+ YYEMPTY = -2,
+ YYEOF = 0, /* "end of file" */
+ YYerror = 256, /* error */
+ YYUNDEF = 257, /* "invalid token" */
+ FOR = 258, /* FOR */
+ IN = 259, /* IN */
+ WHILE = 260, /* WHILE */
+ IF = 261, /* IF */
+ NOT = 262, /* NOT */
+ TWIDDLE = 263, /* TWIDDLE */
+ BANG = 264, /* BANG */
+ SUBSHELL = 265, /* SUBSHELL */
+ SWITCH = 266, /* SWITCH */
+ FN = 267, /* FN */
+ WORD = 268, /* WORD */
+ REDIR = 269, /* REDIR */
+ DUP = 270, /* DUP */
+ PIPE = 271, /* PIPE */
+ SUB = 272, /* SUB */
+ SIMPLE = 273, /* SIMPLE */
+ ARGLIST = 274, /* ARGLIST */
+ WORDS = 275, /* WORDS */
+ BRACE = 276, /* BRACE */
+ PAREN = 277, /* PAREN */
+ PCMD = 278, /* PCMD */
+ PIPEFD = 279, /* PIPEFD */
+ ANDAND = 280, /* ANDAND */
+ OROR = 281, /* OROR */
+ COUNT = 282 /* COUNT */
+ };
+ typedef enum yytokentype yytoken_kind_t;
#endif
-/* Tokens. */
+/* Token kinds. */
+#define YYEMPTY -2
+#define YYEOF 0
+#define YYerror 256
+#define YYUNDEF 257
#define FOR 258
#define IN 259
#define WHILE 260
@@ -89,26 +109,31 @@
#define PAREN 277
#define PCMD 278
#define PIPEFD 279
-#define OROR 280
-#define ANDAND 281
+#define ANDAND 280
+#define OROR 281
#define COUNT 282
+/* Value type. */
+#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
+union YYSTYPE
+{
+#line 16 "sys/cmd/rc/syn.y"
+ struct Tree *tree;
+#line 125 "sys/cmd/rc/y.tab.h"
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
-#line 16 "syn.y"
-{
- struct tree *tree;
-}
-/* Line 1529 of yacc.c. */
-#line 107 "y.tab.h"
- YYSTYPE;
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
+};
+typedef union YYSTYPE YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
+# define YYSTYPE_IS_DECLARED 1
#endif
+
extern YYSTYPE yylval;
+
+int yyparse (void);
+
+
+#endif /* !YY_YY_SYS_CMD_RC_Y_TAB_H_INCLUDED */