about summary refs log tree commit diff
path: root/language/dynamic/input.e
diff options
context:
space:
mode:
authorIrene Knapp <ireneista@irenes.space>2026-10-05 13:00:41 -0700
committerIrene Knapp <ireneista@irenes.space>2026-10-05 15:05:36 -0700
commitb8798f26ee09c4b30ffe033bd657a7f4c99210e5 (patch)
tree4e937c8e9e5072c202bff4b5aa281f969cbe8fbb /language/dynamic/input.e
parenta0ef3365458bdd8e99d0d4bb05c6de9f13527ad6 (diff)
track the filename of an input buffer
this also includes some slightly better facilities for handling temporary strings

Change-Id: Idf5e6fd8ade675d7ceb73264d10895fe8da578d6
Force-Push: yes
Diffstat (limited to 'language/dynamic/input.e')
-rw-r--r--language/dynamic/input.e13
1 files changed, 8 insertions, 5 deletions
diff --git a/language/dynamic/input.e b/language/dynamic/input.e
index 9d73c16..ccff6ca 100644
--- a/language/dynamic/input.e
+++ b/language/dynamic/input.e
@@ -15,11 +15,13 @@
 : buffer-logical-length 3 8 * + ;
 ~ (pointer to buffer metadata -- pointer to buffer "file-descriptor" field)
 : buffer-file-descriptor 4 8 * + ;
+~ (pointer to buffer metadata -- pointer to buffer "filename" field)
+: buffer-filename 5 8 * + ;
 ~ (pointer to input buffer metadata -- pointer to input buffer "refill" field)
-: input-buffer-refill 5 8 * + ;
+: input-buffer-refill 6 8 * + ;
 ~ (pointer to input buffer metadata
 ~  -- pointer to input buffer "next-source" field)
-: input-buffer-next-source 6 8 * + ;
+: input-buffer-next-source 7 8 * + ;
 
 
 ~   Given an initialized buffer (input or otherwise), sets its logical-start
@@ -48,6 +50,7 @@
   dup buffer-logical-start 0 swap !
   dup buffer-logical-length 0 swap !
   dup buffer-file-descriptor -1 swap !
+  dup buffer-filename 0 swap !
   dup input-buffer-refill 0 swap !
   ~ Notice the absence of a dup this time.
   input-buffer-next-source 0 swap ! ;
@@ -58,7 +61,7 @@
 ~
 ~ (-- pointer to input buffer metadata)
 : allocate-input-buffer-metadata
-  7 8 * allocate
+  8 8 * allocate
   dup zero-input-buffer-metadata ;
 
 
@@ -67,10 +70,10 @@
 ~
 ~ (buffer capacity in bytes -- pointer to input buffer metadata)
 : allocate-input-buffer
-  dup 7 8 * + allocate
+  dup 8 8 * + allocate
   dup zero-input-buffer-metadata
   ~ (capacity in bytes, metadata pointer)
-  dup dup 7 8 * +
+  dup dup 8 8 * +
   ~ (capacity in bytes, metadata pointer, metadata pointer, physical start)
   swap buffer-physical-start !
   ~ (capacity in bytes, metadata pointer)