ref: 1ae3cf8839a2498525a5c9753d3c4226d88ee09e
parent: 5c28fc0ab1342098db749c8d07073cf60b149bfb
author: Lennart Augustsson <lennart.augustsson@epicgames.com>
date: Tue Jan 9 07:46:17 EST 2024
Add some utilities.
--- a/src/runtime/bfile.c
+++ b/src/runtime/bfile.c
@@ -45,6 +45,36 @@
p->flushb(p);
}
+void
+putsb(const char *str, struct BFILE *p)
+{+ char c;
+ while ((c = *str++))
+ putb(c, p);
+}
+
+/* convert -n to a string, handles MINBOUND correctly */
+void
+putnegb(value_t n, struct BFILE *p)
+{+ int c = '0' - n % 10;
+ if (n <= -10) {+ putnegb(n / 10, p);
+ }
+ putb(c, p);
+}
+
+void
+putdecb(value_t n, struct BFILE *p)
+{+ if (n < 0) {+ putb('-', p);+ putnegb(n, p);
+ } else {+ putnegb(-n, p);
+ }
+}
+
/***************** BFILE from static buffer *******************/
struct BFILE_buffer {BFILE mets;
--- a/src/runtime/eval.c
+++ b/src/runtime/eval.c
@@ -1426,7 +1426,10 @@
if (n == atptr) putc('@', f); switch (GETTAG(n)) {- case T_IND: putc('*', f); printrec(f, INDIR(n)); break;+ case T_IND:
+ //putc('*', f);+ printrec(f, INDIR(n));
+ break;
case T_AP:
fputc('(', f);printrec(f, FUN(n));
@@ -2305,7 +2308,7 @@
* and make np point to it.
* This graph will be updated continuously as we execite IO action.
* Invariant: the second argument to this BIND is always either RETURN
- * or another C'BIND.
+ * or a C'BIND. The second argument to C'BIND has the same invariant.
* This is the cycle:
* given top = BIND n q
* eval(n)
--
⑨