summary refs log tree commit diff
path: root/input.e
diff options
context:
space:
mode:
Diffstat (limited to 'input.e')
-rw-r--r--input.e60
1 files changed, 30 insertions, 30 deletions
diff --git a/input.e b/input.e
index 8203673..dd1da1c 100644
--- a/input.e
+++ b/input.e
@@ -97,7 +97,7 @@
 ~ (metadata pointer --)
 : consume-from
   ~ If the length is zero, exit without doing anything.
-  dup buffer-logical-length @ 0 = 0branch [ 2 8 * , ] exit
+  dup buffer-logical-length @ 0 = { exit } if
 
   ~ Decrement the logical length. We do this now to get it over with, since
   ~ adjusting the start pointer is more complex.
@@ -116,13 +116,13 @@
   ~ Check whether the updated start is equal to the physical end.
   dup 4 roll =
   ~ (metadata pointer, updated start, updated start, physical end)
-  0branch [ 5 8 * , ]
-
-  ~ If the logical start pointer is now equal to the physical end pointer,
-  ~ we want to wrap to the physical start. That's what makes it a circular
-  ~ buffer.
-  ~ (metadata pointer, updated start)
-  drop dup buffer-physical-start @
+  {
+    ~ If the logical start pointer is now equal to the physical end pointer,
+    ~ we want to wrap to the physical start. That's what makes it a circular
+    ~ buffer.
+    ~ (metadata pointer, updated start)
+    drop dup buffer-physical-start @
+  } if
 
   ~ However we got here, save the updated logical start pointer.
   ~ (metadata pointer, updated start)
@@ -131,28 +131,28 @@
 
 ~ (metadata pointer -- byte or 0)
 : peek-from
-  dup buffer-logical-length @ 0 = 0branch [ 28 8 * , ]
-
-  ~ If the length is zero, there is no input, but we can still try calling
-  ~ the "refill" word.
-  ~ (metadata pointer)
-  dup input-buffer-refill @ dup 0branch [ 17 8 * , ]
-
-  ~ If the refill word is nonzero, call it. It expects a copy of the metadata
-  ~ pointer as its parameter, so set that up.
-  ~ (metadata pointer, refill word)
-  swap dup 3roll execute
-  ~ (metadata pointer)
-  ~ Now we check if the length is still zero.
-  dup buffer-logical-length @ 0 = 0branch [ 10 8 * , ]
-
-  ~ The length is zero even after calling the refill word, so return null.
-  ~ (metadata pointer)
-  drop 0 exit
-
-  ~ If the refill word is zero, we can't help, just return null.
-  ~ (metadata pointer, refill word)
-  drop drop 0 exit
+  dup buffer-logical-length @ {
+    ~ If the length is zero, there is no input, but we can still try calling
+    ~ the "refill" word.
+    ~ (metadata pointer)
+    dup input-buffer-refill @ dup {
+      ~ If the refill word is zero, we can't help, just return null.
+      ~ (metadata pointer, refill word)
+      drop drop 0 exit
+    } unless
+
+    ~ If the refill word is nonzero, call it. It expects a copy of the metadata
+    ~ pointer as its parameter, so set that up.
+    ~ (metadata pointer, refill word)
+    swap dup 3roll execute
+    ~ (metadata pointer)
+    ~ Now we check if the length is still zero.
+    dup buffer-logical-length @ {
+      ~ The length is zero even after calling the refill word, so return null.
+      ~ (metadata pointer)
+      drop 0 exit
+    } unless
+  } unless
 
   ~   The buffer is non-empty, so read a byte from it. We might have reached
   ~ this point either from the original check, or from the second check after