aboutsummaryrefslogtreecommitdiff
path: root/unix/boot/spp/rpp/rpprat/ngetch.r
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /unix/boot/spp/rpp/rpprat/ngetch.r
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'unix/boot/spp/rpp/rpprat/ngetch.r')
-rw-r--r--unix/boot/spp/rpp/rpprat/ngetch.r34
1 files changed, 34 insertions, 0 deletions
diff --git a/unix/boot/spp/rpp/rpprat/ngetch.r b/unix/boot/spp/rpp/rpprat/ngetch.r
new file mode 100644
index 00000000..26dce4de
--- /dev/null
+++ b/unix/boot/spp/rpp/rpprat/ngetch.r
@@ -0,0 +1,34 @@
+#-h- ngetch 442 local 12/01/80 15:54:30
+# ngetch - get a (possibly pushed back) character
+ include defs
+
+ character function ngetch (c)
+ character c
+
+ include COMMON_BLOCKS
+
+ integer getlin, n, i
+
+ if (buf (bp) == EOS)
+ if (getlin (buf (PBPOINT), infile (level)) == EOF)
+ c = EOF
+ else {
+ c = buf (PBPOINT)
+ bp = PBPOINT + 1
+ if (c == SHARP) { #check for "#!# nn" directive
+ if (buf(bp) == BANG & buf(bp+1) == SHARP) {
+ n = 0
+ for (i=bp+3; buf(i) >= DIG0 & buf(i) <= DIG9; i=i+1)
+ n = n * 10 + buf(i) - DIG0
+ linect (level) = n - 1
+ }
+ }
+ linect (level) = linect (level) + 1
+ }
+ else {
+ c = buf (bp)
+ bp = bp + 1
+ }
+
+ return (c)
+ end