diff options
| -rw-r--r-- | compilation/labels.e | 2 | ||||
| -rw-r--r-- | evoke.e | 13 | ||||
| -rw-r--r-- | evoke.hex | 44434 | ||||
| -rw-r--r-- | hex.e | 4 | ||||
| -rw-r--r-- | inscribe-evoke.e | 6 | ||||
| -rw-r--r-- | inscribe-hex.e | 4 | ||||
| -rw-r--r-- | language/boot-source-footer.e | 6 |
7 files changed, 44442 insertions, 27 deletions
diff --git a/compilation/labels.e b/compilation/labels.e index 2a02a4c..2c028aa 100644 --- a/compilation/labels.e +++ b/compilation/labels.e @@ -278,7 +278,7 @@ 0 swap ~ TODO every time you double this to fix a crash, you must publicly ~ apologize for deferring a real fix. those are the rules - 0x80000 allocate dup + 0x100000 allocate dup ~ (iteration count, execution token, output start, output point) { 3 pick 100 > } { 2 pick execute 4 roll 1+ 4 unroll diff --git a/evoke.e b/evoke.e index cade5e4..64a4d92 100644 --- a/evoke.e +++ b/evoke.e @@ -1,10 +1,5 @@ ~ cat evoke.e | ./evoke > evoke2 && chmod 755 evoke2 -s" compilation/labels.e" include -s" compilation/elf.e" include -s" compilation/transform.e" include -s" compilation/execution.e" include - : read-inputs here @ dup s" language/static/core.e" pack-file-contents @@ -32,7 +27,13 @@ s" compilation/execution.e" include 0 pack8 8 packalign here ! s" source-to-copy-to-log" variable - s" relink-main-input-buffer-to-stdin" + here @ dup + s" compilation/labels.e" pack-file-contents + s" compilation/elf.e" pack-file-contents + s" compilation/transform.e" pack-file-contents + s" compilation/execution.e" pack-file-contents + s" language/boot-source-footer.e" pack-file-contents + 0 pack8 8 packalign here ! s" source-to-textually-include" variable ; read-inputs diff --git a/evoke.hex b/evoke.hex index e9ba296..03252f2 100644 --- a/evoke.hex +++ b/evoke.hex @@ -49,8 +49,8 @@ 00 00 00 08 00 00 00 00 ~ *virtual address 00 00 00 00 00 00 00 00 ~ physical address (ignored) - e0 64 05 00 00 00 00 00 ~ *size in file - e0 64 05 00 00 00 00 00 ~ *size in memory + 08 9e 0a 00 00 00 00 00 ~ *size in file + 08 9e 0a 00 00 00 00 00 ~ *size in memory 00 00 00 00 00 00 00 00 ~ segment alignment @@ -67093,8 +67093,8 @@ ~ set. It has a regular entry header up to, but not including, the ~ padding at the end. ~ -~ Unfortunately, this winds up being somewhat hard to read in the hex -~ dump. Sorry about that. +~ Making this readable in the hex dump is no small task, but has been +~ valiantly attempted. 78 61 05 00 00 00 00 00 80 ~ (entry flags) @@ -67103,11 +67103,44431 @@ 6f 75 72 63 65 00 00 00 ~ (alignment padding) ~ label boot-source at offset 0x00000000000564b8 is here. - ~ "relink-main-input-buffer-to-stdin" (string literal with null) + + ~ What follows is a long string literal. For convenience, its contents + ~ are given in short runs, but it's all a single string. When possible, + ~ runs are broken at line endings or word breaks. Trailing line endings + ~ are not shown in the comments; look for them in the hex. + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 0a + + ~ "~ ~~ Machine label facility ~~" + 7e 20 7e 7e 20 4d 61 63 68 69 6e 65 20 6c 61 62 + 65 6c 20 66 61 63 69 6c 69 74 79 20 7e 7e 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 0a + + ~ "~" + 7e 0a + + ~ "~ Compilers and assemblers always have a need to resolve" + ~ " symbolic names for" + 7e 20 20 20 43 6f 6d 70 69 6c 65 72 73 20 61 6e + 64 20 61 73 73 65 6d 62 6c 65 72 73 20 61 6c 77 + 61 79 73 20 68 61 76 65 20 61 20 6e 65 65 64 20 + 74 6f 20 72 65 73 6f 6c 76 65 20 73 79 6d 62 6f + 6c 69 63 20 6e 61 6d 65 73 20 66 6f 72 0a + + ~ "~ parts of their code to numeric values. Usually, these" + ~ " symbolic names are" + 7e 20 70 61 72 74 73 20 6f 66 20 74 68 65 69 72 + 20 63 6f 64 65 20 74 6f 20 6e 75 6d 65 72 69 63 + 20 76 61 6c 75 65 73 2e 20 55 73 75 61 6c 6c 79 + 2c 20 74 68 65 73 65 20 73 79 6d 62 6f 6c 69 63 + 20 6e 61 6d 65 73 20 61 72 65 0a + + ~ "~ called labels." + 7e 20 63 61 6c 6c 65 64 20 6c 61 62 65 6c 73 2e + 0a + + ~ "~" + 7e 0a + + ~ "~ It's a surprisingly deep problem. The output itself can" + ~ " end up depending" + 7e 20 20 20 49 74 27 73 20 61 20 73 75 72 70 72 + 69 73 69 6e 67 6c 79 20 64 65 65 70 20 70 72 6f + 62 6c 65 6d 2e 20 54 68 65 20 6f 75 74 70 75 74 + 20 69 74 73 65 6c 66 20 63 61 6e 20 65 6e 64 20 + 75 70 20 64 65 70 65 6e 64 69 6e 67 0a + + ~ "~ on the actual values, for a variety of reasons. For" + ~ " example, the size of" + 7e 20 6f 6e 20 74 68 65 20 61 63 74 75 61 6c 20 + 76 61 6c 75 65 73 2c 20 66 6f 72 20 61 20 76 61 + 72 69 65 74 79 20 6f 66 20 72 65 61 73 6f 6e 73 + 2e 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 74 + 68 65 20 73 69 7a 65 20 6f 66 0a + + ~ "~ a relative-jump instruction may vary depending on how far" + ~ " away its target" + 7e 20 61 20 72 65 6c 61 74 69 76 65 2d 6a 75 6d + 70 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 6d 61 + 79 20 76 61 72 79 20 64 65 70 65 6e 64 69 6e 67 + 20 6f 6e 20 68 6f 77 20 66 61 72 20 61 77 61 79 + 20 69 74 73 20 74 61 72 67 65 74 0a + + ~ "~ is, which changes the position of everything after. Or," + ~ " there may be a size" + 7e 20 69 73 2c 20 77 68 69 63 68 20 63 68 61 6e + 67 65 73 20 74 68 65 20 70 6f 73 69 74 69 6f 6e + 20 6f 66 20 65 76 65 72 79 74 68 69 6e 67 20 61 + 66 74 65 72 2e 20 4f 72 2c 20 74 68 65 72 65 20 + 6d 61 79 20 62 65 20 61 20 73 69 7a 65 0a + + ~ "~ limit on some particular segment and code may have to be" + ~ " entirely" + 7e 20 6c 69 6d 69 74 20 6f 6e 20 73 6f 6d 65 20 + 70 61 72 74 69 63 75 6c 61 72 20 73 65 67 6d 65 + 6e 74 20 61 6e 64 20 63 6f 64 65 20 6d 61 79 20 + 68 61 76 65 20 74 6f 20 62 65 20 65 6e 74 69 72 + 65 6c 79 0a + + ~ "~ reorganized to make things fit, splitting it into pieces" + ~ " or adding" + 7e 20 72 65 6f 72 67 61 6e 69 7a 65 64 20 74 6f + 20 6d 61 6b 65 20 74 68 69 6e 67 73 20 66 69 74 + 2c 20 73 70 6c 69 74 74 69 6e 67 20 69 74 20 69 + 6e 74 6f 20 70 69 65 63 65 73 20 6f 72 20 61 64 + 64 69 6e 67 0a + + ~ "~ trampolines." + 7e 20 74 72 61 6d 70 6f 6c 69 6e 65 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Often, this winds up being a hidden layer with immense" + ~ " complexity," + 7e 20 20 20 4f 66 74 65 6e 2c 20 74 68 69 73 20 + 77 69 6e 64 73 20 75 70 20 62 65 69 6e 67 20 61 + 20 68 69 64 64 65 6e 20 6c 61 79 65 72 20 77 69 + 74 68 20 69 6d 6d 65 6e 73 65 20 63 6f 6d 70 6c + 65 78 69 74 79 2c 0a + + ~ "~ implemented as part of a linker, that even compiler" + ~ " maintainers find obscure" + 7e 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 73 + 20 70 61 72 74 20 6f 66 20 61 20 6c 69 6e 6b 65 + 72 2c 20 74 68 61 74 20 65 76 65 6e 20 63 6f 6d + 70 69 6c 65 72 20 6d 61 69 6e 74 61 69 6e 65 72 + 73 20 66 69 6e 64 20 6f 62 73 63 75 72 65 0a + + ~ "~ and confusing." + 7e 20 61 6e 64 20 63 6f 6e 66 75 73 69 6e 67 2e + 0a + + ~ "~" + 7e 0a + + ~ "~ It's Irenes' position that we should engage with" + ~ " complexity rather than" + 7e 20 20 20 49 74 27 73 20 49 72 65 6e 65 73 27 + 20 70 6f 73 69 74 69 6f 6e 20 74 68 61 74 20 77 + 65 20 73 68 6f 75 6c 64 20 65 6e 67 61 67 65 20 + 77 69 74 68 20 63 6f 6d 70 6c 65 78 69 74 79 20 + 72 61 74 68 65 72 20 74 68 61 6e 0a + + ~ "~ encysting it. So, in Evocation we take a different" + ~ " approach, heavily" + 7e 20 65 6e 63 79 73 74 69 6e 67 20 69 74 2e 20 + 53 6f 2c 20 69 6e 20 45 76 6f 63 61 74 69 6f 6e + 20 77 65 20 74 61 6b 65 20 61 20 64 69 66 66 65 + 72 65 6e 74 20 61 70 70 72 6f 61 63 68 2c 20 68 + 65 61 76 69 6c 79 0a + + ~ "~ inspired by the semantics of a tool called flatassembler." + ~ " We provide" + 7e 20 69 6e 73 70 69 72 65 64 20 62 79 20 74 68 + 65 20 73 65 6d 61 6e 74 69 63 73 20 6f 66 20 61 + 20 74 6f 6f 6c 20 63 61 6c 6c 65 64 20 66 6c 61 + 74 61 73 73 65 6d 62 6c 65 72 2e 20 57 65 20 70 + 72 6f 76 69 64 65 0a + + ~ "~ downstream code with the basic operations set-label and" + ~ " use-label which it" + 7e 20 64 6f 77 6e 73 74 72 65 61 6d 20 63 6f 64 + 65 20 77 69 74 68 20 74 68 65 20 62 61 73 69 63 + 20 6f 70 65 72 61 74 69 6f 6e 73 20 73 65 74 2d + 6c 61 62 65 6c 20 61 6e 64 20 75 73 65 2d 6c 61 + 62 65 6c 20 77 68 69 63 68 20 69 74 0a + + ~ "~ can combine in whatever order it wants. We also provide a" + ~ " harness," + 7e 20 63 61 6e 20 63 6f 6d 62 69 6e 65 20 69 6e + 20 77 68 61 74 65 76 65 72 20 6f 72 64 65 72 20 + 69 74 20 77 61 6e 74 73 2e 20 57 65 20 61 6c 73 + 6f 20 70 72 6f 76 69 64 65 20 61 20 68 61 72 6e + 65 73 73 2c 0a + + ~ "~ label-loop, which takes an execution token for the" + ~ " downstream code" + 7e 20 6c 61 62 65 6c 2d 6c 6f 6f 70 2c 20 77 68 + 69 63 68 20 74 61 6b 65 73 20 61 6e 20 65 78 65 + 63 75 74 69 6f 6e 20 74 6f 6b 65 6e 20 66 6f 72 + 20 74 68 65 20 64 6f 77 6e 73 74 72 65 61 6d 20 + 63 6f 64 65 0a + + ~ "~ generator and runs it over and over, computing the" + ~ " mathematical fixed point" + 7e 20 67 65 6e 65 72 61 74 6f 72 20 61 6e 64 20 + 72 75 6e 73 20 69 74 20 6f 76 65 72 20 61 6e 64 + 20 6f 76 65 72 2c 20 63 6f 6d 70 75 74 69 6e 67 + 20 74 68 65 20 6d 61 74 68 65 6d 61 74 69 63 61 + 6c 20 66 69 78 65 64 20 70 6f 69 6e 74 0a + + ~ "~ of the label assignments." + 7e 20 6f 66 20 74 68 65 20 6c 61 62 65 6c 20 61 + 73 73 69 67 6e 6d 65 6e 74 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ On the first pass, label-loop guesses a value of zero" + ~ " for any label that's" + 7e 20 20 20 4f 6e 20 74 68 65 20 66 69 72 73 74 + 20 70 61 73 73 2c 20 6c 61 62 65 6c 2d 6c 6f 6f + 70 20 67 75 65 73 73 65 73 20 61 20 76 61 6c 75 + 65 20 6f 66 20 7a 65 72 6f 20 66 6f 72 20 61 6e + 79 20 6c 61 62 65 6c 20 74 68 61 74 27 73 0a + + ~ "~ used before it's set. On subsequent passes, each label" + ~ " starts with the value" + 7e 20 75 73 65 64 20 62 65 66 6f 72 65 20 69 74 + 27 73 20 73 65 74 2e 20 4f 6e 20 73 75 62 73 65 + 71 75 65 6e 74 20 70 61 73 73 65 73 2c 20 65 61 + 63 68 20 6c 61 62 65 6c 20 73 74 61 72 74 73 20 + 77 69 74 68 20 74 68 65 20 76 61 6c 75 65 0a + + ~ "~ it had on the previous pass. When we have a pass where" + ~ " labels end with the" + 7e 20 69 74 20 68 61 64 20 6f 6e 20 74 68 65 20 + 70 72 65 76 69 6f 75 73 20 70 61 73 73 2e 20 57 + 68 65 6e 20 77 65 20 68 61 76 65 20 61 20 70 61 + 73 73 20 77 68 65 72 65 20 6c 61 62 65 6c 73 20 + 65 6e 64 20 77 69 74 68 20 74 68 65 0a + + ~ "~ same value they started with, we say they've converged," + ~ " and we announce" + 7e 20 73 61 6d 65 20 76 61 6c 75 65 20 74 68 65 + 79 20 73 74 61 72 74 65 64 20 77 69 74 68 2c 20 + 77 65 20 73 61 79 20 74 68 65 79 27 76 65 20 63 + 6f 6e 76 65 72 67 65 64 2c 20 61 6e 64 20 77 65 + 20 61 6e 6e 6f 75 6e 63 65 0a + + ~ "~ success. If a hundred passes go by without convergence," + ~ " we fail instead." + 7e 20 73 75 63 63 65 73 73 2e 20 49 66 20 61 20 + 68 75 6e 64 72 65 64 20 70 61 73 73 65 73 20 67 + 6f 20 62 79 20 77 69 74 68 6f 75 74 20 63 6f 6e + 76 65 72 67 65 6e 63 65 2c 20 77 65 20 66 61 69 + 6c 20 69 6e 73 74 65 61 64 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Importantly, the label facility does not have an" + ~ " opinion on where or how" + 7e 20 20 20 49 6d 70 6f 72 74 61 6e 74 6c 79 2c + 20 74 68 65 20 6c 61 62 65 6c 20 66 61 63 69 6c + 69 74 79 20 64 6f 65 73 20 6e 6f 74 20 68 61 76 + 65 20 61 6e 20 6f 70 69 6e 69 6f 6e 20 6f 6e 20 + 77 68 65 72 65 20 6f 72 20 68 6f 77 0a + + ~ "~ the values of labels should be output, nor does it have" + ~ " concepts of" + 7e 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 + 6c 61 62 65 6c 73 20 73 68 6f 75 6c 64 20 62 65 + 20 6f 75 74 70 75 74 2c 20 6e 6f 72 20 64 6f 65 + 73 20 69 74 20 68 61 76 65 20 63 6f 6e 63 65 70 + 74 73 20 6f 66 0a + + ~ "~ dependency tracking or topological sorting. It only cares" + ~ " about the sequence" + 7e 20 64 65 70 65 6e 64 65 6e 63 79 20 74 72 61 + 63 6b 69 6e 67 20 6f 72 20 74 6f 70 6f 6c 6f 67 + 69 63 61 6c 20 73 6f 72 74 69 6e 67 2e 20 49 74 + 20 6f 6e 6c 79 20 63 61 72 65 73 20 61 62 6f 75 + 74 20 74 68 65 20 73 65 71 75 65 6e 63 65 0a + + ~ "~ of set- and use-operations. Code relying on the facility" + ~ " is free to make" + 7e 20 6f 66 20 73 65 74 2d 20 61 6e 64 20 75 73 + 65 2d 6f 70 65 72 61 74 69 6f 6e 73 2e 20 43 6f + 64 65 20 72 65 6c 79 69 6e 67 20 6f 6e 20 74 68 + 65 20 66 61 63 69 6c 69 74 79 20 69 73 20 66 72 + 65 65 20 74 6f 20 6d 61 6b 65 0a + + ~ "~ arbitrarily complex decisions about the layout, size," + ~ " contents etc of its" + 7e 20 61 72 62 69 74 72 61 72 69 6c 79 20 63 6f + 6d 70 6c 65 78 20 64 65 63 69 73 69 6f 6e 73 20 + 61 62 6f 75 74 20 74 68 65 20 6c 61 79 6f 75 74 + 2c 20 73 69 7a 65 2c 20 63 6f 6e 74 65 6e 74 73 + 20 65 74 63 20 6f 66 20 69 74 73 0a + + ~ "~ output, and to use label values as part of those" + ~ " decisions. It is the" + 7e 20 6f 75 74 70 75 74 2c 20 61 6e 64 20 74 6f + 20 75 73 65 20 6c 61 62 65 6c 20 76 61 6c 75 65 + 73 20 61 73 20 70 61 72 74 20 6f 66 20 74 68 6f + 73 65 20 64 65 63 69 73 69 6f 6e 73 2e 20 49 74 + 20 69 73 20 74 68 65 0a + + ~ "~ responsibility of this relying code to ensure the process" + ~ " converges, by" + 7e 20 72 65 73 70 6f 6e 73 69 62 69 6c 69 74 79 + 20 6f 66 20 74 68 69 73 20 72 65 6c 79 69 6e 67 + 20 63 6f 64 65 20 74 6f 20 65 6e 73 75 72 65 20 + 74 68 65 20 70 72 6f 63 65 73 73 20 63 6f 6e 76 + 65 72 67 65 73 2c 20 62 79 0a + + ~ "~ whatever means it wishes." + 7e 20 77 68 61 74 65 76 65 72 20 6d 65 61 6e 73 + 20 69 74 20 77 69 73 68 65 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Since the label facility is not directly involved in" + ~ " output, it is also" + 7e 20 20 20 53 69 6e 63 65 20 74 68 65 20 6c 61 + 62 65 6c 20 66 61 63 69 6c 69 74 79 20 69 73 20 + 6e 6f 74 20 64 69 72 65 63 74 6c 79 20 69 6e 76 + 6f 6c 76 65 64 20 69 6e 20 6f 75 74 70 75 74 2c + 20 69 74 20 69 73 20 61 6c 73 6f 0a + + ~ "~ permissible for code relying on it to make retroactive" + ~ " changes to the" + 7e 20 70 65 72 6d 69 73 73 69 62 6c 65 20 66 6f + 72 20 63 6f 64 65 20 72 65 6c 79 69 6e 67 20 6f + 6e 20 69 74 20 74 6f 20 6d 61 6b 65 20 72 65 74 + 72 6f 61 63 74 69 76 65 20 63 68 61 6e 67 65 73 + 20 74 6f 20 74 68 65 0a + + ~ "~ output, as long as all such changes are completed before" + ~ " returning control" + 7e 20 6f 75 74 70 75 74 2c 20 61 73 20 6c 6f 6e + 67 20 61 73 20 61 6c 6c 20 73 75 63 68 20 63 68 + 61 6e 67 65 73 20 61 72 65 20 63 6f 6d 70 6c 65 + 74 65 64 20 62 65 66 6f 72 65 20 72 65 74 75 72 + 6e 69 6e 67 20 63 6f 6e 74 72 6f 6c 0a + + ~ "~ to label-loop." + 7e 20 74 6f 20 6c 61 62 65 6c 2d 6c 6f 6f 70 2e + 0a + + ~ "~" + 7e 0a + + ~ "~ Most of the time, the shorthand words L@' and L!' will" + ~ " be all you need to" + 7e 20 20 20 4d 6f 73 74 20 6f 66 20 74 68 65 20 + 74 69 6d 65 2c 20 74 68 65 20 73 68 6f 72 74 68 + 61 6e 64 20 77 6f 72 64 73 20 4c 40 27 20 61 6e + 64 20 4c 21 27 20 77 69 6c 6c 20 62 65 20 61 6c + 6c 20 79 6f 75 20 6e 65 65 64 20 74 6f 0a + + ~ "~ use from your own code." + 7e 20 75 73 65 20 66 72 6f 6d 20 79 6f 75 72 20 + 6f 77 6e 20 63 6f 64 65 2e 0a + + ~ "" + 0a + + ~ "~ The labels data structure is a linked list of" + ~ " dictionary entries, with" + 7e 20 20 20 54 68 65 20 6c 61 62 65 6c 73 20 64 + 61 74 61 20 73 74 72 75 63 74 75 72 65 20 69 73 + 20 61 20 6c 69 6e 6b 65 64 20 6c 69 73 74 20 6f + 66 20 64 69 63 74 69 6f 6e 61 72 79 20 65 6e 74 + 72 69 65 73 2c 20 77 69 74 68 0a + + ~ "~ the same header format as the main Evocation dictionary," + ~ " but instead of" + 7e 20 74 68 65 20 73 61 6d 65 20 68 65 61 64 65 + 72 20 66 6f 72 6d 61 74 20 61 73 20 74 68 65 20 + 6d 61 69 6e 20 45 76 6f 63 61 74 69 6f 6e 20 64 + 69 63 74 69 6f 6e 61 72 79 2c 20 62 75 74 20 69 + 6e 73 74 65 61 64 20 6f 66 0a + + ~ "~ being executable, each holds two words of data: status" + ~ " bits, and a value," + 7e 20 62 65 69 6e 67 20 65 78 65 63 75 74 61 62 + 6c 65 2c 20 65 61 63 68 20 68 6f 6c 64 73 20 74 + 77 6f 20 77 6f 72 64 73 20 6f 66 20 64 61 74 61 + 3a 20 73 74 61 74 75 73 20 62 69 74 73 2c 20 61 + 6e 64 20 61 20 76 61 6c 75 65 2c 0a + + ~ "~ in that order. There's no "docol" pointer or anything of" + ~ " the sort." + 7e 20 69 6e 20 74 68 61 74 20 6f 72 64 65 72 2e + 20 54 68 65 72 65 27 73 20 6e 6f 20 22 64 6f 63 + 6f 6c 22 20 70 6f 69 6e 74 65 72 20 6f 72 20 61 + 6e 79 74 68 69 6e 67 20 6f 66 20 74 68 65 20 73 + 6f 72 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Status is a bit field:" + 7e 20 20 20 53 74 61 74 75 73 20 69 73 20 61 20 + 62 69 74 20 66 69 65 6c 64 3a 0a + + ~ "~ bit zero is whether it's been used" + 7e 20 20 20 20 62 69 74 20 7a 65 72 6f 20 69 73 + 20 77 68 65 74 68 65 72 20 69 74 27 73 20 62 65 + 65 6e 20 75 73 65 64 0a + + ~ "~ bit one is whether it's been defined" + 7e 20 20 20 20 62 69 74 20 6f 6e 65 20 69 73 20 + 77 68 65 74 68 65 72 20 69 74 27 73 20 62 65 65 + 6e 20 64 65 66 69 6e 65 64 0a + + ~ "~ bit two is whether it was used before being defined" + 7e 20 20 20 20 62 69 74 20 74 77 6f 20 69 73 20 + 77 68 65 74 68 65 72 20 69 74 20 77 61 73 20 75 + 73 65 64 20 62 65 66 6f 72 65 20 62 65 69 6e 67 + 20 64 65 66 69 6e 65 64 0a + + ~ "~ bit three is whether the guessed value wound up" + ~ " equaling the actual value" + 7e 20 20 20 20 62 69 74 20 74 68 72 65 65 20 69 + 73 20 77 68 65 74 68 65 72 20 74 68 65 20 67 75 + 65 73 73 65 64 20 76 61 6c 75 65 20 77 6f 75 6e + 64 20 75 70 20 65 71 75 61 6c 69 6e 67 20 74 68 + 65 20 61 63 74 75 61 6c 20 76 61 6c 75 65 0a + + ~ "~" + 7e 0a + + ~ "~ Just as the Evocation dictionary uses the global" + ~ " variable "latest" as a" + 7e 20 20 20 4a 75 73 74 20 61 73 20 74 68 65 20 + 45 76 6f 63 61 74 69 6f 6e 20 64 69 63 74 69 6f + 6e 61 72 79 20 75 73 65 73 20 74 68 65 20 67 6c + 6f 62 61 6c 20 76 61 72 69 61 62 6c 65 20 22 6c + 61 74 65 73 74 22 20 61 73 20 61 0a + + ~ "~ handle (a pointer to a pointer) beginning a linked list" + ~ " of entries, so the" + 7e 20 68 61 6e 64 6c 65 20 28 61 20 70 6f 69 6e + 74 65 72 20 74 6f 20 61 20 70 6f 69 6e 74 65 72 + 29 20 62 65 67 69 6e 6e 69 6e 67 20 61 20 6c 69 + 6e 6b 65 64 20 6c 69 73 74 20 6f 66 20 65 6e 74 + 72 69 65 73 2c 20 73 6f 20 74 68 65 0a + + ~ "~ label dictionary also uses a handle variable, named" + ~ " "labels". We initialize" + 7e 20 6c 61 62 65 6c 20 64 69 63 74 69 6f 6e 61 + 72 79 20 61 6c 73 6f 20 75 73 65 73 20 61 20 68 + 61 6e 64 6c 65 20 76 61 72 69 61 62 6c 65 2c 20 + 6e 61 6d 65 64 20 22 6c 61 62 65 6c 73 22 2e 20 + 57 65 20 69 6e 69 74 69 61 6c 69 7a 65 0a + + ~ "~ it here." + 7e 20 69 74 20 68 65 72 65 2e 0a + + ~ "8 allocate s" labels" variable 0 labels !" + 38 20 61 6c 6c 6f 63 61 74 65 20 73 22 20 6c 61 + 62 65 6c 73 22 20 76 61 72 69 61 62 6c 65 20 30 + 20 6c 61 62 65 6c 73 20 21 0a + + ~ "" + 0a + + ~ "~ This is analogous to word-heading, but prints label" + ~ " information." + 7e 20 20 20 54 68 69 73 20 69 73 20 61 6e 61 6c + 6f 67 6f 75 73 20 74 6f 20 77 6f 72 64 2d 68 65 + 61 64 69 6e 67 2c 20 62 75 74 20 70 72 69 6e 74 + 73 20 6c 61 62 65 6c 20 69 6e 66 6f 72 6d 61 74 + 69 6f 6e 2e 0a + + ~ "~ (entry pointer --)" + 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 65 72 + 20 2d 2d 29 0a + + ~ ": label-heading" + 3a 20 6c 61 62 65 6c 2d 68 65 61 64 69 6e 67 0a + + ~ " dup entry-to-name dup emitstring space" + 20 20 64 75 70 20 65 6e 74 72 79 2d 74 6f 2d 6e + 61 6d 65 20 64 75 70 20 65 6d 69 74 73 74 72 69 + 6e 67 20 73 70 61 63 65 0a + + ~ " stringlen 1+ 54 swap - 0 max indent" + 20 20 73 74 72 69 6e 67 6c 65 6e 20 31 2b 20 35 + 34 20 73 77 61 70 20 2d 20 30 20 6d 61 78 20 69 + 6e 64 65 6e 74 0a + + ~ " entry-to-execution-token dup 8 + @ .hex64 space @ .hex8" + 20 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 64 75 70 20 38 + 20 2b 20 40 20 2e 68 65 78 36 34 20 73 70 61 63 + 65 20 40 20 2e 68 65 78 38 0a + + ~ " newline ;" + 20 20 6e 65 77 6c 69 6e 65 20 3b 0a + + ~ "" + 0a + + ~ "~ This prints the headings for all the labels that have" + ~ " been created. Note" + 7e 20 20 20 54 68 69 73 20 70 72 69 6e 74 73 20 + 74 68 65 20 68 65 61 64 69 6e 67 73 20 66 6f 72 + 20 61 6c 6c 20 74 68 65 20 6c 61 62 65 6c 73 20 + 74 68 61 74 20 68 61 76 65 20 62 65 65 6e 20 63 + 72 65 61 74 65 64 2e 20 4e 6f 74 65 0a + + ~ "~ that labels that have been created once stay in the" + ~ " dictionary forever, even" + 7e 20 74 68 61 74 20 6c 61 62 65 6c 73 20 74 68 + 61 74 20 68 61 76 65 20 62 65 65 6e 20 63 72 65 + 61 74 65 64 20 6f 6e 63 65 20 73 74 61 79 20 69 + 6e 20 74 68 65 20 64 69 63 74 69 6f 6e 61 72 79 + 20 66 6f 72 65 76 65 72 2c 20 65 76 65 6e 0a + + ~ "~ if subsequent passes neither use nor define them. That's" + ~ " because the control" + 7e 20 69 66 20 73 75 62 73 65 71 75 65 6e 74 20 + 70 61 73 73 65 73 20 6e 65 69 74 68 65 72 20 75 + 73 65 20 6e 6f 72 20 64 65 66 69 6e 65 20 74 68 + 65 6d 2e 20 54 68 61 74 27 73 20 62 65 63 61 75 + 73 65 20 74 68 65 20 63 6f 6e 74 72 6f 6c 0a + + ~ "~ loop has no way to know if they're still important; it's" + ~ " up to downstream" + 7e 20 6c 6f 6f 70 20 68 61 73 20 6e 6f 20 77 61 + 79 20 74 6f 20 6b 6e 6f 77 20 69 66 20 74 68 65 + 79 27 72 65 20 73 74 69 6c 6c 20 69 6d 70 6f 72 + 74 61 6e 74 3b 20 69 74 27 73 20 75 70 20 74 6f + 20 64 6f 77 6e 73 74 72 65 61 6d 0a + + ~ "~ code to decide that. Everything has been carefully set up" + ~ " so that disused" + 7e 20 63 6f 64 65 20 74 6f 20 64 65 63 69 64 65 + 20 74 68 61 74 2e 20 45 76 65 72 79 74 68 69 6e + 67 20 68 61 73 20 62 65 65 6e 20 63 61 72 65 66 + 75 6c 6c 79 20 73 65 74 20 75 70 20 73 6f 20 74 + 68 61 74 20 64 69 73 75 73 65 64 0a + + ~ "~ labels don't hurt anything." + 7e 20 6c 61 62 65 6c 73 20 64 6f 6e 27 74 20 68 + 75 72 74 20 61 6e 79 74 68 69 6e 67 2e 0a + + ~ ": list-labels" + 3a 20 6c 69 73 74 2d 6c 61 62 65 6c 73 0a + + ~ " labels oldest-entry-in { dup }" + 20 20 6c 61 62 65 6c 73 20 6f 6c 64 65 73 74 2d + 65 6e 74 72 79 2d 69 6e 20 7b 20 64 75 70 20 7d + 0a + + ~ " { dup label-heading labels next-newer-entry-in } while" + ~ " drop ;" + 20 20 7b 20 64 75 70 20 6c 61 62 65 6c 2d 68 65 + 61 64 69 6e 67 20 6c 61 62 65 6c 73 20 6e 65 78 + 74 2d 6e 65 77 65 72 2d 65 6e 74 72 79 2d 69 6e + 20 7d 20 77 68 69 6c 65 20 64 72 6f 70 20 3b 0a + + ~ "" + 0a + + ~ "~ This looks up a label by name if it exists, or returns" + ~ " 0 if it doesn't." + 7e 20 20 20 54 68 69 73 20 6c 6f 6f 6b 73 20 75 + 70 20 61 20 6c 61 62 65 6c 20 62 79 20 6e 61 6d + 65 20 69 66 20 69 74 20 65 78 69 73 74 73 2c 20 + 6f 72 20 72 65 74 75 72 6e 73 20 30 20 69 66 20 + 69 74 20 64 6f 65 73 6e 27 74 2e 0a + + ~ "~ The return value if it's found is an entry pointer." + 7e 20 54 68 65 20 72 65 74 75 72 6e 20 76 61 6c + 75 65 20 69 66 20 69 74 27 73 20 66 6f 75 6e 64 + 20 69 73 20 61 6e 20 65 6e 74 72 79 20 70 6f 69 + 6e 74 65 72 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Keep in mind that this is a pointer to the entry in the" + ~ " label dictionary," + 7e 20 20 20 4b 65 65 70 20 69 6e 20 6d 69 6e 64 + 20 74 68 61 74 20 74 68 69 73 20 69 73 20 61 20 + 70 6f 69 6e 74 65 72 20 74 6f 20 74 68 65 20 65 + 6e 74 72 79 20 69 6e 20 74 68 65 20 6c 61 62 65 + 6c 20 64 69 63 74 69 6f 6e 61 72 79 2c 0a + + ~ "~ not the label's value. It's common for a label's value to" + ~ " itself be a" + 7e 20 6e 6f 74 20 74 68 65 20 6c 61 62 65 6c 27 + 73 20 76 61 6c 75 65 2e 20 49 74 27 73 20 63 6f + 6d 6d 6f 6e 20 66 6f 72 20 61 20 6c 61 62 65 6c + 27 73 20 76 61 6c 75 65 20 74 6f 20 69 74 73 65 + 6c 66 20 62 65 20 61 0a + + ~ "~ pointer to a dictionary entry, in the program being" + ~ " compiled, so it's easy" + 7e 20 70 6f 69 6e 74 65 72 20 74 6f 20 61 20 64 + 69 63 74 69 6f 6e 61 72 79 20 65 6e 74 72 79 2c + 20 69 6e 20 74 68 65 20 70 72 6f 67 72 61 6d 20 + 62 65 69 6e 67 20 63 6f 6d 70 69 6c 65 64 2c 20 + 73 6f 20 69 74 27 73 20 65 61 73 79 0a + + ~ "~ to confuse that." + 7e 20 74 6f 20 63 6f 6e 66 75 73 65 20 74 68 61 + 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (name string pointer -- label entry pointer)" + 7e 20 28 6e 61 6d 65 20 73 74 72 69 6e 67 20 70 + 6f 69 6e 74 65 72 20 2d 2d 20 6c 61 62 65 6c 20 + 65 6e 74 72 79 20 70 6f 69 6e 74 65 72 29 0a + + ~ ": find-label labels swap find-in ;" + 3a 20 66 69 6e 64 2d 6c 61 62 65 6c 20 6c 61 62 + 65 6c 73 20 73 77 61 70 20 66 69 6e 64 2d 69 6e + 20 3b 0a + + ~ "" + 0a + + ~ "~ This creates a new label given a name for it," + ~ " initializing its value and" + 7e 20 20 20 54 68 69 73 20 63 72 65 61 74 65 73 + 20 61 20 6e 65 77 20 6c 61 62 65 6c 20 67 69 76 + 65 6e 20 61 20 6e 61 6d 65 20 66 6f 72 20 69 74 + 2c 20 69 6e 69 74 69 61 6c 69 7a 69 6e 67 20 69 + 74 73 20 76 61 6c 75 65 20 61 6e 64 0a + + ~ "~ status to zero and adding it to the label dictionary." + ~ " This is responsible" + 7e 20 73 74 61 74 75 73 20 74 6f 20 7a 65 72 6f + 20 61 6e 64 20 61 64 64 69 6e 67 20 69 74 20 74 + 6f 20 74 68 65 20 6c 61 62 65 6c 20 64 69 63 74 + 69 6f 6e 61 72 79 2e 20 54 68 69 73 20 69 73 20 + 72 65 73 70 6f 6e 73 69 62 6c 65 0a + + ~ "~ for the initial guess of zero on the first pass." + 7e 20 66 6f 72 20 74 68 65 20 69 6e 69 74 69 61 + 6c 20 67 75 65 73 73 20 6f 66 20 7a 65 72 6f 20 + 6f 6e 20 74 68 65 20 66 69 72 73 74 20 70 61 73 + 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (name string pointer -- )" + 7e 20 28 6e 61 6d 65 20 73 74 72 69 6e 67 20 70 + 6f 69 6e 74 65 72 20 2d 2d 20 29 0a + + ~ ": new-label labels create-in 0 , 0 , ;" + 3a 20 6e 65 77 2d 6c 61 62 65 6c 20 6c 61 62 65 + 6c 73 20 63 72 65 61 74 65 2d 69 6e 20 30 20 2c + 20 30 20 2c 20 3b 0a + + ~ "" + 0a + + ~ "~ These helpers take a label entry pointer and return" + ~ " pointers to the status" + 7e 20 20 20 54 68 65 73 65 20 68 65 6c 70 65 72 + 73 20 74 61 6b 65 20 61 20 6c 61 62 65 6c 20 65 + 6e 74 72 79 20 70 6f 69 6e 74 65 72 20 61 6e 64 + 20 72 65 74 75 72 6e 20 70 6f 69 6e 74 65 72 73 + 20 74 6f 20 74 68 65 20 73 74 61 74 75 73 0a + + ~ "~ and value fields." + 7e 20 61 6e 64 20 76 61 6c 75 65 20 66 69 65 6c + 64 73 2e 0a + + ~ ": label-status entry-to-execution-token ;" + 3a 20 6c 61 62 65 6c 2d 73 74 61 74 75 73 20 65 + 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 69 6f + 6e 2d 74 6f 6b 65 6e 20 3b 0a + + ~ ": label-value entry-to-execution-token 8 + ;" + 3a 20 6c 61 62 65 6c 2d 76 61 6c 75 65 20 65 6e + 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 69 6f 6e + 2d 74 6f 6b 65 6e 20 38 20 2b 20 3b 0a + + ~ "" + 0a + + ~ "~ This looks up a label by name if it exists, or creates" + ~ " it if it doesn't." + 7e 20 20 20 54 68 69 73 20 6c 6f 6f 6b 73 20 75 + 70 20 61 20 6c 61 62 65 6c 20 62 79 20 6e 61 6d + 65 20 69 66 20 69 74 20 65 78 69 73 74 73 2c 20 + 6f 72 20 63 72 65 61 74 65 73 20 69 74 20 69 66 + 20 69 74 20 64 6f 65 73 6e 27 74 2e 0a + + ~ "~ Either way, it returns an entry pointer. It's named after" + ~ " the function" + 7e 20 45 69 74 68 65 72 20 77 61 79 2c 20 69 74 + 20 72 65 74 75 72 6e 73 20 61 6e 20 65 6e 74 72 + 79 20 70 6f 69 6e 74 65 72 2e 20 49 74 27 73 20 + 6e 61 6d 65 64 20 61 66 74 65 72 20 74 68 65 20 + 66 75 6e 63 74 69 6f 6e 0a + + ~ "~ "intern" that many Lisp dialects have." + 7e 20 22 69 6e 74 65 72 6e 22 20 74 68 61 74 20 + 6d 61 6e 79 20 4c 69 73 70 20 64 69 61 6c 65 63 + 74 73 20 68 61 76 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (name string pointer -- label entry pointer)" + 7e 20 28 6e 61 6d 65 20 73 74 72 69 6e 67 20 70 + 6f 69 6e 74 65 72 20 2d 2d 20 6c 61 62 65 6c 20 + 65 6e 74 72 79 20 70 6f 69 6e 74 65 72 29 0a + + ~ ": intern-label" + 3a 20 69 6e 74 65 72 6e 2d 6c 61 62 65 6c 0a + + ~ " dup find-label" + 20 20 64 75 70 20 66 69 6e 64 2d 6c 61 62 65 6c + 0a + + ~ " dup { swap drop }" + 20 20 64 75 70 20 7b 20 73 77 61 70 20 64 72 6f + 70 20 7d 0a + + ~ " { drop dup new-label labels swap find-in } if-else ;" + 20 20 20 20 20 20 7b 20 64 72 6f 70 20 64 75 70 + 20 6e 65 77 2d 6c 61 62 65 6c 20 6c 61 62 65 6c + 73 20 73 77 61 70 20 66 69 6e 64 2d 69 6e 20 7d + 20 69 66 2d 65 6c 73 65 20 3b 0a + + ~ "" + 0a + + ~ "~ This returns the value of a label, also doing all" + ~ " necessary status checks" + 7e 20 20 20 54 68 69 73 20 72 65 74 75 72 6e 73 + 20 74 68 65 20 76 61 6c 75 65 20 6f 66 20 61 20 + 6c 61 62 65 6c 2c 20 61 6c 73 6f 20 64 6f 69 6e + 67 20 61 6c 6c 20 6e 65 63 65 73 73 61 72 79 20 + 73 74 61 74 75 73 20 63 68 65 63 6b 73 0a + + ~ "~ and updates to keep track of the circumstances under" + ~ " which it was used. The" + 7e 20 61 6e 64 20 75 70 64 61 74 65 73 20 74 6f + 20 6b 65 65 70 20 74 72 61 63 6b 20 6f 66 20 74 + 68 65 20 63 69 72 63 75 6d 73 74 61 6e 63 65 73 + 20 75 6e 64 65 72 20 77 68 69 63 68 20 69 74 20 + 77 61 73 20 75 73 65 64 2e 20 54 68 65 0a + + ~ "~ label loop relies on all read accesses going through this" + ~ " word." + 7e 20 6c 61 62 65 6c 20 6c 6f 6f 70 20 72 65 6c + 69 65 73 20 6f 6e 20 61 6c 6c 20 72 65 61 64 20 + 61 63 63 65 73 73 65 73 20 67 6f 69 6e 67 20 74 + 68 72 6f 75 67 68 20 74 68 69 73 20 77 6f 72 64 + 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (label entry pointer -- label value)" + 7e 20 28 6c 61 62 65 6c 20 65 6e 74 72 79 20 70 + 6f 69 6e 74 65 72 20 2d 2d 20 6c 61 62 65 6c 20 + 76 61 6c 75 65 29 0a + + ~ ": use-label" + 3a 20 75 73 65 2d 6c 61 62 65 6c 0a + + ~ " ~ If it hasn't been defined yet, mark it" + ~ " used-before-set." + 20 20 7e 20 49 66 20 69 74 20 68 61 73 6e 27 74 + 20 62 65 65 6e 20 64 65 66 69 6e 65 64 20 79 65 + 74 2c 20 6d 61 72 6b 20 69 74 20 75 73 65 64 2d + 62 65 66 6f 72 65 2d 73 65 74 2e 0a + + ~ " dup label-status dup @ dup 0x02 & not" + 20 20 64 75 70 20 6c 61 62 65 6c 2d 73 74 61 74 + 75 73 20 64 75 70 20 40 20 64 75 70 20 30 78 30 + 32 20 26 20 6e 6f 74 0a + + ~ " { 0x04 | swap ! } { drop drop } if-else" + 20 20 7b 20 30 78 30 34 20 7c 20 73 77 61 70 20 + 21 20 7d 20 7b 20 64 72 6f 70 20 64 72 6f 70 20 + 7d 20 69 66 2d 65 6c 73 65 0a + + ~ "" + 0a + + ~ " ~ Mark it used. It's faster to just do this than to check" + ~ " if it's needed." + 20 20 7e 20 4d 61 72 6b 20 69 74 20 75 73 65 64 + 2e 20 49 74 27 73 20 66 61 73 74 65 72 20 74 6f + 20 6a 75 73 74 20 64 6f 20 74 68 69 73 20 74 68 + 61 6e 20 74 6f 20 63 68 65 63 6b 20 69 66 20 69 + 74 27 73 20 6e 65 65 64 65 64 2e 0a + + ~ " dup label-status dup @ 0x01 | swap !" + 20 20 64 75 70 20 6c 61 62 65 6c 2d 73 74 61 74 + 75 73 20 64 75 70 20 40 20 30 78 30 31 20 7c 20 + 73 77 61 70 20 21 0a + + ~ "" + 0a + + ~ " ~ TODO putting a provide-label magic comment command here" + ~ " would be lovely" + 20 20 7e 20 54 4f 44 4f 20 70 75 74 74 69 6e 67 + 20 61 20 70 72 6f 76 69 64 65 2d 6c 61 62 65 6c + 20 6d 61 67 69 63 20 63 6f 6d 6d 65 6e 74 20 63 + 6f 6d 6d 61 6e 64 20 68 65 72 65 20 77 6f 75 6c + 64 20 62 65 20 6c 6f 76 65 6c 79 0a + + ~ "" + 0a + + ~ " ~ Return the guessed value." + 20 20 7e 20 52 65 74 75 72 6e 20 74 68 65 20 67 + 75 65 73 73 65 64 20 76 61 6c 75 65 2e 0a + + ~ " label-value @ ;" + 20 20 6c 61 62 65 6c 2d 76 61 6c 75 65 20 40 20 + 3b 0a + + ~ "" + 0a + + ~ "~ This overwrites the value of a label, also doing all" + ~ " necessary status" + 7e 20 20 20 54 68 69 73 20 6f 76 65 72 77 72 69 + 74 65 73 20 74 68 65 20 76 61 6c 75 65 20 6f 66 + 20 61 20 6c 61 62 65 6c 2c 20 61 6c 73 6f 20 64 + 6f 69 6e 67 20 61 6c 6c 20 6e 65 63 65 73 73 61 + 72 79 20 73 74 61 74 75 73 0a + + ~ "~ checks and updates to keep track of the cirumstances" + ~ " under which it was" + 7e 20 63 68 65 63 6b 73 20 61 6e 64 20 75 70 64 + 61 74 65 73 20 74 6f 20 6b 65 65 70 20 74 72 61 + 63 6b 20 6f 66 20 74 68 65 20 63 69 72 75 6d 73 + 74 61 6e 63 65 73 20 75 6e 64 65 72 20 77 68 69 + 63 68 20 69 74 20 77 61 73 0a + + ~ "~ set. The label loop relies on all write accesses going" + ~ " through this word." + 7e 20 73 65 74 2e 20 54 68 65 20 6c 61 62 65 6c + 20 6c 6f 6f 70 20 72 65 6c 69 65 73 20 6f 6e 20 + 61 6c 6c 20 77 72 69 74 65 20 61 63 63 65 73 73 + 65 73 20 67 6f 69 6e 67 20 74 68 72 6f 75 67 68 + 20 74 68 69 73 20 77 6f 72 64 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (new label value, label entry pointer --)" + 7e 20 28 6e 65 77 20 6c 61 62 65 6c 20 76 61 6c + 75 65 2c 20 6c 61 62 65 6c 20 65 6e 74 72 79 20 + 70 6f 69 6e 74 65 72 20 2d 2d 29 0a + + ~ ": set-label" + 3a 20 73 65 74 2d 6c 61 62 65 6c 0a + + ~ " dup label-status @" + 20 20 64 75 70 20 6c 61 62 65 6c 2d 73 74 61 74 + 75 73 20 40 0a + + ~ " ~ (new value, entry, initial status)" + 20 20 7e 20 28 6e 65 77 20 76 61 6c 75 65 2c 20 + 65 6e 74 72 79 2c 20 69 6e 69 74 69 61 6c 20 73 + 74 61 74 75 73 29 0a + + ~ "" + 0a + + ~ " ~ Exit, and print a diagnostic, if the label was" + ~ " already set on this pass." + 20 20 7e 20 20 20 45 78 69 74 2c 20 61 6e 64 20 + 70 72 69 6e 74 20 61 20 64 69 61 67 6e 6f 73 74 + 69 63 2c 20 69 66 20 74 68 65 20 6c 61 62 65 6c + 20 77 61 73 20 61 6c 72 65 61 64 79 20 73 65 74 + 20 6f 6e 20 74 68 69 73 20 70 61 73 73 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ Without cooperation from user code, there's no great" + ~ " way to communicate" + 20 20 7e 20 20 20 57 69 74 68 6f 75 74 20 63 6f + 6f 70 65 72 61 74 69 6f 6e 20 66 72 6f 6d 20 75 + 73 65 72 20 63 6f 64 65 2c 20 74 68 65 72 65 27 + 73 20 6e 6f 20 67 72 65 61 74 20 77 61 79 20 74 + 6f 20 63 6f 6d 6d 75 6e 69 63 61 74 65 0a + + ~ " ~ up the call stack that execution should stop, so we" + ~ " don't try to." + 20 20 7e 20 75 70 20 74 68 65 20 63 61 6c 6c 20 + 73 74 61 63 6b 20 74 68 61 74 20 65 78 65 63 75 + 74 69 6f 6e 20 73 68 6f 75 6c 64 20 73 74 6f 70 + 2c 20 73 6f 20 77 65 20 64 6f 6e 27 74 20 74 72 + 79 20 74 6f 2e 0a + + ~ " dup 0x02 & { drop swap drop" + 20 20 64 75 70 20 30 78 30 32 20 26 20 7b 20 64 + 72 6f 70 20 73 77 61 70 20 64 72 6f 70 0a + + ~ " ." Failed by attempting to redefine "" + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2e + 22 20 46 61 69 6c 65 64 20 62 79 20 61 74 74 65 + 6d 70 74 69 6e 67 20 74 6f 20 72 65 64 65 66 69 + 6e 65 20 22 0a + + ~ " entry-to-name emitstring newline exit } if" + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 65 + 6e 74 72 79 2d 74 6f 2d 6e 61 6d 65 20 65 6d 69 + 74 73 74 72 69 6e 67 20 6e 65 77 6c 69 6e 65 20 + 65 78 69 74 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ We always set the defined bit to true. We leave the" + ~ " other status bits" + 20 20 7e 20 57 65 20 61 6c 77 61 79 73 20 73 65 + 74 20 74 68 65 20 64 65 66 69 6e 65 64 20 62 69 + 74 20 74 6f 20 74 72 75 65 2e 20 57 65 20 6c 65 + 61 76 65 20 74 68 65 20 6f 74 68 65 72 20 73 74 + 61 74 75 73 20 62 69 74 73 0a + + ~ " ~ as-is, except that we check whether it's unused up to" + ~ " now, and whether" + 20 20 7e 20 61 73 2d 69 73 2c 20 65 78 63 65 70 + 74 20 74 68 61 74 20 77 65 20 63 68 65 63 6b 20 + 77 68 65 74 68 65 72 20 69 74 27 73 20 75 6e 75 + 73 65 64 20 75 70 20 74 6f 20 6e 6f 77 2c 20 61 + 6e 64 20 77 68 65 74 68 65 72 0a + + ~ " ~ the previous value equals the new value. If either of" + ~ " those holds, we set" + 20 20 7e 20 74 68 65 20 70 72 65 76 69 6f 75 73 + 20 76 61 6c 75 65 20 65 71 75 61 6c 73 20 74 68 + 65 20 6e 65 77 20 76 61 6c 75 65 2e 20 49 66 20 + 65 69 74 68 65 72 20 6f 66 20 74 68 6f 73 65 20 + 68 6f 6c 64 73 2c 20 77 65 20 73 65 74 0a + + ~ " ~ the guessed-equals-actual bit to true." + 20 20 7e 20 74 68 65 20 67 75 65 73 73 65 64 2d + 65 71 75 61 6c 73 2d 61 63 74 75 61 6c 20 62 69 + 74 20 74 6f 20 74 72 75 65 2e 0a + + ~ " 0x02 |" + 20 20 30 78 30 32 20 7c 0a + + ~ " ~ (new value, entry, updated status)" + 20 20 7e 20 28 6e 65 77 20 76 61 6c 75 65 2c 20 + 65 6e 74 72 79 2c 20 75 70 64 61 74 65 64 20 73 + 74 61 74 75 73 29 0a + + ~ " 3unroll dup 4 unroll label-value @ swap dup 3unroll =" + 20 20 33 75 6e 72 6f 6c 6c 20 64 75 70 20 34 20 + 75 6e 72 6f 6c 6c 20 6c 61 62 65 6c 2d 76 61 6c + 75 65 20 40 20 73 77 61 70 20 64 75 70 20 33 75 + 6e 72 6f 6c 6c 20 3d 0a + + ~ " ~ (entry, updated status, new value, equality)" + 20 20 7e 20 28 65 6e 74 72 79 2c 20 75 70 64 61 + 74 65 64 20 73 74 61 74 75 73 2c 20 6e 65 77 20 + 76 61 6c 75 65 2c 20 65 71 75 61 6c 69 74 79 29 + 0a + + ~ " 3roll dup 4 unroll 0x01 & not" + 20 20 33 72 6f 6c 6c 20 64 75 70 20 34 20 75 6e + 72 6f 6c 6c 20 30 78 30 31 20 26 20 6e 6f 74 0a + + ~ " ~ (entry, updated status, new value, equality, unused)" + 20 20 7e 20 28 65 6e 74 72 79 2c 20 75 70 64 61 + 74 65 64 20 73 74 61 74 75 73 2c 20 6e 65 77 20 + 76 61 6c 75 65 2c 20 65 71 75 61 6c 69 74 79 2c + 20 75 6e 75 73 65 64 29 0a + + ~ " || { swap 0x08 | swap } if" + 20 20 7c 7c 20 7b 20 73 77 61 70 20 30 78 30 38 + 20 7c 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " ~ (entry, updated status, new value)" + 20 20 7e 20 28 65 6e 74 72 79 2c 20 75 70 64 61 + 74 65 64 20 73 74 61 74 75 73 2c 20 6e 65 77 20 + 76 61 6c 75 65 29 0a + + ~ " 3roll dup 3unroll" + 20 20 33 72 6f 6c 6c 20 64 75 70 20 33 75 6e 72 + 6f 6c 6c 0a + + ~ " ~ (updated status, entry, new value, entry)" + 20 20 7e 20 28 75 70 64 61 74 65 64 20 73 74 61 + 74 75 73 2c 20 65 6e 74 72 79 2c 20 6e 65 77 20 + 76 61 6c 75 65 2c 20 65 6e 74 72 79 29 0a + + ~ " label-value ! label-status ! ;" + 20 20 6c 61 62 65 6c 2d 76 61 6c 75 65 20 21 20 + 6c 61 62 65 6c 2d 73 74 61 74 75 73 20 21 20 3b + 0a + + ~ "" + 0a + + ~ "~ Since labels have dictionary entry headers but aren't" + ~ " in the main" + 7e 20 20 20 53 69 6e 63 65 20 6c 61 62 65 6c 73 + 20 68 61 76 65 20 64 69 63 74 69 6f 6e 61 72 79 + 20 65 6e 74 72 79 20 68 65 61 64 65 72 73 20 62 + 75 74 20 61 72 65 6e 27 74 20 69 6e 20 74 68 65 + 20 6d 61 69 6e 0a + + ~ "~ dictionary, we get to use the entry flag bits for other" + ~ " things. The only one" + 7e 20 64 69 63 74 69 6f 6e 61 72 79 2c 20 77 65 + 20 67 65 74 20 74 6f 20 75 73 65 20 74 68 65 20 + 65 6e 74 72 79 20 66 6c 61 67 20 62 69 74 73 20 + 66 6f 72 20 6f 74 68 65 72 20 74 68 69 6e 67 73 + 2e 20 54 68 65 20 6f 6e 6c 79 20 6f 6e 65 0a + + ~ "~ we have right now is a feature that acts as a hint to" + ~ " anything trying to" + 7e 20 77 65 20 68 61 76 65 20 72 69 67 68 74 20 + 6e 6f 77 20 69 73 20 61 20 66 65 61 74 75 72 65 + 20 74 68 61 74 20 61 63 74 73 20 61 73 20 61 20 + 68 69 6e 74 20 74 6f 20 61 6e 79 74 68 69 6e 67 + 20 74 72 79 69 6e 67 20 74 6f 0a + + ~ "~ display metadata about labels, to the effect that this" + ~ " one represents" + 7e 20 64 69 73 70 6c 61 79 20 6d 65 74 61 64 61 + 74 61 20 61 62 6f 75 74 20 6c 61 62 65 6c 73 2c + 20 74 6f 20 74 68 65 20 65 66 66 65 63 74 20 74 + 68 61 74 20 74 68 69 73 20 6f 6e 65 20 72 65 70 + 72 65 73 65 6e 74 73 0a + + ~ "~ something other than an offset in the file." + 7e 20 73 6f 6d 65 74 68 69 6e 67 20 6f 74 68 65 + 72 20 74 68 61 6e 20 61 6e 20 6f 66 66 73 65 74 + 20 69 6e 20 74 68 65 20 66 69 6c 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (label entry pointer --)" + 7e 20 28 6c 61 62 65 6c 20 65 6e 74 72 79 20 70 + 6f 69 6e 74 65 72 20 2d 2d 29 0a + + ~ ": set-label-non-offset dup entry-flags@ 0x01 | swap" + ~ " entry-flags! ;" + 3a 20 73 65 74 2d 6c 61 62 65 6c 2d 6e 6f 6e 2d + 6f 66 66 73 65 74 20 64 75 70 20 65 6e 74 72 79 + 2d 66 6c 61 67 73 40 20 30 78 30 31 20 7c 20 73 + 77 61 70 20 65 6e 74 72 79 2d 66 6c 61 67 73 21 + 20 3b 0a + + ~ "~ (label entry pointer -- boolean)" + 7e 20 28 6c 61 62 65 6c 20 65 6e 74 72 79 20 70 + 6f 69 6e 74 65 72 20 2d 2d 20 62 6f 6f 6c 65 61 + 6e 29 0a + + ~ ": is-label-non-offset entry-flags@ 0x01 & ;" + 3a 20 69 73 2d 6c 61 62 65 6c 2d 6e 6f 6e 2d 6f + 66 66 73 65 74 20 65 6e 74 72 79 2d 66 6c 61 67 + 73 40 20 30 78 30 31 20 26 20 3b 0a + + ~ "" + 0a + + ~ "~ This is a convenience helper which downstream code can" + ~ " use to check how" + 7e 20 20 20 54 68 69 73 20 69 73 20 61 20 63 6f + 6e 76 65 6e 69 65 6e 63 65 20 68 65 6c 70 65 72 + 20 77 68 69 63 68 20 64 6f 77 6e 73 74 72 65 61 + 6d 20 63 6f 64 65 20 63 61 6e 20 75 73 65 20 74 + 6f 20 63 68 65 63 6b 20 68 6f 77 0a + + ~ "~ many bytes it has output thus-far." + 7e 20 6d 61 6e 79 20 62 79 74 65 73 20 69 74 20 + 68 61 73 20 6f 75 74 70 75 74 20 74 68 75 73 2d + 66 61 72 2e 0a + + ~ "~ (output memory start, current output point" + 7e 20 28 6f 75 74 70 75 74 20 6d 65 6d 6f 72 79 + 20 73 74 61 72 74 2c 20 63 75 72 72 65 6e 74 20 + 6f 75 74 70 75 74 20 70 6f 69 6e 74 0a + + ~ "~ -- output memory start, current output point, offset)" + 7e 20 20 2d 2d 20 6f 75 74 70 75 74 20 6d 65 6d + 6f 72 79 20 73 74 61 72 74 2c 20 63 75 72 72 65 + 6e 74 20 6f 75 74 70 75 74 20 70 6f 69 6e 74 2c + 20 6f 66 66 73 65 74 29 0a + + ~ ": current-offset 2dup swap - ;" + 3a 20 63 75 72 72 65 6e 74 2d 6f 66 66 73 65 74 + 20 32 64 75 70 20 73 77 61 70 20 2d 20 3b 0a + + ~ "" + 0a + + ~ "~ This is a concise syntax for referencing the entry" + ~ " pointer of a label," + 7e 20 20 20 54 68 69 73 20 69 73 20 61 20 63 6f + 6e 63 69 73 65 20 73 79 6e 74 61 78 20 66 6f 72 + 20 72 65 66 65 72 65 6e 63 69 6e 67 20 74 68 65 + 20 65 6e 74 72 79 20 70 6f 69 6e 74 65 72 20 6f + 66 20 61 20 6c 61 62 65 6c 2c 0a + + ~ "~ when you know its name statically. It reads a word of" + ~ " text input and calls" + 7e 20 77 68 65 6e 20 79 6f 75 20 6b 6e 6f 77 20 + 69 74 73 20 6e 61 6d 65 20 73 74 61 74 69 63 61 + 6c 6c 79 2e 20 49 74 20 72 65 61 64 73 20 61 20 + 77 6f 72 64 20 6f 66 20 74 65 78 74 20 69 6e 70 + 75 74 20 61 6e 64 20 63 61 6c 6c 73 0a + + ~ "~ intern-label on it." + 7e 20 69 6e 74 65 72 6e 2d 6c 61 62 65 6c 20 6f + 6e 20 69 74 2e 0a + + ~ ": L'" + 3a 20 4c 27 0a + + ~ " word value@" + 20 20 77 6f 72 64 20 76 61 6c 75 65 40 0a + + ~ " interpreter-flags @ 0x01 &" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 0a + + ~ " { ' litstring entry-to-execution-token ," + 20 20 7b 20 27 20 6c 69 74 73 74 72 69 6e 67 20 + 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 69 + 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " here @ swap packstring 8 packalign here !" + 20 20 20 20 68 65 72 65 20 40 20 73 77 61 70 20 + 70 61 63 6b 73 74 72 69 6e 67 20 38 20 70 61 63 + 6b 61 6c 69 67 6e 20 68 65 72 65 20 21 0a + + ~ " ' intern-label entry-to-execution-token ," + 20 20 20 20 27 20 69 6e 74 65 72 6e 2d 6c 61 62 + 65 6c 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 + 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " dropstring }" + 20 20 20 20 64 72 6f 70 73 74 72 69 6e 67 20 7d + 0a + + ~ " { intern-label dropstring-with-result } if-else" + 20 20 7b 20 69 6e 74 65 72 6e 2d 6c 61 62 65 6c + 20 64 72 6f 70 73 74 72 69 6e 67 2d 77 69 74 68 + 2d 72 65 73 75 6c 74 20 7d 20 69 66 2d 65 6c 73 + 65 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "~ This is a concise syntax for calling use-label with a" + ~ " label whose name" + 7e 20 20 20 54 68 69 73 20 69 73 20 61 20 63 6f + 6e 63 69 73 65 20 73 79 6e 74 61 78 20 66 6f 72 + 20 63 61 6c 6c 69 6e 67 20 75 73 65 2d 6c 61 62 + 65 6c 20 77 69 74 68 20 61 20 6c 61 62 65 6c 20 + 77 68 6f 73 65 20 6e 61 6d 65 0a + + ~ "~ you know statically. It performs L', then calls" + ~ " use-label." + 7e 20 79 6f 75 20 6b 6e 6f 77 20 73 74 61 74 69 + 63 61 6c 6c 79 2e 20 49 74 20 70 65 72 66 6f 72 + 6d 73 20 4c 27 2c 20 74 68 65 6e 20 63 61 6c 6c + 73 20 75 73 65 2d 6c 61 62 65 6c 2e 0a + + ~ ": L@'" + 3a 20 4c 40 27 0a + + ~ " ' L' entry-to-execution-token execute" + 20 20 27 20 4c 27 20 65 6e 74 72 79 2d 74 6f 2d + 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 + 65 78 65 63 75 74 65 0a + + ~ " interpreter-flags @ 1 &" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 31 20 26 0a + + ~ " { ' use-label entry-to-execution-token , }" + 20 20 20 20 7b 20 27 20 75 73 65 2d 6c 61 62 65 + 6c 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 20 7d 0a + + ~ " { use-label } if-else" + 20 20 20 20 7b 20 75 73 65 2d 6c 61 62 65 6c 20 + 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "~ This is a concise syntax for calling set-label with a" + ~ " label whose name" + 7e 20 20 20 54 68 69 73 20 69 73 20 61 20 63 6f + 6e 63 69 73 65 20 73 79 6e 74 61 78 20 66 6f 72 + 20 63 61 6c 6c 69 6e 67 20 73 65 74 2d 6c 61 62 + 65 6c 20 77 69 74 68 20 61 20 6c 61 62 65 6c 20 + 77 68 6f 73 65 20 6e 61 6d 65 0a + + ~ "~ you know statically. It performs L', then calls" + ~ " set-label." + 7e 20 79 6f 75 20 6b 6e 6f 77 20 73 74 61 74 69 + 63 61 6c 6c 79 2e 20 49 74 20 70 65 72 66 6f 72 + 6d 73 20 4c 27 2c 20 74 68 65 6e 20 63 61 6c 6c + 73 20 73 65 74 2d 6c 61 62 65 6c 2e 0a + + ~ ": L!'" + 3a 20 4c 21 27 0a + + ~ " ' L' entry-to-execution-token execute" + 20 20 27 20 4c 27 20 65 6e 74 72 79 2d 74 6f 2d + 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 + 65 78 65 63 75 74 65 0a + + ~ " interpreter-flags @ 1 &" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 31 20 26 0a + + ~ " { ' set-label entry-to-execution-token , }" + 20 20 20 20 7b 20 27 20 73 65 74 2d 6c 61 62 65 + 6c 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 20 7d 0a + + ~ " { set-label } if-else" + 20 20 20 20 7b 20 73 65 74 2d 6c 61 62 65 6c 20 + 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "~ This is an internal helper that label-loop uses to" + ~ " check if a specific" + 7e 20 20 20 54 68 69 73 20 69 73 20 61 6e 20 69 + 6e 74 65 72 6e 61 6c 20 68 65 6c 70 65 72 20 74 + 68 61 74 20 6c 61 62 65 6c 2d 6c 6f 6f 70 20 75 + 73 65 73 20 74 6f 20 63 68 65 63 6b 20 69 66 20 + 61 20 73 70 65 63 69 66 69 63 0a + + ~ "~ label entry has "converged", based on its status bits." + ~ " Downstream code won't" + 7e 20 6c 61 62 65 6c 20 65 6e 74 72 79 20 68 61 + 73 20 22 63 6f 6e 76 65 72 67 65 64 22 2c 20 62 + 61 73 65 64 20 6f 6e 20 69 74 73 20 73 74 61 74 + 75 73 20 62 69 74 73 2e 20 44 6f 77 6e 73 74 72 + 65 61 6d 20 63 6f 64 65 20 77 6f 6e 27 74 0a + + ~ "~ need to call this directly." + 7e 20 6e 65 65 64 20 74 6f 20 63 61 6c 6c 20 74 + 68 69 73 20 64 69 72 65 63 74 6c 79 2e 0a + + ~ "~" + 7e 0a + + ~ "~ For a label to have "converged", at least one of the" + ~ " following must be" + 7e 20 20 20 46 6f 72 20 61 20 6c 61 62 65 6c 20 + 74 6f 20 68 61 76 65 20 22 63 6f 6e 76 65 72 67 + 65 64 22 2c 20 61 74 20 6c 65 61 73 74 20 6f 6e + 65 20 6f 66 20 74 68 65 20 66 6f 6c 6c 6f 77 69 + 6e 67 20 6d 75 73 74 20 62 65 0a + + ~ "~ true:" + 7e 20 74 72 75 65 3a 0a + + ~ "~" + 7e 0a + + ~ "~ 1. The label must never have been used (bit zero clear);" + 7e 20 31 2e 20 54 68 65 20 6c 61 62 65 6c 20 6d + 75 73 74 20 6e 65 76 65 72 20 68 61 76 65 20 62 + 65 65 6e 20 75 73 65 64 20 28 62 69 74 20 7a 65 + 72 6f 20 63 6c 65 61 72 29 3b 0a + + ~ "~ 2. The label was both used and defined, but not used" + ~ " before it was defined" + 7e 20 32 2e 20 54 68 65 20 6c 61 62 65 6c 20 77 + 61 73 20 62 6f 74 68 20 75 73 65 64 20 61 6e 64 + 20 64 65 66 69 6e 65 64 2c 20 62 75 74 20 6e 6f + 74 20 75 73 65 64 20 62 65 66 6f 72 65 20 69 74 + 20 77 61 73 20 64 65 66 69 6e 65 64 0a + + ~ "~ (bits zero and one set; bit two clear);" + 7e 20 20 20 20 28 62 69 74 73 20 7a 65 72 6f 20 + 61 6e 64 20 6f 6e 65 20 73 65 74 3b 20 62 69 74 + 20 74 77 6f 20 63 6c 65 61 72 29 3b 0a + + ~ "~ 3. The label was both used and defined, and the guessed" + ~ " value equalled the" + 7e 20 33 2e 20 54 68 65 20 6c 61 62 65 6c 20 77 + 61 73 20 62 6f 74 68 20 75 73 65 64 20 61 6e 64 + 20 64 65 66 69 6e 65 64 2c 20 61 6e 64 20 74 68 + 65 20 67 75 65 73 73 65 64 20 76 61 6c 75 65 20 + 65 71 75 61 6c 6c 65 64 20 74 68 65 0a + + ~ "~ actual value (bits zero, one, and three set)." + 7e 20 20 20 20 61 63 74 75 61 6c 20 76 61 6c 75 + 65 20 28 62 69 74 73 20 7a 65 72 6f 2c 20 6f 6e + 65 2c 20 61 6e 64 20 74 68 72 65 65 20 73 65 74 + 29 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (label entry pointer -- boolean)" + 7e 20 28 6c 61 62 65 6c 20 65 6e 74 72 79 20 70 + 6f 69 6e 74 65 72 20 2d 2d 20 62 6f 6f 6c 65 61 + 6e 29 0a + + ~ ": check-label-converged" + 3a 20 63 68 65 63 6b 2d 6c 61 62 65 6c 2d 63 6f + 6e 76 65 72 67 65 64 0a + + ~ " label-status @" + 20 20 6c 61 62 65 6c 2d 73 74 61 74 75 73 20 40 + 0a + + ~ " dup 0x01 & not swap" + 20 20 64 75 70 20 30 78 30 31 20 26 20 6e 6f 74 + 20 73 77 61 70 0a + + ~ " dup 0x03 & 0x03 = swap dup 0x04 & not swap 3unroll &&" + ~ " swap" + 20 20 64 75 70 20 30 78 30 33 20 26 20 30 78 30 + 33 20 3d 20 73 77 61 70 20 64 75 70 20 30 78 30 + 34 20 26 20 6e 6f 74 20 73 77 61 70 20 33 75 6e + 72 6f 6c 6c 20 26 26 20 73 77 61 70 0a + + ~ " 0x0b & 0x0b =" + 20 20 30 78 30 62 20 26 20 30 78 30 62 20 3d 0a + + ~ " || || ;" + 20 20 7c 7c 20 7c 7c 20 3b 0a + + ~ "" + 0a + + ~ "~ This is an internal helper that label-loop uses to" + ~ " check if the overall" + 7e 20 20 20 54 68 69 73 20 69 73 20 61 6e 20 69 + 6e 74 65 72 6e 61 6c 20 68 65 6c 70 65 72 20 74 + 68 61 74 20 6c 61 62 65 6c 2d 6c 6f 6f 70 20 75 + 73 65 73 20 74 6f 20 63 68 65 63 6b 20 69 66 20 + 74 68 65 20 6f 76 65 72 61 6c 6c 0a + + ~ "~ label assignments have converged, based on their status" + ~ " bits. Downstream" + 7e 20 6c 61 62 65 6c 20 61 73 73 69 67 6e 6d 65 + 6e 74 73 20 68 61 76 65 20 63 6f 6e 76 65 72 67 + 65 64 2c 20 62 61 73 65 64 20 6f 6e 20 74 68 65 + 69 72 20 73 74 61 74 75 73 20 62 69 74 73 2e 20 + 44 6f 77 6e 73 74 72 65 61 6d 0a + + ~ "~ code won't need to call this directly." + 7e 20 63 6f 64 65 20 77 6f 6e 27 74 20 6e 65 65 + 64 20 74 6f 20 63 61 6c 6c 20 74 68 69 73 20 64 + 69 72 65 63 74 6c 79 2e 0a + + ~ "~" + 7e 0a + + ~ "~ This returns true if and only if check-label-converged" + ~ " returns true for" + 7e 20 20 20 54 68 69 73 20 72 65 74 75 72 6e 73 + 20 74 72 75 65 20 69 66 20 61 6e 64 20 6f 6e 6c + 79 20 69 66 20 63 68 65 63 6b 2d 6c 61 62 65 6c + 2d 63 6f 6e 76 65 72 67 65 64 20 72 65 74 75 72 + 6e 73 20 74 72 75 65 20 66 6f 72 0a + + ~ "~ all the labels that have been created." + 7e 20 61 6c 6c 20 74 68 65 20 6c 61 62 65 6c 73 + 20 74 68 61 74 20 68 61 76 65 20 62 65 65 6e 20 + 63 72 65 61 74 65 64 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (-- boolean)" + 7e 20 28 2d 2d 20 62 6f 6f 6c 65 61 6e 29 0a + + ~ ": check-labels-converged" + 3a 20 63 68 65 63 6b 2d 6c 61 62 65 6c 73 2d 63 + 6f 6e 76 65 72 67 65 64 0a + + ~ " 1" + 20 20 31 0a + + ~ " labels @ { dup }" + 20 20 6c 61 62 65 6c 73 20 40 20 7b 20 64 75 70 + 20 7d 0a + + ~ " { dup check-label-converged 3roll && swap" + 20 20 7b 20 64 75 70 20 63 68 65 63 6b 2d 6c 61 + 62 65 6c 2d 63 6f 6e 76 65 72 67 65 64 20 33 72 + 6f 6c 6c 20 26 26 20 73 77 61 70 0a + + ~ " @ } while drop ;" + 20 20 20 20 40 20 7d 20 77 68 69 6c 65 20 64 72 + 6f 70 20 3b 0a + + ~ "" + 0a + + ~ "~ This is an internal helper that label-loop calls" + ~ " between passes, to update" + 7e 20 20 20 54 68 69 73 20 69 73 20 61 6e 20 69 + 6e 74 65 72 6e 61 6c 20 68 65 6c 70 65 72 20 74 + 68 61 74 20 6c 61 62 65 6c 2d 6c 6f 6f 70 20 63 + 61 6c 6c 73 20 62 65 74 77 65 65 6e 20 70 61 73 + 73 65 73 2c 20 74 6f 20 75 70 64 61 74 65 0a + + ~ "~ the status bits and get ready for the next one." + ~ " Downstream code won't need" + 7e 20 74 68 65 20 73 74 61 74 75 73 20 62 69 74 + 73 20 61 6e 64 20 67 65 74 20 72 65 61 64 79 20 + 66 6f 72 20 74 68 65 20 6e 65 78 74 20 6f 6e 65 + 2e 20 44 6f 77 6e 73 74 72 65 61 6d 20 63 6f 64 + 65 20 77 6f 6e 27 74 20 6e 65 65 64 0a + + ~ "~ to call this directly." + 7e 20 74 6f 20 63 61 6c 6c 20 74 68 69 73 20 64 + 69 72 65 63 74 6c 79 2e 0a + + ~ "~" + 7e 0a + + ~ ": reset-labels" + 3a 20 72 65 73 65 74 2d 6c 61 62 65 6c 73 0a + + ~ " labels @ { dup }" + 20 20 6c 61 62 65 6c 73 20 40 20 7b 20 64 75 70 + 20 7d 0a + + ~ " { dup label-status 0 swap !" + 20 20 7b 20 64 75 70 20 6c 61 62 65 6c 2d 73 74 + 61 74 75 73 20 30 20 73 77 61 70 20 21 0a + + ~ " @ } while drop ;" + 20 20 20 20 40 20 7d 20 77 68 69 6c 65 20 64 72 + 6f 70 20 3b 0a + + ~ "" + 0a + + ~ "~ This is the top-level word that invokes the entire" + ~ " label system. All the" + 7e 20 20 20 54 68 69 73 20 69 73 20 74 68 65 20 + 74 6f 70 2d 6c 65 76 65 6c 20 77 6f 72 64 20 74 + 68 61 74 20 69 6e 76 6f 6b 65 73 20 74 68 65 20 + 65 6e 74 69 72 65 20 6c 61 62 65 6c 20 73 79 73 + 74 65 6d 2e 20 41 6c 6c 20 74 68 65 0a + + ~ "~ code generation happens inside it." + 7e 20 63 6f 64 65 20 67 65 6e 65 72 61 74 69 6f + 6e 20 68 61 70 70 65 6e 73 20 69 6e 73 69 64 65 + 20 69 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The execution token it's passed should have the" + ~ " interface:" + 7e 20 20 20 54 68 65 20 65 78 65 63 75 74 69 6f + 6e 20 74 6f 6b 65 6e 20 69 74 27 73 20 70 61 73 + 73 65 64 20 73 68 6f 75 6c 64 20 68 61 76 65 20 + 74 68 65 20 69 6e 74 65 72 66 61 63 65 3a 0a + + ~ "~" + 7e 0a + + ~ "~ (output start, current output pointer" + 7e 20 20 20 20 20 28 6f 75 74 70 75 74 20 73 74 + 61 72 74 2c 20 63 75 72 72 65 6e 74 20 6f 75 74 + 70 75 74 20 70 6f 69 6e 74 65 72 0a + + ~ "~ -- output start, current output pointer)" + 7e 20 20 20 20 20 20 2d 2d 20 6f 75 74 70 75 74 + 20 73 74 61 72 74 2c 20 63 75 72 72 65 6e 74 20 + 6f 75 74 70 75 74 20 70 6f 69 6e 74 65 72 29 0a + + ~ "~" + 7e 0a + + ~ "~ In general, this is the same interface that code" + ~ " generation words should" + 7e 20 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 + 74 68 69 73 20 69 73 20 74 68 65 20 73 61 6d 65 + 20 69 6e 74 65 72 66 61 63 65 20 74 68 61 74 20 + 63 6f 64 65 20 67 65 6e 65 72 61 74 69 6f 6e 20 + 77 6f 72 64 73 20 73 68 6f 75 6c 64 0a + + ~ "~ use to communicate with each other. For example, all the" + ~ " words in" + 7e 20 75 73 65 20 74 6f 20 63 6f 6d 6d 75 6e 69 + 63 61 74 65 20 77 69 74 68 20 65 61 63 68 20 6f + 74 68 65 72 2e 20 46 6f 72 20 65 78 61 6d 70 6c + 65 2c 20 61 6c 6c 20 74 68 65 20 77 6f 72 64 73 + 20 69 6e 0a + + ~ "~ compilation/elf.e use this interface." + 7e 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 2f 65 6c + 66 2e 65 20 75 73 65 20 74 68 69 73 20 69 6e 74 + 65 72 66 61 63 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (execution token -- output start, output length)" + 7e 20 28 65 78 65 63 75 74 69 6f 6e 20 74 6f 6b + 65 6e 20 2d 2d 20 6f 75 74 70 75 74 20 73 74 61 + 72 74 2c 20 6f 75 74 70 75 74 20 6c 65 6e 67 74 + 68 29 0a + + ~ ": label-loop" + 3a 20 6c 61 62 65 6c 2d 6c 6f 6f 70 0a + + ~ " 0 swap" + 20 20 30 20 73 77 61 70 0a + + ~ " ~ TODO every time you double this to fix a crash, you" + ~ " must publicly" + 20 20 7e 20 54 4f 44 4f 20 65 76 65 72 79 20 74 + 69 6d 65 20 79 6f 75 20 64 6f 75 62 6c 65 20 74 + 68 69 73 20 74 6f 20 66 69 78 20 61 20 63 72 61 + 73 68 2c 20 79 6f 75 20 6d 75 73 74 20 70 75 62 + 6c 69 63 6c 79 0a + + ~ " ~ apologize for deferring a real fix. those are the" + ~ " rules" + 20 20 7e 20 61 70 6f 6c 6f 67 69 7a 65 20 66 6f + 72 20 64 65 66 65 72 72 69 6e 67 20 61 20 72 65 + 61 6c 20 66 69 78 2e 20 74 68 6f 73 65 20 61 72 + 65 20 74 68 65 20 72 75 6c 65 73 0a + + ~ " 0x100000 allocate dup" + 20 20 30 78 31 30 30 30 30 30 20 61 6c 6c 6f 63 + 61 74 65 20 64 75 70 0a + + ~ " ~ (iteration count, execution token, output start, output" + ~ " point)" + 20 20 7e 20 28 69 74 65 72 61 74 69 6f 6e 20 63 + 6f 75 6e 74 2c 20 65 78 65 63 75 74 69 6f 6e 20 + 74 6f 6b 65 6e 2c 20 6f 75 74 70 75 74 20 73 74 + 61 72 74 2c 20 6f 75 74 70 75 74 20 70 6f 69 6e + 74 29 0a + + ~ " { 3 pick 100 > }" + 20 20 7b 20 33 20 70 69 63 6b 20 31 30 30 20 3e + 20 7d 0a + + ~ " { 2 pick execute 4 roll 1+ 4 unroll" + 20 20 7b 20 32 20 70 69 63 6b 20 65 78 65 63 75 + 74 65 20 34 20 72 6f 6c 6c 20 31 2b 20 34 20 75 + 6e 72 6f 6c 6c 0a + + ~ "" + 0a + + ~ " check-labels-converged" + 20 20 20 20 63 68 65 63 6b 2d 6c 61 62 65 6c 73 + 2d 63 6f 6e 76 65 72 67 65 64 0a + + ~ " { 4 roll drop" + 20 20 20 20 7b 20 34 20 72 6f 6c 6c 20 64 72 6f + 70 0a + + ~ " 3 roll drop" + 20 20 20 20 20 20 33 20 72 6f 6c 6c 20 64 72 6f + 70 0a + + ~ " current-offset swap drop" + 20 20 20 20 20 20 63 75 72 72 65 6e 74 2d 6f 66 + 66 73 65 74 20 73 77 61 70 20 64 72 6f 70 0a + + ~ " exit } if" + 20 20 20 20 20 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " drop dup" + 20 20 20 20 64 72 6f 70 20 64 75 70 0a + + ~ " reset-labels } while" + 20 20 20 20 72 65 73 65 74 2d 6c 61 62 65 6c 73 + 20 7d 20 77 68 69 6c 65 0a + + ~ " ~ TODO run some analysis on the labels to detect labels" + ~ " that are never" + 20 20 7e 20 54 4f 44 4f 20 72 75 6e 20 73 6f 6d + 65 20 61 6e 61 6c 79 73 69 73 20 6f 6e 20 74 68 + 65 20 6c 61 62 65 6c 73 20 74 6f 20 64 65 74 65 + 63 74 20 6c 61 62 65 6c 73 20 74 68 61 74 20 61 + 72 65 20 6e 65 76 65 72 0a + + ~ " ~ defined, but are referenced. List them." + 20 20 7e 20 64 65 66 69 6e 65 64 2c 20 62 75 74 + 20 61 72 65 20 72 65 66 65 72 65 6e 63 65 64 2e + 20 4c 69 73 74 20 74 68 65 6d 2e 0a + + ~ " drop drop drop ." Failed after " . ." iterations."" + ~ " newline ;" + 20 20 64 72 6f 70 20 64 72 6f 70 20 64 72 6f 70 + 20 2e 22 20 46 61 69 6c 65 64 20 61 66 74 65 72 + 20 22 20 2e 20 2e 22 20 20 69 74 65 72 61 74 69 + 6f 6e 73 2e 22 20 6e 65 77 6c 69 6e 65 20 3b 0a + + ~ "" + 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 0a + + ~ "~ ~~ Executable file format ~~" + 7e 20 7e 7e 20 45 78 65 63 75 74 61 62 6c 65 20 + 66 69 6c 65 20 66 6f 72 6d 61 74 20 7e 7e 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 0a + + ~ "~" + 7e 0a + + ~ "~ Before we do anything specific to the actual program" + ~ " we're building, we" + 7e 20 20 20 42 65 66 6f 72 65 20 77 65 20 64 6f + 20 61 6e 79 74 68 69 6e 67 20 73 70 65 63 69 66 + 69 63 20 74 6f 20 74 68 65 20 61 63 74 75 61 6c + 20 70 72 6f 67 72 61 6d 20 77 65 27 72 65 20 62 + 75 69 6c 64 69 6e 67 2c 20 77 65 0a + + ~ "~ do a lot of ELF-specific stuff to ensure that our output" + ~ " is in a format" + 7e 20 64 6f 20 61 20 6c 6f 74 20 6f 66 20 45 4c + 46 2d 73 70 65 63 69 66 69 63 20 73 74 75 66 66 + 20 74 6f 20 65 6e 73 75 72 65 20 74 68 61 74 20 + 6f 75 72 20 6f 75 74 70 75 74 20 69 73 20 69 6e + 20 61 20 66 6f 72 6d 61 74 0a + + ~ "~ Linux knows how to run." + 7e 20 4c 69 6e 75 78 20 6b 6e 6f 77 73 20 68 6f + 77 20 74 6f 20 72 75 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ This relies on the label facility defined in" + ~ " compilation/labels.e. Make" + 7e 20 20 20 54 68 69 73 20 72 65 6c 69 65 73 20 + 6f 6e 20 74 68 65 20 6c 61 62 65 6c 20 66 61 63 + 69 6c 69 74 79 20 64 65 66 69 6e 65 64 20 69 6e + 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 2f 6c 61 62 + 65 6c 73 2e 65 2e 20 4d 61 6b 65 0a + + ~ "~ sure to load that first." + 7e 20 73 75 72 65 20 74 6f 20 6c 6f 61 64 20 74 + 68 61 74 20 66 69 72 73 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ This file makes use of magic comments for the hex" + ~ " transform, described in" + 7e 20 20 20 54 68 69 73 20 66 69 6c 65 20 6d 61 + 6b 65 73 20 75 73 65 20 6f 66 20 6d 61 67 69 63 + 20 63 6f 6d 6d 65 6e 74 73 20 66 6f 72 20 74 68 + 65 20 68 65 78 20 74 72 61 6e 73 66 6f 72 6d 2c + 20 64 65 73 63 72 69 62 65 64 20 69 6e 0a + + ~ "~ detail in compilation/transform.e, but its use is trivial" + ~ " and doesn't" + 7e 20 64 65 74 61 69 6c 20 69 6e 20 63 6f 6d 70 + 69 6c 61 74 69 6f 6e 2f 74 72 61 6e 73 66 6f 72 + 6d 2e 65 2c 20 62 75 74 20 69 74 73 20 75 73 65 + 20 69 73 20 74 72 69 76 69 61 6c 20 61 6e 64 20 + 64 6f 65 73 6e 27 74 0a + + ~ "~ require accounting conventions." + 7e 20 72 65 71 75 69 72 65 20 61 63 63 6f 75 6e + 74 69 6e 67 20 63 6f 6e 76 65 6e 74 69 6f 6e 73 + 2e 0a + + ~ "" + 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 0a + + ~ "~ ~~ ELF file header ~~" + 7e 20 7e 7e 20 45 4c 46 20 66 69 6c 65 20 68 65 + 61 64 65 72 20 7e 7e 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 0a + + ~ "~" + 7e 0a + + ~ "~ First, we output ELF's top-level file header. This" + ~ " header describes the" + 7e 20 20 20 46 69 72 73 74 2c 20 77 65 20 6f 75 + 74 70 75 74 20 45 4c 46 27 73 20 74 6f 70 2d 6c + 65 76 65 6c 20 66 69 6c 65 20 68 65 61 64 65 72 + 2e 20 54 68 69 73 20 68 65 61 64 65 72 20 64 65 + 73 63 72 69 62 65 73 20 74 68 65 0a + + ~ "~ entire file. An ELF always has exactly one of this" + ~ " header, which is always" + 7e 20 65 6e 74 69 72 65 20 66 69 6c 65 2e 20 41 + 6e 20 45 4c 46 20 61 6c 77 61 79 73 20 68 61 73 + 20 65 78 61 63 74 6c 79 20 6f 6e 65 20 6f 66 20 + 74 68 69 73 20 68 65 61 64 65 72 2c 20 77 68 69 + 63 68 20 69 73 20 61 6c 77 61 79 73 0a + + ~ "~ at the start of the file." + 7e 20 61 74 20 74 68 65 20 73 74 61 72 74 20 6f + 66 20 74 68 65 20 66 69 6c 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The program we're building should call this word as the" + ~ " first output it" + 7e 20 20 20 54 68 65 20 70 72 6f 67 72 61 6d 20 + 77 65 27 72 65 20 62 75 69 6c 64 69 6e 67 20 73 + 68 6f 75 6c 64 20 63 61 6c 6c 20 74 68 69 73 20 + 77 6f 72 64 20 61 73 20 74 68 65 20 66 69 72 73 + 74 20 6f 75 74 70 75 74 20 69 74 0a + + ~ "~ generates." + 7e 20 67 65 6e 65 72 61 74 65 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The most interesting thing here is the entry pointer." + 7e 20 20 20 54 68 65 20 6d 6f 73 74 20 69 6e 74 + 65 72 65 73 74 69 6e 67 20 74 68 69 6e 67 20 68 + 65 72 65 20 69 73 20 74 68 65 20 65 6e 74 72 79 + 20 70 6f 69 6e 74 65 72 2e 0a + + ~ "~" + 7e 0a + + ~ "~ It's also worth noticing that we set the ABI version to" + ~ " 3. An ABI version" + 7e 20 20 20 49 74 27 73 20 61 6c 73 6f 20 77 6f + 72 74 68 20 6e 6f 74 69 63 69 6e 67 20 74 68 61 + 74 20 77 65 20 73 65 74 20 74 68 65 20 41 42 49 + 20 76 65 72 73 69 6f 6e 20 74 6f 20 33 2e 20 41 + 6e 20 41 42 49 20 76 65 72 73 69 6f 6e 0a + + ~ "~ of 0 (for the System V ABI) would work fine too, but 3" + ~ " allows FreeBSD's" + 7e 20 6f 66 20 30 20 28 66 6f 72 20 74 68 65 20 + 53 79 73 74 65 6d 20 56 20 41 42 49 29 20 77 6f + 75 6c 64 20 77 6f 72 6b 20 66 69 6e 65 20 74 6f + 6f 2c 20 62 75 74 20 33 20 61 6c 6c 6f 77 73 20 + 46 72 65 65 42 53 44 27 73 0a + + ~ "~ Linux compatibility features to kick in." + 7e 20 4c 69 6e 75 78 20 63 6f 6d 70 61 74 69 62 + 69 6c 69 74 79 20 66 65 61 74 75 72 65 73 20 74 + 6f 20 6b 69 63 6b 20 69 6e 2e 0a + + ~ "" + 0a + + ~ ": elf-file-header" + 3a 20 65 6c 66 2d 66 69 6c 65 2d 68 65 61 64 65 + 72 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : ELF file header" + 20 20 7e 20 3a 20 45 4c 46 20 66 69 6c 65 20 68 + 65 61 64 65 72 0a + + ~ " ~ : indent" + 20 20 7e 20 3a 20 69 6e 64 65 6e 74 0a + + ~ " ~ : * denotes mandatory fields according to breadbox" + 20 20 7e 20 3a 20 2a 20 64 65 6e 6f 74 65 73 20 + 6d 61 6e 64 61 74 6f 72 79 20 66 69 65 6c 64 73 + 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 62 72 + 65 61 64 62 6f 78 0a + + ~ " current-offset 3unroll" + 20 20 63 75 72 72 65 6e 74 2d 6f 66 66 73 65 74 + 20 33 75 6e 72 6f 6c 6c 0a + + ~ "" + 0a + + ~ " ~ : 1 suppress" + 20 20 7e 20 3a 20 31 20 73 75 70 70 72 65 73 73 + 0a + + ~ " 0x7f pack8 s" ELF" pack-raw-string ~ : -4 *magic number" + 20 20 30 78 37 66 20 70 61 63 6b 38 20 73 22 20 + 45 4c 46 22 20 70 61 63 6b 2d 72 61 77 2d 73 74 + 72 69 6e 67 20 20 7e 20 3a 20 2d 34 20 2a 6d 61 + 67 69 63 20 6e 75 6d 62 65 72 0a + + ~ " 2 pack8 ~ : -1 64-bit" + 20 20 32 20 70 61 63 6b 38 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 31 20 36 34 2d + 62 69 74 0a + + ~ " 1 pack8 ~ : -1 little-endian" + 20 20 31 20 70 61 63 6b 38 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 31 20 6c 69 74 + 74 6c 65 2d 65 6e 64 69 61 6e 0a + + ~ " 1 pack8 ~ : -1 ELF header" + ~ " format v1" + 20 20 31 20 70 61 63 6b 38 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 31 20 45 4c 46 + 20 68 65 61 64 65 72 20 66 6f 72 6d 61 74 20 76 + 31 0a + + ~ " 3 pack8 ~ : -1 Linux ABI" + 20 20 33 20 70 61 63 6b 38 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 31 20 4c 69 6e + 75 78 20 41 42 49 0a + + ~ " 0 pack64 ~ : -8 (padding)" + 20 20 30 20 70 61 63 6b 36 34 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 28 70 61 + 64 64 69 6e 67 29 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ "" + 0a + + ~ " 2 pack16 ~ : -2 *executable" + 20 20 32 20 70 61 63 6b 31 36 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 32 20 2a 65 78 + 65 63 75 74 61 62 6c 65 0a + + ~ " 0x3e pack16 ~ : -2 *Intel x86-64" + 20 20 30 78 33 65 20 70 61 63 6b 31 36 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 32 20 2a 49 6e + 74 65 6c 20 78 38 36 2d 36 34 0a + + ~ " 1 pack32 ~ : -4 ELF format" + ~ " version" + 20 20 31 20 70 61 63 6b 33 32 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 34 20 45 4c 46 + 20 66 6f 72 6d 61 74 20 76 65 72 73 69 6f 6e 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ "" + 0a + + ~ " L@' cold-start L@' origin + pack64 ~ : -8 *entry point" + 20 20 4c 40 27 20 63 6f 6c 64 2d 73 74 61 72 74 + 20 4c 40 27 20 6f 72 69 67 69 6e 20 2b 20 70 61 + 63 6b 36 34 20 20 7e 20 3a 20 2d 38 20 2a 65 6e + 74 72 79 20 70 6f 69 6e 74 0a + + ~ " ~ This includes the origin, intentionally." + 20 20 20 20 7e 20 54 68 69 73 20 69 6e 63 6c 75 + 64 65 73 20 74 68 65 20 6f 72 69 67 69 6e 2c 20 + 69 6e 74 65 6e 74 69 6f 6e 61 6c 6c 79 2e 0a + + ~ "" + 0a + + ~ " L@' elf-program-header pack64 ~ : -8 *program" + ~ " header offset" + 20 20 4c 40 27 20 65 6c 66 2d 70 72 6f 67 72 61 + 6d 2d 68 65 61 64 65 72 20 70 61 63 6b 36 34 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 2a 70 72 + 6f 67 72 61 6d 20 68 65 61 64 65 72 20 6f 66 66 + 73 65 74 0a + + ~ " ~ We place the program header immediately after the ELF" + ~ " header. This" + 20 20 20 20 7e 20 57 65 20 70 6c 61 63 65 20 74 + 68 65 20 70 72 6f 67 72 61 6d 20 68 65 61 64 65 + 72 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 61 66 + 74 65 72 20 74 68 65 20 45 4c 46 20 68 65 61 64 + 65 72 2e 20 54 68 69 73 0a + + ~ " ~ offset is from the start of the file." + 20 20 20 20 7e 20 6f 66 66 73 65 74 20 69 73 20 + 66 72 6f 6d 20 74 68 65 20 73 74 61 72 74 20 6f + 66 20 74 68 65 20 66 69 6c 65 2e 0a + + ~ " 0 pack64 ~ : -8 section header" + ~ " offset" + 20 20 30 20 70 61 63 6b 36 34 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 73 65 63 + 74 69 6f 6e 20 68 65 61 64 65 72 20 6f 66 66 73 + 65 74 0a + + ~ " 0 pack32 ~ : -4 processor" + ~ " flags" + 20 20 30 20 70 61 63 6b 33 32 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 34 20 70 72 6f + 63 65 73 73 6f 72 20 66 6c 61 67 73 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ "" + 0a + + ~ " L@' elf-header-size pack16 ~ : -2 ELF header" + ~ " size" + 20 20 4c 40 27 20 65 6c 66 2d 68 65 61 64 65 72 + 2d 73 69 7a 65 20 70 61 63 6b 31 36 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 32 20 45 4c 46 + 20 68 65 61 64 65 72 20 73 69 7a 65 0a + + ~ " L@' elf-program-header-size pack16 ~ : -2 *program" + ~ " header entry size" + 20 20 4c 40 27 20 65 6c 66 2d 70 72 6f 67 72 61 + 6d 2d 68 65 61 64 65 72 2d 73 69 7a 65 20 70 61 + 63 6b 31 36 20 20 7e 20 3a 20 2d 32 20 2a 70 72 + 6f 67 72 61 6d 20 68 65 61 64 65 72 20 65 6e 74 + 72 79 20 73 69 7a 65 0a + + ~ " 1 pack16 ~ : -2 *number of" + ~ " program header entries" + 20 20 31 20 70 61 63 6b 31 36 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 32 20 2a 6e 75 + 6d 62 65 72 20 6f 66 20 70 72 6f 67 72 61 6d 20 + 68 65 61 64 65 72 20 65 6e 74 72 69 65 73 0a + + ~ " 0 pack16 ~ : -2 section header" + ~ " entry size" + 20 20 30 20 70 61 63 6b 31 36 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 32 20 73 65 63 + 74 69 6f 6e 20 68 65 61 64 65 72 20 65 6e 74 72 + 79 20 73 69 7a 65 0a + + ~ " 0 pack16 ~ : -2 number of" + ~ " section header entries" + 20 20 30 20 70 61 63 6b 31 36 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 32 20 6e 75 6d + 62 65 72 20 6f 66 20 73 65 63 74 69 6f 6e 20 68 + 65 61 64 65 72 20 65 6e 74 72 69 65 73 0a + + ~ " 0 pack16 ~ : -2 section name" + ~ " string table index" + 20 20 30 20 70 61 63 6b 31 36 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 32 20 73 65 63 + 74 69 6f 6e 20 6e 61 6d 65 20 73 74 72 69 6e 67 + 20 74 61 62 6c 65 20 69 6e 64 65 78 0a + + ~ "" + 0a + + ~ " ~ Though hardcoding the size of this header would work" + ~ " fine, it's easier" + 20 20 7e 20 20 20 54 68 6f 75 67 68 20 68 61 72 + 64 63 6f 64 69 6e 67 20 74 68 65 20 73 69 7a 65 + 20 6f 66 20 74 68 69 73 20 68 65 61 64 65 72 20 + 77 6f 75 6c 64 20 77 6f 72 6b 20 66 69 6e 65 2c + 20 69 74 27 73 20 65 61 73 69 65 72 0a + + ~ " ~ to use the label system to keep track of its size. The" + ~ " only place this is" + 20 20 7e 20 74 6f 20 75 73 65 20 74 68 65 20 6c + 61 62 65 6c 20 73 79 73 74 65 6d 20 74 6f 20 6b + 65 65 70 20 74 72 61 63 6b 20 6f 66 20 69 74 73 + 20 73 69 7a 65 2e 20 54 68 65 20 6f 6e 6c 79 20 + 70 6c 61 63 65 20 74 68 69 73 20 69 73 0a + + ~ " ~ actually referenced is right here in the header." + 20 20 7e 20 61 63 74 75 61 6c 6c 79 20 72 65 66 + 65 72 65 6e 63 65 64 20 69 73 20 72 69 67 68 74 + 20 68 65 72 65 20 69 6e 20 74 68 65 20 68 65 61 + 64 65 72 2e 0a + + ~ " current-offset 4 roll - L!' elf-header-size" + 20 20 63 75 72 72 65 6e 74 2d 6f 66 66 73 65 74 + 20 34 20 72 6f 6c 6c 20 2d 20 4c 21 27 20 65 6c + 66 2d 68 65 61 64 65 72 2d 73 69 7a 65 0a + + ~ " L' elf-header-size set-label-non-offset" + 20 20 4c 27 20 65 6c 66 2d 68 65 61 64 65 72 2d + 73 69 7a 65 20 73 65 74 2d 6c 61 62 65 6c 2d 6e + 6f 6e 2d 6f 66 66 73 65 74 0a + + ~ " ~ : deindent" + 20 20 7e 20 3a 20 64 65 69 6e 64 65 6e 74 0a + + ~ " ;" + 20 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 0a + + ~ "~ ~~ ELF program header ~~" + 7e 20 7e 7e 20 45 4c 46 20 70 72 6f 67 72 61 6d + 20 68 65 61 64 65 72 20 7e 7e 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 0a + + ~ "~" + 7e 0a + + ~ "~ Second, we output ELF's program header, which lists the" + ~ " memory regions" + 7e 20 20 20 53 65 63 6f 6e 64 2c 20 77 65 20 6f + 75 74 70 75 74 20 45 4c 46 27 73 20 70 72 6f 67 + 72 61 6d 20 68 65 61 64 65 72 2c 20 77 68 69 63 + 68 20 6c 69 73 74 73 20 74 68 65 20 6d 65 6d 6f + 72 79 20 72 65 67 69 6f 6e 73 0a + + ~ "~ ("segments") we want to have and where we want them to" + ~ " come from. There may" + 7e 20 28 22 73 65 67 6d 65 6e 74 73 22 29 20 77 + 65 20 77 61 6e 74 20 74 6f 20 68 61 76 65 20 61 + 6e 64 20 77 68 65 72 65 20 77 65 20 77 61 6e 74 + 20 74 68 65 6d 20 74 6f 20 63 6f 6d 65 20 66 72 + 6f 6d 2e 20 54 68 65 72 65 20 6d 61 79 0a + + ~ "~ be any number of these entries, one per segment, , and" + ~ " they may be anywhere" + 7e 20 62 65 20 61 6e 79 20 6e 75 6d 62 65 72 20 + 6f 66 20 74 68 65 73 65 20 65 6e 74 72 69 65 73 + 2c 20 6f 6e 65 20 70 65 72 20 73 65 67 6d 65 6e + 74 2c 20 2c 20 61 6e 64 20 74 68 65 79 20 6d 61 + 79 20 62 65 20 61 6e 79 77 68 65 72 65 0a + + ~ "~ in the file as long as they're consecutive." + 7e 20 69 6e 20 74 68 65 20 66 69 6c 65 20 61 73 + 20 6c 6f 6e 67 20 61 73 20 74 68 65 79 27 72 65 + 20 63 6f 6e 73 65 63 75 74 69 76 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ We list just a single region, which is the entire" + ~ " contents of the ELF file" + 7e 20 20 20 57 65 20 6c 69 73 74 20 6a 75 73 74 + 20 61 20 73 69 6e 67 6c 65 20 72 65 67 69 6f 6e + 2c 20 77 68 69 63 68 20 69 73 20 74 68 65 20 65 + 6e 74 69 72 65 20 63 6f 6e 74 65 6e 74 73 20 6f + 66 20 74 68 65 20 45 4c 46 20 66 69 6c 65 0a + + ~ "~ from disk, and we put the program header immediately" + ~ " after the file header." + 7e 20 66 72 6f 6d 20 64 69 73 6b 2c 20 61 6e 64 + 20 77 65 20 70 75 74 20 74 68 65 20 70 72 6f 67 + 72 61 6d 20 68 65 61 64 65 72 20 69 6d 6d 65 64 + 69 61 74 65 6c 79 20 61 66 74 65 72 20 74 68 65 + 20 66 69 6c 65 20 68 65 61 64 65 72 2e 0a + + ~ "~ The program we're building should call this word as the" + ~ " second output it" + 7e 20 54 68 65 20 70 72 6f 67 72 61 6d 20 77 65 + 27 72 65 20 62 75 69 6c 64 69 6e 67 20 73 68 6f + 75 6c 64 20 63 61 6c 6c 20 74 68 69 73 20 77 6f + 72 64 20 61 73 20 74 68 65 20 73 65 63 6f 6e 64 + 20 6f 75 74 70 75 74 20 69 74 0a + + ~ "~ generates." + 7e 20 67 65 6e 65 72 61 74 65 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ It would be more typical to use this header to ask the" + ~ " loader to give us" + 7e 20 20 20 49 74 20 77 6f 75 6c 64 20 62 65 20 + 6d 6f 72 65 20 74 79 70 69 63 61 6c 20 74 6f 20 + 75 73 65 20 74 68 69 73 20 68 65 61 64 65 72 20 + 74 6f 20 61 73 6b 20 74 68 65 20 6c 6f 61 64 65 + 72 20 74 6f 20 67 69 76 65 20 75 73 0a + + ~ "~ separate code and data segments, and perhaps a stack or" + ~ " heap, but this keeps" + 7e 20 73 65 70 61 72 61 74 65 20 63 6f 64 65 20 + 61 6e 64 20 64 61 74 61 20 73 65 67 6d 65 6e 74 + 73 2c 20 61 6e 64 20 70 65 72 68 61 70 73 20 61 + 20 73 74 61 63 6b 20 6f 72 20 68 65 61 70 2c 20 + 62 75 74 20 74 68 69 73 20 6b 65 65 70 73 0a + + ~ "~ things simple, and we can create those things for" + ~ " ourselves later." + 7e 20 74 68 69 6e 67 73 20 73 69 6d 70 6c 65 2c + 20 61 6e 64 20 77 65 20 63 61 6e 20 63 72 65 61 + 74 65 20 74 68 6f 73 65 20 74 68 69 6e 67 73 20 + 66 6f 72 20 6f 75 72 73 65 6c 76 65 73 20 6c 61 + 74 65 72 2e 0a + + ~ "~" + 7e 0a + + ~ "~ We do have a little stack space available, though we" + ~ " don't explicitly" + 7e 20 20 20 57 65 20 64 6f 20 68 61 76 65 20 61 + 20 6c 69 74 74 6c 65 20 73 74 61 63 6b 20 73 70 + 61 63 65 20 61 76 61 69 6c 61 62 6c 65 2c 20 74 + 68 6f 75 67 68 20 77 65 20 64 6f 6e 27 74 20 65 + 78 70 6c 69 63 69 74 6c 79 0a + + ~ "~ request any; the kernel allocates it for us as part of" + ~ " exec() so that it can" + 7e 20 72 65 71 75 65 73 74 20 61 6e 79 3b 20 74 + 68 65 20 6b 65 72 6e 65 6c 20 61 6c 6c 6f 63 61 + 74 65 73 20 69 74 20 66 6f 72 20 75 73 20 61 73 + 20 70 61 72 74 20 6f 66 20 65 78 65 63 28 29 20 + 73 6f 20 74 68 61 74 20 69 74 20 63 61 6e 0a + + ~ "~ pass us argc and argv (which we ignore). That stack space" + ~ " will be at a" + 7e 20 70 61 73 73 20 75 73 20 61 72 67 63 20 61 + 6e 64 20 61 72 67 76 20 28 77 68 69 63 68 20 77 + 65 20 69 67 6e 6f 72 65 29 2e 20 54 68 61 74 20 + 73 74 61 63 6b 20 73 70 61 63 65 20 77 69 6c 6c + 20 62 65 20 61 74 20 61 0a + + ~ "~ random address, different every time, because of ASLR;" + ~ " that's a neat" + 7e 20 72 61 6e 64 6f 6d 20 61 64 64 72 65 73 73 + 2c 20 64 69 66 66 65 72 65 6e 74 20 65 76 65 72 + 79 20 74 69 6d 65 2c 20 62 65 63 61 75 73 65 20 + 6f 66 20 41 53 4c 52 3b 20 74 68 61 74 27 73 20 + 61 20 6e 65 61 74 0a + + ~ "~ security feature, so we leave it as-is. Note that ASLR" + ~ " doesn't happen when" + 7e 20 73 65 63 75 72 69 74 79 20 66 65 61 74 75 + 72 65 2c 20 73 6f 20 77 65 20 6c 65 61 76 65 20 + 69 74 20 61 73 2d 69 73 2e 20 4e 6f 74 65 20 74 + 68 61 74 20 41 53 4c 52 20 64 6f 65 73 6e 27 74 + 20 68 61 70 70 65 6e 20 77 68 65 6e 0a + + ~ "~ you run under gdb, so if you aren't seeing it, that's" + ~ " probably why." + 7e 20 79 6f 75 20 72 75 6e 20 75 6e 64 65 72 20 + 67 64 62 2c 20 73 6f 20 69 66 20 79 6f 75 20 61 + 72 65 6e 27 74 20 73 65 65 69 6e 67 20 69 74 2c + 20 74 68 61 74 27 73 20 70 72 6f 62 61 62 6c 79 + 20 77 68 79 2e 0a + + ~ "" + 0a + + ~ "~ ~~" + 7e 20 7e 7e 0a + + ~ ": elf-program-header" + 3a 20 65 6c 66 2d 70 72 6f 67 72 61 6d 2d 68 65 + 61 64 65 72 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : ELF program header" + 20 20 7e 20 3a 20 45 4c 46 20 70 72 6f 67 72 61 + 6d 20 68 65 61 64 65 72 0a + + ~ " ~ : indent" + 20 20 7e 20 3a 20 69 6e 64 65 6e 74 0a + + ~ " ~ * denotes mandatory fields according to breadbox" + 20 20 7e 20 2a 20 64 65 6e 6f 74 65 73 20 6d 61 + 6e 64 61 74 6f 72 79 20 66 69 65 6c 64 73 20 61 + 63 63 6f 72 64 69 6e 67 20 74 6f 20 62 72 65 61 + 64 62 6f 78 0a + + ~ " current-offset L!' elf-program-header" + 20 20 63 75 72 72 65 6e 74 2d 6f 66 66 73 65 74 + 20 4c 21 27 20 65 6c 66 2d 70 72 6f 67 72 61 6d + 2d 68 65 61 64 65 72 0a + + ~ " current-offset 3unroll" + 20 20 63 75 72 72 65 6e 74 2d 6f 66 66 73 65 74 + 20 33 75 6e 72 6f 6c 6c 0a + + ~ "" + 0a + + ~ " 1 pack32 ~ : -4 *"loadable"" + ~ " segment type" + 20 20 31 20 70 61 63 6b 33 32 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 34 20 2a 22 6c + 6f 61 64 61 62 6c 65 22 20 73 65 67 6d 65 6e 74 + 20 74 79 70 65 0a + + ~ " 0x05 pack32 ~ : -4 *read+execute" + ~ " permission" + 20 20 30 78 30 35 20 70 61 63 6b 33 32 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 34 20 2a 72 65 + 61 64 2b 65 78 65 63 75 74 65 20 70 65 72 6d 69 + 73 73 69 6f 6e 0a + + ~ " 0 pack64 ~ : -8 *offset in" + ~ " file" + 20 20 30 20 70 61 63 6b 36 34 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 2a 6f 66 + 66 73 65 74 20 69 6e 20 66 69 6c 65 0a + + ~ " L@' origin pack64 ~ : -8 *virtual" + ~ " address" + 20 20 4c 40 27 20 6f 72 69 67 69 6e 20 70 61 63 + 6b 36 34 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 2a 76 69 + 72 74 75 61 6c 20 61 64 64 72 65 73 73 0a + + ~ " ~ required, but can be anything, subject to alignment" + 20 20 20 20 7e 20 72 65 71 75 69 72 65 64 2c 20 + 62 75 74 20 63 61 6e 20 62 65 20 61 6e 79 74 68 + 69 6e 67 2c 20 73 75 62 6a 65 63 74 20 74 6f 20 + 61 6c 69 67 6e 6d 65 6e 74 0a + + ~ " 0 pack64 ~ : -8 physical" + ~ " address (ignored)" + 20 20 30 20 70 61 63 6b 36 34 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 70 68 79 + 73 69 63 61 6c 20 61 64 64 72 65 73 73 20 28 69 + 67 6e 6f 72 65 64 29 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ "" + 0a + + ~ " L@' total-size pack64 ~ : -8 *size in file" + 20 20 4c 40 27 20 74 6f 74 61 6c 2d 73 69 7a 65 + 20 70 61 63 6b 36 34 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 2a 73 69 + 7a 65 20 69 6e 20 66 69 6c 65 0a + + ~ " L@' total-size pack64 ~ : -8 *size in" + ~ " memory" + 20 20 4c 40 27 20 74 6f 74 61 6c 2d 73 69 7a 65 + 20 70 61 63 6b 36 34 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 2a 73 69 + 7a 65 20 69 6e 20 6d 65 6d 6f 72 79 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ "" + 0a + + ~ " 0 pack64 ~ : -8 segment" + ~ " alignment" + 20 20 30 20 70 61 63 6b 36 34 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 73 65 67 + 6d 65 6e 74 20 61 6c 69 67 6e 6d 65 6e 74 0a + + ~ " ~ for relocation, but this doesn't apply to us" + 20 20 20 20 7e 20 66 6f 72 20 72 65 6c 6f 63 61 + 74 69 6f 6e 2c 20 62 75 74 20 74 68 69 73 20 64 + 6f 65 73 6e 27 74 20 61 70 70 6c 79 20 74 6f 20 + 75 73 0a + + ~ "" + 0a + + ~ " ~ As with the file header, we use the label system to" + ~ " keep track of the" + 20 20 7e 20 20 20 41 73 20 77 69 74 68 20 74 68 + 65 20 66 69 6c 65 20 68 65 61 64 65 72 2c 20 77 + 65 20 75 73 65 20 74 68 65 20 6c 61 62 65 6c 20 + 73 79 73 74 65 6d 20 74 6f 20 6b 65 65 70 20 74 + 72 61 63 6b 20 6f 66 20 74 68 65 0a + + ~ " ~ program header's size." + 20 20 7e 20 70 72 6f 67 72 61 6d 20 68 65 61 64 + 65 72 27 73 20 73 69 7a 65 2e 0a + + ~ " current-offset 4 roll - L!' elf-program-header-size" + 20 20 63 75 72 72 65 6e 74 2d 6f 66 66 73 65 74 + 20 34 20 72 6f 6c 6c 20 2d 20 4c 21 27 20 65 6c + 66 2d 70 72 6f 67 72 61 6d 2d 68 65 61 64 65 72 + 2d 73 69 7a 65 0a + + ~ " L' elf-program-header-size set-label-non-offset" + 20 20 4c 27 20 65 6c 66 2d 70 72 6f 67 72 61 6d + 2d 68 65 61 64 65 72 2d 73 69 7a 65 20 73 65 74 + 2d 6c 61 62 65 6c 2d 6e 6f 6e 2d 6f 66 66 73 65 + 74 0a + + ~ " ~ : deindent" + 20 20 7e 20 3a 20 64 65 69 6e 64 65 6e 74 0a + + ~ " ;" + 20 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This alternate version of the program header isn't used" + ~ " by evoke.e, but" + 7e 20 20 20 54 68 69 73 20 61 6c 74 65 72 6e 61 + 74 65 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 + 65 20 70 72 6f 67 72 61 6d 20 68 65 61 64 65 72 + 20 69 73 6e 27 74 20 75 73 65 64 20 62 79 20 65 + 76 6f 6b 65 2e 65 2c 20 62 75 74 0a + + ~ "~ may be useful for other programs, such as hex.e. Its only" + ~ " difference from" + 7e 20 6d 61 79 20 62 65 20 75 73 65 66 75 6c 20 + 66 6f 72 20 6f 74 68 65 72 20 70 72 6f 67 72 61 + 6d 73 2c 20 73 75 63 68 20 61 73 20 68 65 78 2e + 65 2e 20 49 74 73 20 6f 6e 6c 79 20 64 69 66 66 + 65 72 65 6e 63 65 20 66 72 6f 6d 0a + + ~ "~ the base version is that it adds the write permission." + 7e 20 74 68 65 20 62 61 73 65 20 76 65 72 73 69 + 6f 6e 20 69 73 20 74 68 61 74 20 69 74 20 61 64 + 64 73 20 74 68 65 20 77 72 69 74 65 20 70 65 72 + 6d 69 73 73 69 6f 6e 2e 0a + + ~ ": elf-program-header-writable" + 3a 20 65 6c 66 2d 70 72 6f 67 72 61 6d 2d 68 65 + 61 64 65 72 2d 77 72 69 74 61 62 6c 65 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : ELF program header" + 20 20 7e 20 3a 20 45 4c 46 20 70 72 6f 67 72 61 + 6d 20 68 65 61 64 65 72 0a + + ~ " ~ : indent" + 20 20 7e 20 3a 20 69 6e 64 65 6e 74 0a + + ~ " ~ * denotes mandatory fields according to breadbox" + 20 20 7e 20 2a 20 64 65 6e 6f 74 65 73 20 6d 61 + 6e 64 61 74 6f 72 79 20 66 69 65 6c 64 73 20 61 + 63 63 6f 72 64 69 6e 67 20 74 6f 20 62 72 65 61 + 64 62 6f 78 0a + + ~ " current-offset L!' elf-program-header" + 20 20 63 75 72 72 65 6e 74 2d 6f 66 66 73 65 74 + 20 4c 21 27 20 65 6c 66 2d 70 72 6f 67 72 61 6d + 2d 68 65 61 64 65 72 0a + + ~ " current-offset 3unroll" + 20 20 63 75 72 72 65 6e 74 2d 6f 66 66 73 65 74 + 20 33 75 6e 72 6f 6c 6c 0a + + ~ "" + 0a + + ~ " 1 pack32 ~ : -4 *"loadable"" + ~ " segment type" + 20 20 31 20 70 61 63 6b 33 32 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 34 20 2a 22 6c + 6f 61 64 61 62 6c 65 22 20 73 65 67 6d 65 6e 74 + 20 74 79 70 65 0a + + ~ " 0x07 pack32 ~ : -4" + ~ " *read+write+execute permission" + 20 20 30 78 30 37 20 70 61 63 6b 33 32 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 34 20 2a 72 65 + 61 64 2b 77 72 69 74 65 2b 65 78 65 63 75 74 65 + 20 70 65 72 6d 69 73 73 69 6f 6e 0a + + ~ " 0 pack64 ~ : -8 *offset in" + ~ " file" + 20 20 30 20 70 61 63 6b 36 34 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 2a 6f 66 + 66 73 65 74 20 69 6e 20 66 69 6c 65 0a + + ~ " L@' origin pack64 ~ : -8 *virtual" + ~ " address" + 20 20 4c 40 27 20 6f 72 69 67 69 6e 20 70 61 63 + 6b 36 34 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 2a 76 69 + 72 74 75 61 6c 20 61 64 64 72 65 73 73 0a + + ~ " ~ required, but can be anything, subject to alignment" + 20 20 20 20 7e 20 72 65 71 75 69 72 65 64 2c 20 + 62 75 74 20 63 61 6e 20 62 65 20 61 6e 79 74 68 + 69 6e 67 2c 20 73 75 62 6a 65 63 74 20 74 6f 20 + 61 6c 69 67 6e 6d 65 6e 74 0a + + ~ " 0 pack64 ~ : -8 physical" + ~ " address (ignored)" + 20 20 30 20 70 61 63 6b 36 34 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 70 68 79 + 73 69 63 61 6c 20 61 64 64 72 65 73 73 20 28 69 + 67 6e 6f 72 65 64 29 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ "" + 0a + + ~ " L@' total-size pack64 ~ : -8 *size in file" + 20 20 4c 40 27 20 74 6f 74 61 6c 2d 73 69 7a 65 + 20 70 61 63 6b 36 34 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 2a 73 69 + 7a 65 20 69 6e 20 66 69 6c 65 0a + + ~ " L@' total-size pack64 ~ : -8 *size in" + ~ " memory" + 20 20 4c 40 27 20 74 6f 74 61 6c 2d 73 69 7a 65 + 20 70 61 63 6b 36 34 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 2a 73 69 + 7a 65 20 69 6e 20 6d 65 6d 6f 72 79 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ "" + 0a + + ~ " 0 pack64 ~ : -8 segment" + ~ " alignment" + 20 20 30 20 70 61 63 6b 36 34 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 73 65 67 + 6d 65 6e 74 20 61 6c 69 67 6e 6d 65 6e 74 0a + + ~ " ~ for relocation, but this doesn't apply to us" + 20 20 20 20 7e 20 66 6f 72 20 72 65 6c 6f 63 61 + 74 69 6f 6e 2c 20 62 75 74 20 74 68 69 73 20 64 + 6f 65 73 6e 27 74 20 61 70 70 6c 79 20 74 6f 20 + 75 73 0a + + ~ "" + 0a + + ~ " ~ As with the file header, we use the label system to" + ~ " keep track of the" + 20 20 7e 20 20 20 41 73 20 77 69 74 68 20 74 68 + 65 20 66 69 6c 65 20 68 65 61 64 65 72 2c 20 77 + 65 20 75 73 65 20 74 68 65 20 6c 61 62 65 6c 20 + 73 79 73 74 65 6d 20 74 6f 20 6b 65 65 70 20 74 + 72 61 63 6b 20 6f 66 20 74 68 65 0a + + ~ " ~ program header's size." + 20 20 7e 20 70 72 6f 67 72 61 6d 20 68 65 61 64 + 65 72 27 73 20 73 69 7a 65 2e 0a + + ~ " current-offset 4 roll - L!' elf-program-header-size" + 20 20 63 75 72 72 65 6e 74 2d 6f 66 66 73 65 74 + 20 34 20 72 6f 6c 6c 20 2d 20 4c 21 27 20 65 6c + 66 2d 70 72 6f 67 72 61 6d 2d 68 65 61 64 65 72 + 2d 73 69 7a 65 0a + + ~ " L' elf-program-header-size set-label-non-offset" + 20 20 4c 27 20 65 6c 66 2d 70 72 6f 67 72 61 6d + 2d 68 65 61 64 65 72 2d 73 69 7a 65 20 73 65 74 + 2d 6c 61 62 65 6c 2d 6e 6f 6e 2d 6f 66 66 73 65 + 74 0a + + ~ " ~ : deindent" + 20 20 7e 20 3a 20 64 65 69 6e 64 65 6e 74 0a + + ~ " ;" + 20 20 3b 0a + + ~ "" + 0a + + ~ "~ ~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 0a + + ~ "~ ~~ That's it! ~~" + 7e 20 7e 7e 20 54 68 61 74 27 73 20 69 74 21 20 + 7e 7e 0a + + ~ "~ ~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 0a + + ~ "~" + 7e 0a + + ~ "~ ELF is a simple format, really. Now you can output" + ~ " your own machine code" + 7e 20 20 20 45 4c 46 20 69 73 20 61 20 73 69 6d + 70 6c 65 20 66 6f 72 6d 61 74 2c 20 72 65 61 6c + 6c 79 2e 20 20 4e 6f 77 20 79 6f 75 20 63 61 6e + 20 6f 75 74 70 75 74 20 79 6f 75 72 20 6f 77 6e + 20 6d 61 63 68 69 6e 65 20 63 6f 64 65 0a + + ~ "~ that you generate however you want; make sure to define" + ~ " the labels "origin"" + 7e 20 74 68 61 74 20 79 6f 75 20 67 65 6e 65 72 + 61 74 65 20 68 6f 77 65 76 65 72 20 79 6f 75 20 + 77 61 6e 74 3b 20 6d 61 6b 65 20 73 75 72 65 20 + 74 6f 20 64 65 66 69 6e 65 20 74 68 65 20 6c 61 + 62 65 6c 73 20 22 6f 72 69 67 69 6e 22 0a + + ~ "~ and "cold-start". Origin will control the address the" + ~ " code loads at;" + 7e 20 61 6e 64 20 22 63 6f 6c 64 2d 73 74 61 72 + 74 22 2e 20 4f 72 69 67 69 6e 20 77 69 6c 6c 20 + 63 6f 6e 74 72 6f 6c 20 74 68 65 20 61 64 64 72 + 65 73 73 20 74 68 65 20 63 6f 64 65 20 6c 6f 61 + 64 73 20 61 74 3b 0a + + ~ "~ cold-start will be the first thing that runs. The origin" + ~ " is arbitrary, but" + 7e 20 63 6f 6c 64 2d 73 74 61 72 74 20 77 69 6c + 6c 20 62 65 20 74 68 65 20 66 69 72 73 74 20 74 + 68 69 6e 67 20 74 68 61 74 20 72 75 6e 73 2e 20 + 54 68 65 20 6f 72 69 67 69 6e 20 69 73 20 61 72 + 62 69 74 72 61 72 79 2c 20 62 75 74 0a + + ~ "~ can't be zero." + 7e 20 63 61 6e 27 74 20 62 65 20 7a 65 72 6f 2e + 0a + + ~ "" + 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 0a + + ~ "~ ~~ Code transformation facility ~~" + 7e 20 7e 7e 20 43 6f 64 65 20 74 72 61 6e 73 66 + 6f 72 6d 61 74 69 6f 6e 20 66 61 63 69 6c 69 74 + 79 20 7e 7e 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 0a + + ~ "~" + 7e 0a + + ~ "~ The process of producing an executable binary out of" + ~ " Evocation involves" + 7e 20 20 20 54 68 65 20 70 72 6f 63 65 73 73 20 + 6f 66 20 70 72 6f 64 75 63 69 6e 67 20 61 6e 20 + 65 78 65 63 75 74 61 62 6c 65 20 62 69 6e 61 72 + 79 20 6f 75 74 20 6f 66 20 45 76 6f 63 61 74 69 + 6f 6e 20 69 6e 76 6f 6c 76 65 73 0a + + ~ "~ various bootstrapping phases during which code operates" + ~ " under different" + 7e 20 76 61 72 69 6f 75 73 20 62 6f 6f 74 73 74 + 72 61 70 70 69 6e 67 20 70 68 61 73 65 73 20 64 + 75 72 69 6e 67 20 77 68 69 63 68 20 63 6f 64 65 + 20 6f 70 65 72 61 74 65 73 20 75 6e 64 65 72 20 + 64 69 66 66 65 72 65 6e 74 0a + + ~ "~ constraints, and must be written with different styles." + ~ " In some cases," + 7e 20 63 6f 6e 73 74 72 61 69 6e 74 73 2c 20 61 + 6e 64 20 6d 75 73 74 20 62 65 20 77 72 69 74 74 + 65 6e 20 77 69 74 68 20 64 69 66 66 65 72 65 6e + 74 20 73 74 79 6c 65 73 2e 20 49 6e 20 73 6f 6d + 65 20 63 61 73 65 73 2c 0a + + ~ "~ substantially the same code must be output multiple times" + ~ " in slightly" + 7e 20 73 75 62 73 74 61 6e 74 69 61 6c 6c 79 20 + 74 68 65 20 73 61 6d 65 20 63 6f 64 65 20 6d 75 + 73 74 20 62 65 20 6f 75 74 70 75 74 20 6d 75 6c + 74 69 70 6c 65 20 74 69 6d 65 73 20 69 6e 20 73 + 6c 69 67 68 74 6c 79 0a + + ~ "~ different ways, and it would be both arduous and verbose" + ~ " to write each of" + 7e 20 64 69 66 66 65 72 65 6e 74 20 77 61 79 73 + 2c 20 61 6e 64 20 69 74 20 77 6f 75 6c 64 20 62 + 65 20 62 6f 74 68 20 61 72 64 75 6f 75 73 20 61 + 6e 64 20 76 65 72 62 6f 73 65 20 74 6f 20 77 72 + 69 74 65 20 65 61 63 68 20 6f 66 0a + + ~ "~ these directly." + 7e 20 74 68 65 73 65 20 64 69 72 65 63 74 6c 79 + 2e 0a + + ~ "~" + 7e 0a + + ~ "~ To solve this problem, this file implements a concept" + ~ " of code" + 7e 20 20 20 54 6f 20 73 6f 6c 76 65 20 74 68 69 + 73 20 70 72 6f 62 6c 65 6d 2c 20 74 68 69 73 20 + 66 69 6c 65 20 69 6d 70 6c 65 6d 65 6e 74 73 20 + 61 20 63 6f 6e 63 65 70 74 20 6f 66 20 63 6f 64 + 65 0a + + ~ "~ transformation. There are two transforms, the label" + ~ " transform and the" + 7e 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2e 20 54 68 65 72 65 20 61 72 65 20 74 77 6f 20 + 74 72 61 6e 73 66 6f 72 6d 73 2c 20 74 68 65 20 + 6c 61 62 65 6c 20 74 72 61 6e 73 66 6f 72 6d 20 + 61 6e 64 20 74 68 65 0a + + ~ "~ log-load transform, each of which takes a string" + ~ " containing Evocation source" + 7e 20 6c 6f 67 2d 6c 6f 61 64 20 74 72 61 6e 73 + 66 6f 72 6d 2c 20 65 61 63 68 20 6f 66 20 77 68 + 69 63 68 20 74 61 6b 65 73 20 61 20 73 74 72 69 + 6e 67 20 63 6f 6e 74 61 69 6e 69 6e 67 20 45 76 + 6f 63 61 74 69 6f 6e 20 73 6f 75 72 63 65 0a + + ~ "~ code and produces compiled code that has been modified to" + ~ " operate in a" + 7e 20 63 6f 64 65 20 61 6e 64 20 70 72 6f 64 75 + 63 65 73 20 63 6f 6d 70 69 6c 65 64 20 63 6f 64 + 65 20 74 68 61 74 20 68 61 73 20 62 65 65 6e 20 + 6d 6f 64 69 66 69 65 64 20 74 6f 20 6f 70 65 72 + 61 74 65 20 69 6e 20 61 0a + + ~ "~ specific way. The transforms rely on the label facility" + ~ " provided by" + 7e 20 73 70 65 63 69 66 69 63 20 77 61 79 2e 20 + 54 68 65 20 74 72 61 6e 73 66 6f 72 6d 73 20 72 + 65 6c 79 20 6f 6e 20 74 68 65 20 6c 61 62 65 6c + 20 66 61 63 69 6c 69 74 79 20 70 72 6f 76 69 64 + 65 64 20 62 79 0a + + ~ "~ compilation/labels.e, and expect to run from within" + ~ " label-loop." + 7e 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 2f 6c 61 + 62 65 6c 73 2e 65 2c 20 61 6e 64 20 65 78 70 65 + 63 74 20 74 6f 20 72 75 6e 20 66 72 6f 6d 20 77 + 69 74 68 69 6e 20 6c 61 62 65 6c 2d 6c 6f 6f 70 + 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The label transform produces code that uses one label" + ~ " per word it defines," + 7e 20 20 20 54 68 65 20 6c 61 62 65 6c 20 74 72 + 61 6e 73 66 6f 72 6d 20 70 72 6f 64 75 63 65 73 + 20 63 6f 64 65 20 74 68 61 74 20 75 73 65 73 20 + 6f 6e 65 20 6c 61 62 65 6c 20 70 65 72 20 77 6f + 72 64 20 69 74 20 64 65 66 69 6e 65 73 2c 0a + + ~ "~ to statically reference everything. Thus, when output to" + ~ " an executable" + 7e 20 74 6f 20 73 74 61 74 69 63 61 6c 6c 79 20 + 72 65 66 65 72 65 6e 63 65 20 65 76 65 72 79 74 + 68 69 6e 67 2e 20 54 68 75 73 2c 20 77 68 65 6e + 20 6f 75 74 70 75 74 20 74 6f 20 61 6e 20 65 78 + 65 63 75 74 61 62 6c 65 0a + + ~ "~ binary, this code will function without external" + ~ " dependencies. The tradeoff" + 7e 20 62 69 6e 61 72 79 2c 20 74 68 69 73 20 63 + 6f 64 65 20 77 69 6c 6c 20 66 75 6e 63 74 69 6f + 6e 20 77 69 74 68 6f 75 74 20 65 78 74 65 72 6e + 61 6c 20 64 65 70 65 6e 64 65 6e 63 69 65 73 2e + 20 54 68 65 20 74 72 61 64 65 6f 66 66 0a + + ~ "~ is that it has no way to reference data that exists only" + ~ " at runtime." + 7e 20 69 73 20 74 68 61 74 20 69 74 20 68 61 73 + 20 6e 6f 20 77 61 79 20 74 6f 20 72 65 66 65 72 + 65 6e 63 65 20 64 61 74 61 20 74 68 61 74 20 65 + 78 69 73 74 73 20 6f 6e 6c 79 20 61 74 20 72 75 + 6e 74 69 6d 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The log-load transform relies on labels, but doesn't" + ~ " add any of its own." + 7e 20 20 20 54 68 65 20 6c 6f 67 2d 6c 6f 61 64 + 20 74 72 61 6e 73 66 6f 72 6d 20 72 65 6c 69 65 + 73 20 6f 6e 20 6c 61 62 65 6c 73 2c 20 62 75 74 + 20 64 6f 65 73 6e 27 74 20 61 64 64 20 61 6e 79 + 20 6f 66 20 69 74 73 20 6f 77 6e 2e 0a + + ~ "~ It produces a compiled routine which, when run," + ~ " dynamically looks up all the" + 7e 20 49 74 20 70 72 6f 64 75 63 65 73 20 61 20 + 63 6f 6d 70 69 6c 65 64 20 72 6f 75 74 69 6e 65 + 20 77 68 69 63 68 2c 20 77 68 65 6e 20 72 75 6e + 2c 20 64 79 6e 61 6d 69 63 61 6c 6c 79 20 6c 6f + 6f 6b 73 20 75 70 20 61 6c 6c 20 74 68 65 0a + + ~ "~ references in the log, and appends the original code to" + ~ " the log. This adds" + 7e 20 72 65 66 65 72 65 6e 63 65 73 20 69 6e 20 + 74 68 65 20 6c 6f 67 2c 20 61 6e 64 20 61 70 70 + 65 6e 64 73 20 74 68 65 20 6f 72 69 67 69 6e 61 + 6c 20 63 6f 64 65 20 74 6f 20 74 68 65 20 6c 6f + 67 2e 20 54 68 69 73 20 61 64 64 73 0a + + ~ "~ work that must be done when the runtime starts up, but" + ~ " the benefit is that" + 7e 20 77 6f 72 6b 20 74 68 61 74 20 6d 75 73 74 + 20 62 65 20 64 6f 6e 65 20 77 68 65 6e 20 74 68 + 65 20 72 75 6e 74 69 6d 65 20 73 74 61 72 74 73 + 20 75 70 2c 20 62 75 74 20 74 68 65 20 62 65 6e + 65 66 69 74 20 69 73 20 74 68 61 74 0a + + ~ "~ it can reference data that doesn't exist at compile-time." + ~ " Most crucially," + 7e 20 69 74 20 63 61 6e 20 72 65 66 65 72 65 6e + 63 65 20 64 61 74 61 20 74 68 61 74 20 64 6f 65 + 73 6e 27 74 20 65 78 69 73 74 20 61 74 20 63 6f + 6d 70 69 6c 65 2d 74 69 6d 65 2e 20 4d 6f 73 74 + 20 63 72 75 63 69 61 6c 6c 79 2c 0a + + ~ "~ it can reference the "here" and "latest" pointers in the" + ~ " log, which are" + 7e 20 69 74 20 63 61 6e 20 72 65 66 65 72 65 6e + 63 65 20 74 68 65 20 22 68 65 72 65 22 20 61 6e + 64 20 22 6c 61 74 65 73 74 22 20 70 6f 69 6e 74 + 65 72 73 20 69 6e 20 74 68 65 20 6c 6f 67 2c 20 + 77 68 69 63 68 20 61 72 65 0a + + ~ "~ required for all the usual word-definition stuff to work," + ~ " and whose" + 7e 20 72 65 71 75 69 72 65 64 20 66 6f 72 20 61 + 6c 6c 20 74 68 65 20 75 73 75 61 6c 20 77 6f 72 + 64 2d 64 65 66 69 6e 69 74 69 6f 6e 20 73 74 75 + 66 66 20 74 6f 20 77 6f 72 6b 2c 20 61 6e 64 20 + 77 68 6f 73 65 0a + + ~ "~ addresses are not known until runtime." + 7e 20 61 64 64 72 65 73 73 65 73 20 61 72 65 20 + 6e 6f 74 20 6b 6e 6f 77 6e 20 75 6e 74 69 6c 20 + 72 75 6e 74 69 6d 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The log-load transform may also be useful for" + ~ " experimental tasks such as" + 7e 20 20 20 54 68 65 20 6c 6f 67 2d 6c 6f 61 64 + 20 74 72 61 6e 73 66 6f 72 6d 20 6d 61 79 20 61 + 6c 73 6f 20 62 65 20 75 73 65 66 75 6c 20 66 6f + 72 20 65 78 70 65 72 69 6d 65 6e 74 61 6c 20 74 + 61 73 6b 73 20 73 75 63 68 20 61 73 0a + + ~ "~ creating additional, independent logs, or injecting" + ~ " Evocation into another" + 7e 20 63 72 65 61 74 69 6e 67 20 61 64 64 69 74 + 69 6f 6e 61 6c 2c 20 69 6e 64 65 70 65 6e 64 65 + 6e 74 20 6c 6f 67 73 2c 20 6f 72 20 69 6e 6a 65 + 63 74 69 6e 67 20 45 76 6f 63 61 74 69 6f 6e 20 + 69 6e 74 6f 20 61 6e 6f 74 68 65 72 0a + + ~ "~ process's address space." + 7e 20 70 72 6f 63 65 73 73 27 73 20 61 64 64 72 + 65 73 73 20 73 70 61 63 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Please notice that both these transforms, in different" + ~ " ways, navigate the" + 7e 20 20 20 50 6c 65 61 73 65 20 6e 6f 74 69 63 + 65 20 74 68 61 74 20 62 6f 74 68 20 74 68 65 73 + 65 20 74 72 61 6e 73 66 6f 72 6d 73 2c 20 69 6e + 20 64 69 66 66 65 72 65 6e 74 20 77 61 79 73 2c + 20 6e 61 76 69 67 61 74 65 20 74 68 65 0a + + ~ "~ same underlying design tension: The Forth compilation" + ~ " model hardcodes" + 7e 20 73 61 6d 65 20 75 6e 64 65 72 6c 79 69 6e + 67 20 64 65 73 69 67 6e 20 74 65 6e 73 69 6f 6e + 3a 20 54 68 65 20 46 6f 72 74 68 20 63 6f 6d 70 + 69 6c 61 74 69 6f 6e 20 6d 6f 64 65 6c 20 68 61 + 72 64 63 6f 64 65 73 0a + + ~ "~ references at the time compilation happens, and Evocation" + ~ " makes the choice" + 7e 20 72 65 66 65 72 65 6e 63 65 73 20 61 74 20 + 74 68 65 20 74 69 6d 65 20 63 6f 6d 70 69 6c 61 + 74 69 6f 6e 20 68 61 70 70 65 6e 73 2c 20 61 6e + 64 20 45 76 6f 63 61 74 69 6f 6e 20 6d 61 6b 65 + 73 20 74 68 65 20 63 68 6f 69 63 65 0a + + ~ "~ to not decide the address of the log until runtime. Thus" + ~ " the label transform" + 7e 20 74 6f 20 6e 6f 74 20 64 65 63 69 64 65 20 + 74 68 65 20 61 64 64 72 65 73 73 20 6f 66 20 74 + 68 65 20 6c 6f 67 20 75 6e 74 69 6c 20 72 75 6e + 74 69 6d 65 2e 20 54 68 75 73 20 74 68 65 20 6c + 61 62 65 6c 20 74 72 61 6e 73 66 6f 72 6d 0a + + ~ "~ can't be sufficient on its own. Other Forths avoid this" + ~ " problem by" + 7e 20 63 61 6e 27 74 20 62 65 20 73 75 66 66 69 + 63 69 65 6e 74 20 6f 6e 20 69 74 73 20 6f 77 6e + 2e 20 4f 74 68 65 72 20 46 6f 72 74 68 73 20 61 + 76 6f 69 64 20 74 68 69 73 20 70 72 6f 62 6c 65 + 6d 20 62 79 0a + + ~ "~ hardcoding an address for the log, or by using" + ~ " OS-provided load-time" + 7e 20 68 61 72 64 63 6f 64 69 6e 67 20 61 6e 20 + 61 64 64 72 65 73 73 20 66 6f 72 20 74 68 65 20 + 6c 6f 67 2c 20 6f 72 20 62 79 20 75 73 69 6e 67 + 20 4f 53 2d 70 72 6f 76 69 64 65 64 20 6c 6f 61 + 64 2d 74 69 6d 65 0a + + ~ "~ symbol relocation. Evocation, however, does it on hard" + ~ " mode, mostly for fun." + 7e 20 73 79 6d 62 6f 6c 20 72 65 6c 6f 63 61 74 + 69 6f 6e 2e 20 45 76 6f 63 61 74 69 6f 6e 2c 20 + 68 6f 77 65 76 65 72 2c 20 64 6f 65 73 20 69 74 + 20 6f 6e 20 68 61 72 64 20 6d 6f 64 65 2c 20 6d + 6f 73 74 6c 79 20 66 6f 72 20 66 75 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Because it was clear from early on that the label" + ~ " transform couldn't stand" + 7e 20 20 20 42 65 63 61 75 73 65 20 69 74 20 77 + 61 73 20 63 6c 65 61 72 20 66 72 6f 6d 20 65 61 + 72 6c 79 20 6f 6e 20 74 68 61 74 20 74 68 65 20 + 6c 61 62 65 6c 20 74 72 61 6e 73 66 6f 72 6d 20 + 63 6f 75 6c 64 6e 27 74 20 73 74 61 6e 64 0a + + ~ "~ alone, and that another one would be necessary, we've" + ~ " refrained from adding" + 7e 20 61 6c 6f 6e 65 2c 20 61 6e 64 20 74 68 61 + 74 20 61 6e 6f 74 68 65 72 20 6f 6e 65 20 77 6f + 75 6c 64 20 62 65 20 6e 65 63 65 73 73 61 72 79 + 2c 20 77 65 27 76 65 20 72 65 66 72 61 69 6e 65 + 64 20 66 72 6f 6d 20 61 64 64 69 6e 67 0a + + ~ "~ too many features to it. Since we have multiple" + ~ " transforms, they should each" + 7e 20 74 6f 6f 20 6d 61 6e 79 20 66 65 61 74 75 + 72 65 73 20 74 6f 20 69 74 2e 20 53 69 6e 63 65 + 20 77 65 20 68 61 76 65 20 6d 75 6c 74 69 70 6c + 65 20 74 72 61 6e 73 66 6f 72 6d 73 2c 20 74 68 + 65 79 20 73 68 6f 75 6c 64 20 65 61 63 68 0a + + ~ "~ be kept simple and well-defined, so that they can be" + ~ " composed in creative" + 7e 20 62 65 20 6b 65 70 74 20 73 69 6d 70 6c 65 + 20 61 6e 64 20 77 65 6c 6c 2d 64 65 66 69 6e 65 + 64 2c 20 73 6f 20 74 68 61 74 20 74 68 65 79 20 + 63 61 6e 20 62 65 20 63 6f 6d 70 6f 73 65 64 20 + 69 6e 20 63 72 65 61 74 69 76 65 0a + + ~ "~ new ways down the line. When adding additional behavior," + ~ " always give thought" + 7e 20 6e 65 77 20 77 61 79 73 20 64 6f 77 6e 20 + 74 68 65 20 6c 69 6e 65 2e 20 57 68 65 6e 20 61 + 64 64 69 6e 67 20 61 64 64 69 74 69 6f 6e 61 6c + 20 62 65 68 61 76 69 6f 72 2c 20 61 6c 77 61 79 + 73 20 67 69 76 65 20 74 68 6f 75 67 68 74 0a + + ~ "~ to whether it belongs in an existing transform or a new" + ~ " one." + 7e 20 74 6f 20 77 68 65 74 68 65 72 20 69 74 20 + 62 65 6c 6f 6e 67 73 20 69 6e 20 61 6e 20 65 78 + 69 73 74 69 6e 67 20 74 72 61 6e 73 66 6f 72 6d + 20 6f 72 20 61 20 6e 65 77 20 6f 6e 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~" + 7e 0a + + ~ "~ About the label transform" + 7e 20 41 62 6f 75 74 20 74 68 65 20 6c 61 62 65 + 6c 20 74 72 61 6e 73 66 6f 72 6d 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 0a + + ~ "~" + 7e 0a + + ~ "~ The label transform operates on code that compiles" + ~ " itself, and ensures" + 7e 20 20 20 54 68 65 20 6c 61 62 65 6c 20 74 72 + 61 6e 73 66 6f 72 6d 20 6f 70 65 72 61 74 65 73 + 20 6f 6e 20 63 6f 64 65 20 74 68 61 74 20 63 6f + 6d 70 69 6c 65 73 20 69 74 73 65 6c 66 2c 20 61 + 6e 64 20 65 6e 73 75 72 65 73 0a + + ~ "~ that the result of the compilation is suitable to be" + ~ " included in an" + 7e 20 74 68 61 74 20 74 68 65 20 72 65 73 75 6c + 74 20 6f 66 20 74 68 65 20 63 6f 6d 70 69 6c 61 + 74 69 6f 6e 20 69 73 20 73 75 69 74 61 62 6c 65 + 20 74 6f 20 62 65 20 69 6e 63 6c 75 64 65 64 20 + 69 6e 20 61 6e 0a + + ~ "~ executable binary as words that are statically referenced" + ~ " by their" + 7e 20 65 78 65 63 75 74 61 62 6c 65 20 62 69 6e + 61 72 79 20 61 73 20 77 6f 72 64 73 20 74 68 61 + 74 20 61 72 65 20 73 74 61 74 69 63 61 6c 6c 79 + 20 72 65 66 65 72 65 6e 63 65 64 20 62 79 20 74 + 68 65 69 72 0a + + ~ "~ addresses. To achieve this, it causes each newly-defined" + ~ " word to have a" + 7e 20 61 64 64 72 65 73 73 65 73 2e 20 54 6f 20 + 61 63 68 69 65 76 65 20 74 68 69 73 2c 20 69 74 + 20 63 61 75 73 65 73 20 65 61 63 68 20 6e 65 77 + 6c 79 2d 64 65 66 69 6e 65 64 20 77 6f 72 64 20 + 74 6f 20 68 61 76 65 20 61 0a + + ~ "~ corresponding label whose value is the offset of its" + ~ " codeword, and it causes" + 7e 20 63 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 + 6c 61 62 65 6c 20 77 68 6f 73 65 20 76 61 6c 75 + 65 20 69 73 20 74 68 65 20 6f 66 66 73 65 74 20 + 6f 66 20 69 74 73 20 63 6f 64 65 77 6f 72 64 2c + 20 61 6e 64 20 69 74 20 63 61 75 73 65 73 0a + + ~ "~ all compiled invocations of other words to be resolved by" + ~ " using these labels." + 7e 20 61 6c 6c 20 63 6f 6d 70 69 6c 65 64 20 69 + 6e 76 6f 63 61 74 69 6f 6e 73 20 6f 66 20 6f 74 + 68 65 72 20 77 6f 72 64 73 20 74 6f 20 62 65 20 + 72 65 73 6f 6c 76 65 64 20 62 79 20 75 73 69 6e + 67 20 74 68 65 73 65 20 6c 61 62 65 6c 73 2e 0a + + ~ "~ The label transform is suitable for code that must be" + ~ " directly invoked by" + 7e 20 54 68 65 20 6c 61 62 65 6c 20 74 72 61 6e + 73 66 6f 72 6d 20 69 73 20 73 75 69 74 61 62 6c + 65 20 66 6f 72 20 63 6f 64 65 20 74 68 61 74 20 + 6d 75 73 74 20 62 65 20 64 69 72 65 63 74 6c 79 + 20 69 6e 76 6f 6b 65 64 20 62 79 0a + + ~ "~ the warm-start routine provided by" + ~ " compilation/execution.e." + 7e 20 74 68 65 20 77 61 72 6d 2d 73 74 61 72 74 + 20 72 6f 75 74 69 6e 65 20 70 72 6f 76 69 64 65 + 64 20 62 79 20 63 6f 6d 70 69 6c 61 74 69 6f 6e + 2f 65 78 65 63 75 74 69 6f 6e 2e 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The most fundamental technique the label transform" + ~ " performs is to separate" + 7e 20 20 20 54 68 65 20 6d 6f 73 74 20 66 75 6e + 64 61 6d 65 6e 74 61 6c 20 74 65 63 68 6e 69 71 + 75 65 20 74 68 65 20 6c 61 62 65 6c 20 74 72 61 + 6e 73 66 6f 72 6d 20 70 65 72 66 6f 72 6d 73 20 + 69 73 20 74 6f 20 73 65 70 61 72 61 74 65 0a + + ~ "~ words that run in compile mode from words that run" + ~ " immediately. There is no" + 7e 20 77 6f 72 64 73 20 74 68 61 74 20 72 75 6e + 20 69 6e 20 63 6f 6d 70 69 6c 65 20 6d 6f 64 65 + 20 66 72 6f 6d 20 77 6f 72 64 73 20 74 68 61 74 + 20 72 75 6e 20 69 6d 6d 65 64 69 61 74 65 6c 79 + 2e 20 20 54 68 65 72 65 20 69 73 20 6e 6f 0a + + ~ "~ distinction made between words running in immediate mode," + ~ " and words declared" + 7e 20 64 69 73 74 69 6e 63 74 69 6f 6e 20 6d 61 + 64 65 20 62 65 74 77 65 65 6e 20 77 6f 72 64 73 + 20 72 75 6e 6e 69 6e 67 20 69 6e 20 69 6d 6d 65 + 64 69 61 74 65 20 6d 6f 64 65 2c 20 61 6e 64 20 + 77 6f 72 64 73 20 64 65 63 6c 61 72 65 64 0a + + ~ "~ as immediate. Immediate words are looked up and executed" + ~ " based on their" + 7e 20 61 73 20 69 6d 6d 65 64 69 61 74 65 2e 20 + 49 6d 6d 65 64 69 61 74 65 20 77 6f 72 64 73 20 + 61 72 65 20 6c 6f 6f 6b 65 64 20 75 70 20 61 6e + 64 20 65 78 65 63 75 74 65 64 20 62 61 73 65 64 + 20 6f 6e 20 74 68 65 69 72 0a + + ~ "~ "real", currently-executing definitions. Compiled words," + ~ " including" + 7e 20 22 72 65 61 6c 22 2c 20 63 75 72 72 65 6e + 74 6c 79 2d 65 78 65 63 75 74 69 6e 67 20 64 65 + 66 69 6e 69 74 69 6f 6e 73 2e 20 43 6f 6d 70 69 + 6c 65 64 20 77 6f 72 64 73 2c 20 69 6e 63 6c 75 + 64 69 6e 67 0a + + ~ "~ literals, are looked up via the label facility." + 7e 20 6c 69 74 65 72 61 6c 73 2c 20 61 72 65 20 + 6c 6f 6f 6b 65 64 20 75 70 20 76 69 61 20 74 68 + 65 20 6c 61 62 65 6c 20 66 61 63 69 6c 69 74 79 + 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Since the label facility is able to resolve forward" + ~ " references, there is" + 7e 20 20 20 53 69 6e 63 65 20 74 68 65 20 6c 61 + 62 65 6c 20 66 61 63 69 6c 69 74 79 20 69 73 20 + 61 62 6c 65 20 74 6f 20 72 65 73 6f 6c 76 65 20 + 66 6f 72 77 61 72 64 20 72 65 66 65 72 65 6e 63 + 65 73 2c 20 74 68 65 72 65 20 69 73 0a + + ~ "~ no hard requirement that everything in the file be" + ~ " topologically sorted." + 7e 20 6e 6f 20 68 61 72 64 20 72 65 71 75 69 72 + 65 6d 65 6e 74 20 74 68 61 74 20 65 76 65 72 79 + 74 68 69 6e 67 20 69 6e 20 74 68 65 20 66 69 6c + 65 20 62 65 20 74 6f 70 6f 6c 6f 67 69 63 61 6c + 6c 79 20 73 6f 72 74 65 64 2e 0a + + ~ "~ However, the transform will refuse to create forward" + ~ " references to compiled" + 7e 20 48 6f 77 65 76 65 72 2c 20 74 68 65 20 74 + 72 61 6e 73 66 6f 72 6d 20 77 69 6c 6c 20 72 65 + 66 75 73 65 20 74 6f 20 63 72 65 61 74 65 20 66 + 6f 72 77 61 72 64 20 72 65 66 65 72 65 6e 63 65 + 73 20 74 6f 20 63 6f 6d 70 69 6c 65 64 0a + + ~ "~ words. If you want them, you can create them by hand by" + ~ " calling use-label" + 7e 20 77 6f 72 64 73 2e 20 49 66 20 79 6f 75 20 + 77 61 6e 74 20 74 68 65 6d 2c 20 79 6f 75 20 63 + 61 6e 20 63 72 65 61 74 65 20 74 68 65 6d 20 62 + 79 20 68 61 6e 64 20 62 79 20 63 61 6c 6c 69 6e + 67 20 75 73 65 2d 6c 61 62 65 6c 0a + + ~ "~ yourself. This restriction is in place because allowing" + ~ " forward references" + 7e 20 79 6f 75 72 73 65 6c 66 2e 20 54 68 69 73 + 20 72 65 73 74 72 69 63 74 69 6f 6e 20 69 73 20 + 69 6e 20 70 6c 61 63 65 20 62 65 63 61 75 73 65 + 20 61 6c 6c 6f 77 69 6e 67 20 66 6f 72 77 61 72 + 64 20 72 65 66 65 72 65 6e 63 65 73 0a + + ~ "~ would be a significant difference from un-transformed" + ~ " code that could easily" + 7e 20 77 6f 75 6c 64 20 62 65 20 61 20 73 69 67 + 6e 69 66 69 63 61 6e 74 20 64 69 66 66 65 72 65 + 6e 63 65 20 66 72 6f 6d 20 75 6e 2d 74 72 61 6e + 73 66 6f 72 6d 65 64 20 63 6f 64 65 20 74 68 61 + 74 20 63 6f 75 6c 64 20 65 61 73 69 6c 79 0a + + ~ "~ become confusing, and because it simplifies the" + ~ " implementation a bit." + 7e 20 62 65 63 6f 6d 65 20 63 6f 6e 66 75 73 69 + 6e 67 2c 20 61 6e 64 20 62 65 63 61 75 73 65 20 + 69 74 20 73 69 6d 70 6c 69 66 69 65 73 20 74 68 + 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e + 20 61 20 62 69 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Compilation words do make extensive reference to the" + ~ " global variables" + 7e 20 20 20 43 6f 6d 70 69 6c 61 74 69 6f 6e 20 + 77 6f 72 64 73 20 64 6f 20 6d 61 6b 65 20 65 78 + 74 65 6e 73 69 76 65 20 72 65 66 65 72 65 6e 63 + 65 20 74 6f 20 74 68 65 20 67 6c 6f 62 61 6c 20 + 76 61 72 69 61 62 6c 65 73 0a + + ~ "~ "here" and "latest". In particular, flow-control words" + ~ " such as if-else" + 7e 20 22 68 65 72 65 22 20 61 6e 64 20 22 6c 61 + 74 65 73 74 22 2e 20 49 6e 20 70 61 72 74 69 63 + 75 6c 61 72 2c 20 66 6c 6f 77 2d 63 6f 6e 74 72 + 6f 6c 20 77 6f 72 64 73 20 73 75 63 68 20 61 73 + 20 69 66 2d 65 6c 73 65 0a + + ~ "~ expect the log to have recent compilation outputs on it," + ~ " and to be able to" + 7e 20 65 78 70 65 63 74 20 74 68 65 20 6c 6f 67 + 20 74 6f 20 68 61 76 65 20 72 65 63 65 6e 74 20 + 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 6f 75 74 70 + 75 74 73 20 6f 6e 20 69 74 2c 20 61 6e 64 20 74 + 6f 20 62 65 20 61 62 6c 65 20 74 6f 0a + + ~ "~ mutate them in-place. In order to make this work, we" + ~ " provide temporary" + 7e 20 6d 75 74 61 74 65 20 74 68 65 6d 20 69 6e + 2d 70 6c 61 63 65 2e 20 49 6e 20 6f 72 64 65 72 + 20 74 6f 20 6d 61 6b 65 20 74 68 69 73 20 77 6f + 72 6b 2c 20 77 65 20 70 72 6f 76 69 64 65 20 74 + 65 6d 70 6f 72 61 72 79 0a + + ~ "~ values of these two variables which point to the location" + ~ " of the output" + 7e 20 76 61 6c 75 65 73 20 6f 66 20 74 68 65 73 + 65 20 74 77 6f 20 76 61 72 69 61 62 6c 65 73 20 + 77 68 69 63 68 20 70 6f 69 6e 74 20 74 6f 20 74 + 68 65 20 6c 6f 63 61 74 69 6f 6e 20 6f 66 20 74 + 68 65 20 6f 75 74 70 75 74 0a + + ~ "~ buffer. This allows pointer resolution to work correctly" + ~ " without additional" + 7e 20 62 75 66 66 65 72 2e 20 54 68 69 73 20 61 + 6c 6c 6f 77 73 20 70 6f 69 6e 74 65 72 20 72 65 + 73 6f 6c 75 74 69 6f 6e 20 74 6f 20 77 6f 72 6b + 20 63 6f 72 72 65 63 74 6c 79 20 77 69 74 68 6f + 75 74 20 61 64 64 69 74 69 6f 6e 61 6c 0a + + ~ "~ effort, but notice that the buffer's address will differ" + ~ " from the address" + 7e 20 65 66 66 6f 72 74 2c 20 62 75 74 20 6e 6f + 74 69 63 65 20 74 68 61 74 20 74 68 65 20 62 75 + 66 66 65 72 27 73 20 61 64 64 72 65 73 73 20 77 + 69 6c 6c 20 64 69 66 66 65 72 20 66 72 6f 6d 20 + 74 68 65 20 61 64 64 72 65 73 73 0a + + ~ "~ the resulting program loads itself at. There's no simple" + ~ " way to avoid this" + 7e 20 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 + 70 72 6f 67 72 61 6d 20 6c 6f 61 64 73 20 69 74 + 73 65 6c 66 20 61 74 2e 20 54 68 65 72 65 27 73 + 20 6e 6f 20 73 69 6d 70 6c 65 20 77 61 79 20 74 + 6f 20 61 76 6f 69 64 20 74 68 69 73 0a + + ~ "~ concern, since the variables must point to one of those" + ~ " addresses or the" + 7e 20 63 6f 6e 63 65 72 6e 2c 20 73 69 6e 63 65 + 20 74 68 65 20 76 61 72 69 61 62 6c 65 73 20 6d + 75 73 74 20 70 6f 69 6e 74 20 74 6f 20 6f 6e 65 + 20 6f 66 20 74 68 6f 73 65 20 61 64 64 72 65 73 + 73 65 73 20 6f 72 20 74 68 65 0a + + ~ "~ other, not both." + 7e 20 6f 74 68 65 72 2c 20 6e 6f 74 20 62 6f 74 + 68 2e 0a + + ~ "~" + 7e 0a + + ~ "~ We resolve the issue by running our own, alternate" + ~ " versions of most of the" + 7e 20 20 20 57 65 20 72 65 73 6f 6c 76 65 20 74 + 68 65 20 69 73 73 75 65 20 62 79 20 72 75 6e 6e + 69 6e 67 20 6f 75 72 20 6f 77 6e 2c 20 61 6c 74 + 65 72 6e 61 74 65 20 76 65 72 73 69 6f 6e 73 20 + 6f 66 20 6d 6f 73 74 20 6f 66 20 74 68 65 0a + + ~ "~ critical word-defining words, including for example" + ~ " "create", ":", and ";"." + 7e 20 63 72 69 74 69 63 61 6c 20 77 6f 72 64 2d + 64 65 66 69 6e 69 6e 67 20 77 6f 72 64 73 2c 20 + 69 6e 63 6c 75 64 69 6e 67 20 66 6f 72 20 65 78 + 61 6d 70 6c 65 20 22 63 72 65 61 74 65 22 2c 20 + 22 3a 22 2c 20 61 6e 64 20 22 3b 22 2e 0a + + ~ "~ These alternates run instead of the normal versions of" + ~ " these words, and use" + 7e 20 54 68 65 73 65 20 61 6c 74 65 72 6e 61 74 + 65 73 20 72 75 6e 20 69 6e 73 74 65 61 64 20 6f + 66 20 74 68 65 20 6e 6f 72 6d 61 6c 20 76 65 72 + 73 69 6f 6e 73 20 6f 66 20 74 68 65 73 65 20 77 + 6f 72 64 73 2c 20 61 6e 64 20 75 73 65 0a + + ~ "~ the label facility to compute the addresses that will be" + ~ " needed at runtime." + 7e 20 74 68 65 20 6c 61 62 65 6c 20 66 61 63 69 + 6c 69 74 79 20 74 6f 20 63 6f 6d 70 75 74 65 20 + 74 68 65 20 61 64 64 72 65 73 73 65 73 20 74 68 + 61 74 20 77 69 6c 6c 20 62 65 20 6e 65 65 64 65 + 64 20 61 74 20 72 75 6e 74 69 6d 65 2e 0a + + ~ "~ The code being compiled is responsible for not doing" + ~ " anything else that" + 7e 20 54 68 65 20 63 6f 64 65 20 62 65 69 6e 67 + 20 63 6f 6d 70 69 6c 65 64 20 69 73 20 72 65 73 + 70 6f 6e 73 69 62 6c 65 20 66 6f 72 20 6e 6f 74 + 20 64 6f 69 6e 67 20 61 6e 79 74 68 69 6e 67 20 + 65 6c 73 65 20 74 68 61 74 0a + + ~ "~ would rely on "here" and "latest" matching their runtime" + ~ " addresses, though" + 7e 20 77 6f 75 6c 64 20 72 65 6c 79 20 6f 6e 20 + 22 68 65 72 65 22 20 61 6e 64 20 22 6c 61 74 65 + 73 74 22 20 6d 61 74 63 68 69 6e 67 20 74 68 65 + 69 72 20 72 75 6e 74 69 6d 65 20 61 64 64 72 65 + 73 73 65 73 2c 20 74 68 6f 75 67 68 0a + + ~ "~ it is otherwise allowed to modify and rely on them in all" + ~ " the usual ways." + 7e 20 69 74 20 69 73 20 6f 74 68 65 72 77 69 73 + 65 20 61 6c 6c 6f 77 65 64 20 74 6f 20 6d 6f 64 + 69 66 79 20 61 6e 64 20 72 65 6c 79 20 6f 6e 20 + 74 68 65 6d 20 69 6e 20 61 6c 6c 20 74 68 65 20 + 75 73 75 61 6c 20 77 61 79 73 2e 0a + + ~ "~ The alternate versions are defined in this file as their" + ~ " own words," + 7e 20 54 68 65 20 61 6c 74 65 72 6e 61 74 65 20 + 76 65 72 73 69 6f 6e 73 20 61 72 65 20 64 65 66 + 69 6e 65 64 20 69 6e 20 74 68 69 73 20 66 69 6c + 65 20 61 73 20 74 68 65 69 72 20 6f 77 6e 20 77 + 6f 72 64 73 2c 0a + + ~ "~ "label-create-alternate" and so on." + 7e 20 22 6c 61 62 65 6c 2d 63 72 65 61 74 65 2d + 61 6c 74 65 72 6e 61 74 65 22 20 61 6e 64 20 73 + 6f 20 6f 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Note that these alternates are applied via a purely" + ~ " lexical" + 7e 20 20 20 4e 6f 74 65 20 74 68 61 74 20 74 68 + 65 73 65 20 61 6c 74 65 72 6e 61 74 65 73 20 61 + 72 65 20 61 70 70 6c 69 65 64 20 76 69 61 20 61 + 20 70 75 72 65 6c 79 20 6c 65 78 69 63 61 6c 0a + + ~ "~ transformation: when a word would be looked up in the" + ~ " dictionary to" + 7e 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 3a 20 77 68 65 6e 20 61 20 77 6f 72 64 20 77 6f + 75 6c 64 20 62 65 20 6c 6f 6f 6b 65 64 20 75 70 + 20 69 6e 20 74 68 65 20 64 69 63 74 69 6f 6e 61 + 72 79 20 74 6f 0a + + ~ "~ interpret, first check if it's one of these. That means" + ~ " the transformation" + 7e 20 69 6e 74 65 72 70 72 65 74 2c 20 66 69 72 + 73 74 20 63 68 65 63 6b 20 69 66 20 69 74 27 73 + 20 6f 6e 65 20 6f 66 20 74 68 65 73 65 2e 20 54 + 68 61 74 20 6d 65 61 6e 73 20 74 68 65 20 74 72 + 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 0a + + ~ "~ won't apply to indirect callers of these words, nor to" + ~ " tick-quotes of them." + 7e 20 77 6f 6e 27 74 20 61 70 70 6c 79 20 74 6f + 20 69 6e 64 69 72 65 63 74 20 63 61 6c 6c 65 72 + 73 20 6f 66 20 74 68 65 73 65 20 77 6f 72 64 73 + 2c 20 6e 6f 72 20 74 6f 20 74 69 63 6b 2d 71 75 + 6f 74 65 73 20 6f 66 20 74 68 65 6d 2e 0a + + ~ "~ The code being compiled is responsible for not doing" + ~ " either of those things." + 7e 20 54 68 65 20 63 6f 64 65 20 62 65 69 6e 67 + 20 63 6f 6d 70 69 6c 65 64 20 69 73 20 72 65 73 + 70 6f 6e 73 69 62 6c 65 20 66 6f 72 20 6e 6f 74 + 20 64 6f 69 6e 67 20 65 69 74 68 65 72 20 6f 66 + 20 74 68 6f 73 65 20 74 68 69 6e 67 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Notably, the transformation uses the same" + ~ " "interpreter-flags" variable as" + 7e 20 20 20 4e 6f 74 61 62 6c 79 2c 20 74 68 65 + 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 20 + 75 73 65 73 20 74 68 65 20 73 61 6d 65 20 22 69 + 6e 74 65 72 70 72 65 74 65 72 2d 66 6c 61 67 73 + 22 20 76 61 72 69 61 62 6c 65 20 61 73 0a + + ~ "~ the rest of Evocation. There's no need to keep it" + ~ " separate like there is" + 7e 20 74 68 65 20 72 65 73 74 20 6f 66 20 45 76 + 6f 63 61 74 69 6f 6e 2e 20 54 68 65 72 65 27 73 + 20 6e 6f 20 6e 65 65 64 20 74 6f 20 6b 65 65 70 + 20 69 74 20 73 65 70 61 72 61 74 65 20 6c 69 6b + 65 20 74 68 65 72 65 20 69 73 0a + + ~ "~ with the other variables. This makes it easy to change" + ~ " modes." + 7e 20 77 69 74 68 20 74 68 65 20 6f 74 68 65 72 + 20 76 61 72 69 61 62 6c 65 73 2e 20 54 68 69 73 + 20 6d 61 6b 65 73 20 69 74 20 65 61 73 79 20 74 + 6f 20 63 68 61 6e 67 65 20 6d 6f 64 65 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The label transformation and its alternates rely on" + ~ " various labels, all of" + 7e 20 20 20 54 68 65 20 6c 61 62 65 6c 20 74 72 + 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 20 61 6e 64 + 20 69 74 73 20 61 6c 74 65 72 6e 61 74 65 73 20 + 72 65 6c 79 20 6f 6e 20 76 61 72 69 6f 75 73 20 + 6c 61 62 65 6c 73 2c 20 61 6c 6c 20 6f 66 0a + + ~ "~ which must be defined elsewhere, lest the label loop fail" + ~ " to converge:" + 7e 20 77 68 69 63 68 20 6d 75 73 74 20 62 65 20 + 64 65 66 69 6e 65 64 20 65 6c 73 65 77 68 65 72 + 65 2c 20 6c 65 73 74 20 74 68 65 20 6c 61 62 65 + 6c 20 6c 6f 6f 70 20 66 61 69 6c 20 74 6f 20 63 + 6f 6e 76 65 72 67 65 3a 0a + + ~ "~ "lit", "origin", "docol", "exit", ":", ";", and ";asm"." + 7e 20 22 6c 69 74 22 2c 20 22 6f 72 69 67 69 6e + 22 2c 20 22 64 6f 63 6f 6c 22 2c 20 22 65 78 69 + 74 22 2c 20 22 3a 22 2c 20 22 3b 22 2c 20 61 6e + 64 20 22 3b 61 73 6d 22 2e 0a + + ~ "~" + 7e 0a + + ~ "~ All of these limitations result in the compiled code" + ~ " being, in effect," + 7e 20 20 20 41 6c 6c 20 6f 66 20 74 68 65 73 65 + 20 6c 69 6d 69 74 61 74 69 6f 6e 73 20 72 65 73 + 75 6c 74 20 69 6e 20 74 68 65 20 63 6f 6d 70 69 + 6c 65 64 20 63 6f 64 65 20 62 65 69 6e 67 2c 20 + 69 6e 20 65 66 66 65 63 74 2c 0a + + ~ "~ written in a dialect which is like Evocation, but more" + ~ " restricted. This is" + 7e 20 77 72 69 74 74 65 6e 20 69 6e 20 61 20 64 + 69 61 6c 65 63 74 20 77 68 69 63 68 20 69 73 20 + 6c 69 6b 65 20 45 76 6f 63 61 74 69 6f 6e 2c 20 + 62 75 74 20 6d 6f 72 65 20 72 65 73 74 72 69 63 + 74 65 64 2e 20 54 68 69 73 20 69 73 0a + + ~ "~ acceptable, because the label transform is intended for" + ~ " compiling code that" + 7e 20 61 63 63 65 70 74 61 62 6c 65 2c 20 62 65 + 63 61 75 73 65 20 74 68 65 20 6c 61 62 65 6c 20 + 74 72 61 6e 73 66 6f 72 6d 20 69 73 20 69 6e 74 + 65 6e 64 65 64 20 66 6f 72 20 63 6f 6d 70 69 6c + 69 6e 67 20 63 6f 64 65 20 74 68 61 74 0a + + ~ "~ is an early part of Evocation itself, and the necessary" + ~ " code has all been" + 7e 20 69 73 20 61 6e 20 65 61 72 6c 79 20 70 61 + 72 74 20 6f 66 20 45 76 6f 63 61 74 69 6f 6e 20 + 69 74 73 65 6c 66 2c 20 61 6e 64 20 74 68 65 20 + 6e 65 63 65 73 73 61 72 79 20 63 6f 64 65 20 68 + 61 73 20 61 6c 6c 20 62 65 65 6e 0a + + ~ "~ written to follow these restrictions." + 7e 20 77 72 69 74 74 65 6e 20 74 6f 20 66 6f 6c + 6c 6f 77 20 74 68 65 73 65 20 72 65 73 74 72 69 + 63 74 69 6f 6e 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~" + 7e 0a + + ~ "~ About the log-load transform" + 7e 20 41 62 6f 75 74 20 74 68 65 20 6c 6f 67 2d + 6c 6f 61 64 20 74 72 61 6e 73 66 6f 72 6d 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 0a + + ~ "~" + 7e 0a + + ~ "~ The log-load transform also operates on code that" + ~ " compiles itself; it" + 7e 20 20 20 54 68 65 20 6c 6f 67 2d 6c 6f 61 64 + 20 74 72 61 6e 73 66 6f 72 6d 20 61 6c 73 6f 20 + 6f 70 65 72 61 74 65 73 20 6f 6e 20 63 6f 64 65 + 20 74 68 61 74 20 63 6f 6d 70 69 6c 65 73 20 69 + 74 73 65 6c 66 3b 20 69 74 0a + + ~ "~ produces a compiled routine which, when run, appends the" + ~ " original code to" + 7e 20 70 72 6f 64 75 63 65 73 20 61 20 63 6f 6d + 70 69 6c 65 64 20 72 6f 75 74 69 6e 65 20 77 68 + 69 63 68 2c 20 77 68 65 6e 20 72 75 6e 2c 20 61 + 70 70 65 6e 64 73 20 74 68 65 20 6f 72 69 67 69 + 6e 61 6c 20 63 6f 64 65 20 74 6f 0a + + ~ "~ the log. As the routine is run, each reference to another" + ~ " word is resolved" + 7e 20 74 68 65 20 6c 6f 67 2e 20 41 73 20 74 68 + 65 20 72 6f 75 74 69 6e 65 20 69 73 20 72 75 6e + 2c 20 65 61 63 68 20 72 65 66 65 72 65 6e 63 65 + 20 74 6f 20 61 6e 6f 74 68 65 72 20 77 6f 72 64 + 20 69 73 20 72 65 73 6f 6c 76 65 64 0a + + ~ "~ by looking up the name of the target word in the log." + ~ " Furthermore, these" + 7e 20 62 79 20 6c 6f 6f 6b 69 6e 67 20 75 70 20 + 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 20 + 74 61 72 67 65 74 20 77 6f 72 64 20 69 6e 20 74 + 68 65 20 6c 6f 67 2e 20 46 75 72 74 68 65 72 6d + 6f 72 65 2c 20 74 68 65 73 65 0a + + ~ "~ lookups are done using log-load-find, defined in" + ~ " language/static/log-load.e," + 7e 20 6c 6f 6f 6b 75 70 73 20 61 72 65 20 64 6f + 6e 65 20 75 73 69 6e 67 20 6c 6f 67 2d 6c 6f 61 + 64 2d 66 69 6e 64 2c 20 64 65 66 69 6e 65 64 20 + 69 6e 20 6c 61 6e 67 75 61 67 65 2f 73 74 61 74 + 69 63 2f 6c 6f 67 2d 6c 6f 61 64 2e 65 2c 0a + + ~ "~ which accepts a pointer to the log's base address as a" + ~ " parameter. See that" + 7e 20 77 68 69 63 68 20 61 63 63 65 70 74 73 20 + 61 20 70 6f 69 6e 74 65 72 20 74 6f 20 74 68 65 + 20 6c 6f 67 27 73 20 62 61 73 65 20 61 64 64 72 + 65 73 73 20 61 73 20 61 20 70 61 72 61 6d 65 74 + 65 72 2e 20 53 65 65 20 74 68 61 74 0a + + ~ "~ file for more explanation of what the log is and why it's" + ~ " important. Thus," + 7e 20 66 69 6c 65 20 66 6f 72 20 6d 6f 72 65 20 + 65 78 70 6c 61 6e 61 74 69 6f 6e 20 6f 66 20 77 + 68 61 74 20 74 68 65 20 6c 6f 67 20 69 73 20 61 + 6e 64 20 77 68 79 20 69 74 27 73 20 69 6d 70 6f + 72 74 61 6e 74 2e 20 54 68 75 73 2c 0a + + ~ "~ unlike normal accesses to the log, this routine doesn't" + ~ " rely on already" + 7e 20 75 6e 6c 69 6b 65 20 6e 6f 72 6d 61 6c 20 + 61 63 63 65 73 73 65 73 20 74 6f 20 74 68 65 20 + 6c 6f 67 2c 20 74 68 69 73 20 72 6f 75 74 69 6e + 65 20 64 6f 65 73 6e 27 74 20 72 65 6c 79 20 6f + 6e 20 61 6c 72 65 61 64 79 0a + + ~ "~ having the log's base address hardcoded into it at the" + ~ " time of its own" + 7e 20 68 61 76 69 6e 67 20 74 68 65 20 6c 6f 67 + 27 73 20 62 61 73 65 20 61 64 64 72 65 73 73 20 + 68 61 72 64 63 6f 64 65 64 20 69 6e 74 6f 20 69 + 74 20 61 74 20 74 68 65 20 74 69 6d 65 20 6f 66 + 20 69 74 73 20 6f 77 6e 0a + + ~ "~ compilation. The log-load transform is suitable for" + ~ " implementing the core" + 7e 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 2e 20 54 + 68 65 20 6c 6f 67 2d 6c 6f 61 64 20 74 72 61 6e + 73 66 6f 72 6d 20 69 73 20 73 75 69 74 61 62 6c + 65 20 66 6f 72 20 69 6d 70 6c 65 6d 65 6e 74 69 + 6e 67 20 74 68 65 20 63 6f 72 65 0a + + ~ "~ responsibilities of the warm-start routine provided by" + 7e 20 72 65 73 70 6f 6e 73 69 62 69 6c 69 74 69 + 65 73 20 6f 66 20 74 68 65 20 77 61 72 6d 2d 73 + 74 61 72 74 20 72 6f 75 74 69 6e 65 20 70 72 6f + 76 69 64 65 64 20 62 79 0a + + ~ "~ compilation/execution.e, relying on only a few specific" + ~ " words that it" + 7e 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 2f 65 78 + 65 63 75 74 69 6f 6e 2e 65 2c 20 72 65 6c 79 69 + 6e 67 20 6f 6e 20 6f 6e 6c 79 20 61 20 66 65 77 + 20 73 70 65 63 69 66 69 63 20 77 6f 72 64 73 20 + 74 68 61 74 20 69 74 0a + + ~ "~ statically references via labels." + 7e 20 73 74 61 74 69 63 61 6c 6c 79 20 72 65 66 + 65 72 65 6e 63 65 73 20 76 69 61 20 6c 61 62 65 + 6c 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Much like the label transform, the log-load transform" + ~ " provides alternate" + 7e 20 20 20 4d 75 63 68 20 6c 69 6b 65 20 74 68 + 65 20 6c 61 62 65 6c 20 74 72 61 6e 73 66 6f 72 + 6d 2c 20 74 68 65 20 6c 6f 67 2d 6c 6f 61 64 20 + 74 72 61 6e 73 66 6f 72 6d 20 70 72 6f 76 69 64 + 65 73 20 61 6c 74 65 72 6e 61 74 65 0a + + ~ "~ versions of certain immediate words used in word" + ~ " definition. Also like the" + 7e 20 76 65 72 73 69 6f 6e 73 20 6f 66 20 63 65 + 72 74 61 69 6e 20 69 6d 6d 65 64 69 61 74 65 20 + 77 6f 72 64 73 20 75 73 65 64 20 69 6e 20 77 6f + 72 64 20 64 65 66 69 6e 69 74 69 6f 6e 2e 20 41 + 6c 73 6f 20 6c 69 6b 65 20 74 68 65 0a + + ~ "~ label transform, it provides its own copies of "here" and" + ~ " "latest"." + 7e 20 6c 61 62 65 6c 20 74 72 61 6e 73 66 6f 72 + 6d 2c 20 69 74 20 70 72 6f 76 69 64 65 73 20 69 + 74 73 20 6f 77 6e 20 63 6f 70 69 65 73 20 6f 66 + 20 22 68 65 72 65 22 20 61 6e 64 20 22 6c 61 74 + 65 73 74 22 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The log-load transform provides alternates for a" + ~ " significantly broader set" + 7e 20 20 20 54 68 65 20 6c 6f 67 2d 6c 6f 61 64 + 20 74 72 61 6e 73 66 6f 72 6d 20 70 72 6f 76 69 + 64 65 73 20 61 6c 74 65 72 6e 61 74 65 73 20 66 + 6f 72 20 61 20 73 69 67 6e 69 66 69 63 61 6e 74 + 6c 79 20 62 72 6f 61 64 65 72 20 73 65 74 0a + + ~ "~ of words than the label transform, including all the" + ~ " flow-control words such" + 7e 20 6f 66 20 77 6f 72 64 73 20 74 68 61 6e 20 + 74 68 65 20 6c 61 62 65 6c 20 74 72 61 6e 73 66 + 6f 72 6d 2c 20 69 6e 63 6c 75 64 69 6e 67 20 61 + 6c 6c 20 74 68 65 20 66 6c 6f 77 2d 63 6f 6e 74 + 72 6f 6c 20 77 6f 72 64 73 20 73 75 63 68 0a + + ~ "~ as if-else. It runs its own alternates immediately, but" + ~ " unlike the label" + 7e 20 61 73 20 69 66 2d 65 6c 73 65 2e 20 49 74 + 20 72 75 6e 73 20 69 74 73 20 6f 77 6e 20 61 6c + 74 65 72 6e 61 74 65 73 20 69 6d 6d 65 64 69 61 + 74 65 6c 79 2c 20 62 75 74 20 75 6e 6c 69 6b 65 + 20 74 68 65 20 6c 61 62 65 6c 0a + + ~ "~ transform, immediate execution for the log-load transform" + ~ " is not actually" + 7e 20 74 72 61 6e 73 66 6f 72 6d 2c 20 69 6d 6d + 65 64 69 61 74 65 20 65 78 65 63 75 74 69 6f 6e + 20 66 6f 72 20 74 68 65 20 6c 6f 67 2d 6c 6f 61 + 64 20 74 72 61 6e 73 66 6f 72 6d 20 69 73 20 6e + 6f 74 20 61 63 74 75 61 6c 6c 79 0a + + ~ "~ immediate; it is compiled into words which will have" + ~ " those immediate effects" + 7e 20 69 6d 6d 65 64 69 61 74 65 3b 20 69 74 20 + 69 73 20 63 6f 6d 70 69 6c 65 64 20 69 6e 74 6f + 20 77 6f 72 64 73 20 77 68 69 63 68 20 77 69 6c + 6c 20 68 61 76 65 20 74 68 6f 73 65 20 69 6d 6d + 65 64 69 61 74 65 20 65 66 66 65 63 74 73 0a + + ~ "~ at the time the generated routine is run. The generated" + ~ " routine can itself" + 7e 20 61 74 20 74 68 65 20 74 69 6d 65 20 74 68 + 65 20 67 65 6e 65 72 61 74 65 64 20 72 6f 75 74 + 69 6e 65 20 69 73 20 72 75 6e 2e 20 54 68 65 20 + 67 65 6e 65 72 61 74 65 64 20 72 6f 75 74 69 6e + 65 20 63 61 6e 20 69 74 73 65 6c 66 0a + + ~ "~ be thought of as a compilation process, producing its" + ~ " output on the log, so" + 7e 20 62 65 20 74 68 6f 75 67 68 74 20 6f 66 20 + 61 73 20 61 20 63 6f 6d 70 69 6c 61 74 69 6f 6e + 20 70 72 6f 63 65 73 73 2c 20 70 72 6f 64 75 63 + 69 6e 67 20 69 74 73 20 6f 75 74 70 75 74 20 6f + 6e 20 74 68 65 20 6c 6f 67 2c 20 73 6f 0a + + ~ "~ doing things later for us still means doing them" + ~ " immediately during the" + 7e 20 64 6f 69 6e 67 20 74 68 69 6e 67 73 20 6c + 61 74 65 72 20 66 6f 72 20 75 73 20 73 74 69 6c + 6c 20 6d 65 61 6e 73 20 64 6f 69 6e 67 20 74 68 + 65 6d 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 64 + 75 72 69 6e 67 20 74 68 65 0a + + ~ "~ routine." + 7e 20 72 6f 75 74 69 6e 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The log-load transform does impose a" + ~ " no-forward-references requirement," + 7e 20 20 20 54 68 65 20 6c 6f 67 2d 6c 6f 61 64 + 20 74 72 61 6e 73 66 6f 72 6d 20 64 6f 65 73 20 + 69 6d 70 6f 73 65 20 61 20 6e 6f 2d 66 6f 72 77 + 61 72 64 2d 72 65 66 65 72 65 6e 63 65 73 20 72 + 65 71 75 69 72 65 6d 65 6e 74 2c 0a + + ~ "~ though it is applied at the time the routine is run," + ~ " rather than at the time" + 7e 20 74 68 6f 75 67 68 20 69 74 20 69 73 20 61 + 70 70 6c 69 65 64 20 61 74 20 74 68 65 20 74 69 + 6d 65 20 74 68 65 20 72 6f 75 74 69 6e 65 20 69 + 73 20 72 75 6e 2c 20 72 61 74 68 65 72 20 74 68 + 61 6e 20 61 74 20 74 68 65 20 74 69 6d 65 0a + + ~ "~ of the transformation." + 7e 20 6f 66 20 74 68 65 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The log-load transformation and its alternates rely on" + ~ " the following" + 7e 20 20 20 54 68 65 20 6c 6f 67 2d 6c 6f 61 64 + 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 20 + 61 6e 64 20 69 74 73 20 61 6c 74 65 72 6e 61 74 + 65 73 20 72 65 6c 79 20 6f 6e 20 74 68 65 20 66 + 6f 6c 6c 6f 77 69 6e 67 0a + + ~ "~ labels, all of which must be defined elsewhere: TODO" + 7e 20 6c 61 62 65 6c 73 2c 20 61 6c 6c 20 6f 66 + 20 77 68 69 63 68 20 6d 75 73 74 20 62 65 20 64 + 65 66 69 6e 65 64 20 65 6c 73 65 77 68 65 72 65 + 3a 20 54 4f 44 4f 0a + + ~ "~" + 7e 0a + + ~ "~" + 7e 0a + + ~ "~ About the hex transform" + 7e 20 41 62 6f 75 74 20 74 68 65 20 68 65 78 20 + 74 72 61 6e 73 66 6f 72 6d 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 0a + + ~ "~" + 7e 0a + + ~ "~ The hex transform's role is a bit different. Whereas" + ~ " the label and" + 7e 20 20 20 54 68 65 20 68 65 78 20 74 72 61 6e + 73 66 6f 72 6d 27 73 20 72 6f 6c 65 20 69 73 20 + 61 20 62 69 74 20 64 69 66 66 65 72 65 6e 74 2e + 20 57 68 65 72 65 61 73 20 74 68 65 20 6c 61 62 + 65 6c 20 61 6e 64 0a + + ~ "~ log-load transforms are used as part of generating an" + ~ " executable binary, the" + 7e 20 6c 6f 67 2d 6c 6f 61 64 20 74 72 61 6e 73 + 66 6f 72 6d 73 20 61 72 65 20 75 73 65 64 20 61 + 73 20 70 61 72 74 20 6f 66 20 67 65 6e 65 72 61 + 74 69 6e 67 20 61 6e 20 65 78 65 63 75 74 61 62 + 6c 65 20 62 69 6e 61 72 79 2c 20 74 68 65 0a + + ~ "~ hex transform produces a commented hex dump that, when" + ~ " later processed by" + 7e 20 68 65 78 20 74 72 61 6e 73 66 6f 72 6d 20 + 70 72 6f 64 75 63 65 73 20 61 20 63 6f 6d 6d 65 + 6e 74 65 64 20 68 65 78 20 64 75 6d 70 20 74 68 + 61 74 2c 20 77 68 65 6e 20 6c 61 74 65 72 20 70 + 72 6f 63 65 73 73 65 64 20 62 79 0a + + ~ "~ the "hex" tool, produces that same binary. It achieves" + ~ " this by modifying" + 7e 20 74 68 65 20 22 68 65 78 22 20 74 6f 6f 6c + 2c 20 70 72 6f 64 75 63 65 73 20 74 68 61 74 20 + 73 61 6d 65 20 62 69 6e 61 72 79 2e 20 49 74 20 + 61 63 68 69 65 76 65 73 20 74 68 69 73 20 62 79 + 20 6d 6f 64 69 66 79 69 6e 67 0a + + ~ "~ various words which are core parts of Evocation to keep" + ~ " track of appropriate" + 7e 20 76 61 72 69 6f 75 73 20 77 6f 72 64 73 20 + 77 68 69 63 68 20 61 72 65 20 63 6f 72 65 20 70 + 61 72 74 73 20 6f 66 20 45 76 6f 63 61 74 69 6f + 6e 20 74 6f 20 6b 65 65 70 20 74 72 61 63 6b 20 + 6f 66 20 61 70 70 72 6f 70 72 69 61 74 65 0a + + ~ "~ comments and other metadata, and modifying the output" + ~ " facility to output a" + 7e 20 63 6f 6d 6d 65 6e 74 73 20 61 6e 64 20 6f + 74 68 65 72 20 6d 65 74 61 64 61 74 61 2c 20 61 + 6e 64 20 6d 6f 64 69 66 79 69 6e 67 20 74 68 65 + 20 6f 75 74 70 75 74 20 66 61 63 69 6c 69 74 79 + 20 74 6f 20 6f 75 74 70 75 74 20 61 0a + + ~ "~ hex dump with any attached comments, rather than raw" + ~ " bytes." + 7e 20 68 65 78 20 64 75 6d 70 20 77 69 74 68 20 + 61 6e 79 20 61 74 74 61 63 68 65 64 20 63 6f 6d + 6d 65 6e 74 73 2c 20 72 61 74 68 65 72 20 74 68 + 61 6e 20 72 61 77 20 62 79 74 65 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ By its nature, the hex transform needs to be able to" + ~ " cope with other" + 7e 20 20 20 42 79 20 69 74 73 20 6e 61 74 75 72 + 65 2c 20 74 68 65 20 68 65 78 20 74 72 61 6e 73 + 66 6f 72 6d 20 6e 65 65 64 73 20 74 6f 20 62 65 + 20 61 62 6c 65 20 74 6f 20 63 6f 70 65 20 77 69 + 74 68 20 6f 74 68 65 72 0a + + ~ "~ transforms running inside itself; that is, the" + ~ " transformation facility needs" + 7e 20 74 72 61 6e 73 66 6f 72 6d 73 20 72 75 6e + 6e 69 6e 67 20 69 6e 73 69 64 65 20 69 74 73 65 + 6c 66 3b 20 74 68 61 74 20 69 73 2c 20 74 68 65 + 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 20 + 66 61 63 69 6c 69 74 79 20 6e 65 65 64 73 0a + + ~ "~ to be reentrant. The other transforms don't have to cope" + ~ " with that, since" + 7e 20 74 6f 20 62 65 20 72 65 65 6e 74 72 61 6e + 74 2e 20 54 68 65 20 6f 74 68 65 72 20 74 72 61 + 6e 73 66 6f 72 6d 73 20 64 6f 6e 27 74 20 68 61 + 76 65 20 74 6f 20 63 6f 70 65 20 77 69 74 68 20 + 74 68 61 74 2c 20 73 69 6e 63 65 0a + + ~ "~ the code they run is mostly just about creating word" + ~ " definitions, but the" + 7e 20 74 68 65 20 63 6f 64 65 20 74 68 65 79 20 + 72 75 6e 20 69 73 20 6d 6f 73 74 6c 79 20 6a 75 + 73 74 20 61 62 6f 75 74 20 63 72 65 61 74 69 6e + 67 20 77 6f 72 64 20 64 65 66 69 6e 69 74 69 6f + 6e 73 2c 20 62 75 74 20 74 68 65 0a + + ~ "~ code given to the hex transform will normally include a" + ~ " call to label-loop," + 7e 20 63 6f 64 65 20 67 69 76 65 6e 20 74 6f 20 + 74 68 65 20 68 65 78 20 74 72 61 6e 73 66 6f 72 + 6d 20 77 69 6c 6c 20 6e 6f 72 6d 61 6c 6c 79 20 + 69 6e 63 6c 75 64 65 20 61 20 63 61 6c 6c 20 74 + 6f 20 6c 61 62 65 6c 2d 6c 6f 6f 70 2c 0a + + ~ "~ all the memory manipulation that happens as part of" + ~ " binary generation, and" + 7e 20 61 6c 6c 20 74 68 65 20 6d 65 6d 6f 72 79 + 20 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 20 74 68 + 61 74 20 68 61 70 70 65 6e 73 20 61 73 20 70 61 + 72 74 20 6f 66 20 62 69 6e 61 72 79 20 67 65 6e + 65 72 61 74 69 6f 6e 2c 20 61 6e 64 0a + + ~ "~ various output words." + 7e 20 76 61 72 69 6f 75 73 20 6f 75 74 70 75 74 + 20 77 6f 72 64 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ While the label and log-load transforms allow Evocation" + ~ " to be a" + 7e 20 20 20 57 68 69 6c 65 20 74 68 65 20 6c 61 + 62 65 6c 20 61 6e 64 20 6c 6f 67 2d 6c 6f 61 64 + 20 74 72 61 6e 73 66 6f 72 6d 73 20 61 6c 6c 6f + 77 20 45 76 6f 63 61 74 69 6f 6e 20 74 6f 20 62 + 65 20 61 0a + + ~ "~ self-hosting compiler, the hex transform attains the even" + ~ " higher bar of" + 7e 20 73 65 6c 66 2d 68 6f 73 74 69 6e 67 20 63 + 6f 6d 70 69 6c 65 72 2c 20 74 68 65 20 68 65 78 + 20 74 72 61 6e 73 66 6f 72 6d 20 61 74 74 61 69 + 6e 73 20 74 68 65 20 65 76 65 6e 20 68 69 67 68 + 65 72 20 62 61 72 20 6f 66 0a + + ~ "~ making Evocation a "self-bootstrapping" compiler, able to" + ~ " create a running" + 7e 20 6d 61 6b 69 6e 67 20 45 76 6f 63 61 74 69 + 6f 6e 20 61 20 22 73 65 6c 66 2d 62 6f 6f 74 73 + 74 72 61 70 70 69 6e 67 22 20 63 6f 6d 70 69 6c + 65 72 2c 20 61 62 6c 65 20 74 6f 20 63 72 65 61 + 74 65 20 61 20 72 75 6e 6e 69 6e 67 0a + + ~ "~ copy of itself without having any sort of pre-existing" + ~ " compiler at all, only" + 7e 20 63 6f 70 79 20 6f 66 20 69 74 73 65 6c 66 + 20 77 69 74 68 6f 75 74 20 68 61 76 69 6e 67 20 + 61 6e 79 20 73 6f 72 74 20 6f 66 20 70 72 65 2d + 65 78 69 73 74 69 6e 67 20 63 6f 6d 70 69 6c 65 + 72 20 61 74 20 61 6c 6c 2c 20 6f 6e 6c 79 0a + + ~ "~ a hex converter or similar small tool. The idea is that" + ~ " the hex converter is" + 7e 20 61 20 68 65 78 20 63 6f 6e 76 65 72 74 65 + 72 20 6f 72 20 73 69 6d 69 6c 61 72 20 73 6d 61 + 6c 6c 20 74 6f 6f 6c 2e 20 54 68 65 20 69 64 65 + 61 20 69 73 20 74 68 61 74 20 74 68 65 20 68 65 + 78 20 63 6f 6e 76 65 72 74 65 72 20 69 73 0a + + ~ "~ small and simple enough that it's easy to perform a" + ~ " BINARY audit on, and" + 7e 20 73 6d 61 6c 6c 20 61 6e 64 20 73 69 6d 70 + 6c 65 20 65 6e 6f 75 67 68 20 74 68 61 74 20 69 + 74 27 73 20 65 61 73 79 20 74 6f 20 70 65 72 66 + 6f 72 6d 20 61 20 42 49 4e 41 52 59 20 61 75 64 + 69 74 20 6f 6e 2c 20 61 6e 64 0a + + ~ "~ that there need be no other binary artifacts in the chain" + ~ " of trust." + 7e 20 74 68 61 74 20 74 68 65 72 65 20 6e 65 65 + 64 20 62 65 20 6e 6f 20 6f 74 68 65 72 20 62 69 + 6e 61 72 79 20 61 72 74 69 66 61 63 74 73 20 69 + 6e 20 74 68 65 20 63 68 61 69 6e 20 6f 66 20 74 + 72 75 73 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ This is not a new concept, but as far as Irenes are" + ~ " aware this name for it" + 7e 20 20 20 54 68 69 73 20 69 73 20 6e 6f 74 20 + 61 20 6e 65 77 20 63 6f 6e 63 65 70 74 2c 20 62 + 75 74 20 61 73 20 66 61 72 20 61 73 20 49 72 65 + 6e 65 73 20 61 72 65 20 61 77 61 72 65 20 74 68 + 69 73 20 6e 61 6d 65 20 66 6f 72 20 69 74 0a + + ~ "~ is a new coinage. The approach of using a hex-to-binary" + ~ " conversion tool as" + 7e 20 69 73 20 61 20 6e 65 77 20 63 6f 69 6e 61 + 67 65 2e 20 54 68 65 20 61 70 70 72 6f 61 63 68 + 20 6f 66 20 75 73 69 6e 67 20 61 20 68 65 78 2d + 74 6f 2d 62 69 6e 61 72 79 20 63 6f 6e 76 65 72 + 73 69 6f 6e 20 74 6f 6f 6c 20 61 73 0a + + ~ "~ the initial bootstrapping stage is due to MesCC, which is" + ~ " quite inspiring in" + 7e 20 74 68 65 20 69 6e 69 74 69 61 6c 20 62 6f + 6f 74 73 74 72 61 70 70 69 6e 67 20 73 74 61 67 + 65 20 69 73 20 64 75 65 20 74 6f 20 4d 65 73 43 + 43 2c 20 77 68 69 63 68 20 69 73 20 71 75 69 74 + 65 20 69 6e 73 70 69 72 69 6e 67 20 69 6e 0a + + ~ "~ that regard." + 7e 20 74 68 61 74 20 72 65 67 61 72 64 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The key insight is that, some sense, the difference" + ~ " between source code" + 7e 20 20 20 54 68 65 20 6b 65 79 20 69 6e 73 69 + 67 68 74 20 69 73 20 74 68 61 74 2c 20 73 6f 6d + 65 20 73 65 6e 73 65 2c 20 74 68 65 20 64 69 66 + 66 65 72 65 6e 63 65 20 62 65 74 77 65 65 6e 20 + 73 6f 75 72 63 65 20 63 6f 64 65 0a + + ~ "~ and binary is the ability to have comments." + 7e 20 61 6e 64 20 62 69 6e 61 72 79 20 69 73 20 + 74 68 65 20 61 62 69 6c 69 74 79 20 74 6f 20 68 + 61 76 65 20 63 6f 6d 6d 65 6e 74 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The hex transform keeps some large, complex state as it" + ~ " runs, unlike the" + 7e 20 20 20 54 68 65 20 68 65 78 20 74 72 61 6e + 73 66 6f 72 6d 20 6b 65 65 70 73 20 73 6f 6d 65 + 20 6c 61 72 67 65 2c 20 63 6f 6d 70 6c 65 78 20 + 73 74 61 74 65 20 61 73 20 69 74 20 72 75 6e 73 + 2c 20 75 6e 6c 69 6b 65 20 74 68 65 0a + + ~ "~ label and log-load transforms, which only require very" + ~ " simple state. This" + 7e 20 6c 61 62 65 6c 20 61 6e 64 20 6c 6f 67 2d + 6c 6f 61 64 20 74 72 61 6e 73 66 6f 72 6d 73 2c + 20 77 68 69 63 68 20 6f 6e 6c 79 20 72 65 71 75 + 69 72 65 20 76 65 72 79 20 73 69 6d 70 6c 65 20 + 73 74 61 74 65 2e 20 54 68 69 73 0a + + ~ "~ state is called the "output metadata". Entries in the" + ~ " output metadata are" + 7e 20 73 74 61 74 65 20 69 73 20 63 61 6c 6c 65 + 64 20 74 68 65 20 22 6f 75 74 70 75 74 20 6d 65 + 74 61 64 61 74 61 22 2e 20 45 6e 74 72 69 65 73 + 20 69 6e 20 74 68 65 20 6f 75 74 70 75 74 20 6d + 65 74 61 64 61 74 61 20 61 72 65 0a + + ~ "~ created and modified as the code under transform runs, by" + ~ " "magic comments"" + 7e 20 63 72 65 61 74 65 64 20 61 6e 64 20 6d 6f + 64 69 66 69 65 64 20 61 73 20 74 68 65 20 63 6f + 64 65 20 75 6e 64 65 72 20 74 72 61 6e 73 66 6f + 72 6d 20 72 75 6e 73 2c 20 62 79 20 22 6d 61 67 + 69 63 20 63 6f 6d 6d 65 6e 74 73 22 0a + + ~ "~ embedded within it. There is a complex command language" + ~ " for these comments," + 7e 20 65 6d 62 65 64 64 65 64 20 77 69 74 68 69 + 6e 20 69 74 2e 20 54 68 65 72 65 20 69 73 20 61 + 20 63 6f 6d 70 6c 65 78 20 63 6f 6d 6d 61 6e 64 + 20 6c 61 6e 67 75 61 67 65 20 66 6f 72 20 74 68 + 65 73 65 20 63 6f 6d 6d 65 6e 74 73 2c 0a + + ~ "~ which must be understood to write code designed to make" + ~ " good use of the hex" + 7e 20 77 68 69 63 68 20 6d 75 73 74 20 62 65 20 + 75 6e 64 65 72 73 74 6f 6f 64 20 74 6f 20 77 72 + 69 74 65 20 63 6f 64 65 20 64 65 73 69 67 6e 65 + 64 20 74 6f 20 6d 61 6b 65 20 67 6f 6f 64 20 75 + 73 65 20 6f 66 20 74 68 65 20 68 65 78 0a + + ~ "~ transform. Fortunately, that's really just" + ~ " assembly-language" + 7e 20 74 72 61 6e 73 66 6f 72 6d 2e 20 46 6f 72 + 74 75 6e 61 74 65 6c 79 2c 20 74 68 61 74 27 73 + 20 72 65 61 6c 6c 79 20 6a 75 73 74 20 61 73 73 + 65 6d 62 6c 79 2d 6c 61 6e 67 75 61 67 65 0a + + ~ "~ implementations." + 7e 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e + 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ It's quite an intense topic, and many readers may wish" + ~ " only to know that" + 7e 20 20 20 49 74 27 73 20 71 75 69 74 65 20 61 + 6e 20 69 6e 74 65 6e 73 65 20 74 6f 70 69 63 2c + 20 61 6e 64 20 6d 61 6e 79 20 72 65 61 64 65 72 + 73 20 6d 61 79 20 77 69 73 68 20 6f 6e 6c 79 20 + 74 6f 20 6b 6e 6f 77 20 74 68 61 74 0a + + ~ "~ the hex transform exists, not how it's structured. So," + ~ " details on the output" + 7e 20 74 68 65 20 68 65 78 20 74 72 61 6e 73 66 + 6f 72 6d 20 65 78 69 73 74 73 2c 20 6e 6f 74 20 + 68 6f 77 20 69 74 27 73 20 73 74 72 75 63 74 75 + 72 65 64 2e 20 53 6f 2c 20 64 65 74 61 69 6c 73 + 20 6f 6e 20 74 68 65 20 6f 75 74 70 75 74 0a + + ~ "~ metadata and the magic comments are described below," + ~ " under "hex transform" + 7e 20 6d 65 74 61 64 61 74 61 20 61 6e 64 20 74 + 68 65 20 6d 61 67 69 63 20 63 6f 6d 6d 65 6e 74 + 73 20 61 72 65 20 64 65 73 63 72 69 62 65 64 20 + 62 65 6c 6f 77 2c 20 75 6e 64 65 72 20 22 68 65 + 78 20 74 72 61 6e 73 66 6f 72 6d 0a + + ~ "~ implementation", rather than here." + 7e 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e + 22 2c 20 72 61 74 68 65 72 20 74 68 61 6e 20 68 + 65 72 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The hex transform DOES NOT WORK yet. It's still in" + ~ " development." + 7e 20 20 20 54 68 65 20 68 65 78 20 74 72 61 6e + 73 66 6f 72 6d 20 44 4f 45 53 20 4e 4f 54 20 57 + 4f 52 4b 20 79 65 74 2e 20 49 74 27 73 20 73 74 + 69 6c 6c 20 69 6e 20 64 65 76 65 6c 6f 70 6d 65 + 6e 74 2e 0a + + ~ "~ TODO update this note when it does work" + 7e 20 54 4f 44 4f 20 75 70 64 61 74 65 20 74 68 + 69 73 20 6e 6f 74 65 20 77 68 65 6e 20 69 74 20 + 64 6f 65 73 20 77 6f 72 6b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Address-management helpers" + 7e 20 41 64 64 72 65 73 73 2d 6d 61 6e 61 67 65 + 6d 65 6e 74 20 68 65 6c 70 65 72 73 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 0a + + ~ "~" + 7e 0a + + ~ "~ The facilities in this section are used as helper code" + ~ " in the" + 7e 20 20 20 54 68 65 20 66 61 63 69 6c 69 74 69 + 65 73 20 69 6e 20 74 68 69 73 20 73 65 63 74 69 + 6f 6e 20 61 72 65 20 75 73 65 64 20 61 73 20 68 + 65 6c 70 65 72 20 63 6f 64 65 20 69 6e 20 74 68 + 65 0a + + ~ "~ implementations of all three transforms." + 7e 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e + 73 20 6f 66 20 61 6c 6c 20 74 68 72 65 65 20 74 + 72 61 6e 73 66 6f 72 6d 73 2e 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ We have a bunch of accessors for the transformation" + ~ " state structure, which" + 7e 20 20 20 57 65 20 68 61 76 65 20 61 20 62 75 + 6e 63 68 20 6f 66 20 61 63 63 65 73 73 6f 72 73 + 20 66 6f 72 20 74 68 65 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 20 73 74 61 74 65 20 73 74 + 72 75 63 74 75 72 65 2c 20 77 68 69 63 68 0a + + ~ "~ are all functions from pointers to pointers. We also" + ~ " define a global" + 7e 20 61 72 65 20 61 6c 6c 20 66 75 6e 63 74 69 + 6f 6e 73 20 66 72 6f 6d 20 70 6f 69 6e 74 65 72 + 73 20 74 6f 20 70 6f 69 6e 74 65 72 73 2e 20 57 + 65 20 61 6c 73 6f 20 64 65 66 69 6e 65 20 61 20 + 67 6c 6f 62 61 6c 0a + + ~ "~ variable which points to the transformation state." + 7e 20 76 61 72 69 61 62 6c 65 20 77 68 69 63 68 + 20 70 6f 69 6e 74 73 20 74 6f 20 74 68 65 20 74 + 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 20 73 74 + 61 74 65 2e 0a + + ~ ": transformation-state-saved-here ;" + 3a 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 2d 73 61 76 65 64 2d 68 65 72 + 65 20 3b 0a + + ~ ": transformation-state-saved-latest 8 + ;" + 3a 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 2d 73 61 76 65 64 2d 6c 61 74 + 65 73 74 20 38 20 2b 20 3b 0a + + ~ ": transformation-state-output-buffer-start 2 8 * + ;" + 3a 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 2d 6f 75 74 70 75 74 2d 62 75 + 66 66 65 72 2d 73 74 61 72 74 20 32 20 38 20 2a + 20 2b 20 3b 0a + + ~ ": transformation-state-user-stack-depth 3 8 * + ;" + 3a 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 2d 75 73 65 72 2d 73 74 61 63 + 6b 2d 64 65 70 74 68 20 33 20 38 20 2a 20 2b 20 + 3b 0a + + ~ ": transformation-state-label-scratch 4 8 * + ;" + 3a 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 2d 6c 61 62 65 6c 2d 73 63 72 + 61 74 63 68 20 34 20 38 20 2a 20 2b 20 3b 0a + + ~ ": transformation-state-output-metadata 5 8 * + ;" + 3a 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 2d 6f 75 74 70 75 74 2d 6d 65 + 74 61 64 61 74 61 20 35 20 38 20 2a 20 2b 20 3b + 0a + + ~ ": allocate-transformation-state" + 3a 20 61 6c 6c 6f 63 61 74 65 2d 74 72 61 6e 73 + 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 0a + + ~ " 6 8 * allocate" + 20 20 36 20 38 20 2a 20 61 6c 6c 6f 63 61 74 65 + 0a + + ~ " dup transformation-state-saved-here 0 swap !" + 20 20 64 75 70 20 74 72 61 6e 73 66 6f 72 6d 61 + 74 69 6f 6e 2d 73 74 61 74 65 2d 73 61 76 65 64 + 2d 68 65 72 65 20 30 20 73 77 61 70 20 21 0a + + ~ " dup transformation-state-saved-latest 0 swap !" + 20 20 64 75 70 20 74 72 61 6e 73 66 6f 72 6d 61 + 74 69 6f 6e 2d 73 74 61 74 65 2d 73 61 76 65 64 + 2d 6c 61 74 65 73 74 20 30 20 73 77 61 70 20 21 + 0a + + ~ " dup transformation-state-output-buffer-start 0 swap !" + 20 20 64 75 70 20 74 72 61 6e 73 66 6f 72 6d 61 + 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 75 + 74 2d 62 75 66 66 65 72 2d 73 74 61 72 74 20 30 + 20 73 77 61 70 20 21 0a + + ~ " dup transformation-state-user-stack-depth 0 swap !" + 20 20 64 75 70 20 74 72 61 6e 73 66 6f 72 6d 61 + 74 69 6f 6e 2d 73 74 61 74 65 2d 75 73 65 72 2d + 73 74 61 63 6b 2d 64 65 70 74 68 20 30 20 73 77 + 61 70 20 21 0a + + ~ " dup transformation-state-label-scratch 0 swap !" + 20 20 64 75 70 20 74 72 61 6e 73 66 6f 72 6d 61 + 74 69 6f 6e 2d 73 74 61 74 65 2d 6c 61 62 65 6c + 2d 73 63 72 61 74 63 68 20 30 20 73 77 61 70 20 + 21 0a + + ~ " dup transformation-state-output-metadata 0 swap ! ;" + 20 20 64 75 70 20 74 72 61 6e 73 66 6f 72 6d 61 + 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 75 + 74 2d 6d 65 74 61 64 61 74 61 20 30 20 73 77 61 + 70 20 21 20 3b 0a + + ~ "allocate-transformation-state s" transformation-state"" + ~ " variable" + 61 6c 6c 6f 63 61 74 65 2d 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 73 22 + 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d + 73 74 61 74 65 22 20 76 61 72 69 61 62 6c 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ When calling the label facility during a" + ~ " transformation, it's necessary" + 7e 20 20 20 57 68 65 6e 20 63 61 6c 6c 69 6e 67 + 20 74 68 65 20 6c 61 62 65 6c 20 66 61 63 69 6c + 69 74 79 20 64 75 72 69 6e 67 20 61 20 74 72 61 + 6e 73 66 6f 72 6d 61 74 69 6f 6e 2c 20 69 74 27 + 73 20 6e 65 63 65 73 73 61 72 79 0a + + ~ "~ to use the real, non-wrapped "here" and "latest"." + 7e 20 74 6f 20 75 73 65 20 74 68 65 20 72 65 61 + 6c 2c 20 6e 6f 6e 2d 77 72 61 70 70 65 64 20 22 + 68 65 72 65 22 20 61 6e 64 20 22 6c 61 74 65 73 + 74 22 2e 0a + + ~ ": swap-transform-variables" + 3a 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " here @ transformation-state" + ~ " transformation-state-saved-here @" + 20 20 68 65 72 65 20 40 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 + 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 + 74 65 2d 73 61 76 65 64 2d 68 65 72 65 20 40 0a + + ~ " here ! transformation-state" + ~ " transformation-state-saved-here !" + 20 20 68 65 72 65 20 21 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 + 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 + 74 65 2d 73 61 76 65 64 2d 68 65 72 65 20 21 0a + + ~ " latest @ transformation-state" + ~ " transformation-state-saved-latest @" + 20 20 6c 61 74 65 73 74 20 40 20 74 72 61 6e 73 + 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 + 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 + 74 61 74 65 2d 73 61 76 65 64 2d 6c 61 74 65 73 + 74 20 40 0a + + ~ " latest ! transformation-state" + ~ " transformation-state-saved-latest ! ;" + 20 20 6c 61 74 65 73 74 20 21 20 74 72 61 6e 73 + 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 + 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 + 74 61 74 65 2d 73 61 76 65 64 2d 6c 61 74 65 73 + 74 20 21 20 3b 0a + + ~ "" + 0a + + ~ "~ We deal with a few address spaces. There's the "host"" + ~ " address space, the" + 7e 20 20 20 57 65 20 64 65 61 6c 20 77 69 74 68 + 20 61 20 66 65 77 20 61 64 64 72 65 73 73 20 73 + 70 61 63 65 73 2e 20 54 68 65 72 65 27 73 20 74 + 68 65 20 22 68 6f 73 74 22 20 61 64 64 72 65 73 + 73 20 73 70 61 63 65 2c 20 74 68 65 0a + + ~ "~ space this process performing the compilation is using" + ~ " for itself. There's" + 7e 20 73 70 61 63 65 20 74 68 69 73 20 70 72 6f + 63 65 73 73 20 70 65 72 66 6f 72 6d 69 6e 67 20 + 74 68 65 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 + 69 73 20 75 73 69 6e 67 20 66 6f 72 20 69 74 73 + 65 6c 66 2e 20 54 68 65 72 65 27 73 0a + + ~ "~ the "target" address space, the address space that will" + ~ " exist later, when" + 7e 20 74 68 65 20 22 74 61 72 67 65 74 22 20 61 + 64 64 72 65 73 73 20 73 70 61 63 65 2c 20 74 68 + 65 20 61 64 64 72 65 73 73 20 73 70 61 63 65 20 + 74 68 61 74 20 77 69 6c 6c 20 65 78 69 73 74 20 + 6c 61 74 65 72 2c 20 77 68 65 6e 0a + + ~ "~ the program we've compiled is running." + 7e 20 74 68 65 20 70 72 6f 67 72 61 6d 20 77 65 + 27 76 65 20 63 6f 6d 70 69 6c 65 64 20 69 73 20 + 72 75 6e 6e 69 6e 67 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Then there's "offsets", which are relative to the start" + ~ " of the output" + 7e 20 20 20 54 68 65 6e 20 74 68 65 72 65 27 73 + 20 22 6f 66 66 73 65 74 73 22 2c 20 77 68 69 63 + 68 20 61 72 65 20 72 65 6c 61 74 69 76 65 20 74 + 6f 20 74 68 65 20 73 74 61 72 74 20 6f 66 20 74 + 68 65 20 6f 75 74 70 75 74 0a + + ~ "~ buffer. For clarity's sake, we always refer to these as" + ~ " offsets, rather than" + 7e 20 62 75 66 66 65 72 2e 20 46 6f 72 20 63 6c + 61 72 69 74 79 27 73 20 73 61 6b 65 2c 20 77 65 + 20 61 6c 77 61 79 73 20 72 65 66 65 72 20 74 6f + 20 74 68 65 73 65 20 61 73 20 6f 66 66 73 65 74 + 73 2c 20 72 61 74 68 65 72 20 74 68 61 6e 0a + + ~ "~ as addresses." + 7e 20 61 73 20 61 64 64 72 65 73 73 65 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ When we define labels for compiled words, we set their" + ~ " values to be" + 7e 20 20 20 57 68 65 6e 20 77 65 20 64 65 66 69 + 6e 65 20 6c 61 62 65 6c 73 20 66 6f 72 20 63 6f + 6d 70 69 6c 65 64 20 77 6f 72 64 73 2c 20 77 65 + 20 73 65 74 20 74 68 65 69 72 20 76 61 6c 75 65 + 73 20 74 6f 20 62 65 0a + + ~ "~ offsets pointing to the generated codeword. This is done" + ~ " by" + 7e 20 6f 66 66 73 65 74 73 20 70 6f 69 6e 74 69 + 6e 67 20 74 6f 20 74 68 65 20 67 65 6e 65 72 61 + 74 65 64 20 63 6f 64 65 77 6f 72 64 2e 20 54 68 + 69 73 20 69 73 20 64 6f 6e 65 20 62 79 0a + + ~ "~ label-create-alternate. We then need to convert them" + ~ " either to the host or" + 7e 20 6c 61 62 65 6c 2d 63 72 65 61 74 65 2d 61 + 6c 74 65 72 6e 61 74 65 2e 20 57 65 20 74 68 65 + 6e 20 6e 65 65 64 20 74 6f 20 63 6f 6e 76 65 72 + 74 20 74 68 65 6d 20 65 69 74 68 65 72 20 74 6f + 20 74 68 65 20 68 6f 73 74 20 6f 72 0a + + ~ "~ the target address space, depending on how we're using" + ~ " them." + 7e 20 74 68 65 20 74 61 72 67 65 74 20 61 64 64 + 72 65 73 73 20 73 70 61 63 65 2c 20 64 65 70 65 + 6e 64 69 6e 67 20 6f 6e 20 68 6f 77 20 77 65 27 + 72 65 20 75 73 69 6e 67 20 74 68 65 6d 2e 0a + + ~ "~" + 7e 0a + + ~ "~ There's no approach here that isn't confusing, but the" + ~ " hope is that by" + 7e 20 20 20 54 68 65 72 65 27 73 20 6e 6f 20 61 + 70 70 72 6f 61 63 68 20 68 65 72 65 20 74 68 61 + 74 20 69 73 6e 27 74 20 63 6f 6e 66 75 73 69 6e + 67 2c 20 62 75 74 20 74 68 65 20 68 6f 70 65 20 + 69 73 20 74 68 61 74 20 62 79 0a + + ~ "~ using offsets, so that we always have to convert them" + ~ " regardless of what" + 7e 20 75 73 69 6e 67 20 6f 66 66 73 65 74 73 2c + 20 73 6f 20 74 68 61 74 20 77 65 20 61 6c 77 61 + 79 73 20 68 61 76 65 20 74 6f 20 63 6f 6e 76 65 + 72 74 20 74 68 65 6d 20 72 65 67 61 72 64 6c 65 + 73 73 20 6f 66 20 77 68 61 74 0a + + ~ "~ we're doing with them, we won't miss a spot where" + ~ " conversion needs to" + 7e 20 77 65 27 72 65 20 64 6f 69 6e 67 20 77 69 + 74 68 20 74 68 65 6d 2c 20 77 65 20 77 6f 6e 27 + 74 20 6d 69 73 73 20 61 20 73 70 6f 74 20 77 68 + 65 72 65 20 63 6f 6e 76 65 72 73 69 6f 6e 20 6e + 65 65 64 73 20 74 6f 0a + + ~ "~ happen." + 7e 20 68 61 70 70 65 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (output offset -- target address)" + 7e 20 28 6f 75 74 70 75 74 20 6f 66 66 73 65 74 + 20 2d 2d 20 74 61 72 67 65 74 20 61 64 64 72 65 + 73 73 29 0a + + ~ ": offset-to-target-address-space" + 3a 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 0a + + ~ " ~ Don't transform null pointers." + 20 20 7e 20 44 6f 6e 27 74 20 74 72 61 6e 73 66 + 6f 72 6d 20 6e 75 6c 6c 20 70 6f 69 6e 74 65 72 + 73 2e 0a + + ~ " dup { swap-transform-variables L@' origin" + ~ " swap-transform-variables + } if ;" + 20 20 64 75 70 20 7b 20 73 77 61 70 2d 74 72 61 + 6e 73 66 6f 72 6d 2d 76 61 72 69 61 62 6c 65 73 + 20 4c 40 27 20 6f 72 69 67 69 6e 20 73 77 61 70 + 2d 74 72 61 6e 73 66 6f 72 6d 2d 76 61 72 69 61 + 62 6c 65 73 20 2b 20 7d 20 69 66 20 3b 0a + + ~ "" + 0a + + ~ "~ (target address -- output offset)" + 7e 20 28 74 61 72 67 65 74 20 61 64 64 72 65 73 + 73 20 2d 2d 20 6f 75 74 70 75 74 20 6f 66 66 73 + 65 74 29 0a + + ~ ": target-address-space-to-offset" + 3a 20 74 61 72 67 65 74 2d 61 64 64 72 65 73 73 + 2d 73 70 61 63 65 2d 74 6f 2d 6f 66 66 73 65 74 + 0a + + ~ " ~ Don't transform null pointers." + 20 20 7e 20 44 6f 6e 27 74 20 74 72 61 6e 73 66 + 6f 72 6d 20 6e 75 6c 6c 20 70 6f 69 6e 74 65 72 + 73 2e 0a + + ~ " dup { swap-transform-variables L@' origin" + ~ " swap-transform-variables - } if ;" + 20 20 64 75 70 20 7b 20 73 77 61 70 2d 74 72 61 + 6e 73 66 6f 72 6d 2d 76 61 72 69 61 62 6c 65 73 + 20 4c 40 27 20 6f 72 69 67 69 6e 20 73 77 61 70 + 2d 74 72 61 6e 73 66 6f 72 6d 2d 76 61 72 69 61 + 62 6c 65 73 20 2d 20 7d 20 69 66 20 3b 0a + + ~ "" + 0a + + ~ "~ (output offset -- host address)" + 7e 20 28 6f 75 74 70 75 74 20 6f 66 66 73 65 74 + 20 2d 2d 20 68 6f 73 74 20 61 64 64 72 65 73 73 + 29 0a + + ~ ": offset-to-host-address-space" + 3a 20 6f 66 66 73 65 74 2d 74 6f 2d 68 6f 73 74 + 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 0a + + ~ " ~ Don't transform null pointers" + 20 20 7e 20 44 6f 6e 27 74 20 74 72 61 6e 73 66 + 6f 72 6d 20 6e 75 6c 6c 20 70 6f 69 6e 74 65 72 + 73 0a + + ~ " dup { transformation-state" + ~ " transformation-state-output-buffer-start @ + } if ;" + 20 20 64 75 70 20 7b 20 74 72 61 6e 73 66 6f 72 + 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 + 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 + 65 2d 6f 75 74 70 75 74 2d 62 75 66 66 65 72 2d + 73 74 61 72 74 20 40 20 2b 20 7d 20 69 66 20 3b + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ (host address --output offset)" + 7e 20 28 68 6f 73 74 20 61 64 64 72 65 73 73 20 + 2d 2d 6f 75 74 70 75 74 20 6f 66 66 73 65 74 29 + 0a + + ~ ": host-address-space-to-offset" + 3a 20 68 6f 73 74 2d 61 64 64 72 65 73 73 2d 73 + 70 61 63 65 2d 74 6f 2d 6f 66 66 73 65 74 0a + + ~ " ~ Don't transform null pointers" + 20 20 7e 20 44 6f 6e 27 74 20 74 72 61 6e 73 66 + 6f 72 6d 20 6e 75 6c 6c 20 70 6f 69 6e 74 65 72 + 73 0a + + ~ " dup { transformation-state" + ~ " transformation-state-output-buffer-start @ - } if ;" + 20 20 64 75 70 20 7b 20 74 72 61 6e 73 66 6f 72 + 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 + 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 + 65 2d 6f 75 74 70 75 74 2d 62 75 66 66 65 72 2d + 73 74 61 72 74 20 40 20 2d 20 7d 20 69 66 20 3b + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ (host address inside the output buffer -- target" + ~ " address)" + 7e 20 28 68 6f 73 74 20 61 64 64 72 65 73 73 20 + 69 6e 73 69 64 65 20 74 68 65 20 6f 75 74 70 75 + 74 20 62 75 66 66 65 72 20 2d 2d 20 74 61 72 67 + 65 74 20 61 64 64 72 65 73 73 29 0a + + ~ ": host-address-space-to-target" + 3a 20 68 6f 73 74 2d 61 64 64 72 65 73 73 2d 73 + 70 61 63 65 2d 74 6f 2d 74 61 72 67 65 74 0a + + ~ " host-address-space-to-offset" + ~ " offset-to-target-address-space ;" + 20 20 68 6f 73 74 2d 61 64 64 72 65 73 73 2d 73 + 70 61 63 65 2d 74 6f 2d 6f 66 66 73 65 74 20 6f + 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 65 74 2d + 61 64 64 72 65 73 73 2d 73 70 61 63 65 20 3b 0a + + ~ "" + 0a + + ~ "~ (target address -- host address)" + 7e 20 28 74 61 72 67 65 74 20 61 64 64 72 65 73 + 73 20 2d 2d 20 68 6f 73 74 20 61 64 64 72 65 73 + 73 29 0a + + ~ ": target-address-space-to-host" + 3a 20 74 61 72 67 65 74 2d 61 64 64 72 65 73 73 + 2d 73 70 61 63 65 2d 74 6f 2d 68 6f 73 74 0a + + ~ " target-address-space-to-offset" + ~ " offset-to-host-address-space ;" + 20 20 74 61 72 67 65 74 2d 61 64 64 72 65 73 73 + 2d 73 70 61 63 65 2d 74 6f 2d 6f 66 66 73 65 74 + 20 6f 66 66 73 65 74 2d 74 6f 2d 68 6f 73 74 2d + 61 64 64 72 65 73 73 2d 73 70 61 63 65 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ ": describe-transformation" + 3a 20 64 65 73 63 72 69 62 65 2d 74 72 61 6e 73 + 66 6f 72 6d 61 74 69 6f 6e 0a + + ~ " ." active here " here @ .hex64 space" + 20 20 2e 22 20 20 20 20 20 20 20 20 61 63 74 69 + 76 65 20 68 65 72 65 20 22 20 68 65 72 65 20 40 + 20 2e 68 65 78 36 34 20 73 70 61 63 65 0a + + ~ " ." latest " latest @ .hex64 newline" + 20 20 2e 22 20 6c 61 74 65 73 74 20 22 20 6c 61 + 74 65 73 74 20 40 20 2e 68 65 78 36 34 20 6e 65 + 77 6c 69 6e 65 0a + + ~ " ." saved here " transformation-state" + ~ " transformation-state-saved-here" + 20 20 2e 22 20 20 20 20 20 20 20 20 20 73 61 76 + 65 64 20 68 65 72 65 20 22 20 74 72 61 6e 73 66 + 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 + 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 + 61 74 65 2d 73 61 76 65 64 2d 68 65 72 65 0a + + ~ " @ .hex64 space" + 20 20 40 20 2e 68 65 78 36 34 20 73 70 61 63 65 + 0a + + ~ " ." latest " transformation-state" + ~ " transformation-state-saved-latest" + 20 20 2e 22 20 6c 61 74 65 73 74 20 22 20 74 72 + 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 + 74 65 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f + 6e 2d 73 74 61 74 65 2d 73 61 76 65 64 2d 6c 61 + 74 65 73 74 0a + + ~ " @ .hex64 newline" + 20 20 40 20 2e 68 65 78 36 34 20 6e 65 77 6c 69 + 6e 65 0a + + ~ " ." output start "" + 20 20 2e 22 20 20 20 20 20 20 20 6f 75 74 70 75 + 74 20 73 74 61 72 74 20 22 0a + + ~ " transformation-state" + ~ " transformation-state-output-buffer-start" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 62 75 66 66 65 72 2d 73 74 61 72 74 0a + + ~ " @ .hex64 newline" + 20 20 40 20 2e 68 65 78 36 34 20 6e 65 77 6c 69 + 6e 65 0a + + ~ " ." user stack depth "" + 20 20 2e 22 20 20 20 75 73 65 72 20 73 74 61 63 + 6b 20 64 65 70 74 68 20 22 0a + + ~ " transformation-state" + ~ " transformation-state-user-stack-depth" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 75 73 65 72 + 2d 73 74 61 63 6b 2d 64 65 70 74 68 0a + + ~ " @ .hex64 newline ;" + 20 20 40 20 2e 68 65 78 36 34 20 6e 65 77 6c 69 + 6e 65 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ User stack depth tracking helper" + 7e 20 55 73 65 72 20 73 74 61 63 6b 20 64 65 70 + 74 68 20 74 72 61 63 6b 69 6e 67 20 68 65 6c 70 + 65 72 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 0a + + ~ "~" + 7e 0a + + ~ "~ The transformation facility offers a feature which" + ~ " specific transforms can" + 7e 20 20 20 54 68 65 20 74 72 61 6e 73 66 6f 72 + 6d 61 74 69 6f 6e 20 66 61 63 69 6c 69 74 79 20 + 6f 66 66 65 72 73 20 61 20 66 65 61 74 75 72 65 + 20 77 68 69 63 68 20 73 70 65 63 69 66 69 63 20 + 74 72 61 6e 73 66 6f 72 6d 73 20 63 61 6e 0a + + ~ "~ use, or not, as they prefer, called user stack depth" + ~ " tracking. The log-load" + 7e 20 75 73 65 2c 20 6f 72 20 6e 6f 74 2c 20 61 + 73 20 74 68 65 79 20 70 72 65 66 65 72 2c 20 63 + 61 6c 6c 65 64 20 75 73 65 72 20 73 74 61 63 6b + 20 64 65 70 74 68 20 74 72 61 63 6b 69 6e 67 2e + 20 54 68 65 20 6c 6f 67 2d 6c 6f 61 64 0a + + ~ "~ transform uses it; the label transform does not. The most" + ~ " difficult part of" + 7e 20 74 72 61 6e 73 66 6f 72 6d 20 75 73 65 73 + 20 69 74 3b 20 74 68 65 20 6c 61 62 65 6c 20 74 + 72 61 6e 73 66 6f 72 6d 20 64 6f 65 73 20 6e 6f + 74 2e 20 54 68 65 20 6d 6f 73 74 20 64 69 66 66 + 69 63 75 6c 74 20 70 61 72 74 20 6f 66 0a + + ~ "~ the tracking is the heler word below; it also relies on" + ~ " the user-stack-depth" + 7e 20 74 68 65 20 74 72 61 63 6b 69 6e 67 20 69 + 73 20 74 68 65 20 68 65 6c 65 72 20 77 6f 72 64 + 20 62 65 6c 6f 77 3b 20 69 74 20 61 6c 73 6f 20 + 72 65 6c 69 65 73 20 6f 6e 20 74 68 65 20 75 73 + 65 72 2d 73 74 61 63 6b 2d 64 65 70 74 68 0a + + ~ "~ field of the transformation-state variable." + 7e 20 66 69 65 6c 64 20 6f 66 20 74 68 65 20 74 + 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 + 61 74 65 20 76 61 72 69 61 62 6c 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ What does user stack depth mean? Well, for every" + ~ " transform there's some" + 7e 20 20 20 57 68 61 74 20 64 6f 65 73 20 75 73 + 65 72 20 73 74 61 63 6b 20 64 65 70 74 68 20 6d + 65 61 6e 3f 20 57 65 6c 6c 2c 20 66 6f 72 20 65 + 76 65 72 79 20 74 72 61 6e 73 66 6f 72 6d 20 74 + 68 65 72 65 27 73 20 73 6f 6d 65 0a + + ~ "~ notion of running a word "immediately"; for the log-load" + ~ " transform, it means" + 7e 20 6e 6f 74 69 6f 6e 20 6f 66 20 72 75 6e 6e + 69 6e 67 20 61 20 77 6f 72 64 20 22 69 6d 6d 65 + 64 69 61 74 65 6c 79 22 3b 20 66 6f 72 20 74 68 + 65 20 6c 6f 67 2d 6c 6f 61 64 20 74 72 61 6e 73 + 66 6f 72 6d 2c 20 69 74 20 6d 65 61 6e 73 0a + + ~ "~ that the word runs at the time the generated log-load" + ~ " routine executes. Each" + 7e 20 74 68 61 74 20 74 68 65 20 77 6f 72 64 20 + 72 75 6e 73 20 61 74 20 74 68 65 20 74 69 6d 65 + 20 74 68 65 20 67 65 6e 65 72 61 74 65 64 20 6c + 6f 67 2d 6c 6f 61 64 20 72 6f 75 74 69 6e 65 20 + 65 78 65 63 75 74 65 73 2e 20 45 61 63 68 0a + + ~ "~ time a word runs, it interacts with the value stack in" + ~ " some way. Some words" + 7e 20 74 69 6d 65 20 61 20 77 6f 72 64 20 72 75 + 6e 73 2c 20 69 74 20 69 6e 74 65 72 61 63 74 73 + 20 77 69 74 68 20 74 68 65 20 76 61 6c 75 65 20 + 73 74 61 63 6b 20 69 6e 20 73 6f 6d 65 20 77 61 + 79 2e 20 53 6f 6d 65 20 77 6f 72 64 73 0a + + ~ "~ are neutral; others result in a net increase or decrease" + ~ " in its depth, which" + 7e 20 61 72 65 20 6e 65 75 74 72 61 6c 3b 20 6f + 74 68 65 72 73 20 72 65 73 75 6c 74 20 69 6e 20 + 61 20 6e 65 74 20 69 6e 63 72 65 61 73 65 20 6f + 72 20 64 65 63 72 65 61 73 65 20 69 6e 20 69 74 + 73 20 64 65 70 74 68 2c 20 77 68 69 63 68 0a + + ~ "~ we call the delta. The running total of these deltas is" + ~ " what we call the" + 7e 20 77 65 20 63 61 6c 6c 20 74 68 65 20 64 65 + 6c 74 61 2e 20 54 68 65 20 72 75 6e 6e 69 6e 67 + 20 74 6f 74 61 6c 20 6f 66 20 74 68 65 73 65 20 + 64 65 6c 74 61 73 20 69 73 20 77 68 61 74 20 77 + 65 20 63 61 6c 6c 20 74 68 65 0a + + ~ "~ user stack depth. By "user" we mean that these are values" + ~ " which were created" + 7e 20 75 73 65 72 20 73 74 61 63 6b 20 64 65 70 + 74 68 2e 20 42 79 20 22 75 73 65 72 22 20 77 65 + 20 6d 65 61 6e 20 74 68 61 74 20 74 68 65 73 65 + 20 61 72 65 20 76 61 6c 75 65 73 20 77 68 69 63 + 68 20 77 65 72 65 20 63 72 65 61 74 65 64 0a + + ~ "~ by and for the code being transformed, which the code" + ~ " doing the transforming" + 7e 20 62 79 20 61 6e 64 20 66 6f 72 20 74 68 65 + 20 63 6f 64 65 20 62 65 69 6e 67 20 74 72 61 6e + 73 66 6f 72 6d 65 64 2c 20 77 68 69 63 68 20 74 + 68 65 20 63 6f 64 65 20 64 6f 69 6e 67 20 74 68 + 65 20 74 72 61 6e 73 66 6f 72 6d 69 6e 67 0a + + ~ "~ must be careful not to interfere with." + 7e 20 6d 75 73 74 20 62 65 20 63 61 72 65 66 75 + 6c 20 6e 6f 74 20 74 6f 20 69 6e 74 65 72 66 65 + 72 65 20 77 69 74 68 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Why do we need to do this? Recall that the log-load" + ~ " routine is given the" + 7e 20 20 20 57 68 79 20 64 6f 20 77 65 20 6e 65 + 65 64 20 74 6f 20 64 6f 20 74 68 69 73 3f 20 52 + 65 63 61 6c 6c 20 74 68 61 74 20 74 68 65 20 6c + 6f 67 2d 6c 6f 61 64 20 72 6f 75 74 69 6e 65 20 + 69 73 20 67 69 76 65 6e 20 74 68 65 0a + + ~ "~ log address as the only value on the stack when it" + ~ " begins, and any time it" + 7e 20 6c 6f 67 20 61 64 64 72 65 73 73 20 61 73 + 20 74 68 65 20 6f 6e 6c 79 20 76 61 6c 75 65 20 + 6f 6e 20 74 68 65 20 73 74 61 63 6b 20 77 68 65 + 6e 20 69 74 20 62 65 67 69 6e 73 2c 20 61 6e 64 + 20 61 6e 79 20 74 69 6d 65 20 69 74 0a + + ~ "~ does something that requires looking at the log, it needs" + ~ " to be able to find" + 7e 20 64 6f 65 73 20 73 6f 6d 65 74 68 69 6e 67 + 20 74 68 61 74 20 72 65 71 75 69 72 65 73 20 6c + 6f 6f 6b 69 6e 67 20 61 74 20 74 68 65 20 6c 6f + 67 2c 20 69 74 20 6e 65 65 64 73 20 74 6f 20 62 + 65 20 61 62 6c 65 20 74 6f 20 66 69 6e 64 0a + + ~ "~ that address. The log-load routine runs as part of the" + ~ " warm-start routine" + 7e 20 74 68 61 74 20 61 64 64 72 65 73 73 2e 20 + 54 68 65 20 6c 6f 67 2d 6c 6f 61 64 20 72 6f 75 + 74 69 6e 65 20 72 75 6e 73 20 61 73 20 70 61 72 + 74 20 6f 66 20 74 68 65 20 77 61 72 6d 2d 73 74 + 61 72 74 20 72 6f 75 74 69 6e 65 0a + + ~ "~ (see compilation/execution.e), whose overall job is to" + ~ " get Evocation into a" + 7e 20 28 73 65 65 20 63 6f 6d 70 69 6c 61 74 69 + 6f 6e 2f 65 78 65 63 75 74 69 6f 6e 2e 65 29 2c + 20 77 68 6f 73 65 20 6f 76 65 72 61 6c 6c 20 6a + 6f 62 20 69 73 20 74 6f 20 67 65 74 20 45 76 6f + 63 61 74 69 6f 6e 20 69 6e 74 6f 20 61 0a + + ~ "~ state where it can freely work with dynamically-allocated" + ~ " data on the log" + 7e 20 73 74 61 74 65 20 77 68 65 72 65 20 69 74 + 20 63 61 6e 20 66 72 65 65 6c 79 20 77 6f 72 6b + 20 77 69 74 68 20 64 79 6e 61 6d 69 63 61 6c 6c + 79 2d 61 6c 6c 6f 63 61 74 65 64 20 64 61 74 61 + 20 6f 6e 20 74 68 65 20 6c 6f 67 0a + + ~ "~ whose address isn't known at compile time. Therefore," + ~ " necessarily, the" + 7e 20 77 68 6f 73 65 20 61 64 64 72 65 73 73 20 + 69 73 6e 27 74 20 6b 6e 6f 77 6e 20 61 74 20 63 + 6f 6d 70 69 6c 65 20 74 69 6d 65 2e 20 54 68 65 + 72 65 66 6f 72 65 2c 20 6e 65 63 65 73 73 61 72 + 69 6c 79 2c 20 74 68 65 0a + + ~ "~ log-load routine itself cannot assume access to any" + ~ " scratch space; the value" + 7e 20 6c 6f 67 2d 6c 6f 61 64 20 72 6f 75 74 69 + 6e 65 20 69 74 73 65 6c 66 20 63 61 6e 6e 6f 74 + 20 61 73 73 75 6d 65 20 61 63 63 65 73 73 20 74 + 6f 20 61 6e 79 20 73 63 72 61 74 63 68 20 73 70 + 61 63 65 3b 20 74 68 65 20 76 61 6c 75 65 0a + + ~ "~ stack is the only place it can store anything it needs," + ~ " most crucially" + 7e 20 73 74 61 63 6b 20 69 73 20 74 68 65 20 6f + 6e 6c 79 20 70 6c 61 63 65 20 69 74 20 63 61 6e + 20 73 74 6f 72 65 20 61 6e 79 74 68 69 6e 67 20 + 69 74 20 6e 65 65 64 73 2c 20 6d 6f 73 74 20 63 + 72 75 63 69 61 6c 6c 79 0a + + ~ "~ including the log address." + 7e 20 69 6e 63 6c 75 64 69 6e 67 20 74 68 65 20 + 6c 6f 67 20 61 64 64 72 65 73 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Fortunately, it is possible for the transform's own" + ~ " generated code to" + 7e 20 20 20 46 6f 72 74 75 6e 61 74 65 6c 79 2c + 20 69 74 20 69 73 20 70 6f 73 73 69 62 6c 65 20 + 66 6f 72 20 74 68 65 20 74 72 61 6e 73 66 6f 72 + 6d 27 73 20 6f 77 6e 20 67 65 6e 65 72 61 74 65 + 64 20 63 6f 64 65 20 74 6f 0a + + ~ "~ cooperate with the transformed code so that they can both" + ~ " share the stack," + 7e 20 63 6f 6f 70 65 72 61 74 65 20 77 69 74 68 + 20 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 65 64 + 20 63 6f 64 65 20 73 6f 20 74 68 61 74 20 74 68 + 65 79 20 63 61 6e 20 62 6f 74 68 20 73 68 61 72 + 65 20 74 68 65 20 73 74 61 63 6b 2c 0a + + ~ "~ as long as the log transform knows what the transformed" + ~ " code is doing with" + 7e 20 61 73 20 6c 6f 6e 67 20 61 73 20 74 68 65 + 20 6c 6f 67 20 74 72 61 6e 73 66 6f 72 6d 20 6b + 6e 6f 77 73 20 77 68 61 74 20 74 68 65 20 74 72 + 61 6e 73 66 6f 72 6d 65 64 20 63 6f 64 65 20 69 + 73 20 64 6f 69 6e 67 20 77 69 74 68 0a + + ~ "~ it. Unfortunately, there's no general way to know that." + ~ " We achieve it by" + 7e 20 69 74 2e 20 55 6e 66 6f 72 74 75 6e 61 74 + 65 6c 79 2c 20 74 68 65 72 65 27 73 20 6e 6f 20 + 67 65 6e 65 72 61 6c 20 77 61 79 20 74 6f 20 6b + 6e 6f 77 20 74 68 61 74 2e 20 57 65 20 61 63 68 + 69 65 76 65 20 69 74 20 62 79 0a + + ~ "~ hard-coding a delta value for every single possible word," + ~ " and looking up" + 7e 20 68 61 72 64 2d 63 6f 64 69 6e 67 20 61 20 + 64 65 6c 74 61 20 76 61 6c 75 65 20 66 6f 72 20 + 65 76 65 72 79 20 73 69 6e 67 6c 65 20 70 6f 73 + 73 69 62 6c 65 20 77 6f 72 64 2c 20 61 6e 64 20 + 6c 6f 6f 6b 69 6e 67 20 75 70 0a + + ~ "~ that delta at transform-time, based on the word's name." + ~ " Yes, that is quite a" + 7e 20 74 68 61 74 20 64 65 6c 74 61 20 61 74 20 + 74 72 61 6e 73 66 6f 72 6d 2d 74 69 6d 65 2c 20 + 62 61 73 65 64 20 6f 6e 20 74 68 65 20 77 6f 72 + 64 27 73 20 6e 61 6d 65 2e 20 59 65 73 2c 20 74 + 68 61 74 20 69 73 20 71 75 69 74 65 20 61 0a + + ~ "~ thing to have to do, but it does mean we don't have to" + ~ " think about this" + 7e 20 74 68 69 6e 67 20 74 6f 20 68 61 76 65 20 + 74 6f 20 64 6f 2c 20 62 75 74 20 69 74 20 64 6f + 65 73 20 6d 65 61 6e 20 77 65 20 64 6f 6e 27 74 + 20 68 61 76 65 20 74 6f 20 74 68 69 6e 6b 20 61 + 62 6f 75 74 20 74 68 69 73 0a + + ~ "~ while writing the code we're transforming." + 7e 20 77 68 69 6c 65 20 77 72 69 74 69 6e 67 20 + 74 68 65 20 63 6f 64 65 20 77 65 27 72 65 20 74 + 72 61 6e 73 66 6f 72 6d 69 6e 67 2e 0a + + ~ "~" + 7e 0a + + ~ "~ It's worth noticing that the delta only applies to" + ~ " things that happen" + 7e 20 20 20 49 74 27 73 20 77 6f 72 74 68 20 6e + 6f 74 69 63 69 6e 67 20 74 68 61 74 20 74 68 65 + 20 64 65 6c 74 61 20 6f 6e 6c 79 20 61 70 70 6c + 69 65 73 20 74 6f 20 74 68 69 6e 67 73 20 74 68 + 61 74 20 68 61 70 70 65 6e 0a + + ~ "~ immediately. It does not apply to compiled words because" + ~ " they run later, and" + 7e 20 69 6d 6d 65 64 69 61 74 65 6c 79 2e 20 49 + 74 20 64 6f 65 73 20 6e 6f 74 20 61 70 70 6c 79 + 20 74 6f 20 63 6f 6d 70 69 6c 65 64 20 77 6f 72 + 64 73 20 62 65 63 61 75 73 65 20 74 68 65 79 20 + 72 75 6e 20 6c 61 74 65 72 2c 20 61 6e 64 0a + + ~ "~ it does not apply to alternates because they run too" + ~ " soon. Feel free to" + 7e 20 69 74 20 64 6f 65 73 20 6e 6f 74 20 61 70 + 70 6c 79 20 74 6f 20 61 6c 74 65 72 6e 61 74 65 + 73 20 62 65 63 61 75 73 65 20 74 68 65 79 20 72 + 75 6e 20 74 6f 6f 20 73 6f 6f 6e 2e 20 46 65 65 + 6c 20 66 72 65 65 20 74 6f 0a + + ~ "~ contemplate how confusing it is that transformation-time" + ~ " is sooner than" + 7e 20 63 6f 6e 74 65 6d 70 6c 61 74 65 20 68 6f + 77 20 63 6f 6e 66 75 73 69 6e 67 20 69 74 20 69 + 73 20 74 68 61 74 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 74 69 6d 65 20 69 73 20 73 6f + 6f 6e 65 72 20 74 68 61 6e 0a + + ~ "~ "immediate"." + 7e 20 22 69 6d 6d 65 64 69 61 74 65 22 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (name pointer -- delta value)" + 7e 20 28 6e 61 6d 65 20 70 6f 69 6e 74 65 72 20 + 2d 2d 20 64 65 6c 74 61 20 76 61 6c 75 65 29 0a + + ~ ": transform-get-stack-delta" + 3a 20 74 72 61 6e 73 66 6f 72 6d 2d 67 65 74 2d + 73 74 61 63 6b 2d 64 65 6c 74 61 0a + + ~ " ~ From language/static/core.e." + 20 20 7e 20 46 72 6f 6d 20 6c 61 6e 67 75 61 67 + 65 2f 73 74 61 74 69 63 2f 63 6f 72 65 2e 65 2e + 0a + + ~ " dup s" docol" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 64 6f 63 6f 6c 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" exit" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 65 78 69 74 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" swap" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 73 77 61 70 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" drop" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 64 72 6f 70 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 2d 31 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" 2drop" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 32 64 72 6f 70 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 2d 32 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " ~ The following are deliberate omissions: roll, unroll." + 20 20 7e 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e + 67 20 61 72 65 20 64 65 6c 69 62 65 72 61 74 65 + 20 6f 6d 69 73 73 69 6f 6e 73 3a 20 72 6f 6c 6c + 2c 20 75 6e 72 6f 6c 6c 2e 0a + + ~ " dup s" 3roll" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 33 72 6f 6c 6c 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" 3unroll" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 33 75 6e 72 6f 6c 6c + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" dup" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 64 75 70 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" 2dup" stringcmp 0 = { drop 2 exit } if" + 20 20 64 75 70 20 73 22 20 32 64 75 70 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" +" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 2b 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" -" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 2d 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" *" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 2a 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" /%" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 2f 25 22 20 73 74 72 + 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f + 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" 1+" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 31 2b 22 20 73 74 72 + 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f + 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" 1-" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 31 2d 22 20 73 74 72 + 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f + 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" =" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 3d 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" !=" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 21 3d 22 20 73 74 72 + 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f + 70 20 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" >" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 3e 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" <" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 3c 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" >=" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 3e 3d 22 20 73 74 72 + 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f + 70 20 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" <=" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 3c 3d 22 20 73 74 72 + 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f + 70 20 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" >unsigned" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 3e 75 6e 73 69 67 6e + 65 64 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" <unsigned" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 3c 75 6e 73 69 67 6e + 65 64 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" >=unsigned" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 3e 3d 75 6e 73 69 67 + 6e 65 64 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 + 74 20 7d 20 69 66 0a + + ~ " dup s" <=unsigned" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 3c 3d 75 6e 73 69 67 + 6e 65 64 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 + 74 20 7d 20 69 66 0a + + ~ " dup s" &" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 26 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" |" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 7c 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" xor" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 78 6f 72 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" invert" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 69 6e 76 65 72 74 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" lit" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 6c 69 74 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" litstring" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 6c 69 74 73 74 72 69 + 6e 67 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 31 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" !" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 21 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 2d 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" @" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 40 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" +!" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 2b 21 22 20 73 74 72 + 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f + 70 20 2d 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" -!" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 2d 21 22 20 73 74 72 + 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f + 70 20 2d 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" 8!" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 38 21 22 20 73 74 72 + 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f + 70 20 2d 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" 8@" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 38 40 22 20 73 74 72 + 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f + 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" 16!" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 31 36 21 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 2d 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" 16@" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 31 36 40 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" 32!" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 33 32 21 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 2d 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" 32@" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 33 32 40 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" control!" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 63 6f 6e 74 72 6f 6c + 21 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" control@" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 63 6f 6e 74 72 6f 6c + 40 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 31 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" value!" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 76 61 6c 75 65 21 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 2d 31 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" value@" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 76 61 6c 75 65 40 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" memcopy" stringcmp 0 = { drop -3 exit } if" + 20 20 64 75 70 20 73 22 20 6d 65 6d 63 6f 70 79 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 2d 33 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" memmove" stringcmp 0 = { drop -3 exit } if" + 20 20 64 75 70 20 73 22 20 6d 65 6d 6d 6f 76 65 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 2d 33 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" stringlen" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 73 74 72 69 6e 67 6c + 65 6e 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" reverse-stringlen" stringcmp 0 = { drop 0 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 72 65 76 65 72 73 65 + 2d 73 74 72 69 6e 67 6c 65 6e 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" reverse-padding-len" stringcmp 0 = { drop 0 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 72 65 76 65 72 73 65 + 2d 70 61 64 64 69 6e 67 2d 6c 65 6e 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" stringcmp" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 73 74 72 69 6e 67 63 + 6d 70 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" branch" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 62 72 61 6e 63 68 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" 0branch" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 30 62 72 61 6e 63 68 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " ~ This is kind of a big assumption." + 20 20 7e 20 54 68 69 73 20 69 73 20 6b 69 6e 64 + 20 6f 66 20 61 20 62 69 67 20 61 73 73 75 6d 70 + 74 69 6f 6e 2e 0a + + ~ " dup s" execute" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 65 78 65 63 75 74 65 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" entry-to-execution-token" stringcmp 0 = { drop 0" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 65 6e 74 72 79 2d 74 + 6f 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 + 6e 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" execution-token-to-entry" stringcmp 0 = { drop 0" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 65 78 65 63 75 74 69 + 6f 6e 2d 74 6f 6b 65 6e 2d 74 6f 2d 65 6e 74 72 + 79 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" entry-flags@" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 65 6e 74 72 79 2d 66 + 6c 61 67 73 40 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 + 69 74 20 7d 20 69 66 0a + + ~ " dup s" entry-flags!" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 65 6e 74 72 79 2d 66 + 6c 61 67 73 21 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 32 20 65 + 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" entry-to-name" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 65 6e 74 72 79 2d 74 + 6f 2d 6e 61 6d 65 22 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 + 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" pack64" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 70 61 63 6b 36 34 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 2d 31 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" pack32" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 70 61 63 6b 33 32 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 2d 31 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" pack16" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 70 61 63 6b 31 36 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 2d 31 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" pack8" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 70 61 63 6b 38 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 2d 31 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" packstring" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 70 61 63 6b 73 74 72 + 69 6e 67 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 + 74 20 7d 20 69 66 0a + + ~ " dup s" packalign" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 70 61 63 6b 61 6c 69 + 67 6e 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" unpack64" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 75 6e 70 61 63 6b 36 + 34 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 31 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" unpack32" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 75 6e 70 61 63 6b 33 + 32 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 31 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" unpack16" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 75 6e 70 61 63 6b 31 + 36 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 31 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" unpack8" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 75 6e 70 61 63 6b 38 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 31 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" align-size" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 61 6c 69 67 6e 2d 73 + 69 7a 65 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 + 74 20 7d 20 69 66 0a + + ~ " dup s" unpackalign" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 75 6e 70 61 63 6b 61 + 6c 69 67 6e 22 20 73 74 72 69 6e 67 63 6d 70 20 + 30 20 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 + 69 74 20 7d 20 69 66 0a + + ~ " dup s" crash" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 63 72 61 73 68 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" max" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 6d 61 78 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" min" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 6d 69 6e 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" over" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 6f 76 65 72 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" pick" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 70 69 63 6b 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " ~ The following are deliberate omissions: ndrop, ndup." + 20 20 7e 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e + 67 20 61 72 65 20 64 65 6c 69 62 65 72 61 74 65 + 20 6f 6d 69 73 73 69 6f 6e 73 3a 20 6e 64 72 6f + 70 2c 20 6e 64 75 70 2e 0a + + ~ " dup s" 3drop" stringcmp 0 = { drop -3 exit } if" + 20 20 64 75 70 20 73 22 20 33 64 72 6f 70 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 2d 33 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" 3dup" stringcmp 0 = { drop 3 exit } if" + 20 20 64 75 70 20 73 22 20 33 64 75 70 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 33 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" &&" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 26 26 22 20 73 74 72 + 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f + 70 20 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" ||" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 7c 7c 22 20 73 74 72 + 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f + 70 20 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" not" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 6e 6f 74 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" negate" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 6e 65 67 61 74 65 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" align-floor" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 61 6c 69 67 6e 2d 66 + 6c 6f 6f 72 22 20 73 74 72 69 6e 67 63 6d 70 20 + 30 20 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 + 69 74 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ From language/static/linux.e." + 20 20 7e 20 46 72 6f 6d 20 6c 61 6e 67 75 61 67 + 65 2f 73 74 61 74 69 63 2f 6c 69 6e 75 78 2e 65 + 2e 0a + + ~ " dup s" sys-exit" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 73 79 73 2d 65 78 69 + 74 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" sys-write" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 73 79 73 2d 77 72 69 + 74 65 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 2d 32 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" sys-read" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 73 79 73 2d 72 65 61 + 64 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 2d 32 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ From language/static/output.e." + 20 20 7e 20 46 72 6f 6d 20 6c 61 6e 67 75 61 67 + 65 2f 73 74 61 74 69 63 2f 6f 75 74 70 75 74 2e + 65 2e 0a + + ~ " dup s" emitstring" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 65 6d 69 74 73 74 72 + 69 6e 67 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 + 74 20 7d 20 69 66 0a + + ~ " dup s" space" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 73 70 61 63 65 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" newline" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 6e 65 77 6c 69 6e 65 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" pow" stringcmp 0 = { drop 2 exit } if" + 20 20 64 75 70 20 73 22 20 70 6f 77 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" logfloor" stringcmp 0 = { drop 2 exit } if" + 20 20 64 75 70 20 73 22 20 6c 6f 67 66 6c 6f 6f + 72 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 32 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" logceil" stringcmp 0 = { drop 2 exit } if" + 20 20 64 75 70 20 73 22 20 6c 6f 67 63 65 69 6c + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 32 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" .base-unsigned" stringcmp 0 = { drop -3 exit } if" + 20 20 64 75 70 20 73 22 20 2e 62 61 73 65 2d 75 + 6e 73 69 67 6e 65 64 22 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 33 + 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" .base" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 2e 62 61 73 65 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 2d 32 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" ." stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 2e 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" .hex" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 2e 68 65 78 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 2d 31 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" .hex8" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 2e 68 65 78 38 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 2d 31 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" .hex16" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 2e 68 65 78 31 36 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 2d 31 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" .hex32" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 2e 68 65 78 33 32 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 2d 31 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" .hex64" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 2e 68 65 78 36 34 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 2d 31 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" .hexn" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 2e 68 65 78 6e 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 2d 32 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ "" + 0a + + ~ " ~ From language/static/amd64.e." + 20 20 7e 20 46 72 6f 6d 20 6c 61 6e 67 75 61 67 + 65 2f 73 74 61 74 69 63 2f 61 6d 64 36 34 2e 65 + 2e 0a + + ~ " dup s" :rax" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 72 61 78 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :rcx" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 72 63 78 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :rdx" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 72 64 78 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :rbx" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 72 62 78 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :rsp" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 72 73 70 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :rbp" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 72 62 70 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :rsi" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 72 73 69 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :rdi" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 72 64 69 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :r8" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 72 38 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :r9" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 72 39 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :r10" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 72 31 30 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :r11" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 72 31 31 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :r12" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 72 31 32 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :r13" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 72 31 33 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :r14" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 72 31 34 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :r15" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 72 31 35 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :eax" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 65 61 78 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :ecx" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 65 63 78 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :edx" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 65 64 78 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :ebx" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 65 62 78 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :esp" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 65 73 70 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :ebp" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 65 62 70 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :esi" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 65 73 69 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :edi" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 65 64 69 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :ax" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 61 78 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :cx" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 63 78 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :dx" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 64 78 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :bx" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 62 78 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :sp" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 73 70 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :bp" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 62 70 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :si" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 73 69 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :di" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 64 69 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :al" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 61 6c 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :cl" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 63 6c 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :dl" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 64 6c 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :bl" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 62 6c 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :ah" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 61 68 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :ch" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 63 68 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :dh" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 64 68 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :bh" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 62 68 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :cc-overflow" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 63 63 2d 6f 76 65 + 72 66 6c 6f 77 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 31 20 65 78 + 69 74 20 7d 20 69 66 0a + + ~ " dup s" :cc-no-overflow" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 63 63 2d 6e 6f 2d + 6f 76 65 72 66 6c 6f 77 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 31 + 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :cc-below" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 63 63 2d 62 65 6c + 6f 77 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 31 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" :cc-above-equal" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 63 63 2d 61 62 6f + 76 65 2d 65 71 75 61 6c 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 31 + 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :cc-equal" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 63 63 2d 65 71 75 + 61 6c 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 31 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" :cc-not-equal" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 63 63 2d 6e 6f 74 + 2d 65 71 75 61 6c 22 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 31 20 65 + 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :cc-below-equal" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 63 63 2d 62 65 6c + 6f 77 2d 65 71 75 61 6c 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 31 + 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :cc-above" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 63 63 2d 61 62 6f + 76 65 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 31 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" :cc-sign" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 63 63 2d 73 69 67 + 6e 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 31 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" :cc-not-sign" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 63 63 2d 6e 6f 74 + 2d 73 69 67 6e 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 31 20 65 78 + 69 74 20 7d 20 69 66 0a + + ~ " dup s" :cc-even" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 63 63 2d 65 76 65 + 6e 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 31 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" :cc-odd" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 63 63 2d 6f 64 64 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 31 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" :cc-less" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 63 63 2d 6c 65 73 + 73 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 31 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" :cc-greater-equal" stringcmp 0 = { drop 1 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 3a 63 63 2d 67 72 65 + 61 74 65 72 2d 65 71 75 61 6c 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :cc-less-equal" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 63 63 2d 6c 65 73 + 73 2d 65 71 75 61 6c 22 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 31 20 + 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :cc-greater" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 3a 63 63 2d 67 72 65 + 61 74 65 72 22 20 73 74 72 69 6e 67 63 6d 70 20 + 30 20 3d 20 7b 20 64 72 6f 70 20 31 20 65 78 69 + 74 20 7d 20 69 66 0a + + ~ " dup s" reg64" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 67 36 34 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" extrareg64" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 65 78 74 72 61 72 65 + 67 36 34 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" reg32" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 67 33 32 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" reg16" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 67 31 36 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" reg8" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 67 38 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" scalefield" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 73 63 61 6c 65 66 69 + 65 6c 64 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" condition-code" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 63 6f 6e 64 69 74 69 + 6f 6e 2d 63 6f 64 65 22 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 + 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" rex-0" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 78 2d 30 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" rex-w" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 78 2d 77 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" rex-r" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 78 2d 72 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" rex-x" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 78 2d 78 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" rex-b" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 78 2d 62 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" rex-wr" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 78 2d 77 72 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" rex-wx" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 78 2d 77 78 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" rex-wb" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 78 2d 77 62 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" rex-rx" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 78 2d 72 78 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" rex-rb" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 78 2d 72 62 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" rex-xb" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 78 2d 78 62 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" rex-wrx" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 78 2d 77 72 78 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" rex-wrb" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 78 2d 77 72 62 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" rex-wxb" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 78 2d 77 78 62 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" rex-rxb" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 78 2d 72 78 62 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" rex-wrxb" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 78 2d 77 72 78 + 62 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" opcodereg" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 6f 70 63 6f 64 65 72 + 65 67 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 2d 32 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" opcodecc" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 6f 70 63 6f 64 65 63 + 63 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 2d 32 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" modrm" stringcmp 0 = { drop -3 exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 64 72 6d 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 2d 33 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" sib" stringcmp 0 = { drop -3 exit } if" + 20 20 64 75 70 20 73 22 20 73 69 62 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 2d 33 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" addressing-reg64" stringcmp 0 = { drop -2 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 61 64 64 72 65 73 73 + 69 6e 67 2d 72 65 67 36 34 22 20 73 74 72 69 6e + 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 + 2d 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" addressing-reg8" stringcmp 0 = { drop -2 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 61 64 64 72 65 73 73 + 69 6e 67 2d 72 65 67 38 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d + 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" addressing-indirect-reg64" stringcmp 0 = { drop -2" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 61 64 64 72 65 73 73 + 69 6e 67 2d 69 6e 64 69 72 65 63 74 2d 72 65 67 + 36 34 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 2d 32 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" addressing-disp8-reg64" stringcmp 0 = { drop -3" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 61 64 64 72 65 73 73 + 69 6e 67 2d 64 69 73 70 38 2d 72 65 67 36 34 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 2d 33 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" addressing-disp32-reg64" stringcmp 0 = { drop -3" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 61 64 64 72 65 73 73 + 69 6e 67 2d 64 69 73 70 33 32 2d 72 65 67 36 34 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 2d 33 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" addressing-indexed-reg64" stringcmp 0 = { drop -4" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 61 64 64 72 65 73 73 + 69 6e 67 2d 69 6e 64 65 78 65 64 2d 72 65 67 36 + 34 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 2d 34 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" addressing-disp8-indexed-reg64" stringcmp 0 = {" + ~ " drop -5 exit } if" + 20 20 64 75 70 20 73 22 20 61 64 64 72 65 73 73 + 69 6e 67 2d 64 69 73 70 38 2d 69 6e 64 65 78 65 + 64 2d 72 65 67 36 34 22 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 35 + 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" cld" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 63 6c 64 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" std" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 73 74 64 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" syscall" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 73 79 73 63 61 6c 6c + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" hlt" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 68 6c 74 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" push-reg64" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 70 75 73 68 2d 72 65 + 67 36 34 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 + 74 20 7d 20 69 66 0a + + ~ " dup s" push-extrareg64" stringcmp 0 = { drop -1 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 70 75 73 68 2d 65 78 + 74 72 61 72 65 67 36 34 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d + 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" pop-reg64" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 70 6f 70 2d 72 65 67 + 36 34 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" pop-extrareg64" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 70 6f 70 2d 65 78 74 + 72 61 72 65 67 36 34 22 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 31 + 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" push-imm32-extended64" stringcmp 0 = { drop -1" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 70 75 73 68 2d 69 6d + 6d 33 32 2d 65 78 74 65 6e 64 65 64 36 34 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 2d 31 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" lea-reg64-disp8-reg64" stringcmp 0 = { drop -3" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6c 65 61 2d 72 65 67 + 36 34 2d 64 69 73 70 38 2d 72 65 67 36 34 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 2d 33 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" lea-reg64-disp32-reg64" stringcmp 0 = { drop -3" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6c 65 61 2d 72 65 67 + 36 34 2d 64 69 73 70 33 32 2d 72 65 67 36 34 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 2d 33 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" lea-reg64-indexed-reg64" stringcmp 0 = { drop -4" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6c 65 61 2d 72 65 67 + 36 34 2d 69 6e 64 65 78 65 64 2d 72 65 67 36 34 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 2d 34 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" lea-reg64-disp8-indexed-reg64" stringcmp 0 = {" + ~ " drop -5 exit } if" + 20 20 64 75 70 20 73 22 20 6c 65 61 2d 72 65 67 + 36 34 2d 64 69 73 70 38 2d 69 6e 64 65 78 65 64 + 2d 72 65 67 36 34 22 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 35 20 + 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" mov-reg64-imm32" stringcmp 0 = { drop -2 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 72 65 67 + 36 34 2d 69 6d 6d 33 32 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d + 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" mov-reg64-imm64" stringcmp 0 = { drop -2 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 72 65 67 + 36 34 2d 69 6d 6d 36 34 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d + 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" mov-extrareg64-imm64" stringcmp 0 = { drop -2 exit" + ~ " } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 65 78 74 + 72 61 72 65 67 36 34 2d 69 6d 6d 36 34 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 2d 32 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" mov-reg64-reg64" stringcmp 0 = { drop -2 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 72 65 67 + 36 34 2d 72 65 67 36 34 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d + 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" mov-indirect-reg64-reg64" stringcmp 0 = { drop -2" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 69 6e 64 + 69 72 65 63 74 2d 72 65 67 36 34 2d 72 65 67 36 + 34 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 2d 32 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" mov-disp8-reg64-reg64" stringcmp 0 = { drop -3" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 64 69 73 + 70 38 2d 72 65 67 36 34 2d 72 65 67 36 34 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 2d 33 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" mov-reg64-indirect-reg64" stringcmp 0 = { drop -2" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 72 65 67 + 36 34 2d 69 6e 64 69 72 65 63 74 2d 72 65 67 36 + 34 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 2d 32 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" mov-reg64-disp8-reg64" stringcmp 0 = { drop -3" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 72 65 67 + 36 34 2d 64 69 73 70 38 2d 72 65 67 36 34 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 2d 33 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" mov-reg64-disp32-reg64" stringcmp 0 = { drop -3" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 72 65 67 + 36 34 2d 64 69 73 70 33 32 2d 72 65 67 36 34 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 2d 33 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" mov-reg64-indexed-reg64" stringcmp 0 = { drop -4" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 72 65 67 + 36 34 2d 69 6e 64 65 78 65 64 2d 72 65 67 36 34 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 2d 34 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" mov-indexed-reg64-reg64" stringcmp 0 = { drop -4" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 69 6e 64 + 65 78 65 64 2d 72 65 67 36 34 2d 72 65 67 36 34 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 2d 34 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" mov-indirect-reg64-reg32" stringcmp 0 = { drop -2" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 69 6e 64 + 69 72 65 63 74 2d 72 65 67 36 34 2d 72 65 67 33 + 32 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 2d 32 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" mov-disp8-reg64-reg32" stringcmp 0 = { drop -3" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 64 69 73 + 70 38 2d 72 65 67 36 34 2d 72 65 67 33 32 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 2d 33 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" mov-reg32-indirect-reg64" stringcmp 0 = { drop -2" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 72 65 67 + 33 32 2d 69 6e 64 69 72 65 63 74 2d 72 65 67 36 + 34 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 2d 32 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" mov-reg32-disp8-reg64" stringcmp 0 = { drop -3" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 72 65 67 + 33 32 2d 64 69 73 70 38 2d 72 65 67 36 34 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 2d 33 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" mov-indirect-reg64-reg16" stringcmp 0 = { drop -2" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 69 6e 64 + 69 72 65 63 74 2d 72 65 67 36 34 2d 72 65 67 31 + 36 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 2d 32 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" mov-disp8-reg64-reg16" stringcmp 0 = { drop -3" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 64 69 73 + 70 38 2d 72 65 67 36 34 2d 72 65 67 31 36 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 2d 33 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" mov-reg16-indirect-reg64" stringcmp 0 = { drop -2" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 72 65 67 + 31 36 2d 69 6e 64 69 72 65 63 74 2d 72 65 67 36 + 34 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 2d 32 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" mov-reg16-disp8-reg64" stringcmp 0 = { drop -3" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 72 65 67 + 31 36 2d 64 69 73 70 38 2d 72 65 67 36 34 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 2d 33 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" mov-indirect-reg64-reg8" stringcmp 0 = { drop -2" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 69 6e 64 + 69 72 65 63 74 2d 72 65 67 36 34 2d 72 65 67 38 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 2d 32 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" mov-disp8-reg64-reg8" stringcmp 0 = { drop -3 exit" + ~ " } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 64 69 73 + 70 38 2d 72 65 67 36 34 2d 72 65 67 38 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 2d 33 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" mov-reg8-indirect-reg64" stringcmp 0 = { drop -2" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 72 65 67 + 38 2d 69 6e 64 69 72 65 63 74 2d 72 65 67 36 34 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 2d 32 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" mov-reg8-disp8-reg64" stringcmp 0 = { drop -3 exit" + ~ " } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 72 65 67 + 38 2d 64 69 73 70 38 2d 72 65 67 36 34 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 2d 33 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" mov-reg8-reg8" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 2d 72 65 67 + 38 2d 72 65 67 38 22 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 32 20 + 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" movs8" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 73 38 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" movs16" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 73 31 36 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" movs32" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 73 33 32 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" movs64" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 6d 6f 76 73 36 34 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" rep-movs8" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 2d 6d 6f 76 + 73 38 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" rep-movs16" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 2d 6d 6f 76 + 73 31 36 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" rep-movs32" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 2d 6d 6f 76 + 73 33 32 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" rep-movs64" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 2d 6d 6f 76 + 73 36 34 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" lods8" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 6c 6f 64 73 38 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" lods16" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 6c 6f 64 73 31 36 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" lods32" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 6c 6f 64 73 33 32 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" lods64" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 6c 6f 64 73 36 34 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" rep-lods8" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 2d 6c 6f 64 + 73 38 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" rep-lods16" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 2d 6c 6f 64 + 73 31 36 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" rep-lods32" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 2d 6c 6f 64 + 73 33 32 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" rep-lods64" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 2d 6c 6f 64 + 73 36 34 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" stos8" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 73 74 6f 73 38 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" stos16" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 73 74 6f 73 31 36 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" stos32" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 73 74 6f 73 33 32 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" stos64" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 73 74 6f 73 36 34 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" rep-stos8" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 2d 73 74 6f + 73 38 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" rep-stos16" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 2d 73 74 6f + 73 31 36 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" rep-stos32" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 2d 73 74 6f + 73 33 32 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" rep-stos64" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 2d 73 74 6f + 73 36 34 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" cmps8" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 63 6d 70 73 38 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" cmps16" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 63 6d 70 73 31 36 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" cmps32" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 63 6d 70 73 33 32 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" cmps64" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 63 6d 70 73 36 34 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" repz-cmps8" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 7a 2d 63 6d + 70 73 38 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" repz-cmps16" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 7a 2d 63 6d + 70 73 31 36 22 20 73 74 72 69 6e 67 63 6d 70 20 + 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 + 74 20 7d 20 69 66 0a + + ~ " dup s" repz-cmps32" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 7a 2d 63 6d + 70 73 33 32 22 20 73 74 72 69 6e 67 63 6d 70 20 + 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 + 74 20 7d 20 69 66 0a + + ~ " dup s" repz-cmps64" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 7a 2d 63 6d + 70 73 36 34 22 20 73 74 72 69 6e 67 63 6d 70 20 + 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 + 74 20 7d 20 69 66 0a + + ~ " dup s" repnz-cmps8" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 6e 7a 2d 63 + 6d 70 73 38 22 20 73 74 72 69 6e 67 63 6d 70 20 + 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 + 74 20 7d 20 69 66 0a + + ~ " dup s" repnz-cmps16" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 6e 7a 2d 63 + 6d 70 73 31 36 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 + 69 74 20 7d 20 69 66 0a + + ~ " dup s" repnz-cmps32" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 6e 7a 2d 63 + 6d 70 73 33 32 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 + 69 74 20 7d 20 69 66 0a + + ~ " dup s" repnz-cmps64" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 6e 7a 2d 63 + 6d 70 73 36 34 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 + 69 74 20 7d 20 69 66 0a + + ~ " dup s" scas8" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 73 63 61 73 38 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" scas16" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 73 63 61 73 31 36 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" scas32" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 73 63 61 73 33 32 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" scas64" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 73 63 61 73 36 34 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" repz-scas8" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 7a 2d 73 63 + 61 73 38 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" repz-scas16" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 7a 2d 73 63 + 61 73 31 36 22 20 73 74 72 69 6e 67 63 6d 70 20 + 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 + 74 20 7d 20 69 66 0a + + ~ " dup s" repz-scas32" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 7a 2d 73 63 + 61 73 33 32 22 20 73 74 72 69 6e 67 63 6d 70 20 + 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 + 74 20 7d 20 69 66 0a + + ~ " dup s" repz-scas64" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 7a 2d 73 63 + 61 73 36 34 22 20 73 74 72 69 6e 67 63 6d 70 20 + 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 + 74 20 7d 20 69 66 0a + + ~ " dup s" repnz-scas8" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 6e 7a 2d 73 + 63 61 73 38 22 20 73 74 72 69 6e 67 63 6d 70 20 + 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 + 74 20 7d 20 69 66 0a + + ~ " dup s" repnz-scas16" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 6e 7a 2d 73 + 63 61 73 31 36 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 + 69 74 20 7d 20 69 66 0a + + ~ " dup s" repnz-scas32" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 6e 7a 2d 73 + 63 61 73 33 32 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 + 69 74 20 7d 20 69 66 0a + + ~ " dup s" repnz-scas64" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 70 6e 7a 2d 73 + 63 61 73 36 34 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 + 69 74 20 7d 20 69 66 0a + + ~ " dup s" add-reg64-reg64" stringcmp 0 = { drop -2 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 61 64 64 2d 72 65 67 + 36 34 2d 72 65 67 36 34 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d + 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" add-indirect-reg64-reg64" stringcmp 0 = { drop -2" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 61 64 64 2d 69 6e 64 + 69 72 65 63 74 2d 72 65 67 36 34 2d 72 65 67 36 + 34 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 2d 32 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" add-reg64-indirect-reg64" stringcmp 0 = { drop -2" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 61 64 64 2d 72 65 67 + 36 34 2d 69 6e 64 69 72 65 63 74 2d 72 65 67 36 + 34 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 2d 32 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" add-reg64-imm8" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 61 64 64 2d 72 65 67 + 36 34 2d 69 6d 6d 38 22 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 32 + 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" sub-reg64-reg64" stringcmp 0 = { drop -2 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 73 75 62 2d 72 65 67 + 36 34 2d 72 65 67 36 34 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d + 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" sub-indirect-reg64-reg64" stringcmp 0 = { drop -2" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 73 75 62 2d 69 6e 64 + 69 72 65 63 74 2d 72 65 67 36 34 2d 72 65 67 36 + 34 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 2d 32 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" sub-reg64-imm8" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 73 75 62 2d 72 65 67 + 36 34 2d 69 6d 6d 38 22 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 32 + 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" sbb-reg64-imm8" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 73 62 62 2d 72 65 67 + 36 34 2d 69 6d 6d 38 22 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 32 + 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" mul-reg64" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 6d 75 6c 2d 72 65 67 + 36 34 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" divmod-reg64" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 64 69 76 6d 6f 64 2d + 72 65 67 36 34 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 + 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" idivmod-reg64" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 69 64 69 76 6d 6f 64 + 2d 72 65 67 36 34 22 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 31 20 + 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" inc-reg64" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 69 6e 63 2d 72 65 67 + 36 34 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" dec-reg64" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 64 65 63 2d 72 65 67 + 36 34 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" and-reg64-reg64" stringcmp 0 = { drop -2 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 61 6e 64 2d 72 65 67 + 36 34 2d 72 65 67 36 34 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d + 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" and-reg64-imm8" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 61 6e 64 2d 72 65 67 + 36 34 2d 69 6d 6d 38 22 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 32 + 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" or-reg64-reg64" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 6f 72 2d 72 65 67 36 + 34 2d 72 65 67 36 34 22 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 32 + 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" or-reg64-imm8" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 6f 72 2d 72 65 67 36 + 34 2d 69 6d 6d 38 22 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 32 20 + 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" xor-reg64-reg64" stringcmp 0 = { drop -2 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 78 6f 72 2d 72 65 67 + 36 34 2d 72 65 67 36 34 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d + 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" not-reg64" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 6e 6f 74 2d 72 65 67 + 36 34 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 74 + 20 7d 20 69 66 0a + + ~ " dup s" cmp-reg64-reg64" stringcmp 0 = { drop -2 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 63 6d 70 2d 72 65 67 + 36 34 2d 72 65 67 36 34 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d + 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" test-reg64-reg64" stringcmp 0 = { drop -2 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 74 65 73 74 2d 72 65 + 67 36 34 2d 72 65 67 36 34 22 20 73 74 72 69 6e + 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 + 2d 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" set-reg8-cc" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 73 65 74 2d 72 65 67 + 38 2d 63 63 22 20 73 74 72 69 6e 67 63 6d 70 20 + 30 20 3d 20 7b 20 64 72 6f 70 20 2d 32 20 65 78 + 69 74 20 7d 20 69 66 0a + + ~ " dup s" jmp-cc-rel-imm8" stringcmp 0 = { drop -2 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 6a 6d 70 2d 63 63 2d + 72 65 6c 2d 69 6d 6d 38 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d + 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" jmp-cc-rel-imm32" stringcmp 0 = { drop -2 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 6a 6d 70 2d 63 63 2d + 72 65 6c 2d 69 6d 6d 33 32 22 20 73 74 72 69 6e + 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 + 2d 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" jmp-abs-indirect-reg64" stringcmp 0 = { drop -1" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 6a 6d 70 2d 61 62 73 + 2d 69 6e 64 69 72 65 63 74 2d 72 65 67 36 34 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 2d 31 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" jmp-rel-imm8" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 6a 6d 70 2d 72 65 6c + 2d 69 6d 6d 38 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 + 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" jmp-rel-imm32" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 6a 6d 70 2d 72 65 6c + 2d 69 6d 6d 33 32 22 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 31 20 + 65 78 69 74 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ From language/static/execution-support.e." + 20 20 7e 20 46 72 6f 6d 20 6c 61 6e 67 75 61 67 + 65 2f 73 74 61 74 69 63 2f 65 78 65 63 75 74 69 + 6f 6e 2d 73 75 70 70 6f 72 74 2e 65 2e 0a + + ~ " dup s" pack-next" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 70 61 63 6b 2d 6e 65 + 78 74 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" pack-beforenext" stringcmp 0 = { drop -1 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 70 61 63 6b 2d 62 65 + 66 6f 72 65 6e 65 78 74 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d + 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" pack-pushcontrol" stringcmp 0 = { drop -1 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 70 61 63 6b 2d 70 75 + 73 68 63 6f 6e 74 72 6f 6c 22 20 73 74 72 69 6e + 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 + 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" pack-popcontrol" stringcmp 0 = { drop -1 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 70 61 63 6b 2d 70 6f + 70 63 6f 6e 74 72 6f 6c 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d + 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ From language/dynamic/dynamic.e." + 20 20 7e 20 46 72 6f 6d 20 6c 61 6e 67 75 61 67 + 65 2f 64 79 6e 61 6d 69 63 2f 64 79 6e 61 6d 69 + 63 2e 65 2e 0a + + ~ " dup s" stack" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 73 74 61 63 6b 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" stackhex" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 73 74 61 63 6b 68 65 + 78 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" is-in-log" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 69 73 2d 69 6e 2d 6c + 6f 67 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" oldest-entry" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 6f 6c 64 65 73 74 2d + 65 6e 74 72 79 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 31 20 65 78 + 69 74 20 7d 20 69 66 0a + + ~ " dup s" next-newer-entry" stringcmp 0 = { drop 0 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 6e 65 78 74 2d 6e 65 + 77 65 72 2d 65 6e 74 72 79 22 20 73 74 72 69 6e + 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 + 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" guess-entry-end" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 67 75 65 73 73 2d 65 + 6e 74 72 79 2d 65 6e 64 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 30 + 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" containing-entry" stringcmp 0 = { drop 0 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 63 6f 6e 74 61 69 6e + 69 6e 67 2d 65 6e 74 72 79 22 20 73 74 72 69 6e + 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 + 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" is-assembly-word" stringcmp 0 = { drop 0 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 69 73 2d 61 73 73 65 + 6d 62 6c 79 2d 77 6f 72 64 22 20 73 74 72 69 6e + 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 + 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" is-docol-itself" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 69 73 2d 64 6f 63 6f + 6c 2d 69 74 73 65 6c 66 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 30 + 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" is-docol-codeword" stringcmp 0 = { drop 0 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 69 73 2d 64 6f 63 6f + 6c 2d 63 6f 64 65 77 6f 72 64 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" is-docol-interpreted-word" stringcmp 0 = { drop 0" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 69 73 2d 64 6f 63 6f + 6c 2d 69 6e 74 65 72 70 72 65 74 65 64 2d 77 6f + 72 64 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" is-codeword-pointer" stringcmp 0 = { drop 0 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 69 73 2d 63 6f 64 65 + 77 6f 72 64 2d 70 6f 69 6e 74 65 72 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" indent" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 69 6e 64 65 6e 74 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 2d 31 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" word-heading" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 77 6f 72 64 2d 68 65 + 61 64 69 6e 67 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 + 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" list-dictionary" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 6c 69 73 74 2d 64 69 + 63 74 69 6f 6e 61 72 79 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 30 + 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" hexdump-row" stringcmp 0 = { drop -3 exit } if" + 20 20 64 75 70 20 73 22 20 68 65 78 64 75 6d 70 + 2d 72 6f 77 22 20 73 74 72 69 6e 67 63 6d 70 20 + 30 20 3d 20 7b 20 64 72 6f 70 20 2d 33 20 65 78 + 69 74 20 7d 20 69 66 0a + + ~ " dup s" hexdump-between" stringcmp 0 = { drop -2 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 68 65 78 64 75 6d 70 + 2d 62 65 74 77 65 65 6e 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d + 32 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" hexdump-from" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 68 65 78 64 75 6d 70 + 2d 66 72 6f 6d 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 32 20 65 + 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" hexdump" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 68 65 78 64 75 6d 70 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" describe-hex" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 64 65 73 63 72 69 62 + 65 2d 68 65 78 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 + 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" describe-docol" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 64 65 73 63 72 69 62 + 65 2d 64 6f 63 6f 6c 22 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 31 + 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" describe" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 64 65 73 63 72 69 62 + 65 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" describe-all" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 64 65 73 63 72 69 62 + 65 2d 61 6c 6c 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 + 69 74 20 7d 20 69 66 0a + + ~ " dup s" describe-compilation" stringcmp 0 = { drop 0 exit" + ~ " } if" + 20 20 64 75 70 20 73 22 20 64 65 73 63 72 69 62 + 65 2d 63 6f 6d 70 69 6c 61 74 69 6f 6e 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" symbolize-pointer" stringcmp 0 = { drop -1 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 73 79 6d 62 6f 6c 69 + 7a 65 2d 70 6f 69 6e 74 65 72 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" list-callers" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 6c 69 73 74 2d 63 61 + 6c 6c 65 72 73 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 + 69 74 20 7d 20 69 66 0a + + ~ " dup s" forget" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 66 6f 72 67 65 74 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 2d 31 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" ," stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 2c 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" make-immediate" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 6d 61 6b 65 2d 69 6d + 6d 65 64 69 61 74 65 22 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 + 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" make-hidden" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 6d 61 6b 65 2d 68 69 + 64 64 65 6e 22 20 73 74 72 69 6e 67 63 6d 70 20 + 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 + 74 20 7d 20 69 66 0a + + ~ " dup s" make-visible" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 6d 61 6b 65 2d 76 69 + 73 69 62 6c 65 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 + 69 74 20 7d 20 69 66 0a + + ~ " dup s" recurse" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 63 75 72 73 65 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" recurse" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 63 75 72 73 65 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" find" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 66 69 6e 64 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" allocate" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 61 6c 6c 6f 63 61 74 + 65 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" create" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 63 72 65 61 74 65 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 2d 31 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" self-codeword" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 73 65 6c 66 2d 63 6f + 64 65 77 6f 72 64 22 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 65 + 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" variable" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 76 61 72 69 61 62 6c + 65 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 2d 32 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" keyword" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 6b 65 79 77 6f 72 64 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" literal" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 6c 69 74 65 72 61 6c + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ "" + 0a + + ~ " ~ From language/dynamic/input.e." + 20 20 7e 20 46 72 6f 6d 20 6c 61 6e 67 75 61 67 + 65 2f 64 79 6e 61 6d 69 63 2f 69 6e 70 75 74 2e + 65 2e 0a + + ~ " dup s" buffer-physical-start" stringcmp 0 = { drop 0 exit" + ~ " } if" + 20 20 64 75 70 20 73 22 20 62 75 66 66 65 72 2d + 70 68 79 73 69 63 61 6c 2d 73 74 61 72 74 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" buffer-physical-length" stringcmp 0 = { drop 0" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 62 75 66 66 65 72 2d + 70 68 79 73 69 63 61 6c 2d 6c 65 6e 67 74 68 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" buffer-logical-start" stringcmp 0 = { drop 0 exit" + ~ " } if" + 20 20 64 75 70 20 73 22 20 62 75 66 66 65 72 2d + 6c 6f 67 69 63 61 6c 2d 73 74 61 72 74 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" buffer-logical-length" stringcmp 0 = { drop 0 exit" + ~ " } if" + 20 20 64 75 70 20 73 22 20 62 75 66 66 65 72 2d + 6c 6f 67 69 63 61 6c 2d 6c 65 6e 67 74 68 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" input-buffer-refill" stringcmp 0 = { drop 0 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 69 6e 70 75 74 2d 62 + 75 66 66 65 72 2d 72 65 66 69 6c 6c 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" input-buffer-next-source" stringcmp 0 = { drop 0" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 69 6e 70 75 74 2d 62 + 75 66 66 65 72 2d 6e 65 78 74 2d 73 6f 75 72 63 + 65 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" clear-buffer" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 63 6c 65 61 72 2d 62 + 75 66 66 65 72 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 + 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" zero-input-buffer-metadata" stringcmp 0 = { drop" + ~ " -1 exit } if" + 20 20 64 75 70 20 73 22 20 7a 65 72 6f 2d 69 6e + 70 75 74 2d 62 75 66 66 65 72 2d 6d 65 74 61 64 + 61 74 61 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 78 69 + 74 20 7d 20 69 66 0a + + ~ " dup s" allocate-input-buffer-metadata" stringcmp 0 = {" + ~ " drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 61 6c 6c 6f 63 61 74 + 65 2d 69 6e 70 75 74 2d 62 75 66 66 65 72 2d 6d + 65 74 61 64 61 74 61 22 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 31 20 + 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" allocate-input-buffer" stringcmp 0 = { drop 0 exit" + ~ " } if" + 20 20 64 75 70 20 73 22 20 61 6c 6c 6f 63 61 74 + 65 2d 69 6e 70 75 74 2d 62 75 66 66 65 72 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ " dup s" attach-string-to-input-buffer" stringcmp 0 = {" + ~ " drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 61 74 74 61 63 68 2d + 73 74 72 69 6e 67 2d 74 6f 2d 69 6e 70 75 74 2d + 62 75 66 66 65 72 22 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 32 20 + 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" consume-from" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 63 6f 6e 73 75 6d 65 + 2d 66 72 6f 6d 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 31 20 65 + 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" peek-from" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 70 65 65 6b 2d 66 72 + 6f 6d 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" key-from" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 6b 65 79 2d 66 72 6f + 6d 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" normalize-buffer" stringcmp 0 = { drop -1 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 6e 6f 72 6d 61 6c 69 + 7a 65 2d 62 75 66 66 65 72 22 20 73 74 72 69 6e + 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 + 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" compute-next-buffer-free-block" stringcmp 0 = {" + ~ " drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 63 6f 6d 70 75 74 65 + 2d 6e 65 78 74 2d 62 75 66 66 65 72 2d 66 72 65 + 65 2d 62 6c 6f 63 6b 22 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 31 20 + 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" refill-input-buffer-from-stdin" stringcmp 0 = {" + ~ " drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 66 69 6c 6c 2d + 69 6e 70 75 74 2d 62 75 66 66 65 72 2d 66 72 6f + 6d 2d 73 74 64 69 6e 22 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 31 + 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" main-input-buffer" stringcmp 0 = { drop 1 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 6d 61 69 6e 2d 69 6e + 70 75 74 2d 62 75 66 66 65 72 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" consume" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 63 6f 6e 73 75 6d 65 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " dup s" peek" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 70 65 65 6b 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" key" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 6b 65 79 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ From language/dynamic/interpret.e." + 20 20 7e 20 46 72 6f 6d 20 6c 61 6e 67 75 61 67 + 65 2f 64 79 6e 61 6d 69 63 2f 69 6e 74 65 72 70 + 72 65 74 2e 65 2e 0a + + ~ " dup s" unroll-past-string" stringcmp 0 = { drop 0 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 75 6e 72 6f 6c 6c 2d + 70 61 73 74 2d 73 74 72 69 6e 67 22 20 73 74 72 + 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f + 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" swap-past-string" stringcmp 0 = { drop 0 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 73 77 61 70 2d 70 61 + 73 74 2d 73 74 72 69 6e 67 22 20 73 74 72 69 6e + 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 + 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " ~ The following are deliberate omissions: dropstring," + 20 20 7e 20 20 20 54 68 65 20 66 6f 6c 6c 6f 77 + 69 6e 67 20 61 72 65 20 64 65 6c 69 62 65 72 61 + 74 65 20 6f 6d 69 73 73 69 6f 6e 73 3a 20 64 72 + 6f 70 73 74 72 69 6e 67 2c 0a + + ~ " ~ dropstring-with-result, accumulate-string." + 20 20 7e 20 64 72 6f 70 73 74 72 69 6e 67 2d 77 + 69 74 68 2d 72 65 73 75 6c 74 2c 20 61 63 63 75 + 6d 75 6c 61 74 65 2d 73 74 72 69 6e 67 2e 0a + + ~ " dup s" is-space" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 69 73 2d 73 70 61 63 + 65 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d + 20 69 66 0a + + ~ " dup s" is-alphanumeric" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 69 73 2d 61 6c 70 68 + 61 6e 75 6d 65 72 69 63 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 30 + 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " ~ The following is a deliberate omission: word." + 20 20 7e 20 20 20 54 68 65 20 66 6f 6c 6c 6f 77 + 69 6e 67 20 69 73 20 61 20 64 65 6c 69 62 65 72 + 61 74 65 20 6f 6d 69 73 73 69 6f 6e 3a 20 77 6f + 72 64 2e 0a + + ~ " dup s" generalized-digit-value" stringcmp 0 = { drop 0" + ~ " exit } if" + 20 20 64 75 70 20 73 22 20 67 65 6e 65 72 61 6c + 69 7a 65 64 2d 64 69 67 69 74 2d 76 61 6c 75 65 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 + 69 66 0a + + ~ " ~ The following are deliberate omissions:" + ~ " decode-generalized-digit," + 20 20 7e 20 20 20 54 68 65 20 66 6f 6c 6c 6f 77 + 69 6e 67 20 61 72 65 20 64 65 6c 69 62 65 72 61 + 74 65 20 6f 6d 69 73 73 69 6f 6e 73 3a 20 64 65 + 63 6f 64 65 2d 67 65 6e 65 72 61 6c 69 7a 65 64 + 2d 64 69 67 69 74 2c 0a + + ~ " ~ read-base-unsigned, read-integer-unsigned," + ~ " read-integer, read-decimal." + 20 20 7e 20 72 65 61 64 2d 62 61 73 65 2d 75 6e + 73 69 67 6e 65 64 2c 20 72 65 61 64 2d 69 6e 74 + 65 67 65 72 2d 75 6e 73 69 67 6e 65 64 2c 20 72 + 65 61 64 2d 69 6e 74 65 67 65 72 2c 20 72 65 61 + 64 2d 64 65 63 69 6d 61 6c 2e 0a + + ~ " dup s" interpreter-flags" stringcmp 0 = { drop 1 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 69 6e 74 65 72 70 72 + 65 74 65 72 2d 66 6c 61 67 73 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" [" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 5b 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" ]" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 5d 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" :" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 3a 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" ;" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 3b 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" ;asm" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 3b 61 73 6d 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" '" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 27 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" relink-main-input-buffer-to-stdin" stringcmp 0 = {" + ~ " drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 72 65 6c 69 6e 6b 2d + 6d 61 69 6e 2d 69 6e 70 75 74 2d 62 75 66 66 65 + 72 2d 74 6f 2d 73 74 64 69 6e 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " ~ The following is a deliberate omission: interpret." + 20 20 7e 20 20 20 54 68 65 20 66 6f 6c 6c 6f 77 + 69 6e 67 20 69 73 20 61 20 64 65 6c 69 62 65 72 + 61 74 65 20 6f 6d 69 73 73 69 6f 6e 3a 20 69 6e + 74 65 72 70 72 65 74 2e 0a + + ~ " dup s" quit" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 71 75 69 74 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ From language/dynamic/linux.e." + 20 20 7e 20 46 72 6f 6d 20 6c 61 6e 67 75 61 67 + 65 2f 64 79 6e 61 6d 69 63 2f 6c 69 6e 75 78 2e + 65 2e 0a + + ~ " dup s" allocate-timespec" stringcmp 0 = { drop 1 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 61 6c 6c 6f 63 61 74 + 65 2d 74 69 6d 65 73 70 65 63 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" timespec-seconds" stringcmp 0 = { drop 0 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 74 69 6d 65 73 70 65 + 63 2d 73 65 63 6f 6e 64 73 22 20 73 74 72 69 6e + 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 + 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" timespec-nanoseconds" stringcmp 0 = { drop 0 exit" + ~ " } if" + 20 20 64 75 70 20 73 22 20 74 69 6d 65 73 70 65 + 63 2d 6e 61 6e 6f 73 65 63 6f 6e 64 73 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" nanosleep" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 6e 61 6e 6f 73 6c 65 + 65 70 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 20 64 72 6f 70 20 30 20 65 78 69 74 20 + 7d 20 69 66 0a + + ~ " dup s" sys-sigaction" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 73 79 73 2d 73 69 67 + 61 63 74 69 6f 6e 22 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d 32 20 + 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" sys-sigaltstack" stringcmp 0 = { drop -1 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 73 79 73 2d 73 69 67 + 61 6c 74 73 74 61 63 6b 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 2d + 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" allocate-sigaction" stringcmp 0 = { drop 1 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 61 6c 6c 6f 63 61 74 + 65 2d 73 69 67 61 63 74 69 6f 6e 22 20 73 74 72 + 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f + 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" sigaction-action" stringcmp 0 = { drop 0 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 73 69 67 61 63 74 69 + 6f 6e 2d 61 63 74 69 6f 6e 22 20 73 74 72 69 6e + 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 + 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" sigaction-flags" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 73 69 67 61 63 74 69 + 6f 6e 2d 66 6c 61 67 73 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 30 + 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" sigaction-restorer" stringcmp 0 = { drop 0 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 73 69 67 61 63 74 69 + 6f 6e 2d 72 65 73 74 6f 72 65 72 22 20 73 74 72 + 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f + 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" sigaction-mask" stringcmp 0 = { drop 0 exit } if" + 20 20 64 75 70 20 73 22 20 73 69 67 61 63 74 69 + 6f 6e 2d 6d 61 73 6b 22 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 30 20 + 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" allocate-sigaltstack" stringcmp 0 = { drop 1 exit" + ~ " } if" + 20 20 64 75 70 20 73 22 20 61 6c 6c 6f 63 61 74 + 65 2d 73 69 67 61 6c 74 73 74 61 63 6b 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" sigaltstack-pointer" stringcmp 0 = { drop 0 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 73 69 67 61 6c 74 73 + 74 61 63 6b 2d 70 6f 69 6e 74 65 72 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" sigaltstack-flags" stringcmp 0 = { drop 0 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 73 69 67 61 6c 74 73 + 74 61 63 6b 2d 66 6c 61 67 73 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" sigaltstack-size" stringcmp 0 = { drop 0 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 73 69 67 61 6c 74 73 + 74 61 63 6b 2d 73 69 7a 65 22 20 73 74 72 69 6e + 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 + 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" prepare-signal-stack" stringcmp 0 = { drop 0 exit" + ~ " } if" + 20 20 64 75 70 20 73 22 20 70 72 65 70 61 72 65 + 2d 73 69 67 6e 61 6c 2d 73 74 61 63 6b 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " ~ The following is a deliberate omission:" + ~ " signal-return-trampoline." + 20 20 7e 20 20 20 54 68 65 20 66 6f 6c 6c 6f 77 + 69 6e 67 20 69 73 20 61 20 64 65 6c 69 62 65 72 + 61 74 65 20 6f 6d 69 73 73 69 6f 6e 3a 20 73 69 + 67 6e 61 6c 2d 72 65 74 75 72 6e 2d 74 72 61 6d + 70 6f 6c 69 6e 65 2e 0a + + ~ " dup s" wrap-signal-handler" stringcmp 0 = { drop 0 exit }" + ~ " if" + 20 20 64 75 70 20 73 22 20 77 72 61 70 2d 73 69 + 67 6e 61 6c 2d 68 61 6e 64 6c 65 72 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" bind-signal" stringcmp 0 = { drop -2 exit } if" + 20 20 64 75 70 20 73 22 20 62 69 6e 64 2d 73 69 + 67 6e 61 6c 22 20 73 74 72 69 6e 67 63 6d 70 20 + 30 20 3d 20 7b 20 64 72 6f 70 20 2d 32 20 65 78 + 69 74 20 7d 20 69 66 0a + + ~ " ~ The following is a deliberate omission:" + ~ " handle-crash." + 20 20 7e 20 20 20 54 68 65 20 66 6f 6c 6c 6f 77 + 69 6e 67 20 69 73 20 61 20 64 65 6c 69 62 65 72 + 61 74 65 20 6f 6d 69 73 73 69 6f 6e 3a 20 68 61 + 6e 64 6c 65 2d 63 72 61 73 68 2e 0a + + ~ " dup s" install-crash-handler" stringcmp 0 = { drop 0 exit" + ~ " } if" + 20 20 64 75 70 20 73 22 20 69 6e 73 74 61 6c 6c + 2d 63 72 61 73 68 2d 68 61 6e 64 6c 65 72 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 64 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ "" + 0a + + ~ " ~ Created by warm-start in compilation/execution.e." + 20 20 7e 20 43 72 65 61 74 65 64 20 62 79 20 77 + 61 72 6d 2d 73 74 61 72 74 20 69 6e 20 63 6f 6d + 70 69 6c 61 74 69 6f 6e 2f 65 78 65 63 75 74 69 + 6f 6e 2e 65 2e 0a + + ~ " dup s" log" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 6c 6f 67 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" s0" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 73 30 22 20 73 74 72 + 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f + 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" r0" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 72 30 22 20 73 74 72 + 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 6f + 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" latest" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 6c 61 74 65 73 74 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" here" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 68 65 72 65 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 + 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ Word not provided statically, but used during the" + ~ " log-load routine anyway." + 20 20 7e 20 57 6f 72 64 20 6e 6f 74 20 70 72 6f + 76 69 64 65 64 20 73 74 61 74 69 63 61 6c 6c 79 + 2c 20 62 75 74 20 75 73 65 64 20 64 75 72 69 6e + 67 20 74 68 65 20 6c 6f 67 2d 6c 6f 61 64 20 72 + 6f 75 74 69 6e 65 20 61 6e 79 77 61 79 2e 0a + + ~ " dup s" L@'" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 4c 40 27 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" L!'" stringcmp 0 = { drop -1 exit } if" + 20 20 64 75 70 20 73 22 20 4c 21 27 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 64 72 + 6f 70 20 2d 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " dup s" labels" stringcmp 0 = { drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 6c 61 62 65 6c 73 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 64 72 6f 70 20 31 20 65 78 69 74 20 7d 20 69 + 66 0a + + ~ " dup s" allocate-transformation-state" stringcmp 0 = {" + ~ " drop 1 exit } if" + 20 20 64 75 70 20 73 22 20 61 6c 6c 6f 63 61 74 + 65 2d 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 22 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 20 64 72 6f 70 20 31 20 65 + 78 69 74 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ If we get here, that's a problem. Emit an error" + ~ " message to make sure" + 20 20 7e 20 20 20 49 66 20 77 65 20 67 65 74 20 + 68 65 72 65 2c 20 74 68 61 74 27 73 20 61 20 70 + 72 6f 62 6c 65 6d 2e 20 45 6d 69 74 20 61 6e 20 + 65 72 72 6f 72 20 6d 65 73 73 61 67 65 20 74 6f + 20 6d 61 6b 65 20 73 75 72 65 0a + + ~ " ~ it's easy to diagnose. We also return a comically large" + ~ " negative value," + 20 20 7e 20 69 74 27 73 20 65 61 73 79 20 74 6f + 20 64 69 61 67 6e 6f 73 65 2e 20 57 65 20 61 6c + 73 6f 20 72 65 74 75 72 6e 20 61 20 63 6f 6d 69 + 63 61 6c 6c 79 20 6c 61 72 67 65 20 6e 65 67 61 + 74 69 76 65 20 76 61 6c 75 65 2c 0a + + ~ " ~ to make sure things fail as quickly as possible" + ~ " afterwards." + 20 20 7e 20 74 6f 20 6d 61 6b 65 20 73 75 72 65 + 20 74 68 69 6e 67 73 20 66 61 69 6c 20 61 73 20 + 71 75 69 63 6b 6c 79 20 61 73 20 70 6f 73 73 69 + 62 6c 65 20 61 66 74 65 72 77 61 72 64 73 2e 0a + + ~ " ." No known stack delta: " emitstring newline" + 20 20 2e 22 20 4e 6f 20 6b 6e 6f 77 6e 20 73 74 + 61 63 6b 20 64 65 6c 74 61 3a 20 22 20 65 6d 69 + 74 73 74 72 69 6e 67 20 6e 65 77 6c 69 6e 65 0a + + ~ " -256 ;" + 20 20 2d 32 35 36 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ (delta --)" + 7e 20 28 64 65 6c 74 61 20 2d 2d 29 0a + + ~ ": transform-apply-stack-delta" + 3a 20 74 72 61 6e 73 66 6f 72 6d 2d 61 70 70 6c + 79 2d 73 74 61 63 6b 2d 64 65 6c 74 61 0a + + ~ " transformation-state" + ~ " transformation-state-user-stack-depth @ +" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 75 73 65 72 + 2d 73 74 61 63 6b 2d 64 65 70 74 68 20 40 20 2b + 0a + + ~ " transformation-state" + ~ " transformation-state-user-stack-depth ! ;" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 75 73 65 72 + 2d 73 74 61 63 6b 2d 64 65 70 74 68 20 21 20 3b + 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Label transform implementation" + 7e 20 4c 61 62 65 6c 20 74 72 61 6e 73 66 6f 72 + 6d 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e + 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 0a + + ~ "~" + 7e 0a + + ~ "~ The following code is all part of implementing the" + ~ " label transform. For" + 7e 20 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e + 67 20 63 6f 64 65 20 69 73 20 61 6c 6c 20 70 61 + 72 74 20 6f 66 20 69 6d 70 6c 65 6d 65 6e 74 69 + 6e 67 20 74 68 65 20 6c 61 62 65 6c 20 74 72 61 + 6e 73 66 6f 72 6d 2e 20 46 6f 72 0a + + ~ "~ conceptual overview, see the top of this file." + 7e 20 63 6f 6e 63 65 70 74 75 61 6c 20 6f 76 65 + 72 76 69 65 77 2c 20 73 65 65 20 74 68 65 20 74 + 6f 70 20 6f 66 20 74 68 69 73 20 66 69 6c 65 2e + 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This is the alternate version of "create" for use with" + ~ " the label" + 7e 20 20 20 54 68 69 73 20 69 73 20 74 68 65 20 + 61 6c 74 65 72 6e 61 74 65 20 76 65 72 73 69 6f + 6e 20 6f 66 20 22 63 72 65 61 74 65 22 20 66 6f + 72 20 75 73 65 20 77 69 74 68 20 74 68 65 20 6c + 61 62 65 6c 0a + + ~ "~ transform. Its code is the same as the regular "create"" + ~ " except as noted" + 7e 20 74 72 61 6e 73 66 6f 72 6d 2e 20 49 74 73 + 20 63 6f 64 65 20 69 73 20 74 68 65 20 73 61 6d + 65 20 61 73 20 74 68 65 20 72 65 67 75 6c 61 72 + 20 22 63 72 65 61 74 65 22 20 65 78 63 65 70 74 + 20 61 73 20 6e 6f 74 65 64 0a + + ~ "~ below. It is likely to be extremely useful to read and" + ~ " understand "create"" + 7e 20 62 65 6c 6f 77 2e 20 49 74 20 69 73 20 6c + 69 6b 65 6c 79 20 74 6f 20 62 65 20 65 78 74 72 + 65 6d 65 6c 79 20 75 73 65 66 75 6c 20 74 6f 20 + 72 65 61 64 20 61 6e 64 20 75 6e 64 65 72 73 74 + 61 6e 64 20 22 63 72 65 61 74 65 22 0a + + ~ "~ in language/dynamic/dynamic.e before attempting to" + ~ " understand" + 7e 20 69 6e 20 6c 61 6e 67 75 61 67 65 2f 64 79 + 6e 61 6d 69 63 2f 64 79 6e 61 6d 69 63 2e 65 20 + 62 65 66 6f 72 65 20 61 74 74 65 6d 70 74 69 6e + 67 20 74 6f 20 75 6e 64 65 72 73 74 61 6e 64 0a + + ~ "~ label-create-alternate." + 7e 20 6c 61 62 65 6c 2d 63 72 65 61 74 65 2d 61 + 6c 74 65 72 6e 61 74 65 2e 0a + + ~ ": label-create-alternate" + 3a 20 6c 61 62 65 6c 2d 63 72 65 61 74 65 2d 61 + 6c 74 65 72 6e 61 74 65 0a + + ~ " ~ While we could put magic comments here, and be" + ~ " guaranteed to catch every" + 20 20 7e 20 20 20 57 68 69 6c 65 20 77 65 20 63 + 6f 75 6c 64 20 70 75 74 20 6d 61 67 69 63 20 63 + 6f 6d 6d 65 6e 74 73 20 68 65 72 65 2c 20 61 6e + 64 20 62 65 20 67 75 61 72 61 6e 74 65 65 64 20 + 74 6f 20 63 61 74 63 68 20 65 76 65 72 79 0a + + ~ " ~ word-defining word under the label transform, there's a" + ~ " subtle thing where" + 20 20 7e 20 77 6f 72 64 2d 64 65 66 69 6e 69 6e + 67 20 77 6f 72 64 20 75 6e 64 65 72 20 74 68 65 + 20 6c 61 62 65 6c 20 74 72 61 6e 73 66 6f 72 6d + 2c 20 74 68 65 72 65 27 73 20 61 20 73 75 62 74 + 6c 65 20 74 68 69 6e 67 20 77 68 65 72 65 0a + + ~ " ~ we need to make sure the "indent" command happens in" + ~ " the same places it" + 20 20 7e 20 77 65 20 6e 65 65 64 20 74 6f 20 6d + 61 6b 65 20 73 75 72 65 20 74 68 65 20 22 69 6e + 64 65 6e 74 22 20 63 6f 6d 6d 61 6e 64 20 68 61 + 70 70 65 6e 73 20 69 6e 20 74 68 65 20 73 61 6d + 65 20 70 6c 61 63 65 73 20 69 74 0a + + ~ " ~ does when the same code runs under the log-load" + ~ " transform, and only those" + 20 20 7e 20 64 6f 65 73 20 77 68 65 6e 20 74 68 + 65 20 73 61 6d 65 20 63 6f 64 65 20 72 75 6e 73 + 20 75 6e 64 65 72 20 74 68 65 20 6c 6f 67 2d 6c + 6f 61 64 20 74 72 61 6e 73 66 6f 72 6d 2c 20 61 + 6e 64 20 6f 6e 6c 79 20 74 68 6f 73 65 0a + + ~ " ~ places. So, we do it in the callers of "create"" + ~ " instead." + 20 20 7e 20 70 6c 61 63 65 73 2e 20 53 6f 2c 20 + 77 65 20 64 6f 20 69 74 20 69 6e 20 74 68 65 20 + 63 61 6c 6c 65 72 73 20 6f 66 20 22 63 72 65 61 + 74 65 22 20 69 6e 73 74 65 61 64 2e 0a + + ~ " dup stringlen 1 +" + 20 20 64 75 70 20 73 74 72 69 6e 67 6c 65 6e 20 + 31 20 2b 0a + + ~ " ~ : provide-data" + 20 20 7e 20 3a 20 70 72 6f 76 69 64 65 2d 64 61 + 74 61 0a + + ~ " dup 3unroll" + 20 20 64 75 70 20 33 75 6e 72 6f 6c 6c 0a + + ~ " here @ 10 + swap memmove" + 20 20 68 65 72 65 20 40 20 31 30 20 2b 20 73 77 + 61 70 20 6d 65 6d 6d 6f 76 65 0a + + ~ " here @" + 20 20 68 65 72 65 20 40 0a + + ~ "" + 0a + + ~ " ~ This value of "latest" is going into the generated" + ~ " output, so we need" + 20 20 7e 20 20 20 54 68 69 73 20 76 61 6c 75 65 + 20 6f 66 20 22 6c 61 74 65 73 74 22 20 69 73 20 + 67 6f 69 6e 67 20 69 6e 74 6f 20 74 68 65 20 67 + 65 6e 65 72 61 74 65 64 20 6f 75 74 70 75 74 2c + 20 73 6f 20 77 65 20 6e 65 65 64 0a + + ~ " ~ to map it to the target address space. It's stored in" + ~ " the host address" + 20 20 7e 20 74 6f 20 6d 61 70 20 69 74 20 74 6f + 20 74 68 65 20 74 61 72 67 65 74 20 61 64 64 72 + 65 73 73 20 73 70 61 63 65 2e 20 49 74 27 73 20 + 73 74 6f 72 65 64 20 69 6e 20 74 68 65 20 68 6f + 73 74 20 61 64 64 72 65 73 73 0a + + ~ " ~ space to make immediate words work as expected, so the" + ~ " appropriate" + 20 20 7e 20 73 70 61 63 65 20 74 6f 20 6d 61 6b + 65 20 69 6d 6d 65 64 69 61 74 65 20 77 6f 72 64 + 73 20 77 6f 72 6b 20 61 73 20 65 78 70 65 63 74 + 65 64 2c 20 73 6f 20 74 68 65 20 61 70 70 72 6f + 70 72 69 61 74 65 0a + + ~ " ~ conversion is host-address-space-to-target." + 20 20 7e 20 63 6f 6e 76 65 72 73 69 6f 6e 20 69 + 73 20 68 6f 73 74 2d 61 64 64 72 65 73 73 2d 73 + 70 61 63 65 2d 74 6f 2d 74 61 72 67 65 74 2e 0a + + ~ " ~ : 8 #-- (previous entry pointer)" + 20 20 7e 20 3a 20 38 20 23 2d 2d 20 28 70 72 65 + 76 69 6f 75 73 20 65 6e 74 72 79 20 70 6f 69 6e + 74 65 72 29 0a + + ~ " latest @ host-address-space-to-target pack64" + 20 20 6c 61 74 65 73 74 20 40 20 68 6f 73 74 2d + 61 64 64 72 65 73 73 2d 73 70 61 63 65 2d 74 6f + 2d 74 61 72 67 65 74 20 70 61 63 6b 36 34 0a + + ~ " ~ : 1 #-- (entry flags)" + 20 20 7e 20 3a 20 31 20 23 2d 2d 20 28 65 6e 74 + 72 79 20 66 6c 61 67 73 29 0a + + ~ " 0 pack8" + 20 20 30 20 70 61 63 6b 38 0a + + ~ " ~ : bidirectional-null-terminated entry name" + 20 20 7e 20 3a 20 62 69 64 69 72 65 63 74 69 6f + 6e 61 6c 2d 6e 75 6c 6c 2d 74 65 72 6d 69 6e 61 + 74 65 64 20 65 6e 74 72 79 20 6e 61 6d 65 0a + + ~ " 0 pack8" + 20 20 30 20 70 61 63 6b 38 0a + + ~ " ~ : 1 data-adjust-output-point" + 20 20 7e 20 3a 20 31 20 64 61 74 61 2d 61 64 6a + 75 73 74 2d 6f 75 74 70 75 74 2d 70 6f 69 6e 74 + 0a + + ~ " ~ : fresh-line" + 20 20 7e 20 3a 20 66 72 65 73 68 2d 6c 69 6e 65 + 0a + + ~ " +" + 20 20 2b 0a + + ~ " 8 packalign" + 20 20 38 20 70 61 63 6b 61 6c 69 67 6e 0a + + ~ " here @ latest !" + 20 20 68 65 72 65 20 40 20 6c 61 74 65 73 74 20 + 21 0a + + ~ "" + 0a + + ~ " ~ Now we're immediately after the word header, which is" + ~ " where the codeword" + 20 20 7e 20 20 20 4e 6f 77 20 77 65 27 72 65 20 + 69 6d 6d 65 64 69 61 74 65 6c 79 20 61 66 74 65 + 72 20 74 68 65 20 77 6f 72 64 20 68 65 61 64 65 + 72 2c 20 77 68 69 63 68 20 69 73 20 77 68 65 72 + 65 20 74 68 65 20 63 6f 64 65 77 6f 72 64 0a + + ~ " ~ will be. This is the value the label should taken on," + ~ " so we set it." + 20 20 7e 20 77 69 6c 6c 20 62 65 2e 20 54 68 69 + 73 20 69 73 20 74 68 65 20 76 61 6c 75 65 20 74 + 68 65 20 6c 61 62 65 6c 20 73 68 6f 75 6c 64 20 + 74 61 6b 65 6e 20 6f 6e 2c 20 73 6f 20 77 65 20 + 73 65 74 20 69 74 2e 0a + + ~ " dup host-address-space-to-offset" + 20 20 64 75 70 20 68 6f 73 74 2d 61 64 64 72 65 + 73 73 2d 73 70 61 63 65 2d 74 6f 2d 6f 66 66 73 + 65 74 0a + + ~ " here @ 10 +" + 20 20 68 65 72 65 20 40 20 31 30 20 2b 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " intern-label set-label" + 20 20 69 6e 74 65 72 6e 2d 6c 61 62 65 6c 20 73 + 65 74 2d 6c 61 62 65 6c 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " here ! ;" + 20 20 68 65 72 65 20 21 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This is the alternate version of ":" for use with the" + ~ " label transform. Its" + 7e 20 20 20 54 68 69 73 20 69 73 20 74 68 65 20 + 61 6c 74 65 72 6e 61 74 65 20 76 65 72 73 69 6f + 6e 20 6f 66 20 22 3a 22 20 66 6f 72 20 75 73 65 + 20 77 69 74 68 20 74 68 65 20 6c 61 62 65 6c 20 + 74 72 61 6e 73 66 6f 72 6d 2e 20 49 74 73 0a + + ~ "~ code is the same as the regular "create" except as noted" + ~ " below. It is likely" + 7e 20 63 6f 64 65 20 69 73 20 74 68 65 20 73 61 + 6d 65 20 61 73 20 74 68 65 20 72 65 67 75 6c 61 + 72 20 22 63 72 65 61 74 65 22 20 65 78 63 65 70 + 74 20 61 73 20 6e 6f 74 65 64 20 62 65 6c 6f 77 + 2e 20 49 74 20 69 73 20 6c 69 6b 65 6c 79 0a + + ~ "~ to be extremely useful to read and understand ":" in" + 7e 20 74 6f 20 62 65 20 65 78 74 72 65 6d 65 6c + 79 20 75 73 65 66 75 6c 20 74 6f 20 72 65 61 64 + 20 61 6e 64 20 75 6e 64 65 72 73 74 61 6e 64 20 + 22 3a 22 20 69 6e 0a + + ~ "~ language/dynamic/dynamic.e before attempting to" + ~ " understand" + 7e 20 6c 61 6e 67 75 61 67 65 2f 64 79 6e 61 6d + 69 63 2f 64 79 6e 61 6d 69 63 2e 65 20 62 65 66 + 6f 72 65 20 61 74 74 65 6d 70 74 69 6e 67 20 74 + 6f 20 75 6e 64 65 72 73 74 61 6e 64 0a + + ~ "~ label-colon-alternate." + 7e 20 6c 61 62 65 6c 2d 63 6f 6c 6f 6e 2d 61 6c + 74 65 72 6e 61 74 65 2e 0a + + ~ ": label-colon-alternate" + 3a 20 6c 61 62 65 6c 2d 63 6f 6c 6f 6e 2d 61 6c + 74 65 72 6e 61 74 65 0a + + ~ " ~ This calls label-create-alternate instead of "create"." + 20 20 7e 20 54 68 69 73 20 63 61 6c 6c 73 20 6c + 61 62 65 6c 2d 63 72 65 61 74 65 2d 61 6c 74 65 + 72 6e 61 74 65 20 69 6e 73 74 65 61 64 20 6f 66 + 20 22 63 72 65 61 74 65 22 2e 0a + + ~ " word value@" + 20 20 77 6f 72 64 20 76 61 6c 75 65 40 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : provide-string-copy" + 20 20 7e 20 3a 20 70 72 6f 76 69 64 65 2d 73 74 + 72 69 6e 67 2d 63 6f 70 79 0a + + ~ " ~ : # is defined here via the label transform; this is" + ~ " its entry header." + 20 20 7e 20 3a 20 23 20 69 73 20 64 65 66 69 6e + 65 64 20 68 65 72 65 20 76 69 61 20 74 68 65 20 + 6c 61 62 65 6c 20 74 72 61 6e 73 66 6f 72 6d 3b + 20 74 68 69 73 20 69 73 20 69 74 73 20 65 6e 74 + 72 79 20 68 65 61 64 65 72 2e 0a + + ~ " ~ : indent" + 20 20 7e 20 3a 20 69 6e 64 65 6e 74 0a + + ~ " label-create-alternate dropstring" + 20 20 6c 61 62 65 6c 2d 63 72 65 61 74 65 2d 61 + 6c 74 65 72 6e 61 74 65 20 64 72 6f 70 73 74 72 + 69 6e 67 0a + + ~ "" + 0a + + ~ " ~ This looks up "docol" by label." + 20 20 7e 20 54 68 69 73 20 6c 6f 6f 6b 73 20 75 + 70 20 22 64 6f 63 6f 6c 22 20 62 79 20 6c 61 62 + 65 6c 2e 0a + + ~ " ~ : 8 #-- (docol codeword)" + 20 20 7e 20 3a 20 38 20 23 2d 2d 20 28 64 6f 63 + 6f 6c 20 63 6f 64 65 77 6f 72 64 29 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' docol-codeword-value" + 20 20 4c 40 27 20 64 6f 63 6f 6c 2d 63 6f 64 65 + 77 6f 72 64 2d 76 61 6c 75 65 0a + + ~ " L@' origin" + 20 20 4c 40 27 20 6f 72 69 67 69 6e 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " + ," + 20 20 2b 20 2c 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ "" + 0a + + ~ " latest @ dup entry-flags@ 0x80 | swap entry-flags!" + 20 20 6c 61 74 65 73 74 20 40 20 64 75 70 20 65 + 6e 74 72 79 2d 66 6c 61 67 73 40 20 30 78 38 30 + 20 7c 20 73 77 61 70 20 65 6e 74 72 79 2d 66 6c + 61 67 73 21 0a + + ~ " ] ;" + 20 20 5d 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ So, the way docol's user-facing entry is set up in" + ~ " language/static/core.e," + 7e 20 20 20 53 6f 2c 20 74 68 65 20 77 61 79 20 + 64 6f 63 6f 6c 27 73 20 75 73 65 72 2d 66 61 63 + 69 6e 67 20 65 6e 74 72 79 20 69 73 20 73 65 74 + 20 75 70 20 69 6e 20 6c 61 6e 67 75 61 67 65 2f + 73 74 61 74 69 63 2f 63 6f 72 65 2e 65 2c 0a + + ~ "~ it really wants to reference "here" to create its" + ~ " codeword, but "here" is in" + 7e 20 69 74 20 72 65 61 6c 6c 79 20 77 61 6e 74 + 73 20 74 6f 20 72 65 66 65 72 65 6e 63 65 20 22 + 68 65 72 65 22 20 74 6f 20 63 72 65 61 74 65 20 + 69 74 73 20 63 6f 64 65 77 6f 72 64 2c 20 62 75 + 74 20 22 68 65 72 65 22 20 69 73 20 69 6e 0a + + ~ "~ the host address space. We solve this by having it call" + ~ " the word" + 7e 20 74 68 65 20 68 6f 73 74 20 61 64 64 72 65 + 73 73 20 73 70 61 63 65 2e 20 57 65 20 73 6f 6c + 76 65 20 74 68 69 73 20 62 79 20 68 61 76 69 6e + 67 20 69 74 20 63 61 6c 6c 20 74 68 65 20 77 6f + 72 64 0a + + ~ "~ "self-codeword" and then patching around the address" + ~ " space issue with" + 7e 20 22 73 65 6c 66 2d 63 6f 64 65 77 6f 72 64 + 22 20 61 6e 64 20 74 68 65 6e 20 70 61 74 63 68 + 69 6e 67 20 61 72 6f 75 6e 64 20 74 68 65 20 61 + 64 64 72 65 73 73 20 73 70 61 63 65 20 69 73 73 + 75 65 20 77 69 74 68 0a + + ~ "~ alternates." + 7e 20 61 6c 74 65 72 6e 61 74 65 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ If we didn't have this fix, everything would appear to" + ~ " work fine but the" + 7e 20 20 20 49 66 20 77 65 20 64 69 64 6e 27 74 + 20 68 61 76 65 20 74 68 69 73 20 66 69 78 2c 20 + 65 76 65 72 79 74 68 69 6e 67 20 77 6f 75 6c 64 + 20 61 70 70 65 61 72 20 74 6f 20 77 6f 72 6b 20 + 66 69 6e 65 20 62 75 74 20 74 68 65 0a + + ~ "~ statically generated user-facing docol from the label" + ~ " transform would have" + 7e 20 73 74 61 74 69 63 61 6c 6c 79 20 67 65 6e + 65 72 61 74 65 64 20 75 73 65 72 2d 66 61 63 69 + 6e 67 20 64 6f 63 6f 6c 20 66 72 6f 6d 20 74 68 + 65 20 6c 61 62 65 6c 20 74 72 61 6e 73 66 6f 72 + 6d 20 77 6f 75 6c 64 20 68 61 76 65 0a + + ~ "~ a wrong codeword, varying based on the host's memory" + ~ " usage. It's never" + 7e 20 61 20 77 72 6f 6e 67 20 63 6f 64 65 77 6f + 72 64 2c 20 76 61 72 79 69 6e 67 20 62 61 73 65 + 64 20 6f 6e 20 74 68 65 20 68 6f 73 74 27 73 20 + 6d 65 6d 6f 72 79 20 75 73 61 67 65 2e 20 49 74 + 27 73 20 6e 65 76 65 72 0a + + ~ "~ actually called by evoke itself (it would crash" + ~ " horribly), though it may" + 7e 20 61 63 74 75 61 6c 6c 79 20 63 61 6c 6c 65 + 64 20 62 79 20 65 76 6f 6b 65 20 69 74 73 65 6c + 66 20 28 69 74 20 77 6f 75 6c 64 20 63 72 61 73 + 68 20 68 6f 72 72 69 62 6c 79 29 2c 20 74 68 6f + 75 67 68 20 69 74 20 6d 61 79 0a + + ~ "~ be from programs that use the facilities differently." + ~ " It's a binary" + 7e 20 62 65 20 66 72 6f 6d 20 70 72 6f 67 72 61 + 6d 73 20 74 68 61 74 20 75 73 65 20 74 68 65 20 + 66 61 63 69 6c 69 74 69 65 73 20 64 69 66 66 65 + 72 65 6e 74 6c 79 2e 20 49 74 27 73 20 61 20 62 + 69 6e 61 72 79 0a + + ~ "~ reproducibility issue - our only known one, in fact - so" + ~ " it's worth fixing." + 7e 20 72 65 70 72 6f 64 75 63 69 62 69 6c 69 74 + 79 20 69 73 73 75 65 20 2d 20 6f 75 72 20 6f 6e + 6c 79 20 6b 6e 6f 77 6e 20 6f 6e 65 2c 20 69 6e + 20 66 61 63 74 20 2d 20 73 6f 20 69 74 27 73 20 + 77 6f 72 74 68 20 66 69 78 69 6e 67 2e 0a + + ~ ": label-self-codeword-alternate" + 3a 20 6c 61 62 65 6c 2d 73 65 6c 66 2d 63 6f 64 + 65 77 6f 72 64 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ " here @ dup 8 + host-address-space-to-target pack64 here" + ~ " !" + 20 20 68 65 72 65 20 40 20 64 75 70 20 38 20 2b + 20 68 6f 73 74 2d 61 64 64 72 65 73 73 2d 73 70 + 61 63 65 2d 74 6f 2d 74 61 72 67 65 74 20 70 61 + 63 6b 36 34 20 68 65 72 65 20 21 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This is the alternate version of ";" for use with the" + ~ " label transform. Its" + 7e 20 20 20 54 68 69 73 20 69 73 20 74 68 65 20 + 61 6c 74 65 72 6e 61 74 65 20 76 65 72 73 69 6f + 6e 20 6f 66 20 22 3b 22 20 66 6f 72 20 75 73 65 + 20 77 69 74 68 20 74 68 65 20 6c 61 62 65 6c 20 + 74 72 61 6e 73 66 6f 72 6d 2e 20 49 74 73 0a + + ~ "~ code is the same as the regular "create" except as noted" + ~ " below. It is likely" + 7e 20 63 6f 64 65 20 69 73 20 74 68 65 20 73 61 + 6d 65 20 61 73 20 74 68 65 20 72 65 67 75 6c 61 + 72 20 22 63 72 65 61 74 65 22 20 65 78 63 65 70 + 74 20 61 73 20 6e 6f 74 65 64 20 62 65 6c 6f 77 + 2e 20 49 74 20 69 73 20 6c 69 6b 65 6c 79 0a + + ~ "~ to be extremely useful to read and understand ";" in" + 7e 20 74 6f 20 62 65 20 65 78 74 72 65 6d 65 6c + 79 20 75 73 65 66 75 6c 20 74 6f 20 72 65 61 64 + 20 61 6e 64 20 75 6e 64 65 72 73 74 61 6e 64 20 + 22 3b 22 20 69 6e 0a + + ~ "~ language/dynamic/dynamic.e before attempting to" + ~ " understand" + 7e 20 6c 61 6e 67 75 61 67 65 2f 64 79 6e 61 6d + 69 63 2f 64 79 6e 61 6d 69 63 2e 65 20 62 65 66 + 6f 72 65 20 61 74 74 65 6d 70 74 69 6e 67 20 74 + 6f 20 75 6e 64 65 72 73 74 61 6e 64 0a + + ~ "~ label-semicolon-alternate." + 7e 20 6c 61 62 65 6c 2d 73 65 6d 69 63 6f 6c 6f + 6e 2d 61 6c 74 65 72 6e 61 74 65 2e 0a + + ~ ": label-semicolon-alternate" + 3a 20 6c 61 62 65 6c 2d 73 65 6d 69 63 6f 6c 6f + 6e 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ " ~ This looks up "exit" by label." + 20 20 7e 20 54 68 69 73 20 6c 6f 6f 6b 73 20 75 + 70 20 22 65 78 69 74 22 20 62 79 20 6c 61 62 65 + 6c 2e 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' exit" + 20 20 4c 40 27 20 65 78 69 74 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " offset-to-target-address-space , ~ : -8 exit #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 65 78 + 69 74 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 + 20 70 6f 69 6e 74 65 72 29 0a + + ~ " ~ : deindent" + 20 20 7e 20 3a 20 64 65 69 6e 64 65 6e 74 0a + + ~ "" + 0a + + ~ " latest @ dup entry-flags@ 0x80 invert & swap" + ~ " entry-flags!" + 20 20 6c 61 74 65 73 74 20 40 20 64 75 70 20 65 + 6e 74 72 79 2d 66 6c 61 67 73 40 20 30 78 38 30 + 20 69 6e 76 65 72 74 20 26 20 73 77 61 70 20 65 + 6e 74 72 79 2d 66 6c 61 67 73 21 0a + + ~ "" + 0a + + ~ " ~ Since [ is an immediate word, we have to go to extra" + ~ " trouble to compile" + 20 20 7e 20 20 20 53 69 6e 63 65 20 5b 20 69 73 + 20 61 6e 20 69 6d 6d 65 64 69 61 74 65 20 77 6f + 72 64 2c 20 77 65 20 68 61 76 65 20 74 6f 20 67 + 6f 20 74 6f 20 65 78 74 72 61 20 74 72 6f 75 62 + 6c 65 20 74 6f 20 63 6f 6d 70 69 6c 65 0a + + ~ " ~ it as part of ;." + 20 20 7e 20 69 74 20 61 73 20 70 61 72 74 20 6f + 66 20 3b 2e 0a + + ~ " [ ' [ entry-to-execution-token , ]" + 20 20 5b 20 27 20 5b 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 2c 20 5d 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This is the alternate version of ";asm" for use with" + ~ " the label transform." + 7e 20 20 20 54 68 69 73 20 69 73 20 74 68 65 20 + 61 6c 74 65 72 6e 61 74 65 20 76 65 72 73 69 6f + 6e 20 6f 66 20 22 3b 61 73 6d 22 20 66 6f 72 20 + 75 73 65 20 77 69 74 68 20 74 68 65 20 6c 61 62 + 65 6c 20 74 72 61 6e 73 66 6f 72 6d 2e 0a + + ~ "~ Its code is the same as the regular "create" except as" + ~ " noted below. It is" + 7e 20 49 74 73 20 63 6f 64 65 20 69 73 20 74 68 + 65 20 73 61 6d 65 20 61 73 20 74 68 65 20 72 65 + 67 75 6c 61 72 20 22 63 72 65 61 74 65 22 20 65 + 78 63 65 70 74 20 61 73 20 6e 6f 74 65 64 20 62 + 65 6c 6f 77 2e 20 49 74 20 69 73 0a + + ~ "~ likely to be extremely useful to read and understand" + ~ " ";asm" in" + 7e 20 6c 69 6b 65 6c 79 20 74 6f 20 62 65 20 65 + 78 74 72 65 6d 65 6c 79 20 75 73 65 66 75 6c 20 + 74 6f 20 72 65 61 64 20 61 6e 64 20 75 6e 64 65 + 72 73 74 61 6e 64 20 22 3b 61 73 6d 22 20 69 6e + 0a + + ~ "~ language/dynamic/dynamic.e before attempting to" + ~ " understand" + 7e 20 6c 61 6e 67 75 61 67 65 2f 64 79 6e 61 6d + 69 63 2f 64 79 6e 61 6d 69 63 2e 65 20 62 65 66 + 6f 72 65 20 61 74 74 65 6d 70 74 69 6e 67 20 74 + 6f 20 75 6e 64 65 72 73 74 61 6e 64 0a + + ~ "~ label-semicolon-assembly-alternate." + 7e 20 6c 61 62 65 6c 2d 73 65 6d 69 63 6f 6c 6f + 6e 2d 61 73 73 65 6d 62 6c 79 2d 61 6c 74 65 72 + 6e 61 74 65 2e 0a + + ~ ": label-semicolon-assembly-alternate" + 3a 20 6c 61 62 65 6c 2d 73 65 6d 69 63 6f 6c 6f + 6e 2d 61 73 73 65 6d 62 6c 79 2d 61 6c 74 65 72 + 6e 61 74 65 0a + + ~ " here @ pack-next 8 packalign" + 20 20 68 65 72 65 20 40 20 70 61 63 6b 2d 6e 65 + 78 74 20 38 20 70 61 63 6b 61 6c 69 67 6e 0a + + ~ " ~ : provide-data" + 20 20 7e 20 3a 20 70 72 6f 76 69 64 65 2d 64 61 + 74 61 0a + + ~ " here !" + 20 20 68 65 72 65 20 21 0a + + ~ " ~ : deindent" + 20 20 7e 20 3a 20 64 65 69 6e 64 65 6e 74 0a + + ~ "" + 0a + + ~ " latest @ dup dup entry-flags@ 0x80 invert & swap" + ~ " entry-flags!" + 20 20 6c 61 74 65 73 74 20 40 20 64 75 70 20 64 + 75 70 20 65 6e 74 72 79 2d 66 6c 61 67 73 40 20 + 30 78 38 30 20 69 6e 76 65 72 74 20 26 20 73 77 + 61 70 20 65 6e 74 72 79 2d 66 6c 61 67 73 21 0a + + ~ " entry-to-execution-token" + 20 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 0a + + ~ " ~ The codeword needs to be transformed to the target" + ~ " address space." + 20 20 7e 20 54 68 65 20 63 6f 64 65 77 6f 72 64 + 20 6e 65 65 64 73 20 74 6f 20 62 65 20 74 72 61 + 6e 73 66 6f 72 6d 65 64 20 74 6f 20 74 68 65 20 + 74 61 72 67 65 74 20 61 64 64 72 65 73 73 20 73 + 70 61 63 65 2e 0a + + ~ " ~ : provide-data" + 20 20 7e 20 3a 20 70 72 6f 76 69 64 65 2d 64 61 + 74 61 0a + + ~ " ~ : data-set-output-point" + 20 20 7e 20 3a 20 64 61 74 61 2d 73 65 74 2d 6f + 75 74 70 75 74 2d 70 6f 69 6e 74 0a + + ~ " ~ : delete-last-comment-at-output-point" + 20 20 7e 20 3a 20 64 65 6c 65 74 65 2d 6c 61 73 + 74 2d 63 6f 6d 6d 65 6e 74 2d 61 74 2d 6f 75 74 + 70 75 74 2d 70 6f 69 6e 74 0a + + ~ " ~ : 8 #-- (self codeword)" + 20 20 7e 20 3a 20 38 20 23 2d 2d 20 28 73 65 6c + 66 20 63 6f 64 65 77 6f 72 64 29 0a + + ~ " dup 8 + host-address-space-to-target" + 20 20 64 75 70 20 38 20 2b 20 68 6f 73 74 2d 61 + 64 64 72 65 73 73 2d 73 70 61 63 65 2d 74 6f 2d + 74 61 72 67 65 74 0a + + ~ " swap !" + 20 20 73 77 61 70 20 21 0a + + ~ " ~ : data-set-output-point" + 20 20 7e 20 3a 20 64 61 74 61 2d 73 65 74 2d 6f + 75 74 70 75 74 2d 70 6f 69 6e 74 0a + + ~ "" + 0a + + ~ " ~ Since [ is an immediate word, we have to go to extra" + ~ " trouble to compile" + 20 20 7e 20 20 20 53 69 6e 63 65 20 5b 20 69 73 + 20 61 6e 20 69 6d 6d 65 64 69 61 74 65 20 77 6f + 72 64 2c 20 77 65 20 68 61 76 65 20 74 6f 20 67 + 6f 20 74 6f 20 65 78 74 72 61 20 74 72 6f 75 62 + 6c 65 20 74 6f 20 63 6f 6d 70 69 6c 65 0a + + ~ " ~ it as part of ;asm." + 20 20 7e 20 69 74 20 61 73 20 70 61 72 74 20 6f + 66 20 3b 61 73 6d 2e 0a + + ~ " [ ' [ entry-to-execution-token , ]" + 20 20 5b 20 27 20 5b 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 2c 20 5d 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ TODO there should really be an actual word that this" + ~ " alternate is replacing" + 7e 20 54 4f 44 4f 20 74 68 65 72 65 20 73 68 6f + 75 6c 64 20 72 65 61 6c 6c 79 20 62 65 20 61 6e + 20 61 63 74 75 61 6c 20 77 6f 72 64 20 74 68 61 + 74 20 74 68 69 73 20 61 6c 74 65 72 6e 61 74 65 + 20 69 73 20 72 65 70 6c 61 63 69 6e 67 0a + + ~ "~" + 7e 0a + + ~ "~ If it existed, that word would be (string pointer --)." + 7e 20 49 66 20 69 74 20 65 78 69 73 74 65 64 2c + 20 74 68 61 74 20 77 6f 72 64 20 77 6f 75 6c 64 + 20 62 65 20 28 73 74 72 69 6e 67 20 70 6f 69 6e + 74 65 72 20 2d 2d 29 2e 0a + + ~ ": label-keyword-alternate" + 3a 20 6c 61 62 65 6c 2d 6b 65 79 77 6f 72 64 2d + 61 6c 74 65 72 6e 61 74 65 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : provide-string-copy" + 20 20 7e 20 3a 20 70 72 6f 76 69 64 65 2d 73 74 + 72 69 6e 67 2d 63 6f 70 79 0a + + ~ " ~ : # is defined here via the label transform; this is" + ~ " its entry header." + 20 20 7e 20 3a 20 23 20 69 73 20 64 65 66 69 6e + 65 64 20 68 65 72 65 20 76 69 61 20 74 68 65 20 + 6c 61 62 65 6c 20 74 72 61 6e 73 66 6f 72 6d 3b + 20 74 68 69 73 20 69 73 20 69 74 73 20 65 6e 74 + 72 79 20 68 65 61 64 65 72 2e 0a + + ~ " ~ : indent" + 20 20 7e 20 3a 20 69 6e 64 65 6e 74 0a + + ~ " label-create-alternate" + 20 20 6c 61 62 65 6c 2d 63 72 65 61 74 65 2d 61 + 6c 74 65 72 6e 61 74 65 0a + + ~ "" + 0a + + ~ " here @ dup" + 20 20 68 65 72 65 20 40 20 64 75 70 0a + + ~ " ~ (self execution token, output point)" + 20 20 7e 20 28 73 65 6c 66 20 65 78 65 63 75 74 + 69 6f 6e 20 74 6f 6b 65 6e 2c 20 6f 75 74 70 75 + 74 20 70 6f 69 6e 74 29 0a + + ~ " dup 8 + host-address-space-to-target pack64" + 20 20 64 75 70 20 38 20 2b 20 68 6f 73 74 2d 61 + 64 64 72 65 73 73 2d 73 70 61 63 65 2d 74 6f 2d + 74 61 72 67 65 74 20 70 61 63 6b 36 34 0a + + ~ " swap host-address-space-to-target :rax mov-reg64-imm64" + 20 20 73 77 61 70 20 68 6f 73 74 2d 61 64 64 72 + 65 73 73 2d 73 70 61 63 65 2d 74 6f 2d 74 61 72 + 67 65 74 20 3a 72 61 78 20 6d 6f 76 2d 72 65 67 + 36 34 2d 69 6d 6d 36 34 0a + + ~ " ~ (output point)" + 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f 69 6e + 74 29 0a + + ~ " :rax push-reg64" + 20 20 3a 72 61 78 20 70 75 73 68 2d 72 65 67 36 + 34 0a + + ~ " pack-next" + 20 20 70 61 63 6b 2d 6e 65 78 74 0a + + ~ " 8 packalign" + 20 20 38 20 70 61 63 6b 61 6c 69 67 6e 0a + + ~ " here !" + 20 20 68 65 72 65 20 21 0a + + ~ " ~ : deindent" + 20 20 7e 20 3a 20 64 65 69 6e 64 65 6e 74 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ It's convenient to be able to work with strings in" + ~ " label-transformed" + 7e 20 20 20 49 74 27 73 20 63 6f 6e 76 65 6e 69 + 65 6e 74 20 74 6f 20 62 65 20 61 62 6c 65 20 74 + 6f 20 77 6f 72 6b 20 77 69 74 68 20 73 74 72 69 + 6e 67 73 20 69 6e 20 6c 61 62 65 6c 2d 74 72 61 + 6e 73 66 6f 72 6d 65 64 0a + + ~ "~ code. If we don't provide an alternate for it, we get" + ~ " codeword pointers in" + 7e 20 63 6f 64 65 2e 20 49 66 20 77 65 20 64 6f + 6e 27 74 20 70 72 6f 76 69 64 65 20 61 6e 20 61 + 6c 74 65 72 6e 61 74 65 20 66 6f 72 20 69 74 2c + 20 77 65 20 67 65 74 20 63 6f 64 65 77 6f 72 64 + 20 70 6f 69 6e 74 65 72 73 20 69 6e 0a + + ~ "~ the host address space, which therefore don't work." + 7e 20 74 68 65 20 68 6f 73 74 20 61 64 64 72 65 + 73 73 20 73 70 61 63 65 2c 20 77 68 69 63 68 20 + 74 68 65 72 65 66 6f 72 65 20 64 6f 6e 27 74 20 + 77 6f 72 6b 2e 0a + + ~ ": label-string-alternate" + 3a 20 6c 61 62 65 6c 2d 73 74 72 69 6e 67 2d 61 + 6c 74 65 72 6e 61 74 65 0a + + ~ " ~ Something subtle here: s" is state-dependent. That" + ~ " is, it does different" + 20 20 7e 20 20 20 53 6f 6d 65 74 68 69 6e 67 20 + 73 75 62 74 6c 65 20 68 65 72 65 3a 20 73 22 20 + 69 73 20 73 74 61 74 65 2d 64 65 70 65 6e 64 65 + 6e 74 2e 20 54 68 61 74 20 69 73 2c 20 69 74 20 + 64 6f 65 73 20 64 69 66 66 65 72 65 6e 74 0a + + ~ " ~ things depending on the interpreter flags. We would" + ~ " really rather know" + 20 20 7e 20 74 68 69 6e 67 73 20 64 65 70 65 6e + 64 69 6e 67 20 6f 6e 20 74 68 65 20 69 6e 74 65 + 72 70 72 65 74 65 72 20 66 6c 61 67 73 2e 20 57 + 65 20 77 6f 75 6c 64 20 72 65 61 6c 6c 79 20 72 + 61 74 68 65 72 20 6b 6e 6f 77 0a + + ~ " ~ which version we're getting, and also it would be best" + ~ " if it didn't" + 20 20 7e 20 77 68 69 63 68 20 76 65 72 73 69 6f + 6e 20 77 65 27 72 65 20 67 65 74 74 69 6e 67 2c + 20 61 6e 64 20 61 6c 73 6f 20 69 74 20 77 6f 75 + 6c 64 20 62 65 20 62 65 73 74 20 69 66 20 69 74 + 20 64 69 64 6e 27 74 0a + + ~ " ~ scribble on the output buffer. Fortunately we can" + ~ " achieve both of these," + 20 20 7e 20 73 63 72 69 62 62 6c 65 20 6f 6e 20 + 74 68 65 20 6f 75 74 70 75 74 20 62 75 66 66 65 + 72 2e 20 46 6f 72 74 75 6e 61 74 65 6c 79 20 77 + 65 20 63 61 6e 20 61 63 68 69 65 76 65 20 62 6f + 74 68 20 6f 66 20 74 68 65 73 65 2c 0a + + ~ " ~ by coercing things into a known state while calling" + ~ " it." + 20 20 7e 20 62 79 20 63 6f 65 72 63 69 6e 67 20 + 74 68 69 6e 67 73 20 69 6e 74 6f 20 61 20 6b 6e + 6f 77 6e 20 73 74 61 74 65 20 77 68 69 6c 65 20 + 63 61 6c 6c 69 6e 67 20 69 74 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ We could choose either version of s", but the" + ~ " interpreted one is more" + 20 20 7e 20 20 20 57 65 20 63 6f 75 6c 64 20 63 + 68 6f 6f 73 65 20 65 69 74 68 65 72 20 76 65 72 + 73 69 6f 6e 20 6f 66 20 73 22 2c 20 62 75 74 20 + 74 68 65 20 69 6e 74 65 72 70 72 65 74 65 64 20 + 6f 6e 65 20 69 73 20 6d 6f 72 65 0a + + ~ " ~ convenient because it doesn't mess with a spurious" + ~ " litstring invocation," + 20 20 7e 20 63 6f 6e 76 65 6e 69 65 6e 74 20 62 + 65 63 61 75 73 65 20 69 74 20 64 6f 65 73 6e 27 + 74 20 6d 65 73 73 20 77 69 74 68 20 61 20 73 70 + 75 72 69 6f 75 73 20 6c 69 74 73 74 72 69 6e 67 + 20 69 6e 76 6f 63 61 74 69 6f 6e 2c 0a + + ~ " ~ just scribbled into scratch space after "here". Of" + ~ " course, that raises the" + 20 20 7e 20 6a 75 73 74 20 73 63 72 69 62 62 6c + 65 64 20 69 6e 74 6f 20 73 63 72 61 74 63 68 20 + 73 70 61 63 65 20 61 66 74 65 72 20 22 68 65 72 + 65 22 2e 20 4f 66 20 63 6f 75 72 73 65 2c 20 74 + 68 61 74 20 72 61 69 73 65 73 20 74 68 65 0a + + ~ " ~ additional concern that we have the wrong "here", but" + ~ " we can just swap" + 20 20 7e 20 61 64 64 69 74 69 6f 6e 61 6c 20 63 + 6f 6e 63 65 72 6e 20 74 68 61 74 20 77 65 20 68 + 61 76 65 20 74 68 65 20 77 72 6f 6e 67 20 22 68 + 65 72 65 22 2c 20 62 75 74 20 77 65 20 63 61 6e + 20 6a 75 73 74 20 73 77 61 70 0a + + ~ " ~ that around, too." + 20 20 7e 20 74 68 61 74 20 61 72 6f 75 6e 64 2c + 20 74 6f 6f 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ This is all worth it to avoid reimplementing s". If" + ~ " we had two" + 20 20 7e 20 20 20 54 68 69 73 20 69 73 20 61 6c + 6c 20 77 6f 72 74 68 20 69 74 20 74 6f 20 61 76 + 6f 69 64 20 72 65 69 6d 70 6c 65 6d 65 6e 74 69 + 6e 67 20 73 22 2e 20 49 66 20 77 65 20 68 61 64 + 20 74 77 6f 0a + + ~ " ~ implementations, they'd have to be kept in sync, and" + ~ " it's an important" + 20 20 7e 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 + 6f 6e 73 2c 20 74 68 65 79 27 64 20 68 61 76 65 + 20 74 6f 20 62 65 20 6b 65 70 74 20 69 6e 20 73 + 79 6e 63 2c 20 61 6e 64 20 69 74 27 73 20 61 6e + 20 69 6d 70 6f 72 74 61 6e 74 0a + + ~ " ~ user-facing word with semantics that are likely to" + ~ " improve over time." + 20 20 7e 20 75 73 65 72 2d 66 61 63 69 6e 67 20 + 77 6f 72 64 20 77 69 74 68 20 73 65 6d 61 6e 74 + 69 63 73 20 74 68 61 74 20 61 72 65 20 6c 69 6b + 65 6c 79 20 74 6f 20 69 6d 70 72 6f 76 65 20 6f + 76 65 72 20 74 69 6d 65 2e 0a + + ~ " interpreter-flags @" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 0a + + ~ " ' s" entry-to-execution-token" + 20 20 27 20 73 22 20 65 6e 74 72 79 2d 74 6f 2d + 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " ~ Since [ is an immediate word, we have to go to extra" + ~ " trouble to compile" + 20 20 7e 20 20 20 53 69 6e 63 65 20 5b 20 69 73 + 20 61 6e 20 69 6d 6d 65 64 69 61 74 65 20 77 6f + 72 64 2c 20 77 65 20 68 61 76 65 20 74 6f 20 67 + 6f 20 74 6f 20 65 78 74 72 61 20 74 72 6f 75 62 + 6c 65 20 74 6f 20 63 6f 6d 70 69 6c 65 0a + + ~ " ~ it as part of the alternate." + 20 20 7e 20 69 74 20 61 73 20 70 61 72 74 20 6f + 66 20 74 68 65 20 61 6c 74 65 72 6e 61 74 65 2e + 0a + + ~ " [ ' [ entry-to-execution-token , ]" + 20 20 5b 20 27 20 5b 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 2c 20 5d 0a + + ~ " execute" + 20 20 65 78 65 63 75 74 65 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " swap interpreter-flags !" + 20 20 73 77 61 70 20 69 6e 74 65 72 70 72 65 74 + 65 72 2d 66 6c 61 67 73 20 21 0a + + ~ "" + 0a + + ~ " ~ Whew. What a mouthful." + 20 20 7e 20 20 20 57 68 65 77 2e 20 57 68 61 74 + 20 61 20 6d 6f 75 74 68 66 75 6c 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ Having done this, we have the string pointer on the" + ~ " stack at transform" + 20 20 7e 20 20 20 48 61 76 69 6e 67 20 64 6f 6e + 65 20 74 68 69 73 2c 20 77 65 20 68 61 76 65 20 + 74 68 65 20 73 74 72 69 6e 67 20 70 6f 69 6e 74 + 65 72 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 20 + 61 74 20 74 72 61 6e 73 66 6f 72 6d 0a + + ~ " ~ time, which with the label transform is the same as" + ~ " immediate time. If" + 20 20 7e 20 74 69 6d 65 2c 20 77 68 69 63 68 20 + 77 69 74 68 20 74 68 65 20 6c 61 62 65 6c 20 74 + 72 61 6e 73 66 6f 72 6d 20 69 73 20 74 68 65 20 + 73 61 6d 65 20 61 73 20 69 6d 6d 65 64 69 61 74 + 65 20 74 69 6d 65 2e 20 49 66 0a + + ~ " ~ we're in immediate mode, therefore, we've left the" + ~ " string on the stack and" + 20 20 7e 20 77 65 27 72 65 20 69 6e 20 69 6d 6d + 65 64 69 61 74 65 20 6d 6f 64 65 2c 20 74 68 65 + 72 65 66 6f 72 65 2c 20 77 65 27 76 65 20 6c 65 + 66 74 20 74 68 65 20 73 74 72 69 6e 67 20 6f 6e + 20 74 68 65 20 73 74 61 63 6b 20 61 6e 64 0a + + ~ " ~ that's all we wanted. If we're in compile mode, it's" + ~ " our job to output a" + 20 20 7e 20 74 68 61 74 27 73 20 61 6c 6c 20 77 + 65 20 77 61 6e 74 65 64 2e 20 49 66 20 77 65 27 + 72 65 20 69 6e 20 63 6f 6d 70 69 6c 65 20 6d 6f + 64 65 2c 20 69 74 27 73 20 6f 75 72 20 6a 6f 62 + 20 74 6f 20 6f 75 74 70 75 74 20 61 0a + + ~ " ~ litstring invocation." + 20 20 7e 20 6c 69 74 73 74 72 69 6e 67 20 69 6e + 76 6f 63 61 74 69 6f 6e 2e 0a + + ~ "" + 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' litstring" + 20 20 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e + 67 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space , ~ : -8 litstring #--" + ~ " (codeword pointer)" + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 20 20 20 7e 20 3a 20 2d 38 20 6c 69 + 74 73 74 72 69 6e 67 20 23 2d 2d 20 28 63 6f 64 + 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " here @ swap packstring 8 packalign here !" + 20 20 20 20 68 65 72 65 20 40 20 73 77 61 70 20 + 70 61 63 6b 73 74 72 69 6e 67 20 38 20 70 61 63 + 6b 61 6c 69 67 6e 20 68 65 72 65 20 21 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ ": label-dot-string-alternate" + 3a 20 6c 61 62 65 6c 2d 64 6f 74 2d 73 74 72 69 + 6e 67 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ " ' label-string-alternate entry-to-execution-token" + ~ " execute" + 20 20 27 20 6c 61 62 65 6c 2d 73 74 72 69 6e 67 + 2d 61 6c 74 65 72 6e 61 74 65 20 65 6e 74 72 79 + 2d 74 6f 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f + 6b 65 6e 20 65 78 65 63 75 74 65 0a + + ~ "" + 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' emitstring" + 20 20 20 20 4c 40 27 20 65 6d 69 74 73 74 72 69 + 6e 67 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space , ~ : -8 emitstring" + ~ " #-- (codeword pointer)" + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 20 20 20 7e 20 3a 20 2d 38 20 65 6d + 69 74 73 74 72 69 6e 67 20 23 2d 2d 20 28 63 6f + 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " } { emitstring } if-else" + 20 20 7d 20 7b 20 65 6d 69 74 73 74 72 69 6e 67 + 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Because docol requires it, we provide a special" + ~ " mini-version of the label" + 7e 20 20 20 42 65 63 61 75 73 65 20 64 6f 63 6f + 6c 20 72 65 71 75 69 72 65 73 20 69 74 2c 20 77 + 65 20 70 72 6f 76 69 64 65 20 61 20 73 70 65 63 + 69 61 6c 20 6d 69 6e 69 2d 76 65 72 73 69 6f 6e + 20 6f 66 20 74 68 65 20 6c 61 62 65 6c 0a + + ~ "~ system. We only do L@' and L!', because that's all we" + ~ " need. These are real" + 7e 20 73 79 73 74 65 6d 2e 20 57 65 20 6f 6e 6c + 79 20 64 6f 20 4c 40 27 20 61 6e 64 20 4c 21 27 + 2c 20 62 65 63 61 75 73 65 20 74 68 61 74 27 73 + 20 61 6c 6c 20 77 65 20 6e 65 65 64 2e 20 54 68 + 65 73 65 20 61 72 65 20 72 65 61 6c 0a + + ~ "~ labels; there can be arbitrarily many of them, and they" + ~ " can have forward" + 7e 20 6c 61 62 65 6c 73 3b 20 74 68 65 72 65 20 + 63 61 6e 20 62 65 20 61 72 62 69 74 72 61 72 69 + 6c 79 20 6d 61 6e 79 20 6f 66 20 74 68 65 6d 2c + 20 61 6e 64 20 74 68 65 79 20 63 61 6e 20 68 61 + 76 65 20 66 6f 72 77 61 72 64 0a + + ~ "~ references." + 7e 20 72 65 66 65 72 65 6e 63 65 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The value that's accepted is in the host address space;" + ~ " the label is set" + 7e 20 20 20 54 68 65 20 76 61 6c 75 65 20 74 68 + 61 74 27 73 20 61 63 63 65 70 74 65 64 20 69 73 + 20 69 6e 20 74 68 65 20 68 6f 73 74 20 61 64 64 + 72 65 73 73 20 73 70 61 63 65 3b 20 74 68 65 20 + 6c 61 62 65 6c 20 69 73 20 73 65 74 0a + + ~ "~ to an offset; and the value that's returned is in the" + ~ " target address space." + 7e 20 74 6f 20 61 6e 20 6f 66 66 73 65 74 3b 20 + 61 6e 64 20 74 68 65 20 76 61 6c 75 65 20 74 68 + 61 74 27 73 20 72 65 74 75 72 6e 65 64 20 69 73 + 20 69 6e 20 74 68 65 20 74 61 72 67 65 74 20 61 + 64 64 72 65 73 73 20 73 70 61 63 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (-- value)" + 7e 20 28 2d 2d 20 76 61 6c 75 65 29 0a + + ~ ": label-L@'-alternate" + 3a 20 6c 61 62 65 6c 2d 4c 40 27 2d 61 6c 74 65 + 72 6e 61 74 65 0a + + ~ " word value@" + 20 20 77 6f 72 64 20 76 61 6c 75 65 40 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " intern-label" + 20 20 69 6e 74 65 72 6e 2d 6c 61 62 65 6c 0a + + ~ " use-label" + 20 20 75 73 65 2d 6c 61 62 65 6c 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " dropstring-with-result" + 20 20 64 72 6f 70 73 74 72 69 6e 67 2d 77 69 74 + 68 2d 72 65 73 75 6c 74 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ (value --)" + 7e 20 28 76 61 6c 75 65 20 2d 2d 29 0a + + ~ ": label-L!'-alternate" + 3a 20 6c 61 62 65 6c 2d 4c 21 27 2d 61 6c 74 65 + 72 6e 61 74 65 0a + + ~ " host-address-space-to-offset" + 20 20 68 6f 73 74 2d 61 64 64 72 65 73 73 2d 73 + 70 61 63 65 2d 74 6f 2d 6f 66 66 73 65 74 0a + + ~ "" + 0a + + ~ " word value@" + 20 20 77 6f 72 64 20 76 61 6c 75 65 40 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " intern-label" + 20 20 69 6e 74 65 72 6e 2d 6c 61 62 65 6c 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " dropstring-with-result" + 20 20 64 72 6f 70 73 74 72 69 6e 67 2d 77 69 74 + 68 2d 72 65 73 75 6c 74 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " set-label" + 20 20 73 65 74 2d 6c 61 62 65 6c 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ We implement alternates of all the high-level" + ~ " flow-control words for the" + 7e 20 20 20 57 65 20 69 6d 70 6c 65 6d 65 6e 74 + 20 61 6c 74 65 72 6e 61 74 65 73 20 6f 66 20 61 + 6c 6c 20 74 68 65 20 68 69 67 68 2d 6c 65 76 65 + 6c 20 66 6c 6f 77 2d 63 6f 6e 74 72 6f 6c 20 77 + 6f 72 64 73 20 66 6f 72 20 74 68 65 0a + + ~ "~ label transform: if, unless, if-else, forever, and while." + ~ " We leave { and }" + 7e 20 6c 61 62 65 6c 20 74 72 61 6e 73 66 6f 72 + 6d 3a 20 69 66 2c 20 75 6e 6c 65 73 73 2c 20 69 + 66 2d 65 6c 73 65 2c 20 66 6f 72 65 76 65 72 2c + 20 61 6e 64 20 77 68 69 6c 65 2e 20 57 65 20 6c + 65 61 76 65 20 7b 20 61 6e 64 20 7d 0a + + ~ "~ as their usual implementations. The values { and } leave" + ~ " on the stack will" + 7e 20 61 73 20 74 68 65 69 72 20 75 73 75 61 6c + 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 + 2e 20 54 68 65 20 76 61 6c 75 65 73 20 7b 20 61 + 6e 64 20 7d 20 6c 65 61 76 65 20 6f 6e 20 74 68 + 65 20 73 74 61 63 6b 20 77 69 6c 6c 0a + + ~ "~ be in the host address space, which is convenient anyway." + ~ " Those values don't" + 7e 20 62 65 20 69 6e 20 74 68 65 20 68 6f 73 74 + 20 61 64 64 72 65 73 73 20 73 70 61 63 65 2c 20 + 77 68 69 63 68 20 69 73 20 63 6f 6e 76 65 6e 69 + 65 6e 74 20 61 6e 79 77 61 79 2e 20 54 68 6f 73 + 65 20 76 61 6c 75 65 73 20 64 6f 6e 27 74 0a + + ~ "~ make their way into the output, since everything is" + ~ " relative, and the" + 7e 20 6d 61 6b 65 20 74 68 65 69 72 20 77 61 79 + 20 69 6e 74 6f 20 74 68 65 20 6f 75 74 70 75 74 + 2c 20 73 69 6e 63 65 20 65 76 65 72 79 74 68 69 + 6e 67 20 69 73 20 72 65 6c 61 74 69 76 65 2c 20 + 61 6e 64 20 74 68 65 0a + + ~ "~ relative offsets are correct regardless. What we do need" + ~ " to change, though," + 7e 20 72 65 6c 61 74 69 76 65 20 6f 66 66 73 65 + 74 73 20 61 72 65 20 63 6f 72 72 65 63 74 20 72 + 65 67 61 72 64 6c 65 73 73 2e 20 57 68 61 74 20 + 77 65 20 64 6f 20 6e 65 65 64 20 74 6f 20 63 68 + 61 6e 67 65 2c 20 74 68 6f 75 67 68 2c 0a + + ~ "~ is the addresses of branch and 0branch. We need to" + ~ " resolve these via label." + 7e 20 69 73 20 74 68 65 20 61 64 64 72 65 73 73 + 65 73 20 6f 66 20 62 72 61 6e 63 68 20 61 6e 64 + 20 30 62 72 61 6e 63 68 2e 20 57 65 20 6e 65 65 + 64 20 74 6f 20 72 65 73 6f 6c 76 65 20 74 68 65 + 73 65 20 76 69 61 20 6c 61 62 65 6c 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (start pointer, length --)" + 7e 20 28 73 74 61 72 74 20 70 6f 69 6e 74 65 72 + 2c 20 6c 65 6e 67 74 68 20 2d 2d 29 0a + + ~ ": label-if-alternate" + 3a 20 6c 61 62 65 6c 2d 69 66 2d 61 6c 74 65 72 + 6e 61 74 65 0a + + ~ " 2dup swap dup 5 8 * + 3roll" + 20 20 32 64 75 70 20 73 77 61 70 20 64 75 70 20 + 35 20 38 20 2a 20 2b 20 33 72 6f 6c 6c 0a + + ~ " ~ (start pointer, length, adjusted start pointer, start" + ~ " pointer, length)" + 20 20 7e 20 28 73 74 61 72 74 20 70 6f 69 6e 74 + 65 72 2c 20 6c 65 6e 67 74 68 2c 20 61 64 6a 75 + 73 74 65 64 20 73 74 61 72 74 20 70 6f 69 6e 74 + 65 72 2c 20 73 74 61 72 74 20 70 6f 69 6e 74 65 + 72 2c 20 6c 65 6e 67 74 68 29 0a + + ~ " memmove" + 20 20 6d 65 6d 6d 6f 76 65 0a + + ~ " ~ (start pointer, length)" + 20 20 7e 20 28 73 74 61 72 74 20 70 6f 69 6e 74 + 65 72 2c 20 6c 65 6e 67 74 68 29 0a + + ~ " swap here @ swap here ! swap" + 20 20 73 77 61 70 20 68 65 72 65 20 40 20 73 77 + 61 70 20 68 65 72 65 20 21 20 73 77 61 70 0a + + ~ " ~ (old here, length)" + 20 20 7e 20 28 6f 6c 64 20 68 65 72 65 2c 20 6c + 65 6e 67 74 68 29 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' 0branch" + 20 20 4c 40 27 20 30 62 72 61 6e 63 68 0a + + ~ " L@' !=" + 20 20 4c 40 27 20 21 3d 0a + + ~ " L@' lit" + 20 20 4c 40 27 20 6c 69 74 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " offset-to-target-address-space , ~ : -8 lit #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 6c 69 + 74 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 + 70 6f 69 6e 74 65 72 29 0a + + ~ " 0 ~ : provide-hex" + 20 20 30 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 70 72 6f 76 69 + 64 65 2d 68 65 78 0a + + ~ " , ~ : -8 # #--" + ~ " (integer literal)" + 20 20 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 23 20 + 23 2d 2d 20 28 69 6e 74 65 67 65 72 20 6c 69 74 + 65 72 61 6c 29 0a + + ~ " offset-to-target-address-space , ~ : -8 != #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 21 3d + 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 70 + 6f 69 6e 74 65 72 29 0a + + ~ " ~ The branch length needs to be one word longer than" + ~ " the block length," + 20 20 7e 20 20 20 54 68 65 20 62 72 61 6e 63 68 + 20 6c 65 6e 67 74 68 20 6e 65 65 64 73 20 74 6f + 20 62 65 20 6f 6e 65 20 77 6f 72 64 20 6c 6f 6e + 67 65 72 20 74 68 61 6e 20 74 68 65 20 62 6c 6f + 63 6b 20 6c 65 6e 67 74 68 2c 0a + + ~ " ~ because the length field itself is part of the scope of" + ~ " the branch." + 20 20 7e 20 62 65 63 61 75 73 65 20 74 68 65 20 + 6c 65 6e 67 74 68 20 66 69 65 6c 64 20 69 74 73 + 65 6c 66 20 69 73 20 70 61 72 74 20 6f 66 20 74 + 68 65 20 73 63 6f 70 65 20 6f 66 20 74 68 65 20 + 62 72 61 6e 63 68 2e 0a + + ~ " offset-to-target-address-space , ~ : -8 0branch #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 30 62 + 72 61 6e 63 68 20 23 2d 2d 20 28 63 6f 64 65 77 + 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " dup 8 + ~ : provide-hex" + 20 20 64 75 70 20 38 20 2b 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 70 72 6f 76 69 + 64 65 2d 68 65 78 0a + + ~ " ~ : 8 # #-- (branch offset)" + 20 20 7e 20 3a 20 38 20 23 20 23 2d 2d 20 28 62 + 72 61 6e 63 68 20 6f 66 66 73 65 74 29 0a + + ~ " ," + 20 20 2c 0a + + ~ " ~ (old here, length)" + 20 20 7e 20 28 6f 6c 64 20 68 65 72 65 2c 20 6c + 65 6e 67 74 68 29 0a + + ~ " drop 5 8 * + here !" + 20 20 64 72 6f 70 20 35 20 38 20 2a 20 2b 20 68 + 65 72 65 20 21 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "~ (start pointer, length)" + 7e 20 28 73 74 61 72 74 20 70 6f 69 6e 74 65 72 + 2c 20 6c 65 6e 67 74 68 29 0a + + ~ ": label-unless-alternate" + 3a 20 6c 61 62 65 6c 2d 75 6e 6c 65 73 73 2d 61 + 6c 74 65 72 6e 61 74 65 0a + + ~ " 2dup swap dup 5 8 * + 3roll" + 20 20 32 64 75 70 20 73 77 61 70 20 64 75 70 20 + 35 20 38 20 2a 20 2b 20 33 72 6f 6c 6c 0a + + ~ " ~ (start pointer, length, adjusted start pointer, start" + ~ " pointer, length)" + 20 20 7e 20 28 73 74 61 72 74 20 70 6f 69 6e 74 + 65 72 2c 20 6c 65 6e 67 74 68 2c 20 61 64 6a 75 + 73 74 65 64 20 73 74 61 72 74 20 70 6f 69 6e 74 + 65 72 2c 20 73 74 61 72 74 20 70 6f 69 6e 74 65 + 72 2c 20 6c 65 6e 67 74 68 29 0a + + ~ " memmove" + 20 20 6d 65 6d 6d 6f 76 65 0a + + ~ " ~ (start pointer, length)" + 20 20 7e 20 28 73 74 61 72 74 20 70 6f 69 6e 74 + 65 72 2c 20 6c 65 6e 67 74 68 29 0a + + ~ " swap here @ swap here ! swap" + 20 20 73 77 61 70 20 68 65 72 65 20 40 20 73 77 + 61 70 20 68 65 72 65 20 21 20 73 77 61 70 0a + + ~ " ~ (old here, length)" + 20 20 7e 20 28 6f 6c 64 20 68 65 72 65 2c 20 6c + 65 6e 67 74 68 29 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' 0branch" + 20 20 4c 40 27 20 30 62 72 61 6e 63 68 0a + + ~ " L@' =" + 20 20 4c 40 27 20 3d 0a + + ~ " L@' lit" + 20 20 4c 40 27 20 6c 69 74 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " offset-to-target-address-space , ~ : -8 lit #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 6c 69 + 74 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 + 70 6f 69 6e 74 65 72 29 0a + + ~ " 0 ~ : provide-hex" + 20 20 30 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 70 72 6f 76 69 + 64 65 2d 68 65 78 0a + + ~ " , ~ : -8 # #--" + ~ " (integer literal)" + 20 20 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 23 20 + 23 2d 2d 20 28 69 6e 74 65 67 65 72 20 6c 69 74 + 65 72 61 6c 29 0a + + ~ " offset-to-target-address-space , ~ : -8 = #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 3d 20 + 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 70 6f + 69 6e 74 65 72 29 0a + + ~ " ~ The branch length needs to be one word longer than" + ~ " the block length," + 20 20 7e 20 20 20 54 68 65 20 62 72 61 6e 63 68 + 20 6c 65 6e 67 74 68 20 6e 65 65 64 73 20 74 6f + 20 62 65 20 6f 6e 65 20 77 6f 72 64 20 6c 6f 6e + 67 65 72 20 74 68 61 6e 20 74 68 65 20 62 6c 6f + 63 6b 20 6c 65 6e 67 74 68 2c 0a + + ~ " ~ because the length field itself is part of the scope of" + ~ " the branch." + 20 20 7e 20 62 65 63 61 75 73 65 20 74 68 65 20 + 6c 65 6e 67 74 68 20 66 69 65 6c 64 20 69 74 73 + 65 6c 66 20 69 73 20 70 61 72 74 20 6f 66 20 74 + 68 65 20 73 63 6f 70 65 20 6f 66 20 74 68 65 20 + 62 72 61 6e 63 68 2e 0a + + ~ " offset-to-target-address-space , ~ : -8 0branch #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 30 62 + 72 61 6e 63 68 20 23 2d 2d 20 28 63 6f 64 65 77 + 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " dup 8 + ~ : provide-hex" + 20 20 64 75 70 20 38 20 2b 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 70 72 6f 76 69 + 64 65 2d 68 65 78 0a + + ~ " ~ : 8 # #-- (branch offset)" + 20 20 7e 20 3a 20 38 20 23 20 23 2d 2d 20 28 62 + 72 61 6e 63 68 20 6f 66 66 73 65 74 29 0a + + ~ " ," + 20 20 2c 0a + + ~ " ~ (old here, length)" + 20 20 7e 20 28 6f 6c 64 20 68 65 72 65 2c 20 6c + 65 6e 67 74 68 29 0a + + ~ " drop 5 8 * + here !" + 20 20 64 72 6f 70 20 35 20 38 20 2a 20 2b 20 68 + 65 72 65 20 21 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "~ (true start, true length, false start, false length)" + 7e 20 28 74 72 75 65 20 73 74 61 72 74 2c 20 74 + 72 75 65 20 6c 65 6e 67 74 68 2c 20 66 61 6c 73 + 65 20 73 74 61 72 74 2c 20 66 61 6c 73 65 20 6c + 65 6e 67 74 68 29 0a + + ~ ": label-if-else-alternate" + 3a 20 6c 61 62 65 6c 2d 69 66 2d 65 6c 73 65 2d + 61 6c 74 65 72 6e 61 74 65 0a + + ~ " ~ First we slide the false-block forward, then the" + ~ " true-block. We slide" + 20 20 7e 20 20 20 46 69 72 73 74 20 77 65 20 73 + 6c 69 64 65 20 74 68 65 20 66 61 6c 73 65 2d 62 + 6c 6f 63 6b 20 66 6f 72 77 61 72 64 2c 20 74 68 + 65 6e 20 74 68 65 20 74 72 75 65 2d 62 6c 6f 63 + 6b 2e 20 57 65 20 73 6c 69 64 65 0a + + ~ " ~ them both directly into their final positions, leaving" + ~ " space at the start" + 20 20 7e 20 74 68 65 6d 20 62 6f 74 68 20 64 69 + 72 65 63 74 6c 79 20 69 6e 74 6f 20 74 68 65 69 + 72 20 66 69 6e 61 6c 20 70 6f 73 69 74 69 6f 6e + 73 2c 20 6c 65 61 76 69 6e 67 20 73 70 61 63 65 + 20 61 74 20 74 68 65 20 73 74 61 72 74 0a + + ~ " ~ for a test and branch, and space in between for an" + ~ " unconditional branch." + 20 20 7e 20 66 6f 72 20 61 20 74 65 73 74 20 61 + 6e 64 20 62 72 61 6e 63 68 2c 20 61 6e 64 20 73 + 70 61 63 65 20 69 6e 20 62 65 74 77 65 65 6e 20 + 66 6f 72 20 61 6e 20 75 6e 63 6f 6e 64 69 74 69 + 6f 6e 61 6c 20 62 72 61 6e 63 68 2e 0a + + ~ " ~ Those spaces will take five words, and two words," + ~ " respectively. So the" + 20 20 7e 20 54 68 6f 73 65 20 73 70 61 63 65 73 + 20 77 69 6c 6c 20 74 61 6b 65 20 66 69 76 65 20 + 77 6f 72 64 73 2c 20 61 6e 64 20 74 77 6f 20 77 + 6f 72 64 73 2c 20 72 65 73 70 65 63 74 69 76 65 + 6c 79 2e 20 53 6f 20 74 68 65 0a + + ~ " ~ false-block gets moved by seven words, and the" + ~ " true-block gets moved by" + 20 20 7e 20 66 61 6c 73 65 2d 62 6c 6f 63 6b 20 + 67 65 74 73 20 6d 6f 76 65 64 20 62 79 20 73 65 + 76 65 6e 20 77 6f 72 64 73 2c 20 61 6e 64 20 74 + 68 65 20 74 72 75 65 2d 62 6c 6f 63 6b 20 67 65 + 74 73 20 6d 6f 76 65 64 20 62 79 0a + + ~ " ~ five words." + 20 20 7e 20 66 69 76 65 20 77 6f 72 64 73 2e 0a + + ~ " 2dup swap dup 7 8 * + 3roll memmove" + 20 20 32 64 75 70 20 73 77 61 70 20 64 75 70 20 + 37 20 38 20 2a 20 2b 20 33 72 6f 6c 6c 20 6d 65 + 6d 6d 6f 76 65 0a + + ~ " 3 pick dup 5 8 * + 4 pick memmove" + 20 20 33 20 70 69 63 6b 20 64 75 70 20 35 20 38 + 20 2a 20 2b 20 34 20 70 69 63 6b 20 6d 65 6d 6d + 6f 76 65 0a + + ~ " ~ (true start, true length, false start, false length)" + 20 20 7e 20 28 74 72 75 65 20 73 74 61 72 74 2c + 20 74 72 75 65 20 6c 65 6e 67 74 68 2c 20 66 61 + 6c 73 65 20 73 74 61 72 74 2c 20 66 61 6c 73 65 + 20 6c 65 6e 67 74 68 29 0a + + ~ "" + 0a + + ~ " ~ Now we write out the initial test-and-branch." + 20 20 7e 20 4e 6f 77 20 77 65 20 77 72 69 74 65 + 20 6f 75 74 20 74 68 65 20 69 6e 69 74 69 61 6c + 20 74 65 73 74 2d 61 6e 64 2d 62 72 61 6e 63 68 + 2e 0a + + ~ " 4 roll dup 5 unroll here @ 6 unroll here !" + 20 20 34 20 72 6f 6c 6c 20 64 75 70 20 35 20 75 + 6e 72 6f 6c 6c 20 68 65 72 65 20 40 20 36 20 75 + 6e 72 6f 6c 6c 20 68 65 72 65 20 21 0a + + ~ " ~ (old here, true start, true length, false start, false" + ~ " length)" + 20 20 7e 20 28 6f 6c 64 20 68 65 72 65 2c 20 74 + 72 75 65 20 73 74 61 72 74 2c 20 74 72 75 65 20 + 6c 65 6e 67 74 68 2c 20 66 61 6c 73 65 20 73 74 + 61 72 74 2c 20 66 61 6c 73 65 20 6c 65 6e 67 74 + 68 29 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' 0branch" + 20 20 4c 40 27 20 30 62 72 61 6e 63 68 0a + + ~ " L@' !=" + 20 20 4c 40 27 20 21 3d 0a + + ~ " L@' lit" + 20 20 4c 40 27 20 6c 69 74 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " offset-to-target-address-space , ~ : -8 lit #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 6c 69 + 74 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 + 70 6f 69 6e 74 65 72 29 0a + + ~ " 0 ~ : provide-hex" + 20 20 30 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 70 72 6f 76 69 + 64 65 2d 68 65 78 0a + + ~ " , ~ : -8 # #--" + ~ " (integer literal)" + 20 20 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 23 20 + 23 2d 2d 20 28 69 6e 74 65 67 65 72 20 6c 69 74 + 65 72 61 6c 29 0a + + ~ " offset-to-target-address-space , ~ : -8 != #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 21 3d + 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 70 + 6f 69 6e 74 65 72 29 0a + + ~ " ~ Branch past the length field, the true-block, and the" + ~ " unconditional" + 20 20 7e 20 20 20 42 72 61 6e 63 68 20 70 61 73 + 74 20 74 68 65 20 6c 65 6e 67 74 68 20 66 69 65 + 6c 64 2c 20 74 68 65 20 74 72 75 65 2d 62 6c 6f + 63 6b 2c 20 61 6e 64 20 74 68 65 20 75 6e 63 6f + 6e 64 69 74 69 6f 6e 61 6c 0a + + ~ " ~ branch in the middle." + 20 20 7e 20 62 72 61 6e 63 68 20 69 6e 20 74 68 + 65 20 6d 69 64 64 6c 65 2e 0a + + ~ " offset-to-target-address-space , ~ : -8 0branch #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 30 62 + 72 61 6e 63 68 20 23 2d 2d 20 28 63 6f 64 65 77 + 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " 3roll dup 4 unroll 3 8 * + ~ : provide-hex" + 20 20 33 72 6f 6c 6c 20 64 75 70 20 34 20 75 6e + 72 6f 6c 6c 20 33 20 38 20 2a 20 2b 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 70 72 6f 76 69 + 64 65 2d 68 65 78 0a + + ~ " ~ : 8 # #-- (branch offset)" + 20 20 7e 20 3a 20 38 20 23 20 23 2d 2d 20 28 62 + 72 61 6e 63 68 20 6f 66 66 73 65 74 29 0a + + ~ " ," + 20 20 2c 0a + + ~ "" + 0a + + ~ " ~ Next, write out the unconditional branch in the" + ~ " middle." + 20 20 7e 20 4e 65 78 74 2c 20 77 72 69 74 65 20 + 6f 75 74 20 74 68 65 20 75 6e 63 6f 6e 64 69 74 + 69 6f 6e 61 6c 20 62 72 61 6e 63 68 20 69 6e 20 + 74 68 65 20 6d 69 64 64 6c 65 2e 0a + + ~ " swap dup 3unroll 5 8 * + here !" + 20 20 73 77 61 70 20 64 75 70 20 33 75 6e 72 6f + 6c 6c 20 35 20 38 20 2a 20 2b 20 68 65 72 65 20 + 21 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' branch" + 20 20 4c 40 27 20 62 72 61 6e 63 68 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " offset-to-target-address-space , ~ : -8 branch #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 62 72 + 61 6e 63 68 20 23 2d 2d 20 28 63 6f 64 65 77 6f + 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " ~ Branch past the length field and the false-block." + 20 20 7e 20 42 72 61 6e 63 68 20 70 61 73 74 20 + 74 68 65 20 6c 65 6e 67 74 68 20 66 69 65 6c 64 + 20 61 6e 64 20 74 68 65 20 66 61 6c 73 65 2d 62 + 6c 6f 63 6b 2e 0a + + ~ " dup 8 + ~ : provide-hex" + 20 20 64 75 70 20 38 20 2b 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 70 72 6f 76 69 + 64 65 2d 68 65 78 0a + + ~ " ~ : 8 # #-- (branch offset)" + 20 20 7e 20 3a 20 38 20 23 20 23 2d 2d 20 28 62 + 72 61 6e 63 68 20 6f 66 66 73 65 74 29 0a + + ~ " ," + 20 20 2c 0a + + ~ "" + 0a + + ~ " ~ Set "here" to point to the true end." + 20 20 7e 20 53 65 74 20 22 68 65 72 65 22 20 74 + 6f 20 70 6f 69 6e 74 20 74 6f 20 74 68 65 20 74 + 72 75 65 20 65 6e 64 2e 0a + + ~ " drop drop drop drop 7 8 * + here !" + 20 20 64 72 6f 70 20 64 72 6f 70 20 64 72 6f 70 + 20 64 72 6f 70 20 37 20 38 20 2a 20 2b 20 68 65 + 72 65 20 21 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "~ (start, length --)" + 7e 20 28 73 74 61 72 74 2c 20 6c 65 6e 67 74 68 + 20 2d 2d 29 0a + + ~ ": label-forever-alternate" + 3a 20 6c 61 62 65 6c 2d 66 6f 72 65 76 65 72 2d + 61 6c 74 65 72 6e 61 74 65 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' branch" + 20 20 4c 40 27 20 62 72 61 6e 63 68 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " offset-to-target-address-space , ~ : -8 branch #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 62 72 + 61 6e 63 68 20 23 2d 2d 20 28 63 6f 64 65 77 6f + 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " 8 + -1 * ~ : provide-hex" + 20 20 38 20 2b 20 2d 31 20 2a 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 70 72 6f 76 69 + 64 65 2d 68 65 78 0a + + ~ " ~ : 8 # #-- (branch offset)" + 20 20 7e 20 3a 20 38 20 23 20 23 2d 2d 20 28 62 + 72 61 6e 63 68 20 6f 66 66 73 65 74 29 0a + + ~ " , drop" + 20 20 2c 20 64 72 6f 70 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "~ (test start, test length, body start, body length --)" + 7e 20 28 74 65 73 74 20 73 74 61 72 74 2c 20 74 + 65 73 74 20 6c 65 6e 67 74 68 2c 20 62 6f 64 79 + 20 73 74 61 72 74 2c 20 62 6f 64 79 20 6c 65 6e + 67 74 68 20 2d 2d 29 0a + + ~ ": label-while-alternate" + 3a 20 6c 61 62 65 6c 2d 77 68 69 6c 65 2d 61 6c + 74 65 72 6e 61 74 65 0a + + ~ " ~ The conditional branch needs five words." + 20 20 7e 20 54 68 65 20 63 6f 6e 64 69 74 69 6f + 6e 61 6c 20 62 72 61 6e 63 68 20 6e 65 65 64 73 + 20 66 69 76 65 20 77 6f 72 64 73 2e 0a + + ~ " 2dup swap dup 5 8 * + 3roll memmove" + 20 20 32 64 75 70 20 73 77 61 70 20 64 75 70 20 + 35 20 38 20 2a 20 2b 20 33 72 6f 6c 6c 20 6d 65 + 6d 6d 6f 76 65 0a + + ~ " here @ 5 unroll swap dup 3unroll here !" + 20 20 68 65 72 65 20 40 20 35 20 75 6e 72 6f 6c + 6c 20 73 77 61 70 20 64 75 70 20 33 75 6e 72 6f + 6c 6c 20 68 65 72 65 20 21 0a + + ~ " ~ (old here, test start, test length, body start, body" + ~ " length)" + 20 20 7e 20 28 6f 6c 64 20 68 65 72 65 2c 20 74 + 65 73 74 20 73 74 61 72 74 2c 20 74 65 73 74 20 + 6c 65 6e 67 74 68 2c 20 62 6f 64 79 20 73 74 61 + 72 74 2c 20 62 6f 64 79 20 6c 65 6e 67 74 68 29 + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' 0branch" + 20 20 4c 40 27 20 30 62 72 61 6e 63 68 0a + + ~ " L@' !=" + 20 20 4c 40 27 20 21 3d 0a + + ~ " L@' lit" + 20 20 4c 40 27 20 6c 69 74 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " offset-to-target-address-space , ~ : -8 lit #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 6c 69 + 74 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 + 70 6f 69 6e 74 65 72 29 0a + + ~ " 0 ~ : provide-hex" + 20 20 30 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 70 72 6f 76 69 + 64 65 2d 68 65 78 0a + + ~ " , ~ : -8 # #--" + ~ " (integer literal)" + 20 20 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 23 20 + 23 2d 2d 20 28 69 6e 74 65 67 65 72 20 6c 69 74 + 65 72 61 6c 29 0a + + ~ " offset-to-target-address-space , ~ : -8 != #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 21 3d + 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 70 + 6f 69 6e 74 65 72 29 0a + + ~ " ~ Branch past the length field, the body, and the" + ~ " unconditional branch." + 20 20 7e 20 42 72 61 6e 63 68 20 70 61 73 74 20 + 74 68 65 20 6c 65 6e 67 74 68 20 66 69 65 6c 64 + 2c 20 74 68 65 20 62 6f 64 79 2c 20 61 6e 64 20 + 74 68 65 20 75 6e 63 6f 6e 64 69 74 69 6f 6e 61 + 6c 20 62 72 61 6e 63 68 2e 0a + + ~ " offset-to-target-address-space , ~ : -8 0branch #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 30 62 + 72 61 6e 63 68 20 23 2d 2d 20 28 63 6f 64 65 77 + 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " dup 3 8 * + ~ : provide-hex" + 20 20 64 75 70 20 33 20 38 20 2a 20 2b 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 70 72 6f 76 69 + 64 65 2d 68 65 78 0a + + ~ " ~ : 8 # #-- (branch offset)" + 20 20 7e 20 3a 20 38 20 23 20 23 2d 2d 20 28 62 + 72 61 6e 63 68 20 6f 66 66 73 65 74 29 0a + + ~ " ," + 20 20 2c 0a + + ~ " ~ Set "here" to the new end." + 20 20 7e 20 53 65 74 20 22 68 65 72 65 22 20 74 + 6f 20 74 68 65 20 6e 65 77 20 65 6e 64 2e 0a + + ~ " 5 8 * 6 roll + here !" + 20 20 35 20 38 20 2a 20 36 20 72 6f 6c 6c 20 2b + 20 68 65 72 65 20 21 0a + + ~ " ~ (test start, test length, body start, body length)" + 20 20 7e 20 28 74 65 73 74 20 73 74 61 72 74 2c + 20 74 65 73 74 20 6c 65 6e 67 74 68 2c 20 62 6f + 64 79 20 73 74 61 72 74 2c 20 62 6f 64 79 20 6c + 65 6e 67 74 68 29 0a + + ~ " ~ Unconditionally branch backwards past the branch" + ~ " word, the body, the" + 20 20 7e 20 20 20 55 6e 63 6f 6e 64 69 74 69 6f + 6e 61 6c 6c 79 20 62 72 61 6e 63 68 20 62 61 63 + 6b 77 61 72 64 73 20 70 61 73 74 20 74 68 65 20 + 62 72 61 6e 63 68 20 77 6f 72 64 2c 20 74 68 65 + 20 62 6f 64 79 2c 20 74 68 65 0a + + ~ " ~ conditional branch, and the test." + 20 20 7e 20 63 6f 6e 64 69 74 69 6f 6e 61 6c 20 + 62 72 61 6e 63 68 2c 20 61 6e 64 20 74 68 65 20 + 74 65 73 74 2e 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' branch" + 20 20 4c 40 27 20 62 72 61 6e 63 68 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " offset-to-target-address-space , ~ : -8 branch #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 62 72 + 61 6e 63 68 20 23 2d 2d 20 28 63 6f 64 65 77 6f + 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " 6 8 * + swap drop + swap drop -1 * ~ : provide-hex" + 20 20 36 20 38 20 2a 20 2b 20 73 77 61 70 20 64 + 72 6f 70 20 2b 20 73 77 61 70 20 64 72 6f 70 20 + 2d 31 20 2a 20 20 20 7e 20 3a 20 70 72 6f 76 69 + 64 65 2d 68 65 78 0a + + ~ " ~ : 8 # #-- (branch offset)" + 20 20 7e 20 3a 20 38 20 23 20 23 2d 2d 20 28 62 + 72 61 6e 63 68 20 6f 66 66 73 65 74 29 0a + + ~ " ," + 20 20 2c 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This implements the label transform for a single word." + ~ " It is directly" + 7e 20 20 20 54 68 69 73 20 69 6d 70 6c 65 6d 65 + 6e 74 73 20 74 68 65 20 6c 61 62 65 6c 20 74 72 + 61 6e 73 66 6f 72 6d 20 66 6f 72 20 61 20 73 69 + 6e 67 6c 65 20 77 6f 72 64 2e 20 49 74 20 69 73 + 20 64 69 72 65 63 74 6c 79 0a + + ~ "~ analogous to "interpret", and reading" + ~ " language/dynamic/dynamic.e may help in" + 7e 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 22 + 69 6e 74 65 72 70 72 65 74 22 2c 20 61 6e 64 20 + 72 65 61 64 69 6e 67 20 6c 61 6e 67 75 61 67 65 + 2f 64 79 6e 61 6d 69 63 2f 64 79 6e 61 6d 69 63 + 2e 65 20 6d 61 79 20 68 65 6c 70 20 69 6e 0a + + ~ "~ understanding it, though it's meant to still make sense" + ~ " on its own." + 7e 20 75 6e 64 65 72 73 74 61 6e 64 69 6e 67 20 + 69 74 2c 20 74 68 6f 75 67 68 20 69 74 27 73 20 + 6d 65 61 6e 74 20 74 6f 20 73 74 69 6c 6c 20 6d + 61 6b 65 20 73 65 6e 73 65 20 6f 6e 20 69 74 73 + 20 6f 77 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ It expects to be called from "label-transform", below," + ~ " which loops." + 7e 20 49 74 20 65 78 70 65 63 74 73 20 74 6f 20 + 62 65 20 63 61 6c 6c 65 64 20 66 72 6f 6d 20 22 + 6c 61 62 65 6c 2d 74 72 61 6e 73 66 6f 72 6d 22 + 2c 20 62 65 6c 6f 77 2c 20 77 68 69 63 68 20 6c + 6f 6f 70 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (-- done)" + 7e 20 28 2d 2d 20 64 6f 6e 65 29 0a + + ~ ": label-transform-one" + 3a 20 6c 61 62 65 6c 2d 74 72 61 6e 73 66 6f 72 + 6d 2d 6f 6e 65 0a + + ~ " word" + 20 20 77 6f 72 64 0a + + ~ "" + 0a + + ~ " ~ If no word was returned, end the transformation." + 20 20 7e 20 49 66 20 6e 6f 20 77 6f 72 64 20 77 + 61 73 20 72 65 74 75 72 6e 65 64 2c 20 65 6e 64 + 20 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 61 74 + 69 6f 6e 2e 0a + + ~ " dup 0 = { drop 1 exit } if" + 20 20 64 75 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ The string is on the top of the stack, so to get a" + ~ " pointer to it we get" + 20 20 7e 20 54 68 65 20 73 74 72 69 6e 67 20 69 + 73 20 6f 6e 20 74 68 65 20 74 6f 70 20 6f 66 20 + 74 68 65 20 73 74 61 63 6b 2c 20 73 6f 20 74 6f + 20 67 65 74 20 61 20 70 6f 69 6e 74 65 72 20 74 + 6f 20 69 74 20 77 65 20 67 65 74 0a + + ~ " ~ the stack address." + 20 20 7e 20 74 68 65 20 73 74 61 63 6b 20 61 64 + 64 72 65 73 73 2e 0a + + ~ " ~ (string)" + 20 20 7e 20 28 73 74 72 69 6e 67 29 0a + + ~ " value@" + 20 20 76 61 6c 75 65 40 0a + + ~ "" + 0a + + ~ " ~ Check whether it's one of the words we have" + ~ " alternates for, and look up" + 20 20 7e 20 20 20 43 68 65 63 6b 20 77 68 65 74 + 68 65 72 20 69 74 27 73 20 6f 6e 65 20 6f 66 20 + 74 68 65 20 77 6f 72 64 73 20 77 65 20 68 61 76 + 65 20 61 6c 74 65 72 6e 61 74 65 73 20 66 6f 72 + 2c 20 61 6e 64 20 6c 6f 6f 6b 20 75 70 0a + + ~ " ~ the alternate if so." + 20 20 7e 20 74 68 65 20 61 6c 74 65 72 6e 61 74 + 65 20 69 66 20 73 6f 2e 0a + + ~ " dup 0 swap" + 20 20 64 75 70 20 30 20 73 77 61 70 0a + + ~ " ~ (name as stack string, name pointer, placeholder, name" + ~ " pointer)" + 20 20 7e 20 28 6e 61 6d 65 20 61 73 20 73 74 61 + 63 6b 20 73 74 72 69 6e 67 2c 20 6e 61 6d 65 20 + 70 6f 69 6e 74 65 72 2c 20 70 6c 61 63 65 68 6f + 6c 64 65 72 2c 20 6e 61 6d 65 20 70 6f 69 6e 74 + 65 72 29 0a + + ~ " dup s" create" stringcmp 0 = { swap drop '" + ~ " label-create-alternate swap } if" + 20 20 64 75 70 20 73 22 20 63 72 65 61 74 65 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 73 77 61 70 20 64 72 6f 70 20 27 20 6c 61 62 + 65 6c 2d 63 72 65 61 74 65 2d 61 6c 74 65 72 6e + 61 74 65 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " dup s" :" stringcmp 0 = { swap drop '" + ~ " label-colon-alternate swap } if" + 20 20 64 75 70 20 73 22 20 3a 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 73 77 61 70 + 20 64 72 6f 70 20 27 20 6c 61 62 65 6c 2d 63 6f + 6c 6f 6e 2d 61 6c 74 65 72 6e 61 74 65 20 73 77 + 61 70 20 7d 20 69 66 0a + + ~ " dup s" self-codeword" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 73 65 6c 66 2d 63 6f + 64 65 77 6f 72 64 22 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 0a + + ~ " swap drop ' label-self-codeword-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 61 62 65 6c 2d 73 65 6c 66 2d 63 6f 64 65 77 + 6f 72 64 2d 61 6c 74 65 72 6e 61 74 65 20 73 77 + 61 70 20 7d 20 69 66 0a + + ~ " dup s" ;" stringcmp 0 = { swap drop '" + ~ " label-semicolon-alternate swap } if" + 20 20 64 75 70 20 73 22 20 3b 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 73 77 61 70 + 20 64 72 6f 70 20 27 20 6c 61 62 65 6c 2d 73 65 + 6d 69 63 6f 6c 6f 6e 2d 61 6c 74 65 72 6e 61 74 + 65 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " dup s" ;asm" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 3b 61 73 6d 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " swap drop ' label-semicolon-assembly-alternate swap }" + ~ " if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 61 62 65 6c 2d 73 65 6d 69 63 6f 6c 6f 6e 2d + 61 73 73 65 6d 62 6c 79 2d 61 6c 74 65 72 6e 61 + 74 65 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " ~ It is nontrivial to construct a string with a" + ~ " double-quote in it." + 20 20 7e 20 49 74 20 69 73 20 6e 6f 6e 74 72 69 + 76 69 61 6c 20 74 6f 20 63 6f 6e 73 74 72 75 63 + 74 20 61 20 73 74 72 69 6e 67 20 77 69 74 68 20 + 61 20 64 6f 75 62 6c 65 2d 71 75 6f 74 65 20 69 + 6e 20 69 74 2e 0a + + ~ " dup ' s" entry-to-name stringcmp 0 = {" + 20 20 64 75 70 20 27 20 73 22 20 65 6e 74 72 79 + 2d 74 6f 2d 6e 61 6d 65 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 0a + + ~ " swap drop ' label-string-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 61 62 65 6c 2d 73 74 72 69 6e 67 2d 61 6c 74 + 65 72 6e 61 74 65 20 73 77 61 70 20 7d 20 69 66 + 0a + + ~ " dup ' ." entry-to-name stringcmp 0 = {" + 20 20 64 75 70 20 27 20 2e 22 20 65 6e 74 72 79 + 2d 74 6f 2d 6e 61 6d 65 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 0a + + ~ " swap drop ' label-dot-string-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 61 62 65 6c 2d 64 6f 74 2d 73 74 72 69 6e 67 + 2d 61 6c 74 65 72 6e 61 74 65 20 73 77 61 70 20 + 7d 20 69 66 0a + + ~ " dup s" L@'" stringcmp 0 = { swap drop '" + ~ " label-L@'-alternate swap } if" + 20 20 64 75 70 20 73 22 20 4c 40 27 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 73 77 + 61 70 20 64 72 6f 70 20 27 20 6c 61 62 65 6c 2d + 4c 40 27 2d 61 6c 74 65 72 6e 61 74 65 20 73 77 + 61 70 20 7d 20 69 66 0a + + ~ " dup s" L!'" stringcmp 0 = { swap drop '" + ~ " label-L!'-alternate swap } if" + 20 20 64 75 70 20 73 22 20 4c 21 27 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 73 77 + 61 70 20 64 72 6f 70 20 27 20 6c 61 62 65 6c 2d + 4c 21 27 2d 61 6c 74 65 72 6e 61 74 65 20 73 77 + 61 70 20 7d 20 69 66 0a + + ~ " dup s" keyword" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 6b 65 79 77 6f 72 64 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 0a + + ~ " swap drop ' label-keyword-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 61 62 65 6c 2d 6b 65 79 77 6f 72 64 2d 61 6c + 74 65 72 6e 61 74 65 20 73 77 61 70 20 7d 20 69 + 66 0a + + ~ " dup s" if" stringcmp 0 = { swap drop ' label-if-alternate" + ~ " swap } if" + 20 20 64 75 70 20 73 22 20 69 66 22 20 73 74 72 + 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 73 77 61 + 70 20 64 72 6f 70 20 27 20 6c 61 62 65 6c 2d 69 + 66 2d 61 6c 74 65 72 6e 61 74 65 20 73 77 61 70 + 20 7d 20 69 66 0a + + ~ " dup s" unless" stringcmp 0 = { swap drop '" + ~ " label-unless-alternate swap } if" + 20 20 64 75 70 20 73 22 20 75 6e 6c 65 73 73 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 73 77 61 70 20 64 72 6f 70 20 27 20 6c 61 62 + 65 6c 2d 75 6e 6c 65 73 73 2d 61 6c 74 65 72 6e + 61 74 65 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " dup s" if-else" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 69 66 2d 65 6c 73 65 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 0a + + ~ " swap drop ' label-if-else-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 61 62 65 6c 2d 69 66 2d 65 6c 73 65 2d 61 6c + 74 65 72 6e 61 74 65 20 73 77 61 70 20 7d 20 69 + 66 0a + + ~ " dup s" forever" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 66 6f 72 65 76 65 72 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 0a + + ~ " swap drop ' label-forever-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 61 62 65 6c 2d 66 6f 72 65 76 65 72 2d 61 6c + 74 65 72 6e 61 74 65 20 73 77 61 70 20 7d 20 69 + 66 0a + + ~ " dup s" while" stringcmp 0 = { swap drop '" + ~ " label-while-alternate swap } if" + 20 20 64 75 70 20 73 22 20 77 68 69 6c 65 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 73 77 61 70 20 64 72 6f 70 20 27 20 6c 61 62 65 + 6c 2d 77 68 69 6c 65 2d 61 6c 74 65 72 6e 61 74 + 65 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " drop swap" + 20 20 64 72 6f 70 20 73 77 61 70 0a + + ~ " ~ (name as stack string, 0 or alternate entry pointer," + ~ " name pointer)" + 20 20 7e 20 28 6e 61 6d 65 20 61 73 20 73 74 61 + 63 6b 20 73 74 72 69 6e 67 2c 20 30 20 6f 72 20 + 61 6c 74 65 72 6e 61 74 65 20 65 6e 74 72 79 20 + 70 6f 69 6e 74 65 72 2c 20 6e 61 6d 65 20 70 6f + 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " ~ If an alternate was found, the alternate will be used" + ~ " in immediate mode." + 20 20 7e 20 20 20 49 66 20 61 6e 20 61 6c 74 65 + 72 6e 61 74 65 20 77 61 73 20 66 6f 75 6e 64 2c + 20 74 68 65 20 61 6c 74 65 72 6e 61 74 65 20 77 + 69 6c 6c 20 62 65 20 75 73 65 64 20 69 6e 20 69 + 6d 6d 65 64 69 61 74 65 20 6d 6f 64 65 2e 0a + + ~ " ~ If not, we look up the word in the regular," + ~ " non-transformed dictionary" + 20 20 7e 20 49 66 20 6e 6f 74 2c 20 77 65 20 6c + 6f 6f 6b 20 75 70 20 74 68 65 20 77 6f 72 64 20 + 69 6e 20 74 68 65 20 72 65 67 75 6c 61 72 2c 20 + 6e 6f 6e 2d 74 72 61 6e 73 66 6f 72 6d 65 64 20 + 64 69 63 74 69 6f 6e 61 72 79 0a + + ~ " ~ and use that for immediate mode." + 20 20 7e 20 61 6e 64 20 75 73 65 20 74 68 61 74 + 20 66 6f 72 20 69 6d 6d 65 64 69 61 74 65 20 6d + 6f 64 65 2e 0a + + ~ " over { dup" + 20 20 6f 76 65 72 20 7b 20 64 75 70 0a + + ~ " transformation-state" + ~ " transformation-state-saved-latest @ swap find-in" + 20 20 20 20 20 20 20 20 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 + 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 + 74 65 2d 73 61 76 65 64 2d 6c 61 74 65 73 74 20 + 40 20 73 77 61 70 20 66 69 6e 64 2d 69 6e 0a + + ~ " 3roll drop swap } unless" + 20 20 20 20 20 20 20 20 20 33 72 6f 6c 6c 20 64 + 72 6f 70 20 73 77 61 70 20 7d 20 75 6e 6c 65 73 + 73 0a + + ~ " ~ (name as stack string, immediate entry pointer, name" + ~ " pointer)" + 20 20 7e 20 28 6e 61 6d 65 20 61 73 20 73 74 61 + 63 6b 20 73 74 72 69 6e 67 2c 20 69 6d 6d 65 64 + 69 61 74 65 20 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 2c 20 6e 61 6d 65 20 70 6f 69 6e 74 65 72 + 29 0a + + ~ "" + 0a + + ~ " ~ In regular "interpret", we would check whether we" + ~ " found the word before" + 20 20 7e 20 20 20 49 6e 20 72 65 67 75 6c 61 72 + 20 22 69 6e 74 65 72 70 72 65 74 22 2c 20 77 65 + 20 77 6f 75 6c 64 20 63 68 65 63 6b 20 77 68 65 + 74 68 65 72 20 77 65 20 66 6f 75 6e 64 20 74 68 + 65 20 77 6f 72 64 20 62 65 66 6f 72 65 0a + + ~ " ~ checking the mode. However, we have three different" + ~ " places words could" + 20 20 7e 20 63 68 65 63 6b 69 6e 67 20 74 68 65 + 20 6d 6f 64 65 2e 20 48 6f 77 65 76 65 72 2c 20 + 77 65 20 68 61 76 65 20 74 68 72 65 65 20 64 69 + 66 66 65 72 65 6e 74 20 70 6c 61 63 65 73 20 77 + 6f 72 64 73 20 63 6f 75 6c 64 0a + + ~ " ~ come from, so that's not a simple notion. So, we check" + ~ " the mode first." + 20 20 7e 20 63 6f 6d 65 20 66 72 6f 6d 2c 20 73 + 6f 20 74 68 61 74 27 73 20 6e 6f 74 20 61 20 73 + 69 6d 70 6c 65 20 6e 6f 74 69 6f 6e 2e 20 53 6f + 2c 20 77 65 20 63 68 65 63 6b 20 74 68 65 20 6d + 6f 64 65 20 66 69 72 73 74 2e 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " ~ If we're in compile mode, there's still a chance" + ~ " it's an immediate" + 20 20 20 20 7e 20 20 20 49 66 20 77 65 27 72 65 + 20 69 6e 20 63 6f 6d 70 69 6c 65 20 6d 6f 64 65 + 2c 20 74 68 65 72 65 27 73 20 73 74 69 6c 6c 20 + 61 20 63 68 61 6e 63 65 20 69 74 27 73 20 61 6e + 20 69 6d 6d 65 64 69 61 74 65 0a + + ~ " ~ word. First check whether we have an immediate entry," + ~ " then if so, check" + 20 20 20 20 7e 20 77 6f 72 64 2e 20 46 69 72 73 + 74 20 63 68 65 63 6b 20 77 68 65 74 68 65 72 20 + 77 65 20 68 61 76 65 20 61 6e 20 69 6d 6d 65 64 + 69 61 74 65 20 65 6e 74 72 79 2c 20 74 68 65 6e + 20 69 66 20 73 6f 2c 20 63 68 65 63 6b 0a + + ~ " ~ that entry's flags. Notice that this means the" + ~ " generated code can't" + 20 20 20 20 7e 20 74 68 61 74 20 65 6e 74 72 79 + 27 73 20 66 6c 61 67 73 2e 20 4e 6f 74 69 63 65 + 20 74 68 61 74 20 74 68 69 73 20 6d 65 61 6e 73 + 20 74 68 65 20 67 65 6e 65 72 61 74 65 64 20 63 + 6f 64 65 20 63 61 6e 27 74 0a + + ~ " ~ override an immediate word with a non-immediate word" + ~ " of the same name." + 20 20 20 20 7e 20 6f 76 65 72 72 69 64 65 20 61 + 6e 20 69 6d 6d 65 64 69 61 74 65 20 77 6f 72 64 + 20 77 69 74 68 20 61 20 6e 6f 6e 2d 69 6d 6d 65 + 64 69 61 74 65 20 77 6f 72 64 20 6f 66 20 74 68 + 65 20 73 61 6d 65 20 6e 61 6d 65 2e 0a + + ~ " over dup { entry-flags@ 0x01 & not } { not } if-else" + 20 20 20 20 6f 76 65 72 20 64 75 70 20 7b 20 65 + 6e 74 72 79 2d 66 6c 61 67 73 40 20 30 78 30 31 + 20 26 20 6e 6f 74 20 7d 20 7b 20 6e 6f 74 20 7d + 20 69 66 2d 65 6c 73 65 0a + + ~ "" + 0a + + ~ " {" + 20 20 20 20 7b 0a + + ~ " ~ Either there was no immediate entry, or the" + ~ " immediate entry wasn't" + 20 20 20 20 20 20 7e 20 20 20 45 69 74 68 65 72 + 20 74 68 65 72 65 20 77 61 73 20 6e 6f 20 69 6d + 6d 65 64 69 61 74 65 20 65 6e 74 72 79 2c 20 6f + 72 20 74 68 65 20 69 6d 6d 65 64 69 61 74 65 20 + 65 6e 74 72 79 20 77 61 73 6e 27 74 0a + + ~ " ~ flagged as an immediate word. So we check whether" + ~ " this could be a" + 20 20 20 20 20 20 7e 20 66 6c 61 67 67 65 64 20 + 61 73 20 61 6e 20 69 6d 6d 65 64 69 61 74 65 20 + 77 6f 72 64 2e 20 53 6f 20 77 65 20 63 68 65 63 + 6b 20 77 68 65 74 68 65 72 20 74 68 69 73 20 63 + 6f 75 6c 64 20 62 65 20 61 0a + + ~ " ~ compilation." + 20 20 20 20 20 20 7e 20 63 6f 6d 70 69 6c 61 74 + 69 6f 6e 2e 0a + + ~ " ~" + 20 20 20 20 20 20 7e 0a + + ~ " ~ To do this, we need to look the word up in the" + ~ " output buffer. We" + 20 20 20 20 20 20 7e 20 20 20 54 6f 20 64 6f 20 + 74 68 69 73 2c 20 77 65 20 6e 65 65 64 20 74 6f + 20 6c 6f 6f 6b 20 74 68 65 20 77 6f 72 64 20 75 + 70 20 69 6e 20 74 68 65 20 6f 75 74 70 75 74 20 + 62 75 66 66 65 72 2e 20 57 65 0a + + ~ " ~ can't easily traverse the next-entry pointers in" + ~ " the output buffer's" + 20 20 20 20 20 20 7e 20 63 61 6e 27 74 20 65 61 + 73 69 6c 79 20 74 72 61 76 65 72 73 65 20 74 68 + 65 20 6e 65 78 74 2d 65 6e 74 72 79 20 70 6f 69 + 6e 74 65 72 73 20 69 6e 20 74 68 65 20 6f 75 74 + 70 75 74 20 62 75 66 66 65 72 27 73 0a + + ~ " ~ dictionary, so we check the label. Since we don't" + ~ " know the word's name" + 20 20 20 20 20 20 7e 20 64 69 63 74 69 6f 6e 61 + 72 79 2c 20 73 6f 20 77 65 20 63 68 65 63 6b 20 + 74 68 65 20 6c 61 62 65 6c 2e 20 53 69 6e 63 65 + 20 77 65 20 64 6f 6e 27 74 20 6b 6e 6f 77 20 74 + 68 65 20 77 6f 72 64 27 73 20 6e 61 6d 65 0a + + ~ " ~ statically, this is a rare scenario where we can't" + ~ " use the abbreviated" + 20 20 20 20 20 20 7e 20 73 74 61 74 69 63 61 6c + 6c 79 2c 20 74 68 69 73 20 69 73 20 61 20 72 61 + 72 65 20 73 63 65 6e 61 72 69 6f 20 77 68 65 72 + 65 20 77 65 20 63 61 6e 27 74 20 75 73 65 20 74 + 68 65 20 61 62 62 72 65 76 69 61 74 65 64 0a + + ~ " ~ label syntax, but that's easy enough." + 20 20 20 20 20 20 7e 20 6c 61 62 65 6c 20 73 79 + 6e 74 61 78 2c 20 62 75 74 20 74 68 61 74 27 73 + 20 65 61 73 79 20 65 6e 6f 75 67 68 2e 0a + + ~ " ~" + 20 20 20 20 20 20 7e 0a + + ~ " ~ Even though we've ruled out the possibility that" + ~ " the word is only" + 20 20 20 20 20 20 7e 20 20 20 45 76 65 6e 20 74 + 68 6f 75 67 68 20 77 65 27 76 65 20 72 75 6c 65 + 64 20 6f 75 74 20 74 68 65 20 70 6f 73 73 69 62 + 69 6c 69 74 79 20 74 68 61 74 20 74 68 65 20 77 + 6f 72 64 20 69 73 20 6f 6e 6c 79 0a + + ~ " ~ ever used immediately, it is still possible that" + ~ " there's some reason" + 20 20 20 20 20 20 7e 20 65 76 65 72 20 75 73 65 + 64 20 69 6d 6d 65 64 69 61 74 65 6c 79 2c 20 69 + 74 20 69 73 20 73 74 69 6c 6c 20 70 6f 73 73 69 + 62 6c 65 20 74 68 61 74 20 74 68 65 72 65 27 73 + 20 73 6f 6d 65 20 72 65 61 73 6f 6e 0a + + ~ " ~ the word doesn't exist. In particular, it could be" + ~ " an integer literal." + 20 20 20 20 20 20 7e 20 74 68 65 20 77 6f 72 64 + 20 64 6f 65 73 6e 27 74 20 65 78 69 73 74 2e 20 + 49 6e 20 70 61 72 74 69 63 75 6c 61 72 2c 20 69 + 74 20 63 6f 75 6c 64 20 62 65 20 61 6e 20 69 6e + 74 65 67 65 72 20 6c 69 74 65 72 61 6c 2e 0a + + ~ " ~ If we were to call use-label first, that would" + ~ " count as a requirement" + 20 20 20 20 20 20 7e 20 49 66 20 77 65 20 77 65 + 72 65 20 74 6f 20 63 61 6c 6c 20 75 73 65 2d 6c + 61 62 65 6c 20 66 69 72 73 74 2c 20 74 68 61 74 + 20 77 6f 75 6c 64 20 63 6f 75 6e 74 20 61 73 20 + 61 20 72 65 71 75 69 72 65 6d 65 6e 74 0a + + ~ " ~ that the label must eventually be set. We don't" + ~ " want to require that" + 20 20 20 20 20 20 7e 20 74 68 61 74 20 74 68 65 + 20 6c 61 62 65 6c 20 6d 75 73 74 20 65 76 65 6e + 74 75 61 6c 6c 79 20 62 65 20 73 65 74 2e 20 57 + 65 20 64 6f 6e 27 74 20 77 61 6e 74 20 74 6f 20 + 72 65 71 75 69 72 65 20 74 68 61 74 0a + + ~ " ~ quite yet, so we call find-label." + 20 20 20 20 20 20 7e 20 71 75 69 74 65 20 79 65 + 74 2c 20 73 6f 20 77 65 20 63 61 6c 6c 20 66 69 + 6e 64 2d 6c 61 62 65 6c 2e 0a + + ~ " ~" + 20 20 20 20 20 20 7e 0a + + ~ " ~ This check is the means by which forward" + ~ " references are disallowed:" + 20 20 20 20 20 20 7e 20 20 20 54 68 69 73 20 63 + 68 65 63 6b 20 69 73 20 74 68 65 20 6d 65 61 6e + 73 20 62 79 20 77 68 69 63 68 20 66 6f 72 77 61 + 72 64 20 72 65 66 65 72 65 6e 63 65 73 20 61 72 + 65 20 64 69 73 61 6c 6c 6f 77 65 64 3a 0a + + ~ " ~ On the very first pass, a forward-referenced label" + ~ " won't exist yet, so" + 20 20 20 20 20 20 7e 20 4f 6e 20 74 68 65 20 76 + 65 72 79 20 66 69 72 73 74 20 70 61 73 73 2c 20 + 61 20 66 6f 72 77 61 72 64 2d 72 65 66 65 72 65 + 6e 63 65 64 20 6c 61 62 65 6c 20 77 6f 6e 27 74 + 20 65 78 69 73 74 20 79 65 74 2c 20 73 6f 0a + + ~ " ~ transform will give a "no such word" error, which" + ~ " in an ideal world" + 20 20 20 20 20 20 7e 20 74 72 61 6e 73 66 6f 72 + 6d 20 77 69 6c 6c 20 67 69 76 65 20 61 20 22 6e + 6f 20 73 75 63 68 20 77 6f 72 64 22 20 65 72 72 + 6f 72 2c 20 77 68 69 63 68 20 69 6e 20 61 6e 20 + 69 64 65 61 6c 20 77 6f 72 6c 64 0a + + ~ " ~ would prevent there from being a subsequent pass," + ~ " but at the very" + 20 20 20 20 20 20 7e 20 77 6f 75 6c 64 20 70 72 + 65 76 65 6e 74 20 74 68 65 72 65 20 66 72 6f 6d + 20 62 65 69 6e 67 20 61 20 73 75 62 73 65 71 75 + 65 6e 74 20 70 61 73 73 2c 20 62 75 74 20 61 74 + 20 74 68 65 20 76 65 72 79 0a + + ~ " ~ least it will ensure the output isn't a valid ELF." + 20 20 20 20 20 20 7e 20 6c 65 61 73 74 20 69 74 + 20 77 69 6c 6c 20 65 6e 73 75 72 65 20 74 68 65 + 20 6f 75 74 70 75 74 20 69 73 6e 27 74 20 61 20 + 76 61 6c 69 64 20 45 4c 46 2e 0a + + ~ " dup" + 20 20 20 20 20 20 64 75 70 0a + + ~ " swap-transform-variables" + 20 20 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 + 66 6f 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " find-label" + 20 20 20 20 20 20 66 69 6e 64 2d 6c 61 62 65 6c + 0a + + ~ " swap-transform-variables" + 20 20 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 + 66 6f 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " {" + 20 20 20 20 20 20 7b 0a + + ~ " ~ It exists, so we declare our use of it (that's" + ~ " also the only way to" + 20 20 20 20 20 20 20 20 7e 20 20 20 49 74 20 65 + 78 69 73 74 73 2c 20 73 6f 20 77 65 20 64 65 63 + 6c 61 72 65 20 6f 75 72 20 75 73 65 20 6f 66 20 + 69 74 20 28 74 68 61 74 27 73 20 61 6c 73 6f 20 + 74 68 65 20 6f 6e 6c 79 20 77 61 79 20 74 6f 0a + + ~ " ~ get a value for it)." + 20 20 20 20 20 20 20 20 7e 20 67 65 74 20 61 20 + 76 61 6c 75 65 20 66 6f 72 20 69 74 29 2e 0a + + ~ " ~ : provide-string-copy" + 20 20 20 20 20 20 20 20 7e 20 3a 20 70 72 6f 76 + 69 64 65 2d 73 74 72 69 6e 67 2d 63 6f 70 79 0a + + ~ " swap-transform-variables" + 20 20 20 20 20 20 20 20 73 77 61 70 2d 74 72 61 + 6e 73 66 6f 72 6d 2d 76 61 72 69 61 62 6c 65 73 + 0a + + ~ " intern-label use-label" + 20 20 20 20 20 20 20 20 69 6e 74 65 72 6e 2d 6c + 61 62 65 6c 20 75 73 65 2d 6c 61 62 65 6c 0a + + ~ " swap-transform-variables" + 20 20 20 20 20 20 20 20 73 77 61 70 2d 74 72 61 + 6e 73 66 6f 72 6d 2d 76 61 72 69 61 62 6c 65 73 + 0a + + ~ "" + 0a + + ~ " ~ Labels point to codewords (because that's what" + 20 20 20 20 20 20 20 20 7e 20 20 20 4c 61 62 65 + 6c 73 20 70 6f 69 6e 74 20 74 6f 20 63 6f 64 65 + 77 6f 72 64 73 20 28 62 65 63 61 75 73 65 20 74 + 68 61 74 27 73 20 77 68 61 74 0a + + ~ " ~ label-create-alternate does), which is already" + ~ " what we want to" + 20 20 20 20 20 20 20 20 7e 20 6c 61 62 65 6c 2d + 63 72 65 61 74 65 2d 61 6c 74 65 72 6e 61 74 65 + 20 64 6f 65 73 29 2c 20 77 68 69 63 68 20 69 73 + 20 61 6c 72 65 61 64 79 20 77 68 61 74 20 77 65 + 20 77 61 6e 74 20 74 6f 0a + + ~ " ~ output." + 20 20 20 20 20 20 20 20 7e 20 6f 75 74 70 75 74 + 2e 0a + + ~ " ~" + 20 20 20 20 20 20 20 20 7e 0a + + ~ " ~ An important caveat: Though it would require" + ~ " something weird to be" + 20 20 20 20 20 20 20 20 7e 20 20 20 41 6e 20 69 + 6d 70 6f 72 74 61 6e 74 20 63 61 76 65 61 74 3a + 20 54 68 6f 75 67 68 20 69 74 20 77 6f 75 6c 64 + 20 72 65 71 75 69 72 65 20 73 6f 6d 65 74 68 69 + 6e 67 20 77 65 69 72 64 20 74 6f 20 62 65 0a + + ~ " ~ happening, such as a forced forward reference," + ~ " the label may be" + 20 20 20 20 20 20 20 20 7e 20 68 61 70 70 65 6e + 69 6e 67 2c 20 73 75 63 68 20 61 73 20 61 20 66 + 6f 72 63 65 64 20 66 6f 72 77 61 72 64 20 72 65 + 66 65 72 65 6e 63 65 2c 20 74 68 65 20 6c 61 62 + 65 6c 20 6d 61 79 20 62 65 0a + + ~ " ~ zero! We need to allow for that possibility by" + ~ " not examining the" + 20 20 20 20 20 20 20 20 7e 20 7a 65 72 6f 21 20 + 57 65 20 6e 65 65 64 20 74 6f 20 61 6c 6c 6f 77 + 20 66 6f 72 20 74 68 61 74 20 70 6f 73 73 69 62 + 69 6c 69 74 79 20 62 79 20 6e 6f 74 20 65 78 61 + 6d 69 6e 69 6e 67 20 74 68 65 0a + + ~ " ~ contents of a nonexistent entry." + 20 20 20 20 20 20 20 20 7e 20 63 6f 6e 74 65 6e + 74 73 20 6f 66 20 61 20 6e 6f 6e 65 78 69 73 74 + 65 6e 74 20 65 6e 74 72 79 2e 0a + + ~ " ~" + 20 20 20 20 20 20 20 20 7e 0a + + ~ " ~ Fortunately we don't have to look at it, just" + ~ " append it to the log" + 20 20 20 20 20 20 20 20 7e 20 20 20 46 6f 72 74 + 75 6e 61 74 65 6c 79 20 77 65 20 64 6f 6e 27 74 + 20 68 61 76 65 20 74 6f 20 6c 6f 6f 6b 20 61 74 + 20 69 74 2c 20 6a 75 73 74 20 61 70 70 65 6e 64 + 20 69 74 20 74 6f 20 74 68 65 20 6c 6f 67 0a + + ~ " ~ and clean up." + 20 20 20 20 20 20 20 20 7e 20 61 6e 64 20 63 6c + 65 61 6e 20 75 70 2e 0a + + ~ " ~ : 8 # #-- (codeword pointer)" + 20 20 20 20 20 20 20 20 7e 20 3a 20 38 20 23 20 + 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 70 6f + 69 6e 74 65 72 29 0a + + ~ " offset-to-target-address-space , drop dropstring 0" + ~ " exit" + 20 20 20 20 20 20 20 20 6f 66 66 73 65 74 2d 74 + 6f 2d 74 61 72 67 65 74 2d 61 64 64 72 65 73 73 + 2d 73 70 61 63 65 20 2c 20 64 72 6f 70 20 64 72 + 6f 70 73 74 72 69 6e 67 20 30 20 65 78 69 74 0a + + ~ " } if" + 20 20 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ If we got here, we're in compile mode, no label" + ~ " was found, and even" + 20 20 20 20 20 20 7e 20 20 20 49 66 20 77 65 20 + 67 6f 74 20 68 65 72 65 2c 20 77 65 27 72 65 20 + 69 6e 20 63 6f 6d 70 69 6c 65 20 6d 6f 64 65 2c + 20 6e 6f 20 6c 61 62 65 6c 20 77 61 73 20 66 6f + 75 6e 64 2c 20 61 6e 64 20 65 76 65 6e 0a + + ~ " ~ if there was a candidate for an immediate word it" + ~ " wasn't flagged as" + 20 20 20 20 20 20 7e 20 69 66 20 74 68 65 72 65 + 20 77 61 73 20 61 20 63 61 6e 64 69 64 61 74 65 + 20 66 6f 72 20 61 6e 20 69 6d 6d 65 64 69 61 74 + 65 20 77 6f 72 64 20 69 74 20 77 61 73 6e 27 74 + 20 66 6c 61 67 67 65 64 20 61 73 0a + + ~ " ~ immediate. There are two possibilities: It's" + ~ " genuinely missing, or it's" + 20 20 20 20 20 20 7e 20 69 6d 6d 65 64 69 61 74 + 65 2e 20 54 68 65 72 65 20 61 72 65 20 74 77 6f + 20 70 6f 73 73 69 62 69 6c 69 74 69 65 73 3a 20 + 49 74 27 73 20 67 65 6e 75 69 6e 65 6c 79 20 6d + 69 73 73 69 6e 67 2c 20 6f 72 20 69 74 27 73 0a + + ~ " ~ an integer literal. We decline to run the candidate" + ~ " immediate entry," + 20 20 20 20 20 20 7e 20 61 6e 20 69 6e 74 65 67 + 65 72 20 6c 69 74 65 72 61 6c 2e 20 57 65 20 64 + 65 63 6c 69 6e 65 20 74 6f 20 72 75 6e 20 74 68 + 65 20 63 61 6e 64 69 64 61 74 65 20 69 6d 6d 65 + 64 69 61 74 65 20 65 6e 74 72 79 2c 0a + + ~ " ~ even if it exists, because that's not the correct" + ~ " semantics." + 20 20 20 20 20 20 7e 20 65 76 65 6e 20 69 66 20 + 69 74 20 65 78 69 73 74 73 2c 20 62 65 63 61 75 + 73 65 20 74 68 61 74 27 73 20 6e 6f 74 20 74 68 + 65 20 63 6f 72 72 65 63 74 20 73 65 6d 61 6e 74 + 69 63 73 2e 0a + + ~ " ~" + 20 20 20 20 20 20 7e 0a + + ~ " ~ If the word is genuinely missing, we want to make" + ~ " sure we make it" + 20 20 20 20 20 20 7e 20 20 20 49 66 20 74 68 65 + 20 77 6f 72 64 20 69 73 20 67 65 6e 75 69 6e 65 + 6c 79 20 6d 69 73 73 69 6e 67 2c 20 77 65 20 77 + 61 6e 74 20 74 6f 20 6d 61 6b 65 20 73 75 72 65 + 20 77 65 20 6d 61 6b 65 20 69 74 0a + + ~ " ~ all the way to the not-found error-handling code at" + ~ " the end, because" + 20 20 20 20 20 20 7e 20 61 6c 6c 20 74 68 65 20 + 77 61 79 20 74 6f 20 74 68 65 20 6e 6f 74 2d 66 + 6f 75 6e 64 20 65 72 72 6f 72 2d 68 61 6e 64 6c + 69 6e 67 20 63 6f 64 65 20 61 74 20 74 68 65 20 + 65 6e 64 2c 20 62 65 63 61 75 73 65 0a + + ~ " ~ that will be way easier to debug than doing the" + ~ " wrong thing will. Way," + 20 20 20 20 20 20 7e 20 74 68 61 74 20 77 69 6c + 6c 20 62 65 20 77 61 79 20 65 61 73 69 65 72 20 + 74 6f 20 64 65 62 75 67 20 74 68 61 6e 20 64 6f + 69 6e 67 20 74 68 65 20 77 72 6f 6e 67 20 74 68 + 69 6e 67 20 77 69 6c 6c 2e 20 57 61 79 2c 0a + + ~ " ~ way easier. Far less staring at numbers." + 20 20 20 20 20 20 7e 20 77 61 79 20 65 61 73 69 + 65 72 2e 20 46 61 72 20 6c 65 73 73 20 73 74 61 + 72 69 6e 67 20 61 74 20 6e 75 6d 62 65 72 73 2e + 0a + + ~ " ~" + 20 20 20 20 20 20 7e 0a + + ~ " ~ Anyway, we no longer need the immediate entry" + ~ " pointer, so we drop" + 20 20 20 20 20 20 7e 20 20 20 41 6e 79 77 61 79 + 2c 20 77 65 20 6e 6f 20 6c 6f 6e 67 65 72 20 6e + 65 65 64 20 74 68 65 20 69 6d 6d 65 64 69 61 74 + 65 20 65 6e 74 72 79 20 70 6f 69 6e 74 65 72 2c + 20 73 6f 20 77 65 20 64 72 6f 70 0a + + ~ " ~ it." + 20 20 20 20 20 20 7e 20 69 74 2e 0a + + ~ " drop drop" + 20 20 20 20 20 20 64 72 6f 70 20 64 72 6f 70 0a + + ~ " } {" + 20 20 20 20 7d 20 7b 0a + + ~ " ~ If we get here, we're in compile mode, but there" + ~ " was a candidate" + 20 20 20 20 20 20 7e 20 20 20 49 66 20 77 65 20 + 67 65 74 20 68 65 72 65 2c 20 77 65 27 72 65 20 + 69 6e 20 63 6f 6d 70 69 6c 65 20 6d 6f 64 65 2c + 20 62 75 74 20 74 68 65 72 65 20 77 61 73 20 61 + 20 63 61 6e 64 69 64 61 74 65 0a + + ~ " ~ entry for an immediate word, and it was indeed" + ~ " flagged as immediate." + 20 20 20 20 20 20 7e 20 65 6e 74 72 79 20 66 6f + 72 20 61 6e 20 69 6d 6d 65 64 69 61 74 65 20 77 + 6f 72 64 2c 20 61 6e 64 20 69 74 20 77 61 73 20 + 69 6e 64 65 65 64 20 66 6c 61 67 67 65 64 20 61 + 73 20 69 6d 6d 65 64 69 61 74 65 2e 0a + + ~ " ~ So, we run it and exit." + 20 20 20 20 20 20 7e 20 53 6f 2c 20 77 65 20 72 + 75 6e 20 69 74 20 61 6e 64 20 65 78 69 74 2e 0a + + ~ " drop dropstring-with-result entry-to-execution-token" + ~ " execute" + 20 20 20 20 20 20 64 72 6f 70 20 64 72 6f 70 73 + 74 72 69 6e 67 2d 77 69 74 68 2d 72 65 73 75 6c + 74 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 63 75 + 74 65 0a + + ~ " 0 exit" + 20 20 20 20 20 20 30 20 65 78 69 74 0a + + ~ " } if-else" + 20 20 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ "" + 0a + + ~ " ~ This is the end of the compile-mode branch. As you" + ~ " can see by tracing" + 20 20 20 20 7e 20 20 20 54 68 69 73 20 69 73 20 + 74 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 63 + 6f 6d 70 69 6c 65 2d 6d 6f 64 65 20 62 72 61 6e + 63 68 2e 20 41 73 20 79 6f 75 20 63 61 6e 20 73 + 65 65 20 62 79 20 74 72 61 63 69 6e 67 0a + + ~ " ~ through all the above cases, if we got here, the two" + ~ " possibilities are" + 20 20 20 20 7e 20 74 68 72 6f 75 67 68 20 61 6c + 6c 20 74 68 65 20 61 62 6f 76 65 20 63 61 73 65 + 73 2c 20 69 66 20 77 65 20 67 6f 74 20 68 65 72 + 65 2c 20 74 68 65 20 74 77 6f 20 70 6f 73 73 69 + 62 69 6c 69 74 69 65 73 20 61 72 65 0a + + ~ " ~ that the word is genuinely missing, or it's an" + ~ " integer literal." + 20 20 20 20 7e 20 74 68 61 74 20 74 68 65 20 77 + 6f 72 64 20 69 73 20 67 65 6e 75 69 6e 65 6c 79 + 20 6d 69 73 73 69 6e 67 2c 20 6f 72 20 69 74 27 + 73 20 61 6e 20 69 6e 74 65 67 65 72 20 6c 69 74 + 65 72 61 6c 2e 0a + + ~ " ~" + 20 20 20 20 7e 0a + + ~ " ~ Please notice that these are the same two" + ~ " possibilities remaining at" + 20 20 20 20 7e 20 20 20 50 6c 65 61 73 65 20 6e + 6f 74 69 63 65 20 74 68 61 74 20 74 68 65 73 65 + 20 61 72 65 20 74 68 65 20 73 61 6d 65 20 74 77 + 6f 20 70 6f 73 73 69 62 69 6c 69 74 69 65 73 20 + 72 65 6d 61 69 6e 69 6e 67 20 61 74 0a + + ~ " ~ the end of the immediate-mode branch, below." + 20 20 20 20 7e 20 74 68 65 20 65 6e 64 20 6f 66 + 20 74 68 65 20 69 6d 6d 65 64 69 61 74 65 2d 6d + 6f 64 65 20 62 72 61 6e 63 68 2c 20 62 65 6c 6f + 77 2e 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " ~ If we got here, we're in interpret mode. There are" + ~ " three" + 20 20 20 20 7e 20 20 20 49 66 20 77 65 20 67 6f + 74 20 68 65 72 65 2c 20 77 65 27 72 65 20 69 6e + 20 69 6e 74 65 72 70 72 65 74 20 6d 6f 64 65 2e + 20 54 68 65 72 65 20 61 72 65 20 74 68 72 65 65 + 0a + + ~ " ~ possibilities: there's an immediate word which we" + ~ " should run; it's an" + 20 20 20 20 7e 20 70 6f 73 73 69 62 69 6c 69 74 + 69 65 73 3a 20 74 68 65 72 65 27 73 20 61 6e 20 + 69 6d 6d 65 64 69 61 74 65 20 77 6f 72 64 20 77 + 68 69 63 68 20 77 65 20 73 68 6f 75 6c 64 20 72 + 75 6e 3b 20 69 74 27 73 20 61 6e 0a + + ~ " ~ integer literal; or the word is genuinely missing." + 20 20 20 20 7e 20 69 6e 74 65 67 65 72 20 6c 69 + 74 65 72 61 6c 3b 20 6f 72 20 74 68 65 20 77 6f + 72 64 20 69 73 20 67 65 6e 75 69 6e 65 6c 79 20 + 6d 69 73 73 69 6e 67 2e 0a + + ~ " ~" + 20 20 20 20 7e 0a + + ~ " ~ If the immediate entry pointer is non-zero, run it" + ~ " and exit." + 20 20 20 20 7e 20 20 20 49 66 20 74 68 65 20 69 + 6d 6d 65 64 69 61 74 65 20 65 6e 74 72 79 20 70 + 6f 69 6e 74 65 72 20 69 73 20 6e 6f 6e 2d 7a 65 + 72 6f 2c 20 72 75 6e 20 69 74 20 61 6e 64 20 65 + 78 69 74 2e 0a + + ~ " over {" + 20 20 20 20 6f 76 65 72 20 7b 0a + + ~ " drop dropstring-with-result entry-to-execution-token" + ~ " execute" + 20 20 20 20 20 20 64 72 6f 70 20 64 72 6f 70 73 + 74 72 69 6e 67 2d 77 69 74 68 2d 72 65 73 75 6c + 74 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 63 75 + 74 65 0a + + ~ " 0 exit" + 20 20 20 20 20 20 30 20 65 78 69 74 0a + + ~ " } if" + 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ There was no immediate word, so either it's an" + ~ " integer literal or" + 20 20 20 20 7e 20 20 20 54 68 65 72 65 20 77 61 + 73 20 6e 6f 20 69 6d 6d 65 64 69 61 74 65 20 77 + 6f 72 64 2c 20 73 6f 20 65 69 74 68 65 72 20 69 + 74 27 73 20 61 6e 20 69 6e 74 65 67 65 72 20 6c + 69 74 65 72 61 6c 20 6f 72 0a + + ~ " ~ the word is genuinely missing. Please notice that" + ~ " these are the same two" + 20 20 20 20 7e 20 74 68 65 20 77 6f 72 64 20 69 + 73 20 67 65 6e 75 69 6e 65 6c 79 20 6d 69 73 73 + 69 6e 67 2e 20 50 6c 65 61 73 65 20 6e 6f 74 69 + 63 65 20 74 68 61 74 20 74 68 65 73 65 20 61 72 + 65 20 74 68 65 20 73 61 6d 65 20 74 77 6f 0a + + ~ " ~ possibilities remaining at the end of the" + ~ " compile-mode branch, above." + 20 20 20 20 7e 20 70 6f 73 73 69 62 69 6c 69 74 + 69 65 73 20 72 65 6d 61 69 6e 69 6e 67 20 61 74 + 20 74 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 + 63 6f 6d 70 69 6c 65 2d 6d 6f 64 65 20 62 72 61 + 6e 63 68 2c 20 61 62 6f 76 65 2e 0a + + ~ " ~" + 20 20 20 20 7e 0a + + ~ " ~ We no longer need the immediate-mode pointer, so" + ~ " drop it." + 20 20 20 20 7e 20 20 20 57 65 20 6e 6f 20 6c 6f + 6e 67 65 72 20 6e 65 65 64 20 74 68 65 20 69 6d + 6d 65 64 69 61 74 65 2d 6d 6f 64 65 20 70 6f 69 + 6e 74 65 72 2c 20 73 6f 20 64 72 6f 70 20 69 74 + 2e 0a + + ~ " drop drop" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 0a + + ~ " } if-else" + 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " ~ (name as stack string)" + 20 20 7e 20 28 6e 61 6d 65 20 61 73 20 73 74 61 + 63 6b 20 73 74 72 69 6e 67 29 0a + + ~ "" + 0a + + ~ " ~ If we got here, one of two things is true: the word" + ~ " is an integer" + 20 20 7e 20 20 20 49 66 20 77 65 20 67 6f 74 20 + 68 65 72 65 2c 20 6f 6e 65 20 6f 66 20 74 77 6f + 20 74 68 69 6e 67 73 20 69 73 20 74 72 75 65 3a + 20 74 68 65 20 77 6f 72 64 20 69 73 20 61 6e 20 + 69 6e 74 65 67 65 72 0a + + ~ " ~ literal, or it's genuinely missing. We know this" + ~ " because both the mode" + 20 20 7e 20 6c 69 74 65 72 61 6c 2c 20 6f 72 20 + 69 74 27 73 20 67 65 6e 75 69 6e 65 6c 79 20 6d + 69 73 73 69 6e 67 2e 20 57 65 20 6b 6e 6f 77 20 + 74 68 69 73 20 62 65 63 61 75 73 65 20 62 6f 74 + 68 20 74 68 65 20 6d 6f 64 65 0a + + ~ " ~ cases above end with these as the only two remaining" + ~ " possibilities. So" + 20 20 7e 20 63 61 73 65 73 20 61 62 6f 76 65 20 + 65 6e 64 20 77 69 74 68 20 74 68 65 73 65 20 61 + 73 20 74 68 65 20 6f 6e 6c 79 20 74 77 6f 20 72 + 65 6d 61 69 6e 69 6e 67 20 70 6f 73 73 69 62 69 + 6c 69 74 69 65 73 2e 20 53 6f 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ Check whether it's an integer literal. As before, we" + ~ " get the stack" + 20 20 7e 20 20 20 43 68 65 63 6b 20 77 68 65 74 + 68 65 72 20 69 74 27 73 20 61 6e 20 69 6e 74 65 + 67 65 72 20 6c 69 74 65 72 61 6c 2e 20 41 73 20 + 62 65 66 6f 72 65 2c 20 77 65 20 67 65 74 20 74 + 68 65 20 73 74 61 63 6b 0a + + ~ " ~ address and use it as a string pointer." + 20 20 7e 20 61 64 64 72 65 73 73 20 61 6e 64 20 + 75 73 65 20 69 74 20 61 73 20 61 20 73 74 72 69 + 6e 67 20 70 6f 69 6e 74 65 72 2e 0a + + ~ " value@ read-integer 0 = {" + 20 20 76 61 6c 75 65 40 20 72 65 61 64 2d 69 6e + 74 65 67 65 72 20 30 20 3d 20 7b 0a + + ~ " ~ It's a number." + 20 20 20 20 7e 20 49 74 27 73 20 61 20 6e 75 6d + 62 65 72 2e 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d + 66 6c 61 67 73 20 40 20 30 78 30 31 20 26 20 7b + 0a + + ~ " ~ We're in compile mode; append first "lit", then the" + ~ " number, to the" + 20 20 20 20 20 20 7e 20 57 65 27 72 65 20 69 6e + 20 63 6f 6d 70 69 6c 65 20 6d 6f 64 65 3b 20 61 + 70 70 65 6e 64 20 66 69 72 73 74 20 22 6c 69 74 + 22 2c 20 74 68 65 6e 20 74 68 65 20 6e 75 6d 62 + 65 72 2c 20 74 6f 20 74 68 65 0a + + ~ " ~ log. The version of "lit" we use is found by label," + ~ " so it'll be the" + 20 20 20 20 20 20 7e 20 6c 6f 67 2e 20 54 68 65 + 20 76 65 72 73 69 6f 6e 20 6f 66 20 22 6c 69 74 + 22 20 77 65 20 75 73 65 20 69 73 20 66 6f 75 6e + 64 20 62 79 20 6c 61 62 65 6c 2c 20 73 6f 20 69 + 74 27 6c 6c 20 62 65 20 74 68 65 0a + + ~ " ~ one that exists when this code is ultimately run." + 20 20 20 20 20 20 7e 20 6f 6e 65 20 74 68 61 74 + 20 65 78 69 73 74 73 20 77 68 65 6e 20 74 68 69 + 73 20 63 6f 64 65 20 69 73 20 75 6c 74 69 6d 61 + 74 65 6c 79 20 72 75 6e 2e 0a + + ~ " dropstring-with-result" + 20 20 20 20 20 20 64 72 6f 70 73 74 72 69 6e 67 + 2d 77 69 74 68 2d 72 65 73 75 6c 74 0a + + ~ "" + 0a + + ~ " ~ We look up "lit" as a label." + 20 20 20 20 20 20 7e 20 57 65 20 6c 6f 6f 6b 20 + 75 70 20 22 6c 69 74 22 20 61 73 20 61 20 6c 61 + 62 65 6c 2e 0a + + ~ " swap-transform-variables L@' lit" + ~ " swap-transform-variables" + 20 20 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 + 66 6f 72 6d 2d 76 61 72 69 61 62 6c 65 73 20 4c + 40 27 20 6c 69 74 20 73 77 61 70 2d 74 72 61 6e + 73 66 6f 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " offset-to-target-address-space" + 20 20 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d + 74 61 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 + 70 61 63 65 0a + + ~ " ~ : 8 lit #-- (codeword pointer)" + 20 20 20 20 20 20 7e 20 3a 20 38 20 6c 69 74 20 + 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 70 6f + 69 6e 74 65 72 29 0a + + ~ " ," + 20 20 20 20 20 20 2c 0a + + ~ " ~ : provide-hex" + 20 20 20 20 20 20 7e 20 3a 20 70 72 6f 76 69 64 + 65 2d 68 65 78 0a + + ~ " ~ : 8 # #-- (integer literal)" + 20 20 20 20 20 20 7e 20 3a 20 38 20 23 20 23 2d + 2d 20 28 69 6e 74 65 67 65 72 20 6c 69 74 65 72 + 61 6c 29 0a + + ~ " ," + 20 20 20 20 20 20 2c 0a + + ~ " 0 exit" + 20 20 20 20 20 20 30 20 65 78 69 74 0a + + ~ " } if" + 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ We're in interpret mode; push the number to the" + ~ " stack. Or at least, that's" + 20 20 20 20 7e 20 57 65 27 72 65 20 69 6e 20 69 + 6e 74 65 72 70 72 65 74 20 6d 6f 64 65 3b 20 70 + 75 73 68 20 74 68 65 20 6e 75 6d 62 65 72 20 74 + 6f 20 74 68 65 20 73 74 61 63 6b 2e 20 4f 72 20 + 61 74 20 6c 65 61 73 74 2c 20 74 68 61 74 27 73 + + ~ "" + 0a + + ~ " ~ what the code we're interpreting will see. Really" + ~ " it's already on the" + 20 20 20 20 7e 20 77 68 61 74 20 74 68 65 20 63 + 6f 64 65 20 77 65 27 72 65 20 69 6e 74 65 72 70 + 72 65 74 69 6e 67 20 77 69 6c 6c 20 73 65 65 2e + 20 52 65 61 6c 6c 79 20 69 74 27 73 20 61 6c 72 + 65 61 64 79 20 6f 6e 20 74 68 65 0a + + ~ " ~ stack, just clean everything else up and leave it" + ~ " there." + 20 20 20 20 7e 20 73 74 61 63 6b 2c 20 6a 75 73 + 74 20 63 6c 65 61 6e 20 65 76 65 72 79 74 68 69 + 6e 67 20 65 6c 73 65 20 75 70 20 61 6e 64 20 6c + 65 61 76 65 20 69 74 20 74 68 65 72 65 2e 0a + + ~ " dropstring-with-result" + 20 20 20 20 64 72 6f 70 73 74 72 69 6e 67 2d 77 + 69 74 68 2d 72 65 73 75 6c 74 0a + + ~ " 0 exit" + 20 20 20 20 30 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ If it's neither in the dictionary nor a number, just" + ~ " print an error." + 20 20 7e 20 20 20 49 66 20 69 74 27 73 20 6e 65 + 69 74 68 65 72 20 69 6e 20 74 68 65 20 64 69 63 + 74 69 6f 6e 61 72 79 20 6e 6f 72 20 61 20 6e 75 + 6d 62 65 72 2c 20 6a 75 73 74 20 70 72 69 6e 74 + 20 61 6e 20 65 72 72 6f 72 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ It's really important, when maintaining this code, to" + ~ " make sure that all" + 20 20 7e 20 20 20 49 74 27 73 20 72 65 61 6c 6c + 79 20 69 6d 70 6f 72 74 61 6e 74 2c 20 77 68 65 + 6e 20 6d 61 69 6e 74 61 69 6e 69 6e 67 20 74 68 + 69 73 20 63 6f 64 65 2c 20 74 6f 20 6d 61 6b 65 + 20 73 75 72 65 20 74 68 61 74 20 61 6c 6c 0a + + ~ " ~ the possible ways the word can fail to exist, end up" + ~ " here. Doing anything" + 20 20 7e 20 74 68 65 20 70 6f 73 73 69 62 6c 65 + 20 77 61 79 73 20 74 68 65 20 77 6f 72 64 20 63 + 61 6e 20 66 61 69 6c 20 74 6f 20 65 78 69 73 74 + 2c 20 65 6e 64 20 75 70 20 68 65 72 65 2e 20 44 + 6f 69 6e 67 20 61 6e 79 74 68 69 6e 67 0a + + ~ " ~ else is going to result in many hours of trying to" + ~ " untangle the" + 20 20 7e 20 65 6c 73 65 20 69 73 20 67 6f 69 6e + 67 20 74 6f 20 72 65 73 75 6c 74 20 69 6e 20 6d + 61 6e 79 20 68 6f 75 72 73 20 6f 66 20 74 72 79 + 69 6e 67 20 74 6f 20 75 6e 74 61 6e 67 6c 65 20 + 74 68 65 0a + + ~ " ~ consequences of incorrect behavior, after-the-fact." + 20 20 7e 20 63 6f 6e 73 65 71 75 65 6e 63 65 73 + 20 6f 66 20 69 6e 63 6f 72 72 65 63 74 20 62 65 + 68 61 76 69 6f 72 2c 20 61 66 74 65 72 2d 74 68 + 65 2d 66 61 63 74 2e 0a + + ~ " s" No such word: " emitstring value@ emitstring newline" + ~ " dropstring 0 ;" + 20 20 73 22 20 4e 6f 20 73 75 63 68 20 77 6f 72 + 64 3a 20 22 20 65 6d 69 74 73 74 72 69 6e 67 20 + 76 61 6c 75 65 40 20 65 6d 69 74 73 74 72 69 6e + 67 20 6e 65 77 6c 69 6e 65 20 64 72 6f 70 73 74 + 72 69 6e 67 20 30 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This implements the label transform for all words in a" + ~ " region given as an" + 7e 20 20 20 54 68 69 73 20 69 6d 70 6c 65 6d 65 + 6e 74 73 20 74 68 65 20 6c 61 62 65 6c 20 74 72 + 61 6e 73 66 6f 72 6d 20 66 6f 72 20 61 6c 6c 20 + 77 6f 72 64 73 20 69 6e 20 61 20 72 65 67 69 6f + 6e 20 67 69 76 65 6e 20 61 73 20 61 6e 0a + + ~ "~ input string. It is directly analogous to "quit", in" + ~ " interpet.e, but is far" + 7e 20 69 6e 70 75 74 20 73 74 72 69 6e 67 2e 20 + 49 74 20 69 73 20 64 69 72 65 63 74 6c 79 20 61 + 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 22 71 75 69 + 74 22 2c 20 69 6e 20 69 6e 74 65 72 70 65 74 2e + 65 2c 20 62 75 74 20 69 73 20 66 61 72 0a + + ~ "~ more complex." + 7e 20 6d 6f 72 65 20 63 6f 6d 70 6c 65 78 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (output buffer start, output point, input string pointer" + 7e 20 28 6f 75 74 70 75 74 20 62 75 66 66 65 72 + 20 73 74 61 72 74 2c 20 6f 75 74 70 75 74 20 70 + 6f 69 6e 74 2c 20 69 6e 70 75 74 20 73 74 72 69 + 6e 67 20 70 6f 69 6e 74 65 72 0a + + ~ "~ -- output buffer start, output point, final entry" + ~ " pointer)" + 7e 20 20 2d 2d 20 6f 75 74 70 75 74 20 62 75 66 + 66 65 72 20 73 74 61 72 74 2c 20 6f 75 74 70 75 + 74 20 70 6f 69 6e 74 2c 20 66 69 6e 61 6c 20 65 + 6e 74 72 79 20 70 6f 69 6e 74 65 72 29 0a + + ~ ": label-transform" + 3a 20 6c 61 62 65 6c 2d 74 72 61 6e 73 66 6f 72 + 6d 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~" + ~ " ~ ~ ~ ~ ~ ~ ~ ~ ~" + 20 20 7e 20 3a 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 0a + + ~ " ~ : ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~" + ~ " ~ ~ ~ ~ ~ ~ ~ ~ ~ ~" + 20 20 7e 20 3a 20 20 7e 20 7e 20 7e 20 7e 20 7e + 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e + 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e + 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e + 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 0a + + ~ " ~ : ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~" + ~ " ~ ~ ~ ~ ~ ~ ~ ~ ~" + 20 20 7e 20 3a 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 0a + + ~ " ~ :" + ~ " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + ~ "~~~~~~~~~~~~~" + 20 20 7e 20 3a 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : This is the start of a long block of code which has" + ~ " been processed by" + 20 20 7e 20 3a 20 20 20 54 68 69 73 20 69 73 20 + 74 68 65 20 73 74 61 72 74 20 6f 66 20 61 20 6c + 6f 6e 67 20 62 6c 6f 63 6b 20 6f 66 20 63 6f 64 + 65 20 77 68 69 63 68 20 68 61 73 20 62 65 65 6e + 20 70 72 6f 63 65 73 73 65 64 20 62 79 0a + + ~ " ~ : the label transform, meaning it consists of" + ~ " ready-to-run Forth word" + 20 20 7e 20 3a 20 74 68 65 20 6c 61 62 65 6c 20 + 74 72 61 6e 73 66 6f 72 6d 2c 20 6d 65 61 6e 69 + 6e 67 20 69 74 20 63 6f 6e 73 69 73 74 73 20 6f + 66 20 72 65 61 64 79 2d 74 6f 2d 72 75 6e 20 46 + 6f 72 74 68 20 77 6f 72 64 0a + + ~ " ~ : definitions that reference each other by address," + ~ " suitable for direct" + 20 20 7e 20 3a 20 64 65 66 69 6e 69 74 69 6f 6e + 73 20 74 68 61 74 20 72 65 66 65 72 65 6e 63 65 + 20 65 61 63 68 20 6f 74 68 65 72 20 62 79 20 61 + 64 64 72 65 73 73 2c 20 73 75 69 74 61 62 6c 65 + 20 66 6f 72 20 64 69 72 65 63 74 0a + + ~ " ~ : execution as soon as the cold-start routine has set" + ~ " up the basic" + 20 20 7e 20 3a 20 65 78 65 63 75 74 69 6f 6e 20 + 61 73 20 73 6f 6f 6e 20 61 73 20 74 68 65 20 63 + 6f 6c 64 2d 73 74 61 72 74 20 72 6f 75 74 69 6e + 65 20 68 61 73 20 73 65 74 20 75 70 20 74 68 65 + 20 62 61 73 69 63 0a + + ~ " ~ : registers, flags, and memory areas that form" + ~ " Evocation's internal ABI." + 20 20 7e 20 3a 20 72 65 67 69 73 74 65 72 73 2c + 20 66 6c 61 67 73 2c 20 61 6e 64 20 6d 65 6d 6f + 72 79 20 61 72 65 61 73 20 74 68 61 74 20 66 6f + 72 6d 20 45 76 6f 63 61 74 69 6f 6e 27 73 20 69 + 6e 74 65 72 6e 61 6c 20 41 42 49 2e 0a + + ~ " ~ :" + 20 20 7e 20 3a 0a + + ~ " ~ : Each word definition consists of a dictionary entry" + ~ " header, a" + 20 20 7e 20 3a 20 20 20 45 61 63 68 20 77 6f 72 + 64 20 64 65 66 69 6e 69 74 69 6f 6e 20 63 6f 6e + 73 69 73 74 73 20 6f 66 20 61 20 64 69 63 74 69 + 6f 6e 61 72 79 20 65 6e 74 72 79 20 68 65 61 64 + 65 72 2c 20 61 0a + + ~ " ~ : codeword, and a word body. For words implemented as" + ~ " Forth code, the" + 20 20 7e 20 3a 20 63 6f 64 65 77 6f 72 64 2c 20 + 61 6e 64 20 61 20 77 6f 72 64 20 62 6f 64 79 2e + 20 46 6f 72 20 77 6f 72 64 73 20 69 6d 70 6c 65 + 6d 65 6e 74 65 64 20 61 73 20 46 6f 72 74 68 20 + 63 6f 64 65 2c 20 74 68 65 0a + + ~ " ~ : codeword points to the "docol" routine, and the word" + ~ " body is an array of" + 20 20 7e 20 3a 20 63 6f 64 65 77 6f 72 64 20 70 + 6f 69 6e 74 73 20 74 6f 20 74 68 65 20 22 64 6f + 63 6f 6c 22 20 72 6f 75 74 69 6e 65 2c 20 61 6e + 64 20 74 68 65 20 77 6f 72 64 20 62 6f 64 79 20 + 69 73 20 61 6e 20 61 72 72 61 79 20 6f 66 0a + + ~ " ~ : pointers to the codewords of other words," + ~ " occasionally interspersed with" + 20 20 7e 20 3a 20 70 6f 69 6e 74 65 72 73 20 74 + 6f 20 74 68 65 20 63 6f 64 65 77 6f 72 64 73 20 + 6f 66 20 6f 74 68 65 72 20 77 6f 72 64 73 2c 20 + 6f 63 63 61 73 69 6f 6e 61 6c 6c 79 20 69 6e 74 + 65 72 73 70 65 72 73 65 64 20 77 69 74 68 0a + + ~ " ~ : literal values. For words implemented as machine" + ~ " code, the codeword" + 20 20 7e 20 3a 20 6c 69 74 65 72 61 6c 20 76 61 + 6c 75 65 73 2e 20 46 6f 72 20 77 6f 72 64 73 20 + 69 6d 70 6c 65 6d 65 6e 74 65 64 20 61 73 20 6d + 61 63 68 69 6e 65 20 63 6f 64 65 2c 20 74 68 65 + 20 63 6f 64 65 77 6f 72 64 0a + + ~ " ~ : points to the start of the body, and the body is the" + ~ " machine code." + 20 20 7e 20 3a 20 70 6f 69 6e 74 73 20 74 6f 20 + 74 68 65 20 73 74 61 72 74 20 6f 66 20 74 68 65 + 20 62 6f 64 79 2c 20 61 6e 64 20 74 68 65 20 62 + 6f 64 79 20 69 73 20 74 68 65 20 6d 61 63 68 69 + 6e 65 20 63 6f 64 65 2e 0a + + ~ " ~ :" + 20 20 7e 20 3a 0a + + ~ " ~ : All the word entry headers in this code link to" + ~ " each other, from last" + 20 20 7e 20 3a 20 20 20 41 6c 6c 20 74 68 65 20 + 77 6f 72 64 20 65 6e 74 72 79 20 68 65 61 64 65 + 72 73 20 69 6e 20 74 68 69 73 20 63 6f 64 65 20 + 6c 69 6e 6b 20 74 6f 20 65 61 63 68 20 6f 74 68 + 65 72 2c 20 66 72 6f 6d 20 6c 61 73 74 0a + + ~ " ~ : backwards to first, forming an Evocation dictionary." + 20 20 7e 20 3a 20 62 61 63 6b 77 61 72 64 73 20 + 74 6f 20 66 69 72 73 74 2c 20 66 6f 72 6d 69 6e + 67 20 61 6e 20 45 76 6f 63 61 74 69 6f 6e 20 64 + 69 63 74 69 6f 6e 61 72 79 2e 0a + + ~ " ~ :" + 20 20 7e 20 3a 0a + + ~ " ~ : The warm-start routine relies on words defined by" + ~ " the label transform," + 20 20 7e 20 3a 20 20 20 54 68 65 20 77 61 72 6d + 2d 73 74 61 72 74 20 72 6f 75 74 69 6e 65 20 72 + 65 6c 69 65 73 20 6f 6e 20 77 6f 72 64 73 20 64 + 65 66 69 6e 65 64 20 62 79 20 74 68 65 20 6c 61 + 62 65 6c 20 74 72 61 6e 73 66 6f 72 6d 2c 0a + + ~ " ~ : as does the log-load routine." + 20 20 7e 20 3a 20 61 73 20 64 6f 65 73 20 74 68 + 65 20 6c 6f 67 2d 6c 6f 61 64 20 72 6f 75 74 69 + 6e 65 2e 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ "" + 0a + + ~ " main-input-buffer dup push-input-buffer" + 20 20 6d 61 69 6e 2d 69 6e 70 75 74 2d 62 75 66 + 66 65 72 20 64 75 70 20 70 75 73 68 2d 69 6e 70 + 75 74 2d 62 75 66 66 65 72 0a + + ~ " swap attach-string-to-input-buffer" + 20 20 73 77 61 70 20 61 74 74 61 63 68 2d 73 74 + 72 69 6e 67 2d 74 6f 2d 69 6e 70 75 74 2d 62 75 + 66 66 65 72 0a + + ~ "" + 0a + + ~ " ~ Save the old values of "here" and "latest", and set" + ~ " the initial values" + 20 20 7e 20 20 20 53 61 76 65 20 74 68 65 20 6f + 6c 64 20 76 61 6c 75 65 73 20 6f 66 20 22 68 65 + 72 65 22 20 61 6e 64 20 22 6c 61 74 65 73 74 22 + 2c 20 61 6e 64 20 73 65 74 20 74 68 65 20 69 6e + 69 74 69 61 6c 20 76 61 6c 75 65 73 0a + + ~ " ~ of the internal ones. These values need to persist" + ~ " across iterations," + 20 20 7e 20 6f 66 20 74 68 65 20 69 6e 74 65 72 + 6e 61 6c 20 6f 6e 65 73 2e 20 54 68 65 73 65 20 + 76 61 6c 75 65 73 20 6e 65 65 64 20 74 6f 20 70 + 65 72 73 69 73 74 20 61 63 72 6f 73 73 20 69 74 + 65 72 61 74 69 6f 6e 73 2c 0a + + ~ " ~ since client code will make its own updates to them and" + ~ " then rely on those" + 20 20 7e 20 73 69 6e 63 65 20 63 6c 69 65 6e 74 + 20 63 6f 64 65 20 77 69 6c 6c 20 6d 61 6b 65 20 + 69 74 73 20 6f 77 6e 20 75 70 64 61 74 65 73 20 + 74 6f 20 74 68 65 6d 20 61 6e 64 20 74 68 65 6e + 20 72 65 6c 79 20 6f 6e 20 74 68 6f 73 65 0a + + ~ " ~ updates having taken effect. So we do the swap just" + ~ " once, here outside the" + 20 20 7e 20 75 70 64 61 74 65 73 20 68 61 76 69 + 6e 67 20 74 61 6b 65 6e 20 65 66 66 65 63 74 2e + 20 53 6f 20 77 65 20 64 6f 20 74 68 65 20 73 77 + 61 70 20 6a 75 73 74 20 6f 6e 63 65 2c 20 68 65 + 72 65 20 6f 75 74 73 69 64 65 20 74 68 65 0a + + ~ " ~ loop, and set it back when the loop ends." + 20 20 7e 20 6c 6f 6f 70 2c 20 61 6e 64 20 73 65 + 74 20 69 74 20 62 61 63 6b 20 77 68 65 6e 20 74 + 68 65 20 6c 6f 6f 70 20 65 6e 64 73 2e 0a + + ~ " here @ transformation-state" + ~ " transformation-state-saved-here !" + 20 20 68 65 72 65 20 40 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 + 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 + 74 65 2d 73 61 76 65 64 2d 68 65 72 65 20 21 0a + + ~ " latest @ transformation-state" + ~ " transformation-state-saved-latest !" + 20 20 6c 61 74 65 73 74 20 40 20 74 72 61 6e 73 + 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 + 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 + 74 61 74 65 2d 73 61 76 65 64 2d 6c 61 74 65 73 + 74 20 21 0a + + ~ " swap transformation-state" + ~ " transformation-state-output-buffer-start !" + 20 20 73 77 61 70 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e + 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 + 2d 6f 75 74 70 75 74 2d 62 75 66 66 65 72 2d 73 + 74 61 72 74 20 21 0a + + ~ " here !" + 20 20 68 65 72 65 20 21 0a + + ~ " 0 latest !" + 20 20 30 20 6c 61 74 65 73 74 20 21 0a + + ~ " ~ Now the stack has nothing of ours on it, so client code" + ~ " can do its thing." + 20 20 7e 20 4e 6f 77 20 74 68 65 20 73 74 61 63 + 6b 20 68 61 73 20 6e 6f 74 68 69 6e 67 20 6f 66 + 20 6f 75 72 73 20 6f 6e 20 69 74 2c 20 73 6f 20 + 63 6c 69 65 6e 74 20 63 6f 64 65 20 63 61 6e 20 + 64 6f 20 69 74 73 20 74 68 69 6e 67 2e 0a + + ~ "" + 0a + + ~ " ~ It's important that the stack has nothing of ours on" + ~ " it that persists" + 20 20 7e 20 20 20 49 74 27 73 20 69 6d 70 6f 72 + 74 61 6e 74 20 74 68 61 74 20 74 68 65 20 73 74 + 61 63 6b 20 68 61 73 20 6e 6f 74 68 69 6e 67 20 + 6f 66 20 6f 75 72 73 20 6f 6e 20 69 74 20 74 68 + 61 74 20 70 65 72 73 69 73 74 73 0a + + ~ " ~ across iterations, so that client code can add and" + ~ " remove stuff there as" + 20 20 7e 20 61 63 72 6f 73 73 20 69 74 65 72 61 + 74 69 6f 6e 73 2c 20 73 6f 20 74 68 61 74 20 63 + 6c 69 65 6e 74 20 63 6f 64 65 20 63 61 6e 20 61 + 64 64 20 61 6e 64 20 72 65 6d 6f 76 65 20 73 74 + 75 66 66 20 74 68 65 72 65 20 61 73 0a + + ~ " ~ it sees fit." + 20 20 7e 20 69 74 20 73 65 65 73 20 66 69 74 2e + 0a + + ~ " { label-transform-one" + 20 20 7b 20 6c 61 62 65 6c 2d 74 72 61 6e 73 66 + 6f 72 6d 2d 6f 6e 65 0a + + ~ " ~ (..., done)" + 20 20 20 20 7e 20 28 2e 2e 2e 2c 20 64 6f 6e 65 + 29 0a + + ~ "" + 0a + + ~ " ~ When the loop is done, get the real values of "here"" + ~ " and "latest"" + 20 20 20 20 7e 20 20 57 68 65 6e 20 74 68 65 20 + 6c 6f 6f 70 20 69 73 20 64 6f 6e 65 2c 20 67 65 + 74 20 74 68 65 20 72 65 61 6c 20 76 61 6c 75 65 + 73 20 6f 66 20 22 68 65 72 65 22 20 61 6e 64 20 + 22 6c 61 74 65 73 74 22 0a + + ~ " ~ back. The internal "here" is also the output point," + ~ " and will become our" + 20 20 20 20 7e 20 62 61 63 6b 2e 20 54 68 65 20 + 69 6e 74 65 72 6e 61 6c 20 22 68 65 72 65 22 20 + 69 73 20 61 6c 73 6f 20 74 68 65 20 6f 75 74 70 + 75 74 20 70 6f 69 6e 74 2c 20 61 6e 64 20 77 69 + 6c 6c 20 62 65 63 6f 6d 65 20 6f 75 72 0a + + ~ " ~ return value. The internal "latest" is returned as a" + ~ " result." + 20 20 20 20 7e 20 72 65 74 75 72 6e 20 76 61 6c + 75 65 2e 20 54 68 65 20 69 6e 74 65 72 6e 61 6c + 20 22 6c 61 74 65 73 74 22 20 69 73 20 72 65 74 + 75 72 6e 65 64 20 61 73 20 61 20 72 65 73 75 6c + 74 2e 0a + + ~ " { transformation-state" + ~ " transformation-state-output-buffer-start @" + 20 20 20 20 7b 20 74 72 61 6e 73 66 6f 72 6d 61 + 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 + 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d + 6f 75 74 70 75 74 2d 62 75 66 66 65 72 2d 73 74 + 61 72 74 20 40 0a + + ~ " here @" + 20 20 20 20 20 20 68 65 72 65 20 40 0a + + ~ " latest @ 3unroll" + 20 20 20 20 20 20 6c 61 74 65 73 74 20 40 20 33 + 75 6e 72 6f 6c 6c 0a + + ~ " transformation-state transformation-state-saved-here" + ~ " @ here !" + 20 20 20 20 20 20 74 72 61 6e 73 66 6f 72 6d 61 + 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 + 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d + 73 61 76 65 64 2d 68 65 72 65 20 40 20 68 65 72 + 65 20 21 0a + + ~ " transformation-state" + ~ " transformation-state-saved-latest @ latest !" + 20 20 20 20 20 20 74 72 61 6e 73 66 6f 72 6d 61 + 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 + 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d + 73 61 76 65 64 2d 6c 61 74 65 73 74 20 40 20 6c + 61 74 65 73 74 20 21 0a + + ~ " ~ (final entry pointer, output buffer start, output" + ~ " point)" + 20 20 20 20 20 20 7e 20 28 66 69 6e 61 6c 20 65 + 6e 74 72 79 20 70 6f 69 6e 74 65 72 2c 20 6f 75 + 74 70 75 74 20 62 75 66 66 65 72 20 73 74 61 72 + 74 2c 20 6f 75 74 70 75 74 20 70 6f 69 6e 74 29 + 0a + + ~ "" + 0a + + ~ " ~ Though we don't actually use transformation-state" + ~ " outside of this" + 20 20 20 20 20 20 7e 20 20 20 54 68 6f 75 67 68 + 20 77 65 20 64 6f 6e 27 74 20 61 63 74 75 61 6c + 6c 79 20 75 73 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 20 6f 75 74 73 + 69 64 65 20 6f 66 20 74 68 69 73 0a + + ~ " ~ invocation, for tidiness we zero it out." + 20 20 20 20 20 20 7e 20 69 6e 76 6f 63 61 74 69 + 6f 6e 2c 20 66 6f 72 20 74 69 64 69 6e 65 73 73 + 20 77 65 20 7a 65 72 6f 20 69 74 20 6f 75 74 2e + 0a + + ~ " 0 transformation-state" + ~ " transformation-state-saved-here !" + 20 20 20 20 20 20 30 20 74 72 61 6e 73 66 6f 72 + 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 + 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 + 65 2d 73 61 76 65 64 2d 68 65 72 65 20 21 0a + + ~ " 0 transformation-state" + ~ " transformation-state-saved-latest !" + 20 20 20 20 20 20 30 20 74 72 61 6e 73 66 6f 72 + 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 + 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 + 65 2d 73 61 76 65 64 2d 6c 61 74 65 73 74 20 21 + 0a + + ~ " 0 transformation-state" + ~ " transformation-state-output-buffer-start !" + 20 20 20 20 20 20 30 20 74 72 61 6e 73 66 6f 72 + 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 + 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 + 65 2d 6f 75 74 70 75 74 2d 62 75 66 66 65 72 2d + 73 74 61 72 74 20 21 0a + + ~ "" + 0a + + ~ " ~ Also put the input source back how it was." + 20 20 20 20 20 20 7e 20 20 41 6c 73 6f 20 70 75 + 74 20 74 68 65 20 69 6e 70 75 74 20 73 6f 75 72 + 63 65 20 62 61 63 6b 20 68 6f 77 20 69 74 20 77 + 61 73 2e 0a + + ~ " main-input-buffer pop-input-buffer" + 20 20 20 20 20 20 6d 61 69 6e 2d 69 6e 70 75 74 + 2d 62 75 66 66 65 72 20 70 6f 70 2d 69 6e 70 75 + 74 2d 62 75 66 66 65 72 0a + + ~ "" + 0a + + ~ " 3roll 2 pick -" + 20 20 20 20 20 20 33 72 6f 6c 6c 20 32 20 70 69 + 63 6b 20 2d 0a + + ~ " ~ (output buffer start, output point, final entry" + ~ " offset)" + 20 20 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 + 62 75 66 66 65 72 20 73 74 61 72 74 2c 20 6f 75 + 74 70 75 74 20 70 6f 69 6e 74 2c 20 66 69 6e 61 + 6c 20 65 6e 74 72 79 20 6f 66 66 73 65 74 29 0a + + ~ "" + 0a + + ~ " exit } if } forever ;" + 20 20 20 20 20 20 65 78 69 74 20 7d 20 69 66 20 + 7d 20 66 6f 72 65 76 65 72 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Log-load transform implementation" + 7e 20 4c 6f 67 2d 6c 6f 61 64 20 74 72 61 6e 73 + 66 6f 72 6d 20 69 6d 70 6c 65 6d 65 6e 74 61 74 + 69 6f 6e 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 0a + + ~ "~" + 7e 0a + + ~ "~ The following code is all part of implementing the" + ~ " log-load transform." + 7e 20 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e + 67 20 63 6f 64 65 20 69 73 20 61 6c 6c 20 70 61 + 72 74 20 6f 66 20 69 6d 70 6c 65 6d 65 6e 74 69 + 6e 67 20 74 68 65 20 6c 6f 67 2d 6c 6f 61 64 20 + 74 72 61 6e 73 66 6f 72 6d 2e 0a + + ~ "~ For conceptual overview, see the top of this file." + 7e 20 46 6f 72 20 63 6f 6e 63 65 70 74 75 61 6c + 20 6f 76 65 72 76 69 65 77 2c 20 73 65 65 20 74 + 68 65 20 74 6f 70 20 6f 66 20 74 68 69 73 20 66 + 69 6c 65 2e 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This outputs code that performs a roll of a given size," + ~ " for use by the" + 7e 20 20 20 54 68 69 73 20 6f 75 74 70 75 74 73 + 20 63 6f 64 65 20 74 68 61 74 20 70 65 72 66 6f + 72 6d 73 20 61 20 72 6f 6c 6c 20 6f 66 20 61 20 + 67 69 76 65 6e 20 73 69 7a 65 2c 20 66 6f 72 20 + 75 73 65 20 62 79 20 74 68 65 0a + + ~ "~ words that rely on the tracked user stack depth." + 7e 20 77 6f 72 64 73 20 74 68 61 74 20 72 65 6c + 79 20 6f 6e 20 74 68 65 20 74 72 61 63 6b 65 64 + 20 75 73 65 72 20 73 74 61 63 6b 20 64 65 70 74 + 68 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (amount to roll by --)" + 7e 20 28 61 6d 6f 75 6e 74 20 74 6f 20 72 6f 6c + 6c 20 62 79 20 2d 2d 29 0a + + ~ ": log-load-roll" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c 6c 0a + + ~ " ~ A roll of size 1 is an nop, and a roll of size 0" + ~ " crashes." + 20 20 7e 20 41 20 72 6f 6c 6c 20 6f 66 20 73 69 + 7a 65 20 31 20 69 73 20 61 6e 20 6e 6f 70 2c 20 + 61 6e 64 20 61 20 72 6f 6c 6c 20 6f 66 20 73 69 + 7a 65 20 30 20 63 72 61 73 68 65 73 2e 0a + + ~ " dup 2 > { drop exit } if" + 20 20 64 75 70 20 32 20 3e 20 7b 20 64 72 6f 70 + 20 65 78 69 74 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ A roll of size 2 is equivalent to a swap, and we" + ~ " compile it as one for" + 20 20 7e 20 20 20 41 20 72 6f 6c 6c 20 6f 66 20 + 73 69 7a 65 20 32 20 69 73 20 65 71 75 69 76 61 + 6c 65 6e 74 20 74 6f 20 61 20 73 77 61 70 2c 20 + 61 6e 64 20 77 65 20 63 6f 6d 70 69 6c 65 20 69 + 74 20 61 73 20 6f 6e 65 20 66 6f 72 0a + + ~ " ~ clarity when reading the hexdump." + 20 20 7e 20 63 6c 61 72 69 74 79 20 77 68 65 6e + 20 72 65 61 64 69 6e 67 20 74 68 65 20 68 65 78 + 64 75 6d 70 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ Yes, clarity when reading the hexdump." + 20 20 7e 20 20 20 59 65 73 2c 20 63 6c 61 72 69 + 74 79 20 77 68 65 6e 20 72 65 61 64 69 6e 67 20 + 74 68 65 20 68 65 78 64 75 6d 70 2e 0a + + ~ " dup 2 = {" + 20 20 64 75 70 20 32 20 3d 20 7b 0a + + ~ " drop" + 20 20 20 20 64 72 6f 70 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' swap" + 20 20 20 20 4c 40 27 20 73 77 61 70 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space , ~ : -8 swap #--" + ~ " (codeword pointer)" + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 20 20 20 7e 20 3a 20 2d 38 20 73 77 + 61 70 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 + 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' roll" + 20 20 4c 40 27 20 72 6f 6c 6c 0a + + ~ " L@' lit" + 20 20 4c 40 27 20 6c 69 74 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space , ~ : -8 lit #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 6c 69 + 74 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 + 70 6f 69 6e 74 65 72 29 0a + + ~ " swap ~ : provide-hex" + 20 20 73 77 61 70 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 70 72 6f 76 69 + 64 65 2d 68 65 78 0a + + ~ " , ~ : -8 # #--" + ~ " (integer literal)" + 20 20 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 23 20 + 23 2d 2d 20 28 69 6e 74 65 67 65 72 20 6c 69 74 + 65 72 61 6c 29 0a + + ~ " offset-to-target-address-space , ~ : -8 roll #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 72 6f + 6c 6c 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 + 20 70 6f 69 6e 74 65 72 29 0a + + ~ " ;" + 20 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This outputs code that perfoms an unroll of a given" + ~ " size, for use by the" + 7e 20 20 20 54 68 69 73 20 6f 75 74 70 75 74 73 + 20 63 6f 64 65 20 74 68 61 74 20 70 65 72 66 6f + 6d 73 20 61 6e 20 75 6e 72 6f 6c 6c 20 6f 66 20 + 61 20 67 69 76 65 6e 20 73 69 7a 65 2c 20 66 6f + 72 20 75 73 65 20 62 79 20 74 68 65 0a + + ~ "~ words that rely on the tracked user stack depth." + 7e 20 77 6f 72 64 73 20 74 68 61 74 20 72 65 6c + 79 20 6f 6e 20 74 68 65 20 74 72 61 63 6b 65 64 + 20 75 73 65 72 20 73 74 61 63 6b 20 64 65 70 74 + 68 2e 0a + + ~ "" + 0a + + ~ "~ (amount to unroll by --)" + 7e 20 28 61 6d 6f 75 6e 74 20 74 6f 20 75 6e 72 + 6f 6c 6c 20 62 79 20 2d 2d 29 0a + + ~ ": log-load-unroll" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 0a + + ~ " ~ An unroll of size 1 is an nop, and an unroll of size 0" + ~ " crashes." + 20 20 7e 20 41 6e 20 75 6e 72 6f 6c 6c 20 6f 66 + 20 73 69 7a 65 20 31 20 69 73 20 61 6e 20 6e 6f + 70 2c 20 61 6e 64 20 61 6e 20 75 6e 72 6f 6c 6c + 20 6f 66 20 73 69 7a 65 20 30 20 63 72 61 73 68 + 65 73 2e 0a + + ~ " dup 2 > { drop exit } if" + 20 20 64 75 70 20 32 20 3e 20 7b 20 64 72 6f 70 + 20 65 78 69 74 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ Yes, clarity when reading the hexdump! What's so weird" + ~ " about that? :)" + 20 20 7e 20 59 65 73 2c 20 63 6c 61 72 69 74 79 + 20 77 68 65 6e 20 72 65 61 64 69 6e 67 20 74 68 + 65 20 68 65 78 64 75 6d 70 21 20 57 68 61 74 27 + 73 20 73 6f 20 77 65 69 72 64 20 61 62 6f 75 74 + 20 74 68 61 74 3f 20 3a 29 0a + + ~ " dup 2 = {" + 20 20 64 75 70 20 32 20 3d 20 7b 0a + + ~ " drop" + 20 20 20 20 64 72 6f 70 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' swap" + 20 20 20 20 4c 40 27 20 73 77 61 70 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space , ~ : -8 swap #--" + ~ " (codeword pointer)" + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 20 20 20 7e 20 3a 20 2d 38 20 73 77 + 61 70 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 + 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' unroll" + 20 20 4c 40 27 20 75 6e 72 6f 6c 6c 0a + + ~ " L@' lit" + 20 20 4c 40 27 20 6c 69 74 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space , ~ : -8 lit #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 6c 69 + 74 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 + 70 6f 69 6e 74 65 72 29 0a + + ~ " swap ~ : provide-hex" + 20 20 73 77 61 70 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 70 72 6f 76 69 + 64 65 2d 68 65 78 0a + + ~ " , ~ : -8 # #--" + ~ " (integer literal)" + 20 20 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 23 20 + 23 2d 2d 20 28 69 6e 74 65 67 65 72 20 6c 69 74 + 65 72 61 6c 29 0a + + ~ " offset-to-target-address-space , ~ : -8 unroll #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 75 6e + 72 6f 6c 6c 20 23 2d 2d 20 28 63 6f 64 65 77 6f + 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " ;" + 20 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This checks the tracked user stack depth and outputs an" + ~ " appropriate roll" + 7e 20 20 20 54 68 69 73 20 63 68 65 63 6b 73 20 + 74 68 65 20 74 72 61 63 6b 65 64 20 75 73 65 72 + 20 73 74 61 63 6b 20 64 65 70 74 68 20 61 6e 64 + 20 6f 75 74 70 75 74 73 20 61 6e 20 61 70 70 72 + 6f 70 72 69 61 74 65 20 72 6f 6c 6c 0a + + ~ "~ to put the log address on top, as preparation for calling" + ~ " something that" + 7e 20 74 6f 20 70 75 74 20 74 68 65 20 6c 6f 67 + 20 61 64 64 72 65 73 73 20 6f 6e 20 74 6f 70 2c + 20 61 73 20 70 72 65 70 61 72 61 74 69 6f 6e 20 + 66 6f 72 20 63 61 6c 6c 69 6e 67 20 73 6f 6d 65 + 74 68 69 6e 67 20 74 68 61 74 0a + + ~ "~ relies on it." + 7e 20 72 65 6c 69 65 73 20 6f 6e 20 69 74 2e 0a + + ~ ": log-load-roll-log-address" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c 6c 2d + 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ " transformation-state" + ~ " transformation-state-user-stack-depth @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 75 73 65 72 + 2d 73 74 61 63 6b 2d 64 65 70 74 68 20 40 0a + + ~ " ~ The amount we're rolling includes the log address," + ~ " which is not a user" + 20 20 7e 20 20 20 54 68 65 20 61 6d 6f 75 6e 74 + 20 77 65 27 72 65 20 72 6f 6c 6c 69 6e 67 20 69 + 6e 63 6c 75 64 65 73 20 74 68 65 20 6c 6f 67 20 + 61 64 64 72 65 73 73 2c 20 77 68 69 63 68 20 69 + 73 20 6e 6f 74 20 61 20 75 73 65 72 0a + + ~ " ~ value, so we add 1." + 20 20 7e 20 76 61 6c 75 65 2c 20 73 6f 20 77 65 + 20 61 64 64 20 31 2e 0a + + ~ " 1 +" + 20 20 31 20 2b 0a + + ~ " log-load-roll ;" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c 6c 20 + 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This checks the tracked user stack depth and outputs an" + ~ " appropriate unroll" + 7e 20 20 20 54 68 69 73 20 63 68 65 63 6b 73 20 + 74 68 65 20 74 72 61 63 6b 65 64 20 75 73 65 72 + 20 73 74 61 63 6b 20 64 65 70 74 68 20 61 6e 64 + 20 6f 75 74 70 75 74 73 20 61 6e 20 61 70 70 72 + 6f 70 72 69 61 74 65 20 75 6e 72 6f 6c 6c 0a + + ~ "~ to put the log address back at the bottom, as cleanup" + ~ " after calling" + 7e 20 74 6f 20 70 75 74 20 74 68 65 20 6c 6f 67 + 20 61 64 64 72 65 73 73 20 62 61 63 6b 20 61 74 + 20 74 68 65 20 62 6f 74 74 6f 6d 2c 20 61 73 20 + 63 6c 65 61 6e 75 70 20 61 66 74 65 72 20 63 61 + 6c 6c 69 6e 67 0a + + ~ "~ something that relies on it." + 7e 20 73 6f 6d 65 74 68 69 6e 67 20 74 68 61 74 + 20 72 65 6c 69 65 73 20 6f 6e 20 69 74 2e 0a + + ~ ": log-load-unroll-log-address" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ " transformation-state" + ~ " transformation-state-user-stack-depth @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 75 73 65 72 + 2d 73 74 61 63 6b 2d 64 65 70 74 68 20 40 0a + + ~ " ~ The amount we're rolling includes the log address," + ~ " which is not a user" + 20 20 7e 20 20 20 54 68 65 20 61 6d 6f 75 6e 74 + 20 77 65 27 72 65 20 72 6f 6c 6c 69 6e 67 20 69 + 6e 63 6c 75 64 65 73 20 74 68 65 20 6c 6f 67 20 + 61 64 64 72 65 73 73 2c 20 77 68 69 63 68 20 69 + 73 20 6e 6f 74 20 61 20 75 73 65 72 0a + + ~ " ~ value, so we add 1." + 20 20 7e 20 76 61 6c 75 65 2c 20 73 6f 20 77 65 + 20 61 64 64 20 31 2e 0a + + ~ " 1 +" + 20 20 31 20 2b 0a + + ~ " log-load-unroll ;" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This checks the tracked user stack depth and outputs an" + ~ " appropriate roll" + 7e 20 20 20 54 68 69 73 20 63 68 65 63 6b 73 20 + 74 68 65 20 74 72 61 63 6b 65 64 20 75 73 65 72 + 20 73 74 61 63 6b 20 64 65 70 74 68 20 61 6e 64 + 20 6f 75 74 70 75 74 73 20 61 6e 20 61 70 70 72 + 6f 70 72 69 61 74 65 20 72 6f 6c 6c 0a + + ~ "~ to put the saved label value on top, as preparation for" + ~ " calling something" + 7e 20 74 6f 20 70 75 74 20 74 68 65 20 73 61 76 + 65 64 20 6c 61 62 65 6c 20 76 61 6c 75 65 20 6f + 6e 20 74 6f 70 2c 20 61 73 20 70 72 65 70 61 72 + 61 74 69 6f 6e 20 66 6f 72 20 63 61 6c 6c 69 6e + 67 20 73 6f 6d 65 74 68 69 6e 67 0a + + ~ "~ that consumes it." + 7e 20 74 68 61 74 20 63 6f 6e 73 75 6d 65 73 20 + 69 74 2e 0a + + ~ ": log-load-roll-saved-label" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c 6c 2d + 73 61 76 65 64 2d 6c 61 62 65 6c 0a + + ~ " transformation-state" + ~ " transformation-state-user-stack-depth @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 75 73 65 72 + 2d 73 74 61 63 6b 2d 64 65 70 74 68 20 40 0a + + ~ " ~ The amount we're rolling includes both the log" + ~ " address and the label" + 20 20 7e 20 20 20 54 68 65 20 61 6d 6f 75 6e 74 + 20 77 65 27 72 65 20 72 6f 6c 6c 69 6e 67 20 69 + 6e 63 6c 75 64 65 73 20 62 6f 74 68 20 74 68 65 + 20 6c 6f 67 20 61 64 64 72 65 73 73 20 61 6e 64 + 20 74 68 65 20 6c 61 62 65 6c 0a + + ~ " ~ value, neither of which are user values, so we add 2." + 20 20 7e 20 76 61 6c 75 65 2c 20 6e 65 69 74 68 + 65 72 20 6f 66 20 77 68 69 63 68 20 61 72 65 20 + 75 73 65 72 20 76 61 6c 75 65 73 2c 20 73 6f 20 + 77 65 20 61 64 64 20 32 2e 0a + + ~ " 2 +" + 20 20 32 20 2b 0a + + ~ " log-load-roll ;" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c 6c 20 + 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This checks the tracked user stack depth and outputs an" + ~ " appropriate unroll" + 7e 20 20 20 54 68 69 73 20 63 68 65 63 6b 73 20 + 74 68 65 20 74 72 61 63 6b 65 64 20 75 73 65 72 + 20 73 74 61 63 6b 20 64 65 70 74 68 20 61 6e 64 + 20 6f 75 74 70 75 74 73 20 61 6e 20 61 70 70 72 + 6f 70 72 69 61 74 65 20 75 6e 72 6f 6c 6c 0a + + ~ "~ to put a saved label value on the bottom, as a way of" + ~ " safely storing it away" + 7e 20 74 6f 20 70 75 74 20 61 20 73 61 76 65 64 + 20 6c 61 62 65 6c 20 76 61 6c 75 65 20 6f 6e 20 + 74 68 65 20 62 6f 74 74 6f 6d 2c 20 61 73 20 61 + 20 77 61 79 20 6f 66 20 73 61 66 65 6c 79 20 73 + 74 6f 72 69 6e 67 20 69 74 20 61 77 61 79 0a + + ~ "~ when it's newly generated." + 7e 20 77 68 65 6e 20 69 74 27 73 20 6e 65 77 6c + 79 20 67 65 6e 65 72 61 74 65 64 2e 0a + + ~ ": log-load-unroll-saved-label" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 2d 73 61 76 65 64 2d 6c 61 62 65 6c 0a + + ~ " transformation-state" + ~ " transformation-state-user-stack-depth @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 75 73 65 72 + 2d 73 74 61 63 6b 2d 64 65 70 74 68 20 40 0a + + ~ " ~ The amount we're rolling includes both the log" + ~ " address and the label" + 20 20 7e 20 20 20 54 68 65 20 61 6d 6f 75 6e 74 + 20 77 65 27 72 65 20 72 6f 6c 6c 69 6e 67 20 69 + 6e 63 6c 75 64 65 73 20 62 6f 74 68 20 74 68 65 + 20 6c 6f 67 20 61 64 64 72 65 73 73 20 61 6e 64 + 20 74 68 65 20 6c 61 62 65 6c 0a + + ~ " ~ value, neither of which are user values, so we add 2." + 20 20 7e 20 76 61 6c 75 65 2c 20 6e 65 69 74 68 + 65 72 20 6f 66 20 77 68 69 63 68 20 61 72 65 20 + 75 73 65 72 20 76 61 6c 75 65 73 2c 20 73 6f 20 + 77 65 20 61 64 64 20 32 2e 0a + + ~ " 2 +" + 20 20 32 20 2b 0a + + ~ " log-load-unroll ;" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ (name pointer --)" + 7e 20 28 6e 61 6d 65 20 70 6f 69 6e 74 65 72 20 + 2d 2d 29 0a + + ~ ": log-load-compile-dynamic-word" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 63 6f 6d 70 69 + 6c 65 2d 64 79 6e 61 6d 69 63 2d 77 6f 72 64 0a + + ~ " log-load-roll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c 6c 2d + 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " ~ Looking these up in reverse order saves us some stack" + ~ " juggling. Does it" + 20 20 7e 20 20 20 4c 6f 6f 6b 69 6e 67 20 74 68 + 65 73 65 20 75 70 20 69 6e 20 72 65 76 65 72 73 + 65 20 6f 72 64 65 72 20 73 61 76 65 73 20 75 73 + 20 73 6f 6d 65 20 73 74 61 63 6b 20 6a 75 67 67 + 6c 69 6e 67 2e 20 44 6f 65 73 20 69 74 0a + + ~ " ~ help readability, or hurt it? Who can say..." + 20 20 7e 20 68 65 6c 70 20 72 65 61 64 61 62 69 + 6c 69 74 79 2c 20 6f 72 20 68 75 72 74 20 69 74 + 3f 20 57 68 6f 20 63 61 6e 20 73 61 79 2e 2e 2e + 0a + + ~ " L@' log-load-comma" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 63 + 6f 6d 6d 61 0a + + ~ " L@' log-load-find-execution-token" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 66 + 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f + 6b 65 6e 0a + + ~ " L@' litstring" + 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e 67 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " ~ (name pointer, log-load-comma," + ~ " log-load-find-execution-token, litstring)" + 20 20 7e 20 28 6e 61 6d 65 20 70 6f 69 6e 74 65 + 72 2c 20 6c 6f 67 2d 6c 6f 61 64 2d 63 6f 6d 6d + 61 2c 20 6c 6f 67 2d 6c 6f 61 64 2d 66 69 6e 64 + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 2c 20 6c 69 74 73 74 72 69 6e 67 29 0a + + ~ "" + 0a + + ~ " ~ The overall stack delta of this sequence is 0." + 20 20 7e 20 54 68 65 20 6f 76 65 72 61 6c 6c 20 + 73 74 61 63 6b 20 64 65 6c 74 61 20 6f 66 20 74 + 68 69 73 20 73 65 71 75 65 6e 63 65 20 69 73 20 + 30 2e 0a + + ~ " offset-to-target-address-space , ~ : -8 litstring #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 6c 69 + 74 73 74 72 69 6e 67 20 23 2d 2d 20 28 63 6f 64 + 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " 3roll here @ swap packstring 8 packalign here !" + 20 20 33 72 6f 6c 6c 20 68 65 72 65 20 40 20 73 + 77 61 70 20 70 61 63 6b 73 74 72 69 6e 67 20 38 + 20 70 61 63 6b 61 6c 69 67 6e 20 68 65 72 65 20 + 21 0a + + ~ " offset-to-target-address-space ," + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 0a + + ~ " ~ : -8 log-load-find-execution-token #-- (codeword" + ~ " pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 66 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e + 2d 74 6f 6b 65 6e 20 23 2d 2d 20 28 63 6f 64 65 + 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " offset-to-target-address-space ," + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 0a + + ~ " ~ : -8 log-load-comma #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 63 6f 6d 6d 61 20 23 2d 2d 20 28 63 6f 64 + 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address ;" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ When we want the log-load routine to run a word that" + ~ " wasn't statically" + 7e 20 20 20 57 68 65 6e 20 77 65 20 77 61 6e 74 + 20 74 68 65 20 6c 6f 67 2d 6c 6f 61 64 20 72 6f + 75 74 69 6e 65 20 74 6f 20 72 75 6e 20 61 20 77 + 6f 72 64 20 74 68 61 74 20 77 61 73 6e 27 74 20 + 73 74 61 74 69 63 61 6c 6c 79 0a + + ~ "~ compiled-in to the target executable, we output code that" + ~ " looks up the word" + 7e 20 63 6f 6d 70 69 6c 65 64 2d 69 6e 20 74 6f + 20 74 68 65 20 74 61 72 67 65 74 20 65 78 65 63 + 75 74 61 62 6c 65 2c 20 77 65 20 6f 75 74 70 75 + 74 20 63 6f 64 65 20 74 68 61 74 20 6c 6f 6f 6b + 73 20 75 70 20 74 68 65 20 77 6f 72 64 0a + + ~ "~ by name on the log, then calls it." + 7e 20 62 79 20 6e 61 6d 65 20 6f 6e 20 74 68 65 + 20 6c 6f 67 2c 20 74 68 65 6e 20 63 61 6c 6c 73 + 20 69 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ We update the user stack depth as we go, to account for" + ~ " our internal" + 7e 20 20 20 57 65 20 75 70 64 61 74 65 20 74 68 + 65 20 75 73 65 72 20 73 74 61 63 6b 20 64 65 70 + 74 68 20 61 73 20 77 65 20 67 6f 2c 20 74 6f 20 + 61 63 63 6f 75 6e 74 20 66 6f 72 20 6f 75 72 20 + 69 6e 74 65 72 6e 61 6c 0a + + ~ "~ needs. The last thing our generated code does is execute" + ~ " the word we were" + 7e 20 6e 65 65 64 73 2e 20 54 68 65 20 6c 61 73 + 74 20 74 68 69 6e 67 20 6f 75 72 20 67 65 6e 65 + 72 61 74 65 64 20 63 6f 64 65 20 64 6f 65 73 20 + 69 73 20 65 78 65 63 75 74 65 20 74 68 65 20 77 + 6f 72 64 20 77 65 20 77 65 72 65 0a + + ~ "~ asked to, and we have no way of knowing what its stack" + ~ " delta will be, so" + 7e 20 61 73 6b 65 64 20 74 6f 2c 20 61 6e 64 20 + 77 65 20 68 61 76 65 20 6e 6f 20 77 61 79 20 6f + 66 20 6b 6e 6f 77 69 6e 67 20 77 68 61 74 20 69 + 74 73 20 73 74 61 63 6b 20 64 65 6c 74 61 20 77 + 69 6c 6c 20 62 65 2c 20 73 6f 0a + + ~ "~ that final delta is our caller's responsibility. The" + ~ " caller should only" + 7e 20 74 68 61 74 20 66 69 6e 61 6c 20 64 65 6c + 74 61 20 69 73 20 6f 75 72 20 63 61 6c 6c 65 72 + 27 73 20 72 65 73 70 6f 6e 73 69 62 69 6c 69 74 + 79 2e 20 54 68 65 20 63 61 6c 6c 65 72 20 73 68 + 6f 75 6c 64 20 6f 6e 6c 79 0a + + ~ "~ consider the delta of the word it requested itself; we" + ~ " handle everything" + 7e 20 63 6f 6e 73 69 64 65 72 20 74 68 65 20 64 + 65 6c 74 61 20 6f 66 20 74 68 65 20 77 6f 72 64 + 20 69 74 20 72 65 71 75 65 73 74 65 64 20 69 74 + 73 65 6c 66 3b 20 77 65 20 68 61 6e 64 6c 65 20 + 65 76 65 72 79 74 68 69 6e 67 0a + + ~ "~ pertaining to retrieving, and then consuming, its" + ~ " execution token." + 7e 20 70 65 72 74 61 69 6e 69 6e 67 20 74 6f 20 + 72 65 74 72 69 65 76 69 6e 67 2c 20 61 6e 64 20 + 74 68 65 6e 20 63 6f 6e 73 75 6d 69 6e 67 2c 20 + 69 74 73 20 65 78 65 63 75 74 69 6f 6e 20 74 6f + 6b 65 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (name pointer --)" + 7e 20 28 6e 61 6d 65 20 70 6f 69 6e 74 65 72 20 + 2d 2d 29 0a + + ~ ": log-load-execute-dynamic-word" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 65 78 65 63 75 + 74 65 2d 64 79 6e 61 6d 69 63 2d 77 6f 72 64 0a + + ~ " log-load-roll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c 6c 2d + 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " ~ This is reverse order again." + 20 20 7e 20 54 68 69 73 20 69 73 20 72 65 76 65 + 72 73 65 20 6f 72 64 65 72 20 61 67 61 69 6e 2e + 0a + + ~ " L@' swap" + 20 20 4c 40 27 20 73 77 61 70 0a + + ~ " L@' log-load-find-execution-token" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 66 + 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f + 6b 65 6e 0a + + ~ " L@' litstring" + 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e 67 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " ~ (name pointer, swap, log-load-find-execution-token," + ~ " litstring)" + 20 20 7e 20 28 6e 61 6d 65 20 70 6f 69 6e 74 65 + 72 2c 20 73 77 61 70 2c 20 6c 6f 67 2d 6c 6f 61 + 64 2d 66 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e + 2d 74 6f 6b 65 6e 2c 20 6c 69 74 73 74 72 69 6e + 67 29 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space , ~ : -8 litstring #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 6c 69 + 74 73 74 72 69 6e 67 20 23 2d 2d 20 28 63 6f 64 + 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " 3roll here @ swap packstring 8 packalign here !" + 20 20 33 72 6f 6c 6c 20 68 65 72 65 20 40 20 73 + 77 61 70 20 70 61 63 6b 73 74 72 69 6e 67 20 38 + 20 70 61 63 6b 61 6c 69 67 6e 20 68 65 72 65 20 + 21 0a + + ~ " offset-to-target-address-space ," + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 0a + + ~ " ~ : -8 log-load-find-execution-token #-- (codeword" + ~ " pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 66 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e + 2d 74 6f 6b 65 6e 20 23 2d 2d 20 28 63 6f 64 65 + 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " offset-to-target-address-space , ~ : -8 swap #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 73 77 + 61 70 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 + 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " ~ Now the execution token is on the stack, immediately" + ~ " below the log" + 20 20 7e 20 20 20 4e 6f 77 20 74 68 65 20 65 78 + 65 63 75 74 69 6f 6e 20 74 6f 6b 65 6e 20 69 73 + 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 2c 20 69 + 6d 6d 65 64 69 61 74 65 6c 79 20 62 65 6c 6f 77 + 20 74 68 65 20 6c 6f 67 0a + + ~ " ~ address, so we apply a delta for it." + 20 20 7e 20 61 64 64 72 65 73 73 2c 20 73 6f 20 + 77 65 20 61 70 70 6c 79 20 61 20 64 65 6c 74 61 + 20 66 6f 72 20 69 74 2e 0a + + ~ " 1 transform-apply-stack-delta" + 20 20 31 20 74 72 61 6e 73 66 6f 72 6d 2d 61 70 + 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c 74 61 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' execute" + 20 20 4c 40 27 20 65 78 65 63 75 74 65 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space , ~ : -8 execute #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 65 78 + 65 63 75 74 65 20 23 2d 2d 20 28 63 6f 64 65 77 + 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " ~ Invoking execute consumes the execution token, which" + ~ " is a delta of -1." + 20 20 7e 20 20 20 49 6e 76 6f 6b 69 6e 67 20 65 + 78 65 63 75 74 65 20 63 6f 6e 73 75 6d 65 73 20 + 74 68 65 20 65 78 65 63 75 74 69 6f 6e 20 74 6f + 6b 65 6e 2c 20 77 68 69 63 68 20 69 73 20 61 20 + 64 65 6c 74 61 20 6f 66 20 2d 31 2e 0a + + ~ " ~ Any additional delta is our caller's responsibility," + ~ " per above." + 20 20 7e 20 41 6e 79 20 61 64 64 69 74 69 6f 6e + 61 6c 20 64 65 6c 74 61 20 69 73 20 6f 75 72 20 + 63 61 6c 6c 65 72 27 73 20 72 65 73 70 6f 6e 73 + 69 62 69 6c 69 74 79 2c 20 70 65 72 20 61 62 6f + 76 65 2e 0a + + ~ " -1 transform-apply-stack-delta ;" + 20 20 2d 31 20 74 72 61 6e 73 66 6f 72 6d 2d 61 + 70 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c 74 61 + 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ We generate code that looks up "docol" by name, runs it" + ~ " to get the" + 7e 20 20 20 57 65 20 67 65 6e 65 72 61 74 65 20 + 63 6f 64 65 20 74 68 61 74 20 6c 6f 6f 6b 73 20 + 75 70 20 22 64 6f 63 6f 6c 22 20 62 79 20 6e 61 + 6d 65 2c 20 72 75 6e 73 20 69 74 20 74 6f 20 67 + 65 74 20 74 68 65 0a + + ~ "~ codeword pointer, then finally appends it to the entry." + 7e 20 63 6f 64 65 77 6f 72 64 20 70 6f 69 6e 74 + 65 72 2c 20 74 68 65 6e 20 66 69 6e 61 6c 6c 79 + 20 61 70 70 65 6e 64 73 20 69 74 20 74 6f 20 74 + 68 65 20 65 6e 74 72 79 2e 0a + + ~ "~" + 7e 0a + + ~ "~ This one's unusual in that it first executes the word," + ~ " then compiles the" + 7e 20 20 20 54 68 69 73 20 6f 6e 65 27 73 20 75 + 6e 75 73 75 61 6c 20 69 6e 20 74 68 61 74 20 69 + 74 20 66 69 72 73 74 20 65 78 65 63 75 74 65 73 + 20 74 68 65 20 77 6f 72 64 2c 20 74 68 65 6e 20 + 63 6f 6d 70 69 6c 65 73 20 74 68 65 0a + + ~ "~ result. To avoid rolling and unrolling repeatedly, we" + ~ " implement it as a" + 7e 20 72 65 73 75 6c 74 2e 20 54 6f 20 61 76 6f + 69 64 20 72 6f 6c 6c 69 6e 67 20 61 6e 64 20 75 + 6e 72 6f 6c 6c 69 6e 67 20 72 65 70 65 61 74 65 + 64 6c 79 2c 20 77 65 20 69 6d 70 6c 65 6d 65 6e + 74 20 69 74 20 61 73 20 61 0a + + ~ "~ special case. For clarity's sake we put the code here," + ~ " with the other" + 7e 20 73 70 65 63 69 61 6c 20 63 61 73 65 2e 20 + 46 6f 72 20 63 6c 61 72 69 74 79 27 73 20 73 61 + 6b 65 20 77 65 20 70 75 74 20 74 68 65 20 63 6f + 64 65 20 68 65 72 65 2c 20 77 69 74 68 20 74 68 + 65 20 6f 74 68 65 72 0a + + ~ "~ dynamic word stuff." + 7e 20 64 79 6e 61 6d 69 63 20 77 6f 72 64 20 73 + 74 75 66 66 2e 0a + + ~ "~" + 7e 0a + + ~ ": log-load-compile-docol" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 63 6f 6d 70 69 + 6c 65 2d 64 6f 63 6f 6c 0a + + ~ " log-load-roll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c 6c 2d + 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " ~ As usual, we do these in reverse." + 20 20 7e 20 41 73 20 75 73 75 61 6c 2c 20 77 65 + 20 64 6f 20 74 68 65 73 65 20 69 6e 20 72 65 76 + 65 72 73 65 2e 0a + + ~ " L@' log-load-comma" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 63 + 6f 6d 6d 61 0a + + ~ " L@' execute" + 20 20 4c 40 27 20 65 78 65 63 75 74 65 0a + + ~ " L@' log-load-find-execution-token" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 66 + 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f + 6b 65 6e 0a + + ~ " L@' litstring" + 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e 67 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " ~ The overall stack delta of this sequence is 0." + 20 20 7e 20 54 68 65 20 6f 76 65 72 61 6c 6c 20 + 73 74 61 63 6b 20 64 65 6c 74 61 20 6f 66 20 74 + 68 69 73 20 73 65 71 75 65 6e 63 65 20 69 73 20 + 30 2e 0a + + ~ " offset-to-target-address-space , ~ : -8 litstring #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 6c 69 + 74 73 74 72 69 6e 67 20 23 2d 2d 20 28 63 6f 64 + 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " here @ s" docol" packstring 8 packalign here !" + 20 20 68 65 72 65 20 40 20 73 22 20 64 6f 63 6f + 6c 22 20 70 61 63 6b 73 74 72 69 6e 67 20 38 20 + 70 61 63 6b 61 6c 69 67 6e 20 68 65 72 65 20 21 + 0a + + ~ " offset-to-target-address-space ," + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 0a + + ~ " ~ : -8 log-load-find-execution-token #-- (codeword" + ~ " pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 66 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e + 2d 74 6f 6b 65 6e 20 23 2d 2d 20 28 63 6f 64 65 + 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " offset-to-target-address-space , ~ : -8 execute #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 65 78 + 65 63 75 74 65 20 23 2d 2d 20 28 63 6f 64 65 77 + 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " offset-to-target-address-space ," + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 0a + + ~ " ~ : -8 log-load-comma #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 63 6f 6d 6d 61 20 23 2d 2d 20 28 63 6f 64 + 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address ;" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ There's one more compilation case, where we wish to" + ~ " compile an integer" + 7e 20 20 20 54 68 65 72 65 27 73 20 6f 6e 65 20 + 6d 6f 72 65 20 63 6f 6d 70 69 6c 61 74 69 6f 6e + 20 63 61 73 65 2c 20 77 68 65 72 65 20 77 65 20 + 77 69 73 68 20 74 6f 20 63 6f 6d 70 69 6c 65 20 + 61 6e 20 69 6e 74 65 67 65 72 0a + + ~ "~ literal. Again, for clarity, we do it here." + 7e 20 6c 69 74 65 72 61 6c 2e 20 41 67 61 69 6e + 2c 20 66 6f 72 20 63 6c 61 72 69 74 79 2c 20 77 + 65 20 64 6f 20 69 74 20 68 65 72 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (integer value --)" + 7e 20 28 69 6e 74 65 67 65 72 20 76 61 6c 75 65 + 20 2d 2d 29 0a + + ~ ": log-load-compile-literal" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 63 6f 6d 70 69 + 6c 65 2d 6c 69 74 65 72 61 6c 0a + + ~ " log-load-roll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c 6c 2d + 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " ~ As usual, we do these in reverse." + 20 20 7e 20 41 73 20 75 73 75 61 6c 2c 20 77 65 + 20 64 6f 20 74 68 65 73 65 20 69 6e 20 72 65 76 + 65 72 73 65 2e 0a + + ~ " L@' log-load-comma" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 63 + 6f 6d 6d 61 0a + + ~ " L@' lit" + 20 20 4c 40 27 20 6c 69 74 0a + + ~ " L@' log-load-comma" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 63 + 6f 6d 6d 61 0a + + ~ " L@' log-load-find-execution-token" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 66 + 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f + 6b 65 6e 0a + + ~ " L@' litstring" + 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e 67 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " ~ The overall stack delta of this sequence is 0." + 20 20 7e 20 54 68 65 20 6f 76 65 72 61 6c 6c 20 + 73 74 61 63 6b 20 64 65 6c 74 61 20 6f 66 20 74 + 68 69 73 20 73 65 71 75 65 6e 63 65 20 69 73 20 + 30 2e 0a + + ~ " offset-to-target-address-space , ~ : -8 litstring #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 6c 69 + 74 73 74 72 69 6e 67 20 23 2d 2d 20 28 63 6f 64 + 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " here @ s" lit" packstring 8 packalign here !" + 20 20 68 65 72 65 20 40 20 73 22 20 6c 69 74 22 + 20 70 61 63 6b 73 74 72 69 6e 67 20 38 20 70 61 + 63 6b 61 6c 69 67 6e 20 68 65 72 65 20 21 0a + + ~ " offset-to-target-address-space ," + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 0a + + ~ " ~ : -8 log-load-find-execution-token #-- (codeword" + ~ " pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 66 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e + 2d 74 6f 6b 65 6e 20 23 2d 2d 20 28 63 6f 64 65 + 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " offset-to-target-address-space ," + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 0a + + ~ " ~ : -8 log-load-comma #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 63 6f 6d 6d 61 20 23 2d 2d 20 28 63 6f 64 + 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " offset-to-target-address-space , ~ : -8 lit #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 6c 69 + 74 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 + 70 6f 69 6e 74 65 72 29 0a + + ~ " swap ~ : provide-hex" + 20 20 73 77 61 70 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 70 72 6f 76 69 + 64 65 2d 68 65 78 0a + + ~ " , ~ : -8 # #--" + ~ " (integer literal)" + 20 20 2c 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 23 20 + 23 2d 2d 20 28 69 6e 74 65 67 65 72 20 6c 69 74 + 65 72 61 6c 29 0a + + ~ " offset-to-target-address-space ," + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 0a + + ~ " ~ : -8 log-load-comma #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 63 6f 6d 6d 61 20 23 2d 2d 20 28 63 6f 64 + 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address ;" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This is the alternate version of "create" for use with" + ~ " the log-load" + 7e 20 20 20 54 68 69 73 20 69 73 20 74 68 65 20 + 61 6c 74 65 72 6e 61 74 65 20 76 65 72 73 69 6f + 6e 20 6f 66 20 22 63 72 65 61 74 65 22 20 66 6f + 72 20 75 73 65 20 77 69 74 68 20 74 68 65 20 6c + 6f 67 2d 6c 6f 61 64 0a + + ~ "~ transform. This one is quite unlike the regular "create";" + ~ " rather than" + 7e 20 74 72 61 6e 73 66 6f 72 6d 2e 20 54 68 69 + 73 20 6f 6e 65 20 69 73 20 71 75 69 74 65 20 75 + 6e 6c 69 6b 65 20 74 68 65 20 72 65 67 75 6c 61 + 72 20 22 63 72 65 61 74 65 22 3b 20 72 61 74 68 + 65 72 20 74 68 61 6e 0a + + ~ "~ creating an entry on the log directly, its job is to" + ~ " output words which," + 7e 20 63 72 65 61 74 69 6e 67 20 61 6e 20 65 6e + 74 72 79 20 6f 6e 20 74 68 65 20 6c 6f 67 20 64 + 69 72 65 63 74 6c 79 2c 20 69 74 73 20 6a 6f 62 + 20 69 73 20 74 6f 20 6f 75 74 70 75 74 20 77 6f + 72 64 73 20 77 68 69 63 68 2c 0a + + ~ "~ when they're later executed, will do create's job." + 7e 20 77 68 65 6e 20 74 68 65 79 27 72 65 20 6c + 61 74 65 72 20 65 78 65 63 75 74 65 64 2c 20 77 + 69 6c 6c 20 64 6f 20 63 72 65 61 74 65 27 73 20 + 6a 6f 62 2e 0a + + ~ "~" + 7e 0a + + ~ "~ In practice that means outputting a codeword pointer to" + ~ " run a" + 7e 20 20 20 49 6e 20 70 72 61 63 74 69 63 65 20 + 74 68 61 74 20 6d 65 61 6e 73 20 6f 75 74 70 75 + 74 74 69 6e 67 20 61 20 63 6f 64 65 77 6f 72 64 + 20 70 6f 69 6e 74 65 72 20 74 6f 20 72 75 6e 20 + 61 0a + + ~ "~ statically-compiled word that does the work. The" + ~ " implementation of" + 7e 20 73 74 61 74 69 63 61 6c 6c 79 2d 63 6f 6d + 70 69 6c 65 64 20 77 6f 72 64 20 74 68 61 74 20 + 64 6f 65 73 20 74 68 65 20 77 6f 72 6b 2e 20 54 + 68 65 20 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f + 6e 20 6f 66 0a + + ~ "~ log-load-create is in language/static/log-load.e." + 7e 20 6c 6f 67 2d 6c 6f 61 64 2d 63 72 65 61 74 + 65 20 69 73 20 69 6e 20 6c 61 6e 67 75 61 67 65 + 2f 73 74 61 74 69 63 2f 6c 6f 67 2d 6c 6f 61 64 + 2e 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ It's worth keeping in mind that this alternate only" + ~ " gets called for" + 7e 20 20 20 49 74 27 73 20 77 6f 72 74 68 20 6b + 65 65 70 69 6e 67 20 69 6e 20 6d 69 6e 64 20 74 + 68 61 74 20 74 68 69 73 20 61 6c 74 65 72 6e 61 + 74 65 20 6f 6e 6c 79 20 67 65 74 73 20 63 61 6c + 6c 65 64 20 66 6f 72 0a + + ~ "~ manual invocations of "create". It isn't called from the" + ~ " colon alternate." + 7e 20 6d 61 6e 75 61 6c 20 69 6e 76 6f 63 61 74 + 69 6f 6e 73 20 6f 66 20 22 63 72 65 61 74 65 22 + 2e 20 49 74 20 69 73 6e 27 74 20 63 61 6c 6c 65 + 64 20 66 72 6f 6d 20 74 68 65 20 63 6f 6c 6f 6e + 20 61 6c 74 65 72 6e 61 74 65 2e 0a + + ~ ": log-load-create-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 63 72 65 61 74 + 65 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ " ~ In immediate mode, we have special behavior because" + ~ " this is fundamental" + 20 20 7e 20 20 20 49 6e 20 69 6d 6d 65 64 69 61 + 74 65 20 6d 6f 64 65 2c 20 77 65 20 68 61 76 65 + 20 73 70 65 63 69 61 6c 20 62 65 68 61 76 69 6f + 72 20 62 65 63 61 75 73 65 20 74 68 69 73 20 69 + 73 20 66 75 6e 64 61 6d 65 6e 74 61 6c 0a + + ~ " ~ to bootstrapping the log. In compile mode, we compile a" + ~ " dynamic call," + 20 20 7e 20 74 6f 20 62 6f 6f 74 73 74 72 61 70 + 70 69 6e 67 20 74 68 65 20 6c 6f 67 2e 20 49 6e + 20 63 6f 6d 70 69 6c 65 20 6d 6f 64 65 2c 20 77 + 65 20 63 6f 6d 70 69 6c 65 20 61 20 64 79 6e 61 + 6d 69 63 20 63 61 6c 6c 2c 0a + + ~ " ~ which is the same thing that would happen if we didn't" + ~ " have an alternate" + 20 20 7e 20 77 68 69 63 68 20 69 73 20 74 68 65 + 20 73 61 6d 65 20 74 68 69 6e 67 20 74 68 61 74 + 20 77 6f 75 6c 64 20 68 61 70 70 65 6e 20 69 66 + 20 77 65 20 64 69 64 6e 27 74 20 68 61 76 65 20 + 61 6e 20 61 6c 74 65 72 6e 61 74 65 0a + + ~ " ~ at all." + 20 20 7e 20 61 74 20 61 6c 6c 2e 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " ~ Notice that when we're in compile mode, we aren't" + ~ " actually defining a" + 20 20 20 20 7e 20 20 20 4e 6f 74 69 63 65 20 74 + 68 61 74 20 77 68 65 6e 20 77 65 27 72 65 20 69 + 6e 20 63 6f 6d 70 69 6c 65 20 6d 6f 64 65 2c 20 + 77 65 20 61 72 65 6e 27 74 20 61 63 74 75 61 6c + 6c 79 20 64 65 66 69 6e 69 6e 67 20 61 0a + + ~ " ~ word at the time the log-load routine runs, so we" + ~ " don't have magic" + 20 20 20 20 7e 20 77 6f 72 64 20 61 74 20 74 68 + 65 20 74 69 6d 65 20 74 68 65 20 6c 6f 67 2d 6c + 6f 61 64 20 72 6f 75 74 69 6e 65 20 72 75 6e 73 + 2c 20 73 6f 20 77 65 20 64 6f 6e 27 74 20 68 61 + 76 65 20 6d 61 67 69 63 0a + + ~ " ~ comments." + 20 20 20 20 7e 20 63 6f 6d 6d 65 6e 74 73 2e 0a + + ~ " s" create" log-load-compile-dynamic-word" + 20 20 20 20 73 22 20 63 72 65 61 74 65 22 20 6c + 6f 67 2d 6c 6f 61 64 2d 63 6f 6d 70 69 6c 65 2d + 64 79 6e 61 6d 69 63 2d 77 6f 72 64 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " ~ : blank-line" + 20 20 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 + 6e 65 0a + + ~ " ~ : create" + 20 20 20 20 7e 20 3a 20 63 72 65 61 74 65 0a + + ~ " log-load-roll-log-address" + 20 20 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' log-load-create" + 20 20 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 + 2d 63 72 65 61 74 65 0a + + ~ " L@' swap" + 20 20 20 20 4c 40 27 20 73 77 61 70 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " ~ The overall stack delta of this sequence is 0." + 20 20 20 20 7e 20 54 68 65 20 6f 76 65 72 61 6c + 6c 20 73 74 61 63 6b 20 64 65 6c 74 61 20 6f 66 + 20 74 68 69 73 20 73 65 71 75 65 6e 63 65 20 69 + 73 20 30 2e 0a + + ~ " offset-to-target-address-space , ~ : -8 swap #--" + ~ " (codeword pointer)" + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 + 73 77 61 70 20 23 2d 2d 20 28 63 6f 64 65 77 6f + 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " offset-to-target-address-space ," + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 0a + + ~ " ~ : -8 log-load-create #-- (codeword pointer)" + 20 20 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c + 6f 61 64 2d 63 72 65 61 74 65 20 23 2d 2d 20 28 + 63 6f 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 + 29 0a + + ~ "" + 0a + + ~ " ~ We've consumed a string pointer from the stack, so" + ~ " that's a delta of -1." + 20 20 20 20 7e 20 57 65 27 76 65 20 63 6f 6e 73 + 75 6d 65 64 20 61 20 73 74 72 69 6e 67 20 70 6f + 69 6e 74 65 72 20 66 72 6f 6d 20 74 68 65 20 73 + 74 61 63 6b 2c 20 73 6f 20 74 68 61 74 27 73 20 + 61 20 64 65 6c 74 61 20 6f 66 20 2d 31 2e 0a + + ~ " -1 transform-apply-stack-delta" + 20 20 20 20 2d 31 20 74 72 61 6e 73 66 6f 72 6d + 2d 61 70 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c + 74 61 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address" + 20 20 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 + 6f 6c 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ " ~ : blank-line" + 20 20 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 + 6e 65 0a + + ~ " } if-else ;" + 20 20 7d 20 69 66 2d 65 6c 73 65 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This is the alternate version of ":" for use with the" + ~ " log-load transform." + 7e 20 20 20 54 68 69 73 20 69 73 20 74 68 65 20 + 61 6c 74 65 72 6e 61 74 65 20 76 65 72 73 69 6f + 6e 20 6f 66 20 22 3a 22 20 66 6f 72 20 75 73 65 + 20 77 69 74 68 20 74 68 65 20 6c 6f 67 2d 6c 6f + 61 64 20 74 72 61 6e 73 66 6f 72 6d 2e 0a + + ~ "~ Its code is the same as the regular ":" except as noted" + ~ " below. It is likely" + 7e 20 49 74 73 20 63 6f 64 65 20 69 73 20 74 68 + 65 20 73 61 6d 65 20 61 73 20 74 68 65 20 72 65 + 67 75 6c 61 72 20 22 3a 22 20 65 78 63 65 70 74 + 20 61 73 20 6e 6f 74 65 64 20 62 65 6c 6f 77 2e + 20 49 74 20 69 73 20 6c 69 6b 65 6c 79 0a + + ~ "~ to be extremely useful to read and understand ":" in" + 7e 20 74 6f 20 62 65 20 65 78 74 72 65 6d 65 6c + 79 20 75 73 65 66 75 6c 20 74 6f 20 72 65 61 64 + 20 61 6e 64 20 75 6e 64 65 72 73 74 61 6e 64 20 + 22 3a 22 20 69 6e 0a + + ~ "~ language/dynamic/dynamic.e before attempting to" + ~ " understand" + 7e 20 6c 61 6e 67 75 61 67 65 2f 64 79 6e 61 6d + 69 63 2f 64 79 6e 61 6d 69 63 2e 65 20 62 65 66 + 6f 72 65 20 61 74 74 65 6d 70 74 69 6e 67 20 74 + 6f 20 75 6e 64 65 72 73 74 61 6e 64 0a + + ~ "~ "log-load-colon-alternate"." + 7e 20 22 6c 6f 67 2d 6c 6f 61 64 2d 63 6f 6c 6f + 6e 2d 61 6c 74 65 72 6e 61 74 65 22 2e 0a + + ~ ": log-load-colon-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 63 6f 6c 6f 6e + 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ " word value@" + 20 20 77 6f 72 64 20 76 61 6c 75 65 40 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : provide-string-copy" + 20 20 7e 20 3a 20 70 72 6f 76 69 64 65 2d 73 74 + 72 69 6e 67 2d 63 6f 70 79 0a + + ~ " ~ : # is defined here via the log-load transform." + 20 20 7e 20 3a 20 23 20 69 73 20 64 65 66 69 6e + 65 64 20 68 65 72 65 20 76 69 61 20 74 68 65 20 + 6c 6f 67 2d 6c 6f 61 64 20 74 72 61 6e 73 66 6f + 72 6d 2e 0a + + ~ " ~ : indent" + 20 20 7e 20 3a 20 69 6e 64 65 6e 74 0a + + ~ "" + 0a + + ~ " ~ Calling log-load-create-alternate would result in" + ~ " some redundant rolling" + 20 20 7e 20 20 20 43 61 6c 6c 69 6e 67 20 6c 6f + 67 2d 6c 6f 61 64 2d 63 72 65 61 74 65 2d 61 6c + 74 65 72 6e 61 74 65 20 77 6f 75 6c 64 20 72 65 + 73 75 6c 74 20 69 6e 20 73 6f 6d 65 20 72 65 64 + 75 6e 64 61 6e 74 20 72 6f 6c 6c 69 6e 67 0a + + ~ " ~ and unrolling, so we do it together like this instead." + 20 20 7e 20 61 6e 64 20 75 6e 72 6f 6c 6c 69 6e + 67 2c 20 73 6f 20 77 65 20 64 6f 20 69 74 20 74 + 6f 67 65 74 68 65 72 20 6c 69 6b 65 20 74 68 69 + 73 20 69 6e 73 74 65 61 64 2e 0a + + ~ " log-load-roll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c 6c 2d + 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' log-load-create" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 63 + 72 65 61 74 65 0a + + ~ " L@' litstring" + 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e 67 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " ~ The overall stack delta of this sequence is 0." + 20 20 7e 20 54 68 65 20 6f 76 65 72 61 6c 6c 20 + 73 74 61 63 6b 20 64 65 6c 74 61 20 6f 66 20 74 + 68 69 73 20 73 65 71 75 65 6e 63 65 20 69 73 20 + 30 2e 0a + + ~ " offset-to-target-address-space , ~ : -8 litstring #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 6c 69 + 74 73 74 72 69 6e 67 20 23 2d 2d 20 28 63 6f 64 + 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " swap here @ swap packstring 8 packalign here !" + 20 20 73 77 61 70 20 68 65 72 65 20 40 20 73 77 + 61 70 20 70 61 63 6b 73 74 72 69 6e 67 20 38 20 + 70 61 63 6b 61 6c 69 67 6e 20 68 65 72 65 20 21 + 0a + + ~ " offset-to-target-address-space ," + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 0a + + ~ " ~ : -8 log-load-create #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 63 72 65 61 74 65 20 23 2d 2d 20 28 63 6f + 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " dropstring" + 20 20 64 72 6f 70 73 74 72 69 6e 67 0a + + ~ "" + 0a + + ~ " ~ We generate code that looks up "docol" by name, runs" + ~ " it to get the" + 20 20 7e 20 20 20 57 65 20 67 65 6e 65 72 61 74 + 65 20 63 6f 64 65 20 74 68 61 74 20 6c 6f 6f 6b + 73 20 75 70 20 22 64 6f 63 6f 6c 22 20 62 79 20 + 6e 61 6d 65 2c 20 72 75 6e 73 20 69 74 20 74 6f + 20 67 65 74 20 74 68 65 0a + + ~ " ~ codeword pointer, then finally appends it to the" + ~ " entry." + 20 20 7e 20 63 6f 64 65 77 6f 72 64 20 70 6f 69 + 6e 74 65 72 2c 20 74 68 65 6e 20 66 69 6e 61 6c + 6c 79 20 61 70 70 65 6e 64 73 20 69 74 20 74 6f + 20 74 68 65 20 65 6e 74 72 79 2e 0a + + ~ " log-load-compile-docol" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 63 6f 6d 70 69 + 6c 65 2d 64 6f 63 6f 6c 0a + + ~ "" + 0a + + ~ " ~ This is where we would mark the entry hidden, but we" + ~ " don't do that. It" + 20 20 7e 20 20 20 54 68 69 73 20 69 73 20 77 68 + 65 72 65 20 77 65 20 77 6f 75 6c 64 20 6d 61 72 + 6b 20 74 68 65 20 65 6e 74 72 79 20 68 69 64 64 + 65 6e 2c 20 62 75 74 20 77 65 20 64 6f 6e 27 74 + 20 64 6f 20 74 68 61 74 2e 20 49 74 0a + + ~ " ~ won't shadow anything and it won't be called until the" + ~ " entire log-load" + 20 20 7e 20 77 6f 6e 27 74 20 73 68 61 64 6f 77 + 20 61 6e 79 74 68 69 6e 67 20 61 6e 64 20 69 74 + 20 77 6f 6e 27 74 20 62 65 20 63 61 6c 6c 65 64 + 20 75 6e 74 69 6c 20 74 68 65 20 65 6e 74 69 72 + 65 20 6c 6f 67 2d 6c 6f 61 64 0a + + ~ " ~ routine has finished." + 20 20 7e 20 72 6f 75 74 69 6e 65 20 68 61 73 20 + 66 69 6e 69 73 68 65 64 2e 0a + + ~ "" + 0a + + ~ " ~ Switching between immediate and compile mode is one" + ~ " of the very few" + 20 20 7e 20 20 20 53 77 69 74 63 68 69 6e 67 20 + 62 65 74 77 65 65 6e 20 69 6d 6d 65 64 69 61 74 + 65 20 61 6e 64 20 63 6f 6d 70 69 6c 65 20 6d 6f + 64 65 20 69 73 20 6f 6e 65 20 6f 66 20 74 68 65 + 20 76 65 72 79 20 66 65 77 0a + + ~ " ~ things that happens NOW, while the log-load transform" + ~ " is actually running." + 20 20 7e 20 74 68 69 6e 67 73 20 74 68 61 74 20 + 68 61 70 70 65 6e 73 20 4e 4f 57 2c 20 77 68 69 + 6c 65 20 74 68 65 20 6c 6f 67 2d 6c 6f 61 64 20 + 74 72 61 6e 73 66 6f 72 6d 20 69 73 20 61 63 74 + 75 61 6c 6c 79 20 72 75 6e 6e 69 6e 67 2e 0a + + ~ " ]" + 20 20 5d 0a + + ~ " ;" + 20 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ See notes on label-self-codeword-alternate for what" + ~ " problem this is" + 7e 20 20 20 53 65 65 20 6e 6f 74 65 73 20 6f 6e + 20 6c 61 62 65 6c 2d 73 65 6c 66 2d 63 6f 64 65 + 77 6f 72 64 2d 61 6c 74 65 72 6e 61 74 65 20 66 + 6f 72 20 77 68 61 74 20 70 72 6f 62 6c 65 6d 20 + 74 68 69 73 20 69 73 0a + + ~ "~ solving." + 7e 20 73 6f 6c 76 69 6e 67 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Since self-codeword's real definition is in" + ~ " language/dynamic/dynamic.e," + 7e 20 20 20 53 69 6e 63 65 20 73 65 6c 66 2d 63 + 6f 64 65 77 6f 72 64 27 73 20 72 65 61 6c 20 64 + 65 66 69 6e 69 74 69 6f 6e 20 69 73 20 69 6e 20 + 6c 61 6e 67 75 61 67 65 2f 64 79 6e 61 6d 69 63 + 2f 64 79 6e 61 6d 69 63 2e 65 2c 0a + + ~ "~ which absolutely cannot be loaded yet at the time we" + ~ " output docol at the" + 7e 20 77 68 69 63 68 20 61 62 73 6f 6c 75 74 65 + 6c 79 20 63 61 6e 6e 6f 74 20 62 65 20 6c 6f 61 + 64 65 64 20 79 65 74 20 61 74 20 74 68 65 20 74 + 69 6d 65 20 77 65 20 6f 75 74 70 75 74 20 64 6f + 63 6f 6c 20 61 74 20 74 68 65 0a + + ~ "~ very beginning of language/static/core.e, we need to" + ~ " provide an alternate" + 7e 20 76 65 72 79 20 62 65 67 69 6e 6e 69 6e 67 + 20 6f 66 20 6c 61 6e 67 75 61 67 65 2f 73 74 61 + 74 69 63 2f 63 6f 72 65 2e 65 2c 20 77 65 20 6e + 65 65 64 20 74 6f 20 70 72 6f 76 69 64 65 20 61 + 6e 20 61 6c 74 65 72 6e 61 74 65 0a + + ~ "~ for the log-load transform as well, even though only the" + ~ " label transform has" + 7e 20 66 6f 72 20 74 68 65 20 6c 6f 67 2d 6c 6f + 61 64 20 74 72 61 6e 73 66 6f 72 6d 20 61 73 20 + 77 65 6c 6c 2c 20 65 76 65 6e 20 74 68 6f 75 67 + 68 20 6f 6e 6c 79 20 74 68 65 20 6c 61 62 65 6c + 20 74 72 61 6e 73 66 6f 72 6d 20 68 61 73 0a + + ~ "~ the reproducibility issue." + 7e 20 74 68 65 20 72 65 70 72 6f 64 75 63 69 62 + 69 6c 69 74 79 20 69 73 73 75 65 2e 0a + + ~ ": log-load-self-codeword-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 73 65 6c 66 2d + 63 6f 64 65 77 6f 72 64 2d 61 6c 74 65 72 6e 61 + 74 65 0a + + ~ " ~ It's important to remember, this is not an immediate" + ~ " word! It needs to" + 20 20 7e 20 20 20 49 74 27 73 20 69 6d 70 6f 72 + 74 61 6e 74 20 74 6f 20 72 65 6d 65 6d 62 65 72 + 2c 20 74 68 69 73 20 69 73 20 6e 6f 74 20 61 6e + 20 69 6d 6d 65 64 69 61 74 65 20 77 6f 72 64 21 + 20 49 74 20 6e 65 65 64 73 20 74 6f 0a + + ~ " ~ produce correct compiled output, when invoked in" + ~ " compile mode. Since it's" + 20 20 7e 20 70 72 6f 64 75 63 65 20 63 6f 72 72 + 65 63 74 20 63 6f 6d 70 69 6c 65 64 20 6f 75 74 + 70 75 74 2c 20 77 68 65 6e 20 69 6e 76 6f 6b 65 + 64 20 69 6e 20 63 6f 6d 70 69 6c 65 20 6d 6f 64 + 65 2e 20 53 69 6e 63 65 20 69 74 27 73 0a + + ~ " ~ also a regular word that exists, correct output is a" + ~ " reference to the" + 20 20 7e 20 61 6c 73 6f 20 61 20 72 65 67 75 6c + 61 72 20 77 6f 72 64 20 74 68 61 74 20 65 78 69 + 73 74 73 2c 20 63 6f 72 72 65 63 74 20 6f 75 74 + 70 75 74 20 69 73 20 61 20 72 65 66 65 72 65 6e + 63 65 20 74 6f 20 74 68 65 0a + + ~ " ~ non-alternate version." + 20 20 7e 20 6e 6f 6e 2d 61 6c 74 65 72 6e 61 74 + 65 20 76 65 72 73 69 6f 6e 2e 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " s" self-codeword" log-load-compile-dynamic-word" + 20 20 20 20 73 22 20 73 65 6c 66 2d 63 6f 64 65 + 77 6f 72 64 22 20 6c 6f 67 2d 6c 6f 61 64 2d 63 + 6f 6d 70 69 6c 65 2d 64 79 6e 61 6d 69 63 2d 77 + 6f 72 64 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " log-load-roll-log-address" + 20 20 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' log-load-self-codeword" + 20 20 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 + 2d 73 65 6c 66 2d 63 6f 64 65 77 6f 72 64 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space ," + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 0a + + ~ " ~ : -8 log-load-self-codeword #-- (codeword pointer)" + 20 20 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c + 6f 61 64 2d 73 65 6c 66 2d 63 6f 64 65 77 6f 72 + 64 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 + 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address" + 20 20 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 + 6f 6c 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ " } if-else" + 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This is the alternate version of ";" for use with the" + ~ " log-load transform." + 7e 20 20 20 54 68 69 73 20 69 73 20 74 68 65 20 + 61 6c 74 65 72 6e 61 74 65 20 76 65 72 73 69 6f + 6e 20 6f 66 20 22 3b 22 20 66 6f 72 20 75 73 65 + 20 77 69 74 68 20 74 68 65 20 6c 6f 67 2d 6c 6f + 61 64 20 74 72 61 6e 73 66 6f 72 6d 2e 0a + + ~ "~ Its code is the same as the regular ";" except as noted" + ~ " below. It is" + 7e 20 49 74 73 20 63 6f 64 65 20 69 73 20 74 68 + 65 20 73 61 6d 65 20 61 73 20 74 68 65 20 72 65 + 67 75 6c 61 72 20 22 3b 22 20 65 78 63 65 70 74 + 20 61 73 20 6e 6f 74 65 64 20 62 65 6c 6f 77 2e + 20 49 74 20 69 73 0a + + ~ "~ likely to be extremely useful to read and understand ";"" + ~ " in" + 7e 20 6c 69 6b 65 6c 79 20 74 6f 20 62 65 20 65 + 78 74 72 65 6d 65 6c 79 20 75 73 65 66 75 6c 20 + 74 6f 20 72 65 61 64 20 61 6e 64 20 75 6e 64 65 + 72 73 74 61 6e 64 20 22 3b 22 20 69 6e 0a + + ~ "~ language/dynamic/dynamic.e before attempting to" + ~ " understand" + 7e 20 6c 61 6e 67 75 61 67 65 2f 64 79 6e 61 6d + 69 63 2f 64 79 6e 61 6d 69 63 2e 65 20 62 65 66 + 6f 72 65 20 61 74 74 65 6d 70 74 69 6e 67 20 74 + 6f 20 75 6e 64 65 72 73 74 61 6e 64 0a + + ~ "~ "log-load-semicolon-alternate"." + 7e 20 22 6c 6f 67 2d 6c 6f 61 64 2d 73 65 6d 69 + 63 6f 6c 6f 6e 2d 61 6c 74 65 72 6e 61 74 65 22 + 2e 0a + + ~ ": log-load-semicolon-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 73 65 6d 69 63 + 6f 6c 6f 6e 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ " ~ We generate code that looks up "exit" by name and" + ~ " appends it to the" + 20 20 7e 20 20 20 57 65 20 67 65 6e 65 72 61 74 + 65 20 63 6f 64 65 20 74 68 61 74 20 6c 6f 6f 6b + 73 20 75 70 20 22 65 78 69 74 22 20 62 79 20 6e + 61 6d 65 20 61 6e 64 20 61 70 70 65 6e 64 73 20 + 69 74 20 74 6f 20 74 68 65 0a + + ~ " ~ entry." + 20 20 7e 20 65 6e 74 72 79 2e 0a + + ~ " log-load-roll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c 6c 2d + 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " ~ As usual, we do these in reverse." + 20 20 7e 20 41 73 20 75 73 75 61 6c 2c 20 77 65 + 20 64 6f 20 74 68 65 73 65 20 69 6e 20 72 65 76 + 65 72 73 65 2e 0a + + ~ " L@' log-load-comma" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 63 + 6f 6d 6d 61 0a + + ~ " L@' log-load-find-execution-token" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 66 + 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f + 6b 65 6e 0a + + ~ " L@' litstring" + 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e 67 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " ~ The overall stack delta of this sequence is 0." + 20 20 7e 20 54 68 65 20 6f 76 65 72 61 6c 6c 20 + 73 74 61 63 6b 20 64 65 6c 74 61 20 6f 66 20 74 + 68 69 73 20 73 65 71 75 65 6e 63 65 20 69 73 20 + 30 2e 0a + + ~ " offset-to-target-address-space , ~ : -8 litstring #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 6c 69 + 74 73 74 72 69 6e 67 20 23 2d 2d 20 28 63 6f 64 + 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " here @ s" exit" packstring 8 packalign here !" + 20 20 68 65 72 65 20 40 20 73 22 20 65 78 69 74 + 22 20 70 61 63 6b 73 74 72 69 6e 67 20 38 20 70 + 61 63 6b 61 6c 69 67 6e 20 68 65 72 65 20 21 0a + + ~ " offset-to-target-address-space ," + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 0a + + ~ " ~ : -8 log-load-find-execution-token #-- (codeword" + ~ " pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 66 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e + 2d 74 6f 6b 65 6e 20 23 2d 2d 20 28 63 6f 64 65 + 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " offset-to-target-address-space ," + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 0a + + ~ " ~ : -8 log-load-comma #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 63 6f 6d 6d 61 20 23 2d 2d 20 28 63 6f 64 + 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " ~ : deindent" + 20 20 7e 20 3a 20 64 65 69 6e 64 65 6e 74 0a + + ~ "" + 0a + + ~ " ~ This is where we would unhide the entry, but again, we" + ~ " don't do that." + 20 20 7e 20 54 68 69 73 20 69 73 20 77 68 65 72 + 65 20 77 65 20 77 6f 75 6c 64 20 75 6e 68 69 64 + 65 20 74 68 65 20 65 6e 74 72 79 2c 20 62 75 74 + 20 61 67 61 69 6e 2c 20 77 65 20 64 6f 6e 27 74 + 20 64 6f 20 74 68 61 74 2e 0a + + ~ "" + 0a + + ~ " ~ Since [ is an immediate word, we have to go to extra" + ~ " trouble to compile" + 20 20 7e 20 20 20 53 69 6e 63 65 20 5b 20 69 73 + 20 61 6e 20 69 6d 6d 65 64 69 61 74 65 20 77 6f + 72 64 2c 20 77 65 20 68 61 76 65 20 74 6f 20 67 + 6f 20 74 6f 20 65 78 74 72 61 20 74 72 6f 75 62 + 6c 65 20 74 6f 20 63 6f 6d 70 69 6c 65 0a + + ~ " ~ it as part of ;." + 20 20 7e 20 69 74 20 61 73 20 70 61 72 74 20 6f + 66 20 3b 2e 0a + + ~ " [ ' [ entry-to-execution-token , ]" + 20 20 5b 20 27 20 5b 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 2c 20 5d 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This is the alternate version of ";asm" for use with" + ~ " the log-load" + 7e 20 20 20 54 68 69 73 20 69 73 20 74 68 65 20 + 61 6c 74 65 72 6e 61 74 65 20 76 65 72 73 69 6f + 6e 20 6f 66 20 22 3b 61 73 6d 22 20 66 6f 72 20 + 75 73 65 20 77 69 74 68 20 74 68 65 20 6c 6f 67 + 2d 6c 6f 61 64 0a + + ~ "~ transform. Its code is the same as the regular "create"" + ~ " except as noted" + 7e 20 74 72 61 6e 73 66 6f 72 6d 2e 20 49 74 73 + 20 63 6f 64 65 20 69 73 20 74 68 65 20 73 61 6d + 65 20 61 73 20 74 68 65 20 72 65 67 75 6c 61 72 + 20 22 63 72 65 61 74 65 22 20 65 78 63 65 70 74 + 20 61 73 20 6e 6f 74 65 64 0a + + ~ "~ below. It is likely to be extremely useful to read and" + ~ " understand ";asm" in" + 7e 20 62 65 6c 6f 77 2e 20 49 74 20 69 73 20 6c + 69 6b 65 6c 79 20 74 6f 20 62 65 20 65 78 74 72 + 65 6d 65 6c 79 20 75 73 65 66 75 6c 20 74 6f 20 + 72 65 61 64 20 61 6e 64 20 75 6e 64 65 72 73 74 + 61 6e 64 20 22 3b 61 73 6d 22 20 69 6e 0a + + ~ "~ language/dynamic/dynamic.e before attempting to" + ~ " understand "log-load;asm"." + 7e 20 6c 61 6e 67 75 61 67 65 2f 64 79 6e 61 6d + 69 63 2f 64 79 6e 61 6d 69 63 2e 65 20 62 65 66 + 6f 72 65 20 61 74 74 65 6d 70 74 69 6e 67 20 74 + 6f 20 75 6e 64 65 72 73 74 61 6e 64 20 22 6c 6f + 67 2d 6c 6f 61 64 3b 61 73 6d 22 2e 0a + + ~ ": log-load-semicolon-assembly-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 73 65 6d 69 63 + 6f 6c 6f 6e 2d 61 73 73 65 6d 62 6c 79 2d 61 6c + 74 65 72 6e 61 74 65 0a + + ~ " ~ We generate code that statically invokes" + ~ " log-load-semicolon-assembly," + 20 20 7e 20 20 20 57 65 20 67 65 6e 65 72 61 74 + 65 20 63 6f 64 65 20 74 68 61 74 20 73 74 61 74 + 69 63 61 6c 6c 79 20 69 6e 76 6f 6b 65 73 20 6c + 6f 67 2d 6c 6f 61 64 2d 73 65 6d 69 63 6f 6c 6f + 6e 2d 61 73 73 65 6d 62 6c 79 2c 0a + + ~ " ~ which does all the actual work. There's quite a few" + ~ " steps, so it makes" + 20 20 7e 20 77 68 69 63 68 20 64 6f 65 73 20 61 + 6c 6c 20 74 68 65 20 61 63 74 75 61 6c 20 77 6f + 72 6b 2e 20 54 68 65 72 65 27 73 20 71 75 69 74 + 65 20 61 20 66 65 77 20 73 74 65 70 73 2c 20 73 + 6f 20 69 74 20 6d 61 6b 65 73 0a + + ~ " ~ sense to have a word that bundles them up." + 20 20 7e 20 73 65 6e 73 65 20 74 6f 20 68 61 76 + 65 20 61 20 77 6f 72 64 20 74 68 61 74 20 62 75 + 6e 64 6c 65 73 20 74 68 65 6d 20 75 70 2e 0a + + ~ " log-load-roll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c 6c 2d + 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " ~ As usual, we do these in reverse." + 20 20 7e 20 41 73 20 75 73 75 61 6c 2c 20 77 65 + 20 64 6f 20 74 68 65 73 65 20 69 6e 20 72 65 76 + 65 72 73 65 2e 0a + + ~ " L@' log-load-semicolon-assembly" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 73 + 65 6d 69 63 6f 6c 6f 6e 2d 61 73 73 65 6d 62 6c + 79 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " ~ The stack delta of this call is 0." + 20 20 7e 20 54 68 65 20 73 74 61 63 6b 20 64 65 + 6c 74 61 20 6f 66 20 74 68 69 73 20 63 61 6c 6c + 20 69 73 20 30 2e 0a + + ~ " offset-to-target-address-space ," + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 0a + + ~ " ~ : -8 log-load-semicolon-assembly #-- (codeword" + ~ " pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 73 65 6d 69 63 6f 6c 6f 6e 2d 61 73 73 65 + 6d 62 6c 79 20 23 2d 2d 20 28 63 6f 64 65 77 6f + 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " ~ : deindent" + 20 20 7e 20 3a 20 64 65 69 6e 64 65 6e 74 0a + + ~ "" + 0a + + ~ " ~ This is where we would unhide the entry, but again, we" + ~ " don't do that." + 20 20 7e 20 54 68 69 73 20 69 73 20 77 68 65 72 + 65 20 77 65 20 77 6f 75 6c 64 20 75 6e 68 69 64 + 65 20 74 68 65 20 65 6e 74 72 79 2c 20 62 75 74 + 20 61 67 61 69 6e 2c 20 77 65 20 64 6f 6e 27 74 + 20 64 6f 20 74 68 61 74 2e 0a + + ~ "" + 0a + + ~ " ~ Since [ is an immediate word, we have to go to extra" + ~ " trouble to compile" + 20 20 7e 20 20 20 53 69 6e 63 65 20 5b 20 69 73 + 20 61 6e 20 69 6d 6d 65 64 69 61 74 65 20 77 6f + 72 64 2c 20 77 65 20 68 61 76 65 20 74 6f 20 67 + 6f 20 74 6f 20 65 78 74 72 61 20 74 72 6f 75 62 + 6c 65 20 74 6f 20 63 6f 6d 70 69 6c 65 0a + + ~ " ~ it as part of ;." + 20 20 7e 20 69 74 20 61 73 20 70 61 72 74 20 6f + 66 20 3b 2e 0a + + ~ " [ ' [ entry-to-execution-token , ]" + 20 20 5b 20 27 20 5b 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 2c 20 5d 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This just does the same thing [ always does, but having" + ~ " it as an alternate" + 7e 20 20 20 54 68 69 73 20 6a 75 73 74 20 64 6f + 65 73 20 74 68 65 20 73 61 6d 65 20 74 68 69 6e + 67 20 5b 20 61 6c 77 61 79 73 20 64 6f 65 73 2c + 20 62 75 74 20 68 61 76 69 6e 67 20 69 74 20 61 + 73 20 61 6e 20 61 6c 74 65 72 6e 61 74 65 0a + + ~ "~ means it happens at transformation time, which is sooner" + ~ " than "immediate"" + 7e 20 6d 65 61 6e 73 20 69 74 20 68 61 70 70 65 + 6e 73 20 61 74 20 74 72 61 6e 73 66 6f 72 6d 61 + 74 69 6f 6e 20 74 69 6d 65 2c 20 77 68 69 63 68 + 20 69 73 20 73 6f 6f 6e 65 72 20 74 68 61 6e 20 + 22 69 6d 6d 65 64 69 61 74 65 22 0a + + ~ "~ time. The log load transform is weird like that, it has" + ~ " three different" + 7e 20 74 69 6d 65 2e 20 54 68 65 20 6c 6f 67 20 + 6c 6f 61 64 20 74 72 61 6e 73 66 6f 72 6d 20 69 + 73 20 77 65 69 72 64 20 6c 69 6b 65 20 74 68 61 + 74 2c 20 69 74 20 68 61 73 20 74 68 72 65 65 20 + 64 69 66 66 65 72 65 6e 74 0a + + ~ "~ times things can happen, rather than the usual two." + 7e 20 74 69 6d 65 73 20 74 68 69 6e 67 73 20 63 + 61 6e 20 68 61 70 70 65 6e 2c 20 72 61 74 68 65 + 72 20 74 68 61 6e 20 74 68 65 20 75 73 75 61 6c + 20 74 77 6f 2e 0a + + ~ ": log-load-left-square-brace-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 6c 65 66 74 2d + 73 71 75 61 72 65 2d 62 72 61 63 65 2d 61 6c 74 + 65 72 6e 61 74 65 0a + + ~ " ~ Since [ is an immediate word, we have to go to extra" + ~ " trouble to compile" + 20 20 7e 20 20 20 53 69 6e 63 65 20 5b 20 69 73 + 20 61 6e 20 69 6d 6d 65 64 69 61 74 65 20 77 6f + 72 64 2c 20 77 65 20 68 61 76 65 20 74 6f 20 67 + 6f 20 74 6f 20 65 78 74 72 61 20 74 72 6f 75 62 + 6c 65 20 74 6f 20 63 6f 6d 70 69 6c 65 0a + + ~ " ~ it as part of the alternate." + 20 20 7e 20 69 74 20 61 73 20 70 61 72 74 20 6f + 66 20 74 68 65 20 61 6c 74 65 72 6e 61 74 65 2e + 0a + + ~ " [ ' [ entry-to-execution-token , ]" + 20 20 5b 20 27 20 5b 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 2c 20 5d 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "~ We need this one, too. It's not even an immediate word" + ~ " normally!" + 7e 20 57 65 20 6e 65 65 64 20 74 68 69 73 20 6f + 6e 65 2c 20 74 6f 6f 2e 20 49 74 27 73 20 6e 6f + 74 20 65 76 65 6e 20 61 6e 20 69 6d 6d 65 64 69 + 61 74 65 20 77 6f 72 64 20 6e 6f 72 6d 61 6c 6c + 79 21 0a + + ~ ": log-load-right-square-brace-alternate ] ; make-immediate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 72 69 67 68 74 + 2d 73 71 75 61 72 65 2d 62 72 61 63 65 2d 61 6c + 74 65 72 6e 61 74 65 20 5d 20 3b 20 6d 61 6b 65 + 2d 69 6d 6d 65 64 69 61 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ ": log-load-comma-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 63 6f 6d 6d 61 + 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ " ~ In immediate mode, we have special behavior because" + ~ " of the "here" magic." + 20 20 7e 20 20 20 49 6e 20 69 6d 6d 65 64 69 61 + 74 65 20 6d 6f 64 65 2c 20 77 65 20 68 61 76 65 + 20 73 70 65 63 69 61 6c 20 62 65 68 61 76 69 6f + 72 20 62 65 63 61 75 73 65 20 6f 66 20 74 68 65 + 20 22 68 65 72 65 22 20 6d 61 67 69 63 2e 0a + + ~ " ~ In compile mode, we compile a dynamic call, which is" + ~ " the same thing that" + 20 20 7e 20 49 6e 20 63 6f 6d 70 69 6c 65 20 6d + 6f 64 65 2c 20 77 65 20 63 6f 6d 70 69 6c 65 20 + 61 20 64 79 6e 61 6d 69 63 20 63 61 6c 6c 2c 20 + 77 68 69 63 68 20 69 73 20 74 68 65 20 73 61 6d + 65 20 74 68 69 6e 67 20 74 68 61 74 0a + + ~ " ~ would happen if we didn't have an alternate at all." + 20 20 7e 20 77 6f 75 6c 64 20 68 61 70 70 65 6e + 20 69 66 20 77 65 20 64 69 64 6e 27 74 20 68 61 + 76 65 20 61 6e 20 61 6c 74 65 72 6e 61 74 65 20 + 61 74 20 61 6c 6c 2e 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " s" ," log-load-compile-dynamic-word" + 20 20 20 20 73 22 20 2c 22 20 6c 6f 67 2d 6c 6f + 61 64 2d 63 6f 6d 70 69 6c 65 2d 64 79 6e 61 6d + 69 63 2d 77 6f 72 64 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " log-load-roll-log-address" + 20 20 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' log-load-comma" + 20 20 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 + 2d 63 6f 6d 6d 61 0a + + ~ " L@' swap" + 20 20 20 20 4c 40 27 20 73 77 61 70 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space , ~ : -8 swap #--" + ~ " (codeword pointer)" + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 + 73 77 61 70 20 23 2d 2d 20 28 63 6f 64 65 77 6f + 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " offset-to-target-address-space ," + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 0a + + ~ " ~ : -8 log-load-comma #-- (codeword pointer)" + 20 20 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c + 6f 61 64 2d 63 6f 6d 6d 61 20 23 2d 2d 20 28 63 + 6f 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 + 0a + + ~ "" + 0a + + ~ " ~ We consumed the value, so we apply a delta." + 20 20 20 20 7e 20 20 20 57 65 20 63 6f 6e 73 75 + 6d 65 64 20 74 68 65 20 76 61 6c 75 65 2c 20 73 + 6f 20 77 65 20 61 70 70 6c 79 20 61 20 64 65 6c + 74 61 2e 0a + + ~ " -1 transform-apply-stack-delta" + 20 20 20 20 2d 31 20 74 72 61 6e 73 66 6f 72 6d + 2d 61 70 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c + 74 61 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address" + 20 20 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 + 6f 6c 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ " } if-else" + 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ ": log-load-variable-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 76 61 72 69 61 + 62 6c 65 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ " ~ In immediate mode, we have special behavior because" + ~ " of the "here" magic." + 20 20 7e 20 20 20 49 6e 20 69 6d 6d 65 64 69 61 + 74 65 20 6d 6f 64 65 2c 20 77 65 20 68 61 76 65 + 20 73 70 65 63 69 61 6c 20 62 65 68 61 76 69 6f + 72 20 62 65 63 61 75 73 65 20 6f 66 20 74 68 65 + 20 22 68 65 72 65 22 20 6d 61 67 69 63 2e 0a + + ~ " ~ In compile mode, we compile a dynamic call, which is" + ~ " the same thing that" + 20 20 7e 20 49 6e 20 63 6f 6d 70 69 6c 65 20 6d + 6f 64 65 2c 20 77 65 20 63 6f 6d 70 69 6c 65 20 + 61 20 64 79 6e 61 6d 69 63 20 63 61 6c 6c 2c 20 + 77 68 69 63 68 20 69 73 20 74 68 65 20 73 61 6d + 65 20 74 68 69 6e 67 20 74 68 61 74 0a + + ~ " ~ would happen if we didn't have an alternate at all." + 20 20 7e 20 77 6f 75 6c 64 20 68 61 70 70 65 6e + 20 69 66 20 77 65 20 64 69 64 6e 27 74 20 68 61 + 76 65 20 61 6e 20 61 6c 74 65 72 6e 61 74 65 20 + 61 74 20 61 6c 6c 2e 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " s" variable" log-load-compile-dynamic-word" + 20 20 20 20 73 22 20 76 61 72 69 61 62 6c 65 22 + 20 6c 6f 67 2d 6c 6f 61 64 2d 63 6f 6d 70 69 6c + 65 2d 64 79 6e 61 6d 69 63 2d 77 6f 72 64 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " ~ Calling log-load-create-alternate would result in" + ~ " some redundant rolling" + 20 20 20 20 7e 20 20 20 43 61 6c 6c 69 6e 67 20 + 6c 6f 67 2d 6c 6f 61 64 2d 63 72 65 61 74 65 2d + 61 6c 74 65 72 6e 61 74 65 20 77 6f 75 6c 64 20 + 72 65 73 75 6c 74 20 69 6e 20 73 6f 6d 65 20 72 + 65 64 75 6e 64 61 6e 74 20 72 6f 6c 6c 69 6e 67 + + ~ "" + 0a + + ~ " ~ and unrolling, so we do it together like this" + ~ " instead." + 20 20 20 20 7e 20 61 6e 64 20 75 6e 72 6f 6c 6c + 69 6e 67 2c 20 73 6f 20 77 65 20 64 6f 20 69 74 + 20 74 6f 67 65 74 68 65 72 20 6c 69 6b 65 20 74 + 68 69 73 20 69 6e 73 74 65 61 64 2e 0a + + ~ " log-load-roll-log-address" + 20 20 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' log-load-variable" + 20 20 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 + 2d 76 61 72 69 61 62 6c 65 0a + + ~ " L@' 3unroll" + 20 20 20 20 4c 40 27 20 33 75 6e 72 6f 6c 6c 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space , ~ : -8 3unroll #--" + ~ " (codeword pointer)" + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 + 33 75 6e 72 6f 6c 6c 20 23 2d 2d 20 28 63 6f 64 + 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " offset-to-target-address-space ," + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 0a + + ~ " ~ : -8 log-load-variable #-- (codeword pointer)" + 20 20 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c + 6f 61 64 2d 76 61 72 69 61 62 6c 65 20 23 2d 2d + 20 28 63 6f 64 65 77 6f 72 64 20 70 6f 69 6e 74 + 65 72 29 0a + + ~ "" + 0a + + ~ " ~ We consumed the string and address, so we apply a" + ~ " delta." + 20 20 20 20 7e 20 20 20 57 65 20 63 6f 6e 73 75 + 6d 65 64 20 74 68 65 20 73 74 72 69 6e 67 20 61 + 6e 64 20 61 64 64 72 65 73 73 2c 20 73 6f 20 77 + 65 20 61 70 70 6c 79 20 61 20 64 65 6c 74 61 2e + 0a + + ~ " -2 transform-apply-stack-delta" + 20 20 20 20 2d 32 20 74 72 61 6e 73 66 6f 72 6d + 2d 61 70 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c + 74 61 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address" + 20 20 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 + 6f 6c 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ " } if-else" + 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ ": log-load-keyword-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 6b 65 79 77 6f + 72 64 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ " ~ In immediate mode, we have special behavior because" + ~ " of the "here" magic." + 20 20 7e 20 20 20 49 6e 20 69 6d 6d 65 64 69 61 + 74 65 20 6d 6f 64 65 2c 20 77 65 20 68 61 76 65 + 20 73 70 65 63 69 61 6c 20 62 65 68 61 76 69 6f + 72 20 62 65 63 61 75 73 65 20 6f 66 20 74 68 65 + 20 22 68 65 72 65 22 20 6d 61 67 69 63 2e 0a + + ~ " ~ In compile mode, we compile a dynamic call, which is" + ~ " the same thing that" + 20 20 7e 20 49 6e 20 63 6f 6d 70 69 6c 65 20 6d + 6f 64 65 2c 20 77 65 20 63 6f 6d 70 69 6c 65 20 + 61 20 64 79 6e 61 6d 69 63 20 63 61 6c 6c 2c 20 + 77 68 69 63 68 20 69 73 20 74 68 65 20 73 61 6d + 65 20 74 68 69 6e 67 20 74 68 61 74 0a + + ~ " ~ would happen if we didn't have an alternate at all." + 20 20 7e 20 77 6f 75 6c 64 20 68 61 70 70 65 6e + 20 69 66 20 77 65 20 64 69 64 6e 27 74 20 68 61 + 76 65 20 61 6e 20 61 6c 74 65 72 6e 61 74 65 20 + 61 74 20 61 6c 6c 2e 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " s" keyword" log-load-compile-dynamic-word" + 20 20 20 20 73 22 20 6b 65 79 77 6f 72 64 22 20 + 6c 6f 67 2d 6c 6f 61 64 2d 63 6f 6d 70 69 6c 65 + 2d 64 79 6e 61 6d 69 63 2d 77 6f 72 64 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " ~ Calling log-load-create-alternate would result in" + ~ " some redundant rolling" + 20 20 20 20 7e 20 20 20 43 61 6c 6c 69 6e 67 20 + 6c 6f 67 2d 6c 6f 61 64 2d 63 72 65 61 74 65 2d + 61 6c 74 65 72 6e 61 74 65 20 77 6f 75 6c 64 20 + 72 65 73 75 6c 74 20 69 6e 20 73 6f 6d 65 20 72 + 65 64 75 6e 64 61 6e 74 20 72 6f 6c 6c 69 6e 67 + + ~ "" + 0a + + ~ " ~ and unrolling, so we do it together like this" + ~ " instead." + 20 20 20 20 7e 20 61 6e 64 20 75 6e 72 6f 6c 6c + 69 6e 67 2c 20 73 6f 20 77 65 20 64 6f 20 69 74 + 20 74 6f 67 65 74 68 65 72 20 6c 69 6b 65 20 74 + 68 69 73 20 69 6e 73 74 65 61 64 2e 0a + + ~ " log-load-roll-log-address" + 20 20 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' log-load-keyword" + 20 20 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 + 2d 6b 65 79 77 6f 72 64 0a + + ~ " L@' swap" + 20 20 20 20 4c 40 27 20 73 77 61 70 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space , ~ : -8 swap #--" + ~ " (codeword pointer)" + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 + 73 77 61 70 20 23 2d 2d 20 28 63 6f 64 65 77 6f + 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " offset-to-target-address-space ," + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 0a + + ~ " ~ : -8 log-load-keyword #-- (codeword pointer)" + 20 20 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c + 6f 61 64 2d 6b 65 79 77 6f 72 64 20 23 2d 2d 20 + 28 63 6f 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 + 72 29 0a + + ~ "" + 0a + + ~ " ~ We consumed the string, so we apply a delta." + 20 20 20 20 7e 20 20 20 57 65 20 63 6f 6e 73 75 + 6d 65 64 20 74 68 65 20 73 74 72 69 6e 67 2c 20 + 73 6f 20 77 65 20 61 70 70 6c 79 20 61 20 64 65 + 6c 74 61 2e 0a + + ~ " -1 transform-apply-stack-delta" + 20 20 20 20 2d 31 20 74 72 61 6e 73 66 6f 72 6d + 2d 61 70 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c + 74 61 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address" + 20 20 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 + 6f 6c 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ " } if-else" + 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Yeah comments have to go." + 7e 20 59 65 61 68 20 63 6f 6d 6d 65 6e 74 73 20 + 68 61 76 65 20 74 6f 20 67 6f 2e 0a + + ~ ": log-load-tilde-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 74 69 6c 64 65 + 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ " ' ~ entry-to-execution-token execute" + 20 20 27 20 7e 20 65 6e 74 72 79 2d 74 6f 2d 65 + 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 + 78 65 63 75 74 65 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Strings are important and must happen now, now, now." + 7e 20 53 74 72 69 6e 67 73 20 61 72 65 20 69 6d + 70 6f 72 74 61 6e 74 20 61 6e 64 20 6d 75 73 74 + 20 68 61 70 70 65 6e 20 6e 6f 77 2c 20 6e 6f 77 + 2c 20 6e 6f 77 2e 0a + + ~ ": log-load-string-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 73 74 72 69 6e + 67 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ " ~ Wrapping s" is surprisingly difficult; see" + ~ " label-string-alternate" + 20 20 7e 20 20 20 57 72 61 70 70 69 6e 67 20 73 + 22 20 69 73 20 73 75 72 70 72 69 73 69 6e 67 6c + 79 20 64 69 66 66 69 63 75 6c 74 3b 20 73 65 65 + 20 6c 61 62 65 6c 2d 73 74 72 69 6e 67 2d 61 6c + 74 65 72 6e 61 74 65 0a + + ~ " ~ for detailed notes on how that works. Once we've" + ~ " finished the" + 20 20 7e 20 66 6f 72 20 64 65 74 61 69 6c 65 64 + 20 6e 6f 74 65 73 20 6f 6e 20 68 6f 77 20 74 68 + 61 74 20 77 6f 72 6b 73 2e 20 4f 6e 63 65 20 77 + 65 27 76 65 20 66 69 6e 69 73 68 65 64 20 74 68 + 65 0a + + ~ " ~ transform-time part, our implementations will diverge," + ~ " but this first bit" + 20 20 7e 20 74 72 61 6e 73 66 6f 72 6d 2d 74 69 + 6d 65 20 70 61 72 74 2c 20 6f 75 72 20 69 6d 70 + 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 77 69 6c + 6c 20 64 69 76 65 72 67 65 2c 20 62 75 74 20 74 + 68 69 73 20 66 69 72 73 74 20 62 69 74 0a + + ~ " ~ is the same." + 20 20 7e 20 69 73 20 74 68 65 20 73 61 6d 65 2e + 0a + + ~ " interpreter-flags @" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 0a + + ~ " ' s" entry-to-execution-token" + 20 20 27 20 73 22 20 65 6e 74 72 79 2d 74 6f 2d + 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " ~ Since [ is an immediate word, we have to go to extra" + ~ " trouble to compile" + 20 20 7e 20 20 20 53 69 6e 63 65 20 5b 20 69 73 + 20 61 6e 20 69 6d 6d 65 64 69 61 74 65 20 77 6f + 72 64 2c 20 77 65 20 68 61 76 65 20 74 6f 20 67 + 6f 20 74 6f 20 65 78 74 72 61 20 74 72 6f 75 62 + 6c 65 20 74 6f 20 63 6f 6d 70 69 6c 65 0a + + ~ " ~ it as part of the alternate." + 20 20 7e 20 69 74 20 61 73 20 70 61 72 74 20 6f + 66 20 74 68 65 20 61 6c 74 65 72 6e 61 74 65 2e + 0a + + ~ " [ ' [ entry-to-execution-token , ]" + 20 20 5b 20 27 20 5b 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 2c 20 5d 0a + + ~ " execute" + 20 20 65 78 65 63 75 74 65 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " swap interpreter-flags !" + 20 20 73 77 61 70 20 69 6e 74 65 72 70 72 65 74 + 65 72 2d 66 6c 61 67 73 20 21 0a + + ~ "" + 0a + + ~ " ~ Nope, doing it twice didn't make that any less of a" + ~ " mouthful." + 20 20 7e 20 20 20 4e 6f 70 65 2c 20 64 6f 69 6e + 67 20 69 74 20 74 77 69 63 65 20 64 69 64 6e 27 + 74 20 6d 61 6b 65 20 74 68 61 74 20 61 6e 79 20 + 6c 65 73 73 20 6f 66 20 61 20 6d 6f 75 74 68 66 + 75 6c 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ Having done this, we have the string pointer on the" + ~ " stack at transform" + 20 20 7e 20 20 20 48 61 76 69 6e 67 20 64 6f 6e + 65 20 74 68 69 73 2c 20 77 65 20 68 61 76 65 20 + 74 68 65 20 73 74 72 69 6e 67 20 70 6f 69 6e 74 + 65 72 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 20 + 61 74 20 74 72 61 6e 73 66 6f 72 6d 0a + + ~ " ~ time (not, mind you, at log-load time, as yet). Now it" + ~ " is our job to" + 20 20 7e 20 74 69 6d 65 20 28 6e 6f 74 2c 20 6d + 69 6e 64 20 79 6f 75 2c 20 61 74 20 6c 6f 67 2d + 6c 6f 61 64 20 74 69 6d 65 2c 20 61 73 20 79 65 + 74 29 2e 20 4e 6f 77 20 69 74 20 69 73 20 6f 75 + 72 20 6a 6f 62 20 74 6f 0a + + ~ " ~ either compile it, or invoke it "immediately". Recall" + ~ " that the log-load" + 20 20 7e 20 65 69 74 68 65 72 20 63 6f 6d 70 69 + 6c 65 20 69 74 2c 20 6f 72 20 69 6e 76 6f 6b 65 + 20 69 74 20 22 69 6d 6d 65 64 69 61 74 65 6c 79 + 22 2e 20 52 65 63 61 6c 6c 20 74 68 61 74 20 74 + 68 65 20 6c 6f 67 2d 6c 6f 61 64 0a + + ~ " ~ transform's "immediate" time, which we also call" + ~ " log-load time, is" + 20 20 7e 20 74 72 61 6e 73 66 6f 72 6d 27 73 20 + 22 69 6d 6d 65 64 69 61 74 65 22 20 74 69 6d 65 + 2c 20 77 68 69 63 68 20 77 65 20 61 6c 73 6f 20 + 63 61 6c 6c 20 6c 6f 67 2d 6c 6f 61 64 20 74 69 + 6d 65 2c 20 69 73 0a + + ~ " ~ analogous to the label transform's "compile" time. The" + ~ " log-load" + 20 20 7e 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f + 20 74 68 65 20 6c 61 62 65 6c 20 74 72 61 6e 73 + 66 6f 72 6d 27 73 20 22 63 6f 6d 70 69 6c 65 22 + 20 74 69 6d 65 2e 20 54 68 65 20 6c 6f 67 2d 6c + 6f 61 64 0a + + ~ " ~ transform's "compile" time is an additional layer of" + ~ " indirection." + 20 20 7e 20 74 72 61 6e 73 66 6f 72 6d 27 73 20 + 22 63 6f 6d 70 69 6c 65 22 20 74 69 6d 65 20 69 + 73 20 61 6e 20 61 64 64 69 74 69 6f 6e 61 6c 20 + 6c 61 79 65 72 20 6f 66 20 69 6e 64 69 72 65 63 + 74 69 6f 6e 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ No matter which mode we're in, the first thing we" + ~ " want to do is get the" + 20 20 7e 20 20 20 4e 6f 20 6d 61 74 74 65 72 20 + 77 68 69 63 68 20 6d 6f 64 65 20 77 65 27 72 65 + 20 69 6e 2c 20 74 68 65 20 66 69 72 73 74 20 74 + 68 69 6e 67 20 77 65 20 77 61 6e 74 20 74 6f 20 + 64 6f 20 69 73 20 67 65 74 20 74 68 65 0a + + ~ " ~ string onto the value stack at log-load time. So we" + ~ " compile code to do" + 20 20 7e 20 73 74 72 69 6e 67 20 6f 6e 74 6f 20 + 74 68 65 20 76 61 6c 75 65 20 73 74 61 63 6b 20 + 61 74 20 6c 6f 67 2d 6c 6f 61 64 20 74 69 6d 65 + 2e 20 53 6f 20 77 65 20 63 6f 6d 70 69 6c 65 20 + 63 6f 64 65 20 74 6f 20 64 6f 0a + + ~ " ~ that, first. We do that using the static "litstring"," + ~ " which we find by" + 20 20 7e 20 74 68 61 74 2c 20 66 69 72 73 74 2e + 20 57 65 20 64 6f 20 74 68 61 74 20 75 73 69 6e + 67 20 74 68 65 20 73 74 61 74 69 63 20 22 6c 69 + 74 73 74 72 69 6e 67 22 2c 20 77 68 69 63 68 20 + 77 65 20 66 69 6e 64 20 62 79 0a + + ~ " ~ label." + 20 20 7e 20 6c 61 62 65 6c 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ If this is all too twisty, it might be helpful to go" + ~ " re-read the" + 20 20 7e 20 20 20 49 66 20 74 68 69 73 20 69 73 + 20 61 6c 6c 20 74 6f 6f 20 74 77 69 73 74 79 2c + 20 69 74 20 6d 69 67 68 74 20 62 65 20 68 65 6c + 70 66 75 6c 20 74 6f 20 67 6f 20 72 65 2d 72 65 + 61 64 20 74 68 65 0a + + ~ " ~ definition of log-load-compile-literal, which does a" + ~ " simpler version of" + 20 20 7e 20 64 65 66 69 6e 69 74 69 6f 6e 20 6f + 66 20 6c 6f 67 2d 6c 6f 61 64 2d 63 6f 6d 70 69 + 6c 65 2d 6c 69 74 65 72 61 6c 2c 20 77 68 69 63 + 68 20 64 6f 65 73 20 61 20 73 69 6d 70 6c 65 72 + 20 76 65 72 73 69 6f 6e 20 6f 66 0a + + ~ " ~ this same task (because integers are easier than" + ~ " strings)." + 20 20 7e 20 74 68 69 73 20 73 61 6d 65 20 74 61 + 73 6b 20 28 62 65 63 61 75 73 65 20 69 6e 74 65 + 67 65 72 73 20 61 72 65 20 65 61 73 69 65 72 20 + 74 68 61 6e 20 73 74 72 69 6e 67 73 29 2e 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' litstring" + 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e 67 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space , ~ : -8 litstring #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 6c 69 + 74 73 74 72 69 6e 67 20 23 2d 2d 20 28 63 6f 64 + 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " here @ swap packstring 8 packalign here !" + 20 20 68 65 72 65 20 40 20 73 77 61 70 20 70 61 + 63 6b 73 74 72 69 6e 67 20 38 20 70 61 63 6b 61 + 6c 69 67 6e 20 68 65 72 65 20 21 0a + + ~ "" + 0a + + ~ " ~ Now the string pointer is on the stack at log-load" + ~ " time, so we apply a" + 20 20 7e 20 20 20 4e 6f 77 20 74 68 65 20 73 74 + 72 69 6e 67 20 70 6f 69 6e 74 65 72 20 69 73 20 + 6f 6e 20 74 68 65 20 73 74 61 63 6b 20 61 74 20 + 6c 6f 67 2d 6c 6f 61 64 20 74 69 6d 65 2c 20 73 + 6f 20 77 65 20 61 70 70 6c 79 20 61 0a + + ~ " ~ delta for it." + 20 20 7e 20 64 65 6c 74 61 20 66 6f 72 20 69 74 + 2e 0a + + ~ " 1 transform-apply-stack-delta" + 20 20 31 20 74 72 61 6e 73 66 6f 72 6d 2d 61 70 + 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c 74 61 0a + + ~ "" + 0a + + ~ " ~ If we're in immediate mode, we're done! Yay! Putting" + ~ " the string on the" + 20 20 7e 20 20 20 49 66 20 77 65 27 72 65 20 69 + 6e 20 69 6d 6d 65 64 69 61 74 65 20 6d 6f 64 65 + 2c 20 77 65 27 72 65 20 64 6f 6e 65 21 20 59 61 + 79 21 20 50 75 74 74 69 6e 67 20 74 68 65 20 73 + 74 72 69 6e 67 20 6f 6e 20 74 68 65 0a + + ~ " ~ stack at log-load time is what we wanted. If not..." + 20 20 7e 20 73 74 61 63 6b 20 61 74 20 6c 6f 67 + 2d 6c 6f 61 64 20 74 69 6d 65 20 69 73 20 77 68 + 61 74 20 77 65 20 77 61 6e 74 65 64 2e 20 49 66 + 20 6e 6f 74 2e 2e 2e 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " ~ We're in compile mode, so we need to look up the" + ~ " ultimate, dynamic," + 20 20 20 20 7e 20 20 20 57 65 27 72 65 20 69 6e + 20 63 6f 6d 70 69 6c 65 20 6d 6f 64 65 2c 20 73 + 6f 20 77 65 20 6e 65 65 64 20 74 6f 20 6c 6f 6f + 6b 20 75 70 20 74 68 65 20 75 6c 74 69 6d 61 74 + 65 2c 20 64 79 6e 61 6d 69 63 2c 0a + + ~ " ~ log-based, super-atomic space rocket copy of" + ~ " "litstring" and use that." + 20 20 20 20 7e 20 6c 6f 67 2d 62 61 73 65 64 2c + 20 73 75 70 65 72 2d 61 74 6f 6d 69 63 20 73 70 + 61 63 65 20 72 6f 63 6b 65 74 20 63 6f 70 79 20 + 6f 66 20 22 6c 69 74 73 74 72 69 6e 67 22 20 61 + 6e 64 20 75 73 65 20 74 68 61 74 2e 0a + + ~ " ~ We could call log-load-compile-dynamic-word here," + ~ " but, as usual, it" + 20 20 20 20 7e 20 57 65 20 63 6f 75 6c 64 20 63 + 61 6c 6c 20 6c 6f 67 2d 6c 6f 61 64 2d 63 6f 6d + 70 69 6c 65 2d 64 79 6e 61 6d 69 63 2d 77 6f 72 + 64 20 68 65 72 65 2c 20 62 75 74 2c 20 61 73 20 + 75 73 75 61 6c 2c 20 69 74 0a + + ~ " ~ would produce some excessive rolling and unrolling," + ~ " so we do its job" + 20 20 20 20 7e 20 77 6f 75 6c 64 20 70 72 6f 64 + 75 63 65 20 73 6f 6d 65 20 65 78 63 65 73 73 69 + 76 65 20 72 6f 6c 6c 69 6e 67 20 61 6e 64 20 75 + 6e 72 6f 6c 6c 69 6e 67 2c 20 73 6f 20 77 65 20 + 64 6f 20 69 74 73 20 6a 6f 62 0a + + ~ " ~ ourselves instead." + 20 20 20 20 7e 20 6f 75 72 73 65 6c 76 65 73 20 + 69 6e 73 74 65 61 64 2e 0a + + ~ " log-load-roll-log-address" + 20 20 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " ~ As usual, we do these in reverse." + 20 20 20 20 7e 20 41 73 20 75 73 75 61 6c 2c 20 + 77 65 20 64 6f 20 74 68 65 73 65 20 69 6e 20 72 + 65 76 65 72 73 65 2e 0a + + ~ " L@' log-load-comma-string" + 20 20 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 + 2d 63 6f 6d 6d 61 2d 73 74 72 69 6e 67 0a + + ~ " L@' swap" + 20 20 20 20 4c 40 27 20 73 77 61 70 0a + + ~ " L@' log-load-comma" + 20 20 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 + 2d 63 6f 6d 6d 61 0a + + ~ " L@' log-load-find-execution-token" + 20 20 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 + 2d 66 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e 2d + 74 6f 6b 65 6e 0a + + ~ " L@' litstring" + 20 20 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e + 67 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " ~ The overall stack delta of this sequence is 0." + 20 20 20 20 7e 20 54 68 65 20 6f 76 65 72 61 6c + 6c 20 73 74 61 63 6b 20 64 65 6c 74 61 20 6f 66 + 20 74 68 69 73 20 73 65 71 75 65 6e 63 65 20 69 + 73 20 30 2e 0a + + ~ " offset-to-target-address-space ," + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 0a + + ~ " ~ : -8 litstring #-- (codeword pointer)" + 20 20 20 20 7e 20 3a 20 2d 38 20 6c 69 74 73 74 + 72 69 6e 67 20 23 2d 2d 20 28 63 6f 64 65 77 6f + 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " here @ s" litstring" packstring 8 packalign here !" + 20 20 20 20 68 65 72 65 20 40 20 73 22 20 6c 69 + 74 73 74 72 69 6e 67 22 20 70 61 63 6b 73 74 72 + 69 6e 67 20 38 20 70 61 63 6b 61 6c 69 67 6e 20 + 68 65 72 65 20 21 0a + + ~ " offset-to-target-address-space ," + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 0a + + ~ " ~ : -8 log-load-find-execution-token #-- (codeword" + ~ " pointer)" + 20 20 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c + 6f 61 64 2d 66 69 6e 64 2d 65 78 65 63 75 74 69 + 6f 6e 2d 74 6f 6b 65 6e 20 23 2d 2d 20 28 63 6f + 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " offset-to-target-address-space ," + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 0a + + ~ " ~ : -8 log-load-comma #-- (codeword pointer)" + 20 20 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c + 6f 61 64 2d 63 6f 6d 6d 61 20 23 2d 2d 20 28 63 + 6f 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 + 0a + + ~ " offset-to-target-address-space , ~ : -8 swap #--" + ~ " (codeword pointer)" + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 + 73 77 61 70 20 23 2d 2d 20 28 63 6f 64 65 77 6f + 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " offset-to-target-address-space ," + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 0a + + ~ " ~ : -8 log-load-comma-string #-- (codeword pointer)" + 20 20 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c + 6f 61 64 2d 63 6f 6d 6d 61 2d 73 74 72 69 6e 67 + 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 70 + 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " ~ We consumed the string pointer at log-load time, so" + ~ " we apply a delta" + 20 20 20 20 7e 20 20 20 57 65 20 63 6f 6e 73 75 + 6d 65 64 20 74 68 65 20 73 74 72 69 6e 67 20 70 + 6f 69 6e 74 65 72 20 61 74 20 6c 6f 67 2d 6c 6f + 61 64 20 74 69 6d 65 2c 20 73 6f 20 77 65 20 61 + 70 70 6c 79 20 61 20 64 65 6c 74 61 0a + + ~ " ~ for it." + 20 20 20 20 7e 20 66 6f 72 20 69 74 2e 0a + + ~ " ~" + 20 20 20 20 7e 0a + + ~ " ~ Notice by the way how the nearby calls to" + ~ " log-load-unroll-log-address" + 20 20 20 20 7e 20 20 20 4e 6f 74 69 63 65 20 62 + 79 20 74 68 65 20 77 61 79 20 68 6f 77 20 74 68 + 65 20 6e 65 61 72 62 79 20 63 61 6c 6c 73 20 74 + 6f 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ " ~ rely on this being split into two deltas like this," + ~ " even though they" + 20 20 20 20 7e 20 72 65 6c 79 20 6f 6e 20 74 68 + 69 73 20 62 65 69 6e 67 20 73 70 6c 69 74 20 69 + 6e 74 6f 20 74 77 6f 20 64 65 6c 74 61 73 20 6c + 69 6b 65 20 74 68 69 73 2c 20 65 76 65 6e 20 74 + 68 6f 75 67 68 20 74 68 65 79 0a + + ~ " ~ net out to zero; we aren't doing it just for kicks." + 20 20 20 20 7e 20 6e 65 74 20 6f 75 74 20 74 6f + 20 7a 65 72 6f 3b 20 77 65 20 61 72 65 6e 27 74 + 20 64 6f 69 6e 67 20 69 74 20 6a 75 73 74 20 66 + 6f 72 20 6b 69 63 6b 73 2e 0a + + ~ " -1 transform-apply-stack-delta" + 20 20 20 20 2d 31 20 74 72 61 6e 73 66 6f 72 6d + 2d 61 70 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c + 74 61 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address" + 20 20 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 + 6f 6c 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ ": log-load-dot-string-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 64 6f 74 2d 73 + 74 72 69 6e 67 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ " ' log-load-string-alternate entry-to-execution-token" + ~ " execute" + 20 20 27 20 6c 6f 67 2d 6c 6f 61 64 2d 73 74 72 + 69 6e 67 2d 61 6c 74 65 72 6e 61 74 65 20 65 6e + 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 69 6f 6e + 2d 74 6f 6b 65 6e 20 65 78 65 63 75 74 65 0a + + ~ "" + 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " ~ Hey look, it's the one time we're doing something" + ~ " simple enough that" + 20 20 20 20 7e 20 20 20 48 65 79 20 6c 6f 6f 6b + 2c 20 69 74 27 73 20 74 68 65 20 6f 6e 65 20 74 + 69 6d 65 20 77 65 27 72 65 20 64 6f 69 6e 67 20 + 73 6f 6d 65 74 68 69 6e 67 20 73 69 6d 70 6c 65 + 20 65 6e 6f 75 67 68 20 74 68 61 74 0a + + ~ " ~ we can actually benefit from" + ~ " log-load-compile-dynamic-word as something" + 20 20 20 20 7e 20 77 65 20 63 61 6e 20 61 63 74 + 75 61 6c 6c 79 20 62 65 6e 65 66 69 74 20 66 72 + 6f 6d 20 6c 6f 67 2d 6c 6f 61 64 2d 63 6f 6d 70 + 69 6c 65 2d 64 79 6e 61 6d 69 63 2d 77 6f 72 64 + 20 61 73 20 73 6f 6d 65 74 68 69 6e 67 0a + + ~ " ~ more than an example to start from. :)" + 20 20 20 20 7e 20 6d 6f 72 65 20 74 68 61 6e 20 + 61 6e 20 65 78 61 6d 70 6c 65 20 74 6f 20 73 74 + 61 72 74 20 66 72 6f 6d 2e 20 3a 29 0a + + ~ " s" emitstring" log-load-compile-dynamic-word" + 20 20 20 20 73 22 20 65 6d 69 74 73 74 72 69 6e + 67 22 20 6c 6f 67 2d 6c 6f 61 64 2d 63 6f 6d 70 + 69 6c 65 2d 64 79 6e 61 6d 69 63 2d 77 6f 72 64 + 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' emitstring" + 20 20 20 20 4c 40 27 20 65 6d 69 74 73 74 72 69 + 6e 67 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space ," + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 0a + + ~ " ~ : -8 emitstring #-- (codeword pointer)" + 20 20 20 20 7e 20 3a 20 2d 38 20 65 6d 69 74 73 + 74 72 69 6e 67 20 23 2d 2d 20 28 63 6f 64 65 77 + 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " } if-else" + 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ No matter what mode we're in, we read a name at" + ~ " transform time. Then we" + 7e 20 20 20 4e 6f 20 6d 61 74 74 65 72 20 77 68 + 61 74 20 6d 6f 64 65 20 77 65 27 72 65 20 69 6e + 2c 20 77 65 20 72 65 61 64 20 61 20 6e 61 6d 65 + 20 61 74 20 74 72 61 6e 73 66 6f 72 6d 20 74 69 + 6d 65 2e 20 54 68 65 6e 20 77 65 0a + + ~ "~ look up the name at either log-load time or runtime," + ~ " depending." + 7e 20 6c 6f 6f 6b 20 75 70 20 74 68 65 20 6e 61 + 6d 65 20 61 74 20 65 69 74 68 65 72 20 6c 6f 67 + 2d 6c 6f 61 64 20 74 69 6d 65 20 6f 72 20 72 75 + 6e 74 69 6d 65 2c 20 64 65 70 65 6e 64 69 6e 67 + 2e 0a + + ~ ": log-load-tick-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 74 69 63 6b 2d + 61 6c 74 65 72 6e 61 74 65 0a + + ~ " ~ Read the name." + 20 20 7e 20 52 65 61 64 20 74 68 65 20 6e 61 6d + 65 2e 0a + + ~ " word value@" + 20 20 77 6f 72 64 20 76 61 6c 75 65 40 0a + + ~ "" + 0a + + ~ " ~ Get the name onto the stack at log-load time." + 20 20 7e 20 47 65 74 20 74 68 65 20 6e 61 6d 65 + 20 6f 6e 74 6f 20 74 68 65 20 73 74 61 63 6b 20 + 61 74 20 6c 6f 67 2d 6c 6f 61 64 20 74 69 6d 65 + 2e 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' litstring" + 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e 67 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space , ~ : -8 litstring #--" + ~ " (codeword pointer)" + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 6c 69 + 74 73 74 72 69 6e 67 20 23 2d 2d 20 28 63 6f 64 + 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " here @ swap packstring 8 packalign here !" + 20 20 68 65 72 65 20 40 20 73 77 61 70 20 70 61 + 63 6b 73 74 72 69 6e 67 20 38 20 70 61 63 6b 61 + 6c 69 67 6e 20 68 65 72 65 20 21 0a + + ~ "" + 0a + + ~ " ~ Apply a delta for the string pointer." + 20 20 7e 20 41 70 70 6c 79 20 61 20 64 65 6c 74 + 61 20 66 6f 72 20 74 68 65 20 73 74 72 69 6e 67 + 20 70 6f 69 6e 74 65 72 2e 0a + + ~ " 1 transform-apply-stack-delta" + 20 20 31 20 74 72 61 6e 73 66 6f 72 6d 2d 61 70 + 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c 74 61 0a + + ~ "" + 0a + + ~ " dropstring" + 20 20 64 72 6f 70 73 74 72 69 6e 67 0a + + ~ "" + 0a + + ~ " ~ Now break out the remaining behavior based on mode." + 20 20 7e 20 4e 6f 77 20 62 72 65 61 6b 20 6f 75 + 74 20 74 68 65 20 72 65 6d 61 69 6e 69 6e 67 20 + 62 65 68 61 76 69 6f 72 20 62 61 73 65 64 20 6f + 6e 20 6d 6f 64 65 2e 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " log-load-roll-log-address" + 20 20 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' log-load-comma" + 20 20 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 + 2d 63 6f 6d 6d 61 0a + + ~ " L@' log-load-find-execution-token" + 20 20 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 + 2d 66 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e 2d + 74 6f 6b 65 6e 0a + + ~ " L@' litstring" + 20 20 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e + 67 0a + + ~ " L@' log-load-comma-string" + 20 20 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 + 2d 63 6f 6d 6d 61 2d 73 74 72 69 6e 67 0a + + ~ " L@' swap" + 20 20 20 20 4c 40 27 20 73 77 61 70 0a + + ~ " L@' log-load-comma" + 20 20 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 + 2d 63 6f 6d 6d 61 0a + + ~ " L@' log-load-find-execution-token" + 20 20 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 + 2d 66 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e 2d + 74 6f 6b 65 6e 0a + + ~ " L@' litstring" + 20 20 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e + 67 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " ~ The overall stack delta of this sequence is 0." + 20 20 20 20 7e 20 54 68 65 20 6f 76 65 72 61 6c + 6c 20 73 74 61 63 6b 20 64 65 6c 74 61 20 6f 66 + 20 74 68 69 73 20 73 65 71 75 65 6e 63 65 20 69 + 73 20 30 2e 0a + + ~ " offset-to-target-address-space ," + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 0a + + ~ " ~ : -8 litstring #-- (codeword pointer)" + 20 20 20 20 7e 20 3a 20 2d 38 20 6c 69 74 73 74 + 72 69 6e 67 20 23 2d 2d 20 28 63 6f 64 65 77 6f + 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " here @ s" litstring" packstring 8 packalign here !" + 20 20 20 20 68 65 72 65 20 40 20 73 22 20 6c 69 + 74 73 74 72 69 6e 67 22 20 70 61 63 6b 73 74 72 + 69 6e 67 20 38 20 70 61 63 6b 61 6c 69 67 6e 20 + 68 65 72 65 20 21 0a + + ~ " offset-to-target-address-space ," + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 0a + + ~ " ~ : -8 log-load-find-execution-token #-- (codeword" + ~ " pointer)" + 20 20 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c + 6f 61 64 2d 66 69 6e 64 2d 65 78 65 63 75 74 69 + 6f 6e 2d 74 6f 6b 65 6e 20 23 2d 2d 20 28 63 6f + 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " offset-to-target-address-space ," + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 0a + + ~ " ~ : -8 log-load-comma #-- (codeword pointer)" + 20 20 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c + 6f 61 64 2d 63 6f 6d 6d 61 20 23 2d 2d 20 28 63 + 6f 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 + 0a + + ~ " offset-to-target-address-space , ~ : -8 swap #--" + ~ " (codeword pointer)" + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 20 20 20 20 20 7e 20 3a 20 2d 38 20 + 73 77 61 70 20 23 2d 2d 20 28 63 6f 64 65 77 6f + 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " offset-to-target-address-space ," + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 0a + + ~ " ~ : -8 log-load-comma-string #-- (codeword pointer)" + 20 20 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c + 6f 61 64 2d 63 6f 6d 6d 61 2d 73 74 72 69 6e 67 + 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 70 + 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space ," + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 0a + + ~ " ~ : -8 litstring #-- (codeword pointer)" + 20 20 20 20 7e 20 3a 20 2d 38 20 6c 69 74 73 74 + 72 69 6e 67 20 23 2d 2d 20 28 63 6f 64 65 77 6f + 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " here @ s" find" packstring 8 packalign here !" + 20 20 20 20 68 65 72 65 20 40 20 73 22 20 66 69 + 6e 64 22 20 70 61 63 6b 73 74 72 69 6e 67 20 38 + 20 70 61 63 6b 61 6c 69 67 6e 20 68 65 72 65 20 + 21 0a + + ~ " offset-to-target-address-space ," + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 0a + + ~ " ~ : -8 log-load-find-execution-token #-- (codeword" + ~ " pointer)" + 20 20 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c + 6f 61 64 2d 66 69 6e 64 2d 65 78 65 63 75 74 69 + 6f 6e 2d 74 6f 6b 65 6e 20 23 2d 2d 20 28 63 6f + 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " offset-to-target-address-space ," + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 0a + + ~ " ~ : -8 log-load-comma #-- (codeword pointer)" + 20 20 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c + 6f 61 64 2d 63 6f 6d 6d 61 20 23 2d 2d 20 28 63 + 6f 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 + 0a + + ~ "" + 0a + + ~ " ~ We consumed the string pointer at log-load time, so" + ~ " we apply a delta" + 20 20 20 20 7e 20 20 20 57 65 20 63 6f 6e 73 75 + 6d 65 64 20 74 68 65 20 73 74 72 69 6e 67 20 70 + 6f 69 6e 74 65 72 20 61 74 20 6c 6f 67 2d 6c 6f + 61 64 20 74 69 6d 65 2c 20 73 6f 20 77 65 20 61 + 70 70 6c 79 20 61 20 64 65 6c 74 61 0a + + ~ " ~ for it. As in log-load-string-alternate, this needs" + ~ " to be split into" + 20 20 20 20 7e 20 66 6f 72 20 69 74 2e 20 41 73 + 20 69 6e 20 6c 6f 67 2d 6c 6f 61 64 2d 73 74 72 + 69 6e 67 2d 61 6c 74 65 72 6e 61 74 65 2c 20 74 + 68 69 73 20 6e 65 65 64 73 20 74 6f 20 62 65 20 + 73 70 6c 69 74 20 69 6e 74 6f 0a + + ~ " ~ two parts like this." + 20 20 20 20 7e 20 74 77 6f 20 70 61 72 74 73 20 + 6c 69 6b 65 20 74 68 69 73 2e 0a + + ~ " -1 transform-apply-stack-delta" + 20 20 20 20 2d 31 20 74 72 61 6e 73 66 6f 72 6d + 2d 61 70 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c + 74 61 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address" + 20 20 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 + 6f 6c 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " log-load-roll-log-address" + 20 20 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' log-load-find" + 20 20 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 + 2d 66 69 6e 64 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space ," + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 0a + + ~ " ~ : -8 log-load-find #-- (codeword pointer)" + 20 20 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c + 6f 61 64 2d 66 69 6e 64 20 23 2d 2d 20 28 63 6f + 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " ~ We leave an execution token on the log-load-time" + ~ " stack, so no delta" + 20 20 20 20 7e 20 20 20 57 65 20 6c 65 61 76 65 + 20 61 6e 20 65 78 65 63 75 74 69 6f 6e 20 74 6f + 6b 65 6e 20 6f 6e 20 74 68 65 20 6c 6f 67 2d 6c + 6f 61 64 2d 74 69 6d 65 20 73 74 61 63 6b 2c 20 + 73 6f 20 6e 6f 20 64 65 6c 74 61 0a + + ~ " ~ needed." + 20 20 20 20 7e 20 6e 65 65 64 65 64 2e 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address" + 20 20 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 + 6f 6c 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ " } if-else" + 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Because docol requires it, we provide a special" + ~ " mini-version of the label" + 7e 20 20 20 42 65 63 61 75 73 65 20 64 6f 63 6f + 6c 20 72 65 71 75 69 72 65 73 20 69 74 2c 20 77 + 65 20 70 72 6f 76 69 64 65 20 61 20 73 70 65 63 + 69 61 6c 20 6d 69 6e 69 2d 76 65 72 73 69 6f 6e + 20 6f 66 20 74 68 65 20 6c 61 62 65 6c 0a + + ~ "~ system. We only do L@' and L!', because that's all we" + ~ " need. Unlike the" + 7e 20 73 79 73 74 65 6d 2e 20 57 65 20 6f 6e 6c + 79 20 64 6f 20 4c 40 27 20 61 6e 64 20 4c 21 27 + 2c 20 62 65 63 61 75 73 65 20 74 68 61 74 27 73 + 20 61 6c 6c 20 77 65 20 6e 65 65 64 2e 20 55 6e + 6c 69 6b 65 20 74 68 65 0a + + ~ "~ version of this feature for the label transform, for the" + ~ " log-load transform," + 7e 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 69 + 73 20 66 65 61 74 75 72 65 20 66 6f 72 20 74 68 + 65 20 6c 61 62 65 6c 20 74 72 61 6e 73 66 6f 72 + 6d 2c 20 66 6f 72 20 74 68 65 20 6c 6f 67 2d 6c + 6f 61 64 20 74 72 61 6e 73 66 6f 72 6d 2c 0a + + ~ "~ we heavily restrict the use-case." + 7e 20 77 65 20 68 65 61 76 69 6c 79 20 72 65 73 + 74 72 69 63 74 20 74 68 65 20 75 73 65 2d 63 61 + 73 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The implementation strategy is that we ignore the label" + ~ " name, and store" + 7e 20 20 20 54 68 65 20 69 6d 70 6c 65 6d 65 6e + 74 61 74 69 6f 6e 20 73 74 72 61 74 65 67 79 20 + 69 73 20 74 68 61 74 20 77 65 20 69 67 6e 6f 72 + 65 20 74 68 65 20 6c 61 62 65 6c 20 6e 61 6d 65 + 2c 20 61 6e 64 20 73 74 6f 72 65 0a + + ~ "~ the value on the stack when the generated log-load" + ~ " routine runs. So, each" + 7e 20 74 68 65 20 76 61 6c 75 65 20 6f 6e 20 74 + 68 65 20 73 74 61 63 6b 20 77 68 65 6e 20 74 68 + 65 20 67 65 6e 65 72 61 74 65 64 20 6c 6f 67 2d + 6c 6f 61 64 20 72 6f 75 74 69 6e 65 20 72 75 6e + 73 2e 20 53 6f 2c 20 65 61 63 68 0a + + ~ "~ instance of L@' must be closely followed by a matching" + ~ " instance of L!'. Each" + 7e 20 69 6e 73 74 61 6e 63 65 20 6f 66 20 4c 40 + 27 20 6d 75 73 74 20 62 65 20 63 6c 6f 73 65 6c + 79 20 66 6f 6c 6c 6f 77 65 64 20 62 79 20 61 20 + 6d 61 74 63 68 69 6e 67 20 69 6e 73 74 61 6e 63 + 65 20 6f 66 20 4c 21 27 2e 20 45 61 63 68 0a + + ~ "~ label can only ever be used exactly once, and it must be" + ~ " a backward" + 7e 20 6c 61 62 65 6c 20 63 61 6e 20 6f 6e 6c 79 + 20 65 76 65 72 20 62 65 20 75 73 65 64 20 65 78 + 61 63 74 6c 79 20 6f 6e 63 65 2c 20 61 6e 64 20 + 69 74 20 6d 75 73 74 20 62 65 20 61 20 62 61 63 + 6b 77 61 72 64 0a + + ~ "~ reference. Furthermore, the stack is used in a very" + ~ " specific way, which the" + 7e 20 72 65 66 65 72 65 6e 63 65 2e 20 46 75 72 + 74 68 65 72 6d 6f 72 65 2c 20 74 68 65 20 73 74 + 61 63 6b 20 69 73 20 75 73 65 64 20 69 6e 20 61 + 20 76 65 72 79 20 73 70 65 63 69 66 69 63 20 77 + 61 79 2c 20 77 68 69 63 68 20 74 68 65 0a + + ~ "~ transformed code must be compatible with. The easiest way" + ~ " to explain it is" + 7e 20 74 72 61 6e 73 66 6f 72 6d 65 64 20 63 6f + 64 65 20 6d 75 73 74 20 62 65 20 63 6f 6d 70 61 + 74 69 62 6c 65 20 77 69 74 68 2e 20 54 68 65 20 + 65 61 73 69 65 73 74 20 77 61 79 20 74 6f 20 65 + 78 70 6c 61 69 6e 20 69 74 20 69 73 0a + + ~ "~ by showing the interface of these words from the" + ~ " transformed code's" + 7e 20 62 79 20 73 68 6f 77 69 6e 67 20 74 68 65 + 20 69 6e 74 65 72 66 61 63 65 20 6f 66 20 74 68 + 65 73 65 20 77 6f 72 64 73 20 66 72 6f 6d 20 74 + 68 65 20 74 72 61 6e 73 66 6f 72 6d 65 64 20 63 + 6f 64 65 27 73 0a + + ~ "~ perspective:" + 7e 20 70 65 72 73 70 65 63 74 69 76 65 3a 0a + + ~ "~" + 7e 0a + + ~ "~ L!' is (preserved values, ..., ..., value of label" + 7e 20 20 20 4c 21 27 20 69 73 20 28 70 72 65 73 + 65 72 76 65 64 20 76 61 6c 75 65 73 2c 20 2e 2e + 2e 2c 20 2e 2e 2e 2c 20 76 61 6c 75 65 20 6f 66 + 20 6c 61 62 65 6c 0a + + ~ "~ -- value of label, preserved values, ..., ...)" + 7e 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 76 + 61 6c 75 65 20 6f 66 20 6c 61 62 65 6c 2c 20 70 + 72 65 73 65 72 76 65 64 20 76 61 6c 75 65 73 2c + 20 2e 2e 2e 2c 20 2e 2e 2e 29 0a + + ~ "~ L@' is (value of label, preserved values, ..., ...)" + 7e 20 20 20 4c 40 27 20 69 73 20 28 76 61 6c 75 + 65 20 6f 66 20 6c 61 62 65 6c 2c 20 70 72 65 73 + 65 72 76 65 64 20 76 61 6c 75 65 73 2c 20 2e 2e + 2e 2c 20 2e 2e 2e 29 0a + + ~ "~ -- preserved values, ..., ..., value of label)" + 7e 20 20 20 20 20 20 20 20 20 20 20 2d 2d 20 70 + 72 65 73 65 72 76 65 64 20 76 61 6c 75 65 73 2c + 20 2e 2e 2e 2c 20 2e 2e 2e 2c 20 76 61 6c 75 65 + 20 6f 66 20 6c 61 62 65 6c 29 0a + + ~ "~" + 7e 0a + + ~ "~ The preserved values are simply more items on the" + ~ " stack, which the" + 7e 20 20 20 54 68 65 20 70 72 65 73 65 72 76 65 + 64 20 76 61 6c 75 65 73 20 61 72 65 20 73 69 6d + 70 6c 79 20 6d 6f 72 65 20 69 74 65 6d 73 20 6f + 6e 20 74 68 65 20 73 74 61 63 6b 2c 20 77 68 69 + 63 68 20 74 68 65 0a + + ~ "~ alternates take pains not to interfere with. The" + ~ " alternates output a roll or" + 7e 20 61 6c 74 65 72 6e 61 74 65 73 20 74 61 6b + 65 20 70 61 69 6e 73 20 6e 6f 74 20 74 6f 20 69 + 6e 74 65 72 66 65 72 65 20 77 69 74 68 2e 20 54 + 68 65 20 61 6c 74 65 72 6e 61 74 65 73 20 6f 75 + 74 70 75 74 20 61 20 72 6f 6c 6c 20 6f 72 0a + + ~ "~ unroll of an appropriate size. Hopefully, in reading" + ~ " this, you have the" + 7e 20 75 6e 72 6f 6c 6c 20 6f 66 20 61 6e 20 61 + 70 70 72 6f 70 72 69 61 74 65 20 73 69 7a 65 2e + 20 48 6f 70 65 66 75 6c 6c 79 2c 20 69 6e 20 72 + 65 61 64 69 6e 67 20 74 68 69 73 2c 20 79 6f 75 + 20 68 61 76 65 20 74 68 65 0a + + ~ "~ question: How can the alternates possibly know what size" + ~ " is appropriate?" + 7e 20 71 75 65 73 74 69 6f 6e 3a 20 48 6f 77 20 + 63 61 6e 20 74 68 65 20 61 6c 74 65 72 6e 61 74 + 65 73 20 70 6f 73 73 69 62 6c 79 20 6b 6e 6f 77 + 20 77 68 61 74 20 73 69 7a 65 20 69 73 20 61 70 + 70 72 6f 70 72 69 61 74 65 3f 0a + + ~ "~ The answer is that the log-load transform carefully" + ~ " tracks how many items" + 7e 20 54 68 65 20 61 6e 73 77 65 72 20 69 73 20 + 74 68 61 74 20 74 68 65 20 6c 6f 67 2d 6c 6f 61 + 64 20 74 72 61 6e 73 66 6f 72 6d 20 63 61 72 65 + 66 75 6c 6c 79 20 74 72 61 63 6b 73 20 68 6f 77 + 20 6d 61 6e 79 20 69 74 65 6d 73 0a + + ~ "~ the transformed code is expected to have on the stack," + ~ " based on its" + 7e 20 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 65 + 64 20 63 6f 64 65 20 69 73 20 65 78 70 65 63 74 + 65 64 20 74 6f 20 68 61 76 65 20 6f 6e 20 74 68 + 65 20 73 74 61 63 6b 2c 20 62 61 73 65 64 20 6f + 6e 20 69 74 73 0a + + ~ "~ hardcoded understanding of each word that's expected to" + ~ " be relevant, looked" + 7e 20 68 61 72 64 63 6f 64 65 64 20 75 6e 64 65 + 72 73 74 61 6e 64 69 6e 67 20 6f 66 20 65 61 63 + 68 20 77 6f 72 64 20 74 68 61 74 27 73 20 65 78 + 70 65 63 74 65 64 20 74 6f 20 62 65 20 72 65 6c + 65 76 61 6e 74 2c 20 6c 6f 6f 6b 65 64 0a + + ~ "~ up by the word's name. The number of items is stored in" + ~ " the user-stack-depth" + 7e 20 75 70 20 62 79 20 74 68 65 20 77 6f 72 64 + 27 73 20 6e 61 6d 65 2e 20 54 68 65 20 6e 75 6d + 62 65 72 20 6f 66 20 69 74 65 6d 73 20 69 73 20 + 73 74 6f 72 65 64 20 69 6e 20 74 68 65 20 75 73 + 65 72 2d 73 74 61 63 6b 2d 64 65 70 74 68 0a + + ~ "~ field of transformation-state." + 7e 20 66 69 65 6c 64 20 6f 66 20 74 72 61 6e 73 + 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2e + 0a + + ~ "~" + 7e 0a + + ~ "~ There is no adjustment done on the saved value, since" + ~ " it's created in the" + 7e 20 20 20 54 68 65 72 65 20 69 73 20 6e 6f 20 + 61 64 6a 75 73 74 6d 65 6e 74 20 64 6f 6e 65 20 + 6f 6e 20 74 68 65 20 73 61 76 65 64 20 76 61 6c + 75 65 2c 20 73 69 6e 63 65 20 69 74 27 73 20 63 + 72 65 61 74 65 64 20 69 6e 20 74 68 65 0a + + ~ "~ target address space and then also used in the target" + ~ " address space. It" + 7e 20 74 61 72 67 65 74 20 61 64 64 72 65 73 73 + 20 73 70 61 63 65 20 61 6e 64 20 74 68 65 6e 20 + 61 6c 73 6f 20 75 73 65 64 20 69 6e 20 74 68 65 + 20 74 61 72 67 65 74 20 61 64 64 72 65 73 73 20 + 73 70 61 63 65 2e 20 49 74 0a + + ~ "~ wouldn't actually be necessary to use this at all, since" + ~ " checking "here"" + 7e 20 77 6f 75 6c 64 6e 27 74 20 61 63 74 75 61 + 6c 6c 79 20 62 65 20 6e 65 63 65 73 73 61 72 79 + 20 74 6f 20 75 73 65 20 74 68 69 73 20 61 74 20 + 61 6c 6c 2c 20 73 69 6e 63 65 20 63 68 65 63 6b + 69 6e 67 20 22 68 65 72 65 22 0a + + ~ "~ would be sufficient, but then the code would have to do" + ~ " something different" + 7e 20 77 6f 75 6c 64 20 62 65 20 73 75 66 66 69 + 63 69 65 6e 74 2c 20 62 75 74 20 74 68 65 6e 20 + 74 68 65 20 63 6f 64 65 20 77 6f 75 6c 64 20 68 + 61 76 65 20 74 6f 20 64 6f 20 73 6f 6d 65 74 68 + 69 6e 67 20 64 69 66 66 65 72 65 6e 74 0a + + ~ "~ depending on which transform it's running under, and" + ~ " there'd have to be a" + 7e 20 64 65 70 65 6e 64 69 6e 67 20 6f 6e 20 77 + 68 69 63 68 20 74 72 61 6e 73 66 6f 72 6d 20 69 + 74 27 73 20 72 75 6e 6e 69 6e 67 20 75 6e 64 65 + 72 2c 20 61 6e 64 20 74 68 65 72 65 27 64 20 68 + 61 76 65 20 74 6f 20 62 65 20 61 0a + + ~ "~ mechanism for that." + 7e 20 6d 65 63 68 61 6e 69 73 6d 20 66 6f 72 20 + 74 68 61 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ This is sufficient to implement docol, and that's" + ~ " probably the only thing" + 7e 20 20 20 54 68 69 73 20 69 73 20 73 75 66 66 + 69 63 69 65 6e 74 20 74 6f 20 69 6d 70 6c 65 6d + 65 6e 74 20 64 6f 63 6f 6c 2c 20 61 6e 64 20 74 + 68 61 74 27 73 20 70 72 6f 62 61 62 6c 79 20 74 + 68 65 20 6f 6e 6c 79 20 74 68 69 6e 67 0a + + ~ "~ it should be used for." + 7e 20 69 74 20 73 68 6f 75 6c 64 20 62 65 20 75 + 73 65 64 20 66 6f 72 2e 0a + + ~ ": log-load-L@'-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 4c 40 27 2d 61 + 6c 74 65 72 6e 61 74 65 0a + + ~ " word dropstring" + 20 20 77 6f 72 64 20 64 72 6f 70 73 74 72 69 6e + 67 0a + + ~ " log-load-roll-saved-label" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c 6c 2d + 73 61 76 65 64 2d 6c 61 62 65 6c 0a + + ~ " ~ We now begin thinking of the label value as user" + ~ " data, so we need to" + 20 20 7e 20 20 20 57 65 20 6e 6f 77 20 62 65 67 + 69 6e 20 74 68 69 6e 6b 69 6e 67 20 6f 66 20 74 + 68 65 20 6c 61 62 65 6c 20 76 61 6c 75 65 20 61 + 73 20 75 73 65 72 20 64 61 74 61 2c 20 73 6f 20 + 77 65 20 6e 65 65 64 20 74 6f 0a + + ~ " ~ notate that appropriately." + 20 20 7e 20 6e 6f 74 61 74 65 20 74 68 61 74 20 + 61 70 70 72 6f 70 72 69 61 74 65 6c 79 2e 0a + + ~ " 1 transform-apply-stack-delta" + 20 20 31 20 74 72 61 6e 73 66 6f 72 6d 2d 61 70 + 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c 74 61 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ ": log-load-L!'-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 4c 21 27 2d 61 + 6c 74 65 72 6e 61 74 65 0a + + ~ " word dropstring" + 20 20 77 6f 72 64 20 64 72 6f 70 73 74 72 69 6e + 67 0a + + ~ " ~ We cease to think of the label value as user data, so" + ~ " we need to notate" + 20 20 7e 20 20 20 57 65 20 63 65 61 73 65 20 74 + 6f 20 74 68 69 6e 6b 20 6f 66 20 74 68 65 20 6c + 61 62 65 6c 20 76 61 6c 75 65 20 61 73 20 75 73 + 65 72 20 64 61 74 61 2c 20 73 6f 20 77 65 20 6e + 65 65 64 20 74 6f 20 6e 6f 74 61 74 65 0a + + ~ " ~ that appropriately." + 20 20 7e 20 74 68 61 74 20 61 70 70 72 6f 70 72 + 69 61 74 65 6c 79 2e 0a + + ~ " -1 transform-apply-stack-delta" + 20 20 2d 31 20 74 72 61 6e 73 66 6f 72 6d 2d 61 + 70 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c 74 61 + 0a + + ~ " log-load-unroll-saved-label" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 2d 73 61 76 65 64 2d 6c 61 62 65 6c 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Not to be outdone by the label transform, the log-load" + ~ " transform also" + 7e 20 20 20 4e 6f 74 20 74 6f 20 62 65 20 6f 75 + 74 64 6f 6e 65 20 62 79 20 74 68 65 20 6c 61 62 + 65 6c 20 74 72 61 6e 73 66 6f 72 6d 2c 20 74 68 + 65 20 6c 6f 67 2d 6c 6f 61 64 20 74 72 61 6e 73 + 66 6f 72 6d 20 61 6c 73 6f 0a + + ~ "~ offers alternates of all the high-level flow-control" + ~ " words: if, unless," + 7e 20 6f 66 66 65 72 73 20 61 6c 74 65 72 6e 61 + 74 65 73 20 6f 66 20 61 6c 6c 20 74 68 65 20 68 + 69 67 68 2d 6c 65 76 65 6c 20 66 6c 6f 77 2d 63 + 6f 6e 74 72 6f 6c 20 77 6f 72 64 73 3a 20 69 66 + 2c 20 75 6e 6c 65 73 73 2c 0a + + ~ "~ if-else, forever, and while. Unlike the label transform," + ~ " we also need to" + 7e 20 69 66 2d 65 6c 73 65 2c 20 66 6f 72 65 76 + 65 72 2c 20 61 6e 64 20 77 68 69 6c 65 2e 20 55 + 6e 6c 69 6b 65 20 74 68 65 20 6c 61 62 65 6c 20 + 74 72 61 6e 73 66 6f 72 6d 2c 20 77 65 20 61 6c + 73 6f 20 6e 65 65 64 20 74 6f 0a + + ~ "~ implement alternates of { and }, because their values" + ~ " need to be on the" + 7e 20 69 6d 70 6c 65 6d 65 6e 74 20 61 6c 74 65 + 72 6e 61 74 65 73 20 6f 66 20 7b 20 61 6e 64 20 + 7d 2c 20 62 65 63 61 75 73 65 20 74 68 65 69 72 + 20 76 61 6c 75 65 73 20 6e 65 65 64 20 74 6f 20 + 62 65 20 6f 6e 20 74 68 65 0a + + ~ "~ stack at log-load "immediate" time, not at transform" + ~ " time." + 7e 20 73 74 61 63 6b 20 61 74 20 6c 6f 67 2d 6c + 6f 61 64 20 22 69 6d 6d 65 64 69 61 74 65 22 20 + 74 69 6d 65 2c 20 6e 6f 74 20 61 74 20 74 72 61 + 6e 73 66 6f 72 6d 20 74 69 6d 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Anyway, most of the implementation is deferred to" + ~ " pre-packaged words in" + 7e 20 20 20 41 6e 79 77 61 79 2c 20 6d 6f 73 74 + 20 6f 66 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e + 74 61 74 69 6f 6e 20 69 73 20 64 65 66 65 72 72 + 65 64 20 74 6f 20 70 72 65 2d 70 61 63 6b 61 67 + 65 64 20 77 6f 72 64 73 20 69 6e 0a + + ~ "~ language/static/log-load.e." + 7e 20 6c 61 6e 67 75 61 67 65 2f 73 74 61 74 69 + 63 2f 6c 6f 67 2d 6c 6f 61 64 2e 65 2e 0a + + ~ ": log-load-left-curly-brace-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 6c 65 66 74 2d + 63 75 72 6c 79 2d 62 72 61 63 65 2d 61 6c 74 65 + 72 6e 61 74 65 0a + + ~ " log-load-roll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c 6c 2d + 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' log-load-left-curly-brace" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 6c + 65 66 74 2d 63 75 72 6c 79 2d 62 72 61 63 65 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space ," + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 0a + + ~ " ~ : -8 log-load-left-curly-brace #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 6c 65 66 74 2d 63 75 72 6c 79 2d 62 72 61 + 63 65 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 + 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " ~ It pushes a start pointer onto the stack." + 20 20 7e 20 49 74 20 70 75 73 68 65 73 20 61 20 + 73 74 61 72 74 20 70 6f 69 6e 74 65 72 20 6f 6e + 74 6f 20 74 68 65 20 73 74 61 63 6b 2e 0a + + ~ " 1 transform-apply-stack-delta" + 20 20 31 20 74 72 61 6e 73 66 6f 72 6d 2d 61 70 + 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c 74 61 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ " ~ : {" + 20 20 7e 20 3a 20 7b 0a + + ~ " ~ : indent" + 20 20 7e 20 3a 20 69 6e 64 65 6e 74 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ ": log-load-right-curly-brace-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 72 69 67 68 74 + 2d 63 75 72 6c 79 2d 62 72 61 63 65 2d 61 6c 74 + 65 72 6e 61 74 65 0a + + ~ " ~ : deindent" + 20 20 7e 20 3a 20 64 65 69 6e 64 65 6e 74 0a + + ~ " ~ : }" + 20 20 7e 20 3a 20 7d 0a + + ~ " log-load-roll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c 6c 2d + 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' log-load-right-curly-brace" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 72 + 69 67 68 74 2d 63 75 72 6c 79 2d 62 72 61 63 65 + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space ," + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 0a + + ~ " ~ : -8 log-load-right-curly-brace #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 72 69 67 68 74 2d 63 75 72 6c 79 2d 62 72 + 61 63 65 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 + 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " ~ It pushes a length value onto the stack." + 20 20 7e 20 49 74 20 70 75 73 68 65 73 20 61 20 + 6c 65 6e 67 74 68 20 76 61 6c 75 65 20 6f 6e 74 + 6f 20 74 68 65 20 73 74 61 63 6b 2e 0a + + ~ " 1 transform-apply-stack-delta" + 20 20 31 20 74 72 61 6e 73 66 6f 72 6d 2d 61 70 + 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c 74 61 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ (start pointer, length --)" + 7e 20 28 73 74 61 72 74 20 70 6f 69 6e 74 65 72 + 2c 20 6c 65 6e 67 74 68 20 2d 2d 29 0a + + ~ ": log-load-if-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 69 66 2d 61 6c + 74 65 72 6e 61 74 65 0a + + ~ " ~ : if" + 20 20 7e 20 3a 20 69 66 0a + + ~ " log-load-roll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c 6c 2d + 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' log-load-if" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 69 + 66 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space ," + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 0a + + ~ " ~ : -8 log-load-if #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 69 66 20 23 2d 2d 20 28 63 6f 64 65 77 6f + 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " ~ It pops the start and length." + 20 20 7e 20 49 74 20 70 6f 70 73 20 74 68 65 20 + 73 74 61 72 74 20 61 6e 64 20 6c 65 6e 67 74 68 + 2e 0a + + ~ " -2 transform-apply-stack-delta" + 20 20 2d 32 20 74 72 61 6e 73 66 6f 72 6d 2d 61 + 70 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c 74 61 + 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ (start pointer, length)" + 7e 20 28 73 74 61 72 74 20 70 6f 69 6e 74 65 72 + 2c 20 6c 65 6e 67 74 68 29 0a + + ~ ": log-load-unless-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 6c 65 73 + 73 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ " ~ : unless" + 20 20 7e 20 3a 20 75 6e 6c 65 73 73 0a + + ~ " log-load-roll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c 6c 2d + 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' log-load-unless" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 75 + 6e 6c 65 73 73 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space ," + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 0a + + ~ " ~ : -8 log-load-unless #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 75 6e 6c 65 73 73 20 23 2d 2d 20 28 63 6f + 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " ~ It pops the start and length." + 20 20 7e 20 49 74 20 70 6f 70 73 20 74 68 65 20 + 73 74 61 72 74 20 61 6e 64 20 6c 65 6e 67 74 68 + 2e 0a + + ~ " -2 transform-apply-stack-delta" + 20 20 2d 32 20 74 72 61 6e 73 66 6f 72 6d 2d 61 + 70 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c 74 61 + 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ (true start, true length, false start, false length)" + 7e 20 28 74 72 75 65 20 73 74 61 72 74 2c 20 74 + 72 75 65 20 6c 65 6e 67 74 68 2c 20 66 61 6c 73 + 65 20 73 74 61 72 74 2c 20 66 61 6c 73 65 20 6c + 65 6e 67 74 68 29 0a + + ~ ": log-load-if-else-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 69 66 2d 65 6c + 73 65 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ " ~ : if-else" + 20 20 7e 20 3a 20 69 66 2d 65 6c 73 65 0a + + ~ " log-load-roll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c 6c 2d + 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' log-load-if-else" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 69 + 66 2d 65 6c 73 65 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space ," + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 0a + + ~ " ~ : -8 log-load-if-else #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 69 66 2d 65 6c 73 65 20 23 2d 2d 20 28 63 + 6f 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 + 0a + + ~ "" + 0a + + ~ " ~ It pops two pairs of start and length." + 20 20 7e 20 49 74 20 70 6f 70 73 20 74 77 6f 20 + 70 61 69 72 73 20 6f 66 20 73 74 61 72 74 20 61 + 6e 64 20 6c 65 6e 67 74 68 2e 0a + + ~ " -4 transform-apply-stack-delta" + 20 20 2d 34 20 74 72 61 6e 73 66 6f 72 6d 2d 61 + 70 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c 74 61 + 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ (start, length --)" + 7e 20 28 73 74 61 72 74 2c 20 6c 65 6e 67 74 68 + 20 2d 2d 29 0a + + ~ ": log-load-forever-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 66 6f 72 65 76 + 65 72 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ " ~ : forever" + 20 20 7e 20 3a 20 66 6f 72 65 76 65 72 0a + + ~ " log-load-roll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c 6c 2d + 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' log-load-forever" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 66 + 6f 72 65 76 65 72 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space ," + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 0a + + ~ " ~ : -8 log-load-forever #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 66 6f 72 65 76 65 72 20 23 2d 2d 20 28 63 + 6f 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 + 0a + + ~ "" + 0a + + ~ " ~ It pops the start and length." + 20 20 7e 20 49 74 20 70 6f 70 73 20 74 68 65 20 + 73 74 61 72 74 20 61 6e 64 20 6c 65 6e 67 74 68 + 2e 0a + + ~ " -2 transform-apply-stack-delta" + 20 20 2d 32 20 74 72 61 6e 73 66 6f 72 6d 2d 61 + 70 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c 74 61 + 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ (test start, test length, body start, body length --)" + 7e 20 28 74 65 73 74 20 73 74 61 72 74 2c 20 74 + 65 73 74 20 6c 65 6e 67 74 68 2c 20 62 6f 64 79 + 20 73 74 61 72 74 2c 20 62 6f 64 79 20 6c 65 6e + 67 74 68 20 2d 2d 29 0a + + ~ ": log-load-while-alternate" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 77 68 69 6c 65 + 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ " ~ : while" + 20 20 7e 20 3a 20 77 68 69 6c 65 0a + + ~ " log-load-roll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 72 6f 6c 6c 2d + 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ "" + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " L@' log-load-while" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 77 + 68 69 6c 65 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " offset-to-target-address-space ," + 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 2c 0a + + ~ " ~ : -8 log-load-while #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 77 68 69 6c 65 20 23 2d 2d 20 28 63 6f 64 + 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " ~ It pops two pairs of start and length." + 20 20 7e 20 49 74 20 70 6f 70 73 20 74 77 6f 20 + 70 61 69 72 73 20 6f 66 20 73 74 61 72 74 20 61 + 6e 64 20 6c 65 6e 67 74 68 2e 0a + + ~ " -4 transform-apply-stack-delta" + 20 20 2d 34 20 74 72 61 6e 73 66 6f 72 6d 2d 61 + 70 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c 74 61 + 0a + + ~ "" + 0a + + ~ " log-load-unroll-log-address" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 72 6f 6c + 6c 2d 6c 6f 67 2d 61 64 64 72 65 73 73 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This implements the log-load transform for a single" + ~ " word. It is directly" + 7e 20 20 20 54 68 69 73 20 69 6d 70 6c 65 6d 65 + 6e 74 73 20 74 68 65 20 6c 6f 67 2d 6c 6f 61 64 + 20 74 72 61 6e 73 66 6f 72 6d 20 66 6f 72 20 61 + 20 73 69 6e 67 6c 65 20 77 6f 72 64 2e 20 49 74 + 20 69 73 20 64 69 72 65 63 74 6c 79 0a + + ~ "~ analogous to "interpret", and reading" + ~ " language/dynamic/interpret.e may help" + 7e 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 22 + 69 6e 74 65 72 70 72 65 74 22 2c 20 61 6e 64 20 + 72 65 61 64 69 6e 67 20 6c 61 6e 67 75 61 67 65 + 2f 64 79 6e 61 6d 69 63 2f 69 6e 74 65 72 70 72 + 65 74 2e 65 20 6d 61 79 20 68 65 6c 70 0a + + ~ "~ in understanding it, though it's meant to still make" + ~ " sense on its own." + 7e 20 69 6e 20 75 6e 64 65 72 73 74 61 6e 64 69 + 6e 67 20 69 74 2c 20 74 68 6f 75 67 68 20 69 74 + 27 73 20 6d 65 61 6e 74 20 74 6f 20 73 74 69 6c + 6c 20 6d 61 6b 65 20 73 65 6e 73 65 20 6f 6e 20 + 69 74 73 20 6f 77 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ It expects to be called from "log-load-transform", below," + ~ " which loops." + 7e 20 49 74 20 65 78 70 65 63 74 73 20 74 6f 20 + 62 65 20 63 61 6c 6c 65 64 20 66 72 6f 6d 20 22 + 6c 6f 67 2d 6c 6f 61 64 2d 74 72 61 6e 73 66 6f + 72 6d 22 2c 20 62 65 6c 6f 77 2c 20 77 68 69 63 + 68 20 6c 6f 6f 70 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (-- done)" + 7e 20 28 2d 2d 20 64 6f 6e 65 29 0a + + ~ ": log-load-transform-one" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 74 72 61 6e 73 + 66 6f 72 6d 2d 6f 6e 65 0a + + ~ " word" + 20 20 77 6f 72 64 0a + + ~ "" + 0a + + ~ " ~ If no word was returned, end the transformation." + 20 20 7e 20 49 66 20 6e 6f 20 77 6f 72 64 20 77 + 61 73 20 72 65 74 75 72 6e 65 64 2c 20 65 6e 64 + 20 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 61 74 + 69 6f 6e 2e 0a + + ~ " dup 0 = { drop 1 exit } if" + 20 20 64 75 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ The string is on the top of the stack, so to get a" + ~ " pointer to it we get" + 20 20 7e 20 54 68 65 20 73 74 72 69 6e 67 20 69 + 73 20 6f 6e 20 74 68 65 20 74 6f 70 20 6f 66 20 + 74 68 65 20 73 74 61 63 6b 2c 20 73 6f 20 74 6f + 20 67 65 74 20 61 20 70 6f 69 6e 74 65 72 20 74 + 6f 20 69 74 20 77 65 20 67 65 74 0a + + ~ " ~ the stack address." + 20 20 7e 20 74 68 65 20 73 74 61 63 6b 20 61 64 + 64 72 65 73 73 2e 0a + + ~ " ~ (string)" + 20 20 7e 20 28 73 74 72 69 6e 67 29 0a + + ~ " value@" + 20 20 76 61 6c 75 65 40 0a + + ~ "" + 0a + + ~ " ~ Check whether it's one of the words we have" + ~ " alternates for, and look up" + 20 20 7e 20 20 20 43 68 65 63 6b 20 77 68 65 74 + 68 65 72 20 69 74 27 73 20 6f 6e 65 20 6f 66 20 + 74 68 65 20 77 6f 72 64 73 20 77 65 20 68 61 76 + 65 20 61 6c 74 65 72 6e 61 74 65 73 20 66 6f 72 + 2c 20 61 6e 64 20 6c 6f 6f 6b 20 75 70 0a + + ~ " ~ the alternate if so." + 20 20 7e 20 74 68 65 20 61 6c 74 65 72 6e 61 74 + 65 20 69 66 20 73 6f 2e 0a + + ~ " 0 swap" + 20 20 30 20 73 77 61 70 0a + + ~ " ~ (name as stack string, placeholder, name pointer)" + 20 20 7e 20 28 6e 61 6d 65 20 61 73 20 73 74 61 + 63 6b 20 73 74 72 69 6e 67 2c 20 70 6c 61 63 65 + 68 6f 6c 64 65 72 2c 20 6e 61 6d 65 20 70 6f 69 + 6e 74 65 72 29 0a + + ~ " dup s" create" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 63 72 65 61 74 65 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 0a + + ~ " swap drop ' log-load-create-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 6f 67 2d 6c 6f 61 64 2d 63 72 65 61 74 65 2d + 61 6c 74 65 72 6e 61 74 65 20 73 77 61 70 20 7d + 20 69 66 0a + + ~ " dup s" :" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 3a 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " swap drop ' log-load-colon-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 6f 67 2d 6c 6f 61 64 2d 63 6f 6c 6f 6e 2d 61 + 6c 74 65 72 6e 61 74 65 20 73 77 61 70 20 7d 20 + 69 66 0a + + ~ " dup s" self-codeword" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 73 65 6c 66 2d 63 6f + 64 65 77 6f 72 64 22 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 0a + + ~ " swap drop ' log-load-self-codeword-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 6f 67 2d 6c 6f 61 64 2d 73 65 6c 66 2d 63 6f + 64 65 77 6f 72 64 2d 61 6c 74 65 72 6e 61 74 65 + 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " dup s" ;" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 3b 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " swap drop ' log-load-semicolon-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 6f 67 2d 6c 6f 61 64 2d 73 65 6d 69 63 6f 6c + 6f 6e 2d 61 6c 74 65 72 6e 61 74 65 20 73 77 61 + 70 20 7d 20 69 66 0a + + ~ " dup s" ;asm" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 3b 61 73 6d 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " swap drop ' log-load-semicolon-assembly-alternate swap" + ~ " } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 6f 67 2d 6c 6f 61 64 2d 73 65 6d 69 63 6f 6c + 6f 6e 2d 61 73 73 65 6d 62 6c 79 2d 61 6c 74 65 + 72 6e 61 74 65 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " dup s" [" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 5b 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " swap drop ' log-load-left-square-brace-alternate swap }" + ~ " if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 6f 67 2d 6c 6f 61 64 2d 6c 65 66 74 2d 73 71 + 75 61 72 65 2d 62 72 61 63 65 2d 61 6c 74 65 72 + 6e 61 74 65 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " dup s" ]" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 5d 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " swap drop ' log-load-right-square-brace-alternate swap" + ~ " } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 6f 67 2d 6c 6f 61 64 2d 72 69 67 68 74 2d 73 + 71 75 61 72 65 2d 62 72 61 63 65 2d 61 6c 74 65 + 72 6e 61 74 65 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " dup s" ," stringcmp 0 = { swap drop '" + ~ " log-load-comma-alternate swap } if" + 20 20 64 75 70 20 73 22 20 2c 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 73 77 61 70 + 20 64 72 6f 70 20 27 20 6c 6f 67 2d 6c 6f 61 64 + 2d 63 6f 6d 6d 61 2d 61 6c 74 65 72 6e 61 74 65 + 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " dup s" variable" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 76 61 72 69 61 62 6c + 65 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 0a + + ~ " swap drop ' log-load-variable-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 6f 67 2d 6c 6f 61 64 2d 76 61 72 69 61 62 6c + 65 2d 61 6c 74 65 72 6e 61 74 65 20 73 77 61 70 + 20 7d 20 69 66 0a + + ~ " dup s" keyword" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 6b 65 79 77 6f 72 64 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 0a + + ~ " swap drop ' log-load-keyword-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 6f 67 2d 6c 6f 61 64 2d 6b 65 79 77 6f 72 64 + 2d 61 6c 74 65 72 6e 61 74 65 20 73 77 61 70 20 + 7d 20 69 66 0a + + ~ " dup s" ~" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 7e 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " swap drop ' log-load-tilde-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 6f 67 2d 6c 6f 61 64 2d 74 69 6c 64 65 2d 61 + 6c 74 65 72 6e 61 74 65 20 73 77 61 70 20 7d 20 + 69 66 0a + + ~ " ~ It is nontrivial to construct a string with a" + ~ " double-quote in it." + 20 20 7e 20 49 74 20 69 73 20 6e 6f 6e 74 72 69 + 76 69 61 6c 20 74 6f 20 63 6f 6e 73 74 72 75 63 + 74 20 61 20 73 74 72 69 6e 67 20 77 69 74 68 20 + 61 20 64 6f 75 62 6c 65 2d 71 75 6f 74 65 20 69 + 6e 20 69 74 2e 0a + + ~ " dup ' s" entry-to-name stringcmp 0 = {" + 20 20 64 75 70 20 27 20 73 22 20 65 6e 74 72 79 + 2d 74 6f 2d 6e 61 6d 65 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 0a + + ~ " swap drop ' log-load-string-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 6f 67 2d 6c 6f 61 64 2d 73 74 72 69 6e 67 2d + 61 6c 74 65 72 6e 61 74 65 20 73 77 61 70 20 7d + 20 69 66 0a + + ~ " dup ' ." entry-to-name stringcmp 0 = {" + 20 20 64 75 70 20 27 20 2e 22 20 65 6e 74 72 79 + 2d 74 6f 2d 6e 61 6d 65 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 0a + + ~ " swap drop ' log-load-dot-string-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 6f 67 2d 6c 6f 61 64 2d 64 6f 74 2d 73 74 72 + 69 6e 67 2d 61 6c 74 65 72 6e 61 74 65 20 73 77 + 61 70 20 7d 20 69 66 0a + + ~ " dup ' ' entry-to-name stringcmp 0 = {" + 20 20 64 75 70 20 27 20 27 20 65 6e 74 72 79 2d + 74 6f 2d 6e 61 6d 65 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 0a + + ~ " swap drop ' log-load-tick-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 6f 67 2d 6c 6f 61 64 2d 74 69 63 6b 2d 61 6c + 74 65 72 6e 61 74 65 20 73 77 61 70 20 7d 20 69 + 66 0a + + ~ " dup s" L@'" stringcmp 0 = { swap drop '" + ~ " log-load-L@'-alternate swap } if" + 20 20 64 75 70 20 73 22 20 4c 40 27 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 73 77 + 61 70 20 64 72 6f 70 20 27 20 6c 6f 67 2d 6c 6f + 61 64 2d 4c 40 27 2d 61 6c 74 65 72 6e 61 74 65 + 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " dup s" L!'" stringcmp 0 = { swap drop '" + ~ " log-load-L!'-alternate swap } if" + 20 20 64 75 70 20 73 22 20 4c 21 27 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 73 77 + 61 70 20 64 72 6f 70 20 27 20 6c 6f 67 2d 6c 6f + 61 64 2d 4c 21 27 2d 61 6c 74 65 72 6e 61 74 65 + 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " dup s" {" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 7b 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " swap drop ' log-load-left-curly-brace-alternate swap }" + ~ " if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 6f 67 2d 6c 6f 61 64 2d 6c 65 66 74 2d 63 75 + 72 6c 79 2d 62 72 61 63 65 2d 61 6c 74 65 72 6e + 61 74 65 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " dup s" }" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 7d 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " swap drop ' log-load-right-curly-brace-alternate swap }" + ~ " if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 6f 67 2d 6c 6f 61 64 2d 72 69 67 68 74 2d 63 + 75 72 6c 79 2d 62 72 61 63 65 2d 61 6c 74 65 72 + 6e 61 74 65 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " dup s" if" stringcmp 0 = { swap drop '" + ~ " log-load-if-alternate swap } if" + 20 20 64 75 70 20 73 22 20 69 66 22 20 73 74 72 + 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 73 77 61 + 70 20 64 72 6f 70 20 27 20 6c 6f 67 2d 6c 6f 61 + 64 2d 69 66 2d 61 6c 74 65 72 6e 61 74 65 20 73 + 77 61 70 20 7d 20 69 66 0a + + ~ " dup s" unless" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 75 6e 6c 65 73 73 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 0a + + ~ " swap drop ' log-load-unless-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 6f 67 2d 6c 6f 61 64 2d 75 6e 6c 65 73 73 2d + 61 6c 74 65 72 6e 61 74 65 20 73 77 61 70 20 7d + 20 69 66 0a + + ~ " dup s" if-else" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 69 66 2d 65 6c 73 65 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 0a + + ~ " swap drop ' log-load-if-else-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 6f 67 2d 6c 6f 61 64 2d 69 66 2d 65 6c 73 65 + 2d 61 6c 74 65 72 6e 61 74 65 20 73 77 61 70 20 + 7d 20 69 66 0a + + ~ " dup s" forever" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 66 6f 72 65 76 65 72 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 0a + + ~ " swap drop ' log-load-forever-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 6c 6f 67 2d 6c 6f 61 64 2d 66 6f 72 65 76 65 72 + 2d 61 6c 74 65 72 6e 61 74 65 20 73 77 61 70 20 + 7d 20 69 66 0a + + ~ " dup s" while" stringcmp 0 = { swap drop '" + ~ " log-load-while-alternate swap } if" + 20 20 64 75 70 20 73 22 20 77 68 69 6c 65 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 + 73 77 61 70 20 64 72 6f 70 20 27 20 6c 6f 67 2d + 6c 6f 61 64 2d 77 68 69 6c 65 2d 61 6c 74 65 72 + 6e 61 74 65 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " ~ (name as stack string, 0 or alternate entry pointer," + ~ " name pointer)" + 20 20 7e 20 28 6e 61 6d 65 20 61 73 20 73 74 61 + 63 6b 20 73 74 72 69 6e 67 2c 20 30 20 6f 72 20 + 61 6c 74 65 72 6e 61 74 65 20 65 6e 74 72 79 20 + 70 6f 69 6e 74 65 72 2c 20 6e 61 6d 65 20 70 6f + 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " ~ If we have an alternate, we want to run that now," + ~ " regardless of what" + 20 20 7e 20 20 20 49 66 20 77 65 20 68 61 76 65 + 20 61 6e 20 61 6c 74 65 72 6e 61 74 65 2c 20 77 + 65 20 77 61 6e 74 20 74 6f 20 72 75 6e 20 74 68 + 61 74 20 6e 6f 77 2c 20 72 65 67 61 72 64 6c 65 + 73 73 20 6f 66 20 77 68 61 74 0a + + ~ " ~ mode we're in. They're all flagged as immediate, but we" + ~ " don't even bother" + 20 20 7e 20 6d 6f 64 65 20 77 65 27 72 65 20 69 + 6e 2e 20 54 68 65 79 27 72 65 20 61 6c 6c 20 66 + 6c 61 67 67 65 64 20 61 73 20 69 6d 6d 65 64 69 + 61 74 65 2c 20 62 75 74 20 77 65 20 64 6f 6e 27 + 74 20 65 76 65 6e 20 62 6f 74 68 65 72 0a + + ~ " ~ checking, because it doesn't fully describe their" + ~ " behavior anyway. With" + 20 20 7e 20 63 68 65 63 6b 69 6e 67 2c 20 62 65 + 63 61 75 73 65 20 69 74 20 64 6f 65 73 6e 27 74 + 20 66 75 6c 6c 79 20 64 65 73 63 72 69 62 65 20 + 74 68 65 69 72 20 62 65 68 61 76 69 6f 72 20 61 + 6e 79 77 61 79 2e 20 57 69 74 68 0a + + ~ " ~ this transform there's three potential times at which" + ~ " we might execute" + 20 20 7e 20 74 68 69 73 20 74 72 61 6e 73 66 6f + 72 6d 20 74 68 65 72 65 27 73 20 74 68 72 65 65 + 20 70 6f 74 65 6e 74 69 61 6c 20 74 69 6d 65 73 + 20 61 74 20 77 68 69 63 68 20 77 65 20 6d 69 67 + 68 74 20 65 78 65 63 75 74 65 0a + + ~ " ~ things, not two. The alternates are more immediate than" + ~ " immediate; they" + 20 20 7e 20 74 68 69 6e 67 73 2c 20 6e 6f 74 20 + 74 77 6f 2e 20 54 68 65 20 61 6c 74 65 72 6e 61 + 74 65 73 20 61 72 65 20 6d 6f 72 65 20 69 6d 6d + 65 64 69 61 74 65 20 74 68 61 6e 20 69 6d 6d 65 + 64 69 61 74 65 3b 20 74 68 65 79 0a + + ~ " ~ run NOW, during the transformation." + 20 20 7e 20 72 75 6e 20 4e 4f 57 2c 20 64 75 72 + 69 6e 67 20 74 68 65 20 74 72 61 6e 73 66 6f 72 + 6d 61 74 69 6f 6e 2e 0a + + ~ " over {" + 20 20 6f 76 65 72 20 7b 0a + + ~ " drop dropstring-with-result" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 73 74 72 + 69 6e 67 2d 77 69 74 68 2d 72 65 73 75 6c 74 0a + + ~ " entry-to-execution-token execute" + 20 20 20 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 + 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 + 63 75 74 65 0a + + ~ " 0 exit" + 20 20 20 20 30 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " drop drop" + 20 20 64 72 6f 70 20 64 72 6f 70 0a + + ~ " ~ (name as stack string)" + 20 20 7e 20 28 6e 61 6d 65 20 61 73 20 73 74 61 + 63 6b 20 73 74 72 69 6e 67 29 0a + + ~ "" + 0a + + ~ " ~ Now we might have a compiled word, an immediate word," + ~ " or an integer" + 20 20 7e 20 20 20 4e 6f 77 20 77 65 20 6d 69 67 + 68 74 20 68 61 76 65 20 61 20 63 6f 6d 70 69 6c + 65 64 20 77 6f 72 64 2c 20 61 6e 20 69 6d 6d 65 + 64 69 61 74 65 20 77 6f 72 64 2c 20 6f 72 20 61 + 6e 20 69 6e 74 65 67 65 72 0a + + ~ " ~ literal. Recall that the word won't actually be looked" + ~ " up until the" + 20 20 7e 20 6c 69 74 65 72 61 6c 2e 20 52 65 63 + 61 6c 6c 20 74 68 61 74 20 74 68 65 20 77 6f 72 + 64 20 77 6f 6e 27 74 20 61 63 74 75 61 6c 6c 79 + 20 62 65 20 6c 6f 6f 6b 65 64 20 75 70 20 75 6e + 74 69 6c 20 74 68 65 0a + + ~ " ~ routine we're producing is run - that's the whole point" + ~ " - so there's no" + 20 20 7e 20 72 6f 75 74 69 6e 65 20 77 65 27 72 + 65 20 70 72 6f 64 75 63 69 6e 67 20 69 73 20 72 + 75 6e 20 2d 20 74 68 61 74 27 73 20 74 68 65 20 + 77 68 6f 6c 65 20 70 6f 69 6e 74 20 2d 20 73 6f + 20 74 68 65 72 65 27 73 20 6e 6f 0a + + ~ " ~ check we can perform now that will tell us whether the" + ~ " word we have exists" + 20 20 7e 20 63 68 65 63 6b 20 77 65 20 63 61 6e + 20 70 65 72 66 6f 72 6d 20 6e 6f 77 20 74 68 61 + 74 20 77 69 6c 6c 20 74 65 6c 6c 20 75 73 20 77 + 68 65 74 68 65 72 20 74 68 65 20 77 6f 72 64 20 + 77 65 20 68 61 76 65 20 65 78 69 73 74 73 0a + + ~ " ~ in the eventual log. Instead, we invert the usual" + ~ " fallback order and" + 20 20 7e 20 69 6e 20 74 68 65 20 65 76 65 6e 74 + 75 61 6c 20 6c 6f 67 2e 20 49 6e 73 74 65 61 64 + 2c 20 77 65 20 69 6e 76 65 72 74 20 74 68 65 20 + 75 73 75 61 6c 20 66 61 6c 6c 62 61 63 6b 20 6f + 72 64 65 72 20 61 6e 64 0a + + ~ " ~ check whether the word could be an integer literal. If" + ~ " it is, we'll" + 20 20 7e 20 63 68 65 63 6b 20 77 68 65 74 68 65 + 72 20 74 68 65 20 77 6f 72 64 20 63 6f 75 6c 64 + 20 62 65 20 61 6e 20 69 6e 74 65 67 65 72 20 6c + 69 74 65 72 61 6c 2e 20 49 66 20 69 74 20 69 73 + 2c 20 77 65 27 6c 6c 0a + + ~ " ~ handle that; if not, we'll assume it'll eventually" + ~ " exist." + 20 20 7e 20 68 61 6e 64 6c 65 20 74 68 61 74 3b + 20 69 66 20 6e 6f 74 2c 20 77 65 27 6c 6c 20 61 + 73 73 75 6d 65 20 69 74 27 6c 6c 20 65 76 65 6e + 74 75 61 6c 6c 79 20 65 78 69 73 74 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ This means that code that's run with the log-load" + ~ " transform can't" + 20 20 7e 20 20 20 54 68 69 73 20 6d 65 61 6e 73 + 20 74 68 61 74 20 63 6f 64 65 20 74 68 61 74 27 + 73 20 72 75 6e 20 77 69 74 68 20 74 68 65 20 6c + 6f 67 2d 6c 6f 61 64 20 74 72 61 6e 73 66 6f 72 + 6d 20 63 61 6e 27 74 0a + + ~ " ~ shadow an integer literal with a word definition. Oh," + ~ " so limiting." + 20 20 7e 20 73 68 61 64 6f 77 20 61 6e 20 69 6e + 74 65 67 65 72 20 6c 69 74 65 72 61 6c 20 77 69 + 74 68 20 61 20 77 6f 72 64 20 64 65 66 69 6e 69 + 74 69 6f 6e 2e 20 4f 68 2c 20 73 6f 20 6c 69 6d + 69 74 69 6e 67 2e 0a + + ~ " value@ read-integer 0 = {" + 20 20 76 61 6c 75 65 40 20 72 65 61 64 2d 69 6e + 74 65 67 65 72 20 30 20 3d 20 7b 0a + + ~ " ~ It's a number." + 20 20 20 20 7e 20 49 74 27 73 20 61 20 6e 75 6d + 62 65 72 2e 0a + + ~ " ~" + 20 20 20 20 7e 0a + + ~ " ~ (name as stack string, integer value)" + 20 20 20 20 7e 20 28 6e 61 6d 65 20 61 73 20 73 + 74 61 63 6b 20 73 74 72 69 6e 67 2c 20 69 6e 74 + 65 67 65 72 20 76 61 6c 75 65 29 0a + + ~ " dropstring-with-result" + 20 20 20 20 64 72 6f 70 73 74 72 69 6e 67 2d 77 + 69 74 68 2d 72 65 73 75 6c 74 0a + + ~ " ~ (integer value)" + 20 20 20 20 7e 20 28 69 6e 74 65 67 65 72 20 76 + 61 6c 75 65 29 0a + + ~ "" + 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d + 66 6c 61 67 73 20 40 20 30 78 30 31 20 26 20 7b + 0a + + ~ " ~ We're in compile mode, so we want to generate code" + ~ " which will compile" + 20 20 20 20 20 20 7e 20 57 65 27 72 65 20 69 6e + 20 63 6f 6d 70 69 6c 65 20 6d 6f 64 65 2c 20 73 + 6f 20 77 65 20 77 61 6e 74 20 74 6f 20 67 65 6e + 65 72 61 74 65 20 63 6f 64 65 20 77 68 69 63 68 + 20 77 69 6c 6c 20 63 6f 6d 70 69 6c 65 0a + + ~ " ~ the number." + 20 20 20 20 20 20 7e 20 74 68 65 20 6e 75 6d 62 + 65 72 2e 0a + + ~ " log-load-compile-literal" + 20 20 20 20 20 20 6c 6f 67 2d 6c 6f 61 64 2d 63 + 6f 6d 70 69 6c 65 2d 6c 69 74 65 72 61 6c 0a + + ~ " 0 exit" + 20 20 20 20 20 20 30 20 65 78 69 74 0a + + ~ " } if" + 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ We're in interpret mode, so we want to generate" + ~ " code which will push" + 20 20 20 20 7e 20 20 20 57 65 27 72 65 20 69 6e + 20 69 6e 74 65 72 70 72 65 74 20 6d 6f 64 65 2c + 20 73 6f 20 77 65 20 77 61 6e 74 20 74 6f 20 67 + 65 6e 65 72 61 74 65 20 63 6f 64 65 20 77 68 69 + 63 68 20 77 69 6c 6c 20 70 75 73 68 0a + + ~ " ~ the number to the stack." + 20 20 20 20 7e 20 74 68 65 20 6e 75 6d 62 65 72 + 20 74 6f 20 74 68 65 20 73 74 61 63 6b 2e 0a + + ~ " ~" + 20 20 20 20 7e 0a + + ~ " ~ This is an immediate effect, so once we've done it," + ~ " we update the user" + 20 20 20 20 7e 20 20 20 54 68 69 73 20 69 73 20 + 61 6e 20 69 6d 6d 65 64 69 61 74 65 20 65 66 66 + 65 63 74 2c 20 73 6f 20 6f 6e 63 65 20 77 65 27 + 76 65 20 64 6f 6e 65 20 69 74 2c 20 77 65 20 75 + 70 64 61 74 65 20 74 68 65 20 75 73 65 72 0a + + ~ " ~ stack depth. An integer literal is a stack-depth" + ~ " delta of 1." + 20 20 20 20 7e 20 73 74 61 63 6b 20 64 65 70 74 + 68 2e 20 41 6e 20 69 6e 74 65 67 65 72 20 6c 69 + 74 65 72 61 6c 20 69 73 20 61 20 73 74 61 63 6b + 2d 64 65 70 74 68 20 64 65 6c 74 61 20 6f 66 20 + 31 2e 0a + + ~ " swap-transform-variables L@' lit" + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 20 4c 40 27 + 20 6c 69 74 20 73 77 61 70 2d 74 72 61 6e 73 66 + 6f 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " offset-to-target-address-space , ~ : -8 lit #--" + ~ " (codeword pointer)" + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 20 20 20 7e 20 3a 20 2d 38 20 6c 69 + 74 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 + 70 6f 69 6e 74 65 72 29 0a + + ~ " ~ : provide-hex" + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 70 72 6f 76 69 + 64 65 2d 68 65 78 0a + + ~ " , ~ : -8 # #--" + ~ " (integer literal)" + 20 20 20 20 2c 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 7e 20 3a 20 2d 38 20 23 20 + 23 2d 2d 20 28 69 6e 74 65 67 65 72 20 6c 69 74 + 65 72 61 6c 29 0a + + ~ " 1 transform-apply-stack-delta" + 20 20 20 20 31 20 74 72 61 6e 73 66 6f 72 6d 2d + 61 70 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c 74 + 61 0a + + ~ " 0 exit" + 20 20 20 20 30 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " ~ (name as stack string)" + 20 20 7e 20 28 6e 61 6d 65 20 61 73 20 73 74 61 + 63 6b 20 73 74 72 69 6e 67 29 0a + + ~ "" + 0a + + ~ " ~ We know it's a regular word, and we're assuming it" + ~ " will exist at" + 20 20 7e 20 20 20 57 65 20 6b 6e 6f 77 20 69 74 + 27 73 20 61 20 72 65 67 75 6c 61 72 20 77 6f 72 + 64 2c 20 61 6e 64 20 77 65 27 72 65 20 61 73 73 + 75 6d 69 6e 67 20 69 74 20 77 69 6c 6c 20 65 78 + 69 73 74 20 61 74 0a + + ~ " ~ runtime. We of course have no way to check what flags" + ~ " it will have, which" + 20 20 7e 20 72 75 6e 74 69 6d 65 2e 20 57 65 20 + 6f 66 20 63 6f 75 72 73 65 20 68 61 76 65 20 6e + 6f 20 77 61 79 20 74 6f 20 63 68 65 63 6b 20 77 + 68 61 74 20 66 6c 61 67 73 20 69 74 20 77 69 6c + 6c 20 68 61 76 65 2c 20 77 68 69 63 68 0a + + ~ " ~ means immediate words don't work with this transform." + ~ " We still treat it" + 20 20 7e 20 6d 65 61 6e 73 20 69 6d 6d 65 64 69 + 61 74 65 20 77 6f 72 64 73 20 64 6f 6e 27 74 20 + 77 6f 72 6b 20 77 69 74 68 20 74 68 69 73 20 74 + 72 61 6e 73 66 6f 72 6d 2e 20 57 65 20 73 74 69 + 6c 6c 20 74 72 65 61 74 20 69 74 0a + + ~ " ~ differently based on whether we're in compile mode." + 20 20 7e 20 64 69 66 66 65 72 65 6e 74 6c 79 20 + 62 61 73 65 64 20 6f 6e 20 77 68 65 74 68 65 72 + 20 77 65 27 72 65 20 69 6e 20 63 6f 6d 70 69 6c + 65 20 6d 6f 64 65 2e 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " ~ We're in compile mode. We compile code that" + ~ " compiles the word." + 20 20 20 20 7e 20 20 20 57 65 27 72 65 20 69 6e + 20 63 6f 6d 70 69 6c 65 20 6d 6f 64 65 2e 20 57 + 65 20 63 6f 6d 70 69 6c 65 20 63 6f 64 65 20 74 + 68 61 74 20 63 6f 6d 70 69 6c 65 73 20 74 68 65 + 20 77 6f 72 64 2e 0a + + ~ " ~" + 20 20 20 20 7e 0a + + ~ " ~ Since that's not an immediate effect, we don't need" + ~ " to update the" + 20 20 20 20 7e 20 20 20 53 69 6e 63 65 20 74 68 + 61 74 27 73 20 6e 6f 74 20 61 6e 20 69 6d 6d 65 + 64 69 61 74 65 20 65 66 66 65 63 74 2c 20 77 65 + 20 64 6f 6e 27 74 20 6e 65 65 64 20 74 6f 20 75 + 70 64 61 74 65 20 74 68 65 0a + + ~ " ~ user stack depth. Instead, this is a key spot where" + ~ " we rely on that" + 20 20 20 20 7e 20 75 73 65 72 20 73 74 61 63 6b + 20 64 65 70 74 68 2e 20 49 6e 73 74 65 61 64 2c + 20 74 68 69 73 20 69 73 20 61 20 6b 65 79 20 73 + 70 6f 74 20 77 68 65 72 65 20 77 65 20 72 65 6c + 79 20 6f 6e 20 74 68 61 74 0a + + ~ " ~ knowledge, to roll and unroll the log address." + 20 20 20 20 7e 20 6b 6e 6f 77 6c 65 64 67 65 2c + 20 74 6f 20 72 6f 6c 6c 20 61 6e 64 20 75 6e 72 + 6f 6c 6c 20 74 68 65 20 6c 6f 67 20 61 64 64 72 + 65 73 73 2e 0a + + ~ " value@ log-load-compile-dynamic-word" + 20 20 20 20 76 61 6c 75 65 40 20 6c 6f 67 2d 6c + 6f 61 64 2d 63 6f 6d 70 69 6c 65 2d 64 79 6e 61 + 6d 69 63 2d 77 6f 72 64 0a + + ~ " dropstring 0 exit" + 20 20 20 20 64 72 6f 70 73 74 72 69 6e 67 20 30 + 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " ~ (name as stack string)" + 20 20 7e 20 28 6e 61 6d 65 20 61 73 20 73 74 61 + 63 6b 20 73 74 72 69 6e 67 29 0a + + ~ "" + 0a + + ~ " ~ At this point we know we're in immediate mode and" + ~ " have a regular word." + 20 20 7e 20 20 20 41 74 20 74 68 69 73 20 70 6f + 69 6e 74 20 77 65 20 6b 6e 6f 77 20 77 65 27 72 + 65 20 69 6e 20 69 6d 6d 65 64 69 61 74 65 20 6d + 6f 64 65 20 61 6e 64 20 68 61 76 65 20 61 20 72 + 65 67 75 6c 61 72 20 77 6f 72 64 2e 0a + + ~ " ~ While we still have the name pointer handy, we check" + ~ " what delta this word" + 20 20 7e 20 57 68 69 6c 65 20 77 65 20 73 74 69 + 6c 6c 20 68 61 76 65 20 74 68 65 20 6e 61 6d 65 + 20 70 6f 69 6e 74 65 72 20 68 61 6e 64 79 2c 20 + 77 65 20 63 68 65 63 6b 20 77 68 61 74 20 64 65 + 6c 74 61 20 74 68 69 73 20 77 6f 72 64 0a + + ~ " ~ will cause for the user stack depth, when run. See" + 20 20 7e 20 77 69 6c 6c 20 63 61 75 73 65 20 66 + 6f 72 20 74 68 65 20 75 73 65 72 20 73 74 61 63 + 6b 20 64 65 70 74 68 2c 20 77 68 65 6e 20 72 75 + 6e 2e 20 53 65 65 0a + + ~ " ~ transform-get-stack-delta for more explanation of this." + ~ " We keep track of" + 20 20 7e 20 74 72 61 6e 73 66 6f 72 6d 2d 67 65 + 74 2d 73 74 61 63 6b 2d 64 65 6c 74 61 20 66 6f + 72 20 6d 6f 72 65 20 65 78 70 6c 61 6e 61 74 69 + 6f 6e 20 6f 66 20 74 68 69 73 2e 20 57 65 20 6b + 65 65 70 20 74 72 61 63 6b 20 6f 66 0a + + ~ " ~ the proposed delta until we actually process the word," + ~ " down below." + 20 20 7e 20 74 68 65 20 70 72 6f 70 6f 73 65 64 + 20 64 65 6c 74 61 20 75 6e 74 69 6c 20 77 65 20 + 61 63 74 75 61 6c 6c 79 20 70 72 6f 63 65 73 73 + 20 74 68 65 20 77 6f 72 64 2c 20 64 6f 77 6e 20 + 62 65 6c 6f 77 2e 0a + + ~ " value@ dup transform-get-stack-delta swap" + 20 20 76 61 6c 75 65 40 20 64 75 70 20 74 72 61 + 6e 73 66 6f 72 6d 2d 67 65 74 2d 73 74 61 63 6b + 2d 64 65 6c 74 61 20 73 77 61 70 0a + + ~ " ~ (name as stack string, proposed stack depth delta, name" + ~ " pointer)" + 20 20 7e 20 28 6e 61 6d 65 20 61 73 20 73 74 61 + 63 6b 20 73 74 72 69 6e 67 2c 20 70 72 6f 70 6f + 73 65 64 20 73 74 61 63 6b 20 64 65 70 74 68 20 + 64 65 6c 74 61 2c 20 6e 61 6d 65 20 70 6f 69 6e + 74 65 72 29 0a + + ~ "" + 0a + + ~ " ~ We're in immediate mode. We compile code that runs" + ~ " the word immediately." + 20 20 7e 20 20 20 57 65 27 72 65 20 69 6e 20 69 + 6d 6d 65 64 69 61 74 65 20 6d 6f 64 65 2e 20 57 + 65 20 63 6f 6d 70 69 6c 65 20 63 6f 64 65 20 74 + 68 61 74 20 72 75 6e 73 20 74 68 65 20 77 6f 72 + 64 20 69 6d 6d 65 64 69 61 74 65 6c 79 2e 0a + + ~ " ~ We check whether there's a label for the word; if there" + ~ " is, we'll output" + 20 20 7e 20 57 65 20 63 68 65 63 6b 20 77 68 65 + 74 68 65 72 20 74 68 65 72 65 27 73 20 61 20 6c + 61 62 65 6c 20 66 6f 72 20 74 68 65 20 77 6f 72 + 64 3b 20 69 66 20 74 68 65 72 65 20 69 73 2c 20 + 77 65 27 6c 6c 20 6f 75 74 70 75 74 0a + + ~ " ~ that. Otherwise we'll output code that looks it up in" + ~ " the log and runs it." + 20 20 7e 20 74 68 61 74 2e 20 4f 74 68 65 72 77 + 69 73 65 20 77 65 27 6c 6c 20 6f 75 74 70 75 74 + 20 63 6f 64 65 20 74 68 61 74 20 6c 6f 6f 6b 73 + 20 69 74 20 75 70 20 69 6e 20 74 68 65 20 6c 6f + 67 20 61 6e 64 20 72 75 6e 73 20 69 74 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ Just like in label-transform, we use find-label to" + ~ " check whether a label" + 20 20 7e 20 20 20 4a 75 73 74 20 6c 69 6b 65 20 + 69 6e 20 6c 61 62 65 6c 2d 74 72 61 6e 73 66 6f + 72 6d 2c 20 77 65 20 75 73 65 20 66 69 6e 64 2d + 6c 61 62 65 6c 20 74 6f 20 63 68 65 63 6b 20 77 + 68 65 74 68 65 72 20 61 20 6c 61 62 65 6c 0a + + ~ " ~ exists without declaring a dependency on it, then if it" + ~ " does, we do" + 20 20 7e 20 65 78 69 73 74 73 20 77 69 74 68 6f + 75 74 20 64 65 63 6c 61 72 69 6e 67 20 61 20 64 + 65 70 65 6e 64 65 6e 63 79 20 6f 6e 20 69 74 2c + 20 74 68 65 6e 20 69 66 20 69 74 20 64 6f 65 73 + 2c 20 77 65 20 64 6f 0a + + ~ " ~ use-label to ask for its value." + 20 20 7e 20 75 73 65 2d 6c 61 62 65 6c 20 74 6f + 20 61 73 6b 20 66 6f 72 20 69 74 73 20 76 61 6c + 75 65 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ There's one additional wrinkle to remember here:" + ~ " We're running inside" + 20 20 7e 20 20 20 54 68 65 72 65 27 73 20 6f 6e + 65 20 61 64 64 69 74 69 6f 6e 61 6c 20 77 72 69 + 6e 6b 6c 65 20 74 6f 20 72 65 6d 65 6d 62 65 72 + 20 68 65 72 65 3a 20 57 65 27 72 65 20 72 75 6e + 6e 69 6e 67 20 69 6e 73 69 64 65 0a + + ~ " ~ the label loop, and warm-start appears before all the" + ~ " normal words in the" + 20 20 7e 20 74 68 65 20 6c 61 62 65 6c 20 6c 6f + 6f 70 2c 20 61 6e 64 20 77 61 72 6d 2d 73 74 61 + 72 74 20 61 70 70 65 61 72 73 20 62 65 66 6f 72 + 65 20 61 6c 6c 20 74 68 65 20 6e 6f 72 6d 61 6c + 20 77 6f 72 64 73 20 69 6e 20 74 68 65 0a + + ~ " ~ executable. So all the labels we'll be checking are" + ~ " forwared references," + 20 20 7e 20 65 78 65 63 75 74 61 62 6c 65 2e 20 + 53 6f 20 61 6c 6c 20 74 68 65 20 6c 61 62 65 6c + 73 20 77 65 27 6c 6c 20 62 65 20 63 68 65 63 6b + 69 6e 67 20 61 72 65 20 66 6f 72 77 61 72 65 64 + 20 72 65 66 65 72 65 6e 63 65 73 2c 0a + + ~ " ~ and on the very first pass they definitely won't be" + ~ " defined. That's fine" + 20 20 7e 20 61 6e 64 20 6f 6e 20 74 68 65 20 76 + 65 72 79 20 66 69 72 73 74 20 70 61 73 73 20 74 + 68 65 79 20 64 65 66 69 6e 69 74 65 6c 79 20 77 + 6f 6e 27 74 20 62 65 20 64 65 66 69 6e 65 64 2e + 20 54 68 61 74 27 73 20 66 69 6e 65 0a + + ~ " ~ though, they will exist on all subsequent passes, so" + ~ " things will" + 20 20 7e 20 74 68 6f 75 67 68 2c 20 74 68 65 79 + 20 77 69 6c 6c 20 65 78 69 73 74 20 6f 6e 20 61 + 6c 6c 20 73 75 62 73 65 71 75 65 6e 74 20 70 61 + 73 73 65 73 2c 20 73 6f 20 74 68 69 6e 67 73 20 + 77 69 6c 6c 0a + + ~ " ~ definitely still converge." + 20 20 7e 20 64 65 66 69 6e 69 74 65 6c 79 20 73 + 74 69 6c 6c 20 63 6f 6e 76 65 72 67 65 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ The first pass will never accidentally think it" + ~ " succeeded, because even" + 20 20 7e 20 20 20 54 68 65 20 66 69 72 73 74 20 + 70 61 73 73 20 77 69 6c 6c 20 6e 65 76 65 72 20 + 61 63 63 69 64 65 6e 74 61 6c 6c 79 20 74 68 69 + 6e 6b 20 69 74 20 73 75 63 63 65 65 64 65 64 2c + 20 62 65 63 61 75 73 65 20 65 76 65 6e 0a + + ~ " ~ the reference to L' cold-start from the ELF header is a" + ~ " forward reference" + 20 20 7e 20 74 68 65 20 72 65 66 65 72 65 6e 63 + 65 20 74 6f 20 4c 27 20 63 6f 6c 64 2d 73 74 61 + 72 74 20 66 72 6f 6d 20 74 68 65 20 45 4c 46 20 + 68 65 61 64 65 72 20 69 73 20 61 20 66 6f 72 77 + 61 72 64 20 72 65 66 65 72 65 6e 63 65 0a + + ~ " ~ and won't exist on the first pass." + 20 20 7e 20 61 6e 64 20 77 6f 6e 27 74 20 65 78 + 69 73 74 20 6f 6e 20 74 68 65 20 66 69 72 73 74 + 20 70 61 73 73 2e 0a + + ~ " dup" + 20 20 64 75 70 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " find-label" + 20 20 66 69 6e 64 2d 6c 61 62 65 6c 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " {" + 20 20 7b 0a + + ~ " ~ Again just like in label-transform, we declare our" + ~ " use of the label" + 20 20 20 20 7e 20 20 20 41 67 61 69 6e 20 6a 75 + 73 74 20 6c 69 6b 65 20 69 6e 20 6c 61 62 65 6c + 2d 74 72 61 6e 73 66 6f 72 6d 2c 20 77 65 20 64 + 65 63 6c 61 72 65 20 6f 75 72 20 75 73 65 20 6f + 66 20 74 68 65 20 6c 61 62 65 6c 0a + + ~ " ~ and get a value for it." + 20 20 20 20 7e 20 61 6e 64 20 67 65 74 20 61 20 + 76 61 6c 75 65 20 66 6f 72 20 69 74 2e 0a + + ~ " ~ : provide-string-copy" + 20 20 20 20 7e 20 3a 20 70 72 6f 76 69 64 65 2d + 73 74 72 69 6e 67 2d 63 6f 70 79 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " intern-label use-label" + 20 20 20 20 69 6e 74 65 72 6e 2d 6c 61 62 65 6c + 20 75 73 65 2d 6c 61 62 65 6c 0a + + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " ~ (name as stack string, proposed stack depth delta," + ~ " label value)" + 20 20 20 20 7e 20 28 6e 61 6d 65 20 61 73 20 73 + 74 61 63 6b 20 73 74 72 69 6e 67 2c 20 70 72 6f + 70 6f 73 65 64 20 73 74 61 63 6b 20 64 65 70 74 + 68 20 64 65 6c 74 61 2c 20 6c 61 62 65 6c 20 76 + 61 6c 75 65 29 0a + + ~ "" + 0a + + ~ " ~ Like in label-transform, this is a codeword" + ~ " pointer, so we just output" + 20 20 20 20 7e 20 20 20 4c 69 6b 65 20 69 6e 20 + 6c 61 62 65 6c 2d 74 72 61 6e 73 66 6f 72 6d 2c + 20 74 68 69 73 20 69 73 20 61 20 63 6f 64 65 77 + 6f 72 64 20 70 6f 69 6e 74 65 72 2c 20 73 6f 20 + 77 65 20 6a 75 73 74 20 6f 75 74 70 75 74 0a + + ~ " ~ it directly. Also as before, because we don't have to" + ~ " examine it, we" + 20 20 20 20 7e 20 69 74 20 64 69 72 65 63 74 6c + 79 2e 20 41 6c 73 6f 20 61 73 20 62 65 66 6f 72 + 65 2c 20 62 65 63 61 75 73 65 20 77 65 20 64 6f + 6e 27 74 20 68 61 76 65 20 74 6f 20 65 78 61 6d + 69 6e 65 20 69 74 2c 20 77 65 0a + + ~ " ~ don't have to do anything special in the case where" + ~ " it's zero due to the" + 20 20 20 20 7e 20 64 6f 6e 27 74 20 68 61 76 65 + 20 74 6f 20 64 6f 20 61 6e 79 74 68 69 6e 67 20 + 73 70 65 63 69 61 6c 20 69 6e 20 74 68 65 20 63 + 61 73 65 20 77 68 65 72 65 20 69 74 27 73 20 7a + 65 72 6f 20 64 75 65 20 74 6f 20 74 68 65 0a + + ~ " ~ way the label loop works." + 20 20 20 20 7e 20 77 61 79 20 74 68 65 20 6c 61 + 62 65 6c 20 6c 6f 6f 70 20 77 6f 72 6b 73 2e 0a + + ~ " ~" + 20 20 20 20 7e 0a + + ~ " ~ This is an immediate effect, so once we've done" + ~ " that, we update the" + 20 20 20 20 7e 20 20 20 54 68 69 73 20 69 73 20 + 61 6e 20 69 6d 6d 65 64 69 61 74 65 20 65 66 66 + 65 63 74 2c 20 73 6f 20 6f 6e 63 65 20 77 65 27 + 76 65 20 64 6f 6e 65 20 74 68 61 74 2c 20 77 65 + 20 75 70 64 61 74 65 20 74 68 65 0a + + ~ " ~ user stack depth." + 20 20 20 20 7e 20 75 73 65 72 20 73 74 61 63 6b + 20 64 65 70 74 68 2e 0a + + ~ " offset-to-target-address-space ," + 20 20 20 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 2c 0a + + ~ " ~ : -8 # #-- (codeword pointer)" + 20 20 20 20 7e 20 3a 20 2d 38 20 23 20 23 2d 2d + 20 28 63 6f 64 65 77 6f 72 64 20 70 6f 69 6e 74 + 65 72 29 0a + + ~ " transform-apply-stack-delta" + 20 20 20 20 74 72 61 6e 73 66 6f 72 6d 2d 61 70 + 70 6c 79 2d 73 74 61 63 6b 2d 64 65 6c 74 61 0a + + ~ " dropstring 0 exit" + 20 20 20 20 64 72 6f 70 73 74 72 69 6e 67 20 30 + 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " ~ (name as stack string, proposed stack depth delta, name" + ~ " pointer)" + 20 20 7e 20 28 6e 61 6d 65 20 61 73 20 73 74 61 + 63 6b 20 73 74 72 69 6e 67 2c 20 70 72 6f 70 6f + 73 65 64 20 73 74 61 63 6b 20 64 65 70 74 68 20 + 64 65 6c 74 61 2c 20 6e 61 6d 65 20 70 6f 69 6e + 74 65 72 29 0a + + ~ "" + 0a + + ~ " ~ There's no label for the word; that means it wasn't" + ~ " statically" + 20 20 7e 20 20 20 54 68 65 72 65 27 73 20 6e 6f + 20 6c 61 62 65 6c 20 66 6f 72 20 74 68 65 20 77 + 6f 72 64 3b 20 74 68 61 74 20 6d 65 61 6e 73 20 + 69 74 20 77 61 73 6e 27 74 20 73 74 61 74 69 63 + 61 6c 6c 79 0a + + ~ " ~ compiled-in to the target executable. So we output code" + ~ " that looks up the" + 20 20 7e 20 63 6f 6d 70 69 6c 65 64 2d 69 6e 20 + 74 6f 20 74 68 65 20 74 61 72 67 65 74 20 65 78 + 65 63 75 74 61 62 6c 65 2e 20 53 6f 20 77 65 20 + 6f 75 74 70 75 74 20 63 6f 64 65 20 74 68 61 74 + 20 6c 6f 6f 6b 73 20 75 70 20 74 68 65 0a + + ~ " ~ word by name on the log, then calls it." + 20 20 7e 20 77 6f 72 64 20 62 79 20 6e 61 6d 65 + 20 6f 6e 20 74 68 65 20 6c 6f 67 2c 20 74 68 65 + 6e 20 63 61 6c 6c 73 20 69 74 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ This is also an immediate effect, despite being" + ~ " distinct from the above" + 20 20 7e 20 20 20 54 68 69 73 20 69 73 20 61 6c + 73 6f 20 61 6e 20 69 6d 6d 65 64 69 61 74 65 20 + 65 66 66 65 63 74 2c 20 64 65 73 70 69 74 65 20 + 62 65 69 6e 67 20 64 69 73 74 69 6e 63 74 20 66 + 72 6f 6d 20 74 68 65 20 61 62 6f 76 65 0a + + ~ " ~ case, so once we've done that, we update the user stack" + ~ " depth." + 20 20 7e 20 63 61 73 65 2c 20 73 6f 20 6f 6e 63 + 65 20 77 65 27 76 65 20 64 6f 6e 65 20 74 68 61 + 74 2c 20 77 65 20 75 70 64 61 74 65 20 74 68 65 + 20 75 73 65 72 20 73 74 61 63 6b 20 64 65 70 74 + 68 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ There's no such thing as not finding the word, with" + ~ " this transform. So" + 20 20 7e 20 20 20 54 68 65 72 65 27 73 20 6e 6f + 20 73 75 63 68 20 74 68 69 6e 67 20 61 73 20 6e + 6f 74 20 66 69 6e 64 69 6e 67 20 74 68 65 20 77 + 6f 72 64 2c 20 77 69 74 68 20 74 68 69 73 20 74 + 72 61 6e 73 66 6f 72 6d 2e 20 53 6f 0a + + ~ " ~ once we're done, we just exit." + 20 20 7e 20 6f 6e 63 65 20 77 65 27 72 65 20 64 + 6f 6e 65 2c 20 77 65 20 6a 75 73 74 20 65 78 69 + 74 2e 0a + + ~ " log-load-execute-dynamic-word" + 20 20 6c 6f 67 2d 6c 6f 61 64 2d 65 78 65 63 75 + 74 65 2d 64 79 6e 61 6d 69 63 2d 77 6f 72 64 0a + + ~ " transform-apply-stack-delta" + 20 20 74 72 61 6e 73 66 6f 72 6d 2d 61 70 70 6c + 79 2d 73 74 61 63 6b 2d 64 65 6c 74 61 0a + + ~ " dropstring 0 ;" + 20 20 64 72 6f 70 73 74 72 69 6e 67 20 30 20 3b + 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This implements the log-load transform for all words in" + ~ " a region given as" + 7e 20 20 20 54 68 69 73 20 69 6d 70 6c 65 6d 65 + 6e 74 73 20 74 68 65 20 6c 6f 67 2d 6c 6f 61 64 + 20 74 72 61 6e 73 66 6f 72 6d 20 66 6f 72 20 61 + 6c 6c 20 77 6f 72 64 73 20 69 6e 20 61 20 72 65 + 67 69 6f 6e 20 67 69 76 65 6e 20 61 73 0a + + ~ "~ an input string. It is directly analogous to "quit", in" + 7e 20 61 6e 20 69 6e 70 75 74 20 73 74 72 69 6e + 67 2e 20 49 74 20 69 73 20 64 69 72 65 63 74 6c + 79 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 22 + 71 75 69 74 22 2c 20 69 6e 0a + + ~ "~ language/dynamic/interpret.e, but is far more complex." + 7e 20 6c 61 6e 67 75 61 67 65 2f 64 79 6e 61 6d + 69 63 2f 69 6e 74 65 72 70 72 65 74 2e 65 2c 20 + 62 75 74 20 69 73 20 66 61 72 20 6d 6f 72 65 20 + 63 6f 6d 70 6c 65 78 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (output buffer start, output point, input string pointer" + 7e 20 28 6f 75 74 70 75 74 20 62 75 66 66 65 72 + 20 73 74 61 72 74 2c 20 6f 75 74 70 75 74 20 70 + 6f 69 6e 74 2c 20 69 6e 70 75 74 20 73 74 72 69 + 6e 67 20 70 6f 69 6e 74 65 72 0a + + ~ "~ -- output buffer start, output point)" + 7e 20 20 2d 2d 20 6f 75 74 70 75 74 20 62 75 66 + 66 65 72 20 73 74 61 72 74 2c 20 6f 75 74 70 75 + 74 20 70 6f 69 6e 74 29 0a + + ~ ": log-load-transform" + 3a 20 6c 6f 67 2d 6c 6f 61 64 2d 74 72 61 6e 73 + 66 6f 72 6d 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : This is the start of the log-load routine, which is" + ~ " a long block of" + 20 20 7e 20 3a 20 20 20 54 68 69 73 20 69 73 20 + 74 68 65 20 73 74 61 72 74 20 6f 66 20 74 68 65 + 20 6c 6f 67 2d 6c 6f 61 64 20 72 6f 75 74 69 6e + 65 2c 20 77 68 69 63 68 20 69 73 20 61 20 6c 6f + 6e 67 20 62 6c 6f 63 6b 20 6f 66 0a + + ~ " ~ : code that has been processed by the log-load" + ~ " transform. It is part of" + 20 20 7e 20 3a 20 63 6f 64 65 20 74 68 61 74 20 + 68 61 73 20 62 65 65 6e 20 70 72 6f 63 65 73 73 + 65 64 20 62 79 20 74 68 65 20 6c 6f 67 2d 6c 6f + 61 64 20 74 72 61 6e 73 66 6f 72 6d 2e 20 49 74 + 20 69 73 20 70 61 72 74 20 6f 66 0a + + ~ " ~ : the warm-start routine, which does other things" + ~ " before and after it." + 20 20 7e 20 3a 20 74 68 65 20 77 61 72 6d 2d 73 + 74 61 72 74 20 72 6f 75 74 69 6e 65 2c 20 77 68 + 69 63 68 20 64 6f 65 73 20 6f 74 68 65 72 20 74 + 68 69 6e 67 73 20 62 65 66 6f 72 65 20 61 6e 64 + 20 61 66 74 65 72 20 69 74 2e 0a + + ~ " ~ : For clarity's sake, to avoid weird nesting, the" + ~ " section header above" + 20 20 7e 20 3a 20 46 6f 72 20 63 6c 61 72 69 74 + 79 27 73 20 73 61 6b 65 2c 20 74 6f 20 61 76 6f + 69 64 20 77 65 69 72 64 20 6e 65 73 74 69 6e 67 + 2c 20 74 68 65 20 73 65 63 74 69 6f 6e 20 68 65 + 61 64 65 72 20 61 62 6f 76 65 0a + + ~ " ~ : calls this the warm-start section of the executable," + ~ " but in a sense it" + 20 20 7e 20 3a 20 63 61 6c 6c 73 20 74 68 69 73 + 20 74 68 65 20 77 61 72 6d 2d 73 74 61 72 74 20 + 73 65 63 74 69 6f 6e 20 6f 66 20 74 68 65 20 65 + 78 65 63 75 74 61 62 6c 65 2c 20 62 75 74 20 69 + 6e 20 61 20 73 65 6e 73 65 20 69 74 0a + + ~ " ~ : might be more accurate to call it the log-load" + ~ " section." + 20 20 7e 20 3a 20 6d 69 67 68 74 20 62 65 20 6d + 6f 72 65 20 61 63 63 75 72 61 74 65 20 74 6f 20 + 63 61 6c 6c 20 69 74 20 74 68 65 20 6c 6f 67 2d + 6c 6f 61 64 20 73 65 63 74 69 6f 6e 2e 0a + + ~ " ~ :" + 20 20 7e 20 3a 0a + + ~ " ~ : The routine is interpreted Forth code, just as the" + ~ " warm-start routine" + 20 20 7e 20 3a 20 20 20 54 68 65 20 72 6f 75 74 + 69 6e 65 20 69 73 20 69 6e 74 65 72 70 72 65 74 + 65 64 20 46 6f 72 74 68 20 63 6f 64 65 2c 20 6a + 75 73 74 20 61 73 20 74 68 65 20 77 61 72 6d 2d + 73 74 61 72 74 20 72 6f 75 74 69 6e 65 0a + + ~ " ~ : as a whole is; see above." + 20 20 7e 20 3a 20 61 73 20 61 20 77 68 6f 6c 65 + 20 69 73 3b 20 73 65 65 20 61 62 6f 76 65 2e 0a + + ~ " ~ :" + 20 20 7e 20 3a 0a + + ~ " ~ : The job of the log-load routine is to create" + ~ " runnable code in the" + 20 20 7e 20 3a 20 20 20 54 68 65 20 6a 6f 62 20 + 6f 66 20 74 68 65 20 6c 6f 67 2d 6c 6f 61 64 20 + 72 6f 75 74 69 6e 65 20 69 73 20 74 6f 20 63 72 + 65 61 74 65 20 72 75 6e 6e 61 62 6c 65 20 63 6f + 64 65 20 69 6e 20 74 68 65 0a + + ~ " ~ : dynamic log, at runtime. The normal way to create a" + ~ " Forth executable" + 20 20 7e 20 3a 20 64 79 6e 61 6d 69 63 20 6c 6f + 67 2c 20 61 74 20 72 75 6e 74 69 6d 65 2e 20 54 + 68 65 20 6e 6f 72 6d 61 6c 20 77 61 79 20 74 6f + 20 63 72 65 61 74 65 20 61 20 46 6f 72 74 68 20 + 65 78 65 63 75 74 61 62 6c 65 0a + + ~ " ~ : is to use label-transformed code to implement a" + ~ " minimal set of" + 20 20 7e 20 3a 20 69 73 20 74 6f 20 75 73 65 20 + 6c 61 62 65 6c 2d 74 72 61 6e 73 66 6f 72 6d 65 + 64 20 63 6f 64 65 20 74 6f 20 69 6d 70 6c 65 6d + 65 6e 74 20 61 20 6d 69 6e 69 6d 61 6c 20 73 65 + 74 20 6f 66 0a + + ~ " ~ : functionality needed for the log-load routine to run," + ~ " then invoke the" + 20 20 7e 20 3a 20 66 75 6e 63 74 69 6f 6e 61 6c + 69 74 79 20 6e 65 65 64 65 64 20 66 6f 72 20 74 + 68 65 20 6c 6f 67 2d 6c 6f 61 64 20 72 6f 75 74 + 69 6e 65 20 74 6f 20 72 75 6e 2c 20 74 68 65 6e + 20 69 6e 76 6f 6b 65 20 74 68 65 0a + + ~ " ~ : log-load routine to copy a more complete set of" + ~ " functionality into" + 20 20 7e 20 3a 20 6c 6f 67 2d 6c 6f 61 64 20 72 + 6f 75 74 69 6e 65 20 74 6f 20 63 6f 70 79 20 61 + 20 6d 6f 72 65 20 63 6f 6d 70 6c 65 74 65 20 73 + 65 74 20 6f 66 20 66 75 6e 63 74 69 6f 6e 61 6c + 69 74 79 20 69 6e 74 6f 0a + + ~ " ~ : memory." + 20 20 7e 20 3a 20 6d 65 6d 6f 72 79 2e 0a + + ~ " ~ :" + 20 20 7e 20 3a 0a + + ~ " ~ : The log-load routine is super important, but also" + ~ " extremely verbose," + 20 20 7e 20 3a 20 20 20 54 68 65 20 6c 6f 67 2d + 6c 6f 61 64 20 72 6f 75 74 69 6e 65 20 69 73 20 + 73 75 70 65 72 20 69 6d 70 6f 72 74 61 6e 74 2c + 20 62 75 74 20 61 6c 73 6f 20 65 78 74 72 65 6d + 65 6c 79 20 76 65 72 62 6f 73 65 2c 0a + + ~ " ~ : which necessarily makes it hard to read. If you're" + ~ " skimming this file" + 20 20 7e 20 3a 20 77 68 69 63 68 20 6e 65 63 65 + 73 73 61 72 69 6c 79 20 6d 61 6b 65 73 20 69 74 + 20 68 61 72 64 20 74 6f 20 72 65 61 64 2e 20 49 + 66 20 79 6f 75 27 72 65 20 73 6b 69 6d 6d 69 6e + 67 20 74 68 69 73 20 66 69 6c 65 0a + + ~ " ~ : for the first time to get a sense of what it" + ~ " contains, you might want" + 20 20 7e 20 3a 20 66 6f 72 20 74 68 65 20 66 69 + 72 73 74 20 74 69 6d 65 20 74 6f 20 67 65 74 20 + 61 20 73 65 6e 73 65 20 6f 66 20 77 68 61 74 20 + 69 74 20 63 6f 6e 74 61 69 6e 73 2c 20 79 6f 75 + 20 6d 69 67 68 74 20 77 61 6e 74 0a + + ~ " ~ : to search for the words "label transform" to get to" + ~ " the stuff that makes" + 20 20 7e 20 3a 20 74 6f 20 73 65 61 72 63 68 20 + 66 6f 72 20 74 68 65 20 77 6f 72 64 73 20 22 6c + 61 62 65 6c 20 74 72 61 6e 73 66 6f 72 6d 22 20 + 74 6f 20 67 65 74 20 74 6f 20 74 68 65 20 73 74 + 75 66 66 20 74 68 61 74 20 6d 61 6b 65 73 0a + + ~ " ~ : better introductory reading." + 20 20 7e 20 3a 20 62 65 74 74 65 72 20 69 6e 74 + 72 6f 64 75 63 74 6f 72 79 20 72 65 61 64 69 6e + 67 2e 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ "" + 0a + + ~ " main-input-buffer dup push-input-buffer" + 20 20 6d 61 69 6e 2d 69 6e 70 75 74 2d 62 75 66 + 66 65 72 20 64 75 70 20 70 75 73 68 2d 69 6e 70 + 75 74 2d 62 75 66 66 65 72 0a + + ~ " swap attach-string-to-input-buffer" + 20 20 73 77 61 70 20 61 74 74 61 63 68 2d 73 74 + 72 69 6e 67 2d 74 6f 2d 69 6e 70 75 74 2d 62 75 + 66 66 65 72 0a + + ~ "" + 0a + + ~ " ~ Save the old values of "here" and "latest", and set" + ~ " the initial values" + 20 20 7e 20 20 20 53 61 76 65 20 74 68 65 20 6f + 6c 64 20 76 61 6c 75 65 73 20 6f 66 20 22 68 65 + 72 65 22 20 61 6e 64 20 22 6c 61 74 65 73 74 22 + 2c 20 61 6e 64 20 73 65 74 20 74 68 65 20 69 6e + 69 74 69 61 6c 20 76 61 6c 75 65 73 0a + + ~ " ~ of the internal ones. These values need to persist" + ~ " across iterations," + 20 20 7e 20 6f 66 20 74 68 65 20 69 6e 74 65 72 + 6e 61 6c 20 6f 6e 65 73 2e 20 54 68 65 73 65 20 + 76 61 6c 75 65 73 20 6e 65 65 64 20 74 6f 20 70 + 65 72 73 69 73 74 20 61 63 72 6f 73 73 20 69 74 + 65 72 61 74 69 6f 6e 73 2c 0a + + ~ " ~ since client code will make its own updates to them and" + ~ " then rely on those" + 20 20 7e 20 73 69 6e 63 65 20 63 6c 69 65 6e 74 + 20 63 6f 64 65 20 77 69 6c 6c 20 6d 61 6b 65 20 + 69 74 73 20 6f 77 6e 20 75 70 64 61 74 65 73 20 + 74 6f 20 74 68 65 6d 20 61 6e 64 20 74 68 65 6e + 20 72 65 6c 79 20 6f 6e 20 74 68 6f 73 65 0a + + ~ " ~ updates having taken effect. So we do the swap just" + ~ " once, here outside the" + 20 20 7e 20 75 70 64 61 74 65 73 20 68 61 76 69 + 6e 67 20 74 61 6b 65 6e 20 65 66 66 65 63 74 2e + 20 53 6f 20 77 65 20 64 6f 20 74 68 65 20 73 77 + 61 70 20 6a 75 73 74 20 6f 6e 63 65 2c 20 68 65 + 72 65 20 6f 75 74 73 69 64 65 20 74 68 65 0a + + ~ " ~ loop, and set it back when the loop ends." + 20 20 7e 20 6c 6f 6f 70 2c 20 61 6e 64 20 73 65 + 74 20 69 74 20 62 61 63 6b 20 77 68 65 6e 20 74 + 68 65 20 6c 6f 6f 70 20 65 6e 64 73 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ We also take this opportunity to initialize the" + ~ " output-buffer-start and" + 20 20 7e 20 20 20 57 65 20 61 6c 73 6f 20 74 61 + 6b 65 20 74 68 69 73 20 6f 70 70 6f 72 74 75 6e + 69 74 79 20 74 6f 20 69 6e 69 74 69 61 6c 69 7a + 65 20 74 68 65 20 6f 75 74 70 75 74 2d 62 75 66 + 66 65 72 2d 73 74 61 72 74 20 61 6e 64 0a + + ~ " ~ user-stack-depth fields of transformation-state." + 20 20 7e 20 75 73 65 72 2d 73 74 61 63 6b 2d 64 + 65 70 74 68 20 66 69 65 6c 64 73 20 6f 66 20 74 + 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 + 61 74 65 2e 0a + + ~ " here @ transformation-state" + ~ " transformation-state-saved-here !" + 20 20 68 65 72 65 20 40 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 + 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 + 74 65 2d 73 61 76 65 64 2d 68 65 72 65 20 21 0a + + ~ " latest @ transformation-state" + ~ " transformation-state-saved-latest !" + 20 20 6c 61 74 65 73 74 20 40 20 74 72 61 6e 73 + 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 + 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 + 74 61 74 65 2d 73 61 76 65 64 2d 6c 61 74 65 73 + 74 20 21 0a + + ~ " swap transformation-state" + ~ " transformation-state-output-buffer-start !" + 20 20 73 77 61 70 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e + 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 + 2d 6f 75 74 70 75 74 2d 62 75 66 66 65 72 2d 73 + 74 61 72 74 20 21 0a + + ~ " 0 transformation-state" + ~ " transformation-state-user-stack-depth !" + 20 20 30 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 + 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d 75 73 + 65 72 2d 73 74 61 63 6b 2d 64 65 70 74 68 20 21 + 0a + + ~ " here !" + 20 20 68 65 72 65 20 21 0a + + ~ " 0 latest !" + 20 20 30 20 6c 61 74 65 73 74 20 21 0a + + ~ " ~ Now the stack has nothing of ours on it, so client code" + ~ " can do its thing." + 20 20 7e 20 4e 6f 77 20 74 68 65 20 73 74 61 63 + 6b 20 68 61 73 20 6e 6f 74 68 69 6e 67 20 6f 66 + 20 6f 75 72 73 20 6f 6e 20 69 74 2c 20 73 6f 20 + 63 6c 69 65 6e 74 20 63 6f 64 65 20 63 61 6e 20 + 64 6f 20 69 74 73 20 74 68 69 6e 67 2e 0a + + ~ "" + 0a + + ~ " ~ It's important that the stack has nothing of ours on" + ~ " it that persists" + 20 20 7e 20 20 20 49 74 27 73 20 69 6d 70 6f 72 + 74 61 6e 74 20 74 68 61 74 20 74 68 65 20 73 74 + 61 63 6b 20 68 61 73 20 6e 6f 74 68 69 6e 67 20 + 6f 66 20 6f 75 72 73 20 6f 6e 20 69 74 20 74 68 + 61 74 20 70 65 72 73 69 73 74 73 0a + + ~ " ~ across iterations, so that client code can add and" + ~ " remove stuff there as" + 20 20 7e 20 61 63 72 6f 73 73 20 69 74 65 72 61 + 74 69 6f 6e 73 2c 20 73 6f 20 74 68 61 74 20 63 + 6c 69 65 6e 74 20 63 6f 64 65 20 63 61 6e 20 61 + 64 64 20 61 6e 64 20 72 65 6d 6f 76 65 20 73 74 + 75 66 66 20 74 68 65 72 65 20 61 73 0a + + ~ " ~ it sees fit." + 20 20 7e 20 69 74 20 73 65 65 73 20 66 69 74 2e + 0a + + ~ " { log-load-transform-one" + 20 20 7b 20 6c 6f 67 2d 6c 6f 61 64 2d 74 72 61 + 6e 73 66 6f 72 6d 2d 6f 6e 65 0a + + ~ " ~ (..., done)" + 20 20 20 20 7e 20 28 2e 2e 2e 2c 20 64 6f 6e 65 + 29 0a + + ~ "" + 0a + + ~ " ~ When the loop is done, get the real values of "here"" + ~ " and "latest"" + 20 20 20 20 7e 20 20 57 68 65 6e 20 74 68 65 20 + 6c 6f 6f 70 20 69 73 20 64 6f 6e 65 2c 20 67 65 + 74 20 74 68 65 20 72 65 61 6c 20 76 61 6c 75 65 + 73 20 6f 66 20 22 68 65 72 65 22 20 61 6e 64 20 + 22 6c 61 74 65 73 74 22 0a + + ~ " ~ back. The internal "here" is also the output point," + ~ " and will become our" + 20 20 20 20 7e 20 62 61 63 6b 2e 20 54 68 65 20 + 69 6e 74 65 72 6e 61 6c 20 22 68 65 72 65 22 20 + 69 73 20 61 6c 73 6f 20 74 68 65 20 6f 75 74 70 + 75 74 20 70 6f 69 6e 74 2c 20 61 6e 64 20 77 69 + 6c 6c 20 62 65 63 6f 6d 65 20 6f 75 72 0a + + ~ " ~ return value. The internal "latest" is discarded." + 20 20 20 20 7e 20 72 65 74 75 72 6e 20 76 61 6c + 75 65 2e 20 54 68 65 20 69 6e 74 65 72 6e 61 6c + 20 22 6c 61 74 65 73 74 22 20 69 73 20 64 69 73 + 63 61 72 64 65 64 2e 0a + + ~ " { transformation-state" + ~ " transformation-state-output-buffer-start @" + 20 20 20 20 7b 20 74 72 61 6e 73 66 6f 72 6d 61 + 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 + 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d + 6f 75 74 70 75 74 2d 62 75 66 66 65 72 2d 73 74 + 61 72 74 20 40 0a + + ~ " here @" + 20 20 20 20 20 20 68 65 72 65 20 40 0a + + ~ " transformation-state transformation-state-saved-here" + ~ " @ here !" + 20 20 20 20 20 20 74 72 61 6e 73 66 6f 72 6d 61 + 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 + 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d + 73 61 76 65 64 2d 68 65 72 65 20 40 20 68 65 72 + 65 20 21 0a + + ~ " transformation-state" + ~ " transformation-state-saved-latest @ latest !" + 20 20 20 20 20 20 74 72 61 6e 73 66 6f 72 6d 61 + 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 + 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d + 73 61 76 65 64 2d 6c 61 74 65 73 74 20 40 20 6c + 61 74 65 73 74 20 21 0a + + ~ " ~ (output buffer start, output point)" + 20 20 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 + 62 75 66 66 65 72 20 73 74 61 72 74 2c 20 6f 75 + 74 70 75 74 20 70 6f 69 6e 74 29 0a + + ~ "" + 0a + + ~ " ~ Though we don't actually use transformation-state" + ~ " outside of this" + 20 20 20 20 20 20 7e 20 20 20 54 68 6f 75 67 68 + 20 77 65 20 64 6f 6e 27 74 20 61 63 74 75 61 6c + 6c 79 20 75 73 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 20 6f 75 74 73 + 69 64 65 20 6f 66 20 74 68 69 73 0a + + ~ " ~ invocation, for tidiness we zero it out." + 20 20 20 20 20 20 7e 20 69 6e 76 6f 63 61 74 69 + 6f 6e 2c 20 66 6f 72 20 74 69 64 69 6e 65 73 73 + 20 77 65 20 7a 65 72 6f 20 69 74 20 6f 75 74 2e + 0a + + ~ " 0 transformation-state" + ~ " transformation-state-saved-here !" + 20 20 20 20 20 20 30 20 74 72 61 6e 73 66 6f 72 + 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 + 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 + 65 2d 73 61 76 65 64 2d 68 65 72 65 20 21 0a + + ~ " 0 transformation-state" + ~ " transformation-state-saved-latest !" + 20 20 20 20 20 20 30 20 74 72 61 6e 73 66 6f 72 + 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 + 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 + 65 2d 73 61 76 65 64 2d 6c 61 74 65 73 74 20 21 + 0a + + ~ " 0 transformation-state" + ~ " transformation-state-output-buffer-start !" + 20 20 20 20 20 20 30 20 74 72 61 6e 73 66 6f 72 + 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 + 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 + 65 2d 6f 75 74 70 75 74 2d 62 75 66 66 65 72 2d + 73 74 61 72 74 20 21 0a + + ~ " 0 transformation-state" + ~ " transformation-state-user-stack-depth !" + 20 20 20 20 20 20 30 20 74 72 61 6e 73 66 6f 72 + 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 + 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 + 65 2d 75 73 65 72 2d 73 74 61 63 6b 2d 64 65 70 + 74 68 20 21 0a + + ~ "" + 0a + + ~ " ~ Also put the input source back how it was." + 20 20 20 20 20 20 7e 20 20 41 6c 73 6f 20 70 75 + 74 20 74 68 65 20 69 6e 70 75 74 20 73 6f 75 72 + 63 65 20 62 61 63 6b 20 68 6f 77 20 69 74 20 77 + 61 73 2e 0a + + ~ " main-input-buffer pop-input-buffer" + 20 20 20 20 20 20 6d 61 69 6e 2d 69 6e 70 75 74 + 2d 62 75 66 66 65 72 20 70 6f 70 2d 69 6e 70 75 + 74 2d 62 75 66 66 65 72 0a + + ~ "" + 0a + + ~ " exit } if } forever ;" + 20 20 20 20 20 20 65 78 69 74 20 7d 20 69 66 20 + 7d 20 66 6f 72 65 76 65 72 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Hex transform implementation" + 7e 20 48 65 78 20 74 72 61 6e 73 66 6f 72 6d 20 + 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 0a + + ~ "~" + 7e 0a + + ~ "~ The following code is all part of implementing the hex" + ~ " transform. For" + 7e 20 20 20 54 68 65 20 66 6f 6c 6c 6f 77 69 6e + 67 20 63 6f 64 65 20 69 73 20 61 6c 6c 20 70 61 + 72 74 20 6f 66 20 69 6d 70 6c 65 6d 65 6e 74 69 + 6e 67 20 74 68 65 20 68 65 78 20 74 72 61 6e 73 + 66 6f 72 6d 2e 20 46 6f 72 0a + + ~ "~ conceptual overview, see the top of this file." + 7e 20 63 6f 6e 63 65 70 74 75 61 6c 20 6f 76 65 + 72 76 69 65 77 2c 20 73 65 65 20 74 68 65 20 74 + 6f 70 20 6f 66 20 74 68 69 73 20 66 69 6c 65 2e + 0a + + ~ "~" + 7e 0a + + ~ "~ The hex transform operates under some very complex" + ~ " memory-management" + 7e 20 20 20 54 68 65 20 68 65 78 20 74 72 61 6e + 73 66 6f 72 6d 20 6f 70 65 72 61 74 65 73 20 75 + 6e 64 65 72 20 73 6f 6d 65 20 76 65 72 79 20 63 + 6f 6d 70 6c 65 78 20 6d 65 6d 6f 72 79 2d 6d 61 + 6e 61 67 65 6d 65 6e 74 0a + + ~ "~ assumptions, even compared to the other transforms, so" + ~ " it's worth going over" + 7e 20 61 73 73 75 6d 70 74 69 6f 6e 73 2c 20 65 + 76 65 6e 20 63 6f 6d 70 61 72 65 64 20 74 6f 20 + 74 68 65 20 6f 74 68 65 72 20 74 72 61 6e 73 66 + 6f 72 6d 73 2c 20 73 6f 20 69 74 27 73 20 77 6f + 72 74 68 20 67 6f 69 6e 67 20 6f 76 65 72 0a + + ~ "~ all that and studying how it comes together, even though" + ~ " much of it is" + 7e 20 61 6c 6c 20 74 68 61 74 20 61 6e 64 20 73 + 74 75 64 79 69 6e 67 20 68 6f 77 20 69 74 20 63 + 6f 6d 65 73 20 74 6f 67 65 74 68 65 72 2c 20 65 + 76 65 6e 20 74 68 6f 75 67 68 20 6d 75 63 68 20 + 6f 66 20 69 74 20 69 73 0a + + ~ "~ material that has been explained elsewhere. This" + ~ " explanation is here with" + 7e 20 6d 61 74 65 72 69 61 6c 20 74 68 61 74 20 + 68 61 73 20 62 65 65 6e 20 65 78 70 6c 61 69 6e + 65 64 20 65 6c 73 65 77 68 65 72 65 2e 20 54 68 + 69 73 20 65 78 70 6c 61 6e 61 74 69 6f 6e 20 69 + 73 20 68 65 72 65 20 77 69 74 68 0a + + ~ "~ the implementation details rather than at the top of the" + ~ " file, because it's" + 7e 20 74 68 65 20 69 6d 70 6c 65 6d 65 6e 74 61 + 74 69 6f 6e 20 64 65 74 61 69 6c 73 20 72 61 74 + 68 65 72 20 74 68 61 6e 20 61 74 20 74 68 65 20 + 74 6f 70 20 6f 66 20 74 68 65 20 66 69 6c 65 2c + 20 62 65 63 61 75 73 65 20 69 74 27 73 0a + + ~ "~ only necessary to understanding how to modify the" + ~ " transform, not how to use" + 7e 20 6f 6e 6c 79 20 6e 65 63 65 73 73 61 72 79 + 20 74 6f 20 75 6e 64 65 72 73 74 61 6e 64 69 6e + 67 20 68 6f 77 20 74 6f 20 6d 6f 64 69 66 79 20 + 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 2c 20 6e + 6f 74 20 68 6f 77 20 74 6f 20 75 73 65 0a + + ~ "~ it." + 7e 20 69 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ This is the bit of the hex transform where all the" + ~ " memory-management" + 7e 20 20 20 54 68 69 73 20 69 73 20 74 68 65 20 + 62 69 74 20 6f 66 20 74 68 65 20 68 65 78 20 74 + 72 61 6e 73 66 6f 72 6d 20 77 68 65 72 65 20 61 + 6c 6c 20 74 68 65 20 6d 65 6d 6f 72 79 2d 6d 61 + 6e 61 67 65 6d 65 6e 74 0a + + ~ "~ assumptions are in play at once, so, a quick refresher." + ~ " The transform" + 7e 20 61 73 73 75 6d 70 74 69 6f 6e 73 20 61 72 + 65 20 69 6e 20 70 6c 61 79 20 61 74 20 6f 6e 63 + 65 2c 20 73 6f 2c 20 61 20 71 75 69 63 6b 20 72 + 65 66 72 65 73 68 65 72 2e 20 54 68 65 20 74 72 + 61 6e 73 66 6f 72 6d 0a + + ~ "~ itself is running in the outer context; hex-trace and its" + ~ " siblings are" + 7e 20 69 74 73 65 6c 66 20 69 73 20 72 75 6e 6e + 69 6e 67 20 69 6e 20 74 68 65 20 6f 75 74 65 72 + 20 63 6f 6e 74 65 78 74 3b 20 68 65 78 2d 74 72 + 61 63 65 20 61 6e 64 20 69 74 73 20 73 69 62 6c + 69 6e 67 73 20 61 72 65 0a + + ~ "~ part of Evocation's main log and dictionary. This is also" + ~ " true for the" + 7e 20 70 61 72 74 20 6f 66 20 45 76 6f 63 61 74 + 69 6f 6e 27 73 20 6d 61 69 6e 20 6c 6f 67 20 61 + 6e 64 20 64 69 63 74 69 6f 6e 61 72 79 2e 20 54 + 68 69 73 20 69 73 20 61 6c 73 6f 20 74 72 75 65 + 20 66 6f 72 20 74 68 65 0a + + ~ "~ label and log-load transforms. Evocation has two global" + ~ " variables," + 7e 20 6c 61 62 65 6c 20 61 6e 64 20 6c 6f 67 2d + 6c 6f 61 64 20 74 72 61 6e 73 66 6f 72 6d 73 2e + 20 45 76 6f 63 61 74 69 6f 6e 20 68 61 73 20 74 + 77 6f 20 67 6c 6f 62 61 6c 20 76 61 72 69 61 62 + 6c 65 73 2c 0a + + ~ "~ "here" and "latest", which are the root of all references" + ~ " to the log and" + 7e 20 22 68 65 72 65 22 20 61 6e 64 20 22 6c 61 + 74 65 73 74 22 2c 20 77 68 69 63 68 20 61 72 65 + 20 74 68 65 20 72 6f 6f 74 20 6f 66 20 61 6c 6c + 20 72 65 66 65 72 65 6e 63 65 73 20 74 6f 20 74 + 68 65 20 6c 6f 67 20 61 6e 64 0a + + ~ "~ dictionary, respectively. Remember, the log is the" + ~ " structure used for" + 7e 20 64 69 63 74 69 6f 6e 61 72 79 2c 20 72 65 + 73 70 65 63 74 69 76 65 6c 79 2e 20 52 65 6d 65 + 6d 62 65 72 2c 20 74 68 65 20 6c 6f 67 20 69 73 + 20 74 68 65 20 73 74 72 75 63 74 75 72 65 20 75 + 73 65 64 20 66 6f 72 0a + + ~ "~ memory allocation, and the dictionary, which forms the" + ~ " majority of the" + 7e 20 6d 65 6d 6f 72 79 20 61 6c 6c 6f 63 61 74 + 69 6f 6e 2c 20 61 6e 64 20 74 68 65 20 64 69 63 + 74 69 6f 6e 61 72 79 2c 20 77 68 69 63 68 20 66 + 6f 72 6d 73 20 74 68 65 20 6d 61 6a 6f 72 69 74 + 79 20 6f 66 20 74 68 65 0a + + ~ "~ log, is the structure used for looking up words by name." + 7e 20 6c 6f 67 2c 20 69 73 20 74 68 65 20 73 74 + 72 75 63 74 75 72 65 20 75 73 65 64 20 66 6f 72 + 20 6c 6f 6f 6b 69 6e 67 20 75 70 20 77 6f 72 64 + 73 20 62 79 20 6e 61 6d 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Every transform, in its various ways, is changing what" + ~ " it means to" + 7e 20 20 20 45 76 65 72 79 20 74 72 61 6e 73 66 + 6f 72 6d 2c 20 69 6e 20 69 74 73 20 76 61 72 69 + 6f 75 73 20 77 61 79 73 2c 20 69 73 20 63 68 61 + 6e 67 69 6e 67 20 77 68 61 74 20 69 74 20 6d 65 + 61 6e 73 20 74 6f 0a + + ~ "~ "execute" and "compile" code; therefore, when the" + ~ " transforms are invoked," + 7e 20 22 65 78 65 63 75 74 65 22 20 61 6e 64 20 + 22 63 6f 6d 70 69 6c 65 22 20 63 6f 64 65 3b 20 + 74 68 65 72 65 66 6f 72 65 2c 20 77 68 65 6e 20 + 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 73 20 61 + 72 65 20 69 6e 76 6f 6b 65 64 2c 0a + + ~ "~ they are passed an "output buffer" which is used as the" + ~ " destination for" + 7e 20 74 68 65 79 20 61 72 65 20 70 61 73 73 65 + 64 20 61 6e 20 22 6f 75 74 70 75 74 20 62 75 66 + 66 65 72 22 20 77 68 69 63 68 20 69 73 20 75 73 + 65 64 20 61 73 20 74 68 65 20 64 65 73 74 69 6e + 61 74 69 6f 6e 20 66 6f 72 0a + + ~ "~ any compilation that occurs, and any scratch space that" + ~ " is needed. When" + 7e 20 61 6e 79 20 63 6f 6d 70 69 6c 61 74 69 6f + 6e 20 74 68 61 74 20 6f 63 63 75 72 73 2c 20 61 + 6e 64 20 61 6e 79 20 73 63 72 61 74 63 68 20 73 + 70 61 63 65 20 74 68 61 74 20 69 73 20 6e 65 65 + 64 65 64 2e 20 57 68 65 6e 0a + + ~ "~ more than one transform is running at once (such as when" + ~ " the hex transform" + 7e 20 6d 6f 72 65 20 74 68 61 6e 20 6f 6e 65 20 + 74 72 61 6e 73 66 6f 72 6d 20 69 73 20 72 75 6e + 6e 69 6e 67 20 61 74 20 6f 6e 63 65 20 28 73 75 + 63 68 20 61 73 20 77 68 65 6e 20 74 68 65 20 68 + 65 78 20 74 72 61 6e 73 66 6f 72 6d 0a + + ~ "~ operates on code that is itself running the label" + ~ " transform), each" + 7e 20 6f 70 65 72 61 74 65 73 20 6f 6e 20 63 6f + 64 65 20 74 68 61 74 20 69 73 20 69 74 73 65 6c + 66 20 72 75 6e 6e 69 6e 67 20 74 68 65 20 6c 61 + 62 65 6c 20 74 72 61 6e 73 66 6f 72 6d 29 2c 20 + 65 61 63 68 0a + + ~ "~ transform has its own separate output buffer." + 7e 20 74 72 61 6e 73 66 6f 72 6d 20 68 61 73 20 + 69 74 73 20 6f 77 6e 20 73 65 70 61 72 61 74 65 + 20 6f 75 74 70 75 74 20 62 75 66 66 65 72 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Furthermore, the transformation facility helps each" + ~ " transform to swap out" + 7e 20 20 20 46 75 72 74 68 65 72 6d 6f 72 65 2c + 20 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 61 74 + 69 6f 6e 20 66 61 63 69 6c 69 74 79 20 68 65 6c + 70 73 20 65 61 63 68 20 74 72 61 6e 73 66 6f 72 + 6d 20 74 6f 20 73 77 61 70 20 6f 75 74 0a + + ~ "~ the values of "here" and "latest", and restore them" + ~ " later, so that the code" + 7e 20 74 68 65 20 76 61 6c 75 65 73 20 6f 66 20 + 22 68 65 72 65 22 20 61 6e 64 20 22 6c 61 74 65 + 73 74 22 2c 20 61 6e 64 20 72 65 73 74 6f 72 65 + 20 74 68 65 6d 20 6c 61 74 65 72 2c 20 73 6f 20 + 74 68 61 74 20 74 68 65 20 63 6f 64 65 0a + + ~ "~ being transformed will see the output buffer as if it is" + ~ " the "real" log, and" + 7e 20 62 65 69 6e 67 20 74 72 61 6e 73 66 6f 72 + 6d 65 64 20 77 69 6c 6c 20 73 65 65 20 74 68 65 + 20 6f 75 74 70 75 74 20 62 75 66 66 65 72 20 61 + 73 20 69 66 20 69 74 20 69 73 20 74 68 65 20 22 + 72 65 61 6c 22 20 6c 6f 67 2c 20 61 6e 64 0a + + ~ "~ will see the separate dictionary stored within the output" + ~ " buffer as if it is" + 7e 20 77 69 6c 6c 20 73 65 65 20 74 68 65 20 73 + 65 70 61 72 61 74 65 20 64 69 63 74 69 6f 6e 61 + 72 79 20 73 74 6f 72 65 64 20 77 69 74 68 69 6e + 20 74 68 65 20 6f 75 74 70 75 74 20 62 75 66 66 + 65 72 20 61 73 20 69 66 20 69 74 20 69 73 0a + + ~ "~ the "real" dictionary." + 7e 20 74 68 65 20 22 72 65 61 6c 22 20 64 69 63 + 74 69 6f 6e 61 72 79 2e 0a + + ~ "~" + 7e 0a + + ~ "~ All this stuff about the output buffer applies to every" + ~ " transform. The" + 7e 20 20 20 41 6c 6c 20 74 68 69 73 20 73 74 75 + 66 66 20 61 62 6f 75 74 20 74 68 65 20 6f 75 74 + 70 75 74 20 62 75 66 66 65 72 20 61 70 70 6c 69 + 65 73 20 74 6f 20 65 76 65 72 79 20 74 72 61 6e + 73 66 6f 72 6d 2e 20 54 68 65 0a + + ~ "~ hex transform takes it one step further, and as such" + ~ " there are two" + 7e 20 68 65 78 20 74 72 61 6e 73 66 6f 72 6d 20 + 74 61 6b 65 73 20 69 74 20 6f 6e 65 20 73 74 65 + 70 20 66 75 72 74 68 65 72 2c 20 61 6e 64 20 61 + 73 20 73 75 63 68 20 74 68 65 72 65 20 61 72 65 + 20 74 77 6f 0a + + ~ "~ additional memory regions that are important to" + ~ " understanding it. The first" + 7e 20 61 64 64 69 74 69 6f 6e 61 6c 20 6d 65 6d + 6f 72 79 20 72 65 67 69 6f 6e 73 20 74 68 61 74 + 20 61 72 65 20 69 6d 70 6f 72 74 61 6e 74 20 74 + 6f 20 75 6e 64 65 72 73 74 61 6e 64 69 6e 67 20 + 69 74 2e 20 54 68 65 20 66 69 72 73 74 0a + + ~ "~ is the label-loop buffer, which is allocated out of the" + ~ " inner log, and used" + 7e 20 69 73 20 74 68 65 20 6c 61 62 65 6c 2d 6c + 6f 6f 70 20 62 75 66 66 65 72 2c 20 77 68 69 63 + 68 20 69 73 20 61 6c 6c 6f 63 61 74 65 64 20 6f + 75 74 20 6f 66 20 74 68 65 20 69 6e 6e 65 72 20 + 6c 6f 67 2c 20 61 6e 64 20 75 73 65 64 0a + + ~ "~ to hold draft versions of the binary output that the" + ~ " inner compilation" + 7e 20 74 6f 20 68 6f 6c 64 20 64 72 61 66 74 20 + 76 65 72 73 69 6f 6e 73 20 6f 66 20 74 68 65 20 + 62 69 6e 61 72 79 20 6f 75 74 70 75 74 20 74 68 + 61 74 20 74 68 65 20 69 6e 6e 65 72 20 63 6f 6d + 70 69 6c 61 74 69 6f 6e 0a + + ~ "~ process would eventually emit to the standard output" + ~ " stream, if it were" + 7e 20 70 72 6f 63 65 73 73 20 77 6f 75 6c 64 20 + 65 76 65 6e 74 75 61 6c 6c 79 20 65 6d 69 74 20 + 74 6f 20 74 68 65 20 73 74 61 6e 64 61 72 64 20 + 6f 75 74 70 75 74 20 73 74 72 65 61 6d 2c 20 69 + 66 20 69 74 20 77 65 72 65 0a + + ~ "~ being allowed to emit output in the normal way. The" + ~ " second is the output" + 7e 20 62 65 69 6e 67 20 61 6c 6c 6f 77 65 64 20 + 74 6f 20 65 6d 69 74 20 6f 75 74 70 75 74 20 69 + 6e 20 74 68 65 20 6e 6f 72 6d 61 6c 20 77 61 79 + 2e 20 54 68 65 20 73 65 63 6f 6e 64 20 69 73 20 + 74 68 65 20 6f 75 74 70 75 74 0a + + ~ "~ metadata buffer, which is allocated out of the outer log," + ~ " and used to hold" + 7e 20 6d 65 74 61 64 61 74 61 20 62 75 66 66 65 + 72 2c 20 77 68 69 63 68 20 69 73 20 61 6c 6c 6f + 63 61 74 65 64 20 6f 75 74 20 6f 66 20 74 68 65 + 20 6f 75 74 65 72 20 6c 6f 67 2c 20 61 6e 64 20 + 75 73 65 64 20 74 6f 20 68 6f 6c 64 0a + + ~ "~ metadata such as comments and formatting pertaining to" + ~ " code structure, which" + 7e 20 6d 65 74 61 64 61 74 61 20 73 75 63 68 20 + 61 73 20 63 6f 6d 6d 65 6e 74 73 20 61 6e 64 20 + 66 6f 72 6d 61 74 74 69 6e 67 20 70 65 72 74 61 + 69 6e 69 6e 67 20 74 6f 20 63 6f 64 65 20 73 74 + 72 75 63 74 75 72 65 2c 20 77 68 69 63 68 0a + + ~ "~ will need to be referenced when actually outputting the" + ~ " final hex dump." + 7e 20 77 69 6c 6c 20 6e 65 65 64 20 74 6f 20 62 + 65 20 72 65 66 65 72 65 6e 63 65 64 20 77 68 65 + 6e 20 61 63 74 75 61 6c 6c 79 20 6f 75 74 70 75 + 74 74 69 6e 67 20 74 68 65 20 66 69 6e 61 6c 20 + 68 65 78 20 64 75 6d 70 2e 0a + + ~ "~" + 7e 0a + + ~ "~ So, the label-loop buffer can be thought of as scratch" + ~ " space for the" + 7e 20 20 20 53 6f 2c 20 74 68 65 20 6c 61 62 65 + 6c 2d 6c 6f 6f 70 20 62 75 66 66 65 72 20 63 61 + 6e 20 62 65 20 74 68 6f 75 67 68 74 20 6f 66 20 + 61 73 20 73 63 72 61 74 63 68 20 73 70 61 63 65 + 20 66 6f 72 20 74 68 65 0a + + ~ "~ compiled binary output from the code being transformed," + ~ " and the output" + 7e 20 63 6f 6d 70 69 6c 65 64 20 62 69 6e 61 72 + 79 20 6f 75 74 70 75 74 20 66 72 6f 6d 20 74 68 + 65 20 63 6f 64 65 20 62 65 69 6e 67 20 74 72 61 + 6e 73 66 6f 72 6d 65 64 2c 20 61 6e 64 20 74 68 + 65 20 6f 75 74 70 75 74 0a + + ~ "~ metadata buffer can be thought of as the scratch space" + ~ " for the formatted hex" + 7e 20 6d 65 74 61 64 61 74 61 20 62 75 66 66 65 + 72 20 63 61 6e 20 62 65 20 74 68 6f 75 67 68 74 + 20 6f 66 20 61 73 20 74 68 65 20 73 63 72 61 74 + 63 68 20 73 70 61 63 65 20 66 6f 72 20 74 68 65 + 20 66 6f 72 6d 61 74 74 65 64 20 68 65 78 0a + + ~ "~ dump that will be made out of that output. It's important" + ~ " not to confuse" + 7e 20 64 75 6d 70 20 74 68 61 74 20 77 69 6c 6c + 20 62 65 20 6d 61 64 65 20 6f 75 74 20 6f 66 20 + 74 68 61 74 20 6f 75 74 70 75 74 2e 20 49 74 27 + 73 20 69 6d 70 6f 72 74 61 6e 74 20 6e 6f 74 20 + 74 6f 20 63 6f 6e 66 75 73 65 0a + + ~ "~ either of them with the output buffer, which is the" + ~ " scratch space used as" + 7e 20 65 69 74 68 65 72 20 6f 66 20 74 68 65 6d + 20 77 69 74 68 20 74 68 65 20 6f 75 74 70 75 74 + 20 62 75 66 66 65 72 2c 20 77 68 69 63 68 20 69 + 73 20 74 68 65 20 73 63 72 61 74 63 68 20 73 70 + 61 63 65 20 75 73 65 64 20 61 73 0a + + ~ "~ part of the compilation process." + 7e 20 70 61 72 74 20 6f 66 20 74 68 65 20 63 6f + 6d 70 69 6c 61 74 69 6f 6e 20 70 72 6f 63 65 73 + 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Confusingly, the output buffer and the label-loop" + ~ " buffer both contain" + 7e 20 20 20 43 6f 6e 66 75 73 69 6e 67 6c 79 2c + 20 74 68 65 20 6f 75 74 70 75 74 20 62 75 66 66 + 65 72 20 61 6e 64 20 74 68 65 20 6c 61 62 65 6c + 2d 6c 6f 6f 70 20 62 75 66 66 65 72 20 62 6f 74 + 68 20 63 6f 6e 74 61 69 6e 0a + + ~ "~ logs and dictionaries, at least potentially, if the code" + ~ " being compiled is" + 7e 20 6c 6f 67 73 20 61 6e 64 20 64 69 63 74 69 + 6f 6e 61 72 69 65 73 2c 20 61 74 20 6c 65 61 73 + 74 20 70 6f 74 65 6e 74 69 61 6c 6c 79 2c 20 69 + 66 20 74 68 65 20 63 6f 64 65 20 62 65 69 6e 67 + 20 63 6f 6d 70 69 6c 65 64 20 69 73 0a + + ~ "~ Forth code. It is also possible to use the hex transform" + ~ " on assembly code," + 7e 20 46 6f 72 74 68 20 63 6f 64 65 2e 20 49 74 + 20 69 73 20 61 6c 73 6f 20 70 6f 73 73 69 62 6c + 65 20 74 6f 20 75 73 65 20 74 68 65 20 68 65 78 + 20 74 72 61 6e 73 66 6f 72 6d 20 6f 6e 20 61 73 + 73 65 6d 62 6c 79 20 63 6f 64 65 2c 0a + + ~ "~ in which case the label-loop buffer won't have a log in" + ~ " it but the output" + 7e 20 69 6e 20 77 68 69 63 68 20 63 61 73 65 20 + 74 68 65 20 6c 61 62 65 6c 2d 6c 6f 6f 70 20 62 + 75 66 66 65 72 20 77 6f 6e 27 74 20 68 61 76 65 + 20 61 20 6c 6f 67 20 69 6e 20 69 74 20 62 75 74 + 20 74 68 65 20 6f 75 74 70 75 74 0a + + ~ "~ buffer still will. In practice, the hex transform" + ~ " frequently winds up" + 7e 20 62 75 66 66 65 72 20 73 74 69 6c 6c 20 77 + 69 6c 6c 2e 20 49 6e 20 70 72 61 63 74 69 63 65 + 2c 20 74 68 65 20 68 65 78 20 74 72 61 6e 73 66 + 6f 72 6d 20 66 72 65 71 75 65 6e 74 6c 79 20 77 + 69 6e 64 73 20 75 70 0a + + ~ "~ needing to be careful about the log and dictionary in the" + ~ " output buffer, but" + 7e 20 6e 65 65 64 69 6e 67 20 74 6f 20 62 65 20 + 63 61 72 65 66 75 6c 20 61 62 6f 75 74 20 74 68 + 65 20 6c 6f 67 20 61 6e 64 20 64 69 63 74 69 6f + 6e 61 72 79 20 69 6e 20 74 68 65 20 6f 75 74 70 + 75 74 20 62 75 66 66 65 72 2c 20 62 75 74 0a + + ~ "~ rarely does anything that directly touches the log and" + ~ " dictionary in the" + 7e 20 72 61 72 65 6c 79 20 64 6f 65 73 20 61 6e + 79 74 68 69 6e 67 20 74 68 61 74 20 64 69 72 65 + 63 74 6c 79 20 74 6f 75 63 68 65 73 20 74 68 65 + 20 6c 6f 67 20 61 6e 64 20 64 69 63 74 69 6f 6e + 61 72 79 20 69 6e 20 74 68 65 0a + + ~ "~ label-loop buffer, so you can usually ignore the latter" + ~ " when reading this" + 7e 20 6c 61 62 65 6c 2d 6c 6f 6f 70 20 62 75 66 + 66 65 72 2c 20 73 6f 20 79 6f 75 20 63 61 6e 20 + 75 73 75 61 6c 6c 79 20 69 67 6e 6f 72 65 20 74 + 68 65 20 6c 61 74 74 65 72 20 77 68 65 6e 20 72 + 65 61 64 69 6e 67 20 74 68 69 73 0a + + ~ "~ code." + 7e 20 63 6f 64 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Allocating the output buffer and output metadata buffer" + ~ " is the" + 7e 20 20 20 41 6c 6c 6f 63 61 74 69 6e 67 20 74 + 68 65 20 6f 75 74 70 75 74 20 62 75 66 66 65 72 + 20 61 6e 64 20 6f 75 74 70 75 74 20 6d 65 74 61 + 64 61 74 61 20 62 75 66 66 65 72 20 69 73 20 74 + 68 65 0a + + ~ "~ responsibility of the caller of hex-transform. Allocating" + ~ " the label-loop" + 7e 20 72 65 73 70 6f 6e 73 69 62 69 6c 69 74 79 + 20 6f 66 20 74 68 65 20 63 61 6c 6c 65 72 20 6f + 66 20 68 65 78 2d 74 72 61 6e 73 66 6f 72 6d 2e + 20 41 6c 6c 6f 63 61 74 69 6e 67 20 74 68 65 20 + 6c 61 62 65 6c 2d 6c 6f 6f 70 0a + + ~ "~ buffer is the responsibility of label-loop, which is" + ~ " called by the code" + 7e 20 62 75 66 66 65 72 20 69 73 20 74 68 65 20 + 72 65 73 70 6f 6e 73 69 62 69 6c 69 74 79 20 6f + 66 20 6c 61 62 65 6c 2d 6c 6f 6f 70 2c 20 77 68 + 69 63 68 20 69 73 20 63 61 6c 6c 65 64 20 62 79 + 20 74 68 65 20 63 6f 64 65 0a + + ~ "~ being transformed, but the hex transform intervenes in" + ~ " that allocation to" + 7e 20 62 65 69 6e 67 20 74 72 61 6e 73 66 6f 72 + 6d 65 64 2c 20 62 75 74 20 74 68 65 20 68 65 78 + 20 74 72 61 6e 73 66 6f 72 6d 20 69 6e 74 65 72 + 76 65 6e 65 73 20 69 6e 20 74 68 61 74 20 61 6c + 6c 6f 63 61 74 69 6f 6e 20 74 6f 0a + + ~ "~ save information about it." + 7e 20 73 61 76 65 20 69 6e 66 6f 72 6d 61 74 69 + 6f 6e 20 61 62 6f 75 74 20 69 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The output buffer is referenced during the transform" + ~ " via the" + 7e 20 20 20 54 68 65 20 6f 75 74 70 75 74 20 62 + 75 66 66 65 72 20 69 73 20 72 65 66 65 72 65 6e + 63 65 64 20 64 75 72 69 6e 67 20 74 68 65 20 74 + 72 61 6e 73 66 6f 72 6d 20 76 69 61 20 74 68 65 + 0a + + ~ "~ transformation-state-output-buffer-start field of the" + ~ " global" + 7e 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 2d 6f 75 74 70 75 74 2d 62 75 + 66 66 65 72 2d 73 74 61 72 74 20 66 69 65 6c 64 + 20 6f 66 20 74 68 65 20 67 6c 6f 62 61 6c 0a + + ~ "~ "transformation-state" variable, and the output metadata" + ~ " buffer is" + 7e 20 22 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f + 6e 2d 73 74 61 74 65 22 20 76 61 72 69 61 62 6c + 65 2c 20 61 6e 64 20 74 68 65 20 6f 75 74 70 75 + 74 20 6d 65 74 61 64 61 74 61 20 62 75 66 66 65 + 72 20 69 73 0a + + ~ "~ referenced via the transformation-state-output-metadata" + ~ " field of that same" + 7e 20 72 65 66 65 72 65 6e 63 65 64 20 76 69 61 + 20 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 61 74 + 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 20 66 69 65 6c 64 20 + 6f 66 20 74 68 61 74 20 73 61 6d 65 0a + + ~ "~ variable. The label-loop buffer is referenced from the" + 7e 20 76 61 72 69 61 62 6c 65 2e 20 54 68 65 20 + 6c 61 62 65 6c 2d 6c 6f 6f 70 20 62 75 66 66 65 + 72 20 69 73 20 72 65 66 65 72 65 6e 63 65 64 20 + 66 72 6f 6d 20 74 68 65 0a + + ~ "~ hex-output-metadata-label-loop-buffer-start and -length" + ~ " fields of the" + 7e 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 6c 61 62 65 6c 2d 6c 6f 6f 70 + 2d 62 75 66 66 65 72 2d 73 74 61 72 74 20 61 6e + 64 20 2d 6c 65 6e 67 74 68 20 66 69 65 6c 64 73 + 20 6f 66 20 74 68 65 0a + + ~ "~ output metadata's top-level header, and the code being" + ~ " transformed passes" + 7e 20 6f 75 74 70 75 74 20 6d 65 74 61 64 61 74 + 61 27 73 20 74 6f 70 2d 6c 65 76 65 6c 20 68 65 + 61 64 65 72 2c 20 61 6e 64 20 74 68 65 20 63 6f + 64 65 20 62 65 69 6e 67 20 74 72 61 6e 73 66 6f + 72 6d 65 64 20 70 61 73 73 65 73 0a + + ~ "~ around its own reference to that same buffer." + 7e 20 61 72 6f 75 6e 64 20 69 74 73 20 6f 77 6e + 20 72 65 66 65 72 65 6e 63 65 20 74 6f 20 74 68 + 61 74 20 73 61 6d 65 20 62 75 66 66 65 72 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Finally, recall that, when Evocation itself is the" + ~ " thing being" + 7e 20 20 20 46 69 6e 61 6c 6c 79 2c 20 72 65 63 + 61 6c 6c 20 74 68 61 74 2c 20 77 68 65 6e 20 45 + 76 6f 63 61 74 69 6f 6e 20 69 74 73 65 6c 66 20 + 69 73 20 74 68 65 20 74 68 69 6e 67 20 62 65 69 + 6e 67 0a + + ~ "~ transformed, the code under transformation includes its" + ~ " own copy of the" + 7e 20 74 72 61 6e 73 66 6f 72 6d 65 64 2c 20 74 + 68 65 20 63 6f 64 65 20 75 6e 64 65 72 20 74 72 + 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 20 69 6e 63 + 6c 75 64 65 73 20 69 74 73 20 6f 77 6e 20 63 6f + 70 79 20 6f 66 20 74 68 65 0a + + ~ "~ transformation facility, along with all the rest of" + ~ " Evocation. When the code" + 7e 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 20 66 61 63 69 6c 69 74 79 2c 20 61 6c 6f 6e 67 + 20 77 69 74 68 20 61 6c 6c 20 74 68 65 20 72 65 + 73 74 20 6f 66 20 45 76 6f 63 61 74 69 6f 6e 2e + 20 57 68 65 6e 20 74 68 65 20 63 6f 64 65 0a + + ~ "~ under transformation invokes the label and log-load" + ~ " transforms, it will do" + 7e 20 75 6e 64 65 72 20 74 72 61 6e 73 66 6f 72 + 6d 61 74 69 6f 6e 20 69 6e 76 6f 6b 65 73 20 74 + 68 65 20 6c 61 62 65 6c 20 61 6e 64 20 6c 6f 67 + 2d 6c 6f 61 64 20 74 72 61 6e 73 66 6f 72 6d 73 + 2c 20 69 74 20 77 69 6c 6c 20 64 6f 0a + + ~ "~ so using the copies of those transforms which have been" + ~ " transformed by the" + 7e 20 73 6f 20 75 73 69 6e 67 20 74 68 65 20 63 + 6f 70 69 65 73 20 6f 66 20 74 68 6f 73 65 20 74 + 72 61 6e 73 66 6f 72 6d 73 20 77 68 69 63 68 20 + 68 61 76 65 20 62 65 65 6e 20 74 72 61 6e 73 66 + 6f 72 6d 65 64 20 62 79 20 74 68 65 0a + + ~ "~ hex transform. The same goes for most Evocation internals" + ~ " invoked by the" + 7e 20 68 65 78 20 74 72 61 6e 73 66 6f 72 6d 2e + 20 54 68 65 20 73 61 6d 65 20 67 6f 65 73 20 66 + 6f 72 20 6d 6f 73 74 20 45 76 6f 63 61 74 69 6f + 6e 20 69 6e 74 65 72 6e 61 6c 73 20 69 6e 76 6f + 6b 65 64 20 62 79 20 74 68 65 0a + + ~ "~ compilation process, except for whatever specific" + ~ " exceptions the hex" + 7e 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 70 72 + 6f 63 65 73 73 2c 20 65 78 63 65 70 74 20 66 6f + 72 20 77 68 61 74 65 76 65 72 20 73 70 65 63 69 + 66 69 63 20 65 78 63 65 70 74 69 6f 6e 73 20 74 + 68 65 20 68 65 78 0a + + ~ "~ transform creates. Do not confuse the inner copies of" + ~ " anything with the" + 7e 20 74 72 61 6e 73 66 6f 72 6d 20 63 72 65 61 + 74 65 73 2e 20 44 6f 20 6e 6f 74 20 63 6f 6e 66 + 75 73 65 20 74 68 65 20 69 6e 6e 65 72 20 63 6f + 70 69 65 73 20 6f 66 20 61 6e 79 74 68 69 6e 67 + 20 77 69 74 68 20 74 68 65 0a + + ~ "~ outer copies. Also try not to worry too much about the" + ~ " inner-inner copies," + 7e 20 6f 75 74 65 72 20 63 6f 70 69 65 73 2e 20 + 41 6c 73 6f 20 74 72 79 20 6e 6f 74 20 74 6f 20 + 77 6f 72 72 79 20 74 6f 6f 20 6d 75 63 68 20 61 + 62 6f 75 74 20 74 68 65 20 69 6e 6e 65 72 2d 69 + 6e 6e 65 72 20 63 6f 70 69 65 73 2c 0a + + ~ "~ let the inner transforms deal with them." + 7e 20 6c 65 74 20 74 68 65 20 69 6e 6e 65 72 20 + 74 72 61 6e 73 66 6f 72 6d 73 20 64 65 61 6c 20 + 77 69 74 68 20 74 68 65 6d 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Got all that background fresh in your mind? Okay, time" + ~ " to get concrete!" + 7e 20 20 20 47 6f 74 20 61 6c 6c 20 74 68 61 74 + 20 62 61 63 6b 67 72 6f 75 6e 64 20 66 72 65 73 + 68 20 69 6e 20 79 6f 75 72 20 6d 69 6e 64 3f 20 + 4f 6b 61 79 2c 20 74 69 6d 65 20 74 6f 20 67 65 + 74 20 63 6f 6e 63 72 65 74 65 21 0a + + ~ "~ The output metadata is a header structure followed by an" + ~ " array of entry" + 7e 20 54 68 65 20 6f 75 74 70 75 74 20 6d 65 74 + 61 64 61 74 61 20 69 73 20 61 20 68 65 61 64 65 + 72 20 73 74 72 75 63 74 75 72 65 20 66 6f 6c 6c + 6f 77 65 64 20 62 79 20 61 6e 20 61 72 72 61 79 + 20 6f 66 20 65 6e 74 72 79 0a + + ~ "~ structures, as follows:" + 7e 20 73 74 72 75 63 74 75 72 65 73 2c 20 61 73 + 20 66 6f 6c 6c 6f 77 73 3a 0a + + ~ "~" + 7e 0a + + ~ "~ (header start)" + 7e 20 28 68 65 61 64 65 72 20 73 74 61 72 74 29 + 0a + + ~ "~ 0x00 - 0x07 Label-loop" + ~ " buffer start" + 7e 20 20 20 20 20 20 20 20 20 20 20 30 78 30 30 + 20 2d 20 30 78 30 37 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 4c 61 62 65 + 6c 2d 6c 6f 6f 70 20 62 75 66 66 65 72 20 73 74 + 61 72 74 0a + + ~ "~ 0x08 - 0x0f Label-loop" + ~ " buffer length" + 7e 20 20 20 20 20 20 20 20 20 20 20 30 78 30 38 + 20 2d 20 30 78 30 66 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 4c 61 62 65 + 6c 2d 6c 6f 6f 70 20 62 75 66 66 65 72 20 6c 65 + 6e 67 74 68 0a + + ~ "~ (entry start)" + 7e 20 28 65 6e 74 72 79 20 73 74 61 72 74 29 0a + + ~ "~ ... + 0x00 - ... + 0x07 Data pointer" + 7e 20 20 20 20 20 2e 2e 2e 20 2b 20 30 78 30 30 + 20 2d 20 2e 2e 2e 20 2b 20 30 78 30 37 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 44 61 74 61 + 20 70 6f 69 6e 74 65 72 0a + + ~ "~ ... + 0x08 - ... + 0x0f Referenced data" + ~ " length" + 7e 20 20 20 20 20 2e 2e 2e 20 2b 20 30 78 30 38 + 20 2d 20 2e 2e 2e 20 2b 20 30 78 30 66 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 52 65 66 65 + 72 65 6e 63 65 64 20 64 61 74 61 20 6c 65 6e 67 + 74 68 0a + + ~ "~ ... + 0x10 - ... + 0x17 String pointer" + 7e 20 20 20 20 20 2e 2e 2e 20 2b 20 30 78 31 30 + 20 2d 20 2e 2e 2e 20 2b 20 30 78 31 37 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 53 74 72 69 + 6e 67 20 70 6f 69 6e 74 65 72 0a + + ~ "~ (entry fields repeat at successive offsets, until...)" + 7e 20 28 65 6e 74 72 79 20 66 69 65 6c 64 73 20 + 72 65 70 65 61 74 20 61 74 20 73 75 63 63 65 73 + 73 69 76 65 20 6f 66 66 73 65 74 73 2c 20 75 6e + 74 69 6c 2e 2e 2e 29 0a + + ~ "~ ... + 0x00 - ... + 0x07 (end) Zero, used as a" + ~ " delimiter" + 7e 20 20 20 20 20 2e 2e 2e 20 2b 20 30 78 30 30 + 20 2d 20 2e 2e 2e 20 2b 20 30 78 30 37 20 28 65 + 6e 64 29 20 20 20 20 20 20 20 20 20 5a 65 72 6f + 2c 20 75 73 65 64 20 61 73 20 61 20 64 65 6c 69 + 6d 69 74 65 72 0a + + ~ "~" + 7e 0a + + ~ "~" + 7e 0a + + ~ "~ Magic comment syntax" + 7e 20 4d 61 67 69 63 20 63 6f 6d 6d 65 6e 74 20 + 73 79 6e 74 61 78 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 0a + + ~ "~" + 7e 0a + + ~ "~ How, the sufficiently determined reader may ask, does" + ~ " all this output" + 7e 20 20 20 48 6f 77 2c 20 74 68 65 20 73 75 66 + 66 69 63 69 65 6e 74 6c 79 20 64 65 74 65 72 6d + 69 6e 65 64 20 72 65 61 64 65 72 20 6d 61 79 20 + 61 73 6b 2c 20 64 6f 65 73 20 61 6c 6c 20 74 68 + 69 73 20 6f 75 74 70 75 74 0a + + ~ "~ metadata get created? Surely, the reader may rightly" + ~ " think, creating" + 7e 20 6d 65 74 61 64 61 74 61 20 67 65 74 20 63 + 72 65 61 74 65 64 3f 20 53 75 72 65 6c 79 2c 20 + 74 68 65 20 72 65 61 64 65 72 20 6d 61 79 20 72 + 69 67 68 74 6c 79 20 74 68 69 6e 6b 2c 20 63 72 + 65 61 74 69 6e 67 0a + + ~ "~ metadata entries which fully describe a compilation" + ~ " process must entail" + 7e 20 6d 65 74 61 64 61 74 61 20 65 6e 74 72 69 + 65 73 20 77 68 69 63 68 20 66 75 6c 6c 79 20 64 + 65 73 63 72 69 62 65 20 61 20 63 6f 6d 70 69 6c + 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 20 6d 75 + 73 74 20 65 6e 74 61 69 6c 0a + + ~ "~ gathering and synthesizing information from disparate" + ~ " stages of that" + 7e 20 67 61 74 68 65 72 69 6e 67 20 61 6e 64 20 + 73 79 6e 74 68 65 73 69 7a 69 6e 67 20 69 6e 66 + 6f 72 6d 61 74 69 6f 6e 20 66 72 6f 6d 20 64 69 + 73 70 61 72 61 74 65 20 73 74 61 67 65 73 20 6f + 66 20 74 68 61 74 0a + + ~ "~ process, which seems quite involved." + 7e 20 70 72 6f 63 65 73 73 2c 20 77 68 69 63 68 + 20 73 65 65 6d 73 20 71 75 69 74 65 20 69 6e 76 + 6f 6c 76 65 64 2e 0a + + ~ "~" + 7e 0a + + ~ "~ That is correct: It is quite involved. It would be nice" + ~ " if there were a" + 7e 20 20 20 54 68 61 74 20 69 73 20 63 6f 72 72 + 65 63 74 3a 20 49 74 20 69 73 20 71 75 69 74 65 + 20 69 6e 76 6f 6c 76 65 64 2e 20 49 74 20 77 6f + 75 6c 64 20 62 65 20 6e 69 63 65 20 69 66 20 74 + 68 65 72 65 20 77 65 72 65 20 61 0a + + ~ "~ simple trick, but this appears to be essential" + ~ " complexity. Several" + 7e 20 73 69 6d 70 6c 65 20 74 72 69 63 6b 2c 20 + 62 75 74 20 74 68 69 73 20 61 70 70 65 61 72 73 + 20 74 6f 20 62 65 20 65 73 73 65 6e 74 69 61 6c + 20 63 6f 6d 70 6c 65 78 69 74 79 2e 20 53 65 76 + 65 72 61 6c 0a + + ~ "~ approaches were considered. In principle it would be" + ~ " possible to have a" + 7e 20 61 70 70 72 6f 61 63 68 65 73 20 77 65 72 + 65 20 63 6f 6e 73 69 64 65 72 65 64 2e 20 49 6e + 20 70 72 69 6e 63 69 70 6c 65 20 69 74 20 77 6f + 75 6c 64 20 62 65 20 70 6f 73 73 69 62 6c 65 20 + 74 6f 20 68 61 76 65 20 61 0a + + ~ "~ specific trap defined here in this file for every word" + ~ " that generates" + 7e 20 73 70 65 63 69 66 69 63 20 74 72 61 70 20 + 64 65 66 69 6e 65 64 20 68 65 72 65 20 69 6e 20 + 74 68 69 73 20 66 69 6c 65 20 66 6f 72 20 65 76 + 65 72 79 20 77 6f 72 64 20 74 68 61 74 20 67 65 + 6e 65 72 61 74 65 73 0a + + ~ "~ nontrivial output, and keep knowledge of what information" + ~ " to gather from" + 7e 20 6e 6f 6e 74 72 69 76 69 61 6c 20 6f 75 74 + 70 75 74 2c 20 61 6e 64 20 6b 65 65 70 20 6b 6e + 6f 77 6c 65 64 67 65 20 6f 66 20 77 68 61 74 20 + 69 6e 66 6f 72 6d 61 74 69 6f 6e 20 74 6f 20 67 + 61 74 68 65 72 20 66 72 6f 6d 0a + + ~ "~ those words in the trap definitions. However, that would" + ~ " bind the important" + 7e 20 74 68 6f 73 65 20 77 6f 72 64 73 20 69 6e + 20 74 68 65 20 74 72 61 70 20 64 65 66 69 6e 69 + 74 69 6f 6e 73 2e 20 48 6f 77 65 76 65 72 2c 20 + 74 68 61 74 20 77 6f 75 6c 64 20 62 69 6e 64 20 + 74 68 65 20 69 6d 70 6f 72 74 61 6e 74 0a + + ~ "~ semantics quite closely to the already-overwhelming topic" + ~ " of the" + 7e 20 73 65 6d 61 6e 74 69 63 73 20 71 75 69 74 + 65 20 63 6c 6f 73 65 6c 79 20 74 6f 20 74 68 65 + 20 61 6c 72 65 61 64 79 2d 6f 76 65 72 77 68 65 + 6c 6d 69 6e 67 20 74 6f 70 69 63 20 6f 66 20 74 + 68 65 0a + + ~ "~ transformation data structures, and make it all but" + ~ " impossible to port" + 7e 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 20 64 61 74 61 20 73 74 72 75 63 74 75 72 65 73 + 2c 20 61 6e 64 20 6d 61 6b 65 20 69 74 20 61 6c + 6c 20 62 75 74 20 69 6d 70 6f 73 73 69 62 6c 65 + 20 74 6f 20 70 6f 72 74 0a + + ~ "~ Evocation to a new architecture. The knowledge we wish to" + ~ " capture is really" + 7e 20 45 76 6f 63 61 74 69 6f 6e 20 74 6f 20 61 + 20 6e 65 77 20 61 72 63 68 69 74 65 63 74 75 72 + 65 2e 20 54 68 65 20 6b 6e 6f 77 6c 65 64 67 65 + 20 77 65 20 77 69 73 68 20 74 6f 20 63 61 70 74 + 75 72 65 20 69 73 20 72 65 61 6c 6c 79 0a + + ~ "~ knowledge about an instruction set architecture, not" + ~ " about data structures." + 7e 20 6b 6e 6f 77 6c 65 64 67 65 20 61 62 6f 75 + 74 20 61 6e 20 69 6e 73 74 72 75 63 74 69 6f 6e + 20 73 65 74 20 61 72 63 68 69 74 65 63 74 75 72 + 65 2c 20 6e 6f 74 20 61 62 6f 75 74 20 64 61 74 + 61 20 73 74 72 75 63 74 75 72 65 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Instead, following the principle that different kinds" + ~ " of knowledge on the" + 7e 20 20 20 49 6e 73 74 65 61 64 2c 20 66 6f 6c + 6c 6f 77 69 6e 67 20 74 68 65 20 70 72 69 6e 63 + 69 70 6c 65 20 74 68 61 74 20 64 69 66 66 65 72 + 65 6e 74 20 6b 69 6e 64 73 20 6f 66 20 6b 6e 6f + 77 6c 65 64 67 65 20 6f 6e 20 74 68 65 0a + + ~ "~ same topic should live close together, we've defined a" + ~ " magic-comment syntax" + 7e 20 73 61 6d 65 20 74 6f 70 69 63 20 73 68 6f + 75 6c 64 20 6c 69 76 65 20 63 6c 6f 73 65 20 74 + 6f 67 65 74 68 65 72 2c 20 77 65 27 76 65 20 64 + 65 66 69 6e 65 64 20 61 20 6d 61 67 69 63 2d 63 + 6f 6d 6d 65 6e 74 20 73 79 6e 74 61 78 0a + + ~ "~ which allows the assembly-language words in" + ~ " language/static/amd64.e to" + 7e 20 77 68 69 63 68 20 61 6c 6c 6f 77 73 20 74 + 68 65 20 61 73 73 65 6d 62 6c 79 2d 6c 61 6e 67 + 75 61 67 65 20 77 6f 72 64 73 20 69 6e 20 6c 61 + 6e 67 75 61 67 65 2f 73 74 61 74 69 63 2f 61 6d + 64 36 34 2e 65 20 74 6f 0a + + ~ "~ describe their own metadata, and is versatile enough to" + ~ " do the same for" + 7e 20 64 65 73 63 72 69 62 65 20 74 68 65 69 72 + 20 6f 77 6e 20 6d 65 74 61 64 61 74 61 2c 20 61 + 6e 64 20 69 73 20 76 65 72 73 61 74 69 6c 65 20 + 65 6e 6f 75 67 68 20 74 6f 20 64 6f 20 74 68 65 + 20 73 61 6d 65 20 66 6f 72 0a + + ~ "~ future architectures." + 7e 20 66 75 74 75 72 65 20 61 72 63 68 69 74 65 + 63 74 75 72 65 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ When the compiler operates normally, without the hex" + ~ " transform, these" + 7e 20 20 20 57 68 65 6e 20 74 68 65 20 63 6f 6d + 70 69 6c 65 72 20 6f 70 65 72 61 74 65 73 20 6e + 6f 72 6d 61 6c 6c 79 2c 20 77 69 74 68 6f 75 74 + 20 74 68 65 20 68 65 78 20 74 72 61 6e 73 66 6f + 72 6d 2c 20 74 68 65 73 65 0a + + ~ "~ magic comments are simply regular comments, and are" + ~ " discarded as the" + 7e 20 6d 61 67 69 63 20 63 6f 6d 6d 65 6e 74 73 + 20 61 72 65 20 73 69 6d 70 6c 79 20 72 65 67 75 + 6c 61 72 20 63 6f 6d 6d 65 6e 74 73 2c 20 61 6e + 64 20 61 72 65 20 64 69 73 63 61 72 64 65 64 20 + 61 73 20 74 68 65 0a + + ~ "~ interpreter finds them. When the compiler runs under the" + ~ " hex transform, they" + 7e 20 69 6e 74 65 72 70 72 65 74 65 72 20 66 69 + 6e 64 73 20 74 68 65 6d 2e 20 57 68 65 6e 20 74 + 68 65 20 63 6f 6d 70 69 6c 65 72 20 72 75 6e 73 + 20 75 6e 64 65 72 20 74 68 65 20 68 65 78 20 74 + 72 61 6e 73 66 6f 72 6d 2c 20 74 68 65 79 0a + + ~ "~ are instead recognized as commands to be processed by the" + ~ " hex transform." + 7e 20 61 72 65 20 69 6e 73 74 65 61 64 20 72 65 + 63 6f 67 6e 69 7a 65 64 20 61 73 20 63 6f 6d 6d + 61 6e 64 73 20 74 6f 20 62 65 20 70 72 6f 63 65 + 73 73 65 64 20 62 79 20 74 68 65 20 68 65 78 20 + 74 72 61 6e 73 66 6f 72 6d 2e 0a + + ~ "~ Magic comments can only appear in the body of a word" + ~ " being compiled, not at" + 7e 20 4d 61 67 69 63 20 63 6f 6d 6d 65 6e 74 73 + 20 63 61 6e 20 6f 6e 6c 79 20 61 70 70 65 61 72 + 20 69 6e 20 74 68 65 20 62 6f 64 79 20 6f 66 20 + 61 20 77 6f 72 64 20 62 65 69 6e 67 20 63 6f 6d + 70 69 6c 65 64 2c 20 6e 6f 74 20 61 74 0a + + ~ "~ the top level. The hex transform intervenes in the" + ~ " compilation process to" + 7e 20 74 68 65 20 74 6f 70 20 6c 65 76 65 6c 2e + 20 54 68 65 20 68 65 78 20 74 72 61 6e 73 66 6f + 72 6d 20 69 6e 74 65 72 76 65 6e 65 73 20 69 6e + 20 74 68 65 20 63 6f 6d 70 69 6c 61 74 69 6f 6e + 20 70 72 6f 63 65 73 73 20 74 6f 0a + + ~ "~ insert calls to its own internal words, which are" + ~ " executed, not when the" + 7e 20 69 6e 73 65 72 74 20 63 61 6c 6c 73 20 74 + 6f 20 69 74 73 20 6f 77 6e 20 69 6e 74 65 72 6e + 61 6c 20 77 6f 72 64 73 2c 20 77 68 69 63 68 20 + 61 72 65 20 65 78 65 63 75 74 65 64 2c 20 6e 6f + 74 20 77 68 65 6e 20 74 68 65 0a + + ~ "~ comment is read, but later, when the word it was compiled" + ~ " into is called." + 7e 20 63 6f 6d 6d 65 6e 74 20 69 73 20 72 65 61 + 64 2c 20 62 75 74 20 6c 61 74 65 72 2c 20 77 68 + 65 6e 20 74 68 65 20 77 6f 72 64 20 69 74 20 77 + 61 73 20 63 6f 6d 70 69 6c 65 64 20 69 6e 74 6f + 20 69 73 20 63 61 6c 6c 65 64 2e 0a + + ~ "~ When the word in question is itself part of the compiler," + ~ " the magic comments" + 7e 20 57 68 65 6e 20 74 68 65 20 77 6f 72 64 20 + 69 6e 20 71 75 65 73 74 69 6f 6e 20 69 73 20 69 + 74 73 65 6c 66 20 70 61 72 74 20 6f 66 20 74 68 + 65 20 63 6f 6d 70 69 6c 65 72 2c 20 74 68 65 20 + 6d 61 67 69 63 20 63 6f 6d 6d 65 6e 74 73 0a + + ~ "~ will be able to see and work with all the state that" + ~ " exists as it runs, and" + 7e 20 77 69 6c 6c 20 62 65 20 61 62 6c 65 20 74 + 6f 20 73 65 65 20 61 6e 64 20 77 6f 72 6b 20 77 + 69 74 68 20 61 6c 6c 20 74 68 65 20 73 74 61 74 + 65 20 74 68 61 74 20 65 78 69 73 74 73 20 61 73 + 20 69 74 20 72 75 6e 73 2c 20 61 6e 64 0a + + ~ "~ gather it as they wish." + 7e 20 67 61 74 68 65 72 20 69 74 20 61 73 20 74 + 68 65 79 20 77 69 73 68 2e 0a + + ~ "~" + 7e 0a + + ~ "~ There are several kinds of magic comment. All of them" + ~ " begin with the" + 7e 20 20 20 54 68 65 72 65 20 61 72 65 20 73 65 + 76 65 72 61 6c 20 6b 69 6e 64 73 20 6f 66 20 6d + 61 67 69 63 20 63 6f 6d 6d 65 6e 74 2e 20 41 6c + 6c 20 6f 66 20 74 68 65 6d 20 62 65 67 69 6e 20 + 77 69 74 68 20 74 68 65 0a + + ~ "~ characters : and space as the first two characters of the" + ~ " comment body (and" + 7e 20 63 68 61 72 61 63 74 65 72 73 20 3a 20 61 + 6e 64 20 73 70 61 63 65 20 61 73 20 74 68 65 20 + 66 69 72 73 74 20 74 77 6f 20 63 68 61 72 61 63 + 74 65 72 73 20 6f 66 20 74 68 65 20 63 6f 6d 6d + 65 6e 74 20 62 6f 64 79 20 28 61 6e 64 0a + + ~ "~ don't forget that there's a space after ~, as well). The" + ~ " syntax on the rest" + 7e 20 64 6f 6e 27 74 20 66 6f 72 67 65 74 20 74 + 68 61 74 20 74 68 65 72 65 27 73 20 61 20 73 70 + 61 63 65 20 61 66 74 65 72 20 7e 2c 20 61 73 20 + 77 65 6c 6c 29 2e 20 54 68 65 20 73 79 6e 74 61 + 78 20 6f 6e 20 74 68 65 20 72 65 73 74 0a + + ~ "~ of the line determines what type of command it is." + 7e 20 6f 66 20 74 68 65 20 6c 69 6e 65 20 64 65 + 74 65 72 6d 69 6e 65 73 20 77 68 61 74 20 74 79 + 70 65 20 6f 66 20 63 6f 6d 6d 61 6e 64 20 69 74 + 20 69 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Here are some examples:" + 7e 20 20 20 48 65 72 65 20 61 72 65 20 73 6f 6d + 65 20 65 78 61 6d 70 6c 65 73 3a 0a + + ~ "~" + 7e 0a + + ~ "~ ~ : Intriguing commentary goes here." + 7e 20 20 20 7e 20 3a 20 49 6e 74 72 69 67 75 69 + 6e 67 20 63 6f 6d 6d 65 6e 74 61 72 79 20 67 6f + 65 73 20 68 65 72 65 2e 0a + + ~ "~ ~ : 5 This comment describes the next five bytes of" + ~ " output." + 7e 20 20 20 7e 20 3a 20 35 20 54 68 69 73 20 63 + 6f 6d 6d 65 6e 74 20 64 65 73 63 72 69 62 65 73 + 20 74 68 65 20 6e 65 78 74 20 66 69 76 65 20 62 + 79 74 65 73 20 6f 66 20 6f 75 74 70 75 74 2e 0a + + ~ "~ 777 pack32 ~ : -4 This comment describes the previous" + ~ " four bytes." + 7e 20 20 20 37 37 37 20 70 61 63 6b 33 32 20 7e + 20 3a 20 2d 34 20 54 68 69 73 20 63 6f 6d 6d 65 + 6e 74 20 64 65 73 63 72 69 62 65 73 20 74 68 65 + 20 70 72 65 76 69 6f 75 73 20 66 6f 75 72 20 62 + 79 74 65 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ ~ : indent" + 7e 20 20 20 7e 20 3a 20 69 6e 64 65 6e 74 0a + + ~ "~ ~ : deindent" + 7e 20 20 20 7e 20 3a 20 64 65 69 6e 64 65 6e 74 + 0a + + ~ "~ ~ : fresh-line" + 7e 20 20 20 7e 20 3a 20 66 72 65 73 68 2d 6c 69 + 6e 65 0a + + ~ "~ ~ : blank-line" + 7e 20 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 + 6e 65 0a + + ~ "~" + 7e 0a + + ~ "~ ~ : 1 adjust-length" + 7e 20 20 20 7e 20 3a 20 31 20 61 64 6a 75 73 74 + 2d 6c 65 6e 67 74 68 0a + + ~ "~ ~ : -10 adjust-start" + 7e 20 20 20 7e 20 3a 20 2d 31 30 20 61 64 6a 75 + 73 74 2d 73 74 61 72 74 0a + + ~ "~ ~ : 1 data-adjust-length" + 7e 20 20 20 7e 20 3a 20 31 20 64 61 74 61 2d 61 + 64 6a 75 73 74 2d 6c 65 6e 67 74 68 0a + + ~ "~ ~ : -1 data-adjust-start" + 7e 20 20 20 7e 20 3a 20 2d 31 20 64 61 74 61 2d + 61 64 6a 75 73 74 2d 73 74 61 72 74 0a + + ~ "~" + 7e 0a + + ~ "~ ~ : 0x1000 set-output-point" + 7e 20 20 20 7e 20 3a 20 30 78 31 30 30 30 20 73 + 65 74 2d 6f 75 74 70 75 74 2d 70 6f 69 6e 74 0a + + ~ "~ ~ : 8 adjust-output-point" + 7e 20 20 20 7e 20 3a 20 38 20 61 64 6a 75 73 74 + 2d 6f 75 74 70 75 74 2d 70 6f 69 6e 74 0a + + ~ "~ ~ : data-set-output-point" + 7e 20 20 20 7e 20 3a 20 64 61 74 61 2d 73 65 74 + 2d 6f 75 74 70 75 74 2d 70 6f 69 6e 74 0a + + ~ "~ ~ : 1 data-adjust-output-point" + 7e 20 20 20 7e 20 3a 20 31 20 64 61 74 61 2d 61 + 64 6a 75 73 74 2d 6f 75 74 70 75 74 2d 70 6f 69 + 6e 74 0a + + ~ "~" + 7e 0a + + ~ "~ ~ : 1 suppress" + 7e 20 20 20 7e 20 3a 20 31 20 73 75 70 70 72 65 + 73 73 0a + + ~ "~ ~ : delete-first-comment-at-output-point" + 7e 20 20 20 7e 20 3a 20 64 65 6c 65 74 65 2d 66 + 69 72 73 74 2d 63 6f 6d 6d 65 6e 74 2d 61 74 2d + 6f 75 74 70 75 74 2d 70 6f 69 6e 74 0a + + ~ "~ ~ : delete-last-comment-at-output-point" + 7e 20 20 20 7e 20 3a 20 64 65 6c 65 74 65 2d 6c + 61 73 74 2d 63 6f 6d 6d 65 6e 74 2d 61 74 2d 6f + 75 74 70 75 74 2d 70 6f 69 6e 74 0a + + ~ "~" + 7e 0a + + ~ "~ ~ : Do a thing with # and # ?" + 7e 20 20 20 7e 20 3a 20 44 6f 20 61 20 74 68 69 + 6e 67 20 77 69 74 68 20 23 20 61 6e 64 20 23 20 + 3f 0a + + ~ "~ ~ : provide-decimal" + 7e 20 20 20 7e 20 3a 20 70 72 6f 76 69 64 65 2d + 64 65 63 69 6d 61 6c 0a + + ~ "~ ~ : provide-hex" + 7e 20 20 20 7e 20 3a 20 70 72 6f 76 69 64 65 2d + 68 65 78 0a + + ~ "~ ~ : provide-hex8" + 7e 20 20 20 7e 20 3a 20 70 72 6f 76 69 64 65 2d + 68 65 78 38 0a + + ~ "~ ~ : provide-hex16" + 7e 20 20 20 7e 20 3a 20 70 72 6f 76 69 64 65 2d + 68 65 78 31 36 0a + + ~ "~ ~ : provide-hex32" + 7e 20 20 20 7e 20 3a 20 70 72 6f 76 69 64 65 2d + 68 65 78 33 32 0a + + ~ "~ ~ : provide-hex64" + 7e 20 20 20 7e 20 3a 20 70 72 6f 76 69 64 65 2d + 68 65 78 36 34 0a + + ~ "~ ~ : provide-string" + 7e 20 20 20 7e 20 3a 20 70 72 6f 76 69 64 65 2d + 73 74 72 69 6e 67 0a + + ~ "~ ~ : provide-string-copy" + 7e 20 20 20 7e 20 3a 20 70 72 6f 76 69 64 65 2d + 73 74 72 69 6e 67 2d 63 6f 70 79 0a + + ~ "~ ~ : provide-keyword" + 7e 20 20 20 7e 20 3a 20 70 72 6f 76 69 64 65 2d + 6b 65 79 77 6f 72 64 0a + + ~ "~ ~ : provide-data" + 7e 20 20 20 7e 20 3a 20 70 72 6f 76 69 64 65 2d + 64 61 74 61 0a + + ~ "~ ~ : drop-subitem" + 7e 20 20 20 7e 20 3a 20 64 72 6f 70 2d 73 75 62 + 69 74 65 6d 0a + + ~ "~ ~ : swap-subitems" + 7e 20 20 20 7e 20 3a 20 73 77 61 70 2d 73 75 62 + 69 74 65 6d 73 0a + + ~ "~ ~ : 3 roll-subitems" + 7e 20 20 20 7e 20 3a 20 33 20 72 6f 6c 6c 2d 73 + 75 62 69 74 65 6d 73 0a + + ~ "~" + 7e 0a + + ~ "~ By the way, the reason it's possible to write these" + ~ " examples is that" + 7e 20 20 20 42 79 20 74 68 65 20 77 61 79 2c 20 + 74 68 65 20 72 65 61 73 6f 6e 20 69 74 27 73 20 + 70 6f 73 73 69 62 6c 65 20 74 6f 20 77 72 69 74 + 65 20 74 68 65 73 65 20 65 78 61 6d 70 6c 65 73 + 20 69 73 20 74 68 61 74 0a + + ~ "~ they're all embedded within an outer comment, the text" + ~ " you're reading, so" + 7e 20 74 68 65 79 27 72 65 20 61 6c 6c 20 65 6d + 62 65 64 64 65 64 20 77 69 74 68 69 6e 20 61 6e + 20 6f 75 74 65 72 20 63 6f 6d 6d 65 6e 74 2c 20 + 74 68 65 20 74 65 78 74 20 79 6f 75 27 72 65 20 + 72 65 61 64 69 6e 67 2c 20 73 6f 0a + + ~ "~ they don't look like real magic comments to the hex" + ~ " transform. Hopefully" + 7e 20 74 68 65 79 20 64 6f 6e 27 74 20 6c 6f 6f + 6b 20 6c 69 6b 65 20 72 65 61 6c 20 6d 61 67 69 + 63 20 63 6f 6d 6d 65 6e 74 73 20 74 6f 20 74 68 + 65 20 68 65 78 20 74 72 61 6e 73 66 6f 72 6d 2e + 20 48 6f 70 65 66 75 6c 6c 79 0a + + ~ "~ that's not too confusing; there isn't really another" + ~ " way." + 7e 20 74 68 61 74 27 73 20 6e 6f 74 20 74 6f 6f + 20 63 6f 6e 66 75 73 69 6e 67 3b 20 74 68 65 72 + 65 20 69 73 6e 27 74 20 72 65 61 6c 6c 79 20 61 + 6e 6f 74 68 65 72 20 77 61 79 2e 0a + + ~ "~" + 7e 0a + + ~ "~ So. You'll have noticed that some magic comments seem" + ~ " to be descriptive" + 7e 20 20 20 53 6f 2e 20 59 6f 75 27 6c 6c 20 68 + 61 76 65 20 6e 6f 74 69 63 65 64 20 74 68 61 74 + 20 73 6f 6d 65 20 6d 61 67 69 63 20 63 6f 6d 6d + 65 6e 74 73 20 73 65 65 6d 20 74 6f 20 62 65 20 + 64 65 73 63 72 69 70 74 69 76 65 0a + + ~ "~ text, and others seem to be commands. Every magic" + ~ " comment, in one way or" + 7e 20 74 65 78 74 2c 20 61 6e 64 20 6f 74 68 65 + 72 73 20 73 65 65 6d 20 74 6f 20 62 65 20 63 6f + 6d 6d 61 6e 64 73 2e 20 45 76 65 72 79 20 6d 61 + 67 69 63 20 63 6f 6d 6d 65 6e 74 2c 20 69 6e 20 + 6f 6e 65 20 77 61 79 20 6f 72 0a + + ~ "~ another, creates or manipulates the metadata entries," + ~ " which are stored in" + 7e 20 61 6e 6f 74 68 65 72 2c 20 63 72 65 61 74 + 65 73 20 6f 72 20 6d 61 6e 69 70 75 6c 61 74 65 + 73 20 74 68 65 20 6d 65 74 61 64 61 74 61 20 65 + 6e 74 72 69 65 73 2c 20 77 68 69 63 68 20 61 72 + 65 20 73 74 6f 72 65 64 20 69 6e 0a + + ~ "~ an array inside the output metadata as global mutable" + ~ " state. There are" + 7e 20 61 6e 20 61 72 72 61 79 20 69 6e 73 69 64 + 65 20 74 68 65 20 6f 75 74 70 75 74 20 6d 65 74 + 61 64 61 74 61 20 61 73 20 67 6c 6f 62 61 6c 20 + 6d 75 74 61 62 6c 65 20 73 74 61 74 65 2e 20 54 + 68 65 72 65 20 61 72 65 0a + + ~ "~ several phases of processing, and if you've gotten this" + ~ " far, you likely need" + 7e 20 73 65 76 65 72 61 6c 20 70 68 61 73 65 73 + 20 6f 66 20 70 72 6f 63 65 73 73 69 6e 67 2c 20 + 61 6e 64 20 69 66 20 79 6f 75 27 76 65 20 67 6f + 74 74 65 6e 20 74 68 69 73 20 66 61 72 2c 20 79 + 6f 75 20 6c 69 6b 65 6c 79 20 6e 65 65 64 0a + + ~ "~ to understand what they are and what order they happen" + ~ " in." + 7e 20 74 6f 20 75 6e 64 65 72 73 74 61 6e 64 20 + 77 68 61 74 20 74 68 65 79 20 61 72 65 20 61 6e + 64 20 77 68 61 74 20 6f 72 64 65 72 20 74 68 65 + 79 20 68 61 70 70 65 6e 20 69 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The simplest kind of comment is the "line comment", the" + ~ " first example" + 7e 20 20 20 54 68 65 20 73 69 6d 70 6c 65 73 74 + 20 6b 69 6e 64 20 6f 66 20 63 6f 6d 6d 65 6e 74 + 20 69 73 20 74 68 65 20 22 6c 69 6e 65 20 63 6f + 6d 6d 65 6e 74 22 2c 20 74 68 65 20 66 69 72 73 + 74 20 65 78 61 6d 70 6c 65 0a + + ~ "~ above. Any comment that doesn't match some more-specific" + ~ " syntax is treated" + 7e 20 61 62 6f 76 65 2e 20 41 6e 79 20 63 6f 6d + 6d 65 6e 74 20 74 68 61 74 20 64 6f 65 73 6e 27 + 74 20 6d 61 74 63 68 20 73 6f 6d 65 20 6d 6f 72 + 65 2d 73 70 65 63 69 66 69 63 20 73 79 6e 74 61 + 78 20 69 73 20 74 72 65 61 74 65 64 0a + + ~ "~ as a line comment. It has not escaped Irenes' notice that" + ~ " this means your" + 7e 20 61 73 20 61 20 6c 69 6e 65 20 63 6f 6d 6d + 65 6e 74 2e 20 49 74 20 68 61 73 20 6e 6f 74 20 + 65 73 63 61 70 65 64 20 49 72 65 6e 65 73 27 20 + 6e 6f 74 69 63 65 20 74 68 61 74 20 74 68 69 73 + 20 6d 65 61 6e 73 20 79 6f 75 72 0a + + ~ "~ syntax errors will seem to half-work; sorry about that." + ~ " When a line comment" + 7e 20 73 79 6e 74 61 78 20 65 72 72 6f 72 73 20 + 77 69 6c 6c 20 73 65 65 6d 20 74 6f 20 68 61 6c + 66 2d 77 6f 72 6b 3b 20 73 6f 72 72 79 20 61 62 + 6f 75 74 20 74 68 61 74 2e 20 57 68 65 6e 20 61 + 20 6c 69 6e 65 20 63 6f 6d 6d 65 6e 74 0a + + ~ "~ is executed, it creates a metadata entry at the end of" + ~ " the array of entries," + 7e 20 69 73 20 65 78 65 63 75 74 65 64 2c 20 69 + 74 20 63 72 65 61 74 65 73 20 61 20 6d 65 74 61 + 64 61 74 61 20 65 6e 74 72 79 20 61 74 20 74 68 + 65 20 65 6e 64 20 6f 66 20 74 68 65 20 61 72 72 + 61 79 20 6f 66 20 65 6e 74 72 69 65 73 2c 0a + + ~ "~ of -entry-type-line-comment, attached to the latest" + ~ " output point." + 7e 20 6f 66 20 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 6c 69 6e 65 2d 63 6f 6d 6d 65 6e 74 2c 20 61 + 74 74 61 63 68 65 64 20 74 6f 20 74 68 65 20 6c + 61 74 65 73 74 20 6f 75 74 70 75 74 20 70 6f 69 + 6e 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ This is the general pattern: Any magic comment that" + ~ " creates a metadata" + 7e 20 20 20 54 68 69 73 20 69 73 20 74 68 65 20 + 67 65 6e 65 72 61 6c 20 70 61 74 74 65 72 6e 3a + 20 41 6e 79 20 6d 61 67 69 63 20 63 6f 6d 6d 65 + 6e 74 20 74 68 61 74 20 63 72 65 61 74 65 73 20 + 61 20 6d 65 74 61 64 61 74 61 0a + + ~ "~ entry will always create it at the end of the entry" + ~ " array, and will always" + 7e 20 65 6e 74 72 79 20 77 69 6c 6c 20 61 6c 77 + 61 79 73 20 63 72 65 61 74 65 20 69 74 20 61 74 + 20 74 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 + 65 6e 74 72 79 20 61 72 72 61 79 2c 20 61 6e 64 + 20 77 69 6c 6c 20 61 6c 77 61 79 73 0a + + ~ "~ attach it to the latest output point as of the time the" + ~ " comment executes." + 7e 20 61 74 74 61 63 68 20 69 74 20 74 6f 20 74 + 68 65 20 6c 61 74 65 73 74 20 6f 75 74 70 75 74 + 20 70 6f 69 6e 74 20 61 73 20 6f 66 20 74 68 65 + 20 74 69 6d 65 20 74 68 65 20 63 6f 6d 6d 65 6e + 74 20 65 78 65 63 75 74 65 73 2e 0a + + ~ "~ Notice that, although the entry array will eventually be" + ~ " sorted by the" + 7e 20 4e 6f 74 69 63 65 20 74 68 61 74 2c 20 61 + 6c 74 68 6f 75 67 68 20 74 68 65 20 65 6e 74 72 + 79 20 61 72 72 61 79 20 77 69 6c 6c 20 65 76 65 + 6e 74 75 61 6c 6c 79 20 62 65 20 73 6f 72 74 65 + 64 20 62 79 20 74 68 65 0a + + ~ "~ addresses entries are attached to, at the time entries" + ~ " are created they're" + 7e 20 61 64 64 72 65 73 73 65 73 20 65 6e 74 72 + 69 65 73 20 61 72 65 20 61 74 74 61 63 68 65 64 + 20 74 6f 2c 20 61 74 20 74 68 65 20 74 69 6d 65 + 20 65 6e 74 72 69 65 73 20 61 72 65 20 63 72 65 + 61 74 65 64 20 74 68 65 79 27 72 65 0a + + ~ "~ simply appended. This is rarely an important distinction," + ~ " but when it is, it" + 7e 20 73 69 6d 70 6c 79 20 61 70 70 65 6e 64 65 + 64 2e 20 54 68 69 73 20 69 73 20 72 61 72 65 6c + 79 20 61 6e 20 69 6d 70 6f 72 74 61 6e 74 20 64 + 69 73 74 69 6e 63 74 69 6f 6e 2c 20 62 75 74 20 + 77 68 65 6e 20 69 74 20 69 73 2c 20 69 74 0a + + ~ "~ is." + 7e 20 69 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ What is the latest output point? Well, the hex" + ~ " transform has trapped all" + 7e 20 20 20 57 68 61 74 20 69 73 20 74 68 65 20 + 6c 61 74 65 73 74 20 6f 75 74 70 75 74 20 70 6f + 69 6e 74 3f 20 57 65 6c 6c 2c 20 74 68 65 20 68 + 65 78 20 74 72 61 6e 73 66 6f 72 6d 20 68 61 73 + 20 74 72 61 70 70 65 64 20 61 6c 6c 0a + + ~ "~ the words from core that compilation processes use to" + ~ " directly append bytes" + 7e 20 74 68 65 20 77 6f 72 64 73 20 66 72 6f 6d + 20 63 6f 72 65 20 74 68 61 74 20 63 6f 6d 70 69 + 6c 61 74 69 6f 6e 20 70 72 6f 63 65 73 73 65 73 + 20 75 73 65 20 74 6f 20 64 69 72 65 63 74 6c 79 + 20 61 70 70 65 6e 64 20 62 79 74 65 73 0a + + ~ "~ to the label-loop buffer, including pack8, packstring," + ~ " and the variants" + 7e 20 74 6f 20 74 68 65 20 6c 61 62 65 6c 2d 6c + 6f 6f 70 20 62 75 66 66 65 72 2c 20 69 6e 63 6c + 75 64 69 6e 67 20 70 61 63 6b 38 2c 20 70 61 63 + 6b 73 74 72 69 6e 67 2c 20 61 6e 64 20 74 68 65 + 20 76 61 72 69 61 6e 74 73 0a + + ~ "~ thereof. The traps are able to tell when the destination" + ~ " is in the" + 7e 20 74 68 65 72 65 6f 66 2e 20 54 68 65 20 74 + 72 61 70 73 20 61 72 65 20 61 62 6c 65 20 74 6f + 20 74 65 6c 6c 20 77 68 65 6e 20 74 68 65 20 64 + 65 73 74 69 6e 61 74 69 6f 6e 20 69 73 20 69 6e + 20 74 68 65 0a + + ~ "~ label-loop buffer, and they ignore any writes that" + ~ " aren't. The traps keep" + 7e 20 6c 61 62 65 6c 2d 6c 6f 6f 70 20 62 75 66 + 66 65 72 2c 20 61 6e 64 20 74 68 65 79 20 69 67 + 6e 6f 72 65 20 61 6e 79 20 77 72 69 74 65 73 20 + 74 68 61 74 20 61 72 65 6e 27 74 2e 20 54 68 65 + 20 74 72 61 70 73 20 6b 65 65 70 0a + + ~ "~ track of the next address AFTER whatever was just" + ~ " written, and store that" + 7e 20 74 72 61 63 6b 20 6f 66 20 74 68 65 20 6e + 65 78 74 20 61 64 64 72 65 73 73 20 41 46 54 45 + 52 20 77 68 61 74 65 76 65 72 20 77 61 73 20 6a + 75 73 74 20 77 72 69 74 74 65 6e 2c 20 61 6e 64 + 20 73 74 6f 72 65 20 74 68 61 74 0a + + ~ "~ in the output metadata header so magic comments can make" + ~ " use of it." + 7e 20 69 6e 20 74 68 65 20 6f 75 74 70 75 74 20 + 6d 65 74 61 64 61 74 61 20 68 65 61 64 65 72 20 + 73 6f 20 6d 61 67 69 63 20 63 6f 6d 6d 65 6e 74 + 73 20 63 61 6e 20 6d 61 6b 65 20 75 73 65 20 6f + 66 20 69 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ It's necessary to take this sneaky approach, because" + ~ " the compiler is free" + 7e 20 20 20 49 74 27 73 20 6e 65 63 65 73 73 61 + 72 79 20 74 6f 20 74 61 6b 65 20 74 68 69 73 20 + 73 6e 65 61 6b 79 20 61 70 70 72 6f 61 63 68 2c + 20 62 65 63 61 75 73 65 20 74 68 65 20 63 6f 6d + 70 69 6c 65 72 20 69 73 20 66 72 65 65 0a + + ~ "~ to write things in any order it wants; the label loop" + ~ " goes back to the start" + 7e 20 74 6f 20 77 72 69 74 65 20 74 68 69 6e 67 + 73 20 69 6e 20 61 6e 79 20 6f 72 64 65 72 20 69 + 74 20 77 61 6e 74 73 3b 20 74 68 65 20 6c 61 62 + 65 6c 20 6c 6f 6f 70 20 67 6f 65 73 20 62 61 63 + 6b 20 74 6f 20 74 68 65 20 73 74 61 72 74 0a + + ~ "~ every so often, and the high-level flow-control words" + ~ " even slide things" + 7e 20 65 76 65 72 79 20 73 6f 20 6f 66 74 65 6e + 2c 20 61 6e 64 20 74 68 65 20 68 69 67 68 2d 6c + 65 76 65 6c 20 66 6c 6f 77 2d 63 6f 6e 74 72 6f + 6c 20 77 6f 72 64 73 20 65 76 65 6e 20 73 6c 69 + 64 65 20 74 68 69 6e 67 73 0a + + ~ "~ around after the fact. The compiler is also free to pass" + ~ " around addresses" + 7e 20 61 72 6f 75 6e 64 20 61 66 74 65 72 20 74 + 68 65 20 66 61 63 74 2e 20 54 68 65 20 63 6f 6d + 70 69 6c 65 72 20 69 73 20 61 6c 73 6f 20 66 72 + 65 65 20 74 6f 20 70 61 73 73 20 61 72 6f 75 6e + 64 20 61 64 64 72 65 73 73 65 73 0a + + ~ "~ however it wants within itself, and without restricting" + ~ " that, there's no way" + 7e 20 68 6f 77 65 76 65 72 20 69 74 20 77 61 6e + 74 73 20 77 69 74 68 69 6e 20 69 74 73 65 6c 66 + 2c 20 61 6e 64 20 77 69 74 68 6f 75 74 20 72 65 + 73 74 72 69 63 74 69 6e 67 20 74 68 61 74 2c 20 + 74 68 65 72 65 27 73 20 6e 6f 20 77 61 79 0a + + ~ "~ for the hex transform to know which value represents the" + ~ " place stuff MIGHT" + 7e 20 66 6f 72 20 74 68 65 20 68 65 78 20 74 72 + 61 6e 73 66 6f 72 6d 20 74 6f 20 6b 6e 6f 77 20 + 77 68 69 63 68 20 76 61 6c 75 65 20 72 65 70 72 + 65 73 65 6e 74 73 20 74 68 65 20 70 6c 61 63 65 + 20 73 74 75 66 66 20 4d 49 47 48 54 0a + + ~ "~ be written to." + 7e 20 62 65 20 77 72 69 74 74 65 6e 20 74 6f 2e + 0a + + ~ "~" + 7e 0a + + ~ "~ The semantics of the latest output point are simple" + ~ " enough that they're" + 7e 20 20 20 54 68 65 20 73 65 6d 61 6e 74 69 63 + 73 20 6f 66 20 74 68 65 20 6c 61 74 65 73 74 20 + 6f 75 74 70 75 74 20 70 6f 69 6e 74 20 61 72 65 + 20 73 69 6d 70 6c 65 20 65 6e 6f 75 67 68 20 74 + 68 61 74 20 74 68 65 79 27 72 65 0a + + ~ "~ easy to keep in mind while writing magic comments. In" + ~ " practice, the output" + 7e 20 65 61 73 79 20 74 6f 20 6b 65 65 70 20 69 + 6e 20 6d 69 6e 64 20 77 68 69 6c 65 20 77 72 69 + 74 69 6e 67 20 6d 61 67 69 63 20 63 6f 6d 6d 65 + 6e 74 73 2e 20 49 6e 20 70 72 61 63 74 69 63 65 + 2c 20 74 68 65 20 6f 75 74 70 75 74 0a + + ~ "~ point is almost never the cause of confusion about the" + ~ " behavior of magic" + 7e 20 70 6f 69 6e 74 20 69 73 20 61 6c 6d 6f 73 + 74 20 6e 65 76 65 72 20 74 68 65 20 63 61 75 73 + 65 20 6f 66 20 63 6f 6e 66 75 73 69 6f 6e 20 61 + 62 6f 75 74 20 74 68 65 20 62 65 68 61 76 69 6f + 72 20 6f 66 20 6d 61 67 69 63 0a + + ~ "~ comments, but it's important to know about since it's the" + ~ " input the whole" + 7e 20 63 6f 6d 6d 65 6e 74 73 2c 20 62 75 74 20 + 69 74 27 73 20 69 6d 70 6f 72 74 61 6e 74 20 74 + 6f 20 6b 6e 6f 77 20 61 62 6f 75 74 20 73 69 6e + 63 65 20 69 74 27 73 20 74 68 65 20 69 6e 70 75 + 74 20 74 68 65 20 77 68 6f 6c 65 0a + + ~ "~ thing starts with." + 7e 20 74 68 69 6e 67 20 73 74 61 72 74 73 20 77 + 69 74 68 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Now, one thing to keep in mind is that every metadata" + ~ " entry has both an" + 7e 20 20 20 4e 6f 77 2c 20 6f 6e 65 20 74 68 69 + 6e 67 20 74 6f 20 6b 65 65 70 20 69 6e 20 6d 69 + 6e 64 20 69 73 20 74 68 61 74 20 65 76 65 72 79 + 20 6d 65 74 61 64 61 74 61 20 65 6e 74 72 79 20 + 68 61 73 20 62 6f 74 68 20 61 6e 0a + + ~ "~ address in the label-loop buffer that it attaches to, and" + ~ " a length field." + 7e 20 61 64 64 72 65 73 73 20 69 6e 20 74 68 65 + 20 6c 61 62 65 6c 2d 6c 6f 6f 70 20 62 75 66 66 + 65 72 20 74 68 61 74 20 69 74 20 61 74 74 61 63 + 68 65 73 20 74 6f 2c 20 61 6e 64 20 61 20 6c 65 + 6e 67 74 68 20 66 69 65 6c 64 2e 0a + + ~ "~ Line comments insert themselves in between lines of" + ~ " output in the hex dump," + 7e 20 4c 69 6e 65 20 63 6f 6d 6d 65 6e 74 73 20 + 69 6e 73 65 72 74 20 74 68 65 6d 73 65 6c 76 65 + 73 20 69 6e 20 62 65 74 77 65 65 6e 20 6c 69 6e + 65 73 20 6f 66 20 6f 75 74 70 75 74 20 69 6e 20 + 74 68 65 20 68 65 78 20 64 75 6d 70 2c 0a + + ~ "~ and don't otherwise affect the surrounding formatting, so" + ~ " they don't need to" + 7e 20 61 6e 64 20 64 6f 6e 27 74 20 6f 74 68 65 + 72 77 69 73 65 20 61 66 66 65 63 74 20 74 68 65 + 20 73 75 72 72 6f 75 6e 64 69 6e 67 20 66 6f 72 + 6d 61 74 74 69 6e 67 2c 20 73 6f 20 74 68 65 79 + 20 64 6f 6e 27 74 20 6e 65 65 64 20 74 6f 0a + + ~ "~ make use of the length and it's always set to zero." + 7e 20 6d 61 6b 65 20 75 73 65 20 6f 66 20 74 68 + 65 20 6c 65 6e 67 74 68 20 61 6e 64 20 69 74 27 + 73 20 61 6c 77 61 79 73 20 73 65 74 20 74 6f 20 + 7a 65 72 6f 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Now the second example above, which starts with the" + ~ " number 5 before its" + 7e 20 20 20 4e 6f 77 20 74 68 65 20 73 65 63 6f + 6e 64 20 65 78 61 6d 70 6c 65 20 61 62 6f 76 65 + 2c 20 77 68 69 63 68 20 73 74 61 72 74 73 20 77 + 69 74 68 20 74 68 65 20 6e 75 6d 62 65 72 20 35 + 20 62 65 66 6f 72 65 20 69 74 73 0a + + ~ "~ descriptive text. When the first space-separated word of" + ~ " a magic comment's" + 7e 20 64 65 73 63 72 69 70 74 69 76 65 20 74 65 + 78 74 2e 20 57 68 65 6e 20 74 68 65 20 66 69 72 + 73 74 20 73 70 61 63 65 2d 73 65 70 61 72 61 74 + 65 64 20 77 6f 72 64 20 6f 66 20 61 20 6d 61 67 + 69 63 20 63 6f 6d 6d 65 6e 74 27 73 0a + + ~ "~ body is a valid integer literal, this is taken as a" + ~ " parameter; different" + 7e 20 62 6f 64 79 20 69 73 20 61 20 76 61 6c 69 + 64 20 69 6e 74 65 67 65 72 20 6c 69 74 65 72 61 + 6c 2c 20 74 68 69 73 20 69 73 20 74 61 6b 65 6e + 20 61 73 20 61 20 70 61 72 61 6d 65 74 65 72 3b + 20 64 69 66 66 65 72 65 6e 74 0a + + ~ "~ types of magic comment use that parameter in different" + ~ " ways. The parameter" + 7e 20 74 79 70 65 73 20 6f 66 20 6d 61 67 69 63 + 20 63 6f 6d 6d 65 6e 74 20 75 73 65 20 74 68 61 + 74 20 70 61 72 61 6d 65 74 65 72 20 69 6e 20 64 + 69 66 66 65 72 65 6e 74 20 77 61 79 73 2e 20 54 + 68 65 20 70 61 72 61 6d 65 74 65 72 0a + + ~ "~ can be positive or negative, and can be written in any" + ~ " base Evocation" + 7e 20 63 61 6e 20 62 65 20 70 6f 73 69 74 69 76 + 65 20 6f 72 20 6e 65 67 61 74 69 76 65 2c 20 61 + 6e 64 20 63 61 6e 20 62 65 20 77 72 69 74 74 65 + 6e 20 69 6e 20 61 6e 79 20 62 61 73 65 20 45 76 + 6f 63 61 74 69 6f 6e 0a + + ~ "~ normally supports." + 7e 20 6e 6f 72 6d 61 6c 6c 79 20 73 75 70 70 6f + 72 74 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ When a parameter is given (even if it's zero), and the" + ~ " comment doesn't" + 7e 20 20 20 57 68 65 6e 20 61 20 70 61 72 61 6d + 65 74 65 72 20 69 73 20 67 69 76 65 6e 20 28 65 + 76 65 6e 20 69 66 20 69 74 27 73 20 7a 65 72 6f + 29 2c 20 61 6e 64 20 74 68 65 20 63 6f 6d 6d 65 + 6e 74 20 64 6f 65 73 6e 27 74 0a + + ~ "~ match some other more-specific syntax, it's treated as a" + ~ " "suffix comment"." + 7e 20 6d 61 74 63 68 20 73 6f 6d 65 20 6f 74 68 + 65 72 20 6d 6f 72 65 2d 73 70 65 63 69 66 69 63 + 20 73 79 6e 74 61 78 2c 20 69 74 27 73 20 74 72 + 65 61 74 65 64 20 61 73 20 61 20 22 73 75 66 66 + 69 78 20 63 6f 6d 6d 65 6e 74 22 2e 0a + + ~ "~ Much like a line comment, when a suffix comment is" + ~ " executed, it creates a" + 7e 20 4d 75 63 68 20 6c 69 6b 65 20 61 20 6c 69 + 6e 65 20 63 6f 6d 6d 65 6e 74 2c 20 77 68 65 6e + 20 61 20 73 75 66 66 69 78 20 63 6f 6d 6d 65 6e + 74 20 69 73 20 65 78 65 63 75 74 65 64 2c 20 69 + 74 20 63 72 65 61 74 65 73 20 61 0a + + ~ "~ metadata entry at the end, of -entry-type-suffix-comment," + ~ " attached to the" + 7e 20 6d 65 74 61 64 61 74 61 20 65 6e 74 72 79 + 20 61 74 20 74 68 65 20 65 6e 64 2c 20 6f 66 20 + 2d 65 6e 74 72 79 2d 74 79 70 65 2d 73 75 66 66 + 69 78 2d 63 6f 6d 6d 65 6e 74 2c 20 61 74 74 61 + 63 68 65 64 20 74 6f 20 74 68 65 0a + + ~ "~ latest output point. The command uses the parameter as" + ~ " the initial value of" + 7e 20 6c 61 74 65 73 74 20 6f 75 74 70 75 74 20 + 70 6f 69 6e 74 2e 20 54 68 65 20 63 6f 6d 6d 61 + 6e 64 20 75 73 65 73 20 74 68 65 20 70 61 72 61 + 6d 65 74 65 72 20 61 73 20 74 68 65 20 69 6e 69 + 74 69 61 6c 20 76 61 6c 75 65 20 6f 66 0a + + ~ "~ the entry's length field, but it's worth being aware that" + ~ " other commands may" + 7e 20 74 68 65 20 65 6e 74 72 79 27 73 20 6c 65 + 6e 67 74 68 20 66 69 65 6c 64 2c 20 62 75 74 20 + 69 74 27 73 20 77 6f 72 74 68 20 62 65 69 6e 67 + 20 61 77 61 72 65 20 74 68 61 74 20 6f 74 68 65 + 72 20 63 6f 6d 6d 61 6e 64 73 20 6d 61 79 0a + + ~ "~ change it later." + 7e 20 63 68 61 6e 67 65 20 69 74 20 6c 61 74 65 + 72 2e 0a + + ~ "~" + 7e 0a + + ~ "~ It's called a suffix comment because, when all the" + ~ " passes described below" + 7e 20 20 20 49 74 27 73 20 63 61 6c 6c 65 64 20 + 61 20 73 75 66 66 69 78 20 63 6f 6d 6d 65 6e 74 + 20 62 65 63 61 75 73 65 2c 20 77 68 65 6e 20 61 + 6c 6c 20 74 68 65 20 70 61 73 73 65 73 20 64 65 + 73 63 72 69 62 65 64 20 62 65 6c 6f 77 0a + + ~ "~ have run and the formatting happens, it will appear at" + ~ " the end of a line of" + 7e 20 68 61 76 65 20 72 75 6e 20 61 6e 64 20 74 + 68 65 20 66 6f 72 6d 61 74 74 69 6e 67 20 68 61 + 70 70 65 6e 73 2c 20 69 74 20 77 69 6c 6c 20 61 + 70 70 65 61 72 20 61 74 20 74 68 65 20 65 6e 64 + 20 6f 66 20 61 20 6c 69 6e 65 20 6f 66 0a + + ~ "~ text, after the byte values it's attached to. Things like" + ~ " assembly-language" + 7e 20 74 65 78 74 2c 20 61 66 74 65 72 20 74 68 + 65 20 62 79 74 65 20 76 61 6c 75 65 73 20 69 74 + 27 73 20 61 74 74 61 63 68 65 64 20 74 6f 2e 20 + 54 68 69 6e 67 73 20 6c 69 6b 65 20 61 73 73 65 + 6d 62 6c 79 2d 6c 61 6e 67 75 61 67 65 0a + + ~ "~ instructions should almost always be suffix comments," + ~ " because this makes it" + 7e 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 73 + 68 6f 75 6c 64 20 61 6c 6d 6f 73 74 20 61 6c 77 + 61 79 73 20 62 65 20 73 75 66 66 69 78 20 63 6f + 6d 6d 65 6e 74 73 2c 20 62 65 63 61 75 73 65 20 + 74 68 69 73 20 6d 61 6b 65 73 20 69 74 0a + + ~ "~ easy for a human reader to see which bytes of machine" + ~ " code go with them." + 7e 20 65 61 73 79 20 66 6f 72 20 61 20 68 75 6d + 61 6e 20 72 65 61 64 65 72 20 74 6f 20 73 65 65 + 20 77 68 69 63 68 20 62 79 74 65 73 20 6f 66 20 + 6d 61 63 68 69 6e 65 20 63 6f 64 65 20 67 6f 20 + 77 69 74 68 20 74 68 65 6d 2e 0a + + ~ "~" + 7e 0a + + ~ "~ There's also an implicit way to create a suffix" + ~ " comment, which is to have" + 7e 20 20 20 54 68 65 72 65 27 73 20 61 6c 73 6f + 20 61 6e 20 69 6d 70 6c 69 63 69 74 20 77 61 79 + 20 74 6f 20 63 72 65 61 74 65 20 61 20 73 75 66 + 66 69 78 20 63 6f 6d 6d 65 6e 74 2c 20 77 68 69 + 63 68 20 69 73 20 74 6f 20 68 61 76 65 0a + + ~ "~ non-blank words of any kind on the line prior to the" + ~ " magic comment. In this" + 7e 20 6e 6f 6e 2d 62 6c 61 6e 6b 20 77 6f 72 64 + 73 20 6f 66 20 61 6e 79 20 6b 69 6e 64 20 6f 6e + 20 74 68 65 20 6c 69 6e 65 20 70 72 69 6f 72 20 + 74 6f 20 74 68 65 20 6d 61 67 69 63 20 63 6f 6d + 6d 65 6e 74 2e 20 49 6e 20 74 68 69 73 0a + + ~ "~ case, the default is to be a suffix comment rather than a" + ~ " line comment." + 7e 20 63 61 73 65 2c 20 74 68 65 20 64 65 66 61 + 75 6c 74 20 69 73 20 74 6f 20 62 65 20 61 20 73 + 75 66 66 69 78 20 63 6f 6d 6d 65 6e 74 20 72 61 + 74 68 65 72 20 74 68 61 6e 20 61 20 6c 69 6e 65 + 20 63 6f 6d 6d 65 6e 74 2e 0a + + ~ "~ Suffix comments created this way will have zero length." + 7e 20 53 75 66 66 69 78 20 63 6f 6d 6d 65 6e 74 + 73 20 63 72 65 61 74 65 64 20 74 68 69 73 20 77 + 61 79 20 77 69 6c 6c 20 68 61 76 65 20 7a 65 72 + 6f 20 6c 65 6e 67 74 68 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Before we move on from magic comments that produce" + ~ " descriptive text, also" + 7e 20 20 20 42 65 66 6f 72 65 20 77 65 20 6d 6f + 76 65 20 6f 6e 20 66 72 6f 6d 20 6d 61 67 69 63 + 20 63 6f 6d 6d 65 6e 74 73 20 74 68 61 74 20 70 + 72 6f 64 75 63 65 20 64 65 73 63 72 69 70 74 69 + 76 65 20 74 65 78 74 2c 20 61 6c 73 6f 0a + + ~ "~ look at the third example above. This is another suffix" + ~ " comment, but it's" + 7e 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 74 68 + 69 72 64 20 65 78 61 6d 70 6c 65 20 61 62 6f 76 + 65 2e 20 54 68 69 73 20 69 73 20 61 6e 6f 74 68 + 65 72 20 73 75 66 66 69 78 20 63 6f 6d 6d 65 6e + 74 2c 20 62 75 74 20 69 74 27 73 0a + + ~ "~ got a negative number as its parameter. It's got a bit of" + ~ " code on the line" + 7e 20 67 6f 74 20 61 20 6e 65 67 61 74 69 76 65 + 20 6e 75 6d 62 65 72 20 61 73 20 69 74 73 20 70 + 61 72 61 6d 65 74 65 72 2e 20 49 74 27 73 20 67 + 6f 74 20 61 20 62 69 74 20 6f 66 20 63 6f 64 65 + 20 6f 6e 20 74 68 65 20 6c 69 6e 65 0a + + ~ "~ before it, to illustrate the typical way these negative" + ~ " parameters are used." + 7e 20 62 65 66 6f 72 65 20 69 74 2c 20 74 6f 20 + 69 6c 6c 75 73 74 72 61 74 65 20 74 68 65 20 74 + 79 70 69 63 61 6c 20 77 61 79 20 74 68 65 73 65 + 20 6e 65 67 61 74 69 76 65 20 70 61 72 61 6d 65 + 74 65 72 73 20 61 72 65 20 75 73 65 64 2e 0a + + ~ "~ Just as a suffix comment with a positive length describes" + ~ " a span of bytes" + 7e 20 4a 75 73 74 20 61 73 20 61 20 73 75 66 66 + 69 78 20 63 6f 6d 6d 65 6e 74 20 77 69 74 68 20 + 61 20 70 6f 73 69 74 69 76 65 20 6c 65 6e 67 74 + 68 20 64 65 73 63 72 69 62 65 73 20 61 20 73 70 + 61 6e 20 6f 66 20 62 79 74 65 73 0a + + ~ "~ with its start anchored at the address the comment is" + ~ " attached to, so when" + 7e 20 77 69 74 68 20 69 74 73 20 73 74 61 72 74 + 20 61 6e 63 68 6f 72 65 64 20 61 74 20 74 68 65 + 20 61 64 64 72 65 73 73 20 74 68 65 20 63 6f 6d + 6d 65 6e 74 20 69 73 20 61 74 74 61 63 68 65 64 + 20 74 6f 2c 20 73 6f 20 77 68 65 6e 0a + + ~ "~ the length is negative, the span of bytes has its END" + ~ " anchored at the" + 7e 20 74 68 65 20 6c 65 6e 67 74 68 20 69 73 20 + 6e 65 67 61 74 69 76 65 2c 20 74 68 65 20 73 70 + 61 6e 20 6f 66 20 62 79 74 65 73 20 68 61 73 20 + 69 74 73 20 45 4e 44 20 61 6e 63 68 6f 72 65 64 + 20 61 74 20 74 68 65 0a + + ~ "~ address." + 7e 20 61 64 64 72 65 73 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ You can see examples of how this syntax is useful in" + ~ " compilation/elf.e," + 7e 20 20 20 59 6f 75 20 63 61 6e 20 73 65 65 20 + 65 78 61 6d 70 6c 65 73 20 6f 66 20 68 6f 77 20 + 74 68 69 73 20 73 79 6e 74 61 78 20 69 73 20 75 + 73 65 66 75 6c 20 69 6e 20 63 6f 6d 70 69 6c 61 + 74 69 6f 6e 2f 65 6c 66 2e 65 2c 0a + + ~ "~ where it describes fields of various header structures." + ~ " When it fits the" + 7e 20 77 68 65 72 65 20 69 74 20 64 65 73 63 72 + 69 62 65 73 20 66 69 65 6c 64 73 20 6f 66 20 76 + 61 72 69 6f 75 73 20 68 65 61 64 65 72 20 73 74 + 72 75 63 74 75 72 65 73 2e 20 57 68 65 6e 20 69 + 74 20 66 69 74 73 20 74 68 65 0a + + ~ "~ situation, this notation is concise and easy to visually" + ~ " skim both in the" + 7e 20 73 69 74 75 61 74 69 6f 6e 2c 20 74 68 69 + 73 20 6e 6f 74 61 74 69 6f 6e 20 69 73 20 63 6f + 6e 63 69 73 65 20 61 6e 64 20 65 61 73 79 20 74 + 6f 20 76 69 73 75 61 6c 6c 79 20 73 6b 69 6d 20 + 62 6f 74 68 20 69 6e 20 74 68 65 0a + + ~ "~ actual source code, and in the generated hex dump." + 7e 20 61 63 74 75 61 6c 20 73 6f 75 72 63 65 20 + 63 6f 64 65 2c 20 61 6e 64 20 69 6e 20 74 68 65 + 20 67 65 6e 65 72 61 74 65 64 20 68 65 78 20 64 + 75 6d 70 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Now let's look at some magic comments that do more" + ~ " interesting things." + 7e 20 20 20 4e 6f 77 20 6c 65 74 27 73 20 6c 6f + 6f 6b 20 61 74 20 73 6f 6d 65 20 6d 61 67 69 63 + 20 63 6f 6d 6d 65 6e 74 73 20 74 68 61 74 20 64 + 6f 20 6d 6f 72 65 20 69 6e 74 65 72 65 73 74 69 + 6e 67 20 74 68 69 6e 67 73 2e 0a + + ~ "~ The two commands "indent" and "deindent" both create an" + ~ " entry of" + 7e 20 54 68 65 20 74 77 6f 20 63 6f 6d 6d 61 6e + 64 73 20 22 69 6e 64 65 6e 74 22 20 61 6e 64 20 + 22 64 65 69 6e 64 65 6e 74 22 20 62 6f 74 68 20 + 63 72 65 61 74 65 20 61 6e 20 65 6e 74 72 79 20 + 6f 66 0a + + ~ "~ -entry-type-indent. Neither takes a parameter as part of" + ~ " the comment syntax," + 7e 20 2d 65 6e 74 72 79 2d 74 79 70 65 2d 69 6e + 64 65 6e 74 2e 20 4e 65 69 74 68 65 72 20 74 61 + 6b 65 73 20 61 20 70 61 72 61 6d 65 74 65 72 20 + 61 73 20 70 61 72 74 20 6f 66 20 74 68 65 20 63 + 6f 6d 6d 65 6e 74 20 73 79 6e 74 61 78 2c 0a + + ~ "~ but the entry structure has an internal value which is" + ~ " set to 2 for "indent"" + 7e 20 62 75 74 20 74 68 65 20 65 6e 74 72 79 20 + 73 74 72 75 63 74 75 72 65 20 68 61 73 20 61 6e + 20 69 6e 74 65 72 6e 61 6c 20 76 61 6c 75 65 20 + 77 68 69 63 68 20 69 73 20 73 65 74 20 74 6f 20 + 32 20 66 6f 72 20 22 69 6e 64 65 6e 74 22 0a + + ~ "~ and -2 for "deindent". When output is eventually" + ~ " formatted, these entries" + 7e 20 61 6e 64 20 2d 32 20 66 6f 72 20 22 64 65 + 69 6e 64 65 6e 74 22 2e 20 57 68 65 6e 20 6f 75 + 74 70 75 74 20 69 73 20 65 76 65 6e 74 75 61 6c + 6c 79 20 66 6f 72 6d 61 74 74 65 64 2c 20 74 68 + 65 73 65 20 65 6e 74 72 69 65 73 0a + + ~ "~ will be used to adjust the amount of space at the" + ~ " beginning of each line," + 7e 20 77 69 6c 6c 20 62 65 20 75 73 65 64 20 74 + 6f 20 61 64 6a 75 73 74 20 74 68 65 20 61 6d 6f + 75 6e 74 20 6f 66 20 73 70 61 63 65 20 61 74 20 + 74 68 65 20 62 65 67 69 6e 6e 69 6e 67 20 6f 66 + 20 65 61 63 68 20 6c 69 6e 65 2c 0a + + ~ "~ which can be very useful to visually group code together." + ~ " The formatting" + 7e 20 77 68 69 63 68 20 63 61 6e 20 62 65 20 76 + 65 72 79 20 75 73 65 66 75 6c 20 74 6f 20 76 69 + 73 75 61 6c 6c 79 20 67 72 6f 75 70 20 63 6f 64 + 65 20 74 6f 67 65 74 68 65 72 2e 20 54 68 65 20 + 66 6f 72 6d 61 74 74 69 6e 67 0a + + ~ "~ process has some mutable state of its own, which doesn't" + ~ " exist until this" + 7e 20 70 72 6f 63 65 73 73 20 68 61 73 20 73 6f + 6d 65 20 6d 75 74 61 62 6c 65 20 73 74 61 74 65 + 20 6f 66 20 69 74 73 20 6f 77 6e 2c 20 77 68 69 + 63 68 20 64 6f 65 73 6e 27 74 20 65 78 69 73 74 + 20 75 6e 74 69 6c 20 74 68 69 73 0a + + ~ "~ very late stage (long after magic comments execute);" + ~ " among other things," + 7e 20 76 65 72 79 20 6c 61 74 65 20 73 74 61 67 + 65 20 28 6c 6f 6e 67 20 61 66 74 65 72 20 6d 61 + 67 69 63 20 63 6f 6d 6d 65 6e 74 73 20 65 78 65 + 63 75 74 65 29 3b 20 61 6d 6f 6e 67 20 6f 74 68 + 65 72 20 74 68 69 6e 67 73 2c 0a + + ~ "~ there's a notion of current indentation level, which is" + ~ " preserved until" + 7e 20 74 68 65 72 65 27 73 20 61 20 6e 6f 74 69 + 6f 6e 20 6f 66 20 63 75 72 72 65 6e 74 20 69 6e + 64 65 6e 74 61 74 69 6f 6e 20 6c 65 76 65 6c 2c + 20 77 68 69 63 68 20 69 73 20 70 72 65 73 65 72 + 76 65 64 20 75 6e 74 69 6c 0a + + ~ "~ these entries adjust it." + 7e 20 74 68 65 73 65 20 65 6e 74 72 69 65 73 20 + 61 64 6a 75 73 74 20 69 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The commands "fresh-line" and "blank-line" create" + ~ " entries of" + 7e 20 20 20 54 68 65 20 63 6f 6d 6d 61 6e 64 73 + 20 22 66 72 65 73 68 2d 6c 69 6e 65 22 20 61 6e + 64 20 22 62 6c 61 6e 6b 2d 6c 69 6e 65 22 20 63 + 72 65 61 74 65 20 65 6e 74 72 69 65 73 20 6f 66 + 0a + + ~ "~ -entry-type-fresh-line and -entry-type-blank-line," + ~ " respectively. Just as the" + 7e 20 2d 65 6e 74 72 79 2d 74 79 70 65 2d 66 72 + 65 73 68 2d 6c 69 6e 65 20 61 6e 64 20 2d 65 6e + 74 72 79 2d 74 79 70 65 2d 62 6c 61 6e 6b 2d 6c + 69 6e 65 2c 20 72 65 73 70 65 63 74 69 76 65 6c + 79 2e 20 4a 75 73 74 20 61 73 20 74 68 65 0a + + ~ "~ output formatting knows how deeply indented it is, it" + ~ " also knows whether" + 7e 20 6f 75 74 70 75 74 20 66 6f 72 6d 61 74 74 + 69 6e 67 20 6b 6e 6f 77 73 20 68 6f 77 20 64 65 + 65 70 6c 79 20 69 6e 64 65 6e 74 65 64 20 69 74 + 20 69 73 2c 20 69 74 20 61 6c 73 6f 20 6b 6e 6f + 77 73 20 77 68 65 74 68 65 72 0a + + ~ "~ it's at the start of a line. A fresh-line entry will" + ~ " insert a line break," + 7e 20 69 74 27 73 20 61 74 20 74 68 65 20 73 74 + 61 72 74 20 6f 66 20 61 20 6c 69 6e 65 2e 20 41 + 20 66 72 65 73 68 2d 6c 69 6e 65 20 65 6e 74 72 + 79 20 77 69 6c 6c 20 69 6e 73 65 72 74 20 61 20 + 6c 69 6e 65 20 62 72 65 61 6b 2c 0a + + ~ "~ but only if we're somewhere deep in a line; if we're" + ~ " already at the start," + 7e 20 62 75 74 20 6f 6e 6c 79 20 69 66 20 77 65 + 27 72 65 20 73 6f 6d 65 77 68 65 72 65 20 64 65 + 65 70 20 69 6e 20 61 20 6c 69 6e 65 3b 20 69 66 + 20 77 65 27 72 65 20 61 6c 72 65 61 64 79 20 61 + 74 20 74 68 65 20 73 74 61 72 74 2c 0a + + ~ "~ it does nothing. A blank-line entry will do the same" + ~ " thing as fresh-line," + 7e 20 69 74 20 64 6f 65 73 20 6e 6f 74 68 69 6e + 67 2e 20 41 20 62 6c 61 6e 6b 2d 6c 69 6e 65 20 + 65 6e 74 72 79 20 77 69 6c 6c 20 64 6f 20 74 68 + 65 20 73 61 6d 65 20 74 68 69 6e 67 20 61 73 20 + 66 72 65 73 68 2d 6c 69 6e 65 2c 0a + + ~ "~ then it will add another line break, so that the result" + ~ " is to output a fully" + 7e 20 74 68 65 6e 20 69 74 20 77 69 6c 6c 20 61 + 64 64 20 61 6e 6f 74 68 65 72 20 6c 69 6e 65 20 + 62 72 65 61 6b 2c 20 73 6f 20 74 68 61 74 20 74 + 68 65 20 72 65 73 75 6c 74 20 69 73 20 74 6f 20 + 6f 75 74 70 75 74 20 61 20 66 75 6c 6c 79 0a + + ~ "~ blank line in the hex dump. This can be useful to break" + ~ " things up visually." + 7e 20 62 6c 61 6e 6b 20 6c 69 6e 65 20 69 6e 20 + 74 68 65 20 68 65 78 20 64 75 6d 70 2e 20 54 68 + 69 73 20 63 61 6e 20 62 65 20 75 73 65 66 75 6c + 20 74 6f 20 62 72 65 61 6b 20 74 68 69 6e 67 73 + 20 75 70 20 76 69 73 75 61 6c 6c 79 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Thus far, though we've taken pains to allude to the" + ~ " fact that there are" + 7e 20 20 20 54 68 75 73 20 66 61 72 2c 20 74 68 + 6f 75 67 68 20 77 65 27 76 65 20 74 61 6b 65 6e + 20 70 61 69 6e 73 20 74 6f 20 61 6c 6c 75 64 65 + 20 74 6f 20 74 68 65 20 66 61 63 74 20 74 68 61 + 74 20 74 68 65 72 65 20 61 72 65 0a + + ~ "~ many stages of processing of metadata entries after" + ~ " they're created, we" + 7e 20 6d 61 6e 79 20 73 74 61 67 65 73 20 6f 66 + 20 70 72 6f 63 65 73 73 69 6e 67 20 6f 66 20 6d + 65 74 61 64 61 74 61 20 65 6e 74 72 69 65 73 20 + 61 66 74 65 72 20 74 68 65 79 27 72 65 20 63 72 + 65 61 74 65 64 2c 20 77 65 0a + + ~ "~ haven't introduced any interesting features that rely on" + ~ " that. That changes" + 7e 20 68 61 76 65 6e 27 74 20 69 6e 74 72 6f 64 + 75 63 65 64 20 61 6e 79 20 69 6e 74 65 72 65 73 + 74 69 6e 67 20 66 65 61 74 75 72 65 73 20 74 68 + 61 74 20 72 65 6c 79 20 6f 6e 20 74 68 61 74 2e + 20 54 68 61 74 20 63 68 61 6e 67 65 73 0a + + ~ "~ with the "adjust-line" command. When this command" + ~ " executes, it doesn't" + 7e 20 77 69 74 68 20 74 68 65 20 22 61 64 6a 75 + 73 74 2d 6c 69 6e 65 22 20 63 6f 6d 6d 61 6e 64 + 2e 20 57 68 65 6e 20 74 68 69 73 20 63 6f 6d 6d + 61 6e 64 20 65 78 65 63 75 74 65 73 2c 20 69 74 + 20 64 6f 65 73 6e 27 74 0a + + ~ "~ create a new metadata entry. Rather, it scans backwards" + ~ " from the end of the" + 7e 20 63 72 65 61 74 65 20 61 20 6e 65 77 20 6d + 65 74 61 64 61 74 61 20 65 6e 74 72 79 2e 20 52 + 61 74 68 65 72 2c 20 69 74 20 73 63 61 6e 73 20 + 62 61 63 6b 77 61 72 64 73 20 66 72 6f 6d 20 74 + 68 65 20 65 6e 64 20 6f 66 20 74 68 65 0a + + ~ "~ entry array, to find the most recently-created entry" + ~ " which is a line or" + 7e 20 65 6e 74 72 79 20 61 72 72 61 79 2c 20 74 + 6f 20 66 69 6e 64 20 74 68 65 20 6d 6f 73 74 20 + 72 65 63 65 6e 74 6c 79 2d 63 72 65 61 74 65 64 + 20 65 6e 74 72 79 20 77 68 69 63 68 20 69 73 20 + 61 20 6c 69 6e 65 20 6f 72 0a + + ~ "~ suffix comment. It skips over entries of other types." + ~ " Then it adjusts the" + 7e 20 73 75 66 66 69 78 20 63 6f 6d 6d 65 6e 74 + 2e 20 49 74 20 73 6b 69 70 73 20 6f 76 65 72 20 + 65 6e 74 72 69 65 73 20 6f 66 20 6f 74 68 65 72 + 20 74 79 70 65 73 2e 20 54 68 65 6e 20 69 74 20 + 61 64 6a 75 73 74 73 20 74 68 65 0a + + ~ "~ length of that entry, in-place! The parameter of" + ~ " adjust-line may be positive" + 7e 20 6c 65 6e 67 74 68 20 6f 66 20 74 68 61 74 + 20 65 6e 74 72 79 2c 20 69 6e 2d 70 6c 61 63 65 + 21 20 54 68 65 20 70 61 72 61 6d 65 74 65 72 20 + 6f 66 20 61 64 6a 75 73 74 2d 6c 69 6e 65 20 6d + 61 79 20 62 65 20 70 6f 73 69 74 69 76 65 0a + + ~ "~ or negative, and either way it's added to the" + ~ " pre-existing length of the" + 7e 20 6f 72 20 6e 65 67 61 74 69 76 65 2c 20 61 + 6e 64 20 65 69 74 68 65 72 20 77 61 79 20 69 74 + 27 73 20 61 64 64 65 64 20 74 6f 20 74 68 65 20 + 70 72 65 2d 65 78 69 73 74 69 6e 67 20 6c 65 6e + 67 74 68 20 6f 66 20 74 68 65 0a + + ~ "~ entry it modifies." + 7e 20 65 6e 74 72 79 20 69 74 20 6d 6f 64 69 66 + 69 65 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ If that doesn't sound confusing, you may not have fully" + ~ " appreciated that" + 7e 20 20 20 49 66 20 74 68 61 74 20 64 6f 65 73 + 6e 27 74 20 73 6f 75 6e 64 20 63 6f 6e 66 75 73 + 69 6e 67 2c 20 79 6f 75 20 6d 61 79 20 6e 6f 74 + 20 68 61 76 65 20 66 75 6c 6c 79 20 61 70 70 72 + 65 63 69 61 74 65 64 20 74 68 61 74 0a + + ~ "~ adjust-line commands don't have to come in the same word" + ~ " as the command that" + 7e 20 61 64 6a 75 73 74 2d 6c 69 6e 65 20 63 6f + 6d 6d 61 6e 64 73 20 64 6f 6e 27 74 20 68 61 76 + 65 20 74 6f 20 63 6f 6d 65 20 69 6e 20 74 68 65 + 20 73 61 6d 65 20 77 6f 72 64 20 61 73 20 74 68 + 65 20 63 6f 6d 6d 61 6e 64 20 74 68 61 74 0a + + ~ "~ created the entry they're modifying. For example, in" + 7e 20 63 72 65 61 74 65 64 20 74 68 65 20 65 6e + 74 72 79 20 74 68 65 79 27 72 65 20 6d 6f 64 69 + 66 79 69 6e 67 2e 20 46 6f 72 20 65 78 61 6d 70 + 6c 65 2c 20 69 6e 0a + + ~ "~ language/static/amd64.e, rex-w is a common helper word" + ~ " called as part of" + 7e 20 6c 61 6e 67 75 61 67 65 2f 73 74 61 74 69 + 63 2f 61 6d 64 36 34 2e 65 2c 20 72 65 78 2d 77 + 20 69 73 20 61 20 63 6f 6d 6d 6f 6e 20 68 65 6c + 70 65 72 20 77 6f 72 64 20 63 61 6c 6c 65 64 20 + 61 73 20 70 61 72 74 20 6f 66 0a + + ~ "~ many assembly instructions. It always outputs a single" + ~ " byte. Commentary in" + 7e 20 6d 61 6e 79 20 61 73 73 65 6d 62 6c 79 20 + 69 6e 73 74 72 75 63 74 69 6f 6e 73 2e 20 49 74 + 20 61 6c 77 61 79 73 20 6f 75 74 70 75 74 73 20 + 61 20 73 69 6e 67 6c 65 20 62 79 74 65 2e 20 43 + 6f 6d 6d 65 6e 74 61 72 79 20 69 6e 0a + + ~ "~ that file describes an accounting convention whereby" + ~ " keeping track of this" + 7e 20 74 68 61 74 20 66 69 6c 65 20 64 65 73 63 + 72 69 62 65 73 20 61 6e 20 61 63 63 6f 75 6e 74 + 69 6e 67 20 63 6f 6e 76 65 6e 74 69 6f 6e 20 77 + 68 65 72 65 62 79 20 6b 65 65 70 69 6e 67 20 74 + 72 61 63 6b 20 6f 66 20 74 68 69 73 0a + + ~ "~ byte is rex-w's job, so rex-w also has a magic comment" + ~ " with an adjust-length" + 7e 20 62 79 74 65 20 69 73 20 72 65 78 2d 77 27 + 73 20 6a 6f 62 2c 20 73 6f 20 72 65 78 2d 77 20 + 61 6c 73 6f 20 68 61 73 20 61 20 6d 61 67 69 63 + 20 63 6f 6d 6d 65 6e 74 20 77 69 74 68 20 61 6e + 20 61 64 6a 75 73 74 2d 6c 65 6e 67 74 68 0a + + ~ "~ command. Whatever word calls rex-w will have already" + ~ " created a suffix" + 7e 20 63 6f 6d 6d 61 6e 64 2e 20 57 68 61 74 65 + 76 65 72 20 77 6f 72 64 20 63 61 6c 6c 73 20 72 + 65 78 2d 77 20 77 69 6c 6c 20 68 61 76 65 20 61 + 6c 72 65 61 64 79 20 63 72 65 61 74 65 64 20 61 + 20 73 75 66 66 69 78 0a + + ~ "~ comment giving the name of the instruction it's" + ~ " implementing, by the time" + 7e 20 63 6f 6d 6d 65 6e 74 20 67 69 76 69 6e 67 + 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 65 + 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 69 74 27 + 73 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 2c 20 + 62 79 20 74 68 65 20 74 69 6d 65 0a + + ~ "~ this is called, and rex-w's call to adjust-length will" + ~ " find that comment's" + 7e 20 74 68 69 73 20 69 73 20 63 61 6c 6c 65 64 + 2c 20 61 6e 64 20 72 65 78 2d 77 27 73 20 63 61 + 6c 6c 20 74 6f 20 61 64 6a 75 73 74 2d 6c 65 6e + 67 74 68 20 77 69 6c 6c 20 66 69 6e 64 20 74 68 + 61 74 20 63 6f 6d 6d 65 6e 74 27 73 0a + + ~ "~ entry and modify it." + 7e 20 65 6e 74 72 79 20 61 6e 64 20 6d 6f 64 69 + 66 79 20 69 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The use of this may not seem like much for a word like" + ~ " rex-w, which always" + 7e 20 20 20 54 68 65 20 75 73 65 20 6f 66 20 74 + 68 69 73 20 6d 61 79 20 6e 6f 74 20 73 65 65 6d + 20 6c 69 6b 65 20 6d 75 63 68 20 66 6f 72 20 61 + 20 77 6f 72 64 20 6c 69 6b 65 20 72 65 78 2d 77 + 2c 20 77 68 69 63 68 20 61 6c 77 61 79 73 0a + + ~ "~ outputs the same number of bytes, but now look at the" + ~ " definition of" + 7e 20 6f 75 74 70 75 74 73 20 74 68 65 20 73 61 + 6d 65 20 6e 75 6d 62 65 72 20 6f 66 20 62 79 74 + 65 73 2c 20 62 75 74 20 6e 6f 77 20 6c 6f 6f 6b + 20 61 74 20 74 68 65 20 64 65 66 69 6e 69 74 69 + 6f 6e 20 6f 66 0a + + ~ "~ addressing-indirect-reg64. This is a common addressing" + ~ " mode shared by many" + 7e 20 61 64 64 72 65 73 73 69 6e 67 2d 69 6e 64 + 69 72 65 63 74 2d 72 65 67 36 34 2e 20 54 68 69 + 73 20 69 73 20 61 20 63 6f 6d 6d 6f 6e 20 61 64 + 64 72 65 73 73 69 6e 67 20 6d 6f 64 65 20 73 68 + 61 72 65 64 20 62 79 20 6d 61 6e 79 0a + + ~ "~ instructions, and called as a helper from various" + ~ " instruction words. Notice" + 7e 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 2c 20 + 61 6e 64 20 63 61 6c 6c 65 64 20 61 73 20 61 20 + 68 65 6c 70 65 72 20 66 72 6f 6d 20 76 61 72 69 + 6f 75 73 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 + 77 6f 72 64 73 2e 20 4e 6f 74 69 63 65 0a + + ~ "~ how it has to generate a different encoding when it's" + ~ " given the register" + 7e 20 68 6f 77 20 69 74 20 68 61 73 20 74 6f 20 + 67 65 6e 65 72 61 74 65 20 61 20 64 69 66 66 65 + 72 65 6e 74 20 65 6e 63 6f 64 69 6e 67 20 77 68 + 65 6e 20 69 74 27 73 20 67 69 76 65 6e 20 74 68 + 65 20 72 65 67 69 73 74 65 72 0a + + ~ "~ :rsp, which has an extra SIB byte that's not needed for" + ~ " any other register." + 7e 20 3a 72 73 70 2c 20 77 68 69 63 68 20 68 61 + 73 20 61 6e 20 65 78 74 72 61 20 53 49 42 20 62 + 79 74 65 20 74 68 61 74 27 73 20 6e 6f 74 20 6e + 65 65 64 65 64 20 66 6f 72 20 61 6e 79 20 6f 74 + 68 65 72 20 72 65 67 69 73 74 65 72 2e 0a + + ~ "~ There's no magic comments in addressing-indirect-reg64" + ~ " itself, but the word" + 7e 20 54 68 65 72 65 27 73 20 6e 6f 20 6d 61 67 + 69 63 20 63 6f 6d 6d 65 6e 74 73 20 69 6e 20 61 + 64 64 72 65 73 73 69 6e 67 2d 69 6e 64 69 72 65 + 63 74 2d 72 65 67 36 34 20 69 74 73 65 6c 66 2c + 20 62 75 74 20 74 68 65 20 77 6f 72 64 0a + + ~ "~ "sib" is another helper which does an appropriate" + ~ " adjust-length, if and only" + 7e 20 22 73 69 62 22 20 69 73 20 61 6e 6f 74 68 + 65 72 20 68 65 6c 70 65 72 20 77 68 69 63 68 20 + 64 6f 65 73 20 61 6e 20 61 70 70 72 6f 70 72 69 + 61 74 65 20 61 64 6a 75 73 74 2d 6c 65 6e 67 74 + 68 2c 20 69 66 20 61 6e 64 20 6f 6e 6c 79 0a + + ~ "~ if sib is actually called." + 7e 20 69 66 20 73 69 62 20 69 73 20 61 63 74 75 + 61 6c 6c 79 20 63 61 6c 6c 65 64 2e 0a + + ~ "~" + 7e 0a + + ~ "~ You can see how it might become quite confusing trying" + ~ " to decide which" + 7e 20 20 20 59 6f 75 20 63 61 6e 20 73 65 65 20 + 68 6f 77 20 69 74 20 6d 69 67 68 74 20 62 65 63 + 6f 6d 65 20 71 75 69 74 65 20 63 6f 6e 66 75 73 + 69 6e 67 20 74 72 79 69 6e 67 20 74 6f 20 64 65 + 63 69 64 65 20 77 68 69 63 68 0a + + ~ "~ word should take responsibility for a particular byte," + ~ " when there are" + 7e 20 77 6f 72 64 20 73 68 6f 75 6c 64 20 74 61 + 6b 65 20 72 65 73 70 6f 6e 73 69 62 69 6c 69 74 + 79 20 66 6f 72 20 61 20 70 61 72 74 69 63 75 6c + 61 72 20 62 79 74 65 2c 20 77 68 65 6e 20 74 68 + 65 72 65 20 61 72 65 0a + + ~ "~ multiple layers of abstraction like this. It's especially" + ~ " confusing because" + 7e 20 6d 75 6c 74 69 70 6c 65 20 6c 61 79 65 72 + 73 20 6f 66 20 61 62 73 74 72 61 63 74 69 6f 6e + 20 6c 69 6b 65 20 74 68 69 73 2e 20 49 74 27 73 + 20 65 73 70 65 63 69 61 6c 6c 79 20 63 6f 6e 66 + 75 73 69 6e 67 20 62 65 63 61 75 73 65 0a + + ~ "~ this is an extra form of side-effect which acts on global" + ~ " mutable state, and" + 7e 20 74 68 69 73 20 69 73 20 61 6e 20 65 78 74 + 72 61 20 66 6f 72 6d 20 6f 66 20 73 69 64 65 2d + 65 66 66 65 63 74 20 77 68 69 63 68 20 61 63 74 + 73 20 6f 6e 20 67 6c 6f 62 61 6c 20 6d 75 74 61 + 62 6c 65 20 73 74 61 74 65 2c 20 61 6e 64 0a + + ~ "~ is out-of-band compared to the normal Forth value stack." + ~ " When you're" + 7e 20 69 73 20 6f 75 74 2d 6f 66 2d 62 61 6e 64 + 20 63 6f 6d 70 61 72 65 64 20 74 6f 20 74 68 65 + 20 6e 6f 72 6d 61 6c 20 46 6f 72 74 68 20 76 61 + 6c 75 65 20 73 74 61 63 6b 2e 20 57 68 65 6e 20 + 79 6f 75 27 72 65 0a + + ~ "~ implementing an instruction set architecture, you should" + ~ " strongly consider" + 7e 20 69 6d 70 6c 65 6d 65 6e 74 69 6e 67 20 61 + 6e 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 73 65 + 74 20 61 72 63 68 69 74 65 63 74 75 72 65 2c 20 + 79 6f 75 20 73 68 6f 75 6c 64 20 73 74 72 6f 6e + 67 6c 79 20 63 6f 6e 73 69 64 65 72 0a + + ~ "~ defining an accounting convention which makes that clear" + ~ " and unambiguous." + 7e 20 64 65 66 69 6e 69 6e 67 20 61 6e 20 61 63 + 63 6f 75 6e 74 69 6e 67 20 63 6f 6e 76 65 6e 74 + 69 6f 6e 20 77 68 69 63 68 20 6d 61 6b 65 73 20 + 74 68 61 74 20 63 6c 65 61 72 20 61 6e 64 20 75 + 6e 61 6d 62 69 67 75 6f 75 73 2e 0a + + ~ "~ Feel free to consult the convention described at the top" + ~ " of" + 7e 20 46 65 65 6c 20 66 72 65 65 20 74 6f 20 63 + 6f 6e 73 75 6c 74 20 74 68 65 20 63 6f 6e 76 65 + 6e 74 69 6f 6e 20 64 65 73 63 72 69 62 65 64 20 + 61 74 20 74 68 65 20 74 6f 70 20 6f 66 0a + + ~ "~ language/static/amd64.e for inspiration." + 7e 20 6c 61 6e 67 75 61 67 65 2f 73 74 61 74 69 + 63 2f 61 6d 64 36 34 2e 65 20 66 6f 72 20 69 6e + 73 70 69 72 61 74 69 6f 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ All the adjust-* commands change something immediately," + ~ " as they execute." + 7e 20 20 20 41 6c 6c 20 74 68 65 20 61 64 6a 75 + 73 74 2d 2a 20 63 6f 6d 6d 61 6e 64 73 20 63 68 + 61 6e 67 65 20 73 6f 6d 65 74 68 69 6e 67 20 69 + 6d 6d 65 64 69 61 74 65 6c 79 2c 20 61 73 20 74 + 68 65 79 20 65 78 65 63 75 74 65 2e 0a + + ~ "~ What they adjust differs. In the cases of adjust-length" + ~ " and adjust-start," + 7e 20 57 68 61 74 20 74 68 65 79 20 61 64 6a 75 + 73 74 20 64 69 66 66 65 72 73 2e 20 49 6e 20 74 + 68 65 20 63 61 73 65 73 20 6f 66 20 61 64 6a 75 + 73 74 2d 6c 65 6e 67 74 68 20 61 6e 64 20 61 64 + 6a 75 73 74 2d 73 74 61 72 74 2c 0a + + ~ "~ it's a field of a recent entry. Notionally, adjust-start" + ~ " does the same thing" + 7e 20 69 74 27 73 20 61 20 66 69 65 6c 64 20 6f + 66 20 61 20 72 65 63 65 6e 74 20 65 6e 74 72 79 + 2e 20 4e 6f 74 69 6f 6e 61 6c 6c 79 2c 20 61 64 + 6a 75 73 74 2d 73 74 61 72 74 20 64 6f 65 73 20 + 74 68 65 20 73 61 6d 65 20 74 68 69 6e 67 0a + + ~ "~ as adjust-length but for the start address the entry is" + ~ " attached to, rather" + 7e 20 61 73 20 61 64 6a 75 73 74 2d 6c 65 6e 67 + 74 68 20 62 75 74 20 66 6f 72 20 74 68 65 20 73 + 74 61 72 74 20 61 64 64 72 65 73 73 20 74 68 65 + 20 65 6e 74 72 79 20 69 73 20 61 74 74 61 63 68 + 65 64 20 74 6f 2c 20 72 61 74 68 65 72 0a + + ~ "~ than the length of the attachment. Also, while" + ~ " adjust-length only affects" + 7e 20 74 68 61 6e 20 74 68 65 20 6c 65 6e 67 74 + 68 20 6f 66 20 74 68 65 20 61 74 74 61 63 68 6d + 65 6e 74 2e 20 41 6c 73 6f 2c 20 77 68 69 6c 65 + 20 61 64 6a 75 73 74 2d 6c 65 6e 67 74 68 20 6f + 6e 6c 79 20 61 66 66 65 63 74 73 0a + + ~ "~ comment entries, adjust-start affects any entry that" + ~ " produces output, such" + 7e 20 63 6f 6d 6d 65 6e 74 20 65 6e 74 72 69 65 + 73 2c 20 61 64 6a 75 73 74 2d 73 74 61 72 74 20 + 61 66 66 65 63 74 73 20 61 6e 79 20 65 6e 74 72 + 79 20 74 68 61 74 20 70 72 6f 64 75 63 65 73 20 + 6f 75 74 70 75 74 2c 20 73 75 63 68 0a + + ~ "~ as fresh-line." + 7e 20 61 73 20 66 72 65 73 68 2d 6c 69 6e 65 2e + 0a + + ~ "~" + 7e 0a + + ~ "~ The various -output-point commands are used to directly" + ~ " interact with the" + 7e 20 20 20 54 68 65 20 76 61 72 69 6f 75 73 20 + 2d 6f 75 74 70 75 74 2d 70 6f 69 6e 74 20 63 6f + 6d 6d 61 6e 64 73 20 61 72 65 20 75 73 65 64 20 + 74 6f 20 64 69 72 65 63 74 6c 79 20 69 6e 74 65 + 72 61 63 74 20 77 69 74 68 20 74 68 65 0a + + ~ "~ notion of the latest output point, which can be useful if" + ~ " a location has" + 7e 20 6e 6f 74 69 6f 6e 20 6f 66 20 74 68 65 20 + 6c 61 74 65 73 74 20 6f 75 74 70 75 74 20 70 6f + 69 6e 74 2c 20 77 68 69 63 68 20 63 61 6e 20 62 + 65 20 75 73 65 66 75 6c 20 69 66 20 61 20 6c 6f + 63 61 74 69 6f 6e 20 68 61 73 0a + + ~ "~ been skipped over and there are commands which should be" + ~ " run before" + 7e 20 62 65 65 6e 20 73 6b 69 70 70 65 64 20 6f + 76 65 72 20 61 6e 64 20 74 68 65 72 65 20 61 72 + 65 20 63 6f 6d 6d 61 6e 64 73 20 77 68 69 63 68 + 20 73 68 6f 75 6c 64 20 62 65 20 72 75 6e 20 62 + 65 66 6f 72 65 0a + + ~ "~ outputting anything at the new location. The simplest" + ~ " variant is" + 7e 20 6f 75 74 70 75 74 74 69 6e 67 20 61 6e 79 + 74 68 69 6e 67 20 61 74 20 74 68 65 20 6e 65 77 + 20 6c 6f 63 61 74 69 6f 6e 2e 20 54 68 65 20 73 + 69 6d 70 6c 65 73 74 20 76 61 72 69 61 6e 74 20 + 69 73 0a + + ~ "~ set-output-point, which sets it to the parameter value." + ~ " The data-set-" + 7e 20 73 65 74 2d 6f 75 74 70 75 74 2d 70 6f 69 + 6e 74 2c 20 77 68 69 63 68 20 73 65 74 73 20 69 + 74 20 74 6f 20 74 68 65 20 70 61 72 61 6d 65 74 + 65 72 20 76 61 6c 75 65 2e 20 54 68 65 20 64 61 + 74 61 2d 73 65 74 2d 0a + + ~ "~ variant obtains a value in the manner of the other data-*" + ~ " commands, adds it" + 7e 20 76 61 72 69 61 6e 74 20 6f 62 74 61 69 6e + 73 20 61 20 76 61 6c 75 65 20 69 6e 20 74 68 65 + 20 6d 61 6e 6e 65 72 20 6f 66 20 74 68 65 20 6f + 74 68 65 72 20 64 61 74 61 2d 2a 20 63 6f 6d 6d + 61 6e 64 73 2c 20 61 64 64 73 20 69 74 0a + + ~ "~ to the parameter value, and sets the latest output point" + ~ " to the result. The" + 7e 20 74 6f 20 74 68 65 20 70 61 72 61 6d 65 74 + 65 72 20 76 61 6c 75 65 2c 20 61 6e 64 20 73 65 + 74 73 20 74 68 65 20 6c 61 74 65 73 74 20 6f 75 + 74 70 75 74 20 70 6f 69 6e 74 20 74 6f 20 74 68 + 65 20 72 65 73 75 6c 74 2e 20 54 68 65 0a + + ~ "~ adjust- and data-adjust- variants, like other adjust" + ~ " commands, add a value" + 7e 20 61 64 6a 75 73 74 2d 20 61 6e 64 20 64 61 + 74 61 2d 61 64 6a 75 73 74 2d 20 76 61 72 69 61 + 6e 74 73 2c 20 6c 69 6b 65 20 6f 74 68 65 72 20 + 61 64 6a 75 73 74 20 63 6f 6d 6d 61 6e 64 73 2c + 20 61 64 64 20 61 20 76 61 6c 75 65 0a + + ~ "~ to the existing one." + 7e 20 74 6f 20 74 68 65 20 65 78 69 73 74 69 6e + 67 20 6f 6e 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Notice that the general rule is that data-set-*" + ~ " commands use their" + 7e 20 20 20 4e 6f 74 69 63 65 20 74 68 61 74 20 + 74 68 65 20 67 65 6e 65 72 61 6c 20 72 75 6c 65 + 20 69 73 20 74 68 61 74 20 64 61 74 61 2d 73 65 + 74 2d 2a 20 63 6f 6d 6d 61 6e 64 73 20 75 73 65 + 20 74 68 65 69 72 0a + + ~ "~ parameter as an addend, while data-adjust-* commands use" + ~ " it as a multiplier." + 7e 20 70 61 72 61 6d 65 74 65 72 20 61 73 20 61 + 6e 20 61 64 64 65 6e 64 2c 20 77 68 69 6c 65 20 + 64 61 74 61 2d 61 64 6a 75 73 74 2d 2a 20 63 6f + 6d 6d 61 6e 64 73 20 75 73 65 20 69 74 20 61 73 + 20 61 20 6d 75 6c 74 69 70 6c 69 65 72 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The data-adjust-* variants deserve further commentary," + ~ " though you may find" + 7e 20 20 20 54 68 65 20 64 61 74 61 2d 61 64 6a + 75 73 74 2d 2a 20 76 61 72 69 61 6e 74 73 20 64 + 65 73 65 72 76 65 20 66 75 72 74 68 65 72 20 63 + 6f 6d 6d 65 6e 74 61 72 79 2c 20 74 68 6f 75 67 + 68 20 79 6f 75 20 6d 61 79 20 66 69 6e 64 0a + + ~ "~ it more productive to read and understand the entire" + ~ " explanation about" + 7e 20 69 74 20 6d 6f 72 65 20 70 72 6f 64 75 63 + 74 69 76 65 20 74 6f 20 72 65 61 64 20 61 6e 64 + 20 75 6e 64 65 72 73 74 61 6e 64 20 74 68 65 20 + 65 6e 74 69 72 65 20 65 78 70 6c 61 6e 61 74 69 + 6f 6e 20 61 62 6f 75 74 0a + + ~ "~ provide-* commands before worrying about these. These" + ~ " variants adjust the" + 7e 20 70 72 6f 76 69 64 65 2d 2a 20 63 6f 6d 6d + 61 6e 64 73 20 62 65 66 6f 72 65 20 77 6f 72 72 + 79 69 6e 67 20 61 62 6f 75 74 20 74 68 65 73 65 + 2e 20 54 68 65 73 65 20 76 61 72 69 61 6e 74 73 + 20 61 64 6a 75 73 74 20 74 68 65 0a + + ~ "~ same things as the non-data ones, but instead of" + ~ " adjusting by a fixed" + 7e 20 73 61 6d 65 20 74 68 69 6e 67 73 20 61 73 + 20 74 68 65 20 6e 6f 6e 2d 64 61 74 61 20 6f 6e + 65 73 2c 20 62 75 74 20 69 6e 73 74 65 61 64 20 + 6f 66 20 61 64 6a 75 73 74 69 6e 67 20 62 79 20 + 61 20 66 69 78 65 64 0a + + ~ "~ amount, they look for the most recent" + ~ " -entry-type-saved-data metadata entry." + 7e 20 61 6d 6f 75 6e 74 2c 20 74 68 65 79 20 6c + 6f 6f 6b 20 66 6f 72 20 74 68 65 20 6d 6f 73 74 + 20 72 65 63 65 6e 74 20 2d 65 6e 74 72 79 2d 74 + 79 70 65 2d 73 61 76 65 64 2d 64 61 74 61 20 6d + 65 74 61 64 61 74 61 20 65 6e 74 72 79 2e 0a + + ~ "~ They delete that entry from the entry array entirely, and" + ~ " use the value" + 7e 20 54 68 65 79 20 64 65 6c 65 74 65 20 74 68 + 61 74 20 65 6e 74 72 79 20 66 72 6f 6d 20 74 68 + 65 20 65 6e 74 72 79 20 61 72 72 61 79 20 65 6e + 74 69 72 65 6c 79 2c 20 61 6e 64 20 75 73 65 20 + 74 68 65 20 76 61 6c 75 65 0a + + ~ "~ saved in it as the amount to adjust by. Such entries are" + ~ " created by the" + 7e 20 73 61 76 65 64 20 69 6e 20 69 74 20 61 73 + 20 74 68 65 20 61 6d 6f 75 6e 74 20 74 6f 20 61 + 64 6a 75 73 74 20 62 79 2e 20 53 75 63 68 20 65 + 6e 74 72 69 65 73 20 61 72 65 20 63 72 65 61 74 + 65 64 20 62 79 20 74 68 65 0a + + ~ "~ provide-data command, on which more below. Additionally," + ~ " the data-adjust-*" + 7e 20 70 72 6f 76 69 64 65 2d 64 61 74 61 20 63 + 6f 6d 6d 61 6e 64 2c 20 6f 6e 20 77 68 69 63 68 + 20 6d 6f 72 65 20 62 65 6c 6f 77 2e 20 41 64 64 + 69 74 69 6f 6e 61 6c 6c 79 2c 20 74 68 65 20 64 + 61 74 61 2d 61 64 6a 75 73 74 2d 2a 0a + + ~ "~ commands use their parameters as scaling factors to the" + ~ " adjustment, and" + 7e 20 63 6f 6d 6d 61 6e 64 73 20 75 73 65 20 74 + 68 65 69 72 20 70 61 72 61 6d 65 74 65 72 73 20 + 61 73 20 73 63 61 6c 69 6e 67 20 66 61 63 74 6f + 72 73 20 74 6f 20 74 68 65 20 61 64 6a 75 73 74 + 6d 65 6e 74 2c 20 61 6e 64 0a + + ~ "~ these factors may be negative. You'll usually specify a" + ~ " parameter of 1 or" + 7e 20 74 68 65 73 65 20 66 61 63 74 6f 72 73 20 + 6d 61 79 20 62 65 20 6e 65 67 61 74 69 76 65 2e + 20 59 6f 75 27 6c 6c 20 75 73 75 61 6c 6c 79 20 + 73 70 65 63 69 66 79 20 61 20 70 61 72 61 6d 65 + 74 65 72 20 6f 66 20 31 20 6f 72 0a + + ~ "~ -1." + 7e 20 2d 31 2e 0a + + ~ "~" + 7e 0a + + ~ "~ We will revisit the topic of adjust-length later, when" + ~ " we describe the" + 7e 20 20 20 57 65 20 77 69 6c 6c 20 72 65 76 69 + 73 69 74 20 74 68 65 20 74 6f 70 69 63 20 6f 66 + 20 61 64 6a 75 73 74 2d 6c 65 6e 67 74 68 20 6c + 61 74 65 72 2c 20 77 68 65 6e 20 77 65 20 64 65 + 73 63 72 69 62 65 20 74 68 65 0a + + ~ "~ comment template feature, but for now we'll leave it" + ~ " there." + 7e 20 63 6f 6d 6d 65 6e 74 20 74 65 6d 70 6c 61 + 74 65 20 66 65 61 74 75 72 65 2c 20 62 75 74 20 + 66 6f 72 20 6e 6f 77 20 77 65 27 6c 6c 20 6c 65 + 61 76 65 20 69 74 20 74 68 65 72 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Direct your attention to the "suppress" command." + ~ " Sometimes, you intend to" + 7e 20 20 20 44 69 72 65 63 74 20 79 6f 75 72 20 + 61 74 74 65 6e 74 69 6f 6e 20 74 6f 20 74 68 65 + 20 22 73 75 70 70 72 65 73 73 22 20 63 6f 6d 6d + 61 6e 64 2e 20 53 6f 6d 65 74 69 6d 65 73 2c 20 + 79 6f 75 20 69 6e 74 65 6e 64 20 74 6f 0a + + ~ "~ call a helper word which is going to create its own" + ~ " entries, but you know" + 7e 20 63 61 6c 6c 20 61 20 68 65 6c 70 65 72 20 + 77 6f 72 64 20 77 68 69 63 68 20 69 73 20 67 6f + 69 6e 67 20 74 6f 20 63 72 65 61 74 65 20 69 74 + 73 20 6f 77 6e 20 65 6e 74 72 69 65 73 2c 20 62 + 75 74 20 79 6f 75 20 6b 6e 6f 77 0a + + ~ "~ that those entries don't suit your purpose, and you want" + ~ " to ignore them." + 7e 20 74 68 61 74 20 74 68 6f 73 65 20 65 6e 74 + 72 69 65 73 20 64 6f 6e 27 74 20 73 75 69 74 20 + 79 6f 75 72 20 70 75 72 70 6f 73 65 2c 20 61 6e + 64 20 79 6f 75 20 77 61 6e 74 20 74 6f 20 69 67 + 6e 6f 72 65 20 74 68 65 6d 2e 0a + + ~ "~ For example, you may be calling a word which outputs a" + ~ " binary string and" + 7e 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 20 79 + 6f 75 20 6d 61 79 20 62 65 20 63 61 6c 6c 69 6e + 67 20 61 20 77 6f 72 64 20 77 68 69 63 68 20 6f + 75 74 70 75 74 73 20 61 20 62 69 6e 61 72 79 20 + 73 74 72 69 6e 67 20 61 6e 64 0a + + ~ "~ creates entries describing the string, but you're doing" + ~ " something more" + 7e 20 63 72 65 61 74 65 73 20 65 6e 74 72 69 65 + 73 20 64 65 73 63 72 69 62 69 6e 67 20 74 68 65 + 20 73 74 72 69 6e 67 2c 20 62 75 74 20 79 6f 75 + 27 72 65 20 64 6f 69 6e 67 20 73 6f 6d 65 74 68 + 69 6e 67 20 6d 6f 72 65 0a + + ~ "~ specific and would prefer to create entries that describe" + ~ " your special case," + 7e 20 73 70 65 63 69 66 69 63 20 61 6e 64 20 77 + 6f 75 6c 64 20 70 72 65 66 65 72 20 74 6f 20 63 + 72 65 61 74 65 20 65 6e 74 72 69 65 73 20 74 68 + 61 74 20 64 65 73 63 72 69 62 65 20 79 6f 75 72 + 20 73 70 65 63 69 61 6c 20 63 61 73 65 2c 0a + + ~ "~ instead." + 7e 20 69 6e 73 74 65 61 64 2e 0a + + ~ "~" + 7e 0a + + ~ "~ When you need this, you can call "suppress" with an" + ~ " integer parameter. If" + 7e 20 20 20 57 68 65 6e 20 79 6f 75 20 6e 65 65 + 64 20 74 68 69 73 2c 20 79 6f 75 20 63 61 6e 20 + 63 61 6c 6c 20 22 73 75 70 70 72 65 73 73 22 20 + 77 69 74 68 20 61 6e 20 69 6e 74 65 67 65 72 20 + 70 61 72 61 6d 65 74 65 72 2e 20 49 66 0a + + ~ "~ the parameter is 1, the next time a metadata entry would" + ~ " have been created," + 7e 20 74 68 65 20 70 61 72 61 6d 65 74 65 72 20 + 69 73 20 31 2c 20 74 68 65 20 6e 65 78 74 20 74 + 69 6d 65 20 61 20 6d 65 74 61 64 61 74 61 20 65 + 6e 74 72 79 20 77 6f 75 6c 64 20 68 61 76 65 20 + 62 65 65 6e 20 63 72 65 61 74 65 64 2c 0a + + ~ "~ it won't; then things go back to normal. If you want to" + ~ " suppress more than" + 7e 20 69 74 20 77 6f 6e 27 74 3b 20 74 68 65 6e + 20 74 68 69 6e 67 73 20 67 6f 20 62 61 63 6b 20 + 74 6f 20 6e 6f 72 6d 61 6c 2e 20 49 66 20 79 6f + 75 20 77 61 6e 74 20 74 6f 20 73 75 70 70 72 65 + 73 73 20 6d 6f 72 65 20 74 68 61 6e 0a + + ~ "~ one entry in a row, you can pass it a larger number. If" + ~ " you change your" + 7e 20 6f 6e 65 20 65 6e 74 72 79 20 69 6e 20 61 + 20 72 6f 77 2c 20 79 6f 75 20 63 61 6e 20 70 61 + 73 73 20 69 74 20 61 20 6c 61 72 67 65 72 20 6e + 75 6d 62 65 72 2e 20 49 66 20 79 6f 75 20 63 68 + 61 6e 67 65 20 79 6f 75 72 0a + + ~ "~ mind, you can pass it a negative number. At the time" + ~ " magic comments are" + 7e 20 6d 69 6e 64 2c 20 79 6f 75 20 63 61 6e 20 + 70 61 73 73 20 69 74 20 61 20 6e 65 67 61 74 69 + 76 65 20 6e 75 6d 62 65 72 2e 20 41 74 20 74 68 + 65 20 74 69 6d 65 20 6d 61 67 69 63 20 63 6f 6d + 6d 65 6e 74 73 20 61 72 65 0a + + ~ "~ executing, there's a running count of how many entries" + ~ " should be suppressed," + 7e 20 65 78 65 63 75 74 69 6e 67 2c 20 74 68 65 + 72 65 27 73 20 61 20 72 75 6e 6e 69 6e 67 20 63 + 6f 75 6e 74 20 6f 66 20 68 6f 77 20 6d 61 6e 79 + 20 65 6e 74 72 69 65 73 20 73 68 6f 75 6c 64 20 + 62 65 20 73 75 70 70 72 65 73 73 65 64 2c 0a + + ~ "~ which is decremented any time it's greater than zero and" + ~ " an entry would be" + 7e 20 77 68 69 63 68 20 69 73 20 64 65 63 72 65 + 6d 65 6e 74 65 64 20 61 6e 79 20 74 69 6d 65 20 + 69 74 27 73 20 67 72 65 61 74 65 72 20 74 68 61 + 6e 20 7a 65 72 6f 20 61 6e 64 20 61 6e 20 65 6e + 74 72 79 20 77 6f 75 6c 64 20 62 65 0a + + ~ "~ created, and adjusted every time a call to "suppress" is" + ~ " executed." + 7e 20 63 72 65 61 74 65 64 2c 20 61 6e 64 20 61 + 64 6a 75 73 74 65 64 20 65 76 65 72 79 20 74 69 + 6d 65 20 61 20 63 61 6c 6c 20 74 6f 20 22 73 75 + 70 70 72 65 73 73 22 20 69 73 20 65 78 65 63 75 + 74 65 64 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Sometimes, an entry has already been created, and you" + ~ " now need to get rid" + 7e 20 20 20 53 6f 6d 65 74 69 6d 65 73 2c 20 61 + 6e 20 65 6e 74 72 79 20 68 61 73 20 61 6c 72 65 + 61 64 79 20 62 65 65 6e 20 63 72 65 61 74 65 64 + 2c 20 61 6e 64 20 79 6f 75 20 6e 6f 77 20 6e 65 + 65 64 20 74 6f 20 67 65 74 20 72 69 64 0a + + ~ "~ of it. While there are reasons to be cautious of" + ~ " more-general mechanisms," + 7e 20 6f 66 20 69 74 2e 20 57 68 69 6c 65 20 74 + 68 65 72 65 20 61 72 65 20 72 65 61 73 6f 6e 73 + 20 74 6f 20 62 65 20 63 61 75 74 69 6f 75 73 20 + 6f 66 20 6d 6f 72 65 2d 67 65 6e 65 72 61 6c 20 + 6d 65 63 68 61 6e 69 73 6d 73 2c 0a + + ~ "~ the commands delete-*-comment-at-output-point will search" + ~ " for a metadata" + 7e 20 74 68 65 20 63 6f 6d 6d 61 6e 64 73 20 64 + 65 6c 65 74 65 2d 2a 2d 63 6f 6d 6d 65 6e 74 2d + 61 74 2d 6f 75 74 70 75 74 2d 70 6f 69 6e 74 20 + 77 69 6c 6c 20 73 65 61 72 63 68 20 66 6f 72 20 + 61 20 6d 65 74 61 64 61 74 61 0a + + ~ "~ entry which is one of the comment types and which has its" + ~ " start position set" + 7e 20 65 6e 74 72 79 20 77 68 69 63 68 20 69 73 + 20 6f 6e 65 20 6f 66 20 74 68 65 20 63 6f 6d 6d + 65 6e 74 20 74 79 70 65 73 20 61 6e 64 20 77 68 + 69 63 68 20 68 61 73 20 69 74 73 20 73 74 61 72 + 74 20 70 6f 73 69 74 69 6f 6e 20 73 65 74 0a + + ~ "~ to the same address as the current output point. The" + ~ " -first- variant will" + 7e 20 74 6f 20 74 68 65 20 73 61 6d 65 20 61 64 + 64 72 65 73 73 20 61 73 20 74 68 65 20 63 75 72 + 72 65 6e 74 20 6f 75 74 70 75 74 20 70 6f 69 6e + 74 2e 20 54 68 65 20 2d 66 69 72 73 74 2d 20 76 + 61 72 69 61 6e 74 20 77 69 6c 6c 0a + + ~ "~ search forward from the start of the array, while -last-" + ~ " will search" + 7e 20 73 65 61 72 63 68 20 66 6f 72 77 61 72 64 + 20 66 72 6f 6d 20 74 68 65 20 73 74 61 72 74 20 + 6f 66 20 74 68 65 20 61 72 72 61 79 2c 20 77 68 + 69 6c 65 20 2d 6c 61 73 74 2d 20 77 69 6c 6c 20 + 73 65 61 72 63 68 0a + + ~ "~ backward from the end; both will stop as soon as they" + ~ " encounter one. This is" + 7e 20 62 61 63 6b 77 61 72 64 20 66 72 6f 6d 20 + 74 68 65 20 65 6e 64 3b 20 62 6f 74 68 20 77 69 + 6c 6c 20 73 74 6f 70 20 61 73 20 73 6f 6f 6e 20 + 61 73 20 74 68 65 79 20 65 6e 63 6f 75 6e 74 65 + 72 20 6f 6e 65 2e 20 54 68 69 73 20 69 73 0a + + ~ "~ usually desired when overwriting a location that has" + ~ " already been written" + 7e 20 75 73 75 61 6c 6c 79 20 64 65 73 69 72 65 + 64 20 77 68 65 6e 20 6f 76 65 72 77 72 69 74 69 + 6e 67 20 61 20 6c 6f 63 61 74 69 6f 6e 20 74 68 + 61 74 20 68 61 73 20 61 6c 72 65 61 64 79 20 62 + 65 65 6e 20 77 72 69 74 74 65 6e 0a + + ~ "~ to." + 7e 20 74 6f 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Take a quick look at the remaining examples. These are" + ~ " part of the comment" + 7e 20 20 20 54 61 6b 65 20 61 20 71 75 69 63 6b + 20 6c 6f 6f 6b 20 61 74 20 74 68 65 20 72 65 6d + 61 69 6e 69 6e 67 20 65 78 61 6d 70 6c 65 73 2e + 20 54 68 65 73 65 20 61 72 65 20 70 61 72 74 20 + 6f 66 20 74 68 65 20 63 6f 6d 6d 65 6e 74 0a + + ~ "~ template feature. We'll need to describe the other phases" + ~ " of processing" + 7e 20 74 65 6d 70 6c 61 74 65 20 66 65 61 74 75 + 72 65 2e 20 57 65 27 6c 6c 20 6e 65 65 64 20 74 + 6f 20 64 65 73 63 72 69 62 65 20 74 68 65 20 6f + 74 68 65 72 20 70 68 61 73 65 73 20 6f 66 20 70 + 72 6f 63 65 73 73 69 6e 67 0a + + ~ "~ before we can talk about how they work, but notice that" + ~ " one of them has the" + 7e 20 62 65 66 6f 72 65 20 77 65 20 63 61 6e 20 + 74 61 6c 6b 20 61 62 6f 75 74 20 68 6f 77 20 74 + 68 65 79 20 77 6f 72 6b 2c 20 62 75 74 20 6e 6f + 74 69 63 65 20 74 68 61 74 20 6f 6e 65 20 6f 66 + 20 74 68 65 6d 20 68 61 73 20 74 68 65 0a + + ~ "~ space-separated word # inside it, while the others are" + ~ " commands whose names" + 7e 20 73 70 61 63 65 2d 73 65 70 61 72 61 74 65 + 64 20 77 6f 72 64 20 23 20 69 6e 73 69 64 65 20 + 69 74 2c 20 77 68 69 6c 65 20 74 68 65 20 6f 74 + 68 65 72 73 20 61 72 65 20 63 6f 6d 6d 61 6e 64 + 73 20 77 68 6f 73 65 20 6e 61 6d 65 73 0a + + ~ "~ start with provide-. Any line or suffix comment can have" + ~ " # in it, which will" + 7e 20 73 74 61 72 74 20 77 69 74 68 20 70 72 6f + 76 69 64 65 2d 2e 20 41 6e 79 20 6c 69 6e 65 20 + 6f 72 20 73 75 66 66 69 78 20 63 6f 6d 6d 65 6e + 74 20 63 61 6e 20 68 61 76 65 20 23 20 69 6e 20 + 69 74 2c 20 77 68 69 63 68 20 77 69 6c 6c 0a + + ~ "~ consume a subitem from somewhere else, replacing the #" + ~ " like it's a template." + 7e 20 63 6f 6e 73 75 6d 65 20 61 20 73 75 62 69 + 74 65 6d 20 66 72 6f 6d 20 73 6f 6d 65 77 68 65 + 72 65 20 65 6c 73 65 2c 20 72 65 70 6c 61 63 69 + 6e 67 20 74 68 65 20 23 20 6c 69 6b 65 20 69 74 + 27 73 20 61 20 74 65 6d 70 6c 61 74 65 2e 0a + + ~ "~ The various provide- commands are the origins of those" + ~ " subitems. Which #" + 7e 20 54 68 65 20 76 61 72 69 6f 75 73 20 70 72 + 6f 76 69 64 65 2d 20 63 6f 6d 6d 61 6e 64 73 20 + 61 72 65 20 74 68 65 20 6f 72 69 67 69 6e 73 20 + 6f 66 20 74 68 6f 73 65 20 73 75 62 69 74 65 6d + 73 2e 20 57 68 69 63 68 20 23 0a + + ~ "~ goes with which provide- command? Thereby hangs a tale." + 7e 20 67 6f 65 73 20 77 69 74 68 20 77 68 69 63 + 68 20 70 72 6f 76 69 64 65 2d 20 63 6f 6d 6d 61 + 6e 64 3f 20 54 68 65 72 65 62 79 20 68 61 6e 67 + 73 20 61 20 74 61 6c 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ So. Let's pretend for the moment that we've finished" + ~ " talking about things" + 7e 20 20 20 53 6f 2e 20 4c 65 74 27 73 20 70 72 + 65 74 65 6e 64 20 66 6f 72 20 74 68 65 20 6d 6f + 6d 65 6e 74 20 74 68 61 74 20 77 65 27 76 65 20 + 66 69 6e 69 73 68 65 64 20 74 61 6c 6b 69 6e 67 + 20 61 62 6f 75 74 20 74 68 69 6e 67 73 0a + + ~ "~ that happen when magic comments execute. We haven't," + ~ " quite, but to finish it" + 7e 20 74 68 61 74 20 68 61 70 70 65 6e 20 77 68 + 65 6e 20 6d 61 67 69 63 20 63 6f 6d 6d 65 6e 74 + 73 20 65 78 65 63 75 74 65 2e 20 57 65 20 68 61 + 76 65 6e 27 74 2c 20 71 75 69 74 65 2c 20 62 75 + 74 20 74 6f 20 66 69 6e 69 73 68 20 69 74 0a + + ~ "~ out you'll need the full picture in your head." + 7e 20 6f 75 74 20 79 6f 75 27 6c 6c 20 6e 65 65 + 64 20 74 68 65 20 66 75 6c 6c 20 70 69 63 74 75 + 72 65 20 69 6e 20 79 6f 75 72 20 68 65 61 64 2e + 0a + + ~ "~" + 7e 0a + + ~ "~ All this time, the hex transform has been executing the" + ~ " compiler, which" + 7e 20 20 20 41 6c 6c 20 74 68 69 73 20 74 69 6d + 65 2c 20 74 68 65 20 68 65 78 20 74 72 61 6e 73 + 66 6f 72 6d 20 68 61 73 20 62 65 65 6e 20 65 78 + 65 63 75 74 69 6e 67 20 74 68 65 20 63 6f 6d 70 + 69 6c 65 72 2c 20 77 68 69 63 68 0a + + ~ "~ is running its guts inside a utility called the label" + ~ " loop (see" + 7e 20 69 73 20 72 75 6e 6e 69 6e 67 20 69 74 73 + 20 67 75 74 73 20 69 6e 73 69 64 65 20 61 20 75 + 74 69 6c 69 74 79 20 63 61 6c 6c 65 64 20 74 68 + 65 20 6c 61 62 65 6c 20 6c 6f 6f 70 20 28 73 65 + 65 0a + + ~ "~ compilation/labels.e). The compiler guts have been" + ~ " calling their own various" + 7e 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 2f 6c 61 + 62 65 6c 73 2e 65 29 2e 20 54 68 65 20 63 6f 6d + 70 69 6c 65 72 20 67 75 74 73 20 68 61 76 65 20 + 62 65 65 6e 20 63 61 6c 6c 69 6e 67 20 74 68 65 + 69 72 20 6f 77 6e 20 76 61 72 69 6f 75 73 0a + + ~ "~ internal words and accumulating their binary output in" + ~ " the label-loop" + 7e 20 69 6e 74 65 72 6e 61 6c 20 77 6f 72 64 73 + 20 61 6e 64 20 61 63 63 75 6d 75 6c 61 74 69 6e + 67 20 74 68 65 69 72 20 62 69 6e 61 72 79 20 6f + 75 74 70 75 74 20 69 6e 20 74 68 65 20 6c 61 62 + 65 6c 2d 6c 6f 6f 70 0a + + ~ "~ buffer. While this is happening, the hex transform's" + ~ " various traps have been" + 7e 20 62 75 66 66 65 72 2e 20 57 68 69 6c 65 20 + 74 68 69 73 20 69 73 20 68 61 70 70 65 6e 69 6e + 67 2c 20 74 68 65 20 68 65 78 20 74 72 61 6e 73 + 66 6f 72 6d 27 73 20 76 61 72 69 6f 75 73 20 74 + 72 61 70 73 20 68 61 76 65 20 62 65 65 6e 0a + + ~ "~ tracking the latest output point, executing magic" + ~ " comments, and doing other" + 7e 20 74 72 61 63 6b 69 6e 67 20 74 68 65 20 6c + 61 74 65 73 74 20 6f 75 74 70 75 74 20 70 6f 69 + 6e 74 2c 20 65 78 65 63 75 74 69 6e 67 20 6d 61 + 67 69 63 20 63 6f 6d 6d 65 6e 74 73 2c 20 61 6e + 64 20 64 6f 69 6e 67 20 6f 74 68 65 72 0a + + ~ "~ vital but simpler tasks." + 7e 20 76 69 74 61 6c 20 62 75 74 20 73 69 6d 70 + 6c 65 72 20 74 61 73 6b 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Eventually the label-loop will reach the end of its" + ~ " iteration, and then it" + 7e 20 20 20 45 76 65 6e 74 75 61 6c 6c 79 20 74 + 68 65 20 6c 61 62 65 6c 2d 6c 6f 6f 70 20 77 69 + 6c 6c 20 72 65 61 63 68 20 74 68 65 20 65 6e 64 + 20 6f 66 20 69 74 73 20 69 74 65 72 61 74 69 6f + 6e 2c 20 61 6e 64 20 74 68 65 6e 20 69 74 0a + + ~ "~ will either conclude that all the labels in the program" + ~ " have been resolved" + 7e 20 77 69 6c 6c 20 65 69 74 68 65 72 20 63 6f + 6e 63 6c 75 64 65 20 74 68 61 74 20 61 6c 6c 20 + 74 68 65 20 6c 61 62 65 6c 73 20 69 6e 20 74 68 + 65 20 70 72 6f 67 72 61 6d 20 68 61 76 65 20 62 + 65 65 6e 20 72 65 73 6f 6c 76 65 64 0a + + ~ "~ successfully, or it will notice that some of them were" + ~ " given addresses that" + 7e 20 73 75 63 63 65 73 73 66 75 6c 6c 79 2c 20 + 6f 72 20 69 74 20 77 69 6c 6c 20 6e 6f 74 69 63 + 65 20 74 68 61 74 20 73 6f 6d 65 20 6f 66 20 74 + 68 65 6d 20 77 65 72 65 20 67 69 76 65 6e 20 61 + 64 64 72 65 73 73 65 73 20 74 68 61 74 0a + + ~ "~ don't work. If the labels aren't all resolved, the label" + ~ " loop will start" + 7e 20 64 6f 6e 27 74 20 77 6f 72 6b 2e 20 49 66 + 20 74 68 65 20 6c 61 62 65 6c 73 20 61 72 65 6e + 27 74 20 61 6c 6c 20 72 65 73 6f 6c 76 65 64 2c + 20 74 68 65 20 6c 61 62 65 6c 20 6c 6f 6f 70 20 + 77 69 6c 6c 20 73 74 61 72 74 0a + + ~ "~ over from the beginning, running all the same compiler" + ~ " guts again. The hex" + 7e 20 6f 76 65 72 20 66 72 6f 6d 20 74 68 65 20 + 62 65 67 69 6e 6e 69 6e 67 2c 20 72 75 6e 6e 69 + 6e 67 20 61 6c 6c 20 74 68 65 20 73 61 6d 65 20 + 63 6f 6d 70 69 6c 65 72 20 67 75 74 73 20 61 67 + 61 69 6e 2e 20 54 68 65 20 68 65 78 0a + + ~ "~ transform will notice that this happened, clear out all" + ~ " the metadata" + 7e 20 74 72 61 6e 73 66 6f 72 6d 20 77 69 6c 6c + 20 6e 6f 74 69 63 65 20 74 68 61 74 20 74 68 69 + 73 20 68 61 70 70 65 6e 65 64 2c 20 63 6c 65 61 + 72 20 6f 75 74 20 61 6c 6c 20 74 68 65 20 6d 65 + 74 61 64 61 74 61 0a + + ~ "~ entries, and restart its own activities as well." + 7e 20 65 6e 74 72 69 65 73 2c 20 61 6e 64 20 72 + 65 73 74 61 72 74 20 69 74 73 20 6f 77 6e 20 61 + 63 74 69 76 69 74 69 65 73 20 61 73 20 77 65 6c + 6c 2e 0a + + ~ "~" + 7e 0a + + ~ "~ When the label loop finally declares success, and" + ~ " exits, the compiler will" + 7e 20 20 20 57 68 65 6e 20 74 68 65 20 6c 61 62 + 65 6c 20 6c 6f 6f 70 20 66 69 6e 61 6c 6c 79 20 + 64 65 63 6c 61 72 65 73 20 73 75 63 63 65 73 73 + 2c 20 61 6e 64 20 65 78 69 74 73 2c 20 74 68 65 + 20 63 6f 6d 70 69 6c 65 72 20 77 69 6c 6c 0a + + ~ "~ want to actually produce its binary output. The hex" + ~ " transform has trapped" + 7e 20 77 61 6e 74 20 74 6f 20 61 63 74 75 61 6c + 6c 79 20 70 72 6f 64 75 63 65 20 69 74 73 20 62 + 69 6e 61 72 79 20 6f 75 74 70 75 74 2e 20 54 68 + 65 20 68 65 78 20 74 72 61 6e 73 66 6f 72 6d 20 + 68 61 73 20 74 72 61 70 70 65 64 0a + + ~ "~ this, too! Now there's a postprocessing phase which" + ~ " cleans up all the" + 7e 20 74 68 69 73 2c 20 74 6f 6f 21 20 4e 6f 77 + 20 74 68 65 72 65 27 73 20 61 20 70 6f 73 74 70 + 72 6f 63 65 73 73 69 6e 67 20 70 68 61 73 65 20 + 77 68 69 63 68 20 63 6c 65 61 6e 73 20 75 70 20 + 61 6c 6c 20 74 68 65 0a + + ~ "~ metadata entries, and then finally there's a formatting" + ~ " phase where the" + 7e 20 6d 65 74 61 64 61 74 61 20 65 6e 74 72 69 + 65 73 2c 20 61 6e 64 20 74 68 65 6e 20 66 69 6e + 61 6c 6c 79 20 74 68 65 72 65 27 73 20 61 20 66 + 6f 72 6d 61 74 74 69 6e 67 20 70 68 61 73 65 20 + 77 68 65 72 65 20 74 68 65 0a + + ~ "~ entries are "run", as if they're a program, and the final" + ~ " hex dump with all" + 7e 20 65 6e 74 72 69 65 73 20 61 72 65 20 22 72 + 75 6e 22 2c 20 61 73 20 69 66 20 74 68 65 79 27 + 72 65 20 61 20 70 72 6f 67 72 61 6d 2c 20 61 6e + 64 20 74 68 65 20 66 69 6e 61 6c 20 68 65 78 20 + 64 75 6d 70 20 77 69 74 68 20 61 6c 6c 0a + + ~ "~ its comments is output." + 7e 20 69 74 73 20 63 6f 6d 6d 65 6e 74 73 20 69 + 73 20 6f 75 74 70 75 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ As a side note, the hex transform doesn't stop the" + ~ " compiler short; it lets" + 7e 20 20 20 41 73 20 61 20 73 69 64 65 20 6e 6f + 74 65 2c 20 74 68 65 20 68 65 78 20 74 72 61 6e + 73 66 6f 72 6d 20 64 6f 65 73 6e 27 74 20 73 74 + 6f 70 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 20 + 73 68 6f 72 74 3b 20 69 74 20 6c 65 74 73 0a + + ~ "~ the compiler decide which bytes will be output and in" + ~ " what order. In" + 7e 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 20 64 + 65 63 69 64 65 20 77 68 69 63 68 20 62 79 74 65 + 73 20 77 69 6c 6c 20 62 65 20 6f 75 74 70 75 74 + 20 61 6e 64 20 69 6e 20 77 68 61 74 20 6f 72 64 + 65 72 2e 20 49 6e 0a + + ~ "~ practice, Evocation and the various supplemental programs" + ~ " around it only" + 7e 20 70 72 61 63 74 69 63 65 2c 20 45 76 6f 63 + 61 74 69 6f 6e 20 61 6e 64 20 74 68 65 20 76 61 + 72 69 6f 75 73 20 73 75 70 70 6c 65 6d 65 6e 74 + 61 6c 20 70 72 6f 67 72 61 6d 73 20 61 72 6f 75 + 6e 64 20 69 74 20 6f 6e 6c 79 0a + + ~ "~ ever write their output in a single giant chunk, but the" + ~ " formatting phase" + 7e 20 65 76 65 72 20 77 72 69 74 65 20 74 68 65 + 69 72 20 6f 75 74 70 75 74 20 69 6e 20 61 20 73 + 69 6e 67 6c 65 20 67 69 61 6e 74 20 63 68 75 6e + 6b 2c 20 62 75 74 20 74 68 65 20 66 6f 72 6d 61 + 74 74 69 6e 67 20 70 68 61 73 65 0a + + ~ "~ actually runs every single time the compiler calls" + ~ " sys-write, and it only" + 7e 20 61 63 74 75 61 6c 6c 79 20 72 75 6e 73 20 + 65 76 65 72 79 20 73 69 6e 67 6c 65 20 74 69 6d + 65 20 74 68 65 20 63 6f 6d 70 69 6c 65 72 20 63 + 61 6c 6c 73 20 73 79 73 2d 77 72 69 74 65 2c 20 + 61 6e 64 20 69 74 20 6f 6e 6c 79 0a + + ~ "~ handles the portion of the label-loop buffer which the" + ~ " compiler passed to" + 7e 20 68 61 6e 64 6c 65 73 20 74 68 65 20 70 6f + 72 74 69 6f 6e 20 6f 66 20 74 68 65 20 6c 61 62 + 65 6c 2d 6c 6f 6f 70 20 62 75 66 66 65 72 20 77 + 68 69 63 68 20 74 68 65 20 63 6f 6d 70 69 6c 65 + 72 20 70 61 73 73 65 64 20 74 6f 0a + + ~ "~ sys-write." + 7e 20 73 79 73 2d 77 72 69 74 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The postprocessing phase is idempotent - doing it twice" + ~ " is the same as" + 7e 20 20 20 54 68 65 20 70 6f 73 74 70 72 6f 63 + 65 73 73 69 6e 67 20 70 68 61 73 65 20 69 73 20 + 69 64 65 6d 70 6f 74 65 6e 74 20 2d 20 64 6f 69 + 6e 67 20 69 74 20 74 77 69 63 65 20 69 73 20 74 + 68 65 20 73 61 6d 65 20 61 73 0a + + ~ "~ doing it once - so it's simply called every time" + ~ " sys-write is, before the" + 7e 20 64 6f 69 6e 67 20 69 74 20 6f 6e 63 65 20 + 2d 20 73 6f 20 69 74 27 73 20 73 69 6d 70 6c 79 + 20 63 61 6c 6c 65 64 20 65 76 65 72 79 20 74 69 + 6d 65 20 73 79 73 2d 77 72 69 74 65 20 69 73 2c + 20 62 65 66 6f 72 65 20 74 68 65 0a + + ~ "~ formatting phase starts. Postprocessing considers every" + ~ " metadata entry," + 7e 20 66 6f 72 6d 61 74 74 69 6e 67 20 70 68 61 + 73 65 20 73 74 61 72 74 73 2e 20 50 6f 73 74 70 + 72 6f 63 65 73 73 69 6e 67 20 63 6f 6e 73 69 64 + 65 72 73 20 65 76 65 72 79 20 6d 65 74 61 64 61 + 74 61 20 65 6e 74 72 79 2c 0a + + ~ "~ every time it runs, even when sys-write is called on" + ~ " something less than" + 7e 20 65 76 65 72 79 20 74 69 6d 65 20 69 74 20 + 72 75 6e 73 2c 20 65 76 65 6e 20 77 68 65 6e 20 + 73 79 73 2d 77 72 69 74 65 20 69 73 20 63 61 6c + 6c 65 64 20 6f 6e 20 73 6f 6d 65 74 68 69 6e 67 + 20 6c 65 73 73 20 74 68 61 6e 0a + + ~ "~ the whole buffer." + 7e 20 74 68 65 20 77 68 6f 6c 65 20 62 75 66 66 + 65 72 2e 0a + + ~ "~" + 7e 0a + + ~ "~ If you add postprocessing features, make sure to keep" + ~ " them idempotent." + 7e 20 20 20 49 66 20 79 6f 75 20 61 64 64 20 70 + 6f 73 74 70 72 6f 63 65 73 73 69 6e 67 20 66 65 + 61 74 75 72 65 73 2c 20 6d 61 6b 65 20 73 75 72 + 65 20 74 6f 20 6b 65 65 70 20 74 68 65 6d 20 69 + 64 65 6d 70 6f 74 65 6e 74 2e 0a + + ~ "~ While it's possible to imagine reasons one might want to" + ~ " have back-and-forth" + 7e 20 57 68 69 6c 65 20 69 74 27 73 20 70 6f 73 + 73 69 62 6c 65 20 74 6f 20 69 6d 61 67 69 6e 65 + 20 72 65 61 73 6f 6e 73 20 6f 6e 65 20 6d 69 67 + 68 74 20 77 61 6e 74 20 74 6f 20 68 61 76 65 20 + 62 61 63 6b 2d 61 6e 64 2d 66 6f 72 74 68 0a + + ~ "~ interplay between successive formatting and" + ~ " postprocessing phases, Evocation" + 7e 20 69 6e 74 65 72 70 6c 61 79 20 62 65 74 77 + 65 65 6e 20 73 75 63 63 65 73 73 69 76 65 20 66 + 6f 72 6d 61 74 74 69 6e 67 20 61 6e 64 20 70 6f + 73 74 70 72 6f 63 65 73 73 69 6e 67 20 70 68 61 + 73 65 73 2c 20 45 76 6f 63 61 74 69 6f 6e 0a + + ~ "~ goes to some trouble to make sure there is none. In" + ~ " Irenes' opinion, this" + 7e 20 67 6f 65 73 20 74 6f 20 73 6f 6d 65 20 74 + 72 6f 75 62 6c 65 20 74 6f 20 6d 61 6b 65 20 73 + 75 72 65 20 74 68 65 72 65 20 69 73 20 6e 6f 6e + 65 2e 20 49 6e 20 49 72 65 6e 65 73 27 20 6f 70 + 69 6e 69 6f 6e 2c 20 74 68 69 73 0a + + ~ "~ is already quite enough complexity and is nearing the" + ~ " limit of what humans" + 7e 20 69 73 20 61 6c 72 65 61 64 79 20 71 75 69 + 74 65 20 65 6e 6f 75 67 68 20 63 6f 6d 70 6c 65 + 78 69 74 79 20 61 6e 64 20 69 73 20 6e 65 61 72 + 69 6e 67 20 74 68 65 20 6c 69 6d 69 74 20 6f 66 + 20 77 68 61 74 20 68 75 6d 61 6e 73 0a + + ~ "~ will find worthwhile. If you break idempotence, you are" + ~ " hereby warned that" + 7e 20 77 69 6c 6c 20 66 69 6e 64 20 77 6f 72 74 + 68 77 68 69 6c 65 2e 20 49 66 20 79 6f 75 20 62 + 72 65 61 6b 20 69 64 65 6d 70 6f 74 65 6e 63 65 + 2c 20 79 6f 75 20 61 72 65 20 68 65 72 65 62 79 + 20 77 61 72 6e 65 64 20 74 68 61 74 0a + + ~ "~ you are at risk of falling into the abyss[1]." + 7e 20 79 6f 75 20 61 72 65 20 61 74 20 72 69 73 + 6b 20 6f 66 20 66 61 6c 6c 69 6e 67 20 69 6e 74 + 6f 20 74 68 65 20 61 62 79 73 73 5b 31 5d 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Postprocessing re-organizes entries, without changing" + ~ " their meaning, but" + 7e 20 20 20 50 6f 73 74 70 72 6f 63 65 73 73 69 + 6e 67 20 72 65 2d 6f 72 67 61 6e 69 7a 65 73 20 + 65 6e 74 72 69 65 73 2c 20 77 69 74 68 6f 75 74 + 20 63 68 61 6e 67 69 6e 67 20 74 68 65 69 72 20 + 6d 65 61 6e 69 6e 67 2c 20 62 75 74 0a + + ~ "~ in a way that will make them easier to format. There are" + ~ " two things it" + 7e 20 69 6e 20 61 20 77 61 79 20 74 68 61 74 20 + 77 69 6c 6c 20 6d 61 6b 65 20 74 68 65 6d 20 65 + 61 73 69 65 72 20 74 6f 20 66 6f 72 6d 61 74 2e + 20 54 68 65 72 65 20 61 72 65 20 74 77 6f 20 74 + 68 69 6e 67 73 20 69 74 0a + + ~ "~ does, and they happen simultaneously: The whole array is" + ~ " bubble-sorted;" + 7e 20 64 6f 65 73 2c 20 61 6e 64 20 74 68 65 79 + 20 68 61 70 70 65 6e 20 73 69 6d 75 6c 74 61 6e + 65 6f 75 73 6c 79 3a 20 54 68 65 20 77 68 6f 6c + 65 20 61 72 72 61 79 20 69 73 20 62 75 62 62 6c + 65 2d 73 6f 72 74 65 64 3b 0a + + ~ "~ and some suffix comment entries are split apart." + 7e 20 61 6e 64 20 73 6f 6d 65 20 73 75 66 66 69 + 78 20 63 6f 6d 6d 65 6e 74 20 65 6e 74 72 69 65 + 73 20 61 72 65 20 73 70 6c 69 74 20 61 70 61 72 + 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The bubble sort resolves ordering first by the address" + ~ " each entry is" + 7e 20 20 20 54 68 65 20 62 75 62 62 6c 65 20 73 + 6f 72 74 20 72 65 73 6f 6c 76 65 73 20 6f 72 64 + 65 72 69 6e 67 20 66 69 72 73 74 20 62 79 20 74 + 68 65 20 61 64 64 72 65 73 73 20 65 61 63 68 20 + 65 6e 74 72 79 20 69 73 0a + + ~ "~ attached to, low-to-high. As a tiebreaker when two" + ~ " entries have the same" + 7e 20 61 74 74 61 63 68 65 64 20 74 6f 2c 20 6c + 6f 77 2d 74 6f 2d 68 69 67 68 2e 20 41 73 20 61 + 20 74 69 65 62 72 65 61 6b 65 72 20 77 68 65 6e + 20 74 77 6f 20 65 6e 74 72 69 65 73 20 68 61 76 + 65 20 74 68 65 20 73 61 6d 65 0a + + ~ "~ address, a comment entry is sorted after a" + ~ " stack-manipulation entry. The" + 7e 20 61 64 64 72 65 73 73 2c 20 61 20 63 6f 6d + 6d 65 6e 74 20 65 6e 74 72 79 20 69 73 20 73 6f + 72 74 65 64 20 61 66 74 65 72 20 61 20 73 74 61 + 63 6b 2d 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 20 + 65 6e 74 72 79 2e 20 54 68 65 0a + + ~ "~ tiebreaker rule means that stack-manipulation commands" + ~ " can come after the" + 7e 20 74 69 65 62 72 65 61 6b 65 72 20 72 75 6c + 65 20 6d 65 61 6e 73 20 74 68 61 74 20 73 74 61 + 63 6b 2d 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 20 + 63 6f 6d 6d 61 6e 64 73 20 63 61 6e 20 63 6f 6d + 65 20 61 66 74 65 72 20 74 68 65 0a + + ~ "~ last byte that's within the comment's span; otherwise" + ~ " they would always have" + 7e 20 6c 61 73 74 20 62 79 74 65 20 74 68 61 74 + 27 73 20 77 69 74 68 69 6e 20 74 68 65 20 63 6f + 6d 6d 65 6e 74 27 73 20 73 70 61 6e 3b 20 6f 74 + 68 65 72 77 69 73 65 20 74 68 65 79 20 77 6f 75 + 6c 64 20 61 6c 77 61 79 73 20 68 61 76 65 0a + + ~ "~ to be before it. If neither criterion applies, the" + ~ " entries will stay in" + 7e 20 74 6f 20 62 65 20 62 65 66 6f 72 65 20 69 + 74 2e 20 49 66 20 6e 65 69 74 68 65 72 20 63 72 + 69 74 65 72 69 6f 6e 20 61 70 70 6c 69 65 73 2c + 20 74 68 65 20 65 6e 74 72 69 65 73 20 77 69 6c + 6c 20 73 74 61 79 20 69 6e 0a + + ~ "~ whatever order they were in to begin with; that is, it's" + ~ " a stable sort." + 7e 20 77 68 61 74 65 76 65 72 20 6f 72 64 65 72 + 20 74 68 65 79 20 77 65 72 65 20 69 6e 20 74 6f + 20 62 65 67 69 6e 20 77 69 74 68 3b 20 74 68 61 + 74 20 69 73 2c 20 69 74 27 73 20 61 20 73 74 61 + 62 6c 65 20 73 6f 72 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The comment splitting applies only to suffix comments," + ~ " and only when their" + 7e 20 20 20 54 68 65 20 63 6f 6d 6d 65 6e 74 20 + 73 70 6c 69 74 74 69 6e 67 20 61 70 70 6c 69 65 + 73 20 6f 6e 6c 79 20 74 6f 20 73 75 66 66 69 78 + 20 63 6f 6d 6d 65 6e 74 73 2c 20 61 6e 64 20 6f + 6e 6c 79 20 77 68 65 6e 20 74 68 65 69 72 0a + + ~ "~ length is not zero. They become a fresh-line entry at the" + ~ " start of the span" + 7e 20 6c 65 6e 67 74 68 20 69 73 20 6e 6f 74 20 + 7a 65 72 6f 2e 20 54 68 65 79 20 62 65 63 6f 6d + 65 20 61 20 66 72 65 73 68 2d 6c 69 6e 65 20 65 + 6e 74 72 79 20 61 74 20 74 68 65 20 73 74 61 72 + 74 20 6f 66 20 74 68 65 20 73 70 61 6e 0a + + ~ "~ the comment originally attached to, and a zero-length" + ~ " suffix comment entry" + 7e 20 74 68 65 20 63 6f 6d 6d 65 6e 74 20 6f 72 + 69 67 69 6e 61 6c 6c 79 20 61 74 74 61 63 68 65 + 64 20 74 6f 2c 20 61 6e 64 20 61 20 7a 65 72 6f + 2d 6c 65 6e 67 74 68 20 73 75 66 66 69 78 20 63 + 6f 6d 6d 65 6e 74 20 65 6e 74 72 79 0a + + ~ "~ at the end of the span." + 7e 20 61 74 20 74 68 65 20 65 6e 64 20 6f 66 20 + 74 68 65 20 73 70 61 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Please notice that adjust-length commands happen when" + ~ " magic comments are" + 7e 20 20 20 50 6c 65 61 73 65 20 6e 6f 74 69 63 + 65 20 74 68 61 74 20 61 64 6a 75 73 74 2d 6c 65 + 6e 67 74 68 20 63 6f 6d 6d 61 6e 64 73 20 68 61 + 70 70 65 6e 20 77 68 65 6e 20 6d 61 67 69 63 20 + 63 6f 6d 6d 65 6e 74 73 20 61 72 65 0a + + ~ "~ executed, which was long, long ago by now. By the time" + ~ " the postprocessing" + 7e 20 65 78 65 63 75 74 65 64 2c 20 77 68 69 63 + 68 20 77 61 73 20 6c 6f 6e 67 2c 20 6c 6f 6e 67 + 20 61 67 6f 20 62 79 20 6e 6f 77 2e 20 42 79 20 + 74 68 65 20 74 69 6d 65 20 74 68 65 20 70 6f 73 + 74 70 72 6f 63 65 73 73 69 6e 67 0a + + ~ "~ happens, every entry's length has been as adjusted as" + ~ " it's ever going to be." + 7e 20 68 61 70 70 65 6e 73 2c 20 65 76 65 72 79 + 20 65 6e 74 72 79 27 73 20 6c 65 6e 67 74 68 20 + 68 61 73 20 62 65 65 6e 20 61 73 20 61 64 6a 75 + 73 74 65 64 20 61 73 20 69 74 27 73 20 65 76 65 + 72 20 67 6f 69 6e 67 20 74 6f 20 62 65 2e 0a + + ~ "~ This is important, because the order of entries is going" + ~ " to matter during" + 7e 20 54 68 69 73 20 69 73 20 69 6d 70 6f 72 74 + 61 6e 74 2c 20 62 65 63 61 75 73 65 20 74 68 65 + 20 6f 72 64 65 72 20 6f 66 20 65 6e 74 72 69 65 + 73 20 69 73 20 67 6f 69 6e 67 20 74 6f 20 6d 61 + 74 74 65 72 20 64 75 72 69 6e 67 0a + + ~ "~ the formatting phase." + 7e 20 74 68 65 20 66 6f 72 6d 61 74 74 69 6e 67 + 20 70 68 61 73 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Notice also that the splitting of suffix comment" + ~ " entries changes what" + 7e 20 20 20 4e 6f 74 69 63 65 20 61 6c 73 6f 20 + 74 68 61 74 20 74 68 65 20 73 70 6c 69 74 74 69 + 6e 67 20 6f 66 20 73 75 66 66 69 78 20 63 6f 6d + 6d 65 6e 74 20 65 6e 74 72 69 65 73 20 63 68 61 + 6e 67 65 73 20 77 68 61 74 0a + + ~ "~ address the comment is attached to (unless it's a" + ~ " negative length, which is" + 7e 20 61 64 64 72 65 73 73 20 74 68 65 20 63 6f + 6d 6d 65 6e 74 20 69 73 20 61 74 74 61 63 68 65 + 64 20 74 6f 20 28 75 6e 6c 65 73 73 20 69 74 27 + 73 20 61 20 6e 65 67 61 74 69 76 65 20 6c 65 6e + 67 74 68 2c 20 77 68 69 63 68 20 69 73 0a + + ~ "~ already at the end of its span). Any entries that were" + ~ " attached to output" + 7e 20 61 6c 72 65 61 64 79 20 61 74 20 74 68 65 + 20 65 6e 64 20 6f 66 20 69 74 73 20 73 70 61 6e + 29 2e 20 41 6e 79 20 65 6e 74 72 69 65 73 20 74 + 68 61 74 20 77 65 72 65 20 61 74 74 61 63 68 65 + 64 20 74 6f 20 6f 75 74 70 75 74 0a + + ~ "~ points somewhere inside the span will now definitely be" + ~ " before the suffix" + 7e 20 70 6f 69 6e 74 73 20 73 6f 6d 65 77 68 65 + 72 65 20 69 6e 73 69 64 65 20 74 68 65 20 73 70 + 61 6e 20 77 69 6c 6c 20 6e 6f 77 20 64 65 66 69 + 6e 69 74 65 6c 79 20 62 65 20 62 65 66 6f 72 65 + 20 74 68 65 20 73 75 66 66 69 78 0a + + ~ "~ comment's entry in the entry array, whereas up till now" + ~ " they were likely" + 7e 20 63 6f 6d 6d 65 6e 74 27 73 20 65 6e 74 72 + 79 20 69 6e 20 74 68 65 20 65 6e 74 72 79 20 61 + 72 72 61 79 2c 20 77 68 65 72 65 61 73 20 75 70 + 20 74 69 6c 6c 20 6e 6f 77 20 74 68 65 79 20 77 + 65 72 65 20 6c 69 6b 65 6c 79 0a + + ~ "~ somewhere after it, depending on the exact order" + ~ " everything was created in." + 7e 20 73 6f 6d 65 77 68 65 72 65 20 61 66 74 65 + 72 20 69 74 2c 20 64 65 70 65 6e 64 69 6e 67 20 + 6f 6e 20 74 68 65 20 65 78 61 63 74 20 6f 72 64 + 65 72 20 65 76 65 72 79 74 68 69 6e 67 20 77 61 + 73 20 63 72 65 61 74 65 64 20 69 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The postprocessing phase is conceptually simple -" + ~ " unlike the magic-comment" + 7e 20 20 20 54 68 65 20 70 6f 73 74 70 72 6f 63 + 65 73 73 69 6e 67 20 70 68 61 73 65 20 69 73 20 + 63 6f 6e 63 65 70 74 75 61 6c 6c 79 20 73 69 6d + 70 6c 65 20 2d 20 75 6e 6c 69 6b 65 20 74 68 65 + 20 6d 61 67 69 63 2d 63 6f 6d 6d 65 6e 74 0a + + ~ "~ execution phase before it, and unlike the formatting" + ~ " phase after it, there" + 7e 20 65 78 65 63 75 74 69 6f 6e 20 70 68 61 73 + 65 20 62 65 66 6f 72 65 20 69 74 2c 20 61 6e 64 + 20 75 6e 6c 69 6b 65 20 74 68 65 20 66 6f 72 6d + 61 74 74 69 6e 67 20 70 68 61 73 65 20 61 66 74 + 65 72 20 69 74 2c 20 74 68 65 72 65 0a + + ~ "~ isn't any mutable state inside the phase that would make" + ~ " it matter what" + 7e 20 69 73 6e 27 74 20 61 6e 79 20 6d 75 74 61 + 62 6c 65 20 73 74 61 74 65 20 69 6e 73 69 64 65 + 20 74 68 65 20 70 68 61 73 65 20 74 68 61 74 20 + 77 6f 75 6c 64 20 6d 61 6b 65 20 69 74 20 6d 61 + 74 74 65 72 20 77 68 61 74 0a + + ~ "~ order things happen in. Enjoy this, because ordering is" + ~ " about to become" + 7e 20 6f 72 64 65 72 20 74 68 69 6e 67 73 20 68 + 61 70 70 65 6e 20 69 6e 2e 20 45 6e 6a 6f 79 20 + 74 68 69 73 2c 20 62 65 63 61 75 73 65 20 6f 72 + 64 65 72 69 6e 67 20 69 73 20 61 62 6f 75 74 20 + 74 6f 20 62 65 63 6f 6d 65 0a + + ~ "~ super confusing." + 7e 20 73 75 70 65 72 20 63 6f 6e 66 75 73 69 6e + 67 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Now let's consider the formatting phase. We've already" + ~ " mentioned that" + 7e 20 20 20 4e 6f 77 20 6c 65 74 27 73 20 63 6f + 6e 73 69 64 65 72 20 74 68 65 20 66 6f 72 6d 61 + 74 74 69 6e 67 20 70 68 61 73 65 2e 20 57 65 27 + 76 65 20 61 6c 72 65 61 64 79 20 6d 65 6e 74 69 + 6f 6e 65 64 20 74 68 61 74 0a + + ~ "~ there is some global state which is tracked throughout" + ~ " the phase, such as" + 7e 20 74 68 65 72 65 20 69 73 20 73 6f 6d 65 20 + 67 6c 6f 62 61 6c 20 73 74 61 74 65 20 77 68 69 + 63 68 20 69 73 20 74 72 61 63 6b 65 64 20 74 68 + 72 6f 75 67 68 6f 75 74 20 74 68 65 20 70 68 61 + 73 65 2c 20 73 75 63 68 20 61 73 0a + + ~ "~ the current indentation level and whether the output is" + ~ " at the start of a" + 7e 20 74 68 65 20 63 75 72 72 65 6e 74 20 69 6e + 64 65 6e 74 61 74 69 6f 6e 20 6c 65 76 65 6c 20 + 61 6e 64 20 77 68 65 74 68 65 72 20 74 68 65 20 + 6f 75 74 70 75 74 20 69 73 20 61 74 20 74 68 65 + 20 73 74 61 72 74 20 6f 66 20 61 0a + + ~ "~ line. The formatting phase is given an overall block of" + ~ " bytes in the" + 7e 20 6c 69 6e 65 2e 20 54 68 65 20 66 6f 72 6d + 61 74 74 69 6e 67 20 70 68 61 73 65 20 69 73 20 + 67 69 76 65 6e 20 61 6e 20 6f 76 65 72 61 6c 6c + 20 62 6c 6f 63 6b 20 6f 66 20 62 79 74 65 73 20 + 69 6e 20 74 68 65 0a + + ~ "~ label-loop buffer, which it iterates through in order" + ~ " from beginning to end." + 7e 20 6c 61 62 65 6c 2d 6c 6f 6f 70 20 62 75 66 + 66 65 72 2c 20 77 68 69 63 68 20 69 74 20 69 74 + 65 72 61 74 65 73 20 74 68 72 6f 75 67 68 20 69 + 6e 20 6f 72 64 65 72 20 66 72 6f 6d 20 62 65 67 + 69 6e 6e 69 6e 67 20 74 6f 20 65 6e 64 2e 0a + + ~ "~ Any time the formatting phase reaches an address which" + ~ " has metadata entries" + 7e 20 41 6e 79 20 74 69 6d 65 20 74 68 65 20 66 + 6f 72 6d 61 74 74 69 6e 67 20 70 68 61 73 65 20 + 72 65 61 63 68 65 73 20 61 6e 20 61 64 64 72 65 + 73 73 20 77 68 69 63 68 20 68 61 73 20 6d 65 74 + 61 64 61 74 61 20 65 6e 74 72 69 65 73 0a + + ~ "~ attached to it, all the entries at that address are" + ~ " executed, in the order" + 7e 20 61 74 74 61 63 68 65 64 20 74 6f 20 69 74 + 2c 20 61 6c 6c 20 74 68 65 20 65 6e 74 72 69 65 + 73 20 61 74 20 74 68 61 74 20 61 64 64 72 65 73 + 73 20 61 72 65 20 65 78 65 63 75 74 65 64 2c 20 + 69 6e 20 74 68 65 20 6f 72 64 65 72 0a + + ~ "~ they exist in the entry array." + 7e 20 74 68 65 79 20 65 78 69 73 74 20 69 6e 20 + 74 68 65 20 65 6e 74 72 79 20 61 72 72 61 79 2e + 0a + + ~ "~" + 7e 0a + + ~ "~ Yes, that's right, executing an entry is different from" + ~ " executing the" + 7e 20 20 20 59 65 73 2c 20 74 68 61 74 27 73 20 + 72 69 67 68 74 2c 20 65 78 65 63 75 74 69 6e 67 + 20 61 6e 20 65 6e 74 72 79 20 69 73 20 64 69 66 + 66 65 72 65 6e 74 20 66 72 6f 6d 20 65 78 65 63 + 75 74 69 6e 67 20 74 68 65 0a + + ~ "~ magic comment that created the entry. That's important." + 7e 20 6d 61 67 69 63 20 63 6f 6d 6d 65 6e 74 20 + 74 68 61 74 20 63 72 65 61 74 65 64 20 74 68 65 + 20 65 6e 74 72 79 2e 20 54 68 61 74 27 73 20 69 + 6d 70 6f 72 74 61 6e 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The line-comment and suffix-comment entries do the" + ~ " obvious things: They" + 7e 20 20 20 54 68 65 20 6c 69 6e 65 2d 63 6f 6d + 6d 65 6e 74 20 61 6e 64 20 73 75 66 66 69 78 2d + 63 6f 6d 6d 65 6e 74 20 65 6e 74 72 69 65 73 20 + 64 6f 20 74 68 65 20 6f 62 76 69 6f 75 73 20 74 + 68 69 6e 67 73 3a 20 54 68 65 79 0a + + ~ "~ print out the appropriate comment text. Suffix comments" + ~ " are also all" + 7e 20 70 72 69 6e 74 20 6f 75 74 20 74 68 65 20 + 61 70 70 72 6f 70 72 69 61 74 65 20 63 6f 6d 6d + 65 6e 74 20 74 65 78 74 2e 20 53 75 66 66 69 78 + 20 63 6f 6d 6d 65 6e 74 73 20 61 72 65 20 61 6c + 73 6f 20 61 6c 6c 0a + + ~ "~ horizontally aligned with each other, to make them easier" + ~ " to visually skim." + 7e 20 68 6f 72 69 7a 6f 6e 74 61 6c 6c 79 20 61 + 6c 69 67 6e 65 64 20 77 69 74 68 20 65 61 63 68 + 20 6f 74 68 65 72 2c 20 74 6f 20 6d 61 6b 65 20 + 74 68 65 6d 20 65 61 73 69 65 72 20 74 6f 20 76 + 69 73 75 61 6c 6c 79 20 73 6b 69 6d 2e 0a + + ~ "~ The two kinds of comment entries also do a less-obvious" + ~ " thing, which is fill" + 7e 20 54 68 65 20 74 77 6f 20 6b 69 6e 64 73 20 + 6f 66 20 63 6f 6d 6d 65 6e 74 20 65 6e 74 72 69 + 65 73 20 61 6c 73 6f 20 64 6f 20 61 20 6c 65 73 + 73 2d 6f 62 76 69 6f 75 73 20 74 68 69 6e 67 2c + 20 77 68 69 63 68 20 69 73 20 66 69 6c 6c 0a + + ~ "~ in any # template items that are part of the comment" + ~ " text, in order from" + 7e 20 69 6e 20 61 6e 79 20 23 20 74 65 6d 70 6c + 61 74 65 20 69 74 65 6d 73 20 74 68 61 74 20 61 + 72 65 20 70 61 72 74 20 6f 66 20 74 68 65 20 63 + 6f 6d 6d 65 6e 74 20 74 65 78 74 2c 20 69 6e 20 + 6f 72 64 65 72 20 66 72 6f 6d 0a + + ~ "~ left to right." + 7e 20 6c 65 66 74 20 74 6f 20 72 69 67 68 74 2e + 0a + + ~ "~" + 7e 0a + + ~ "~ Where do those items come from? Well, there's a" + ~ " separate stack, the" + 7e 20 20 20 57 68 65 72 65 20 64 6f 20 74 68 6f + 73 65 20 69 74 65 6d 73 20 63 6f 6d 65 20 66 72 + 6f 6d 3f 20 57 65 6c 6c 2c 20 74 68 65 72 65 27 + 73 20 61 20 73 65 70 61 72 61 74 65 20 73 74 61 + 63 6b 2c 20 74 68 65 0a + + ~ "~ subitem entry stack, which is kept in the hex output" + ~ " metadata header. The" + 7e 20 73 75 62 69 74 65 6d 20 65 6e 74 72 79 20 + 73 74 61 63 6b 2c 20 77 68 69 63 68 20 69 73 20 + 6b 65 70 74 20 69 6e 20 74 68 65 20 68 65 78 20 + 6f 75 74 70 75 74 20 6d 65 74 61 64 61 74 61 20 + 68 65 61 64 65 72 2e 20 54 68 65 0a + + ~ "~ subitem entry stack has an extremely small, fixed maximum" + ~ " depth. The maximum" + 7e 20 73 75 62 69 74 65 6d 20 65 6e 74 72 79 20 + 73 74 61 63 6b 20 68 61 73 20 61 6e 20 65 78 74 + 72 65 6d 65 6c 79 20 73 6d 61 6c 6c 2c 20 66 69 + 78 65 64 20 6d 61 78 69 6d 75 6d 20 64 65 70 74 + 68 2e 20 54 68 65 20 6d 61 78 69 6d 75 6d 0a + + ~ "~ depth is deliberately small, so that any leaks onto it" + ~ " will be detected" + 7e 20 64 65 70 74 68 20 69 73 20 64 65 6c 69 62 + 65 72 61 74 65 6c 79 20 73 6d 61 6c 6c 2c 20 73 + 6f 20 74 68 61 74 20 61 6e 79 20 6c 65 61 6b 73 + 20 6f 6e 74 6f 20 69 74 20 77 69 6c 6c 20 62 65 + 20 64 65 74 65 63 74 65 64 0a + + ~ "~ somewhere close to their root causes, for ease of" + ~ " diagnosis. Unusually for" + 7e 20 73 6f 6d 65 77 68 65 72 65 20 63 6c 6f 73 + 65 20 74 6f 20 74 68 65 69 72 20 72 6f 6f 74 20 + 63 61 75 73 65 73 2c 20 66 6f 72 20 65 61 73 65 + 20 20 6f 66 20 64 69 61 67 6e 6f 73 69 73 2e 20 + 55 6e 75 73 75 61 6c 6c 79 20 66 6f 72 0a + + ~ "~ Evocation, if you underflow or overflow it, you'll get a" + ~ " friendly error" + 7e 20 45 76 6f 63 61 74 69 6f 6e 2c 20 69 66 20 + 79 6f 75 20 75 6e 64 65 72 66 6c 6f 77 20 6f 72 + 20 6f 76 65 72 66 6c 6f 77 20 69 74 2c 20 79 6f + 75 27 6c 6c 20 67 65 74 20 61 20 66 72 69 65 6e + 64 6c 79 20 65 72 72 6f 72 0a + + ~ "~ message rather than a segfault - how nice! Of course, the" + ~ " error message will" + 7e 20 6d 65 73 73 61 67 65 20 72 61 74 68 65 72 + 20 74 68 61 6e 20 61 20 73 65 67 66 61 75 6c 74 + 20 2d 20 68 6f 77 20 6e 69 63 65 21 20 4f 66 20 + 63 6f 75 72 73 65 2c 20 74 68 65 20 65 72 72 6f + 72 20 6d 65 73 73 61 67 65 20 77 69 6c 6c 0a + + ~ "~ appear in the middle of your regular output and corrupt" + ~ " it, but you can't" + 7e 20 61 70 70 65 61 72 20 69 6e 20 74 68 65 20 + 6d 69 64 64 6c 65 20 6f 66 20 79 6f 75 72 20 72 + 65 67 75 6c 61 72 20 6f 75 74 70 75 74 20 61 6e + 64 20 63 6f 72 72 75 70 74 20 69 74 2c 20 62 75 + 74 20 79 6f 75 20 63 61 6e 27 74 0a + + ~ "~ have everything..." + 7e 20 68 61 76 65 20 65 76 65 72 79 74 68 69 6e + 67 2e 2e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Each time a comment template is being filled and" + ~ " encounters a #" + 7e 20 20 20 45 61 63 68 20 74 69 6d 65 20 61 20 + 63 6f 6d 6d 65 6e 74 20 74 65 6d 70 6c 61 74 65 + 20 69 73 20 62 65 69 6e 67 20 66 69 6c 6c 65 64 + 20 61 6e 64 20 65 6e 63 6f 75 6e 74 65 72 73 20 + 61 20 23 0a + + ~ "~ placeholder, an item is popped off the subitem entry" + ~ " stack and formatted" + 7e 20 70 6c 61 63 65 68 6f 6c 64 65 72 2c 20 61 + 6e 20 69 74 65 6d 20 69 73 20 70 6f 70 70 65 64 + 20 6f 66 66 20 74 68 65 20 73 75 62 69 74 65 6d + 20 65 6e 74 72 79 20 73 74 61 63 6b 20 61 6e 64 + 20 66 6f 72 6d 61 74 74 65 64 0a + + ~ "~ according to what type of entry it is. It's called an" + ~ " "entry stack" for a" + 7e 20 61 63 63 6f 72 64 69 6e 67 20 74 6f 20 77 + 68 61 74 20 74 79 70 65 20 6f 66 20 65 6e 74 72 + 79 20 69 74 20 69 73 2e 20 49 74 27 73 20 63 61 + 6c 6c 65 64 20 61 6e 20 22 65 6e 74 72 79 20 73 + 74 61 63 6b 22 20 66 6f 72 20 61 0a + + ~ "~ reason: it's a stack of pointers to metadata entries," + ~ " whose backing store" + 7e 20 72 65 61 73 6f 6e 3a 20 69 74 27 73 20 61 + 20 73 74 61 63 6b 20 6f 66 20 70 6f 69 6e 74 65 + 72 73 20 74 6f 20 6d 65 74 61 64 61 74 61 20 65 + 6e 74 72 69 65 73 2c 20 77 68 6f 73 65 20 62 61 + 63 6b 69 6e 67 20 73 74 6f 72 65 0a + + ~ "~ is in this very same entry array that we're executing." + ~ " So, all the various" + 7e 20 69 73 20 69 6e 20 74 68 69 73 20 76 65 72 + 79 20 73 61 6d 65 20 65 6e 74 72 79 20 61 72 72 + 61 79 20 74 68 61 74 20 77 65 27 72 65 20 65 78 + 65 63 75 74 69 6e 67 2e 20 53 6f 2c 20 61 6c 6c + 20 74 68 65 20 76 61 72 69 6f 75 73 0a + + ~ "~ internal fields of an entry are available to provide rich" + ~ " behavior which" + 7e 20 69 6e 74 65 72 6e 61 6c 20 66 69 65 6c 64 + 73 20 6f 66 20 61 6e 20 65 6e 74 72 79 20 61 72 + 65 20 61 76 61 69 6c 61 62 6c 65 20 74 6f 20 70 + 72 6f 76 69 64 65 20 72 69 63 68 20 62 65 68 61 + 76 69 6f 72 20 77 68 69 63 68 0a + + ~ "~ allows different kinds of values to be formatted in" + ~ " different ways." + 7e 20 61 6c 6c 6f 77 73 20 64 69 66 66 65 72 65 + 6e 74 20 6b 69 6e 64 73 20 6f 66 20 76 61 6c 75 + 65 73 20 74 6f 20 62 65 20 66 6f 72 6d 61 74 74 + 65 64 20 69 6e 20 64 69 66 66 65 72 65 6e 74 20 + 77 61 79 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ For those used to languages with automatic memory" + ~ " management, keep in mind" + 7e 20 20 20 46 6f 72 20 74 68 6f 73 65 20 75 73 + 65 64 20 74 6f 20 6c 61 6e 67 75 61 67 65 73 20 + 77 69 74 68 20 61 75 74 6f 6d 61 74 69 63 20 6d + 65 6d 6f 72 79 20 6d 61 6e 61 67 65 6d 65 6e 74 + 2c 20 6b 65 65 70 20 69 6e 20 6d 69 6e 64 0a + + ~ "~ that there's no language-provided guarantee that the" + ~ " thing a pointer points" + 7e 20 74 68 61 74 20 74 68 65 72 65 27 73 20 6e + 6f 20 6c 61 6e 67 75 61 67 65 2d 70 72 6f 76 69 + 64 65 64 20 67 75 61 72 61 6e 74 65 65 20 74 68 + 61 74 20 74 68 65 20 74 68 69 6e 67 20 61 20 70 + 6f 69 6e 74 65 72 20 70 6f 69 6e 74 73 0a + + ~ "~ to still exists, and hasn't been replaced with some" + ~ " other" + 7e 20 74 6f 20 73 74 69 6c 6c 20 65 78 69 73 74 + 73 2c 20 61 6e 64 20 68 61 73 6e 27 74 20 62 65 + 65 6e 20 72 65 70 6c 61 63 65 64 20 77 69 74 68 + 20 73 6f 6d 65 20 6f 74 68 65 72 0a + + ~ "~ misleadingly-similar thing. The separation of all this" + ~ " stuff into phases" + 7e 20 6d 69 73 6c 65 61 64 69 6e 67 6c 79 2d 73 + 69 6d 69 6c 61 72 20 74 68 69 6e 67 2e 20 54 68 + 65 20 73 65 70 61 72 61 74 69 6f 6e 20 6f 66 20 + 61 6c 6c 20 74 68 69 73 20 73 74 75 66 66 20 69 + 6e 74 6f 20 70 68 61 73 65 73 0a + + ~ "~ provides that guarantee, because there's nothing in the" + ~ " formatting phase" + 7e 20 70 72 6f 76 69 64 65 73 20 74 68 61 74 20 + 67 75 61 72 61 6e 74 65 65 2c 20 62 65 63 61 75 + 73 65 20 74 68 65 72 65 27 73 20 6e 6f 74 68 69 + 6e 67 20 69 6e 20 74 68 65 20 66 6f 72 6d 61 74 + 74 69 6e 67 20 70 68 61 73 65 0a + + ~ "~ that destroys or moves metadata entries in the array, but" + ~ " if that separation" + 7e 20 74 68 61 74 20 64 65 73 74 72 6f 79 73 20 + 6f 72 20 6d 6f 76 65 73 20 6d 65 74 61 64 61 74 + 61 20 65 6e 74 72 69 65 73 20 69 6e 20 74 68 65 + 20 61 72 72 61 79 2c 20 62 75 74 20 69 66 20 74 + 68 61 74 20 73 65 70 61 72 61 74 69 6f 6e 0a + + ~ "~ were to break down, astonishingly complex wrong behavior" + ~ " would be entirely" + 7e 20 77 65 72 65 20 74 6f 20 62 72 65 61 6b 20 + 64 6f 77 6e 2c 20 61 73 74 6f 6e 69 73 68 69 6e + 67 6c 79 20 63 6f 6d 70 6c 65 78 20 77 72 6f 6e + 67 20 62 65 68 61 76 69 6f 72 20 77 6f 75 6c 64 + 20 62 65 20 65 6e 74 69 72 65 6c 79 0a + + ~ "~ likely. If you're reading all this, it's probably to" + ~ " touch that code, so" + 7e 20 6c 69 6b 65 6c 79 2e 20 49 66 20 79 6f 75 + 27 72 65 20 72 65 61 64 69 6e 67 20 61 6c 6c 20 + 74 68 69 73 2c 20 69 74 27 73 20 70 72 6f 62 61 + 62 6c 79 20 74 6f 20 74 6f 75 63 68 20 74 68 61 + 74 20 63 6f 64 65 2c 20 73 6f 0a + + ~ "~ please keep those consequences in mind." + 7e 20 70 6c 65 61 73 65 20 6b 65 65 70 20 74 68 + 6f 73 65 20 63 6f 6e 73 65 71 75 65 6e 63 65 73 + 20 69 6e 20 6d 69 6e 64 2e 0a + + ~ "~" + 7e 0a + + ~ "~ How do entry pointers get pushed onto the subitem entry" + ~ " stack, and where" + 7e 20 20 20 48 6f 77 20 64 6f 20 65 6e 74 72 79 + 20 70 6f 69 6e 74 65 72 73 20 67 65 74 20 70 75 + 73 68 65 64 20 6f 6e 74 6f 20 74 68 65 20 73 75 + 62 69 74 65 6d 20 65 6e 74 72 79 20 73 74 61 63 + 6b 2c 20 61 6e 64 20 77 68 65 72 65 0a + + ~ "~ do the values inside them come from? Okay, now this is" + ~ " the payoff, the part" + 7e 20 64 6f 20 74 68 65 20 76 61 6c 75 65 73 20 + 69 6e 73 69 64 65 20 74 68 65 6d 20 63 6f 6d 65 + 20 66 72 6f 6d 3f 20 4f 6b 61 79 2c 20 6e 6f 77 + 20 74 68 69 73 20 69 73 20 74 68 65 20 70 61 79 + 6f 66 66 2c 20 74 68 65 20 70 61 72 74 0a + + ~ "~ where you need to understand all these phases at once." + ~ " Cast your mind all" + 7e 20 77 68 65 72 65 20 79 6f 75 20 6e 65 65 64 + 20 74 6f 20 75 6e 64 65 72 73 74 61 6e 64 20 61 + 6c 6c 20 74 68 65 73 65 20 70 68 61 73 65 73 20 + 61 74 20 6f 6e 63 65 2e 20 43 61 73 74 20 79 6f + 75 72 20 6d 69 6e 64 20 61 6c 6c 0a + + ~ "~ the way back to the magic-comment execution, and take" + ~ " another look at the" + 7e 20 74 68 65 20 77 61 79 20 62 61 63 6b 20 74 + 6f 20 74 68 65 20 6d 61 67 69 63 2d 63 6f 6d 6d + 65 6e 74 20 65 78 65 63 75 74 69 6f 6e 2c 20 61 + 6e 64 20 74 61 6b 65 20 61 6e 6f 74 68 65 72 20 + 6c 6f 6f 6b 20 61 74 20 74 68 65 0a + + ~ "~ provide-* examples above. Recall that magic comment" + ~ " commands execute when" + 7e 20 70 72 6f 76 69 64 65 2d 2a 20 65 78 61 6d + 70 6c 65 73 20 61 62 6f 76 65 2e 20 52 65 63 61 + 6c 6c 20 74 68 61 74 20 6d 61 67 69 63 20 63 6f + 6d 6d 65 6e 74 20 63 6f 6d 6d 61 6e 64 73 20 65 + 78 65 63 75 74 65 20 77 68 65 6e 0a + + ~ "~ the word they're contained in is running. For the other" + ~ " comment commands," + 7e 20 74 68 65 20 77 6f 72 64 20 74 68 65 79 27 + 72 65 20 63 6f 6e 74 61 69 6e 65 64 20 69 6e 20 + 69 73 20 72 75 6e 6e 69 6e 67 2e 20 46 6f 72 20 + 74 68 65 20 6f 74 68 65 72 20 63 6f 6d 6d 65 6e + 74 20 63 6f 6d 6d 61 6e 64 73 2c 0a + + ~ "~ this is mostly a curiosity; we talked about" + ~ " adjust-length, above, but that's" + 7e 20 74 68 69 73 20 69 73 20 6d 6f 73 74 6c 79 + 20 61 20 63 75 72 69 6f 73 69 74 79 3b 20 77 65 + 20 74 61 6c 6b 65 64 20 61 62 6f 75 74 20 61 64 + 6a 75 73 74 2d 6c 65 6e 67 74 68 2c 20 61 62 6f + 76 65 2c 20 62 75 74 20 74 68 61 74 27 73 0a + + ~ "~ still just recording the fact that the word did or didn't" + ~ " run." + 7e 20 73 74 69 6c 6c 20 6a 75 73 74 20 72 65 63 + 6f 72 64 69 6e 67 20 74 68 65 20 66 61 63 74 20 + 74 68 61 74 20 74 68 65 20 77 6f 72 64 20 64 69 + 64 20 6f 72 20 64 69 64 6e 27 74 20 72 75 6e 2e + 0a + + ~ "~" + 7e 0a + + ~ "~ The provide-* commands are deeper than that. They peek" + ~ " at the top item on" + 7e 20 20 20 54 68 65 20 70 72 6f 76 69 64 65 2d + 2a 20 63 6f 6d 6d 61 6e 64 73 20 61 72 65 20 64 + 65 65 70 65 72 20 74 68 61 6e 20 74 68 61 74 2e + 20 54 68 65 79 20 70 65 65 6b 20 61 74 20 74 68 + 65 20 74 6f 70 20 69 74 65 6d 20 6f 6e 0a + + ~ "~ the stack OF THE COMPILER, the code being transformed." + ~ " The -decimal and" + 7e 20 74 68 65 20 73 74 61 63 6b 20 4f 46 20 54 + 48 45 20 43 4f 4d 50 49 4c 45 52 2c 20 74 68 65 + 20 63 6f 64 65 20 62 65 69 6e 67 20 74 72 61 6e + 73 66 6f 72 6d 65 64 2e 20 54 68 65 20 2d 64 65 + 63 69 6d 61 6c 20 61 6e 64 0a + + ~ "~ -hex* variants create a corresponding" + ~ " -entry-type-push-subitem- metadata" + 7e 20 2d 68 65 78 2a 20 76 61 72 69 61 6e 74 73 + 20 63 72 65 61 74 65 20 61 20 63 6f 72 72 65 73 + 70 6f 6e 64 69 6e 67 20 2d 65 6e 74 72 79 2d 74 + 79 70 65 2d 70 75 73 68 2d 73 75 62 69 74 65 6d + 2d 20 6d 65 74 61 64 61 74 61 0a + + ~ "~ entry of the matching type, and copy the numeric value" + ~ " into it." + 7e 20 65 6e 74 72 79 20 6f 66 20 74 68 65 20 6d + 61 74 63 68 69 6e 67 20 74 79 70 65 2c 20 61 6e + 64 20 63 6f 70 79 20 74 68 65 20 6e 75 6d 65 72 + 69 63 20 76 61 6c 75 65 20 69 6e 74 6f 20 69 74 + 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The -string variant expects to find a pointer to a" + ~ " null-terminated string;" + 7e 20 20 20 54 68 65 20 2d 73 74 72 69 6e 67 20 + 76 61 72 69 61 6e 74 20 65 78 70 65 63 74 73 20 + 74 6f 20 66 69 6e 64 20 61 20 70 6f 69 6e 74 65 + 72 20 74 6f 20 61 20 6e 75 6c 6c 2d 74 65 72 6d + 69 6e 61 74 65 64 20 73 74 72 69 6e 67 3b 0a + + ~ "~ -string-copy does too, but copies the contents of it to a" + ~ " safe place" + 7e 20 2d 73 74 72 69 6e 67 2d 63 6f 70 79 20 64 + 6f 65 73 20 74 6f 6f 2c 20 62 75 74 20 63 6f 70 + 69 65 73 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 + 20 6f 66 20 69 74 20 74 6f 20 61 20 73 61 66 65 + 20 70 6c 61 63 65 0a + + ~ "~ immediately, on the assumption they'll be overwritten." + ~ " The -keyword variant" + 7e 20 69 6d 6d 65 64 69 61 74 65 6c 79 2c 20 6f + 6e 20 74 68 65 20 61 73 73 75 6d 70 74 69 6f 6e + 20 74 68 65 79 27 6c 6c 20 62 65 20 6f 76 65 72 + 77 72 69 74 74 65 6e 2e 20 54 68 65 20 2d 6b 65 + 79 77 6f 72 64 20 76 61 72 69 61 6e 74 0a + + ~ "~ expects to find a keyword (a word which, when executed," + ~ " pushes its own" + 7e 20 65 78 70 65 63 74 73 20 74 6f 20 66 69 6e + 64 20 61 20 6b 65 79 77 6f 72 64 20 28 61 20 77 + 6f 72 64 20 77 68 69 63 68 2c 20 77 68 65 6e 20 + 65 78 65 63 75 74 65 64 2c 20 70 75 73 68 65 73 + 20 69 74 73 20 6f 77 6e 0a + + ~ "~ execution token onto the stack); the command extracts the" + ~ " name of the" + 7e 20 65 78 65 63 75 74 69 6f 6e 20 74 6f 6b 65 + 6e 20 6f 6e 74 6f 20 74 68 65 20 73 74 61 63 6b + 29 3b 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 65 + 78 74 72 61 63 74 73 20 74 68 65 20 6e 61 6d 65 + 20 6f 66 20 74 68 65 0a + + ~ "~ keyword from the dictionary entry header. All three of" + ~ " these save pointers" + 7e 20 6b 65 79 77 6f 72 64 20 66 72 6f 6d 20 74 + 68 65 20 64 69 63 74 69 6f 6e 61 72 79 20 65 6e + 74 72 79 20 68 65 61 64 65 72 2e 20 41 6c 6c 20 + 74 68 72 65 65 20 6f 66 20 74 68 65 73 65 20 73 + 61 76 65 20 70 6f 69 6e 74 65 72 73 0a + + ~ "~ to their respective strings in a push-subitem-string" + ~ " metadata entry. They" + 7e 20 74 6f 20 74 68 65 69 72 20 72 65 73 70 65 + 63 74 69 76 65 20 73 74 72 69 6e 67 73 20 69 6e + 20 61 20 70 75 73 68 2d 73 75 62 69 74 65 6d 2d + 73 74 72 69 6e 67 20 6d 65 74 61 64 61 74 61 20 + 65 6e 74 72 79 2e 20 54 68 65 79 0a + + ~ "~ also save the lengths of their strings to the subitem" + ~ " entry's length field;" + 7e 20 61 6c 73 6f 20 73 61 76 65 20 74 68 65 20 + 6c 65 6e 67 74 68 73 20 6f 66 20 74 68 65 69 72 + 20 73 74 72 69 6e 67 73 20 74 6f 20 74 68 65 20 + 73 75 62 69 74 65 6d 20 65 6e 74 72 79 27 73 20 + 6c 65 6e 67 74 68 20 66 69 65 6c 64 3b 0a + + ~ "~ this is in contrast to the non-string provide-* commands," + ~ " which use the" + 7e 20 74 68 69 73 20 69 73 20 69 6e 20 63 6f 6e + 74 72 61 73 74 20 74 6f 20 74 68 65 20 6e 6f 6e + 2d 73 74 72 69 6e 67 20 70 72 6f 76 69 64 65 2d + 2a 20 63 6f 6d 6d 61 6e 64 73 2c 20 77 68 69 63 + 68 20 75 73 65 20 74 68 65 0a + + ~ "~ command's parameter as their length values." + 7e 20 63 6f 6d 6d 61 6e 64 27 73 20 70 61 72 61 + 6d 65 74 65 72 20 61 73 20 74 68 65 69 72 20 6c + 65 6e 67 74 68 20 76 61 6c 75 65 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Admit it, you thought writing out "metadata entry" so" + ~ " many times instead" + 7e 20 20 20 41 64 6d 69 74 20 69 74 2c 20 79 6f + 75 20 74 68 6f 75 67 68 74 20 77 72 69 74 69 6e + 67 20 6f 75 74 20 22 6d 65 74 61 64 61 74 61 20 + 65 6e 74 72 79 22 20 73 6f 20 6d 61 6e 79 20 74 + 69 6d 65 73 20 69 6e 73 74 65 61 64 0a + + ~ "~ of just "entry" was silly because there was no other kind" + ~ " of entry in" + 7e 20 6f 66 20 6a 75 73 74 20 22 65 6e 74 72 79 + 22 20 77 61 73 20 73 69 6c 6c 79 20 62 65 63 61 + 75 73 65 20 74 68 65 72 65 20 77 61 73 20 6e 6f + 20 6f 74 68 65 72 20 6b 69 6e 64 20 6f 66 20 65 + 6e 74 72 79 20 69 6e 0a + + ~ "~ consideration, right up until you got to "dictionary" + ~ " entry". If so, hey" + 7e 20 63 6f 6e 73 69 64 65 72 61 74 69 6f 6e 2c + 20 72 69 67 68 74 20 75 70 20 75 6e 74 69 6c 20 + 79 6f 75 20 67 6f 74 20 74 6f 20 22 64 69 63 74 + 69 6f 6e 61 72 79 20 65 6e 74 72 79 22 2e 20 49 + 66 20 73 6f 2c 20 68 65 79 0a + + ~ "~ look, neat, right? ;)" + 7e 20 6c 6f 6f 6b 2c 20 6e 65 61 74 2c 20 72 69 + 67 68 74 3f 20 3b 29 0a + + ~ "~" + 7e 0a + + ~ "~ The -data variant treats the value as opaque, and" + ~ " creates an" + 7e 20 20 20 54 68 65 20 2d 64 61 74 61 20 76 61 + 72 69 61 6e 74 20 74 72 65 61 74 73 20 74 68 65 + 20 76 61 6c 75 65 20 61 73 20 6f 70 61 71 75 65 + 2c 20 61 6e 64 20 63 72 65 61 74 65 73 20 61 6e + 0a + + ~ "~ -entry-type-saved-data metadata entry. Unlike the others," + ~ " these entries do" + 7e 20 2d 65 6e 74 72 79 2d 74 79 70 65 2d 73 61 + 76 65 64 2d 64 61 74 61 20 6d 65 74 61 64 61 74 + 61 20 65 6e 74 72 79 2e 20 55 6e 6c 69 6b 65 20 + 74 68 65 20 6f 74 68 65 72 73 2c 20 74 68 65 73 + 65 20 65 6e 74 72 69 65 73 20 64 6f 0a + + ~ "~ not affect the subitem entry stack; they're consumed and" + ~ " removed from the" + 7e 20 6e 6f 74 20 61 66 66 65 63 74 20 74 68 65 + 20 73 75 62 69 74 65 6d 20 65 6e 74 72 79 20 73 + 74 61 63 6b 3b 20 74 68 65 79 27 72 65 20 63 6f + 6e 73 75 6d 65 64 20 61 6e 64 20 72 65 6d 6f 76 + 65 64 20 66 72 6f 6d 20 74 68 65 0a + + ~ "~ entry array before entry execution even starts, by the" + ~ " matching data-*" + 7e 20 65 6e 74 72 79 20 61 72 72 61 79 20 62 65 + 66 6f 72 65 20 65 6e 74 72 79 20 65 78 65 63 75 + 74 69 6f 6e 20 65 76 65 6e 20 73 74 61 72 74 73 + 2c 20 62 79 20 74 68 65 20 6d 61 74 63 68 69 6e + 67 20 64 61 74 61 2d 2a 0a + + ~ "~ command." + 7e 20 63 6f 6d 6d 61 6e 64 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Anyway, notice that when the various provide-* commands" + ~ " execute, all" + 7e 20 20 20 41 6e 79 77 61 79 2c 20 6e 6f 74 69 + 63 65 20 74 68 61 74 20 77 68 65 6e 20 74 68 65 + 20 76 61 72 69 6f 75 73 20 70 72 6f 76 69 64 65 + 2d 2a 20 63 6f 6d 6d 61 6e 64 73 20 65 78 65 63 + 75 74 65 2c 20 61 6c 6c 0a + + ~ "~ they're doing is capturing values and creating metadata" + ~ " entries. Like all" + 7e 20 74 68 65 79 27 72 65 20 64 6f 69 6e 67 20 + 69 73 20 63 61 70 74 75 72 69 6e 67 20 76 61 6c + 75 65 73 20 61 6e 64 20 63 72 65 61 74 69 6e 67 + 20 6d 65 74 61 64 61 74 61 20 65 6e 74 72 69 65 + 73 2e 20 4c 69 6b 65 20 61 6c 6c 0a + + ~ "~ metadata entries, these are attached to the latest output" + ~ " point as of the" + 7e 20 6d 65 74 61 64 61 74 61 20 65 6e 74 72 69 + 65 73 2c 20 74 68 65 73 65 20 61 72 65 20 61 74 + 74 61 63 68 65 64 20 74 6f 20 74 68 65 20 6c 61 + 74 65 73 74 20 6f 75 74 70 75 74 20 70 6f 69 6e + 74 20 61 73 20 6f 66 20 74 68 65 0a + + ~ "~ time the magic comment executes. In particular, the" + ~ " subitem entry stack" + 7e 20 74 69 6d 65 20 74 68 65 20 6d 61 67 69 63 + 20 63 6f 6d 6d 65 6e 74 20 65 78 65 63 75 74 65 + 73 2e 20 49 6e 20 70 61 72 74 69 63 75 6c 61 72 + 2c 20 74 68 65 20 73 75 62 69 74 65 6d 20 65 6e + 74 72 79 20 73 74 61 63 6b 0a + + ~ "~ isn't touched until all the way at the end, in the" + ~ " formatting phase. It's" + 7e 20 69 73 6e 27 74 20 74 6f 75 63 68 65 64 20 + 75 6e 74 69 6c 20 61 6c 6c 20 74 68 65 20 77 61 + 79 20 61 74 20 74 68 65 20 65 6e 64 2c 20 69 6e + 20 74 68 65 20 66 6f 72 6d 61 74 74 69 6e 67 20 + 70 68 61 73 65 2e 20 49 74 27 73 0a + + ~ "~ only when the formatting reaches the address the entry is" + ~ " attached to that" + 7e 20 6f 6e 6c 79 20 77 68 65 6e 20 74 68 65 20 + 66 6f 72 6d 61 74 74 69 6e 67 20 72 65 61 63 68 + 65 73 20 74 68 65 20 61 64 64 72 65 73 73 20 74 + 68 65 20 65 6e 74 72 79 20 69 73 20 61 74 74 61 + 63 68 65 64 20 74 6f 20 74 68 61 74 0a + + ~ "~ the entry is executed, which has the effect of pushing a" + ~ " pointer to the" + 7e 20 74 68 65 20 65 6e 74 72 79 20 69 73 20 65 + 78 65 63 75 74 65 64 2c 20 77 68 69 63 68 20 68 + 61 73 20 74 68 65 20 65 66 66 65 63 74 20 6f 66 + 20 70 75 73 68 69 6e 67 20 61 20 70 6f 69 6e 74 + 65 72 20 74 6f 20 74 68 65 0a + + ~ "~ entry onto the subitem entry stack." + 7e 20 65 6e 74 72 79 20 6f 6e 74 6f 20 74 68 65 + 20 73 75 62 69 74 65 6d 20 65 6e 74 72 79 20 73 + 74 61 63 6b 2e 0a + + ~ "~" + 7e 0a + + ~ "~ It's been said already, but just to bring it all full" + ~ " circle, the life" + 7e 20 20 20 49 74 27 73 20 62 65 65 6e 20 73 61 + 69 64 20 61 6c 72 65 61 64 79 2c 20 62 75 74 20 + 6a 75 73 74 20 74 6f 20 62 72 69 6e 67 20 69 74 + 20 61 6c 6c 20 66 75 6c 6c 20 63 69 72 63 6c 65 + 2c 20 74 68 65 20 6c 69 66 65 0a + + ~ "~ cycle of a push-* entry ends later in the formatting" + ~ " phase, when a comment" + 7e 20 63 79 63 6c 65 20 6f 66 20 61 20 70 75 73 + 68 2d 2a 20 65 6e 74 72 79 20 65 6e 64 73 20 6c + 61 74 65 72 20 69 6e 20 74 68 65 20 66 6f 72 6d + 61 74 74 69 6e 67 20 70 68 61 73 65 2c 20 77 68 + 65 6e 20 61 20 63 6f 6d 6d 65 6e 74 0a + + ~ "~ entry pops it off the subitem entry stack and" + ~ " pretty-prints the value it" + 7e 20 65 6e 74 72 79 20 70 6f 70 73 20 69 74 20 + 6f 66 66 20 74 68 65 20 73 75 62 69 74 65 6d 20 + 65 6e 74 72 79 20 73 74 61 63 6b 20 61 6e 64 20 + 70 72 65 74 74 79 2d 70 72 69 6e 74 73 20 74 68 + 65 20 76 61 6c 75 65 20 69 74 0a + + ~ "~ holds." + 7e 20 68 6f 6c 64 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ With all this context, it likely doesn't need much" + ~ " explanation, but the" + 7e 20 20 20 57 69 74 68 20 61 6c 6c 20 74 68 69 + 73 20 63 6f 6e 74 65 78 74 2c 20 69 74 20 6c 69 + 6b 65 6c 79 20 64 6f 65 73 6e 27 74 20 6e 65 65 + 64 20 6d 75 63 68 20 65 78 70 6c 61 6e 61 74 69 + 6f 6e 2c 20 62 75 74 20 74 68 65 0a + + ~ "~ drop-subitem command will create an" + ~ " -entry-type-drop-subitem entry. When" + 7e 20 64 72 6f 70 2d 73 75 62 69 74 65 6d 20 63 + 6f 6d 6d 61 6e 64 20 77 69 6c 6c 20 63 72 65 61 + 74 65 20 61 6e 20 2d 65 6e 74 72 79 2d 74 79 70 + 65 2d 64 72 6f 70 2d 73 75 62 69 74 65 6d 20 65 + 6e 74 72 79 2e 20 57 68 65 6e 0a + + ~ "~ this entry is executed, it will discard an item from the" + ~ " subitem entry" + 7e 20 74 68 69 73 20 65 6e 74 72 79 20 69 73 20 + 65 78 65 63 75 74 65 64 2c 20 69 74 20 77 69 6c + 6c 20 64 69 73 63 61 72 64 20 61 6e 20 69 74 65 + 6d 20 66 72 6f 6d 20 74 68 65 20 73 75 62 69 74 + 65 6d 20 65 6e 74 72 79 0a + + ~ "~ stack. Similarly, swap-subitems creates an" + ~ " -entry-type-swap-subitems, which" + 7e 20 73 74 61 63 6b 2e 20 53 69 6d 69 6c 61 72 + 6c 79 2c 20 73 77 61 70 2d 73 75 62 69 74 65 6d + 73 20 63 72 65 61 74 65 73 20 61 6e 20 2d 65 6e + 74 72 79 2d 74 79 70 65 2d 73 77 61 70 2d 73 75 + 62 69 74 65 6d 73 2c 20 77 68 69 63 68 0a + + ~ "~ swaps the top two items, and roll-subitems creates an" + 7e 20 73 77 61 70 73 20 74 68 65 20 74 6f 70 20 + 74 77 6f 20 69 74 65 6d 73 2c 20 61 6e 64 20 72 + 6f 6c 6c 2d 73 75 62 69 74 65 6d 73 20 63 72 65 + 61 74 65 73 20 61 6e 0a + + ~ "~ -entry-type-roll-subitems, which rolls them, or unrolls" + ~ " them with a negative" + 7e 20 2d 65 6e 74 72 79 2d 74 79 70 65 2d 72 6f + 6c 6c 2d 73 75 62 69 74 65 6d 73 2c 20 77 68 69 + 63 68 20 72 6f 6c 6c 73 20 74 68 65 6d 2c 20 6f + 72 20 75 6e 72 6f 6c 6c 73 20 74 68 65 6d 20 77 + 69 74 68 20 61 20 6e 65 67 61 74 69 76 65 0a + + ~ "~ parameter." + 7e 20 70 61 72 61 6d 65 74 65 72 2e 0a + + ~ "" + 0a + + ~ "~ In general, the order in which provide-* commands" + ~ " execute will most likely" + 7e 20 20 20 49 6e 20 67 65 6e 65 72 61 6c 2c 20 + 74 68 65 20 6f 72 64 65 72 20 69 6e 20 77 68 69 + 63 68 20 70 72 6f 76 69 64 65 2d 2a 20 63 6f 6d + 6d 61 6e 64 73 20 65 78 65 63 75 74 65 20 77 69 + 6c 6c 20 6d 6f 73 74 20 6c 69 6b 65 6c 79 0a + + ~ "~ match the order in which the corresponding bytes are" + ~ " output. This may not" + 7e 20 6d 61 74 63 68 20 74 68 65 20 6f 72 64 65 + 72 20 69 6e 20 77 68 69 63 68 20 74 68 65 20 63 + 6f 72 72 65 73 70 6f 6e 64 69 6e 67 20 62 79 74 + 65 73 20 61 72 65 20 6f 75 74 70 75 74 2e 20 54 + 68 69 73 20 6d 61 79 20 6e 6f 74 0a + + ~ "~ always match the order in which the comment template" + ~ " wants to pretty-print" + 7e 20 61 6c 77 61 79 73 20 6d 61 74 63 68 20 74 + 68 65 20 6f 72 64 65 72 20 69 6e 20 77 68 69 63 + 68 20 74 68 65 20 63 6f 6d 6d 65 6e 74 20 74 65 + 6d 70 6c 61 74 65 20 77 61 6e 74 73 20 74 6f 20 + 70 72 65 74 74 79 2d 70 72 69 6e 74 0a + + ~ "~ them. Therefore, you will want to use these commands to" + ~ " get the subitem" + 7e 20 74 68 65 6d 2e 20 54 68 65 72 65 66 6f 72 + 65 2c 20 79 6f 75 20 77 69 6c 6c 20 77 61 6e 74 + 20 74 6f 20 75 73 65 20 74 68 65 73 65 20 63 6f + 6d 6d 61 6e 64 73 20 74 6f 20 67 65 74 20 74 68 + 65 20 73 75 62 69 74 65 6d 0a + + ~ "~ stack in the proper order." + 7e 20 73 74 61 63 6b 20 69 6e 20 74 68 65 20 70 + 72 6f 70 65 72 20 6f 72 64 65 72 2e 0a + + ~ "~" + 7e 0a + + ~ "~ In using these commands that manipulate the subitem" + ~ " stack, it's important" + 7e 20 20 20 49 6e 20 75 73 69 6e 67 20 74 68 65 + 73 65 20 63 6f 6d 6d 61 6e 64 73 20 74 68 61 74 + 20 6d 61 6e 69 70 75 6c 61 74 65 20 74 68 65 20 + 73 75 62 69 74 65 6d 20 73 74 61 63 6b 2c 20 69 + 74 27 73 20 69 6d 70 6f 72 74 61 6e 74 0a + + ~ "~ to remember that, when formatting happens, the" + ~ " left-to-right output of" + 7e 20 74 6f 20 72 65 6d 65 6d 62 65 72 20 74 68 + 61 74 2c 20 77 68 65 6e 20 66 6f 72 6d 61 74 74 + 69 6e 67 20 68 61 70 70 65 6e 73 2c 20 74 68 65 + 20 6c 65 66 74 2d 74 6f 2d 72 69 67 68 74 20 6f + 75 74 70 75 74 20 6f 66 0a + + ~ "~ subitems in the final output comment is top-to-bottom on" + ~ " the subitem stack," + 7e 20 73 75 62 69 74 65 6d 73 20 69 6e 20 74 68 + 65 20 66 69 6e 61 6c 20 6f 75 74 70 75 74 20 63 + 6f 6d 6d 65 6e 74 20 69 73 20 74 6f 70 2d 74 6f + 2d 62 6f 74 74 6f 6d 20 6f 6e 20 74 68 65 20 73 + 75 62 69 74 65 6d 20 73 74 61 63 6b 2c 0a + + ~ "~ because they're popped in order. This is the opposite of" + ~ " the usual visual" + 7e 20 62 65 63 61 75 73 65 20 74 68 65 79 27 72 + 65 20 70 6f 70 70 65 64 20 69 6e 20 6f 72 64 65 + 72 2e 20 54 68 69 73 20 69 73 20 74 68 65 20 6f + 70 70 6f 73 69 74 65 20 6f 66 20 74 68 65 20 75 + 73 75 61 6c 20 76 69 73 75 61 6c 0a + + ~ "~ representation of stacks, and can easily be confusing." + 7e 20 72 65 70 72 65 73 65 6e 74 61 74 69 6f 6e + 20 6f 66 20 73 74 61 63 6b 73 2c 20 61 6e 64 20 + 63 61 6e 20 65 61 73 69 6c 79 20 62 65 20 63 6f + 6e 66 75 73 69 6e 67 2e 0a + + ~ "~" + 7e 0a + + ~ "~ It's probably clear from the extreme emphasis this" + ~ " documentation has taken" + 7e 20 20 20 49 74 27 73 20 70 72 6f 62 61 62 6c + 79 20 63 6c 65 61 72 20 66 72 6f 6d 20 74 68 65 + 20 65 78 74 72 65 6d 65 20 65 6d 70 68 61 73 69 + 73 20 74 68 69 73 20 64 6f 63 75 6d 65 6e 74 61 + 74 69 6f 6e 20 68 61 73 20 74 61 6b 65 6e 0a + + ~ "~ on describing the order things happen in, but it is quite" + ~ " common to define" + 7e 20 6f 6e 20 64 65 73 63 72 69 62 69 6e 67 20 + 74 68 65 20 6f 72 64 65 72 20 74 68 69 6e 67 73 + 20 68 61 70 70 65 6e 20 69 6e 2c 20 62 75 74 20 + 69 74 20 69 73 20 71 75 69 74 65 20 63 6f 6d 6d + 6f 6e 20 74 6f 20 64 65 66 69 6e 65 0a + + ~ "~ a suffix comment at the start of an assembly-instruction" + ~ " word; adjust its" + 7e 20 61 20 73 75 66 66 69 78 20 63 6f 6d 6d 65 + 6e 74 20 61 74 20 74 68 65 20 73 74 61 72 74 20 + 6f 66 20 61 6e 20 61 73 73 65 6d 62 6c 79 2d 69 + 6e 73 74 72 75 63 74 69 6f 6e 20 77 6f 72 64 3b + 20 61 64 6a 75 73 74 20 69 74 73 0a + + ~ "~ length as other words are called; accumulate push-*" + ~ " entries; then rely" + 7e 20 6c 65 6e 67 74 68 20 61 73 20 6f 74 68 65 + 72 20 77 6f 72 64 73 20 61 72 65 20 63 61 6c 6c + 65 64 3b 20 61 63 63 75 6d 75 6c 61 74 65 20 70 + 75 73 68 2d 2a 20 65 6e 74 72 69 65 73 3b 20 74 + 68 65 6e 20 72 65 6c 79 0a + + ~ "~ on the address sorting to make sure the push-* entries" + ~ " are executed" + 7e 20 6f 6e 20 74 68 65 20 61 64 64 72 65 73 73 + 20 73 6f 72 74 69 6e 67 20 74 6f 20 6d 61 6b 65 + 20 73 75 72 65 20 74 68 65 20 70 75 73 68 2d 2a + 20 65 6e 74 72 69 65 73 20 61 72 65 20 65 78 65 + 63 75 74 65 64 0a + + ~ "~ before the suffix comment entry, even though the" + ~ " suffix-comment command" + 7e 20 62 65 66 6f 72 65 20 74 68 65 20 73 75 66 + 66 69 78 20 63 6f 6d 6d 65 6e 74 20 65 6e 74 72 + 79 2c 20 65 76 65 6e 20 74 68 6f 75 67 68 20 74 + 68 65 20 73 75 66 66 69 78 2d 63 6f 6d 6d 65 6e + 74 20 63 6f 6d 6d 61 6e 64 0a + + ~ "~ executed before the others, and even though the" + ~ " adjust-length commands may" + 7e 20 65 78 65 63 75 74 65 64 20 62 65 66 6f 72 + 65 20 74 68 65 20 6f 74 68 65 72 73 2c 20 61 6e + 64 20 65 76 65 6e 20 74 68 6f 75 67 68 20 74 68 + 65 20 61 64 6a 75 73 74 2d 6c 65 6e 67 74 68 20 + 63 6f 6d 6d 61 6e 64 73 20 6d 61 79 0a + + ~ "~ have come before or after the provide-* commands that go" + ~ " with the same" + 7e 20 68 61 76 65 20 63 6f 6d 65 20 62 65 66 6f + 72 65 20 6f 72 20 61 66 74 65 72 20 74 68 65 20 + 70 72 6f 76 69 64 65 2d 2a 20 63 6f 6d 6d 61 6e + 64 73 20 74 68 61 74 20 67 6f 20 77 69 74 68 20 + 74 68 65 20 73 61 6d 65 0a + + ~ "~ suffix comment." + 7e 20 73 75 66 66 69 78 20 63 6f 6d 6d 65 6e 74 + 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Now that you have this full picture in your head, you" + ~ " finally also have" + 7e 20 20 20 4e 6f 77 20 74 68 61 74 20 79 6f 75 + 20 68 61 76 65 20 74 68 69 73 20 66 75 6c 6c 20 + 70 69 63 74 75 72 65 20 69 6e 20 79 6f 75 72 20 + 68 65 61 64 2c 20 79 6f 75 20 66 69 6e 61 6c 6c + 79 20 61 6c 73 6f 20 68 61 76 65 0a + + ~ "~ the background to understand the data-adjust-* commands." + ~ " You may find it" + 7e 20 74 68 65 20 62 61 63 6b 67 72 6f 75 6e 64 + 20 74 6f 20 75 6e 64 65 72 73 74 61 6e 64 20 74 + 68 65 20 64 61 74 61 2d 61 64 6a 75 73 74 2d 2a + 20 63 6f 6d 6d 61 6e 64 73 2e 20 59 6f 75 20 6d + 61 79 20 66 69 6e 64 20 69 74 0a + + ~ "~ helpful to go re-read the explanation of them, above, to" + ~ " let it sink in." + 7e 20 68 65 6c 70 66 75 6c 20 74 6f 20 67 6f 20 + 72 65 2d 72 65 61 64 20 74 68 65 20 65 78 70 6c + 61 6e 61 74 69 6f 6e 20 6f 66 20 74 68 65 6d 2c + 20 61 62 6f 76 65 2c 20 74 6f 20 6c 65 74 20 69 + 74 20 73 69 6e 6b 20 69 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ This is the kind of forwards-and-backwards thinking" + ~ " which humans are" + 7e 20 20 20 54 68 69 73 20 69 73 20 74 68 65 20 + 6b 69 6e 64 20 6f 66 20 66 6f 72 77 61 72 64 73 + 2d 61 6e 64 2d 62 61 63 6b 77 61 72 64 73 20 74 + 68 69 6e 6b 69 6e 67 20 77 68 69 63 68 20 68 75 + 6d 61 6e 73 20 61 72 65 0a + + ~ "~ surprisingly good at when reading and writing software," + ~ " but which it's" + 7e 20 73 75 72 70 72 69 73 69 6e 67 6c 79 20 67 + 6f 6f 64 20 61 74 20 77 68 65 6e 20 72 65 61 64 + 69 6e 67 20 61 6e 64 20 77 72 69 74 69 6e 67 20 + 73 6f 66 74 77 61 72 65 2c 20 62 75 74 20 77 68 + 69 63 68 20 69 74 27 73 0a + + ~ "~ quite difficult to formalize in a way that lets a" + ~ " computer share that" + 7e 20 71 75 69 74 65 20 64 69 66 66 69 63 75 6c + 74 20 74 6f 20 66 6f 72 6d 61 6c 69 7a 65 20 69 + 6e 20 61 20 77 61 79 20 74 68 61 74 20 6c 65 74 + 73 20 61 20 63 6f 6d 70 75 74 65 72 20 73 68 61 + 72 65 20 74 68 61 74 0a + + ~ "~ understanding. If you've read this far, Irenes would" + ~ " absolutely adore" + 7e 20 75 6e 64 65 72 73 74 61 6e 64 69 6e 67 2e + 20 49 66 20 79 6f 75 27 76 65 20 72 65 61 64 20 + 74 68 69 73 20 66 61 72 2c 20 49 72 65 6e 65 73 + 20 77 6f 75 6c 64 20 61 62 73 6f 6c 75 74 65 6c + 79 20 61 64 6f 72 65 0a + + ~ "~ hearing about how you found the explanation and whether" + ~ " you did anything" + 7e 20 68 65 61 72 69 6e 67 20 61 62 6f 75 74 20 + 68 6f 77 20 79 6f 75 20 66 6f 75 6e 64 20 74 68 + 65 20 65 78 70 6c 61 6e 61 74 69 6f 6e 20 61 6e + 64 20 77 68 65 74 68 65 72 20 79 6f 75 20 64 69 + 64 20 61 6e 79 74 68 69 6e 67 0a + + ~ "~ with it; don't be shy!" + 7e 20 77 69 74 68 20 69 74 3b 20 64 6f 6e 27 74 + 20 62 65 20 73 68 79 21 0a + + ~ "~" + 7e 0a + + ~ "~ [1] https://katalepsis.net/" + 7e 20 5b 31 5d 20 68 74 74 70 73 3a 2f 2f 6b 61 + 74 61 6c 65 70 73 69 73 2e 6e 65 74 2f 0a + + ~ "" + 0a + + ~ "~ We have a bunch of accessors and traversers for the" + ~ " output metadata, which" + 7e 20 20 20 57 65 20 68 61 76 65 20 61 20 62 75 + 6e 63 68 20 6f 66 20 61 63 63 65 73 73 6f 72 73 + 20 61 6e 64 20 74 72 61 76 65 72 73 65 72 73 20 + 66 6f 72 20 74 68 65 20 6f 75 74 70 75 74 20 6d + 65 74 61 64 61 74 61 2c 20 77 68 69 63 68 0a + + ~ "~ are all functions from pointers to pointers. Don't" + ~ " confuse these with the" + 7e 20 61 72 65 20 61 6c 6c 20 66 75 6e 63 74 69 + 6f 6e 73 20 66 72 6f 6d 20 70 6f 69 6e 74 65 72 + 73 20 74 6f 20 70 6f 69 6e 74 65 72 73 2e 20 44 + 6f 6e 27 74 20 63 6f 6e 66 75 73 65 20 74 68 65 + 73 65 20 77 69 74 68 20 74 68 65 0a + + ~ "~ accessors for the transformation state, defined far, far" + ~ " above." + 7e 20 61 63 63 65 73 73 6f 72 73 20 66 6f 72 20 + 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 + 6f 6e 20 73 74 61 74 65 2c 20 64 65 66 69 6e 65 + 64 20 66 61 72 2c 20 66 61 72 20 61 62 6f 76 65 + 2e 0a + + ~ ": hex-output-metadata-label-loop-buffer-start ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 6c 61 62 65 6c 2d 6c 6f 6f 70 + 2d 62 75 66 66 65 72 2d 73 74 61 72 74 20 3b 0a + + ~ ": hex-output-metadata-label-loop-buffer-length 8 + ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 6c 61 62 65 6c 2d 6c 6f 6f 70 + 2d 62 75 66 66 65 72 2d 6c 65 6e 67 74 68 20 38 + 20 2b 20 3b 0a + + ~ ": hex-output-metadata-latest-output-point 2 8 * + ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 6c 61 74 65 73 74 2d 6f 75 74 + 70 75 74 2d 70 6f 69 6e 74 20 32 20 38 20 2a 20 + 2b 20 3b 0a + + ~ ": hex-output-metadata-has-non-space-this-input-line 3 8 * +" + ~ " ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 68 61 73 2d 6e 6f 6e 2d 73 70 + 61 63 65 2d 74 68 69 73 2d 69 6e 70 75 74 2d 6c + 69 6e 65 20 33 20 38 20 2a 20 2b 20 3b 0a + + ~ ": hex-output-metadata-suppression-count 4 8 * + ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 73 75 70 70 72 65 73 73 69 6f + 6e 2d 63 6f 75 6e 74 20 34 20 38 20 2a 20 2b 20 + 3b 0a + + ~ ": hex-output-metadata-is-fresh-line 5 8 * + ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 69 73 2d 66 72 65 73 68 2d 6c + 69 6e 65 20 35 20 38 20 2a 20 2b 20 3b 0a + + ~ ": hex-output-metadata-indentation-depth 6 8 * + ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 69 6e 64 65 6e 74 61 74 69 6f + 6e 2d 64 65 70 74 68 20 36 20 38 20 2a 20 2b 20 + 3b 0a + + ~ ": hex-output-metadata-current-column 7 8 * + ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 63 75 72 72 65 6e 74 2d 63 6f + 6c 75 6d 6e 20 37 20 38 20 2a 20 2b 20 3b 0a + + ~ ": hex-output-metadata-n-bytes-this-line 8 8 * + ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 6e 2d 62 79 74 65 73 2d 74 68 + 69 73 2d 6c 69 6e 65 20 38 20 38 20 2a 20 2b 20 + 3b 0a + + ~ ": hex-output-metadata-entry-count 9 8 * + ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 63 6f 75 6e + 74 20 39 20 38 20 2a 20 2b 20 3b 0a + + ~ ": hex-output-metadata-subitem-entry-stack-depth 10 8 * + ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 73 75 62 69 74 65 6d 2d 65 6e + 74 72 79 2d 73 74 61 63 6b 2d 64 65 70 74 68 20 + 31 30 20 38 20 2a 20 2b 20 3b 0a + + ~ ": hex-output-metadata-subitem-entry-stack-zero 11 8 * + ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 73 75 62 69 74 65 6d 2d 65 6e + 74 72 79 2d 73 74 61 63 6b 2d 7a 65 72 6f 20 31 + 31 20 38 20 2a 20 2b 20 3b 0a + + ~ ": hex-output-metadata-subitem-entry-stack-capacity 8 ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 73 75 62 69 74 65 6d 2d 65 6e + 74 72 79 2d 73 74 61 63 6b 2d 63 61 70 61 63 69 + 74 79 20 38 20 3b 0a + + ~ ": hex-output-metadata-first-entry" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 66 69 72 73 74 2d 65 6e 74 72 + 79 0a + + ~ " 11 hex-output-metadata-subitem-entry-stack-capacity + 8 *" + ~ " + ;" + 20 20 31 31 20 68 65 78 2d 6f 75 74 70 75 74 2d + 6d 65 74 61 64 61 74 61 2d 73 75 62 69 74 65 6d + 2d 65 6e 74 72 79 2d 73 74 61 63 6b 2d 63 61 70 + 61 63 69 74 79 20 2b 20 38 20 2a 20 2b 20 3b 0a + + ~ ": hex-output-metadata-entry-data-start ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 64 61 74 61 + 2d 73 74 61 72 74 20 3b 0a + + ~ ": hex-output-metadata-entry-data-length 8 + ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 64 61 74 61 + 2d 6c 65 6e 67 74 68 20 38 20 2b 20 3b 0a + + ~ ": hex-output-metadata-entry-type 2 8 * + ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 20 32 20 38 20 2a 20 2b 20 3b 0a + + ~ ": hex-output-metadata-entry-content 3 8 * + ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 63 6f 6e 74 + 65 6e 74 20 33 20 38 20 2a 20 2b 20 3b 0a + + ~ ": hex-output-metadata-entry-structure-size 4 8 * ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 73 74 72 75 + 63 74 75 72 65 2d 73 69 7a 65 20 34 20 38 20 2a + 20 3b 0a + + ~ ": hex-output-metadata-next-entry" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 6e 65 78 74 2d 65 6e 74 72 79 + 0a + + ~ " hex-output-metadata-entry-structure-size + ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 73 74 72 75 + 63 74 75 72 65 2d 73 69 7a 65 20 2b 20 3b 0a + + ~ ": hex-output-metadata-previous-entry" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 70 72 65 76 69 6f 75 73 2d 65 + 6e 74 72 79 0a + + ~ " hex-output-metadata-entry-structure-size - ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 73 74 72 75 + 63 74 75 72 65 2d 73 69 7a 65 20 2d 20 3b 0a + + ~ ": hex-output-metadata-entry-type-line-comment 0 ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 6c 69 6e 65 2d 63 6f 6d 6d 65 6e 74 20 30 20 + 3b 0a + + ~ ": hex-output-metadata-entry-type-suffix-comment 1 ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 73 75 66 66 69 78 2d 63 6f 6d 6d 65 6e 74 20 + 31 20 3b 0a + + ~ ": hex-output-metadata-entry-type-fresh-line 2 ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 66 72 65 73 68 2d 6c 69 6e 65 20 32 20 3b 0a + + ~ ": hex-output-metadata-entry-type-blank-line 3 ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 62 6c 61 6e 6b 2d 6c 69 6e 65 20 33 20 3b 0a + + ~ ": hex-output-metadata-entry-type-indent 4 ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 69 6e 64 65 6e 74 20 34 20 3b 0a + + ~ ": hex-output-metadata-entry-type-string-literal 5 ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 73 74 72 69 6e 67 2d 6c 69 74 65 72 61 6c 20 + 35 20 3b 0a + + ~ ": hex-output-metadata-entry-type-raw-string-literal 6 ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 72 61 77 2d 73 74 72 69 6e 67 2d 6c 69 74 65 + 72 61 6c 20 36 20 3b 0a + + ~ ": hex-output-metadata-entry-type-push-subitem-decimal 7 ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 64 65 + 63 69 6d 61 6c 20 37 20 3b 0a + + ~ ": hex-output-metadata-entry-type-push-subitem-hex 8 ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 68 65 + 78 20 38 20 3b 0a + + ~ ": hex-output-metadata-entry-type-push-subitem-hex8 9 ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 68 65 + 78 38 20 39 20 3b 0a + + ~ ": hex-output-metadata-entry-type-push-subitem-hex16 10 ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 68 65 + 78 31 36 20 31 30 20 3b 0a + + ~ ": hex-output-metadata-entry-type-push-subitem-hex32 11 ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 68 65 + 78 33 32 20 31 31 20 3b 0a + + ~ ": hex-output-metadata-entry-type-push-subitem-hex64 12 ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 68 65 + 78 36 34 20 31 32 20 3b 0a + + ~ ": hex-output-metadata-entry-type-push-subitem-string 13 ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 73 74 + 72 69 6e 67 20 31 33 20 3b 0a + + ~ ": hex-output-metadata-entry-type-saved-data 14 ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 73 61 76 65 64 2d 64 61 74 61 20 31 34 20 3b + 0a + + ~ ": hex-output-metadata-entry-type-drop-subitem 15 ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 64 72 6f 70 2d 73 75 62 69 74 65 6d 20 31 35 + 20 3b 0a + + ~ ": hex-output-metadata-entry-type-swap-subitems 16 ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 73 77 61 70 2d 73 75 62 69 74 65 6d 73 20 31 + 36 20 3b 0a + + ~ ": hex-output-metadata-entry-type-roll-subitems 17 ;" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 72 6f 6c 6c 2d 73 75 62 69 74 65 6d 73 20 31 + 37 20 3b 0a + + ~ "" + 0a + + ~ "~ Initialize the contents of the output metadata to all" + ~ " zeroes. This is" + 7e 20 20 20 49 6e 69 74 69 61 6c 69 7a 65 20 74 + 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f 66 20 74 + 68 65 20 6f 75 74 70 75 74 20 6d 65 74 61 64 61 + 74 61 20 74 6f 20 61 6c 6c 20 7a 65 72 6f 65 73 + 2e 20 54 68 69 73 20 69 73 0a + + ~ "~ called from hex-transform at its top level, at the very" + ~ " start, to make sure" + 7e 20 63 61 6c 6c 65 64 20 66 72 6f 6d 20 68 65 + 78 2d 74 72 61 6e 73 66 6f 72 6d 20 61 74 20 69 + 74 73 20 74 6f 70 20 6c 65 76 65 6c 2c 20 61 74 + 20 74 68 65 20 76 65 72 79 20 73 74 61 72 74 2c + 20 74 6f 20 6d 61 6b 65 20 73 75 72 65 0a + + ~ "~ everything is structurally valid. We can't store real" + ~ " values at that point," + 7e 20 65 76 65 72 79 74 68 69 6e 67 20 69 73 20 + 73 74 72 75 63 74 75 72 61 6c 6c 79 20 76 61 6c + 69 64 2e 20 57 65 20 63 61 6e 27 74 20 73 74 6f + 72 65 20 72 65 61 6c 20 76 61 6c 75 65 73 20 61 + 74 20 74 68 61 74 20 70 6f 69 6e 74 2c 0a + + ~ "~ because they don't exist yet. The actual label-loop" + ~ " buffer, per its name," + 7e 20 62 65 63 61 75 73 65 20 74 68 65 79 20 64 + 6f 6e 27 74 20 65 78 69 73 74 20 79 65 74 2e 20 + 54 68 65 20 61 63 74 75 61 6c 20 6c 61 62 65 6c + 2d 6c 6f 6f 70 20 62 75 66 66 65 72 2c 20 70 65 + 72 20 69 74 73 20 6e 61 6d 65 2c 0a + + ~ "~ won't be allocated until label-loop is called, so we" + ~ " can't possibly know its" + 7e 20 77 6f 6e 27 74 20 62 65 20 61 6c 6c 6f 63 + 61 74 65 64 20 75 6e 74 69 6c 20 6c 61 62 65 6c + 2d 6c 6f 6f 70 20 69 73 20 63 61 6c 6c 65 64 2c + 20 73 6f 20 77 65 20 63 61 6e 27 74 20 70 6f 73 + 73 69 62 6c 79 20 6b 6e 6f 77 20 69 74 73 0a + + ~ "~ address till then." + 7e 20 61 64 64 72 65 73 73 20 74 69 6c 6c 20 74 + 68 65 6e 2e 0a + + ~ ": zero-hex-output-metadata" + 3a 20 7a 65 72 6f 2d 68 65 78 2d 6f 75 74 70 75 + 74 2d 6d 65 74 61 64 61 74 61 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " dup hex-output-metadata-label-loop-buffer-start 0 swap !" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 6c 61 62 65 6c 2d + 6c 6f 6f 70 2d 62 75 66 66 65 72 2d 73 74 61 72 + 74 20 30 20 73 77 61 70 20 21 0a + + ~ " dup hex-output-metadata-label-loop-buffer-length 0 swap" + ~ " !" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 6c 61 62 65 6c 2d + 6c 6f 6f 70 2d 62 75 66 66 65 72 2d 6c 65 6e 67 + 74 68 20 30 20 73 77 61 70 20 21 0a + + ~ " dup hex-output-metadata-latest-output-point 0 swap !" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 6c 61 74 65 73 74 + 2d 6f 75 74 70 75 74 2d 70 6f 69 6e 74 20 30 20 + 73 77 61 70 20 21 0a + + ~ " dup hex-output-metadata-has-non-space-this-input-line 0" + ~ " swap !" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 68 61 73 2d 6e 6f + 6e 2d 73 70 61 63 65 2d 74 68 69 73 2d 69 6e 70 + 75 74 2d 6c 69 6e 65 20 30 20 73 77 61 70 20 21 + 0a + + ~ " dup hex-output-metadata-suppression-count 0 swap !" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 73 75 70 70 72 65 + 73 73 69 6f 6e 2d 63 6f 75 6e 74 20 30 20 73 77 + 61 70 20 21 0a + + ~ " dup hex-output-metadata-is-fresh-line 1 swap !" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 69 73 2d 66 72 65 + 73 68 2d 6c 69 6e 65 20 31 20 73 77 61 70 20 21 + 0a + + ~ " dup hex-output-metadata-indentation-depth 0 swap !" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 69 6e 64 65 6e 74 + 61 74 69 6f 6e 2d 64 65 70 74 68 20 30 20 73 77 + 61 70 20 21 0a + + ~ " dup hex-output-metadata-current-column 0 swap !" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 63 75 72 72 65 6e + 74 2d 63 6f 6c 75 6d 6e 20 30 20 73 77 61 70 20 + 21 0a + + ~ " dup hex-output-metadata-n-bytes-this-line 0 swap !" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 6e 2d 62 79 74 65 + 73 2d 74 68 69 73 2d 6c 69 6e 65 20 30 20 73 77 + 61 70 20 21 0a + + ~ " dup hex-output-metadata-entry-count 0 swap !" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 63 6f 75 6e 74 20 30 20 73 77 61 70 20 21 0a + + ~ " dup hex-output-metadata-subitem-entry-stack-depth 0 swap" + ~ " !" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 73 75 62 69 74 65 + 6d 2d 65 6e 74 72 79 2d 73 74 61 63 6b 2d 64 65 + 70 74 68 20 30 20 73 77 61 70 20 21 0a + + ~ " dup hex-output-metadata-first-entry 0 swap ! ;" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 66 69 72 73 74 2d + 65 6e 74 72 79 20 30 20 73 77 61 70 20 21 20 3b + 0a + + ~ "" + 0a + + ~ "~ (pointer -- boolean)" + 7e 20 28 70 6f 69 6e 74 65 72 20 2d 2d 20 62 6f + 6f 6c 65 61 6e 29 0a + + ~ ": is-in-label-loop-buffer" + 3a 20 69 73 2d 69 6e 2d 6c 61 62 65 6c 2d 6c 6f + 6f 70 2d 62 75 66 66 65 72 0a + + ~ " dup" + 20 20 64 75 70 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-label-loop-buffer-start @" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 6c 61 62 65 6c 2d 6c 6f 6f 70 + 2d 62 75 66 66 65 72 2d 73 74 61 72 74 20 40 0a + + ~ " <=" + 20 20 3c 3d 0a + + ~ " swap" + 20 20 73 77 61 70 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " dup hex-output-metadata-label-loop-buffer-start @" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 6c 61 62 65 6c 2d + 6c 6f 6f 70 2d 62 75 66 66 65 72 2d 73 74 61 72 + 74 20 40 0a + + ~ " swap hex-output-metadata-label-loop-buffer-length @ +" + 20 20 73 77 61 70 20 68 65 78 2d 6f 75 74 70 75 + 74 2d 6d 65 74 61 64 61 74 61 2d 6c 61 62 65 6c + 2d 6c 6f 6f 70 2d 62 75 66 66 65 72 2d 6c 65 6e + 67 74 68 20 40 20 2b 0a + + ~ " > && ;" + 20 20 3e 20 26 26 20 3b 0a + + ~ "" + 0a + + ~ ": has-non-space-this-input-line@" + 3a 20 68 61 73 2d 6e 6f 6e 2d 73 70 61 63 65 2d + 74 68 69 73 2d 69 6e 70 75 74 2d 6c 69 6e 65 40 + 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-has-non-space-this-input-line @ ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 68 61 73 2d 6e 6f 6e 2d 73 70 + 61 63 65 2d 74 68 69 73 2d 69 6e 70 75 74 2d 6c + 69 6e 65 20 40 20 3b 0a + + ~ "" + 0a + + ~ ": has-non-space-this-input-line!" + 3a 20 68 61 73 2d 6e 6f 6e 2d 73 70 61 63 65 2d + 74 68 69 73 2d 69 6e 70 75 74 2d 6c 69 6e 65 21 + 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-has-non-space-this-input-line ! ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 68 61 73 2d 6e 6f 6e 2d 73 70 + 61 63 65 2d 74 68 69 73 2d 69 6e 70 75 74 2d 6c + 69 6e 65 20 21 20 3b 0a + + ~ "" + 0a + + ~ ": is-comment-entry" + 3a 20 69 73 2d 63 6f 6d 6d 65 6e 74 2d 65 6e 74 + 72 79 0a + + ~ " hex-output-metadata-entry-type @" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 20 40 0a + + ~ " dup hex-output-metadata-entry-type-line-comment = swap" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 74 79 70 65 2d 6c 69 6e 65 2d 63 6f 6d 6d 65 6e + 74 20 3d 20 73 77 61 70 0a + + ~ " hex-output-metadata-entry-type-suffix-comment = || ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 73 75 66 66 69 78 2d 63 6f 6d 6d 65 6e 74 20 + 3d 20 7c 7c 20 3b 0a + + ~ "" + 0a + + ~ ": is-output-producing-entry" + 3a 20 69 73 2d 6f 75 74 70 75 74 2d 70 72 6f 64 + 75 63 69 6e 67 2d 65 6e 74 72 79 0a + + ~ " dup is-comment-entry swap" + 20 20 64 75 70 20 69 73 2d 63 6f 6d 6d 65 6e 74 + 2d 65 6e 74 72 79 20 73 77 61 70 0a + + ~ " hex-output-metadata-entry-type @" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 20 40 0a + + ~ " dup hex-output-metadata-entry-type-fresh-line = 3roll ||" + ~ " swap" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 74 79 70 65 2d 66 72 65 73 68 2d 6c 69 6e 65 20 + 3d 20 33 72 6f 6c 6c 20 7c 7c 20 73 77 61 70 0a + + ~ " hex-output-metadata-entry-type-blank-line = || ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 62 6c 61 6e 6b 2d 6c 69 6e 65 20 3d 20 7c 7c + 20 3b 0a + + ~ "" + 0a + + ~ ": is-saved-data-entry" + 3a 20 69 73 2d 73 61 76 65 64 2d 64 61 74 61 2d + 65 6e 74 72 79 0a + + ~ " hex-output-metadata-entry-type @" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 20 40 0a + + ~ " hex-output-metadata-entry-type-saved-data = ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 73 61 76 65 64 2d 64 61 74 61 20 3d 20 3b 0a + + ~ "" + 0a + + ~ ": is-push-subitem-entry" + 3a 20 69 73 2d 70 75 73 68 2d 73 75 62 69 74 65 + 6d 2d 65 6e 74 72 79 0a + + ~ " ~ Notably, the subitem swap, drop, and roll entry types" + ~ " are not" + 20 20 7e 20 20 20 4e 6f 74 61 62 6c 79 2c 20 74 + 68 65 20 73 75 62 69 74 65 6d 20 73 77 61 70 2c + 20 64 72 6f 70 2c 20 61 6e 64 20 72 6f 6c 6c 20 + 65 6e 74 72 79 20 74 79 70 65 73 20 61 72 65 20 + 6e 6f 74 0a + + ~ " ~ push-subitem entries." + 20 20 7e 20 70 75 73 68 2d 73 75 62 69 74 65 6d + 20 65 6e 74 72 69 65 73 2e 0a + + ~ " hex-output-metadata-entry-type @" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 20 40 0a + + ~ " dup hex-output-metadata-entry-type-push-subitem-decimal =" + ~ " swap" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 74 79 70 65 2d 70 75 73 68 2d 73 75 62 69 74 65 + 6d 2d 64 65 63 69 6d 61 6c 20 3d 20 73 77 61 70 + 0a + + ~ " dup hex-output-metadata-entry-type-push-subitem-hex =" + ~ " 3roll || swap" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 74 79 70 65 2d 70 75 73 68 2d 73 75 62 69 74 65 + 6d 2d 68 65 78 20 3d 20 33 72 6f 6c 6c 20 7c 7c + 20 73 77 61 70 0a + + ~ " dup hex-output-metadata-entry-type-push-subitem-hex8 =" + ~ " 3roll || swap" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 74 79 70 65 2d 70 75 73 68 2d 73 75 62 69 74 65 + 6d 2d 68 65 78 38 20 3d 20 33 72 6f 6c 6c 20 7c + 7c 20 73 77 61 70 0a + + ~ " dup hex-output-metadata-entry-type-push-subitem-hex16 =" + ~ " 3roll || swap" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 74 79 70 65 2d 70 75 73 68 2d 73 75 62 69 74 65 + 6d 2d 68 65 78 31 36 20 3d 20 33 72 6f 6c 6c 20 + 7c 7c 20 73 77 61 70 0a + + ~ " dup hex-output-metadata-entry-type-push-subitem-hex32 =" + ~ " 3roll || swap" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 74 79 70 65 2d 70 75 73 68 2d 73 75 62 69 74 65 + 6d 2d 68 65 78 33 32 20 3d 20 33 72 6f 6c 6c 20 + 7c 7c 20 73 77 61 70 0a + + ~ " dup hex-output-metadata-entry-type-push-subitem-hex64 =" + ~ " 3roll || swap" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 74 79 70 65 2d 70 75 73 68 2d 73 75 62 69 74 65 + 6d 2d 68 65 78 36 34 20 3d 20 33 72 6f 6c 6c 20 + 7c 7c 20 73 77 61 70 0a + + ~ " hex-output-metadata-entry-type-push-subitem-string = ||" + ~ " ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 73 74 + 72 69 6e 67 20 3d 20 7c 7c 20 3b 0a + + ~ "" + 0a + + ~ ": is-subitem-stack-manipulation-entry" + 3a 20 69 73 2d 73 75 62 69 74 65 6d 2d 73 74 61 + 63 6b 2d 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 2d + 65 6e 74 72 79 0a + + ~ " hex-output-metadata-entry-type @" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 20 40 0a + + ~ " dup hex-output-metadata-entry-type-drop-subitem = swap" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 74 79 70 65 2d 64 72 6f 70 2d 73 75 62 69 74 65 + 6d 20 3d 20 73 77 61 70 0a + + ~ " dup hex-output-metadata-entry-type-swap-subitems = 3roll" + ~ " || swap" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 74 79 70 65 2d 73 77 61 70 2d 73 75 62 69 74 65 + 6d 73 20 3d 20 33 72 6f 6c 6c 20 7c 7c 20 73 77 + 61 70 0a + + ~ " hex-output-metadata-entry-type-roll-subitems = || ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 72 6f 6c 6c 2d 73 75 62 69 74 65 6d 73 20 3d + 20 7c 7c 20 3b 0a + + ~ "" + 0a + + ~ ": is-fresh-line@" + 3a 20 69 73 2d 66 72 65 73 68 2d 6c 69 6e 65 40 + 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-is-fresh-line @ ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 69 73 2d 66 72 65 73 68 2d 6c + 69 6e 65 20 40 20 3b 0a + + ~ "" + 0a + + ~ ": is-fresh-line!" + 3a 20 69 73 2d 66 72 65 73 68 2d 6c 69 6e 65 21 + 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-is-fresh-line ! ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 69 73 2d 66 72 65 73 68 2d 6c + 69 6e 65 20 21 20 3b 0a + + ~ "" + 0a + + ~ ": fresh-line is-fresh-line@ not { newline } if ;" + 3a 20 66 72 65 73 68 2d 6c 69 6e 65 20 69 73 2d + 66 72 65 73 68 2d 6c 69 6e 65 40 20 6e 6f 74 20 + 7b 20 6e 65 77 6c 69 6e 65 20 7d 20 69 66 20 3b + 0a + + ~ "" + 0a + + ~ ": indentation-depth@" + 3a 20 69 6e 64 65 6e 74 61 74 69 6f 6e 2d 64 65 + 70 74 68 40 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-indentation-depth @ ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 69 6e 64 65 6e 74 61 74 69 6f + 6e 2d 64 65 70 74 68 20 40 20 3b 0a + + ~ "" + 0a + + ~ ": indentation-depth!" + 3a 20 69 6e 64 65 6e 74 61 74 69 6f 6e 2d 64 65 + 70 74 68 21 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-indentation-depth ! ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 69 6e 64 65 6e 74 61 74 69 6f + 6e 2d 64 65 70 74 68 20 21 20 3b 0a + + ~ "" + 0a + + ~ ": current-column@" + 3a 20 63 75 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e + 40 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-current-column @ ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 63 75 72 72 65 6e 74 2d 63 6f + 6c 75 6d 6e 20 40 20 3b 0a + + ~ "" + 0a + + ~ ": current-column!" + 3a 20 63 75 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e + 21 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-current-column ! ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 63 75 72 72 65 6e 74 2d 63 6f + 6c 75 6d 6e 20 21 20 3b 0a + + ~ "" + 0a + + ~ ": advance-current-column current-column@ + current-column!" + ~ " ;" + 3a 20 61 64 76 61 6e 63 65 2d 63 75 72 72 65 6e + 74 2d 63 6f 6c 75 6d 6e 20 63 75 72 72 65 6e 74 + 2d 63 6f 6c 75 6d 6e 40 20 2b 20 63 75 72 72 65 + 6e 74 2d 63 6f 6c 75 6d 6e 21 20 3b 0a + + ~ "" + 0a + + ~ ": n-bytes-this-line@" + 3a 20 6e 2d 62 79 74 65 73 2d 74 68 69 73 2d 6c + 69 6e 65 40 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-n-bytes-this-line @ ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 6e 2d 62 79 74 65 73 2d 74 68 + 69 73 2d 6c 69 6e 65 20 40 20 3b 0a + + ~ "" + 0a + + ~ ": n-bytes-this-line!" + 3a 20 6e 2d 62 79 74 65 73 2d 74 68 69 73 2d 6c + 69 6e 65 21 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-n-bytes-this-line ! ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 6e 2d 62 79 74 65 73 2d 74 68 + 69 73 2d 6c 69 6e 65 20 21 20 3b 0a + + ~ "" + 0a + + ~ ": output-metadata-entry-count@" + 3a 20 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 + 61 2d 65 6e 74 72 79 2d 63 6f 75 6e 74 40 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-entry-count @ ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 63 6f 75 6e + 74 20 40 20 3b 0a + + ~ "" + 0a + + ~ ": output-metadata-entry-count!" + 3a 20 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 + 61 2d 65 6e 74 72 79 2d 63 6f 75 6e 74 21 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-entry-count ! ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 63 6f 75 6e + 74 20 21 20 3b 0a + + ~ "" + 0a + + ~ ": increment-bytes-this-line n-bytes-this-line@ 1+" + ~ " n-bytes-this-line! ;" + 3a 20 69 6e 63 72 65 6d 65 6e 74 2d 62 79 74 65 + 73 2d 74 68 69 73 2d 6c 69 6e 65 20 6e 2d 62 79 + 74 65 73 2d 74 68 69 73 2d 6c 69 6e 65 40 20 31 + 2b 20 6e 2d 62 79 74 65 73 2d 74 68 69 73 2d 6c + 69 6e 65 21 20 3b 0a + + ~ "" + 0a + + ~ ": describe-subitem-entry-stack" + 3a 20 64 65 73 63 72 69 62 65 2d 73 75 62 69 74 + 65 6d 2d 65 6e 74 72 79 2d 73 74 61 63 6b 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " ." depth "" + 20 20 2e 22 20 20 20 20 64 65 70 74 68 20 22 0a + + ~ " dup hex-output-metadata-subitem-entry-stack-depth @" + ~ " .hex64 newline" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 73 75 62 69 74 65 + 6d 2d 65 6e 74 72 79 2d 73 74 61 63 6b 2d 64 65 + 70 74 68 20 40 20 2e 68 65 78 36 34 20 6e 65 77 + 6c 69 6e 65 0a + + ~ " ." capacity "" + 20 20 2e 22 20 63 61 70 61 63 69 74 79 20 22 0a + + ~ " hex-output-metadata-subitem-entry-stack-capacity .hex64" + ~ " newline" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 73 75 62 69 74 65 6d 2d 65 6e + 74 72 79 2d 73 74 61 63 6b 2d 63 61 70 61 63 69 + 74 79 20 2e 68 65 78 36 34 20 6e 65 77 6c 69 6e + 65 0a + + ~ " hex-output-metadata-subitem-entry-stack-zero" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 73 75 62 69 74 65 6d 2d 65 6e + 74 72 79 2d 73 74 61 63 6b 2d 7a 65 72 6f 0a + + ~ " hex-output-metadata-subitem-entry-stack-capacity 8 *" + ~ " hexdump-from ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 73 75 62 69 74 65 6d 2d 65 6e + 74 72 79 2d 73 74 61 63 6b 2d 63 61 70 61 63 69 + 74 79 20 38 20 2a 20 68 65 78 64 75 6d 70 2d 66 + 72 6f 6d 20 3b 0a + + ~ "" + 0a + + ~ ": subitem-entry-stack-depth@" + 3a 20 73 75 62 69 74 65 6d 2d 65 6e 74 72 79 2d + 73 74 61 63 6b 2d 64 65 70 74 68 40 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-subitem-entry-stack-depth @ ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 73 75 62 69 74 65 6d 2d 65 6e + 74 72 79 2d 73 74 61 63 6b 2d 64 65 70 74 68 20 + 40 20 3b 0a + + ~ "" + 0a + + ~ ": subitem-entry-stack-depth!" + 3a 20 73 75 62 69 74 65 6d 2d 65 6e 74 72 79 2d + 73 74 61 63 6b 2d 64 65 70 74 68 21 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-subitem-entry-stack-depth ! ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 73 75 62 69 74 65 6d 2d 65 6e + 74 72 79 2d 73 74 61 63 6b 2d 64 65 70 74 68 20 + 21 20 3b 0a + + ~ "" + 0a + + ~ ": is-subitem-entry-stack-empty" + 3a 20 69 73 2d 73 75 62 69 74 65 6d 2d 65 6e 74 + 72 79 2d 73 74 61 63 6b 2d 65 6d 70 74 79 0a + + ~ " subitem-entry-stack-depth@ 0 = ;" + 20 20 73 75 62 69 74 65 6d 2d 65 6e 74 72 79 2d + 73 74 61 63 6b 2d 64 65 70 74 68 40 20 30 20 3d + 20 3b 0a + + ~ "" + 0a + + ~ ": is-subitem-entry-stack-full" + 3a 20 69 73 2d 73 75 62 69 74 65 6d 2d 65 6e 74 + 72 79 2d 73 74 61 63 6b 2d 66 75 6c 6c 0a + + ~ " subitem-entry-stack-depth@" + 20 20 73 75 62 69 74 65 6d 2d 65 6e 74 72 79 2d + 73 74 61 63 6b 2d 64 65 70 74 68 40 0a + + ~ " hex-output-metadata-subitem-entry-stack-capacity = ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 73 75 62 69 74 65 6d 2d 65 6e + 74 72 79 2d 73 74 61 63 6b 2d 63 61 70 61 63 69 + 74 79 20 3d 20 3b 0a + + ~ "" + 0a + + ~ ": push-subitem-entry-stack" + 3a 20 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 65 + 6e 74 72 79 2d 73 74 61 63 6b 0a + + ~ " is-subitem-entry-stack-full not {" + 20 20 69 73 2d 73 75 62 69 74 65 6d 2d 65 6e 74 + 72 79 2d 73 74 61 63 6b 2d 66 75 6c 6c 20 6e 6f + 74 20 7b 0a + + ~ " transformation-state" + ~ " transformation-state-output-metadata @" + 20 20 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 + 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 + 74 70 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-subitem-entry-stack-zero" + 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 73 75 62 69 74 65 6d 2d + 65 6e 74 72 79 2d 73 74 61 63 6b 2d 7a 65 72 6f + 0a + + ~ " subitem-entry-stack-depth@ 8 * + !" + 20 20 20 20 73 75 62 69 74 65 6d 2d 65 6e 74 72 + 79 2d 73 74 61 63 6b 2d 64 65 70 74 68 40 20 38 + 20 2a 20 2b 20 21 0a + + ~ "" + 0a + + ~ " subitem-entry-stack-depth@ 1+" + ~ " subitem-entry-stack-depth!" + 20 20 20 20 73 75 62 69 74 65 6d 2d 65 6e 74 72 + 79 2d 73 74 61 63 6b 2d 64 65 70 74 68 40 20 31 + 2b 20 73 75 62 69 74 65 6d 2d 65 6e 74 72 79 2d + 73 74 61 63 6b 2d 64 65 70 74 68 21 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " ~ We still consume the value, so that our caller" + ~ " doesn't crash." + 20 20 20 20 7e 20 57 65 20 73 74 69 6c 6c 20 63 + 6f 6e 73 75 6d 65 20 74 68 65 20 76 61 6c 75 65 + 2c 20 73 6f 20 74 68 61 74 20 6f 75 72 20 63 61 + 6c 6c 65 72 20 64 6f 65 73 6e 27 74 20 63 72 61 + 73 68 2e 0a + + ~ " drop" + 20 20 20 20 64 72 6f 70 0a + + ~ "" + 0a + + ~ " ." Subitem entry stack overflow." newline" + 20 20 20 20 2e 22 20 53 75 62 69 74 65 6d 20 65 + 6e 74 72 79 20 73 74 61 63 6b 20 6f 76 65 72 66 + 6c 6f 77 2e 22 20 6e 65 77 6c 69 6e 65 0a + + ~ " } if-else ;" + 20 20 7d 20 69 66 2d 65 6c 73 65 20 3b 0a + + ~ "" + 0a + + ~ ": pop-subitem-entry-stack" + 3a 20 70 6f 70 2d 73 75 62 69 74 65 6d 2d 65 6e + 74 72 79 2d 73 74 61 63 6b 0a + + ~ " is-subitem-entry-stack-empty not {" + 20 20 69 73 2d 73 75 62 69 74 65 6d 2d 65 6e 74 + 72 79 2d 73 74 61 63 6b 2d 65 6d 70 74 79 20 6e + 6f 74 20 7b 0a + + ~ " subitem-entry-stack-depth@ 1-" + ~ " subitem-entry-stack-depth!" + 20 20 20 20 73 75 62 69 74 65 6d 2d 65 6e 74 72 + 79 2d 73 74 61 63 6b 2d 64 65 70 74 68 40 20 31 + 2d 20 73 75 62 69 74 65 6d 2d 65 6e 74 72 79 2d + 73 74 61 63 6b 2d 64 65 70 74 68 21 0a + + ~ "" + 0a + + ~ " transformation-state" + ~ " transformation-state-output-metadata @" + 20 20 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 + 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 + 74 70 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-subitem-entry-stack-zero" + 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 73 75 62 69 74 65 6d 2d + 65 6e 74 72 79 2d 73 74 61 63 6b 2d 7a 65 72 6f + 0a + + ~ " subitem-entry-stack-depth@ 8 * + @" + 20 20 20 20 73 75 62 69 74 65 6d 2d 65 6e 74 72 + 79 2d 73 74 61 63 6b 2d 64 65 70 74 68 40 20 38 + 20 2a 20 2b 20 40 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " ." Subitem entry stack underflow." newline" + 20 20 20 20 2e 22 20 53 75 62 69 74 65 6d 20 65 + 6e 74 72 79 20 73 74 61 63 6b 20 75 6e 64 65 72 + 66 6c 6f 77 2e 22 20 6e 65 77 6c 69 6e 65 0a + + ~ "" + 0a + + ~ " ~ We still return a value, so that our caller doesn't" + ~ " crash." + 20 20 20 20 7e 20 57 65 20 73 74 69 6c 6c 20 72 + 65 74 75 72 6e 20 61 20 76 61 6c 75 65 2c 20 73 + 6f 20 74 68 61 74 20 6f 75 72 20 63 61 6c 6c 65 + 72 20 64 6f 65 73 6e 27 74 20 63 72 61 73 68 2e + 0a + + ~ " 0" + 20 20 20 20 30 0a + + ~ " } if-else ;" + 20 20 7d 20 69 66 2d 65 6c 73 65 20 3b 0a + + ~ "" + 0a + + ~ "~ This computes and returns a pointer to immediately" + ~ " after the end of the" + 7e 20 20 20 54 68 69 73 20 63 6f 6d 70 75 74 65 + 73 20 61 6e 64 20 72 65 74 75 72 6e 73 20 61 20 + 70 6f 69 6e 74 65 72 20 74 6f 20 69 6d 6d 65 64 + 69 61 74 65 6c 79 20 61 66 74 65 72 20 74 68 65 + 20 65 6e 64 20 6f 66 20 74 68 65 0a + + ~ "~ metadata entry array and its terminator. (That is, it" + ~ " points AFTER the" + 7e 20 6d 65 74 61 64 61 74 61 20 65 6e 74 72 79 + 20 61 72 72 61 79 20 61 6e 64 20 69 74 73 20 74 + 65 72 6d 69 6e 61 74 6f 72 2e 20 28 54 68 61 74 + 20 69 73 2c 20 69 74 20 70 6f 69 6e 74 73 20 41 + 46 54 45 52 20 74 68 65 0a + + ~ "~ terminator.) The computation is based on the entry" + ~ " count." + 7e 20 74 65 72 6d 69 6e 61 74 6f 72 2e 29 20 54 + 68 65 20 63 6f 6d 70 75 74 61 74 69 6f 6e 20 69 + 73 20 62 61 73 65 64 20 6f 6e 20 74 68 65 20 65 + 6e 74 72 79 20 63 6f 75 6e 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (end pointer)" + 7e 20 28 65 6e 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ ": hex-output-metadata-entry-array-end" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 61 72 72 61 + 79 2d 65 6e 64 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " dup hex-output-metadata-first-entry" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 66 69 72 73 74 2d + 65 6e 74 72 79 0a + + ~ " swap hex-output-metadata-entry-count @" + 20 20 73 77 61 70 20 68 65 78 2d 6f 75 74 70 75 + 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 + 2d 63 6f 75 6e 74 20 40 0a + + ~ " hex-output-metadata-entry-structure-size * + 8 + ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 73 74 72 75 + 63 74 75 72 65 2d 73 69 7a 65 20 2a 20 2b 20 38 + 20 2b 20 3b 0a + + ~ "" + 0a + + ~ "~ (data start, data length, entry type, string pointer," + ~ " entry pointer --)" + 7e 20 28 64 61 74 61 20 73 74 61 72 74 2c 20 64 + 61 74 61 20 6c 65 6e 67 74 68 2c 20 65 6e 74 72 + 79 20 74 79 70 65 2c 20 73 74 72 69 6e 67 20 70 + 6f 69 6e 74 65 72 2c 20 65 6e 74 72 79 20 70 6f + 69 6e 74 65 72 20 2d 2d 29 0a + + ~ ": hex-output-metadata-entry!" + 3a 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 21 0a + + ~ " dup hex-output-metadata-entry-content 3roll swap !" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 63 6f 6e 74 65 6e 74 20 33 72 6f 6c 6c 20 73 77 + 61 70 20 21 0a + + ~ " dup hex-output-metadata-entry-type 3roll swap !" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 74 79 70 65 20 33 72 6f 6c 6c 20 73 77 61 70 20 + 21 0a + + ~ " dup hex-output-metadata-entry-data-length 3roll swap !" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 64 61 74 61 2d 6c 65 6e 67 74 68 20 33 72 6f 6c + 6c 20 73 77 61 70 20 21 0a + + ~ " dup hex-output-metadata-entry-data-start 3roll swap !" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 64 61 74 61 2d 73 74 61 72 74 20 33 72 6f 6c 6c + 20 73 77 61 70 20 21 0a + + ~ " drop ;" + 20 20 64 72 6f 70 20 3b 0a + + ~ "" + 0a + + ~ "~ (entry pointer, data start, data length, entry type," + ~ " string pointer" + 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 65 72 + 2c 20 64 61 74 61 20 73 74 61 72 74 2c 20 64 61 + 74 61 20 6c 65 6e 67 74 68 2c 20 65 6e 74 72 79 + 20 74 79 70 65 2c 20 73 74 72 69 6e 67 20 70 6f + 69 6e 74 65 72 0a + + ~ "~ -- next entry pointer)" + 7e 20 20 2d 2d 20 6e 65 78 74 20 65 6e 74 72 79 + 20 70 6f 69 6e 74 65 72 29 0a + + ~ ": pack-hex-output-metadata-entry" + 3a 20 70 61 63 6b 2d 68 65 78 2d 6f 75 74 70 75 + 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 + 0a + + ~ " 4 pick hex-output-metadata-entry!" + 20 20 34 20 70 69 63 6b 20 68 65 78 2d 6f 75 74 + 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 + 72 79 21 0a + + ~ " hex-output-metadata-next-entry ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 6e 65 78 74 2d 65 6e 74 72 79 + 20 3b 0a + + ~ "" + 0a + + ~ "~ This is a helper used by add-hex-output-metadata-entry" + ~ " and" + 7e 20 20 20 54 68 69 73 20 69 73 20 61 20 68 65 + 6c 70 65 72 20 75 73 65 64 20 62 79 20 61 64 64 + 2d 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 + 64 61 74 61 2d 65 6e 74 72 79 20 61 6e 64 0a + + ~ "~ postprocess-metadata-entries, below. It duplicates the" + ~ " entry it's given," + 7e 20 70 6f 73 74 70 72 6f 63 65 73 73 2d 6d 65 + 74 61 64 61 74 61 2d 65 6e 74 72 69 65 73 2c 20 + 62 65 6c 6f 77 2e 20 49 74 20 64 75 70 6c 69 63 + 61 74 65 73 20 74 68 65 20 65 6e 74 72 79 20 69 + 74 27 73 20 67 69 76 65 6e 2c 0a + + ~ "~ creating a second identical copy immediately after it in" + ~ " the entry array," + 7e 20 63 72 65 61 74 69 6e 67 20 61 20 73 65 63 + 6f 6e 64 20 69 64 65 6e 74 69 63 61 6c 20 63 6f + 70 79 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 61 + 66 74 65 72 20 69 74 20 69 6e 20 74 68 65 20 65 + 6e 74 72 79 20 61 72 72 61 79 2c 0a + + ~ "~ sliding everything else forward to make room." + 7e 20 73 6c 69 64 69 6e 67 20 65 76 65 72 79 74 + 68 69 6e 67 20 65 6c 73 65 20 66 6f 72 77 61 72 + 64 20 74 6f 20 6d 61 6b 65 20 72 6f 6f 6d 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (entry pointer --)" + 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 65 72 + 20 2d 2d 29 0a + + ~ ": dup-metadata-entry" + 3a 20 64 75 70 2d 6d 65 74 61 64 61 74 61 2d 65 + 6e 74 72 79 0a + + ~ " ~ Find all the remaining entries, and the final" + ~ " terminator, and slide" + 20 20 7e 20 20 20 46 69 6e 64 20 61 6c 6c 20 74 + 68 65 20 72 65 6d 61 69 6e 69 6e 67 20 65 6e 74 + 72 69 65 73 2c 20 61 6e 64 20 74 68 65 20 66 69 + 6e 61 6c 20 74 65 72 6d 69 6e 61 74 6f 72 2c 20 + 61 6e 64 20 73 6c 69 64 65 0a + + ~ " ~ them forward by the length of one entry." + 20 20 7e 20 74 68 65 6d 20 66 6f 72 77 61 72 64 + 20 62 79 20 74 68 65 20 6c 65 6e 67 74 68 20 6f + 66 20 6f 6e 65 20 65 6e 74 72 79 2e 0a + + ~ " dup hex-output-metadata-entry-array-end" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 61 72 72 61 79 2d 65 6e 64 0a + + ~ " ~ (entry pointer, entry pointer, entry array end" + ~ " pointer)" + 20 20 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 2c 20 65 6e 74 72 79 20 70 6f 69 6e 74 65 + 72 2c 20 65 6e 74 72 79 20 61 72 72 61 79 20 65 + 6e 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " swap -" + 20 20 73 77 61 70 20 2d 0a + + ~ " ~ (entry pointer, entry array tail length)" + 20 20 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 2c 20 65 6e 74 72 79 20 61 72 72 61 79 20 + 74 61 69 6c 20 6c 65 6e 67 74 68 29 0a + + ~ " swap dup hex-output-metadata-next-entry 3roll" + 20 20 73 77 61 70 20 64 75 70 20 68 65 78 2d 6f + 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 6e + 65 78 74 2d 65 6e 74 72 79 20 33 72 6f 6c 6c 0a + + ~ " ~ (entry pointer, adjusted entry pointer, entry array" + ~ " tail length)" + 20 20 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 2c 20 61 64 6a 75 73 74 65 64 20 65 6e 74 + 72 79 20 70 6f 69 6e 74 65 72 2c 20 65 6e 74 72 + 79 20 61 72 72 61 79 20 74 61 69 6c 20 6c 65 6e + 67 74 68 29 0a + + ~ " memmove" + 20 20 6d 65 6d 6d 6f 76 65 0a + + ~ "" + 0a + + ~ " ~ Increment the entry count." + 20 20 7e 20 49 6e 63 72 65 6d 65 6e 74 20 74 68 + 65 20 65 6e 74 72 79 20 63 6f 75 6e 74 2e 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-entry-count dup" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 63 6f 75 6e + 74 20 64 75 70 0a + + ~ " @ 1+ swap ! ;" + 20 20 40 20 31 2b 20 73 77 61 70 20 21 20 3b 0a + + ~ "" + 0a + + ~ "~ This is a helper used by postprocess-metadata-entries," + ~ " below. It swaps" + 7e 20 20 20 54 68 69 73 20 69 73 20 61 20 68 65 + 6c 70 65 72 20 75 73 65 64 20 62 79 20 70 6f 73 + 74 70 72 6f 63 65 73 73 2d 6d 65 74 61 64 61 74 + 61 2d 65 6e 74 72 69 65 73 2c 20 62 65 6c 6f 77 + 2e 20 49 74 20 73 77 61 70 73 0a + + ~ "~ the contents of the entry it's given with the contents of" + ~ " the entry" + 7e 20 74 68 65 20 63 6f 6e 74 65 6e 74 73 20 6f + 66 20 74 68 65 20 65 6e 74 72 79 20 69 74 27 73 + 20 67 69 76 65 6e 20 77 69 74 68 20 74 68 65 20 + 63 6f 6e 74 65 6e 74 73 20 6f 66 20 74 68 65 20 + 65 6e 74 72 79 0a + + ~ "~ immediately after it in the entry array." + 7e 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 61 66 + 74 65 72 20 69 74 20 69 6e 20 74 68 65 20 65 6e + 74 72 79 20 61 72 72 61 79 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (entry pointer --)" + 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 65 72 + 20 2d 2d 29 0a + + ~ ": swap-metadata-entries" + 3a 20 73 77 61 70 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 69 65 73 0a + + ~ " ~ Copy the current entry to a scratch area." + 20 20 7e 20 43 6f 70 79 20 74 68 65 20 63 75 72 + 72 65 6e 74 20 65 6e 74 72 79 20 74 6f 20 61 20 + 73 63 72 61 74 63 68 20 61 72 65 61 2e 0a + + ~ " dup dup dup hex-output-metadata-next-entry swap -" + 20 20 64 75 70 20 64 75 70 20 64 75 70 20 68 65 + 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 + 61 2d 6e 65 78 74 2d 65 6e 74 72 79 20 73 77 61 + 70 20 2d 0a + + ~ " ~ (entry pointer, entry pointer, entry length)" + 20 20 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 2c 20 65 6e 74 72 79 20 70 6f 69 6e 74 65 + 72 2c 20 65 6e 74 72 79 20 6c 65 6e 67 74 68 29 + 0a + + ~ " swap-transform-variables here @ swap-transform-variables" + ~ " swap" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 20 68 65 72 65 20 + 40 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 20 73 77 61 70 0a + + ~ " ~ (entry pointer, entry pointer, scratch pointer, entry" + ~ " length)" + 20 20 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 2c 20 65 6e 74 72 79 20 70 6f 69 6e 74 65 + 72 2c 20 73 63 72 61 74 63 68 20 70 6f 69 6e 74 + 65 72 2c 20 65 6e 74 72 79 20 6c 65 6e 67 74 68 + 29 0a + + ~ " memcopy" + 20 20 6d 65 6d 63 6f 70 79 0a + + ~ " ~ (entry pointer)" + 20 20 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 29 0a + + ~ "" + 0a + + ~ " ~ Copy the next entry over the current entry." + 20 20 7e 20 43 6f 70 79 20 74 68 65 20 6e 65 78 + 74 20 65 6e 74 72 79 20 6f 76 65 72 20 74 68 65 + 20 63 75 72 72 65 6e 74 20 65 6e 74 72 79 2e 0a + + ~ " dup dup hex-output-metadata-next-entry dup" + 20 20 64 75 70 20 64 75 70 20 68 65 78 2d 6f 75 + 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 6e 65 + 78 74 2d 65 6e 74 72 79 20 64 75 70 0a + + ~ " ~ (entry pointer, entry pointer, next entry pointer, next" + ~ " entry pointer)" + 20 20 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 2c 20 65 6e 74 72 79 20 70 6f 69 6e 74 65 + 72 2c 20 6e 65 78 74 20 65 6e 74 72 79 20 70 6f + 69 6e 74 65 72 2c 20 6e 65 78 74 20 65 6e 74 72 + 79 20 70 6f 69 6e 74 65 72 29 0a + + ~ " 3roll -" + 20 20 33 72 6f 6c 6c 20 2d 0a + + ~ " ~ (entry pointer, next entry pointer, entry length)" + 20 20 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 2c 20 6e 65 78 74 20 65 6e 74 72 79 20 70 + 6f 69 6e 74 65 72 2c 20 65 6e 74 72 79 20 6c 65 + 6e 67 74 68 29 0a + + ~ " 2 pick swap" + 20 20 32 20 70 69 63 6b 20 73 77 61 70 0a + + ~ " ~ (entry pointer, next entry pointer, entry pointer," + ~ " entry length)" + 20 20 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 2c 20 6e 65 78 74 20 65 6e 74 72 79 20 70 + 6f 69 6e 74 65 72 2c 20 65 6e 74 72 79 20 70 6f + 69 6e 74 65 72 2c 20 65 6e 74 72 79 20 6c 65 6e + 67 74 68 29 0a + + ~ " memcopy" + 20 20 6d 65 6d 63 6f 70 79 0a + + ~ " ~ (entry pointer)" + 20 20 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 29 0a + + ~ "" + 0a + + ~ " ~ Copy the scratch area over the next entry." + 20 20 7e 20 43 6f 70 79 20 74 68 65 20 73 63 72 + 61 74 63 68 20 61 72 65 61 20 6f 76 65 72 20 74 + 68 65 20 6e 65 78 74 20 65 6e 74 72 79 2e 0a + + ~ " dup hex-output-metadata-next-entry dup" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 6e 65 78 74 2d 65 + 6e 74 72 79 20 64 75 70 0a + + ~ " ~ (entry pointer, next entry pointer, next entry" + ~ " pointer)" + 20 20 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 2c 20 6e 65 78 74 20 65 6e 74 72 79 20 70 + 6f 69 6e 74 65 72 2c 20 6e 65 78 74 20 65 6e 74 + 72 79 20 70 6f 69 6e 74 65 72 29 0a + + ~ " 3roll -" + 20 20 33 72 6f 6c 6c 20 2d 0a + + ~ " ~ (next entry pointer, entry length)" + 20 20 7e 20 28 6e 65 78 74 20 65 6e 74 72 79 20 + 70 6f 69 6e 74 65 72 2c 20 65 6e 74 72 79 20 6c + 65 6e 67 74 68 29 0a + + ~ " swap-transform-variables here @ swap-transform-variables" + ~ " 3unroll" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 20 68 65 72 65 20 + 40 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 20 33 75 6e 72 6f + 6c 6c 0a + + ~ " ~ (scratch pointer, next entry pointer, entry length)" + 20 20 7e 20 28 73 63 72 61 74 63 68 20 70 6f 69 + 6e 74 65 72 2c 20 6e 65 78 74 20 65 6e 74 72 79 + 20 70 6f 69 6e 74 65 72 2c 20 65 6e 74 72 79 20 + 6c 65 6e 67 74 68 29 0a + + ~ " memcopy ;" + 20 20 6d 65 6d 63 6f 70 79 20 3b 0a + + ~ "" + 0a + + ~ "~ (data start, data length, entry type, string pointer --)" + 7e 20 28 64 61 74 61 20 73 74 61 72 74 2c 20 64 + 61 74 61 20 6c 65 6e 67 74 68 2c 20 65 6e 74 72 + 79 20 74 79 70 65 2c 20 73 74 72 69 6e 67 20 70 + 6f 69 6e 74 65 72 20 2d 2d 29 0a + + ~ ": add-hex-output-metadata-entry" + 3a 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ " ~ If the suppression count is greater than zero," + ~ " decrement it." + 20 20 7e 20 49 66 20 74 68 65 20 73 75 70 70 72 + 65 73 73 69 6f 6e 20 63 6f 75 6e 74 20 69 73 20 + 67 72 65 61 74 65 72 20 74 68 61 6e 20 7a 65 72 + 6f 2c 20 64 65 63 72 65 6d 65 6e 74 20 69 74 2e + 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-suppression-count @" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 73 75 70 70 72 65 73 73 69 6f + 6e 2d 63 6f 75 6e 74 20 40 0a + + ~ " dup 0 < {" + 20 20 64 75 70 20 30 20 3c 20 7b 0a + + ~ " 1-" + 20 20 20 20 31 2d 0a + + ~ " transformation-state" + ~ " transformation-state-output-metadata @" + 20 20 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 + 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 + 74 70 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-suppression-count !" + 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 73 75 70 70 72 65 73 73 + 69 6f 6e 2d 63 6f 75 6e 74 20 21 0a + + ~ " 4 ndrop exit" + 20 20 20 20 34 20 6e 64 72 6f 70 20 65 78 69 74 + 0a + + ~ " } { drop } if-else" + 20 20 7d 20 7b 20 64 72 6f 70 20 7d 20 69 66 2d + 65 6c 73 65 0a + + ~ "" + 0a + + ~ " ~ Don't do anything unless the address is in the" + ~ " label-loop buffer." + 20 20 7e 20 44 6f 6e 27 74 20 64 6f 20 61 6e 79 + 74 68 69 6e 67 20 75 6e 6c 65 73 73 20 74 68 65 + 20 61 64 64 72 65 73 73 20 69 73 20 69 6e 20 74 + 68 65 20 6c 61 62 65 6c 2d 6c 6f 6f 70 20 62 75 + 66 66 65 72 2e 0a + + ~ " 3 pick is-in-label-loop-buffer {" + 20 20 33 20 70 69 63 6b 20 69 73 2d 69 6e 2d 6c + 61 62 65 6c 2d 6c 6f 6f 70 2d 62 75 66 66 65 72 + 20 7b 0a + + ~ " ~ (data start, data length, entry type, string" + ~ " pointer)" + 20 20 20 20 7e 20 28 64 61 74 61 20 73 74 61 72 + 74 2c 20 64 61 74 61 20 6c 65 6e 67 74 68 2c 20 + 65 6e 74 72 79 20 74 79 70 65 2c 20 73 74 72 69 + 6e 67 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " hex-output-metadata-entry-array-end 8 -" + 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d 61 72 + 72 61 79 2d 65 6e 64 20 38 20 2d 0a + + ~ "" + 0a + + ~ " ~ Write the entry." + 20 20 20 20 7e 20 57 72 69 74 65 20 74 68 65 20 + 65 6e 74 72 79 2e 0a + + ~ " 5 unroll pack-hex-output-metadata-entry" + 20 20 20 20 35 20 75 6e 72 6f 6c 6c 20 70 61 63 + 6b 2d 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ " ~ Write the end-of-array marker, and clean up." + 20 20 20 20 7e 20 57 72 69 74 65 20 74 68 65 20 + 65 6e 64 2d 6f 66 2d 61 72 72 61 79 20 6d 61 72 + 6b 65 72 2c 20 61 6e 64 20 63 6c 65 61 6e 20 75 + 70 2e 0a + + ~ " 0 pack64 drop" + 20 20 20 20 30 20 70 61 63 6b 36 34 20 64 72 6f + 70 0a + + ~ "" + 0a + + ~ " ~ Increment the entry count." + 20 20 20 20 7e 20 49 6e 63 72 65 6d 65 6e 74 20 + 74 68 65 20 65 6e 74 72 79 20 63 6f 75 6e 74 2e + 0a + + ~ " transformation-state" + ~ " transformation-state-output-metadata @" + 20 20 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 + 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 + 74 70 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-entry-count dup" + 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d 63 6f + 75 6e 74 20 64 75 70 0a + + ~ " @ 1+ swap !" + 20 20 20 20 40 20 31 2b 20 73 77 61 70 20 21 0a + + ~ " } { drop drop drop drop } if-else ;" + 20 20 7d 20 7b 20 64 72 6f 70 20 64 72 6f 70 20 + 64 72 6f 70 20 64 72 6f 70 20 7d 20 69 66 2d 65 + 6c 73 65 20 3b 0a + + ~ "" + 0a + + ~ "~ (entry pointer --)" + 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 65 72 + 20 2d 2d 29 0a + + ~ ": delete-metadata-entry" + 3a 20 64 65 6c 65 74 65 2d 6d 65 74 61 64 61 74 + 61 2d 65 6e 74 72 79 0a + + ~ " ~ Slide memory backwards to overwrite the entry." + 20 20 7e 20 53 6c 69 64 65 20 6d 65 6d 6f 72 79 + 20 62 61 63 6b 77 61 72 64 73 20 74 6f 20 6f 76 + 65 72 77 72 69 74 65 20 74 68 65 20 65 6e 74 72 + 79 2e 0a + + ~ " hex-output-metadata-entry-array-end" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 61 72 72 61 + 79 2d 65 6e 64 0a + + ~ " ~ (entry pointer, entry array end pointer)" + 20 20 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 2c 20 65 6e 74 72 79 20 61 72 72 61 79 20 + 65 6e 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " over hex-output-metadata-next-entry -" + 20 20 6f 76 65 72 20 68 65 78 2d 6f 75 74 70 75 + 74 2d 6d 65 74 61 64 61 74 61 2d 6e 65 78 74 2d + 65 6e 74 72 79 20 2d 0a + + ~ " ~ (entry pointer, length of block to move)" + 20 20 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 2c 20 6c 65 6e 67 74 68 20 6f 66 20 62 6c + 6f 63 6b 20 74 6f 20 6d 6f 76 65 29 0a + + ~ " swap dup hex-output-metadata-next-entry swap 3roll" + ~ " memmove" + 20 20 73 77 61 70 20 64 75 70 20 68 65 78 2d 6f + 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 6e + 65 78 74 2d 65 6e 74 72 79 20 73 77 61 70 20 33 + 72 6f 6c 6c 20 6d 65 6d 6d 6f 76 65 0a + + ~ "" + 0a + + ~ " ~ Decrement the entry count." + 20 20 7e 20 44 65 63 72 65 6d 65 6e 74 20 74 68 + 65 20 65 6e 74 72 79 20 63 6f 75 6e 74 2e 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-entry-count dup" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 63 6f 75 6e + 74 20 64 75 70 0a + + ~ " @ 1- swap ! ;" + 20 20 40 20 31 2d 20 73 77 61 70 20 21 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ (-- entry pointer or 0)" + 7e 20 28 2d 2d 20 65 6e 74 72 79 20 70 6f 69 6e + 74 65 72 20 6f 72 20 30 29 0a + + ~ ": find-latest-metadata-entry" + 3a 20 66 69 6e 64 2d 6c 61 74 65 73 74 2d 6d 65 + 74 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ " ~ Get the entry count and make sure it's nonzero." + 20 20 7e 20 47 65 74 20 74 68 65 20 65 6e 74 72 + 79 20 63 6f 75 6e 74 20 61 6e 64 20 6d 61 6b 65 + 20 73 75 72 65 20 69 74 27 73 20 6e 6f 6e 7a 65 + 72 6f 2e 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-entry-count @ dup {" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 63 6f 75 6e + 74 20 40 20 64 75 70 20 7b 0a + + ~ " ~ Use the entry count to directly compute the offset" + ~ " to the last actual" + 20 20 20 20 7e 20 20 20 55 73 65 20 74 68 65 20 + 65 6e 74 72 79 20 63 6f 75 6e 74 20 74 6f 20 64 + 69 72 65 63 74 6c 79 20 63 6f 6d 70 75 74 65 20 + 74 68 65 20 6f 66 66 73 65 74 20 74 6f 20 74 68 + 65 20 6c 61 73 74 20 61 63 74 75 61 6c 0a + + ~ " ~ entry in the array." + 20 20 20 20 7e 20 65 6e 74 72 79 20 69 6e 20 74 + 68 65 20 61 72 72 61 79 2e 0a + + ~ " 1 - hex-output-metadata-entry-structure-size *" + 20 20 20 20 31 20 2d 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 73 74 72 75 63 74 75 72 65 2d 73 69 7a 65 + 20 2a 0a + + ~ " transformation-state" + ~ " transformation-state-output-metadata @" + 20 20 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 + 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 + 74 70 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-first-entry +" + 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 66 69 72 73 74 2d 65 6e + 74 72 79 20 2b 0a + + ~ " } if ;" + 20 20 7d 20 69 66 20 3b 0a + + ~ "" + 0a + + ~ "~ (-- entry pointer or 0)" + 7e 20 28 2d 2d 20 65 6e 74 72 79 20 70 6f 69 6e + 74 65 72 20 6f 72 20 30 29 0a + + ~ ": find-latest-comment-metadata-entry" + 3a 20 66 69 6e 64 2d 6c 61 74 65 73 74 2d 63 6f + 6d 6d 65 6e 74 2d 6d 65 74 61 64 61 74 61 2d 65 + 6e 74 72 79 0a + + ~ " find-latest-metadata-entry" + 20 20 66 69 6e 64 2d 6c 61 74 65 73 74 2d 6d 65 + 74 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ " ~ (entry pointer or 0)" + 20 20 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 20 6f 72 20 30 29 0a + + ~ "" + 0a + + ~ " ~ If and only if we actually found one, now loop" + ~ " backwards to find the" + 20 20 7e 20 20 20 49 66 20 61 6e 64 20 6f 6e 6c + 79 20 69 66 20 77 65 20 61 63 74 75 61 6c 6c 79 + 20 66 6f 75 6e 64 20 6f 6e 65 2c 20 6e 6f 77 20 + 6c 6f 6f 70 20 62 61 63 6b 77 61 72 64 73 20 74 + 6f 20 66 69 6e 64 20 74 68 65 0a + + ~ " ~ most recent one that's a comment entry. All length" + ~ " adjustments apply to" + 20 20 7e 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 + 6f 6e 65 20 74 68 61 74 27 73 20 61 20 63 6f 6d + 6d 65 6e 74 20 65 6e 74 72 79 2e 20 41 6c 6c 20 + 6c 65 6e 67 74 68 20 61 64 6a 75 73 74 6d 65 6e + 74 73 20 61 70 70 6c 79 20 74 6f 0a + + ~ " ~ comment entries, anything else needs to be skipped for" + ~ " this purpose." + 20 20 7e 20 63 6f 6d 6d 65 6e 74 20 65 6e 74 72 + 69 65 73 2c 20 61 6e 79 74 68 69 6e 67 20 65 6c + 73 65 20 6e 65 65 64 73 20 74 6f 20 62 65 20 73 + 6b 69 70 70 65 64 20 66 6f 72 20 74 68 69 73 20 + 70 75 72 70 6f 73 65 2e 0a + + ~ " { dup { dup is-comment-entry not } { 0 } if-else }" + 20 20 7b 20 64 75 70 20 7b 20 64 75 70 20 69 73 + 2d 63 6f 6d 6d 65 6e 74 2d 65 6e 74 72 79 20 6e + 6f 74 20 7d 20 7b 20 30 20 7d 20 69 66 2d 65 6c + 73 65 20 7d 0a + + ~ " { transformation-state" + ~ " transformation-state-output-metadata @" + 20 20 7b 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 + 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 + 74 70 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-first-entry" + 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 66 69 72 73 74 2d 65 6e + 74 72 79 0a + + ~ " over > {" + 20 20 20 20 6f 76 65 72 20 3e 20 7b 0a + + ~ " hex-output-metadata-previous-entry } { drop 0 }" + ~ " if-else } while" + 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 70 72 65 76 69 6f + 75 73 2d 65 6e 74 72 79 20 7d 20 7b 20 64 72 6f + 70 20 30 20 7d 20 69 66 2d 65 6c 73 65 20 7d 20 + 77 68 69 6c 65 0a + + ~ " ~ (entry pointer or 0)" + 20 20 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 20 6f 72 20 30 29 0a + + ~ " ;" + 20 20 3b 0a + + ~ "" + 0a + + ~ "~ (-- entry pointer or 0)" + 7e 20 28 2d 2d 20 65 6e 74 72 79 20 70 6f 69 6e + 74 65 72 20 6f 72 20 30 29 0a + + ~ ": find-latest-output-producing-metadata-entry" + 3a 20 66 69 6e 64 2d 6c 61 74 65 73 74 2d 6f 75 + 74 70 75 74 2d 70 72 6f 64 75 63 69 6e 67 2d 6d + 65 74 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ " find-latest-metadata-entry" + 20 20 66 69 6e 64 2d 6c 61 74 65 73 74 2d 6d 65 + 74 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ " ~ (entry pointer or 0)" + 20 20 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 20 6f 72 20 30 29 0a + + ~ "" + 0a + + ~ " ~ If and only if we actually found one, now loop" + ~ " backwards to find the" + 20 20 7e 20 20 20 49 66 20 61 6e 64 20 6f 6e 6c + 79 20 69 66 20 77 65 20 61 63 74 75 61 6c 6c 79 + 20 66 6f 75 6e 64 20 6f 6e 65 2c 20 6e 6f 77 20 + 6c 6f 6f 70 20 62 61 63 6b 77 61 72 64 73 20 74 + 6f 20 66 69 6e 64 20 74 68 65 0a + + ~ " ~ most recent one that's an output-producing entry." + 20 20 7e 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 + 6f 6e 65 20 74 68 61 74 27 73 20 61 6e 20 6f 75 + 74 70 75 74 2d 70 72 6f 64 75 63 69 6e 67 20 65 + 6e 74 72 79 2e 0a + + ~ " { dup { dup is-output-producing-entry not } { 0 } if-else" + ~ " }" + 20 20 7b 20 64 75 70 20 7b 20 64 75 70 20 69 73 + 2d 6f 75 74 70 75 74 2d 70 72 6f 64 75 63 69 6e + 67 2d 65 6e 74 72 79 20 6e 6f 74 20 7d 20 7b 20 + 30 20 7d 20 69 66 2d 65 6c 73 65 20 7d 0a + + ~ " { transformation-state" + ~ " transformation-state-output-metadata @" + 20 20 7b 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 + 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 + 74 70 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-first-entry" + 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 66 69 72 73 74 2d 65 6e + 74 72 79 0a + + ~ " over > {" + 20 20 20 20 6f 76 65 72 20 3e 20 7b 0a + + ~ " hex-output-metadata-previous-entry } { drop 0 }" + ~ " if-else } while" + 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 70 72 65 76 69 6f + 75 73 2d 65 6e 74 72 79 20 7d 20 7b 20 64 72 6f + 70 20 30 20 7d 20 69 66 2d 65 6c 73 65 20 7d 20 + 77 68 69 6c 65 0a + + ~ " ~ (entry pointer or 0)" + 20 20 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 20 6f 72 20 30 29 0a + + ~ " ;" + 20 20 3b 0a + + ~ "" + 0a + + ~ "~ (-- entry pointer or 0)" + 7e 20 28 2d 2d 20 65 6e 74 72 79 20 70 6f 69 6e + 74 65 72 20 6f 72 20 30 29 0a + + ~ ": find-latest-saved-data-metadata-entry" + 3a 20 66 69 6e 64 2d 6c 61 74 65 73 74 2d 73 61 + 76 65 64 2d 64 61 74 61 2d 6d 65 74 61 64 61 74 + 61 2d 65 6e 74 72 79 0a + + ~ " find-latest-metadata-entry" + 20 20 66 69 6e 64 2d 6c 61 74 65 73 74 2d 6d 65 + 74 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ " ~ (entry pointer or 0)" + 20 20 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 20 6f 72 20 30 29 0a + + ~ "" + 0a + + ~ " ~ If and only if we actually found one, now loop" + ~ " backwards to find the" + 20 20 7e 20 20 20 49 66 20 61 6e 64 20 6f 6e 6c + 79 20 69 66 20 77 65 20 61 63 74 75 61 6c 6c 79 + 20 66 6f 75 6e 64 20 6f 6e 65 2c 20 6e 6f 77 20 + 6c 6f 6f 70 20 62 61 63 6b 77 61 72 64 73 20 74 + 6f 20 66 69 6e 64 20 74 68 65 0a + + ~ " ~ most recent one that's a saved-data entry. All" + ~ " data-consuming commands" + 20 20 7e 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 + 6f 6e 65 20 74 68 61 74 27 73 20 61 20 73 61 76 + 65 64 2d 64 61 74 61 20 65 6e 74 72 79 2e 20 41 + 6c 6c 20 64 61 74 61 2d 63 6f 6e 73 75 6d 69 6e + 67 20 63 6f 6d 6d 61 6e 64 73 0a + + ~ " ~ apply to saved-data entries, anything else needs to be" + ~ " skipped for this" + 20 20 7e 20 61 70 70 6c 79 20 74 6f 20 73 61 76 + 65 64 2d 64 61 74 61 20 65 6e 74 72 69 65 73 2c + 20 61 6e 79 74 68 69 6e 67 20 65 6c 73 65 20 6e + 65 65 64 73 20 74 6f 20 62 65 20 73 6b 69 70 70 + 65 64 20 66 6f 72 20 74 68 69 73 0a + + ~ " ~ purpose." + 20 20 7e 20 70 75 72 70 6f 73 65 2e 0a + + ~ " { dup { dup is-saved-data-entry not } { 0 } if-else }" + 20 20 7b 20 64 75 70 20 7b 20 64 75 70 20 69 73 + 2d 73 61 76 65 64 2d 64 61 74 61 2d 65 6e 74 72 + 79 20 6e 6f 74 20 7d 20 7b 20 30 20 7d 20 69 66 + 2d 65 6c 73 65 20 7d 0a + + ~ " { transformation-state" + ~ " transformation-state-output-metadata @" + 20 20 7b 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 + 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 + 74 70 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-first-entry" + 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 66 69 72 73 74 2d 65 6e + 74 72 79 0a + + ~ " over > {" + 20 20 20 20 6f 76 65 72 20 3e 20 7b 0a + + ~ " hex-output-metadata-previous-entry } { drop 0 }" + ~ " if-else } while" + 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 70 72 65 76 69 6f + 75 73 2d 65 6e 74 72 79 20 7d 20 7b 20 64 72 6f + 70 20 30 20 7d 20 69 66 2d 65 6c 73 65 20 7d 20 + 77 68 69 6c 65 0a + + ~ " ~ (entry pointer or 0)" + 20 20 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 20 6f 72 20 30 29 0a + + ~ " ;" + 20 20 3b 0a + + ~ "" + 0a + + ~ "~ (target start location -- entry pointer or 0)" + 7e 20 28 74 61 72 67 65 74 20 73 74 61 72 74 20 + 6c 6f 63 61 74 69 6f 6e 20 2d 2d 20 65 6e 74 72 + 79 20 70 6f 69 6e 74 65 72 20 6f 72 20 30 29 0a + + ~ ": find-first-comment-metadata-entry-with-start" + 3a 20 66 69 6e 64 2d 66 69 72 73 74 2d 63 6f 6d + 6d 65 6e 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e + 74 72 79 2d 77 69 74 68 2d 73 74 61 72 74 0a + + ~ " ~ Find the first entry, but if it doesn't exist, we want" + ~ " 0 instead." + 20 20 7e 20 46 69 6e 64 20 74 68 65 20 66 69 72 + 73 74 20 65 6e 74 72 79 2c 20 62 75 74 20 69 66 + 20 69 74 20 64 6f 65 73 6e 27 74 20 65 78 69 73 + 74 2c 20 77 65 20 77 61 6e 74 20 30 20 69 6e 73 + 74 65 61 64 2e 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-first-entry" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 66 69 72 73 74 2d 65 6e 74 72 + 79 0a + + ~ " ~ (target start location, entry pointer)" + 20 20 7e 20 28 74 61 72 67 65 74 20 73 74 61 72 + 74 20 6c 6f 63 61 74 69 6f 6e 2c 20 65 6e 74 72 + 79 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " ~ Now loop forwards to find the first that's a comment" + ~ " entry and has the" + 20 20 7e 20 20 20 4e 6f 77 20 6c 6f 6f 70 20 66 + 6f 72 77 61 72 64 73 20 74 6f 20 66 69 6e 64 20 + 74 68 65 20 66 69 72 73 74 20 74 68 61 74 27 73 + 20 61 20 63 6f 6d 6d 65 6e 74 20 65 6e 74 72 79 + 20 61 6e 64 20 68 61 73 20 74 68 65 0a + + ~ " ~ desired start location." + 20 20 7e 20 64 65 73 69 72 65 64 20 73 74 61 72 + 74 20 6c 6f 63 61 74 69 6f 6e 2e 0a + + ~ " { dup @ } {" + 20 20 7b 20 64 75 70 20 40 20 7d 20 7b 0a + + ~ " dup is-comment-entry" + 20 20 20 20 64 75 70 20 69 73 2d 63 6f 6d 6d 65 + 6e 74 2d 65 6e 74 72 79 0a + + ~ " over hex-output-metadata-entry-data-start @ 3 pick =" + 20 20 20 20 6f 76 65 72 20 68 65 78 2d 6f 75 74 + 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 + 72 79 2d 64 61 74 61 2d 73 74 61 72 74 20 40 20 + 33 20 70 69 63 6b 20 3d 0a + + ~ " && { swap drop exit } if" + 20 20 20 20 26 26 20 7b 20 73 77 61 70 20 64 72 + 6f 70 20 65 78 69 74 20 7d 20 69 66 0a + + ~ " hex-output-metadata-next-entry" + 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 6e 65 78 74 2d 65 6e 74 + 72 79 0a + + ~ " } while drop drop 0 ;" + 20 20 7d 20 77 68 69 6c 65 20 64 72 6f 70 20 64 + 72 6f 70 20 30 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ (target start location -- entry pointer or 0)" + 7e 20 28 74 61 72 67 65 74 20 73 74 61 72 74 20 + 6c 6f 63 61 74 69 6f 6e 20 2d 2d 20 65 6e 74 72 + 79 20 70 6f 69 6e 74 65 72 20 6f 72 20 30 29 0a + + ~ ": find-latest-comment-metadata-entry-with-start" + 3a 20 66 69 6e 64 2d 6c 61 74 65 73 74 2d 63 6f + 6d 6d 65 6e 74 2d 6d 65 74 61 64 61 74 61 2d 65 + 6e 74 72 79 2d 77 69 74 68 2d 73 74 61 72 74 0a + + ~ " find-latest-metadata-entry" + 20 20 66 69 6e 64 2d 6c 61 74 65 73 74 2d 6d 65 + 74 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ " ~ (target start location, entry pointer or 0)" + 20 20 7e 20 28 74 61 72 67 65 74 20 73 74 61 72 + 74 20 6c 6f 63 61 74 69 6f 6e 2c 20 65 6e 74 72 + 79 20 70 6f 69 6e 74 65 72 20 6f 72 20 30 29 0a + + ~ "" + 0a + + ~ " dup {" + 20 20 64 75 70 20 7b 0a + + ~ " { dup @ } {" + 20 20 20 20 7b 20 64 75 70 20 40 20 7d 20 7b 0a + + ~ " dup is-comment-entry" + 20 20 20 20 20 20 64 75 70 20 69 73 2d 63 6f 6d + 6d 65 6e 74 2d 65 6e 74 72 79 0a + + ~ " over hex-output-metadata-entry-data-start @ 3 pick =" + 20 20 20 20 20 20 6f 76 65 72 20 68 65 78 2d 6f + 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 + 6e 74 72 79 2d 64 61 74 61 2d 73 74 61 72 74 20 + 40 20 33 20 70 69 63 6b 20 3d 0a + + ~ " && { swap drop exit } if" + 20 20 20 20 20 20 26 26 20 7b 20 73 77 61 70 20 + 64 72 6f 70 20 65 78 69 74 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup" + 20 20 20 20 20 20 64 75 70 0a + + ~ " transformation-state" + ~ " transformation-state-output-metadata @" + 20 20 20 20 20 20 74 72 61 6e 73 66 6f 72 6d 61 + 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 + 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d + 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 20 + 40 0a + + ~ " hex-output-metadata-first-entry" + 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 66 69 72 73 74 2d + 65 6e 74 72 79 0a + + ~ " = { drop drop 0 exit } if" + 20 20 20 20 20 20 3d 20 7b 20 64 72 6f 70 20 64 + 72 6f 70 20 30 20 65 78 69 74 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " hex-output-metadata-previous-entry" + 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 70 72 65 76 69 6f + 75 73 2d 65 6e 74 72 79 0a + + ~ " } while" + 20 20 20 20 7d 20 77 68 69 6c 65 0a + + ~ " } if swap drop ;" + 20 20 7d 20 69 66 20 73 77 61 70 20 64 72 6f 70 + 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ (length adjustment --)" + 7e 20 28 6c 65 6e 67 74 68 20 61 64 6a 75 73 74 + 6d 65 6e 74 20 2d 2d 29 0a + + ~ ": adjust-latest-comment-metadata-entry-length" + 3a 20 61 64 6a 75 73 74 2d 6c 61 74 65 73 74 2d + 63 6f 6d 6d 65 6e 74 2d 6d 65 74 61 64 61 74 61 + 2d 65 6e 74 72 79 2d 6c 65 6e 67 74 68 0a + + ~ " find-latest-comment-metadata-entry" + 20 20 66 69 6e 64 2d 6c 61 74 65 73 74 2d 63 6f + 6d 6d 65 6e 74 2d 6d 65 74 61 64 61 74 61 2d 65 + 6e 74 72 79 0a + + ~ "" + 0a + + ~ " ~ We've found the entry we want to act on, if it exists," + ~ " so do it." + 20 20 7e 20 57 65 27 76 65 20 66 6f 75 6e 64 20 + 74 68 65 20 65 6e 74 72 79 20 77 65 20 77 61 6e + 74 20 74 6f 20 61 63 74 20 6f 6e 2c 20 69 66 20 + 69 74 20 65 78 69 73 74 73 2c 20 73 6f 20 64 6f + 20 69 74 2e 0a + + ~ " dup {" + 20 20 64 75 70 20 7b 0a + + ~ " hex-output-metadata-entry-data-length dup @ 3roll +" + ~ " swap !" + 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d 64 61 + 74 61 2d 6c 65 6e 67 74 68 20 64 75 70 20 40 20 + 33 72 6f 6c 6c 20 2b 20 73 77 61 70 20 21 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " drop" + 20 20 20 20 64 72 6f 70 0a + + ~ "" + 0a + + ~ " ~ If we get here, that's a problem. Emit an error" + ~ " message to make sure" + 20 20 20 20 7e 20 20 20 49 66 20 77 65 20 67 65 + 74 20 68 65 72 65 2c 20 74 68 61 74 27 73 20 61 + 20 70 72 6f 62 6c 65 6d 2e 20 45 6d 69 74 20 61 + 6e 20 65 72 72 6f 72 20 6d 65 73 73 61 67 65 20 + 74 6f 20 6d 61 6b 65 20 73 75 72 65 0a + + ~ " ~ it's easy to diagnose." + 20 20 20 20 7e 20 69 74 27 73 20 65 61 73 79 20 + 74 6f 20 64 69 61 67 6e 6f 73 65 2e 0a + + ~ " ." No pre-existing metadata entry to adjust." newline" + 20 20 20 20 2e 22 20 4e 6f 20 70 72 65 2d 65 78 + 69 73 74 69 6e 67 20 6d 65 74 61 64 61 74 61 20 + 65 6e 74 72 79 20 74 6f 20 61 64 6a 75 73 74 2e + 22 20 6e 65 77 6c 69 6e 65 0a + + ~ " crash" + 20 20 20 20 63 72 61 73 68 0a + + ~ " } if-else ;" + 20 20 7d 20 69 66 2d 65 6c 73 65 20 3b 0a + + ~ "" + 0a + + ~ "~ (length adjustment --)" + 7e 20 28 6c 65 6e 67 74 68 20 61 64 6a 75 73 74 + 6d 65 6e 74 20 2d 2d 29 0a + + ~ ": adjust-latest-output-producing-metadata-entry-start" + 3a 20 61 64 6a 75 73 74 2d 6c 61 74 65 73 74 2d + 6f 75 74 70 75 74 2d 70 72 6f 64 75 63 69 6e 67 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 73 74 61 72 74 0a + + ~ " find-latest-output-producing-metadata-entry" + 20 20 66 69 6e 64 2d 6c 61 74 65 73 74 2d 6f 75 + 74 70 75 74 2d 70 72 6f 64 75 63 69 6e 67 2d 6d + 65 74 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ "" + 0a + + ~ " ~ We've found the entry we want to act on, if it exists," + ~ " so do it." + 20 20 7e 20 57 65 27 76 65 20 66 6f 75 6e 64 20 + 74 68 65 20 65 6e 74 72 79 20 77 65 20 77 61 6e + 74 20 74 6f 20 61 63 74 20 6f 6e 2c 20 69 66 20 + 69 74 20 65 78 69 73 74 73 2c 20 73 6f 20 64 6f + 20 69 74 2e 0a + + ~ " dup {" + 20 20 64 75 70 20 7b 0a + + ~ " hex-output-metadata-entry-data-start dup @ 3roll + swap" + ~ " !" + 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d 64 61 + 74 61 2d 73 74 61 72 74 20 64 75 70 20 40 20 33 + 72 6f 6c 6c 20 2b 20 73 77 61 70 20 21 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " drop" + 20 20 20 20 64 72 6f 70 0a + + ~ "" + 0a + + ~ " ~ If we get here, that's a problem. Emit an error" + ~ " message to make sure" + 20 20 20 20 7e 20 20 20 49 66 20 77 65 20 67 65 + 74 20 68 65 72 65 2c 20 74 68 61 74 27 73 20 61 + 20 70 72 6f 62 6c 65 6d 2e 20 45 6d 69 74 20 61 + 6e 20 65 72 72 6f 72 20 6d 65 73 73 61 67 65 20 + 74 6f 20 6d 61 6b 65 20 73 75 72 65 0a + + ~ " ~ it's easy to diagnose." + 20 20 20 20 7e 20 69 74 27 73 20 65 61 73 79 20 + 74 6f 20 64 69 61 67 6e 6f 73 65 2e 0a + + ~ " ." No pre-existing metadata entry to adjust." newline" + 20 20 20 20 2e 22 20 4e 6f 20 70 72 65 2d 65 78 + 69 73 74 69 6e 67 20 6d 65 74 61 64 61 74 61 20 + 65 6e 74 72 79 20 74 6f 20 61 64 6a 75 73 74 2e + 22 20 6e 65 77 6c 69 6e 65 0a + + ~ " crash" + 20 20 20 20 63 72 61 73 68 0a + + ~ " } if-else ;" + 20 20 7d 20 69 66 2d 65 6c 73 65 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ (target start location --)" + 7e 20 28 74 61 72 67 65 74 20 73 74 61 72 74 20 + 6c 6f 63 61 74 69 6f 6e 20 2d 2d 29 0a + + ~ ": delete-first-comment-metadata-entry-with-start" + 3a 20 64 65 6c 65 74 65 2d 66 69 72 73 74 2d 63 + 6f 6d 6d 65 6e 74 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 79 2d 77 69 74 68 2d 73 74 61 72 74 + 0a + + ~ " find-first-comment-metadata-entry-with-start" + 20 20 66 69 6e 64 2d 66 69 72 73 74 2d 63 6f 6d + 6d 65 6e 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e + 74 72 79 2d 77 69 74 68 2d 73 74 61 72 74 0a + + ~ " dup { delete-metadata-entry } { drop } if-else ;" + 20 20 64 75 70 20 7b 20 64 65 6c 65 74 65 2d 6d + 65 74 61 64 61 74 61 2d 65 6e 74 72 79 20 7d 20 + 7b 20 64 72 6f 70 20 7d 20 69 66 2d 65 6c 73 65 + 20 3b 0a + + ~ "" + 0a + + ~ "~ (target start location --)" + 7e 20 28 74 61 72 67 65 74 20 73 74 61 72 74 20 + 6c 6f 63 61 74 69 6f 6e 20 2d 2d 29 0a + + ~ ": delete-latest-comment-metadata-entry-with-start" + 3a 20 64 65 6c 65 74 65 2d 6c 61 74 65 73 74 2d + 63 6f 6d 6d 65 6e 74 2d 6d 65 74 61 64 61 74 61 + 2d 65 6e 74 72 79 2d 77 69 74 68 2d 73 74 61 72 + 74 0a + + ~ " find-latest-comment-metadata-entry-with-start" + 20 20 66 69 6e 64 2d 6c 61 74 65 73 74 2d 63 6f + 6d 6d 65 6e 74 2d 6d 65 74 61 64 61 74 61 2d 65 + 6e 74 72 79 2d 77 69 74 68 2d 73 74 61 72 74 0a + + ~ " dup { delete-metadata-entry } { drop } if-else ;" + 20 20 64 75 70 20 7b 20 64 65 6c 65 74 65 2d 6d + 65 74 61 64 61 74 61 2d 65 6e 74 72 79 20 7d 20 + 7b 20 64 72 6f 70 20 7d 20 69 66 2d 65 6c 73 65 + 20 3b 0a + + ~ "" + 0a + + ~ ": delete-first-comment-metadata-entry-at-output-point" + 3a 20 64 65 6c 65 74 65 2d 66 69 72 73 74 2d 63 + 6f 6d 6d 65 6e 74 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 79 2d 61 74 2d 6f 75 74 70 75 74 2d + 70 6f 69 6e 74 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-latest-output-point @" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 6c 61 74 65 73 74 2d 6f 75 74 + 70 75 74 2d 70 6f 69 6e 74 20 40 0a + + ~ " delete-first-comment-metadata-entry-with-start ;" + 20 20 64 65 6c 65 74 65 2d 66 69 72 73 74 2d 63 + 6f 6d 6d 65 6e 74 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 79 2d 77 69 74 68 2d 73 74 61 72 74 + 20 3b 0a + + ~ "" + 0a + + ~ ": delete-latest-comment-metadata-entry-at-output-point" + 3a 20 64 65 6c 65 74 65 2d 6c 61 74 65 73 74 2d + 63 6f 6d 6d 65 6e 74 2d 6d 65 74 61 64 61 74 61 + 2d 65 6e 74 72 79 2d 61 74 2d 6f 75 74 70 75 74 + 2d 70 6f 69 6e 74 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-latest-output-point @" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 6c 61 74 65 73 74 2d 6f 75 74 + 70 75 74 2d 70 6f 69 6e 74 20 40 0a + + ~ " delete-latest-comment-metadata-entry-with-start ;" + 20 20 64 65 6c 65 74 65 2d 6c 61 74 65 73 74 2d + 63 6f 6d 6d 65 6e 74 2d 6d 65 74 61 64 61 74 61 + 2d 65 6e 74 72 79 2d 77 69 74 68 2d 73 74 61 72 + 74 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ (value --)" + 7e 20 28 76 61 6c 75 65 20 2d 2d 29 0a + + ~ ": set-latest-output-point" + 3a 20 73 65 74 2d 6c 61 74 65 73 74 2d 6f 75 74 + 70 75 74 2d 70 6f 69 6e 74 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-latest-output-point ! ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 6c 61 74 65 73 74 2d 6f 75 74 + 70 75 74 2d 70 6f 69 6e 74 20 21 20 3b 0a + + ~ "" + 0a + + ~ "~ (adjustment --)" + 7e 20 28 61 64 6a 75 73 74 6d 65 6e 74 20 2d 2d + 29 0a + + ~ ": adjust-latest-output-point" + 3a 20 61 64 6a 75 73 74 2d 6c 61 74 65 73 74 2d + 6f 75 74 70 75 74 2d 70 6f 69 6e 74 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-latest-output-point" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 6c 61 74 65 73 74 2d 6f 75 74 + 70 75 74 2d 70 6f 69 6e 74 0a + + ~ " dup 3unroll @ + swap ! ;" + 20 20 64 75 70 20 33 75 6e 72 6f 6c 6c 20 40 20 + 2b 20 73 77 61 70 20 21 20 3b 0a + + ~ "" + 0a + + ~ "~ (-- data value)" + 7e 20 28 2d 2d 20 64 61 74 61 20 76 61 6c 75 65 + 29 0a + + ~ ": data-consume" + 3a 20 64 61 74 61 2d 63 6f 6e 73 75 6d 65 0a + + ~ " find-latest-saved-data-metadata-entry" + 20 20 66 69 6e 64 2d 6c 61 74 65 73 74 2d 73 61 + 76 65 64 2d 64 61 74 61 2d 6d 65 74 61 64 61 74 + 61 2d 65 6e 74 72 79 0a + + ~ " ~ (entry pointer or 0)" + 20 20 7e 20 28 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 20 6f 72 20 30 29 0a + + ~ "" + 0a + + ~ " dup {" + 20 20 64 75 70 20 7b 0a + + ~ " dup hex-output-metadata-entry-content @ swap" + 20 20 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 63 6f 6e 74 65 6e 74 20 40 20 73 77 61 70 + 0a + + ~ " ~ (data value, entry pointer)" + 20 20 20 20 7e 20 28 64 61 74 61 20 76 61 6c 75 + 65 2c 20 65 6e 74 72 79 20 70 6f 69 6e 74 65 72 + 29 0a + + ~ "" + 0a + + ~ " delete-metadata-entry" + 20 20 20 20 64 65 6c 65 74 65 2d 6d 65 74 61 64 + 61 74 61 2d 65 6e 74 72 79 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " drop" + 20 20 20 20 64 72 6f 70 0a + + ~ "" + 0a + + ~ " ~ If we get here, that's a problem. Emit an error" + ~ " message to make sure" + 20 20 20 20 7e 20 20 20 49 66 20 77 65 20 67 65 + 74 20 68 65 72 65 2c 20 74 68 61 74 27 73 20 61 + 20 70 72 6f 62 6c 65 6d 2e 20 45 6d 69 74 20 61 + 6e 20 65 72 72 6f 72 20 6d 65 73 73 61 67 65 20 + 74 6f 20 6d 61 6b 65 20 73 75 72 65 0a + + ~ " ~ it's easy to diagnose." + 20 20 20 20 7e 20 69 74 27 73 20 65 61 73 79 20 + 74 6f 20 64 69 61 67 6e 6f 73 65 2e 0a + + ~ " ." No saved-data metadata entry to take a value from."" + ~ " newline" + 20 20 20 20 2e 22 20 4e 6f 20 73 61 76 65 64 2d + 64 61 74 61 20 6d 65 74 61 64 61 74 61 20 65 6e + 74 72 79 20 74 6f 20 74 61 6b 65 20 61 20 76 61 + 6c 75 65 20 66 72 6f 6d 2e 22 20 6e 65 77 6c 69 + 6e 65 0a + + ~ "" + 0a + + ~ " ~ We still return a value, so that our caller doesn't" + ~ " crash." + 20 20 20 20 7e 20 57 65 20 73 74 69 6c 6c 20 72 + 65 74 75 72 6e 20 61 20 76 61 6c 75 65 2c 20 73 + 6f 20 74 68 61 74 20 6f 75 72 20 63 61 6c 6c 65 + 72 20 64 6f 65 73 6e 27 74 20 63 72 61 73 68 2e + 0a + + ~ " 0" + 20 20 20 20 30 0a + + ~ " } if-else ;" + 20 20 7d 20 69 66 2d 65 6c 73 65 20 3b 0a + + ~ "" + 0a + + ~ "~ (adjustment scale factor --)" + 7e 20 28 61 64 6a 75 73 74 6d 65 6e 74 20 73 63 + 61 6c 65 20 66 61 63 74 6f 72 20 2d 2d 29 0a + + ~ ": data-adjust-latest-comment-metadata-entry-length" + 3a 20 64 61 74 61 2d 61 64 6a 75 73 74 2d 6c 61 + 74 65 73 74 2d 63 6f 6d 6d 65 6e 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 6c 65 6e 67 + 74 68 0a + + ~ " ~ All the entry array manipulation happens in" + ~ " data-consume. Once we're" + 20 20 7e 20 20 20 41 6c 6c 20 74 68 65 20 65 6e + 74 72 79 20 61 72 72 61 79 20 6d 61 6e 69 70 75 + 6c 61 74 69 6f 6e 20 68 61 70 70 65 6e 73 20 69 + 6e 20 64 61 74 61 2d 63 6f 6e 73 75 6d 65 2e 20 + 4f 6e 63 65 20 77 65 27 72 65 0a + + ~ " ~ done doing that, the array is now in a consistent" + ~ " state, so we can hand" + 20 20 7e 20 64 6f 6e 65 20 64 6f 69 6e 67 20 74 + 68 61 74 2c 20 74 68 65 20 61 72 72 61 79 20 69 + 73 20 6e 6f 77 20 69 6e 20 61 20 63 6f 6e 73 69 + 73 74 65 6e 74 20 73 74 61 74 65 2c 20 73 6f 20 + 77 65 20 63 61 6e 20 68 61 6e 64 0a + + ~ " ~ off to the non-data implementation to do the rest of" + ~ " the work." + 20 20 7e 20 6f 66 66 20 74 6f 20 74 68 65 20 6e + 6f 6e 2d 64 61 74 61 20 69 6d 70 6c 65 6d 65 6e + 74 61 74 69 6f 6e 20 74 6f 20 64 6f 20 74 68 65 + 20 72 65 73 74 20 6f 66 20 74 68 65 20 77 6f 72 + 6b 2e 0a + + ~ " data-consume *" + ~ " adjust-latest-comment-metadata-entry-length ;" + 20 20 64 61 74 61 2d 63 6f 6e 73 75 6d 65 20 2a + 20 61 64 6a 75 73 74 2d 6c 61 74 65 73 74 2d 63 + 6f 6d 6d 65 6e 74 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 79 2d 6c 65 6e 67 74 68 20 3b 0a + + ~ "~ (adjustment scale factor --)" + 7e 20 28 61 64 6a 75 73 74 6d 65 6e 74 20 73 63 + 61 6c 65 20 66 61 63 74 6f 72 20 2d 2d 29 0a + + ~ ": data-adjust-latest-output-producing-metadata-entry-start" + 3a 20 64 61 74 61 2d 61 64 6a 75 73 74 2d 6c 61 + 74 65 73 74 2d 6f 75 74 70 75 74 2d 70 72 6f 64 + 75 63 69 6e 67 2d 6d 65 74 61 64 61 74 61 2d 65 + 6e 74 72 79 2d 73 74 61 72 74 0a + + ~ " ~ Same as for adjusting the entry length." + 20 20 7e 20 53 61 6d 65 20 61 73 20 66 6f 72 20 + 61 64 6a 75 73 74 69 6e 67 20 74 68 65 20 65 6e + 74 72 79 20 6c 65 6e 67 74 68 2e 0a + + ~ " data-consume *" + ~ " adjust-latest-output-producing-metadata-entry-start ;" + 20 20 64 61 74 61 2d 63 6f 6e 73 75 6d 65 20 2a + 20 61 64 6a 75 73 74 2d 6c 61 74 65 73 74 2d 6f + 75 74 70 75 74 2d 70 72 6f 64 75 63 69 6e 67 2d + 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d 73 + 74 61 72 74 20 3b 0a + + ~ "" + 0a + + ~ "~ (value offset --)" + 7e 20 28 76 61 6c 75 65 20 6f 66 66 73 65 74 20 + 2d 2d 29 0a + + ~ ": data-set-latest-output-point" + 3a 20 64 61 74 61 2d 73 65 74 2d 6c 61 74 65 73 + 74 2d 6f 75 74 70 75 74 2d 70 6f 69 6e 74 0a + + ~ " data-consume + set-latest-output-point ;" + 20 20 64 61 74 61 2d 63 6f 6e 73 75 6d 65 20 2b + 20 73 65 74 2d 6c 61 74 65 73 74 2d 6f 75 74 70 + 75 74 2d 70 6f 69 6e 74 20 3b 0a + + ~ "~ (adjustment scale factor --)" + 7e 20 28 61 64 6a 75 73 74 6d 65 6e 74 20 73 63 + 61 6c 65 20 66 61 63 74 6f 72 20 2d 2d 29 0a + + ~ ": data-adjust-latest-output-point" + 3a 20 64 61 74 61 2d 61 64 6a 75 73 74 2d 6c 61 + 74 65 73 74 2d 6f 75 74 70 75 74 2d 70 6f 69 6e + 74 0a + + ~ " data-consume * adjust-latest-output-point ;" + 20 20 64 61 74 61 2d 63 6f 6e 73 75 6d 65 20 2a + 20 61 64 6a 75 73 74 2d 6c 61 74 65 73 74 2d 6f + 75 74 70 75 74 2d 70 6f 69 6e 74 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ (count adjustment --)" + 7e 20 28 63 6f 75 6e 74 20 61 64 6a 75 73 74 6d + 65 6e 74 20 2d 2d 29 0a + + ~ ": adjust-hex-output-suppression-count" + 3a 20 61 64 6a 75 73 74 2d 68 65 78 2d 6f 75 74 + 70 75 74 2d 73 75 70 70 72 65 73 73 69 6f 6e 2d + 63 6f 75 6e 74 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-suppression-count dup @ 3roll + swap" + ~ " ! ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 73 75 70 70 72 65 73 73 69 6f + 6e 2d 63 6f 75 6e 74 20 64 75 70 20 40 20 33 72 + 6f 6c 6c 20 2b 20 73 77 61 70 20 21 20 3b 0a + + ~ "" + 0a + + ~ "~ This is the followup to zero-hex-output-metadata," + ~ " above. Once we do have" + 7e 20 20 20 54 68 69 73 20 69 73 20 74 68 65 20 + 66 6f 6c 6c 6f 77 75 70 20 74 6f 20 7a 65 72 6f + 2d 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 + 64 61 74 61 2c 20 61 62 6f 76 65 2e 20 4f 6e 63 + 65 20 77 65 20 64 6f 20 68 61 76 65 0a + + ~ "~ the label-loop buffer, we need to create some default" + ~ " entries. This is" + 7e 20 74 68 65 20 6c 61 62 65 6c 2d 6c 6f 6f 70 + 20 62 75 66 66 65 72 2c 20 77 65 20 6e 65 65 64 + 20 74 6f 20 63 72 65 61 74 65 20 73 6f 6d 65 20 + 64 65 66 61 75 6c 74 20 65 6e 74 72 69 65 73 2e + 20 54 68 69 73 20 69 73 0a + + ~ "~ called in the first label-loop iteration by" + ~ " hex-allocate-replacement, and" + 7e 20 63 61 6c 6c 65 64 20 69 6e 20 74 68 65 20 + 66 69 72 73 74 20 6c 61 62 65 6c 2d 6c 6f 6f 70 + 20 69 74 65 72 61 74 69 6f 6e 20 62 79 20 68 65 + 78 2d 61 6c 6c 6f 63 61 74 65 2d 72 65 70 6c 61 + 63 65 6d 65 6e 74 2c 20 61 6e 64 0a + + ~ "~ it's called before subsequent iterations by the hook on" + ~ " reset-labels defined" + 7e 20 69 74 27 73 20 63 61 6c 6c 65 64 20 62 65 + 66 6f 72 65 20 73 75 62 73 65 71 75 65 6e 74 20 + 69 74 65 72 61 74 69 6f 6e 73 20 62 79 20 74 68 + 65 20 68 6f 6f 6b 20 6f 6e 20 72 65 73 65 74 2d + 6c 61 62 65 6c 73 20 64 65 66 69 6e 65 64 0a + + ~ "~ in hex-colon-alternate." + 7e 20 69 6e 20 68 65 78 2d 63 6f 6c 6f 6e 2d 61 + 6c 74 65 72 6e 61 74 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ This overwrites whatever entries currently exist with" + ~ " the new ones, and" + 7e 20 20 20 54 68 69 73 20 6f 76 65 72 77 72 69 + 74 65 73 20 77 68 61 74 65 76 65 72 20 65 6e 74 + 72 69 65 73 20 63 75 72 72 65 6e 74 6c 79 20 65 + 78 69 73 74 20 77 69 74 68 20 74 68 65 20 6e 65 + 77 20 6f 6e 65 73 2c 20 61 6e 64 0a + + ~ "~ adds a zero delimiter at the end." + 7e 20 61 64 64 73 20 61 20 7a 65 72 6f 20 64 65 + 6c 69 6d 69 74 65 72 20 61 74 20 74 68 65 20 65 + 6e 64 2e 0a + + ~ "~" + 7e 0a + + ~ "~ In addition to setting up the entries, we also set" + ~ " latest-output-point to" + 7e 20 20 20 49 6e 20 61 64 64 69 74 69 6f 6e 20 + 74 6f 20 73 65 74 74 69 6e 67 20 75 70 20 74 68 + 65 20 65 6e 74 72 69 65 73 2c 20 77 65 20 61 6c + 73 6f 20 73 65 74 20 6c 61 74 65 73 74 2d 6f 75 + 74 70 75 74 2d 70 6f 69 6e 74 20 74 6f 0a + + ~ "~ the start of the label-loop buffer here. This needs to" + ~ " happen at the start" + 7e 20 74 68 65 20 73 74 61 72 74 20 6f 66 20 74 + 68 65 20 6c 61 62 65 6c 2d 6c 6f 6f 70 20 62 75 + 66 66 65 72 20 68 65 72 65 2e 20 54 68 69 73 20 + 6e 65 65 64 73 20 74 6f 20 68 61 70 70 65 6e 20 + 61 74 20 74 68 65 20 73 74 61 72 74 0a + + ~ "~ of each pass, so although it doesn't quite fit the name," + ~ " we do it here." + 7e 20 6f 66 20 65 61 63 68 20 70 61 73 73 2c 20 + 73 6f 20 61 6c 74 68 6f 75 67 68 20 69 74 20 64 + 6f 65 73 6e 27 74 20 71 75 69 74 65 20 66 69 74 + 20 74 68 65 20 6e 61 6d 65 2c 20 77 65 20 64 6f + 20 69 74 20 68 65 72 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ It requires the header to have already been" + ~ " initialized; in particular it" + 7e 20 20 20 49 74 20 72 65 71 75 69 72 65 73 20 + 74 68 65 20 68 65 61 64 65 72 20 74 6f 20 68 61 + 76 65 20 61 6c 72 65 61 64 79 20 62 65 65 6e 20 + 69 6e 69 74 69 61 6c 69 7a 65 64 3b 20 69 6e 20 + 70 61 72 74 69 63 75 6c 61 72 20 69 74 0a + + ~ "~ requires the label-loop buffer start pointer to be" + ~ " valid." + 7e 20 72 65 71 75 69 72 65 73 20 74 68 65 20 6c + 61 62 65 6c 2d 6c 6f 6f 70 20 62 75 66 66 65 72 + 20 73 74 61 72 74 20 70 6f 69 6e 74 65 72 20 74 + 6f 20 62 65 20 76 61 6c 69 64 2e 0a + + ~ ": create-hex-output-metadata-top-of-file-entries" + 3a 20 63 72 65 61 74 65 2d 68 65 78 2d 6f 75 74 + 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 74 6f 70 + 2d 6f 66 2d 66 69 6c 65 2d 65 6e 74 72 69 65 73 + 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " dup hex-output-metadata-label-loop-buffer-start @" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 6c 61 62 65 6c 2d + 6c 6f 6f 70 2d 62 75 66 66 65 72 2d 73 74 61 72 + 74 20 40 0a + + ~ " swap hex-output-metadata-first-entry" + 20 20 73 77 61 70 20 68 65 78 2d 6f 75 74 70 75 + 74 2d 6d 65 74 61 64 61 74 61 2d 66 69 72 73 74 + 2d 65 6e 74 72 79 0a + + ~ " ~ (label buffer start, metadata output point)" + 20 20 7e 20 28 6c 61 62 65 6c 20 62 75 66 66 65 + 72 20 73 74 61 72 74 2c 20 6d 65 74 61 64 61 74 + 61 20 6f 75 74 70 75 74 20 70 6f 69 6e 74 29 0a + + ~ "" + 0a + + ~ " ~ This likely won't affect anything, because every call" + ~ " to pack*" + 20 20 7e 20 20 20 54 68 69 73 20 6c 69 6b 65 6c + 79 20 77 6f 6e 27 74 20 61 66 66 65 63 74 20 61 + 6e 79 74 68 69 6e 67 2c 20 62 65 63 61 75 73 65 + 20 65 76 65 72 79 20 63 61 6c 6c 20 74 6f 20 70 + 61 63 6b 2a 0a + + ~ " ~ overwrites it, but we initialize the latest output" + ~ " point to the start of" + 20 20 7e 20 6f 76 65 72 77 72 69 74 65 73 20 69 + 74 2c 20 62 75 74 20 77 65 20 69 6e 69 74 69 61 + 6c 69 7a 65 20 74 68 65 20 6c 61 74 65 73 74 20 + 6f 75 74 70 75 74 20 70 6f 69 6e 74 20 74 6f 20 + 74 68 65 20 73 74 61 72 74 20 6f 66 0a + + ~ " ~ the label loop buffer here. That way, in the event the" + ~ " very first thing in" + 20 20 7e 20 74 68 65 20 6c 61 62 65 6c 20 6c 6f + 6f 70 20 62 75 66 66 65 72 20 68 65 72 65 2e 20 + 54 68 61 74 20 77 61 79 2c 20 69 6e 20 74 68 65 + 20 65 76 65 6e 74 20 74 68 65 20 76 65 72 79 20 + 66 69 72 73 74 20 74 68 69 6e 67 20 69 6e 0a + + ~ " ~ the output is something that's supposed to have a magic" + ~ " comment on it," + 20 20 7e 20 74 68 65 20 6f 75 74 70 75 74 20 69 + 73 20 73 6f 6d 65 74 68 69 6e 67 20 74 68 61 74 + 27 73 20 73 75 70 70 6f 73 65 64 20 74 6f 20 68 + 61 76 65 20 61 20 6d 61 67 69 63 20 63 6f 6d 6d + 65 6e 74 20 6f 6e 20 69 74 2c 0a + + ~ " ~ hex-tilde-replacement will know where to attach the" + ~ " metadata entry." + 20 20 7e 20 68 65 78 2d 74 69 6c 64 65 2d 72 65 + 70 6c 61 63 65 6d 65 6e 74 20 77 69 6c 6c 20 6b + 6e 6f 77 20 77 68 65 72 65 20 74 6f 20 61 74 74 + 61 63 68 20 74 68 65 20 6d 65 74 61 64 61 74 61 + 20 65 6e 74 72 79 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ If that was word soup, go read about" + ~ " hex-tilde-replacement and" + 20 20 7e 20 20 20 49 66 20 74 68 61 74 20 77 61 + 73 20 77 6f 72 64 20 73 6f 75 70 2c 20 67 6f 20 + 72 65 61 64 20 61 62 6f 75 74 20 68 65 78 2d 74 + 69 6c 64 65 2d 72 65 70 6c 61 63 65 6d 65 6e 74 + 20 61 6e 64 0a + + ~ " ~ hex-tilde-alternate and come back. :)" + 20 20 7e 20 68 65 78 2d 74 69 6c 64 65 2d 61 6c + 74 65 72 6e 61 74 65 20 61 6e 64 20 63 6f 6d 65 + 20 62 61 63 6b 2e 20 3a 29 0a + + ~ " over" + 20 20 6f 76 65 72 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-latest-output-point !" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 6c 61 74 65 73 74 2d 6f 75 74 + 70 75 74 2d 70 6f 69 6e 74 20 21 0a + + ~ " 0 has-non-space-this-input-line!" + 20 20 30 20 68 61 73 2d 6e 6f 6e 2d 73 70 61 63 + 65 2d 74 68 69 73 2d 69 6e 70 75 74 2d 6c 69 6e + 65 21 0a + + ~ "" + 0a + + ~ " over 0 hex-output-metadata-entry-type-line-comment" + 20 20 6f 76 65 72 20 30 20 68 65 78 2d 6f 75 74 + 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 + 72 79 2d 74 79 70 65 2d 6c 69 6e 65 2d 63 6f 6d + 6d 65 6e 74 0a + + ~ " s" This file is a commented hexadecimal representation" + ~ " of a compiled"" + 20 20 73 22 20 20 20 54 68 69 73 20 66 69 6c 65 + 20 69 73 20 61 20 63 6f 6d 6d 65 6e 74 65 64 20 + 68 65 78 61 64 65 63 69 6d 61 6c 20 72 65 70 72 + 65 73 65 6e 74 61 74 69 6f 6e 20 6f 66 20 61 20 + 63 6f 6d 70 69 6c 65 64 22 0a + + ~ " pack-hex-output-metadata-entry" + 20 20 70 61 63 6b 2d 68 65 78 2d 6f 75 74 70 75 + 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 + 0a + + ~ "" + 0a + + ~ " over 0 hex-output-metadata-entry-type-line-comment" + 20 20 6f 76 65 72 20 30 20 68 65 78 2d 6f 75 74 + 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 + 72 79 2d 74 79 70 65 2d 6c 69 6e 65 2d 63 6f 6d + 6d 65 6e 74 0a + + ~ " s" program, the output of Evocation's hex transform. The" + ~ " comments are"" + 20 20 73 22 20 70 72 6f 67 72 61 6d 2c 20 74 68 + 65 20 6f 75 74 70 75 74 20 6f 66 20 45 76 6f 63 + 61 74 69 6f 6e 27 73 20 68 65 78 20 74 72 61 6e + 73 66 6f 72 6d 2e 20 54 68 65 20 63 6f 6d 6d 65 + 6e 74 73 20 61 72 65 22 0a + + ~ " pack-hex-output-metadata-entry" + 20 20 70 61 63 6b 2d 68 65 78 2d 6f 75 74 70 75 + 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 + 0a + + ~ "" + 0a + + ~ " over 0 hex-output-metadata-entry-type-line-comment" + 20 20 6f 76 65 72 20 30 20 68 65 78 2d 6f 75 74 + 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 + 72 79 2d 74 79 70 65 2d 6c 69 6e 65 2d 63 6f 6d + 6d 65 6e 74 0a + + ~ " s" intended to allow a human reader to audit it. You can" + ~ " convert it to a"" + 20 20 73 22 20 69 6e 74 65 6e 64 65 64 20 74 6f + 20 61 6c 6c 6f 77 20 61 20 68 75 6d 61 6e 20 72 + 65 61 64 65 72 20 74 6f 20 61 75 64 69 74 20 69 + 74 2e 20 59 6f 75 20 63 61 6e 20 63 6f 6e 76 65 + 72 74 20 69 74 20 74 6f 20 61 22 0a + + ~ " pack-hex-output-metadata-entry" + 20 20 70 61 63 6b 2d 68 65 78 2d 6f 75 74 70 75 + 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 + 0a + + ~ "" + 0a + + ~ " over 0 hex-output-metadata-entry-type-line-comment" + 20 20 6f 76 65 72 20 30 20 68 65 78 2d 6f 75 74 + 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 + 72 79 2d 74 79 70 65 2d 6c 69 6e 65 2d 63 6f 6d + 6d 65 6e 74 0a + + ~ " s" runnable executable by piping it through the program" + ~ " named 'hex' and"" + 20 20 73 22 20 72 75 6e 6e 61 62 6c 65 20 65 78 + 65 63 75 74 61 62 6c 65 20 62 79 20 70 69 70 69 + 6e 67 20 69 74 20 74 68 72 6f 75 67 68 20 74 68 + 65 20 70 72 6f 67 72 61 6d 20 6e 61 6d 65 64 20 + 27 68 65 78 27 20 61 6e 64 22 0a + + ~ " pack-hex-output-metadata-entry" + 20 20 70 61 63 6b 2d 68 65 78 2d 6f 75 74 70 75 + 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 + 0a + + ~ "" + 0a + + ~ " over 0 hex-output-metadata-entry-type-line-comment" + 20 20 6f 76 65 72 20 30 20 68 65 78 2d 6f 75 74 + 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 + 72 79 2d 74 79 70 65 2d 6c 69 6e 65 2d 63 6f 6d + 6d 65 6e 74 0a + + ~ " s" chmodding the output 755. The difference between a" + ~ " source and a binary"" + 20 20 73 22 20 63 68 6d 6f 64 64 69 6e 67 20 74 + 68 65 20 6f 75 74 70 75 74 20 37 35 35 2e 20 54 + 68 65 20 64 69 66 66 65 72 65 6e 63 65 20 62 65 + 74 77 65 65 6e 20 61 20 73 6f 75 72 63 65 20 61 + 6e 64 20 61 20 62 69 6e 61 72 79 22 0a + + ~ " pack-hex-output-metadata-entry" + 20 20 70 61 63 6b 2d 68 65 78 2d 6f 75 74 70 75 + 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 + 0a + + ~ "" + 0a + + ~ " over 0 hex-output-metadata-entry-type-line-comment" + 20 20 6f 76 65 72 20 30 20 68 65 78 2d 6f 75 74 + 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 + 72 79 2d 74 79 70 65 2d 6c 69 6e 65 2d 63 6f 6d + 6d 65 6e 74 0a + + ~ " s" is comments! Enjoy. :)"" + 20 20 73 22 20 69 73 20 63 6f 6d 6d 65 6e 74 73 + 21 20 45 6e 6a 6f 79 2e 20 3a 29 22 0a + + ~ " pack-hex-output-metadata-entry" + 20 20 70 61 63 6b 2d 68 65 78 2d 6f 75 74 70 75 + 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 + 0a + + ~ "" + 0a + + ~ " over 0 hex-output-metadata-entry-type-blank-line 0" + 20 20 6f 76 65 72 20 30 20 68 65 78 2d 6f 75 74 + 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 + 72 79 2d 74 79 70 65 2d 62 6c 61 6e 6b 2d 6c 69 + 6e 65 20 30 0a + + ~ " pack-hex-output-metadata-entry" + 20 20 70 61 63 6b 2d 68 65 78 2d 6f 75 74 70 75 + 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 + 0a + + ~ "" + 0a + + ~ " 0 swap ! ~ End-of-entries delimiter" + 20 20 30 20 73 77 61 70 20 21 20 7e 20 45 6e 64 + 2d 6f 66 2d 65 6e 74 72 69 65 73 20 64 65 6c 69 + 6d 69 74 65 72 0a + + ~ " drop" + 20 20 64 72 6f 70 0a + + ~ "" + 0a + + ~ " ~ Overwrite the entry count to reflect what we just did." + 20 20 7e 20 4f 76 65 72 77 72 69 74 65 20 74 68 + 65 20 65 6e 74 72 79 20 63 6f 75 6e 74 20 74 6f + 20 72 65 66 6c 65 63 74 20 77 68 61 74 20 77 65 + 20 6a 75 73 74 20 64 69 64 2e 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-entry-count 7 swap ! ;" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 63 6f 75 6e + 74 20 37 20 73 77 61 70 20 21 20 3b 0a + + ~ "" + 0a + + ~ ": hex-self-codeword-alternate self-codeword ;" + 3a 20 68 65 78 2d 73 65 6c 66 2d 63 6f 64 65 77 + 6f 72 64 2d 61 6c 74 65 72 6e 61 74 65 20 73 65 + 6c 66 2d 63 6f 64 65 77 6f 72 64 20 3b 0a + + ~ "" + 0a + + ~ ": hex-string-alternate" + 3a 20 68 65 78 2d 73 74 72 69 6e 67 2d 61 6c 74 + 65 72 6e 61 74 65 0a + + ~ " ~ The technique we use to wrap s" is analogous to how" + ~ " we do it in the" + 20 20 7e 20 20 20 54 68 65 20 74 65 63 68 6e 69 + 71 75 65 20 77 65 20 75 73 65 20 74 6f 20 77 72 + 61 70 20 73 22 20 69 73 20 61 6e 61 6c 6f 67 6f + 75 73 20 74 6f 20 68 6f 77 20 77 65 20 64 6f 20 + 69 74 20 69 6e 20 74 68 65 0a + + ~ " ~ label transform, but with one critical decision" + ~ " different." + 20 20 7e 20 6c 61 62 65 6c 20 74 72 61 6e 73 66 + 6f 72 6d 2c 20 62 75 74 20 77 69 74 68 20 6f 6e + 65 20 63 72 69 74 69 63 61 6c 20 64 65 63 69 73 + 69 6f 6e 20 64 69 66 66 65 72 65 6e 74 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ In the label transform, the output buffer is going to" + ~ " be written" + 20 20 7e 20 20 20 49 6e 20 74 68 65 20 6c 61 62 + 65 6c 20 74 72 61 6e 73 66 6f 72 6d 2c 20 74 68 + 65 20 6f 75 74 70 75 74 20 62 75 66 66 65 72 20 + 69 73 20 67 6f 69 6e 67 20 74 6f 20 62 65 20 77 + 72 69 74 74 65 6e 0a + + ~ " ~ directly into the final executable at some point, and" + ~ " we'd really rather" + 20 20 7e 20 64 69 72 65 63 74 6c 79 20 69 6e 74 + 6f 20 74 68 65 20 66 69 6e 61 6c 20 65 78 65 63 + 75 74 61 62 6c 65 20 61 74 20 73 6f 6d 65 20 70 + 6f 69 6e 74 2c 20 61 6e 64 20 77 65 27 64 20 72 + 65 61 6c 6c 79 20 72 61 74 68 65 72 0a + + ~ " ~ not scribble temporary values into it, even if we" + ~ " expect to overwrite them" + 20 20 7e 20 6e 6f 74 20 73 63 72 69 62 62 6c 65 + 20 74 65 6d 70 6f 72 61 72 79 20 76 61 6c 75 65 + 73 20 69 6e 74 6f 20 69 74 2c 20 65 76 65 6e 20 + 69 66 20 77 65 20 65 78 70 65 63 74 20 74 6f 20 + 6f 76 65 72 77 72 69 74 65 20 74 68 65 6d 0a + + ~ " ~ later. Additionally, everything the label transform" + ~ " does runs inside the" + 20 20 7e 20 6c 61 74 65 72 2e 20 41 64 64 69 74 + 69 6f 6e 61 6c 6c 79 2c 20 65 76 65 72 79 74 68 + 69 6e 67 20 74 68 65 20 6c 61 62 65 6c 20 74 72 + 61 6e 73 66 6f 72 6d 20 64 6f 65 73 20 72 75 6e + 73 20 69 6e 73 69 64 65 20 74 68 65 0a + + ~ " ~ label loop, so the code it's transforming isn't" + ~ " expected to do any sort of" + 20 20 7e 20 6c 61 62 65 6c 20 6c 6f 6f 70 2c 20 + 73 6f 20 74 68 65 20 63 6f 64 65 20 69 74 27 73 + 20 74 72 61 6e 73 66 6f 72 6d 69 6e 67 20 69 73 + 6e 27 74 20 65 78 70 65 63 74 65 64 20 74 6f 20 + 64 6f 20 61 6e 79 20 73 6f 72 74 20 6f 66 0a + + ~ " ~ miscellaneous setup things, just define a bunch of" + ~ " words. In that" + 20 20 7e 20 6d 69 73 63 65 6c 6c 61 6e 65 6f 75 + 73 20 73 65 74 75 70 20 74 68 69 6e 67 73 2c 20 + 6a 75 73 74 20 64 65 66 69 6e 65 20 61 20 62 75 + 6e 63 68 20 6f 66 20 77 6f 72 64 73 2e 20 49 6e + 20 74 68 61 74 0a + + ~ " ~ situation, making sure to use temporary space from the" + ~ " outer, "real" log" + 20 20 7e 20 73 69 74 75 61 74 69 6f 6e 2c 20 6d + 61 6b 69 6e 67 20 73 75 72 65 20 74 6f 20 75 73 + 65 20 74 65 6d 70 6f 72 61 72 79 20 73 70 61 63 + 65 20 66 72 6f 6d 20 74 68 65 20 6f 75 74 65 72 + 2c 20 22 72 65 61 6c 22 20 6c 6f 67 0a + + ~ " ~ is helpful." + 20 20 7e 20 69 73 20 68 65 6c 70 66 75 6c 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ In the hex transform, most of that is different. The" + ~ " output buffer will" + 20 20 7e 20 20 20 49 6e 20 74 68 65 20 68 65 78 + 20 74 72 61 6e 73 66 6f 72 6d 2c 20 6d 6f 73 74 + 20 6f 66 20 74 68 61 74 20 69 73 20 64 69 66 66 + 65 72 65 6e 74 2e 20 54 68 65 20 6f 75 74 70 75 + 74 20 62 75 66 66 65 72 20 77 69 6c 6c 0a + + ~ " ~ include all sorts of things that don't become part of" + ~ " the final" + 20 20 7e 20 69 6e 63 6c 75 64 65 20 61 6c 6c 20 + 73 6f 72 74 73 20 6f 66 20 74 68 69 6e 67 73 20 + 74 68 61 74 20 64 6f 6e 27 74 20 62 65 63 6f 6d + 65 20 70 61 72 74 20 6f 66 20 74 68 65 20 66 69 + 6e 61 6c 0a + + ~ " ~ executable, though they're used in producing it. So," + ~ " it's fine to use it" + 20 20 7e 20 65 78 65 63 75 74 61 62 6c 65 2c 20 + 74 68 6f 75 67 68 20 74 68 65 79 27 72 65 20 75 + 73 65 64 20 69 6e 20 70 72 6f 64 75 63 69 6e 67 + 20 69 74 2e 20 53 6f 2c 20 69 74 27 73 20 66 69 + 6e 65 20 74 6f 20 75 73 65 20 69 74 0a + + ~ " ~ for scratch space. Additionally, using the outer log" + ~ " for string literals" + 20 20 7e 20 66 6f 72 20 73 63 72 61 74 63 68 20 + 73 70 61 63 65 2e 20 41 64 64 69 74 69 6f 6e 61 + 6c 6c 79 2c 20 75 73 69 6e 67 20 74 68 65 20 6f + 75 74 65 72 20 6c 6f 67 20 66 6f 72 20 73 74 72 + 69 6e 67 20 6c 69 74 65 72 61 6c 73 0a + + ~ " ~ gets us into trouble, since some of these temporary" + ~ " strings need to be" + 20 20 7e 20 67 65 74 73 20 75 73 20 69 6e 74 6f + 20 74 72 6f 75 62 6c 65 2c 20 73 69 6e 63 65 20 + 73 6f 6d 65 20 6f 66 20 74 68 65 73 65 20 74 65 + 6d 70 6f 72 61 72 79 20 73 74 72 69 6e 67 73 20 + 6e 65 65 64 20 74 6f 20 62 65 0a + + ~ " ~ made more durable by calling allocate-string on them." + ~ " If we do that with" + 20 20 7e 20 6d 61 64 65 20 6d 6f 72 65 20 64 75 + 72 61 62 6c 65 20 62 79 20 63 61 6c 6c 69 6e 67 + 20 61 6c 6c 6f 63 61 74 65 2d 73 74 72 69 6e 67 + 20 6f 6e 20 74 68 65 6d 2e 20 49 66 20 77 65 20 + 64 6f 20 74 68 61 74 20 77 69 74 68 0a + + ~ " ~ a string pointer backed by the outer log, the inner" + ~ " "here" will wind up" + 20 20 7e 20 61 20 73 74 72 69 6e 67 20 70 6f 69 + 6e 74 65 72 20 62 61 63 6b 65 64 20 62 79 20 74 + 68 65 20 6f 75 74 65 72 20 6c 6f 67 2c 20 74 68 + 65 20 69 6e 6e 65 72 20 22 68 65 72 65 22 20 77 + 69 6c 6c 20 77 69 6e 64 20 75 70 0a + + ~ " ~ pointing to the end of the outer log, and all sorts of" + ~ " things will start" + 20 20 7e 20 70 6f 69 6e 74 69 6e 67 20 74 6f 20 + 74 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 6f + 75 74 65 72 20 6c 6f 67 2c 20 61 6e 64 20 61 6c + 6c 20 73 6f 72 74 73 20 6f 66 20 74 68 69 6e 67 + 73 20 77 69 6c 6c 20 73 74 61 72 74 0a + + ~ " ~ scribbling atop each other." + 20 20 7e 20 73 63 72 69 62 62 6c 69 6e 67 20 61 + 74 6f 70 20 65 61 63 68 20 6f 74 68 65 72 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ We do still benefit from using the interpreted" + ~ " version of s" rather than" + 20 20 7e 20 20 20 57 65 20 64 6f 20 73 74 69 6c + 6c 20 62 65 6e 65 66 69 74 20 66 72 6f 6d 20 75 + 73 69 6e 67 20 74 68 65 20 69 6e 74 65 72 70 72 + 65 74 65 64 20 76 65 72 73 69 6f 6e 20 6f 66 20 + 73 22 20 72 61 74 68 65 72 20 74 68 61 6e 0a + + ~ " ~ the compiled one; as with the label transform, it's" + ~ " convenient to handle" + 20 20 7e 20 74 68 65 20 63 6f 6d 70 69 6c 65 64 + 20 6f 6e 65 3b 20 61 73 20 77 69 74 68 20 74 68 + 65 20 6c 61 62 65 6c 20 74 72 61 6e 73 66 6f 72 + 6d 2c 20 69 74 27 73 20 63 6f 6e 76 65 6e 69 65 + 6e 74 20 74 6f 20 68 61 6e 64 6c 65 0a + + ~ " ~ the litstring dance ourselves." + 20 20 7e 20 74 68 65 20 6c 69 74 73 74 72 69 6e + 67 20 64 61 6e 63 65 20 6f 75 72 73 65 6c 76 65 + 73 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ If we're in compile mode, we have reinvented a" + ~ " problem which the" + 20 20 7e 20 20 20 49 66 20 77 65 27 72 65 20 69 + 6e 20 63 6f 6d 70 69 6c 65 20 6d 6f 64 65 2c 20 + 77 65 20 68 61 76 65 20 72 65 69 6e 76 65 6e 74 + 65 64 20 61 20 70 72 6f 62 6c 65 6d 20 77 68 69 + 63 68 20 74 68 65 0a + + ~ " ~ regular, non-transformed s" already deals with: The" + ~ " temporary space we're" + 20 20 7e 20 72 65 67 75 6c 61 72 2c 20 6e 6f 6e + 2d 74 72 61 6e 73 66 6f 72 6d 65 64 20 73 22 20 + 61 6c 72 65 61 64 79 20 64 65 61 6c 73 20 77 69 + 74 68 3a 20 54 68 65 20 74 65 6d 70 6f 72 61 72 + 79 20 73 70 61 63 65 20 77 65 27 72 65 0a + + ~ " ~ writing to is in the same place as the code we're" + ~ " compiling. We solve it" + 20 20 7e 20 77 72 69 74 69 6e 67 20 74 6f 20 69 + 73 20 69 6e 20 74 68 65 20 73 61 6d 65 20 70 6c + 61 63 65 20 61 73 20 74 68 65 20 63 6f 64 65 20 + 77 65 27 72 65 20 63 6f 6d 70 69 6c 69 6e 67 2e + 20 57 65 20 73 6f 6c 76 65 20 69 74 0a + + ~ " ~ the same way: Check beforehand and write out the call" + ~ " to litstring if we" + 20 20 7e 20 74 68 65 20 73 61 6d 65 20 77 61 79 + 3a 20 43 68 65 63 6b 20 62 65 66 6f 72 65 68 61 + 6e 64 20 61 6e 64 20 77 72 69 74 65 20 6f 75 74 + 20 74 68 65 20 63 61 6c 6c 20 74 6f 20 6c 69 74 + 73 74 72 69 6e 67 20 69 66 20 77 65 0a + + ~ " ~ need it, so that we won't have to slide things around" + ~ " later." + 20 20 7e 20 6e 65 65 64 20 69 74 2c 20 73 6f 20 + 74 68 61 74 20 77 65 20 77 6f 6e 27 74 20 68 61 + 76 65 20 74 6f 20 73 6c 69 64 65 20 74 68 69 6e + 67 73 20 61 72 6f 75 6e 64 20 6c 61 74 65 72 2e + 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " ~ We look up the inner version of litstring to" + ~ " reference here. This is" + 20 20 20 20 7e 20 20 20 57 65 20 6c 6f 6f 6b 20 + 75 70 20 74 68 65 20 69 6e 6e 65 72 20 76 65 72 + 73 69 6f 6e 20 6f 66 20 6c 69 74 73 74 72 69 6e + 67 20 74 6f 20 72 65 66 65 72 65 6e 63 65 20 68 + 65 72 65 2e 20 54 68 69 73 20 69 73 0a + + ~ " ~ similar to what the label transform does, except we" + ~ " don't use a label" + 20 20 20 20 7e 20 73 69 6d 69 6c 61 72 20 74 6f + 20 77 68 61 74 20 74 68 65 20 6c 61 62 65 6c 20 + 74 72 61 6e 73 66 6f 72 6d 20 64 6f 65 73 2c 20 + 65 78 63 65 70 74 20 77 65 20 64 6f 6e 27 74 20 + 75 73 65 20 61 20 6c 61 62 65 6c 0a + + ~ " ~ for it." + 20 20 20 20 7e 20 66 6f 72 20 69 74 2e 0a + + ~ " s" litstring" find entry-to-execution-token ," + 20 20 20 20 73 22 20 6c 69 74 73 74 72 69 6e 67 + 22 20 66 69 6e 64 20 65 6e 74 72 79 2d 74 6f 2d + 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 + 2c 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ Now, regardless of what mode we're actually in, call" + ~ " the interpreted" + 20 20 7e 20 20 20 4e 6f 77 2c 20 72 65 67 61 72 + 64 6c 65 73 73 20 6f 66 20 77 68 61 74 20 6d 6f + 64 65 20 77 65 27 72 65 20 61 63 74 75 61 6c 6c + 79 20 69 6e 2c 20 63 61 6c 6c 20 74 68 65 20 69 + 6e 74 65 72 70 72 65 74 65 64 0a + + ~ " ~ version of s" to read the actual string and its null" + ~ " terminator." + 20 20 7e 20 76 65 72 73 69 6f 6e 20 6f 66 20 73 + 22 20 74 6f 20 72 65 61 64 20 74 68 65 20 61 63 + 74 75 61 6c 20 73 74 72 69 6e 67 20 61 6e 64 20 + 69 74 73 20 6e 75 6c 6c 20 74 65 72 6d 69 6e 61 + 74 6f 72 2e 0a + + ~ " interpreter-flags @" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 0a + + ~ " ' s" entry-to-execution-token" + 20 20 27 20 73 22 20 65 6e 74 72 79 2d 74 6f 2d + 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 0a + + ~ " [ ' [ entry-to-execution-token , ]" + 20 20 5b 20 27 20 5b 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 2c 20 5d 0a + + ~ " execute" + 20 20 65 78 65 63 75 74 65 0a + + ~ " swap interpreter-flags !" + 20 20 73 77 61 70 20 69 6e 74 65 72 70 72 65 74 + 65 72 2d 66 6c 61 67 73 20 21 0a + + ~ "" + 0a + + ~ " ~ Now we have a string pointer on the stack at" + ~ " transform time. If we're in" + 20 20 7e 20 20 20 4e 6f 77 20 77 65 20 68 61 76 + 65 20 61 20 73 74 72 69 6e 67 20 70 6f 69 6e 74 + 65 72 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 20 + 61 74 20 74 72 61 6e 73 66 6f 72 6d 20 74 69 6d + 65 2e 20 49 66 20 77 65 27 72 65 20 69 6e 0a + + ~ " ~ immediate mode, that's sufficient. If we're in compile" + ~ " mode, we also" + 20 20 7e 20 69 6d 6d 65 64 69 61 74 65 20 6d 6f + 64 65 2c 20 74 68 61 74 27 73 20 73 75 66 66 69 + 63 69 65 6e 74 2e 20 49 66 20 77 65 27 72 65 20 + 69 6e 20 63 6f 6d 70 69 6c 65 20 6d 6f 64 65 2c + 20 77 65 20 61 6c 73 6f 0a + + ~ " ~ already output a litstring invocation, and the string" + ~ " is in the right" + 20 20 7e 20 61 6c 72 65 61 64 79 20 6f 75 74 70 + 75 74 20 61 20 6c 69 74 73 74 72 69 6e 67 20 69 + 6e 76 6f 63 61 74 69 6f 6e 2c 20 61 6e 64 20 74 + 68 65 20 73 74 72 69 6e 67 20 69 73 20 69 6e 20 + 74 68 65 20 72 69 67 68 74 0a + + ~ " ~ place, but "here" is pointing before it and needs to" + ~ " point after it, then" + 20 20 7e 20 70 6c 61 63 65 2c 20 62 75 74 20 22 + 68 65 72 65 22 20 69 73 20 70 6f 69 6e 74 69 6e + 67 20 62 65 66 6f 72 65 20 69 74 20 61 6e 64 20 + 6e 65 65 64 73 20 74 6f 20 70 6f 69 6e 74 20 61 + 66 74 65 72 20 69 74 2c 20 74 68 65 6e 0a + + ~ " ~ we also still need to add alignment padding. Plus, we" + ~ " need to be sure to" + 20 20 7e 20 77 65 20 61 6c 73 6f 20 73 74 69 6c + 6c 20 6e 65 65 64 20 74 6f 20 61 64 64 20 61 6c + 69 67 6e 6d 65 6e 74 20 70 61 64 64 69 6e 67 2e + 20 50 6c 75 73 2c 20 77 65 20 6e 65 65 64 20 74 + 6f 20 62 65 20 73 75 72 65 20 74 6f 0a + + ~ " ~ not leave the string pointer itself on the stack." + 20 20 7e 20 6e 6f 74 20 6c 65 61 76 65 20 74 68 + 65 20 73 74 72 69 6e 67 20 70 6f 69 6e 74 65 72 + 20 69 74 73 65 6c 66 20 6f 6e 20 74 68 65 20 73 + 74 61 63 6b 2e 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " dup stringlen 1+ + 8 packalign here !" + 20 20 20 20 64 75 70 20 73 74 72 69 6e 67 6c 65 + 6e 20 31 2b 20 2b 20 38 20 70 61 63 6b 61 6c 69 + 67 6e 20 68 65 72 65 20 21 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ ": hex-dot-string-alternate" + 3a 20 68 65 78 2d 64 6f 74 2d 73 74 72 69 6e 67 + 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ " ' hex-string-alternate entry-to-execution-token execute" + 20 20 27 20 68 65 78 2d 73 74 72 69 6e 67 2d 61 + 6c 74 65 72 6e 61 74 65 20 65 6e 74 72 79 2d 74 + 6f 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 + 6e 20 65 78 65 63 75 74 65 0a + + ~ "" + 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " ~ We look up the inner version of emitstring, too." + 20 20 20 20 7e 20 57 65 20 6c 6f 6f 6b 20 75 70 + 20 74 68 65 20 69 6e 6e 65 72 20 76 65 72 73 69 + 6f 6e 20 6f 66 20 65 6d 69 74 73 74 72 69 6e 67 + 2c 20 74 6f 6f 2e 0a + + ~ " s" emitstring" find entry-to-execution-token ," + 20 20 20 20 73 22 20 65 6d 69 74 73 74 72 69 6e + 67 22 20 66 69 6e 64 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 2c 0a + + ~ " } { emitstring } if-else" + 20 20 7d 20 7b 20 65 6d 69 74 73 74 72 69 6e 67 + 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ ": hex-create-alternate create ;" + 3a 20 68 65 78 2d 63 72 65 61 74 65 2d 61 6c 74 + 65 72 6e 61 74 65 20 63 72 65 61 74 65 20 3b 0a + + ~ "" + 0a + + ~ "~ This is a helper called from the patched version of" + ~ " "variable", described" + 7e 20 20 20 54 68 69 73 20 69 73 20 61 20 68 65 + 6c 70 65 72 20 63 61 6c 6c 65 64 20 66 72 6f 6d + 20 74 68 65 20 70 61 74 63 68 65 64 20 76 65 72 + 73 69 6f 6e 20 6f 66 20 22 76 61 72 69 61 62 6c + 65 22 2c 20 64 65 73 63 72 69 62 65 64 0a + + ~ "~ in more detail in hex-colon-alternate, below. It expects" + ~ " to be called after" + 7e 20 69 6e 20 6d 6f 72 65 20 64 65 74 61 69 6c + 20 69 6e 20 68 65 78 2d 63 6f 6c 6f 6e 2d 61 6c + 74 65 72 6e 61 74 65 2c 20 62 65 6c 6f 77 2e 20 + 49 74 20 65 78 70 65 63 74 73 20 74 6f 20 62 65 + 20 63 61 6c 6c 65 64 20 61 66 74 65 72 0a + + ~ "~ outputting the entry header for "variable", during the" + ~ " body of the" + 7e 20 6f 75 74 70 75 74 74 69 6e 67 20 74 68 65 + 20 65 6e 74 72 79 20 68 65 61 64 65 72 20 66 6f + 72 20 22 76 61 72 69 61 62 6c 65 22 2c 20 64 75 + 72 69 6e 67 20 74 68 65 20 62 6f 64 79 20 6f 66 + 20 74 68 65 0a + + ~ "~ definition, so that it can output compiled code which" + ~ " will run as part of" + 7e 20 64 65 66 69 6e 69 74 69 6f 6e 2c 20 73 6f + 20 74 68 61 74 20 69 74 20 63 61 6e 20 6f 75 74 + 70 75 74 20 63 6f 6d 70 69 6c 65 64 20 63 6f 64 + 65 20 77 68 69 63 68 20 77 69 6c 6c 20 72 75 6e + 20 61 73 20 70 61 72 74 20 6f 66 0a + + ~ "~ the transformed "variable"." + 7e 20 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 65 + 64 20 22 76 61 72 69 61 62 6c 65 22 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The helper accepts a string pointer giving a variable" + ~ " name. The code it" + 7e 20 20 20 54 68 65 20 68 65 6c 70 65 72 20 61 + 63 63 65 70 74 73 20 61 20 73 74 72 69 6e 67 20 + 70 6f 69 6e 74 65 72 20 67 69 76 69 6e 67 20 61 + 20 76 61 72 69 61 62 6c 65 20 6e 61 6d 65 2e 20 + 54 68 65 20 63 6f 64 65 20 69 74 0a + + ~ "~ produces checks the name of the variable being defined" + ~ " and, if the two names" + 7e 20 70 72 6f 64 75 63 65 73 20 63 68 65 63 6b + 73 20 74 68 65 20 6e 61 6d 65 20 6f 66 20 74 68 + 65 20 76 61 72 69 61 62 6c 65 20 62 65 69 6e 67 + 20 64 65 66 69 6e 65 64 20 61 6e 64 2c 20 69 66 + 20 74 68 65 20 74 77 6f 20 6e 61 6d 65 73 0a + + ~ "~ match, alters the resulting inner variable to point to" + ~ " the same backing" + 7e 20 6d 61 74 63 68 2c 20 61 6c 74 65 72 73 20 + 74 68 65 20 72 65 73 75 6c 74 69 6e 67 20 69 6e + 6e 65 72 20 76 61 72 69 61 62 6c 65 20 74 6f 20 + 70 6f 69 6e 74 20 74 6f 20 74 68 65 20 73 61 6d + 65 20 62 61 63 6b 69 6e 67 0a + + ~ "~ store as the outer variable of the same name." + 7e 20 73 74 6f 72 65 20 61 73 20 74 68 65 20 6f + 75 74 65 72 20 76 61 72 69 61 62 6c 65 20 6f 66 + 20 74 68 65 20 73 61 6d 65 20 6e 61 6d 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ In many ways the hex transform is the trippiest one. To" + ~ " wit, there's two" + 7e 20 20 20 49 6e 20 6d 61 6e 79 20 77 61 79 73 + 20 74 68 65 20 68 65 78 20 74 72 61 6e 73 66 6f + 72 6d 20 69 73 20 74 68 65 20 74 72 69 70 70 69 + 65 73 74 20 6f 6e 65 2e 20 54 6f 20 77 69 74 2c + 20 74 68 65 72 65 27 73 20 74 77 6f 0a + + ~ "~ layers of compilation happening here... so don't get" + ~ " confused. When the" + 7e 20 6c 61 79 65 72 73 20 6f 66 20 63 6f 6d 70 + 69 6c 61 74 69 6f 6e 20 68 61 70 70 65 6e 69 6e + 67 20 68 65 72 65 2e 2e 2e 20 73 6f 20 64 6f 6e + 27 74 20 67 65 74 20 63 6f 6e 66 75 73 65 64 2e + 20 57 68 65 6e 20 74 68 65 0a + + ~ "~ helper is called, we're compiling the inner "variable"," + ~ " but "variable"" + 7e 20 68 65 6c 70 65 72 20 69 73 20 63 61 6c 6c + 65 64 2c 20 77 65 27 72 65 20 63 6f 6d 70 69 6c + 69 6e 67 20 74 68 65 20 69 6e 6e 65 72 20 22 76 + 61 72 69 61 62 6c 65 22 2c 20 62 75 74 20 22 76 + 61 72 69 61 62 6c 65 22 0a + + ~ "~ itself is a word-defining word which also has the task of" + ~ " compilation..." + 7e 20 69 74 73 65 6c 66 20 69 73 20 61 20 77 6f + 72 64 2d 64 65 66 69 6e 69 6e 67 20 77 6f 72 64 + 20 77 68 69 63 68 20 61 6c 73 6f 20 68 61 73 20 + 74 68 65 20 74 61 73 6b 20 6f 66 20 63 6f 6d 70 + 69 6c 61 74 69 6f 6e 2e 2e 2e 0a + + ~ "~ which we're modifying." + 7e 20 77 68 69 63 68 20 77 65 27 72 65 20 6d 6f + 64 69 66 79 69 6e 67 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (name pointer --)" + 7e 20 28 6e 61 6d 65 20 70 6f 69 6e 74 65 72 20 + 2d 2d 29 0a + + ~ ": hex-variable-use-outer" + 3a 20 68 65 78 2d 76 61 72 69 61 62 6c 65 2d 75 + 73 65 2d 6f 75 74 65 72 0a + + ~ " ~ The actual payload here is that we check whether" + ~ " we're defining the" + 20 20 7e 20 20 20 54 68 65 20 61 63 74 75 61 6c + 20 70 61 79 6c 6f 61 64 20 68 65 72 65 20 69 73 + 20 74 68 61 74 20 77 65 20 63 68 65 63 6b 20 77 + 68 65 74 68 65 72 20 77 65 27 72 65 20 64 65 66 + 69 6e 69 6e 67 20 74 68 65 0a + + ~ " ~ word described by the name pointer we were given, and," + ~ " if so, we make it" + 20 20 7e 20 77 6f 72 64 20 64 65 73 63 72 69 62 + 65 64 20 62 79 20 74 68 65 20 6e 61 6d 65 20 70 + 6f 69 6e 74 65 72 20 77 65 20 77 65 72 65 20 67 + 69 76 65 6e 2c 20 61 6e 64 2c 20 69 66 20 73 6f + 2c 20 77 65 20 6d 61 6b 65 20 69 74 0a + + ~ " ~ reference the outer backing store instead of the inner" + ~ " one." + 20 20 7e 20 72 65 66 65 72 65 6e 63 65 20 74 68 + 65 20 6f 75 74 65 72 20 62 61 63 6b 69 6e 67 20 + 73 74 6f 72 65 20 69 6e 73 74 65 61 64 20 6f 66 + 20 74 68 65 20 69 6e 6e 65 72 20 6f 6e 65 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ We want to do this all as references to inner words," + ~ " which fortunately" + 20 20 7e 20 20 20 57 65 20 77 61 6e 74 20 74 6f + 20 64 6f 20 74 68 69 73 20 61 6c 6c 20 61 73 20 + 72 65 66 65 72 65 6e 63 65 73 20 74 6f 20 69 6e + 6e 65 72 20 77 6f 72 64 73 2c 20 77 68 69 63 68 + 20 66 6f 72 74 75 6e 61 74 65 6c 79 0a + + ~ " ~ have been defined by now, but we have to do that a bit" + ~ " indirectly..." + 20 20 7e 20 68 61 76 65 20 62 65 65 6e 20 64 65 + 66 69 6e 65 64 20 62 79 20 6e 6f 77 2c 20 62 75 + 74 20 77 65 20 68 61 76 65 20 74 6f 20 64 6f 20 + 74 68 61 74 20 61 20 62 69 74 20 69 6e 64 69 72 + 65 63 74 6c 79 2e 2e 2e 0a + + ~ " s" dup" find entry-to-execution-token ," + 20 20 73 22 20 64 75 70 22 20 66 69 6e 64 20 65 + 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 69 6f + 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" litstring" find entry-to-execution-token ," + 20 20 73 22 20 6c 69 74 73 74 72 69 6e 67 22 20 + 66 69 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 + 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " here @ over packstring 8 packalign here !" + 20 20 68 65 72 65 20 40 20 6f 76 65 72 20 70 61 + 63 6b 73 74 72 69 6e 67 20 38 20 70 61 63 6b 61 + 6c 69 67 6e 20 68 65 72 65 20 21 0a + + ~ " s" stringcmp" find entry-to-execution-token ," + 20 20 73 22 20 73 74 72 69 6e 67 63 6d 70 22 20 + 66 69 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 + 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" lit" find entry-to-execution-token , 0 ," + 20 20 73 22 20 6c 69 74 22 20 66 69 6e 64 20 65 + 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 69 6f + 6e 2d 74 6f 6b 65 6e 20 2c 20 30 20 2c 0a + + ~ " s" =" find entry-to-execution-token ," + 20 20 73 22 20 3d 22 20 66 69 6e 64 20 65 6e 74 + 72 79 2d 74 6f 2d 65 78 65 63 75 74 69 6f 6e 2d + 74 6f 6b 65 6e 20 2c 0a + + ~ "" + 0a + + ~ " ~ Also, we don't have high-level flow control yet, and" + ~ " even if we did," + 20 20 7e 20 20 20 41 6c 73 6f 2c 20 77 65 20 64 + 6f 6e 27 74 20 68 61 76 65 20 68 69 67 68 2d 6c + 65 76 65 6c 20 66 6c 6f 77 20 63 6f 6e 74 72 6f + 6c 20 79 65 74 2c 20 61 6e 64 20 65 76 65 6e 20 + 69 66 20 77 65 20 64 69 64 2c 0a + + ~ " ~ it would be awkward to use it here. So we count the" + ~ " branch by hand. Ah" + 20 20 7e 20 69 74 20 77 6f 75 6c 64 20 62 65 20 + 61 77 6b 77 61 72 64 20 74 6f 20 75 73 65 20 69 + 74 20 68 65 72 65 2e 20 53 6f 20 77 65 20 63 6f + 75 6e 74 20 74 68 65 20 62 72 61 6e 63 68 20 62 + 79 20 68 61 6e 64 2e 20 41 68 0a + + ~ " ~ well. As always, remember that with forward branches," + ~ " the offset to" + 20 20 7e 20 77 65 6c 6c 2e 20 41 73 20 61 6c 77 + 61 79 73 2c 20 72 65 6d 65 6d 62 65 72 20 74 68 + 61 74 20 77 69 74 68 20 66 6f 72 77 61 72 64 20 + 62 72 61 6e 63 68 65 73 2c 20 74 68 65 20 6f 66 + 66 73 65 74 20 74 6f 0a + + ~ " ~ branch by is the first word to be skipped, and is" + ~ " included in the count." + 20 20 7e 20 62 72 61 6e 63 68 20 62 79 20 69 73 + 20 74 68 65 20 66 69 72 73 74 20 77 6f 72 64 20 + 74 6f 20 62 65 20 73 6b 69 70 70 65 64 2c 20 61 + 6e 64 20 69 73 20 69 6e 63 6c 75 64 65 64 20 69 + 6e 20 74 68 65 20 63 6f 75 6e 74 2e 0a + + ~ " s" 0branch" find entry-to-execution-token , 6 8 * ," + 20 20 73 22 20 30 62 72 61 6e 63 68 22 20 66 69 + 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 + 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 20 36 20 + 38 20 2a 20 2c 0a + + ~ "" + 0a + + ~ " ~ If control reaches here in the generated code, the" + ~ " string matched." + 20 20 7e 20 49 66 20 63 6f 6e 74 72 6f 6c 20 72 + 65 61 63 68 65 73 20 68 65 72 65 20 69 6e 20 74 + 68 65 20 67 65 6e 65 72 61 74 65 64 20 63 6f 64 + 65 2c 20 74 68 65 20 73 74 72 69 6e 67 20 6d 61 + 74 63 68 65 64 2e 0a + + ~ " s" swap" find entry-to-execution-token ," + 20 20 73 22 20 73 77 61 70 22 20 66 69 6e 64 20 + 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 69 + 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" drop" find entry-to-execution-token ," + 20 20 73 22 20 64 72 6f 70 22 20 66 69 6e 64 20 + 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 69 + 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ "" + 0a + + ~ " ~ To get the value of the outer variable, we just call" + ~ " it. Of course," + 20 20 7e 20 20 20 54 6f 20 67 65 74 20 74 68 65 + 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 6f 75 + 74 65 72 20 76 61 72 69 61 62 6c 65 2c 20 77 65 + 20 6a 75 73 74 20 63 61 6c 6c 20 69 74 2e 20 4f + 66 20 63 6f 75 72 73 65 2c 0a + + ~ " ~ looking up an outer entry is a pain, but at least it's" + ~ " a pain in a way" + 20 20 7e 20 6c 6f 6f 6b 69 6e 67 20 75 70 20 61 + 6e 20 6f 75 74 65 72 20 65 6e 74 72 79 20 69 73 + 20 61 20 70 61 69 6e 2c 20 62 75 74 20 61 74 20 + 6c 65 61 73 74 20 69 74 27 73 20 61 20 70 61 69 + 6e 20 69 6e 20 61 20 77 61 79 0a + + ~ " ~ that should be familiar by now." + 20 20 7e 20 74 68 61 74 20 73 68 6f 75 6c 64 20 + 62 65 20 66 61 6d 69 6c 69 61 72 20 62 79 20 6e + 6f 77 2e 0a + + ~ " s" lit" find entry-to-execution-token ," + 20 20 73 22 20 6c 69 74 22 20 66 69 6e 64 20 65 + 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 69 6f + 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " find" + 20 20 66 69 6e 64 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " entry-to-execution-token execute ," + 20 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 63 75 + 74 65 20 2c 0a + + ~ "" + 0a + + ~ " s" swap" find entry-to-execution-token , ;" + 20 20 73 22 20 73 77 61 70 22 20 66 69 6e 64 20 + 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 69 + 6f 6e 2d 74 6f 6b 65 6e 20 2c 20 3b 0a + + ~ "" + 0a + + ~ "~ Metadata entries are post-processed before they're" + ~ " output, in order to" + 7e 20 20 20 4d 65 74 61 64 61 74 61 20 65 6e 74 + 72 69 65 73 20 61 72 65 20 70 6f 73 74 2d 70 72 + 6f 63 65 73 73 65 64 20 62 65 66 6f 72 65 20 74 + 68 65 79 27 72 65 20 6f 75 74 70 75 74 2c 20 69 + 6e 20 6f 72 64 65 72 20 74 6f 0a + + ~ "~ make the structure of the output code simpler. The" + ~ " post-processing won't" + 7e 20 6d 61 6b 65 20 74 68 65 20 73 74 72 75 63 + 74 75 72 65 20 6f 66 20 74 68 65 20 6f 75 74 70 + 75 74 20 63 6f 64 65 20 73 69 6d 70 6c 65 72 2e + 20 54 68 65 20 70 6f 73 74 2d 70 72 6f 63 65 73 + 73 69 6e 67 20 77 6f 6e 27 74 0a + + ~ "~ happen until output actually occurs, which is important" + ~ " for operations that" + 7e 20 68 61 70 70 65 6e 20 75 6e 74 69 6c 20 6f + 75 74 70 75 74 20 61 63 74 75 61 6c 6c 79 20 6f + 63 63 75 72 73 2c 20 77 68 69 63 68 20 69 73 20 + 69 6d 70 6f 72 74 61 6e 74 20 66 6f 72 20 6f 70 + 65 72 61 74 69 6f 6e 73 20 74 68 61 74 0a + + ~ "~ modify entries in-place." + 7e 20 6d 6f 64 69 66 79 20 65 6e 74 72 69 65 73 + 20 69 6e 2d 70 6c 61 63 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Any time output is performed, all existing entries are" + ~ " post-processed." + 7e 20 20 20 41 6e 79 20 74 69 6d 65 20 6f 75 74 + 70 75 74 20 69 73 20 70 65 72 66 6f 72 6d 65 64 + 2c 20 61 6c 6c 20 65 78 69 73 74 69 6e 67 20 65 + 6e 74 72 69 65 73 20 61 72 65 20 70 6f 73 74 2d + 70 72 6f 63 65 73 73 65 64 2e 0a + + ~ "~ Therefore, the post-processing is required to be" + ~ " idempotent, and is." + 7e 20 54 68 65 72 65 66 6f 72 65 2c 20 74 68 65 + 20 70 6f 73 74 2d 70 72 6f 63 65 73 73 69 6e 67 + 20 69 73 20 72 65 71 75 69 72 65 64 20 74 6f 20 + 62 65 20 69 64 65 6d 70 6f 74 65 6e 74 2c 20 61 + 6e 64 20 69 73 2e 0a + + ~ ": postprocess-metadata-entries" + 3a 20 70 6f 73 74 70 72 6f 63 65 73 73 2d 6d 65 + 74 61 64 61 74 61 2d 65 6e 74 72 69 65 73 0a + + ~ " 1 { } {" + 20 20 31 20 7b 20 7d 20 7b 0a + + ~ " 0" + 20 20 20 20 30 0a + + ~ " ~ (did anything this iteration)" + 20 20 20 20 7e 20 28 64 69 64 20 61 6e 79 74 68 + 69 6e 67 20 74 68 69 73 20 69 74 65 72 61 74 69 + 6f 6e 29 0a + + ~ "" + 0a + + ~ " transformation-state" + ~ " transformation-state-output-metadata @" + 20 20 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 + 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 + 74 70 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-first-entry" + 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 66 69 72 73 74 2d 65 6e + 74 72 79 0a + + ~ " { dup @ } {" + 20 20 20 20 7b 20 64 75 70 20 40 20 7d 20 7b 0a + + ~ " ~ (did anything, entry pointer)" + 20 20 20 20 20 20 7e 20 28 64 69 64 20 61 6e 79 + 74 68 69 6e 67 2c 20 65 6e 74 72 79 20 70 6f 69 + 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " ~ Is the entry a suffix comment with a non-zero data" + ~ " length?" + 20 20 20 20 20 20 7e 20 49 73 20 74 68 65 20 65 + 6e 74 72 79 20 61 20 73 75 66 66 69 78 20 63 6f + 6d 6d 65 6e 74 20 77 69 74 68 20 61 20 6e 6f 6e + 2d 7a 65 72 6f 20 64 61 74 61 20 6c 65 6e 67 74 + 68 3f 0a + + ~ " dup hex-output-metadata-entry-type @" + 20 20 20 20 20 20 64 75 70 20 68 65 78 2d 6f 75 + 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e + 74 72 79 2d 74 79 70 65 20 40 0a + + ~ " hex-output-metadata-entry-type-suffix-comment =" + 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 74 79 70 65 2d 73 75 66 66 69 78 2d 63 6f 6d 6d + 65 6e 74 20 3d 0a + + ~ " over hex-output-metadata-entry-data-length @ 0 != &&" + ~ " {" + 20 20 20 20 20 20 6f 76 65 72 20 68 65 78 2d 6f + 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 + 6e 74 72 79 2d 64 61 74 61 2d 6c 65 6e 67 74 68 + 20 40 20 30 20 21 3d 20 26 26 20 7b 0a + + ~ " ~ Split it into two entries so as not to rely on" + ~ " data length for" + 20 20 20 20 20 20 20 20 7e 20 20 20 53 70 6c 69 + 74 20 69 74 20 69 6e 74 6f 20 74 77 6f 20 65 6e + 74 72 69 65 73 20 73 6f 20 61 73 20 6e 6f 74 20 + 74 6f 20 72 65 6c 79 20 6f 6e 20 64 61 74 61 20 + 6c 65 6e 67 74 68 20 66 6f 72 0a + + ~ " ~ formatting." + 20 20 20 20 20 20 20 20 7e 20 66 6f 72 6d 61 74 + 74 69 6e 67 2e 0a + + ~ " dup dup-metadata-entry" + 20 20 20 20 20 20 20 20 64 75 70 20 64 75 70 2d + 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ " ~ (did anything, entry pointer)" + 20 20 20 20 20 20 20 20 7e 20 28 64 69 64 20 61 + 6e 79 74 68 69 6e 67 2c 20 65 6e 74 72 79 20 70 + 6f 69 6e 74 65 72 29 0a + + ~ " ~ Now we have the original entry at the original" + ~ " location, and a" + 20 20 20 20 20 20 20 20 7e 20 20 20 4e 6f 77 20 + 77 65 20 68 61 76 65 20 74 68 65 20 6f 72 69 67 + 69 6e 61 6c 20 65 6e 74 72 79 20 61 74 20 74 68 + 65 20 6f 72 69 67 69 6e 61 6c 20 6c 6f 63 61 74 + 69 6f 6e 2c 20 61 6e 64 20 61 0a + + ~ " ~ copy of it at the next location." + 20 20 20 20 20 20 20 20 7e 20 63 6f 70 79 20 6f + 66 20 69 74 20 61 74 20 74 68 65 20 6e 65 78 74 + 20 6c 6f 63 61 74 69 6f 6e 2e 0a + + ~ "" + 0a + + ~ " ~ We have a feature which lets a suffix comment" + ~ " be created with a" + 20 20 20 20 20 20 20 20 7e 20 20 20 57 65 20 68 + 61 76 65 20 61 20 66 65 61 74 75 72 65 20 77 68 + 69 63 68 20 6c 65 74 73 20 61 20 73 75 66 66 69 + 78 20 63 6f 6d 6d 65 6e 74 20 62 65 20 63 72 65 + 61 74 65 64 20 77 69 74 68 20 61 0a + + ~ " ~ negative length, which means it covers bytes" + ~ " before the current output" + 20 20 20 20 20 20 20 20 7e 20 6e 65 67 61 74 69 + 76 65 20 6c 65 6e 67 74 68 2c 20 77 68 69 63 68 + 20 6d 65 61 6e 73 20 69 74 20 63 6f 76 65 72 73 + 20 62 79 74 65 73 20 62 65 66 6f 72 65 20 74 68 + 65 20 63 75 72 72 65 6e 74 20 6f 75 74 70 75 74 + + ~ "" + 0a + + ~ " ~ point rather than after it. This logic here is" + ~ " the implementation of" + 20 20 20 20 20 20 20 20 7e 20 70 6f 69 6e 74 20 + 72 61 74 68 65 72 20 74 68 61 6e 20 61 66 74 65 + 72 20 69 74 2e 20 54 68 69 73 20 6c 6f 67 69 63 + 20 68 65 72 65 20 69 73 20 74 68 65 20 69 6d 70 + 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 6f 66 0a + + ~ " ~ that feature." + 20 20 20 20 20 20 20 20 7e 20 74 68 61 74 20 66 + 65 61 74 75 72 65 2e 0a + + ~ " dup hex-output-metadata-entry-data-start @ dup" + 20 20 20 20 20 20 20 20 64 75 70 20 68 65 78 2d + 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 79 2d 64 61 74 61 2d 73 74 61 72 74 + 20 40 20 64 75 70 0a + + ~ " 2 pick hex-output-metadata-entry-data-length @ +" + 20 20 20 20 20 20 20 20 32 20 70 69 63 6b 20 68 + 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 + 74 61 2d 65 6e 74 72 79 2d 64 61 74 61 2d 6c 65 + 6e 67 74 68 20 40 20 2b 0a + + ~ " 2dup min 3unroll max" + 20 20 20 20 20 20 20 20 32 64 75 70 20 6d 69 6e + 20 33 75 6e 72 6f 6c 6c 20 6d 61 78 0a + + ~ " ~ (..., entry pointer, low end of data, high end of" + ~ " data)" + 20 20 20 20 20 20 20 20 7e 20 28 2e 2e 2e 2c 20 + 65 6e 74 72 79 20 70 6f 69 6e 74 65 72 2c 20 6c + 6f 77 20 65 6e 64 20 6f 66 20 64 61 74 61 2c 20 + 68 69 67 68 20 65 6e 64 20 6f 66 20 64 61 74 61 + 29 0a + + ~ "" + 0a + + ~ " ~ Now we modify the original in-place to turn it" + ~ " into a fresh-line" + 20 20 20 20 20 20 20 20 7e 20 20 20 4e 6f 77 20 + 77 65 20 6d 6f 64 69 66 79 20 74 68 65 20 6f 72 + 69 67 69 6e 61 6c 20 69 6e 2d 70 6c 61 63 65 20 + 74 6f 20 74 75 72 6e 20 69 74 20 69 6e 74 6f 20 + 61 20 66 72 65 73 68 2d 6c 69 6e 65 0a + + ~ " ~ entry at the low end of the data..." + 20 20 20 20 20 20 20 20 7e 20 65 6e 74 72 79 20 + 61 74 20 74 68 65 20 6c 6f 77 20 65 6e 64 20 6f + 66 20 74 68 65 20 64 61 74 61 2e 2e 2e 0a + + ~ " 2 pick hex-output-metadata-entry-type" + 20 20 20 20 20 20 20 20 32 20 70 69 63 6b 20 68 + 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 + 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 0a + + ~ " hex-output-metadata-entry-type-fresh-line swap !" + 20 20 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 74 79 70 65 2d 66 72 65 73 68 2d 6c 69 6e + 65 20 73 77 61 70 20 21 0a + + ~ " ~ (..., entry pointer, low end of data, high end of" + ~ " data)" + 20 20 20 20 20 20 20 20 7e 20 28 2e 2e 2e 2c 20 + 65 6e 74 72 79 20 70 6f 69 6e 74 65 72 2c 20 6c + 6f 77 20 65 6e 64 20 6f 66 20 64 61 74 61 2c 20 + 68 69 67 68 20 65 6e 64 20 6f 66 20 64 61 74 61 + 29 0a + + ~ "" + 0a + + ~ " 2 pick hex-output-metadata-entry-data-start 3roll" + ~ " swap !" + 20 20 20 20 20 20 20 20 32 20 70 69 63 6b 20 68 + 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 + 74 61 2d 65 6e 74 72 79 2d 64 61 74 61 2d 73 74 + 61 72 74 20 33 72 6f 6c 6c 20 73 77 61 70 20 21 + 0a + + ~ " ~ (..., entry pointer, high end of data)" + 20 20 20 20 20 20 20 20 7e 20 28 2e 2e 2e 2c 20 + 65 6e 74 72 79 20 70 6f 69 6e 74 65 72 2c 20 68 + 69 67 68 20 65 6e 64 20 6f 66 20 64 61 74 61 29 + 0a + + ~ " over hex-output-metadata-entry-data-length 0 swap" + ~ " !" + 20 20 20 20 20 20 20 20 6f 76 65 72 20 68 65 78 + 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 + 2d 65 6e 74 72 79 2d 64 61 74 61 2d 6c 65 6e 67 + 74 68 20 30 20 73 77 61 70 20 21 0a + + ~ " ~ (..., entry pointer, high end of data)" + 20 20 20 20 20 20 20 20 7e 20 28 2e 2e 2e 2c 20 + 65 6e 74 72 79 20 70 6f 69 6e 74 65 72 2c 20 68 + 69 67 68 20 65 6e 64 20 6f 66 20 64 61 74 61 29 + 0a + + ~ "" + 0a + + ~ " ~ ... then we modify the next entry in-place to" + ~ " set its location to" + 20 20 20 20 20 20 20 20 7e 20 20 20 2e 2e 2e 20 + 74 68 65 6e 20 77 65 20 6d 6f 64 69 66 79 20 74 + 68 65 20 6e 65 78 74 20 65 6e 74 72 79 20 69 6e + 2d 70 6c 61 63 65 20 74 6f 20 73 65 74 20 69 74 + 73 20 6c 6f 63 61 74 69 6f 6e 20 74 6f 0a + + ~ " ~ the end of the data instead of the beginning, and" + ~ " its length to zero." + 20 20 20 20 20 20 20 20 7e 20 74 68 65 20 65 6e + 64 20 6f 66 20 74 68 65 20 64 61 74 61 20 69 6e + 73 74 65 61 64 20 6f 66 20 74 68 65 20 62 65 67 + 69 6e 6e 69 6e 67 2c 20 61 6e 64 20 69 74 73 20 + 6c 65 6e 67 74 68 20 74 6f 20 7a 65 72 6f 2e 0a + + ~ " over hex-output-metadata-next-entry" + 20 20 20 20 20 20 20 20 6f 76 65 72 20 68 65 78 + 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 + 2d 6e 65 78 74 2d 65 6e 74 72 79 0a + + ~ " ~ (..., entry pointer, high end of data, next entry" + ~ " pointer)" + 20 20 20 20 20 20 20 20 7e 20 28 2e 2e 2e 2c 20 + 65 6e 74 72 79 20 70 6f 69 6e 74 65 72 2c 20 68 + 69 67 68 20 65 6e 64 20 6f 66 20 64 61 74 61 2c + 20 6e 65 78 74 20 65 6e 74 72 79 20 70 6f 69 6e + 74 65 72 29 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-data-start 3roll swap" + ~ " !" + 20 20 20 20 20 20 20 20 64 75 70 20 68 65 78 2d + 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 79 2d 64 61 74 61 2d 73 74 61 72 74 + 20 33 72 6f 6c 6c 20 73 77 61 70 20 21 0a + + ~ " ~ (..., entry pointer, next entry pointer)" + 20 20 20 20 20 20 20 20 7e 20 28 2e 2e 2e 2c 20 + 65 6e 74 72 79 20 70 6f 69 6e 74 65 72 2c 20 6e + 65 78 74 20 65 6e 74 72 79 20 70 6f 69 6e 74 65 + 72 29 0a + + ~ " hex-output-metadata-entry-data-length 0 swap !" + 20 20 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 64 61 74 61 2d 6c 65 6e 67 74 68 20 30 20 + 73 77 61 70 20 21 0a + + ~ " ~ (..., entry pointer)" + 20 20 20 20 20 20 20 20 7e 20 28 2e 2e 2e 2c 20 + 65 6e 74 72 79 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " ~ This rule won't fire again on the fresh-line" + ~ " entry because it's of a" + 20 20 20 20 20 20 20 20 7e 20 20 20 54 68 69 73 + 20 72 75 6c 65 20 77 6f 6e 27 74 20 66 69 72 65 + 20 61 67 61 69 6e 20 6f 6e 20 74 68 65 20 66 72 + 65 73 68 2d 6c 69 6e 65 20 65 6e 74 72 79 20 62 + 65 63 61 75 73 65 20 69 74 27 73 20 6f 66 20 61 + + ~ "" + 0a + + ~ " ~ a different type, and it won't fire on the" + ~ " modified suffix-comment" + 20 20 20 20 20 20 20 20 7e 20 61 20 64 69 66 66 + 65 72 65 6e 74 20 74 79 70 65 2c 20 61 6e 64 20 + 69 74 20 77 6f 6e 27 74 20 66 69 72 65 20 6f 6e + 20 74 68 65 20 6d 6f 64 69 66 69 65 64 20 73 75 + 66 66 69 78 2d 63 6f 6d 6d 65 6e 74 0a + + ~ " ~ entry because its data length is zero." + 20 20 20 20 20 20 20 20 7e 20 65 6e 74 72 79 20 + 62 65 63 61 75 73 65 20 69 74 73 20 64 61 74 61 + 20 6c 65 6e 67 74 68 20 69 73 20 7a 65 72 6f 2e + 0a + + ~ " ~" + 20 20 20 20 20 20 20 20 7e 0a + + ~ " ~ It's possible that one or the other of the" + ~ " bubble-sort rules will" + 20 20 20 20 20 20 20 20 7e 20 20 20 49 74 27 73 + 20 70 6f 73 73 69 62 6c 65 20 74 68 61 74 20 6f + 6e 65 20 6f 72 20 74 68 65 20 6f 74 68 65 72 20 + 6f 66 20 74 68 65 20 62 75 62 62 6c 65 2d 73 6f + 72 74 20 72 75 6c 65 73 20 77 69 6c 6c 0a + + ~ " ~ fire on either of them." + 20 20 20 20 20 20 20 20 7e 20 66 69 72 65 20 6f + 6e 20 65 69 74 68 65 72 20 6f 66 20 74 68 65 6d + 2e 0a + + ~ "" + 0a + + ~ " ~ (did anything, entry pointer)" + 20 20 20 20 20 20 20 20 7e 20 28 64 69 64 20 61 + 6e 79 74 68 69 6e 67 2c 20 65 6e 74 72 79 20 70 + 6f 69 6e 74 65 72 29 0a + + ~ " swap drop 1 swap" + 20 20 20 20 20 20 20 20 73 77 61 70 20 64 72 6f + 70 20 31 20 73 77 61 70 0a + + ~ " } if" + 20 20 20 20 20 20 7d 20 69 66 0a + + ~ " ~ (did anything, entry pointer)" + 20 20 20 20 20 20 7e 20 28 64 69 64 20 61 6e 79 + 74 68 69 6e 67 2c 20 65 6e 74 72 79 20 70 6f 69 + 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " ~ Do this entry and the next entry both exist, and" + ~ " they're out of" + 20 20 20 20 20 20 7e 20 20 20 44 6f 20 74 68 69 + 73 20 65 6e 74 72 79 20 61 6e 64 20 74 68 65 20 + 6e 65 78 74 20 65 6e 74 72 79 20 62 6f 74 68 20 + 65 78 69 73 74 2c 20 61 6e 64 20 74 68 65 79 27 + 72 65 20 6f 75 74 20 6f 66 0a + + ~ " ~ order based on their data starts?" + 20 20 20 20 20 20 7e 20 6f 72 64 65 72 20 62 61 + 73 65 64 20 6f 6e 20 74 68 65 69 72 20 64 61 74 + 61 20 73 74 61 72 74 73 3f 0a + + ~ " dup hex-output-metadata-next-entry dup @" + 20 20 20 20 20 20 64 75 70 20 68 65 78 2d 6f 75 + 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 6e 65 + 78 74 2d 65 6e 74 72 79 20 64 75 70 20 40 0a + + ~ " { hex-output-metadata-entry-data-start @" + 20 20 20 20 20 20 20 20 7b 20 68 65 78 2d 6f 75 + 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e + 74 72 79 2d 64 61 74 61 2d 73 74 61 72 74 20 40 + 0a + + ~ " over hex-output-metadata-entry-data-start @ > }" + 20 20 20 20 20 20 20 20 20 20 6f 76 65 72 20 68 + 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 + 74 61 2d 65 6e 74 72 79 2d 64 61 74 61 2d 73 74 + 61 72 74 20 40 20 3e 20 7d 0a + + ~ " { drop 0 } if-else" + 20 20 20 20 20 20 20 20 7b 20 64 72 6f 70 20 30 + 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " {" + 20 20 20 20 20 20 7b 0a + + ~ " ~ Swap the order of the two entries. Since this" + ~ " whole thing is in a" + 20 20 20 20 20 20 20 20 7e 20 20 20 53 77 61 70 + 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 74 68 + 65 20 74 77 6f 20 65 6e 74 72 69 65 73 2e 20 53 + 69 6e 63 65 20 74 68 69 73 20 77 68 6f 6c 65 20 + 74 68 69 6e 67 20 69 73 20 69 6e 20 61 0a + + ~ " ~ loop, this functions as a bubble sort." + 20 20 20 20 20 20 20 20 7e 20 6c 6f 6f 70 2c 20 + 74 68 69 73 20 66 75 6e 63 74 69 6f 6e 73 20 61 + 73 20 61 20 62 75 62 62 6c 65 20 73 6f 72 74 2e + 0a + + ~ " dup swap-metadata-entries" + 20 20 20 20 20 20 20 20 64 75 70 20 73 77 61 70 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 69 65 + 73 0a + + ~ " swap drop 1 swap" + 20 20 20 20 20 20 20 20 73 77 61 70 20 64 72 6f + 70 20 31 20 73 77 61 70 0a + + ~ "" + 0a + + ~ " ~ This rule won't fire again on the same pair of" + ~ " entries because now" + 20 20 20 20 20 20 20 20 7e 20 20 20 54 68 69 73 + 20 72 75 6c 65 20 77 6f 6e 27 74 20 66 69 72 65 + 20 61 67 61 69 6e 20 6f 6e 20 74 68 65 20 73 61 + 6d 65 20 70 61 69 72 20 6f 66 20 65 6e 74 72 69 + 65 73 20 62 65 63 61 75 73 65 20 6e 6f 77 0a + + ~ " ~ they're in the correct order. It may fire again" + ~ " next iteration," + 20 20 20 20 20 20 20 20 7e 20 74 68 65 79 27 72 + 65 20 69 6e 20 74 68 65 20 63 6f 72 72 65 63 74 + 20 6f 72 64 65 72 2e 20 49 74 20 6d 61 79 20 66 + 69 72 65 20 61 67 61 69 6e 20 6e 65 78 74 20 69 + 74 65 72 61 74 69 6f 6e 2c 0a + + ~ " ~ but only until everything is sorted." + 20 20 20 20 20 20 20 20 7e 20 62 75 74 20 6f 6e + 6c 79 20 75 6e 74 69 6c 20 65 76 65 72 79 74 68 + 69 6e 67 20 69 73 20 73 6f 72 74 65 64 2e 0a + + ~ " ~" + 20 20 20 20 20 20 20 20 7e 0a + + ~ " ~ This rule does nothing to alter whether the" + ~ " suffix-comment rule" + 20 20 20 20 20 20 20 20 7e 20 20 20 54 68 69 73 + 20 72 75 6c 65 20 64 6f 65 73 20 6e 6f 74 68 69 + 6e 67 20 74 6f 20 61 6c 74 65 72 20 77 68 65 74 + 68 65 72 20 74 68 65 20 73 75 66 66 69 78 2d 63 + 6f 6d 6d 65 6e 74 20 72 75 6c 65 0a + + ~ " ~ will fire on either of the entries it swapped, so" + ~ " there's no" + 20 20 20 20 20 20 20 20 7e 20 77 69 6c 6c 20 66 + 69 72 65 20 6f 6e 20 65 69 74 68 65 72 20 6f 66 + 20 74 68 65 20 65 6e 74 72 69 65 73 20 69 74 20 + 73 77 61 70 70 65 64 2c 20 73 6f 20 74 68 65 72 + 65 27 73 20 6e 6f 0a + + ~ " ~ possibility of an infinite loop through that" + ~ " one." + 20 20 20 20 20 20 20 20 7e 20 70 6f 73 73 69 62 + 69 6c 69 74 79 20 6f 66 20 61 6e 20 69 6e 66 69 + 6e 69 74 65 20 6c 6f 6f 70 20 74 68 72 6f 75 67 + 68 20 74 68 61 74 20 6f 6e 65 2e 0a + + ~ " } if" + 20 20 20 20 20 20 7d 20 69 66 0a + + ~ " ~ (did anything, entry pointer)" + 20 20 20 20 20 20 7e 20 28 64 69 64 20 61 6e 79 + 74 68 69 6e 67 2c 20 65 6e 74 72 79 20 70 6f 69 + 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " ~ Do this entry and the next entry both exist, and" + ~ " they have the same" + 20 20 20 20 20 20 7e 20 20 20 44 6f 20 74 68 69 + 73 20 65 6e 74 72 79 20 61 6e 64 20 74 68 65 20 + 6e 65 78 74 20 65 6e 74 72 79 20 62 6f 74 68 20 + 65 78 69 73 74 2c 20 61 6e 64 20 74 68 65 79 20 + 68 61 76 65 20 74 68 65 20 73 61 6d 65 0a + + ~ " ~ data start, and this one is a comment entry, and" + ~ " the next one is a" + 20 20 20 20 20 20 7e 20 64 61 74 61 20 73 74 61 + 72 74 2c 20 61 6e 64 20 74 68 69 73 20 6f 6e 65 + 20 69 73 20 61 20 63 6f 6d 6d 65 6e 74 20 65 6e + 74 72 79 2c 20 61 6e 64 20 74 68 65 20 6e 65 78 + 74 20 6f 6e 65 20 69 73 20 61 0a + + ~ " ~ stack-manipulation entry with zero length?" + 20 20 20 20 20 20 7e 20 73 74 61 63 6b 2d 6d 61 + 6e 69 70 75 6c 61 74 69 6f 6e 20 65 6e 74 72 79 + 20 77 69 74 68 20 7a 65 72 6f 20 6c 65 6e 67 74 + 68 3f 0a + + ~ " dup is-comment-entry over" + ~ " hex-output-metadata-next-entry @ &&" + 20 20 20 20 20 20 64 75 70 20 69 73 2d 63 6f 6d + 6d 65 6e 74 2d 65 6e 74 72 79 20 6f 76 65 72 20 + 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 + 61 74 61 2d 6e 65 78 74 2d 65 6e 74 72 79 20 40 + 20 26 26 0a + + ~ " { ~ (did anything, entry pointer)" + 20 20 20 20 20 20 20 20 7b 20 7e 20 28 64 69 64 + 20 61 6e 79 74 68 69 6e 67 2c 20 65 6e 74 72 79 + 20 70 6f 69 6e 74 65 72 29 0a + + ~ " dup hex-output-metadata-next-entry" + 20 20 20 20 20 20 20 20 20 20 64 75 70 20 68 65 + 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 + 61 2d 6e 65 78 74 2d 65 6e 74 72 79 0a + + ~ " over hex-output-metadata-entry-data-start @" + 20 20 20 20 20 20 20 20 20 20 6f 76 65 72 20 68 + 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 + 74 61 2d 65 6e 74 72 79 2d 64 61 74 61 2d 73 74 + 61 72 74 20 40 0a + + ~ " over hex-output-metadata-entry-data-start @ =" + 20 20 20 20 20 20 20 20 20 20 6f 76 65 72 20 68 + 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 + 74 61 2d 65 6e 74 72 79 2d 64 61 74 61 2d 73 74 + 61 72 74 20 40 20 3d 0a + + ~ " swap dup hex-output-metadata-entry-data-length @" + ~ " 0 = 3roll && swap" + 20 20 20 20 20 20 20 20 20 20 73 77 61 70 20 64 + 75 70 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 + 74 61 64 61 74 61 2d 65 6e 74 72 79 2d 64 61 74 + 61 2d 6c 65 6e 67 74 68 20 40 20 30 20 3d 20 33 + 72 6f 6c 6c 20 26 26 20 73 77 61 70 0a + + ~ " is-subitem-stack-manipulation-entry && }" + 20 20 20 20 20 20 20 20 20 20 69 73 2d 73 75 62 + 69 74 65 6d 2d 73 74 61 63 6b 2d 6d 61 6e 69 70 + 75 6c 61 74 69 6f 6e 2d 65 6e 74 72 79 20 26 26 + 20 7d 0a + + ~ " { 0 } if-else" + 20 20 20 20 20 20 20 20 7b 20 30 20 7d 20 69 66 + 2d 65 6c 73 65 0a + + ~ " {" + 20 20 20 20 20 20 7b 0a + + ~ " ~ Swap the order of the two entries. Since this" + ~ " whole thing is in a" + 20 20 20 20 20 20 20 20 7e 20 20 20 53 77 61 70 + 20 74 68 65 20 6f 72 64 65 72 20 6f 66 20 74 68 + 65 20 74 77 6f 20 65 6e 74 72 69 65 73 2e 20 53 + 69 6e 63 65 20 74 68 69 73 20 77 68 6f 6c 65 20 + 74 68 69 6e 67 20 69 73 20 69 6e 20 61 0a + + ~ " ~ loop, this functions as a bubble sort." + 20 20 20 20 20 20 20 20 7e 20 6c 6f 6f 70 2c 20 + 74 68 69 73 20 66 75 6e 63 74 69 6f 6e 73 20 61 + 73 20 61 20 62 75 62 62 6c 65 20 73 6f 72 74 2e + 0a + + ~ " dup swap-metadata-entries" + 20 20 20 20 20 20 20 20 64 75 70 20 73 77 61 70 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 69 65 + 73 0a + + ~ " swap drop 1 swap" + 20 20 20 20 20 20 20 20 73 77 61 70 20 64 72 6f + 70 20 31 20 73 77 61 70 0a + + ~ "" + 0a + + ~ " ~ This rule can't fire in the same iteration as" + ~ " the previous swap," + 20 20 20 20 20 20 20 20 7e 20 20 20 54 68 69 73 + 20 72 75 6c 65 20 63 61 6e 27 74 20 66 69 72 65 + 20 69 6e 20 74 68 65 20 73 61 6d 65 20 69 74 65 + 72 61 74 69 6f 6e 20 61 73 20 74 68 65 20 70 72 + 65 76 69 6f 75 73 20 73 77 61 70 2c 0a + + ~ " ~ because that one doesn't fire when the starts are" + ~ " equal. It also" + 20 20 20 20 20 20 20 20 7e 20 62 65 63 61 75 73 + 65 20 74 68 61 74 20 6f 6e 65 20 64 6f 65 73 6e + 27 74 20 66 69 72 65 20 77 68 65 6e 20 74 68 65 + 20 73 74 61 72 74 73 20 61 72 65 20 65 71 75 61 + 6c 2e 20 49 74 20 61 6c 73 6f 0a + + ~ " ~ won't fire again on the same pair of entries," + ~ " again because now" + 20 20 20 20 20 20 20 20 7e 20 77 6f 6e 27 74 20 + 66 69 72 65 20 61 67 61 69 6e 20 6f 6e 20 74 68 + 65 20 73 61 6d 65 20 70 61 69 72 20 6f 66 20 65 + 6e 74 72 69 65 73 2c 20 61 67 61 69 6e 20 62 65 + 63 61 75 73 65 20 6e 6f 77 0a + + ~ " ~ they're in the correct order. If it fires again" + ~ " in the next" + 20 20 20 20 20 20 20 20 7e 20 74 68 65 79 27 72 + 65 20 69 6e 20 74 68 65 20 63 6f 72 72 65 63 74 + 20 6f 72 64 65 72 2e 20 49 66 20 69 74 20 66 69 + 72 65 73 20 61 67 61 69 6e 20 69 6e 20 74 68 65 + 20 6e 65 78 74 0a + + ~ " ~ iteration that'll only be in the usual way it" + ~ " does for a bubble" + 20 20 20 20 20 20 20 20 7e 20 69 74 65 72 61 74 + 69 6f 6e 20 74 68 61 74 27 6c 6c 20 6f 6e 6c 79 + 20 62 65 20 69 6e 20 74 68 65 20 75 73 75 61 6c + 20 77 61 79 20 69 74 20 64 6f 65 73 20 66 6f 72 + 20 61 20 62 75 62 62 6c 65 0a + + ~ " ~ sort." + 20 20 20 20 20 20 20 20 7e 20 73 6f 72 74 2e 0a + + ~ " ~" + 20 20 20 20 20 20 20 20 7e 0a + + ~ " ~ As with the other swap rule, this rule also" + ~ " does nothing to alter" + 20 20 20 20 20 20 20 20 7e 20 20 20 41 73 20 77 + 69 74 68 20 74 68 65 20 6f 74 68 65 72 20 73 77 + 61 70 20 72 75 6c 65 2c 20 74 68 69 73 20 72 75 + 6c 65 20 61 6c 73 6f 20 64 6f 65 73 20 6e 6f 74 + 68 69 6e 67 20 74 6f 20 61 6c 74 65 72 0a + + ~ " ~ whether the suffix-comment rule will fire on" + ~ " either entry it" + 20 20 20 20 20 20 20 20 7e 20 77 68 65 74 68 65 + 72 20 74 68 65 20 73 75 66 66 69 78 2d 63 6f 6d + 6d 65 6e 74 20 72 75 6c 65 20 77 69 6c 6c 20 66 + 69 72 65 20 6f 6e 20 65 69 74 68 65 72 20 65 6e + 74 72 79 20 69 74 0a + + ~ " ~ touches, so it won't loop through that one." + 20 20 20 20 20 20 20 20 7e 20 74 6f 75 63 68 65 + 73 2c 20 73 6f 20 69 74 20 77 6f 6e 27 74 20 6c + 6f 6f 70 20 74 68 72 6f 75 67 68 20 74 68 61 74 + 20 6f 6e 65 2e 0a + + ~ " } if" + 20 20 20 20 20 20 7d 20 69 66 0a + + ~ " ~ (did anything, entry pointer)" + 20 20 20 20 20 20 7e 20 28 64 69 64 20 61 6e 79 + 74 68 69 6e 67 2c 20 65 6e 74 72 79 20 70 6f 69 + 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " hex-output-metadata-next-entry" + 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 6e 65 78 74 2d 65 + 6e 74 72 79 0a + + ~ " } while drop" + 20 20 20 20 7d 20 77 68 69 6c 65 20 64 72 6f 70 + 0a + + ~ " } while ;" + 20 20 7d 20 77 68 69 6c 65 20 3b 0a + + ~ "" + 0a + + ~ ": hex-comment-first-tab-stop 36 ;" + 3a 20 68 65 78 2d 63 6f 6d 6d 65 6e 74 2d 66 69 + 72 73 74 2d 74 61 62 2d 73 74 6f 70 20 33 36 20 + 3b 0a + + ~ ": hex-comment-second-tab-stop 58 ;" + 3a 20 68 65 78 2d 63 6f 6d 6d 65 6e 74 2d 73 65 + 63 6f 6e 64 2d 74 61 62 2d 73 74 6f 70 20 35 38 + 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ (subitem entry -- subitem entry)" + 7e 20 28 73 75 62 69 74 65 6d 20 65 6e 74 72 79 + 20 2d 2d 20 73 75 62 69 74 65 6d 20 65 6e 74 72 + 79 29 0a + + ~ ": hex-emit-template-subitem" + 3a 20 68 65 78 2d 65 6d 69 74 2d 74 65 6d 70 6c + 61 74 65 2d 73 75 62 69 74 65 6d 0a + + ~ " dup hex-output-metadata-entry-type @" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 74 79 70 65 20 40 0a + + ~ " hex-output-metadata-entry-type-push-subitem-decimal = {" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 64 65 + 63 69 6d 61 6c 20 3d 20 7b 0a + + ~ " dup hex-output-metadata-entry-content @" + 20 20 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 63 6f 6e 74 65 6e 74 20 40 0a + + ~ " dup 10 swap logfloor 1+ advance-current-column" + 20 20 20 20 64 75 70 20 31 30 20 73 77 61 70 20 + 6c 6f 67 66 6c 6f 6f 72 20 31 2b 20 61 64 76 61 + 6e 63 65 2d 63 75 72 72 65 6e 74 2d 63 6f 6c 75 + 6d 6e 0a + + ~ " ." + 20 20 20 20 2e 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-type @" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 74 79 70 65 20 40 0a + + ~ " hex-output-metadata-entry-type-push-subitem-hex = {" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 68 65 + 78 20 3d 20 7b 0a + + ~ " ." 0x"" + 20 20 20 20 2e 22 20 30 78 22 0a + + ~ " dup hex-output-metadata-entry-content @" + 20 20 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 63 6f 6e 74 65 6e 74 20 40 0a + + ~ " dup 16 swap logfloor 1+ 2 + advance-current-column" + 20 20 20 20 64 75 70 20 31 36 20 73 77 61 70 20 + 6c 6f 67 66 6c 6f 6f 72 20 31 2b 20 32 20 2b 20 + 61 64 76 61 6e 63 65 2d 63 75 72 72 65 6e 74 2d + 63 6f 6c 75 6d 6e 0a + + ~ " .hex" + 20 20 20 20 2e 68 65 78 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-type @" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 74 79 70 65 20 40 0a + + ~ " hex-output-metadata-entry-type-push-subitem-hex8 = {" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 68 65 + 78 38 20 3d 20 7b 0a + + ~ " ." 0x"" + 20 20 20 20 2e 22 20 30 78 22 0a + + ~ " dup hex-output-metadata-entry-content @ .hex8" + 20 20 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 63 6f 6e 74 65 6e 74 20 40 20 2e 68 65 78 + 38 0a + + ~ " 4 advance-current-column" + 20 20 20 20 34 20 61 64 76 61 6e 63 65 2d 63 75 + 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-type @" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 74 79 70 65 20 40 0a + + ~ " hex-output-metadata-entry-type-push-subitem-hex16 = {" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 68 65 + 78 31 36 20 3d 20 7b 0a + + ~ " ." 0x"" + 20 20 20 20 2e 22 20 30 78 22 0a + + ~ " dup hex-output-metadata-entry-content @ .hex16" + 20 20 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 63 6f 6e 74 65 6e 74 20 40 20 2e 68 65 78 + 31 36 0a + + ~ " 6 advance-current-column" + 20 20 20 20 36 20 61 64 76 61 6e 63 65 2d 63 75 + 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-type @" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 74 79 70 65 20 40 0a + + ~ " hex-output-metadata-entry-type-push-subitem-hex32 = {" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 68 65 + 78 33 32 20 3d 20 7b 0a + + ~ " ." 0x"" + 20 20 20 20 2e 22 20 30 78 22 0a + + ~ " dup hex-output-metadata-entry-content @ .hex32" + 20 20 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 63 6f 6e 74 65 6e 74 20 40 20 2e 68 65 78 + 33 32 0a + + ~ " 10 advance-current-column" + 20 20 20 20 31 30 20 61 64 76 61 6e 63 65 2d 63 + 75 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-type @" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 74 79 70 65 20 40 0a + + ~ " hex-output-metadata-entry-type-push-subitem-hex64 = {" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 68 65 + 78 36 34 20 3d 20 7b 0a + + ~ " ." 0x"" + 20 20 20 20 2e 22 20 30 78 22 0a + + ~ " dup hex-output-metadata-entry-content @ .hex64" + 20 20 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 63 6f 6e 74 65 6e 74 20 40 20 2e 68 65 78 + 36 34 0a + + ~ " 18 advance-current-column" + 20 20 20 20 31 38 20 61 64 76 61 6e 63 65 2d 63 + 75 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-type @" + 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 74 79 70 65 20 40 0a + + ~ " hex-output-metadata-entry-type-push-subitem-string = {" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 73 74 + 72 69 6e 67 20 3d 20 7b 0a + + ~ " dup hex-output-metadata-entry-content @" + 20 20 20 20 64 75 70 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 63 6f 6e 74 65 6e 74 20 40 0a + + ~ " over hex-output-metadata-entry-data-length @" + 20 20 20 20 6f 76 65 72 20 68 65 78 2d 6f 75 74 + 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 + 72 79 2d 64 61 74 61 2d 6c 65 6e 67 74 68 20 40 + 0a + + ~ " ~ (subitem entry, string point, n bytes remaining)" + 20 20 20 20 7e 20 28 73 75 62 69 74 65 6d 20 65 + 6e 74 72 79 2c 20 73 74 72 69 6e 67 20 70 6f 69 + 6e 74 2c 20 6e 20 62 79 74 65 73 20 72 65 6d 61 + 69 6e 69 6e 67 29 0a + + ~ " { dup } {" + 20 20 20 20 7b 20 64 75 70 20 7d 20 7b 0a + + ~ " swap unpack8" + 20 20 20 20 20 20 73 77 61 70 20 75 6e 70 61 63 + 6b 38 0a + + ~ " value@ emitstring" + 20 20 20 20 20 20 76 61 6c 75 65 40 20 65 6d 69 + 74 73 74 72 69 6e 67 0a + + ~ " drop swap" + 20 20 20 20 20 20 64 72 6f 70 20 73 77 61 70 0a + + ~ " 1-" + 20 20 20 20 20 20 31 2d 0a + + ~ " 1 advance-current-column" + 20 20 20 20 20 20 31 20 61 64 76 61 6e 63 65 2d + 63 75 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e 0a + + ~ " } while" + 20 20 20 20 7d 20 77 68 69 6c 65 0a + + ~ " drop drop" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 0a + + ~ " } if ;" + 20 20 7d 20 69 66 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This is a helper called from hex-emit-template-string." + ~ " The word pointer" + 7e 20 20 20 54 68 69 73 20 69 73 20 61 20 68 65 + 6c 70 65 72 20 63 61 6c 6c 65 64 20 66 72 6f 6d + 20 68 65 78 2d 65 6d 69 74 2d 74 65 6d 70 6c 61 + 74 65 2d 73 74 72 69 6e 67 2e 20 54 68 65 20 77 + 6f 72 64 20 70 6f 69 6e 74 65 72 0a + + ~ "~ is in the outer log's scratch space, and must not be" + ~ " overwritten." + 7e 20 69 73 20 69 6e 20 74 68 65 20 6f 75 74 65 + 72 20 6c 6f 67 27 73 20 73 63 72 61 74 63 68 20 + 73 70 61 63 65 2c 20 61 6e 64 20 6d 75 73 74 20 + 6e 6f 74 20 62 65 20 6f 76 65 72 77 72 69 74 74 + 65 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (queued space count, word pointer -- should ignore" + ~ " space)" + 7e 20 28 71 75 65 75 65 64 20 73 70 61 63 65 20 + 63 6f 75 6e 74 2c 20 77 6f 72 64 20 70 6f 69 6e + 74 65 72 20 2d 2d 20 73 68 6f 75 6c 64 20 69 67 + 6e 6f 72 65 20 73 70 61 63 65 29 0a + + ~ ": hex-emit-template-string-word" + 3a 20 68 65 78 2d 65 6d 69 74 2d 74 65 6d 70 6c + 61 74 65 2d 73 74 72 69 6e 67 2d 77 6f 72 64 0a + + ~ " dup s" #" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 23 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " ~ (queued space count, word pointer)" + 20 20 20 20 7e 20 28 71 75 65 75 65 64 20 73 70 + 61 63 65 20 63 6f 75 6e 74 2c 20 77 6f 72 64 20 + 70 6f 69 6e 74 65 72 29 0a + + ~ " drop" + 20 20 20 20 64 72 6f 70 0a + + ~ "" + 0a + + ~ " pop-subitem-entry-stack" + 20 20 20 20 70 6f 70 2d 73 75 62 69 74 65 6d 2d + 65 6e 74 72 79 2d 73 74 61 63 6b 0a + + ~ " ~ (queued space count, subitem entry)" + 20 20 20 20 7e 20 28 71 75 65 75 65 64 20 73 70 + 61 63 65 20 63 6f 75 6e 74 2c 20 73 75 62 69 74 + 65 6d 20 65 6e 74 72 79 29 0a + + ~ "" + 0a + + ~ " ~ If we underflowed the stack, we got zero back, so" + ~ " make sure not to" + 20 20 20 20 7e 20 20 20 49 66 20 77 65 20 75 6e + 64 65 72 66 6c 6f 77 65 64 20 74 68 65 20 73 74 + 61 63 6b 2c 20 77 65 20 67 6f 74 20 7a 65 72 6f + 20 62 61 63 6b 2c 20 73 6f 20 6d 61 6b 65 20 73 + 75 72 65 20 6e 6f 74 20 74 6f 0a + + ~ " ~ crash. A crash here would be a pain to debug because" + ~ " it would be" + 20 20 20 20 7e 20 63 72 61 73 68 2e 20 41 20 63 + 72 61 73 68 20 68 65 72 65 20 77 6f 75 6c 64 20 + 62 65 20 61 20 70 61 69 6e 20 74 6f 20 64 65 62 + 75 67 20 62 65 63 61 75 73 65 20 69 74 20 77 6f + 75 6c 64 20 62 65 0a + + ~ " ~ unclear how much of the overall system is working," + ~ " and it's a" + 20 20 20 20 7e 20 75 6e 63 6c 65 61 72 20 68 6f + 77 20 6d 75 63 68 20 6f 66 20 74 68 65 20 6f 76 + 65 72 61 6c 6c 20 73 79 73 74 65 6d 20 69 73 20 + 77 6f 72 6b 69 6e 67 2c 20 61 6e 64 20 69 74 27 + 73 20 61 0a + + ~ " ~ complex system." + 20 20 20 20 7e 20 63 6f 6d 70 6c 65 78 20 73 79 + 73 74 65 6d 2e 0a + + ~ " dup {" + 20 20 20 20 64 75 70 20 7b 0a + + ~ " ~ (queued space count, subitem entry)" + 20 20 20 20 20 20 7e 20 28 71 75 65 75 65 64 20 + 73 70 61 63 65 20 63 6f 75 6e 74 2c 20 73 75 62 + 69 74 65 6d 20 65 6e 74 72 79 29 0a + + ~ " swap dup indent advance-current-column 0 swap" + 20 20 20 20 20 20 73 77 61 70 20 64 75 70 20 69 + 6e 64 65 6e 74 20 61 64 76 61 6e 63 65 2d 63 75 + 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e 20 30 20 73 + 77 61 70 0a + + ~ " ~ (adjusted queued space count, subitem entry)" + 20 20 20 20 20 20 7e 20 28 61 64 6a 75 73 74 65 + 64 20 71 75 65 75 65 64 20 73 70 61 63 65 20 63 + 6f 75 6e 74 2c 20 73 75 62 69 74 65 6d 20 65 6e + 74 72 79 29 0a + + ~ "" + 0a + + ~ " hex-emit-template-subitem" + 20 20 20 20 20 20 68 65 78 2d 65 6d 69 74 2d 74 + 65 6d 70 6c 61 74 65 2d 73 75 62 69 74 65 6d 0a + + ~ " } if" + 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " drop drop 0 exit" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 20 30 20 + 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ Same as # but with quotes around it. The notation" + ~ " uses single quotes" + 20 20 7e 20 20 20 53 61 6d 65 20 61 73 20 23 20 + 62 75 74 20 77 69 74 68 20 71 75 6f 74 65 73 20 + 61 72 6f 75 6e 64 20 69 74 2e 20 54 68 65 20 6e + 6f 74 61 74 69 6f 6e 20 75 73 65 73 20 73 69 6e + 67 6c 65 20 71 75 6f 74 65 73 0a + + ~ " ~ because that's easier to put in a string for syntax" + ~ " reasons, but the" + 20 20 7e 20 62 65 63 61 75 73 65 20 74 68 61 74 + 27 73 20 65 61 73 69 65 72 20 74 6f 20 70 75 74 + 20 69 6e 20 61 20 73 74 72 69 6e 67 20 66 6f 72 + 20 73 79 6e 74 61 78 20 72 65 61 73 6f 6e 73 2c + 20 62 75 74 20 74 68 65 0a + + ~ " ~ output uses double." + 20 20 7e 20 6f 75 74 70 75 74 20 75 73 65 73 20 + 64 6f 75 62 6c 65 2e 0a + + ~ " dup s" '#'" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 27 23 27 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " drop" + 20 20 20 20 64 72 6f 70 0a + + ~ "" + 0a + + ~ " pop-subitem-entry-stack" + 20 20 20 20 70 6f 70 2d 73 75 62 69 74 65 6d 2d + 65 6e 74 72 79 2d 73 74 61 63 6b 0a + + ~ "" + 0a + + ~ " dup {" + 20 20 20 20 64 75 70 20 7b 0a + + ~ " swap dup indent advance-current-column 0 swap" + 20 20 20 20 20 20 73 77 61 70 20 64 75 70 20 69 + 6e 64 65 6e 74 20 61 64 76 61 6e 63 65 2d 63 75 + 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e 20 30 20 73 + 77 61 70 0a + + ~ "" + 0a + + ~ " 0x22 value@ emitstring drop" + 20 20 20 20 20 20 30 78 32 32 20 76 61 6c 75 65 + 40 20 65 6d 69 74 73 74 72 69 6e 67 20 64 72 6f + 70 0a + + ~ " 1 advance-current-column" + 20 20 20 20 20 20 31 20 61 64 76 61 6e 63 65 2d + 63 75 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e 0a + + ~ "" + 0a + + ~ " hex-emit-template-subitem" + 20 20 20 20 20 20 68 65 78 2d 65 6d 69 74 2d 74 + 65 6d 70 6c 61 74 65 2d 73 75 62 69 74 65 6d 0a + + ~ "" + 0a + + ~ " 0x22 value@ emitstring drop" + 20 20 20 20 20 20 30 78 32 32 20 76 61 6c 75 65 + 40 20 65 6d 69 74 73 74 72 69 6e 67 20 64 72 6f + 70 0a + + ~ " 1 advance-current-column" + 20 20 20 20 20 20 31 20 61 64 76 61 6e 63 65 2d + 63 75 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e 0a + + ~ " } if" + 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " drop drop 0 exit" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 20 30 20 + 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup s" #--" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 23 2d 2d 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " ~ (queued space count, word pointer)" + 20 20 20 20 7e 20 28 71 75 65 75 65 64 20 73 70 + 61 63 65 20 63 6f 75 6e 74 2c 20 77 6f 72 64 20 + 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " hex-comment-second-tab-stop current-column@" + 20 20 20 20 68 65 78 2d 63 6f 6d 6d 65 6e 74 2d + 73 65 63 6f 6e 64 2d 74 61 62 2d 73 74 6f 70 20 + 63 75 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e 40 0a + + ~ " 2dup > {" + 20 20 20 20 32 64 75 70 20 3e 20 7b 0a + + ~ " drop drop swap drop 0 swap" + 20 20 20 20 20 20 64 72 6f 70 20 64 72 6f 70 20 + 73 77 61 70 20 64 72 6f 70 20 30 20 73 77 61 70 + 0a + + ~ " newline" + 20 20 20 20 20 20 6e 65 77 6c 69 6e 65 0a + + ~ " hex-comment-first-tab-stop indent ." ~"" + 20 20 20 20 20 20 68 65 78 2d 63 6f 6d 6d 65 6e + 74 2d 66 69 72 73 74 2d 74 61 62 2d 73 74 6f 70 + 20 69 6e 64 65 6e 74 20 2e 22 20 7e 22 0a + + ~ " hex-comment-second-tab-stop" + ~ " hex-comment-first-tab-stop 1+ - indent" + 20 20 20 20 20 20 68 65 78 2d 63 6f 6d 6d 65 6e + 74 2d 73 65 63 6f 6e 64 2d 74 61 62 2d 73 74 6f + 70 20 68 65 78 2d 63 6f 6d 6d 65 6e 74 2d 66 69 + 72 73 74 2d 74 61 62 2d 73 74 6f 70 20 31 2b 20 + 2d 20 69 6e 64 65 6e 74 0a + + ~ " hex-comment-second-tab-stop current-column!" + 20 20 20 20 20 20 68 65 78 2d 63 6f 6d 6d 65 6e + 74 2d 73 65 63 6f 6e 64 2d 74 61 62 2d 73 74 6f + 70 20 63 75 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e + 21 0a + + ~ " } {" + 20 20 20 20 7d 20 7b 0a + + ~ " - dup indent advance-current-column" + 20 20 20 20 20 20 2d 20 64 75 70 20 69 6e 64 65 + 6e 74 20 61 64 76 61 6e 63 65 2d 63 75 72 72 65 + 6e 74 2d 63 6f 6c 75 6d 6e 0a + + ~ " swap drop 0 swap" + 20 20 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 + 30 20 73 77 61 70 0a + + ~ " } if-else" + 20 20 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ "" + 0a + + ~ " drop drop 1 exit" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 20 31 20 + 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ (queued space count, word pointer)" + 20 20 7e 20 28 71 75 65 75 65 64 20 73 70 61 63 + 65 20 63 6f 75 6e 74 2c 20 77 6f 72 64 20 70 6f + 69 6e 74 65 72 29 0a + + ~ " swap dup indent advance-current-column" + 20 20 73 77 61 70 20 64 75 70 20 69 6e 64 65 6e + 74 20 61 64 76 61 6e 63 65 2d 63 75 72 72 65 6e + 74 2d 63 6f 6c 75 6d 6e 0a + + ~ " dup stringlen advance-current-column" + 20 20 64 75 70 20 73 74 72 69 6e 67 6c 65 6e 20 + 61 64 76 61 6e 63 65 2d 63 75 72 72 65 6e 74 2d + 63 6f 6c 75 6d 6e 0a + + ~ " emitstring 0 ;" + 20 20 65 6d 69 74 73 74 72 69 6e 67 20 30 20 3b + 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ (string pointer --)" + 7e 20 28 73 74 72 69 6e 67 20 70 6f 69 6e 74 65 + 72 20 2d 2d 29 0a + + ~ ": hex-emit-template-string" + 3a 20 68 65 78 2d 65 6d 69 74 2d 74 65 6d 70 6c + 61 74 65 2d 73 74 72 69 6e 67 0a + + ~ " 0 swap" + 20 20 30 20 73 77 61 70 0a + + ~ " ~ (queued space count, input point)" + 20 20 7e 20 28 71 75 65 75 65 64 20 73 70 61 63 + 65 20 63 6f 75 6e 74 2c 20 69 6e 70 75 74 20 70 + 6f 69 6e 74 29 0a + + ~ "" + 0a + + ~ " { unpack8 dup } {" + 20 20 7b 20 75 6e 70 61 63 6b 38 20 64 75 70 20 + 7d 20 7b 0a + + ~ " ~ (queued space count, input point, latest character)" + 20 20 20 20 7e 20 28 71 75 65 75 65 64 20 73 70 + 61 63 65 20 63 6f 75 6e 74 2c 20 69 6e 70 75 74 + 20 70 6f 69 6e 74 2c 20 6c 61 74 65 73 74 20 63 + 68 61 72 61 63 74 65 72 29 0a + + ~ " dup is-space {" + 20 20 20 20 64 75 70 20 69 73 2d 73 70 61 63 65 + 20 7b 0a + + ~ " ~ Instead of outputting space characters as we" + ~ " reach them, we keep a" + 20 20 20 20 20 20 7e 20 20 20 49 6e 73 74 65 61 + 64 20 6f 66 20 6f 75 74 70 75 74 74 69 6e 67 20 + 73 70 61 63 65 20 63 68 61 72 61 63 74 65 72 73 + 20 61 73 20 77 65 20 72 65 61 63 68 20 74 68 65 + 6d 2c 20 77 65 20 6b 65 65 70 20 61 0a + + ~ " ~ count of how many are pending. This allows us to do" + ~ " word-wrapping" + 20 20 20 20 20 20 7e 20 63 6f 75 6e 74 20 6f 66 + 20 68 6f 77 20 6d 61 6e 79 20 61 72 65 20 70 65 + 6e 64 69 6e 67 2e 20 54 68 69 73 20 61 6c 6c 6f + 77 73 20 75 73 20 74 6f 20 64 6f 20 77 6f 72 64 + 2d 77 72 61 70 70 69 6e 67 0a + + ~ " ~ without having to worry about trailing spaces." + 20 20 20 20 20 20 7e 20 77 69 74 68 6f 75 74 20 + 68 61 76 69 6e 67 20 74 6f 20 77 6f 72 72 79 20 + 61 62 6f 75 74 20 74 72 61 69 6c 69 6e 67 20 73 + 70 61 63 65 73 2e 0a + + ~ " 3roll 1+ 3unroll drop" + 20 20 20 20 20 20 33 72 6f 6c 6c 20 31 2b 20 33 + 75 6e 72 6f 6c 6c 20 64 72 6f 70 0a + + ~ " } {" + 20 20 20 20 7d 20 7b 0a + + ~ " ~ (queued space count, input point, first word" + ~ " character)" + 20 20 20 20 20 20 7e 20 28 71 75 65 75 65 64 20 + 73 70 61 63 65 20 63 6f 75 6e 74 2c 20 69 6e 70 + 75 74 20 70 6f 69 6e 74 2c 20 66 69 72 73 74 20 + 77 6f 72 64 20 63 68 61 72 61 63 74 65 72 29 0a + + ~ " ~ We use the outer log's scratch space to" + ~ " accumulate each word in." + 20 20 20 20 20 20 7e 20 20 20 57 65 20 75 73 65 + 20 74 68 65 20 6f 75 74 65 72 20 6c 6f 67 27 73 + 20 73 63 72 61 74 63 68 20 73 70 61 63 65 20 74 + 6f 20 61 63 63 75 6d 75 6c 61 74 65 20 65 61 63 + 68 20 77 6f 72 64 20 69 6e 2e 0a + + ~ " swap-transform-variables here @" + ~ " swap-transform-variables" + 20 20 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 + 66 6f 72 6d 2d 76 61 72 69 61 62 6c 65 73 20 68 + 65 72 65 20 40 20 73 77 61 70 2d 74 72 61 6e 73 + 66 6f 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " swap" + 20 20 20 20 20 20 73 77 61 70 0a + + ~ " pack8" + 20 20 20 20 20 20 70 61 63 6b 38 0a + + ~ " swap" + 20 20 20 20 20 20 73 77 61 70 0a + + ~ " ~ (queued space count, scratch output point, input" + ~ " point)" + 20 20 20 20 20 20 7e 20 28 71 75 65 75 65 64 20 + 73 70 61 63 65 20 63 6f 75 6e 74 2c 20 73 63 72 + 61 74 63 68 20 6f 75 74 70 75 74 20 70 6f 69 6e + 74 2c 20 69 6e 70 75 74 20 70 6f 69 6e 74 29 0a + + ~ "" + 0a + + ~ " ~ Scan forward and find a space-separated word." + 20 20 20 20 20 20 7e 20 20 20 53 63 61 6e 20 66 + 6f 72 77 61 72 64 20 61 6e 64 20 66 69 6e 64 20 + 61 20 73 70 61 63 65 2d 73 65 70 61 72 61 74 65 + 64 20 77 6f 72 64 2e 0a + + ~ " { unpack8 dup dup is-space not && } {" + 20 20 20 20 20 20 7b 20 75 6e 70 61 63 6b 38 20 + 64 75 70 20 64 75 70 20 69 73 2d 73 70 61 63 65 + 20 6e 6f 74 20 26 26 20 7d 20 7b 0a + + ~ " ~ (queued space count, scratch output point," + ~ " adjusted input point," + 20 20 20 20 20 20 20 20 7e 20 28 71 75 65 75 65 + 64 20 73 70 61 63 65 20 63 6f 75 6e 74 2c 20 73 + 63 72 61 74 63 68 20 6f 75 74 70 75 74 20 70 6f + 69 6e 74 2c 20 61 64 6a 75 73 74 65 64 20 69 6e + 70 75 74 20 70 6f 69 6e 74 2c 0a + + ~ " ~ next character)" + 20 20 20 20 20 20 20 20 7e 20 20 6e 65 78 74 20 + 63 68 61 72 61 63 74 65 72 29 0a + + ~ " 3roll swap pack8 swap" + 20 20 20 20 20 20 20 20 33 72 6f 6c 6c 20 73 77 + 61 70 20 70 61 63 6b 38 20 73 77 61 70 0a + + ~ " ~ (queued space count, adjusted scratch output" + ~ " point," + 20 20 20 20 20 20 20 20 7e 20 28 71 75 65 75 65 + 64 20 73 70 61 63 65 20 63 6f 75 6e 74 2c 20 61 + 64 6a 75 73 74 65 64 20 73 63 72 61 74 63 68 20 + 6f 75 74 70 75 74 20 70 6f 69 6e 74 2c 0a + + ~ " ~ adjusted input point)" + 20 20 20 20 20 20 20 20 7e 20 20 61 64 6a 75 73 + 74 65 64 20 69 6e 70 75 74 20 70 6f 69 6e 74 29 + 0a + + ~ " } while" + 20 20 20 20 20 20 7d 20 77 68 69 6c 65 0a + + ~ " ~ (queued space count, scratch output point, input" + ~ " point," + 20 20 20 20 20 20 7e 20 28 71 75 65 75 65 64 20 + 73 70 61 63 65 20 63 6f 75 6e 74 2c 20 73 63 72 + 61 74 63 68 20 6f 75 74 70 75 74 20 70 6f 69 6e + 74 2c 20 69 6e 70 75 74 20 70 6f 69 6e 74 2c 0a + + ~ " ~ first non-word character or 0)" + 20 20 20 20 20 20 7e 20 20 66 69 72 73 74 20 6e + 6f 6e 2d 77 6f 72 64 20 63 68 61 72 61 63 74 65 + 72 20 6f 72 20 30 29 0a + + ~ " 3roll 0 pack8 drop" + 20 20 20 20 20 20 33 72 6f 6c 6c 20 30 20 70 61 + 63 6b 38 20 64 72 6f 70 0a + + ~ " ~ (queued space count, input point, first non-word" + ~ " character or 0)" + 20 20 20 20 20 20 7e 20 28 71 75 65 75 65 64 20 + 73 70 61 63 65 20 63 6f 75 6e 74 2c 20 69 6e 70 + 75 74 20 70 6f 69 6e 74 2c 20 66 69 72 73 74 20 + 6e 6f 6e 2d 77 6f 72 64 20 63 68 61 72 61 63 74 + 65 72 20 6f 72 20 30 29 0a + + ~ "" + 0a + + ~ " swap-transform-variables here @" + ~ " swap-transform-variables" + 20 20 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 + 66 6f 72 6d 2d 76 61 72 69 61 62 6c 65 73 20 68 + 65 72 65 20 40 20 73 77 61 70 2d 74 72 61 6e 73 + 66 6f 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " ~ (queued space count, input point, first non-word" + ~ " character or 0," + 20 20 20 20 20 20 7e 20 28 71 75 65 75 65 64 20 + 73 70 61 63 65 20 63 6f 75 6e 74 2c 20 69 6e 70 + 75 74 20 70 6f 69 6e 74 2c 20 66 69 72 73 74 20 + 6e 6f 6e 2d 77 6f 72 64 20 63 68 61 72 61 63 74 + 65 72 20 6f 72 20 30 2c 0a + + ~ " ~ word pointer)" + 20 20 20 20 20 20 7e 20 20 77 6f 72 64 20 70 6f + 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " 4 roll swap 1 max hex-emit-template-string-word 0 4" + ~ " unroll" + 20 20 20 20 20 20 34 20 72 6f 6c 6c 20 73 77 61 + 70 20 31 20 6d 61 78 20 68 65 78 2d 65 6d 69 74 + 2d 74 65 6d 70 6c 61 74 65 2d 73 74 72 69 6e 67 + 2d 77 6f 72 64 20 30 20 34 20 75 6e 72 6f 6c 6c + 0a + + ~ " ~ (queued space count, input point, first non-word" + ~ " character," + 20 20 20 20 20 20 7e 20 28 71 75 65 75 65 64 20 + 73 70 61 63 65 20 63 6f 75 6e 74 2c 20 69 6e 70 + 75 74 20 70 6f 69 6e 74 2c 20 66 69 72 73 74 20 + 6e 6f 6e 2d 77 6f 72 64 20 63 68 61 72 61 63 74 + 65 72 2c 0a + + ~ " ~ should ignore space)" + 20 20 20 20 20 20 7e 20 20 73 68 6f 75 6c 64 20 + 69 67 6e 6f 72 65 20 73 70 61 63 65 29 0a + + ~ "" + 0a + + ~ " over {" + 20 20 20 20 20 20 6f 76 65 72 20 7b 0a + + ~ " ~ If the character is non-zero, it's a space, so" + ~ " it can't be part of" + 20 20 20 20 20 20 20 20 7e 20 20 20 49 66 20 74 + 68 65 20 63 68 61 72 61 63 74 65 72 20 69 73 20 + 6e 6f 6e 2d 7a 65 72 6f 2c 20 69 74 27 73 20 61 + 20 73 70 61 63 65 2c 20 73 6f 20 69 74 20 63 61 + 6e 27 74 20 62 65 20 70 61 72 74 20 6f 66 0a + + ~ " ~ a word, so we can queue it for later output..." + ~ " unless we were asked" + 20 20 20 20 20 20 20 20 7e 20 61 20 77 6f 72 64 + 2c 20 73 6f 20 77 65 20 63 61 6e 20 71 75 65 75 + 65 20 69 74 20 66 6f 72 20 6c 61 74 65 72 20 6f + 75 74 70 75 74 2e 2e 2e 20 75 6e 6c 65 73 73 20 + 77 65 20 77 65 72 65 20 61 73 6b 65 64 0a + + ~ " ~ to skip it, of course." + 20 20 20 20 20 20 20 20 7e 20 74 6f 20 73 6b 69 + 70 20 69 74 2c 20 6f 66 20 63 6f 75 72 73 65 2e + 0a + + ~ " not {" + 20 20 20 20 20 20 20 20 6e 6f 74 20 7b 0a + + ~ " ~ (queued space count, input point, first" + ~ " non-word character)" + 20 20 20 20 20 20 20 20 20 20 7e 20 28 71 75 65 + 75 65 64 20 73 70 61 63 65 20 63 6f 75 6e 74 2c + 20 69 6e 70 75 74 20 70 6f 69 6e 74 2c 20 66 69 + 72 73 74 20 6e 6f 6e 2d 77 6f 72 64 20 63 68 61 + 72 61 63 74 65 72 29 0a + + ~ " 3roll 1+ 3unroll" + 20 20 20 20 20 20 20 20 20 20 33 72 6f 6c 6c 20 + 31 2b 20 33 75 6e 72 6f 6c 6c 0a + + ~ " } if" + 20 20 20 20 20 20 20 20 7d 20 69 66 0a + + ~ " drop" + 20 20 20 20 20 20 20 20 64 72 6f 70 0a + + ~ " } {" + 20 20 20 20 20 20 7d 20 7b 0a + + ~ " ~ If this is the end of the string, we can" + ~ " discard the 0, but then" + 20 20 20 20 20 20 20 20 7e 20 20 20 49 66 20 74 + 68 69 73 20 69 73 20 74 68 65 20 65 6e 64 20 6f + 66 20 74 68 65 20 73 74 72 69 6e 67 2c 20 77 65 + 20 63 61 6e 20 64 69 73 63 61 72 64 20 74 68 65 + 20 30 2c 20 62 75 74 20 74 68 65 6e 0a + + ~ " ~ we need to nudge the input point back so the loop" + ~ " will terminate." + 20 20 20 20 20 20 20 20 7e 20 77 65 20 6e 65 65 + 64 20 74 6f 20 6e 75 64 67 65 20 74 68 65 20 69 + 6e 70 75 74 20 70 6f 69 6e 74 20 62 61 63 6b 20 + 73 6f 20 74 68 65 20 6c 6f 6f 70 20 77 69 6c 6c + 20 74 65 72 6d 69 6e 61 74 65 2e 0a + + ~ " drop drop 1-" + 20 20 20 20 20 20 20 20 64 72 6f 70 20 64 72 6f + 70 20 31 2d 0a + + ~ " } if-else" + 20 20 20 20 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " ~ (queued space count, input point)" + 20 20 20 20 20 20 7e 20 28 71 75 65 75 65 64 20 + 73 70 61 63 65 20 63 6f 75 6e 74 2c 20 69 6e 70 + 75 74 20 70 6f 69 6e 74 29 0a + + ~ " } if-else" + 20 20 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " } while drop drop drop ;" + 20 20 7d 20 77 68 69 6c 65 20 64 72 6f 70 20 64 + 72 6f 70 20 64 72 6f 70 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ (string pointer --)" + 7e 20 28 73 74 72 69 6e 67 20 70 6f 69 6e 74 65 + 72 20 2d 2d 29 0a + + ~ ": hex-emit-comment" + 3a 20 68 65 78 2d 65 6d 69 74 2d 63 6f 6d 6d 65 + 6e 74 0a + + ~ " hex-comment-second-tab-stop current-column@ > {" + 20 20 68 65 78 2d 63 6f 6d 6d 65 6e 74 2d 73 65 + 63 6f 6e 64 2d 74 61 62 2d 73 74 6f 70 20 63 75 + 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e 40 20 3e 20 + 7b 0a + + ~ " newline" + 20 20 20 20 6e 65 77 6c 69 6e 65 0a + + ~ " hex-comment-first-tab-stop dup indent current-column!" + 20 20 20 20 68 65 78 2d 63 6f 6d 6d 65 6e 74 2d + 66 69 72 73 74 2d 74 61 62 2d 73 74 6f 70 20 64 + 75 70 20 69 6e 64 65 6e 74 20 63 75 72 72 65 6e + 74 2d 63 6f 6c 75 6d 6e 21 0a + + ~ " 1 is-fresh-line!" + 20 20 20 20 31 20 69 73 2d 66 72 65 73 68 2d 6c + 69 6e 65 21 0a + + ~ " 0 n-bytes-this-line!" + 20 20 20 20 30 20 6e 2d 62 79 74 65 73 2d 74 68 + 69 73 2d 6c 69 6e 65 21 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ." ~"" + 20 20 2e 22 20 7e 22 0a + + ~ " 1 advance-current-column" + 20 20 31 20 61 64 76 61 6e 63 65 2d 63 75 72 72 + 65 6e 74 2d 63 6f 6c 75 6d 6e 0a + + ~ "" + 0a + + ~ " dup @ {" + 20 20 64 75 70 20 40 20 7b 0a + + ~ " space" + 20 20 20 20 73 70 61 63 65 0a + + ~ " 1 advance-current-column" + 20 20 20 20 31 20 61 64 76 61 6e 63 65 2d 63 75 + 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " hex-emit-template-string ;" + 20 20 68 65 78 2d 65 6d 69 74 2d 74 65 6d 70 6c + 61 74 65 2d 73 74 72 69 6e 67 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This "replacement" is a little different from an" + ~ " alternate: When the code" + 7e 20 20 20 54 68 69 73 20 22 72 65 70 6c 61 63 + 65 6d 65 6e 74 22 20 69 73 20 61 20 6c 69 74 74 + 6c 65 20 64 69 66 66 65 72 65 6e 74 20 66 72 6f + 6d 20 61 6e 20 61 6c 74 65 72 6e 61 74 65 3a 20 + 57 68 65 6e 20 74 68 65 20 63 6f 64 65 0a + + ~ "~ under transformation attempts to compile its own version" + ~ " of sys-write, it" + 7e 20 75 6e 64 65 72 20 74 72 61 6e 73 66 6f 72 + 6d 61 74 69 6f 6e 20 61 74 74 65 6d 70 74 73 20 + 74 6f 20 63 6f 6d 70 69 6c 65 20 69 74 73 20 6f + 77 6e 20 76 65 72 73 69 6f 6e 20 6f 66 20 73 79 + 73 2d 77 72 69 74 65 2c 20 69 74 0a + + ~ "~ gets a stub that calls this word instead. It's swapped" + ~ " out by" + 7e 20 67 65 74 73 20 61 20 73 74 75 62 20 74 68 + 61 74 20 63 61 6c 6c 73 20 74 68 69 73 20 77 6f + 72 64 20 69 6e 73 74 65 61 64 2e 20 49 74 27 73 + 20 73 77 61 70 70 65 64 20 6f 75 74 20 62 79 0a + + ~ "~ hex-colon-alternate, whereas the regular alternates are" + ~ " swapped out by" + 7e 20 68 65 78 2d 63 6f 6c 6f 6e 2d 61 6c 74 65 + 72 6e 61 74 65 2c 20 77 68 65 72 65 61 73 20 74 + 68 65 20 72 65 67 75 6c 61 72 20 61 6c 74 65 72 + 6e 61 74 65 73 20 61 72 65 20 73 77 61 70 70 65 + 64 20 6f 75 74 20 62 79 0a + + ~ "~ hex-transform-one." + 7e 20 68 65 78 2d 74 72 61 6e 73 66 6f 72 6d 2d + 6f 6e 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ In the programs we're actually running the transform" + ~ " on, there's only ever" + 7e 20 20 20 49 6e 20 74 68 65 20 70 72 6f 67 72 + 61 6d 73 20 77 65 27 72 65 20 61 63 74 75 61 6c + 6c 79 20 72 75 6e 6e 69 6e 67 20 74 68 65 20 74 + 72 61 6e 73 66 6f 72 6d 20 6f 6e 2c 20 74 68 65 + 72 65 27 73 20 6f 6e 6c 79 20 65 76 65 72 0a + + ~ "~ a single call to sys-write which is the whole binary in" + ~ " one go, but we don't" + 7e 20 61 20 73 69 6e 67 6c 65 20 63 61 6c 6c 20 + 74 6f 20 73 79 73 2d 77 72 69 74 65 20 77 68 69 + 63 68 20 69 73 20 74 68 65 20 77 68 6f 6c 65 20 + 62 69 6e 61 72 79 20 69 6e 20 6f 6e 65 20 67 6f + 2c 20 62 75 74 20 77 65 20 64 6f 6e 27 74 0a + + ~ "~ want to require that, so we keep all the formatting state" + ~ " in the output" + 7e 20 77 61 6e 74 20 74 6f 20 72 65 71 75 69 72 + 65 20 74 68 61 74 2c 20 73 6f 20 77 65 20 6b 65 + 65 70 20 61 6c 6c 20 74 68 65 20 66 6f 72 6d 61 + 74 74 69 6e 67 20 73 74 61 74 65 20 69 6e 20 74 + 68 65 20 6f 75 74 70 75 74 0a + + ~ "~ metadata header." + 7e 20 6d 65 74 61 64 61 74 61 20 68 65 61 64 65 + 72 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (file descriptor, base address, length to write -- length" + ~ " written)" + 7e 20 28 66 69 6c 65 20 64 65 73 63 72 69 70 74 + 6f 72 2c 20 62 61 73 65 20 61 64 64 72 65 73 73 + 2c 20 6c 65 6e 67 74 68 20 74 6f 20 77 72 69 74 + 65 20 2d 2d 20 6c 65 6e 67 74 68 20 77 72 69 74 + 74 65 6e 29 0a + + ~ ": hex-sys-write-replacement" + 3a 20 68 65 78 2d 73 79 73 2d 77 72 69 74 65 2d + 72 65 70 6c 61 63 65 6d 65 6e 74 0a + + ~ " ~ In intended operation, the code under transformation" + ~ " is a compilation" + 20 20 7e 20 20 20 49 6e 20 69 6e 74 65 6e 64 65 + 64 20 6f 70 65 72 61 74 69 6f 6e 2c 20 74 68 65 + 20 63 6f 64 65 20 75 6e 64 65 72 20 74 72 61 6e + 73 66 6f 72 6d 61 74 69 6f 6e 20 69 73 20 61 20 + 63 6f 6d 70 69 6c 61 74 69 6f 6e 0a + + ~ " ~ process, and it won't output anything that isn't" + ~ " executable binary." + 20 20 7e 20 70 72 6f 63 65 73 73 2c 20 61 6e 64 + 20 69 74 20 77 6f 6e 27 74 20 6f 75 74 70 75 74 + 20 61 6e 79 74 68 69 6e 67 20 74 68 61 74 20 69 + 73 6e 27 74 20 65 78 65 63 75 74 61 62 6c 65 20 + 62 69 6e 61 72 79 2e 0a + + ~ " ~ However, while developing, it's common to have crashes," + ~ " and it's nice to" + 20 20 7e 20 48 6f 77 65 76 65 72 2c 20 77 68 69 + 6c 65 20 64 65 76 65 6c 6f 70 69 6e 67 2c 20 69 + 74 27 73 20 63 6f 6d 6d 6f 6e 20 74 6f 20 68 61 + 76 65 20 63 72 61 73 68 65 73 2c 20 61 6e 64 20 + 69 74 27 73 20 6e 69 63 65 20 74 6f 0a + + ~ " ~ get the crash dump as ASCII rather than hex." + 20 20 7e 20 67 65 74 20 74 68 65 20 63 72 61 73 + 68 20 64 75 6d 70 20 61 73 20 41 53 43 49 49 20 + 72 61 74 68 65 72 20 74 68 61 6e 20 68 65 78 2e + 0a + + ~ " over is-in-label-loop-buffer not {" + 20 20 6f 76 65 72 20 69 73 2d 69 6e 2d 6c 61 62 + 65 6c 2d 6c 6f 6f 70 2d 62 75 66 66 65 72 20 6e + 6f 74 20 7b 0a + + ~ " sys-write exit" + 20 20 20 20 73 79 73 2d 77 72 69 74 65 20 65 78 + 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " 3roll drop dup 3roll" + 20 20 33 72 6f 6c 6c 20 64 72 6f 70 20 64 75 70 + 20 33 72 6f 6c 6c 0a + + ~ " ~ The result should be the length written. We just" + ~ " proactively declare" + 20 20 7e 20 20 20 54 68 65 20 72 65 73 75 6c 74 + 20 73 68 6f 75 6c 64 20 62 65 20 74 68 65 20 6c + 65 6e 67 74 68 20 77 72 69 74 74 65 6e 2e 20 57 + 65 20 6a 75 73 74 20 70 72 6f 61 63 74 69 76 65 + 6c 79 20 64 65 63 6c 61 72 65 0a + + ~ " ~ that we'll write the full length we were asked to," + ~ " threading that through" + 20 20 7e 20 74 68 61 74 20 77 65 27 6c 6c 20 77 + 72 69 74 65 20 74 68 65 20 66 75 6c 6c 20 6c 65 + 6e 67 74 68 20 77 65 20 77 65 72 65 20 61 73 6b + 65 64 20 74 6f 2c 20 74 68 72 65 61 64 69 6e 67 + 20 74 68 61 74 20 74 68 72 6f 75 67 68 0a + + ~ " ~ as the result we'll eventually return." + 20 20 7e 20 61 73 20 74 68 65 20 72 65 73 75 6c + 74 20 77 65 27 6c 6c 20 65 76 65 6e 74 75 61 6c + 6c 79 20 72 65 74 75 72 6e 2e 0a + + ~ " ~ (result, length to write, base address)" + 20 20 7e 20 28 72 65 73 75 6c 74 2c 20 6c 65 6e + 67 74 68 20 74 6f 20 77 72 69 74 65 2c 20 62 61 + 73 65 20 61 64 64 72 65 73 73 29 0a + + ~ "" + 0a + + ~ " postprocess-metadata-entries" + 20 20 70 6f 73 74 70 72 6f 63 65 73 73 2d 6d 65 + 74 61 64 61 74 61 2d 65 6e 74 72 69 65 73 0a + + ~ "" + 0a + + ~ " ~ Importantly, postprocessing leaves the entries" + ~ " sorted, which means we" + 20 20 7e 20 20 20 49 6d 70 6f 72 74 61 6e 74 6c + 79 2c 20 70 6f 73 74 70 72 6f 63 65 73 73 69 6e + 67 20 6c 65 61 76 65 73 20 74 68 65 20 65 6e 74 + 72 69 65 73 20 73 6f 72 74 65 64 2c 20 77 68 69 + 63 68 20 6d 65 61 6e 73 20 77 65 0a + + ~ " ~ can go back and forth in a linear scan through the" + ~ " entry array while we" + 20 20 7e 20 63 61 6e 20 67 6f 20 62 61 63 6b 20 + 61 6e 64 20 66 6f 72 74 68 20 69 6e 20 61 20 6c + 69 6e 65 61 72 20 73 63 61 6e 20 74 68 72 6f 75 + 67 68 20 74 68 65 20 65 6e 74 72 79 20 61 72 72 + 61 79 20 77 68 69 6c 65 20 77 65 0a + + ~ " ~ also do a linear scan of the output data. It's fiddly," + ~ " but we can't afford" + 20 20 7e 20 61 6c 73 6f 20 64 6f 20 61 20 6c 69 + 6e 65 61 72 20 73 63 61 6e 20 6f 66 20 74 68 65 + 20 6f 75 74 70 75 74 20 64 61 74 61 2e 20 49 74 + 27 73 20 66 69 64 64 6c 79 2c 20 62 75 74 20 77 + 65 20 63 61 6e 27 74 20 61 66 66 6f 72 64 0a + + ~ " ~ to be O(n^2) here, it adds up to quite a lot of" + ~ " runtime." + 20 20 7e 20 74 6f 20 62 65 20 4f 28 6e 5e 32 29 + 20 68 65 72 65 2c 20 69 74 20 61 64 64 73 20 75 + 70 20 74 6f 20 71 75 69 74 65 20 61 20 6c 6f 74 + 20 6f 66 20 72 75 6e 74 69 6d 65 2e 0a + + ~ "" + 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-first-entry" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 66 69 72 73 74 2d 65 6e 74 72 + 79 0a + + ~ " ~ (result, length to write, base address, initial" + ~ " metadata scan pointer)" + 20 20 7e 20 28 72 65 73 75 6c 74 2c 20 6c 65 6e + 67 74 68 20 74 6f 20 77 72 69 74 65 2c 20 62 61 + 73 65 20 61 64 64 72 65 73 73 2c 20 69 6e 69 74 + 69 61 6c 20 6d 65 74 61 64 61 74 61 20 73 63 61 + 6e 20 70 6f 69 6e 74 65 72 29 0a + + ~ " { 2 pick 0 <= } {" + 20 20 7b 20 32 20 70 69 63 6b 20 30 20 3c 3d 20 + 7d 20 7b 0a + + ~ " ~ (result, length remaining, current output address," + 20 20 20 20 7e 20 28 72 65 73 75 6c 74 2c 20 6c + 65 6e 67 74 68 20 72 65 6d 61 69 6e 69 6e 67 2c + 20 63 75 72 72 65 6e 74 20 6f 75 74 70 75 74 20 + 61 64 64 72 65 73 73 2c 0a + + ~ " ~ metadata scan pointer)" + 20 20 20 20 7e 20 20 6d 65 74 61 64 61 74 61 20 + 73 63 61 6e 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " ~ Keep inspecting entries as long as the output" + ~ " address is greater than" + 20 20 20 20 7e 20 20 20 4b 65 65 70 20 69 6e 73 + 70 65 63 74 69 6e 67 20 65 6e 74 72 69 65 73 20 + 61 73 20 6c 6f 6e 67 20 61 73 20 74 68 65 20 6f + 75 74 70 75 74 20 61 64 64 72 65 73 73 20 69 73 + 20 67 72 65 61 74 65 72 20 74 68 61 6e 0a + + ~ " ~ or equal to the entry address. If we're looking at" + ~ " the entries that come" + 20 20 20 20 7e 20 6f 72 20 65 71 75 61 6c 20 74 + 6f 20 74 68 65 20 65 6e 74 72 79 20 61 64 64 72 + 65 73 73 2e 20 49 66 20 77 65 27 72 65 20 6c 6f + 6f 6b 69 6e 67 20 61 74 20 74 68 65 20 65 6e 74 + 72 69 65 73 20 74 68 61 74 20 63 6f 6d 65 0a + + ~ " ~ before the output, this will scan through all of them" + ~ " first, then" + 20 20 20 20 7e 20 62 65 66 6f 72 65 20 74 68 65 + 20 6f 75 74 70 75 74 2c 20 74 68 69 73 20 77 69 + 6c 6c 20 73 63 61 6e 20 74 68 72 6f 75 67 68 20 + 61 6c 6c 20 6f 66 20 74 68 65 6d 20 66 69 72 73 + 74 2c 20 74 68 65 6e 0a + + ~ " ~ eventually catch up. Since the scan pointer is kept" + ~ " across iterations," + 20 20 20 20 7e 20 65 76 65 6e 74 75 61 6c 6c 79 + 20 63 61 74 63 68 20 75 70 2e 20 53 69 6e 63 65 + 20 74 68 65 20 73 63 61 6e 20 70 6f 69 6e 74 65 + 72 20 69 73 20 6b 65 70 74 20 61 63 72 6f 73 73 + 20 69 74 65 72 61 74 69 6f 6e 73 2c 0a + + ~ " ~ it's important we not go beyond that point." + 20 20 20 20 7e 20 69 74 27 73 20 69 6d 70 6f 72 + 74 61 6e 74 20 77 65 20 6e 6f 74 20 67 6f 20 62 + 65 79 6f 6e 64 20 74 68 61 74 20 70 6f 69 6e 74 + 2e 0a + + ~ " { dup @ dup" + 20 20 20 20 7b 20 64 75 70 20 40 20 64 75 70 0a + + ~ " ~ (result, length remaining, current output address," + 20 20 20 20 20 20 7e 20 28 72 65 73 75 6c 74 2c + 20 6c 65 6e 67 74 68 20 72 65 6d 61 69 6e 69 6e + 67 2c 20 63 75 72 72 65 6e 74 20 6f 75 74 70 75 + 74 20 61 64 64 72 65 73 73 2c 0a + + ~ " ~ metadata scan pointer, entry's first field," + ~ " entry's first field)" + 20 20 20 20 20 20 7e 20 20 6d 65 74 61 64 61 74 + 61 20 73 63 61 6e 20 70 6f 69 6e 74 65 72 2c 20 + 65 6e 74 72 79 27 73 20 66 69 72 73 74 20 66 69 + 65 6c 64 2c 20 65 6e 74 72 79 27 73 20 66 69 72 + 73 74 20 66 69 65 6c 64 29 0a + + ~ " {" + 20 20 20 20 20 20 7b 0a + + ~ " ~ This is an nop, but for clarity's sake it's" + ~ " best to not depend on" + 20 20 20 20 20 20 20 20 7e 20 20 20 54 68 69 73 + 20 69 73 20 61 6e 20 6e 6f 70 2c 20 62 75 74 20 + 66 6f 72 20 63 6c 61 72 69 74 79 27 73 20 73 61 + 6b 65 20 69 74 27 73 20 62 65 73 74 20 74 6f 20 + 6e 6f 74 20 64 65 70 65 6e 64 20 6f 6e 0a + + ~ " ~ details of the structure layout that perhaps not" + ~ " everyone has" + 20 20 20 20 20 20 20 20 7e 20 64 65 74 61 69 6c + 73 20 6f 66 20 74 68 65 20 73 74 72 75 63 74 75 + 72 65 20 6c 61 79 6f 75 74 20 74 68 61 74 20 70 + 65 72 68 61 70 73 20 6e 6f 74 20 65 76 65 72 79 + 6f 6e 65 20 68 61 73 0a + + ~ " ~ memorized..." + 20 20 20 20 20 20 20 20 7e 20 6d 65 6d 6f 72 69 + 7a 65 64 2e 2e 2e 0a + + ~ " ~" + 20 20 20 20 20 20 20 20 7e 0a + + ~ " ~ To get into this block, we tested for the array" + ~ " end indicator, but" + 20 20 20 20 20 20 20 20 7e 20 20 20 54 6f 20 67 + 65 74 20 69 6e 74 6f 20 74 68 69 73 20 62 6c 6f + 63 6b 2c 20 77 65 20 74 65 73 74 65 64 20 66 6f + 72 20 74 68 65 20 61 72 72 61 79 20 65 6e 64 20 + 69 6e 64 69 63 61 74 6f 72 2c 20 62 75 74 0a + + ~ " ~ now that we know we have an entry here, we're" + ~ " looking at its" + 20 20 20 20 20 20 20 20 7e 20 6e 6f 77 20 74 68 + 61 74 20 77 65 20 6b 6e 6f 77 20 77 65 20 68 61 + 76 65 20 61 6e 20 65 6e 74 72 79 20 68 65 72 65 + 2c 20 77 65 27 72 65 20 6c 6f 6f 6b 69 6e 67 20 + 61 74 20 69 74 73 0a + + ~ " ~ contents." + 20 20 20 20 20 20 20 20 7e 20 63 6f 6e 74 65 6e + 74 73 2e 0a + + ~ " hex-output-metadata-entry-data-start" + 20 20 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 64 61 74 61 2d 73 74 61 72 74 0a + + ~ "" + 0a + + ~ " dup 3 pick" + 20 20 20 20 20 20 20 20 64 75 70 20 33 20 70 69 + 63 6b 0a + + ~ " ~ (result, length remaining, current output" + ~ " address," + 20 20 20 20 20 20 20 20 7e 20 28 72 65 73 75 6c + 74 2c 20 6c 65 6e 67 74 68 20 72 65 6d 61 69 6e + 69 6e 67 2c 20 63 75 72 72 65 6e 74 20 6f 75 74 + 70 75 74 20 61 64 64 72 65 73 73 2c 0a + + ~ " ~ metadata scan pointer, entry's data start," + ~ " entry's data start," + 20 20 20 20 20 20 20 20 7e 20 20 6d 65 74 61 64 + 61 74 61 20 73 63 61 6e 20 70 6f 69 6e 74 65 72 + 2c 20 65 6e 74 72 79 27 73 20 64 61 74 61 20 73 + 74 61 72 74 2c 20 65 6e 74 72 79 27 73 20 64 61 + 74 61 20 73 74 61 72 74 2c 0a + + ~ " ~ current output address)" + 20 20 20 20 20 20 20 20 7e 20 20 63 75 72 72 65 + 6e 74 20 6f 75 74 70 75 74 20 61 64 64 72 65 73 + 73 29 0a + + ~ " >= swap drop" + 20 20 20 20 20 20 20 20 3e 3d 20 73 77 61 70 20 + 64 72 6f 70 0a + + ~ " } if" + 20 20 20 20 20 20 7d 20 69 66 0a + + ~ " } {" + 20 20 20 20 7d 20 7b 0a + + ~ " dup @" + 20 20 20 20 20 20 64 75 70 20 40 0a + + ~ " 2 pick = {" + 20 20 20 20 20 20 32 20 70 69 63 6b 20 3d 20 7b + 0a + + ~ " ~ We found a matching metadata entry." + 20 20 20 20 20 20 20 20 7e 20 57 65 20 66 6f 75 + 6e 64 20 61 20 6d 61 74 63 68 69 6e 67 20 6d 65 + 74 61 64 61 74 61 20 65 6e 74 72 79 2e 0a + + ~ " ~ (result, length remaining, current output" + ~ " address," + 20 20 20 20 20 20 20 20 7e 20 28 72 65 73 75 6c + 74 2c 20 6c 65 6e 67 74 68 20 72 65 6d 61 69 6e + 69 6e 67 2c 20 63 75 72 72 65 6e 74 20 6f 75 74 + 70 75 74 20 61 64 64 72 65 73 73 2c 0a + + ~ " ~ metadata scan pointer)" + 20 20 20 20 20 20 20 20 7e 20 20 6d 65 74 61 64 + 61 74 61 20 73 63 61 6e 20 70 6f 69 6e 74 65 72 + 29 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-type @" + 20 20 20 20 20 20 20 20 64 75 70 20 68 65 78 2d + 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 79 2d 74 79 70 65 20 40 0a + + ~ " hex-output-metadata-entry-type-line-comment = {" + 20 20 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 74 79 70 65 2d 6c 69 6e 65 2d 63 6f 6d 6d + 65 6e 74 20 3d 20 7b 0a + + ~ " fresh-line" + 20 20 20 20 20 20 20 20 20 20 66 72 65 73 68 2d + 6c 69 6e 65 0a + + ~ " indentation-depth@ dup indent" + ~ " advance-current-column" + 20 20 20 20 20 20 20 20 20 20 69 6e 64 65 6e 74 + 61 74 69 6f 6e 2d 64 65 70 74 68 40 20 64 75 70 + 20 69 6e 64 65 6e 74 20 61 64 76 61 6e 63 65 2d + 63 75 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-content @" + ~ " hex-emit-comment" + 20 20 20 20 20 20 20 20 20 20 64 75 70 20 68 65 + 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 + 61 2d 65 6e 74 72 79 2d 63 6f 6e 74 65 6e 74 20 + 40 20 68 65 78 2d 65 6d 69 74 2d 63 6f 6d 6d 65 + 6e 74 0a + + ~ " newline" + 20 20 20 20 20 20 20 20 20 20 6e 65 77 6c 69 6e + 65 0a + + ~ "" + 0a + + ~ " 1 is-fresh-line!" + 20 20 20 20 20 20 20 20 20 20 31 20 69 73 2d 66 + 72 65 73 68 2d 6c 69 6e 65 21 0a + + ~ " 0 n-bytes-this-line!" + 20 20 20 20 20 20 20 20 20 20 30 20 6e 2d 62 79 + 74 65 73 2d 74 68 69 73 2d 6c 69 6e 65 21 0a + + ~ " 0 current-column!" + 20 20 20 20 20 20 20 20 20 20 30 20 63 75 72 72 + 65 6e 74 2d 63 6f 6c 75 6d 6e 21 0a + + ~ " } if" + 20 20 20 20 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-type @" + 20 20 20 20 20 20 20 20 64 75 70 20 68 65 78 2d + 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 79 2d 74 79 70 65 20 40 0a + + ~ " hex-output-metadata-entry-type-suffix-comment = {" + 20 20 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 74 79 70 65 2d 73 75 66 66 69 78 2d 63 6f + 6d 6d 65 6e 74 20 3d 20 7b 0a + + ~ " hex-comment-first-tab-stop current-column@ - 1" + ~ " max" + 20 20 20 20 20 20 20 20 20 20 68 65 78 2d 63 6f + 6d 6d 65 6e 74 2d 66 69 72 73 74 2d 74 61 62 2d + 73 74 6f 70 20 63 75 72 72 65 6e 74 2d 63 6f 6c + 75 6d 6e 40 20 2d 20 31 20 6d 61 78 0a + + ~ " dup indent advance-current-column" + 20 20 20 20 20 20 20 20 20 20 64 75 70 20 69 6e + 64 65 6e 74 20 61 64 76 61 6e 63 65 2d 63 75 72 + 72 65 6e 74 2d 63 6f 6c 75 6d 6e 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-content @" + ~ " hex-emit-comment" + 20 20 20 20 20 20 20 20 20 20 64 75 70 20 68 65 + 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 + 61 2d 65 6e 74 72 79 2d 63 6f 6e 74 65 6e 74 20 + 40 20 68 65 78 2d 65 6d 69 74 2d 63 6f 6d 6d 65 + 6e 74 0a + + ~ " newline" + 20 20 20 20 20 20 20 20 20 20 6e 65 77 6c 69 6e + 65 0a + + ~ "" + 0a + + ~ " 1 is-fresh-line!" + 20 20 20 20 20 20 20 20 20 20 31 20 69 73 2d 66 + 72 65 73 68 2d 6c 69 6e 65 21 0a + + ~ " 0 n-bytes-this-line!" + 20 20 20 20 20 20 20 20 20 20 30 20 6e 2d 62 79 + 74 65 73 2d 74 68 69 73 2d 6c 69 6e 65 21 0a + + ~ " 0 current-column!" + 20 20 20 20 20 20 20 20 20 20 30 20 63 75 72 72 + 65 6e 74 2d 63 6f 6c 75 6d 6e 21 0a + + ~ " } if" + 20 20 20 20 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-type @" + 20 20 20 20 20 20 20 20 64 75 70 20 68 65 78 2d + 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 79 2d 74 79 70 65 20 40 0a + + ~ " hex-output-metadata-entry-type-fresh-line = {" + 20 20 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 74 79 70 65 2d 66 72 65 73 68 2d 6c 69 6e + 65 20 3d 20 7b 0a + + ~ " fresh-line" + 20 20 20 20 20 20 20 20 20 20 66 72 65 73 68 2d + 6c 69 6e 65 0a + + ~ " 1 is-fresh-line!" + 20 20 20 20 20 20 20 20 20 20 31 20 69 73 2d 66 + 72 65 73 68 2d 6c 69 6e 65 21 0a + + ~ " 0 n-bytes-this-line!" + 20 20 20 20 20 20 20 20 20 20 30 20 6e 2d 62 79 + 74 65 73 2d 74 68 69 73 2d 6c 69 6e 65 21 0a + + ~ " 0 current-column!" + 20 20 20 20 20 20 20 20 20 20 30 20 63 75 72 72 + 65 6e 74 2d 63 6f 6c 75 6d 6e 21 0a + + ~ " } if" + 20 20 20 20 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-type @" + 20 20 20 20 20 20 20 20 64 75 70 20 68 65 78 2d + 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 79 2d 74 79 70 65 20 40 0a + + ~ " hex-output-metadata-entry-type-blank-line = {" + 20 20 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 74 79 70 65 2d 62 6c 61 6e 6b 2d 6c 69 6e + 65 20 3d 20 7b 0a + + ~ " fresh-line" + 20 20 20 20 20 20 20 20 20 20 66 72 65 73 68 2d + 6c 69 6e 65 0a + + ~ " newline" + 20 20 20 20 20 20 20 20 20 20 6e 65 77 6c 69 6e + 65 0a + + ~ " 1 is-fresh-line!" + 20 20 20 20 20 20 20 20 20 20 31 20 69 73 2d 66 + 72 65 73 68 2d 6c 69 6e 65 21 0a + + ~ " 0 n-bytes-this-line!" + 20 20 20 20 20 20 20 20 20 20 30 20 6e 2d 62 79 + 74 65 73 2d 74 68 69 73 2d 6c 69 6e 65 21 0a + + ~ " 0 current-column!" + 20 20 20 20 20 20 20 20 20 20 30 20 63 75 72 72 + 65 6e 74 2d 63 6f 6c 75 6d 6e 21 0a + + ~ " } if" + 20 20 20 20 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-type @" + 20 20 20 20 20 20 20 20 64 75 70 20 68 65 78 2d + 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 79 2d 74 79 70 65 20 40 0a + + ~ " hex-output-metadata-entry-type-indent = {" + 20 20 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 74 79 70 65 2d 69 6e 64 65 6e 74 20 3d 20 + 7b 0a + + ~ " dup hex-output-metadata-entry-content @" + 20 20 20 20 20 20 20 20 20 20 64 75 70 20 68 65 + 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 + 61 2d 65 6e 74 72 79 2d 63 6f 6e 74 65 6e 74 20 + 40 0a + + ~ " indentation-depth@ + indentation-depth!" + 20 20 20 20 20 20 20 20 20 20 69 6e 64 65 6e 74 + 61 74 69 6f 6e 2d 64 65 70 74 68 40 20 2b 20 69 + 6e 64 65 6e 74 61 74 69 6f 6e 2d 64 65 70 74 68 + 21 0a + + ~ " } if" + 20 20 20 20 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-type @" + 20 20 20 20 20 20 20 20 64 75 70 20 68 65 78 2d + 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 79 2d 74 79 70 65 20 40 0a + + ~ " hex-output-metadata-entry-type-string-literal = {" + 20 20 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 74 79 70 65 2d 73 74 72 69 6e 67 2d 6c 69 + 74 65 72 61 6c 20 3d 20 7b 0a + + ~ " fresh-line" + 20 20 20 20 20 20 20 20 20 20 66 72 65 73 68 2d + 6c 69 6e 65 0a + + ~ " indentation-depth@ dup indent" + ~ " advance-current-column" + 20 20 20 20 20 20 20 20 20 20 69 6e 64 65 6e 74 + 61 74 69 6f 6e 2d 64 65 70 74 68 40 20 64 75 70 + 20 69 6e 64 65 6e 74 20 61 64 76 61 6e 63 65 2d + 63 75 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e 0a + + ~ "" + 0a + + ~ " ." ~ "" + 20 20 20 20 20 20 20 20 20 20 2e 22 20 7e 20 22 + 0a + + ~ " 0x22 value@ emitstring drop" + 20 20 20 20 20 20 20 20 20 20 30 78 32 32 20 76 + 61 6c 75 65 40 20 65 6d 69 74 73 74 72 69 6e 67 + 20 64 72 6f 70 0a + + ~ " dup hex-output-metadata-entry-content @" + ~ " emitstring" + 20 20 20 20 20 20 20 20 20 20 64 75 70 20 68 65 + 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 + 61 2d 65 6e 74 72 79 2d 63 6f 6e 74 65 6e 74 20 + 40 20 65 6d 69 74 73 74 72 69 6e 67 0a + + ~ " 0x22 value@ emitstring drop" + 20 20 20 20 20 20 20 20 20 20 30 78 32 32 20 76 + 61 6c 75 65 40 20 65 6d 69 74 73 74 72 69 6e 67 + 20 64 72 6f 70 0a + + ~ " ." (string literal with null)"" + 20 20 20 20 20 20 20 20 20 20 2e 22 20 20 20 20 + 28 73 74 72 69 6e 67 20 6c 69 74 65 72 61 6c 20 + 77 69 74 68 20 6e 75 6c 6c 29 22 0a + + ~ "" + 0a + + ~ " newline" + 20 20 20 20 20 20 20 20 20 20 6e 65 77 6c 69 6e + 65 0a + + ~ " 1 is-fresh-line!" + 20 20 20 20 20 20 20 20 20 20 31 20 69 73 2d 66 + 72 65 73 68 2d 6c 69 6e 65 21 0a + + ~ " 0 n-bytes-this-line!" + 20 20 20 20 20 20 20 20 20 20 30 20 6e 2d 62 79 + 74 65 73 2d 74 68 69 73 2d 6c 69 6e 65 21 0a + + ~ " 0 current-column!" + 20 20 20 20 20 20 20 20 20 20 30 20 63 75 72 72 + 65 6e 74 2d 63 6f 6c 75 6d 6e 21 0a + + ~ " } if" + 20 20 20 20 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-type @" + 20 20 20 20 20 20 20 20 64 75 70 20 68 65 78 2d + 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 79 2d 74 79 70 65 20 40 0a + + ~ " hex-output-metadata-entry-type-raw-string-literal =" + ~ " {" + 20 20 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 74 79 70 65 2d 72 61 77 2d 73 74 72 69 6e + 67 2d 6c 69 74 65 72 61 6c 20 3d 20 7b 0a + + ~ " fresh-line" + 20 20 20 20 20 20 20 20 20 20 66 72 65 73 68 2d + 6c 69 6e 65 0a + + ~ " indentation-depth@ dup indent" + ~ " advance-current-column" + 20 20 20 20 20 20 20 20 20 20 69 6e 64 65 6e 74 + 61 74 69 6f 6e 2d 64 65 70 74 68 40 20 64 75 70 + 20 69 6e 64 65 6e 74 20 61 64 76 61 6e 63 65 2d + 63 75 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e 0a + + ~ "" + 0a + + ~ " ." ~ "" + 20 20 20 20 20 20 20 20 20 20 2e 22 20 7e 20 22 + 0a + + ~ " 0x22 value@ emitstring drop" + 20 20 20 20 20 20 20 20 20 20 30 78 32 32 20 76 + 61 6c 75 65 40 20 65 6d 69 74 73 74 72 69 6e 67 + 20 64 72 6f 70 0a + + ~ " dup hex-output-metadata-entry-content @" + ~ " emitstring" + 20 20 20 20 20 20 20 20 20 20 64 75 70 20 68 65 + 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 + 61 2d 65 6e 74 72 79 2d 63 6f 6e 74 65 6e 74 20 + 40 20 65 6d 69 74 73 74 72 69 6e 67 0a + + ~ " 0x22 value@ emitstring drop" + 20 20 20 20 20 20 20 20 20 20 30 78 32 32 20 76 + 61 6c 75 65 40 20 65 6d 69 74 73 74 72 69 6e 67 + 20 64 72 6f 70 0a + + ~ " ." (raw string literal)"" + 20 20 20 20 20 20 20 20 20 20 2e 22 20 20 20 20 + 20 28 72 61 77 20 73 74 72 69 6e 67 20 6c 69 74 + 65 72 61 6c 29 22 0a + + ~ "" + 0a + + ~ " newline" + 20 20 20 20 20 20 20 20 20 20 6e 65 77 6c 69 6e + 65 0a + + ~ " 1 is-fresh-line!" + 20 20 20 20 20 20 20 20 20 20 31 20 69 73 2d 66 + 72 65 73 68 2d 6c 69 6e 65 21 0a + + ~ " 0 n-bytes-this-line!" + 20 20 20 20 20 20 20 20 20 20 30 20 6e 2d 62 79 + 74 65 73 2d 74 68 69 73 2d 6c 69 6e 65 21 0a + + ~ " 0 current-column!" + 20 20 20 20 20 20 20 20 20 20 30 20 63 75 72 72 + 65 6e 74 2d 63 6f 6c 75 6d 6e 21 0a + + ~ " } if" + 20 20 20 20 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup is-push-subitem-entry {" + 20 20 20 20 20 20 20 20 64 75 70 20 69 73 2d 70 + 75 73 68 2d 73 75 62 69 74 65 6d 2d 65 6e 74 72 + 79 20 7b 0a + + ~ " dup push-subitem-entry-stack" + 20 20 20 20 20 20 20 20 20 20 64 75 70 20 70 75 + 73 68 2d 73 75 62 69 74 65 6d 2d 65 6e 74 72 79 + 2d 73 74 61 63 6b 0a + + ~ " } if" + 20 20 20 20 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-type @" + 20 20 20 20 20 20 20 20 64 75 70 20 68 65 78 2d + 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 79 2d 74 79 70 65 20 40 0a + + ~ " hex-output-metadata-entry-type-saved-data = {" + 20 20 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 74 79 70 65 2d 73 61 76 65 64 2d 64 61 74 + 61 20 3d 20 7b 0a + + ~ " ~ It's not valid to execute these, so print a" + ~ " diagnostic. They're" + 20 20 20 20 20 20 20 20 20 20 7e 20 20 20 49 74 + 27 73 20 6e 6f 74 20 76 61 6c 69 64 20 74 6f 20 + 65 78 65 63 75 74 65 20 74 68 65 73 65 2c 20 73 + 6f 20 70 72 69 6e 74 20 61 20 64 69 61 67 6e 6f + 73 74 69 63 2e 20 54 68 65 79 27 72 65 0a + + ~ " ~ supposed to always be consumed by data-*" + ~ " commands." + 20 20 20 20 20 20 20 20 20 20 7e 20 73 75 70 70 + 6f 73 65 64 20 74 6f 20 61 6c 77 61 79 73 20 62 + 65 20 63 6f 6e 73 75 6d 65 64 20 62 79 20 64 61 + 74 61 2d 2a 20 63 6f 6d 6d 61 6e 64 73 2e 0a + + ~ " ." A saved-data metadata entry leaked." newline" + 20 20 20 20 20 20 20 20 20 20 2e 22 20 41 20 73 + 61 76 65 64 2d 64 61 74 61 20 6d 65 74 61 64 61 + 74 61 20 65 6e 74 72 79 20 6c 65 61 6b 65 64 2e + 22 20 6e 65 77 6c 69 6e 65 0a + + ~ " } if" + 20 20 20 20 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-type @" + 20 20 20 20 20 20 20 20 64 75 70 20 68 65 78 2d + 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 79 2d 74 79 70 65 20 40 0a + + ~ " hex-output-metadata-entry-type-drop-subitem = {" + 20 20 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 74 79 70 65 2d 64 72 6f 70 2d 73 75 62 69 + 74 65 6d 20 3d 20 7b 0a + + ~ " pop-subitem-entry-stack drop" + 20 20 20 20 20 20 20 20 20 20 70 6f 70 2d 73 75 + 62 69 74 65 6d 2d 65 6e 74 72 79 2d 73 74 61 63 + 6b 20 64 72 6f 70 0a + + ~ " } if" + 20 20 20 20 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-type @" + 20 20 20 20 20 20 20 20 64 75 70 20 68 65 78 2d + 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 79 2d 74 79 70 65 20 40 0a + + ~ " hex-output-metadata-entry-type-swap-subitems = {" + 20 20 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 74 79 70 65 2d 73 77 61 70 2d 73 75 62 69 + 74 65 6d 73 20 3d 20 7b 0a + + ~ " ~ If we underflow the stack, we'll get zeroes" + ~ " back here. In order" + 20 20 20 20 20 20 20 20 20 20 7e 20 20 20 49 66 + 20 77 65 20 75 6e 64 65 72 66 6c 6f 77 20 74 68 + 65 20 73 74 61 63 6b 2c 20 77 65 27 6c 6c 20 67 + 65 74 20 7a 65 72 6f 65 73 20 62 61 63 6b 20 68 + 65 72 65 2e 20 49 6e 20 6f 72 64 65 72 0a + + ~ " ~ to avoid causing more confusing problems later," + ~ " we make sure to" + 20 20 20 20 20 20 20 20 20 20 7e 20 74 6f 20 61 + 76 6f 69 64 20 63 61 75 73 69 6e 67 20 6d 6f 72 + 65 20 63 6f 6e 66 75 73 69 6e 67 20 70 72 6f 62 + 6c 65 6d 73 20 6c 61 74 65 72 2c 20 77 65 20 6d + 61 6b 65 20 73 75 72 65 20 74 6f 0a + + ~ " ~ discard the zeroes instead of pushing them." + ~ " Just like in" + 20 20 20 20 20 20 20 20 20 20 7e 20 64 69 73 63 + 61 72 64 20 74 68 65 20 7a 65 72 6f 65 73 20 69 + 6e 73 74 65 61 64 20 6f 66 20 70 75 73 68 69 6e + 67 20 74 68 65 6d 2e 20 4a 75 73 74 20 6c 69 6b + 65 20 69 6e 0a + + ~ " ~ hex-emit-template-string, the reasoning is that" + ~ " it's easier to" + 20 20 20 20 20 20 20 20 20 20 7e 20 68 65 78 2d + 65 6d 69 74 2d 74 65 6d 70 6c 61 74 65 2d 73 74 + 72 69 6e 67 2c 20 74 68 65 20 72 65 61 73 6f 6e + 69 6e 67 20 69 73 20 74 68 61 74 20 69 74 27 73 + 20 65 61 73 69 65 72 20 74 6f 0a + + ~ " ~ diagnose what's wrong with this subsystem when" + ~ " it runs to" + 20 20 20 20 20 20 20 20 20 20 7e 20 64 69 61 67 + 6e 6f 73 65 20 77 68 61 74 27 73 20 77 72 6f 6e + 67 20 77 69 74 68 20 74 68 69 73 20 73 75 62 73 + 79 73 74 65 6d 20 77 68 65 6e 20 69 74 20 72 75 + 6e 73 20 74 6f 0a + + ~ " ~ completion." + 20 20 20 20 20 20 20 20 20 20 7e 20 63 6f 6d 70 + 6c 65 74 69 6f 6e 2e 0a + + ~ " pop-subitem-entry-stack" + 20 20 20 20 20 20 20 20 20 20 70 6f 70 2d 73 75 + 62 69 74 65 6d 2d 65 6e 74 72 79 2d 73 74 61 63 + 6b 0a + + ~ " pop-subitem-entry-stack" + 20 20 20 20 20 20 20 20 20 20 70 6f 70 2d 73 75 + 62 69 74 65 6d 2d 65 6e 74 72 79 2d 73 74 61 63 + 6b 0a + + ~ " swap" + 20 20 20 20 20 20 20 20 20 20 73 77 61 70 0a + + ~ " dup { push-subitem-entry-stack } { drop }" + ~ " if-else" + 20 20 20 20 20 20 20 20 20 20 64 75 70 20 7b 20 + 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 65 6e 74 + 72 79 2d 73 74 61 63 6b 20 7d 20 7b 20 64 72 6f + 70 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " dup { push-subitem-entry-stack } { drop }" + ~ " if-else" + 20 20 20 20 20 20 20 20 20 20 64 75 70 20 7b 20 + 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 65 6e 74 + 72 79 2d 73 74 61 63 6b 20 7d 20 7b 20 64 72 6f + 70 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " } if" + 20 20 20 20 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-type @" + 20 20 20 20 20 20 20 20 64 75 70 20 68 65 78 2d + 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 79 2d 74 79 70 65 20 40 0a + + ~ " hex-output-metadata-entry-type-roll-subitems = {" + 20 20 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 74 79 70 65 2d 72 6f 6c 6c 2d 73 75 62 69 + 74 65 6d 73 20 3d 20 7b 0a + + ~ " ~ The parameter giving the amount to roll by is" + ~ " in the content" + 20 20 20 20 20 20 20 20 20 20 7e 20 20 20 54 68 + 65 20 70 61 72 61 6d 65 74 65 72 20 67 69 76 69 + 6e 67 20 74 68 65 20 61 6d 6f 75 6e 74 20 74 6f + 20 72 6f 6c 6c 20 62 79 20 69 73 20 69 6e 20 74 + 68 65 20 63 6f 6e 74 65 6e 74 0a + + ~ " ~ field." + 20 20 20 20 20 20 20 20 20 20 7e 20 66 69 65 6c + 64 2e 0a + + ~ " dup hex-output-metadata-entry-content @" + 20 20 20 20 20 20 20 20 20 20 64 75 70 20 68 65 + 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 + 61 2d 65 6e 74 72 79 2d 63 6f 6e 74 65 6e 74 20 + 40 0a + + ~ " ~ (... amount to roll by)" + 20 20 20 20 20 20 20 20 20 20 7e 20 28 2e 2e 2e + 20 61 6d 6f 75 6e 74 20 74 6f 20 72 6f 6c 6c 20 + 62 79 29 0a + + ~ "" + 0a + + ~ " ~ We resist the temptation to do the memcopy" + ~ " math. We don't need" + 20 20 20 20 20 20 20 20 20 20 7e 20 20 20 57 65 + 20 72 65 73 69 73 74 20 74 68 65 20 74 65 6d 70 + 74 61 74 69 6f 6e 20 74 6f 20 64 6f 20 74 68 65 + 20 6d 65 6d 63 6f 70 79 20 6d 61 74 68 2e 20 57 + 65 20 64 6f 6e 27 74 20 6e 65 65 64 0a + + ~ " ~ to, since the regular Forth roll and unroll do" + ~ " it for us." + 20 20 20 20 20 20 20 20 20 20 7e 20 74 6f 2c 20 + 73 69 6e 63 65 20 74 68 65 20 72 65 67 75 6c 61 + 72 20 46 6f 72 74 68 20 72 6f 6c 6c 20 61 6e 64 + 20 75 6e 72 6f 6c 6c 20 64 6f 20 69 74 20 66 6f + 72 20 75 73 2e 0a + + ~ " dup 0 < {" + 20 20 20 20 20 20 20 20 20 20 64 75 70 20 30 20 + 3c 20 7b 0a + + ~ " ~ In this scenario, we're rolling. The amount" + ~ " to roll by is also" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 20 20 + 49 6e 20 74 68 69 73 20 73 63 65 6e 61 72 69 6f + 2c 20 77 65 27 72 65 20 72 6f 6c 6c 69 6e 67 2e + 20 54 68 65 20 61 6d 6f 75 6e 74 20 74 6f 20 72 + 6f 6c 6c 20 62 79 20 69 73 20 61 6c 73 6f 0a + + ~ " ~ the number of items." + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 74 68 + 65 20 6e 75 6d 62 65 72 20 6f 66 20 69 74 65 6d + 73 2e 0a + + ~ "" + 0a + + ~ " 0 { 2dup < } { pop-subitem-entry-stack 3unroll" + ~ " 1+ } while" + 20 20 20 20 20 20 20 20 20 20 20 20 30 20 7b 20 + 32 64 75 70 20 3c 20 7d 20 7b 20 70 6f 70 2d 73 + 75 62 69 74 65 6d 2d 65 6e 74 72 79 2d 73 74 61 + 63 6b 20 33 75 6e 72 6f 6c 6c 20 31 2b 20 7d 20 + 77 68 69 6c 65 0a + + ~ " drop" + 20 20 20 20 20 20 20 20 20 20 20 20 64 72 6f 70 + 0a + + ~ " ~ (... items, amount to roll by / number of" + ~ " items)" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 28 2e + 2e 2e 20 69 74 65 6d 73 2c 20 61 6d 6f 75 6e 74 + 20 74 6f 20 72 6f 6c 6c 20 62 79 20 2f 20 6e 75 + 6d 62 65 72 20 6f 66 20 69 74 65 6d 73 29 0a + + ~ "" + 0a + + ~ " ~ Please notice that the items we have popped" + ~ " from the subitem" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 20 20 + 50 6c 65 61 73 65 20 6e 6f 74 69 63 65 20 74 68 + 61 74 20 74 68 65 20 69 74 65 6d 73 20 77 65 20 + 68 61 76 65 20 70 6f 70 70 65 64 20 66 72 6f 6d + 20 74 68 65 20 73 75 62 69 74 65 6d 0a + + ~ " ~ entry stack are now, on the value stack, in" + ~ " the reverse of the" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 65 6e + 74 72 79 20 73 74 61 63 6b 20 61 72 65 20 6e 6f + 77 2c 20 6f 6e 20 74 68 65 20 76 61 6c 75 65 20 + 73 74 61 63 6b 2c 20 69 6e 20 74 68 65 20 72 65 + 76 65 72 73 65 20 6f 66 20 74 68 65 0a + + ~ " ~ order they were on the entry stack. They will" + ~ " reverse again when" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 6f 72 + 64 65 72 20 74 68 65 79 20 77 65 72 65 20 6f 6e + 20 74 68 65 20 65 6e 74 72 79 20 73 74 61 63 6b + 2e 20 54 68 65 79 20 77 69 6c 6c 20 72 65 76 65 + 72 73 65 20 61 67 61 69 6e 20 77 68 65 6e 0a + + ~ " ~ we push them back." + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 77 65 + 20 70 75 73 68 20 74 68 65 6d 20 62 61 63 6b 2e + 0a + + ~ " ~" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 0a + + ~ " ~ The amount to roll by is positive, so the" + ~ " desired operation is" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 20 20 + 54 68 65 20 61 6d 6f 75 6e 74 20 74 6f 20 72 6f + 6c 6c 20 62 79 20 69 73 20 70 6f 73 69 74 69 76 + 65 2c 20 73 6f 20 74 68 65 20 64 65 73 69 72 65 + 64 20 6f 70 65 72 61 74 69 6f 6e 20 69 73 0a + + ~ " ~ a regular roll. Since the entries are" + ~ " reversed right now, we" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 61 20 + 72 65 67 75 6c 61 72 20 72 6f 6c 6c 2e 20 53 69 + 6e 63 65 20 74 68 65 20 65 6e 74 72 69 65 73 20 + 61 72 65 20 72 65 76 65 72 73 65 64 20 72 69 67 + 68 74 20 6e 6f 77 2c 20 77 65 0a + + ~ " ~ unroll them, which will be what we want when" + ~ " we put them back." + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 75 6e + 72 6f 6c 6c 20 74 68 65 6d 2c 20 77 68 69 63 68 + 20 77 69 6c 6c 20 62 65 20 77 68 61 74 20 77 65 + 20 77 61 6e 74 20 77 68 65 6e 20 77 65 20 70 75 + 74 20 74 68 65 6d 20 62 61 63 6b 2e 0a + + ~ " ~" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 0a + + ~ " ~ Try it out interactively with a toy example" + ~ " and convince" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 20 20 + 54 72 79 20 69 74 20 6f 75 74 20 69 6e 74 65 72 + 61 63 74 69 76 65 6c 79 20 77 69 74 68 20 61 20 + 74 6f 79 20 65 78 61 6d 70 6c 65 20 61 6e 64 20 + 63 6f 6e 76 69 6e 63 65 0a + + ~ " ~ yourself. It's hard to really model in your" + ~ " head, but it's true." + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 79 6f + 75 72 73 65 6c 66 2e 20 49 74 27 73 20 68 61 72 + 64 20 74 6f 20 72 65 61 6c 6c 79 20 6d 6f 64 65 + 6c 20 69 6e 20 79 6f 75 72 20 68 65 61 64 2c 20 + 62 75 74 20 69 74 27 73 20 74 72 75 65 2e 0a + + ~ " ~ The intuition is that, if you're looking at" + ~ " the value stack," + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 54 68 + 65 20 69 6e 74 75 69 74 69 6f 6e 20 69 73 20 74 + 68 61 74 2c 20 69 66 20 79 6f 75 27 72 65 20 6c + 6f 6f 6b 69 6e 67 20 61 74 20 74 68 65 20 76 61 + 6c 75 65 20 73 74 61 63 6b 2c 0a + + ~ " ~ the bottommost item there will be the topmost" + ~ " one after" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 74 68 + 65 20 62 6f 74 74 6f 6d 6d 6f 73 74 20 69 74 65 + 6d 20 74 68 65 72 65 20 77 69 6c 6c 20 62 65 20 + 74 68 65 20 74 6f 70 6d 6f 73 74 20 6f 6e 65 20 + 61 66 74 65 72 0a + + ~ " ~ re-reversing, so we think of our operations" + ~ " as proceeding" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 72 65 + 2d 72 65 76 65 72 73 69 6e 67 2c 20 73 6f 20 77 + 65 20 74 68 69 6e 6b 20 6f 66 20 6f 75 72 20 6f + 70 65 72 61 74 69 6f 6e 73 20 61 73 20 70 72 6f + 63 65 65 64 69 6e 67 0a + + ~ " ~ up-stack from there, instead of the usual" + ~ " operations that start" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 75 70 + 2d 73 74 61 63 6b 20 66 72 6f 6d 20 74 68 65 72 + 65 2c 20 69 6e 73 74 65 61 64 20 6f 66 20 74 68 + 65 20 75 73 75 61 6c 20 6f 70 65 72 61 74 69 6f + 6e 73 20 74 68 61 74 20 73 74 61 72 74 0a + + ~ " ~ at the topmost item and proceed downwards." + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 61 74 + 20 74 68 65 20 74 6f 70 6d 6f 73 74 20 69 74 65 + 6d 20 61 6e 64 20 70 72 6f 63 65 65 64 20 64 6f + 77 6e 77 61 72 64 73 2e 0a + + ~ " ~" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 0a + + ~ " ~ Anyway, this little trick does a regular" + ~ " unroll, which acts as" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 20 20 + 41 6e 79 77 61 79 2c 20 74 68 69 73 20 6c 69 74 + 74 6c 65 20 74 72 69 63 6b 20 64 6f 65 73 20 61 + 20 72 65 67 75 6c 61 72 20 75 6e 72 6f 6c 6c 2c + 20 77 68 69 63 68 20 61 63 74 73 20 61 73 0a + + ~ " ~ a roll, and keeps the value around." + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 61 20 + 72 6f 6c 6c 2c 20 61 6e 64 20 6b 65 65 70 73 20 + 74 68 65 20 76 61 6c 75 65 20 61 72 6f 75 6e 64 + 2e 0a + + ~ " dup 3unroll 1+ unroll" + 20 20 20 20 20 20 20 20 20 20 20 20 64 75 70 20 + 33 75 6e 72 6f 6c 6c 20 31 2b 20 75 6e 72 6f 6c + 6c 0a + + ~ " } if" + 20 20 20 20 20 20 20 20 20 20 7d 20 69 66 0a + + ~ " ~ (... items if positive, amount to roll by)" + 20 20 20 20 20 20 20 20 20 20 7e 20 28 2e 2e 2e + 20 69 74 65 6d 73 20 69 66 20 70 6f 73 69 74 69 + 76 65 2c 20 61 6d 6f 75 6e 74 20 74 6f 20 72 6f + 6c 6c 20 62 79 29 0a + + ~ "" + 0a + + ~ " ~ We did the positive case first, which means" + ~ " the amount to roll" + 20 20 20 20 20 20 20 20 20 20 7e 20 20 20 57 65 + 20 64 69 64 20 74 68 65 20 70 6f 73 69 74 69 76 + 65 20 63 61 73 65 20 66 69 72 73 74 2c 20 77 68 + 69 63 68 20 6d 65 61 6e 73 20 74 68 65 20 61 6d + 6f 75 6e 74 20 74 6f 20 72 6f 6c 6c 0a + + ~ " ~ by is still its original value, regardless of" + ~ " whether that case" + 20 20 20 20 20 20 20 20 20 20 7e 20 62 79 20 69 + 73 20 73 74 69 6c 6c 20 69 74 73 20 6f 72 69 67 + 69 6e 61 6c 20 76 61 6c 75 65 2c 20 72 65 67 61 + 72 64 6c 65 73 73 20 6f 66 20 77 68 65 74 68 65 + 72 20 74 68 61 74 20 63 61 73 65 0a + + ~ " ~ ran or not. So, we can check if it's negative" + ~ " to see if we need" + 20 20 20 20 20 20 20 20 20 20 7e 20 72 61 6e 20 + 6f 72 20 6e 6f 74 2e 20 53 6f 2c 20 77 65 20 63 + 61 6e 20 63 68 65 63 6b 20 69 66 20 69 74 27 73 + 20 6e 65 67 61 74 69 76 65 20 74 6f 20 73 65 65 + 20 69 66 20 77 65 20 6e 65 65 64 0a + + ~ " ~ to do the negative case." + 20 20 20 20 20 20 20 20 20 20 7e 20 74 6f 20 64 + 6f 20 74 68 65 20 6e 65 67 61 74 69 76 65 20 63 + 61 73 65 2e 0a + + ~ " dup 0 > {" + 20 20 20 20 20 20 20 20 20 20 64 75 70 20 30 20 + 3e 20 7b 0a + + ~ " ~ In this scenario, we're unrolling. We" + ~ " negate the amount to" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 20 20 + 49 6e 20 74 68 69 73 20 73 63 65 6e 61 72 69 6f + 2c 20 77 65 27 72 65 20 75 6e 72 6f 6c 6c 69 6e + 67 2e 20 57 65 20 6e 65 67 61 74 65 20 74 68 65 + 20 61 6d 6f 75 6e 74 20 74 6f 0a + + ~ " ~ roll by to get the amount to unroll by, which" + ~ " is also the number" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 72 6f + 6c 6c 20 62 79 20 74 6f 20 67 65 74 20 74 68 65 + 20 61 6d 6f 75 6e 74 20 74 6f 20 75 6e 72 6f 6c + 6c 20 62 79 2c 20 77 68 69 63 68 20 69 73 20 61 + 6c 73 6f 20 74 68 65 20 6e 75 6d 62 65 72 0a + + ~ " ~ of items." + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 6f 66 + 20 69 74 65 6d 73 2e 0a + + ~ " negate" + 20 20 20 20 20 20 20 20 20 20 20 20 6e 65 67 61 + 74 65 0a + + ~ "" + 0a + + ~ " 0 { 2dup < } { pop-subitem-entry-stack 3unroll" + ~ " 1+ } while" + 20 20 20 20 20 20 20 20 20 20 20 20 30 20 7b 20 + 32 64 75 70 20 3c 20 7d 20 7b 20 70 6f 70 2d 73 + 75 62 69 74 65 6d 2d 65 6e 74 72 79 2d 73 74 61 + 63 6b 20 33 75 6e 72 6f 6c 6c 20 31 2b 20 7d 20 + 77 68 69 6c 65 0a + + ~ " drop" + 20 20 20 20 20 20 20 20 20 20 20 20 64 72 6f 70 + 0a + + ~ " ~ (... items, number of items)" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 28 2e + 2e 2e 20 69 74 65 6d 73 2c 20 6e 75 6d 62 65 72 + 20 6f 66 20 69 74 65 6d 73 29 0a + + ~ "" + 0a + + ~ " ~ The parameter was negative, so we were" + ~ " asked to do an unroll." + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 20 20 + 54 68 65 20 70 61 72 61 6d 65 74 65 72 20 77 61 + 73 20 6e 65 67 61 74 69 76 65 2c 20 73 6f 20 77 + 65 20 77 65 72 65 20 61 73 6b 65 64 20 74 6f 20 + 64 6f 20 61 6e 20 75 6e 72 6f 6c 6c 2e 0a + + ~ " ~ This trick does a roll, and keeps the value." + ~ " Notice that "roll"" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 54 68 + 69 73 20 74 72 69 63 6b 20 64 6f 65 73 20 61 20 + 72 6f 6c 6c 2c 20 61 6e 64 20 6b 65 65 70 73 20 + 74 68 65 20 76 61 6c 75 65 2e 20 4e 6f 74 69 63 + 65 20 74 68 61 74 20 22 72 6f 6c 6c 22 0a + + ~ " ~ always needs a positive amount." + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 61 6c + 77 61 79 73 20 6e 65 65 64 73 20 61 20 70 6f 73 + 69 74 69 76 65 20 61 6d 6f 75 6e 74 2e 0a + + ~ " dup 1+ roll swap" + 20 20 20 20 20 20 20 20 20 20 20 20 64 75 70 20 + 31 2b 20 72 6f 6c 6c 20 73 77 61 70 0a + + ~ " } if" + 20 20 20 20 20 20 20 20 20 20 7d 20 69 66 0a + + ~ " ~ (... items, number of items)" + 20 20 20 20 20 20 20 20 20 20 7e 20 28 2e 2e 2e + 20 69 74 65 6d 73 2c 20 6e 75 6d 62 65 72 20 6f + 66 20 69 74 65 6d 73 29 0a + + ~ "" + 0a + + ~ " ~ Now, regardless of which case ran, we have" + ~ " the items and we have" + 20 20 20 20 20 20 20 20 20 20 7e 20 20 20 4e 6f + 77 2c 20 72 65 67 61 72 64 6c 65 73 73 20 6f 66 + 20 77 68 69 63 68 20 63 61 73 65 20 72 61 6e 2c + 20 77 65 20 68 61 76 65 20 74 68 65 20 69 74 65 + 6d 73 20 61 6e 64 20 77 65 20 68 61 76 65 0a + + ~ " ~ a non-negative count of them. Notice that if we" + ~ " were asked to roll" + 20 20 20 20 20 20 20 20 20 20 7e 20 61 20 6e 6f + 6e 2d 6e 65 67 61 74 69 76 65 20 63 6f 75 6e 74 + 20 6f 66 20 74 68 65 6d 2e 20 4e 6f 74 69 63 65 + 20 74 68 61 74 20 69 66 20 77 65 20 77 65 72 65 + 20 61 73 6b 65 64 20 74 6f 20 72 6f 6c 6c 0a + + ~ " ~ by zero, neither case ran, but that still" + ~ " describes what we have" + 20 20 20 20 20 20 20 20 20 20 7e 20 62 79 20 7a + 65 72 6f 2c 20 6e 65 69 74 68 65 72 20 63 61 73 + 65 20 72 61 6e 2c 20 62 75 74 20 74 68 61 74 20 + 73 74 69 6c 6c 20 64 65 73 63 72 69 62 65 73 20 + 77 68 61 74 20 77 65 20 68 61 76 65 0a + + ~ " ~ accurately." + 20 20 20 20 20 20 20 20 20 20 7e 20 61 63 63 75 + 72 61 74 65 6c 79 2e 0a + + ~ "" + 0a + + ~ " ~ Now we push them back." + 20 20 20 20 20 20 20 20 20 20 7e 20 4e 6f 77 20 + 77 65 20 70 75 73 68 20 74 68 65 6d 20 62 61 63 + 6b 2e 0a + + ~ " 0 { 2dup < } {" + 20 20 20 20 20 20 20 20 20 20 30 20 7b 20 32 64 + 75 70 20 3c 20 7d 20 7b 0a + + ~ " 3roll" + 20 20 20 20 20 20 20 20 20 20 20 20 33 72 6f 6c + 6c 0a + + ~ "" + 0a + + ~ " ~ Again, if we underflowed we got zeros, and we" + ~ " discard them." + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 41 67 + 61 69 6e 2c 20 69 66 20 77 65 20 75 6e 64 65 72 + 66 6c 6f 77 65 64 20 77 65 20 67 6f 74 20 7a 65 + 72 6f 73 2c 20 61 6e 64 20 77 65 20 64 69 73 63 + 61 72 64 20 74 68 65 6d 2e 0a + + ~ " dup { push-subitem-entry-stack } { drop }" + ~ " if-else" + 20 20 20 20 20 20 20 20 20 20 20 20 64 75 70 20 + 7b 20 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 65 + 6e 74 72 79 2d 73 74 61 63 6b 20 7d 20 7b 20 64 + 72 6f 70 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ "" + 0a + + ~ " 1+" + 20 20 20 20 20 20 20 20 20 20 20 20 31 2b 0a + + ~ " } while" + 20 20 20 20 20 20 20 20 20 20 7d 20 77 68 69 6c + 65 0a + + ~ " drop drop" + 20 20 20 20 20 20 20 20 20 20 64 72 6f 70 20 64 + 72 6f 70 0a + + ~ " } if" + 20 20 20 20 20 20 20 20 7d 20 69 66 0a + + ~ " } if" + 20 20 20 20 20 20 7d 20 69 66 0a + + ~ " hex-output-metadata-next-entry" + 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 6e 65 78 74 2d 65 + 6e 74 72 79 0a + + ~ " } while" + 20 20 20 20 7d 20 77 68 69 6c 65 0a + + ~ " ~ (result, length remaining, current output address," + 20 20 20 20 7e 20 28 72 65 73 75 6c 74 2c 20 6c + 65 6e 67 74 68 20 72 65 6d 61 69 6e 69 6e 67 2c + 20 63 75 72 72 65 6e 74 20 6f 75 74 70 75 74 20 + 61 64 64 72 65 73 73 2c 0a + + ~ " ~ metadata scan pointer)" + 20 20 20 20 7e 20 20 6d 65 74 61 64 61 74 61 20 + 73 63 61 6e 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " 2 pick {" + 20 20 20 20 32 20 70 69 63 6b 20 7b 0a + + ~ " n-bytes-this-line@ 16 = {" + 20 20 20 20 20 20 6e 2d 62 79 74 65 73 2d 74 68 + 69 73 2d 6c 69 6e 65 40 20 31 36 20 3d 20 7b 0a + + ~ " newline" + 20 20 20 20 20 20 20 20 6e 65 77 6c 69 6e 65 0a + + ~ " 1 is-fresh-line!" + 20 20 20 20 20 20 20 20 31 20 69 73 2d 66 72 65 + 73 68 2d 6c 69 6e 65 21 0a + + ~ " 0 n-bytes-this-line!" + 20 20 20 20 20 20 20 20 30 20 6e 2d 62 79 74 65 + 73 2d 74 68 69 73 2d 6c 69 6e 65 21 0a + + ~ " 0 current-column!" + 20 20 20 20 20 20 20 20 30 20 63 75 72 72 65 6e + 74 2d 63 6f 6c 75 6d 6e 21 0a + + ~ " } if" + 20 20 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " is-fresh-line@ {" + 20 20 20 20 20 20 69 73 2d 66 72 65 73 68 2d 6c + 69 6e 65 40 20 7b 0a + + ~ " indentation-depth@ dup indent" + ~ " advance-current-column" + 20 20 20 20 20 20 20 20 69 6e 64 65 6e 74 61 74 + 69 6f 6e 2d 64 65 70 74 68 40 20 64 75 70 20 69 + 6e 64 65 6e 74 20 61 64 76 61 6e 63 65 2d 63 75 + 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e 0a + + ~ " } {" + 20 20 20 20 20 20 7d 20 7b 0a + + ~ " space" + 20 20 20 20 20 20 20 20 73 70 61 63 65 0a + + ~ " 1 advance-current-column" + 20 20 20 20 20 20 20 20 31 20 61 64 76 61 6e 63 + 65 2d 63 75 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e + 0a + + ~ " } if-else" + 20 20 20 20 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ "" + 0a + + ~ " over 8@ .hex8" + 20 20 20 20 20 20 6f 76 65 72 20 38 40 20 2e 68 + 65 78 38 0a + + ~ "" + 0a + + ~ " 2 advance-current-column" + 20 20 20 20 20 20 32 20 61 64 76 61 6e 63 65 2d + 63 75 72 72 65 6e 74 2d 63 6f 6c 75 6d 6e 0a + + ~ " increment-bytes-this-line" + 20 20 20 20 20 20 69 6e 63 72 65 6d 65 6e 74 2d + 62 79 74 65 73 2d 74 68 69 73 2d 6c 69 6e 65 0a + + ~ " 0 is-fresh-line!" + 20 20 20 20 20 20 30 20 69 73 2d 66 72 65 73 68 + 2d 6c 69 6e 65 21 0a + + ~ " } if" + 20 20 20 20 7d 20 69 66 0a + + ~ " ~ (result, length remaining, current output address," + 20 20 20 20 7e 20 28 72 65 73 75 6c 74 2c 20 6c + 65 6e 67 74 68 20 72 65 6d 61 69 6e 69 6e 67 2c + 20 63 75 72 72 65 6e 74 20 6f 75 74 70 75 74 20 + 61 64 64 72 65 73 73 2c 0a + + ~ " ~ metadata scan pointer)" + 20 20 20 20 7e 20 20 6d 65 74 61 64 61 74 61 20 + 73 63 61 6e 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " 3unroll 1+ swap 1- swap 3roll" + 20 20 20 20 33 75 6e 72 6f 6c 6c 20 31 2b 20 73 + 77 61 70 20 31 2d 20 73 77 61 70 20 33 72 6f 6c + 6c 0a + + ~ " } while drop ;" + 20 20 7d 20 77 68 69 6c 65 20 64 72 6f 70 20 3b + 0a + + ~ "" + 0a + + ~ "~ This has complex logic, so we do it as a trace rather" + ~ " than with magic" + 7e 20 20 20 54 68 69 73 20 68 61 73 20 63 6f 6d + 70 6c 65 78 20 6c 6f 67 69 63 2c 20 73 6f 20 77 + 65 20 64 6f 20 69 74 20 61 73 20 61 20 74 72 61 + 63 65 20 72 61 74 68 65 72 20 74 68 61 6e 20 77 + 69 74 68 20 6d 61 67 69 63 0a + + ~ "~ comments." + 7e 20 63 6f 6d 6d 65 6e 74 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (new label value, label entry pointer --)" + 7e 20 28 6e 65 77 20 6c 61 62 65 6c 20 76 61 6c + 75 65 2c 20 6c 61 62 65 6c 20 65 6e 74 72 79 20 + 70 6f 69 6e 74 65 72 20 2d 2d 29 0a + + ~ ": hex-set-label-trace" + 3a 20 68 65 78 2d 73 65 74 2d 6c 61 62 65 6c 2d + 74 72 61 63 65 0a + + ~ " ~ If the value is zero, don't bother making an entry." + ~ " There's a bunch of" + 20 20 7e 20 20 20 49 66 20 74 68 65 20 76 61 6c + 75 65 20 69 73 20 7a 65 72 6f 2c 20 64 6f 6e 27 + 74 20 62 6f 74 68 65 72 20 6d 61 6b 69 6e 67 20 + 61 6e 20 65 6e 74 72 79 2e 20 54 68 65 72 65 27 + 73 20 61 20 62 75 6e 63 68 20 6f 66 0a + + ~ " ~ unused labels set to zero and even if they were used," + ~ " showing them at the" + 20 20 7e 20 75 6e 75 73 65 64 20 6c 61 62 65 6c + 73 20 73 65 74 20 74 6f 20 7a 65 72 6f 20 61 6e + 64 20 65 76 65 6e 20 69 66 20 74 68 65 79 20 77 + 65 72 65 20 75 73 65 64 2c 20 73 68 6f 77 69 6e + 67 20 74 68 65 6d 20 61 74 20 74 68 65 0a + + ~ " ~ start of the file would not provide useful" + ~ " information." + 20 20 7e 20 73 74 61 72 74 20 6f 66 20 74 68 65 + 20 66 69 6c 65 20 77 6f 75 6c 64 20 6e 6f 74 20 + 70 72 6f 76 69 64 65 20 75 73 65 66 75 6c 20 69 + 6e 66 6f 72 6d 61 74 69 6f 6e 2e 0a + + ~ " over 0 = { drop drop exit } if" + 20 20 6f 76 65 72 20 30 20 3d 20 7b 20 64 72 6f + 70 20 64 72 6f 70 20 65 78 69 74 20 7d 20 69 66 + 0a + + ~ "" + 0a + + ~ " ~ Similarly, if the label has its non-offset bit set," + ~ " we don't need an" + 20 20 7e 20 20 20 53 69 6d 69 6c 61 72 6c 79 2c + 20 69 66 20 74 68 65 20 6c 61 62 65 6c 20 68 61 + 73 20 69 74 73 20 6e 6f 6e 2d 6f 66 66 73 65 74 + 20 62 69 74 20 73 65 74 2c 20 77 65 20 64 6f 6e + 27 74 20 6e 65 65 64 20 61 6e 0a + + ~ " ~ entry for that, either" + 20 20 7e 20 65 6e 74 72 79 20 66 6f 72 20 74 68 + 61 74 2c 20 65 69 74 68 65 72 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ It's worth noting that this bit is set by the code" + ~ " being compiled," + 20 20 7e 20 20 20 49 74 27 73 20 77 6f 72 74 68 + 20 6e 6f 74 69 6e 67 20 74 68 61 74 20 74 68 69 + 73 20 62 69 74 20 69 73 20 73 65 74 20 62 79 20 + 74 68 65 20 63 6f 64 65 20 62 65 69 6e 67 20 63 + 6f 6d 70 69 6c 65 64 2c 0a + + ~ " ~ potentially after it has already called label-set, and" + ~ " therefore after" + 20 20 7e 20 70 6f 74 65 6e 74 69 61 6c 6c 79 20 + 61 66 74 65 72 20 69 74 20 68 61 73 20 61 6c 72 + 65 61 64 79 20 63 61 6c 6c 65 64 20 6c 61 62 65 + 6c 2d 73 65 74 2c 20 61 6e 64 20 74 68 65 72 65 + 66 6f 72 65 20 61 66 74 65 72 0a + + ~ " ~ this trace. This introduces an ordering dependency," + ~ " though it's unlikely" + 20 20 7e 20 74 68 69 73 20 74 72 61 63 65 2e 20 + 54 68 69 73 20 69 6e 74 72 6f 64 75 63 65 73 20 + 61 6e 20 6f 72 64 65 72 69 6e 67 20 64 65 70 65 + 6e 64 65 6e 63 79 2c 20 74 68 6f 75 67 68 20 69 + 74 27 73 20 75 6e 6c 69 6b 65 6c 79 0a + + ~ " ~ to come up in practice because the bit is kept across" + ~ " label-loop passes" + 20 20 7e 20 74 6f 20 63 6f 6d 65 20 75 70 20 69 + 6e 20 70 72 61 63 74 69 63 65 20 62 65 63 61 75 + 73 65 20 74 68 65 20 62 69 74 20 69 73 20 6b 65 + 70 74 20 61 63 72 6f 73 73 20 6c 61 62 65 6c 2d + 6c 6f 6f 70 20 70 61 73 73 65 73 0a + + ~ " ~ and as long as there are any forward references there" + ~ " will always be at" + 20 20 7e 20 61 6e 64 20 61 73 20 6c 6f 6e 67 20 + 61 73 20 74 68 65 72 65 20 61 72 65 20 61 6e 79 + 20 66 6f 72 77 61 72 64 20 72 65 66 65 72 65 6e + 63 65 73 20 74 68 65 72 65 20 77 69 6c 6c 20 61 + 6c 77 61 79 73 20 62 65 20 61 74 0a + + ~ " ~ least two passes." + 20 20 7e 20 6c 65 61 73 74 20 74 77 6f 20 70 61 + 73 73 65 73 2e 0a + + ~ " dup is-label-non-offset { drop drop exit } if" + 20 20 64 75 70 20 69 73 2d 6c 61 62 65 6c 2d 6e + 6f 6e 2d 6f 66 66 73 65 74 20 7b 20 64 72 6f 70 + 20 64 72 6f 70 20 65 78 69 74 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ Recall that label values are offsets within the" + ~ " output file. This is not" + 20 20 7e 20 20 20 52 65 63 61 6c 6c 20 74 68 61 + 74 20 6c 61 62 65 6c 20 76 61 6c 75 65 73 20 61 + 72 65 20 6f 66 66 73 65 74 73 20 77 69 74 68 69 + 6e 20 74 68 65 20 6f 75 74 70 75 74 20 66 69 6c + 65 2e 20 54 68 69 73 20 69 73 20 6e 6f 74 0a + + ~ " ~ otherwise a requirement, compiled code can use their" + ~ " values for anything" + 20 20 7e 20 6f 74 68 65 72 77 69 73 65 20 61 20 + 72 65 71 75 69 72 65 6d 65 6e 74 2c 20 63 6f 6d + 70 69 6c 65 64 20 63 6f 64 65 20 63 61 6e 20 75 + 73 65 20 74 68 65 69 72 20 76 61 6c 75 65 73 20 + 66 6f 72 20 61 6e 79 74 68 69 6e 67 0a + + ~ " ~ it wants, but the label transform treats them as" + ~ " offsets and so does the" + 20 20 7e 20 69 74 20 77 61 6e 74 73 2c 20 62 75 + 74 20 74 68 65 20 6c 61 62 65 6c 20 74 72 61 6e + 73 66 6f 72 6d 20 74 72 65 61 74 73 20 74 68 65 + 6d 20 61 73 20 6f 66 66 73 65 74 73 20 61 6e 64 + 20 73 6f 20 64 6f 65 73 20 74 68 65 0a + + ~ " ~ ELF code." + 20 20 7e 20 45 4c 46 20 63 6f 64 65 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ We want to create metadata entries associated with" + ~ " that offset; recall" + 20 20 7e 20 20 20 57 65 20 77 61 6e 74 20 74 6f + 20 63 72 65 61 74 65 20 6d 65 74 61 64 61 74 61 + 20 65 6e 74 72 69 65 73 20 61 73 73 6f 63 69 61 + 74 65 64 20 77 69 74 68 20 74 68 61 74 20 6f 66 + 66 73 65 74 3b 20 72 65 63 61 6c 6c 0a + + ~ " ~ also that entries' data starts are host addresses which" + ~ " must be within" + 20 20 7e 20 61 6c 73 6f 20 74 68 61 74 20 65 6e + 74 72 69 65 73 27 20 64 61 74 61 20 73 74 61 72 + 74 73 20 61 72 65 20 68 6f 73 74 20 61 64 64 72 + 65 73 73 65 73 20 77 68 69 63 68 20 6d 75 73 74 + 20 62 65 20 77 69 74 68 69 6e 0a + + ~ " ~ the label-loop buffer. So..." + 20 20 7e 20 74 68 65 20 6c 61 62 65 6c 2d 6c 6f + 6f 70 20 62 75 66 66 65 72 2e 20 53 6f 2e 2e 2e + 0a + + ~ " over" + 20 20 6f 76 65 72 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-label-loop-buffer-start @ +" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 6c 61 62 65 6c 2d 6c 6f 6f 70 + 2d 62 75 66 66 65 72 2d 73 74 61 72 74 20 40 20 + 2b 0a + + ~ " 0" + 20 20 30 0a + + ~ " ~ (new label value, label entry pointer, entry data" + ~ " start," + 20 20 7e 20 28 6e 65 77 20 6c 61 62 65 6c 20 76 + 61 6c 75 65 2c 20 6c 61 62 65 6c 20 65 6e 74 72 + 79 20 70 6f 69 6e 74 65 72 2c 20 65 6e 74 72 79 + 20 64 61 74 61 20 73 74 61 72 74 2c 0a + + ~ " ~ entry data length)" + 20 20 7e 20 20 65 6e 74 72 79 20 64 61 74 61 20 + 6c 65 6e 67 74 68 29 0a + + ~ "" + 0a + + ~ " 2dup hex-output-metadata-entry-type-push-subitem-hex64 7" + ~ " roll" + 20 20 32 64 75 70 20 68 65 78 2d 6f 75 74 70 75 + 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 + 2d 74 79 70 65 2d 70 75 73 68 2d 73 75 62 69 74 + 65 6d 2d 68 65 78 36 34 20 37 20 72 6f 6c 6c 0a + + ~ " add-hex-output-metadata-entry" + 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ " ~ (label entry pointer, entry data start, entry data" + ~ " length)" + 20 20 7e 20 28 6c 61 62 65 6c 20 65 6e 74 72 79 + 20 70 6f 69 6e 74 65 72 2c 20 65 6e 74 72 79 20 + 64 61 74 61 20 73 74 61 72 74 2c 20 65 6e 74 72 + 79 20 64 61 74 61 20 6c 65 6e 67 74 68 29 0a + + ~ "" + 0a + + ~ " over hex-output-metadata-entry-type-push-subitem-string" + 20 20 6f 76 65 72 20 68 65 78 2d 6f 75 74 70 75 + 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 + 2d 74 79 70 65 2d 70 75 73 68 2d 73 75 62 69 74 + 65 6d 2d 73 74 72 69 6e 67 0a + + ~ " 5 roll entry-to-name" + 20 20 35 20 72 6f 6c 6c 20 65 6e 74 72 79 2d 74 + 6f 2d 6e 61 6d 65 0a + + ~ " dup stringlen 3unroll" + 20 20 64 75 70 20 73 74 72 69 6e 67 6c 65 6e 20 + 33 75 6e 72 6f 6c 6c 0a + + ~ "" + 0a + + ~ " swap-transform-variables here @ swap-transform-variables" + ~ " dup 3unroll" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 20 68 65 72 65 20 + 40 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 20 64 75 70 20 33 + 75 6e 72 6f 6c 6c 0a + + ~ " ~ (copy, original, copy)" + 20 20 7e 20 28 63 6f 70 79 2c 20 6f 72 69 67 69 + 6e 61 6c 2c 20 63 6f 70 79 29 0a + + ~ " over stringlen 1+ memcopy" + 20 20 6f 76 65 72 20 73 74 72 69 6e 67 6c 65 6e + 20 31 2b 20 6d 65 6d 63 6f 70 79 0a + + ~ " swap-transform-variables allocate-string" + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 20 61 6c 6c 6f 63 + 61 74 65 2d 73 74 72 69 6e 67 20 73 77 61 70 2d + 74 72 61 6e 73 66 6f 72 6d 2d 76 61 72 69 61 62 + 6c 65 73 0a + + ~ " add-hex-output-metadata-entry" + 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ "" + 0a + + ~ " hex-output-metadata-entry-type-line-comment" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 6c 69 6e 65 2d 63 6f 6d 6d 65 6e 74 0a + + ~ " s" label # at offset # is here."" + 20 20 73 22 20 6c 61 62 65 6c 20 23 20 61 74 20 + 6f 66 66 73 65 74 20 23 20 69 73 20 68 65 72 65 + 2e 22 0a + + ~ " add-hex-output-metadata-entry ;" + 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 20 + 3b 0a + + ~ "" + 0a + + ~ "~ (data start, data length --)" + 7e 20 28 64 61 74 61 20 73 74 61 72 74 2c 20 64 + 61 74 61 20 6c 65 6e 67 74 68 20 2d 2d 29 0a + + ~ ": hex-pack-trace" + 3a 20 68 65 78 2d 70 61 63 6b 2d 74 72 61 63 65 + 0a + + ~ " ~ We keep a running tally of the next address in the" + ~ " output, for the" + 20 20 7e 20 20 20 57 65 20 6b 65 65 70 20 61 20 + 72 75 6e 6e 69 6e 67 20 74 61 6c 6c 79 20 6f 66 + 20 74 68 65 20 6e 65 78 74 20 61 64 64 72 65 73 + 73 20 69 6e 20 74 68 65 20 6f 75 74 70 75 74 2c + 20 66 6f 72 20 74 68 65 0a + + ~ " ~ benefit of hex-tilde-replacement, which needs to know" + ~ " where to attach its" + 20 20 7e 20 62 65 6e 65 66 69 74 20 6f 66 20 68 + 65 78 2d 74 69 6c 64 65 2d 72 65 70 6c 61 63 65 + 6d 65 6e 74 2c 20 77 68 69 63 68 20 6e 65 65 64 + 73 20 74 6f 20 6b 6e 6f 77 20 77 68 65 72 65 20 + 74 6f 20 61 74 74 61 63 68 20 69 74 73 0a + + ~ " ~ metadata entries." + 20 20 7e 20 6d 65 74 61 64 61 74 61 20 65 6e 74 + 72 69 65 73 2e 0a + + ~ " +" + 20 20 2b 0a + + ~ " dup is-in-label-loop-buffer {" + 20 20 64 75 70 20 69 73 2d 69 6e 2d 6c 61 62 65 + 6c 2d 6c 6f 6f 70 2d 62 75 66 66 65 72 20 7b 0a + + ~ " transformation-state" + ~ " transformation-state-output-metadata @" + 20 20 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 + 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 + 74 70 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-latest-output-point !" + 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 6c 61 74 65 73 74 2d 6f + 75 74 70 75 74 2d 70 6f 69 6e 74 20 21 0a + + ~ " } { drop } if-else ;" + 20 20 7d 20 7b 20 64 72 6f 70 20 7d 20 69 66 2d + 65 6c 73 65 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Conveniently, this is both the maximum normal length of" + ~ " a line of text in" + 7e 20 20 20 43 6f 6e 76 65 6e 69 65 6e 74 6c 79 + 2c 20 74 68 69 73 20 69 73 20 62 6f 74 68 20 74 + 68 65 20 6d 61 78 69 6d 75 6d 20 6e 6f 72 6d 61 + 6c 20 6c 65 6e 67 74 68 20 6f 66 20 61 20 6c 69 + 6e 65 20 6f 66 20 74 65 78 74 20 69 6e 0a + + ~ "~ Evocation's source per our informal style rules, and an" + ~ " exact multiple of" + 7e 20 45 76 6f 63 61 74 69 6f 6e 27 73 20 73 6f + 75 72 63 65 20 70 65 72 20 6f 75 72 20 69 6e 66 + 6f 72 6d 61 6c 20 73 74 79 6c 65 20 72 75 6c 65 + 73 2c 20 61 6e 64 20 61 6e 20 65 78 61 63 74 20 + 6d 75 6c 74 69 70 6c 65 20 6f 66 0a + + ~ "~ the number of bytes we wrap to in the hex part of the" + ~ " output. That's" + 7e 20 74 68 65 20 6e 75 6d 62 65 72 20 6f 66 20 + 62 79 74 65 73 20 77 65 20 77 72 61 70 20 74 6f + 20 69 6e 20 74 68 65 20 68 65 78 20 70 61 72 74 + 20 6f 66 20 74 68 65 20 6f 75 74 70 75 74 2e 20 + 54 68 61 74 27 73 0a + + ~ "~ sixteen, and 16 * 5 is 80." + 7e 20 73 69 78 74 65 65 6e 2c 20 61 6e 64 20 31 + 36 20 2a 20 35 20 69 73 20 38 30 2e 0a + + ~ ": long-string-threshold 80 ;" + 3a 20 6c 6f 6e 67 2d 73 74 72 69 6e 67 2d 74 68 + 72 65 73 68 6f 6c 64 20 38 30 20 3b 0a + + ~ "" + 0a + + ~ "~ Nothing particularly poetic about this number. It must" + ~ " be smaller than" + 7e 20 20 20 4e 6f 74 68 69 6e 67 20 70 61 72 74 + 69 63 75 6c 61 72 6c 79 20 70 6f 65 74 69 63 20 + 61 62 6f 75 74 20 74 68 69 73 20 6e 75 6d 62 65 + 72 2e 20 49 74 20 6d 75 73 74 20 62 65 20 73 6d + 61 6c 6c 65 72 20 74 68 61 6e 0a + + ~ "~ long-string-threshold by enough that there's room for" + ~ " indentation, quotation" + 7e 20 6c 6f 6e 67 2d 73 74 72 69 6e 67 2d 74 68 + 72 65 73 68 6f 6c 64 20 62 79 20 65 6e 6f 75 67 + 68 20 74 68 61 74 20 74 68 65 72 65 27 73 20 72 + 6f 6f 6d 20 66 6f 72 20 69 6e 64 65 6e 74 61 74 + 69 6f 6e 2c 20 71 75 6f 74 61 74 69 6f 6e 0a + + ~ "~ marks, and other such niceties. That's the only formal" + ~ " constraint." + 7e 20 6d 61 72 6b 73 2c 20 61 6e 64 20 6f 74 68 + 65 72 20 73 75 63 68 20 6e 69 63 65 74 69 65 73 + 2e 20 54 68 61 74 27 73 20 74 68 65 20 6f 6e 6c + 79 20 66 6f 72 6d 61 6c 20 63 6f 6e 73 74 72 61 + 69 6e 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ However, it's not aesthetically pleasing to make the" + ~ " thresholds too close" + 7e 20 20 20 48 6f 77 65 76 65 72 2c 20 69 74 27 + 73 20 6e 6f 74 20 61 65 73 74 68 65 74 69 63 61 + 6c 6c 79 20 70 6c 65 61 73 69 6e 67 20 74 6f 20 + 6d 61 6b 65 20 74 68 65 20 74 68 72 65 73 68 6f + 6c 64 73 20 74 6f 6f 20 63 6c 6f 73 65 0a + + ~ "~ together, because that results in a lot of lines being" + ~ " wrapped into one" + 7e 20 74 6f 67 65 74 68 65 72 2c 20 62 65 63 61 + 75 73 65 20 74 68 61 74 20 72 65 73 75 6c 74 73 + 20 69 6e 20 61 20 6c 6f 74 20 6f 66 20 6c 69 6e + 65 73 20 62 65 69 6e 67 20 77 72 61 70 70 65 64 + 20 69 6e 74 6f 20 6f 6e 65 0a + + ~ "~ which is quite long and one which is quite short." + 7e 20 77 68 69 63 68 20 69 73 20 71 75 69 74 65 + 20 6c 6f 6e 67 20 61 6e 64 20 6f 6e 65 20 77 68 + 69 63 68 20 69 73 20 71 75 69 74 65 20 73 68 6f + 72 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ So, this smaller value was chosen by trial and error to" + ~ " not lead the eye" + 7e 20 20 20 53 6f 2c 20 74 68 69 73 20 73 6d 61 + 6c 6c 65 72 20 76 61 6c 75 65 20 77 61 73 20 63 + 68 6f 73 65 6e 20 62 79 20 74 72 69 61 6c 20 61 + 6e 64 20 65 72 72 6f 72 20 74 6f 20 6e 6f 74 20 + 6c 65 61 64 20 74 68 65 20 65 79 65 0a + + ~ "~ around too much." + 7e 20 61 72 6f 75 6e 64 20 74 6f 6f 20 6d 75 63 + 68 2e 0a + + ~ ": long-string-comment-wrap-threshold 60 ;" + 3a 20 6c 6f 6e 67 2d 73 74 72 69 6e 67 2d 63 6f + 6d 6d 65 6e 74 2d 77 72 61 70 2d 74 68 72 65 73 + 68 6f 6c 64 20 36 30 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Choose where to line-wrap a string. This is for the" + ~ " outer loop, as" + 7e 20 20 20 43 68 6f 6f 73 65 20 77 68 65 72 65 + 20 74 6f 20 6c 69 6e 65 2d 77 72 61 70 20 61 20 + 73 74 72 69 6e 67 2e 20 54 68 69 73 20 69 73 20 + 66 6f 72 20 74 68 65 20 6f 75 74 65 72 20 6c 6f + 6f 70 2c 20 61 73 0a + + ~ "~ described in hex-packstring-trace, below. If the string" + ~ " contains any" + 7e 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 68 + 65 78 2d 70 61 63 6b 73 74 72 69 6e 67 2d 74 72 + 61 63 65 2c 20 62 65 6c 6f 77 2e 20 49 66 20 74 + 68 65 20 73 74 72 69 6e 67 20 63 6f 6e 74 61 69 + 6e 73 20 61 6e 79 0a + + ~ "~ newlines, this breaks immediately after the first." + ~ " Otherwise, it doesn't" + 7e 20 6e 65 77 6c 69 6e 65 73 2c 20 74 68 69 73 + 20 62 72 65 61 6b 73 20 69 6d 6d 65 64 69 61 74 + 65 6c 79 20 61 66 74 65 72 20 74 68 65 20 66 69 + 72 73 74 2e 20 4f 74 68 65 72 77 69 73 65 2c 20 + 69 74 20 64 6f 65 73 6e 27 74 0a + + ~ "~ break." + 7e 20 62 72 65 61 6b 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Note that our caller has already bitten off a maximum" + ~ " length that does not" + 7e 20 20 20 4e 6f 74 65 20 74 68 61 74 20 6f 75 + 72 20 63 61 6c 6c 65 72 20 68 61 73 20 61 6c 72 + 65 61 64 79 20 62 69 74 74 65 6e 20 6f 66 66 20 + 61 20 6d 61 78 69 6d 75 6d 20 6c 65 6e 67 74 68 + 20 74 68 61 74 20 64 6f 65 73 20 6e 6f 74 0a + + ~ "~ exceed long-string-threshold, so if this word chooses to" + ~ " not wrap, there's" + 7e 20 65 78 63 65 65 64 20 6c 6f 6e 67 2d 73 74 + 72 69 6e 67 2d 74 68 72 65 73 68 6f 6c 64 2c 20 + 73 6f 20 69 66 20 74 68 69 73 20 77 6f 72 64 20 + 63 68 6f 6f 73 65 73 20 74 6f 20 6e 6f 74 20 77 + 72 61 70 2c 20 74 68 65 72 65 27 73 0a + + ~ "~ still fallback wrapping in place." + 7e 20 73 74 69 6c 6c 20 66 61 6c 6c 62 61 63 6b + 20 77 72 61 70 70 69 6e 67 20 69 6e 20 70 6c 61 + 63 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (string pointer, maximum length -- chosen length)" + 7e 20 28 73 74 72 69 6e 67 20 70 6f 69 6e 74 65 + 72 2c 20 6d 61 78 69 6d 75 6d 20 6c 65 6e 67 74 + 68 20 2d 2d 20 63 68 6f 73 65 6e 20 6c 65 6e 67 + 74 68 29 0a + + ~ ": choose-string-outer-break-point" + 3a 20 63 68 6f 6f 73 65 2d 73 74 72 69 6e 67 2d + 6f 75 74 65 72 2d 62 72 65 61 6b 2d 70 6f 69 6e + 74 0a + + ~ " ~ If the maximum length is zero, do nothing." + 20 20 7e 20 49 66 20 74 68 65 20 6d 61 78 69 6d + 75 6d 20 6c 65 6e 67 74 68 20 69 73 20 7a 65 72 + 6f 2c 20 64 6f 20 6e 6f 74 68 69 6e 67 2e 0a + + ~ " dup {" + 20 20 64 75 70 20 7b 0a + + ~ " ~ Scan forward from the start for a newline." + 20 20 20 20 7e 20 53 63 61 6e 20 66 6f 72 77 61 + 72 64 20 66 72 6f 6d 20 74 68 65 20 73 74 61 72 + 74 20 66 6f 72 20 61 20 6e 65 77 6c 69 6e 65 2e + 0a + + ~ " 0 { 2dup 1+ < } {" + 20 20 20 20 30 20 7b 20 32 64 75 70 20 31 2b 20 + 3c 20 7d 20 7b 0a + + ~ " ~ (string pointer, maximum length, offset)" + 20 20 20 20 20 20 7e 20 28 73 74 72 69 6e 67 20 + 70 6f 69 6e 74 65 72 2c 20 6d 61 78 69 6d 75 6d + 20 6c 65 6e 67 74 68 2c 20 6f 66 66 73 65 74 29 + 0a + + ~ " 2 pick over + 8@ 0x0a = {" + 20 20 20 20 20 20 32 20 70 69 63 6b 20 6f 76 65 + 72 20 2b 20 38 40 20 30 78 30 61 20 3d 20 7b 0a + + ~ " 3unroll 2drop 1+ exit" + 20 20 20 20 20 20 20 20 33 75 6e 72 6f 6c 6c 20 + 32 64 72 6f 70 20 31 2b 20 65 78 69 74 0a + + ~ " } if" + 20 20 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ (string pointer, maximum length, offset)" + 20 20 20 20 20 20 7e 20 28 73 74 72 69 6e 67 20 + 70 6f 69 6e 74 65 72 2c 20 6d 61 78 69 6d 75 6d + 20 6c 65 6e 67 74 68 2c 20 6f 66 66 73 65 74 29 + 0a + + ~ " 1+" + 20 20 20 20 20 20 31 2b 0a + + ~ " } while drop" + 20 20 20 20 7d 20 77 68 69 6c 65 20 64 72 6f 70 + 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ No case matched, so choose the maximum length." + 20 20 7e 20 4e 6f 20 63 61 73 65 20 6d 61 74 63 + 68 65 64 2c 20 73 6f 20 63 68 6f 6f 73 65 20 74 + 68 65 20 6d 61 78 69 6d 75 6d 20 6c 65 6e 67 74 + 68 2e 0a + + ~ " swap drop ;" + 20 20 73 77 61 70 20 64 72 6f 70 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Choose where to line-wrap a string. This is for the" + ~ " inner loop, as" + 7e 20 20 20 43 68 6f 6f 73 65 20 77 68 65 72 65 + 20 74 6f 20 6c 69 6e 65 2d 77 72 61 70 20 61 20 + 73 74 72 69 6e 67 2e 20 54 68 69 73 20 69 73 20 + 66 6f 72 20 74 68 65 20 69 6e 6e 65 72 20 6c 6f + 6f 70 2c 20 61 73 0a + + ~ "~ described in hex-packstring-trace, below. If the string" + ~ " is shorter than" + 7e 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 68 + 65 78 2d 70 61 63 6b 73 74 72 69 6e 67 2d 74 72 + 61 63 65 2c 20 62 65 6c 6f 77 2e 20 49 66 20 74 + 68 65 20 73 74 72 69 6e 67 20 69 73 20 73 68 6f + 72 74 65 72 20 74 68 61 6e 0a + + ~ "~ long-string-comment-wrap-threshold, it is returned" + ~ " without wrapping." + 7e 20 6c 6f 6e 67 2d 73 74 72 69 6e 67 2d 63 6f + 6d 6d 65 6e 74 2d 77 72 61 70 2d 74 68 72 65 73 + 68 6f 6c 64 2c 20 69 74 20 69 73 20 72 65 74 75 + 72 6e 65 64 20 77 69 74 68 6f 75 74 20 77 72 61 + 70 70 69 6e 67 2e 0a + + ~ "~ Otherwise, if it contains any spaces prior to that" + ~ " threshold, it is broken" + 7e 20 4f 74 68 65 72 77 69 73 65 2c 20 69 66 20 + 69 74 20 63 6f 6e 74 61 69 6e 73 20 61 6e 79 20 + 73 70 61 63 65 73 20 70 72 69 6f 72 20 74 6f 20 + 74 68 61 74 20 74 68 72 65 73 68 6f 6c 64 2c 20 + 69 74 20 69 73 20 62 72 6f 6b 65 6e 0a + + ~ "~ immediately before the last. If neither condition" + ~ " applies, the string is" + 7e 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 62 65 + 66 6f 72 65 20 74 68 65 20 6c 61 73 74 2e 20 49 + 66 20 6e 65 69 74 68 65 72 20 63 6f 6e 64 69 74 + 69 6f 6e 20 61 70 70 6c 69 65 73 2c 20 74 68 65 + 20 73 74 72 69 6e 67 20 69 73 0a + + ~ "~ broken at the threshold despite this being notionally" + ~ " mid-word." + 7e 20 62 72 6f 6b 65 6e 20 61 74 20 74 68 65 20 + 74 68 72 65 73 68 6f 6c 64 20 64 65 73 70 69 74 + 65 20 74 68 69 73 20 62 65 69 6e 67 20 6e 6f 74 + 69 6f 6e 61 6c 6c 79 20 6d 69 64 2d 77 6f 72 64 + 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (string pointer, maximum length -- chosen length)" + 7e 20 28 73 74 72 69 6e 67 20 70 6f 69 6e 74 65 + 72 2c 20 6d 61 78 69 6d 75 6d 20 6c 65 6e 67 74 + 68 20 2d 2d 20 63 68 6f 73 65 6e 20 6c 65 6e 67 + 74 68 29 0a + + ~ ": choose-string-inner-break-point" + 3a 20 63 68 6f 6f 73 65 2d 73 74 72 69 6e 67 2d + 69 6e 6e 65 72 2d 62 72 65 61 6b 2d 70 6f 69 6e + 74 0a + + ~ " ~ If the maximum length is less than the threshold, do" + ~ " nothing." + 20 20 7e 20 49 66 20 74 68 65 20 6d 61 78 69 6d + 75 6d 20 6c 65 6e 67 74 68 20 69 73 20 6c 65 73 + 73 20 74 68 61 6e 20 74 68 65 20 74 68 72 65 73 + 68 6f 6c 64 2c 20 64 6f 20 6e 6f 74 68 69 6e 67 + 2e 0a + + ~ " dup long-string-comment-wrap-threshold <= {" + 20 20 64 75 70 20 6c 6f 6e 67 2d 73 74 72 69 6e + 67 2d 63 6f 6d 6d 65 6e 74 2d 77 72 61 70 2d 74 + 68 72 65 73 68 6f 6c 64 20 3c 3d 20 7b 0a + + ~ " long-string-comment-wrap-threshold 1- { dup 1 < } {" + 20 20 20 20 6c 6f 6e 67 2d 73 74 72 69 6e 67 2d + 63 6f 6d 6d 65 6e 74 2d 77 72 61 70 2d 74 68 72 + 65 73 68 6f 6c 64 20 31 2d 20 7b 20 64 75 70 20 + 31 20 3c 20 7d 20 7b 0a + + ~ " ~ (string pointer, maximum length, offset)" + 20 20 20 20 20 20 7e 20 28 73 74 72 69 6e 67 20 + 70 6f 69 6e 74 65 72 2c 20 6d 61 78 69 6d 75 6d + 20 6c 65 6e 67 74 68 2c 20 6f 66 66 73 65 74 29 + 0a + + ~ " 2 pick over + 8@ 0x20 = {" + 20 20 20 20 20 20 32 20 70 69 63 6b 20 6f 76 65 + 72 20 2b 20 38 40 20 30 78 32 30 20 3d 20 7b 0a + + ~ " 3unroll 2drop exit" + 20 20 20 20 20 20 20 20 33 75 6e 72 6f 6c 6c 20 + 32 64 72 6f 70 20 65 78 69 74 0a + + ~ " } if" + 20 20 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ (string pointer, maximum length, offset)" + 20 20 20 20 20 20 7e 20 28 73 74 72 69 6e 67 20 + 70 6f 69 6e 74 65 72 2c 20 6d 61 78 69 6d 75 6d + 20 6c 65 6e 67 74 68 2c 20 6f 66 66 73 65 74 29 + 0a + + ~ " 1-" + 20 20 20 20 20 20 31 2d 0a + + ~ " } while drop" + 20 20 20 20 7d 20 77 68 69 6c 65 20 64 72 6f 70 + 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ No case matched, so fall back to hard-wrapping at the" + ~ " threshold." + 20 20 7e 20 4e 6f 20 63 61 73 65 20 6d 61 74 63 + 68 65 64 2c 20 73 6f 20 66 61 6c 6c 20 62 61 63 + 6b 20 74 6f 20 68 61 72 64 2d 77 72 61 70 70 69 + 6e 67 20 61 74 20 74 68 65 20 74 68 72 65 73 68 + 6f 6c 64 2e 0a + + ~ " swap drop long-string-comment-wrap-threshold min ;" + 20 20 73 77 61 70 20 64 72 6f 70 20 6c 6f 6e 67 + 2d 73 74 72 69 6e 67 2d 63 6f 6d 6d 65 6e 74 2d + 77 72 61 70 2d 74 68 72 65 73 68 6f 6c 64 20 6d + 69 6e 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ The code in hex-packstring-trace, below, is broken into" + ~ " two cases, one for" + 7e 20 20 20 54 68 65 20 63 6f 64 65 20 69 6e 20 + 68 65 78 2d 70 61 63 6b 73 74 72 69 6e 67 2d 74 + 72 61 63 65 2c 20 62 65 6c 6f 77 2c 20 69 73 20 + 62 72 6f 6b 65 6e 20 69 6e 74 6f 20 74 77 6f 20 + 63 61 73 65 73 2c 20 6f 6e 65 20 66 6f 72 0a + + ~ "~ ordinary strings and one for very long strings that need" + ~ " special formatting." + 7e 20 6f 72 64 69 6e 61 72 79 20 73 74 72 69 6e + 67 73 20 61 6e 64 20 6f 6e 65 20 66 6f 72 20 76 + 65 72 79 20 6c 6f 6e 67 20 73 74 72 69 6e 67 73 + 20 74 68 61 74 20 6e 65 65 64 20 73 70 65 63 69 + 61 6c 20 66 6f 72 6d 61 74 74 69 6e 67 2e 0a + + ~ "~ Most of its complexity pertains to iteration structure;" + ~ " the logic of" + 7e 20 4d 6f 73 74 20 6f 66 20 69 74 73 20 63 6f + 6d 70 6c 65 78 69 74 79 20 70 65 72 74 61 69 6e + 73 20 74 6f 20 69 74 65 72 61 74 69 6f 6e 20 73 + 74 72 75 63 74 75 72 65 3b 20 74 68 65 20 6c 6f + 67 69 63 20 6f 66 0a + + ~ "~ actually creating metadata entries has been deferred to" + ~ " helpers. This helper" + 7e 20 61 63 74 75 61 6c 6c 79 20 63 72 65 61 74 + 69 6e 67 20 6d 65 74 61 64 61 74 61 20 65 6e 74 + 72 69 65 73 20 68 61 73 20 62 65 65 6e 20 64 65 + 66 65 72 72 65 64 20 74 6f 20 68 65 6c 70 65 72 + 73 2e 20 54 68 69 73 20 68 65 6c 70 65 72 0a + + ~ "~ handles the short-string case." + 7e 20 68 61 6e 64 6c 65 73 20 74 68 65 20 73 68 + 6f 72 74 2d 73 74 72 69 6e 67 20 63 61 73 65 2e + 0a + + ~ "~" + 7e 0a + + ~ "~ There is only one call to this helper per string, since" + ~ " that's all that's" + 7e 20 20 20 54 68 65 72 65 20 69 73 20 6f 6e 6c + 79 20 6f 6e 65 20 63 61 6c 6c 20 74 6f 20 74 68 + 69 73 20 68 65 6c 70 65 72 20 70 65 72 20 73 74 + 72 69 6e 67 2c 20 73 69 6e 63 65 20 74 68 61 74 + 27 73 20 61 6c 6c 20 74 68 61 74 27 73 0a + + ~ "~ needed." + 7e 20 6e 65 65 64 65 64 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (output point, string length, string pointer --)" + 7e 20 28 6f 75 74 70 75 74 20 70 6f 69 6e 74 2c + 20 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 2c 20 + 73 74 72 69 6e 67 20 70 6f 69 6e 74 65 72 20 2d + 2d 29 0a + + ~ ": add-short-string-entry-pair" + 3a 20 61 64 64 2d 73 68 6f 72 74 2d 73 74 72 69 + 6e 67 2d 65 6e 74 72 79 2d 70 61 69 72 0a + + ~ " drop 2dup over" + 20 20 64 72 6f 70 20 32 64 75 70 20 6f 76 65 72 + 0a + + ~ " ~ (output point, string length, output point, string" + ~ " length, output point)" + 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f 69 6e + 74 2c 20 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 + 2c 20 6f 75 74 70 75 74 20 70 6f 69 6e 74 2c 20 + 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 2c 20 6f + 75 74 70 75 74 20 70 6f 69 6e 74 29 0a + + ~ " hex-output-metadata-entry-type-push-subitem-string swap" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 73 74 + 72 69 6e 67 20 73 77 61 70 0a + + ~ " add-hex-output-metadata-entry" + 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ " ~ (output point, string length)" + 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f 69 6e + 74 2c 20 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 + 29 0a + + ~ " hex-output-metadata-entry-type-line-comment" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 6c 69 6e 65 2d 63 6f 6d 6d 65 6e 74 0a + + ~ " s" '#' (string literal with null)"" + 20 20 73 22 20 27 23 27 20 20 20 28 73 74 72 69 + 6e 67 20 6c 69 74 65 72 61 6c 20 77 69 74 68 20 + 6e 75 6c 6c 29 22 0a + + ~ " add-hex-output-metadata-entry ;" + 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 20 + 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ The code in hex-packstring-trace, below, is broken into" + ~ " two cases, one for" + 7e 20 20 20 54 68 65 20 63 6f 64 65 20 69 6e 20 + 68 65 78 2d 70 61 63 6b 73 74 72 69 6e 67 2d 74 + 72 61 63 65 2c 20 62 65 6c 6f 77 2c 20 69 73 20 + 62 72 6f 6b 65 6e 20 69 6e 74 6f 20 74 77 6f 20 + 63 61 73 65 73 2c 20 6f 6e 65 20 66 6f 72 0a + + ~ "~ ordinary strings and one for very long strings that need" + ~ " special formatting." + 7e 20 6f 72 64 69 6e 61 72 79 20 73 74 72 69 6e + 67 73 20 61 6e 64 20 6f 6e 65 20 66 6f 72 20 76 + 65 72 79 20 6c 6f 6e 67 20 73 74 72 69 6e 67 73 + 20 74 68 61 74 20 6e 65 65 64 20 73 70 65 63 69 + 61 6c 20 66 6f 72 6d 61 74 74 69 6e 67 2e 0a + + ~ "~ The long-string case begins by outputting a fixed set of" + ~ " entries that" + 7e 20 54 68 65 20 6c 6f 6e 67 2d 73 74 72 69 6e + 67 20 63 61 73 65 20 62 65 67 69 6e 73 20 62 79 + 20 6f 75 74 70 75 74 74 69 6e 67 20 61 20 66 69 + 78 65 64 20 73 65 74 20 6f 66 20 65 6e 74 72 69 + 65 73 20 74 68 61 74 0a + + ~ "~ describe, to the reader, what's about to happen. This" + ~ " helper produces those" + 7e 20 64 65 73 63 72 69 62 65 2c 20 74 6f 20 74 + 68 65 20 72 65 61 64 65 72 2c 20 77 68 61 74 27 + 73 20 61 62 6f 75 74 20 74 6f 20 68 61 70 70 65 + 6e 2e 20 54 68 69 73 20 68 65 6c 70 65 72 20 70 + 72 6f 64 75 63 65 73 20 74 68 6f 73 65 0a + + ~ "~ entries." + 7e 20 65 6e 74 72 69 65 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (output point--)" + 7e 20 28 6f 75 74 70 75 74 20 70 6f 69 6e 74 2d + 2d 29 0a + + ~ ": add-long-string-header-entries" + 3a 20 61 64 64 2d 6c 6f 6e 67 2d 73 74 72 69 6e + 67 2d 68 65 61 64 65 72 2d 65 6e 74 72 69 65 73 + 0a + + ~ " dup 0 hex-output-metadata-entry-type-blank-line 0" + 20 20 64 75 70 20 30 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 74 79 70 65 2d 62 6c 61 6e 6b 2d 6c 69 6e + 65 20 30 0a + + ~ " add-hex-output-metadata-entry" + 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ "" + 0a + + ~ " dup 0 hex-output-metadata-entry-type-line-comment" + 20 20 64 75 70 20 30 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 74 79 70 65 2d 6c 69 6e 65 2d 63 6f 6d 6d + 65 6e 74 0a + + ~ " s" What follows is a long string literal. For" + ~ " convenience, its contents"" + 20 20 73 22 20 20 20 57 68 61 74 20 66 6f 6c 6c + 6f 77 73 20 69 73 20 61 20 6c 6f 6e 67 20 73 74 + 72 69 6e 67 20 6c 69 74 65 72 61 6c 2e 20 46 6f + 72 20 63 6f 6e 76 65 6e 69 65 6e 63 65 2c 20 69 + 74 73 20 63 6f 6e 74 65 6e 74 73 22 0a + + ~ " add-hex-output-metadata-entry" + 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ "" + 0a + + ~ " dup 0 hex-output-metadata-entry-type-line-comment" + 20 20 64 75 70 20 30 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 74 79 70 65 2d 6c 69 6e 65 2d 63 6f 6d 6d + 65 6e 74 0a + + ~ " s" are given in short runs, but it's all a single string." + ~ " When possible,"" + 20 20 73 22 20 61 72 65 20 67 69 76 65 6e 20 69 + 6e 20 73 68 6f 72 74 20 72 75 6e 73 2c 20 62 75 + 74 20 69 74 27 73 20 61 6c 6c 20 61 20 73 69 6e + 67 6c 65 20 73 74 72 69 6e 67 2e 20 57 68 65 6e + 20 70 6f 73 73 69 62 6c 65 2c 22 0a + + ~ " add-hex-output-metadata-entry" + 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ "" + 0a + + ~ " dup 0 hex-output-metadata-entry-type-line-comment" + 20 20 64 75 70 20 30 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 74 79 70 65 2d 6c 69 6e 65 2d 63 6f 6d 6d + 65 6e 74 0a + + ~ " s" runs are broken at line endings or word breaks." + ~ " Trailing line endings"" + 20 20 73 22 20 72 75 6e 73 20 61 72 65 20 62 72 + 6f 6b 65 6e 20 61 74 20 6c 69 6e 65 20 65 6e 64 + 69 6e 67 73 20 6f 72 20 77 6f 72 64 20 62 72 65 + 61 6b 73 2e 20 54 72 61 69 6c 69 6e 67 20 6c 69 + 6e 65 20 65 6e 64 69 6e 67 73 22 0a + + ~ " add-hex-output-metadata-entry" + 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ "" + 0a + + ~ " ~ Note the lack of a "dup" this time." + 20 20 7e 20 4e 6f 74 65 20 74 68 65 20 6c 61 63 + 6b 20 6f 66 20 61 20 22 64 75 70 22 20 74 68 69 + 73 20 74 69 6d 65 2e 0a + + ~ " 0 hex-output-metadata-entry-type-line-comment" + 20 20 30 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 + 70 65 2d 6c 69 6e 65 2d 63 6f 6d 6d 65 6e 74 0a + + ~ " s" are not shown in the comments; look for them in the" + ~ " hex."" + 20 20 73 22 20 61 72 65 20 6e 6f 74 20 73 68 6f + 77 6e 20 69 6e 20 74 68 65 20 63 6f 6d 6d 65 6e + 74 73 3b 20 6c 6f 6f 6b 20 66 6f 72 20 74 68 65 + 6d 20 69 6e 20 74 68 65 20 68 65 78 2e 22 0a + + ~ " add-hex-output-metadata-entry ;" + 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 20 + 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ The code in hex-packstring-trace, below, is broken into" + ~ " two cases, one for" + 7e 20 20 20 54 68 65 20 63 6f 64 65 20 69 6e 20 + 68 65 78 2d 70 61 63 6b 73 74 72 69 6e 67 2d 74 + 72 61 63 65 2c 20 62 65 6c 6f 77 2c 20 69 73 20 + 62 72 6f 6b 65 6e 20 69 6e 74 6f 20 74 77 6f 20 + 63 61 73 65 73 2c 20 6f 6e 65 20 66 6f 72 0a + + ~ "~ ordinary strings and one for very long strings that need" + ~ " special formatting." + 7e 20 6f 72 64 69 6e 61 72 79 20 73 74 72 69 6e + 67 73 20 61 6e 64 20 6f 6e 65 20 66 6f 72 20 76 + 65 72 79 20 6c 6f 6e 67 20 73 74 72 69 6e 67 73 + 20 74 68 61 74 20 6e 65 65 64 20 73 70 65 63 69 + 61 6c 20 66 6f 72 6d 61 74 74 69 6e 67 2e 0a + + ~ "~ The long-string case ends by outputting a fixed set of" + ~ " entries that" + 7e 20 54 68 65 20 6c 6f 6e 67 2d 73 74 72 69 6e + 67 20 63 61 73 65 20 65 6e 64 73 20 62 79 20 6f + 75 74 70 75 74 74 69 6e 67 20 61 20 66 69 78 65 + 64 20 73 65 74 20 6f 66 20 65 6e 74 72 69 65 73 + 20 74 68 61 74 0a + + ~ "~ inform the reader the special handling is complete. This" + ~ " helper produces" + 7e 20 69 6e 66 6f 72 6d 20 74 68 65 20 72 65 61 + 64 65 72 20 74 68 65 20 73 70 65 63 69 61 6c 20 + 68 61 6e 64 6c 69 6e 67 20 69 73 20 63 6f 6d 70 + 6c 65 74 65 2e 20 54 68 69 73 20 68 65 6c 70 65 + 72 20 70 72 6f 64 75 63 65 73 0a + + ~ "~ those entries." + 7e 20 74 68 6f 73 65 20 65 6e 74 72 69 65 73 2e + 0a + + ~ "~" + 7e 0a + + ~ "~ (output point--)" + 7e 20 28 6f 75 74 70 75 74 20 70 6f 69 6e 74 2d + 2d 29 0a + + ~ ": add-long-string-footer-entries" + 3a 20 61 64 64 2d 6c 6f 6e 67 2d 73 74 72 69 6e + 67 2d 66 6f 6f 74 65 72 2d 65 6e 74 72 69 65 73 + 0a + + ~ " dup 0 hex-output-metadata-entry-type-blank-line 0" + 20 20 64 75 70 20 30 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 74 79 70 65 2d 62 6c 61 6e 6b 2d 6c 69 6e + 65 20 30 0a + + ~ " add-hex-output-metadata-entry" + 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ "" + 0a + + ~ " dup 0 hex-output-metadata-entry-type-line-comment" + 20 20 64 75 70 20 30 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 74 79 70 65 2d 6c 69 6e 65 2d 63 6f 6d 6d + 65 6e 74 0a + + ~ " s" This is the end of the long string literal. We now" + ~ " return you to the"" + 20 20 73 22 20 20 20 54 68 69 73 20 69 73 20 74 + 68 65 20 65 6e 64 20 6f 66 20 74 68 65 20 6c 6f + 6e 67 20 73 74 72 69 6e 67 20 6c 69 74 65 72 61 + 6c 2e 20 57 65 20 6e 6f 77 20 72 65 74 75 72 6e + 20 79 6f 75 20 74 6f 20 74 68 65 22 0a + + ~ " add-hex-output-metadata-entry" + 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ "" + 0a + + ~ " dup 0 hex-output-metadata-entry-type-line-comment" + 20 20 64 75 70 20 30 20 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 74 79 70 65 2d 6c 69 6e 65 2d 63 6f 6d 6d + 65 6e 74 0a + + ~ " s" normal hex-dump stuff."" + 20 20 73 22 20 6e 6f 72 6d 61 6c 20 68 65 78 2d + 64 75 6d 70 20 73 74 75 66 66 2e 22 0a + + ~ " add-hex-output-metadata-entry" + 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ "" + 0a + + ~ " ~ Note the lack of a "dup" this time." + 20 20 7e 20 4e 6f 74 65 20 74 68 65 20 6c 61 63 + 6b 20 6f 66 20 61 20 22 64 75 70 22 20 74 68 69 + 73 20 74 69 6d 65 2e 0a + + ~ " 0 hex-output-metadata-entry-type-blank-line 0" + 20 20 30 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 + 70 65 2d 62 6c 61 6e 6b 2d 6c 69 6e 65 20 30 0a + + ~ " add-hex-output-metadata-entry ;" + 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 20 + 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ The code in hex-packstring-trace, below, is broken into" + ~ " two cases, one for" + 7e 20 20 20 54 68 65 20 63 6f 64 65 20 69 6e 20 + 68 65 78 2d 70 61 63 6b 73 74 72 69 6e 67 2d 74 + 72 61 63 65 2c 20 62 65 6c 6f 77 2c 20 69 73 20 + 62 72 6f 6b 65 6e 20 69 6e 74 6f 20 74 77 6f 20 + 63 61 73 65 73 2c 20 6f 6e 65 20 66 6f 72 0a + + ~ "~ ordinary strings and one for very long strings that need" + ~ " special formatting." + 7e 20 6f 72 64 69 6e 61 72 79 20 73 74 72 69 6e + 67 73 20 61 6e 64 20 6f 6e 65 20 66 6f 72 20 76 + 65 72 79 20 6c 6f 6e 67 20 73 74 72 69 6e 67 73 + 20 74 68 61 74 20 6e 65 65 64 20 73 70 65 63 69 + 61 6c 20 66 6f 72 6d 61 74 74 69 6e 67 2e 0a + + ~ "~ The long-string case has two layers of loop, and the" + ~ " outer layer needs to" + 7e 20 54 68 65 20 6c 6f 6e 67 2d 73 74 72 69 6e + 67 20 63 61 73 65 20 68 61 73 20 74 77 6f 20 6c + 61 79 65 72 73 20 6f 66 20 6c 6f 6f 70 2c 20 61 + 6e 64 20 74 68 65 20 6f 75 74 65 72 20 6c 61 79 + 65 72 20 6e 65 65 64 73 20 74 6f 0a + + ~ "~ output a fixed set of entries at the start of each of its" + ~ " iterations. This" + 7e 20 6f 75 74 70 75 74 20 61 20 66 69 78 65 64 + 20 73 65 74 20 6f 66 20 65 6e 74 72 69 65 73 20 + 61 74 20 74 68 65 20 73 74 61 72 74 20 6f 66 20 + 65 61 63 68 20 6f 66 20 69 74 73 20 69 74 65 72 + 61 74 69 6f 6e 73 2e 20 54 68 69 73 0a + + ~ "~ helper produces those entries." + 7e 20 68 65 6c 70 65 72 20 70 72 6f 64 75 63 65 + 73 20 74 68 6f 73 65 20 65 6e 74 72 69 65 73 2e + 0a + + ~ "~" + 7e 0a + + ~ "~ (output point--)" + 7e 20 28 6f 75 74 70 75 74 20 70 6f 69 6e 74 2d + 2d 29 0a + + ~ ": add-long-string-outer-iteration-header-entries" + 3a 20 61 64 64 2d 6c 6f 6e 67 2d 73 74 72 69 6e + 67 2d 6f 75 74 65 72 2d 69 74 65 72 61 74 69 6f + 6e 2d 68 65 61 64 65 72 2d 65 6e 74 72 69 65 73 + 0a + + ~ " 0 hex-output-metadata-entry-type-blank-line 0" + 20 20 30 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 + 70 65 2d 62 6c 61 6e 6b 2d 6c 69 6e 65 20 30 0a + + ~ " add-hex-output-metadata-entry ;" + 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 20 + 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ The code in hex-packstring-trace, below, is broken into" + ~ " two cases, one for" + 7e 20 20 20 54 68 65 20 63 6f 64 65 20 69 6e 20 + 68 65 78 2d 70 61 63 6b 73 74 72 69 6e 67 2d 74 + 72 61 63 65 2c 20 62 65 6c 6f 77 2c 20 69 73 20 + 62 72 6f 6b 65 6e 20 69 6e 74 6f 20 74 77 6f 20 + 63 61 73 65 73 2c 20 6f 6e 65 20 66 6f 72 0a + + ~ "~ ordinary strings and one for very long strings that need" + ~ " special formatting." + 7e 20 6f 72 64 69 6e 61 72 79 20 73 74 72 69 6e + 67 73 20 61 6e 64 20 6f 6e 65 20 66 6f 72 20 76 + 65 72 79 20 6c 6f 6e 67 20 73 74 72 69 6e 67 73 + 20 74 68 61 74 20 6e 65 65 64 20 73 70 65 63 69 + 61 6c 20 66 6f 72 6d 61 74 74 69 6e 67 2e 0a + + ~ "~ Most of its complexity pertains to iteration structure;" + ~ " the logic of" + 7e 20 4d 6f 73 74 20 6f 66 20 69 74 73 20 63 6f + 6d 70 6c 65 78 69 74 79 20 70 65 72 74 61 69 6e + 73 20 74 6f 20 69 74 65 72 61 74 69 6f 6e 20 73 + 74 72 75 63 74 75 72 65 3b 20 74 68 65 20 6c 6f + 67 69 63 20 6f 66 0a + + ~ "~ actually creating metadata entries has been deferred to" + ~ " helpers. This helper" + 7e 20 61 63 74 75 61 6c 6c 79 20 63 72 65 61 74 + 69 6e 67 20 6d 65 74 61 64 61 74 61 20 65 6e 74 + 72 69 65 73 20 68 61 73 20 62 65 65 6e 20 64 65 + 66 65 72 72 65 64 20 74 6f 20 68 65 6c 70 65 72 + 73 2e 20 54 68 69 73 20 68 65 6c 70 65 72 0a + + ~ "~ handles the entries for a single iteration of the inner" + ~ " loop in the" + 7e 20 68 61 6e 64 6c 65 73 20 74 68 65 20 65 6e + 74 72 69 65 73 20 66 6f 72 20 61 20 73 69 6e 67 + 6c 65 20 69 74 65 72 61 74 69 6f 6e 20 6f 66 20 + 74 68 65 20 69 6e 6e 65 72 20 6c 6f 6f 70 20 69 + 6e 20 74 68 65 0a + + ~ "~ long-string case." + 7e 20 6c 6f 6e 67 2d 73 74 72 69 6e 67 20 63 61 + 73 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ There are potentially quite a lot of calls to this" + ~ " helper, exactly one per" + 7e 20 20 20 54 68 65 72 65 20 61 72 65 20 70 6f + 74 65 6e 74 69 61 6c 6c 79 20 71 75 69 74 65 20 + 61 20 6c 6f 74 20 6f 66 20 63 61 6c 6c 73 20 74 + 6f 20 74 68 69 73 20 68 65 6c 70 65 72 2c 20 65 + 78 61 63 74 6c 79 20 6f 6e 65 20 70 65 72 0a + + ~ "~ inner iteration. See the full explanation in" + ~ " hex-packstring-trace about the" + 7e 20 69 6e 6e 65 72 20 69 74 65 72 61 74 69 6f + 6e 2e 20 53 65 65 20 74 68 65 20 66 75 6c 6c 20 + 65 78 70 6c 61 6e 61 74 69 6f 6e 20 69 6e 20 68 + 65 78 2d 70 61 63 6b 73 74 72 69 6e 67 2d 74 72 + 61 63 65 20 61 62 6f 75 74 20 74 68 65 0a + + ~ "~ meaning of the inner and outer layers of iteration." + 7e 20 6d 65 61 6e 69 6e 67 20 6f 66 20 74 68 65 + 20 69 6e 6e 65 72 20 61 6e 64 20 6f 75 74 65 72 + 20 6c 61 79 65 72 73 20 6f 66 20 69 74 65 72 61 + 74 69 6f 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (output point, string length, string pointer --)" + 7e 20 28 6f 75 74 70 75 74 20 70 6f 69 6e 74 2c + 20 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 2c 20 + 73 74 72 69 6e 67 20 70 6f 69 6e 74 65 72 20 2d + 2d 29 0a + + ~ ": add-long-string-entry-pair" + 3a 20 61 64 64 2d 6c 6f 6e 67 2d 73 74 72 69 6e + 67 2d 65 6e 74 72 79 2d 70 61 69 72 0a + + ~ " ~ If the final character would be a newline, exclude" + ~ " that from the comment" + 20 20 7e 20 20 20 49 66 20 74 68 65 20 66 69 6e + 61 6c 20 63 68 61 72 61 63 74 65 72 20 77 6f 75 + 6c 64 20 62 65 20 61 20 6e 65 77 6c 69 6e 65 2c + 20 65 78 63 6c 75 64 65 20 74 68 61 74 20 66 72 + 6f 6d 20 74 68 65 20 63 6f 6d 6d 65 6e 74 0a + + ~ " ~ body." + 20 20 7e 20 62 6f 64 79 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ Please notice that we do this check on every comment," + ~ " though we only" + 20 20 7e 20 20 20 50 6c 65 61 73 65 20 6e 6f 74 + 69 63 65 20 74 68 61 74 20 77 65 20 64 6f 20 74 + 68 69 73 20 63 68 65 63 6b 20 6f 6e 20 65 76 65 + 72 79 20 63 6f 6d 6d 65 6e 74 2c 20 74 68 6f 75 + 67 68 20 77 65 20 6f 6e 6c 79 0a + + ~ " ~ care about it for the final one in the block. Because" + ~ " of the way" + 20 20 7e 20 63 61 72 65 20 61 62 6f 75 74 20 69 + 74 20 66 6f 72 20 74 68 65 20 66 69 6e 61 6c 20 + 6f 6e 65 20 69 6e 20 74 68 65 20 62 6c 6f 63 6b + 2e 20 42 65 63 61 75 73 65 20 6f 66 20 74 68 65 + 20 77 61 79 0a + + ~ " ~ line-wrapping will always choose the first newline if" + ~ " there is one, we" + 20 20 7e 20 6c 69 6e 65 2d 77 72 61 70 70 69 6e + 67 20 77 69 6c 6c 20 61 6c 77 61 79 73 20 63 68 + 6f 6f 73 65 20 74 68 65 20 66 69 72 73 74 20 6e + 65 77 6c 69 6e 65 20 69 66 20 74 68 65 72 65 20 + 69 73 20 6f 6e 65 2c 20 77 65 0a + + ~ " ~ don't need to worry about this check firing when it's" + ~ " unwanted." + 20 20 7e 20 64 6f 6e 27 74 20 6e 65 65 64 20 74 + 6f 20 77 6f 72 72 79 20 61 62 6f 75 74 20 74 68 + 69 73 20 63 68 65 63 6b 20 66 69 72 69 6e 67 20 + 77 68 65 6e 20 69 74 27 73 20 75 6e 77 61 6e 74 + 65 64 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ Letting that happen here means we have less trouble" + ~ " writing the" + 20 20 7e 20 20 20 4c 65 74 74 69 6e 67 20 74 68 + 61 74 20 68 61 70 70 65 6e 20 68 65 72 65 20 6d + 65 61 6e 73 20 77 65 20 68 61 76 65 20 6c 65 73 + 73 20 74 72 6f 75 62 6c 65 20 77 72 69 74 69 6e + 67 20 74 68 65 0a + + ~ " ~ termination check for the inner loop." + 20 20 7e 20 74 65 72 6d 69 6e 61 74 69 6f 6e 20 + 63 68 65 63 6b 20 66 6f 72 20 74 68 65 20 69 6e + 6e 65 72 20 6c 6f 6f 70 2e 0a + + ~ " 2dup + 1- 8@ 0x0a = { swap 1- swap } if" + 20 20 32 64 75 70 20 2b 20 31 2d 20 38 40 20 30 + 78 30 61 20 3d 20 7b 20 73 77 61 70 20 31 2d 20 + 73 77 61 70 20 7d 20 69 66 0a + + ~ " ~ (output point, string length, string pointer)" + 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f 69 6e + 74 2c 20 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 + 2c 20 73 74 72 69 6e 67 20 70 6f 69 6e 74 65 72 + 29 0a + + ~ "" + 0a + + ~ " 2 pick 2 pick 2 pick" + 20 20 32 20 70 69 63 6b 20 32 20 70 69 63 6b 20 + 32 20 70 69 63 6b 0a + + ~ " hex-output-metadata-entry-type-push-subitem-string swap" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 70 75 73 68 2d 73 75 62 69 74 65 6d 2d 73 74 + 72 69 6e 67 20 73 77 61 70 0a + + ~ " add-hex-output-metadata-entry" + 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 0a + + ~ " ~ (output point, string length, string pointer)" + 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f 69 6e + 74 2c 20 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 + 2c 20 73 74 72 69 6e 67 20 70 6f 69 6e 74 65 72 + 29 0a + + ~ "" + 0a + + ~ " drop" + 20 20 64 72 6f 70 0a + + ~ " hex-output-metadata-entry-type-line-comment s" '#'"" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 6c 69 6e 65 2d 63 6f 6d 6d 65 6e 74 20 73 22 + 20 27 23 27 22 0a + + ~ " add-hex-output-metadata-entry ;" + 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 20 + 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ (output point, string pointer --)" + 7e 20 28 6f 75 74 70 75 74 20 70 6f 69 6e 74 2c + 20 73 74 72 69 6e 67 20 70 6f 69 6e 74 65 72 20 + 2d 2d 29 0a + + ~ ": hex-packstring-trace" + 3a 20 68 65 78 2d 70 61 63 6b 73 74 72 69 6e 67 + 2d 74 72 61 63 65 0a + + ~ " dup stringlen 1+" + 20 20 64 75 70 20 73 74 72 69 6e 67 6c 65 6e 20 + 31 2b 0a + + ~ " ~ (output point, string pointer, string length)" + 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f 69 6e + 74 2c 20 73 74 72 69 6e 67 20 70 6f 69 6e 74 65 + 72 2c 20 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 + 29 0a + + ~ " 2 pick over hex-pack-trace" + 20 20 32 20 70 69 63 6b 20 6f 76 65 72 20 68 65 + 78 2d 70 61 63 6b 2d 74 72 61 63 65 0a + + ~ " swap" + 20 20 73 77 61 70 0a + + ~ " ~ (output point, string length, string pointer)" + 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f 69 6e + 74 2c 20 73 74 72 69 6e 67 20 6c 65 6e 67 74 68 + 2c 20 73 74 72 69 6e 67 20 70 6f 69 6e 74 65 72 + 29 0a + + ~ " over long-string-threshold >= {" + 20 20 6f 76 65 72 20 6c 6f 6e 67 2d 73 74 72 69 + 6e 67 2d 74 68 72 65 73 68 6f 6c 64 20 3e 3d 20 + 7b 0a + + ~ " add-short-string-entry-pair" + 20 20 20 20 61 64 64 2d 73 68 6f 72 74 2d 73 74 + 72 69 6e 67 2d 65 6e 74 72 79 2d 70 61 69 72 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " 2 pick add-long-string-header-entries" + 20 20 20 20 32 20 70 69 63 6b 20 61 64 64 2d 6c + 6f 6e 67 2d 73 74 72 69 6e 67 2d 68 65 61 64 65 + 72 2d 65 6e 74 72 69 65 73 0a + + ~ "" + 0a + + ~ " ~ It's important not to accidentally confuse the" + ~ " string point with the" + 20 20 20 20 7e 20 20 20 49 74 27 73 20 69 6d 70 + 6f 72 74 61 6e 74 20 6e 6f 74 20 74 6f 20 61 63 + 63 69 64 65 6e 74 61 6c 6c 79 20 63 6f 6e 66 75 + 73 65 20 74 68 65 20 73 74 72 69 6e 67 20 70 6f + 69 6e 74 20 77 69 74 68 20 74 68 65 0a + + ~ " ~ output point here. Because of the multi-pass nature" + ~ " of the label loop," + 20 20 20 20 7e 20 6f 75 74 70 75 74 20 70 6f 69 + 6e 74 20 68 65 72 65 2e 20 42 65 63 61 75 73 65 + 20 6f 66 20 74 68 65 20 6d 75 6c 74 69 2d 70 61 + 73 73 20 6e 61 74 75 72 65 20 6f 66 20 74 68 65 + 20 6c 61 62 65 6c 20 6c 6f 6f 70 2c 0a + + ~ " ~ there's a real chance the contents of both will be" + ~ " identical, making it" + 20 20 20 20 7e 20 74 68 65 72 65 27 73 20 61 20 + 72 65 61 6c 20 63 68 61 6e 63 65 20 74 68 65 20 + 63 6f 6e 74 65 6e 74 73 20 6f 66 20 62 6f 74 68 + 20 77 69 6c 6c 20 62 65 20 69 64 65 6e 74 69 63 + 61 6c 2c 20 6d 61 6b 69 6e 67 20 69 74 0a + + ~ " ~ very easy to use the wrong one since it will seem to" + ~ " work. There is no" + 20 20 20 20 7e 20 76 65 72 79 20 65 61 73 79 20 + 74 6f 20 75 73 65 20 74 68 65 20 77 72 6f 6e 67 + 20 6f 6e 65 20 73 69 6e 63 65 20 69 74 20 77 69 + 6c 6c 20 73 65 65 6d 20 74 6f 20 77 6f 72 6b 2e + 20 54 68 65 72 65 20 69 73 20 6e 6f 0a + + ~ " ~ guarantee that all long strings in the final pass" + ~ " will be at the same" + 20 20 20 20 7e 20 67 75 61 72 61 6e 74 65 65 20 + 74 68 61 74 20 61 6c 6c 20 6c 6f 6e 67 20 73 74 + 72 69 6e 67 73 20 69 6e 20 74 68 65 20 66 69 6e + 61 6c 20 70 61 73 73 20 77 69 6c 6c 20 62 65 20 + 61 74 20 74 68 65 20 73 61 6d 65 0a + + ~ " ~ locations they were in the penultimate pass, or that" + ~ " nothing has" + 20 20 20 20 7e 20 6c 6f 63 61 74 69 6f 6e 73 20 + 74 68 65 79 20 77 65 72 65 20 69 6e 20 74 68 65 + 20 70 65 6e 75 6c 74 69 6d 61 74 65 20 70 61 73 + 73 2c 20 6f 72 20 74 68 61 74 20 6e 6f 74 68 69 + 6e 67 20 68 61 73 0a + + ~ " ~ scribbled over them, so don't get it wrong!" + 20 20 20 20 7e 20 73 63 72 69 62 62 6c 65 64 20 + 6f 76 65 72 20 74 68 65 6d 2c 20 73 6f 20 64 6f + 6e 27 74 20 67 65 74 20 69 74 20 77 72 6f 6e 67 + 21 0a + + ~ " ~" + 20 20 20 20 7e 0a + + ~ " ~ Okay, got that firmly in mind? Good. Now, what" + ~ " we're doing is a" + 20 20 20 20 7e 20 20 20 4f 6b 61 79 2c 20 67 6f + 74 20 74 68 61 74 20 66 69 72 6d 6c 79 20 69 6e + 20 6d 69 6e 64 3f 20 47 6f 6f 64 2e 20 4e 6f 77 + 2c 20 77 68 61 74 20 77 65 27 72 65 20 64 6f 69 + 6e 67 20 69 73 20 61 0a + + ~ " ~ two-layer iteration. That may be surprising" + ~ " complexity. To motivate it," + 20 20 20 20 7e 20 74 77 6f 2d 6c 61 79 65 72 20 + 69 74 65 72 61 74 69 6f 6e 2e 20 54 68 61 74 20 + 6d 61 79 20 62 65 20 73 75 72 70 72 69 73 69 6e + 67 20 63 6f 6d 70 6c 65 78 69 74 79 2e 20 54 6f + 20 6d 6f 74 69 76 61 74 65 20 69 74 2c 0a + + ~ " ~ contemplate how the text inside the string is likely" + ~ " wrapped to 80" + 20 20 20 20 7e 20 63 6f 6e 74 65 6d 70 6c 61 74 + 65 20 68 6f 77 20 74 68 65 20 74 65 78 74 20 69 + 6e 73 69 64 65 20 74 68 65 20 73 74 72 69 6e 67 + 20 69 73 20 6c 69 6b 65 6c 79 20 77 72 61 70 70 + 65 64 20 74 6f 20 38 30 0a + + ~ " ~ columns wide, and the formatted hex dump we're" + ~ " producing is likely ALSO" + 20 20 20 20 7e 20 63 6f 6c 75 6d 6e 73 20 77 69 + 64 65 2c 20 61 6e 64 20 74 68 65 20 66 6f 72 6d + 61 74 74 65 64 20 68 65 78 20 64 75 6d 70 20 77 + 65 27 72 65 20 70 72 6f 64 75 63 69 6e 67 20 69 + 73 20 6c 69 6b 65 6c 79 20 41 4c 53 4f 0a + + ~ " ~ wrapped to 80 columns wide. Our choice to displaying" + ~ " everything in" + 20 20 20 20 7e 20 77 72 61 70 70 65 64 20 74 6f + 20 38 30 20 63 6f 6c 75 6d 6e 73 20 77 69 64 65 + 2e 20 4f 75 72 20 63 68 6f 69 63 65 20 74 6f 20 + 64 69 73 70 6c 61 79 69 6e 67 20 65 76 65 72 79 + 74 68 69 6e 67 20 69 6e 0a + + ~ " ~ hexadecimal, with comment syntax, and so on, results" + ~ " in us not being" + 20 20 20 20 7e 20 68 65 78 61 64 65 63 69 6d 61 + 6c 2c 20 77 69 74 68 20 63 6f 6d 6d 65 6e 74 20 + 73 79 6e 74 61 78 2c 20 61 6e 64 20 73 6f 20 6f + 6e 2c 20 72 65 73 75 6c 74 73 20 69 6e 20 75 73 + 20 6e 6f 74 20 62 65 69 6e 67 0a + + ~ " ~ able to give the inner text the 80 columns it wants," + ~ " and we have to get" + 20 20 20 20 7e 20 61 62 6c 65 20 74 6f 20 67 69 + 76 65 20 74 68 65 20 69 6e 6e 65 72 20 74 65 78 + 74 20 74 68 65 20 38 30 20 63 6f 6c 75 6d 6e 73 + 20 69 74 20 77 61 6e 74 73 2c 20 61 6e 64 20 77 + 65 20 68 61 76 65 20 74 6f 20 67 65 74 0a + + ~ " ~ creative." + 20 20 20 20 7e 20 63 72 65 61 74 69 76 65 2e 0a + + ~ " ~" + 20 20 20 20 7e 0a + + ~ " ~ We resolve this by having an outer loop which" + ~ " breaks the string into" + 20 20 20 20 7e 20 20 20 57 65 20 72 65 73 6f 6c + 76 65 20 74 68 69 73 20 62 79 20 68 61 76 69 6e + 67 20 61 6e 20 6f 75 74 65 72 20 6c 6f 6f 70 20 + 77 68 69 63 68 20 62 72 65 61 6b 73 20 74 68 65 + 20 73 74 72 69 6e 67 20 69 6e 74 6f 0a + + ~ " ~ lines (preferring to do so at newlines when" + ~ " possible), and renders each" + 20 20 20 20 7e 20 6c 69 6e 65 73 20 28 70 72 65 + 66 65 72 72 69 6e 67 20 74 6f 20 64 6f 20 73 6f + 20 61 74 20 6e 65 77 6c 69 6e 65 73 20 77 68 65 + 6e 20 70 6f 73 73 69 62 6c 65 29 2c 20 61 6e 64 + 20 72 65 6e 64 65 72 73 20 65 61 63 68 0a + + ~ " ~ of these as a consecutive block of hex, nothing" + ~ " interrupting it. Then" + 20 20 20 20 7e 20 6f 66 20 74 68 65 73 65 20 61 + 73 20 61 20 63 6f 6e 73 65 63 75 74 69 76 65 20 + 62 6c 6f 63 6b 20 6f 66 20 68 65 78 2c 20 6e 6f + 74 68 69 6e 67 20 69 6e 74 65 72 72 75 70 74 69 + 6e 67 20 69 74 2e 20 54 68 65 6e 0a + + ~ " ~ we also have an inner loop which breaks the comments" + ~ " preceding the hex" + 20 20 20 20 7e 20 77 65 20 61 6c 73 6f 20 68 61 + 76 65 20 61 6e 20 69 6e 6e 65 72 20 6c 6f 6f 70 + 20 77 68 69 63 68 20 62 72 65 61 6b 73 20 74 68 + 65 20 63 6f 6d 6d 65 6e 74 73 20 70 72 65 63 65 + 64 69 6e 67 20 74 68 65 20 68 65 78 0a + + ~ " ~ (preferring to do so at spaces when possible), to" + ~ " make a block of" + 20 20 20 20 7e 20 28 70 72 65 66 65 72 72 69 6e + 67 20 74 6f 20 64 6f 20 73 6f 20 61 74 20 73 70 + 61 63 65 73 20 77 68 65 6e 20 70 6f 73 73 69 62 + 6c 65 29 2c 20 74 6f 20 6d 61 6b 65 20 61 20 62 + 6c 6f 63 6b 20 6f 66 0a + + ~ " ~ comments that correspond to the hex and all come at" + ~ " the start of it." + 20 20 20 20 7e 20 63 6f 6d 6d 65 6e 74 73 20 74 + 68 61 74 20 63 6f 72 72 65 73 70 6f 6e 64 20 74 + 6f 20 74 68 65 20 68 65 78 20 61 6e 64 20 61 6c + 6c 20 63 6f 6d 65 20 61 74 20 74 68 65 20 73 74 + 61 72 74 20 6f 66 20 69 74 2e 0a + + ~ " ~" + 20 20 20 20 7e 0a + + ~ " ~ In the event that lines are very long, fallback" + ~ " behavior may break" + 20 20 20 20 7e 20 20 20 49 6e 20 74 68 65 20 65 + 76 65 6e 74 20 74 68 61 74 20 6c 69 6e 65 73 20 + 61 72 65 20 76 65 72 79 20 6c 6f 6e 67 2c 20 66 + 61 6c 6c 62 61 63 6b 20 62 65 68 61 76 69 6f 72 + 20 6d 61 79 20 62 72 65 61 6b 0a + + ~ " ~ them somewhere other than a newline, but conceptually" + ~ " it's easiest if" + 20 20 20 20 7e 20 74 68 65 6d 20 73 6f 6d 65 77 + 68 65 72 65 20 6f 74 68 65 72 20 74 68 61 6e 20 + 61 20 6e 65 77 6c 69 6e 65 2c 20 62 75 74 20 63 + 6f 6e 63 65 70 74 75 61 6c 6c 79 20 69 74 27 73 + 20 65 61 73 69 65 73 74 20 69 66 0a + + ~ " ~ you think of each hex "paragraph" as representing a" + ~ " single line of text" + 20 20 20 20 7e 20 79 6f 75 20 74 68 69 6e 6b 20 + 6f 66 20 65 61 63 68 20 68 65 78 20 22 70 61 72 + 61 67 72 61 70 68 22 20 61 73 20 72 65 70 72 65 + 73 65 6e 74 69 6e 67 20 61 20 73 69 6e 67 6c 65 + 20 6c 69 6e 65 20 6f 66 20 74 65 78 74 0a + + ~ " ~ from the inside-the-string perspective." + 20 20 20 20 7e 20 66 72 6f 6d 20 74 68 65 20 69 + 6e 73 69 64 65 2d 74 68 65 2d 73 74 72 69 6e 67 + 20 70 65 72 73 70 65 63 74 69 76 65 2e 0a + + ~ " ~" + 20 20 20 20 7e 0a + + ~ " ~ If that sounds abstract, it's a good idea to go" + ~ " look at an example of" + 20 20 20 20 7e 20 20 20 49 66 20 74 68 61 74 20 + 73 6f 75 6e 64 73 20 61 62 73 74 72 61 63 74 2c + 20 69 74 27 73 20 61 20 67 6f 6f 64 20 69 64 65 + 61 20 74 6f 20 67 6f 20 6c 6f 6f 6b 20 61 74 20 + 61 6e 20 65 78 61 6d 70 6c 65 20 6f 66 0a + + ~ " ~ the rendered output at this point. Look in" + ~ " "evoke.hex" for the label" + 20 20 20 20 7e 20 74 68 65 20 72 65 6e 64 65 72 + 65 64 20 6f 75 74 70 75 74 20 61 74 20 74 68 69 + 73 20 70 6f 69 6e 74 2e 20 4c 6f 6f 6b 20 69 6e + 20 22 65 76 6f 6b 65 2e 68 65 78 22 20 66 6f 72 + 20 74 68 65 20 6c 61 62 65 6c 0a + + ~ " ~ "boot-source" and skim its contents; that's all" + ~ " rendered by this code." + 20 20 20 20 7e 20 22 62 6f 6f 74 2d 73 6f 75 72 + 63 65 22 20 61 6e 64 20 73 6b 69 6d 20 69 74 73 + 20 63 6f 6e 74 65 6e 74 73 3b 20 74 68 61 74 27 + 73 20 61 6c 6c 20 72 65 6e 64 65 72 65 64 20 62 + 79 20 74 68 69 73 20 63 6f 64 65 2e 0a + + ~ " ~" + 20 20 20 20 7e 0a + + ~ " ~ Anyway, this "while" block is the outer loop." + 20 20 20 20 7e 20 20 20 41 6e 79 77 61 79 2c 20 + 74 68 69 73 20 22 77 68 69 6c 65 22 20 62 6c 6f + 63 6b 20 69 73 20 74 68 65 20 6f 75 74 65 72 20 + 6c 6f 6f 70 2e 0a + + ~ " swap { dup } {" + 20 20 20 20 73 77 61 70 20 7b 20 64 75 70 20 7d + 20 7b 0a + + ~ " ~ (output point, outer string point, remaining" + ~ " length)" + 20 20 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 + 70 6f 69 6e 74 2c 20 6f 75 74 65 72 20 73 74 72 + 69 6e 67 20 70 6f 69 6e 74 2c 20 72 65 6d 61 69 + 6e 69 6e 67 20 6c 65 6e 67 74 68 29 0a + + ~ " 2 pick" + ~ " add-long-string-outer-iteration-header-entries" + 20 20 20 20 20 20 32 20 70 69 63 6b 20 61 64 64 + 2d 6c 6f 6e 67 2d 73 74 72 69 6e 67 2d 6f 75 74 + 65 72 2d 69 74 65 72 61 74 69 6f 6e 2d 68 65 61 + 64 65 72 2d 65 6e 74 72 69 65 73 0a + + ~ "" + 0a + + ~ " dup long-string-threshold min" + 20 20 20 20 20 20 64 75 70 20 6c 6f 6e 67 2d 73 + 74 72 69 6e 67 2d 74 68 72 65 73 68 6f 6c 64 20 + 6d 69 6e 0a + + ~ " ~ (output point, outer string point, remaining" + ~ " length," + 20 20 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 + 70 6f 69 6e 74 2c 20 6f 75 74 65 72 20 73 74 72 + 69 6e 67 20 70 6f 69 6e 74 2c 20 72 65 6d 61 69 + 6e 69 6e 67 20 6c 65 6e 67 74 68 2c 0a + + ~ " ~ max length this outer iteration)" + 20 20 20 20 20 20 7e 20 20 6d 61 78 20 6c 65 6e + 67 74 68 20 74 68 69 73 20 6f 75 74 65 72 20 69 + 74 65 72 61 74 69 6f 6e 29 0a + + ~ " 2 pick swap choose-string-outer-break-point" + 20 20 20 20 20 20 32 20 70 69 63 6b 20 73 77 61 + 70 20 63 68 6f 6f 73 65 2d 73 74 72 69 6e 67 2d + 6f 75 74 65 72 2d 62 72 65 61 6b 2d 70 6f 69 6e + 74 0a + + ~ " ~ (output point, outer string point, remaining" + ~ " length," + 20 20 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 + 70 6f 69 6e 74 2c 20 6f 75 74 65 72 20 73 74 72 + 69 6e 67 20 70 6f 69 6e 74 2c 20 72 65 6d 61 69 + 6e 69 6e 67 20 6c 65 6e 67 74 68 2c 0a + + ~ " ~ outer iteration length)" + 20 20 20 20 20 20 7e 20 20 6f 75 74 65 72 20 69 + 74 65 72 61 74 69 6f 6e 20 6c 65 6e 67 74 68 29 + 0a + + ~ "" + 0a + + ~ " 2 pick 0" + 20 20 20 20 20 20 32 20 70 69 63 6b 20 30 0a + + ~ " ~ (output point, outer string point, remaining" + ~ " length," + 20 20 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 + 70 6f 69 6e 74 2c 20 6f 75 74 65 72 20 73 74 72 + 69 6e 67 20 70 6f 69 6e 74 2c 20 72 65 6d 61 69 + 6e 69 6e 67 20 6c 65 6e 67 74 68 2c 0a + + ~ " ~ outer iteration length, inner string point, inner" + ~ " iteration offset)" + 20 20 20 20 20 20 7e 20 20 6f 75 74 65 72 20 69 + 74 65 72 61 74 69 6f 6e 20 6c 65 6e 67 74 68 2c + 20 69 6e 6e 65 72 20 73 74 72 69 6e 67 20 70 6f + 69 6e 74 2c 20 69 6e 6e 65 72 20 69 74 65 72 61 + 74 69 6f 6e 20 6f 66 66 73 65 74 29 0a + + ~ "" + 0a + + ~ " { 2 pick over < } {" + 20 20 20 20 20 20 7b 20 32 20 70 69 63 6b 20 6f + 76 65 72 20 3c 20 7d 20 7b 0a + + ~ " ~ (output point, outer string point, remaining" + ~ " length," + 20 20 20 20 20 20 20 20 7e 20 28 6f 75 74 70 75 + 74 20 70 6f 69 6e 74 2c 20 6f 75 74 65 72 20 73 + 74 72 69 6e 67 20 70 6f 69 6e 74 2c 20 72 65 6d + 61 69 6e 69 6e 67 20 6c 65 6e 67 74 68 2c 0a + + ~ " ~ outer iteration length, inner string point," + ~ " inner iteration offset)" + 20 20 20 20 20 20 20 20 7e 20 20 6f 75 74 65 72 + 20 69 74 65 72 61 74 69 6f 6e 20 6c 65 6e 67 74 + 68 2c 20 69 6e 6e 65 72 20 73 74 72 69 6e 67 20 + 70 6f 69 6e 74 2c 20 69 6e 6e 65 72 20 69 74 65 + 72 61 74 69 6f 6e 20 6f 66 66 73 65 74 29 0a + + ~ " 2 pick over -" + 20 20 20 20 20 20 20 20 32 20 70 69 63 6b 20 6f + 76 65 72 20 2d 0a + + ~ " ~ (output point, outer string point, remaining" + ~ " length," + 20 20 20 20 20 20 20 20 7e 20 28 6f 75 74 70 75 + 74 20 70 6f 69 6e 74 2c 20 6f 75 74 65 72 20 73 + 74 72 69 6e 67 20 70 6f 69 6e 74 2c 20 72 65 6d + 61 69 6e 69 6e 67 20 6c 65 6e 67 74 68 2c 0a + + ~ " ~ outer iteration length, inner string point," + ~ " inner iteration offset," + 20 20 20 20 20 20 20 20 7e 20 20 6f 75 74 65 72 + 20 69 74 65 72 61 74 69 6f 6e 20 6c 65 6e 67 74 + 68 2c 20 69 6e 6e 65 72 20 73 74 72 69 6e 67 20 + 70 6f 69 6e 74 2c 20 69 6e 6e 65 72 20 69 74 65 + 72 61 74 69 6f 6e 20 6f 66 66 73 65 74 2c 0a + + ~ " ~ inner iteration length)" + 20 20 20 20 20 20 20 20 7e 20 20 69 6e 6e 65 72 + 20 69 74 65 72 61 74 69 6f 6e 20 6c 65 6e 67 74 + 68 29 0a + + ~ " 2 pick swap choose-string-inner-break-point" + 20 20 20 20 20 20 20 20 32 20 70 69 63 6b 20 73 + 77 61 70 20 63 68 6f 6f 73 65 2d 73 74 72 69 6e + 67 2d 69 6e 6e 65 72 2d 62 72 65 61 6b 2d 70 6f + 69 6e 74 0a + + ~ "" + 0a + + ~ " ~ It's worth noticing that we use the same output" + ~ " point for all of" + 20 20 20 20 20 20 20 20 7e 20 20 20 49 74 27 73 + 20 77 6f 72 74 68 20 6e 6f 74 69 63 69 6e 67 20 + 74 68 61 74 20 77 65 20 75 73 65 20 74 68 65 20 + 73 61 6d 65 20 6f 75 74 70 75 74 20 70 6f 69 6e + 74 20 66 6f 72 20 61 6c 6c 20 6f 66 0a + + ~ " ~ these, which is what makes them appear at the top" + ~ " of the hex block" + 20 20 20 20 20 20 20 20 7e 20 74 68 65 73 65 2c + 20 77 68 69 63 68 20 69 73 20 77 68 61 74 20 6d + 61 6b 65 73 20 74 68 65 6d 20 61 70 70 65 61 72 + 20 61 74 20 74 68 65 20 74 6f 70 20 6f 66 20 74 + 68 65 20 68 65 78 20 62 6c 6f 63 6b 0a + + ~ " ~ rather than interspersed throughout it." + 20 20 20 20 20 20 20 20 7e 20 72 61 74 68 65 72 + 20 74 68 61 6e 20 69 6e 74 65 72 73 70 65 72 73 + 65 64 20 74 68 72 6f 75 67 68 6f 75 74 20 69 74 + 2e 0a + + ~ " ~" + 20 20 20 20 20 20 20 20 7e 0a + + ~ " ~ We leave the newline-ignoring logic to" + ~ " add-long-string-entry-pair," + 20 20 20 20 20 20 20 20 7e 20 20 20 57 65 20 6c + 65 61 76 65 20 74 68 65 20 6e 65 77 6c 69 6e 65 + 2d 69 67 6e 6f 72 69 6e 67 20 6c 6f 67 69 63 20 + 74 6f 20 61 64 64 2d 6c 6f 6e 67 2d 73 74 72 69 + 6e 67 2d 65 6e 74 72 79 2d 70 61 69 72 2c 0a + + ~ " ~ as described further therein." + 20 20 20 20 20 20 20 20 7e 20 61 73 20 64 65 73 + 63 72 69 62 65 64 20 66 75 72 74 68 65 72 20 74 + 68 65 72 65 69 6e 2e 0a + + ~ " 6 pick over 4 pick add-long-string-entry-pair" + 20 20 20 20 20 20 20 20 36 20 70 69 63 6b 20 6f + 76 65 72 20 34 20 70 69 63 6b 20 61 64 64 2d 6c + 6f 6e 67 2d 73 74 72 69 6e 67 2d 65 6e 74 72 79 + 2d 70 61 69 72 0a + + ~ "" + 0a + + ~ " ~ (output point, outer string point, remaining" + ~ " length," + 20 20 20 20 20 20 20 20 7e 20 28 6f 75 74 70 75 + 74 20 70 6f 69 6e 74 2c 20 6f 75 74 65 72 20 73 + 74 72 69 6e 67 20 70 6f 69 6e 74 2c 20 72 65 6d + 61 69 6e 69 6e 67 20 6c 65 6e 67 74 68 2c 0a + + ~ " ~ outer iteration length, inner string point," + ~ " inner iteration offset," + 20 20 20 20 20 20 20 20 7e 20 20 6f 75 74 65 72 + 20 69 74 65 72 61 74 69 6f 6e 20 6c 65 6e 67 74 + 68 2c 20 69 6e 6e 65 72 20 73 74 72 69 6e 67 20 + 70 6f 69 6e 74 2c 20 69 6e 6e 65 72 20 69 74 65 + 72 61 74 69 6f 6e 20 6f 66 66 73 65 74 2c 0a + + ~ " ~ inner iteration length)" + 20 20 20 20 20 20 20 20 7e 20 20 69 6e 6e 65 72 + 20 69 74 65 72 61 74 69 6f 6e 20 6c 65 6e 67 74 + 68 29 0a + + ~ " dup 4 roll + 3unroll" + 20 20 20 20 20 20 20 20 64 75 70 20 34 20 72 6f + 6c 6c 20 2b 20 33 75 6e 72 6f 6c 6c 0a + + ~ " dup 3roll + swap" + 20 20 20 20 20 20 20 20 64 75 70 20 33 72 6f 6c + 6c 20 2b 20 73 77 61 70 0a + + ~ " drop" + 20 20 20 20 20 20 20 20 64 72 6f 70 0a + + ~ " } while 2drop" + 20 20 20 20 20 20 7d 20 77 68 69 6c 65 20 32 64 + 72 6f 70 0a + + ~ " ~ (output point, outer string point, remaining" + ~ " length," + 20 20 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 + 70 6f 69 6e 74 2c 20 6f 75 74 65 72 20 73 74 72 + 69 6e 67 20 70 6f 69 6e 74 2c 20 72 65 6d 61 69 + 6e 69 6e 67 20 6c 65 6e 67 74 68 2c 0a + + ~ " ~ outer iteration length)" + 20 20 20 20 20 20 7e 20 20 6f 75 74 65 72 20 69 + 74 65 72 61 74 69 6f 6e 20 6c 65 6e 67 74 68 29 + 0a + + ~ "" + 0a + + ~ " dup 5 roll + 4 unroll" + 20 20 20 20 20 20 64 75 70 20 35 20 72 6f 6c 6c + 20 2b 20 34 20 75 6e 72 6f 6c 6c 0a + + ~ " dup 4 roll + 3unroll" + 20 20 20 20 20 20 64 75 70 20 34 20 72 6f 6c 6c + 20 2b 20 33 75 6e 72 6f 6c 6c 0a + + ~ " -" + 20 20 20 20 20 20 2d 0a + + ~ " } while" + 20 20 20 20 7d 20 77 68 69 6c 65 0a + + ~ "" + 0a + + ~ " 2drop add-long-string-footer-entries" + 20 20 20 20 32 64 72 6f 70 20 61 64 64 2d 6c 6f + 6e 67 2d 73 74 72 69 6e 67 2d 66 6f 6f 74 65 72 + 2d 65 6e 74 72 69 65 73 0a + + ~ " } if-else ;" + 20 20 7d 20 69 66 2d 65 6c 73 65 20 3b 0a + + ~ "" + 0a + + ~ "~ The purpose of this word is to make sure that the" + ~ " memory-sliding" + 7e 20 20 20 54 68 65 20 70 75 72 70 6f 73 65 20 + 6f 66 20 74 68 69 73 20 77 6f 72 64 20 69 73 20 + 74 6f 20 6d 61 6b 65 20 73 75 72 65 20 74 68 61 + 74 20 74 68 65 20 6d 65 6d 6f 72 79 2d 73 6c 69 + 64 69 6e 67 0a + + ~ "~ techniques used by the high-level flow control words are" + ~ " appropriately" + 7e 20 74 65 63 68 6e 69 71 75 65 73 20 75 73 65 + 64 20 62 79 20 74 68 65 20 68 69 67 68 2d 6c 65 + 76 65 6c 20 66 6c 6f 77 20 63 6f 6e 74 72 6f 6c + 20 77 6f 72 64 73 20 61 72 65 20 61 70 70 72 6f + 70 72 69 61 74 65 6c 79 0a + + ~ "~ reflected in the output metadata. This is accomplished by" + ~ " finding all" + 7e 20 72 65 66 6c 65 63 74 65 64 20 69 6e 20 74 + 68 65 20 6f 75 74 70 75 74 20 6d 65 74 61 64 61 + 74 61 2e 20 54 68 69 73 20 69 73 20 61 63 63 6f + 6d 70 6c 69 73 68 65 64 20 62 79 20 66 69 6e 64 + 69 6e 67 20 61 6c 6c 0a + + ~ "~ entries whose data start pointer or string content" + ~ " pointer is within the" + 7e 20 65 6e 74 72 69 65 73 20 77 68 6f 73 65 20 + 64 61 74 61 20 73 74 61 72 74 20 70 6f 69 6e 74 + 65 72 20 6f 72 20 73 74 72 69 6e 67 20 63 6f 6e + 74 65 6e 74 20 70 6f 69 6e 74 65 72 20 69 73 20 + 77 69 74 68 69 6e 20 74 68 65 0a + + ~ "~ slid region, and adjusting the relevant pointer" + ~ " appropriately." + 7e 20 73 6c 69 64 20 72 65 67 69 6f 6e 2c 20 61 + 6e 64 20 61 64 6a 75 73 74 69 6e 67 20 74 68 65 + 20 72 65 6c 65 76 61 6e 74 20 70 6f 69 6e 74 65 + 72 20 61 70 70 72 6f 70 72 69 61 74 65 6c 79 2e + 0a + + ~ "~" + 7e 0a + + ~ "~ Notice that this strategy means there's no metadata" + ~ " entry describing the" + 7e 20 20 20 4e 6f 74 69 63 65 20 74 68 61 74 20 + 74 68 69 73 20 73 74 72 61 74 65 67 79 20 6d 65 + 61 6e 73 20 74 68 65 72 65 27 73 20 6e 6f 20 6d + 65 74 61 64 61 74 61 20 65 6e 74 72 79 20 64 65 + 73 63 72 69 62 69 6e 67 20 74 68 65 0a + + ~ "~ old location of the slid memory, though sliding is" + ~ " non-destructive. The" + 7e 20 6f 6c 64 20 6c 6f 63 61 74 69 6f 6e 20 6f + 66 20 74 68 65 20 73 6c 69 64 20 6d 65 6d 6f 72 + 79 2c 20 74 68 6f 75 67 68 20 73 6c 69 64 69 6e + 67 20 69 73 20 6e 6f 6e 2d 64 65 73 74 72 75 63 + 74 69 76 65 2e 20 54 68 65 0a + + ~ "~ assumption is that that location is going to be" + ~ " overwritten with new code," + 7e 20 61 73 73 75 6d 70 74 69 6f 6e 20 69 73 20 + 74 68 61 74 20 74 68 61 74 20 6c 6f 63 61 74 69 + 6f 6e 20 69 73 20 67 6f 69 6e 67 20 74 6f 20 62 + 65 20 6f 76 65 72 77 72 69 74 74 65 6e 20 77 69 + 74 68 20 6e 65 77 20 63 6f 64 65 2c 0a + + ~ "~ which will have its own metadata entries created as the" + ~ " new code is written." + 7e 20 77 68 69 63 68 20 77 69 6c 6c 20 68 61 76 + 65 20 69 74 73 20 6f 77 6e 20 6d 65 74 61 64 61 + 74 61 20 65 6e 74 72 69 65 73 20 63 72 65 61 74 + 65 64 20 61 73 20 74 68 65 20 6e 65 77 20 63 6f + 64 65 20 69 73 20 77 72 69 74 74 65 6e 2e 0a + + ~ "~ Otherwise, since we don't do anything to erase metadata" + ~ " entries pertaining" + 7e 20 4f 74 68 65 72 77 69 73 65 2c 20 73 69 6e + 63 65 20 77 65 20 64 6f 6e 27 74 20 64 6f 20 61 + 6e 79 74 68 69 6e 67 20 74 6f 20 65 72 61 73 65 + 20 6d 65 74 61 64 61 74 61 20 65 6e 74 72 69 65 + 73 20 70 65 72 74 61 69 6e 69 6e 67 0a + + ~ "~ to overwritten locations, old and new metadata entries" + ~ " would overlap and" + 7e 20 74 6f 20 6f 76 65 72 77 72 69 74 74 65 6e + 20 6c 6f 63 61 74 69 6f 6e 73 2c 20 6f 6c 64 20 + 61 6e 64 20 6e 65 77 20 6d 65 74 61 64 61 74 61 + 20 65 6e 74 72 69 65 73 20 77 6f 75 6c 64 20 6f + 76 65 72 6c 61 70 20 61 6e 64 0a + + ~ "~ cause confusion. The assumption is correct for all" + ~ " existing uses of" + 7e 20 63 61 75 73 65 20 63 6f 6e 66 75 73 69 6f + 6e 2e 20 54 68 65 20 61 73 73 75 6d 70 74 69 6f + 6e 20 69 73 20 63 6f 72 72 65 63 74 20 66 6f 72 + 20 61 6c 6c 20 65 78 69 73 74 69 6e 67 20 75 73 + 65 73 20 6f 66 0a + + ~ "~ memory-sliding as of the time this was written, but it's" + ~ " possible it will" + 7e 20 6d 65 6d 6f 72 79 2d 73 6c 69 64 69 6e 67 + 20 61 73 20 6f 66 20 74 68 65 20 74 69 6d 65 20 + 74 68 69 73 20 77 61 73 20 77 72 69 74 74 65 6e + 2c 20 62 75 74 20 69 74 27 73 20 70 6f 73 73 69 + 62 6c 65 20 69 74 20 77 69 6c 6c 0a + + ~ "~ need to be revisited someday." + 7e 20 6e 65 65 64 20 74 6f 20 62 65 20 72 65 76 + 69 73 69 74 65 64 20 73 6f 6d 65 64 61 79 2e 0a + + ~ "~" + 7e 0a + + ~ "~ This word is called for both memcopy and memmove. It's" + ~ " called by" + 7e 20 20 20 54 68 69 73 20 77 6f 72 64 20 69 73 + 20 63 61 6c 6c 65 64 20 66 6f 72 20 62 6f 74 68 + 20 6d 65 6d 63 6f 70 79 20 61 6e 64 20 6d 65 6d + 6d 6f 76 65 2e 20 49 74 27 73 20 63 61 6c 6c 65 + 64 20 62 79 0a + + ~ "~ hex-memory-slide-replacement, which is itself installed" + ~ " by a variety of" + 7e 20 68 65 78 2d 6d 65 6d 6f 72 79 2d 73 6c 69 + 64 65 2d 72 65 70 6c 61 63 65 6d 65 6e 74 2c 20 + 77 68 69 63 68 20 69 73 20 69 74 73 65 6c 66 20 + 69 6e 73 74 61 6c 6c 65 64 20 62 79 20 61 20 76 + 61 72 69 65 74 79 20 6f 66 0a + + ~ "~ means for different situations; see its documentation for" + ~ " more detail." + 7e 20 6d 65 61 6e 73 20 66 6f 72 20 64 69 66 66 + 65 72 65 6e 74 20 73 69 74 75 61 74 69 6f 6e 73 + 3b 20 73 65 65 20 69 74 73 20 64 6f 63 75 6d 65 + 6e 74 61 74 69 6f 6e 20 66 6f 72 20 6d 6f 72 65 + 20 64 65 74 61 69 6c 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (source, destination, length --)" + 7e 20 28 73 6f 75 72 63 65 2c 20 64 65 73 74 69 + 6e 61 74 69 6f 6e 2c 20 6c 65 6e 67 74 68 20 2d + 2d 29 0a + + ~ ": hex-memory-slide-trace" + 3a 20 68 65 78 2d 6d 65 6d 6f 72 79 2d 73 6c 69 + 64 65 2d 74 72 61 63 65 0a + + ~ " 2 pick is-in-label-loop-buffer" + 20 20 32 20 70 69 63 6b 20 69 73 2d 69 6e 2d 6c + 61 62 65 6c 2d 6c 6f 6f 70 2d 62 75 66 66 65 72 + 0a + + ~ " 2 pick is-in-label-loop-buffer &&" + 20 20 32 20 70 69 63 6b 20 69 73 2d 69 6e 2d 6c + 61 62 65 6c 2d 6c 6f 6f 70 2d 62 75 66 66 65 72 + 20 26 26 0a + + ~ " {" + 20 20 7b 0a + + ~ " ~ At the time this runs, the metadata entry array" + ~ " isn't sorted, so we" + 20 20 20 20 7e 20 20 20 41 74 20 74 68 65 20 74 + 69 6d 65 20 74 68 69 73 20 72 75 6e 73 2c 20 74 + 68 65 20 6d 65 74 61 64 61 74 61 20 65 6e 74 72 + 79 20 61 72 72 61 79 20 69 73 6e 27 74 20 73 6f + 72 74 65 64 2c 20 73 6f 20 77 65 0a + + ~ " ~ check the whole thing." + 20 20 20 20 7e 20 63 68 65 63 6b 20 74 68 65 20 + 77 68 6f 6c 65 20 74 68 69 6e 67 2e 0a + + ~ " transformation-state" + ~ " transformation-state-output-metadata @" + 20 20 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 + 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 + 74 70 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-first-entry" + 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 66 69 72 73 74 2d 65 6e + 74 72 79 0a + + ~ " ~ (source, destination, length, initial metadata scan" + ~ " pointer)" + 20 20 20 20 7e 20 28 73 6f 75 72 63 65 2c 20 64 + 65 73 74 69 6e 61 74 69 6f 6e 2c 20 6c 65 6e 67 + 74 68 2c 20 69 6e 69 74 69 61 6c 20 6d 65 74 61 + 64 61 74 61 20 73 63 61 6e 20 70 6f 69 6e 74 65 + 72 29 0a + + ~ " { dup @ } {" + 20 20 20 20 7b 20 64 75 70 20 40 20 7d 20 7b 0a + + ~ " ~ (source, destination, length, metadata scan" + ~ " pointer)" + 20 20 20 20 20 20 7e 20 28 73 6f 75 72 63 65 2c + 20 64 65 73 74 69 6e 61 74 69 6f 6e 2c 20 6c 65 + 6e 67 74 68 2c 20 6d 65 74 61 64 61 74 61 20 73 + 63 61 6e 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-data-start @ 4 pick <=" + 20 20 20 20 20 20 64 75 70 20 68 65 78 2d 6f 75 + 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e + 74 72 79 2d 64 61 74 61 2d 73 74 61 72 74 20 40 + 20 34 20 70 69 63 6b 20 3c 3d 0a + + ~ " ~ (source, destination, length, metadata scan" + ~ " pointer, lower bound okay)" + 20 20 20 20 20 20 7e 20 28 73 6f 75 72 63 65 2c + 20 64 65 73 74 69 6e 61 74 69 6f 6e 2c 20 6c 65 + 6e 67 74 68 2c 20 6d 65 74 61 64 61 74 61 20 73 + 63 61 6e 20 70 6f 69 6e 74 65 72 2c 20 6c 6f 77 + 65 72 20 62 6f 75 6e 64 20 6f 6b 61 79 29 0a + + ~ " over hex-output-metadata-entry-data-start @ 5 pick 4" + ~ " pick + >" + 20 20 20 20 20 20 6f 76 65 72 20 68 65 78 2d 6f + 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 + 6e 74 72 79 2d 64 61 74 61 2d 73 74 61 72 74 20 + 40 20 35 20 70 69 63 6b 20 34 20 70 69 63 6b 20 + 2b 20 3e 0a + + ~ " && {" + 20 20 20 20 20 20 26 26 20 7b 0a + + ~ " ~ (source, destination, length, metadata scan" + ~ " pointer)" + 20 20 20 20 20 20 20 20 7e 20 28 73 6f 75 72 63 + 65 2c 20 64 65 73 74 69 6e 61 74 69 6f 6e 2c 20 + 6c 65 6e 67 74 68 2c 20 6d 65 74 61 64 61 74 61 + 20 73 63 61 6e 20 70 6f 69 6e 74 65 72 29 0a + + ~ " dup hex-output-metadata-entry-data-start @ 4 pick -" + ~ " 3 pick +" + 20 20 20 20 20 20 20 20 64 75 70 20 68 65 78 2d + 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 79 2d 64 61 74 61 2d 73 74 61 72 74 + 20 40 20 34 20 70 69 63 6b 20 2d 20 33 20 70 69 + 63 6b 20 2b 0a + + ~ " over hex-output-metadata-entry-data-start !" + 20 20 20 20 20 20 20 20 6f 76 65 72 20 68 65 78 + 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 + 2d 65 6e 74 72 79 2d 64 61 74 61 2d 73 74 61 72 + 74 20 21 0a + + ~ " } if" + 20 20 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup hex-output-metadata-entry-type @" + 20 20 20 20 20 20 64 75 70 20 68 65 78 2d 6f 75 + 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e + 74 72 79 2d 74 79 70 65 20 40 0a + + ~ " dup hex-output-metadata-entry-type-string-literal =" + 20 20 20 20 20 20 64 75 70 20 68 65 78 2d 6f 75 + 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e + 74 72 79 2d 74 79 70 65 2d 73 74 72 69 6e 67 2d + 6c 69 74 65 72 61 6c 20 3d 0a + + ~ " swap dup" + ~ " hex-output-metadata-entry-type-raw-string-literal = ||" + 20 20 20 20 20 20 73 77 61 70 20 64 75 70 20 68 + 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 + 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 2d 72 61 + 77 2d 73 74 72 69 6e 67 2d 6c 69 74 65 72 61 6c + 20 3d 20 7c 7c 0a + + ~ " swap" + ~ " hex-output-metadata-entry-type-push-subitem-string = || {" + 20 20 20 20 20 20 73 77 61 70 20 68 65 78 2d 6f + 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 + 6e 74 72 79 2d 74 79 70 65 2d 70 75 73 68 2d 73 + 75 62 69 74 65 6d 2d 73 74 72 69 6e 67 20 3d 20 + 7c 7c 20 7b 0a + + ~ " dup hex-output-metadata-entry-content @" + 20 20 20 20 20 20 20 20 64 75 70 20 68 65 78 2d + 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 79 2d 63 6f 6e 74 65 6e 74 20 40 0a + + ~ " ~ (source, destination, length, scan pointer," + ~ " content pointer)" + 20 20 20 20 20 20 20 20 7e 20 28 73 6f 75 72 63 + 65 2c 20 64 65 73 74 69 6e 61 74 69 6f 6e 2c 20 + 6c 65 6e 67 74 68 2c 20 73 63 61 6e 20 70 6f 69 + 6e 74 65 72 2c 20 63 6f 6e 74 65 6e 74 20 70 6f + 69 6e 74 65 72 29 0a + + ~ " dup 5 pick <=" + 20 20 20 20 20 20 20 20 64 75 70 20 35 20 70 69 + 63 6b 20 3c 3d 0a + + ~ " ~ (source, destination, length, scan pointer," + ~ " content pointer," + 20 20 20 20 20 20 20 20 7e 20 28 73 6f 75 72 63 + 65 2c 20 64 65 73 74 69 6e 61 74 69 6f 6e 2c 20 + 6c 65 6e 67 74 68 2c 20 73 63 61 6e 20 70 6f 69 + 6e 74 65 72 2c 20 63 6f 6e 74 65 6e 74 20 70 6f + 69 6e 74 65 72 2c 0a + + ~ " ~ lower bound okay)" + 20 20 20 20 20 20 20 20 7e 20 20 6c 6f 77 65 72 + 20 62 6f 75 6e 64 20 6f 6b 61 79 29 0a + + ~ " over 6 pick 5 pick + > && {" + 20 20 20 20 20 20 20 20 6f 76 65 72 20 36 20 70 + 69 63 6b 20 35 20 70 69 63 6b 20 2b 20 3e 20 26 + 26 20 7b 0a + + ~ " ~ (source, destination, length, scan pointer," + ~ " content pointer)" + 20 20 20 20 20 20 20 20 20 20 7e 20 28 73 6f 75 + 72 63 65 2c 20 64 65 73 74 69 6e 61 74 69 6f 6e + 2c 20 6c 65 6e 67 74 68 2c 20 73 63 61 6e 20 70 + 6f 69 6e 74 65 72 2c 20 63 6f 6e 74 65 6e 74 20 + 70 6f 69 6e 74 65 72 29 0a + + ~ " 4 pick - 3 pick +" + 20 20 20 20 20 20 20 20 20 20 34 20 70 69 63 6b + 20 2d 20 33 20 70 69 63 6b 20 2b 0a + + ~ " over hex-output-metadata-entry-content !" + 20 20 20 20 20 20 20 20 20 20 6f 76 65 72 20 68 + 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 + 74 61 2d 65 6e 74 72 79 2d 63 6f 6e 74 65 6e 74 + 20 21 0a + + ~ " } { drop } if-else" + 20 20 20 20 20 20 20 20 7d 20 7b 20 64 72 6f 70 + 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " } if" + 20 20 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " hex-output-metadata-next-entry" + 20 20 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 6e 65 78 74 2d 65 + 6e 74 72 79 0a + + ~ " } while 4 ndrop" + 20 20 20 20 7d 20 77 68 69 6c 65 20 34 20 6e 64 + 72 6f 70 0a + + ~ " } { drop drop drop } if-else ;" + 20 20 7d 20 7b 20 64 72 6f 70 20 64 72 6f 70 20 + 64 72 6f 70 20 7d 20 69 66 2d 65 6c 73 65 20 3b + 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ By overriding colon, we can special-case the" + ~ " definitions of particular" + 7e 20 20 20 42 79 20 6f 76 65 72 72 69 64 69 6e + 67 20 63 6f 6c 6f 6e 2c 20 77 65 20 63 61 6e 20 + 73 70 65 63 69 61 6c 2d 63 61 73 65 20 74 68 65 + 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 6f 66 20 + 70 61 72 74 69 63 75 6c 61 72 0a + + ~ "~ words. It's very metacircular." + 7e 20 77 6f 72 64 73 2e 20 49 74 27 73 20 76 65 + 72 79 20 6d 65 74 61 63 69 72 63 75 6c 61 72 2e + 0a + + ~ "~" + 7e 0a + + ~ "~ This lets us prepend trap code to the original" + ~ " definition. For those not" + 7e 20 20 20 54 68 69 73 20 6c 65 74 73 20 75 73 + 20 70 72 65 70 65 6e 64 20 74 72 61 70 20 63 6f + 64 65 20 74 6f 20 74 68 65 20 6f 72 69 67 69 6e + 61 6c 20 64 65 66 69 6e 69 74 69 6f 6e 2e 20 46 + 6f 72 20 74 68 6f 73 65 20 6e 6f 74 0a + + ~ "~ familiar, a "trap" in systems programming is code that" + ~ " runs instead of some" + 7e 20 66 61 6d 69 6c 69 61 72 2c 20 61 20 22 74 + 72 61 70 22 20 69 6e 20 73 79 73 74 65 6d 73 20 + 70 72 6f 67 72 61 6d 6d 69 6e 67 20 69 73 20 63 + 6f 64 65 20 74 68 61 74 20 72 75 6e 73 20 69 6e + 73 74 65 61 64 20 6f 66 20 73 6f 6d 65 0a + + ~ "~ other, pre-existing code, by violating the usual" + ~ " abstractions in some way." + 7e 20 6f 74 68 65 72 2c 20 70 72 65 2d 65 78 69 + 73 74 69 6e 67 20 63 6f 64 65 2c 20 62 79 20 76 + 69 6f 6c 61 74 69 6e 67 20 74 68 65 20 75 73 75 + 61 6c 20 61 62 73 74 72 61 63 74 69 6f 6e 73 20 + 69 6e 20 73 6f 6d 65 20 77 61 79 2e 0a + + ~ "~ We implement our traps by creating the word header," + ~ " including the docol" + 7e 20 57 65 20 69 6d 70 6c 65 6d 65 6e 74 20 6f + 75 72 20 74 72 61 70 73 20 62 79 20 63 72 65 61 + 74 69 6e 67 20 74 68 65 20 77 6f 72 64 20 68 65 + 61 64 65 72 2c 20 69 6e 63 6c 75 64 69 6e 67 20 + 74 68 65 20 64 6f 63 6f 6c 0a + + ~ "~ pointer, then compiling the trap code before we return" + ~ " from the colon" + 7e 20 70 6f 69 6e 74 65 72 2c 20 74 68 65 6e 20 + 63 6f 6d 70 69 6c 69 6e 67 20 74 68 65 20 74 72 + 61 70 20 63 6f 64 65 20 62 65 66 6f 72 65 20 77 + 65 20 72 65 74 75 72 6e 20 66 72 6f 6d 20 74 68 + 65 20 63 6f 6c 6f 6e 0a + + ~ "~ alternate, so that it's already been output before the" + ~ " original word's body" + 7e 20 61 6c 74 65 72 6e 61 74 65 2c 20 73 6f 20 + 74 68 61 74 20 69 74 27 73 20 61 6c 72 65 61 64 + 79 20 62 65 65 6e 20 6f 75 74 70 75 74 20 62 65 + 66 6f 72 65 20 74 68 65 20 6f 72 69 67 69 6e 61 + 6c 20 77 6f 72 64 27 73 20 62 6f 64 79 0a + + ~ "~ starts to compile." + 7e 20 73 74 61 72 74 73 20 74 6f 20 63 6f 6d 70 + 69 6c 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Prepending our trap code to the original code like this" + ~ " can also be used" + 7e 20 20 20 50 72 65 70 65 6e 64 69 6e 67 20 6f + 75 72 20 74 72 61 70 20 63 6f 64 65 20 74 6f 20 + 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 63 6f 64 + 65 20 6c 69 6b 65 20 74 68 69 73 20 63 61 6e 20 + 61 6c 73 6f 20 62 65 20 75 73 65 64 0a + + ~ "~ to get the effect of replacing the original code entirely" + ~ " by calling "exit"" + 7e 20 74 6f 20 67 65 74 20 74 68 65 20 65 66 66 + 65 63 74 20 6f 66 20 72 65 70 6c 61 63 69 6e 67 + 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 63 6f + 64 65 20 65 6e 74 69 72 65 6c 79 20 62 79 20 63 + 61 6c 6c 69 6e 67 20 22 65 78 69 74 22 0a + + ~ "~ at the end of our trap. The original code will still be" + ~ " compiled, after the" + 7e 20 61 74 20 74 68 65 20 65 6e 64 20 6f 66 20 + 6f 75 72 20 74 72 61 70 2e 20 54 68 65 20 6f 72 + 69 67 69 6e 61 6c 20 63 6f 64 65 20 77 69 6c 6c + 20 73 74 69 6c 6c 20 62 65 20 63 6f 6d 70 69 6c + 65 64 2c 20 61 66 74 65 72 20 74 68 65 0a + + ~ "~ trap code, but doing this will make sure it doesn't run." + ~ " Most of the time," + 7e 20 74 72 61 70 20 63 6f 64 65 2c 20 62 75 74 + 20 64 6f 69 6e 67 20 74 68 69 73 20 77 69 6c 6c + 20 6d 61 6b 65 20 73 75 72 65 20 69 74 20 64 6f + 65 73 6e 27 74 20 72 75 6e 2e 20 4d 6f 73 74 20 + 6f 66 20 74 68 65 20 74 69 6d 65 2c 0a + + ~ "~ though, we do want to run the original code, so we allow" + ~ " the trap to fall" + 7e 20 74 68 6f 75 67 68 2c 20 77 65 20 64 6f 20 + 77 61 6e 74 20 74 6f 20 72 75 6e 20 74 68 65 20 + 6f 72 69 67 69 6e 61 6c 20 63 6f 64 65 2c 20 73 + 6f 20 77 65 20 61 6c 6c 6f 77 20 74 68 65 20 74 + 72 61 70 20 74 6f 20 66 61 6c 6c 0a + + ~ "~ through to it. We carefully note fall-through with" + ~ " comments, to make the" + 7e 20 74 68 72 6f 75 67 68 20 74 6f 20 69 74 2e + 20 57 65 20 63 61 72 65 66 75 6c 6c 79 20 6e 6f + 74 65 20 66 61 6c 6c 2d 74 68 72 6f 75 67 68 20 + 77 69 74 68 20 63 6f 6d 6d 65 6e 74 73 2c 20 74 + 6f 20 6d 61 6b 65 20 74 68 65 0a + + ~ "~ traps easier to maintain." + 7e 20 74 72 61 70 73 20 65 61 73 69 65 72 20 74 + 6f 20 6d 61 69 6e 74 61 69 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The kinds of side-effects we care about can all be" + ~ " written this way," + 7e 20 20 20 54 68 65 20 6b 69 6e 64 73 20 6f 66 + 20 73 69 64 65 2d 65 66 66 65 63 74 73 20 77 65 + 20 63 61 72 65 20 61 62 6f 75 74 20 63 61 6e 20 + 61 6c 6c 20 62 65 20 77 72 69 74 74 65 6e 20 74 + 68 69 73 20 77 61 79 2c 0a + + ~ "~ though occasionally we wind up having to compute an" + ~ " intermediate value that" + 7e 20 74 68 6f 75 67 68 20 6f 63 63 61 73 69 6f + 6e 61 6c 6c 79 20 77 65 20 77 69 6e 64 20 75 70 + 20 68 61 76 69 6e 67 20 74 6f 20 63 6f 6d 70 75 + 74 65 20 61 6e 20 69 6e 74 65 72 6d 65 64 69 61 + 74 65 20 76 61 6c 75 65 20 74 68 61 74 0a + + ~ "~ the code we're trapping will then compute independently," + ~ " and it's important" + 7e 20 74 68 65 20 63 6f 64 65 20 77 65 27 72 65 + 20 74 72 61 70 70 69 6e 67 20 77 69 6c 6c 20 74 + 68 65 6e 20 63 6f 6d 70 75 74 65 20 69 6e 64 65 + 70 65 6e 64 65 6e 74 6c 79 2c 20 61 6e 64 20 69 + 74 27 73 20 69 6d 70 6f 72 74 61 6e 74 0a + + ~ "~ to keep those implementations in sync." + 7e 20 74 6f 20 6b 65 65 70 20 74 68 6f 73 65 20 + 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 20 + 69 6e 20 73 79 6e 63 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The most significant challenge is that, because our" + ~ " trap will be defined" + 7e 20 20 20 54 68 65 20 6d 6f 73 74 20 73 69 67 + 6e 69 66 69 63 61 6e 74 20 63 68 61 6c 6c 65 6e + 67 65 20 69 73 20 74 68 61 74 2c 20 62 65 63 61 + 75 73 65 20 6f 75 72 20 74 72 61 70 20 77 69 6c + 6c 20 62 65 20 64 65 66 69 6e 65 64 0a + + ~ "~ at the same point in loading as the original word would" + ~ " be, it can only use" + 7e 20 61 74 20 74 68 65 20 73 61 6d 65 20 70 6f + 69 6e 74 20 69 6e 20 6c 6f 61 64 69 6e 67 20 61 + 73 20 74 68 65 20 6f 72 69 67 69 6e 61 6c 20 77 + 6f 72 64 20 77 6f 75 6c 64 20 62 65 2c 20 69 74 + 20 63 61 6e 20 6f 6e 6c 79 20 75 73 65 0a + + ~ "~ words that are available at that point. Occasionally this" + ~ " results in some" + 7e 20 77 6f 72 64 73 20 74 68 61 74 20 61 72 65 + 20 61 76 61 69 6c 61 62 6c 65 20 61 74 20 74 68 + 61 74 20 70 6f 69 6e 74 2e 20 4f 63 63 61 73 69 + 6f 6e 61 6c 6c 79 20 74 68 69 73 20 72 65 73 75 + 6c 74 73 20 69 6e 20 73 6f 6d 65 0a + + ~ "~ awkwardness." + 7e 20 61 77 6b 77 61 72 64 6e 65 73 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Code for these traps winds up looking a lot like code" + ~ " written for log-load" + 7e 20 20 20 43 6f 64 65 20 66 6f 72 20 74 68 65 + 73 65 20 74 72 61 70 73 20 77 69 6e 64 73 20 75 + 70 20 6c 6f 6f 6b 69 6e 67 20 61 20 6c 6f 74 20 + 6c 69 6b 65 20 63 6f 64 65 20 77 72 69 74 74 65 + 6e 20 66 6f 72 20 6c 6f 67 2d 6c 6f 61 64 0a + + ~ "~ alternates, in that we have to do the dictionary lookups" + ~ " and other" + 7e 20 61 6c 74 65 72 6e 61 74 65 73 2c 20 69 6e + 20 74 68 61 74 20 77 65 20 68 61 76 65 20 74 6f + 20 64 6f 20 74 68 65 20 64 69 63 74 69 6f 6e 61 + 72 79 20 6c 6f 6f 6b 75 70 73 20 61 6e 64 20 6f + 74 68 65 72 0a + + ~ "~ compilation ourselves." + 7e 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 6f 75 + 72 73 65 6c 76 65 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ At times, we also need to trap words that are" + ~ " implemented in assembler." + 7e 20 20 20 41 74 20 74 69 6d 65 73 2c 20 77 65 + 20 61 6c 73 6f 20 6e 65 65 64 20 74 6f 20 74 72 + 61 70 20 77 6f 72 64 73 20 74 68 61 74 20 61 72 + 65 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 69 6e + 20 61 73 73 65 6d 62 6c 65 72 2e 0a + + ~ "~ The most notable of these is "sys-write", which is" + ~ " fundamental to what the" + 7e 20 54 68 65 20 6d 6f 73 74 20 6e 6f 74 61 62 + 6c 65 20 6f 66 20 74 68 65 73 65 20 69 73 20 22 + 73 79 73 2d 77 72 69 74 65 22 2c 20 77 68 69 63 + 68 20 69 73 20 66 75 6e 64 61 6d 65 6e 74 61 6c + 20 74 6f 20 77 68 61 74 20 74 68 65 0a + + ~ "~ hex transform does. The details of how we make our traps" + ~ " work with assembler" + 7e 20 68 65 78 20 74 72 61 6e 73 66 6f 72 6d 20 + 64 6f 65 73 2e 20 54 68 65 20 64 65 74 61 69 6c + 73 20 6f 66 20 68 6f 77 20 77 65 20 6d 61 6b 65 + 20 6f 75 72 20 74 72 61 70 73 20 77 6f 72 6b 20 + 77 69 74 68 20 61 73 73 65 6d 62 6c 65 72 0a + + ~ "~ words are explained below, as they arise." + 7e 20 77 6f 72 64 73 20 61 72 65 20 65 78 70 6c + 61 69 6e 65 64 20 62 65 6c 6f 77 2c 20 61 73 20 + 74 68 65 79 20 61 72 69 73 65 2e 0a + + ~ ": hex-colon-alternate" + 3a 20 68 65 78 2d 63 6f 6c 6f 6e 2d 61 6c 74 65 + 72 6e 61 74 65 0a + + ~ " word value@" + 20 20 77 6f 72 64 20 76 61 6c 75 65 40 0a + + ~ "" + 0a + + ~ " ~ The word "variable" is itself a word-defining word," + ~ " and we will" + 20 20 7e 20 20 20 54 68 65 20 77 6f 72 64 20 22 + 76 61 72 69 61 62 6c 65 22 20 69 73 20 69 74 73 + 65 6c 66 20 61 20 77 6f 72 64 2d 64 65 66 69 6e + 69 6e 67 20 77 6f 72 64 2c 20 61 6e 64 20 77 65 + 20 77 69 6c 6c 0a + + ~ " ~ special-case its definition to special-case the" + ~ " definitions of particular" + 20 20 7e 20 73 70 65 63 69 61 6c 2d 63 61 73 65 + 20 69 74 73 20 64 65 66 69 6e 69 74 69 6f 6e 20 + 74 6f 20 73 70 65 63 69 61 6c 2d 63 61 73 65 20 + 74 68 65 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 + 6f 66 20 70 61 72 74 69 63 75 6c 61 72 0a + + ~ " ~ variables. It's very very metacircular." + 20 20 7e 20 76 61 72 69 61 62 6c 65 73 2e 20 49 + 74 27 73 20 76 65 72 79 20 76 65 72 79 20 6d 65 + 74 61 63 69 72 63 75 6c 61 72 2e 0a + + ~ " dup s" variable" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 76 61 72 69 61 62 6c + 65 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 0a + + ~ " ~ Don't lose track of the layering happening here." + ~ " The word "variable"" + 20 20 20 20 7e 20 20 20 44 6f 6e 27 74 20 6c 6f + 73 65 20 74 72 61 63 6b 20 6f 66 20 74 68 65 20 + 6c 61 79 65 72 69 6e 67 20 68 61 70 70 65 6e 69 + 6e 67 20 68 65 72 65 2e 20 54 68 65 20 77 6f 72 + 64 20 22 76 61 72 69 61 62 6c 65 22 0a + + ~ " ~ is a regular docol word; it's defining a word that's" + ~ " implemented in" + 20 20 20 20 7e 20 69 73 20 61 20 72 65 67 75 6c + 61 72 20 64 6f 63 6f 6c 20 77 6f 72 64 3b 20 69 + 74 27 73 20 64 65 66 69 6e 69 6e 67 20 61 20 77 + 6f 72 64 20 74 68 61 74 27 73 20 69 6d 70 6c 65 + 6d 65 6e 74 65 64 20 69 6e 0a + + ~ " ~ assembly, but it can use whatever Forthy logic it" + ~ " wants to do so. In" + 20 20 20 20 7e 20 61 73 73 65 6d 62 6c 79 2c 20 + 62 75 74 20 69 74 20 63 61 6e 20 75 73 65 20 77 + 68 61 74 65 76 65 72 20 46 6f 72 74 68 79 20 6c + 6f 67 69 63 20 69 74 20 77 61 6e 74 73 20 74 6f + 20 64 6f 20 73 6f 2e 20 49 6e 0a + + ~ " ~ this case we're going to have it run a little extra" + ~ " logic, then continue" + 20 20 20 20 7e 20 74 68 69 73 20 63 61 73 65 20 + 77 65 27 72 65 20 67 6f 69 6e 67 20 74 6f 20 68 + 61 76 65 20 69 74 20 72 75 6e 20 61 20 6c 69 74 + 74 6c 65 20 65 78 74 72 61 20 6c 6f 67 69 63 2c + 20 74 68 65 6e 20 63 6f 6e 74 69 6e 75 65 0a + + ~ " ~ with the rest of its usual definition." + 20 20 20 20 7e 20 77 69 74 68 20 74 68 65 20 72 + 65 73 74 20 6f 66 20 69 74 73 20 75 73 75 61 6c + 20 64 65 66 69 6e 69 74 69 6f 6e 2e 0a + + ~ "" + 0a + + ~ " ~ Before we get to the extra logic, we do want an" + ~ " entry header for" + 20 20 20 20 7e 20 20 20 42 65 66 6f 72 65 20 77 + 65 20 67 65 74 20 74 6f 20 74 68 65 20 65 78 74 + 72 61 20 6c 6f 67 69 63 2c 20 77 65 20 64 6f 20 + 77 61 6e 74 20 61 6e 20 65 6e 74 72 79 20 68 65 + 61 64 65 72 20 66 6f 72 0a + + ~ " ~ "variable" itself, so we do that... This takes care" + ~ " of all of colon's" + 20 20 20 20 7e 20 22 76 61 72 69 61 62 6c 65 22 + 20 69 74 73 65 6c 66 2c 20 73 6f 20 77 65 20 64 + 6f 20 74 68 61 74 2e 2e 2e 20 54 68 69 73 20 74 + 61 6b 65 73 20 63 61 72 65 20 6f 66 20 61 6c 6c + 20 6f 66 20 63 6f 6c 6f 6e 27 73 0a + + ~ " ~ responsibilities except switching to compile mode;" + ~ " we'll do that part" + 20 20 20 20 7e 20 72 65 73 70 6f 6e 73 69 62 69 + 6c 69 74 69 65 73 20 65 78 63 65 70 74 20 73 77 + 69 74 63 68 69 6e 67 20 74 6f 20 63 6f 6d 70 69 + 6c 65 20 6d 6f 64 65 3b 20 77 65 27 6c 6c 20 64 + 6f 20 74 68 61 74 20 70 61 72 74 0a + + ~ " ~ after we've output our payload." + 20 20 20 20 7e 20 61 66 74 65 72 20 77 65 27 76 + 65 20 6f 75 74 70 75 74 20 6f 75 72 20 70 61 79 + 6c 6f 61 64 2e 0a + + ~ " create dropstring" + 20 20 20 20 63 72 65 61 74 65 20 64 72 6f 70 73 + 74 72 69 6e 67 0a + + ~ " s" docol" find entry-to-execution-token execute ," + 20 20 20 20 73 22 20 64 6f 63 6f 6c 22 20 66 69 + 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 + 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 63 + 75 74 65 20 2c 0a + + ~ " make-hidden" + 20 20 20 20 6d 61 6b 65 2d 68 69 64 64 65 6e 0a + + ~ "" + 0a + + ~ " ~ There's two variables that we want to point to the" + ~ " outer backing" + 20 20 20 20 7e 20 20 20 54 68 65 72 65 27 73 20 + 74 77 6f 20 76 61 72 69 61 62 6c 65 73 20 74 68 + 61 74 20 77 65 20 77 61 6e 74 20 74 6f 20 70 6f + 69 6e 74 20 74 6f 20 74 68 65 20 6f 75 74 65 72 + 20 62 61 63 6b 69 6e 67 0a + + ~ " ~ stores, rather than the inner ones. The code for that" + ~ " is a bit" + 20 20 20 20 7e 20 73 74 6f 72 65 73 2c 20 72 61 + 74 68 65 72 20 74 68 61 6e 20 74 68 65 20 69 6e + 6e 65 72 20 6f 6e 65 73 2e 20 54 68 65 20 63 6f + 64 65 20 66 6f 72 20 74 68 61 74 20 69 73 20 61 + 20 62 69 74 0a + + ~ " ~ repetitive, so we have a helper for it; see above." + 20 20 20 20 7e 20 72 65 70 65 74 69 74 69 76 65 + 2c 20 73 6f 20 77 65 20 68 61 76 65 20 61 20 68 + 65 6c 70 65 72 20 66 6f 72 20 69 74 3b 20 73 65 + 65 20 61 62 6f 76 65 2e 0a + + ~ " ~" + 20 20 20 20 7e 0a + + ~ " ~ It is worth stopping to contemplate the meaning of" + ~ " sharing these two" + 20 20 20 20 7e 20 20 20 49 74 20 69 73 20 77 6f + 72 74 68 20 73 74 6f 70 70 69 6e 67 20 74 6f 20 + 63 6f 6e 74 65 6d 70 6c 61 74 65 20 74 68 65 20 + 6d 65 61 6e 69 6e 67 20 6f 66 20 73 68 61 72 69 + 6e 67 20 74 68 65 73 65 20 74 77 6f 0a + + ~ " ~ variables in particular between the inner and outer" + ~ " contexts." + 20 20 20 20 7e 20 76 61 72 69 61 62 6c 65 73 20 + 69 6e 20 70 61 72 74 69 63 75 6c 61 72 20 62 65 + 74 77 65 65 6e 20 74 68 65 20 69 6e 6e 65 72 20 + 61 6e 64 20 6f 75 74 65 72 20 63 6f 6e 74 65 78 + 74 73 2e 0a + + ~ " ~ Essentially this says that they're both reading the" + ~ " same input stream," + 20 20 20 20 7e 20 45 73 73 65 6e 74 69 61 6c 6c + 79 20 74 68 69 73 20 73 61 79 73 20 74 68 61 74 + 20 74 68 65 79 27 72 65 20 62 6f 74 68 20 72 65 + 61 64 69 6e 67 20 74 68 65 20 73 61 6d 65 20 69 + 6e 70 75 74 20 73 74 72 65 61 6d 2c 0a + + ~ " ~ and the two copies of the interpreter both share the" + ~ " same state. Thus," + 20 20 20 20 7e 20 61 6e 64 20 74 68 65 20 74 77 + 6f 20 63 6f 70 69 65 73 20 6f 66 20 74 68 65 20 + 69 6e 74 65 72 70 72 65 74 65 72 20 62 6f 74 68 + 20 73 68 61 72 65 20 74 68 65 20 73 61 6d 65 20 + 73 74 61 74 65 2e 20 54 68 75 73 2c 0a + + ~ " ~ trading off responsibility for lexing between inner" + ~ " and outer contexts" + 20 20 20 20 7e 20 74 72 61 64 69 6e 67 20 6f 66 + 66 20 72 65 73 70 6f 6e 73 69 62 69 6c 69 74 79 + 20 66 6f 72 20 6c 65 78 69 6e 67 20 62 65 74 77 + 65 65 6e 20 69 6e 6e 65 72 20 61 6e 64 20 6f 75 + 74 65 72 20 63 6f 6e 74 65 78 74 73 0a + + ~ " ~ works just like trading off responsibility between" + ~ " two interpreters" + 20 20 20 20 7e 20 77 6f 72 6b 73 20 6a 75 73 74 + 20 6c 69 6b 65 20 74 72 61 64 69 6e 67 20 6f 66 + 66 20 72 65 73 70 6f 6e 73 69 62 69 6c 69 74 79 + 20 62 65 74 77 65 65 6e 20 74 77 6f 20 69 6e 74 + 65 72 70 72 65 74 65 72 73 0a + + ~ " ~ when there's no transformation involved, or between a" + ~ " regular" + 20 20 20 20 7e 20 77 68 65 6e 20 74 68 65 72 65 + 27 73 20 6e 6f 20 74 72 61 6e 73 66 6f 72 6d 61 + 74 69 6f 6e 20 69 6e 76 6f 6c 76 65 64 2c 20 6f + 72 20 62 65 74 77 65 65 6e 20 61 20 72 65 67 75 + 6c 61 72 0a + + ~ " ~ interpreter and a transform." + 20 20 20 20 7e 20 69 6e 74 65 72 70 72 65 74 65 + 72 20 61 6e 64 20 61 20 74 72 61 6e 73 66 6f 72 + 6d 2e 0a + + ~ " ~" + 20 20 20 20 7e 0a + + ~ " ~ If we didn't do this, we'd still have to invent" + ~ " some way to control" + 20 20 20 20 7e 20 20 20 49 66 20 77 65 20 64 69 + 64 6e 27 74 20 64 6f 20 74 68 69 73 2c 20 77 65 + 27 64 20 73 74 69 6c 6c 20 68 61 76 65 20 74 6f + 20 69 6e 76 65 6e 74 20 73 6f 6d 65 20 77 61 79 + 20 74 6f 20 63 6f 6e 74 72 6f 6c 0a + + ~ " ~ what input the inner context sees, and the concept of" + ~ " "the next" + 20 20 20 20 7e 20 77 68 61 74 20 69 6e 70 75 74 + 20 74 68 65 20 69 6e 6e 65 72 20 63 6f 6e 74 65 + 78 74 20 73 65 65 73 2c 20 61 6e 64 20 74 68 65 + 20 63 6f 6e 63 65 70 74 20 6f 66 20 22 74 68 65 + 20 6e 65 78 74 0a + + ~ " ~ character" would become more complex during the" + ~ " transform and require" + 20 20 20 20 7e 20 63 68 61 72 61 63 74 65 72 22 + 20 77 6f 75 6c 64 20 62 65 63 6f 6d 65 20 6d 6f + 72 65 20 63 6f 6d 70 6c 65 78 20 64 75 72 69 6e + 67 20 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 20 + 61 6e 64 20 72 65 71 75 69 72 65 0a + + ~ " ~ care and attention. Sharing this stuff keeps it" + ~ " simple." + 20 20 20 20 7e 20 63 61 72 65 20 61 6e 64 20 61 + 74 74 65 6e 74 69 6f 6e 2e 20 53 68 61 72 69 6e + 67 20 74 68 69 73 20 73 74 75 66 66 20 6b 65 65 + 70 73 20 69 74 20 73 69 6d 70 6c 65 2e 0a + + ~ " s" interpreter-flags" hex-variable-use-outer" + 20 20 20 20 73 22 20 69 6e 74 65 72 70 72 65 74 + 65 72 2d 66 6c 61 67 73 22 20 68 65 78 2d 76 61 + 72 69 61 62 6c 65 2d 75 73 65 2d 6f 75 74 65 72 + 0a + + ~ " s" main-input-buffer" hex-variable-use-outer" + 20 20 20 20 73 22 20 6d 61 69 6e 2d 69 6e 70 75 + 74 2d 62 75 66 66 65 72 22 20 68 65 78 2d 76 61 + 72 69 61 62 6c 65 2d 75 73 65 2d 6f 75 74 65 72 + 0a + + ~ " ~ After this, we can return control to the" + ~ " regularly-scheduled" + 20 20 20 20 7e 20 20 20 41 66 74 65 72 20 74 68 + 69 73 2c 20 77 65 20 63 61 6e 20 72 65 74 75 72 + 6e 20 63 6f 6e 74 72 6f 6c 20 74 6f 20 74 68 65 + 20 72 65 67 75 6c 61 72 6c 79 2d 73 63 68 65 64 + 75 6c 65 64 0a + + ~ " ~ "variable", which will do the "create" and all that." + ~ " That stuff isn't" + 20 20 20 20 7e 20 22 76 61 72 69 61 62 6c 65 22 + 2c 20 77 68 69 63 68 20 77 69 6c 6c 20 64 6f 20 + 74 68 65 20 22 63 72 65 61 74 65 22 20 61 6e 64 + 20 61 6c 6c 20 74 68 61 74 2e 20 54 68 61 74 20 + 73 74 75 66 66 20 69 73 6e 27 74 0a + + ~ " ~ colon's responsibility, so it isn't our" + ~ " responsibility, it'll happen" + 20 20 20 20 7e 20 63 6f 6c 6f 6e 27 73 20 72 65 + 73 70 6f 6e 73 69 62 69 6c 69 74 79 2c 20 73 6f + 20 69 74 20 69 73 6e 27 74 20 6f 75 72 20 72 65 + 73 70 6f 6e 73 69 62 69 6c 69 74 79 2c 20 69 74 + 27 6c 6c 20 68 61 70 70 65 6e 0a + + ~ " ~ regardless." + 20 20 20 20 7e 20 72 65 67 61 72 64 6c 65 73 73 + 2e 0a + + ~ "" + 0a + + ~ " ~ Notably, we do NOT share transformation-state." + ~ " There are at least a" + 20 20 20 20 7e 20 20 20 4e 6f 74 61 62 6c 79 2c + 20 77 65 20 64 6f 20 4e 4f 54 20 73 68 61 72 65 + 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d + 73 74 61 74 65 2e 20 54 68 65 72 65 20 61 72 65 + 20 61 74 20 6c 65 61 73 74 20 61 0a + + ~ " ~ hundred places where it would need to be carefully" + ~ " swapped, and we" + 20 20 20 20 7e 20 68 75 6e 64 72 65 64 20 70 6c + 61 63 65 73 20 77 68 65 72 65 20 69 74 20 77 6f + 75 6c 64 20 6e 65 65 64 20 74 6f 20 62 65 20 63 + 61 72 65 66 75 6c 6c 79 20 73 77 61 70 70 65 64 + 2c 20 61 6e 64 20 77 65 0a + + ~ " ~ already have quite enough of that kind of brittleness" + ~ " in the log-load" + 20 20 20 20 7e 20 61 6c 72 65 61 64 79 20 68 61 + 76 65 20 71 75 69 74 65 20 65 6e 6f 75 67 68 20 + 6f 66 20 74 68 61 74 20 6b 69 6e 64 20 6f 66 20 + 62 72 69 74 74 6c 65 6e 65 73 73 20 69 6e 20 74 + 68 65 20 6c 6f 67 2d 6c 6f 61 64 0a + + ~ " ~ transform. Plus, there's no obvious way to do a real" + ~ " push/pop notion for" + 20 20 20 20 7e 20 74 72 61 6e 73 66 6f 72 6d 2e + 20 50 6c 75 73 2c 20 74 68 65 72 65 27 73 20 6e + 6f 20 6f 62 76 69 6f 75 73 20 77 61 79 20 74 6f + 20 64 6f 20 61 20 72 65 61 6c 20 70 75 73 68 2f + 70 6f 70 20 6e 6f 74 69 6f 6e 20 66 6f 72 0a + + ~ " ~ it, so we wouldn't get arbitrary nesting of" + ~ " transforms anyway. By" + 20 20 20 20 7e 20 69 74 2c 20 73 6f 20 77 65 20 + 77 6f 75 6c 64 6e 27 74 20 67 65 74 20 61 72 62 + 69 74 72 61 72 79 20 6e 65 73 74 69 6e 67 20 6f + 66 20 74 72 61 6e 73 66 6f 72 6d 73 20 61 6e 79 + 77 61 79 2e 20 42 79 0a + + ~ " ~ letting the code inside the hex transform have its" + ~ " own, separate copy of" + 20 20 20 20 7e 20 6c 65 74 74 69 6e 67 20 74 68 + 65 20 63 6f 64 65 20 69 6e 73 69 64 65 20 74 68 + 65 20 68 65 78 20 74 72 61 6e 73 66 6f 72 6d 20 + 68 61 76 65 20 69 74 73 20 6f 77 6e 2c 20 73 65 + 70 61 72 61 74 65 20 63 6f 70 79 20 6f 66 0a + + ~ " ~ transformation-state, we avoid that problem entirely," + ~ " and it's still not" + 20 20 20 20 7e 20 74 72 61 6e 73 66 6f 72 6d 61 + 74 69 6f 6e 2d 73 74 61 74 65 2c 20 77 65 20 61 + 76 6f 69 64 20 74 68 61 74 20 70 72 6f 62 6c 65 + 6d 20 65 6e 74 69 72 65 6c 79 2c 20 61 6e 64 20 + 69 74 27 73 20 73 74 69 6c 6c 20 6e 6f 74 0a + + ~ " ~ hard to access the "other" one when circumstances" + ~ " require." + 20 20 20 20 7e 20 68 61 72 64 20 74 6f 20 61 63 + 63 65 73 73 20 74 68 65 20 22 6f 74 68 65 72 22 + 20 6f 6e 65 20 77 68 65 6e 20 63 69 72 63 75 6d + 73 74 61 6e 63 65 73 20 72 65 71 75 69 72 65 2e + 0a + + ~ "" + 0a + + ~ " ~ Now we close out colon's responsibilities by" + ~ " switching to compile" + 20 20 20 20 7e 20 20 20 4e 6f 77 20 77 65 20 63 + 6c 6f 73 65 20 6f 75 74 20 63 6f 6c 6f 6e 27 73 + 20 72 65 73 70 6f 6e 73 69 62 69 6c 69 74 69 65 + 73 20 62 79 20 73 77 69 74 63 68 69 6e 67 20 74 + 6f 20 63 6f 6d 70 69 6c 65 0a + + ~ " ~ mode. We return from colon after this. The hex" + ~ " transform will continue" + 20 20 20 20 7e 20 6d 6f 64 65 2e 20 57 65 20 72 + 65 74 75 72 6e 20 66 72 6f 6d 20 63 6f 6c 6f 6e + 20 61 66 74 65 72 20 74 68 69 73 2e 20 54 68 65 + 20 68 65 78 20 74 72 61 6e 73 66 6f 72 6d 20 77 + 69 6c 6c 20 63 6f 6e 74 69 6e 75 65 0a + + ~ " ~ by processing the source words that form the regular" + ~ " body of "variable"," + 20 20 20 20 7e 20 62 79 20 70 72 6f 63 65 73 73 + 69 6e 67 20 74 68 65 20 73 6f 75 72 63 65 20 77 + 6f 72 64 73 20 74 68 61 74 20 66 6f 72 6d 20 74 + 68 65 20 72 65 67 75 6c 61 72 20 62 6f 64 79 20 + 6f 66 20 22 76 61 72 69 61 62 6c 65 22 2c 0a + + ~ " ~ eventually hitting the matching semicolon. Our" + ~ " friendly tampering is" + 20 20 20 20 7e 20 65 76 65 6e 74 75 61 6c 6c 79 + 20 68 69 74 74 69 6e 67 20 74 68 65 20 6d 61 74 + 63 68 69 6e 67 20 73 65 6d 69 63 6f 6c 6f 6e 2e + 20 4f 75 72 20 66 72 69 65 6e 64 6c 79 20 74 61 + 6d 70 65 72 69 6e 67 20 69 73 0a + + ~ " ~ now complete!" + 20 20 20 20 7e 20 6e 6f 77 20 63 6f 6d 70 6c 65 + 74 65 21 0a + + ~ " ' ] entry-to-execution-token execute" + 20 20 20 20 27 20 5d 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 65 78 65 63 75 74 65 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ Now we want to override s". As usual, that's the" + ~ " single most annoying" + 20 20 7e 20 20 20 4e 6f 77 20 77 65 20 77 61 6e + 74 20 74 6f 20 6f 76 65 72 72 69 64 65 20 73 22 + 2e 20 41 73 20 75 73 75 61 6c 2c 20 74 68 61 74 + 27 73 20 74 68 65 20 73 69 6e 67 6c 65 20 6d 6f + 73 74 20 61 6e 6e 6f 79 69 6e 67 0a + + ~ " ~ string to quote, so we cheat." + 20 20 7e 20 73 74 72 69 6e 67 20 74 6f 20 71 75 + 6f 74 65 2c 20 73 6f 20 77 65 20 63 68 65 61 74 + 2e 0a + + ~ " dup ' s" entry-to-name stringcmp 0 = {" + 20 20 64 75 70 20 27 20 73 22 20 65 6e 74 72 79 + 2d 74 6f 2d 6e 61 6d 65 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 0a + + ~ " ~ Create the word header. It's a normal docol word, so" + ~ " that much is" + 20 20 20 20 7e 20 20 43 72 65 61 74 65 20 74 68 + 65 20 77 6f 72 64 20 68 65 61 64 65 72 2e 20 49 + 74 27 73 20 61 20 6e 6f 72 6d 61 6c 20 64 6f 63 + 6f 6c 20 77 6f 72 64 2c 20 73 6f 20 74 68 61 74 + 20 6d 75 63 68 20 69 73 0a + + ~ " ~ simple." + 20 20 20 20 7e 20 73 69 6d 70 6c 65 2e 0a + + ~ " create dropstring" + 20 20 20 20 63 72 65 61 74 65 20 64 72 6f 70 73 + 74 72 69 6e 67 0a + + ~ " s" docol" find entry-to-execution-token execute ," + 20 20 20 20 73 22 20 64 6f 63 6f 6c 22 20 66 69 + 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 + 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 63 + 75 74 65 20 2c 0a + + ~ " make-hidden" + 20 20 20 20 6d 61 6b 65 2d 68 69 64 64 65 6e 0a + + ~ "" + 0a + + ~ " ~ This time around we would really rather just always" + ~ " use the alternate," + 20 20 20 20 7e 20 20 20 54 68 69 73 20 74 69 6d + 65 20 61 72 6f 75 6e 64 20 77 65 20 77 6f 75 6c + 64 20 72 65 61 6c 6c 79 20 72 61 74 68 65 72 20 + 6a 75 73 74 20 61 6c 77 61 79 73 20 75 73 65 20 + 74 68 65 20 61 6c 74 65 72 6e 61 74 65 2c 0a + + ~ " ~ which already untangles the layered nonsense. So we" + ~ " have the payload" + 20 20 20 20 7e 20 77 68 69 63 68 20 61 6c 72 65 + 61 64 79 20 75 6e 74 61 6e 67 6c 65 73 20 74 68 + 65 20 6c 61 79 65 72 65 64 20 6e 6f 6e 73 65 6e + 73 65 2e 20 53 6f 20 77 65 20 68 61 76 65 20 74 + 68 65 20 70 61 79 6c 6f 61 64 0a + + ~ " ~ call the alternate directly, then exit. We could come" + ~ " up with a way to" + 20 20 20 20 7e 20 63 61 6c 6c 20 74 68 65 20 61 + 6c 74 65 72 6e 61 74 65 20 64 69 72 65 63 74 6c + 79 2c 20 74 68 65 6e 20 65 78 69 74 2e 20 57 65 + 20 63 6f 75 6c 64 20 63 6f 6d 65 20 75 70 20 77 + 69 74 68 20 61 20 77 61 79 20 74 6f 0a + + ~ " ~ then skip forward in the code under transformation," + ~ " but that would be" + 20 20 20 20 7e 20 74 68 65 6e 20 73 6b 69 70 20 + 66 6f 72 77 61 72 64 20 69 6e 20 74 68 65 20 63 + 6f 64 65 20 75 6e 64 65 72 20 74 72 61 6e 73 66 + 6f 72 6d 61 74 69 6f 6e 2c 20 62 75 74 20 74 68 + 61 74 20 77 6f 75 6c 64 20 62 65 0a + + ~ " ~ complex, and it's unnecessary: We let it keep" + ~ " running, outputting the" + 20 20 20 20 7e 20 63 6f 6d 70 6c 65 78 2c 20 61 + 6e 64 20 69 74 27 73 20 75 6e 6e 65 63 65 73 73 + 61 72 79 3a 20 57 65 20 6c 65 74 20 69 74 20 6b + 65 65 70 20 72 75 6e 6e 69 6e 67 2c 20 6f 75 74 + 70 75 74 74 69 6e 67 20 74 68 65 0a + + ~ " ~ usual body of s", which we know will never be" + ~ " reached." + 20 20 20 20 7e 20 75 73 75 61 6c 20 62 6f 64 79 + 20 6f 66 20 73 22 2c 20 77 68 69 63 68 20 77 65 + 20 6b 6e 6f 77 20 77 69 6c 6c 20 6e 65 76 65 72 + 20 62 65 20 72 65 61 63 68 65 64 2e 0a + + ~ " ' hex-string-alternate entry-to-execution-token ," + 20 20 20 20 27 20 68 65 78 2d 73 74 72 69 6e 67 + 2d 61 6c 74 65 72 6e 61 74 65 20 65 6e 74 72 79 + 2d 74 6f 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f + 6b 65 6e 20 2c 0a + + ~ " s" exit" find entry-to-execution-token ," + 20 20 20 20 73 22 20 65 78 69 74 22 20 66 69 6e + 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ "" + 0a + + ~ " ~ As before, finish up colon's responsibilities, then" + ~ " return control to" + 20 20 20 20 7e 20 20 20 41 73 20 62 65 66 6f 72 + 65 2c 20 66 69 6e 69 73 68 20 75 70 20 63 6f 6c + 6f 6e 27 73 20 72 65 73 70 6f 6e 73 69 62 69 6c + 69 74 69 65 73 2c 20 74 68 65 6e 20 72 65 74 75 + 72 6e 20 63 6f 6e 74 72 6f 6c 20 74 6f 0a + + ~ " ~ the code under transformation." + 20 20 20 20 7e 20 74 68 65 20 63 6f 64 65 20 75 + 6e 64 65 72 20 74 72 61 6e 73 66 6f 72 6d 61 74 + 69 6f 6e 2e 0a + + ~ " ' ] entry-to-execution-token execute" + 20 20 20 20 27 20 5d 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 65 78 65 63 75 74 65 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ Same deal for .". Hey, we're getting good at this!" + 20 20 7e 20 53 61 6d 65 20 64 65 61 6c 20 66 6f + 72 20 2e 22 2e 20 48 65 79 2c 20 77 65 27 72 65 + 20 67 65 74 74 69 6e 67 20 67 6f 6f 64 20 61 74 + 20 74 68 69 73 21 0a + + ~ " dup ' ." entry-to-name stringcmp 0 = {" + 20 20 64 75 70 20 27 20 2e 22 20 65 6e 74 72 79 + 2d 74 6f 2d 6e 61 6d 65 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 0a + + ~ " create dropstring" + 20 20 20 20 63 72 65 61 74 65 20 64 72 6f 70 73 + 74 72 69 6e 67 0a + + ~ " s" docol" find entry-to-execution-token execute ," + 20 20 20 20 73 22 20 64 6f 63 6f 6c 22 20 66 69 + 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 + 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 63 + 75 74 65 20 2c 0a + + ~ " make-hidden" + 20 20 20 20 6d 61 6b 65 2d 68 69 64 64 65 6e 0a + + ~ "" + 0a + + ~ " ' hex-dot-string-alternate entry-to-execution-token ," + 20 20 20 20 27 20 68 65 78 2d 64 6f 74 2d 73 74 + 72 69 6e 67 2d 61 6c 74 65 72 6e 61 74 65 20 65 + 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 69 6f + 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" exit" find entry-to-execution-token ," + 20 20 20 20 73 22 20 65 78 69 74 22 20 66 69 6e + 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ "" + 0a + + ~ " ' ] entry-to-execution-token execute" + 20 20 20 20 27 20 5d 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 65 78 65 63 75 74 65 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ We want to suppress the behavior of" + ~ " relink-main-input-buffer-to-stdin" + 20 20 7e 20 20 20 57 65 20 77 61 6e 74 20 74 6f + 20 73 75 70 70 72 65 73 73 20 74 68 65 20 62 65 + 68 61 76 69 6f 72 20 6f 66 20 72 65 6c 69 6e 6b + 2d 6d 61 69 6e 2d 69 6e 70 75 74 2d 62 75 66 66 + 65 72 2d 74 6f 2d 73 74 64 69 6e 0a + + ~ " ~ entirely. Happily, that's easy. We need to do this" + ~ " because otherwise the" + 20 20 7e 20 65 6e 74 69 72 65 6c 79 2e 20 48 61 + 70 70 69 6c 79 2c 20 74 68 61 74 27 73 20 65 61 + 73 79 2e 20 57 65 20 6e 65 65 64 20 74 6f 20 64 + 6f 20 74 68 69 73 20 62 65 63 61 75 73 65 20 6f + 74 68 65 72 77 69 73 65 20 74 68 65 0a + + ~ " ~ transformed code will mess with our outer interpreter!" + 20 20 7e 20 74 72 61 6e 73 66 6f 72 6d 65 64 20 + 63 6f 64 65 20 77 69 6c 6c 20 6d 65 73 73 20 77 + 69 74 68 20 6f 75 72 20 6f 75 74 65 72 20 69 6e + 74 65 72 70 72 65 74 65 72 21 0a + + ~ " dup s" relink-main-input-buffer-to-stdin" stringcmp 0 =" + ~ " {" + 20 20 64 75 70 20 73 22 20 72 65 6c 69 6e 6b 2d + 6d 61 69 6e 2d 69 6e 70 75 74 2d 62 75 66 66 65 + 72 2d 74 6f 2d 73 74 64 69 6e 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " create dropstring" + 20 20 20 20 63 72 65 61 74 65 20 64 72 6f 70 73 + 74 72 69 6e 67 0a + + ~ " s" docol" find entry-to-execution-token execute ," + 20 20 20 20 73 22 20 64 6f 63 6f 6c 22 20 66 69 + 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 + 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 63 + 75 74 65 20 2c 0a + + ~ " make-hidden" + 20 20 20 20 6d 61 6b 65 2d 68 69 64 64 65 6e 0a + + ~ "" + 0a + + ~ " ~ Return before doing anything." + 20 20 20 20 7e 20 52 65 74 75 72 6e 20 62 65 66 + 6f 72 65 20 64 6f 69 6e 67 20 61 6e 79 74 68 69 + 6e 67 2e 0a + + ~ " s" exit" find entry-to-execution-token ," + 20 20 20 20 73 22 20 65 78 69 74 22 20 66 69 6e + 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ "" + 0a + + ~ " ' ] entry-to-execution-token execute" + 20 20 20 20 27 20 5d 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 65 78 65 63 75 74 65 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ We are entirely replacing sys-write with our own" + ~ " version. It's an" + 20 20 7e 20 20 20 57 65 20 61 72 65 20 65 6e 74 + 69 72 65 6c 79 20 72 65 70 6c 61 63 69 6e 67 20 + 73 79 73 2d 77 72 69 74 65 20 77 69 74 68 20 6f + 75 72 20 6f 77 6e 20 76 65 72 73 69 6f 6e 2e 20 + 49 74 27 73 20 61 6e 0a + + ~ " ~ assembly word, and we're replacing it with a Forth" + ~ " word, so there's some" + 20 20 7e 20 61 73 73 65 6d 62 6c 79 20 77 6f 72 + 64 2c 20 61 6e 64 20 77 65 27 72 65 20 72 65 70 + 6c 61 63 69 6e 67 20 69 74 20 77 69 74 68 20 61 + 20 46 6f 72 74 68 20 77 6f 72 64 2c 20 73 6f 20 + 74 68 65 72 65 27 73 20 73 6f 6d 65 0a + + ~ " ~ matching code in the ;asm alternate that makes sure to" + ~ " not mess that up." + 20 20 7e 20 6d 61 74 63 68 69 6e 67 20 63 6f 64 + 65 20 69 6e 20 74 68 65 20 3b 61 73 6d 20 61 6c + 74 65 72 6e 61 74 65 20 74 68 61 74 20 6d 61 6b + 65 73 20 73 75 72 65 20 74 6f 20 6e 6f 74 20 6d + 65 73 73 20 74 68 61 74 20 75 70 2e 0a + + ~ " dup s" sys-write" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 73 79 73 2d 77 72 69 + 74 65 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 0a + + ~ " create dropstring" + 20 20 20 20 63 72 65 61 74 65 20 64 72 6f 70 73 + 74 72 69 6e 67 0a + + ~ " s" docol" find entry-to-execution-token execute ," + 20 20 20 20 73 22 20 64 6f 63 6f 6c 22 20 66 69 + 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 + 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 63 + 75 74 65 20 2c 0a + + ~ " make-hidden" + 20 20 20 20 6d 61 6b 65 2d 68 69 64 64 65 6e 0a + + ~ "" + 0a + + ~ " ' hex-sys-write-replacement entry-to-execution-token ," + 20 20 20 20 27 20 68 65 78 2d 73 79 73 2d 77 72 + 69 74 65 2d 72 65 70 6c 61 63 65 6d 65 6e 74 20 + 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 69 + 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" exit" find entry-to-execution-token ," + 20 20 20 20 73 22 20 65 78 69 74 22 20 66 69 6e + 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ "" + 0a + + ~ " ' ] entry-to-execution-token execute" + 20 20 20 20 27 20 5d 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 65 78 65 63 75 74 65 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ Now we have a bunch of patches that keep track of" + ~ " output metadata. These" + 20 20 7e 20 20 20 4e 6f 77 20 77 65 20 68 61 76 + 65 20 61 20 62 75 6e 63 68 20 6f 66 20 70 61 74 + 63 68 65 73 20 74 68 61 74 20 6b 65 65 70 20 74 + 72 61 63 6b 20 6f 66 20 6f 75 74 70 75 74 20 6d + 65 74 61 64 61 74 61 2e 20 54 68 65 73 65 0a + + ~ " ~ are all Forth words, nothing too complicated about the" + ~ " actual patching." + 20 20 7e 20 61 72 65 20 61 6c 6c 20 46 6f 72 74 + 68 20 77 6f 72 64 73 2c 20 6e 6f 74 68 69 6e 67 + 20 74 6f 6f 20 63 6f 6d 70 6c 69 63 61 74 65 64 + 20 61 62 6f 75 74 20 74 68 65 20 61 63 74 75 61 + 6c 20 70 61 74 63 68 69 6e 67 2e 0a + + ~ " dup s" reset-labels" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 72 65 73 65 74 2d 6c + 61 62 65 6c 73 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 0a + + ~ " create dropstring" + 20 20 20 20 63 72 65 61 74 65 20 64 72 6f 70 73 + 74 72 69 6e 67 0a + + ~ " s" docol" find entry-to-execution-token execute ," + 20 20 20 20 73 22 20 64 6f 63 6f 6c 22 20 66 69 + 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 + 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 63 + 75 74 65 20 2c 0a + + ~ " make-hidden" + 20 20 20 20 6d 61 6b 65 2d 68 69 64 64 65 6e 0a + + ~ "" + 0a + + ~ " ~ This is only ever called in one place, the end of a" + ~ " failed iteration" + 20 20 20 20 7e 20 20 20 54 68 69 73 20 69 73 20 + 6f 6e 6c 79 20 65 76 65 72 20 63 61 6c 6c 65 64 + 20 69 6e 20 6f 6e 65 20 70 6c 61 63 65 2c 20 74 + 68 65 20 65 6e 64 20 6f 66 20 61 20 66 61 69 6c + 65 64 20 69 74 65 72 61 74 69 6f 6e 0a + + ~ " ~ of label-loop. We need to reinitialize all the" + ~ " metadata entries whenever" + 20 20 20 20 7e 20 6f 66 20 6c 61 62 65 6c 2d 6c + 6f 6f 70 2e 20 57 65 20 6e 65 65 64 20 74 6f 20 + 72 65 69 6e 69 74 69 61 6c 69 7a 65 20 61 6c 6c + 20 74 68 65 20 6d 65 74 61 64 61 74 61 20 65 6e + 74 72 69 65 73 20 77 68 65 6e 65 76 65 72 0a + + ~ " ~ that happens, and reset-labels is a good semantic" + ~ " match for that" + 20 20 20 20 7e 20 74 68 61 74 20 68 61 70 70 65 + 6e 73 2c 20 61 6e 64 20 72 65 73 65 74 2d 6c 61 + 62 65 6c 73 20 69 73 20 61 20 67 6f 6f 64 20 73 + 65 6d 61 6e 74 69 63 20 6d 61 74 63 68 20 66 6f + 72 20 74 68 61 74 0a + + ~ " ~ behavior, so it's a good place for the hook." + 20 20 20 20 7e 20 62 65 68 61 76 69 6f 72 2c 20 + 73 6f 20 69 74 27 73 20 61 20 67 6f 6f 64 20 70 + 6c 61 63 65 20 66 6f 72 20 74 68 65 20 68 6f 6f + 6b 2e 0a + + ~ " ' create-hex-output-metadata-top-of-file-entries" + 20 20 20 20 27 20 63 72 65 61 74 65 2d 68 65 78 + 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 + 2d 74 6f 70 2d 6f 66 2d 66 69 6c 65 2d 65 6e 74 + 72 69 65 73 0a + + ~ " entry-to-execution-token ," + 20 20 20 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 + 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " ~ Fall through to the inner implementation." + 20 20 20 20 7e 20 46 61 6c 6c 20 74 68 72 6f 75 + 67 68 20 74 6f 20 74 68 65 20 69 6e 6e 65 72 20 + 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2e 0a + + ~ "" + 0a + + ~ " ' ] entry-to-execution-token execute" + 20 20 20 20 27 20 5d 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 65 78 65 63 75 74 65 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup s" set-label" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 73 65 74 2d 6c 61 62 + 65 6c 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 0a + + ~ " create dropstring" + 20 20 20 20 63 72 65 61 74 65 20 64 72 6f 70 73 + 74 72 69 6e 67 0a + + ~ " s" docol" find entry-to-execution-token execute ," + 20 20 20 20 73 22 20 64 6f 63 6f 6c 22 20 66 69 + 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 + 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 63 + 75 74 65 20 2c 0a + + ~ " make-hidden" + 20 20 20 20 6d 61 6b 65 2d 68 69 64 64 65 6e 0a + + ~ "" + 0a + + ~ " ~ (new label value, label entry pointer --)" + 20 20 20 20 7e 20 28 6e 65 77 20 6c 61 62 65 6c + 20 76 61 6c 75 65 2c 20 6c 61 62 65 6c 20 65 6e + 74 72 79 20 70 6f 69 6e 74 65 72 20 2d 2d 29 0a + + ~ " s" 2dup" find entry-to-execution-token ," + 20 20 20 20 73 22 20 32 64 75 70 22 20 66 69 6e + 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " ' hex-set-label-trace entry-to-execution-token ," + 20 20 20 20 27 20 68 65 78 2d 73 65 74 2d 6c 61 + 62 65 6c 2d 74 72 61 63 65 20 65 6e 74 72 79 2d + 74 6f 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b + 65 6e 20 2c 0a + + ~ " ~ Fall through to the inner implementation." + 20 20 20 20 7e 20 46 61 6c 6c 20 74 68 72 6f 75 + 67 68 20 74 6f 20 74 68 65 20 69 6e 6e 65 72 20 + 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2e 0a + + ~ "" + 0a + + ~ " ' ] entry-to-execution-token execute" + 20 20 20 20 27 20 5d 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 65 78 65 63 75 74 65 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ " dup s" packstring" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 70 61 63 6b 73 74 72 + 69 6e 67 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 0a + + ~ " create dropstring" + 20 20 20 20 63 72 65 61 74 65 20 64 72 6f 70 73 + 74 72 69 6e 67 0a + + ~ " s" docol" find entry-to-execution-token execute ," + 20 20 20 20 73 22 20 64 6f 63 6f 6c 22 20 66 69 + 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 + 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 63 + 75 74 65 20 2c 0a + + ~ " make-hidden" + 20 20 20 20 6d 61 6b 65 2d 68 69 64 64 65 6e 0a + + ~ "" + 0a + + ~ " ~ (output point, string pointer)" + 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f + 69 6e 74 2c 20 73 74 72 69 6e 67 20 70 6f 69 6e + 74 65 72 29 0a + + ~ " s" 2dup" find entry-to-execution-token ," + 20 20 20 20 73 22 20 32 64 75 70 22 20 66 69 6e + 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " ~ This one's a lot of work, so we defer to a" + ~ " single-purpose word." + 20 20 20 20 7e 20 54 68 69 73 20 6f 6e 65 27 73 + 20 61 20 6c 6f 74 20 6f 66 20 77 6f 72 6b 2c 20 + 73 6f 20 77 65 20 64 65 66 65 72 20 74 6f 20 61 + 20 73 69 6e 67 6c 65 2d 70 75 72 70 6f 73 65 20 + 77 6f 72 64 2e 0a + + ~ " ' hex-packstring-trace entry-to-execution-token ," + 20 20 20 20 27 20 68 65 78 2d 70 61 63 6b 73 74 + 72 69 6e 67 2d 74 72 61 63 65 20 65 6e 74 72 79 + 2d 74 6f 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f + 6b 65 6e 20 2c 0a + + ~ " ~ Fall through to the inner implementation." + 20 20 20 20 7e 20 46 61 6c 6c 20 74 68 72 6f 75 + 67 68 20 74 6f 20 74 68 65 20 69 6e 6e 65 72 20 + 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2e 0a + + ~ "" + 0a + + ~ " ' ] entry-to-execution-token execute" + 20 20 20 20 27 20 5d 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 65 78 65 63 75 74 65 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ This is highly similar to packstring." + 20 20 7e 20 54 68 69 73 20 69 73 20 68 69 67 68 + 6c 79 20 73 69 6d 69 6c 61 72 20 74 6f 20 70 61 + 63 6b 73 74 72 69 6e 67 2e 0a + + ~ " dup s" pack-raw-string" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 70 61 63 6b 2d 72 61 + 77 2d 73 74 72 69 6e 67 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " create dropstring" + 20 20 20 20 63 72 65 61 74 65 20 64 72 6f 70 73 + 74 72 69 6e 67 0a + + ~ " s" docol" find entry-to-execution-token execute ," + 20 20 20 20 73 22 20 64 6f 63 6f 6c 22 20 66 69 + 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 + 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 63 + 75 74 65 20 2c 0a + + ~ " make-hidden" + 20 20 20 20 6d 61 6b 65 2d 68 69 64 64 65 6e 0a + + ~ "" + 0a + + ~ " ~ (output point, string pointer)" + 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f + 69 6e 74 2c 20 73 74 72 69 6e 67 20 70 6f 69 6e + 74 65 72 29 0a + + ~ " s" 2dup" find entry-to-execution-token ," + 20 20 20 20 73 22 20 32 64 75 70 22 20 66 69 6e + 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" dup" find entry-to-execution-token ," + 20 20 20 20 73 22 20 64 75 70 22 20 66 69 6e 64 + 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 + 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" stringlen" find entry-to-execution-token ," + 20 20 20 20 73 22 20 73 74 72 69 6e 67 6c 65 6e + 22 20 66 69 6e 64 20 65 6e 74 72 79 2d 74 6f 2d + 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 + 2c 0a + + ~ " ~ (output point, string pointer, string length NOT" + ~ " including terminator)" + 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f + 69 6e 74 2c 20 73 74 72 69 6e 67 20 70 6f 69 6e + 74 65 72 2c 20 73 74 72 69 6e 67 20 6c 65 6e 67 + 74 68 20 4e 4f 54 20 69 6e 63 6c 75 64 69 6e 67 + 20 74 65 72 6d 69 6e 61 74 6f 72 29 0a + + ~ "" + 0a + + ~ " ~ Before we add the metadata entry, we also want to" + ~ " call hex-pack-trace" + 20 20 20 20 7e 20 20 20 42 65 66 6f 72 65 20 77 + 65 20 61 64 64 20 74 68 65 20 6d 65 74 61 64 61 + 74 61 20 65 6e 74 72 79 2c 20 77 65 20 61 6c 73 + 6f 20 77 61 6e 74 20 74 6f 20 63 61 6c 6c 20 68 + 65 78 2d 70 61 63 6b 2d 74 72 61 63 65 0a + + ~ " ~ to make sure latest-output-point gets adjusted for" + ~ " the string." + 20 20 20 20 7e 20 74 6f 20 6d 61 6b 65 20 73 75 + 72 65 20 6c 61 74 65 73 74 2d 6f 75 74 70 75 74 + 2d 70 6f 69 6e 74 20 67 65 74 73 20 61 64 6a 75 + 73 74 65 64 20 66 6f 72 20 74 68 65 20 73 74 72 + 69 6e 67 2e 0a + + ~ " ~ Otherwise, we'd see magic comments in the wrong" + ~ " place." + 20 20 20 20 7e 20 4f 74 68 65 72 77 69 73 65 2c + 20 77 65 27 64 20 73 65 65 20 6d 61 67 69 63 20 + 63 6f 6d 6d 65 6e 74 73 20 69 6e 20 74 68 65 20 + 77 72 6f 6e 67 20 70 6c 61 63 65 2e 0a + + ~ " s" 3roll" find entry-to-execution-token ," + 20 20 20 20 73 22 20 33 72 6f 6c 6c 22 20 66 69 + 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 + 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" dup" find entry-to-execution-token ," + 20 20 20 20 73 22 20 64 75 70 22 20 66 69 6e 64 + 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 + 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" lit" find entry-to-execution-token ," + 20 20 20 20 73 22 20 6c 69 74 22 20 66 69 6e 64 + 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 + 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " 4 ," + 20 20 20 20 34 20 2c 0a + + ~ " s" unroll" find entry-to-execution-token ," + 20 20 20 20 73 22 20 75 6e 72 6f 6c 6c 22 20 66 + 69 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 + 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" swap" find entry-to-execution-token ," + 20 20 20 20 73 22 20 73 77 61 70 22 20 66 69 6e + 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" dup" find entry-to-execution-token ," + 20 20 20 20 73 22 20 64 75 70 22 20 66 69 6e 64 + 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 + 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" 3unroll" find entry-to-execution-token ," + 20 20 20 20 73 22 20 33 75 6e 72 6f 6c 6c 22 20 + 66 69 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 + 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " ~ (output point, string pointer, string length NOT" + ~ " including terminator," + 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f + 69 6e 74 2c 20 73 74 72 69 6e 67 20 70 6f 69 6e + 74 65 72 2c 20 73 74 72 69 6e 67 20 6c 65 6e 67 + 74 68 20 4e 4f 54 20 69 6e 63 6c 75 64 69 6e 67 + 20 74 65 72 6d 69 6e 61 74 6f 72 2c 0a + + ~ " ~ output point, string length NOT including" + ~ " terminator)" + 20 20 20 20 7e 20 20 6f 75 74 70 75 74 20 70 6f + 69 6e 74 2c 20 73 74 72 69 6e 67 20 6c 65 6e 67 + 74 68 20 4e 4f 54 20 69 6e 63 6c 75 64 69 6e 67 + 20 74 65 72 6d 69 6e 61 74 6f 72 29 0a + + ~ " ' hex-pack-trace entry-to-execution-token ," + 20 20 20 20 27 20 68 65 78 2d 70 61 63 6b 2d 74 + 72 61 63 65 20 65 6e 74 72 79 2d 74 6f 2d 65 78 + 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ "" + 0a + + ~ " ~ (output point, string pointer, string length" + ~ " including terminator)" + 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f + 69 6e 74 2c 20 73 74 72 69 6e 67 20 70 6f 69 6e + 74 65 72 2c 20 73 74 72 69 6e 67 20 6c 65 6e 67 + 74 68 20 69 6e 63 6c 75 64 69 6e 67 20 74 65 72 + 6d 69 6e 61 74 6f 72 29 0a + + ~ " s" swap" find entry-to-execution-token ," + 20 20 20 20 73 22 20 73 77 61 70 22 20 66 69 6e + 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " ' hex-output-metadata-entry-type-raw-string-literal" + 20 20 20 20 27 20 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 74 79 70 65 2d 72 61 77 2d 73 74 72 69 6e 67 2d + 6c 69 74 65 72 61 6c 0a + + ~ " entry-to-execution-token ," + 20 20 20 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 + 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" swap" find entry-to-execution-token ," + 20 20 20 20 73 22 20 73 77 61 70 22 20 66 69 6e + 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " ' add-hex-output-metadata-entry" + ~ " entry-to-execution-token ," + 20 20 20 20 27 20 61 64 64 2d 68 65 78 2d 6f 75 + 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e + 74 72 79 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 + 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " ~ (output point, string pointer)" + 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f + 69 6e 74 2c 20 73 74 72 69 6e 67 20 70 6f 69 6e + 74 65 72 29 0a + + ~ " ~ Fall through to the inner implementation." + 20 20 20 20 7e 20 46 61 6c 6c 20 74 68 72 6f 75 + 67 68 20 74 6f 20 74 68 65 20 69 6e 6e 65 72 20 + 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2e 0a + + ~ "" + 0a + + ~ " ' ] entry-to-execution-token execute" + 20 20 20 20 27 20 5d 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 65 78 65 63 75 74 65 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ " dup s" pack8" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 70 61 63 6b 38 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " create dropstring" + 20 20 20 20 63 72 65 61 74 65 20 64 72 6f 70 73 + 74 72 69 6e 67 0a + + ~ " s" docol" find entry-to-execution-token execute ," + 20 20 20 20 73 22 20 64 6f 63 6f 6c 22 20 66 69 + 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 + 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 63 + 75 74 65 20 2c 0a + + ~ " make-hidden" + 20 20 20 20 6d 61 6b 65 2d 68 69 64 64 65 6e 0a + + ~ "" + 0a + + ~ " ~ We can't use over because this patch happens at the" + ~ " time pack8 is" + 20 20 20 20 7e 20 20 20 57 65 20 63 61 6e 27 74 + 20 75 73 65 20 6f 76 65 72 20 62 65 63 61 75 73 + 65 20 74 68 69 73 20 70 61 74 63 68 20 68 61 70 + 70 65 6e 73 20 61 74 20 74 68 65 20 74 69 6d 65 + 20 70 61 63 6b 38 20 69 73 0a + + ~ " ~ being defined, and it would be a forward reference." + ~ " We do the equivalent" + 20 20 20 20 7e 20 62 65 69 6e 67 20 64 65 66 69 + 6e 65 64 2c 20 61 6e 64 20 69 74 20 77 6f 75 6c + 64 20 62 65 20 61 20 66 6f 72 77 61 72 64 20 72 + 65 66 65 72 65 6e 63 65 2e 20 57 65 20 64 6f 20 + 74 68 65 20 65 71 75 69 76 61 6c 65 6e 74 0a + + ~ " ~ by hand." + 20 20 20 20 7e 20 62 79 20 68 61 6e 64 2e 0a + + ~ " ~ (output point, value)" + 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f + 69 6e 74 2c 20 76 61 6c 75 65 29 0a + + ~ " s" swap" find entry-to-execution-token ," + 20 20 20 20 73 22 20 73 77 61 70 22 20 66 69 6e + 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" dup" find entry-to-execution-token ," + 20 20 20 20 73 22 20 64 75 70 22 20 66 69 6e 64 + 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 + 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" 3unroll" find entry-to-execution-token ," + 20 20 20 20 73 22 20 33 75 6e 72 6f 6c 6c 22 20 + 66 69 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 + 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " ~ (output point, value, output point)" + 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f + 69 6e 74 2c 20 76 61 6c 75 65 2c 20 6f 75 74 70 + 75 74 20 70 6f 69 6e 74 29 0a + + ~ " s" lit" find entry-to-execution-token ," + 20 20 20 20 73 22 20 6c 69 74 22 20 66 69 6e 64 + 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 + 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " 1 ," + 20 20 20 20 31 20 2c 0a + + ~ " ' hex-pack-trace entry-to-execution-token ," + 20 20 20 20 27 20 68 65 78 2d 70 61 63 6b 2d 74 + 72 61 63 65 20 65 6e 74 72 79 2d 74 6f 2d 65 78 + 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " ~ Fall through to the inner implementation." + 20 20 20 20 7e 20 46 61 6c 6c 20 74 68 72 6f 75 + 67 68 20 74 6f 20 74 68 65 20 69 6e 6e 65 72 20 + 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2e 0a + + ~ "" + 0a + + ~ " ' ] entry-to-execution-token execute" + 20 20 20 20 27 20 5d 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 65 78 65 63 75 74 65 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ Extremely similar to the pack8 patch." + 20 20 7e 20 45 78 74 72 65 6d 65 6c 79 20 73 69 + 6d 69 6c 61 72 20 74 6f 20 74 68 65 20 70 61 63 + 6b 38 20 70 61 74 63 68 2e 0a + + ~ " dup s" pack16" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 70 61 63 6b 31 36 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 0a + + ~ " create dropstring" + 20 20 20 20 63 72 65 61 74 65 20 64 72 6f 70 73 + 74 72 69 6e 67 0a + + ~ " s" docol" find entry-to-execution-token execute ," + 20 20 20 20 73 22 20 64 6f 63 6f 6c 22 20 66 69 + 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 + 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 63 + 75 74 65 20 2c 0a + + ~ " make-hidden" + 20 20 20 20 6d 61 6b 65 2d 68 69 64 64 65 6e 0a + + ~ "" + 0a + + ~ " ~ We can't use over because this patch happens at the" + ~ " time pack8 is" + 20 20 20 20 7e 20 20 20 57 65 20 63 61 6e 27 74 + 20 75 73 65 20 6f 76 65 72 20 62 65 63 61 75 73 + 65 20 74 68 69 73 20 70 61 74 63 68 20 68 61 70 + 70 65 6e 73 20 61 74 20 74 68 65 20 74 69 6d 65 + 20 70 61 63 6b 38 20 69 73 0a + + ~ " ~ being defined, and it would be a forward reference." + ~ " We do the equivalent" + 20 20 20 20 7e 20 62 65 69 6e 67 20 64 65 66 69 + 6e 65 64 2c 20 61 6e 64 20 69 74 20 77 6f 75 6c + 64 20 62 65 20 61 20 66 6f 72 77 61 72 64 20 72 + 65 66 65 72 65 6e 63 65 2e 20 57 65 20 64 6f 20 + 74 68 65 20 65 71 75 69 76 61 6c 65 6e 74 0a + + ~ " ~ by hand." + 20 20 20 20 7e 20 62 79 20 68 61 6e 64 2e 0a + + ~ " ~ (output point, value)" + 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f + 69 6e 74 2c 20 76 61 6c 75 65 29 0a + + ~ " s" swap" find entry-to-execution-token ," + 20 20 20 20 73 22 20 73 77 61 70 22 20 66 69 6e + 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" dup" find entry-to-execution-token ," + 20 20 20 20 73 22 20 64 75 70 22 20 66 69 6e 64 + 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 + 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" 3unroll" find entry-to-execution-token ," + 20 20 20 20 73 22 20 33 75 6e 72 6f 6c 6c 22 20 + 66 69 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 + 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " ~ (output point, value, output point)" + 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f + 69 6e 74 2c 20 76 61 6c 75 65 2c 20 6f 75 74 70 + 75 74 20 70 6f 69 6e 74 29 0a + + ~ " s" lit" find entry-to-execution-token ," + 20 20 20 20 73 22 20 6c 69 74 22 20 66 69 6e 64 + 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 + 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " 2 ," + 20 20 20 20 32 20 2c 0a + + ~ " ' hex-pack-trace entry-to-execution-token ," + 20 20 20 20 27 20 68 65 78 2d 70 61 63 6b 2d 74 + 72 61 63 65 20 65 6e 74 72 79 2d 74 6f 2d 65 78 + 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " ~ Fall through to the inner implementation." + 20 20 20 20 7e 20 46 61 6c 6c 20 74 68 72 6f 75 + 67 68 20 74 6f 20 74 68 65 20 69 6e 6e 65 72 20 + 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2e 0a + + ~ "" + 0a + + ~ " ' ] entry-to-execution-token execute" + 20 20 20 20 27 20 5d 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 65 78 65 63 75 74 65 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ Extremely similar to the pack8 patch." + 20 20 7e 20 45 78 74 72 65 6d 65 6c 79 20 73 69 + 6d 69 6c 61 72 20 74 6f 20 74 68 65 20 70 61 63 + 6b 38 20 70 61 74 63 68 2e 0a + + ~ " dup s" pack32" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 70 61 63 6b 33 32 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 0a + + ~ " create dropstring" + 20 20 20 20 63 72 65 61 74 65 20 64 72 6f 70 73 + 74 72 69 6e 67 0a + + ~ " s" docol" find entry-to-execution-token execute ," + 20 20 20 20 73 22 20 64 6f 63 6f 6c 22 20 66 69 + 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 + 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 63 + 75 74 65 20 2c 0a + + ~ " make-hidden" + 20 20 20 20 6d 61 6b 65 2d 68 69 64 64 65 6e 0a + + ~ "" + 0a + + ~ " ~ We can't use over because this patch happens at the" + ~ " time pack8 is" + 20 20 20 20 7e 20 20 20 57 65 20 63 61 6e 27 74 + 20 75 73 65 20 6f 76 65 72 20 62 65 63 61 75 73 + 65 20 74 68 69 73 20 70 61 74 63 68 20 68 61 70 + 70 65 6e 73 20 61 74 20 74 68 65 20 74 69 6d 65 + 20 70 61 63 6b 38 20 69 73 0a + + ~ " ~ being defined, and it would be a forward reference." + ~ " We do the equivalent" + 20 20 20 20 7e 20 62 65 69 6e 67 20 64 65 66 69 + 6e 65 64 2c 20 61 6e 64 20 69 74 20 77 6f 75 6c + 64 20 62 65 20 61 20 66 6f 72 77 61 72 64 20 72 + 65 66 65 72 65 6e 63 65 2e 20 57 65 20 64 6f 20 + 74 68 65 20 65 71 75 69 76 61 6c 65 6e 74 0a + + ~ " ~ by hand." + 20 20 20 20 7e 20 62 79 20 68 61 6e 64 2e 0a + + ~ " ~ (output point, value)" + 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f + 69 6e 74 2c 20 76 61 6c 75 65 29 0a + + ~ " s" swap" find entry-to-execution-token ," + 20 20 20 20 73 22 20 73 77 61 70 22 20 66 69 6e + 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" dup" find entry-to-execution-token ," + 20 20 20 20 73 22 20 64 75 70 22 20 66 69 6e 64 + 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 + 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" 3unroll" find entry-to-execution-token ," + 20 20 20 20 73 22 20 33 75 6e 72 6f 6c 6c 22 20 + 66 69 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 + 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " ~ (output point, value, output point)" + 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f + 69 6e 74 2c 20 76 61 6c 75 65 2c 20 6f 75 74 70 + 75 74 20 70 6f 69 6e 74 29 0a + + ~ " s" lit" find entry-to-execution-token ," + 20 20 20 20 73 22 20 6c 69 74 22 20 66 69 6e 64 + 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 + 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " 4 ," + 20 20 20 20 34 20 2c 0a + + ~ " ' hex-pack-trace entry-to-execution-token ," + 20 20 20 20 27 20 68 65 78 2d 70 61 63 6b 2d 74 + 72 61 63 65 20 65 6e 74 72 79 2d 74 6f 2d 65 78 + 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " ~ Fall through to the inner implementation." + 20 20 20 20 7e 20 46 61 6c 6c 20 74 68 72 6f 75 + 67 68 20 74 6f 20 74 68 65 20 69 6e 6e 65 72 20 + 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2e 0a + + ~ "" + 0a + + ~ " ' ] entry-to-execution-token execute" + 20 20 20 20 27 20 5d 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 65 78 65 63 75 74 65 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ Extremely similar to the pack8 patch." + 20 20 7e 20 45 78 74 72 65 6d 65 6c 79 20 73 69 + 6d 69 6c 61 72 20 74 6f 20 74 68 65 20 70 61 63 + 6b 38 20 70 61 74 63 68 2e 0a + + ~ " dup s" pack64" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 70 61 63 6b 36 34 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 0a + + ~ " create dropstring" + 20 20 20 20 63 72 65 61 74 65 20 64 72 6f 70 73 + 74 72 69 6e 67 0a + + ~ " s" docol" find entry-to-execution-token execute ," + 20 20 20 20 73 22 20 64 6f 63 6f 6c 22 20 66 69 + 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 + 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 63 + 75 74 65 20 2c 0a + + ~ " make-hidden" + 20 20 20 20 6d 61 6b 65 2d 68 69 64 64 65 6e 0a + + ~ "" + 0a + + ~ " ~ We can't use over because this patch happens at the" + ~ " time pack8 is" + 20 20 20 20 7e 20 20 20 57 65 20 63 61 6e 27 74 + 20 75 73 65 20 6f 76 65 72 20 62 65 63 61 75 73 + 65 20 74 68 69 73 20 70 61 74 63 68 20 68 61 70 + 70 65 6e 73 20 61 74 20 74 68 65 20 74 69 6d 65 + 20 70 61 63 6b 38 20 69 73 0a + + ~ " ~ being defined, and it would be a forward reference." + ~ " We do the equivalent" + 20 20 20 20 7e 20 62 65 69 6e 67 20 64 65 66 69 + 6e 65 64 2c 20 61 6e 64 20 69 74 20 77 6f 75 6c + 64 20 62 65 20 61 20 66 6f 72 77 61 72 64 20 72 + 65 66 65 72 65 6e 63 65 2e 20 57 65 20 64 6f 20 + 74 68 65 20 65 71 75 69 76 61 6c 65 6e 74 0a + + ~ " ~ by hand." + 20 20 20 20 7e 20 62 79 20 68 61 6e 64 2e 0a + + ~ " ~ (output point, value)" + 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f + 69 6e 74 2c 20 76 61 6c 75 65 29 0a + + ~ " s" swap" find entry-to-execution-token ," + 20 20 20 20 73 22 20 73 77 61 70 22 20 66 69 6e + 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" dup" find entry-to-execution-token ," + 20 20 20 20 73 22 20 64 75 70 22 20 66 69 6e 64 + 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 + 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" 3unroll" find entry-to-execution-token ," + 20 20 20 20 73 22 20 33 75 6e 72 6f 6c 6c 22 20 + 66 69 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 + 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " ~ (output point, value, output point)" + 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 70 6f + 69 6e 74 2c 20 76 61 6c 75 65 2c 20 6f 75 74 70 + 75 74 20 70 6f 69 6e 74 29 0a + + ~ " s" lit" find entry-to-execution-token ," + 20 20 20 20 73 22 20 6c 69 74 22 20 66 69 6e 64 + 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 + 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " 8 ," + 20 20 20 20 38 20 2c 0a + + ~ " ' hex-pack-trace entry-to-execution-token ," + 20 20 20 20 27 20 68 65 78 2d 70 61 63 6b 2d 74 + 72 61 63 65 20 65 6e 74 72 79 2d 74 6f 2d 65 78 + 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " ~ Fall through to the inner implementation." + 20 20 20 20 7e 20 46 61 6c 6c 20 74 68 72 6f 75 + 67 68 20 74 6f 20 74 68 65 20 69 6e 6e 65 72 20 + 69 6d 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 2e 0a + + ~ "" + 0a + + ~ " ' ] entry-to-execution-token execute" + 20 20 20 20 27 20 5d 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 65 78 65 63 75 74 65 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ If no special case matches, we fall back to just" + ~ " being a regular colon." + 20 20 7e 20 20 20 49 66 20 6e 6f 20 73 70 65 63 + 69 61 6c 20 63 61 73 65 20 6d 61 74 63 68 65 73 + 2c 20 77 65 20 66 61 6c 6c 20 62 61 63 6b 20 74 + 6f 20 6a 75 73 74 20 62 65 69 6e 67 20 61 20 72 + 65 67 75 6c 61 72 20 63 6f 6c 6f 6e 2e 0a + + ~ " ~ We already read the word name above, so we have to do" + ~ " the rest of the" + 20 20 7e 20 57 65 20 61 6c 72 65 61 64 79 20 72 + 65 61 64 20 74 68 65 20 77 6f 72 64 20 6e 61 6d + 65 20 61 62 6f 76 65 2c 20 73 6f 20 77 65 20 68 + 61 76 65 20 74 6f 20 64 6f 20 74 68 65 20 72 65 + 73 74 20 6f 66 20 74 68 65 0a + + ~ " ~ steps ourselves as well." + 20 20 7e 20 73 74 65 70 73 20 6f 75 72 73 65 6c + 76 65 73 20 61 73 20 77 65 6c 6c 2e 0a + + ~ " create dropstring" + 20 20 63 72 65 61 74 65 20 64 72 6f 70 73 74 72 + 69 6e 67 0a + + ~ " s" docol" find entry-to-execution-token execute ," + 20 20 73 22 20 64 6f 63 6f 6c 22 20 66 69 6e 64 + 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 + 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 63 75 74 + 65 20 2c 0a + + ~ " make-hidden" + 20 20 6d 61 6b 65 2d 68 69 64 64 65 6e 0a + + ~ " ' ] entry-to-execution-token execute" + 20 20 27 20 5d 20 65 6e 74 72 79 2d 74 6f 2d 65 + 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 + 78 65 63 75 74 65 0a + + ~ " ;" + 20 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This word gets installed as a trap at the beginning of" + ~ " every Forth word," + 7e 20 20 54 68 69 73 20 77 6f 72 64 20 67 65 74 + 73 20 69 6e 73 74 61 6c 6c 65 64 20 61 73 20 61 + 20 74 72 61 70 20 61 74 20 74 68 65 20 62 65 67 + 69 6e 6e 69 6e 67 20 6f 66 20 65 76 65 72 79 20 + 46 6f 72 74 68 20 77 6f 72 64 2c 0a + + ~ "~ so that it can examine the control stack and produce" + ~ " kinds of metadata that" + 7e 20 73 6f 20 74 68 61 74 20 69 74 20 63 61 6e + 20 65 78 61 6d 69 6e 65 20 74 68 65 20 63 6f 6e + 74 72 6f 6c 20 73 74 61 63 6b 20 61 6e 64 20 70 + 72 6f 64 75 63 65 20 6b 69 6e 64 73 20 6f 66 20 + 6d 65 74 61 64 61 74 61 20 74 68 61 74 0a + + ~ "~ require information that only exists at runtime. See" + 7e 20 72 65 71 75 69 72 65 20 69 6e 66 6f 72 6d + 61 74 69 6f 6e 20 74 68 61 74 20 6f 6e 6c 79 20 + 65 78 69 73 74 73 20 61 74 20 72 75 6e 74 69 6d + 65 2e 20 53 65 65 0a + + ~ "~ hex-semicolon-alterante, below, for details of how it's" + ~ " installed." + 7e 20 68 65 78 2d 73 65 6d 69 63 6f 6c 6f 6e 2d + 61 6c 74 65 72 61 6e 74 65 2c 20 62 65 6c 6f 77 + 2c 20 66 6f 72 20 64 65 74 61 69 6c 73 20 6f 66 + 20 68 6f 77 20 69 74 27 73 20 69 6e 73 74 61 6c + 6c 65 64 2e 0a + + ~ "~" + 7e 0a + + ~ "~ It is worth noting that hex-trap can coexist with the" + ~ " more-targeted traps" + 7e 20 20 20 49 74 20 69 73 20 77 6f 72 74 68 20 + 6e 6f 74 69 6e 67 20 74 68 61 74 20 68 65 78 2d + 74 72 61 70 20 63 61 6e 20 63 6f 65 78 69 73 74 + 20 77 69 74 68 20 74 68 65 20 6d 6f 72 65 2d 74 + 61 72 67 65 74 65 64 20 74 72 61 70 73 0a + + ~ "~ installed by hex-colon-alternate, above. It runs before" + ~ " them, because" + 7e 20 69 6e 73 74 61 6c 6c 65 64 20 62 79 20 68 + 65 78 2d 63 6f 6c 6f 6e 2d 61 6c 74 65 72 6e 61 + 74 65 2c 20 61 62 6f 76 65 2e 20 49 74 20 72 75 + 6e 73 20 62 65 66 6f 72 65 20 74 68 65 6d 2c 20 + 62 65 63 61 75 73 65 0a + + ~ "~ hex-colon-alternate prepends its stuff first and then" + 7e 20 68 65 78 2d 63 6f 6c 6f 6e 2d 61 6c 74 65 + 72 6e 61 74 65 20 70 72 65 70 65 6e 64 73 20 69 + 74 73 20 73 74 75 66 66 20 66 69 72 73 74 20 61 + 6e 64 20 74 68 65 6e 0a + + ~ "~ hex-semicolon-alternate slides that all forward to" + ~ " prepend the call to" + 7e 20 68 65 78 2d 73 65 6d 69 63 6f 6c 6f 6e 2d + 61 6c 74 65 72 6e 61 74 65 20 73 6c 69 64 65 73 + 20 74 68 61 74 20 61 6c 6c 20 66 6f 72 77 61 72 + 64 20 74 6f 20 70 72 65 70 65 6e 64 20 74 68 65 + 20 63 61 6c 6c 20 74 6f 0a + + ~ "~ hex-trace." + 7e 20 68 65 78 2d 74 72 61 63 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ TODO this probably doesn't serve a purpose in the end," + ~ " and should go away," + 7e 20 54 4f 44 4f 20 74 68 69 73 20 70 72 6f 62 + 61 62 6c 79 20 64 6f 65 73 6e 27 74 20 73 65 72 + 76 65 20 61 20 70 75 72 70 6f 73 65 20 69 6e 20 + 74 68 65 20 65 6e 64 2c 20 61 6e 64 20 73 68 6f + 75 6c 64 20 67 6f 20 61 77 61 79 2c 0a + + ~ "~ but the actual stack-walking code is useful and should be" + ~ " kept until it's" + 7e 20 62 75 74 20 74 68 65 20 61 63 74 75 61 6c + 20 73 74 61 63 6b 2d 77 61 6c 6b 69 6e 67 20 63 + 6f 64 65 20 69 73 20 75 73 65 66 75 6c 20 61 6e + 64 20 73 68 6f 75 6c 64 20 62 65 20 6b 65 70 74 + 20 75 6e 74 69 6c 20 69 74 27 73 0a + + ~ "~ been refactored into something worth keeping." + 7e 20 62 65 65 6e 20 72 65 66 61 63 74 6f 72 65 + 64 20 69 6e 74 6f 20 73 6f 6d 65 74 68 69 6e 67 + 20 77 6f 72 74 68 20 6b 65 65 70 69 6e 67 2e 0a + + ~ ": hex-trace" + 3a 20 68 65 78 2d 74 72 61 63 65 0a + + ~ " exit" + 20 20 65 78 69 74 0a + + ~ " ~ value@ here @ swap 0" + ~ " hex-output-metadata-entry-type-line-comment" + 20 20 7e 20 76 61 6c 75 65 40 20 68 65 72 65 20 + 40 20 73 77 61 70 20 30 20 68 65 78 2d 6f 75 74 + 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 + 72 79 2d 74 79 70 65 2d 6c 69 6e 65 2d 63 6f 6d + 6d 65 6e 74 0a + + ~ " ~ add-hex-output-metadata-entry" + 20 20 7e 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 0a + + ~ " newline" + 20 20 6e 65 77 6c 69 6e 65 0a + + ~ " ~ This stack-walking code is modeled off the code in" + ~ " list-callers, in" + 20 20 7e 20 20 20 54 68 69 73 20 73 74 61 63 6b + 2d 77 61 6c 6b 69 6e 67 20 63 6f 64 65 20 69 73 + 20 6d 6f 64 65 6c 65 64 20 6f 66 66 20 74 68 65 + 20 63 6f 64 65 20 69 6e 20 6c 69 73 74 2d 63 61 + 6c 6c 65 72 73 2c 20 69 6e 0a + + ~ " ~ language/dynamic/dynamic.e." + 20 20 7e 20 6c 61 6e 67 75 61 67 65 2f 64 79 6e + 61 6d 69 63 2f 64 79 6e 61 6d 69 63 2e 65 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ "" + 0a + + ~ " ~ This is the bit of the hex transform where all the" + ~ " memory-management" + 20 20 7e 20 20 20 54 68 69 73 20 69 73 20 74 68 + 65 20 62 69 74 20 6f 66 20 74 68 65 20 68 65 78 + 20 74 72 61 6e 73 66 6f 72 6d 20 77 68 65 72 65 + 20 61 6c 6c 20 74 68 65 20 6d 65 6d 6f 72 79 2d + 6d 61 6e 61 67 65 6d 65 6e 74 0a + + ~ " ~ assumptions are in play at once, so, in understanding" + ~ " it, it's probably" + 20 20 7e 20 61 73 73 75 6d 70 74 69 6f 6e 73 20 + 61 72 65 20 69 6e 20 70 6c 61 79 20 61 74 20 6f + 6e 63 65 2c 20 73 6f 2c 20 69 6e 20 75 6e 64 65 + 72 73 74 61 6e 64 69 6e 67 20 69 74 2c 20 69 74 + 27 73 20 70 72 6f 62 61 62 6c 79 0a + + ~ " ~ a good idea to skim back over the background described" + ~ " under "hex" + 20 20 7e 20 61 20 67 6f 6f 64 20 69 64 65 61 20 + 74 6f 20 73 6b 69 6d 20 62 61 63 6b 20 6f 76 65 + 72 20 74 68 65 20 62 61 63 6b 67 72 6f 75 6e 64 + 20 64 65 73 63 72 69 62 65 64 20 75 6e 64 65 72 + 20 22 68 65 78 0a + + ~ " ~ transform implementation", above, and make sure it's" + ~ " fresh in your mind." + 20 20 7e 20 74 72 61 6e 73 66 6f 72 6d 20 69 6d + 70 6c 65 6d 65 6e 74 61 74 69 6f 6e 22 2c 20 61 + 62 6f 76 65 2c 20 61 6e 64 20 6d 61 6b 65 20 73 + 75 72 65 20 69 74 27 73 20 66 72 65 73 68 20 69 + 6e 20 79 6f 75 72 20 6d 69 6e 64 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ It's important to notice that, as we walk it, the" + ~ " values of "here" and" + 20 20 7e 20 20 20 49 74 27 73 20 69 6d 70 6f 72 + 74 61 6e 74 20 74 6f 20 6e 6f 74 69 63 65 20 74 + 68 61 74 2c 20 61 73 20 77 65 20 77 61 6c 6b 20 + 69 74 2c 20 74 68 65 20 76 61 6c 75 65 73 20 6f + 66 20 22 68 65 72 65 22 20 61 6e 64 0a + + ~ " ~ "latest" reflect the log and dictionary of the code" + ~ " being transformed, ie." + 20 20 7e 20 22 6c 61 74 65 73 74 22 20 72 65 66 + 6c 65 63 74 20 74 68 65 20 6c 6f 67 20 61 6e 64 + 20 64 69 63 74 69 6f 6e 61 72 79 20 6f 66 20 74 + 68 65 20 63 6f 64 65 20 62 65 69 6e 67 20 74 72 + 61 6e 73 66 6f 72 6d 65 64 2c 20 69 65 2e 0a + + ~ " ~ they are the ones in the output buffer, not the log and" + ~ " dictionary of the" + 20 20 7e 20 74 68 65 79 20 61 72 65 20 74 68 65 + 20 6f 6e 65 73 20 69 6e 20 74 68 65 20 6f 75 74 + 70 75 74 20 62 75 66 66 65 72 2c 20 6e 6f 74 20 + 74 68 65 20 6c 6f 67 20 61 6e 64 20 64 69 63 74 + 69 6f 6e 61 72 79 20 6f 66 20 74 68 65 0a + + ~ " ~ outer program. Therefore, we can use containing-entry" + ~ " to find the entry" + 20 20 7e 20 6f 75 74 65 72 20 70 72 6f 67 72 61 + 6d 2e 20 54 68 65 72 65 66 6f 72 65 2c 20 77 65 + 20 63 61 6e 20 75 73 65 20 63 6f 6e 74 61 69 6e + 69 6e 67 2d 65 6e 74 72 79 20 74 6f 20 66 69 6e + 64 20 74 68 65 20 65 6e 74 72 79 0a + + ~ " ~ headers for words inside the transform, and if we want" + ~ " to look at words" + 20 20 7e 20 68 65 61 64 65 72 73 20 66 6f 72 20 + 77 6f 72 64 73 20 69 6e 73 69 64 65 20 74 68 65 + 20 74 72 61 6e 73 66 6f 72 6d 2c 20 61 6e 64 20 + 69 66 20 77 65 20 77 61 6e 74 20 74 6f 20 6c 6f + 6f 6b 20 61 74 20 77 6f 72 64 73 0a + + ~ " ~ outside the transform we can wrap containing-entry in" + 20 20 7e 20 6f 75 74 73 69 64 65 20 74 68 65 20 + 74 72 61 6e 73 66 6f 72 6d 20 77 65 20 63 61 6e + 20 77 72 61 70 20 63 6f 6e 74 61 69 6e 69 6e 67 + 2d 65 6e 74 72 79 20 69 6e 0a + + ~ " ~ swap-transform-variables. We can't use is-in-log," + ~ " though, because the" + 20 20 7e 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 2e 20 57 65 + 20 63 61 6e 27 74 20 75 73 65 20 69 73 2d 69 6e + 2d 6c 6f 67 2c 20 74 68 6f 75 67 68 2c 20 62 65 + 63 61 75 73 65 20 74 68 65 0a + + ~ " ~ label-loop buffer is inside the output buffer, which is" + ~ " inside the outer" + 20 20 7e 20 6c 61 62 65 6c 2d 6c 6f 6f 70 20 62 + 75 66 66 65 72 20 69 73 20 69 6e 73 69 64 65 20 + 74 68 65 20 6f 75 74 70 75 74 20 62 75 66 66 65 + 72 2c 20 77 68 69 63 68 20 69 73 20 69 6e 73 69 + 64 65 20 74 68 65 20 6f 75 74 65 72 0a + + ~ " ~ log, so it doesn't make the distinctions we need it" + ~ " to." + 20 20 7e 20 6c 6f 67 2c 20 73 6f 20 69 74 20 64 + 6f 65 73 6e 27 74 20 6d 61 6b 65 20 74 68 65 20 + 64 69 73 74 69 6e 63 74 69 6f 6e 73 20 77 65 20 + 6e 65 65 64 20 69 74 20 74 6f 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ Every word inside the transform will have" + ~ " hex-transform-one exactly once" + 20 20 7e 20 20 20 45 76 65 72 79 20 77 6f 72 64 + 20 69 6e 73 69 64 65 20 74 68 65 20 74 72 61 6e + 73 66 6f 72 6d 20 77 69 6c 6c 20 68 61 76 65 20 + 68 65 78 2d 74 72 61 6e 73 66 6f 72 6d 2d 6f 6e + 65 20 65 78 61 63 74 6c 79 20 6f 6e 63 65 0a + + ~ " ~ in its call chain, so we walk the control stack only up" + ~ " to that point." + 20 20 7e 20 69 6e 20 69 74 73 20 63 61 6c 6c 20 + 63 68 61 69 6e 2c 20 73 6f 20 77 65 20 77 61 6c + 6b 20 74 68 65 20 63 6f 6e 74 72 6f 6c 20 73 74 + 61 63 6b 20 6f 6e 6c 79 20 75 70 20 74 6f 20 74 + 68 61 74 20 70 6f 69 6e 74 2e 0a + + ~ " control@" + 20 20 63 6f 6e 74 72 6f 6c 40 0a + + ~ " { ~ First, check to make sure we haven't run off the" + ~ " bottom of the control" + 20 20 7b 20 7e 20 20 20 46 69 72 73 74 2c 20 63 + 68 65 63 6b 20 74 6f 20 6d 61 6b 65 20 73 75 72 + 65 20 77 65 20 68 61 76 65 6e 27 74 20 72 75 6e + 20 6f 66 66 20 74 68 65 20 62 6f 74 74 6f 6d 20 + 6f 66 20 74 68 65 20 63 6f 6e 74 72 6f 6c 0a + + ~ " ~ stack. Remember, the control stack is an array of" + ~ " pointers, so this is a" + 20 20 20 20 7e 20 73 74 61 63 6b 2e 20 52 65 6d + 65 6d 62 65 72 2c 20 74 68 65 20 63 6f 6e 74 72 + 6f 6c 20 73 74 61 63 6b 20 69 73 20 61 6e 20 61 + 72 72 61 79 20 6f 66 20 70 6f 69 6e 74 65 72 73 + 2c 20 73 6f 20 74 68 69 73 20 69 73 20 61 0a + + ~ " ~ simple bounds check." + 20 20 20 20 7e 20 73 69 6d 70 6c 65 20 62 6f 75 + 6e 64 73 20 63 68 65 63 6b 2e 0a + + ~ " dup r0 @ >" + 20 20 20 20 64 75 70 20 72 30 20 40 20 3e 0a + + ~ "" + 0a + + ~ " ~ If it is, we also want to look at what it points" + ~ " to." + 20 20 20 20 7e 20 20 20 49 66 20 69 74 20 69 73 + 2c 20 77 65 20 61 6c 73 6f 20 77 61 6e 74 20 74 + 6f 20 6c 6f 6f 6b 20 61 74 20 77 68 61 74 20 69 + 74 20 70 6f 69 6e 74 73 20 74 6f 2e 0a + + ~ " dup {" + 20 20 20 20 64 75 70 20 7b 0a + + ~ " ~ Dereference the pointer we've been iterating (..." + ~ " we're actually" + 20 20 20 20 20 20 7e 20 20 20 44 65 72 65 66 65 + 72 65 6e 63 65 20 74 68 65 20 70 6f 69 6e 74 65 + 72 20 77 65 27 76 65 20 62 65 65 6e 20 69 74 65 + 72 61 74 69 6e 67 20 28 2e 2e 2e 20 77 65 27 72 + 65 20 61 63 74 75 61 6c 6c 79 0a + + ~ " ~ looking at a pointer to a pointer ...), and check" + ~ " that it's not inside" + 20 20 20 20 20 20 7e 20 6c 6f 6f 6b 69 6e 67 20 + 61 74 20 61 20 70 6f 69 6e 74 65 72 20 74 6f 20 + 61 20 70 6f 69 6e 74 65 72 20 2e 2e 2e 29 2c 20 + 61 6e 64 20 63 68 65 63 6b 20 74 68 61 74 20 69 + 74 27 73 20 6e 6f 74 20 69 6e 73 69 64 65 0a + + ~ " ~ hex-transform-one's body." + 20 20 20 20 20 20 7e 20 68 65 78 2d 74 72 61 6e + 73 66 6f 72 6d 2d 6f 6e 65 27 73 20 62 6f 64 79 + 2e 0a + + ~ " drop dup @" + 20 20 20 20 20 20 64 72 6f 70 20 64 75 70 20 40 + 0a + + ~ "" + 0a + + ~ " ~ The inner dictionary is inside the outer log, so" + ~ " we'll get an entry" + 20 20 20 20 20 20 7e 20 20 20 54 68 65 20 69 6e + 6e 65 72 20 64 69 63 74 69 6f 6e 61 72 79 20 69 + 73 20 69 6e 73 69 64 65 20 74 68 65 20 6f 75 74 + 65 72 20 6c 6f 67 2c 20 73 6f 20 77 65 27 6c 6c + 20 67 65 74 20 61 6e 20 65 6e 74 72 79 0a + + ~ " ~ header regardless of which dictionary we consider," + ~ " but it may not be" + 20 20 20 20 20 20 7e 20 68 65 61 64 65 72 20 72 + 65 67 61 72 64 6c 65 73 73 20 6f 66 20 77 68 69 + 63 68 20 64 69 63 74 69 6f 6e 61 72 79 20 77 65 + 20 63 6f 6e 73 69 64 65 72 2c 20 62 75 74 20 69 + 74 20 6d 61 79 20 6e 6f 74 20 62 65 0a + + ~ " ~ the one we care about. If we want to get the" + ~ " correct entry pointer, we" + 20 20 20 20 20 20 7e 20 74 68 65 20 6f 6e 65 20 + 77 65 20 63 61 72 65 20 61 62 6f 75 74 2e 20 49 + 66 20 77 65 20 77 61 6e 74 20 74 6f 20 67 65 74 + 20 74 68 65 20 63 6f 72 72 65 63 74 20 65 6e 74 + 72 79 20 70 6f 69 6e 74 65 72 2c 20 77 65 0a + + ~ " ~ have to make sure we're looking at the outer" + ~ " dictionary." + 20 20 20 20 20 20 7e 20 68 61 76 65 20 74 6f 20 + 6d 61 6b 65 20 73 75 72 65 20 77 65 27 72 65 20 + 6c 6f 6f 6b 69 6e 67 20 61 74 20 74 68 65 20 6f + 75 74 65 72 20 64 69 63 74 69 6f 6e 61 72 79 2e + 0a + + ~ " swap-transform-variables" + 20 20 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 + 66 6f 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " ~ Check what entry the control pointer is in." + 20 20 20 20 20 20 7e 20 43 68 65 63 6b 20 77 68 + 61 74 20 65 6e 74 72 79 20 74 68 65 20 63 6f 6e + 74 72 6f 6c 20 70 6f 69 6e 74 65 72 20 69 73 20 + 69 6e 2e 0a + + ~ " containing-entry" + 20 20 20 20 20 20 63 6f 6e 74 61 69 6e 69 6e 67 + 2d 65 6e 74 72 79 0a + + ~ "" + 0a + + ~ " ~ Get the entry for hex-transform-one to compare" + ~ " against. This would" + 20 20 20 20 20 20 7e 20 20 20 47 65 74 20 74 68 + 65 20 65 6e 74 72 79 20 66 6f 72 20 68 65 78 2d + 74 72 61 6e 73 66 6f 72 6d 2d 6f 6e 65 20 74 6f + 20 63 6f 6d 70 61 72 65 20 61 67 61 69 6e 73 74 + 2e 20 20 54 68 69 73 20 77 6f 75 6c 64 0a + + ~ " ~ be a forward reference, so we need to look it up at" + ~ " runtime." + 20 20 20 20 20 20 7e 20 62 65 20 61 20 66 6f 72 + 77 61 72 64 20 72 65 66 65 72 65 6e 63 65 2c 20 + 73 6f 20 77 65 20 6e 65 65 64 20 74 6f 20 6c 6f + 6f 6b 20 69 74 20 75 70 20 61 74 20 72 75 6e 74 + 69 6d 65 2e 0a + + ~ " s" hex-transform-one" find" + 20 20 20 20 20 20 73 22 20 68 65 78 2d 74 72 61 + 6e 73 66 6f 72 6d 2d 6f 6e 65 22 20 66 69 6e 64 + 0a + + ~ "" + 0a + + ~ " ~ Now switch back." + 20 20 20 20 20 20 7e 20 4e 6f 77 20 73 77 69 74 + 63 68 20 62 61 63 6b 2e 0a + + ~ " swap-transform-variables" + 20 20 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 + 66 6f 72 6d 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " ~ If they're equal, we want to stop the loop." + 20 20 20 20 20 20 7e 20 49 66 20 74 68 65 79 27 + 72 65 20 65 71 75 61 6c 2c 20 77 65 20 77 61 6e + 74 20 74 6f 20 73 74 6f 70 20 74 68 65 20 6c 6f + 6f 70 2e 0a + + ~ " !=" + 20 20 20 20 20 20 21 3d 0a + + ~ " } if }" + 20 20 20 20 7d 20 69 66 20 7d 0a + + ~ " { dup @" + 20 20 7b 20 64 75 70 20 40 0a + + ~ "" + 0a + + ~ " ~ TODO this isn't in quine.asm, so if we keep this code" + ~ " at all, that needs" + 20 20 20 20 7e 20 54 4f 44 4f 20 74 68 69 73 20 + 69 73 6e 27 74 20 69 6e 20 71 75 69 6e 65 2e 61 + 73 6d 2c 20 73 6f 20 69 66 20 77 65 20 6b 65 65 + 70 20 74 68 69 73 20 63 6f 64 65 20 61 74 20 61 + 6c 6c 2c 20 74 68 61 74 20 6e 65 65 64 73 0a + + ~ " ~ to be dealt with" + 20 20 20 20 7e 20 74 6f 20 62 65 20 64 65 61 6c + 74 20 77 69 74 68 0a + + ~ " ~ symbolize-pointer space" + 20 20 20 20 7e 20 73 79 6d 62 6f 6c 69 7a 65 2d + 70 6f 69 6e 74 65 72 20 73 70 61 63 65 0a + + ~ "" + 0a + + ~ " ~ Iterate to the next pointer in the control stack." + ~ " It's an array of" + 20 20 20 20 7e 20 20 20 49 74 65 72 61 74 65 20 + 74 6f 20 74 68 65 20 6e 65 78 74 20 70 6f 69 6e + 74 65 72 20 69 6e 20 74 68 65 20 63 6f 6e 74 72 + 6f 6c 20 73 74 61 63 6b 2e 20 49 74 27 73 20 61 + 6e 20 61 72 72 61 79 20 6f 66 0a + + ~ " ~ pointers, so this is just arithmetic." + 20 20 20 20 7e 20 70 6f 69 6e 74 65 72 73 2c 20 + 73 6f 20 74 68 69 73 20 69 73 20 6a 75 73 74 20 + 61 72 69 74 68 6d 65 74 69 63 2e 0a + + ~ " 8 + } while" + 20 20 20 20 38 20 2b 20 7d 20 77 68 69 6c 65 0a + + ~ " drop ;" + 20 20 64 72 6f 70 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ We want to trace every call to a Forth word, for use in" + ~ " generating" + 7e 20 20 20 57 65 20 77 61 6e 74 20 74 6f 20 74 + 72 61 63 65 20 65 76 65 72 79 20 63 61 6c 6c 20 + 74 6f 20 61 20 46 6f 72 74 68 20 77 6f 72 64 2c + 20 66 6f 72 20 75 73 65 20 69 6e 20 67 65 6e 65 + 72 61 74 69 6e 67 0a + + ~ "~ metadata. To do this, we want to add a prefix trap to the" + ~ " calls, but we" + 7e 20 6d 65 74 61 64 61 74 61 2e 20 54 6f 20 64 + 6f 20 74 68 69 73 2c 20 77 65 20 77 61 6e 74 20 + 74 6f 20 61 64 64 20 61 20 70 72 65 66 69 78 20 + 74 72 61 70 20 74 6f 20 74 68 65 20 63 61 6c 6c + 73 2c 20 62 75 74 20 77 65 0a + + ~ "~ can't put the logic in hex-colon-alternate because we" + ~ " don't know which" + 7e 20 63 61 6e 27 74 20 70 75 74 20 74 68 65 20 + 6c 6f 67 69 63 20 69 6e 20 68 65 78 2d 63 6f 6c + 6f 6e 2d 61 6c 74 65 72 6e 61 74 65 20 62 65 63 + 61 75 73 65 20 77 65 20 64 6f 6e 27 74 20 6b 6e + 6f 77 20 77 68 69 63 68 0a + + ~ "~ words are Forth words and which are assembly words until" + ~ " we see the" + 7e 20 77 6f 72 64 73 20 61 72 65 20 46 6f 72 74 + 68 20 77 6f 72 64 73 20 61 6e 64 20 77 68 69 63 + 68 20 61 72 65 20 61 73 73 65 6d 62 6c 79 20 77 + 6f 72 64 73 20 75 6e 74 69 6c 20 77 65 20 73 65 + 65 20 74 68 65 0a + + ~ "~ semicolon." + 7e 20 73 65 6d 69 63 6f 6c 6f 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ So, we do it here in hex-semicolon-alternate. The word" + ~ " body has already" + 7e 20 20 20 53 6f 2c 20 77 65 20 64 6f 20 69 74 + 20 68 65 72 65 20 69 6e 20 68 65 78 2d 73 65 6d + 69 63 6f 6c 6f 6e 2d 61 6c 74 65 72 6e 61 74 65 + 2e 20 54 68 65 20 77 6f 72 64 20 62 6f 64 79 20 + 68 61 73 20 61 6c 72 65 61 64 79 0a + + ~ "~ been compiled at this point, so we slide the whole body" + ~ " forward to make" + 7e 20 62 65 65 6e 20 63 6f 6d 70 69 6c 65 64 20 + 61 74 20 74 68 69 73 20 70 6f 69 6e 74 2c 20 73 + 6f 20 77 65 20 73 6c 69 64 65 20 74 68 65 20 77 + 68 6f 6c 65 20 62 6f 64 79 20 66 6f 72 77 61 72 + 64 20 74 6f 20 6d 61 6b 65 0a + + ~ "~ room. This is explicitly allowed by our compilation" + ~ " model; you may be" + 7e 20 72 6f 6f 6d 2e 20 54 68 69 73 20 69 73 20 + 65 78 70 6c 69 63 69 74 6c 79 20 61 6c 6c 6f 77 + 65 64 20 62 79 20 6f 75 72 20 63 6f 6d 70 69 6c + 61 74 69 6f 6e 20 6d 6f 64 65 6c 3b 20 79 6f 75 + 20 6d 61 79 20 62 65 0a + + ~ "~ aware that it's also how high-level flow control is" + ~ " implemented." + 7e 20 61 77 61 72 65 20 74 68 61 74 20 69 74 27 + 73 20 61 6c 73 6f 20 68 6f 77 20 68 69 67 68 2d + 6c 65 76 65 6c 20 66 6c 6f 77 20 63 6f 6e 74 72 + 6f 6c 20 69 73 20 69 6d 70 6c 65 6d 65 6e 74 65 + 64 2e 0a + + ~ "~" + 7e 0a + + ~ "~ You might find it useful to compare this code to the" + ~ " implementations of" + 7e 20 20 20 59 6f 75 20 6d 69 67 68 74 20 66 69 + 6e 64 20 69 74 20 75 73 65 66 75 6c 20 74 6f 20 + 63 6f 6d 70 61 72 65 20 74 68 69 73 20 63 6f 64 + 65 20 74 6f 20 74 68 65 20 69 6d 70 6c 65 6d 65 + 6e 74 61 74 69 6f 6e 73 20 6f 66 0a + + ~ "~ high-level flow-control utilities in" + ~ " language/static/log-load.e; it operates" + 7e 20 68 69 67 68 2d 6c 65 76 65 6c 20 66 6c 6f + 77 2d 63 6f 6e 74 72 6f 6c 20 75 74 69 6c 69 74 + 69 65 73 20 69 6e 20 6c 61 6e 67 75 61 67 65 2f + 73 74 61 74 69 63 2f 6c 6f 67 2d 6c 6f 61 64 2e + 65 3b 20 69 74 20 6f 70 65 72 61 74 65 73 0a + + ~ "~ under a very similar set of constraints, except that" + ~ " fortunately we don't" + 7e 20 75 6e 64 65 72 20 61 20 76 65 72 79 20 73 + 69 6d 69 6c 61 72 20 73 65 74 20 6f 66 20 63 6f + 6e 73 74 72 61 69 6e 74 73 2c 20 65 78 63 65 70 + 74 20 74 68 61 74 20 66 6f 72 74 75 6e 61 74 65 + 6c 79 20 77 65 20 64 6f 6e 27 74 0a + + ~ "~ have the nightmare multi-dictionary situation that the" + ~ " log-load transform" + 7e 20 68 61 76 65 20 74 68 65 20 6e 69 67 68 74 + 6d 61 72 65 20 6d 75 6c 74 69 2d 64 69 63 74 69 + 6f 6e 61 72 79 20 73 69 74 75 61 74 69 6f 6e 20 + 74 68 61 74 20 74 68 65 20 6c 6f 67 2d 6c 6f 61 + 64 20 74 72 61 6e 73 66 6f 72 6d 0a + + ~ "~ does." + 7e 20 64 6f 65 73 2e 0a + + ~ ": hex-semicolon-alternate" + 3a 20 68 65 78 2d 73 65 6d 69 63 6f 6c 6f 6e 2d + 61 6c 74 65 72 6e 61 74 65 0a + + ~ " latest @ entry-to-execution-token 8 +" + 20 20 6c 61 74 65 73 74 20 40 20 65 6e 74 72 79 + 2d 74 6f 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f + 6b 65 6e 20 38 20 2b 0a + + ~ " dup dup dup" + 20 20 64 75 70 20 64 75 70 20 64 75 70 0a + + ~ " ~ (start, start, start, start)" + 20 20 7e 20 28 73 74 61 72 74 2c 20 73 74 61 72 + 74 2c 20 73 74 61 72 74 2c 20 73 74 61 72 74 29 + 0a + + ~ "" + 0a + + ~ " ~ The actual body of the trap is just a single word" + ~ " long (see below). If" + 20 20 7e 20 20 20 54 68 65 20 61 63 74 75 61 6c + 20 62 6f 64 79 20 6f 66 20 74 68 65 20 74 72 61 + 70 20 69 73 20 6a 75 73 74 20 61 20 73 69 6e 67 + 6c 65 20 77 6f 72 64 20 6c 6f 6e 67 20 28 73 65 + 65 20 62 65 6c 6f 77 29 2e 20 49 66 0a + + ~ " ~ that ever changes, make sure to keep the amount we" + ~ " slide by in sync with" + 20 20 7e 20 74 68 61 74 20 65 76 65 72 20 63 68 + 61 6e 67 65 73 2c 20 6d 61 6b 65 20 73 75 72 65 + 20 74 6f 20 6b 65 65 70 20 74 68 65 20 61 6d 6f + 75 6e 74 20 77 65 20 73 6c 69 64 65 20 62 79 20 + 69 6e 20 73 79 6e 63 20 77 69 74 68 0a + + ~ " ~ it." + 20 20 7e 20 69 74 2e 0a + + ~ " 8 + swap ~ TODO change number of words" + 20 20 38 20 2b 20 73 77 61 70 20 7e 20 54 4f 44 + 4f 20 63 68 61 6e 67 65 20 6e 75 6d 62 65 72 20 + 6f 66 20 77 6f 72 64 73 0a + + ~ " ~ (start, start, adjusted start, start)" + 20 20 7e 20 28 73 74 61 72 74 2c 20 73 74 61 72 + 74 2c 20 61 64 6a 75 73 74 65 64 20 73 74 61 72 + 74 2c 20 73 74 61 72 74 29 0a + + ~ "" + 0a + + ~ " here @ swap -" + 20 20 68 65 72 65 20 40 20 73 77 61 70 20 2d 0a + + ~ " ~ (start, start, adjusted start, length)" + 20 20 7e 20 28 73 74 61 72 74 2c 20 73 74 61 72 + 74 2c 20 61 64 6a 75 73 74 65 64 20 73 74 61 72 + 74 2c 20 6c 65 6e 67 74 68 29 0a + + ~ "" + 0a + + ~ " memmove" + 20 20 6d 65 6d 6d 6f 76 65 0a + + ~ " ~ (start)" + 20 20 7e 20 28 73 74 61 72 74 29 0a + + ~ "" + 0a + + ~ " ~ We're going to use comma to append compiled code, so" + ~ " let's swap out the" + 20 20 7e 20 20 20 57 65 27 72 65 20 67 6f 69 6e + 67 20 74 6f 20 75 73 65 20 63 6f 6d 6d 61 20 74 + 6f 20 61 70 70 65 6e 64 20 63 6f 6d 70 69 6c 65 + 64 20 63 6f 64 65 2c 20 73 6f 20 6c 65 74 27 73 + 20 73 77 61 70 20 6f 75 74 20 74 68 65 0a + + ~ " ~ value of "here" to point to the space we just opened" + ~ " up." + 20 20 7e 20 76 61 6c 75 65 20 6f 66 20 22 68 65 + 72 65 22 20 74 6f 20 70 6f 69 6e 74 20 74 6f 20 + 74 68 65 20 73 70 61 63 65 20 77 65 20 6a 75 73 + 74 20 6f 70 65 6e 65 64 20 75 70 2e 0a + + ~ " here @ swap here !" + 20 20 68 65 72 65 20 40 20 73 77 61 70 20 68 65 + 72 65 20 21 0a + + ~ " ~ (old "here")" + 20 20 7e 20 28 6f 6c 64 20 22 68 65 72 65 22 29 + 0a + + ~ "" + 0a + + ~ " ~ This applies to every single word terminated with" + ~ " semicolon, which is" + 20 20 7e 20 20 20 54 68 69 73 20 61 70 70 6c 69 + 65 73 20 74 6f 20 65 76 65 72 79 20 73 69 6e 67 + 6c 65 20 77 6f 72 64 20 74 65 72 6d 69 6e 61 74 + 65 64 20 77 69 74 68 20 73 65 6d 69 63 6f 6c 6f + 6e 2c 20 77 68 69 63 68 20 69 73 0a + + ~ " ~ all the Forth words that are created directly rather" + ~ " than with "variable"" + 20 20 7e 20 61 6c 6c 20 74 68 65 20 46 6f 72 74 + 68 20 77 6f 72 64 73 20 74 68 61 74 20 61 72 65 + 20 63 72 65 61 74 65 64 20 64 69 72 65 63 74 6c + 79 20 72 61 74 68 65 72 20 74 68 61 6e 20 77 69 + 74 68 20 22 76 61 72 69 61 62 6c 65 22 0a + + ~ " ~ or some similar high-level facility. Because we also" + ~ " can't have forward" + 20 20 7e 20 6f 72 20 73 6f 6d 65 20 73 69 6d 69 + 6c 61 72 20 68 69 67 68 2d 6c 65 76 65 6c 20 66 + 61 63 69 6c 69 74 79 2e 20 42 65 63 61 75 73 65 + 20 77 65 20 61 6c 73 6f 20 63 61 6e 27 74 20 68 + 61 76 65 20 66 6f 72 77 61 72 64 0a + + ~ " ~ references, that means we can't assume we'll have any" + ~ " available words in" + 20 20 7e 20 72 65 66 65 72 65 6e 63 65 73 2c 20 + 74 68 61 74 20 6d 65 61 6e 73 20 77 65 20 63 61 + 6e 27 74 20 61 73 73 75 6d 65 20 77 65 27 6c 6c + 20 68 61 76 65 20 61 6e 79 20 61 76 61 69 6c 61 + 62 6c 65 20 77 6f 72 64 73 20 69 6e 0a + + ~ " ~ the transformed code to call, at all. So, the only" + ~ " thing we can usefully" + 20 20 7e 20 74 68 65 20 74 72 61 6e 73 66 6f 72 + 6d 65 64 20 63 6f 64 65 20 74 6f 20 63 61 6c 6c + 2c 20 61 74 20 61 6c 6c 2e 20 53 6f 2c 20 74 68 + 65 20 6f 6e 6c 79 20 74 68 69 6e 67 20 77 65 20 + 63 61 6e 20 75 73 65 66 75 6c 6c 79 0a + + ~ " ~ have the trap do is call a word that's defined as part" + ~ " of the transform." + 20 20 7e 20 68 61 76 65 20 74 68 65 20 74 72 61 + 70 20 64 6f 20 69 73 20 63 61 6c 6c 20 61 20 77 + 6f 72 64 20 74 68 61 74 27 73 20 64 65 66 69 6e + 65 64 20 61 73 20 70 61 72 74 20 6f 66 20 74 68 + 65 20 74 72 61 6e 73 66 6f 72 6d 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ Fortunately, we do get to assume there will be a" + ~ " normal entry header in" + 20 20 7e 20 20 20 46 6f 72 74 75 6e 61 74 65 6c + 79 2c 20 77 65 20 64 6f 20 67 65 74 20 74 6f 20 + 61 73 73 75 6d 65 20 74 68 65 72 65 20 77 69 6c + 6c 20 62 65 20 61 20 6e 6f 72 6d 61 6c 20 65 6e + 74 72 79 20 68 65 61 64 65 72 20 69 6e 0a + + ~ " ~ place for the word we're trapping. So we don't need to" + ~ " scrounge up any" + 20 20 7e 20 70 6c 61 63 65 20 66 6f 72 20 74 68 + 65 20 77 6f 72 64 20 77 65 27 72 65 20 74 72 61 + 70 70 69 6e 67 2e 20 53 6f 20 77 65 20 64 6f 6e + 27 74 20 6e 65 65 64 20 74 6f 20 73 63 72 6f 75 + 6e 67 65 20 75 70 20 61 6e 79 0a + + ~ " ~ runtime data for the trap's benefit; the trap will be" + ~ " able to get what it" + 20 20 7e 20 72 75 6e 74 69 6d 65 20 64 61 74 61 + 20 66 6f 72 20 74 68 65 20 74 72 61 70 27 73 20 + 62 65 6e 65 66 69 74 3b 20 74 68 65 20 74 72 61 + 70 20 77 69 6c 6c 20 62 65 20 61 62 6c 65 20 74 + 6f 20 67 65 74 20 77 68 61 74 20 69 74 0a + + ~ " ~ needs by inspecting the control stack and the log." + 20 20 7e 20 6e 65 65 64 73 20 62 79 20 69 6e 73 + 70 65 63 74 69 6e 67 20 74 68 65 20 63 6f 6e 74 + 72 6f 6c 20 73 74 61 63 6b 20 61 6e 64 20 74 68 + 65 20 6c 6f 67 2e 0a + + ~ " ' hex-trace entry-to-execution-token ," + 20 20 27 20 68 65 78 2d 74 72 61 63 65 20 65 6e + 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 69 6f 6e + 2d 74 6f 6b 65 6e 20 2c 0a + + ~ "" + 0a + + ~ " ~ We're done compiling the trap's contents, so swap" + ~ " "here" back. Again," + 20 20 7e 20 20 20 57 65 27 72 65 20 64 6f 6e 65 + 20 63 6f 6d 70 69 6c 69 6e 67 20 74 68 65 20 74 + 72 61 70 27 73 20 63 6f 6e 74 65 6e 74 73 2c 20 + 73 6f 20 73 77 61 70 20 22 68 65 72 65 22 20 62 + 61 63 6b 2e 20 41 67 61 69 6e 2c 0a + + ~ " ~ keep this in sync with the length of the trap." + 20 20 7e 20 6b 65 65 70 20 74 68 69 73 20 69 6e + 20 73 79 6e 63 20 77 69 74 68 20 74 68 65 20 6c + 65 6e 67 74 68 20 6f 66 20 74 68 65 20 74 72 61 + 70 2e 0a + + ~ " 8 + here !" + 20 20 38 20 2b 20 68 65 72 65 20 21 0a + + ~ "" + 0a + + ~ " ~ Now we do the regular semicolon stuff." + 20 20 7e 20 4e 6f 77 20 77 65 20 64 6f 20 74 68 + 65 20 72 65 67 75 6c 61 72 20 73 65 6d 69 63 6f + 6c 6f 6e 20 73 74 75 66 66 2e 0a + + ~ " [ ' ; entry-to-execution-token , ]" + 20 20 5b 20 27 20 3b 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 2c 20 5d 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ ": hex-semicolon-assembly-alternate" + 3a 20 68 65 78 2d 73 65 6d 69 63 6f 6c 6f 6e 2d + 61 73 73 65 6d 62 6c 79 2d 61 6c 74 65 72 6e 61 + 74 65 0a + + ~ " latest @ entry-to-name" + 20 20 6c 61 74 65 73 74 20 40 20 65 6e 74 72 79 + 2d 74 6f 2d 6e 61 6d 65 0a + + ~ " dup s" sys-write" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 73 79 73 2d 77 72 69 + 74 65 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 0a + + ~ " ~ As detailed in hex-colon-alternate, above," + ~ " sys-write is implemented in" + 20 20 20 20 7e 20 20 20 41 73 20 64 65 74 61 69 + 6c 65 64 20 69 6e 20 68 65 78 2d 63 6f 6c 6f 6e + 2d 61 6c 74 65 72 6e 61 74 65 2c 20 61 62 6f 76 + 65 2c 20 73 79 73 2d 77 72 69 74 65 20 69 73 20 + 69 6d 70 6c 65 6d 65 6e 74 65 64 20 69 6e 0a + + ~ " ~ assembly but we replace it with Forth. This logic" + ~ " here collaborates with" + 20 20 20 20 7e 20 61 73 73 65 6d 62 6c 79 20 62 + 75 74 20 77 65 20 72 65 70 6c 61 63 65 20 69 74 + 20 77 69 74 68 20 46 6f 72 74 68 2e 20 54 68 69 + 73 20 6c 6f 67 69 63 20 68 65 72 65 20 63 6f 6c + 6c 61 62 6f 72 61 74 65 73 20 77 69 74 68 0a + + ~ " ~ the logic there to make that work." + 20 20 20 20 7e 20 74 68 65 20 6c 6f 67 69 63 20 + 74 68 65 72 65 20 74 6f 20 6d 61 6b 65 20 74 68 + 61 74 20 77 6f 72 6b 2e 0a + + ~ " ~" + 20 20 20 20 7e 0a + + ~ " ~ The transformed code will still have compiled some" + ~ " assembly, though it" + 20 20 20 20 7e 20 20 20 54 68 65 20 74 72 61 6e + 73 66 6f 72 6d 65 64 20 63 6f 64 65 20 77 69 6c + 6c 20 73 74 69 6c 6c 20 68 61 76 65 20 63 6f 6d + 70 69 6c 65 64 20 73 6f 6d 65 20 61 73 73 65 6d + 62 6c 79 2c 20 74 68 6f 75 67 68 20 69 74 0a + + ~ " ~ won't be reached and would crash, so we need to fix" + ~ " alignment before we" + 20 20 20 20 7e 20 77 6f 6e 27 74 20 62 65 20 72 + 65 61 63 68 65 64 20 61 6e 64 20 77 6f 75 6c 64 + 20 63 72 61 73 68 2c 20 73 6f 20 77 65 20 6e 65 + 65 64 20 74 6f 20 66 69 78 20 61 6c 69 67 6e 6d + 65 6e 74 20 62 65 66 6f 72 65 20 77 65 0a + + ~ " ~ call semicolon." + 20 20 20 20 7e 20 63 61 6c 6c 20 73 65 6d 69 63 + 6f 6c 6f 6e 2e 0a + + ~ " drop" + 20 20 20 20 64 72 6f 70 0a + + ~ " here @ 8 packalign here !" + 20 20 20 20 68 65 72 65 20 40 20 38 20 70 61 63 + 6b 61 6c 69 67 6e 20 68 65 72 65 20 21 0a + + ~ " [ ' ; entry-to-execution-token , ]" + 20 20 20 20 5b 20 27 20 3b 20 65 6e 74 72 79 2d + 74 6f 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b + 65 6e 20 2c 20 5d 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " drop" + 20 20 64 72 6f 70 0a + + ~ "" + 0a + + ~ " ~ If no special case matches, we fall back to the regular" + ~ " behavior." + 20 20 7e 20 49 66 20 6e 6f 20 73 70 65 63 69 61 + 6c 20 63 61 73 65 20 6d 61 74 63 68 65 73 2c 20 + 77 65 20 66 61 6c 6c 20 62 61 63 6b 20 74 6f 20 + 74 68 65 20 72 65 67 75 6c 61 72 20 62 65 68 61 + 76 69 6f 72 2e 0a + + ~ " [ ' ;asm entry-to-execution-token , ]" + 20 20 5b 20 27 20 3b 61 73 6d 20 65 6e 74 72 79 + 2d 74 6f 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f + 6b 65 6e 20 2c 20 5d 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Because docol requires it, we provide a special" + ~ " mini-version of the label" + 7e 20 20 20 42 65 63 61 75 73 65 20 64 6f 63 6f + 6c 20 72 65 71 75 69 72 65 73 20 69 74 2c 20 77 + 65 20 70 72 6f 76 69 64 65 20 61 20 73 70 65 63 + 69 61 6c 20 6d 69 6e 69 2d 76 65 72 73 69 6f 6e + 20 6f 66 20 74 68 65 20 6c 61 62 65 6c 0a + + ~ "~ system. We only do L@' and L!', because that's all we" + ~ " need. Unlike with the" + 7e 20 73 79 73 74 65 6d 2e 20 57 65 20 6f 6e 6c + 79 20 64 6f 20 4c 40 27 20 61 6e 64 20 4c 21 27 + 2c 20 62 65 63 61 75 73 65 20 74 68 61 74 27 73 + 20 61 6c 6c 20 77 65 20 6e 65 65 64 2e 20 55 6e + 6c 69 6b 65 20 77 69 74 68 20 74 68 65 0a + + ~ "~ label transform, these are NOT real labels; they're" + ~ " restricted similarly to" + 7e 20 6c 61 62 65 6c 20 74 72 61 6e 73 66 6f 72 + 6d 2c 20 74 68 65 73 65 20 61 72 65 20 4e 4f 54 + 20 72 65 61 6c 20 6c 61 62 65 6c 73 3b 20 74 68 + 65 79 27 72 65 20 72 65 73 74 72 69 63 74 65 64 + 20 73 69 6d 69 6c 61 72 6c 79 20 74 6f 0a + + ~ "~ how they are for the log-load transform." + 7e 20 68 6f 77 20 74 68 65 79 20 61 72 65 20 66 + 6f 72 20 74 68 65 20 6c 6f 67 2d 6c 6f 61 64 20 + 74 72 61 6e 73 66 6f 72 6d 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Per the precedence rules in hex-transform-one, this" + ~ " version will apply to" + 7e 20 20 20 50 65 72 20 74 68 65 20 70 72 65 63 + 65 64 65 6e 63 65 20 72 75 6c 65 73 20 69 6e 20 + 68 65 78 2d 74 72 61 6e 73 66 6f 72 6d 2d 6f 6e + 65 2c 20 74 68 69 73 20 76 65 72 73 69 6f 6e 20 + 77 69 6c 6c 20 61 70 70 6c 79 20 74 6f 0a + + ~ "~ all invocations, regardless of compile mode vs. immediate" + ~ " execution." + 7e 20 61 6c 6c 20 69 6e 76 6f 63 61 74 69 6f 6e + 73 2c 20 72 65 67 61 72 64 6c 65 73 73 20 6f 66 + 20 63 6f 6d 70 69 6c 65 20 6d 6f 64 65 20 76 73 + 2e 20 69 6d 6d 65 64 69 61 74 65 20 65 78 65 63 + 75 74 69 6f 6e 2e 0a + + ~ "~ However, its own logic defers to the inner label system" + ~ " when that exists." + 7e 20 48 6f 77 65 76 65 72 2c 20 69 74 73 20 6f + 77 6e 20 6c 6f 67 69 63 20 64 65 66 65 72 73 20 + 74 6f 20 74 68 65 20 69 6e 6e 65 72 20 6c 61 62 + 65 6c 20 73 79 73 74 65 6d 20 77 68 65 6e 20 74 + 68 61 74 20 65 78 69 73 74 73 2e 0a + + ~ ": hex-L@'-alternate" + 3a 20 68 65 78 2d 4c 40 27 2d 61 6c 74 65 72 6e + 61 74 65 0a + + ~ " ~ If there's an inner copy of L@' defined, defer to it." + 20 20 7e 20 49 66 20 74 68 65 72 65 27 73 20 61 + 6e 20 69 6e 6e 65 72 20 63 6f 70 79 20 6f 66 20 + 4c 40 27 20 64 65 66 69 6e 65 64 2c 20 64 65 66 + 65 72 20 74 6f 20 69 74 2e 0a + + ~ " s" L@'" find dup {" + 20 20 73 22 20 4c 40 27 22 20 66 69 6e 64 20 64 + 75 70 20 7b 0a + + ~ " entry-to-execution-token execute" + 20 20 20 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 + 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 + 63 75 74 65 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } { drop } if-else" + 20 20 7d 20 7b 20 64 72 6f 70 20 7d 20 69 66 2d + 65 6c 73 65 0a + + ~ "" + 0a + + ~ " word dropstring" + 20 20 77 6f 72 64 20 64 72 6f 70 73 74 72 69 6e + 67 0a + + ~ " transformation-state transformation-state-label-scratch" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6c 61 62 65 + 6c 2d 73 63 72 61 74 63 68 20 40 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ ": hex-L!'-alternate" + 3a 20 68 65 78 2d 4c 21 27 2d 61 6c 74 65 72 6e + 61 74 65 0a + + ~ " ~ If there's an inner copy of L!' defined, defer to it." + 20 20 7e 20 49 66 20 74 68 65 72 65 27 73 20 61 + 6e 20 69 6e 6e 65 72 20 63 6f 70 79 20 6f 66 20 + 4c 21 27 20 64 65 66 69 6e 65 64 2c 20 64 65 66 + 65 72 20 74 6f 20 69 74 2e 0a + + ~ " s" L!'" find dup {" + 20 20 73 22 20 4c 21 27 22 20 66 69 6e 64 20 64 + 75 70 20 7b 0a + + ~ " entry-to-execution-token execute" + 20 20 20 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 + 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 + 63 75 74 65 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } { drop } if-else" + 20 20 7d 20 7b 20 64 72 6f 70 20 7d 20 69 66 2d + 65 6c 73 65 0a + + ~ "" + 0a + + ~ " word dropstring" + 20 20 77 6f 72 64 20 64 72 6f 70 73 74 72 69 6e + 67 0a + + ~ " transformation-state transformation-state-label-scratch" + ~ " !" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6c 61 62 65 + 6c 2d 73 63 72 61 74 63 68 20 21 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ The code we're compiling may try to exit when it's" + ~ " done. We want to return" + 7e 20 20 20 54 68 65 20 63 6f 64 65 20 77 65 27 + 72 65 20 63 6f 6d 70 69 6c 69 6e 67 20 6d 61 79 + 20 74 72 79 20 74 6f 20 65 78 69 74 20 77 68 65 + 6e 20 69 74 27 73 20 64 6f 6e 65 2e 20 57 65 20 + 77 61 6e 74 20 74 6f 20 72 65 74 75 72 6e 0a + + ~ "~ to our caller instead; we turn that into an nop. This" + ~ " isn't quite correct," + 7e 20 74 6f 20 6f 75 72 20 63 61 6c 6c 65 72 20 + 69 6e 73 74 65 61 64 3b 20 77 65 20 74 75 72 6e + 20 74 68 61 74 20 69 6e 74 6f 20 61 6e 20 6e 6f + 70 2e 20 54 68 69 73 20 69 73 6e 27 74 20 71 75 + 69 74 65 20 63 6f 72 72 65 63 74 2c 0a + + ~ "~ but it will work as long as the inner code doesn't try to" + ~ " do anything else" + 7e 20 62 75 74 20 69 74 20 77 69 6c 6c 20 77 6f + 72 6b 20 61 73 20 6c 6f 6e 67 20 61 73 20 74 68 + 65 20 69 6e 6e 65 72 20 63 6f 64 65 20 64 6f 65 + 73 6e 27 74 20 74 72 79 20 74 6f 20 64 6f 20 61 + 6e 79 74 68 69 6e 67 20 65 6c 73 65 0a + + ~ "~ after." + 7e 20 61 66 74 65 72 2e 0a + + ~ ": hex-bye-alternate ;" + 3a 20 68 65 78 2d 62 79 65 2d 61 6c 74 65 72 6e + 61 74 65 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Okay, now here's an interesting one. We need to provide" + ~ " additional" + 7e 20 20 20 4f 6b 61 79 2c 20 6e 6f 77 20 68 65 + 72 65 27 73 20 61 6e 20 69 6e 74 65 72 65 73 74 + 69 6e 67 20 6f 6e 65 2e 20 57 65 20 6e 65 65 64 + 20 74 6f 20 70 72 6f 76 69 64 65 20 61 64 64 69 + 74 69 6f 6e 61 6c 0a + + ~ "~ behavior for "allocate", but only when it is called" + ~ " directly from the body" + 7e 20 62 65 68 61 76 69 6f 72 20 66 6f 72 20 22 + 61 6c 6c 6f 63 61 74 65 22 2c 20 62 75 74 20 6f + 6e 6c 79 20 77 68 65 6e 20 69 74 20 69 73 20 63 + 61 6c 6c 65 64 20 64 69 72 65 63 74 6c 79 20 66 + 72 6f 6d 20 74 68 65 20 62 6f 64 79 0a + + ~ "~ of label-loop. That condition of being in the body is" + ~ " only testable" + 7e 20 6f 66 20 6c 61 62 65 6c 2d 6c 6f 6f 70 2e + 20 54 68 61 74 20 63 6f 6e 64 69 74 69 6f 6e 20 + 6f 66 20 62 65 69 6e 67 20 69 6e 20 74 68 65 20 + 62 6f 64 79 20 69 73 20 6f 6e 6c 79 20 74 65 73 + 74 61 62 6c 65 0a + + ~ "~ immediately, though "allocate" is not an immediate word" + ~ " and the effect of it" + 7e 20 69 6d 6d 65 64 69 61 74 65 6c 79 2c 20 74 + 68 6f 75 67 68 20 22 61 6c 6c 6f 63 61 74 65 22 + 20 69 73 20 6e 6f 74 20 61 6e 20 69 6d 6d 65 64 + 69 61 74 65 20 77 6f 72 64 20 61 6e 64 20 74 68 + 65 20 65 66 66 65 63 74 20 6f 66 20 69 74 0a + + ~ "~ needs to happen later. This is crucial functionality that" + ~ " we can't work" + 7e 20 6e 65 65 64 73 20 74 6f 20 68 61 70 70 65 + 6e 20 6c 61 74 65 72 2e 20 54 68 69 73 20 69 73 + 20 63 72 75 63 69 61 6c 20 66 75 6e 63 74 69 6f + 6e 61 6c 69 74 79 20 74 68 61 74 20 77 65 20 63 + 61 6e 27 74 20 77 6f 72 6b 0a + + ~ "~ without. So, we use a replacement and an alternate that" + ~ " work in tandem." + 7e 20 77 69 74 68 6f 75 74 2e 20 53 6f 2c 20 77 + 65 20 75 73 65 20 61 20 72 65 70 6c 61 63 65 6d + 65 6e 74 20 61 6e 64 20 61 6e 20 61 6c 74 65 72 + 6e 61 74 65 20 74 68 61 74 20 77 6f 72 6b 20 69 + 6e 20 74 61 6e 64 65 6d 2e 0a + + ~ "~" + 7e 0a + + ~ "~ First, we define the replacement..." + 7e 20 20 20 46 69 72 73 74 2c 20 77 65 20 64 65 + 66 69 6e 65 20 74 68 65 20 72 65 70 6c 61 63 65 + 6d 65 6e 74 2e 2e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (size -- pointer)" + 7e 20 28 73 69 7a 65 20 2d 2d 20 70 6f 69 6e 74 + 65 72 29 0a + + ~ ": hex-allocate-replacement" + 3a 20 68 65 78 2d 61 6c 6c 6f 63 61 74 65 2d 72 + 65 70 6c 61 63 65 6d 65 6e 74 0a + + ~ " dup allocate swap" + 20 20 64 75 70 20 61 6c 6c 6f 63 61 74 65 20 73 + 77 61 70 0a + + ~ " ~ (result pointer, size)" + 20 20 7e 20 28 72 65 73 75 6c 74 20 70 6f 69 6e + 74 65 72 2c 20 73 69 7a 65 29 0a + + ~ "" + 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-label-loop-buffer-length !" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 6c 61 62 65 6c 2d 6c 6f 6f 70 + 2d 62 75 66 66 65 72 2d 6c 65 6e 67 74 68 20 21 + 0a + + ~ " ~ (result pointer)" + 20 20 7e 20 28 72 65 73 75 6c 74 20 70 6f 69 6e + 74 65 72 29 0a + + ~ "" + 0a + + ~ " dup" + 20 20 64 75 70 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-label-loop-buffer-start !" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 6c 61 62 65 6c 2d 6c 6f 6f 70 + 2d 62 75 66 66 65 72 2d 73 74 61 72 74 20 21 0a + + ~ " ~ (result pointer)" + 20 20 7e 20 28 72 65 73 75 6c 74 20 70 6f 69 6e + 74 65 72 29 0a + + ~ "" + 0a + + ~ " create-hex-output-metadata-top-of-file-entries ;" + 20 20 63 72 65 61 74 65 2d 68 65 78 2d 6f 75 74 + 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 74 6f 70 + 2d 6f 66 2d 66 69 6c 65 2d 65 6e 74 72 69 65 73 + 20 3b 0a + + ~ "" + 0a + + ~ "~ ... then, we define the alternate." + 7e 20 2e 2e 2e 20 74 68 65 6e 2c 20 77 65 20 64 + 65 66 69 6e 65 20 74 68 65 20 61 6c 74 65 72 6e + 61 74 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The alternate is flagged as immediate, which means" + ~ " hex-transform-one will" + 7e 20 20 20 54 68 65 20 61 6c 74 65 72 6e 61 74 + 65 20 69 73 20 66 6c 61 67 67 65 64 20 61 73 20 + 69 6d 6d 65 64 69 61 74 65 2c 20 77 68 69 63 68 + 20 6d 65 61 6e 73 20 68 65 78 2d 74 72 61 6e 73 + 66 6f 72 6d 2d 6f 6e 65 20 77 69 6c 6c 0a + + ~ "~ treat it as always having the highest priority. It checks" + ~ " what mode we're" + 7e 20 74 72 65 61 74 20 69 74 20 61 73 20 61 6c + 77 61 79 73 20 68 61 76 69 6e 67 20 74 68 65 20 + 68 69 67 68 65 73 74 20 70 72 69 6f 72 69 74 79 + 2e 20 49 74 20 63 68 65 63 6b 73 20 77 68 61 74 + 20 6d 6f 64 65 20 77 65 27 72 65 0a + + ~ "~ in; if we're immediate, it runs the inner "allocate" if" + ~ " it exists or the" + 7e 20 69 6e 3b 20 69 66 20 77 65 27 72 65 20 69 + 6d 6d 65 64 69 61 74 65 2c 20 69 74 20 72 75 6e + 73 20 74 68 65 20 69 6e 6e 65 72 20 22 61 6c 6c + 6f 63 61 74 65 22 20 69 66 20 69 74 20 65 78 69 + 73 74 73 20 6f 72 20 74 68 65 0a + + ~ "~ outer one if not. If we're compiling, it checks if we're" + ~ " in the body of" + 7e 20 6f 75 74 65 72 20 6f 6e 65 20 69 66 20 6e + 6f 74 2e 20 49 66 20 77 65 27 72 65 20 63 6f 6d + 70 69 6c 69 6e 67 2c 20 69 74 20 63 68 65 63 6b + 73 20 69 66 20 77 65 27 72 65 20 69 6e 20 74 68 + 65 20 62 6f 64 79 20 6f 66 0a + + ~ "~ label-loop and compiles an execution token for the" + ~ " replacement if so, or the" + 7e 20 6c 61 62 65 6c 2d 6c 6f 6f 70 20 61 6e 64 + 20 63 6f 6d 70 69 6c 65 73 20 61 6e 20 65 78 65 + 63 75 74 69 6f 6e 20 74 6f 6b 65 6e 20 66 6f 72 + 20 74 68 65 20 72 65 70 6c 61 63 65 6d 65 6e 74 + 20 69 66 20 73 6f 2c 20 6f 72 20 74 68 65 0a + + ~ "~ inner "allocate" if not." + 7e 20 69 6e 6e 65 72 20 22 61 6c 6c 6f 63 61 74 + 65 22 20 69 66 20 6e 6f 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ If that was confusing: The point is, by having the" + ~ " immediate effect be" + 7e 20 20 20 49 66 20 74 68 61 74 20 77 61 73 20 + 63 6f 6e 66 75 73 69 6e 67 3a 20 54 68 65 20 70 + 6f 69 6e 74 20 69 73 2c 20 62 79 20 68 61 76 69 + 6e 67 20 74 68 65 20 69 6d 6d 65 64 69 61 74 65 + 20 65 66 66 65 63 74 20 62 65 0a + + ~ "~ compilation, we get to have it both ways." + 7e 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 2c 20 77 + 65 20 67 65 74 20 74 6f 20 68 61 76 65 20 69 74 + 20 62 6f 74 68 20 77 61 79 73 2e 0a + + ~ ": hex-allocate-alternate" + 3a 20 68 65 78 2d 61 6c 6c 6f 63 61 74 65 2d 61 + 6c 74 65 72 6e 61 74 65 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " ~ Compile mode." + 20 20 20 20 7e 20 43 6f 6d 70 69 6c 65 20 6d 6f + 64 65 2e 0a + + ~ " latest @ entry-to-name dup s" label-loop" stringcmp 0 =" + ~ " {" + 20 20 20 20 6c 61 74 65 73 74 20 40 20 65 6e 74 + 72 79 2d 74 6f 2d 6e 61 6d 65 20 64 75 70 20 73 + 22 20 6c 61 62 65 6c 2d 6c 6f 6f 70 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " ~ In label-loop." + 20 20 20 20 20 20 7e 20 49 6e 20 6c 61 62 65 6c + 2d 6c 6f 6f 70 2e 0a + + ~ " drop" + 20 20 20 20 20 20 64 72 6f 70 0a + + ~ " ' hex-allocate-replacement entry-to-execution-token" + ~ " ," + 20 20 20 20 20 20 27 20 68 65 78 2d 61 6c 6c 6f + 63 61 74 65 2d 72 65 70 6c 61 63 65 6d 65 6e 74 + 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 + 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " } {" + 20 20 20 20 7d 20 7b 0a + + ~ " ~ Not in label-loop." + 20 20 20 20 20 20 7e 20 4e 6f 74 20 69 6e 20 6c + 61 62 65 6c 2d 6c 6f 6f 70 2e 0a + + ~ " drop" + 20 20 20 20 20 20 64 72 6f 70 0a + + ~ " s" allocate" find entry-to-execution-token ," + 20 20 20 20 20 20 73 22 20 61 6c 6c 6f 63 61 74 + 65 22 20 66 69 6e 64 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 2c 0a + + ~ " } if-else" + 20 20 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " ~ Immediate mode." + 20 20 20 20 7e 20 49 6d 6d 65 64 69 61 74 65 20 + 6d 6f 64 65 2e 0a + + ~ " s" allocate" find" + 20 20 20 20 73 22 20 61 6c 6c 6f 63 61 74 65 22 + 20 66 69 6e 64 0a + + ~ " dup { entry-to-execution-token execute } { drop" + ~ " allocate } if-else" + 20 20 20 20 64 75 70 20 7b 20 65 6e 74 72 79 2d + 74 6f 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b + 65 6e 20 65 78 65 63 75 74 65 20 7d 20 7b 20 64 + 72 6f 70 20 61 6c 6c 6f 63 61 74 65 20 7d 20 69 + 66 2d 65 6c 73 65 0a + + ~ " } if-else ; make-immediate" + 20 20 7d 20 69 66 2d 65 6c 73 65 20 3b 20 6d 61 + 6b 65 2d 69 6d 6d 65 64 69 61 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ In order to handle code that slides compiled code" + ~ " around, most notably the" + 7e 20 20 20 49 6e 20 6f 72 64 65 72 20 74 6f 20 + 68 61 6e 64 6c 65 20 63 6f 64 65 20 74 68 61 74 + 20 73 6c 69 64 65 73 20 63 6f 6d 70 69 6c 65 64 + 20 63 6f 64 65 20 61 72 6f 75 6e 64 2c 20 6d 6f + 73 74 20 6e 6f 74 61 62 6c 79 20 74 68 65 0a + + ~ "~ high-level flow-control words, we trap memcopy and" + ~ " memmove. These are" + 7e 20 68 69 67 68 2d 6c 65 76 65 6c 20 66 6c 6f + 77 2d 63 6f 6e 74 72 6f 6c 20 77 6f 72 64 73 2c + 20 77 65 20 74 72 61 70 20 6d 65 6d 63 6f 70 79 + 20 61 6e 64 20 6d 65 6d 6d 6f 76 65 2e 20 54 68 + 65 73 65 20 61 72 65 0a + + ~ "~ assembly words, so trapping them with hex-colon-alternate" + ~ " is inconvenient;" + 7e 20 61 73 73 65 6d 62 6c 79 20 77 6f 72 64 73 + 2c 20 73 6f 20 74 72 61 70 70 69 6e 67 20 74 68 + 65 6d 20 77 69 74 68 20 68 65 78 2d 63 6f 6c 6f + 6e 2d 61 6c 74 65 72 6e 61 74 65 20 69 73 20 69 + 6e 63 6f 6e 76 65 6e 69 65 6e 74 3b 0a + + ~ "~ instead we patch their callers. This is like the" + ~ " "allocate" trap, but" + 7e 20 69 6e 73 74 65 61 64 20 77 65 20 70 61 74 + 63 68 20 74 68 65 69 72 20 63 61 6c 6c 65 72 73 + 2e 20 54 68 69 73 20 69 73 20 6c 69 6b 65 20 74 + 68 65 20 22 61 6c 6c 6f 63 61 74 65 22 20 74 72 + 61 70 2c 20 62 75 74 0a + + ~ "~ simpler. There's no special logic needed here, we just" + ~ " unconditionally" + 7e 20 73 69 6d 70 6c 65 72 2e 20 54 68 65 72 65 + 27 73 20 6e 6f 20 73 70 65 63 69 61 6c 20 6c 6f + 67 69 63 20 6e 65 65 64 65 64 20 68 65 72 65 2c + 20 77 65 20 6a 75 73 74 20 75 6e 63 6f 6e 64 69 + 74 69 6f 6e 61 6c 6c 79 0a + + ~ "~ install the trap." + 7e 20 69 6e 73 74 61 6c 6c 20 74 68 65 20 74 72 + 61 70 2e 0a + + ~ "~" + 7e 0a + + ~ "~ This word is responsible for processing the hook. For" + ~ " code running" + 7e 20 20 20 54 68 69 73 20 77 6f 72 64 20 69 73 + 20 72 65 73 70 6f 6e 73 69 62 6c 65 20 66 6f 72 + 20 70 72 6f 63 65 73 73 69 6e 67 20 74 68 65 20 + 68 6f 6f 6b 2e 20 46 6f 72 20 63 6f 64 65 20 72 + 75 6e 6e 69 6e 67 0a + + ~ "~ directly under the hex transform, it's installed by" + ~ " hex-memcopy-alternate" + 7e 20 64 69 72 65 63 74 6c 79 20 75 6e 64 65 72 + 20 74 68 65 20 68 65 78 20 74 72 61 6e 73 66 6f + 72 6d 2c 20 69 74 27 73 20 69 6e 73 74 61 6c 6c + 65 64 20 62 79 20 68 65 78 2d 6d 65 6d 63 6f 70 + 79 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ "~ and hex-memmove-alternate, immediately below. For code" + ~ " running in a nested" + 7e 20 61 6e 64 20 68 65 78 2d 6d 65 6d 6d 6f 76 + 65 2d 61 6c 74 65 72 6e 61 74 65 2c 20 69 6d 6d + 65 64 69 61 74 65 6c 79 20 62 65 6c 6f 77 2e 20 + 46 6f 72 20 63 6f 64 65 20 72 75 6e 6e 69 6e 67 + 20 69 6e 20 61 20 6e 65 73 74 65 64 0a + + ~ "~ label transform, see hex-label-word-replacement, further" + ~ " down. Note" + 7e 20 6c 61 62 65 6c 20 74 72 61 6e 73 66 6f 72 + 6d 2c 20 73 65 65 20 68 65 78 2d 6c 61 62 65 6c + 2d 77 6f 72 64 2d 72 65 70 6c 61 63 65 6d 65 6e + 74 2c 20 66 75 72 74 68 65 72 20 64 6f 77 6e 2e + 20 4e 6f 74 65 0a + + ~ "~ carefully that when it's in a nested transform, the hook" + ~ " only runs in" + 7e 20 63 61 72 65 66 75 6c 6c 79 20 74 68 61 74 + 20 77 68 65 6e 20 69 74 27 73 20 69 6e 20 61 20 + 6e 65 73 74 65 64 20 74 72 61 6e 73 66 6f 72 6d + 2c 20 74 68 65 20 68 6f 6f 6b 20 6f 6e 6c 79 20 + 72 75 6e 73 20 69 6e 0a + + ~ "~ immediate mode; running it in compile mode would affect" + ~ " the program being" + 7e 20 69 6d 6d 65 64 69 61 74 65 20 6d 6f 64 65 + 3b 20 72 75 6e 6e 69 6e 67 20 69 74 20 69 6e 20 + 63 6f 6d 70 69 6c 65 20 6d 6f 64 65 20 77 6f 75 + 6c 64 20 61 66 66 65 63 74 20 74 68 65 20 70 72 + 6f 67 72 61 6d 20 62 65 69 6e 67 0a + + ~ "~ compiled." + 7e 20 63 6f 6d 70 69 6c 65 64 2e 0a + + ~ "~" + 7e 0a + + ~ "~ It is worth noting that, as of the time this code was" + ~ " written, there is" + 7e 20 20 20 49 74 20 69 73 20 77 6f 72 74 68 20 + 6e 6f 74 69 6e 67 20 74 68 61 74 2c 20 61 73 20 + 6f 66 20 74 68 65 20 74 69 6d 65 20 74 68 69 73 + 20 63 6f 64 65 20 77 61 73 20 77 72 69 74 74 65 + 6e 2c 20 74 68 65 72 65 20 69 73 0a + + ~ "~ never actually any memory sliding of compiled code that" + ~ " occurs outside of a" + 7e 20 6e 65 76 65 72 20 61 63 74 75 61 6c 6c 79 + 20 61 6e 79 20 6d 65 6d 6f 72 79 20 73 6c 69 64 + 69 6e 67 20 6f 66 20 63 6f 6d 70 69 6c 65 64 20 + 63 6f 64 65 20 74 68 61 74 20 6f 63 63 75 72 73 + 20 6f 75 74 73 69 64 65 20 6f 66 20 61 0a + + ~ "~ nested transform. This aligns with intuition, since" + ~ " sliding is really only" + 7e 20 6e 65 73 74 65 64 20 74 72 61 6e 73 66 6f + 72 6d 2e 20 54 68 69 73 20 61 6c 69 67 6e 73 20 + 77 69 74 68 20 69 6e 74 75 69 74 69 6f 6e 2c 20 + 73 69 6e 63 65 20 73 6c 69 64 69 6e 67 20 69 73 + 20 72 65 61 6c 6c 79 20 6f 6e 6c 79 0a + + ~ "~ done in the high-level flow-control words. However," + ~ " should it happen in the" + 7e 20 64 6f 6e 65 20 69 6e 20 74 68 65 20 68 69 + 67 68 2d 6c 65 76 65 6c 20 66 6c 6f 77 2d 63 6f + 6e 74 72 6f 6c 20 77 6f 72 64 73 2e 20 48 6f 77 + 65 76 65 72 2c 20 73 68 6f 75 6c 64 20 69 74 20 + 68 61 70 70 65 6e 20 69 6e 20 74 68 65 0a + + ~ "~ future, we still want it to work, so it's implemented." + 7e 20 66 75 74 75 72 65 2c 20 77 65 20 73 74 69 + 6c 6c 20 77 61 6e 74 20 69 74 20 74 6f 20 77 6f + 72 6b 2c 20 73 6f 20 69 74 27 73 20 69 6d 70 6c + 65 6d 65 6e 74 65 64 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The actual metadata handling is done by" + ~ " hex-memory-slide-trace, which is" + 7e 20 20 20 54 68 65 20 61 63 74 75 61 6c 20 6d + 65 74 61 64 61 74 61 20 68 61 6e 64 6c 69 6e 67 + 20 69 73 20 64 6f 6e 65 20 62 79 20 68 65 78 2d + 6d 65 6d 6f 72 79 2d 73 6c 69 64 65 2d 74 72 61 + 63 65 2c 20 77 68 69 63 68 20 69 73 0a + + ~ "~ above, near the other words that trace memory operations." + ~ " We let the" + 7e 20 61 62 6f 76 65 2c 20 6e 65 61 72 20 74 68 + 65 20 6f 74 68 65 72 20 77 6f 72 64 73 20 74 68 + 61 74 20 74 72 61 63 65 20 6d 65 6d 6f 72 79 20 + 6f 70 65 72 61 74 69 6f 6e 73 2e 20 57 65 20 6c + 65 74 20 74 68 65 0a + + ~ "~ replacement handle preserving the parameters so that the" + ~ " trace doesn't need" + 7e 20 72 65 70 6c 61 63 65 6d 65 6e 74 20 68 61 + 6e 64 6c 65 20 70 72 65 73 65 72 76 69 6e 67 20 + 74 68 65 20 70 61 72 61 6d 65 74 65 72 73 20 73 + 6f 20 74 68 61 74 20 74 68 65 20 74 72 61 63 65 + 20 64 6f 65 73 6e 27 74 20 6e 65 65 64 0a + + ~ "~ to, since that would be a difference between it and the" + ~ " other words similar" + 7e 20 74 6f 2c 20 73 69 6e 63 65 20 74 68 61 74 + 20 77 6f 75 6c 64 20 62 65 20 61 20 64 69 66 66 + 65 72 65 6e 63 65 20 62 65 74 77 65 65 6e 20 69 + 74 20 61 6e 64 20 74 68 65 20 6f 74 68 65 72 20 + 77 6f 72 64 73 20 73 69 6d 69 6c 61 72 0a + + ~ "~ to it." + 7e 20 74 6f 20 69 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (source, destination, length -- source, destination," + ~ " length)" + 7e 20 28 73 6f 75 72 63 65 2c 20 64 65 73 74 69 + 6e 61 74 69 6f 6e 2c 20 6c 65 6e 67 74 68 20 2d + 2d 20 73 6f 75 72 63 65 2c 20 64 65 73 74 69 6e + 61 74 69 6f 6e 2c 20 6c 65 6e 67 74 68 29 0a + + ~ ": hex-memory-slide-replacement" + 3a 20 68 65 78 2d 6d 65 6d 6f 72 79 2d 73 6c 69 + 64 65 2d 72 65 70 6c 61 63 65 6d 65 6e 74 0a + + ~ " 2 pick 2 pick 2 pick hex-memory-slide-trace ;" + 20 20 32 20 70 69 63 6b 20 32 20 70 69 63 6b 20 + 32 20 70 69 63 6b 20 68 65 78 2d 6d 65 6d 6f 72 + 79 2d 73 6c 69 64 65 2d 74 72 61 63 65 20 3b 0a + + ~ "" + 0a + + ~ "~ These two alternates are responsible for installing" + 7e 20 20 20 54 68 65 73 65 20 74 77 6f 20 61 6c + 74 65 72 6e 61 74 65 73 20 61 72 65 20 72 65 73 + 70 6f 6e 73 69 62 6c 65 20 66 6f 72 20 69 6e 73 + 74 61 6c 6c 69 6e 67 0a + + ~ "~ hex-memory-slide-replacement, immediately above, in" + ~ " invocations of memcopy" + 7e 20 68 65 78 2d 6d 65 6d 6f 72 79 2d 73 6c 69 + 64 65 2d 72 65 70 6c 61 63 65 6d 65 6e 74 2c 20 + 69 6d 6d 65 64 69 61 74 65 6c 79 20 61 62 6f 76 + 65 2c 20 69 6e 20 69 6e 76 6f 63 61 74 69 6f 6e + 73 20 6f 66 20 6d 65 6d 63 6f 70 79 0a + + ~ "~ and memmove that occur directly under the hex transform." + ~ " For invocations" + 7e 20 61 6e 64 20 6d 65 6d 6d 6f 76 65 20 74 68 + 61 74 20 6f 63 63 75 72 20 64 69 72 65 63 74 6c + 79 20 75 6e 64 65 72 20 74 68 65 20 68 65 78 20 + 74 72 61 6e 73 66 6f 72 6d 2e 20 46 6f 72 20 69 + 6e 76 6f 63 61 74 69 6f 6e 73 0a + + ~ "~ that occur in nested transforms, see" + ~ " hex-label-word-replacement, further" + 7e 20 74 68 61 74 20 6f 63 63 75 72 20 69 6e 20 + 6e 65 73 74 65 64 20 74 72 61 6e 73 66 6f 72 6d + 73 2c 20 73 65 65 20 68 65 78 2d 6c 61 62 65 6c + 2d 77 6f 72 64 2d 72 65 70 6c 61 63 65 6d 65 6e + 74 2c 20 66 75 72 74 68 65 72 0a + + ~ "~ down." + 7e 20 64 6f 77 6e 2e 0a + + ~ ": hex-memcopy-alternate" + 3a 20 68 65 78 2d 6d 65 6d 63 6f 70 79 2d 61 6c + 74 65 72 6e 61 74 65 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " ' hex-memory-slide-replacement entry-to-execution-token" + ~ " ," + 20 20 20 20 27 20 68 65 78 2d 6d 65 6d 6f 72 79 + 2d 73 6c 69 64 65 2d 72 65 70 6c 61 63 65 6d 65 + 6e 74 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 + 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" memcopy" find entry-to-execution-token ," + 20 20 20 20 73 22 20 6d 65 6d 63 6f 70 79 22 20 + 66 69 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 + 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " hex-memory-slide-replacement" + 20 20 20 20 68 65 78 2d 6d 65 6d 6f 72 79 2d 73 + 6c 69 64 65 2d 72 65 70 6c 61 63 65 6d 65 6e 74 + 0a + + ~ " s" memcopy" find entry-to-execution-token execute" + 20 20 20 20 73 22 20 6d 65 6d 63 6f 70 79 22 20 + 66 69 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 + 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 + 65 63 75 74 65 0a + + ~ " } if-else ; make-immediate" + 20 20 7d 20 69 66 2d 65 6c 73 65 20 3b 20 6d 61 + 6b 65 2d 69 6d 6d 65 64 69 61 74 65 0a + + ~ ": hex-memmove-alternate" + 3a 20 68 65 78 2d 6d 65 6d 6d 6f 76 65 2d 61 6c + 74 65 72 6e 61 74 65 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " ' hex-memory-slide-replacement entry-to-execution-token" + ~ " ," + 20 20 20 20 27 20 68 65 78 2d 6d 65 6d 6f 72 79 + 2d 73 6c 69 64 65 2d 72 65 70 6c 61 63 65 6d 65 + 6e 74 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 + 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " s" memmove" find entry-to-execution-token ," + 20 20 20 20 73 22 20 6d 65 6d 6d 6f 76 65 22 20 + 66 69 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 + 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " hex-memory-slide-replacement" + 20 20 20 20 68 65 78 2d 6d 65 6d 6f 72 79 2d 73 + 6c 69 64 65 2d 72 65 70 6c 61 63 65 6d 65 6e 74 + 0a + + ~ " s" memmove" find entry-to-execution-token execute" + 20 20 20 20 73 22 20 6d 65 6d 6d 6f 76 65 22 20 + 66 69 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 + 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 + 65 63 75 74 65 0a + + ~ " } if-else ; make-immediate" + 20 20 7d 20 69 66 2d 65 6c 73 65 20 3b 20 6d 61 + 6b 65 2d 69 6d 6d 65 64 69 61 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Similar to how we handle "allocate" as a replacement" + ~ " which is installed by" + 7e 20 20 20 53 69 6d 69 6c 61 72 20 74 6f 20 68 + 6f 77 20 77 65 20 68 61 6e 64 6c 65 20 22 61 6c + 6c 6f 63 61 74 65 22 20 61 73 20 61 20 72 65 70 + 6c 61 63 65 6d 65 6e 74 20 77 68 69 63 68 20 69 + 73 20 69 6e 73 74 61 6c 6c 65 64 20 62 79 0a + + ~ "~ an alternate, we do the same for tilde, but for a" + ~ " different reason. The" + 7e 20 61 6e 20 61 6c 74 65 72 6e 61 74 65 2c 20 + 77 65 20 64 6f 20 74 68 65 20 73 61 6d 65 20 66 + 6f 72 20 74 69 6c 64 65 2c 20 62 75 74 20 66 6f + 72 20 61 20 64 69 66 66 65 72 65 6e 74 20 72 65 + 61 73 6f 6e 2e 20 54 68 65 0a + + ~ "~ semantics of ordinary, non-transformed tilde skip over" + ~ " comment text while" + 7e 20 73 65 6d 61 6e 74 69 63 73 20 6f 66 20 6f + 72 64 69 6e 61 72 79 2c 20 6e 6f 6e 2d 74 72 61 + 6e 73 66 6f 72 6d 65 64 20 74 69 6c 64 65 20 73 + 6b 69 70 20 6f 76 65 72 20 63 6f 6d 6d 65 6e 74 + 20 74 65 78 74 20 77 68 69 6c 65 0a + + ~ "~ compiling, and discard it. We need to do processing of" + ~ " that text later, when" + 7e 20 63 6f 6d 70 69 6c 69 6e 67 2c 20 61 6e 64 + 20 64 69 73 63 61 72 64 20 69 74 2e 20 57 65 20 + 6e 65 65 64 20 74 6f 20 64 6f 20 70 72 6f 63 65 + 73 73 69 6e 67 20 6f 66 20 74 68 61 74 20 74 65 + 78 74 20 6c 61 74 65 72 2c 20 77 68 65 6e 0a + + ~ "~ the comment's position would be reached in running the" + ~ " word it's part of, so" + 7e 20 74 68 65 20 63 6f 6d 6d 65 6e 74 27 73 20 + 70 6f 73 69 74 69 6f 6e 20 77 6f 75 6c 64 20 62 + 65 20 72 65 61 63 68 65 64 20 69 6e 20 72 75 6e + 6e 69 6e 67 20 74 68 65 20 77 6f 72 64 20 69 74 + 27 73 20 70 61 72 74 20 6f 66 2c 20 73 6f 0a + + ~ "~ the alternate compiles it appropriately." + 7e 20 74 68 65 20 61 6c 74 65 72 6e 61 74 65 20 + 63 6f 6d 70 69 6c 65 73 20 69 74 20 61 70 70 72 + 6f 70 72 69 61 74 65 6c 79 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Importantly, the replacement is only used for comments" + ~ " that have a special" + 7e 20 20 20 49 6d 70 6f 72 74 61 6e 74 6c 79 2c + 20 74 68 65 20 72 65 70 6c 61 63 65 6d 65 6e 74 + 20 69 73 20 6f 6e 6c 79 20 75 73 65 64 20 66 6f + 72 20 63 6f 6d 6d 65 6e 74 73 20 74 68 61 74 20 + 68 61 76 65 20 61 20 73 70 65 63 69 61 6c 0a + + ~ "~ comment syntax unique to the hex transform, as described" + ~ " in more detail in" + 7e 20 63 6f 6d 6d 65 6e 74 20 73 79 6e 74 61 78 + 20 75 6e 69 71 75 65 20 74 6f 20 74 68 65 20 68 + 65 78 20 74 72 61 6e 73 66 6f 72 6d 2c 20 61 73 + 20 64 65 73 63 72 69 62 65 64 20 69 6e 20 6d 6f + 72 65 20 64 65 74 61 69 6c 20 69 6e 0a + + ~ "~ the alternate, below. If it were used for all comments," + ~ " it would interfere" + 7e 20 74 68 65 20 61 6c 74 65 72 6e 61 74 65 2c + 20 62 65 6c 6f 77 2e 20 49 66 20 69 74 20 77 65 + 72 65 20 75 73 65 64 20 66 6f 72 20 61 6c 6c 20 + 63 6f 6d 6d 65 6e 74 73 2c 20 69 74 20 77 6f 75 + 6c 64 20 69 6e 74 65 72 66 65 72 65 0a + + ~ "~ with the distance of branches, which could get quite" + ~ " complex to work around." + 7e 20 77 69 74 68 20 74 68 65 20 64 69 73 74 61 + 6e 63 65 20 6f 66 20 62 72 61 6e 63 68 65 73 2c + 20 77 68 69 63 68 20 63 6f 75 6c 64 20 67 65 74 + 20 71 75 69 74 65 20 63 6f 6d 70 6c 65 78 20 74 + 6f 20 77 6f 72 6b 20 61 72 6f 75 6e 64 2e 0a + + ~ "~ It is the responsibility of words that use the" + ~ " hex-transform comment syntax" + 7e 20 49 74 20 69 73 20 74 68 65 20 72 65 73 70 + 6f 6e 73 69 62 69 6c 69 74 79 20 6f 66 20 77 6f + 72 64 73 20 74 68 61 74 20 75 73 65 20 74 68 65 + 20 68 65 78 2d 74 72 61 6e 73 66 6f 72 6d 20 63 + 6f 6d 6d 65 6e 74 20 73 79 6e 74 61 78 0a + + ~ "~ to avoid placing such comments within the scope of a" + ~ " branch. This applies" + 7e 20 74 6f 20 61 76 6f 69 64 20 70 6c 61 63 69 + 6e 67 20 73 75 63 68 20 63 6f 6d 6d 65 6e 74 73 + 20 77 69 74 68 69 6e 20 74 68 65 20 73 63 6f 70 + 65 20 6f 66 20 61 20 62 72 61 6e 63 68 2e 20 54 + 68 69 73 20 61 70 70 6c 69 65 73 0a + + ~ "~ only to explicit, precomputed branches using the words" + ~ " "branch" and" + 7e 20 6f 6e 6c 79 20 74 6f 20 65 78 70 6c 69 63 + 69 74 2c 20 70 72 65 63 6f 6d 70 75 74 65 64 20 + 62 72 61 6e 63 68 65 73 20 75 73 69 6e 67 20 74 + 68 65 20 77 6f 72 64 73 20 22 62 72 61 6e 63 68 + 22 20 61 6e 64 0a + + ~ "~ "branch0". Fortunately, implicit branches that are part" + ~ " of high-level" + 7e 20 22 62 72 61 6e 63 68 30 22 2e 20 46 6f 72 + 74 75 6e 61 74 65 6c 79 2c 20 69 6d 70 6c 69 63 + 69 74 20 62 72 61 6e 63 68 65 73 20 74 68 61 74 + 20 61 72 65 20 70 61 72 74 20 6f 66 20 68 69 67 + 68 2d 6c 65 76 65 6c 0a + + ~ "~ flow-control words such as "if" and "while" will work" + ~ " fine, since the" + 7e 20 66 6c 6f 77 2d 63 6f 6e 74 72 6f 6c 20 77 + 6f 72 64 73 20 73 75 63 68 20 61 73 20 22 69 66 + 22 20 61 6e 64 20 22 77 68 69 6c 65 22 20 77 69 + 6c 6c 20 77 6f 72 6b 20 66 69 6e 65 2c 20 73 69 + 6e 63 65 20 74 68 65 0a + + ~ "~ substitution occurs before the flow control words start" + ~ " sliding code around," + 7e 20 73 75 62 73 74 69 74 75 74 69 6f 6e 20 6f + 63 63 75 72 73 20 62 65 66 6f 72 65 20 74 68 65 + 20 66 6c 6f 77 20 63 6f 6e 74 72 6f 6c 20 77 6f + 72 64 73 20 73 74 61 72 74 20 73 6c 69 64 69 6e + 67 20 63 6f 64 65 20 61 72 6f 75 6e 64 2c 0a + + ~ "~ and it updates "here" appropriately." + 7e 20 61 6e 64 20 69 74 20 75 70 64 61 74 65 73 + 20 22 68 65 72 65 22 20 61 70 70 72 6f 70 72 69 + 61 74 65 6c 79 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Because hex-tilde-replacement is called in various" + ~ " situations during" + 7e 20 20 20 42 65 63 61 75 73 65 20 68 65 78 2d + 74 69 6c 64 65 2d 72 65 70 6c 61 63 65 6d 65 6e + 74 20 69 73 20 63 61 6c 6c 65 64 20 69 6e 20 76 + 61 72 69 6f 75 73 20 73 69 74 75 61 74 69 6f 6e + 73 20 64 75 72 69 6e 67 0a + + ~ "~ various phases of compilation and interpreting, it can't" + ~ " take responsibility" + 7e 20 76 61 72 69 6f 75 73 20 70 68 61 73 65 73 + 20 6f 66 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 20 + 61 6e 64 20 69 6e 74 65 72 70 72 65 74 69 6e 67 + 2c 20 69 74 20 63 61 6e 27 74 20 74 61 6b 65 20 + 72 65 73 70 6f 6e 73 69 62 69 6c 69 74 79 0a + + ~ "~ for knowing how the string pointer it's given is" + ~ " allocated. It assumes the" + 7e 20 66 6f 72 20 6b 6e 6f 77 69 6e 67 20 68 6f + 77 20 74 68 65 20 73 74 72 69 6e 67 20 70 6f 69 + 6e 74 65 72 20 69 74 27 73 20 67 69 76 65 6e 20 + 69 73 20 61 6c 6c 6f 63 61 74 65 64 2e 20 49 74 + 20 61 73 73 75 6d 65 73 20 74 68 65 0a + + ~ "~ string pointer will be valid indefinitely; it's the" + ~ " caller's responsibility" + 7e 20 73 74 72 69 6e 67 20 70 6f 69 6e 74 65 72 + 20 77 69 6c 6c 20 62 65 20 76 61 6c 69 64 20 69 + 6e 64 65 66 69 6e 69 74 65 6c 79 3b 20 69 74 27 + 73 20 74 68 65 20 63 61 6c 6c 65 72 27 73 20 72 + 65 73 70 6f 6e 73 69 62 69 6c 69 74 79 0a + + ~ "~ to make sure of that." + 7e 20 74 6f 20 6d 61 6b 65 20 73 75 72 65 20 6f + 66 20 74 68 61 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (has non-space this line, string pointer --)" + 7e 20 28 68 61 73 20 6e 6f 6e 2d 73 70 61 63 65 + 20 74 68 69 73 20 6c 69 6e 65 2c 20 73 74 72 69 + 6e 67 20 70 6f 69 6e 74 65 72 20 2d 2d 29 0a + + ~ ": hex-tilde-replacement" + 3a 20 68 65 78 2d 74 69 6c 64 65 2d 72 65 70 6c + 61 63 65 6d 65 6e 74 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " @" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 40 0a + + ~ " hex-output-metadata-latest-output-point @" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 6c 61 74 65 73 74 2d 6f 75 74 + 70 75 74 2d 70 6f 69 6e 74 20 40 0a + + ~ " swap" + 20 20 73 77 61 70 0a + + ~ " ~ (has non-space this line, data start, string pointer)" + 20 20 7e 20 28 68 61 73 20 6e 6f 6e 2d 73 70 61 + 63 65 20 74 68 69 73 20 6c 69 6e 65 2c 20 64 61 + 74 61 20 73 74 61 72 74 2c 20 73 74 72 69 6e 67 + 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " ~ If the output wouldn't go in the label-loop buffer," + ~ " don't do any of" + 20 20 7e 20 20 20 49 66 20 74 68 65 20 6f 75 74 + 70 75 74 20 77 6f 75 6c 64 6e 27 74 20 67 6f 20 + 69 6e 20 74 68 65 20 6c 61 62 65 6c 2d 6c 6f 6f + 70 20 62 75 66 66 65 72 2c 20 64 6f 6e 27 74 20 + 64 6f 20 61 6e 79 20 6f 66 0a + + ~ " ~ this." + 20 20 7e 20 74 68 69 73 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ That may seem spurious, but remember, the same" + ~ " assembly instructions" + 20 20 7e 20 20 20 54 68 61 74 20 6d 61 79 20 73 + 65 65 6d 20 73 70 75 72 69 6f 75 73 2c 20 62 75 + 74 20 72 65 6d 65 6d 62 65 72 2c 20 74 68 65 20 + 73 61 6d 65 20 61 73 73 65 6d 62 6c 79 20 69 6e + 73 74 72 75 63 74 69 6f 6e 73 0a + + ~ " ~ are used for compiling the final binary and defining" + ~ " words within the" + 20 20 7e 20 61 72 65 20 75 73 65 64 20 66 6f 72 + 20 63 6f 6d 70 69 6c 69 6e 67 20 74 68 65 20 66 + 69 6e 61 6c 20 62 69 6e 61 72 79 20 61 6e 64 20 + 64 65 66 69 6e 69 6e 67 20 77 6f 72 64 73 20 77 + 69 74 68 69 6e 20 74 68 65 0a + + ~ " ~ compiler. In particular, "variable" will hit this, and" + ~ " there are surely" + 20 20 7e 20 63 6f 6d 70 69 6c 65 72 2e 20 49 6e + 20 70 61 72 74 69 63 75 6c 61 72 2c 20 22 76 61 + 72 69 61 62 6c 65 22 20 77 69 6c 6c 20 68 69 74 + 20 74 68 69 73 2c 20 61 6e 64 20 74 68 65 72 65 + 20 61 72 65 20 73 75 72 65 6c 79 0a + + ~ " ~ others." + 20 20 7e 20 6f 74 68 65 72 73 2e 0a + + ~ " over is-in-label-loop-buffer not { 3 ndrop exit } if" + 20 20 6f 76 65 72 20 69 73 2d 69 6e 2d 6c 61 62 + 65 6c 2d 6c 6f 6f 70 2d 62 75 66 66 65 72 20 6e + 6f 74 20 7b 20 33 20 6e 64 72 6f 70 20 65 78 69 + 74 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ Copy the first space-separated word of the comment" + ~ " body into scratch" + 20 20 7e 20 20 20 43 6f 70 79 20 74 68 65 20 66 + 69 72 73 74 20 73 70 61 63 65 2d 73 65 70 61 72 + 61 74 65 64 20 77 6f 72 64 20 6f 66 20 74 68 65 + 20 63 6f 6d 6d 65 6e 74 20 62 6f 64 79 20 69 6e + 74 6f 20 73 63 72 61 74 63 68 0a + + ~ " ~ space to see if it's a special instruction. To minimize" + ~ " interference with" + 20 20 7e 20 73 70 61 63 65 20 74 6f 20 73 65 65 + 20 69 66 20 69 74 27 73 20 61 20 73 70 65 63 69 + 61 6c 20 69 6e 73 74 72 75 63 74 69 6f 6e 2e 20 + 54 6f 20 6d 69 6e 69 6d 69 7a 65 20 69 6e 74 65 + 72 66 65 72 65 6e 63 65 20 77 69 74 68 0a + + ~ " ~ the program under transformation, we use the outer" + ~ " log's scratch space" + 20 20 7e 20 74 68 65 20 70 72 6f 67 72 61 6d 20 + 75 6e 64 65 72 20 74 72 61 6e 73 66 6f 72 6d 61 + 74 69 6f 6e 2c 20 77 65 20 75 73 65 20 74 68 65 + 20 6f 75 74 65 72 20 6c 6f 67 27 73 20 73 63 72 + 61 74 63 68 20 73 70 61 63 65 0a + + ~ " ~ rather than the inner one's." + 20 20 7e 20 72 61 74 68 65 72 20 74 68 61 6e 20 + 74 68 65 20 69 6e 6e 65 72 20 6f 6e 65 27 73 2e + 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " dup" + 20 20 64 75 70 0a + + ~ " here @" + 20 20 68 65 72 65 20 40 0a + + ~ " ~ (... source pointer, destination pointer)" + 20 20 7e 20 28 2e 2e 2e 20 73 6f 75 72 63 65 20 + 70 6f 69 6e 74 65 72 2c 20 64 65 73 74 69 6e 61 + 74 69 6f 6e 20 70 6f 69 6e 74 65 72 29 0a + + ~ " { over 8@ dup 0x20 != && } {" + 20 20 7b 20 6f 76 65 72 20 38 40 20 64 75 70 20 + 30 78 32 30 20 21 3d 20 26 26 20 7d 20 7b 0a + + ~ " swap unpack8 swap 3unroll pack8" + 20 20 20 20 73 77 61 70 20 75 6e 70 61 63 6b 38 + 20 73 77 61 70 20 33 75 6e 72 6f 6c 6c 20 70 61 + 63 6b 38 0a + + ~ " } while" + 20 20 7d 20 77 68 69 6c 65 0a + + ~ " 0 pack8 drop drop" + 20 20 30 20 70 61 63 6b 38 20 64 72 6f 70 20 64 + 72 6f 70 0a + + ~ "" + 0a + + ~ " here @" + 20 20 68 65 72 65 20 40 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " ~ (has non-space this line, data start, string pointer," + 20 20 7e 20 28 68 61 73 20 6e 6f 6e 2d 73 70 61 + 63 65 20 74 68 69 73 20 6c 69 6e 65 2c 20 64 61 + 74 61 20 73 74 61 72 74 2c 20 73 74 72 69 6e 67 + 20 70 6f 69 6e 74 65 72 2c 0a + + ~ " ~ first word string pointer)" + 20 20 7e 20 20 66 69 72 73 74 20 77 6f 72 64 20 + 73 74 72 69 6e 67 20 70 6f 69 6e 74 65 72 29 0a + + ~ " dup read-integer 0 = {" + 20 20 64 75 70 20 72 65 61 64 2d 69 6e 74 65 67 + 65 72 20 30 20 3d 20 7b 0a + + ~ " ~ (has non-space, data start, string pointer, first" + ~ " word string pointer," + 20 20 20 20 7e 20 28 68 61 73 20 6e 6f 6e 2d 73 + 70 61 63 65 2c 20 64 61 74 61 20 73 74 61 72 74 + 2c 20 73 74 72 69 6e 67 20 70 6f 69 6e 74 65 72 + 2c 20 66 69 72 73 74 20 77 6f 72 64 20 73 74 72 + 69 6e 67 20 70 6f 69 6e 74 65 72 2c 0a + + ~ " ~ data length)" + 20 20 20 20 7e 20 20 64 61 74 61 20 6c 65 6e 67 + 74 68 29 0a + + ~ " 3unroll stringlen 1+ +" + 20 20 20 20 33 75 6e 72 6f 6c 6c 20 73 74 72 69 + 6e 67 6c 65 6e 20 31 2b 20 2b 0a + + ~ " ~ (has non-space, data start, data length, adjusted" + ~ " string pointer)" + 20 20 20 20 7e 20 28 68 61 73 20 6e 6f 6e 2d 73 + 70 61 63 65 2c 20 64 61 74 61 20 73 74 61 72 74 + 2c 20 64 61 74 61 20 6c 65 6e 67 74 68 2c 20 61 + 64 6a 75 73 74 65 64 20 73 74 72 69 6e 67 20 70 + 6f 69 6e 74 65 72 29 0a + + ~ " 4 roll drop" + 20 20 20 20 34 20 72 6f 6c 6c 20 64 72 6f 70 0a + + ~ " 1 swap" + 20 20 20 20 31 20 73 77 61 70 0a + + ~ " ~ (data start, data length, is suffix, adjusted string" + ~ " pointer)" + 20 20 20 20 7e 20 28 64 61 74 61 20 73 74 61 72 + 74 2c 20 64 61 74 61 20 6c 65 6e 67 74 68 2c 20 + 69 73 20 73 75 66 66 69 78 2c 20 61 64 6a 75 73 + 74 65 64 20 73 74 72 69 6e 67 20 70 6f 69 6e 74 + 65 72 29 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " drop 0 swap" + 20 20 20 20 64 72 6f 70 20 30 20 73 77 61 70 0a + + ~ " ~ (has non-space, data start, data length, string" + ~ " pointer)" + 20 20 20 20 7e 20 28 68 61 73 20 6e 6f 6e 2d 73 + 70 61 63 65 2c 20 64 61 74 61 20 73 74 61 72 74 + 2c 20 64 61 74 61 20 6c 65 6e 67 74 68 2c 20 73 + 74 72 69 6e 67 20 70 6f 69 6e 74 65 72 29 0a + + ~ " 4 roll swap" + 20 20 20 20 34 20 72 6f 6c 6c 20 73 77 61 70 0a + + ~ " ~ (data start, data length, is suffix, string pointer)" + 20 20 20 20 7e 20 28 64 61 74 61 20 73 74 61 72 + 74 2c 20 64 61 74 61 20 6c 65 6e 67 74 68 2c 20 + 69 73 20 73 75 66 66 69 78 2c 20 73 74 72 69 6e + 67 20 70 6f 69 6e 74 65 72 29 0a + + ~ " } if-else" + 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " ~ (data start, data length, is suffix, adjusted string" + ~ " pointer)" + 20 20 7e 20 28 64 61 74 61 20 73 74 61 72 74 2c + 20 64 61 74 61 20 6c 65 6e 67 74 68 2c 20 69 73 + 20 73 75 66 66 69 78 2c 20 61 64 6a 75 73 74 65 + 64 20 73 74 72 69 6e 67 20 70 6f 69 6e 74 65 72 + 29 0a + + ~ "" + 0a + + ~ " ~ Now look for instruction keywords. These keywords are" + ~ " expected to be the" + 20 20 7e 20 20 20 4e 6f 77 20 6c 6f 6f 6b 20 66 + 6f 72 20 69 6e 73 74 72 75 63 74 69 6f 6e 20 6b + 65 79 77 6f 72 64 73 2e 20 54 68 65 73 65 20 6b + 65 79 77 6f 72 64 73 20 61 72 65 20 65 78 70 65 + 63 74 65 64 20 74 6f 20 62 65 20 74 68 65 0a + + ~ " ~ entire line, except that a length field can come before" + ~ " them." + 20 20 7e 20 65 6e 74 69 72 65 20 6c 69 6e 65 2c + 20 65 78 63 65 70 74 20 74 68 61 74 20 61 20 6c + 65 6e 67 74 68 20 66 69 65 6c 64 20 63 61 6e 20 + 63 6f 6d 65 20 62 65 66 6f 72 65 20 74 68 65 6d + 2e 0a + + ~ " dup s" adjust-length" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 61 64 6a 75 73 74 2d + 6c 65 6e 67 74 68 22 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 0a + + ~ " ~ Modify the most recent comment entry by adjusting its" + ~ " length." + 20 20 20 20 7e 20 4d 6f 64 69 66 79 20 74 68 65 + 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 63 6f 6d + 6d 65 6e 74 20 65 6e 74 72 79 20 62 79 20 61 64 + 6a 75 73 74 69 6e 67 20 69 74 73 20 6c 65 6e 67 + 74 68 2e 0a + + ~ " drop drop swap drop" + ~ " adjust-latest-comment-metadata-entry-length" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 20 73 77 + 61 70 20 64 72 6f 70 20 61 64 6a 75 73 74 2d 6c + 61 74 65 73 74 2d 63 6f 6d 6d 65 6e 74 2d 6d 65 + 74 61 64 61 74 61 2d 65 6e 74 72 79 2d 6c 65 6e + 67 74 68 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " dup s" adjust-start" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 61 64 6a 75 73 74 2d + 73 74 61 72 74 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 0a + + ~ " ~ Modify the most recent output-producing entry by" + ~ " adjusting its start." + 20 20 20 20 7e 20 4d 6f 64 69 66 79 20 74 68 65 + 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 6f 75 74 + 70 75 74 2d 70 72 6f 64 75 63 69 6e 67 20 65 6e + 74 72 79 20 62 79 20 61 64 6a 75 73 74 69 6e 67 + 20 69 74 73 20 73 74 61 72 74 2e 0a + + ~ " drop drop swap drop" + ~ " adjust-latest-output-producing-metadata-entry-start" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 20 73 77 + 61 70 20 64 72 6f 70 20 61 64 6a 75 73 74 2d 6c + 61 74 65 73 74 2d 6f 75 74 70 75 74 2d 70 72 6f + 64 75 63 69 6e 67 2d 6d 65 74 61 64 61 74 61 2d + 65 6e 74 72 79 2d 73 74 61 72 74 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " dup s" set-output-point" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 73 65 74 2d 6f 75 74 + 70 75 74 2d 70 6f 69 6e 74 22 20 73 74 72 69 6e + 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " ~ Override the latest output point." + 20 20 20 20 7e 20 4f 76 65 72 72 69 64 65 20 74 + 68 65 20 6c 61 74 65 73 74 20 6f 75 74 70 75 74 + 20 70 6f 69 6e 74 2e 0a + + ~ " drop drop swap drop set-latest-output-point" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 20 73 77 + 61 70 20 64 72 6f 70 20 73 65 74 2d 6c 61 74 65 + 73 74 2d 6f 75 74 70 75 74 2d 70 6f 69 6e 74 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " dup s" adjust-output-point" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 61 64 6a 75 73 74 2d + 6f 75 74 70 75 74 2d 70 6f 69 6e 74 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " ~ Modify the latest output point." + 20 20 20 20 7e 20 4d 6f 64 69 66 79 20 74 68 65 + 20 6c 61 74 65 73 74 20 6f 75 74 70 75 74 20 70 + 6f 69 6e 74 2e 0a + + ~ " drop drop swap drop adjust-latest-output-point" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 20 73 77 + 61 70 20 64 72 6f 70 20 61 64 6a 75 73 74 2d 6c + 61 74 65 73 74 2d 6f 75 74 70 75 74 2d 70 6f 69 + 6e 74 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup s" data-adjust-length" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 64 61 74 61 2d 61 64 + 6a 75 73 74 2d 6c 65 6e 67 74 68 22 20 73 74 72 + 69 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " ~ Modify the most recent comment entry by adjusting" + ~ " its length, also" + 20 20 20 20 7e 20 20 20 4d 6f 64 69 66 79 20 74 + 68 65 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 63 + 6f 6d 6d 65 6e 74 20 65 6e 74 72 79 20 62 79 20 + 61 64 6a 75 73 74 69 6e 67 20 69 74 73 20 6c 65 + 6e 67 74 68 2c 20 61 6c 73 6f 0a + + ~ " ~ using data from the most recent data entry." + 20 20 20 20 7e 20 75 73 69 6e 67 20 64 61 74 61 + 20 66 72 6f 6d 20 74 68 65 20 6d 6f 73 74 20 72 + 65 63 65 6e 74 20 64 61 74 61 20 65 6e 74 72 79 + 2e 0a + + ~ " drop drop swap drop" + ~ " data-adjust-latest-comment-metadata-entry-length" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 20 73 77 + 61 70 20 64 72 6f 70 20 64 61 74 61 2d 61 64 6a + 75 73 74 2d 6c 61 74 65 73 74 2d 63 6f 6d 6d 65 + 6e 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 2d 6c 65 6e 67 74 68 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " dup s" data-adjust-start" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 64 61 74 61 2d 61 64 + 6a 75 73 74 2d 73 74 61 72 74 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " ~ Modify the most recent output-producing entry by" + ~ " adjusting its start," + 20 20 20 20 7e 20 20 20 4d 6f 64 69 66 79 20 74 + 68 65 20 6d 6f 73 74 20 72 65 63 65 6e 74 20 6f + 75 74 70 75 74 2d 70 72 6f 64 75 63 69 6e 67 20 + 65 6e 74 72 79 20 62 79 20 61 64 6a 75 73 74 69 + 6e 67 20 69 74 73 20 73 74 61 72 74 2c 0a + + ~ " ~ also using data from the most recent data entry." + 20 20 20 20 7e 20 61 6c 73 6f 20 75 73 69 6e 67 + 20 64 61 74 61 20 66 72 6f 6d 20 74 68 65 20 6d + 6f 73 74 20 72 65 63 65 6e 74 20 64 61 74 61 20 + 65 6e 74 72 79 2e 0a + + ~ " drop drop swap drop" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 20 73 77 + 61 70 20 64 72 6f 70 0a + + ~ " " + ~ " data-adjust-latest-output-producing-metadata-entry-start" + 20 20 20 20 64 61 74 61 2d 61 64 6a 75 73 74 2d + 6c 61 74 65 73 74 2d 6f 75 74 70 75 74 2d 70 72 + 6f 64 75 63 69 6e 67 2d 6d 65 74 61 64 61 74 61 + 2d 65 6e 74 72 79 2d 73 74 61 72 74 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " dup s" data-set-output-point" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 64 61 74 61 2d 73 65 + 74 2d 6f 75 74 70 75 74 2d 70 6f 69 6e 74 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " ~ Override the latest output point, also using data" + ~ " from the most recent" + 20 20 20 20 7e 20 20 20 4f 76 65 72 72 69 64 65 + 20 74 68 65 20 6c 61 74 65 73 74 20 6f 75 74 70 + 75 74 20 70 6f 69 6e 74 2c 20 61 6c 73 6f 20 75 + 73 69 6e 67 20 64 61 74 61 20 66 72 6f 6d 20 74 + 68 65 20 6d 6f 73 74 20 72 65 63 65 6e 74 0a + + ~ " ~ data entry." + 20 20 20 20 7e 20 64 61 74 61 20 65 6e 74 72 79 + 2e 0a + + ~ " drop drop swap drop data-set-latest-output-point" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 20 73 77 + 61 70 20 64 72 6f 70 20 64 61 74 61 2d 73 65 74 + 2d 6c 61 74 65 73 74 2d 6f 75 74 70 75 74 2d 70 + 6f 69 6e 74 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " dup s" data-adjust-output-point" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 64 61 74 61 2d 61 64 + 6a 75 73 74 2d 6f 75 74 70 75 74 2d 70 6f 69 6e + 74 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 0a + + ~ " ~ Modify the latest output point, also using data" + ~ " from the most recent" + 20 20 20 20 7e 20 20 20 4d 6f 64 69 66 79 20 74 + 68 65 20 6c 61 74 65 73 74 20 6f 75 74 70 75 74 + 20 70 6f 69 6e 74 2c 20 61 6c 73 6f 20 75 73 69 + 6e 67 20 64 61 74 61 20 66 72 6f 6d 20 74 68 65 + 20 6d 6f 73 74 20 72 65 63 65 6e 74 0a + + ~ " ~ data entry." + 20 20 20 20 7e 20 64 61 74 61 20 65 6e 74 72 79 + 2e 0a + + ~ " drop drop swap drop data-adjust-latest-output-point" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 20 73 77 + 61 70 20 64 72 6f 70 20 64 61 74 61 2d 61 64 6a + 75 73 74 2d 6c 61 74 65 73 74 2d 6f 75 74 70 75 + 74 2d 70 6f 69 6e 74 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup s" suppress" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 73 75 70 70 72 65 73 + 73 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 0a + + ~ " ~ Suppress the next N entries, or adjust the" + ~ " remaining count of entries" + 20 20 20 20 7e 20 20 20 53 75 70 70 72 65 73 73 + 20 74 68 65 20 6e 65 78 74 20 4e 20 65 6e 74 72 + 69 65 73 2c 20 6f 72 20 61 64 6a 75 73 74 20 74 + 68 65 20 72 65 6d 61 69 6e 69 6e 67 20 63 6f 75 + 6e 74 20 6f 66 20 65 6e 74 72 69 65 73 0a + + ~ " ~ to suppress." + 20 20 20 20 7e 20 74 6f 20 73 75 70 70 72 65 73 + 73 2e 0a + + ~ " drop drop swap drop" + ~ " adjust-hex-output-suppression-count" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 20 73 77 + 61 70 20 64 72 6f 70 20 61 64 6a 75 73 74 2d 68 + 65 78 2d 6f 75 74 70 75 74 2d 73 75 70 70 72 65 + 73 73 69 6f 6e 2d 63 6f 75 6e 74 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup s" delete-first-comment-at-output-point" stringcmp 0" + ~ " = {" + 20 20 64 75 70 20 73 22 20 64 65 6c 65 74 65 2d + 66 69 72 73 74 2d 63 6f 6d 6d 65 6e 74 2d 61 74 + 2d 6f 75 74 70 75 74 2d 70 6f 69 6e 74 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " 4 ndrop" + ~ " delete-first-comment-metadata-entry-at-output-point" + 20 20 20 20 34 20 6e 64 72 6f 70 20 64 65 6c 65 + 74 65 2d 66 69 72 73 74 2d 63 6f 6d 6d 65 6e 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d + 61 74 2d 6f 75 74 70 75 74 2d 70 6f 69 6e 74 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup s" delete-last-comment-at-output-point" stringcmp 0 =" + ~ " {" + 20 20 64 75 70 20 73 22 20 64 65 6c 65 74 65 2d + 6c 61 73 74 2d 63 6f 6d 6d 65 6e 74 2d 61 74 2d + 6f 75 74 70 75 74 2d 70 6f 69 6e 74 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " 4 ndrop" + ~ " delete-latest-comment-metadata-entry-at-output-point" + 20 20 20 20 34 20 6e 64 72 6f 70 20 64 65 6c 65 + 74 65 2d 6c 61 74 65 73 74 2d 63 6f 6d 6d 65 6e + 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 + 2d 61 74 2d 6f 75 74 70 75 74 2d 70 6f 69 6e 74 + 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup s" fresh-line" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 66 72 65 73 68 2d 6c + 69 6e 65 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 0a + + ~ " ~ Create a new fresh-line entry." + 20 20 20 20 7e 20 43 72 65 61 74 65 20 61 20 6e + 65 77 20 66 72 65 73 68 2d 6c 69 6e 65 20 65 6e + 74 72 79 2e 0a + + ~ " drop drop hex-output-metadata-entry-type-fresh-line 0" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 20 68 65 + 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 + 61 2d 65 6e 74 72 79 2d 74 79 70 65 2d 66 72 65 + 73 68 2d 6c 69 6e 65 20 30 0a + + ~ " add-hex-output-metadata-entry" + 20 20 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup s" blank-line" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 62 6c 61 6e 6b 2d 6c + 69 6e 65 22 20 73 74 72 69 6e 67 63 6d 70 20 30 + 20 3d 20 7b 0a + + ~ " ~ Create a new blank-line entry." + 20 20 20 20 7e 20 43 72 65 61 74 65 20 61 20 6e + 65 77 20 62 6c 61 6e 6b 2d 6c 69 6e 65 20 65 6e + 74 72 79 2e 0a + + ~ " drop drop hex-output-metadata-entry-type-blank-line 0" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 20 68 65 + 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 + 61 2d 65 6e 74 72 79 2d 74 79 70 65 2d 62 6c 61 + 6e 6b 2d 6c 69 6e 65 20 30 0a + + ~ " add-hex-output-metadata-entry" + 20 20 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup s" indent" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 69 6e 64 65 6e 74 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 0a + + ~ " ~ Create a new indent entry with a positive indentation" + ~ " delta." + 20 20 20 20 7e 20 43 72 65 61 74 65 20 61 20 6e + 65 77 20 69 6e 64 65 6e 74 20 65 6e 74 72 79 20 + 77 69 74 68 20 61 20 70 6f 73 69 74 69 76 65 20 + 69 6e 64 65 6e 74 61 74 69 6f 6e 20 64 65 6c 74 + 61 2e 0a + + ~ " drop drop hex-output-metadata-entry-type-indent 2" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 20 68 65 + 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 + 61 2d 65 6e 74 72 79 2d 74 79 70 65 2d 69 6e 64 + 65 6e 74 20 32 0a + + ~ " add-hex-output-metadata-entry" + 20 20 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup s" deindent" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 64 65 69 6e 64 65 6e + 74 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 0a + + ~ " ~ Create a new indent entry with a negative indentation" + ~ " delta." + 20 20 20 20 7e 20 43 72 65 61 74 65 20 61 20 6e + 65 77 20 69 6e 64 65 6e 74 20 65 6e 74 72 79 20 + 77 69 74 68 20 61 20 6e 65 67 61 74 69 76 65 20 + 69 6e 64 65 6e 74 61 74 69 6f 6e 20 64 65 6c 74 + 61 2e 0a + + ~ " drop drop hex-output-metadata-entry-type-indent -2" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 20 68 65 + 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 + 61 2d 65 6e 74 72 79 2d 74 79 70 65 2d 69 6e 64 + 65 6e 74 20 2d 32 0a + + ~ " add-hex-output-metadata-entry" + 20 20 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ Now we have some commands for the various" + ~ " -provide-subitem- variants." + 20 20 7e 20 20 20 4e 6f 77 20 77 65 20 68 61 76 + 65 20 73 6f 6d 65 20 63 6f 6d 6d 61 6e 64 73 20 + 66 6f 72 20 74 68 65 20 76 61 72 69 6f 75 73 20 + 2d 70 72 6f 76 69 64 65 2d 73 75 62 69 74 65 6d + 2d 20 76 61 72 69 61 6e 74 73 2e 0a + + ~ " ~ Notice with all of these that we intentionally read one" + ~ " stack level deeper" + 20 20 7e 20 4e 6f 74 69 63 65 20 77 69 74 68 20 + 61 6c 6c 20 6f 66 20 74 68 65 73 65 20 74 68 61 + 74 20 77 65 20 69 6e 74 65 6e 74 69 6f 6e 61 6c + 6c 79 20 72 65 61 64 20 6f 6e 65 20 73 74 61 63 + 6b 20 6c 65 76 65 6c 20 64 65 65 70 65 72 0a + + ~ " ~ than anything of ours, which will be a value provided" + ~ " by the code the" + 20 20 7e 20 74 68 61 6e 20 61 6e 79 74 68 69 6e + 67 20 6f 66 20 6f 75 72 73 2c 20 77 68 69 63 68 + 20 77 69 6c 6c 20 62 65 20 61 20 76 61 6c 75 65 + 20 70 72 6f 76 69 64 65 64 20 62 79 20 74 68 65 + 20 63 6f 64 65 20 74 68 65 0a + + ~ " ~ magic comment is embedded in." + 20 20 7e 20 6d 61 67 69 63 20 63 6f 6d 6d 65 6e + 74 20 69 73 20 65 6d 62 65 64 64 65 64 20 69 6e + 2e 0a + + ~ " dup s" provide-decimal" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 70 72 6f 76 69 64 65 + 2d 64 65 63 69 6d 61 6c 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " ~ Create a new "push subitem decimal" entry." + 20 20 20 20 7e 20 43 72 65 61 74 65 20 61 20 6e + 65 77 20 22 70 75 73 68 20 73 75 62 69 74 65 6d + 20 64 65 63 69 6d 61 6c 22 20 65 6e 74 72 79 2e + 0a + + ~ " drop drop" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 0a + + ~ " 2 pick" + ~ " hex-output-metadata-entry-type-push-subitem-decimal swap" + 20 20 20 20 32 20 70 69 63 6b 20 68 65 78 2d 6f + 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 + 6e 74 72 79 2d 74 79 70 65 2d 70 75 73 68 2d 73 + 75 62 69 74 65 6d 2d 64 65 63 69 6d 61 6c 20 73 + 77 61 70 0a + + ~ " add-hex-output-metadata-entry" + 20 20 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " dup s" provide-hex" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 70 72 6f 76 69 64 65 + 2d 68 65 78 22 20 73 74 72 69 6e 67 63 6d 70 20 + 30 20 3d 20 7b 0a + + ~ " ~ Create a new "push subitem hex" entry." + 20 20 20 20 7e 20 43 72 65 61 74 65 20 61 20 6e + 65 77 20 22 70 75 73 68 20 73 75 62 69 74 65 6d + 20 68 65 78 22 20 65 6e 74 72 79 2e 0a + + ~ " drop drop" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 0a + + ~ " 2 pick hex-output-metadata-entry-type-push-subitem-hex" + ~ " swap" + 20 20 20 20 32 20 70 69 63 6b 20 68 65 78 2d 6f + 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 + 6e 74 72 79 2d 74 79 70 65 2d 70 75 73 68 2d 73 + 75 62 69 74 65 6d 2d 68 65 78 20 73 77 61 70 0a + + ~ " add-hex-output-metadata-entry" + 20 20 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " dup s" provide-hex8" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 70 72 6f 76 69 64 65 + 2d 68 65 78 38 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 0a + + ~ " ~ Create a new "push subitem hex8" entry." + 20 20 20 20 7e 20 43 72 65 61 74 65 20 61 20 6e + 65 77 20 22 70 75 73 68 20 73 75 62 69 74 65 6d + 20 68 65 78 38 22 20 65 6e 74 72 79 2e 0a + + ~ " drop drop" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 0a + + ~ " 2 pick hex-output-metadata-entry-type-push-subitem-hex8" + ~ " swap" + 20 20 20 20 32 20 70 69 63 6b 20 68 65 78 2d 6f + 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 + 6e 74 72 79 2d 74 79 70 65 2d 70 75 73 68 2d 73 + 75 62 69 74 65 6d 2d 68 65 78 38 20 73 77 61 70 + 0a + + ~ " add-hex-output-metadata-entry" + 20 20 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " dup s" provide-hex16" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 70 72 6f 76 69 64 65 + 2d 68 65 78 31 36 22 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 0a + + ~ " ~ Create a new "push subitem hex16" entry." + 20 20 20 20 7e 20 43 72 65 61 74 65 20 61 20 6e + 65 77 20 22 70 75 73 68 20 73 75 62 69 74 65 6d + 20 68 65 78 31 36 22 20 65 6e 74 72 79 2e 0a + + ~ " drop drop" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 0a + + ~ " 2 pick" + ~ " hex-output-metadata-entry-type-push-subitem-hex16 swap" + 20 20 20 20 32 20 70 69 63 6b 20 68 65 78 2d 6f + 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 + 6e 74 72 79 2d 74 79 70 65 2d 70 75 73 68 2d 73 + 75 62 69 74 65 6d 2d 68 65 78 31 36 20 73 77 61 + 70 0a + + ~ " add-hex-output-metadata-entry" + 20 20 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " dup s" provide-hex32" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 70 72 6f 76 69 64 65 + 2d 68 65 78 33 32 22 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 0a + + ~ " ~ Create a new "push subitem hex32" entry." + 20 20 20 20 7e 20 43 72 65 61 74 65 20 61 20 6e + 65 77 20 22 70 75 73 68 20 73 75 62 69 74 65 6d + 20 68 65 78 33 32 22 20 65 6e 74 72 79 2e 0a + + ~ " drop drop" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 0a + + ~ " 2 pick" + ~ " hex-output-metadata-entry-type-push-subitem-hex32 swap" + 20 20 20 20 32 20 70 69 63 6b 20 68 65 78 2d 6f + 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 + 6e 74 72 79 2d 74 79 70 65 2d 70 75 73 68 2d 73 + 75 62 69 74 65 6d 2d 68 65 78 33 32 20 73 77 61 + 70 0a + + ~ " add-hex-output-metadata-entry" + 20 20 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " dup s" provide-hex64" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 70 72 6f 76 69 64 65 + 2d 68 65 78 36 34 22 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 0a + + ~ " ~ Create a new "push subitem hex64" entry." + 20 20 20 20 7e 20 43 72 65 61 74 65 20 61 20 6e + 65 77 20 22 70 75 73 68 20 73 75 62 69 74 65 6d + 20 68 65 78 36 34 22 20 65 6e 74 72 79 2e 0a + + ~ " drop drop" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 0a + + ~ " 2 pick" + ~ " hex-output-metadata-entry-type-push-subitem-hex64 swap" + 20 20 20 20 32 20 70 69 63 6b 20 68 65 78 2d 6f + 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 + 6e 74 72 79 2d 74 79 70 65 2d 70 75 73 68 2d 73 + 75 62 69 74 65 6d 2d 68 65 78 36 34 20 73 77 61 + 70 0a + + ~ " add-hex-output-metadata-entry" + 20 20 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " dup s" provide-string" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 70 72 6f 76 69 64 65 + 2d 73 74 72 69 6e 67 22 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 0a + + ~ " drop drop" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 0a + + ~ " drop over dup stringlen swap" + 20 20 20 20 64 72 6f 70 20 6f 76 65 72 20 64 75 + 70 20 73 74 72 69 6e 67 6c 65 6e 20 73 77 61 70 + 0a + + ~ " hex-output-metadata-entry-type-push-subitem-string" + ~ " swap" + 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 + 70 65 2d 70 75 73 68 2d 73 75 62 69 74 65 6d 2d + 73 74 72 69 6e 67 20 73 77 61 70 0a + + ~ " add-hex-output-metadata-entry" + 20 20 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " dup s" provide-string-copy" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 70 72 6f 76 69 64 65 + 2d 73 74 72 69 6e 67 2d 63 6f 70 79 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " drop drop" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 0a + + ~ " drop over dup stringlen swap" + 20 20 20 20 64 72 6f 70 20 6f 76 65 72 20 64 75 + 70 20 73 74 72 69 6e 67 6c 65 6e 20 73 77 61 70 + 0a + + ~ " hex-output-metadata-entry-type-push-subitem-string" + ~ " swap" + 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 + 70 65 2d 70 75 73 68 2d 73 75 62 69 74 65 6d 2d + 73 74 72 69 6e 67 20 73 77 61 70 0a + + ~ " swap-transform-variables here @" + ~ " swap-transform-variables dup 3unroll" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 20 68 65 72 + 65 20 40 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 20 64 75 70 + 20 33 75 6e 72 6f 6c 6c 0a + + ~ " ~ (copy, original, copy)" + 20 20 20 20 7e 20 28 63 6f 70 79 2c 20 6f 72 69 + 67 69 6e 61 6c 2c 20 63 6f 70 79 29 0a + + ~ " over stringlen 1+ memcopy" + 20 20 20 20 6f 76 65 72 20 73 74 72 69 6e 67 6c + 65 6e 20 31 2b 20 6d 65 6d 63 6f 70 79 0a + + ~ " swap-transform-variables allocate-string" + ~ " swap-transform-variables" + 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f + 72 6d 2d 76 61 72 69 61 62 6c 65 73 20 61 6c 6c + 6f 63 61 74 65 2d 73 74 72 69 6e 67 20 73 77 61 + 70 2d 74 72 61 6e 73 66 6f 72 6d 2d 76 61 72 69 + 61 62 6c 65 73 0a + + ~ " add-hex-output-metadata-entry" + 20 20 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " dup s" provide-keyword" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 70 72 6f 76 69 64 65 + 2d 6b 65 79 77 6f 72 64 22 20 73 74 72 69 6e 67 + 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " ~ Create a new "push subitem string" entry given a" + ~ " keyword pointer." + 20 20 20 20 7e 20 43 72 65 61 74 65 20 61 20 6e + 65 77 20 22 70 75 73 68 20 73 75 62 69 74 65 6d + 20 73 74 72 69 6e 67 22 20 65 6e 74 72 79 20 67 + 69 76 65 6e 20 61 20 6b 65 79 77 6f 72 64 20 70 + 6f 69 6e 74 65 72 2e 0a + + ~ " drop drop" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 0a + + ~ " drop over execution-token-to-entry entry-to-name" + 20 20 20 20 64 72 6f 70 20 6f 76 65 72 20 65 78 + 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 2d 74 6f + 2d 65 6e 74 72 79 20 65 6e 74 72 79 2d 74 6f 2d + 6e 61 6d 65 0a + + ~ " dup stringlen swap" + 20 20 20 20 64 75 70 20 73 74 72 69 6e 67 6c 65 + 6e 20 73 77 61 70 0a + + ~ " hex-output-metadata-entry-type-push-subitem-string" + ~ " swap" + 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 + 70 65 2d 70 75 73 68 2d 73 75 62 69 74 65 6d 2d + 73 74 72 69 6e 67 20 73 77 61 70 0a + + ~ " add-hex-output-metadata-entry" + 20 20 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " dup s" provide-data" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 70 72 6f 76 69 64 65 + 2d 64 61 74 61 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 0a + + ~ " ~ Create a new "push subitem data" entry." + 20 20 20 20 7e 20 43 72 65 61 74 65 20 61 20 6e + 65 77 20 22 70 75 73 68 20 73 75 62 69 74 65 6d + 20 64 61 74 61 22 20 65 6e 74 72 79 2e 0a + + ~ " drop drop" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 0a + + ~ " 2 pick hex-output-metadata-entry-type-saved-data swap" + 20 20 20 20 32 20 70 69 63 6b 20 68 65 78 2d 6f + 75 74 70 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 + 6e 74 72 79 2d 74 79 70 65 2d 73 61 76 65 64 2d + 64 61 74 61 20 73 77 61 70 0a + + ~ " add-hex-output-metadata-entry" + 20 20 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ Next are the subitem stack manipulation commands." + ~ " These deal with the" + 20 20 7e 20 20 20 4e 65 78 74 20 61 72 65 20 74 + 68 65 20 73 75 62 69 74 65 6d 20 73 74 61 63 6b + 20 6d 61 6e 69 70 75 6c 61 74 69 6f 6e 20 63 6f + 6d 6d 61 6e 64 73 2e 20 54 68 65 73 65 20 64 65 + 61 6c 20 77 69 74 68 20 74 68 65 0a + + ~ " ~ subitem entry stack, just as the provide-* commands do," + ~ " but at this phase" + 20 20 7e 20 73 75 62 69 74 65 6d 20 65 6e 74 72 + 79 20 73 74 61 63 6b 2c 20 6a 75 73 74 20 61 73 + 20 74 68 65 20 70 72 6f 76 69 64 65 2d 2a 20 63 + 6f 6d 6d 61 6e 64 73 20 64 6f 2c 20 62 75 74 20 + 61 74 20 74 68 69 73 20 70 68 61 73 65 0a + + ~ " ~ of processing the effect is just to create an entry in" + ~ " the entry array," + 20 20 7e 20 6f 66 20 70 72 6f 63 65 73 73 69 6e + 67 20 74 68 65 20 65 66 66 65 63 74 20 69 73 20 + 6a 75 73 74 20 74 6f 20 63 72 65 61 74 65 20 61 + 6e 20 65 6e 74 72 79 20 69 6e 20 74 68 65 20 65 + 6e 74 72 79 20 61 72 72 61 79 2c 0a + + ~ " ~ not to do any actual stack manipulation, so their" + ~ " implementations are" + 20 20 7e 20 6e 6f 74 20 74 6f 20 64 6f 20 61 6e + 79 20 61 63 74 75 61 6c 20 73 74 61 63 6b 20 6d + 61 6e 69 70 75 6c 61 74 69 6f 6e 2c 20 73 6f 20 + 74 68 65 69 72 20 69 6d 70 6c 65 6d 65 6e 74 61 + 74 69 6f 6e 73 20 61 72 65 0a + + ~ " ~ quite simple." + 20 20 7e 20 71 75 69 74 65 20 73 69 6d 70 6c 65 + 2e 0a + + ~ " dup s" drop-subitem" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 64 72 6f 70 2d 73 75 + 62 69 74 65 6d 22 20 73 74 72 69 6e 67 63 6d 70 + 20 30 20 3d 20 7b 0a + + ~ " ~ Create a new "drop subitem" entry." + 20 20 20 20 7e 20 43 72 65 61 74 65 20 61 20 6e + 65 77 20 22 64 72 6f 70 20 73 75 62 69 74 65 6d + 22 20 65 6e 74 72 79 2e 0a + + ~ " drop drop hex-output-metadata-entry-type-drop-subitem" + ~ " 0" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 20 68 65 + 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 + 61 2d 65 6e 74 72 79 2d 74 79 70 65 2d 64 72 6f + 70 2d 73 75 62 69 74 65 6d 20 30 0a + + ~ " add-hex-output-metadata-entry" + 20 20 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " dup s" swap-subitems" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 73 77 61 70 2d 73 75 + 62 69 74 65 6d 73 22 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 0a + + ~ " ~ Create a new "swap subitem" entry." + 20 20 20 20 7e 20 43 72 65 61 74 65 20 61 20 6e + 65 77 20 22 73 77 61 70 20 73 75 62 69 74 65 6d + 22 20 65 6e 74 72 79 2e 0a + + ~ " drop drop hex-output-metadata-entry-type-swap-subitems" + ~ " 0" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 20 68 65 + 78 2d 6f 75 74 70 75 74 2d 6d 65 74 61 64 61 74 + 61 2d 65 6e 74 72 79 2d 74 79 70 65 2d 73 77 61 + 70 2d 73 75 62 69 74 65 6d 73 20 30 0a + + ~ " add-hex-output-metadata-entry" + 20 20 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " dup s" roll-subitems" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 72 6f 6c 6c 2d 73 75 + 62 69 74 65 6d 73 22 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 0a + + ~ " ~ Create a new "roll subitem" entry. The parameter" + ~ " goes in the content" + 20 20 20 20 7e 20 20 20 43 72 65 61 74 65 20 61 + 20 6e 65 77 20 22 72 6f 6c 6c 20 73 75 62 69 74 + 65 6d 22 20 65 6e 74 72 79 2e 20 54 68 65 20 70 + 61 72 61 6d 65 74 65 72 20 67 6f 65 73 20 69 6e + 20 74 68 65 20 63 6f 6e 74 65 6e 74 0a + + ~ " ~ field, and the length is always zero." + 20 20 20 20 7e 20 66 69 65 6c 64 2c 20 61 6e 64 + 20 74 68 65 20 6c 65 6e 67 74 68 20 69 73 20 61 + 6c 77 61 79 73 20 7a 65 72 6f 2e 0a + + ~ " drop drop 0 swap" + ~ " hex-output-metadata-entry-type-roll-subitems swap" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 20 30 20 + 73 77 61 70 20 68 65 78 2d 6f 75 74 70 75 74 2d + 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 + 79 70 65 2d 72 6f 6c 6c 2d 73 75 62 69 74 65 6d + 73 20 73 77 61 70 0a + + ~ " add-hex-output-metadata-entry" + 20 20 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ If it's flagged as a suffix by the logic above," + ~ " create a new" + 20 20 7e 20 20 20 49 66 20 69 74 27 73 20 66 6c + 61 67 67 65 64 20 61 73 20 61 20 73 75 66 66 69 + 78 20 62 79 20 74 68 65 20 6c 6f 67 69 63 20 61 + 62 6f 76 65 2c 20 63 72 65 61 74 65 20 61 20 6e + 65 77 0a + + ~ " ~ suffix-comment entry." + 20 20 7e 20 73 75 66 66 69 78 2d 63 6f 6d 6d 65 + 6e 74 20 65 6e 74 72 79 2e 0a + + ~ " swap {" + 20 20 73 77 61 70 20 7b 0a + + ~ " hex-output-metadata-entry-type-suffix-comment swap" + 20 20 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d + 65 74 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 + 70 65 2d 73 75 66 66 69 78 2d 63 6f 6d 6d 65 6e + 74 20 73 77 61 70 0a + + ~ " add-hex-output-metadata-entry" + 20 20 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 + 79 0a + + ~ " exit" + 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ Create a new line-comment entry." + 20 20 7e 20 43 72 65 61 74 65 20 61 20 6e 65 77 + 20 6c 69 6e 65 2d 63 6f 6d 6d 65 6e 74 20 65 6e + 74 72 79 2e 0a + + ~ " hex-output-metadata-entry-type-line-comment swap" + 20 20 68 65 78 2d 6f 75 74 70 75 74 2d 6d 65 74 + 61 64 61 74 61 2d 65 6e 74 72 79 2d 74 79 70 65 + 2d 6c 69 6e 65 2d 63 6f 6d 6d 65 6e 74 20 73 77 + 61 70 0a + + ~ " add-hex-output-metadata-entry ;" + 20 20 61 64 64 2d 68 65 78 2d 6f 75 74 70 75 74 + 2d 6d 65 74 61 64 61 74 61 2d 65 6e 74 72 79 20 + 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ We need to define a few helpers for use in" + 7e 20 20 20 57 65 20 6e 65 65 64 20 74 6f 20 64 + 65 66 69 6e 65 20 61 20 66 65 77 20 68 65 6c 70 + 65 72 73 20 66 6f 72 20 75 73 65 20 69 6e 0a + + ~ "~ hex-read-magic-comment-introducer, below. The string" + ~ " pointers these return" + 7e 20 68 65 78 2d 72 65 61 64 2d 6d 61 67 69 63 + 2d 63 6f 6d 6d 65 6e 74 2d 69 6e 74 72 6f 64 75 + 63 65 72 2c 20 62 65 6c 6f 77 2e 20 54 68 65 20 + 73 74 72 69 6e 67 20 70 6f 69 6e 74 65 72 73 20 + 74 68 65 73 65 20 72 65 74 75 72 6e 0a + + ~ "~ are allocated in the manner described there." + 7e 20 61 72 65 20 61 6c 6c 6f 63 61 74 65 64 20 + 69 6e 20 74 68 65 20 6d 61 6e 6e 65 72 20 64 65 + 73 63 72 69 62 65 64 20 74 68 65 72 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (first key -- body-string-pointer)" + 7e 20 28 66 69 72 73 74 20 6b 65 79 20 2d 2d 20 + 62 6f 64 79 2d 73 74 72 69 6e 67 2d 70 6f 69 6e + 74 65 72 29 0a + + ~ ": hex-read-nonempty-comment-body" + 3a 20 68 65 78 2d 72 65 61 64 2d 6e 6f 6e 65 6d + 70 74 79 2d 63 6f 6d 6d 65 6e 74 2d 62 6f 64 79 + 0a + + ~ " ~ This is the rare case in the transforms where we want" + ~ " to get into the" + 20 20 7e 20 20 20 54 68 69 73 20 69 73 20 74 68 + 65 20 72 61 72 65 20 63 61 73 65 20 69 6e 20 74 + 68 65 20 74 72 61 6e 73 66 6f 72 6d 73 20 77 68 + 65 72 65 20 77 65 20 77 61 6e 74 20 74 6f 20 67 + 65 74 20 69 6e 74 6f 20 74 68 65 0a + + ~ " ~ nitty-gritty of lexing. Normally we rely on the" + ~ " upstream implementations," + 20 20 7e 20 6e 69 74 74 79 2d 67 72 69 74 74 79 + 20 6f 66 20 6c 65 78 69 6e 67 2e 20 4e 6f 72 6d + 61 6c 6c 79 20 77 65 20 72 65 6c 79 20 6f 6e 20 + 74 68 65 20 75 70 73 74 72 65 61 6d 20 69 6d 70 + 6c 65 6d 65 6e 74 61 74 69 6f 6e 73 2c 0a + + ~ " ~ even when we have to go out of our way to do so," + ~ " because we don't want to" + 20 20 7e 20 65 76 65 6e 20 77 68 65 6e 20 77 65 + 20 68 61 76 65 20 74 6f 20 67 6f 20 6f 75 74 20 + 6f 66 20 6f 75 72 20 77 61 79 20 74 6f 20 64 6f + 20 73 6f 2c 20 62 65 63 61 75 73 65 20 77 65 20 + 64 6f 6e 27 74 20 77 61 6e 74 20 74 6f 0a + + ~ " ~ have to update the transforms every time there's a new" + ~ " syntax feature." + 20 20 7e 20 68 61 76 65 20 74 6f 20 75 70 64 61 + 74 65 20 74 68 65 20 74 72 61 6e 73 66 6f 72 6d + 73 20 65 76 65 72 79 20 74 69 6d 65 20 74 68 65 + 72 65 27 73 20 61 20 6e 65 77 20 73 79 6e 74 61 + 78 20 66 65 61 74 75 72 65 2e 0a + + ~ " ~ Here, however, we've got a syntax that only has meaning" + ~ " to the transform," + 20 20 7e 20 48 65 72 65 2c 20 68 6f 77 65 76 65 + 72 2c 20 77 65 27 76 65 20 67 6f 74 20 61 20 73 + 79 6e 74 61 78 20 74 68 61 74 20 6f 6e 6c 79 20 + 68 61 73 20 6d 65 61 6e 69 6e 67 20 74 6f 20 74 + 68 65 20 74 72 61 6e 73 66 6f 72 6d 2c 0a + + ~ " ~ so there's no choice." + 20 20 7e 20 73 6f 20 74 68 65 72 65 27 73 20 6e + 6f 20 63 68 6f 69 63 65 2e 0a + + ~ " swap-transform-variables here @ swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 20 68 65 72 65 20 + 40 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " ~ This little loop is a modified version of the original" + ~ " tilde loop." + 20 20 7e 20 54 68 69 73 20 6c 69 74 74 6c 65 20 + 6c 6f 6f 70 20 69 73 20 61 20 6d 6f 64 69 66 69 + 65 64 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 + 65 20 6f 72 69 67 69 6e 61 6c 20 74 69 6c 64 65 + 20 6c 6f 6f 70 2e 0a + + ~ " swap { dup dup 0x0a != && } { pack8 key } while drop" + 20 20 73 77 61 70 20 7b 20 64 75 70 20 64 75 70 + 20 30 78 30 61 20 21 3d 20 26 26 20 7d 20 7b 20 + 70 61 63 6b 38 20 6b 65 79 20 7d 20 77 68 69 6c + 65 20 64 72 6f 70 0a + + ~ "" + 0a + + ~ " 0 pack8" + 20 20 30 20 70 61 63 6b 38 0a + + ~ " 8 packalign" + 20 20 38 20 70 61 63 6b 61 6c 69 67 6e 0a + + ~ "" + 0a + + ~ " drop" + 20 20 64 72 6f 70 0a + + ~ " swap-transform-variables here @ swap-transform-variables" + ~ " ;" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 20 68 65 72 65 20 + 40 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 20 3b 0a + + ~ "" + 0a + + ~ ": hex-read-empty-comment-body" + 3a 20 68 65 78 2d 72 65 61 64 2d 65 6d 70 74 79 + 2d 63 6f 6d 6d 65 6e 74 2d 62 6f 64 79 0a + + ~ " swap-transform-variables here @ swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 20 68 65 72 65 20 + 40 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ "" + 0a + + ~ " 0 pack8" + 20 20 30 20 70 61 63 6b 38 0a + + ~ " 8 packalign" + 20 20 38 20 70 61 63 6b 61 6c 69 67 6e 0a + + ~ "" + 0a + + ~ " drop" + 20 20 64 72 6f 70 0a + + ~ " swap-transform-variables here @ swap-transform-variables" + ~ " ;" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 20 68 65 72 65 20 + 40 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This is called from a tilde alternate (such as" + ~ " hex-tilde-alternate, but" + 7e 20 20 20 54 68 69 73 20 69 73 20 63 61 6c 6c + 65 64 20 66 72 6f 6d 20 61 20 74 69 6c 64 65 20 + 61 6c 74 65 72 6e 61 74 65 20 28 73 75 63 68 20 + 61 73 20 68 65 78 2d 74 69 6c 64 65 2d 61 6c 74 + 65 72 6e 61 74 65 2c 20 62 75 74 0a + + ~ "~ there are several). Its purpose is to do the lexical" + ~ " analysis of the" + 7e 20 74 68 65 72 65 20 61 72 65 20 73 65 76 65 + 72 61 6c 29 2e 20 49 74 73 20 70 75 72 70 6f 73 + 65 20 69 73 20 74 6f 20 64 6f 20 74 68 65 20 6c + 65 78 69 63 61 6c 20 61 6e 61 6c 79 73 69 73 20 + 6f 66 20 74 68 65 0a + + ~ "~ sequence that introduces a magic comment; it assumes that" + ~ " the leading tilde" + 7e 20 73 65 71 75 65 6e 63 65 20 74 68 61 74 20 + 69 6e 74 72 6f 64 75 63 65 73 20 61 20 6d 61 67 + 69 63 20 63 6f 6d 6d 65 6e 74 3b 20 69 74 20 61 + 73 73 75 6d 65 73 20 74 68 61 74 20 74 68 65 20 + 6c 65 61 64 69 6e 67 20 74 69 6c 64 65 0a + + ~ "~ character has just been consumed from the main input," + ~ " leaving the separating" + 7e 20 63 68 61 72 61 63 74 65 72 20 68 61 73 20 + 6a 75 73 74 20 62 65 65 6e 20 63 6f 6e 73 75 6d + 65 64 20 66 72 6f 6d 20 74 68 65 20 6d 61 69 6e + 20 69 6e 70 75 74 2c 20 6c 65 61 76 69 6e 67 20 + 74 68 65 20 73 65 70 61 72 61 74 69 6e 67 0a + + ~ "~ space as the next character ready to be read." + 7e 20 73 70 61 63 65 20 61 73 20 74 68 65 20 6e + 65 78 74 20 63 68 61 72 61 63 74 65 72 20 72 65 + 61 64 79 20 74 6f 20 62 65 20 72 65 61 64 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Recall that the delimiter for a regular comment is "~ "" + ~ " (the trailing" + 7e 20 20 20 52 65 63 61 6c 6c 20 74 68 61 74 20 + 74 68 65 20 64 65 6c 69 6d 69 74 65 72 20 66 6f + 72 20 61 20 72 65 67 75 6c 61 72 20 63 6f 6d 6d + 65 6e 74 20 69 73 20 22 7e 20 22 20 28 74 68 65 + 20 74 72 61 69 6c 69 6e 67 0a + + ~ "~ space is part of it for this purpose). The delimiter for" + ~ " a magic comment is" + 7e 20 73 70 61 63 65 20 69 73 20 70 61 72 74 20 + 6f 66 20 69 74 20 66 6f 72 20 74 68 69 73 20 70 + 75 72 70 6f 73 65 29 2e 20 54 68 65 20 64 65 6c + 69 6d 69 74 65 72 20 66 6f 72 20 61 20 6d 61 67 + 69 63 20 63 6f 6d 6d 65 6e 74 20 69 73 0a + + ~ "~ "~ : ". A regular comment may also have a linefeed" + ~ " instead of a space," + 7e 20 22 7e 20 3a 20 22 2e 20 41 20 72 65 67 75 + 6c 61 72 20 63 6f 6d 6d 65 6e 74 20 6d 61 79 20 + 61 6c 73 6f 20 68 61 76 65 20 61 20 6c 69 6e 65 + 66 65 65 64 20 69 6e 73 74 65 61 64 20 6f 66 20 + 61 20 73 70 61 63 65 2c 0a + + ~ "~ indicating that it's empty; magic comments likewise can" + ~ " be empty, by ending" + 7e 20 69 6e 64 69 63 61 74 69 6e 67 20 74 68 61 + 74 20 69 74 27 73 20 65 6d 70 74 79 3b 20 6d 61 + 67 69 63 20 63 6f 6d 6d 65 6e 74 73 20 6c 69 6b + 65 77 69 73 65 20 63 61 6e 20 62 65 20 65 6d 70 + 74 79 2c 20 62 79 20 65 6e 64 69 6e 67 0a + + ~ "~ the line immediately after the colon." + 7e 20 74 68 65 20 6c 69 6e 65 20 69 6d 6d 65 64 + 69 61 74 65 6c 79 20 61 66 74 65 72 20 74 68 65 + 20 63 6f 6c 6f 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ This word does the necessary reading, then leaves the" + ~ " input pointing at" + 7e 20 20 20 54 68 69 73 20 77 6f 72 64 20 64 6f + 65 73 20 74 68 65 20 6e 65 63 65 73 73 61 72 79 + 20 72 65 61 64 69 6e 67 2c 20 74 68 65 6e 20 6c + 65 61 76 65 73 20 74 68 65 20 69 6e 70 75 74 20 + 70 6f 69 6e 74 69 6e 67 20 61 74 0a + + ~ "~ the body of the comment and returns a value indicating" + ~ " what type of comment" + 7e 20 74 68 65 20 62 6f 64 79 20 6f 66 20 74 68 + 65 20 63 6f 6d 6d 65 6e 74 20 61 6e 64 20 72 65 + 74 75 72 6e 73 20 61 20 76 61 6c 75 65 20 69 6e + 64 69 63 61 74 69 6e 67 20 77 68 61 74 20 74 79 + 70 65 20 6f 66 20 63 6f 6d 6d 65 6e 74 0a + + ~ "~ this is. A result code of 0 indicates it's a regular" + ~ " comment and the input" + 7e 20 74 68 69 73 20 69 73 2e 20 41 20 72 65 73 + 75 6c 74 20 63 6f 64 65 20 6f 66 20 30 20 69 6e + 64 69 63 61 74 65 73 20 69 74 27 73 20 61 20 72 + 65 67 75 6c 61 72 20 63 6f 6d 6d 65 6e 74 20 61 + 6e 64 20 74 68 65 20 69 6e 70 75 74 0a + + ~ "~ now points immediately after its ending delimiter; that" + ~ " is, to the start of" + 7e 20 6e 6f 77 20 70 6f 69 6e 74 73 20 69 6d 6d + 65 64 69 61 74 65 6c 79 20 61 66 74 65 72 20 69 + 74 73 20 65 6e 64 69 6e 67 20 64 65 6c 69 6d 69 + 74 65 72 3b 20 74 68 61 74 20 69 73 2c 20 74 6f + 20 74 68 65 20 73 74 61 72 74 20 6f 66 0a + + ~ "~ the next line of text. A value of 1 indicates it's a" + ~ " magic comment with" + 7e 20 74 68 65 20 6e 65 78 74 20 6c 69 6e 65 20 + 6f 66 20 74 65 78 74 2e 20 41 20 76 61 6c 75 65 + 20 6f 66 20 31 20 69 6e 64 69 63 61 74 65 73 20 + 69 74 27 73 20 61 20 6d 61 67 69 63 20 63 6f 6d + 6d 65 6e 74 20 77 69 74 68 0a + + ~ "~ non-zero length and the input points immediately after" + ~ " the delimiter. A" + 7e 20 6e 6f 6e 2d 7a 65 72 6f 20 6c 65 6e 67 74 + 68 20 61 6e 64 20 74 68 65 20 69 6e 70 75 74 20 + 70 6f 69 6e 74 73 20 69 6d 6d 65 64 69 61 74 65 + 6c 79 20 61 66 74 65 72 20 74 68 65 20 64 65 6c + 69 6d 69 74 65 72 2e 20 41 0a + + ~ "~ value of 2 indicates it's a magic comment with zero" + ~ " length, and the input" + 7e 20 76 61 6c 75 65 20 6f 66 20 32 20 69 6e 64 + 69 63 61 74 65 73 20 69 74 27 73 20 61 20 6d 61 + 67 69 63 20 63 6f 6d 6d 65 6e 74 20 77 69 74 68 + 20 7a 65 72 6f 20 6c 65 6e 67 74 68 2c 20 61 6e + 64 20 74 68 65 20 69 6e 70 75 74 0a + + ~ "~ again points to the start of the next line." + 7e 20 61 67 61 69 6e 20 70 6f 69 6e 74 73 20 74 + 6f 20 74 68 65 20 73 74 61 72 74 20 6f 66 20 74 + 68 65 20 6e 65 78 74 20 6c 69 6e 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Our caller will want to do things with the comment" + ~ " body, so we also return" + 7e 20 20 20 4f 75 72 20 63 61 6c 6c 65 72 20 77 + 69 6c 6c 20 77 61 6e 74 20 74 6f 20 64 6f 20 74 + 68 69 6e 67 73 20 77 69 74 68 20 74 68 65 20 63 + 6f 6d 6d 65 6e 74 20 62 6f 64 79 2c 20 73 6f 20 + 77 65 20 61 6c 73 6f 20 72 65 74 75 72 6e 0a + + ~ "~ a pointer to a string in temporary storage, for use in" + ~ " further processing." + 7e 20 61 20 70 6f 69 6e 74 65 72 20 74 6f 20 61 + 20 73 74 72 69 6e 67 20 69 6e 20 74 65 6d 70 6f + 72 61 72 79 20 73 74 6f 72 61 67 65 2c 20 66 6f + 72 20 75 73 65 20 69 6e 20 66 75 72 74 68 65 72 + 20 70 72 6f 63 65 73 73 69 6e 67 2e 0a + + ~ "~ This temporary storage is taken from the "real" log," + ~ " outside the transform's" + 7e 20 54 68 69 73 20 74 65 6d 70 6f 72 61 72 79 + 20 73 74 6f 72 61 67 65 20 69 73 20 74 61 6b 65 + 6e 20 66 72 6f 6d 20 74 68 65 20 22 72 65 61 6c + 22 20 6c 6f 67 2c 20 6f 75 74 73 69 64 65 20 74 + 68 65 20 74 72 61 6e 73 66 6f 72 6d 27 73 0a + + ~ "~ scope. It's not allocated, merely using the space right" + ~ " after "here"," + 7e 20 73 63 6f 70 65 2e 20 49 74 27 73 20 6e 6f + 74 20 61 6c 6c 6f 63 61 74 65 64 2c 20 6d 65 72 + 65 6c 79 20 75 73 69 6e 67 20 74 68 65 20 73 70 + 61 63 65 20 72 69 67 68 74 20 61 66 74 65 72 20 + 22 68 65 72 65 22 2c 0a + + ~ "~ because the caller may or may not wish to allocate it for" + ~ " the long term, and" + 7e 20 62 65 63 61 75 73 65 20 74 68 65 20 63 61 + 6c 6c 65 72 20 6d 61 79 20 6f 72 20 6d 61 79 20 + 6e 6f 74 20 77 69 73 68 20 74 6f 20 61 6c 6c 6f + 63 61 74 65 20 69 74 20 66 6f 72 20 74 68 65 20 + 6c 6f 6e 67 20 74 65 72 6d 2c 20 61 6e 64 0a + + ~ "~ may prefer that its long-term location be elsewhere." + 7e 20 6d 61 79 20 70 72 65 66 65 72 20 74 68 61 + 74 20 69 74 73 20 6c 6f 6e 67 2d 74 65 72 6d 20 + 6c 6f 63 61 74 69 6f 6e 20 62 65 20 65 6c 73 65 + 77 68 65 72 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Some of the various magic-comment syntaxes care about" + ~ " spacing within the" + 7e 20 20 20 53 6f 6d 65 20 6f 66 20 74 68 65 20 + 76 61 72 69 6f 75 73 20 6d 61 67 69 63 2d 63 6f + 6d 6d 65 6e 74 20 73 79 6e 74 61 78 65 73 20 63 + 61 72 65 20 61 62 6f 75 74 20 73 70 61 63 69 6e + 67 20 77 69 74 68 69 6e 20 74 68 65 0a + + ~ "~ comment body, so it's important to notice that only the" + ~ " first space after" + 7e 20 63 6f 6d 6d 65 6e 74 20 62 6f 64 79 2c 20 + 73 6f 20 69 74 27 73 20 69 6d 70 6f 72 74 61 6e + 74 20 74 6f 20 6e 6f 74 69 63 65 20 74 68 61 74 + 20 6f 6e 6c 79 20 74 68 65 20 66 69 72 73 74 20 + 73 70 61 63 65 20 61 66 74 65 72 0a + + ~ "~ the colon is consumed. Any subsequent spaces are part of" + ~ " the body." + 7e 20 74 68 65 20 63 6f 6c 6f 6e 20 69 73 20 63 + 6f 6e 73 75 6d 65 64 2e 20 41 6e 79 20 73 75 62 + 73 65 71 75 65 6e 74 20 73 70 61 63 65 73 20 61 + 72 65 20 70 61 72 74 20 6f 66 20 74 68 65 20 62 + 6f 64 79 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (-- body string pointer, result code)" + 7e 20 28 2d 2d 20 62 6f 64 79 20 73 74 72 69 6e + 67 20 70 6f 69 6e 74 65 72 2c 20 72 65 73 75 6c + 74 20 63 6f 64 65 29 0a + + ~ ": hex-read-magic-comment-introducer" + 3a 20 68 65 78 2d 72 65 61 64 2d 6d 61 67 69 63 + 2d 63 6f 6d 6d 65 6e 74 2d 69 6e 74 72 6f 64 75 + 63 65 72 0a + + ~ " ~ The original code goes byte-by-byte, checks that the" + ~ " value is nonzero" + 20 20 7e 20 20 20 54 68 65 20 6f 72 69 67 69 6e + 61 6c 20 63 6f 64 65 20 67 6f 65 73 20 62 79 74 + 65 2d 62 79 2d 62 79 74 65 2c 20 63 68 65 63 6b + 73 20 74 68 61 74 20 74 68 65 20 76 61 6c 75 65 + 20 69 73 20 6e 6f 6e 7a 65 72 6f 0a + + ~ " ~ and not equal to 0x0a (linefeed), and exits when either" + ~ " property fails." + 20 20 7e 20 61 6e 64 20 6e 6f 74 20 65 71 75 61 + 6c 20 74 6f 20 30 78 30 61 20 28 6c 69 6e 65 66 + 65 65 64 29 2c 20 61 6e 64 20 65 78 69 74 73 20 + 77 68 65 6e 20 65 69 74 68 65 72 20 70 72 6f 70 + 65 72 74 79 20 66 61 69 6c 73 2e 0a + + ~ " ~ We want to do something different based on the very" + ~ " first characters of" + 20 20 7e 20 57 65 20 77 61 6e 74 20 74 6f 20 64 + 6f 20 73 6f 6d 65 74 68 69 6e 67 20 64 69 66 66 + 65 72 65 6e 74 20 62 61 73 65 64 20 6f 6e 20 74 + 68 65 20 76 65 72 79 20 66 69 72 73 74 20 63 68 + 61 72 61 63 74 65 72 73 20 6f 66 0a + + ~ " ~ the comment body. So, we unroll the first few" + ~ " iterations of the loop so we" + 20 20 7e 20 74 68 65 20 63 6f 6d 6d 65 6e 74 20 + 62 6f 64 79 2e 20 53 6f 2c 20 77 65 20 75 6e 72 + 6f 6c 6c 20 74 68 65 20 66 69 72 73 74 20 66 65 + 77 20 69 74 65 72 61 74 69 6f 6e 73 20 6f 66 20 + 74 68 65 20 6c 6f 6f 70 20 73 6f 20 77 65 0a + + ~ " ~ can do that test before we fall back to the normal" + ~ " behavior." + 20 20 7e 20 63 61 6e 20 64 6f 20 74 68 61 74 20 + 74 65 73 74 20 62 65 66 6f 72 65 20 77 65 20 66 + 61 6c 6c 20 62 61 63 6b 20 74 6f 20 74 68 65 20 + 6e 6f 72 6d 61 6c 20 62 65 68 61 76 69 6f 72 2e + 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ Specifically, we want to recognize a colon (0x3a)" + ~ " with a space (0x20)" + 20 20 7e 20 20 20 53 70 65 63 69 66 69 63 61 6c + 6c 79 2c 20 77 65 20 77 61 6e 74 20 74 6f 20 72 + 65 63 6f 67 6e 69 7a 65 20 61 20 63 6f 6c 6f 6e + 20 28 30 78 33 61 29 20 77 69 74 68 20 61 20 73 + 70 61 63 65 20 28 30 78 32 30 29 0a + + ~ " ~ immediately after it. Since the interpeter peeked at" + ~ " the space delimiter," + 20 20 7e 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 + 61 66 74 65 72 20 69 74 2e 20 53 69 6e 63 65 20 + 74 68 65 20 69 6e 74 65 72 70 65 74 65 72 20 70 + 65 65 6b 65 64 20 61 74 20 74 68 65 20 73 70 61 + 63 65 20 64 65 6c 69 6d 69 74 65 72 2c 0a + + ~ " ~ but didn't consume it, we also need to check for a" + ~ " space before the colon," + 20 20 7e 20 62 75 74 20 64 69 64 6e 27 74 20 63 + 6f 6e 73 75 6d 65 20 69 74 2c 20 77 65 20 61 6c + 73 6f 20 6e 65 65 64 20 74 6f 20 63 68 65 63 6b + 20 66 6f 72 20 61 20 73 70 61 63 65 20 62 65 66 + 6f 72 65 20 74 68 65 20 63 6f 6c 6f 6e 2c 0a + + ~ " ~ for a total sequence of three bytes we need to match." + ~ " We can't just skip" + 20 20 7e 20 66 6f 72 20 61 20 74 6f 74 61 6c 20 + 73 65 71 75 65 6e 63 65 20 6f 66 20 74 68 72 65 + 65 20 62 79 74 65 73 20 77 65 20 6e 65 65 64 20 + 74 6f 20 6d 61 74 63 68 2e 20 57 65 20 63 61 6e + 27 74 20 6a 75 73 74 20 73 6b 69 70 0a + + ~ " ~ over the space with "consume", because it might also be" + ~ " a linefeed, which" + 20 20 7e 20 6f 76 65 72 20 74 68 65 20 73 70 61 + 63 65 20 77 69 74 68 20 22 63 6f 6e 73 75 6d 65 + 22 2c 20 62 65 63 61 75 73 65 20 69 74 20 6d 69 + 67 68 74 20 61 6c 73 6f 20 62 65 20 61 20 6c 69 + 6e 65 66 65 65 64 2c 20 77 68 69 63 68 0a + + ~ " ~ would satisfy the exit criterion. We need to properly" + ~ " match it." + 20 20 7e 20 77 6f 75 6c 64 20 73 61 74 69 73 66 + 79 20 74 68 65 20 65 78 69 74 20 63 72 69 74 65 + 72 69 6f 6e 2e 20 57 65 20 6e 65 65 64 20 74 6f + 20 70 72 6f 70 65 72 6c 79 20 6d 61 74 63 68 20 + 69 74 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ We also recognize a colon followed immediately by a" + ~ " linefeed, as" + 20 20 7e 20 20 20 57 65 20 61 6c 73 6f 20 72 65 + 63 6f 67 6e 69 7a 65 20 61 20 63 6f 6c 6f 6e 20 + 66 6f 6c 6c 6f 77 65 64 20 69 6d 6d 65 64 69 61 + 74 65 6c 79 20 62 79 20 61 20 6c 69 6e 65 66 65 + 65 64 2c 20 61 73 0a + + ~ " ~ denoting an empty comment." + 20 20 7e 20 64 65 6e 6f 74 69 6e 67 20 61 6e 20 + 65 6d 70 74 79 20 63 6f 6d 6d 65 6e 74 2e 0a + + ~ " key dup dup 0x0a != && {" + 20 20 6b 65 79 20 64 75 70 20 64 75 70 20 30 78 + 30 61 20 21 3d 20 26 26 20 7b 0a + + ~ " ~ If we got here, the first byte was not 0 or 0x0a. Now" + ~ " we check if it's" + 20 20 20 20 7e 20 49 66 20 77 65 20 67 6f 74 20 + 68 65 72 65 2c 20 74 68 65 20 66 69 72 73 74 20 + 62 79 74 65 20 77 61 73 20 6e 6f 74 20 30 20 6f + 72 20 30 78 30 61 2e 20 4e 6f 77 20 77 65 20 63 + 68 65 63 6b 20 69 66 20 69 74 27 73 0a + + ~ " ~ colon." + 20 20 20 20 7e 20 63 6f 6c 6f 6e 2e 0a + + ~ " 0x20 = {" + 20 20 20 20 30 78 32 30 20 3d 20 7b 0a + + ~ " ~ The first byte was 0x20. Now check the second." + 20 20 20 20 20 20 7e 20 54 68 65 20 66 69 72 73 + 74 20 62 79 74 65 20 77 61 73 20 30 78 32 30 2e + 20 4e 6f 77 20 63 68 65 63 6b 20 74 68 65 20 73 + 65 63 6f 6e 64 2e 0a + + ~ " key dup dup 0x0a != && {" + 20 20 20 20 20 20 6b 65 79 20 64 75 70 20 64 75 + 70 20 30 78 30 61 20 21 3d 20 26 26 20 7b 0a + + ~ " dup 0x3a = {" + 20 20 20 20 20 20 20 20 64 75 70 20 30 78 33 61 + 20 3d 20 7b 0a + + ~ " ~ The second byte was 0x3a. Now check the third." + 20 20 20 20 20 20 20 20 20 20 7e 20 54 68 65 20 + 73 65 63 6f 6e 64 20 62 79 74 65 20 77 61 73 20 + 30 78 33 61 2e 20 4e 6f 77 20 63 68 65 63 6b 20 + 74 68 65 20 74 68 69 72 64 2e 0a + + ~ " drop key dup {" + 20 20 20 20 20 20 20 20 20 20 64 72 6f 70 20 6b + 65 79 20 64 75 70 20 7b 0a + + ~ " ~ The third byte is not 0." + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 54 68 + 65 20 74 68 69 72 64 20 62 79 74 65 20 69 73 20 + 6e 6f 74 20 30 2e 0a + + ~ " dup 0x20 = {" + 20 20 20 20 20 20 20 20 20 20 20 20 64 75 70 20 + 30 78 32 30 20 3d 20 7b 0a + + ~ " ~ We have a magic comment with a nonempty" + ~ " body. We must save" + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 + 20 20 57 65 20 68 61 76 65 20 61 20 6d 61 67 69 + 63 20 63 6f 6d 6d 65 6e 74 20 77 69 74 68 20 61 + 20 6e 6f 6e 65 6d 70 74 79 20 62 6f 64 79 2e 20 + 57 65 20 6d 75 73 74 20 73 61 76 65 0a + + ~ " ~ the rest of it so we can return it." + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 + 74 68 65 20 72 65 73 74 20 6f 66 20 69 74 20 73 + 6f 20 77 65 20 63 61 6e 20 72 65 74 75 72 6e 20 + 69 74 2e 0a + + ~ " drop key hex-read-nonempty-comment-body 1" + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 72 + 6f 70 20 6b 65 79 20 68 65 78 2d 72 65 61 64 2d + 6e 6f 6e 65 6d 70 74 79 2d 63 6f 6d 6d 65 6e 74 + 2d 62 6f 64 79 20 31 0a + + ~ " } {" + 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 7b 0a + + ~ " ~ The third byte is not 0 or 0x20." + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 + 20 20 54 68 65 20 74 68 69 72 64 20 62 79 74 65 + 20 69 73 20 6e 6f 74 20 30 20 6f 72 20 30 78 32 + 30 2e 0a + + ~ " dup 0x0a = {" + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 64 75 + 70 20 30 78 30 61 20 3d 20 7b 0a + + ~ " ~ We have a magic comment with an empty" + ~ " body, ending at a" + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 7e 20 20 20 57 65 20 68 61 76 65 20 61 20 6d 61 + 67 69 63 20 63 6f 6d 6d 65 6e 74 20 77 69 74 68 + 20 61 6e 20 65 6d 70 74 79 20 62 6f 64 79 2c 20 + 65 6e 64 69 6e 67 20 61 74 20 61 0a + + ~ " ~ linefeed. As with nonempty ones, we" + ~ " prepare a temporary" + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 7e 20 6c 69 6e 65 66 65 65 64 2e 20 41 73 20 77 + 69 74 68 20 6e 6f 6e 65 6d 70 74 79 20 6f 6e 65 + 73 2c 20 77 65 20 70 72 65 70 61 72 65 20 61 20 + 74 65 6d 70 6f 72 61 72 79 0a + + ~ " ~ string to return." + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 7e 20 73 74 72 69 6e 67 20 74 6f 20 72 65 74 75 + 72 6e 2e 0a + + ~ " drop hex-read-empty-comment-body 2" + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 64 72 6f 70 20 68 65 78 2d 72 65 61 64 2d 65 6d + 70 74 79 2d 63 6f 6d 6d 65 6e 74 2d 62 6f 64 79 + 20 32 0a + + ~ " } {" + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 + 7b 0a + + ~ " ~ The third byte was not 0, 0x0a, or" + ~ " 0x20. We got a space," + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 7e 20 20 20 54 68 65 20 74 68 69 72 64 20 62 79 + 74 65 20 77 61 73 20 6e 6f 74 20 30 2c 20 30 78 + 30 61 2c 20 6f 72 20 30 78 32 30 2e 20 57 65 20 + 67 6f 74 20 61 20 73 70 61 63 65 2c 0a + + ~ " ~ a colon, and something else. So our" + ~ " special test failed, but" + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 7e 20 61 20 63 6f 6c 6f 6e 2c 20 61 6e 64 20 73 + 6f 6d 65 74 68 69 6e 67 20 65 6c 73 65 2e 20 53 + 6f 20 6f 75 72 20 73 70 65 63 69 61 6c 20 74 65 + 73 74 20 66 61 69 6c 65 64 2c 20 62 75 74 0a + + ~ " ~ the exit condition isn't met. So we're" + ~ " done unrolling." + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 7e 20 74 68 65 20 65 78 69 74 20 63 6f 6e 64 69 + 74 69 6f 6e 20 69 73 6e 27 74 20 6d 65 74 2e 20 + 53 6f 20 77 65 27 72 65 20 64 6f 6e 65 20 75 6e + 72 6f 6c 6c 69 6e 67 2e 0a + + ~ " hex-read-nonempty-comment-body 0" + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 68 65 78 2d 72 65 61 64 2d 6e 6f 6e 65 6d 70 74 + 79 2d 63 6f 6d 6d 65 6e 74 2d 62 6f 64 79 20 30 + 0a + + ~ " } if-else" + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 + 69 66 2d 65 6c 73 65 0a + + ~ " } if-else" + 20 20 20 20 20 20 20 20 20 20 20 20 7d 20 69 66 + 2d 65 6c 73 65 0a + + ~ " } {" + 20 20 20 20 20 20 20 20 20 20 7d 20 7b 0a + + ~ " ~ We got a colon and a zero. This is a magic" + ~ " comment with an" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 20 20 + 57 65 20 67 6f 74 20 61 20 63 6f 6c 6f 6e 20 61 + 6e 64 20 61 20 7a 65 72 6f 2e 20 54 68 69 73 20 + 69 73 20 61 20 6d 61 67 69 63 20 63 6f 6d 6d 65 + 6e 74 20 77 69 74 68 20 61 6e 0a + + ~ " ~ empty body, ending at the end of the file." + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 65 6d + 70 74 79 20 62 6f 64 79 2c 20 65 6e 64 69 6e 67 + 20 61 74 20 74 68 65 20 65 6e 64 20 6f 66 20 74 + 68 65 20 66 69 6c 65 2e 0a + + ~ " drop hex-read-empty-comment-body 2" + 20 20 20 20 20 20 20 20 20 20 20 20 64 72 6f 70 + 20 68 65 78 2d 72 65 61 64 2d 65 6d 70 74 79 2d + 63 6f 6d 6d 65 6e 74 2d 62 6f 64 79 20 32 0a + + ~ " } if-else" + 20 20 20 20 20 20 20 20 20 20 7d 20 69 66 2d 65 + 6c 73 65 0a + + ~ " } {" + 20 20 20 20 20 20 20 20 7d 20 7b 0a + + ~ " ~ Again, the special test failed but the exit" + ~ " condition isn't met." + 20 20 20 20 20 20 20 20 20 20 7e 20 41 67 61 69 + 6e 2c 20 74 68 65 20 73 70 65 63 69 61 6c 20 74 + 65 73 74 20 66 61 69 6c 65 64 20 62 75 74 20 74 + 68 65 20 65 78 69 74 20 63 6f 6e 64 69 74 69 6f + 6e 20 69 73 6e 27 74 20 6d 65 74 2e 0a + + ~ " hex-read-nonempty-comment-body 0" + 20 20 20 20 20 20 20 20 20 20 68 65 78 2d 72 65 + 61 64 2d 6e 6f 6e 65 6d 70 74 79 2d 63 6f 6d 6d + 65 6e 74 2d 62 6f 64 79 20 30 0a + + ~ " } if-else" + 20 20 20 20 20 20 20 20 7d 20 69 66 2d 65 6c 73 + 65 0a + + ~ " } {" + 20 20 20 20 20 20 7d 20 7b 0a + + ~ " ~ Again, the exit condition is met." + 20 20 20 20 20 20 20 20 7e 20 41 67 61 69 6e 2c + 20 74 68 65 20 65 78 69 74 20 63 6f 6e 64 69 74 + 69 6f 6e 20 69 73 20 6d 65 74 2e 0a + + ~ " drop hex-read-empty-comment-body 0" + 20 20 20 20 20 20 20 20 64 72 6f 70 20 68 65 78 + 2d 72 65 61 64 2d 65 6d 70 74 79 2d 63 6f 6d 6d + 65 6e 74 2d 62 6f 64 79 20 30 0a + + ~ " } if-else" + 20 20 20 20 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " } {" + 20 20 20 20 7d 20 7b 0a + + ~ " ~ Once more, the special test failed but the exit" + ~ " condition isn't met." + 20 20 20 20 20 20 7e 20 4f 6e 63 65 20 6d 6f 72 + 65 2c 20 74 68 65 20 73 70 65 63 69 61 6c 20 74 + 65 73 74 20 66 61 69 6c 65 64 20 62 75 74 20 74 + 68 65 20 65 78 69 74 20 63 6f 6e 64 69 74 69 6f + 6e 20 69 73 6e 27 74 20 6d 65 74 2e 0a + + ~ " hex-read-nonempty-comment-body 0" + 20 20 20 20 20 20 68 65 78 2d 72 65 61 64 2d 6e + 6f 6e 65 6d 70 74 79 2d 63 6f 6d 6d 65 6e 74 2d + 62 6f 64 79 20 30 0a + + ~ " } if-else" + 20 20 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " ~ For the last time, the exit condition is met." + 20 20 20 20 7e 20 46 6f 72 20 74 68 65 20 6c 61 + 73 74 20 74 69 6d 65 2c 20 74 68 65 20 65 78 69 + 74 20 63 6f 6e 64 69 74 69 6f 6e 20 69 73 20 6d + 65 74 2e 0a + + ~ " drop hex-read-empty-comment-body 0" + 20 20 20 20 64 72 6f 70 20 68 65 78 2d 72 65 61 + 64 2d 65 6d 70 74 79 2d 63 6f 6d 6d 65 6e 74 2d + 62 6f 64 79 20 30 0a + + ~ " } if-else ;" + 20 20 7d 20 69 66 2d 65 6c 73 65 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ The tilde alternate is a very important word for the" + ~ " hex transform; it has" + 7e 20 20 20 54 68 65 20 74 69 6c 64 65 20 61 6c + 74 65 72 6e 61 74 65 20 69 73 20 61 20 76 65 72 + 79 20 69 6d 70 6f 72 74 61 6e 74 20 77 6f 72 64 + 20 66 6f 72 20 74 68 65 20 68 65 78 20 74 72 61 + 6e 73 66 6f 72 6d 3b 20 69 74 20 68 61 73 0a + + ~ "~ the task of hooking comment processing to detect a" + ~ " special comment syntax" + 7e 20 74 68 65 20 74 61 73 6b 20 6f 66 20 68 6f + 6f 6b 69 6e 67 20 63 6f 6d 6d 65 6e 74 20 70 72 + 6f 63 65 73 73 69 6e 67 20 74 6f 20 64 65 74 65 + 63 74 20 61 20 73 70 65 63 69 61 6c 20 63 6f 6d + 6d 65 6e 74 20 73 79 6e 74 61 78 0a + + ~ "~ which can be used by words that generate binary output," + ~ " to define comments" + 7e 20 77 68 69 63 68 20 63 61 6e 20 62 65 20 75 + 73 65 64 20 62 79 20 77 6f 72 64 73 20 74 68 61 + 74 20 67 65 6e 65 72 61 74 65 20 62 69 6e 61 72 + 79 20 6f 75 74 70 75 74 2c 20 74 6f 20 64 65 66 + 69 6e 65 20 63 6f 6d 6d 65 6e 74 73 0a + + ~ "~ which will appear as part of the hex-dump version of that" + ~ " output, but which" + 7e 20 77 68 69 63 68 20 77 69 6c 6c 20 61 70 70 + 65 61 72 20 61 73 20 70 61 72 74 20 6f 66 20 74 + 68 65 20 68 65 78 2d 64 75 6d 70 20 76 65 72 73 + 69 6f 6e 20 6f 66 20 74 68 61 74 20 6f 75 74 70 + 75 74 2c 20 62 75 74 20 77 68 69 63 68 0a + + ~ "~ will be ignored in normal execution." + 7e 20 77 69 6c 6c 20 62 65 20 69 67 6e 6f 72 65 + 64 20 69 6e 20 6e 6f 72 6d 61 6c 20 65 78 65 63 + 75 74 69 6f 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ This mechanism allows us, for example, to avoid putting" + ~ " detailed knowledge" + 7e 20 20 20 54 68 69 73 20 6d 65 63 68 61 6e 69 + 73 6d 20 61 6c 6c 6f 77 73 20 75 73 2c 20 66 6f + 72 20 65 78 61 6d 70 6c 65 2c 20 74 6f 20 61 76 + 6f 69 64 20 70 75 74 74 69 6e 67 20 64 65 74 61 + 69 6c 65 64 20 6b 6e 6f 77 6c 65 64 67 65 0a + + ~ "~ of the amd64 Evocation-assembly instructions in the hex" + ~ " transform; instead" + 7e 20 6f 66 20 74 68 65 20 61 6d 64 36 34 20 45 + 76 6f 63 61 74 69 6f 6e 2d 61 73 73 65 6d 62 6c + 79 20 69 6e 73 74 72 75 63 74 69 6f 6e 73 20 69 + 6e 20 74 68 65 20 68 65 78 20 74 72 61 6e 73 66 + 6f 72 6d 3b 20 69 6e 73 74 65 61 64 0a + + ~ "~ all the details are kept in one place, the authoritative" + ~ " implementations of" + 7e 20 61 6c 6c 20 74 68 65 20 64 65 74 61 69 6c + 73 20 61 72 65 20 6b 65 70 74 20 69 6e 20 6f 6e + 65 20 70 6c 61 63 65 2c 20 74 68 65 20 61 75 74 + 68 6f 72 69 74 61 74 69 76 65 20 69 6d 70 6c 65 + 6d 65 6e 74 61 74 69 6f 6e 73 20 6f 66 0a + + ~ "~ those instructions. This will substantially improve the" + ~ " maintainability of" + 7e 20 74 68 6f 73 65 20 69 6e 73 74 72 75 63 74 + 69 6f 6e 73 2e 20 54 68 69 73 20 77 69 6c 6c 20 + 73 75 62 73 74 61 6e 74 69 61 6c 6c 79 20 69 6d + 70 72 6f 76 65 20 74 68 65 20 6d 61 69 6e 74 61 + 69 6e 61 62 69 6c 69 74 79 20 6f 66 0a + + ~ "~ the code, especially when adding new architectures." + 7e 20 74 68 65 20 63 6f 64 65 2c 20 65 73 70 65 + 63 69 61 6c 6c 79 20 77 68 65 6e 20 61 64 64 69 + 6e 67 20 6e 65 77 20 61 72 63 68 69 74 65 63 74 + 75 72 65 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ This word hex-tilde-alternate only applies to code that" + ~ " is running" + 7e 20 20 20 54 68 69 73 20 77 6f 72 64 20 68 65 + 78 2d 74 69 6c 64 65 2d 61 6c 74 65 72 6e 61 74 + 65 20 6f 6e 6c 79 20 61 70 70 6c 69 65 73 20 74 + 6f 20 63 6f 64 65 20 74 68 61 74 20 69 73 20 72 + 75 6e 6e 69 6e 67 0a + + ~ "~ directly within the hex transform. When an inner" + ~ " transform runs within the" + 7e 20 64 69 72 65 63 74 6c 79 20 77 69 74 68 69 + 6e 20 74 68 65 20 68 65 78 20 74 72 61 6e 73 66 + 6f 72 6d 2e 20 57 68 65 6e 20 61 6e 20 69 6e 6e + 65 72 20 74 72 61 6e 73 66 6f 72 6d 20 72 75 6e + 73 20 77 69 74 68 69 6e 20 74 68 65 0a + + ~ "~ hex transform, the inner transform is responsible for" + ~ " lexical processing, so" + 7e 20 68 65 78 20 74 72 61 6e 73 66 6f 72 6d 2c + 20 74 68 65 20 69 6e 6e 65 72 20 74 72 61 6e 73 + 66 6f 72 6d 20 69 73 20 72 65 73 70 6f 6e 73 69 + 62 6c 65 20 66 6f 72 20 6c 65 78 69 63 61 6c 20 + 70 72 6f 63 65 73 73 69 6e 67 2c 20 73 6f 0a + + ~ "~ this word never gets invoked. There is an additional" + ~ " variant word" + 7e 20 74 68 69 73 20 77 6f 72 64 20 6e 65 76 65 + 72 20 67 65 74 73 20 69 6e 76 6f 6b 65 64 2e 20 + 54 68 65 72 65 20 69 73 20 61 6e 20 61 64 64 69 + 74 69 6f 6e 61 6c 20 76 61 72 69 61 6e 74 20 77 + 6f 72 64 0a + + ~ "~ hex-*-tilde-alternate for each inner transform that the" + ~ " hex transform" + 7e 20 68 65 78 2d 2a 2d 74 69 6c 64 65 2d 61 6c + 74 65 72 6e 61 74 65 20 66 6f 72 20 65 61 63 68 + 20 69 6e 6e 65 72 20 74 72 61 6e 73 66 6f 72 6d + 20 74 68 61 74 20 74 68 65 20 68 65 78 20 74 72 + 61 6e 73 66 6f 72 6d 0a + + ~ "~ supports, responsible for conducting the analogous task" + ~ " within the rules of" + 7e 20 73 75 70 70 6f 72 74 73 2c 20 72 65 73 70 + 6f 6e 73 69 62 6c 65 20 66 6f 72 20 63 6f 6e 64 + 75 63 74 69 6e 67 20 74 68 65 20 61 6e 61 6c 6f + 67 6f 75 73 20 74 61 73 6b 20 77 69 74 68 69 6e + 20 74 68 65 20 72 75 6c 65 73 20 6f 66 0a + + ~ "~ that inner transform." + 7e 20 74 68 61 74 20 69 6e 6e 65 72 20 74 72 61 + 6e 73 66 6f 72 6d 2e 0a + + ~ ": hex-tilde-alternate" + 3a 20 68 65 78 2d 74 69 6c 64 65 2d 61 6c 74 65 + 72 6e 61 74 65 0a + + ~ " ~ The original tilde is already an immediate word, so" + ~ " we can take over" + 20 20 7e 20 20 20 54 68 65 20 6f 72 69 67 69 6e + 61 6c 20 74 69 6c 64 65 20 69 73 20 61 6c 72 65 + 61 64 79 20 61 6e 20 69 6d 6d 65 64 69 61 74 65 + 20 77 6f 72 64 2c 20 73 6f 20 77 65 20 63 61 6e + 20 74 61 6b 65 20 6f 76 65 72 0a + + ~ " ~ those responsibilities directly without needing to do" + ~ " any extra work to" + 20 20 7e 20 74 68 6f 73 65 20 72 65 73 70 6f 6e + 73 69 62 69 6c 69 74 69 65 73 20 64 69 72 65 63 + 74 6c 79 20 77 69 74 68 6f 75 74 20 6e 65 65 64 + 69 6e 67 20 74 6f 20 64 6f 20 61 6e 79 20 65 78 + 74 72 61 20 77 6f 72 6b 20 74 6f 0a + + ~ " ~ check the mode we're in or anything like that." + 20 20 7e 20 63 68 65 63 6b 20 74 68 65 20 6d 6f + 64 65 20 77 65 27 72 65 20 69 6e 20 6f 72 20 61 + 6e 79 74 68 69 6e 67 20 6c 69 6b 65 20 74 68 61 + 74 2e 0a + + ~ " hex-read-magic-comment-introducer" + 20 20 68 65 78 2d 72 65 61 64 2d 6d 61 67 69 63 + 2d 63 6f 6d 6d 65 6e 74 2d 69 6e 74 72 6f 64 75 + 63 65 72 0a + + ~ " ~ (body string pointer, result code)" + 20 20 7e 20 28 62 6f 64 79 20 73 74 72 69 6e 67 + 20 70 6f 69 6e 74 65 72 2c 20 72 65 73 75 6c 74 + 20 63 6f 64 65 29 0a + + ~ "" + 0a + + ~ " {" + 20 20 7b 0a + + ~ " ~ It's a magic comment, which may or may not be" + ~ " empty. We want to either" + 20 20 20 20 7e 20 20 20 49 74 27 73 20 61 20 6d + 61 67 69 63 20 63 6f 6d 6d 65 6e 74 2c 20 77 68 + 69 63 68 20 6d 61 79 20 6f 72 20 6d 61 79 20 6e + 6f 74 20 62 65 20 65 6d 70 74 79 2e 20 57 65 20 + 77 61 6e 74 20 74 6f 20 65 69 74 68 65 72 0a + + ~ " ~ compile or execute a call to hex-tilde-replacement." + 20 20 20 20 7e 20 63 6f 6d 70 69 6c 65 20 6f 72 + 20 65 78 65 63 75 74 65 20 61 20 63 61 6c 6c 20 + 74 6f 20 68 65 78 2d 74 69 6c 64 65 2d 72 65 70 + 6c 61 63 65 6d 65 6e 74 2e 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d + 66 6c 61 67 73 20 40 20 30 78 30 31 20 26 20 7b + 0a + + ~ " ~ We're in compile mode." + 20 20 20 20 20 20 7e 20 20 20 57 65 27 72 65 20 + 69 6e 20 63 6f 6d 70 69 6c 65 20 6d 6f 64 65 2e + 0a + + ~ " ~" + 20 20 20 20 20 20 7e 0a + + ~ " ~ Fortunately, we can pack the string directly into" + ~ " the output buffer," + 20 20 20 20 20 20 7e 20 20 20 46 6f 72 74 75 6e + 61 74 65 6c 79 2c 20 77 65 20 63 61 6e 20 70 61 + 63 6b 20 74 68 65 20 73 74 72 69 6e 67 20 64 69 + 72 65 63 74 6c 79 20 69 6e 74 6f 20 74 68 65 20 + 6f 75 74 70 75 74 20 62 75 66 66 65 72 2c 0a + + ~ " ~ so we don't need to mess around with" + ~ " accumulate-string." + 20 20 20 20 20 20 7e 20 73 6f 20 77 65 20 64 6f + 6e 27 74 20 6e 65 65 64 20 74 6f 20 6d 65 73 73 + 20 61 72 6f 75 6e 64 20 77 69 74 68 20 61 63 63 + 75 6d 75 6c 61 74 65 2d 73 74 72 69 6e 67 2e 0a + + ~ " s" lit" find entry-to-execution-token ," + 20 20 20 20 20 20 73 22 20 6c 69 74 22 20 66 69 + 6e 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 + 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " has-non-space-this-input-line@ ," + 20 20 20 20 20 20 68 61 73 2d 6e 6f 6e 2d 73 70 + 61 63 65 2d 74 68 69 73 2d 69 6e 70 75 74 2d 6c + 69 6e 65 40 20 2c 0a + + ~ "" + 0a + + ~ " s" litstring" find entry-to-execution-token ," + 20 20 20 20 20 20 73 22 20 6c 69 74 73 74 72 69 + 6e 67 22 20 66 69 6e 64 20 65 6e 74 72 79 2d 74 + 6f 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 + 6e 20 2c 0a + + ~ " here @" + 20 20 20 20 20 20 68 65 72 65 20 40 0a + + ~ " swap packstring" + 20 20 20 20 20 20 73 77 61 70 20 70 61 63 6b 73 + 74 72 69 6e 67 0a + + ~ " 8 packalign" + 20 20 20 20 20 20 38 20 70 61 63 6b 61 6c 69 67 + 6e 0a + + ~ " here !" + 20 20 20 20 20 20 68 65 72 65 20 21 0a + + ~ "" + 0a + + ~ " ' hex-tilde-replacement entry-to-execution-token ," + 20 20 20 20 20 20 27 20 68 65 78 2d 74 69 6c 64 + 65 2d 72 65 70 6c 61 63 65 6d 65 6e 74 20 65 6e + 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 69 6f 6e + 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " } {" + 20 20 20 20 7d 20 7b 0a + + ~ " ~ We're in interpret mode." + 20 20 20 20 20 20 7e 20 57 65 27 72 65 20 69 6e + 20 69 6e 74 65 72 70 72 65 74 20 6d 6f 64 65 2e + 0a + + ~ " has-non-space-this-input-line@ swap" + 20 20 20 20 20 20 68 61 73 2d 6e 6f 6e 2d 73 70 + 61 63 65 2d 74 68 69 73 2d 69 6e 70 75 74 2d 6c + 69 6e 65 40 20 73 77 61 70 0a + + ~ " hex-tilde-replacement" + 20 20 20 20 20 20 68 65 78 2d 74 69 6c 64 65 2d + 72 65 70 6c 61 63 65 6d 65 6e 74 0a + + ~ " } if-else" + 20 20 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " ~ If it's a regular comment, we just ignore it." + 20 20 20 20 7e 20 49 66 20 69 74 27 73 20 61 20 + 72 65 67 75 6c 61 72 20 63 6f 6d 6d 65 6e 74 2c + 20 77 65 20 6a 75 73 74 20 69 67 6e 6f 72 65 20 + 69 74 2e 0a + + ~ " drop" + 20 20 20 20 64 72 6f 70 0a + + ~ " } if-else" + 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ "" + 0a + + ~ " ~ Regardless of what path we took, we just consumed a" + ~ " newline, so make" + 20 20 7e 20 20 20 52 65 67 61 72 64 6c 65 73 73 + 20 6f 66 20 77 68 61 74 20 70 61 74 68 20 77 65 + 20 74 6f 6f 6b 2c 20 77 65 20 6a 75 73 74 20 63 + 6f 6e 73 75 6d 65 64 20 61 20 6e 65 77 6c 69 6e + 65 2c 20 73 6f 20 6d 61 6b 65 0a + + ~ " ~ note of the fact." + 20 20 7e 20 6e 6f 74 65 20 6f 66 20 74 68 65 20 + 66 61 63 74 2e 0a + + ~ " 0 has-non-space-this-input-line!" + 20 20 30 20 68 61 73 2d 6e 6f 6e 2d 73 70 61 63 + 65 2d 74 68 69 73 2d 69 6e 70 75 74 2d 6c 69 6e + 65 21 0a + + ~ " ; make-immediate" + 20 20 3b 20 6d 61 6b 65 2d 69 6d 6d 65 64 69 61 + 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This word runs whenever the label transform, running" + ~ " inside the hex" + 7e 20 20 20 54 68 69 73 20 77 6f 72 64 20 72 75 + 6e 73 20 77 68 65 6e 65 76 65 72 20 74 68 65 20 + 6c 61 62 65 6c 20 74 72 61 6e 73 66 6f 72 6d 2c + 20 72 75 6e 6e 69 6e 67 20 69 6e 73 69 64 65 20 + 74 68 65 20 68 65 78 0a + + ~ "~ transform, encounters a tilde. It completely replaces the" + ~ " normal invocation" + 7e 20 74 72 61 6e 73 66 6f 72 6d 2c 20 65 6e 63 + 6f 75 6e 74 65 72 73 20 61 20 74 69 6c 64 65 2e + 20 49 74 20 63 6f 6d 70 6c 65 74 65 6c 79 20 72 + 65 70 6c 61 63 65 73 20 74 68 65 20 6e 6f 72 6d + 61 6c 20 69 6e 76 6f 63 61 74 69 6f 6e 0a + + ~ "~ of tilde, just as hex-tilde-alternate does. It has the" + ~ " same responsibilities" + 7e 20 6f 66 20 74 69 6c 64 65 2c 20 6a 75 73 74 + 20 61 73 20 68 65 78 2d 74 69 6c 64 65 2d 61 6c + 74 65 72 6e 61 74 65 20 64 6f 65 73 2e 20 49 74 + 20 68 61 73 20 74 68 65 20 73 61 6d 65 20 72 65 + 73 70 6f 6e 73 69 62 69 6c 69 74 69 65 73 0a + + ~ "~ around magic comments as hex-tilde-alternate, but for" + ~ " code which is" + 7e 20 61 72 6f 75 6e 64 20 6d 61 67 69 63 20 63 + 6f 6d 6d 65 6e 74 73 20 61 73 20 68 65 78 2d 74 + 69 6c 64 65 2d 61 6c 74 65 72 6e 61 74 65 2c 20 + 62 75 74 20 66 6f 72 20 63 6f 64 65 20 77 68 69 + 63 68 20 69 73 0a + + ~ "~ lexically processed by label-transform-one rather than by" + ~ " hex-transform-one." + 7e 20 6c 65 78 69 63 61 6c 6c 79 20 70 72 6f 63 + 65 73 73 65 64 20 62 79 20 6c 61 62 65 6c 2d 74 + 72 61 6e 73 66 6f 72 6d 2d 6f 6e 65 20 72 61 74 + 68 65 72 20 74 68 61 6e 20 62 79 20 68 65 78 2d + 74 72 61 6e 73 66 6f 72 6d 2d 6f 6e 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The actions it takes upon finding various sorts of" + ~ " comments differ from" + 7e 20 20 20 54 68 65 20 61 63 74 69 6f 6e 73 20 + 69 74 20 74 61 6b 65 73 20 75 70 6f 6e 20 66 69 + 6e 64 69 6e 67 20 76 61 72 69 6f 75 73 20 73 6f + 72 74 73 20 6f 66 20 63 6f 6d 6d 65 6e 74 73 20 + 64 69 66 66 65 72 20 66 72 6f 6d 0a + + ~ "~ hex-tilde-alternate, because the behavior of the label" + ~ " transform is" + 7e 20 68 65 78 2d 74 69 6c 64 65 2d 61 6c 74 65 + 72 6e 61 74 65 2c 20 62 65 63 61 75 73 65 20 74 + 68 65 20 62 65 68 61 76 69 6f 72 20 6f 66 20 74 + 68 65 20 6c 61 62 65 6c 20 74 72 61 6e 73 66 6f + 72 6d 20 69 73 0a + + ~ "~ different from the behavior of the hex transform." + 7e 20 64 69 66 66 65 72 65 6e 74 20 66 72 6f 6d + 20 74 68 65 20 62 65 68 61 76 69 6f 72 20 6f 66 + 20 74 68 65 20 68 65 78 20 74 72 61 6e 73 66 6f + 72 6d 2e 0a + + ~ "~" + 7e 0a + + ~ "~ This is installed by hex-label-word-replacement," + ~ " bypassing the label" + 7e 20 20 20 54 68 69 73 20 69 73 20 69 6e 73 74 + 61 6c 6c 65 64 20 62 79 20 68 65 78 2d 6c 61 62 + 65 6c 2d 77 6f 72 64 2d 72 65 70 6c 61 63 65 6d + 65 6e 74 2c 20 62 79 70 61 73 73 69 6e 67 20 74 + 68 65 20 6c 61 62 65 6c 0a + + ~ "~ transform's normal precedence rules, so there's no need" + ~ " for it to be" + 7e 20 74 72 61 6e 73 66 6f 72 6d 27 73 20 6e 6f + 72 6d 61 6c 20 70 72 65 63 65 64 65 6e 63 65 20 + 72 75 6c 65 73 2c 20 73 6f 20 74 68 65 72 65 27 + 73 20 6e 6f 20 6e 65 65 64 20 66 6f 72 20 69 74 + 20 74 6f 20 62 65 0a + + ~ "~ immediate." + 7e 20 69 6d 6d 65 64 69 61 74 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Installing this word is the most significant change the" + ~ " hex transform" + 7e 20 20 20 49 6e 73 74 61 6c 6c 69 6e 67 20 74 + 68 69 73 20 77 6f 72 64 20 69 73 20 74 68 65 20 + 6d 6f 73 74 20 73 69 67 6e 69 66 69 63 61 6e 74 + 20 63 68 61 6e 67 65 20 74 68 65 20 68 65 78 20 + 74 72 61 6e 73 66 6f 72 6d 0a + + ~ "~ makes to the behavior of the label transform." + 7e 20 6d 61 6b 65 73 20 74 6f 20 74 68 65 20 62 + 65 68 61 76 69 6f 72 20 6f 66 20 74 68 65 20 6c + 61 62 65 6c 20 74 72 61 6e 73 66 6f 72 6d 2e 0a + + ~ ": hex-label-tilde-alternate" + 3a 20 68 65 78 2d 6c 61 62 65 6c 2d 74 69 6c 64 + 65 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ " hex-read-magic-comment-introducer" + 20 20 68 65 78 2d 72 65 61 64 2d 6d 61 67 69 63 + 2d 63 6f 6d 6d 65 6e 74 2d 69 6e 74 72 6f 64 75 + 63 65 72 0a + + ~ " ~ (body string pointer, result code)" + 20 20 7e 20 28 62 6f 64 79 20 73 74 72 69 6e 67 + 20 70 6f 69 6e 74 65 72 2c 20 72 65 73 75 6c 74 + 20 63 6f 64 65 29 0a + + ~ "" + 0a + + ~ " {" + 20 20 7b 0a + + ~ " ~ It's a magic comment, which may or may not be empty." + 20 20 20 20 7e 20 49 74 27 73 20 61 20 6d 61 67 + 69 63 20 63 6f 6d 6d 65 6e 74 2c 20 77 68 69 63 + 68 20 6d 61 79 20 6f 72 20 6d 61 79 20 6e 6f 74 + 20 62 65 20 65 6d 70 74 79 2e 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d + 66 6c 61 67 73 20 40 20 30 78 30 31 20 26 20 7b + 0a + + ~ " ~ We're in compile mode. We ignore magic comments" + ~ " in compile mode," + 20 20 20 20 20 20 7e 20 20 20 57 65 27 72 65 20 + 69 6e 20 63 6f 6d 70 69 6c 65 20 6d 6f 64 65 2e + 20 57 65 20 69 67 6e 6f 72 65 20 6d 61 67 69 63 + 20 63 6f 6d 6d 65 6e 74 73 20 69 6e 20 63 6f 6d + 70 69 6c 65 20 6d 6f 64 65 2c 0a + + ~ " ~ because they shouldn't become part of the program" + ~ " being compiled." + 20 20 20 20 20 20 7e 20 62 65 63 61 75 73 65 20 + 74 68 65 79 20 73 68 6f 75 6c 64 6e 27 74 20 62 + 65 63 6f 6d 65 20 70 61 72 74 20 6f 66 20 74 68 + 65 20 70 72 6f 67 72 61 6d 20 62 65 69 6e 67 20 + 63 6f 6d 70 69 6c 65 64 2e 0a + + ~ " drop" + 20 20 20 20 20 20 64 72 6f 70 0a + + ~ " } {" + 20 20 20 20 7d 20 7b 0a + + ~ " ~ We're in interpret mode. We run the magic comment" + ~ " immediately." + 20 20 20 20 20 20 7e 20 57 65 27 72 65 20 69 6e + 20 69 6e 74 65 72 70 72 65 74 20 6d 6f 64 65 2e + 20 57 65 20 72 75 6e 20 74 68 65 20 6d 61 67 69 + 63 20 63 6f 6d 6d 65 6e 74 20 69 6d 6d 65 64 69 + 61 74 65 6c 79 2e 0a + + ~ " has-non-space-this-input-line@ swap" + 20 20 20 20 20 20 68 61 73 2d 6e 6f 6e 2d 73 70 + 61 63 65 2d 74 68 69 73 2d 69 6e 70 75 74 2d 6c + 69 6e 65 40 20 73 77 61 70 0a + + ~ " swap-transform-variables allocate-string" + ~ " swap-transform-variables" + 20 20 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 + 66 6f 72 6d 2d 76 61 72 69 61 62 6c 65 73 20 61 + 6c 6c 6f 63 61 74 65 2d 73 74 72 69 6e 67 20 73 + 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d 2d 76 61 + 72 69 61 62 6c 65 73 0a + + ~ " hex-tilde-replacement" + 20 20 20 20 20 20 68 65 78 2d 74 69 6c 64 65 2d + 72 65 70 6c 61 63 65 6d 65 6e 74 0a + + ~ " } if-else" + 20 20 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " ~ If it's a regular comment, we just ignore it." + 20 20 20 20 7e 20 49 66 20 69 74 27 73 20 61 20 + 72 65 67 75 6c 61 72 20 63 6f 6d 6d 65 6e 74 2c + 20 77 65 20 6a 75 73 74 20 69 67 6e 6f 72 65 20 + 69 74 2e 0a + + ~ " drop" + 20 20 20 20 64 72 6f 70 0a + + ~ " } if-else" + 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ "" + 0a + + ~ " ~ Regardless of what path we took, we just consumed a" + ~ " newline, so make" + 20 20 7e 20 20 20 52 65 67 61 72 64 6c 65 73 73 + 20 6f 66 20 77 68 61 74 20 70 61 74 68 20 77 65 + 20 74 6f 6f 6b 2c 20 77 65 20 6a 75 73 74 20 63 + 6f 6e 73 75 6d 65 64 20 61 20 6e 65 77 6c 69 6e + 65 2c 20 73 6f 20 6d 61 6b 65 0a + + ~ " ~ note of the fact." + 20 20 7e 20 6e 6f 74 65 20 6f 66 20 74 68 65 20 + 66 61 63 74 2e 0a + + ~ " 0 has-non-space-this-input-line! ;" + 20 20 30 20 68 61 73 2d 6e 6f 6e 2d 73 70 61 63 + 65 2d 74 68 69 73 2d 69 6e 70 75 74 2d 6c 69 6e + 65 21 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This word runs whenever the log-load transform, running" + ~ " inside the hex" + 7e 20 20 20 54 68 69 73 20 77 6f 72 64 20 72 75 + 6e 73 20 77 68 65 6e 65 76 65 72 20 74 68 65 20 + 6c 6f 67 2d 6c 6f 61 64 20 74 72 61 6e 73 66 6f + 72 6d 2c 20 72 75 6e 6e 69 6e 67 20 69 6e 73 69 + 64 65 20 74 68 65 20 68 65 78 0a + + ~ "~ transform, encounters a tilde. It completely replaces the" + ~ " normal invocation" + 7e 20 74 72 61 6e 73 66 6f 72 6d 2c 20 65 6e 63 + 6f 75 6e 74 65 72 73 20 61 20 74 69 6c 64 65 2e + 20 49 74 20 63 6f 6d 70 6c 65 74 65 6c 79 20 72 + 65 70 6c 61 63 65 73 20 74 68 65 20 6e 6f 72 6d + 61 6c 20 69 6e 76 6f 63 61 74 69 6f 6e 0a + + ~ "~ of tilde, just as hex-tilde-alternate does. It has the" + ~ " same responsibilities" + 7e 20 6f 66 20 74 69 6c 64 65 2c 20 6a 75 73 74 + 20 61 73 20 68 65 78 2d 74 69 6c 64 65 2d 61 6c + 74 65 72 6e 61 74 65 20 64 6f 65 73 2e 20 49 74 + 20 68 61 73 20 74 68 65 20 73 61 6d 65 20 72 65 + 73 70 6f 6e 73 69 62 69 6c 69 74 69 65 73 0a + + ~ "~ around magic comments as hex-tilde-alternate, but for" + ~ " code which is" + 7e 20 61 72 6f 75 6e 64 20 6d 61 67 69 63 20 63 + 6f 6d 6d 65 6e 74 73 20 61 73 20 68 65 78 2d 74 + 69 6c 64 65 2d 61 6c 74 65 72 6e 61 74 65 2c 20 + 62 75 74 20 66 6f 72 20 63 6f 64 65 20 77 68 69 + 63 68 20 69 73 0a + + ~ "~ lexically processed by log-load-transform-one rather than" + ~ " by" + 7e 20 6c 65 78 69 63 61 6c 6c 79 20 70 72 6f 63 + 65 73 73 65 64 20 62 79 20 6c 6f 67 2d 6c 6f 61 + 64 2d 74 72 61 6e 73 66 6f 72 6d 2d 6f 6e 65 20 + 72 61 74 68 65 72 20 74 68 61 6e 20 62 79 0a + + ~ "~ hex-transform-one." + 7e 20 68 65 78 2d 74 72 61 6e 73 66 6f 72 6d 2d + 6f 6e 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The actions it takes upon finding various sorts of" + ~ " comments differ from" + 7e 20 20 20 54 68 65 20 61 63 74 69 6f 6e 73 20 + 69 74 20 74 61 6b 65 73 20 75 70 6f 6e 20 66 69 + 6e 64 69 6e 67 20 76 61 72 69 6f 75 73 20 73 6f + 72 74 73 20 6f 66 20 63 6f 6d 6d 65 6e 74 73 20 + 64 69 66 66 65 72 20 66 72 6f 6d 0a + + ~ "~ hex-tilde-alternate, because the behavior of the log-load" + ~ " transform is" + 7e 20 68 65 78 2d 74 69 6c 64 65 2d 61 6c 74 65 + 72 6e 61 74 65 2c 20 62 65 63 61 75 73 65 20 74 + 68 65 20 62 65 68 61 76 69 6f 72 20 6f 66 20 74 + 68 65 20 6c 6f 67 2d 6c 6f 61 64 20 74 72 61 6e + 73 66 6f 72 6d 20 69 73 0a + + ~ "~ different from the behavior of the hex transform." + 7e 20 64 69 66 66 65 72 65 6e 74 20 66 72 6f 6d + 20 74 68 65 20 62 65 68 61 76 69 6f 72 20 6f 66 + 20 74 68 65 20 68 65 78 20 74 72 61 6e 73 66 6f + 72 6d 2e 0a + + ~ "~" + 7e 0a + + ~ "~ This is installed by hex-log-load-word-replacement," + ~ " bypassing the log-load" + 7e 20 20 20 54 68 69 73 20 69 73 20 69 6e 73 74 + 61 6c 6c 65 64 20 62 79 20 68 65 78 2d 6c 6f 67 + 2d 6c 6f 61 64 2d 77 6f 72 64 2d 72 65 70 6c 61 + 63 65 6d 65 6e 74 2c 20 62 79 70 61 73 73 69 6e + 67 20 74 68 65 20 6c 6f 67 2d 6c 6f 61 64 0a + + ~ "~ transform's normal precedence rules, so there's no need" + ~ " for it to be" + 7e 20 74 72 61 6e 73 66 6f 72 6d 27 73 20 6e 6f + 72 6d 61 6c 20 70 72 65 63 65 64 65 6e 63 65 20 + 72 75 6c 65 73 2c 20 73 6f 20 74 68 65 72 65 27 + 73 20 6e 6f 20 6e 65 65 64 20 66 6f 72 20 69 74 + 20 74 6f 20 62 65 0a + + ~ "~ immediate." + 7e 20 69 6d 6d 65 64 69 61 74 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Installing this word is the most significant change the" + ~ " hex transform" + 7e 20 20 20 49 6e 73 74 61 6c 6c 69 6e 67 20 74 + 68 69 73 20 77 6f 72 64 20 69 73 20 74 68 65 20 + 6d 6f 73 74 20 73 69 67 6e 69 66 69 63 61 6e 74 + 20 63 68 61 6e 67 65 20 74 68 65 20 68 65 78 20 + 74 72 61 6e 73 66 6f 72 6d 0a + + ~ "~ makes to the behavior of the log-load transform." + 7e 20 6d 61 6b 65 73 20 74 6f 20 74 68 65 20 62 + 65 68 61 76 69 6f 72 20 6f 66 20 74 68 65 20 6c + 6f 67 2d 6c 6f 61 64 20 74 72 61 6e 73 66 6f 72 + 6d 2e 0a + + ~ ": hex-log-load-tilde-alternate" + 3a 20 68 65 78 2d 6c 6f 67 2d 6c 6f 61 64 2d 74 + 69 6c 64 65 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ " hex-read-magic-comment-introducer" + 20 20 68 65 78 2d 72 65 61 64 2d 6d 61 67 69 63 + 2d 63 6f 6d 6d 65 6e 74 2d 69 6e 74 72 6f 64 75 + 63 65 72 0a + + ~ " ~ (body string pointer, result code)" + 20 20 7e 20 28 62 6f 64 79 20 73 74 72 69 6e 67 + 20 70 6f 69 6e 74 65 72 2c 20 72 65 73 75 6c 74 + 20 63 6f 64 65 29 0a + + ~ "" + 0a + + ~ " {" + 20 20 7b 0a + + ~ " ~ It's a magic comment, which may or may not be empty." + 20 20 20 20 7e 20 49 74 27 73 20 61 20 6d 61 67 + 69 63 20 63 6f 6d 6d 65 6e 74 2c 20 77 68 69 63 + 68 20 6d 61 79 20 6f 72 20 6d 61 79 20 6e 6f 74 + 20 62 65 20 65 6d 70 74 79 2e 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d + 66 6c 61 67 73 20 40 20 30 78 30 31 20 26 20 7b + 0a + + ~ " ~ We're in compile mode. We ignore magic comments" + ~ " in compile mode," + 20 20 20 20 20 20 7e 20 20 20 57 65 27 72 65 20 + 69 6e 20 63 6f 6d 70 69 6c 65 20 6d 6f 64 65 2e + 20 57 65 20 69 67 6e 6f 72 65 20 6d 61 67 69 63 + 20 63 6f 6d 6d 65 6e 74 73 20 69 6e 20 63 6f 6d + 70 69 6c 65 20 6d 6f 64 65 2c 0a + + ~ " ~ because they shouldn't become part of the program" + ~ " being compiled." + 20 20 20 20 20 20 7e 20 62 65 63 61 75 73 65 20 + 74 68 65 79 20 73 68 6f 75 6c 64 6e 27 74 20 62 + 65 63 6f 6d 65 20 70 61 72 74 20 6f 66 20 74 68 + 65 20 70 72 6f 67 72 61 6d 20 62 65 69 6e 67 20 + 63 6f 6d 70 69 6c 65 64 2e 0a + + ~ " drop" + 20 20 20 20 20 20 64 72 6f 70 0a + + ~ " } {" + 20 20 20 20 7d 20 7b 0a + + ~ " ~ We're in interpret mode. We run the magic comment" + ~ " immediately." + 20 20 20 20 20 20 7e 20 57 65 27 72 65 20 69 6e + 20 69 6e 74 65 72 70 72 65 74 20 6d 6f 64 65 2e + 20 57 65 20 72 75 6e 20 74 68 65 20 6d 61 67 69 + 63 20 63 6f 6d 6d 65 6e 74 20 69 6d 6d 65 64 69 + 61 74 65 6c 79 2e 0a + + ~ " has-non-space-this-input-line@ swap" + 20 20 20 20 20 20 68 61 73 2d 6e 6f 6e 2d 73 70 + 61 63 65 2d 74 68 69 73 2d 69 6e 70 75 74 2d 6c + 69 6e 65 40 20 73 77 61 70 0a + + ~ " swap-transform-variables allocate-string" + ~ " swap-transform-variables" + 20 20 20 20 20 20 73 77 61 70 2d 74 72 61 6e 73 + 66 6f 72 6d 2d 76 61 72 69 61 62 6c 65 73 20 61 + 6c 6c 6f 63 61 74 65 2d 73 74 72 69 6e 67 20 73 + 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d 2d 76 61 + 72 69 61 62 6c 65 73 0a + + ~ " hex-tilde-replacement" + 20 20 20 20 20 20 68 65 78 2d 74 69 6c 64 65 2d + 72 65 70 6c 61 63 65 6d 65 6e 74 0a + + ~ " } if-else" + 20 20 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " ~ If it's a regular comment, we just ignore it." + 20 20 20 20 7e 20 49 66 20 69 74 27 73 20 61 20 + 72 65 67 75 6c 61 72 20 63 6f 6d 6d 65 6e 74 2c + 20 77 65 20 6a 75 73 74 20 69 67 6e 6f 72 65 20 + 69 74 2e 0a + + ~ " drop" + 20 20 20 20 64 72 6f 70 0a + + ~ " } if-else" + 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ "" + 0a + + ~ " ~ Regardless of what path we took, we just consumed a" + ~ " newline, so make" + 20 20 7e 20 20 20 52 65 67 61 72 64 6c 65 73 73 + 20 6f 66 20 77 68 61 74 20 70 61 74 68 20 77 65 + 20 74 6f 6f 6b 2c 20 77 65 20 6a 75 73 74 20 63 + 6f 6e 73 75 6d 65 64 20 61 20 6e 65 77 6c 69 6e + 65 2c 20 73 6f 20 6d 61 6b 65 0a + + ~ " ~ note of the fact." + 20 20 7e 20 6e 6f 74 65 20 6f 66 20 74 68 65 20 + 66 61 63 74 2e 0a + + ~ " 0 has-non-space-this-input-line! ;" + 20 20 30 20 68 61 73 2d 6e 6f 6e 2d 73 70 61 63 + 65 2d 74 68 69 73 2d 69 6e 70 75 74 2d 6c 69 6e + 65 21 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This input helper is a very unusual thing: It's used by" + ~ " hex-transform-one," + 7e 20 20 20 54 68 69 73 20 69 6e 70 75 74 20 68 + 65 6c 70 65 72 20 69 73 20 61 20 76 65 72 79 20 + 75 6e 75 73 75 61 6c 20 74 68 69 6e 67 3a 20 49 + 74 27 73 20 75 73 65 64 20 62 79 20 68 65 78 2d + 74 72 61 6e 73 66 6f 72 6d 2d 6f 6e 65 2c 0a + + ~ "~ hex-label-word-replacement, and" + ~ " hex-log-load-word-replacement to skip the" + 7e 20 68 65 78 2d 6c 61 62 65 6c 2d 77 6f 72 64 + 2d 72 65 70 6c 61 63 65 6d 65 6e 74 2c 20 61 6e + 64 20 68 65 78 2d 6c 6f 67 2d 6c 6f 61 64 2d 77 + 6f 72 64 2d 72 65 70 6c 61 63 65 6d 65 6e 74 20 + 74 6f 20 73 6b 69 70 20 74 68 65 0a + + ~ "~ space between words. That's necessary because we need to" + ~ " keep track of" + 7e 20 73 70 61 63 65 20 62 65 74 77 65 65 6e 20 + 77 6f 72 64 73 2e 20 54 68 61 74 27 73 20 6e 65 + 63 65 73 73 61 72 79 20 62 65 63 61 75 73 65 20 + 77 65 20 6e 65 65 64 20 74 6f 20 6b 65 65 70 20 + 74 72 61 63 6b 20 6f 66 0a + + ~ "~ whether we've had any non-blank stuff on each line yet," + ~ " so that the tilde" + 7e 20 77 68 65 74 68 65 72 20 77 65 27 76 65 20 + 68 61 64 20 61 6e 79 20 6e 6f 6e 2d 62 6c 61 6e + 6b 20 73 74 75 66 66 20 6f 6e 20 65 61 63 68 20 + 6c 69 6e 65 20 79 65 74 2c 20 73 6f 20 74 68 61 + 74 20 74 68 65 20 74 69 6c 64 65 0a + + ~ "~ replacement can figure out certain cases where a magic" + ~ " comment needs to be a" + 7e 20 72 65 70 6c 61 63 65 6d 65 6e 74 20 63 61 + 6e 20 66 69 67 75 72 65 20 6f 75 74 20 63 65 72 + 74 61 69 6e 20 63 61 73 65 73 20 77 68 65 72 65 + 20 61 20 6d 61 67 69 63 20 63 6f 6d 6d 65 6e 74 + 20 6e 65 65 64 73 20 74 6f 20 62 65 20 61 0a + + ~ "~ suffix comment rather than a line comment." + 7e 20 73 75 66 66 69 78 20 63 6f 6d 6d 65 6e 74 + 20 72 61 74 68 65 72 20 74 68 61 6e 20 61 20 6c + 69 6e 65 20 63 6f 6d 6d 65 6e 74 2e 0a + + ~ ": hex-skip-space" + 3a 20 68 65 78 2d 73 6b 69 70 2d 73 70 61 63 65 + 0a + + ~ " { peek dup is-space }" + 20 20 7b 20 70 65 65 6b 20 64 75 70 20 69 73 2d + 73 70 61 63 65 20 7d 0a + + ~ " { consume" + 20 20 7b 20 63 6f 6e 73 75 6d 65 0a + + ~ " ~ This will set the flag once for each newline, if we" + ~ " have multiple" + 20 20 20 20 7e 20 20 20 54 68 69 73 20 77 69 6c + 6c 20 73 65 74 20 74 68 65 20 66 6c 61 67 20 6f + 6e 63 65 20 66 6f 72 20 65 61 63 68 20 6e 65 77 + 6c 69 6e 65 2c 20 69 66 20 77 65 20 68 61 76 65 + 20 6d 75 6c 74 69 70 6c 65 0a + + ~ " ~ consecutive ones or something like that, but that's" + ~ " harmless." + 20 20 20 20 7e 20 63 6f 6e 73 65 63 75 74 69 76 + 65 20 6f 6e 65 73 20 6f 72 20 73 6f 6d 65 74 68 + 69 6e 67 20 6c 69 6b 65 20 74 68 61 74 2c 20 62 + 75 74 20 74 68 61 74 27 73 20 68 61 72 6d 6c 65 + 73 73 2e 0a + + ~ " 0x0a = { 0 has-non-space-this-input-line! } if" + 20 20 20 20 30 78 30 61 20 3d 20 7b 20 30 20 68 + 61 73 2d 6e 6f 6e 2d 73 70 61 63 65 2d 74 68 69 + 73 2d 69 6e 70 75 74 2d 6c 69 6e 65 21 20 7d 20 + 69 66 0a + + ~ " } while drop ;" + 20 20 20 20 7d 20 77 68 69 6c 65 20 64 72 6f 70 + 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This word is installed into label-transform-one by the" + ~ " hex-word-alternate," + 7e 20 20 20 54 68 69 73 20 77 6f 72 64 20 69 73 + 20 69 6e 73 74 61 6c 6c 65 64 20 69 6e 74 6f 20 + 6c 61 62 65 6c 2d 74 72 61 6e 73 66 6f 72 6d 2d + 6f 6e 65 20 62 79 20 74 68 65 20 68 65 78 2d 77 + 6f 72 64 2d 61 6c 74 65 72 6e 61 74 65 2c 0a + + ~ "~ when the label transform runs inside the hex transform." + ~ " It has the job of" + 7e 20 77 68 65 6e 20 74 68 65 20 6c 61 62 65 6c + 20 74 72 61 6e 73 66 6f 72 6d 20 72 75 6e 73 20 + 69 6e 73 69 64 65 20 74 68 65 20 68 65 78 20 74 + 72 61 6e 73 66 6f 72 6d 2e 20 49 74 20 68 61 73 + 20 74 68 65 20 6a 6f 62 20 6f 66 0a + + ~ "~ performing substantive changes to the label transform's" + ~ " behavior, as" + 7e 20 70 65 72 66 6f 72 6d 69 6e 67 20 73 75 62 + 73 74 61 6e 74 69 76 65 20 63 68 61 6e 67 65 73 + 20 74 6f 20 74 68 65 20 6c 61 62 65 6c 20 74 72 + 61 6e 73 66 6f 72 6d 27 73 20 62 65 68 61 76 69 + 6f 72 2c 20 61 73 0a + + ~ "~ required by the hex transform." + 7e 20 72 65 71 75 69 72 65 64 20 62 79 20 74 68 + 65 20 68 65 78 20 74 72 61 6e 73 66 6f 72 6d 2e + 0a + + ~ "~" + 7e 0a + + ~ "~ The most important changes to the base language that" + ~ " this word makes are" + 7e 20 20 20 54 68 65 20 6d 6f 73 74 20 69 6d 70 + 6f 72 74 61 6e 74 20 63 68 61 6e 67 65 73 20 74 + 6f 20 74 68 65 20 62 61 73 65 20 6c 61 6e 67 75 + 61 67 65 20 74 68 61 74 20 74 68 69 73 20 77 6f + 72 64 20 6d 61 6b 65 73 20 61 72 65 0a + + ~ "~ to call hex-label-tilde-alternate any time a tilde is" + ~ " encountered as a word," + 7e 20 74 6f 20 63 61 6c 6c 20 68 65 78 2d 6c 61 + 62 65 6c 2d 74 69 6c 64 65 2d 61 6c 74 65 72 6e + 61 74 65 20 61 6e 79 20 74 69 6d 65 20 61 20 74 + 69 6c 64 65 20 69 73 20 65 6e 63 6f 75 6e 74 65 + 72 65 64 20 61 73 20 61 20 77 6f 72 64 2c 0a + + ~ "~ and to call hex-skip-space before reading a word." + 7e 20 61 6e 64 20 74 6f 20 63 61 6c 6c 20 68 65 + 78 2d 73 6b 69 70 2d 73 70 61 63 65 20 62 65 66 + 6f 72 65 20 72 65 61 64 69 6e 67 20 61 20 77 6f + 72 64 2e 0a + + ~ "~" + 7e 0a + + ~ "~ This word is also responsible for invoking" + ~ " hex-memory-slide-replacement" + 7e 20 20 20 54 68 69 73 20 77 6f 72 64 20 69 73 + 20 61 6c 73 6f 20 72 65 73 70 6f 6e 73 69 62 6c + 65 20 66 6f 72 20 69 6e 76 6f 6b 69 6e 67 20 68 + 65 78 2d 6d 65 6d 6f 72 79 2d 73 6c 69 64 65 2d + 72 65 70 6c 61 63 65 6d 65 6e 74 0a + + ~ "~ when memcopy or memmove are encountered in immediate" + ~ " mode. Note that this" + 7e 20 77 68 65 6e 20 6d 65 6d 63 6f 70 79 20 6f + 72 20 6d 65 6d 6d 6f 76 65 20 61 72 65 20 65 6e + 63 6f 75 6e 74 65 72 65 64 20 69 6e 20 69 6d 6d + 65 64 69 61 74 65 20 6d 6f 64 65 2e 20 4e 6f 74 + 65 20 74 68 61 74 20 74 68 69 73 0a + + ~ "~ really pushes right up against the limit of what it's" + ~ " possible for a" + 7e 20 72 65 61 6c 6c 79 20 70 75 73 68 65 73 20 + 72 69 67 68 74 20 75 70 20 61 67 61 69 6e 73 74 + 20 74 68 65 20 6c 69 6d 69 74 20 6f 66 20 77 68 + 61 74 20 69 74 27 73 20 70 6f 73 73 69 62 6c 65 + 20 66 6f 72 20 61 0a + + ~ "~ transform to do without altering the compilation's" + ~ " output; invoking the" + 7e 20 74 72 61 6e 73 66 6f 72 6d 20 74 6f 20 64 + 6f 20 77 69 74 68 6f 75 74 20 61 6c 74 65 72 69 + 6e 67 20 74 68 65 20 63 6f 6d 70 69 6c 61 74 69 + 6f 6e 27 73 20 6f 75 74 70 75 74 3b 20 69 6e 76 + 6f 6b 69 6e 67 20 74 68 65 0a + + ~ "~ replacement in compile mode would do so." + 7e 20 72 65 70 6c 61 63 65 6d 65 6e 74 20 69 6e + 20 63 6f 6d 70 69 6c 65 20 6d 6f 64 65 20 77 6f + 75 6c 64 20 64 6f 20 73 6f 2e 0a + + ~ ": hex-label-word-replacement" + 3a 20 68 65 78 2d 6c 61 62 65 6c 2d 77 6f 72 64 + 2d 72 65 70 6c 61 63 65 6d 65 6e 74 0a + + ~ " hex-skip-space" + 20 20 68 65 78 2d 73 6b 69 70 2d 73 70 61 63 65 + 0a + + ~ " word" + 20 20 77 6f 72 64 0a + + ~ "" + 0a + + ~ " value@" + 20 20 76 61 6c 75 65 40 0a + + ~ " dup s" ~" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 7e 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " ~ We won't be going back to label-transform-one; clear" + ~ " away its state." + 20 20 20 20 7e 20 57 65 20 77 6f 6e 27 74 20 62 + 65 20 67 6f 69 6e 67 20 62 61 63 6b 20 74 6f 20 + 6c 61 62 65 6c 2d 74 72 61 6e 73 66 6f 72 6d 2d + 6f 6e 65 3b 20 63 6c 65 61 72 20 61 77 61 79 20 + 69 74 73 20 73 74 61 74 65 2e 0a + + ~ " drop dropstring" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 73 74 72 + 69 6e 67 0a + + ~ "" + 0a + + ~ " hex-label-tilde-alternate" + 20 20 20 20 68 65 78 2d 6c 61 62 65 6c 2d 74 69 + 6c 64 65 2d 61 6c 74 65 72 6e 61 74 65 0a + + ~ "" + 0a + + ~ " ~ Return directly to label-transform, faking the "not" + ~ " done" return value" + 20 20 20 20 7e 20 20 20 52 65 74 75 72 6e 20 64 + 69 72 65 63 74 6c 79 20 74 6f 20 6c 61 62 65 6c + 2d 74 72 61 6e 73 66 6f 72 6d 2c 20 66 61 6b 69 + 6e 67 20 74 68 65 20 22 6e 6f 74 20 64 6f 6e 65 + 22 20 72 65 74 75 72 6e 20 76 61 6c 75 65 0a + + ~ " ~ from label-transform-one." + 20 20 20 20 7e 20 66 72 6f 6d 20 6c 61 62 65 6c + 2d 74 72 61 6e 73 66 6f 72 6d 2d 6f 6e 65 2e 0a + + ~ " 0" + 20 20 20 20 30 0a + + ~ " 2 nexit" + 20 20 20 20 32 20 6e 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " dup s" memcopy" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 6d 65 6d 63 6f 70 79 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 0a + + ~ " interpreter-flags @ 0x01 & not {" + 20 20 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d + 66 6c 61 67 73 20 40 20 30 78 30 31 20 26 20 6e + 6f 74 20 7b 0a + + ~ " drop hex-memory-slide-replacement exit" + 20 20 20 20 20 20 64 72 6f 70 20 68 65 78 2d 6d + 65 6d 6f 72 79 2d 73 6c 69 64 65 2d 72 65 70 6c + 61 63 65 6d 65 6e 74 20 65 78 69 74 0a + + ~ " ~ Fall through, returning control to" + ~ " label-transform-one." + 20 20 20 20 20 20 7e 20 46 61 6c 6c 20 74 68 72 + 6f 75 67 68 2c 20 72 65 74 75 72 6e 69 6e 67 20 + 63 6f 6e 74 72 6f 6c 20 74 6f 20 6c 61 62 65 6c + 2d 74 72 61 6e 73 66 6f 72 6d 2d 6f 6e 65 2e 0a + + ~ " } if" + 20 20 20 20 7d 20 69 66 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " dup s" memmove" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 6d 65 6d 6d 6f 76 65 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 0a + + ~ " interpreter-flags @ 0x01 & not {" + 20 20 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d + 66 6c 61 67 73 20 40 20 30 78 30 31 20 26 20 6e + 6f 74 20 7b 0a + + ~ " drop hex-memory-slide-replacement exit" + 20 20 20 20 20 20 64 72 6f 70 20 68 65 78 2d 6d + 65 6d 6f 72 79 2d 73 6c 69 64 65 2d 72 65 70 6c + 61 63 65 6d 65 6e 74 20 65 78 69 74 0a + + ~ " ~ Fall through, returning control to" + ~ " label-transform-one." + 20 20 20 20 20 20 7e 20 46 61 6c 6c 20 74 68 72 + 6f 75 67 68 2c 20 72 65 74 75 72 6e 69 6e 67 20 + 63 6f 6e 74 72 6f 6c 20 74 6f 20 6c 61 62 65 6c + 2d 74 72 61 6e 73 66 6f 72 6d 2d 6f 6e 65 2e 0a + + ~ " } if" + 20 20 20 20 7d 20 69 66 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " drop ;" + 20 20 64 72 6f 70 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This word is installed into log-load-transform-one by" + ~ " the" + 7e 20 20 20 54 68 69 73 20 77 6f 72 64 20 69 73 + 20 69 6e 73 74 61 6c 6c 65 64 20 69 6e 74 6f 20 + 6c 6f 67 2d 6c 6f 61 64 2d 74 72 61 6e 73 66 6f + 72 6d 2d 6f 6e 65 20 62 79 20 74 68 65 0a + + ~ "~ hex-word-alternate, when the log-load transform runs" + ~ " inside the hex" + 7e 20 68 65 78 2d 77 6f 72 64 2d 61 6c 74 65 72 + 6e 61 74 65 2c 20 77 68 65 6e 20 74 68 65 20 6c + 6f 67 2d 6c 6f 61 64 20 74 72 61 6e 73 66 6f 72 + 6d 20 72 75 6e 73 20 69 6e 73 69 64 65 20 74 68 + 65 20 68 65 78 0a + + ~ "~ transform. It has the job of performing substantive" + ~ " changes to the log-load" + 7e 20 74 72 61 6e 73 66 6f 72 6d 2e 20 49 74 20 + 68 61 73 20 74 68 65 20 6a 6f 62 20 6f 66 20 70 + 65 72 66 6f 72 6d 69 6e 67 20 73 75 62 73 74 61 + 6e 74 69 76 65 20 63 68 61 6e 67 65 73 20 74 6f + 20 74 68 65 20 6c 6f 67 2d 6c 6f 61 64 0a + + ~ "~ transform's behavior, as required by the hex transform." + 7e 20 74 72 61 6e 73 66 6f 72 6d 27 73 20 62 65 + 68 61 76 69 6f 72 2c 20 61 73 20 72 65 71 75 69 + 72 65 64 20 62 79 20 74 68 65 20 68 65 78 20 74 + 72 61 6e 73 66 6f 72 6d 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The most important changes to the base language that" + ~ " this word makes are" + 7e 20 20 20 54 68 65 20 6d 6f 73 74 20 69 6d 70 + 6f 72 74 61 6e 74 20 63 68 61 6e 67 65 73 20 74 + 6f 20 74 68 65 20 62 61 73 65 20 6c 61 6e 67 75 + 61 67 65 20 74 68 61 74 20 74 68 69 73 20 77 6f + 72 64 20 6d 61 6b 65 73 20 61 72 65 0a + + ~ "~ to call hex-log-load-tilde-alternate any time a tilde is" + ~ " encountered as a" + 7e 20 74 6f 20 63 61 6c 6c 20 68 65 78 2d 6c 6f + 67 2d 6c 6f 61 64 2d 74 69 6c 64 65 2d 61 6c 74 + 65 72 6e 61 74 65 20 61 6e 79 20 74 69 6d 65 20 + 61 20 74 69 6c 64 65 20 69 73 20 65 6e 63 6f 75 + 6e 74 65 72 65 64 20 61 73 20 61 0a + + ~ "~ word, and to call hex-skip-space before reading a word." + 7e 20 77 6f 72 64 2c 20 61 6e 64 20 74 6f 20 63 + 61 6c 6c 20 68 65 78 2d 73 6b 69 70 2d 73 70 61 + 63 65 20 62 65 66 6f 72 65 20 72 65 61 64 69 6e + 67 20 61 20 77 6f 72 64 2e 0a + + ~ ": hex-log-load-word-replacement" + 3a 20 68 65 78 2d 6c 6f 67 2d 6c 6f 61 64 2d 77 + 6f 72 64 2d 72 65 70 6c 61 63 65 6d 65 6e 74 0a + + ~ " hex-skip-space" + 20 20 68 65 78 2d 73 6b 69 70 2d 73 70 61 63 65 + 0a + + ~ " word" + 20 20 77 6f 72 64 0a + + ~ "" + 0a + + ~ " value@" + 20 20 76 61 6c 75 65 40 0a + + ~ " dup s" ~" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 7e 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " ~ We won't be going back to log-load-transform-one;" + ~ " clear away its state." + 20 20 20 20 7e 20 57 65 20 77 6f 6e 27 74 20 62 + 65 20 67 6f 69 6e 67 20 62 61 63 6b 20 74 6f 20 + 6c 6f 67 2d 6c 6f 61 64 2d 74 72 61 6e 73 66 6f + 72 6d 2d 6f 6e 65 3b 20 63 6c 65 61 72 20 61 77 + 61 79 20 69 74 73 20 73 74 61 74 65 2e 0a + + ~ " drop dropstring" + 20 20 20 20 64 72 6f 70 20 64 72 6f 70 73 74 72 + 69 6e 67 0a + + ~ "" + 0a + + ~ " hex-log-load-tilde-alternate" + 20 20 20 20 68 65 78 2d 6c 6f 67 2d 6c 6f 61 64 + 2d 74 69 6c 64 65 2d 61 6c 74 65 72 6e 61 74 65 + 0a + + ~ "" + 0a + + ~ " ~ Return directly to log-load-transform, faking the" + ~ " "not done" return" + 20 20 20 20 7e 20 20 20 52 65 74 75 72 6e 20 64 + 69 72 65 63 74 6c 79 20 74 6f 20 6c 6f 67 2d 6c + 6f 61 64 2d 74 72 61 6e 73 66 6f 72 6d 2c 20 66 + 61 6b 69 6e 67 20 74 68 65 20 22 6e 6f 74 20 64 + 6f 6e 65 22 20 72 65 74 75 72 6e 0a + + ~ " ~ value from log-load-transform-one." + 20 20 20 20 7e 20 76 61 6c 75 65 20 66 72 6f 6d + 20 6c 6f 67 2d 6c 6f 61 64 2d 74 72 61 6e 73 66 + 6f 72 6d 2d 6f 6e 65 2e 0a + + ~ " 0" + 20 20 20 20 30 0a + + ~ " 2 nexit" + 20 20 20 20 32 20 6e 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " drop ;" + 20 20 64 72 6f 70 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Just as hex-allocate-alternate has the job of" + ~ " installing" + 7e 20 20 20 4a 75 73 74 20 61 73 20 68 65 78 2d + 61 6c 6c 6f 63 61 74 65 2d 61 6c 74 65 72 6e 61 + 74 65 20 68 61 73 20 74 68 65 20 6a 6f 62 20 6f + 66 20 69 6e 73 74 61 6c 6c 69 6e 67 0a + + ~ "~ hex-allocate-replacement in only one single spot, so" + ~ " hex-word-alternate has" + 7e 20 68 65 78 2d 61 6c 6c 6f 63 61 74 65 2d 72 + 65 70 6c 61 63 65 6d 65 6e 74 20 69 6e 20 6f 6e + 6c 79 20 6f 6e 65 20 73 69 6e 67 6c 65 20 73 70 + 6f 74 2c 20 73 6f 20 68 65 78 2d 77 6f 72 64 2d + 61 6c 74 65 72 6e 61 74 65 20 68 61 73 0a + + ~ "~ the job of installing hex-label-word-replacement. It gets" + ~ " installed when" + 7e 20 74 68 65 20 6a 6f 62 20 6f 66 20 69 6e 73 + 74 61 6c 6c 69 6e 67 20 68 65 78 2d 6c 61 62 65 + 6c 2d 77 6f 72 64 2d 72 65 70 6c 61 63 65 6d 65 + 6e 74 2e 20 49 74 20 67 65 74 73 20 69 6e 73 74 + 61 6c 6c 65 64 20 77 68 65 6e 0a + + ~ "~ "word" is called from lexically within" + ~ " label-transform-one, and at no other" + 7e 20 22 77 6f 72 64 22 20 69 73 20 63 61 6c 6c + 65 64 20 66 72 6f 6d 20 6c 65 78 69 63 61 6c 6c + 79 20 77 69 74 68 69 6e 20 6c 61 62 65 6c 2d 74 + 72 61 6e 73 66 6f 72 6d 2d 6f 6e 65 2c 20 61 6e + 64 20 61 74 20 6e 6f 20 6f 74 68 65 72 0a + + ~ "~ time." + 7e 20 74 69 6d 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Notice how the job of each transform's inner bits can" + ~ " be thought of as" + 7e 20 20 20 4e 6f 74 69 63 65 20 68 6f 77 20 74 + 68 65 20 6a 6f 62 20 6f 66 20 65 61 63 68 20 74 + 72 61 6e 73 66 6f 72 6d 27 73 20 69 6e 6e 65 72 + 20 62 69 74 73 20 63 61 6e 20 62 65 20 74 68 6f + 75 67 68 74 20 6f 66 20 61 73 0a + + ~ "~ calling "word" and doing something with the result, with" + ~ " all the lexical" + 7e 20 63 61 6c 6c 69 6e 67 20 22 77 6f 72 64 22 + 20 61 6e 64 20 64 6f 69 6e 67 20 73 6f 6d 65 74 + 68 69 6e 67 20 77 69 74 68 20 74 68 65 20 72 65 + 73 75 6c 74 2c 20 77 69 74 68 20 61 6c 6c 20 74 + 68 65 20 6c 65 78 69 63 61 6c 0a + + ~ "~ processing delegated to "word". This makes "word" a good" + ~ " place to install a" + 7e 20 70 72 6f 63 65 73 73 69 6e 67 20 64 65 6c + 65 67 61 74 65 64 20 74 6f 20 22 77 6f 72 64 22 + 2e 20 54 68 69 73 20 6d 61 6b 65 73 20 22 77 6f + 72 64 22 20 61 20 67 6f 6f 64 20 70 6c 61 63 65 + 20 74 6f 20 69 6e 73 74 61 6c 6c 20 61 0a + + ~ "~ modification to the transform's behavior." + 7e 20 6d 6f 64 69 66 69 63 61 74 69 6f 6e 20 74 + 6f 20 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 27 + 73 20 62 65 68 61 76 69 6f 72 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Its structure is highly similar to that of" + ~ " hex-allocate-alternate." + 7e 20 20 20 49 74 73 20 73 74 72 75 63 74 75 72 + 65 20 69 73 20 68 69 67 68 6c 79 20 73 69 6d 69 + 6c 61 72 20 74 6f 20 74 68 61 74 20 6f 66 20 68 + 65 78 2d 61 6c 6c 6f 63 61 74 65 2d 61 6c 74 65 + 72 6e 61 74 65 2e 0a + + ~ ": hex-word-alternate" + 3a 20 68 65 78 2d 77 6f 72 64 2d 61 6c 74 65 72 + 6e 61 74 65 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " ~ Compile mode." + 20 20 20 20 7e 20 43 6f 6d 70 69 6c 65 20 6d 6f + 64 65 2e 0a + + ~ " latest @ entry-to-name" + 20 20 20 20 6c 61 74 65 73 74 20 40 20 65 6e 74 + 72 79 2d 74 6f 2d 6e 61 6d 65 0a + + ~ "" + 0a + + ~ " dup s" label-transform-one" stringcmp 0 = {" + 20 20 20 20 64 75 70 20 73 22 20 6c 61 62 65 6c + 2d 74 72 61 6e 73 66 6f 72 6d 2d 6f 6e 65 22 20 + 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " drop" + 20 20 20 20 20 20 64 72 6f 70 0a + + ~ " ' hex-label-word-replacement entry-to-execution-token" + ~ " ," + 20 20 20 20 20 20 27 20 68 65 78 2d 6c 61 62 65 + 6c 2d 77 6f 72 64 2d 72 65 70 6c 61 63 65 6d 65 + 6e 74 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 + 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " exit" + 20 20 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " dup s" log-load-transform-one" stringcmp 0 = {" + 20 20 20 20 64 75 70 20 73 22 20 6c 6f 67 2d 6c + 6f 61 64 2d 74 72 61 6e 73 66 6f 72 6d 2d 6f 6e + 65 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 0a + + ~ " drop" + 20 20 20 20 20 20 64 72 6f 70 0a + + ~ " ' hex-log-load-word-replacement" + ~ " entry-to-execution-token ," + 20 20 20 20 20 20 27 20 68 65 78 2d 6c 6f 67 2d + 6c 6f 61 64 2d 77 6f 72 64 2d 72 65 70 6c 61 63 + 65 6d 65 6e 74 20 65 6e 74 72 79 2d 74 6f 2d 65 + 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c + 0a + + ~ " exit" + 20 20 20 20 20 20 20 65 78 69 74 0a + + ~ " } if" + 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ Not in a word we install stuff into." + 20 20 20 20 7e 20 4e 6f 74 20 69 6e 20 61 20 77 + 6f 72 64 20 77 65 20 69 6e 73 74 61 6c 6c 20 73 + 74 75 66 66 20 69 6e 74 6f 2e 0a + + ~ " drop" + 20 20 20 20 64 72 6f 70 0a + + ~ " s" word" find entry-to-execution-token ," + 20 20 20 20 73 22 20 77 6f 72 64 22 20 66 69 6e + 64 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " ~ Immediate mode." + 20 20 20 20 7e 20 49 6d 6d 65 64 69 61 74 65 20 + 6d 6f 64 65 2e 0a + + ~ " s" word" find" + 20 20 20 20 73 22 20 77 6f 72 64 22 20 66 69 6e + 64 0a + + ~ " dup { entry-to-execution-token execute } { drop" + ~ " allocate } if-else" + 20 20 20 20 64 75 70 20 7b 20 65 6e 74 72 79 2d + 74 6f 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b + 65 6e 20 65 78 65 63 75 74 65 20 7d 20 7b 20 64 + 72 6f 70 20 61 6c 6c 6f 63 61 74 65 20 7d 20 69 + 66 2d 65 6c 73 65 0a + + ~ " } if-else ; make-immediate" + 20 20 7d 20 69 66 2d 65 6c 73 65 20 3b 20 6d 61 + 6b 65 2d 69 6d 6d 65 64 69 61 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This runs instead of "interpret" in code under the hex" + ~ " transform. The" + 7e 20 20 20 54 68 69 73 20 72 75 6e 73 20 69 6e + 73 74 65 61 64 20 6f 66 20 22 69 6e 74 65 72 70 + 72 65 74 22 20 69 6e 20 63 6f 64 65 20 75 6e 64 + 65 72 20 74 68 65 20 68 65 78 20 74 72 61 6e 73 + 66 6f 72 6d 2e 20 54 68 65 0a + + ~ "~ proximate effect of that is to make "include" work. Note," + ~ " however, that this" + 7e 20 70 72 6f 78 69 6d 61 74 65 20 65 66 66 65 + 63 74 20 6f 66 20 74 68 61 74 20 69 73 20 74 6f + 20 6d 61 6b 65 20 22 69 6e 63 6c 75 64 65 22 20 + 77 6f 72 6b 2e 20 4e 6f 74 65 2c 20 68 6f 77 65 + 76 65 72 2c 20 74 68 61 74 20 74 68 69 73 0a + + ~ "~ replacement only applies directly under the hex" + ~ " transform. It isn't a" + 7e 20 72 65 70 6c 61 63 65 6d 65 6e 74 20 6f 6e + 6c 79 20 61 70 70 6c 69 65 73 20 64 69 72 65 63 + 74 6c 79 20 75 6e 64 65 72 20 74 68 65 20 68 65 + 78 20 74 72 61 6e 73 66 6f 72 6d 2e 20 49 74 20 + 69 73 6e 27 74 20 61 0a + + ~ "~ sensible approach under the log-load transform at all," + ~ " and under the label" + 7e 20 73 65 6e 73 69 62 6c 65 20 61 70 70 72 6f + 61 63 68 20 75 6e 64 65 72 20 74 68 65 20 6c 6f + 67 2d 6c 6f 61 64 20 74 72 61 6e 73 66 6f 72 6d + 20 61 74 20 61 6c 6c 2c 20 61 6e 64 20 75 6e 64 + 65 72 20 74 68 65 20 6c 61 62 65 6c 0a + + ~ "~ transform it would have such strange behavior that it" + ~ " isn't a good idea" + 7e 20 74 72 61 6e 73 66 6f 72 6d 20 69 74 20 77 + 6f 75 6c 64 20 68 61 76 65 20 73 75 63 68 20 73 + 74 72 61 6e 67 65 20 62 65 68 61 76 69 6f 72 20 + 74 68 61 74 20 69 74 20 69 73 6e 27 74 20 61 20 + 67 6f 6f 64 20 69 64 65 61 0a + + ~ "~ either." + 7e 20 65 69 74 68 65 72 2e 0a + + ~ ": hex-interpret-replacement" + 3a 20 68 65 78 2d 69 6e 74 65 72 70 72 65 74 2d + 72 65 70 6c 61 63 65 6d 65 6e 74 0a + + ~ " ~ This is a forward reference, so we need to look it up." + 20 20 7e 20 54 68 69 73 20 69 73 20 61 20 66 6f + 72 77 61 72 64 20 72 65 66 65 72 65 6e 63 65 2c + 20 73 6f 20 77 65 20 6e 65 65 64 20 74 6f 20 6c + 6f 6f 6b 20 69 74 20 75 70 2e 0a + + ~ " s" hex-transform-one"" + 20 20 73 22 20 68 65 78 2d 74 72 61 6e 73 66 6f + 72 6d 2d 6f 6e 65 22 0a + + ~ " swap-transform-variables find swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 20 66 69 6e 64 20 + 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d 2d 76 + 61 72 69 61 62 6c 65 73 0a + + ~ " entry-to-execution-token execute" + 20 20 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 + 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 78 65 63 75 + 74 65 0a + + ~ "" + 0a + + ~ " ~ We ignore the EOF indication, on the assumption" + ~ " something else will" + 20 20 7e 20 20 20 57 65 20 69 67 6e 6f 72 65 20 + 74 68 65 20 45 4f 46 20 69 6e 64 69 63 61 74 69 + 6f 6e 2c 20 6f 6e 20 74 68 65 20 61 73 73 75 6d + 70 74 69 6f 6e 20 73 6f 6d 65 74 68 69 6e 67 20 + 65 6c 73 65 20 77 69 6c 6c 0a + + ~ " ~ detect it and return to the outer loop, the one that's" + ~ " ours. For example," + 20 20 7e 20 64 65 74 65 63 74 20 69 74 20 61 6e + 64 20 72 65 74 75 72 6e 20 74 6f 20 74 68 65 20 + 6f 75 74 65 72 20 6c 6f 6f 70 2c 20 74 68 65 20 + 6f 6e 65 20 74 68 61 74 27 73 20 6f 75 72 73 2e + 20 46 6f 72 20 65 78 61 6d 70 6c 65 2c 0a + + ~ " ~ look at "include", in language/dynamic/files.e." + 20 20 7e 20 6c 6f 6f 6b 20 61 74 20 22 69 6e 63 + 6c 75 64 65 22 2c 20 69 6e 20 6c 61 6e 67 75 61 + 67 65 2f 64 79 6e 61 6d 69 63 2f 66 69 6c 65 73 + 2e 65 2e 0a + + ~ " drop ;" + 20 20 64 72 6f 70 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This installs hex-interpret-replacement, compiling it" + ~ " in compile mode and" + 7e 20 20 20 54 68 69 73 20 69 6e 73 74 61 6c 6c + 73 20 68 65 78 2d 69 6e 74 65 72 70 72 65 74 2d + 72 65 70 6c 61 63 65 6d 65 6e 74 2c 20 63 6f 6d + 70 69 6c 69 6e 67 20 69 74 20 69 6e 20 63 6f 6d + 70 69 6c 65 20 6d 6f 64 65 20 61 6e 64 0a + + ~ "~ executing it in immediate mode." + 7e 20 65 78 65 63 75 74 69 6e 67 20 69 74 20 69 + 6e 20 69 6d 6d 65 64 69 61 74 65 20 6d 6f 64 65 + 2e 0a + + ~ ": hex-interpret-alternate" + 3a 20 68 65 78 2d 69 6e 74 65 72 70 72 65 74 2d + 61 6c 74 65 72 6e 61 74 65 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " ' hex-interpret-replacement entry-to-execution-token ," + 20 20 20 20 27 20 68 65 78 2d 69 6e 74 65 72 70 + 72 65 74 2d 72 65 70 6c 61 63 65 6d 65 6e 74 20 + 65 6e 74 72 79 2d 74 6f 2d 65 78 65 63 75 74 69 + 6f 6e 2d 74 6f 6b 65 6e 20 2c 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " hex-interpret-replacement" + 20 20 20 20 68 65 78 2d 69 6e 74 65 72 70 72 65 + 74 2d 72 65 70 6c 61 63 65 6d 65 6e 74 0a + + ~ " } if-else ; make-immediate" + 20 20 7d 20 69 66 2d 65 6c 73 65 20 3b 20 6d 61 + 6b 65 2d 69 6d 6d 65 64 69 61 74 65 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This implements the hex transform for a single word. It" + ~ " is directly" + 7e 20 20 20 54 68 69 73 20 69 6d 70 6c 65 6d 65 + 6e 74 73 20 74 68 65 20 68 65 78 20 74 72 61 6e + 73 66 6f 72 6d 20 66 6f 72 20 61 20 73 69 6e 67 + 6c 65 20 77 6f 72 64 2e 20 49 74 20 69 73 20 64 + 69 72 65 63 74 6c 79 0a + + ~ "~ analogous to "interpret", and reading" + ~ " language/dynamic/interpret.e may help" + 7e 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 22 + 69 6e 74 65 72 70 72 65 74 22 2c 20 61 6e 64 20 + 72 65 61 64 69 6e 67 20 6c 61 6e 67 75 61 67 65 + 2f 64 79 6e 61 6d 69 63 2f 69 6e 74 65 72 70 72 + 65 74 2e 65 20 6d 61 79 20 68 65 6c 70 0a + + ~ "~ in understanding it, though it's meant to still make" + ~ " sense on its own." + 7e 20 69 6e 20 75 6e 64 65 72 73 74 61 6e 64 69 + 6e 67 20 69 74 2c 20 74 68 6f 75 67 68 20 69 74 + 27 73 20 6d 65 61 6e 74 20 74 6f 20 73 74 69 6c + 6c 20 6d 61 6b 65 20 73 65 6e 73 65 20 6f 6e 20 + 69 74 73 20 6f 77 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The hex transform runs code immediately. Whereas most" + ~ " transforms alter" + 7e 20 20 20 54 68 65 20 68 65 78 20 74 72 61 6e + 73 66 6f 72 6d 20 72 75 6e 73 20 63 6f 64 65 20 + 69 6d 6d 65 64 69 61 74 65 6c 79 2e 20 57 68 65 + 72 65 61 73 20 6d 6f 73 74 20 74 72 61 6e 73 66 + 6f 72 6d 73 20 61 6c 74 65 72 0a + + ~ "~ what the transformed code compiles into, the hex" + ~ " transform alters what it" + 7e 20 77 68 61 74 20 74 68 65 20 74 72 61 6e 73 + 66 6f 72 6d 65 64 20 63 6f 64 65 20 63 6f 6d 70 + 69 6c 65 73 20 69 6e 74 6f 2c 20 74 68 65 20 68 + 65 78 20 74 72 61 6e 73 66 6f 72 6d 20 61 6c 74 + 65 72 73 20 77 68 61 74 20 69 74 0a + + ~ "~ outputs. It's assumed that the output is a binary file of" + ~ " some sort; the" + 7e 20 6f 75 74 70 75 74 73 2e 20 49 74 27 73 20 + 61 73 73 75 6d 65 64 20 74 68 61 74 20 74 68 65 + 20 6f 75 74 70 75 74 20 69 73 20 61 20 62 69 6e + 61 72 79 20 66 69 6c 65 20 6f 66 20 73 6f 6d 65 + 20 73 6f 72 74 3b 20 74 68 65 0a + + ~ "~ binary is output as hexadecimal, interspersed with" + ~ " comments describing the" + 7e 20 62 69 6e 61 72 79 20 69 73 20 6f 75 74 70 + 75 74 20 61 73 20 68 65 78 61 64 65 63 69 6d 61 + 6c 2c 20 69 6e 74 65 72 73 70 65 72 73 65 64 20 + 77 69 74 68 20 63 6f 6d 6d 65 6e 74 73 20 64 65 + 73 63 72 69 62 69 6e 67 20 74 68 65 0a + + ~ "~ code that produced it, including descriptions of what was" + ~ " executed, along" + 7e 20 63 6f 64 65 20 74 68 61 74 20 70 72 6f 64 + 75 63 65 64 20 69 74 2c 20 69 6e 63 6c 75 64 69 + 6e 67 20 64 65 73 63 72 69 70 74 69 6f 6e 73 20 + 6f 66 20 77 68 61 74 20 77 61 73 20 65 78 65 63 + 75 74 65 64 2c 20 61 6c 6f 6e 67 0a + + ~ "~ with any comments from the original code." + 7e 20 77 69 74 68 20 61 6e 79 20 63 6f 6d 6d 65 + 6e 74 73 20 66 72 6f 6d 20 74 68 65 20 6f 72 69 + 67 69 6e 61 6c 20 63 6f 64 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The hex transform's alternates take priority over words" + ~ " defined under" + 7e 20 20 20 54 68 65 20 68 65 78 20 74 72 61 6e + 73 66 6f 72 6d 27 73 20 61 6c 74 65 72 6e 61 74 + 65 73 20 74 61 6b 65 20 70 72 69 6f 72 69 74 79 + 20 6f 76 65 72 20 77 6f 72 64 73 20 64 65 66 69 + 6e 65 64 20 75 6e 64 65 72 0a + + ~ "~ the transform when running immediately, but for" + ~ " compilation, words defined" + 7e 20 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 20 + 77 68 65 6e 20 72 75 6e 6e 69 6e 67 20 69 6d 6d + 65 64 69 61 74 65 6c 79 2c 20 62 75 74 20 66 6f + 72 20 63 6f 6d 70 69 6c 61 74 69 6f 6e 2c 20 77 + 6f 72 64 73 20 64 65 66 69 6e 65 64 0a + + ~ "~ under the transform take precedence. In the event that" + ~ " neither an alternate" + 7e 20 75 6e 64 65 72 20 74 68 65 20 74 72 61 6e + 73 66 6f 72 6d 20 74 61 6b 65 20 70 72 65 63 65 + 64 65 6e 63 65 2e 20 49 6e 20 74 68 65 20 65 76 + 65 6e 74 20 74 68 61 74 20 6e 65 69 74 68 65 72 + 20 61 6e 20 61 6c 74 65 72 6e 61 74 65 0a + + ~ "~ nor an entry in the inner dictionary is found, the outer" + ~ " dictionary is" + 7e 20 6e 6f 72 20 61 6e 20 65 6e 74 72 79 20 69 + 6e 20 74 68 65 20 69 6e 6e 65 72 20 64 69 63 74 + 69 6f 6e 61 72 79 20 69 73 20 66 6f 75 6e 64 2c + 20 74 68 65 20 6f 75 74 65 72 20 64 69 63 74 69 + 6f 6e 61 72 79 20 69 73 0a + + ~ "~ checked; otherwise it's irrelevant." + 7e 20 63 68 65 63 6b 65 64 3b 20 6f 74 68 65 72 + 77 69 73 65 20 69 74 27 73 20 69 72 72 65 6c 65 + 76 61 6e 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The point of this precedence rule is that string" + ~ " literals, which require" + 7e 20 20 20 54 68 65 20 70 6f 69 6e 74 20 6f 66 + 20 74 68 69 73 20 70 72 65 63 65 64 65 6e 63 65 + 20 72 75 6c 65 20 69 73 20 74 68 61 74 20 73 74 + 72 69 6e 67 20 6c 69 74 65 72 61 6c 73 2c 20 77 + 68 69 63 68 20 72 65 71 75 69 72 65 0a + + ~ "~ special treatment, will be using the inner implementation" + ~ " by the time it" + 7e 20 73 70 65 63 69 61 6c 20 74 72 65 61 74 6d + 65 6e 74 2c 20 77 69 6c 6c 20 62 65 20 75 73 69 + 6e 67 20 74 68 65 20 69 6e 6e 65 72 20 69 6d 70 + 6c 65 6d 65 6e 74 61 74 69 6f 6e 20 62 79 20 74 + 68 65 20 74 69 6d 65 20 69 74 0a + + ~ "~ gets to actually generating an executable image. It's" + ~ " important that there" + 7e 20 67 65 74 73 20 74 6f 20 61 63 74 75 61 6c + 6c 79 20 67 65 6e 65 72 61 74 69 6e 67 20 61 6e + 20 65 78 65 63 75 74 61 62 6c 65 20 69 6d 61 67 + 65 2e 20 49 74 27 73 20 69 6d 70 6f 72 74 61 6e + 74 20 74 68 61 74 20 74 68 65 72 65 0a + + ~ "~ not be any alternates altering the generated code, only" + ~ " the program actually" + 7e 20 6e 6f 74 20 62 65 20 61 6e 79 20 61 6c 74 + 65 72 6e 61 74 65 73 20 61 6c 74 65 72 69 6e 67 + 20 74 68 65 20 67 65 6e 65 72 61 74 65 64 20 63 + 6f 64 65 2c 20 6f 6e 6c 79 20 74 68 65 20 70 72 + 6f 67 72 61 6d 20 61 63 74 75 61 6c 6c 79 0a + + ~ "~ being compiled. Other literal syntaxes, such as tick," + ~ " don't have alternates" + 7e 20 62 65 69 6e 67 20 63 6f 6d 70 69 6c 65 64 + 2e 20 4f 74 68 65 72 20 6c 69 74 65 72 61 6c 20 + 73 79 6e 74 61 78 65 73 2c 20 73 75 63 68 20 61 + 73 20 74 69 63 6b 2c 20 64 6f 6e 27 74 20 68 61 + 76 65 20 61 6c 74 65 72 6e 61 74 65 73 0a + + ~ "~ at all (the hex transform manages to be more parsimonious" + ~ " with alternates" + 7e 20 61 74 20 61 6c 6c 20 28 74 68 65 20 68 65 + 78 20 74 72 61 6e 73 66 6f 72 6d 20 6d 61 6e 61 + 67 65 73 20 74 6f 20 62 65 20 6d 6f 72 65 20 70 + 61 72 73 69 6d 6f 6e 69 6f 75 73 20 77 69 74 68 + 20 61 6c 74 65 72 6e 61 74 65 73 0a + + ~ "~ than other transforms), and will always be using inner" + ~ " versions." + 7e 20 74 68 61 6e 20 6f 74 68 65 72 20 74 72 61 + 6e 73 66 6f 72 6d 73 29 2c 20 61 6e 64 20 77 69 + 6c 6c 20 61 6c 77 61 79 73 20 62 65 20 75 73 69 + 6e 67 20 69 6e 6e 65 72 20 76 65 72 73 69 6f 6e + 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The precedence rule does fail to have the desired" + ~ " effect for label" + 7e 20 20 20 54 68 65 20 70 72 65 63 65 64 65 6e + 63 65 20 72 75 6c 65 20 64 6f 65 73 20 66 61 69 + 6c 20 74 6f 20 68 61 76 65 20 74 68 65 20 64 65 + 73 69 72 65 64 20 65 66 66 65 63 74 20 66 6f 72 + 20 6c 61 62 65 6c 0a + + ~ "~ references. For these, the alternates take the unusual" + ~ " step of manually" + 7e 20 72 65 66 65 72 65 6e 63 65 73 2e 20 46 6f + 72 20 74 68 65 73 65 2c 20 74 68 65 20 61 6c 74 + 65 72 6e 61 74 65 73 20 74 61 6b 65 20 74 68 65 + 20 75 6e 75 73 75 61 6c 20 73 74 65 70 20 6f 66 + 20 6d 61 6e 75 61 6c 6c 79 0a + + ~ "~ calling the inner versions when they exist." + 7e 20 63 61 6c 6c 69 6e 67 20 74 68 65 20 69 6e + 6e 65 72 20 76 65 72 73 69 6f 6e 73 20 77 68 65 + 6e 20 74 68 65 79 20 65 78 69 73 74 2e 0a + + ~ "~ TODO think through whether the precedence rule is" + ~ " actually doing anything..." + 7e 20 54 4f 44 4f 20 74 68 69 6e 6b 20 74 68 72 + 6f 75 67 68 20 77 68 65 74 68 65 72 20 74 68 65 + 20 70 72 65 63 65 64 65 6e 63 65 20 72 75 6c 65 + 20 69 73 20 61 63 74 75 61 6c 6c 79 20 64 6f 69 + 6e 67 20 61 6e 79 74 68 69 6e 67 2e 2e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ It expects to be called from "hex-transform", below," + ~ " which loops." + 7e 20 49 74 20 65 78 70 65 63 74 73 20 74 6f 20 + 62 65 20 63 61 6c 6c 65 64 20 66 72 6f 6d 20 22 + 68 65 78 2d 74 72 61 6e 73 66 6f 72 6d 22 2c 20 + 62 65 6c 6f 77 2c 20 77 68 69 63 68 20 6c 6f 6f + 70 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (-- done)" + 7e 20 28 2d 2d 20 64 6f 6e 65 29 0a + + ~ ": hex-transform-one" + 3a 20 68 65 78 2d 74 72 61 6e 73 66 6f 72 6d 2d + 6f 6e 65 0a + + ~ " hex-skip-space" + 20 20 68 65 78 2d 73 6b 69 70 2d 73 70 61 63 65 + 0a + + ~ " word" + 20 20 77 6f 72 64 0a + + ~ "" + 0a + + ~ " ~ If no word was returned, end the transformation." + 20 20 7e 20 49 66 20 6e 6f 20 77 6f 72 64 20 77 + 61 73 20 72 65 74 75 72 6e 65 64 2c 20 65 6e 64 + 20 74 68 65 20 74 72 61 6e 73 66 6f 72 6d 61 74 + 69 6f 6e 2e 0a + + ~ " dup 0 = { drop 1 exit } if" + 20 20 64 75 70 20 30 20 3d 20 7b 20 64 72 6f 70 + 20 31 20 65 78 69 74 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " ~ The string is on the top of the stack, so to get a" + ~ " pointer to it we get" + 20 20 7e 20 54 68 65 20 73 74 72 69 6e 67 20 69 + 73 20 6f 6e 20 74 68 65 20 74 6f 70 20 6f 66 20 + 74 68 65 20 73 74 61 63 6b 2c 20 73 6f 20 74 6f + 20 67 65 74 20 61 20 70 6f 69 6e 74 65 72 20 74 + 6f 20 69 74 20 77 65 20 67 65 74 0a + + ~ " ~ the stack address." + 20 20 7e 20 74 68 65 20 73 74 61 63 6b 20 61 64 + 64 72 65 73 73 2e 0a + + ~ " ~ (string)" + 20 20 7e 20 28 73 74 72 69 6e 67 29 0a + + ~ " value@" + 20 20 76 61 6c 75 65 40 0a + + ~ "" + 0a + + ~ " ~ If it's anything but tilde, set the input state flag" + ~ " accordingly." + 20 20 7e 20 49 66 20 69 74 27 73 20 61 6e 79 74 + 68 69 6e 67 20 62 75 74 20 74 69 6c 64 65 2c 20 + 73 65 74 20 74 68 65 20 69 6e 70 75 74 20 73 74 + 61 74 65 20 66 6c 61 67 20 61 63 63 6f 72 64 69 + 6e 67 6c 79 2e 0a + + ~ " dup s" ~" stringcmp 0 != { 1" + ~ " has-non-space-this-input-line! } if" + 20 20 64 75 70 20 73 22 20 7e 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 21 3d 20 7b 20 31 20 68 + 61 73 2d 6e 6f 6e 2d 73 70 61 63 65 2d 74 68 69 + 73 2d 69 6e 70 75 74 2d 6c 69 6e 65 21 20 7d 20 + 69 66 0a + + ~ "" + 0a + + ~ " ~ Check whether it's one of the words we have" + ~ " alternates for, and look up" + 20 20 7e 20 20 20 43 68 65 63 6b 20 77 68 65 74 + 68 65 72 20 69 74 27 73 20 6f 6e 65 20 6f 66 20 + 74 68 65 20 77 6f 72 64 73 20 77 65 20 68 61 76 + 65 20 61 6c 74 65 72 6e 61 74 65 73 20 66 6f 72 + 2c 20 61 6e 64 20 6c 6f 6f 6b 20 75 70 0a + + ~ " ~ the alternate if so." + 20 20 7e 20 74 68 65 20 61 6c 74 65 72 6e 61 74 + 65 20 69 66 20 73 6f 2e 0a + + ~ " 0 swap" + 20 20 30 20 73 77 61 70 0a + + ~ " ~ (name as stack string, placeholder, name pointer)" + 20 20 7e 20 28 6e 61 6d 65 20 61 73 20 73 74 61 + 63 6b 20 73 74 72 69 6e 67 2c 20 70 6c 61 63 65 + 68 6f 6c 64 65 72 2c 20 6e 61 6d 65 20 70 6f 69 + 6e 74 65 72 29 0a + + ~ " dup s" self-codeword" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 73 65 6c 66 2d 63 6f + 64 65 77 6f 72 64 22 20 73 74 72 69 6e 67 63 6d + 70 20 30 20 3d 20 7b 0a + + ~ " swap drop ' hex-self-codeword-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 68 65 78 2d 73 65 6c 66 2d 63 6f 64 65 77 6f 72 + 64 2d 61 6c 74 65 72 6e 61 74 65 20 73 77 61 70 + 20 7d 20 69 66 0a + + ~ " ~ It is nontrivial to construct a string with a" + ~ " double-quote in it." + 20 20 7e 20 49 74 20 69 73 20 6e 6f 6e 74 72 69 + 76 69 61 6c 20 74 6f 20 63 6f 6e 73 74 72 75 63 + 74 20 61 20 73 74 72 69 6e 67 20 77 69 74 68 20 + 61 20 64 6f 75 62 6c 65 2d 71 75 6f 74 65 20 69 + 6e 20 69 74 2e 0a + + ~ " dup ' s" entry-to-name stringcmp 0 = {" + 20 20 64 75 70 20 27 20 73 22 20 65 6e 74 72 79 + 2d 74 6f 2d 6e 61 6d 65 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 0a + + ~ " swap drop ' hex-string-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 68 65 78 2d 73 74 72 69 6e 67 2d 61 6c 74 65 72 + 6e 61 74 65 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " dup ' ." entry-to-name stringcmp 0 = {" + 20 20 64 75 70 20 27 20 2e 22 20 65 6e 74 72 79 + 2d 74 6f 2d 6e 61 6d 65 20 73 74 72 69 6e 67 63 + 6d 70 20 30 20 3d 20 7b 0a + + ~ " swap drop ' hex-dot-string-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 68 65 78 2d 64 6f 74 2d 73 74 72 69 6e 67 2d 61 + 6c 74 65 72 6e 61 74 65 20 73 77 61 70 20 7d 20 + 69 66 0a + + ~ " dup s" create" stringcmp 0 = { swap drop '" + ~ " hex-create-alternate swap } if" + 20 20 64 75 70 20 73 22 20 63 72 65 61 74 65 22 + 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b + 20 73 77 61 70 20 64 72 6f 70 20 27 20 68 65 78 + 2d 63 72 65 61 74 65 2d 61 6c 74 65 72 6e 61 74 + 65 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " dup s" :" stringcmp 0 = { swap drop ' hex-colon-alternate" + ~ " swap } if" + 20 20 64 75 70 20 73 22 20 3a 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 73 77 61 70 + 20 64 72 6f 70 20 27 20 68 65 78 2d 63 6f 6c 6f + 6e 2d 61 6c 74 65 72 6e 61 74 65 20 73 77 61 70 + 20 7d 20 69 66 0a + + ~ " dup s" ;" stringcmp 0 = { swap drop '" + ~ " hex-semicolon-alternate swap } if" + 20 20 64 75 70 20 73 22 20 3b 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 73 77 61 70 + 20 64 72 6f 70 20 27 20 68 65 78 2d 73 65 6d 69 + 63 6f 6c 6f 6e 2d 61 6c 74 65 72 6e 61 74 65 20 + 73 77 61 70 20 7d 20 69 66 0a + + ~ " dup s" ;asm" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 3b 61 73 6d 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 0a + + ~ " swap drop ' hex-semicolon-assembly-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 68 65 78 2d 73 65 6d 69 63 6f 6c 6f 6e 2d 61 73 + 73 65 6d 62 6c 79 2d 61 6c 74 65 72 6e 61 74 65 + 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " dup s" L@'" stringcmp 0 = { swap drop ' hex-L@'-alternate" + ~ " swap } if" + 20 20 64 75 70 20 73 22 20 4c 40 27 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 73 77 + 61 70 20 64 72 6f 70 20 27 20 68 65 78 2d 4c 40 + 27 2d 61 6c 74 65 72 6e 61 74 65 20 73 77 61 70 + 20 7d 20 69 66 0a + + ~ " dup s" L!'" stringcmp 0 = { swap drop ' hex-L!'-alternate" + ~ " swap } if" + 20 20 64 75 70 20 73 22 20 4c 21 27 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 73 77 + 61 70 20 64 72 6f 70 20 27 20 68 65 78 2d 4c 21 + 27 2d 61 6c 74 65 72 6e 61 74 65 20 73 77 61 70 + 20 7d 20 69 66 0a + + ~ " dup s" bye" stringcmp 0 = { swap drop ' hex-bye-alternate" + ~ " swap } if" + 20 20 64 75 70 20 73 22 20 62 79 65 22 20 73 74 + 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 73 77 + 61 70 20 64 72 6f 70 20 27 20 68 65 78 2d 62 79 + 65 2d 61 6c 74 65 72 6e 61 74 65 20 73 77 61 70 + 20 7d 20 69 66 0a + + ~ " dup s" allocate" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 61 6c 6c 6f 63 61 74 + 65 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d + 20 7b 0a + + ~ " swap drop ' hex-allocate-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 68 65 78 2d 61 6c 6c 6f 63 61 74 65 2d 61 6c 74 + 65 72 6e 61 74 65 20 73 77 61 70 20 7d 20 69 66 + 0a + + ~ " dup s" memcopy" stringcmp 0 = { swap drop '" + ~ " hex-memcopy-alternate swap } if" + 20 20 64 75 70 20 73 22 20 6d 65 6d 63 6f 70 79 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 73 77 61 70 20 64 72 6f 70 20 27 20 68 65 + 78 2d 6d 65 6d 63 6f 70 79 2d 61 6c 74 65 72 6e + 61 74 65 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " dup s" memmove" stringcmp 0 = { swap drop '" + ~ " hex-memmove-alternate swap } if" + 20 20 64 75 70 20 73 22 20 6d 65 6d 6d 6f 76 65 + 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 + 7b 20 73 77 61 70 20 64 72 6f 70 20 27 20 68 65 + 78 2d 6d 65 6d 6d 6f 76 65 2d 61 6c 74 65 72 6e + 61 74 65 20 73 77 61 70 20 7d 20 69 66 0a + + ~ " dup s" word" stringcmp 0 = { swap drop '" + ~ " hex-word-alternate swap } if" + 20 20 64 75 70 20 73 22 20 77 6f 72 64 22 20 73 + 74 72 69 6e 67 63 6d 70 20 30 20 3d 20 7b 20 73 + 77 61 70 20 64 72 6f 70 20 27 20 68 65 78 2d 77 + 6f 72 64 2d 61 6c 74 65 72 6e 61 74 65 20 73 77 + 61 70 20 7d 20 69 66 0a + + ~ " dup s" ~" stringcmp 0 = { swap drop ' hex-tilde-alternate" + ~ " swap } if" + 20 20 64 75 70 20 73 22 20 7e 22 20 73 74 72 69 + 6e 67 63 6d 70 20 30 20 3d 20 7b 20 73 77 61 70 + 20 64 72 6f 70 20 27 20 68 65 78 2d 74 69 6c 64 + 65 2d 61 6c 74 65 72 6e 61 74 65 20 73 77 61 70 + 20 7d 20 69 66 0a + + ~ " dup s" interpret" stringcmp 0 = {" + 20 20 64 75 70 20 73 22 20 69 6e 74 65 72 70 72 + 65 74 22 20 73 74 72 69 6e 67 63 6d 70 20 30 20 + 3d 20 7b 0a + + ~ " swap drop ' hex-interpret-alternate swap } if" + 20 20 20 20 73 77 61 70 20 64 72 6f 70 20 27 20 + 68 65 78 2d 69 6e 74 65 72 70 72 65 74 2d 61 6c + 74 65 72 6e 61 74 65 20 73 77 61 70 20 7d 20 69 + 66 0a + + ~ " ~ (name as stack string, 0 or alternate entry pointer," + ~ " name pointer)" + 20 20 7e 20 28 6e 61 6d 65 20 61 73 20 73 74 61 + 63 6b 20 73 74 72 69 6e 67 2c 20 30 20 6f 72 20 + 61 6c 74 65 72 6e 61 74 65 20 65 6e 74 72 79 20 + 70 6f 69 6e 74 65 72 2c 20 6e 61 6d 65 20 70 6f + 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " find" + 20 20 66 69 6e 64 0a + + ~ " ~ (stack string, 0 or alternate entry pointer, 0 or inner" + ~ " entry pointer)" + 20 20 7e 20 28 73 74 61 63 6b 20 73 74 72 69 6e + 67 2c 20 30 20 6f 72 20 61 6c 74 65 72 6e 61 74 + 65 20 65 6e 74 72 79 20 70 6f 69 6e 74 65 72 2c + 20 30 20 6f 72 20 69 6e 6e 65 72 20 65 6e 74 72 + 79 20 70 6f 69 6e 74 65 72 29 0a + + ~ "" + 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d 66 6c + 61 67 73 20 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " ~ We're in compile mode. An alternate immediate entry" + ~ " has the highest" + 20 20 20 20 7e 20 57 65 27 72 65 20 69 6e 20 63 + 6f 6d 70 69 6c 65 20 6d 6f 64 65 2e 20 41 6e 20 + 61 6c 74 65 72 6e 61 74 65 20 69 6d 6d 65 64 69 + 61 74 65 20 65 6e 74 72 79 20 68 61 73 20 74 68 + 65 20 68 69 67 68 65 73 74 0a + + ~ " ~ precedence; an inner entry of any kind has" + ~ " second-highest." + 20 20 20 20 7e 20 70 72 65 63 65 64 65 6e 63 65 + 3b 20 61 6e 20 69 6e 6e 65 72 20 65 6e 74 72 79 + 20 6f 66 20 61 6e 79 20 6b 69 6e 64 20 68 61 73 + 20 73 65 63 6f 6e 64 2d 68 69 67 68 65 73 74 2e + 0a + + ~ " over {" + 20 20 20 20 6f 76 65 72 20 7b 0a + + ~ " ~ An alternate entry exists; check its flags." + 20 20 20 20 20 20 7e 20 41 6e 20 61 6c 74 65 72 + 6e 61 74 65 20 65 6e 74 72 79 20 65 78 69 73 74 + 73 3b 20 63 68 65 63 6b 20 69 74 73 20 66 6c 61 + 67 73 2e 0a + + ~ " over entry-flags@ 0x01 & {" + 20 20 20 20 20 20 6f 76 65 72 20 65 6e 74 72 79 + 2d 66 6c 61 67 73 40 20 30 78 30 31 20 26 20 7b + 0a + + ~ " ~ It's an immediate entry, so it has precedence," + ~ " regardless of" + 20 20 20 20 20 20 20 20 7e 20 20 20 49 74 27 73 + 20 61 6e 20 69 6d 6d 65 64 69 61 74 65 20 65 6e + 74 72 79 2c 20 73 6f 20 69 74 20 68 61 73 20 70 + 72 65 63 65 64 65 6e 63 65 2c 20 72 65 67 61 72 + 64 6c 65 73 73 20 6f 66 0a + + ~ " ~ what's up with the inner entry. Execute it." + 20 20 20 20 20 20 20 20 7e 20 77 68 61 74 27 73 + 20 75 70 20 77 69 74 68 20 74 68 65 20 69 6e 6e + 65 72 20 65 6e 74 72 79 2e 20 45 78 65 63 75 74 + 65 20 69 74 2e 0a + + ~ " drop dropstring-with-result" + 20 20 20 20 20 20 20 20 64 72 6f 70 20 64 72 6f + 70 73 74 72 69 6e 67 2d 77 69 74 68 2d 72 65 73 + 75 6c 74 0a + + ~ " entry-to-execution-token execute" + 20 20 20 20 20 20 20 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 65 78 65 63 75 74 65 0a + + ~ " 0 exit" + 20 20 20 20 20 20 20 20 30 20 65 78 69 74 0a + + ~ " } {" + 20 20 20 20 20 20 7d 20 7b 0a + + ~ " ~ The alternate is not immediate, so check if" + ~ " there's an inner entry." + 20 20 20 20 20 20 20 20 7e 20 54 68 65 20 61 6c + 74 65 72 6e 61 74 65 20 69 73 20 6e 6f 74 20 69 + 6d 6d 65 64 69 61 74 65 2c 20 73 6f 20 63 68 65 + 63 6b 20 69 66 20 74 68 65 72 65 27 73 20 61 6e + 20 69 6e 6e 65 72 20 65 6e 74 72 79 2e 0a + + ~ " dup {" + 20 20 20 20 20 20 20 20 64 75 70 20 7b 0a + + ~ " ~ There is also an inner entry. Check its flags." + 20 20 20 20 20 20 20 20 20 20 7e 20 54 68 65 72 + 65 20 69 73 20 61 6c 73 6f 20 61 6e 20 69 6e 6e + 65 72 20 65 6e 74 72 79 2e 20 43 68 65 63 6b 20 + 69 74 73 20 66 6c 61 67 73 2e 0a + + ~ " dup entry-flags@ 0x01 & {" + 20 20 20 20 20 20 20 20 20 20 64 75 70 20 65 6e + 74 72 79 2d 66 6c 61 67 73 40 20 30 78 30 31 20 + 26 20 7b 0a + + ~ " ~ The inner entry is immediate, so it has" + ~ " precedence. Execute it." + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 54 68 + 65 20 69 6e 6e 65 72 20 65 6e 74 72 79 20 69 73 + 20 69 6d 6d 65 64 69 61 74 65 2c 20 73 6f 20 69 + 74 20 68 61 73 20 70 72 65 63 65 64 65 6e 63 65 + 2e 20 45 78 65 63 75 74 65 20 69 74 2e 0a + + ~ " swap drop dropstring-with-result" + 20 20 20 20 20 20 20 20 20 20 20 20 73 77 61 70 + 20 64 72 6f 70 20 64 72 6f 70 73 74 72 69 6e 67 + 2d 77 69 74 68 2d 72 65 73 75 6c 74 0a + + ~ " entry-to-execution-token execute" + 20 20 20 20 20 20 20 20 20 20 20 20 65 6e 74 72 + 79 2d 74 6f 2d 65 78 65 63 75 74 69 6f 6e 2d 74 + 6f 6b 65 6e 20 65 78 65 63 75 74 65 0a + + ~ " 0 exit" + 20 20 20 20 20 20 20 20 20 20 20 20 30 20 65 78 + 69 74 0a + + ~ " } {" + 20 20 20 20 20 20 20 20 20 20 7d 20 7b 0a + + ~ " ~ The inner entry is not immediate, so the" + ~ " alternate has" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 20 20 + 54 68 65 20 69 6e 6e 65 72 20 65 6e 74 72 79 20 + 69 73 20 6e 6f 74 20 69 6d 6d 65 64 69 61 74 65 + 2c 20 73 6f 20 74 68 65 20 61 6c 74 65 72 6e 61 + 74 65 20 68 61 73 0a + + ~ " ~ precedence. Compile it." + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 70 72 + 65 63 65 64 65 6e 63 65 2e 20 43 6f 6d 70 69 6c + 65 20 69 74 2e 0a + + ~ " ~" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 0a + + ~ " ~ Watch this space closely for correctness" + ~ " issues, it's a rare" + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 20 20 + 57 61 74 63 68 20 74 68 69 73 20 73 70 61 63 65 + 20 63 6c 6f 73 65 6c 79 20 66 6f 72 20 63 6f 72 + 72 65 63 74 6e 65 73 73 20 69 73 73 75 65 73 2c + 20 69 74 27 73 20 61 20 72 61 72 65 0a + + ~ " ~ codepath." + 20 20 20 20 20 20 20 20 20 20 20 20 7e 20 63 6f + 64 65 70 61 74 68 2e 0a + + ~ " drop dropstring-with-result" + 20 20 20 20 20 20 20 20 20 20 20 20 64 72 6f 70 + 20 64 72 6f 70 73 74 72 69 6e 67 2d 77 69 74 68 + 2d 72 65 73 75 6c 74 0a + + ~ " entry-to-execution-token ," + 20 20 20 20 20 20 20 20 20 20 20 20 65 6e 74 72 + 79 2d 74 6f 2d 65 78 65 63 75 74 69 6f 6e 2d 74 + 6f 6b 65 6e 20 2c 0a + + ~ " 0 exit" + 20 20 20 20 20 20 20 20 20 20 20 20 30 20 65 78 + 69 74 0a + + ~ " } if-else" + 20 20 20 20 20 20 20 20 20 20 7d 20 69 66 2d 65 + 6c 73 65 0a + + ~ " } {" + 20 20 20 20 20 20 20 20 7d 20 7b 0a + + ~ " ~ There's no inner entry. Compile the alternate." + 20 20 20 20 20 20 20 20 20 20 7e 20 54 68 65 72 + 65 27 73 20 6e 6f 20 69 6e 6e 65 72 20 65 6e 74 + 72 79 2e 20 43 6f 6d 70 69 6c 65 20 74 68 65 20 + 61 6c 74 65 72 6e 61 74 65 2e 0a + + ~ " ~" + 20 20 20 20 20 20 20 20 20 20 7e 0a + + ~ " ~ This path, too, is rare and should get close" + ~ " scrutiny for" + 20 20 20 20 20 20 20 20 20 20 7e 20 20 20 54 68 + 69 73 20 70 61 74 68 2c 20 74 6f 6f 2c 20 69 73 + 20 72 61 72 65 20 61 6e 64 20 73 68 6f 75 6c 64 + 20 67 65 74 20 63 6c 6f 73 65 20 73 63 72 75 74 + 69 6e 79 20 66 6f 72 0a + + ~ " ~ correctness." + 20 20 20 20 20 20 20 20 20 20 7e 20 63 6f 72 72 + 65 63 74 6e 65 73 73 2e 0a + + ~ " drop dropstring-with-result" + 20 20 20 20 20 20 20 20 20 20 64 72 6f 70 20 64 + 72 6f 70 73 74 72 69 6e 67 2d 77 69 74 68 2d 72 + 65 73 75 6c 74 0a + + ~ " entry-to-execution-token ," + 20 20 20 20 20 20 20 20 20 20 65 6e 74 72 79 2d + 74 6f 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b + 65 6e 20 2c 0a + + ~ " 0 exit" + 20 20 20 20 20 20 20 20 20 20 30 20 65 78 69 74 + 0a + + ~ " } if-else" + 20 20 20 20 20 20 20 20 7d 20 69 66 2d 65 6c 73 + 65 0a + + ~ " } if-else" + 20 20 20 20 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " } {" + 20 20 20 20 7d 20 7b 0a + + ~ " ~ There is no alternate entry; check for an inner" + ~ " entry." + 20 20 20 20 20 20 7e 20 54 68 65 72 65 20 69 73 + 20 6e 6f 20 61 6c 74 65 72 6e 61 74 65 20 65 6e + 74 72 79 3b 20 63 68 65 63 6b 20 66 6f 72 20 61 + 6e 20 69 6e 6e 65 72 20 65 6e 74 72 79 2e 0a + + ~ " dup {" + 20 20 20 20 20 20 64 75 70 20 7b 0a + + ~ " ~ An inner entry exists; check its flags." + 20 20 20 20 20 20 20 20 7e 20 41 6e 20 69 6e 6e + 65 72 20 65 6e 74 72 79 20 65 78 69 73 74 73 3b + 20 63 68 65 63 6b 20 69 74 73 20 66 6c 61 67 73 + 2e 0a + + ~ " dup entry-flags@ 0x01 & {" + 20 20 20 20 20 20 20 20 64 75 70 20 65 6e 74 72 + 79 2d 66 6c 61 67 73 40 20 30 78 30 31 20 26 20 + 7b 0a + + ~ " ~ It's an immediate entry. Execute it." + 20 20 20 20 20 20 20 20 20 20 7e 20 49 74 27 73 + 20 61 6e 20 69 6d 6d 65 64 69 61 74 65 20 65 6e + 74 72 79 2e 20 45 78 65 63 75 74 65 20 69 74 2e + 0a + + ~ " swap drop dropstring-with-result" + 20 20 20 20 20 20 20 20 20 20 73 77 61 70 20 64 + 72 6f 70 20 64 72 6f 70 73 74 72 69 6e 67 2d 77 + 69 74 68 2d 72 65 73 75 6c 74 0a + + ~ " entry-to-execution-token execute" + 20 20 20 20 20 20 20 20 20 20 65 6e 74 72 79 2d + 74 6f 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b + 65 6e 20 65 78 65 63 75 74 65 0a + + ~ " 0 exit" + 20 20 20 20 20 20 20 20 20 20 30 20 65 78 69 74 + 0a + + ~ " } {" + 20 20 20 20 20 20 20 20 7d 20 20 7b 0a + + ~ " ~ It's not an immediate entry. Compile it." + 20 20 20 20 20 20 20 20 20 20 7e 20 49 74 27 73 + 20 6e 6f 74 20 61 6e 20 69 6d 6d 65 64 69 61 74 + 65 20 65 6e 74 72 79 2e 20 43 6f 6d 70 69 6c 65 + 20 69 74 2e 0a + + ~ " swap drop dropstring-with-result" + 20 20 20 20 20 20 20 20 20 20 73 77 61 70 20 64 + 72 6f 70 20 64 72 6f 70 73 74 72 69 6e 67 2d 77 + 69 74 68 2d 72 65 73 75 6c 74 0a + + ~ " entry-to-execution-token ," + 20 20 20 20 20 20 20 20 20 20 65 6e 74 72 79 2d + 74 6f 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b + 65 6e 20 2c 0a + + ~ " 0 exit" + 20 20 20 20 20 20 20 20 20 20 30 20 65 78 69 74 + 0a + + ~ " } if-else" + 20 20 20 20 20 20 20 20 7d 20 69 66 2d 65 6c 73 + 65 0a + + ~ " } if" + 20 20 20 20 20 20 7d 20 69 66 0a + + ~ " ~ If we got here, there's no inner or alternate" + ~ " entry; fall through." + 20 20 20 20 20 20 7e 20 49 66 20 77 65 20 67 6f + 74 20 68 65 72 65 2c 20 74 68 65 72 65 27 73 20 + 6e 6f 20 69 6e 6e 65 72 20 6f 72 20 61 6c 74 65 + 72 6e 61 74 65 20 65 6e 74 72 79 3b 20 66 61 6c + 6c 20 74 68 72 6f 75 67 68 2e 0a + + ~ " } if-else" + 20 20 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " ~ We're in immediate mode. An alternate entry of any" + ~ " kind has precedence." + 20 20 20 20 7e 20 57 65 27 72 65 20 69 6e 20 69 + 6d 6d 65 64 69 61 74 65 20 6d 6f 64 65 2e 20 41 + 6e 20 61 6c 74 65 72 6e 61 74 65 20 65 6e 74 72 + 79 20 6f 66 20 61 6e 79 20 6b 69 6e 64 20 68 61 + 73 20 70 72 65 63 65 64 65 6e 63 65 2e 0a + + ~ " over {" + 20 20 20 20 6f 76 65 72 20 7b 0a + + ~ " ~ There's an alternate entry. Execute it." + 20 20 20 20 20 20 7e 20 54 68 65 72 65 27 73 20 + 61 6e 20 61 6c 74 65 72 6e 61 74 65 20 65 6e 74 + 72 79 2e 20 45 78 65 63 75 74 65 20 69 74 2e 0a + + ~ " drop dropstring-with-result" + 20 20 20 20 20 20 64 72 6f 70 20 64 72 6f 70 73 + 74 72 69 6e 67 2d 77 69 74 68 2d 72 65 73 75 6c + 74 0a + + ~ " entry-to-execution-token execute" + 20 20 20 20 20 20 65 6e 74 72 79 2d 74 6f 2d 65 + 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 20 65 + 78 65 63 75 74 65 0a + + ~ " 0 exit" + 20 20 20 20 20 20 30 20 65 78 69 74 0a + + ~ " } {" + 20 20 20 20 7d 20 7b 0a + + ~ " ~ There's no alternate entry. Check for an inner" + ~ " entry." + 20 20 20 20 20 20 7e 20 54 68 65 72 65 27 73 20 + 6e 6f 20 61 6c 74 65 72 6e 61 74 65 20 65 6e 74 + 72 79 2e 20 43 68 65 63 6b 20 66 6f 72 20 61 6e + 20 69 6e 6e 65 72 20 65 6e 74 72 79 2e 0a + + ~ " dup {" + 20 20 20 20 20 20 64 75 70 20 7b 0a + + ~ " ~ An inner entry exists. Execute it." + 20 20 20 20 20 20 20 20 7e 20 41 6e 20 69 6e 6e + 65 72 20 65 6e 74 72 79 20 65 78 69 73 74 73 2e + 20 45 78 65 63 75 74 65 20 69 74 2e 0a + + ~ " swap drop dropstring-with-result" + 20 20 20 20 20 20 20 20 73 77 61 70 20 64 72 6f + 70 20 64 72 6f 70 73 74 72 69 6e 67 2d 77 69 74 + 68 2d 72 65 73 75 6c 74 0a + + ~ " entry-to-execution-token execute" + 20 20 20 20 20 20 20 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 20 65 78 65 63 75 74 65 0a + + ~ " 0 exit" + 20 20 20 20 20 20 20 20 30 20 65 78 69 74 0a + + ~ " } if" + 20 20 20 20 20 20 7d 20 69 66 0a + + ~ " ~ If we got here, there's no inner or alternate; fall" + ~ " through." + 20 20 20 20 20 20 7e 20 49 66 20 77 65 20 67 6f + 74 20 68 65 72 65 2c 20 74 68 65 72 65 27 73 20 + 6e 6f 20 69 6e 6e 65 72 20 6f 72 20 61 6c 74 65 + 72 6e 61 74 65 3b 20 66 61 6c 6c 20 74 68 72 6f + 75 67 68 2e 0a + + ~ " } if-else" + 20 20 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " } if-else" + 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " drop drop" + 20 20 64 72 6f 70 20 64 72 6f 70 0a + + ~ " ~ (stack string)" + 20 20 7e 20 28 73 74 61 63 6b 20 73 74 72 69 6e + 67 29 0a + + ~ "" + 0a + + ~ " ~ As a final fallback, we also check the outer" + ~ " dictionary, for immediate" + 20 20 7e 20 20 20 41 73 20 61 20 66 69 6e 61 6c + 20 66 61 6c 6c 62 61 63 6b 2c 20 77 65 20 61 6c + 73 6f 20 63 68 65 63 6b 20 74 68 65 20 6f 75 74 + 65 72 20 64 69 63 74 69 6f 6e 61 72 79 2c 20 66 + 6f 72 20 69 6d 6d 65 64 69 61 74 65 0a + + ~ " ~ use only. This will allow things like assembly words to" + ~ " work." + 20 20 7e 20 75 73 65 20 6f 6e 6c 79 2e 20 54 68 + 69 73 20 77 69 6c 6c 20 61 6c 6c 6f 77 20 74 68 + 69 6e 67 73 20 6c 69 6b 65 20 61 73 73 65 6d 62 + 6c 79 20 77 6f 72 64 73 20 74 6f 20 77 6f 72 6b + 2e 0a + + ~ " value@" + 20 20 76 61 6c 75 65 40 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " find" + 20 20 66 69 6e 64 0a + + ~ " swap-transform-variables" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 0a + + ~ " dup {" + 20 20 64 75 70 20 7b 0a + + ~ " ~ There's an outer entry; check the mode." + 20 20 20 20 7e 20 54 68 65 72 65 27 73 20 61 6e + 20 6f 75 74 65 72 20 65 6e 74 72 79 3b 20 63 68 + 65 63 6b 20 74 68 65 20 6d 6f 64 65 2e 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d + 66 6c 61 67 73 20 40 20 30 78 30 31 20 26 20 7b + 0a + + ~ " ~ We're in compile mode; check the outer entry's" + ~ " flags." + 20 20 20 20 20 20 7e 20 57 65 27 72 65 20 69 6e + 20 63 6f 6d 70 69 6c 65 20 6d 6f 64 65 3b 20 63 + 68 65 63 6b 20 74 68 65 20 6f 75 74 65 72 20 65 + 6e 74 72 79 27 73 20 66 6c 61 67 73 2e 0a + + ~ " dup entry-flags@ 0x01 & {" + 20 20 20 20 20 20 64 75 70 20 65 6e 74 72 79 2d + 66 6c 61 67 73 40 20 30 78 30 31 20 26 20 7b 0a + + ~ " ~ It's an immediate word; execute it." + 20 20 20 20 20 20 20 20 7e 20 49 74 27 73 20 61 + 6e 20 69 6d 6d 65 64 69 61 74 65 20 77 6f 72 64 + 3b 20 65 78 65 63 75 74 65 20 69 74 2e 0a + + ~ " dropstring-with-result" + 20 20 20 20 20 20 20 20 64 72 6f 70 73 74 72 69 + 6e 67 2d 77 69 74 68 2d 72 65 73 75 6c 74 0a + + ~ " entry-to-execution-token" + 20 20 20 20 20 20 20 20 65 6e 74 72 79 2d 74 6f + 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e + 0a + + ~ " execute" + 20 20 20 20 20 20 20 20 65 78 65 63 75 74 65 0a + + ~ " 0 exit" + 20 20 20 20 20 20 20 20 30 20 65 78 69 74 0a + + ~ " } {" + 20 20 20 20 20 20 7d 20 7b 0a + + ~ " ~ It's not an immediate word. Pretend it doesn't" + ~ " exist, and fall" + 20 20 20 20 20 20 20 20 7e 20 20 20 49 74 27 73 + 20 6e 6f 74 20 61 6e 20 69 6d 6d 65 64 69 61 74 + 65 20 77 6f 72 64 2e 20 50 72 65 74 65 6e 64 20 + 69 74 20 64 6f 65 73 6e 27 74 20 65 78 69 73 74 + 2c 20 61 6e 64 20 66 61 6c 6c 0a + + ~ " ~ through." + 20 20 20 20 20 20 20 20 7e 20 74 68 72 6f 75 67 + 68 2e 0a + + ~ " drop" + 20 20 20 20 20 20 20 20 64 72 6f 70 0a + + ~ " } if-else" + 20 20 20 20 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " } {" + 20 20 20 20 7d 20 7b 0a + + ~ " ~ We're in immediate mode. Execute the outer entry." + 20 20 20 20 20 20 7e 20 57 65 27 72 65 20 69 6e + 20 69 6d 6d 65 64 69 61 74 65 20 6d 6f 64 65 2e + 20 45 78 65 63 75 74 65 20 74 68 65 20 6f 75 74 + 65 72 20 65 6e 74 72 79 2e 0a + + ~ " dropstring-with-result" + 20 20 20 20 20 20 64 72 6f 70 73 74 72 69 6e 67 + 2d 77 69 74 68 2d 72 65 73 75 6c 74 0a + + ~ " entry-to-execution-token" + 20 20 20 20 20 20 65 6e 74 72 79 2d 74 6f 2d 65 + 78 65 63 75 74 69 6f 6e 2d 74 6f 6b 65 6e 0a + + ~ " execute" + 20 20 20 20 20 20 65 78 65 63 75 74 65 0a + + ~ " 0 exit" + 20 20 20 20 20 20 30 20 65 78 69 74 0a + + ~ " } if-else" + 20 20 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " } {" + 20 20 7d 20 7b 0a + + ~ " ~ There's no outer entry. Fall through." + 20 20 20 20 7e 20 54 68 65 72 65 27 73 20 6e 6f + 20 6f 75 74 65 72 20 65 6e 74 72 79 2e 20 46 61 + 6c 6c 20 74 68 72 6f 75 67 68 2e 0a + + ~ " drop" + 20 20 20 20 64 72 6f 70 0a + + ~ " } if-else" + 20 20 7d 20 69 66 2d 65 6c 73 65 0a + + ~ " ~ (stack string)" + 20 20 7e 20 28 73 74 61 63 6b 20 73 74 72 69 6e + 67 29 0a + + ~ "" + 0a + + ~ " ~ Check whether it's a number literal." + 20 20 7e 20 43 68 65 63 6b 20 77 68 65 74 68 65 + 72 20 69 74 27 73 20 61 20 6e 75 6d 62 65 72 20 + 6c 69 74 65 72 61 6c 2e 0a + + ~ " value@ read-integer 0 = {" + 20 20 76 61 6c 75 65 40 20 72 65 61 64 2d 69 6e + 74 65 67 65 72 20 30 20 3d 20 7b 0a + + ~ " ~ It's a number." + 20 20 20 20 7e 20 49 74 27 73 20 61 20 6e 75 6d + 62 65 72 2e 0a + + ~ " ~" + 20 20 20 20 7e 0a + + ~ " ~ (name as stack string, integer value)" + 20 20 20 20 7e 20 28 6e 61 6d 65 20 61 73 20 73 + 74 61 63 6b 20 73 74 72 69 6e 67 2c 20 69 6e 74 + 65 67 65 72 20 76 61 6c 75 65 29 0a + + ~ " dropstring-with-result" + 20 20 20 20 64 72 6f 70 73 74 72 69 6e 67 2d 77 + 69 74 68 2d 72 65 73 75 6c 74 0a + + ~ " ~ (integer value)" + 20 20 20 20 7e 20 28 69 6e 74 65 67 65 72 20 76 + 61 6c 75 65 29 0a + + ~ "" + 0a + + ~ " interpreter-flags @ 0x01 & {" + 20 20 20 20 69 6e 74 65 72 70 72 65 74 65 72 2d + 66 6c 61 67 73 20 40 20 30 78 30 31 20 26 20 7b + 0a + + ~ " ~ TODO this probably needs a lit alternate (!)" + 20 20 20 20 20 20 7e 20 54 4f 44 4f 20 74 68 69 + 73 20 70 72 6f 62 61 62 6c 79 20 6e 65 65 64 73 + 20 61 20 6c 69 74 20 61 6c 74 65 72 6e 61 74 65 + 20 28 21 29 0a + + ~ " ' lit entry-to-execution-token , ," + 20 20 20 20 20 20 27 20 6c 69 74 20 65 6e 74 72 + 79 2d 74 6f 2d 65 78 65 63 75 74 69 6f 6e 2d 74 + 6f 6b 65 6e 20 2c 20 2c 0a + + ~ " 0 exit" + 20 20 20 20 20 20 30 20 65 78 69 74 0a + + ~ " } if" + 20 20 20 20 7d 20 69 66 0a + + ~ "" + 0a + + ~ " 0 exit" + 20 20 20 20 30 20 65 78 69 74 0a + + ~ " } if" + 20 20 7d 20 69 66 0a + + ~ " ~ (stack string)" + 20 20 7e 20 28 73 74 61 63 6b 20 73 74 72 69 6e + 67 29 0a + + ~ "" + 0a + + ~ " ." No such word: " value@ emitstring newline dropstring 0" + ~ " ;" + 20 20 2e 22 20 4e 6f 20 73 75 63 68 20 77 6f 72 + 64 3a 20 22 20 76 61 6c 75 65 40 20 65 6d 69 74 + 73 74 72 69 6e 67 20 6e 65 77 6c 69 6e 65 20 64 + 72 6f 70 73 74 72 69 6e 67 20 30 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This implements the hex transform for all words in a" + ~ " region given as" + 7e 20 20 20 54 68 69 73 20 69 6d 70 6c 65 6d 65 + 6e 74 73 20 74 68 65 20 68 65 78 20 74 72 61 6e + 73 66 6f 72 6d 20 66 6f 72 20 61 6c 6c 20 77 6f + 72 64 73 20 69 6e 20 61 20 72 65 67 69 6f 6e 20 + 67 69 76 65 6e 20 61 73 0a + + ~ "~ an input string. It is directly analogous to "quit", in" + 7e 20 61 6e 20 69 6e 70 75 74 20 73 74 72 69 6e + 67 2e 20 49 74 20 69 73 20 64 69 72 65 63 74 6c + 79 20 61 6e 61 6c 6f 67 6f 75 73 20 74 6f 20 22 + 71 75 69 74 22 2c 20 69 6e 0a + + ~ "~ language/dynamic/interpret.e, but is more complex." + 7e 20 6c 61 6e 67 75 61 67 65 2f 64 79 6e 61 6d + 69 63 2f 69 6e 74 65 72 70 72 65 74 2e 65 2c 20 + 62 75 74 20 69 73 20 6d 6f 72 65 20 63 6f 6d 70 + 6c 65 78 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (output metadata buffer start, output buffer start," + ~ " output point," + 7e 20 28 6f 75 74 70 75 74 20 6d 65 74 61 64 61 + 74 61 20 62 75 66 66 65 72 20 73 74 61 72 74 2c + 20 6f 75 74 70 75 74 20 62 75 66 66 65 72 20 73 + 74 61 72 74 2c 20 6f 75 74 70 75 74 20 70 6f 69 + 6e 74 2c 0a + + ~ "~ input string pointer -- output buffer start, output" + ~ " point)" + 7e 20 20 69 6e 70 75 74 20 73 74 72 69 6e 67 20 + 70 6f 69 6e 74 65 72 20 2d 2d 20 6f 75 74 70 75 + 74 20 62 75 66 66 65 72 20 73 74 61 72 74 2c 20 + 6f 75 74 70 75 74 20 70 6f 69 6e 74 29 0a + + ~ ": hex-transform" + 3a 20 68 65 78 2d 74 72 61 6e 73 66 6f 72 6d 0a + + ~ " main-input-buffer dup push-input-buffer" + 20 20 6d 61 69 6e 2d 69 6e 70 75 74 2d 62 75 66 + 66 65 72 20 64 75 70 20 70 75 73 68 2d 69 6e 70 + 75 74 2d 62 75 66 66 65 72 0a + + ~ " swap attach-string-to-input-buffer" + 20 20 73 77 61 70 20 61 74 74 61 63 68 2d 73 74 + 72 69 6e 67 2d 74 6f 2d 69 6e 70 75 74 2d 62 75 + 66 66 65 72 0a + + ~ " ~ (output metadata buffer start, output buffer start," + ~ " output point)" + 20 20 7e 20 28 6f 75 74 70 75 74 20 6d 65 74 61 + 64 61 74 61 20 62 75 66 66 65 72 20 73 74 61 72 + 74 2c 20 6f 75 74 70 75 74 20 62 75 66 66 65 72 + 20 73 74 61 72 74 2c 20 6f 75 74 70 75 74 20 70 + 6f 69 6e 74 29 0a + + ~ "" + 0a + + ~ " ~ Save the old values of "here" and "latest", and set" + ~ " the initial values" + 20 20 7e 20 20 20 53 61 76 65 20 74 68 65 20 6f + 6c 64 20 76 61 6c 75 65 73 20 6f 66 20 22 68 65 + 72 65 22 20 61 6e 64 20 22 6c 61 74 65 73 74 22 + 2c 20 61 6e 64 20 73 65 74 20 74 68 65 20 69 6e + 69 74 69 61 6c 20 76 61 6c 75 65 73 0a + + ~ " ~ of the internal ones. These values need to persist" + ~ " across iterations," + 20 20 7e 20 6f 66 20 74 68 65 20 69 6e 74 65 72 + 6e 61 6c 20 6f 6e 65 73 2e 20 54 68 65 73 65 20 + 76 61 6c 75 65 73 20 6e 65 65 64 20 74 6f 20 70 + 65 72 73 69 73 74 20 61 63 72 6f 73 73 20 69 74 + 65 72 61 74 69 6f 6e 73 2c 0a + + ~ " ~ since client code will make its own updates to them and" + ~ " then rely on those" + 20 20 7e 20 73 69 6e 63 65 20 63 6c 69 65 6e 74 + 20 63 6f 64 65 20 77 69 6c 6c 20 6d 61 6b 65 20 + 69 74 73 20 6f 77 6e 20 75 70 64 61 74 65 73 20 + 74 6f 20 74 68 65 6d 20 61 6e 64 20 74 68 65 6e + 20 72 65 6c 79 20 6f 6e 20 74 68 6f 73 65 0a + + ~ " ~ updates having taken effect. So we do the swap just" + ~ " once, here outside the" + 20 20 7e 20 75 70 64 61 74 65 73 20 68 61 76 69 + 6e 67 20 74 61 6b 65 6e 20 65 66 66 65 63 74 2e + 20 53 6f 20 77 65 20 64 6f 20 74 68 65 20 73 77 + 61 70 20 6a 75 73 74 20 6f 6e 63 65 2c 20 68 65 + 72 65 20 6f 75 74 73 69 64 65 20 74 68 65 0a + + ~ " ~ loop, and set it back when the loop ends." + 20 20 7e 20 6c 6f 6f 70 2c 20 61 6e 64 20 73 65 + 74 20 69 74 20 62 61 63 6b 20 77 68 65 6e 20 74 + 68 65 20 6c 6f 6f 70 20 65 6e 64 73 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ We also take this opportunity to initialize the other" + ~ " fields of" + 20 20 7e 20 20 20 57 65 20 61 6c 73 6f 20 74 61 + 6b 65 20 74 68 69 73 20 6f 70 70 6f 72 74 75 6e + 69 74 79 20 74 6f 20 69 6e 69 74 69 61 6c 69 7a + 65 20 74 68 65 20 6f 74 68 65 72 20 66 69 65 6c + 64 73 20 6f 66 0a + + ~ " ~ transformation-state. While it might be nice to do" + ~ " these in some sort of" + 20 20 7e 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 + 6f 6e 2d 73 74 61 74 65 2e 20 57 68 69 6c 65 20 + 69 74 20 6d 69 67 68 74 20 62 65 20 6e 69 63 65 + 20 74 6f 20 64 6f 20 74 68 65 73 65 20 69 6e 20 + 73 6f 6d 65 20 73 6f 72 74 20 6f 66 0a + + ~ " ~ logical order, it gets unreadable quickly, so we" + ~ " initialize them in the" + 20 20 7e 20 6c 6f 67 69 63 61 6c 20 6f 72 64 65 + 72 2c 20 69 74 20 67 65 74 73 20 75 6e 72 65 61 + 64 61 62 6c 65 20 71 75 69 63 6b 6c 79 2c 20 73 + 6f 20 77 65 20 69 6e 69 74 69 61 6c 69 7a 65 20 + 74 68 65 6d 20 69 6e 20 74 68 65 0a + + ~ " ~ most convenient order given how we received our" + ~ " parameters." + 20 20 7e 20 6d 6f 73 74 20 63 6f 6e 76 65 6e 69 + 65 6e 74 20 6f 72 64 65 72 20 67 69 76 65 6e 20 + 68 6f 77 20 77 65 20 72 65 63 65 69 76 65 64 20 + 6f 75 72 20 70 61 72 61 6d 65 74 65 72 73 2e 0a + + ~ " here @ transformation-state" + ~ " transformation-state-saved-here !" + 20 20 68 65 72 65 20 40 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 + 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 + 74 65 2d 73 61 76 65 64 2d 68 65 72 65 20 21 0a + + ~ " latest @ transformation-state" + ~ " transformation-state-saved-latest !" + 20 20 6c 61 74 65 73 74 20 40 20 74 72 61 6e 73 + 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 + 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 + 74 61 74 65 2d 73 61 76 65 64 2d 6c 61 74 65 73 + 74 20 21 0a + + ~ " here !" + 20 20 68 65 72 65 20 21 0a + + ~ " 0 latest !" + 20 20 30 20 6c 61 74 65 73 74 20 21 0a + + ~ " transformation-state" + ~ " transformation-state-output-buffer-start !" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 62 75 66 66 65 72 2d 73 74 61 72 74 20 + 21 0a + + ~ " 0 transformation-state" + ~ " transformation-state-user-stack-depth !" + 20 20 30 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 + 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f + 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d 75 73 + 65 72 2d 73 74 61 63 6b 2d 64 65 70 74 68 20 21 + 0a + + ~ " transformation-state transformation-state-output-metadata" + ~ " !" + 20 20 74 72 61 6e 73 66 6f 72 6d 61 74 69 6f 6e + 2d 73 74 61 74 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 2d 6f 75 74 70 + 75 74 2d 6d 65 74 61 64 61 74 61 20 21 0a + + ~ " ~ Now the stack has nothing of ours on it, so client code" + ~ " can do its thing." + 20 20 7e 20 4e 6f 77 20 74 68 65 20 73 74 61 63 + 6b 20 68 61 73 20 6e 6f 74 68 69 6e 67 20 6f 66 + 20 6f 75 72 73 20 6f 6e 20 69 74 2c 20 73 6f 20 + 63 6c 69 65 6e 74 20 63 6f 64 65 20 63 61 6e 20 + 64 6f 20 69 74 73 20 74 68 69 6e 67 2e 0a + + ~ "" + 0a + + ~ " ~ We don't have the real values yet, so we can't create" + ~ " the initial" + 20 20 7e 20 20 20 57 65 20 64 6f 6e 27 74 20 68 + 61 76 65 20 74 68 65 20 72 65 61 6c 20 76 61 6c + 75 65 73 20 79 65 74 2c 20 73 6f 20 77 65 20 63 + 61 6e 27 74 20 63 72 65 61 74 65 20 74 68 65 20 + 69 6e 69 74 69 61 6c 0a + + ~ " ~ entries in the output metadata, but we can and should" + ~ " zero it out to make" + 20 20 7e 20 65 6e 74 72 69 65 73 20 69 6e 20 74 + 68 65 20 6f 75 74 70 75 74 20 6d 65 74 61 64 61 + 74 61 2c 20 62 75 74 20 77 65 20 63 61 6e 20 61 + 6e 64 20 73 68 6f 75 6c 64 20 7a 65 72 6f 20 69 + 74 20 6f 75 74 20 74 6f 20 6d 61 6b 65 0a + + ~ " ~ sure everything else operating on it finds it" + ~ " well-formed." + 20 20 7e 20 73 75 72 65 20 65 76 65 72 79 74 68 + 69 6e 67 20 65 6c 73 65 20 6f 70 65 72 61 74 69 + 6e 67 20 6f 6e 20 69 74 20 66 69 6e 64 73 20 69 + 74 20 77 65 6c 6c 2d 66 6f 72 6d 65 64 2e 0a + + ~ " zero-hex-output-metadata" + 20 20 7a 65 72 6f 2d 68 65 78 2d 6f 75 74 70 75 + 74 2d 6d 65 74 61 64 61 74 61 0a + + ~ "" + 0a + + ~ " ~ The code under the hex transform never gets a real" + ~ " copy of warm-start," + 20 20 7e 20 20 20 54 68 65 20 63 6f 64 65 20 75 + 6e 64 65 72 20 74 68 65 20 68 65 78 20 74 72 61 + 6e 73 66 6f 72 6d 20 6e 65 76 65 72 20 67 65 74 + 73 20 61 20 72 65 61 6c 20 63 6f 70 79 20 6f 66 + 20 77 61 72 6d 2d 73 74 61 72 74 2c 0a + + ~ " ~ so it doesn't have the globals "here" and so on. It" + ~ " wants to have the" + 20 20 7e 20 73 6f 20 69 74 20 64 6f 65 73 6e 27 + 74 20 68 61 76 65 20 74 68 65 20 67 6c 6f 62 61 + 6c 73 20 22 68 65 72 65 22 20 61 6e 64 20 73 6f + 20 6f 6e 2e 20 49 74 20 77 61 6e 74 73 20 74 6f + 20 68 61 76 65 20 74 68 65 0a + + ~ " ~ globals, but it can't, not without our help. Why aren't" + ~ " we helping?" + 20 20 7e 20 67 6c 6f 62 61 6c 73 2c 20 62 75 74 + 20 69 74 20 63 61 6e 27 74 2c 20 6e 6f 74 20 77 + 69 74 68 6f 75 74 20 6f 75 72 20 68 65 6c 70 2e + 20 57 68 79 20 61 72 65 6e 27 74 20 77 65 20 68 + 65 6c 70 69 6e 67 3f 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ Oh, right, we're helping right here. We just write" + ~ " them into the inner" + 20 20 7e 20 20 20 4f 68 2c 20 72 69 67 68 74 2c + 20 77 65 27 72 65 20 68 65 6c 70 69 6e 67 20 72 + 69 67 68 74 20 68 65 72 65 2e 20 20 57 65 20 6a + 75 73 74 20 77 72 69 74 65 20 74 68 65 6d 20 69 + 6e 74 6f 20 74 68 65 20 69 6e 6e 65 72 0a + + ~ " ~ log and dictionary directly, by using our outer copy of" + ~ " "variable". These" + 20 20 7e 20 6c 6f 67 20 61 6e 64 20 64 69 63 74 + 69 6f 6e 61 72 79 20 64 69 72 65 63 74 6c 79 2c + 20 62 79 20 75 73 69 6e 67 20 6f 75 72 20 6f 75 + 74 65 72 20 63 6f 70 79 20 6f 66 20 22 76 61 72 + 69 61 62 6c 65 22 2e 20 54 68 65 73 65 0a + + ~ " ~ definitions don't have to do anything special; we point" + ~ " them to the same" + 20 20 7e 20 64 65 66 69 6e 69 74 69 6f 6e 73 20 + 64 6f 6e 27 74 20 68 61 76 65 20 74 6f 20 64 6f + 20 61 6e 79 74 68 69 6e 67 20 73 70 65 63 69 61 + 6c 3b 20 77 65 20 70 6f 69 6e 74 20 74 68 65 6d + 20 74 6f 20 74 68 65 20 73 61 6d 65 0a + + ~ " ~ addresses as the outer ones. Note though that the" + ~ " actual values the" + 20 20 7e 20 61 64 64 72 65 73 73 65 73 20 61 73 + 20 74 68 65 20 6f 75 74 65 72 20 6f 6e 65 73 2e + 20 4e 6f 74 65 20 74 68 6f 75 67 68 20 74 68 61 + 74 20 74 68 65 20 61 63 74 75 61 6c 20 76 61 6c + 75 65 73 20 74 68 65 0a + + ~ " ~ transformed code sees sees are the wrapped, inner ones," + ~ " since we swapped" + 20 20 7e 20 74 72 61 6e 73 66 6f 72 6d 65 64 20 + 63 6f 64 65 20 73 65 65 73 20 73 65 65 73 20 61 + 72 65 20 74 68 65 20 77 72 61 70 70 65 64 2c 20 + 69 6e 6e 65 72 20 6f 6e 65 73 2c 20 73 69 6e 63 + 65 20 77 65 20 73 77 61 70 70 65 64 0a + + ~ " ~ the values out elsewhere." + 20 20 7e 20 74 68 65 20 76 61 6c 75 65 73 20 6f + 75 74 20 65 6c 73 65 77 68 65 72 65 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ If we provided these as alternates instead, that" + ~ " would work for code" + 20 20 7e 20 20 20 49 66 20 77 65 20 70 72 6f 76 + 69 64 65 64 20 74 68 65 73 65 20 61 73 20 61 6c + 74 65 72 6e 61 74 65 73 20 69 6e 73 74 65 61 64 + 2c 20 74 68 61 74 20 77 6f 75 6c 64 20 77 6f 72 + 6b 20 66 6f 72 20 63 6f 64 65 0a + + ~ " ~ that doesn't have a nested transform, but the inner" + ~ " transforms want to be" + 20 20 7e 20 74 68 61 74 20 64 6f 65 73 6e 27 74 + 20 68 61 76 65 20 61 20 6e 65 73 74 65 64 20 74 + 72 61 6e 73 66 6f 72 6d 2c 20 62 75 74 20 74 68 + 65 20 69 6e 6e 65 72 20 74 72 61 6e 73 66 6f 72 + 6d 73 20 77 61 6e 74 20 74 6f 20 62 65 0a + + ~ " ~ able to look them up by name." + 20 20 7e 20 61 62 6c 65 20 74 6f 20 6c 6f 6f 6b + 20 74 68 65 6d 20 75 70 20 62 79 20 6e 61 6d 65 + 2e 0a + + ~ " swap-transform-variables log swap-transform-variables s"" + ~ " log" variable" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 20 6c 6f 67 20 73 + 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d 2d 76 61 + 72 69 61 62 6c 65 73 20 73 22 20 6c 6f 67 22 20 + 76 61 72 69 61 62 6c 65 0a + + ~ " swap-transform-variables s0 swap-transform-variables s"" + ~ " s0" variable" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 20 73 30 20 73 77 + 61 70 2d 74 72 61 6e 73 66 6f 72 6d 2d 76 61 72 + 69 61 62 6c 65 73 20 73 22 20 73 30 22 20 76 61 + 72 69 61 62 6c 65 0a + + ~ " swap-transform-variables r0 swap-transform-variables s"" + ~ " r0" variable" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 20 72 30 20 73 77 + 61 70 2d 74 72 61 6e 73 66 6f 72 6d 2d 76 61 72 + 69 61 62 6c 65 73 20 73 22 20 72 30 22 20 76 61 + 72 69 61 62 6c 65 0a + + ~ " swap-transform-variables latest swap-transform-variables" + ~ " s" latest" variable" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 20 6c 61 74 65 73 + 74 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 20 73 22 20 6c 61 + 74 65 73 74 22 20 76 61 72 69 61 62 6c 65 0a + + ~ " swap-transform-variables here swap-transform-variables s"" + ~ " here" variable" + 20 20 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d + 2d 76 61 72 69 61 62 6c 65 73 20 68 65 72 65 20 + 73 77 61 70 2d 74 72 61 6e 73 66 6f 72 6d 2d 76 + 61 72 69 61 62 6c 65 73 20 73 22 20 68 65 72 65 + 22 20 76 61 72 69 61 62 6c 65 0a + + ~ "" + 0a + + ~ " ~ It's important that the stack has nothing of ours on" + ~ " it that persists" + 20 20 7e 20 20 20 49 74 27 73 20 69 6d 70 6f 72 + 74 61 6e 74 20 74 68 61 74 20 74 68 65 20 73 74 + 61 63 6b 20 68 61 73 20 6e 6f 74 68 69 6e 67 20 + 6f 66 20 6f 75 72 73 20 6f 6e 20 69 74 20 74 68 + 61 74 20 70 65 72 73 69 73 74 73 0a + + ~ " ~ across iterations, so that client code can add and" + ~ " remove stuff there as" + 20 20 7e 20 61 63 72 6f 73 73 20 69 74 65 72 61 + 74 69 6f 6e 73 2c 20 73 6f 20 74 68 61 74 20 63 + 6c 69 65 6e 74 20 63 6f 64 65 20 63 61 6e 20 61 + 64 64 20 61 6e 64 20 72 65 6d 6f 76 65 20 73 74 + 75 66 66 20 74 68 65 72 65 20 61 73 0a + + ~ " ~ it sees fit." + 20 20 7e 20 69 74 20 73 65 65 73 20 66 69 74 2e + 0a + + ~ " { hex-transform-one" + 20 20 7b 20 68 65 78 2d 74 72 61 6e 73 66 6f 72 + 6d 2d 6f 6e 65 0a + + ~ " ~ (done)" + 20 20 20 20 7e 20 28 64 6f 6e 65 29 0a + + ~ "" + 0a + + ~ " ~ When the loop is done, get the real values of "here"" + ~ " and "latest"" + 20 20 20 20 7e 20 20 57 68 65 6e 20 74 68 65 20 + 6c 6f 6f 70 20 69 73 20 64 6f 6e 65 2c 20 67 65 + 74 20 74 68 65 20 72 65 61 6c 20 76 61 6c 75 65 + 73 20 6f 66 20 22 68 65 72 65 22 20 61 6e 64 20 + 22 6c 61 74 65 73 74 22 0a + + ~ " ~ back. The internal "here" is also the output point," + ~ " and will become our" + 20 20 20 20 7e 20 62 61 63 6b 2e 20 54 68 65 20 + 69 6e 74 65 72 6e 61 6c 20 22 68 65 72 65 22 20 + 69 73 20 61 6c 73 6f 20 74 68 65 20 6f 75 74 70 + 75 74 20 70 6f 69 6e 74 2c 20 61 6e 64 20 77 69 + 6c 6c 20 62 65 63 6f 6d 65 20 6f 75 72 0a + + ~ " ~ return value. The internal "latest" is discarded." + 20 20 20 20 7e 20 72 65 74 75 72 6e 20 76 61 6c + 75 65 2e 20 54 68 65 20 69 6e 74 65 72 6e 61 6c + 20 22 6c 61 74 65 73 74 22 20 69 73 20 64 69 73 + 63 61 72 64 65 64 2e 0a + + ~ " { transformation-state" + ~ " transformation-state-output-buffer-start @" + 20 20 20 20 7b 20 74 72 61 6e 73 66 6f 72 6d 61 + 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 + 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d + 6f 75 74 70 75 74 2d 62 75 66 66 65 72 2d 73 74 + 61 72 74 20 40 0a + + ~ " here @" + 20 20 20 20 20 20 68 65 72 65 20 40 0a + + ~ " transformation-state transformation-state-saved-here" + ~ " @ here !" + 20 20 20 20 20 20 74 72 61 6e 73 66 6f 72 6d 61 + 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 + 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d + 73 61 76 65 64 2d 68 65 72 65 20 40 20 68 65 72 + 65 20 21 0a + + ~ " transformation-state" + ~ " transformation-state-saved-latest @ latest !" + 20 20 20 20 20 20 74 72 61 6e 73 66 6f 72 6d 61 + 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 6e 73 + 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 65 2d + 73 61 76 65 64 2d 6c 61 74 65 73 74 20 40 20 6c + 61 74 65 73 74 20 21 0a + + ~ " ~ (output point)" + 20 20 20 20 20 20 7e 20 28 6f 75 74 70 75 74 20 + 70 6f 69 6e 74 29 0a + + ~ "" + 0a + + ~ " ~ Though we don't actually use transformation-state" + ~ " outside of this" + 20 20 20 20 20 20 7e 20 20 20 54 68 6f 75 67 68 + 20 77 65 20 64 6f 6e 27 74 20 61 63 74 75 61 6c + 6c 79 20 75 73 65 20 74 72 61 6e 73 66 6f 72 6d + 61 74 69 6f 6e 2d 73 74 61 74 65 20 6f 75 74 73 + 69 64 65 20 6f 66 20 74 68 69 73 0a + + ~ " ~ invocation, for tidiness we zero it out." + 20 20 20 20 20 20 7e 20 69 6e 76 6f 63 61 74 69 + 6f 6e 2c 20 66 6f 72 20 74 69 64 69 6e 65 73 73 + 20 77 65 20 7a 65 72 6f 20 69 74 20 6f 75 74 2e + 0a + + ~ " 0 transformation-state" + ~ " transformation-state-saved-here !" + 20 20 20 20 20 20 30 20 74 72 61 6e 73 66 6f 72 + 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 + 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 + 65 2d 73 61 76 65 64 2d 68 65 72 65 20 21 0a + + ~ " 0 transformation-state" + ~ " transformation-state-saved-latest !" + 20 20 20 20 20 20 30 20 74 72 61 6e 73 66 6f 72 + 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 + 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 + 65 2d 73 61 76 65 64 2d 6c 61 74 65 73 74 20 21 + 0a + + ~ " 0 transformation-state" + ~ " transformation-state-output-buffer-start !" + 20 20 20 20 20 20 30 20 74 72 61 6e 73 66 6f 72 + 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 + 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 + 65 2d 6f 75 74 70 75 74 2d 62 75 66 66 65 72 2d + 73 74 61 72 74 20 21 0a + + ~ " 0 transformation-state" + ~ " transformation-state-user-stack-depth !" + 20 20 20 20 20 20 30 20 74 72 61 6e 73 66 6f 72 + 6d 61 74 69 6f 6e 2d 73 74 61 74 65 20 74 72 61 + 6e 73 66 6f 72 6d 61 74 69 6f 6e 2d 73 74 61 74 + 65 2d 75 73 65 72 2d 73 74 61 63 6b 2d 64 65 70 + 74 68 20 21 0a + + ~ "" + 0a + + ~ " ~ Also put the input source back how it was." + 20 20 20 20 20 20 7e 20 20 41 6c 73 6f 20 70 75 + 74 20 74 68 65 20 69 6e 70 75 74 20 73 6f 75 72 + 63 65 20 62 61 63 6b 20 68 6f 77 20 69 74 20 77 + 61 73 2e 0a + + ~ " main-input-buffer pop-input-buffer" + 20 20 20 20 20 20 6d 61 69 6e 2d 69 6e 70 75 74 + 2d 62 75 66 66 65 72 20 70 6f 70 2d 69 6e 70 75 + 74 2d 62 75 66 66 65 72 0a + + ~ "" + 0a + + ~ " exit } if } forever ;" + 20 20 20 20 20 20 65 78 69 74 20 7d 20 69 66 20 + 7d 20 66 6f 72 65 76 65 72 20 3b 0a + + ~ "" + 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 0a + + ~ "~ ~~ Execution model ~~" + 7e 20 7e 7e 20 45 78 65 63 75 74 69 6f 6e 20 6d + 6f 64 65 6c 20 7e 7e 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 0a + + ~ "~" + 7e 0a + + ~ "~ We use Forth-style dual stacks, one for values and one" + ~ " for control. We" + 7e 20 20 20 20 57 65 20 75 73 65 20 46 6f 72 74 + 68 2d 73 74 79 6c 65 20 64 75 61 6c 20 73 74 61 + 63 6b 73 2c 20 6f 6e 65 20 66 6f 72 20 76 61 6c + 75 65 73 20 61 6e 64 20 6f 6e 65 20 66 6f 72 20 + 63 6f 6e 74 72 6f 6c 2e 20 57 65 0a + + ~ "~ use rsp for values, just like C does. We use rbp for the" + ~ " control stack," + 7e 20 20 75 73 65 20 72 73 70 20 66 6f 72 20 76 + 61 6c 75 65 73 2c 20 6a 75 73 74 20 6c 69 6b 65 + 20 43 20 64 6f 65 73 2e 20 57 65 20 75 73 65 20 + 72 62 70 20 66 6f 72 20 74 68 65 20 63 6f 6e 74 + 72 6f 6c 20 73 74 61 63 6b 2c 0a + + ~ "~ which is a special Forth-y stack: These are pointers" + ~ " into the bodies of" + 7e 20 20 77 68 69 63 68 20 69 73 20 61 20 73 70 + 65 63 69 61 6c 20 46 6f 72 74 68 2d 79 20 73 74 + 61 63 6b 3a 20 54 68 65 73 65 20 61 72 65 20 70 + 6f 69 6e 74 65 72 73 20 69 6e 74 6f 20 74 68 65 + 20 62 6f 64 69 65 73 20 6f 66 0a + + ~ "~ Forth words, not return addresses." + 7e 20 20 46 6f 72 74 68 20 77 6f 72 64 73 2c 20 + 6e 6f 74 20 72 65 74 75 72 6e 20 61 64 64 72 65 + 73 73 65 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The choice of rsp and rbp for the stack pointers" + ~ " imitates Jonesforth;" + 7e 20 20 20 20 54 68 65 20 63 68 6f 69 63 65 20 + 6f 66 20 72 73 70 20 61 6e 64 20 72 62 70 20 66 + 6f 72 20 74 68 65 20 73 74 61 63 6b 20 70 6f 69 + 6e 74 65 72 73 20 69 6d 69 74 61 74 65 73 20 4a + 6f 6e 65 73 66 6f 72 74 68 3b 0a + + ~ "~ I'm hopeful that it gives us convenient addressing" + ~ " modes, and will report" + 7e 20 20 49 27 6d 20 68 6f 70 65 66 75 6c 20 74 + 68 61 74 20 69 74 20 67 69 76 65 73 20 75 73 20 + 63 6f 6e 76 65 6e 69 65 6e 74 20 61 64 64 72 65 + 73 73 69 6e 67 20 6d 6f 64 65 73 2c 20 61 6e 64 + 20 77 69 6c 6c 20 72 65 70 6f 72 74 0a + + ~ "~ back about that when I feel that I understand the" + ~ " implications." + 7e 20 20 62 61 63 6b 20 61 62 6f 75 74 20 74 68 + 61 74 20 77 68 65 6e 20 49 20 66 65 65 6c 20 74 + 68 61 74 20 49 20 75 6e 64 65 72 73 74 61 6e 64 + 20 74 68 65 20 69 6d 70 6c 69 63 61 74 69 6f 6e + 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ In Forth, everything is a "word", including mutable" + ~ " variables." + 7e 20 20 20 20 49 6e 20 46 6f 72 74 68 2c 20 65 + 76 65 72 79 74 68 69 6e 67 20 69 73 20 61 20 22 + 77 6f 72 64 22 2c 20 69 6e 63 6c 75 64 69 6e 67 + 20 6d 75 74 61 62 6c 65 20 76 61 72 69 61 62 6c + 65 73 2e 0a + + ~ "~ Conceptually, a word is a unit of execution, which may" + ~ " be implemented" + 7e 20 20 43 6f 6e 63 65 70 74 75 61 6c 6c 79 2c + 20 61 20 77 6f 72 64 20 69 73 20 61 20 75 6e 69 + 74 20 6f 66 20 65 78 65 63 75 74 69 6f 6e 2c 20 + 77 68 69 63 68 20 6d 61 79 20 62 65 20 69 6d 70 + 6c 65 6d 65 6e 74 65 64 0a + + ~ "~ either in machine code or as an array of pointer to" + ~ " other words." + 7e 20 20 65 69 74 68 65 72 20 69 6e 20 6d 61 63 + 68 69 6e 65 20 63 6f 64 65 20 6f 72 20 61 73 20 + 61 6e 20 61 72 72 61 79 20 6f 66 20 70 6f 69 6e + 74 65 72 20 74 6f 20 6f 74 68 65 72 20 77 6f 72 + 64 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ This polymorphism is implemented by having each word's" + ~ " contents begin" + 7e 20 20 20 20 54 68 69 73 20 70 6f 6c 79 6d 6f + 72 70 68 69 73 6d 20 69 73 20 69 6d 70 6c 65 6d + 65 6e 74 65 64 20 62 79 20 68 61 76 69 6e 67 20 + 65 61 63 68 20 77 6f 72 64 27 73 20 63 6f 6e 74 + 65 6e 74 73 20 62 65 67 69 6e 0a + + ~ "~ with a "codeword", which is a pointer to machine code" + ~ " that "interprets"" + 7e 20 20 77 69 74 68 20 61 20 22 63 6f 64 65 77 + 6f 72 64 22 2c 20 77 68 69 63 68 20 69 73 20 61 + 20 70 6f 69 6e 74 65 72 20 74 6f 20 6d 61 63 68 + 69 6e 65 20 63 6f 64 65 20 74 68 61 74 20 22 69 + 6e 74 65 72 70 72 65 74 73 22 0a + + ~ "~ the rest of the contents. In the case of words" + ~ " implemented in machine" + 7e 20 20 74 68 65 20 72 65 73 74 20 6f 66 20 74 + 68 65 20 63 6f 6e 74 65 6e 74 73 2e 20 49 6e 20 + 74 68 65 20 63 61 73 65 20 6f 66 20 77 6f 72 64 + 73 20 69 6d 70 6c 65 6d 65 6e 74 65 64 20 69 6e + 20 6d 61 63 68 69 6e 65 0a + + ~ "~ code, the codeword points directly to that code, which" + ~ " is normally right" + 7e 20 20 63 6f 64 65 2c 20 74 68 65 20 63 6f 64 + 65 77 6f 72 64 20 70 6f 69 6e 74 73 20 64 69 72 + 65 63 74 6c 79 20 74 6f 20 74 68 61 74 20 63 6f + 64 65 2c 20 77 68 69 63 68 20 69 73 20 6e 6f 72 + 6d 61 6c 6c 79 20 72 69 67 68 74 0a + + ~ "~ next to it." + 7e 20 20 6e 65 78 74 20 74 6f 20 69 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Variables, to Forth, are simply one more thing that" + ~ " can be executed; the" + 7e 20 20 20 20 56 61 72 69 61 62 6c 65 73 2c 20 + 74 6f 20 46 6f 72 74 68 2c 20 61 72 65 20 73 69 + 6d 70 6c 79 20 6f 6e 65 20 6d 6f 72 65 20 74 68 + 69 6e 67 20 74 68 61 74 20 63 61 6e 20 62 65 20 + 65 78 65 63 75 74 65 64 3b 20 74 68 65 0a + + ~ "~ effect of executing a variable is to push its address" + ~ " onto the value" + 7e 20 20 65 66 66 65 63 74 20 6f 66 20 65 78 65 + 63 75 74 69 6e 67 20 61 20 76 61 72 69 61 62 6c + 65 20 69 73 20 74 6f 20 70 75 73 68 20 69 74 73 + 20 61 64 64 72 65 73 73 20 6f 6e 74 6f 20 74 68 + 65 20 76 61 6c 75 65 0a + + ~ "~ stack." + 7e 20 20 73 74 61 63 6b 2e 0a + + ~ "~" + 7e 0a + + ~ "~ We adopt this model of words, codewords, and" + ~ " variables-as-words. It's" + 7e 20 20 20 20 57 65 20 61 64 6f 70 74 20 74 68 + 69 73 20 6d 6f 64 65 6c 20 6f 66 20 77 6f 72 64 + 73 2c 20 63 6f 64 65 77 6f 72 64 73 2c 20 61 6e + 64 20 76 61 72 69 61 62 6c 65 73 2d 61 73 2d 77 + 6f 72 64 73 2e 20 49 74 27 73 0a + + ~ "~ really nice how it doesn't force anything else on us," + ~ " not even a heap," + 7e 20 20 72 65 61 6c 6c 79 20 6e 69 63 65 20 68 + 6f 77 20 69 74 20 64 6f 65 73 6e 27 74 20 66 6f + 72 63 65 20 61 6e 79 74 68 69 6e 67 20 65 6c 73 + 65 20 6f 6e 20 75 73 2c 20 6e 6f 74 20 65 76 65 + 6e 20 61 20 68 65 61 70 2c 0a + + ~ "~ though we do end up using the log as a sort-of heap." + 7e 20 20 74 68 6f 75 67 68 20 77 65 20 64 6f 20 + 65 6e 64 20 75 70 20 75 73 69 6e 67 20 74 68 65 + 20 6c 6f 67 20 61 73 20 61 20 73 6f 72 74 2d 6f + 66 20 68 65 61 70 2e 0a + + ~ "~" + 7e 0a + + ~ "~ We specifically implement a version of calling and" + ~ " returning that Forth" + 7e 20 20 20 20 57 65 20 73 70 65 63 69 66 69 63 + 61 6c 6c 79 20 69 6d 70 6c 65 6d 65 6e 74 20 61 + 20 76 65 72 73 69 6f 6e 20 6f 66 20 63 61 6c 6c + 69 6e 67 20 61 6e 64 20 72 65 74 75 72 6e 69 6e + 67 20 74 68 61 74 20 46 6f 72 74 68 0a + + ~ "~ calls indirect threaded code: The control stack is a" + ~ " stack of pointers" + 7e 20 20 63 61 6c 6c 73 20 69 6e 64 69 72 65 63 + 74 20 74 68 72 65 61 64 65 64 20 63 6f 64 65 3a + 20 54 68 65 20 63 6f 6e 74 72 6f 6c 20 73 74 61 + 63 6b 20 69 73 20 61 20 73 74 61 63 6b 20 6f 66 + 20 70 6f 69 6e 74 65 72 73 0a + + ~ "~ into the middle of interpreted words. The interpreter" + ~ " snippet, called" + 7e 20 20 69 6e 74 6f 20 74 68 65 20 6d 69 64 64 + 6c 65 20 6f 66 20 69 6e 74 65 72 70 72 65 74 65 + 64 20 77 6f 72 64 73 2e 20 54 68 65 20 69 6e 74 + 65 72 70 72 65 74 65 72 20 73 6e 69 70 70 65 74 + 2c 20 63 61 6c 6c 65 64 0a + + ~ "~ docol, implements calling. Each word is responsible for" + ~ " making sure" + 7e 20 20 64 6f 63 6f 6c 2c 20 69 6d 70 6c 65 6d + 65 6e 74 73 20 63 61 6c 6c 69 6e 67 2e 20 20 45 + 61 63 68 20 77 6f 72 64 20 69 73 20 72 65 73 70 + 6f 6e 73 69 62 6c 65 20 66 6f 72 20 6d 61 6b 69 + 6e 67 20 73 75 72 65 0a + + ~ "~ returning works properly. Interpreted words accomplish" + ~ " this by ending with" + 7e 20 20 72 65 74 75 72 6e 69 6e 67 20 77 6f 72 + 6b 73 20 70 72 6f 70 65 72 6c 79 2e 20 49 6e 74 + 65 72 70 72 65 74 65 64 20 77 6f 72 64 73 20 61 + 63 63 6f 6d 70 6c 69 73 68 20 74 68 69 73 20 62 + 79 20 65 6e 64 69 6e 67 20 77 69 74 68 0a + + ~ "~ the word "exit", while machine-code words accomplish it" + ~ " by ending with a" + 7e 20 20 74 68 65 20 77 6f 72 64 20 22 65 78 69 + 74 22 2c 20 77 68 69 6c 65 20 6d 61 63 68 69 6e + 65 2d 63 6f 64 65 20 77 6f 72 64 73 20 61 63 63 + 6f 6d 70 6c 69 73 68 20 69 74 20 62 79 20 65 6e + 64 69 6e 67 20 77 69 74 68 20 61 0a + + ~ "~ verbatim snippet called "next"." + 7e 20 20 76 65 72 62 61 74 69 6d 20 73 6e 69 70 + 70 65 74 20 63 61 6c 6c 65 64 20 22 6e 65 78 74 + 22 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Conceptually, "next" returns, but more specifically it" + ~ " accomplishes this" + 7e 20 20 20 20 43 6f 6e 63 65 70 74 75 61 6c 6c + 79 2c 20 22 6e 65 78 74 22 20 72 65 74 75 72 6e + 73 2c 20 62 75 74 20 6d 6f 72 65 20 73 70 65 63 + 69 66 69 63 61 6c 6c 79 20 69 74 20 61 63 63 6f + 6d 70 6c 69 73 68 65 73 20 74 68 69 73 0a + + ~ "~ by doing the caller's next dispatch for it; thus control" + ~ " never actually" + 7e 20 20 62 79 20 64 6f 69 6e 67 20 74 68 65 20 + 63 61 6c 6c 65 72 27 73 20 6e 65 78 74 20 64 69 + 73 70 61 74 63 68 20 66 6f 72 20 69 74 3b 20 74 + 68 75 73 20 63 6f 6e 74 72 6f 6c 20 6e 65 76 65 + 72 20 61 63 74 75 61 6c 6c 79 0a + + ~ "~ goes back to the caller's interpreter after initial" + ~ " setup. For performance" + 7e 20 20 67 6f 65 73 20 62 61 63 6b 20 74 6f 20 + 74 68 65 20 63 61 6c 6c 65 72 27 73 20 69 6e 74 + 65 72 70 72 65 74 65 72 20 61 66 74 65 72 20 69 + 6e 69 74 69 61 6c 20 73 65 74 75 70 2e 20 46 6f + 72 20 70 65 72 66 6f 72 6d 61 6e 63 65 0a + + ~ "~ reasons, "next" is always inlined, so we define it as a" + ~ " macro." + 7e 20 20 72 65 61 73 6f 6e 73 2c 20 22 6e 65 78 + 74 22 20 69 73 20 61 6c 77 61 79 73 20 69 6e 6c + 69 6e 65 64 2c 20 73 6f 20 77 65 20 64 65 66 69 + 6e 65 20 69 74 20 61 73 20 61 20 6d 61 63 72 6f + 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The docol routine is just ordinary code, not a macro." + ~ " It's defined later" + 7e 20 20 20 20 54 68 65 20 64 6f 63 6f 6c 20 72 + 6f 75 74 69 6e 65 20 69 73 20 6a 75 73 74 20 6f + 72 64 69 6e 61 72 79 20 63 6f 64 65 2c 20 6e 6f + 74 20 61 20 6d 61 63 72 6f 2e 20 49 74 27 73 20 + 64 65 66 69 6e 65 64 20 6c 61 74 65 72 0a + + ~ "~ in this file, as a label." + 7e 20 20 69 6e 20 74 68 69 73 20 66 69 6c 65 2c + 20 61 73 20 61 20 6c 61 62 65 6c 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Notionally, we could consider not having a dictionary," + ~ " and not giving" + 7e 20 20 20 20 4e 6f 74 69 6f 6e 61 6c 6c 79 2c + 20 77 65 20 63 6f 75 6c 64 20 63 6f 6e 73 69 64 + 65 72 20 6e 6f 74 20 68 61 76 69 6e 67 20 61 20 + 64 69 63 74 69 6f 6e 61 72 79 2c 20 61 6e 64 20 + 6e 6f 74 20 67 69 76 69 6e 67 0a + + ~ "~ our words names. However, it feels silly to stop when" + ~ " we're so close to" + 7e 20 20 6f 75 72 20 77 6f 72 64 73 20 6e 61 6d + 65 73 2e 20 48 6f 77 65 76 65 72 2c 20 69 74 20 + 66 65 65 6c 73 20 73 69 6c 6c 79 20 74 6f 20 73 + 74 6f 70 20 77 68 65 6e 20 77 65 27 72 65 20 73 + 6f 20 63 6c 6f 73 65 20 74 6f 0a + + ~ "~ being a full Forth, and using names for things solves a" + ~ " bootstrapping" + 7e 20 20 62 65 69 6e 67 20 61 20 66 75 6c 6c 20 + 46 6f 72 74 68 2c 20 61 6e 64 20 75 73 69 6e 67 + 20 6e 61 6d 65 73 20 66 6f 72 20 74 68 69 6e 67 + 73 20 73 6f 6c 76 65 73 20 61 20 62 6f 6f 74 73 + 74 72 61 70 70 69 6e 67 0a + + ~ "~ problem related to log management - see the write-up of" + ~ " cold-start about" + 7e 20 20 70 72 6f 62 6c 65 6d 20 72 65 6c 61 74 + 65 64 20 74 6f 20 6c 6f 67 20 6d 61 6e 61 67 65 + 6d 65 6e 74 20 2d 20 73 65 65 20 74 68 65 20 77 + 72 69 74 65 2d 75 70 20 6f 66 20 63 6f 6c 64 2d + 73 74 61 72 74 20 61 62 6f 75 74 0a + + ~ "~ how the log is created, below. So, we add an additional" + ~ " header before the" + 7e 20 20 68 6f 77 20 74 68 65 20 6c 6f 67 20 69 + 73 20 63 72 65 61 74 65 64 2c 20 62 65 6c 6f 77 + 2e 20 53 6f 2c 20 77 65 20 61 64 64 20 61 6e 20 + 61 64 64 69 74 69 6f 6e 61 6c 20 68 65 61 64 65 + 72 20 62 65 66 6f 72 65 20 74 68 65 0a + + ~ "~ codeword for this purpose." + 7e 20 20 63 6f 64 65 77 6f 72 64 20 66 6f 72 20 + 74 68 69 73 20 70 75 72 70 6f 73 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The Forth dictionary is usually a linked list of every" + ~ " word that has" + 7e 20 20 20 20 54 68 65 20 46 6f 72 74 68 20 64 + 69 63 74 69 6f 6e 61 72 79 20 69 73 20 75 73 75 + 61 6c 6c 79 20 61 20 6c 69 6e 6b 65 64 20 6c 69 + 73 74 20 6f 66 20 65 76 65 72 79 20 77 6f 72 64 + 20 74 68 61 74 20 68 61 73 0a + + ~ "~ ever been defined, with the newest at the head; the" + ~ " names of words are" + 7e 20 20 65 76 65 72 20 62 65 65 6e 20 64 65 66 + 69 6e 65 64 2c 20 77 69 74 68 20 74 68 65 20 6e + 65 77 65 73 74 20 61 74 20 74 68 65 20 68 65 61 + 64 3b 20 74 68 65 20 6e 61 6d 65 73 20 6f 66 20 + 77 6f 72 64 73 20 61 72 65 0a + + ~ "~ stored in string fields, often right next to the link" + ~ " pointer. We adopt" + 7e 20 20 73 74 6f 72 65 64 20 69 6e 20 73 74 72 + 69 6e 67 20 66 69 65 6c 64 73 2c 20 6f 66 74 65 + 6e 20 72 69 67 68 74 20 6e 65 78 74 20 74 6f 20 + 74 68 65 20 6c 69 6e 6b 20 70 6f 69 6e 74 65 72 + 2e 20 57 65 20 61 64 6f 70 74 0a + + ~ "~ this model, with the field sizes and order shown in the" + ~ " quick reference" + 7e 20 20 74 68 69 73 20 6d 6f 64 65 6c 2c 20 77 + 69 74 68 20 74 68 65 20 66 69 65 6c 64 20 73 69 + 7a 65 73 20 61 6e 64 20 6f 72 64 65 72 20 73 68 + 6f 77 6e 20 69 6e 20 74 68 65 20 71 75 69 63 6b + 20 72 65 66 65 72 65 6e 63 65 0a + + ~ "~ below. We break with Forth tradition in one way: Rather" + ~ " than having a" + 7e 20 20 62 65 6c 6f 77 2e 20 57 65 20 62 72 65 + 61 6b 20 77 69 74 68 20 46 6f 72 74 68 20 74 72 + 61 64 69 74 69 6f 6e 20 69 6e 20 6f 6e 65 20 77 + 61 79 3a 20 52 61 74 68 65 72 20 74 68 61 6e 20 + 68 61 76 69 6e 67 20 61 0a + + ~ "~ length field, we use a null-terminated string. Thus," + ~ " there's no length" + 7e 20 20 6c 65 6e 67 74 68 20 66 69 65 6c 64 2c + 20 77 65 20 75 73 65 20 61 20 6e 75 6c 6c 2d 74 + 65 72 6d 69 6e 61 74 65 64 20 73 74 72 69 6e 67 + 2e 20 54 68 75 73 2c 20 74 68 65 72 65 27 73 20 + 6e 6f 20 6c 65 6e 67 74 68 0a + + ~ "~ limit on names. This necessitates breaking out the flags" + ~ " (to be explained" + 7e 20 20 6c 69 6d 69 74 20 6f 6e 20 6e 61 6d 65 + 73 2e 20 54 68 69 73 20 6e 65 63 65 73 73 69 74 + 61 74 65 73 20 62 72 65 61 6b 69 6e 67 20 6f 75 + 74 20 74 68 65 20 66 6c 61 67 73 20 28 74 6f 20 + 62 65 20 65 78 70 6c 61 69 6e 65 64 0a + + ~ "~ later) into their own byte, rather than taking bits from" + ~ " the length field" + 7e 20 20 6c 61 74 65 72 29 20 69 6e 74 6f 20 74 + 68 65 69 72 20 6f 77 6e 20 62 79 74 65 2c 20 72 + 61 74 68 65 72 20 74 68 61 6e 20 74 61 6b 69 6e + 67 20 62 69 74 73 20 66 72 6f 6d 20 74 68 65 20 + 6c 65 6e 67 74 68 20 66 69 65 6c 64 0a + + ~ "~ for them." + 7e 20 20 66 6f 72 20 74 68 65 6d 2e 0a + + ~ "~" + 7e 0a + + ~ "~ There's an important performance consideration:" + ~ " Executable words" + 7e 20 20 20 20 54 68 65 72 65 27 73 20 61 6e 20 + 69 6d 70 6f 72 74 61 6e 74 20 70 65 72 66 6f 72 + 6d 61 6e 63 65 20 63 6f 6e 73 69 64 65 72 61 74 + 69 6f 6e 3a 20 45 78 65 63 75 74 61 62 6c 65 20 + 77 6f 72 64 73 0a + + ~ "~ reference each other by pointers to their respective" + ~ " codewords. However," + 7e 20 20 72 65 66 65 72 65 6e 63 65 20 65 61 63 + 68 20 6f 74 68 65 72 20 62 79 20 70 6f 69 6e 74 + 65 72 73 20 74 6f 20 74 68 65 69 72 20 72 65 73 + 70 65 63 74 69 76 65 20 63 6f 64 65 77 6f 72 64 + 73 2e 20 48 6f 77 65 76 65 72 2c 0a + + ~ "~ dictionary entries reference each other by pointers to" + ~ " their respective" + 7e 20 20 64 69 63 74 69 6f 6e 61 72 79 20 65 6e + 74 72 69 65 73 20 72 65 66 65 72 65 6e 63 65 20 + 65 61 63 68 20 6f 74 68 65 72 20 62 79 20 70 6f + 69 6e 74 65 72 73 20 74 6f 20 74 68 65 69 72 20 + 72 65 73 70 65 63 74 69 76 65 0a + + ~ "~ link fields. Traversing from the link field to the" + ~ " codeword is easy," + 7e 20 20 6c 69 6e 6b 20 66 69 65 6c 64 73 2e 20 + 54 72 61 76 65 72 73 69 6e 67 20 66 72 6f 6d 20 + 74 68 65 20 6c 69 6e 6b 20 66 69 65 6c 64 20 74 + 6f 20 74 68 65 20 63 6f 64 65 77 6f 72 64 20 69 + 73 20 65 61 73 79 2c 0a + + ~ "~ though it's a non-constant-time operation: Just walk the" + ~ " string. In order" + 7e 20 20 74 68 6f 75 67 68 20 69 74 27 73 20 61 + 20 6e 6f 6e 2d 63 6f 6e 73 74 61 6e 74 2d 74 69 + 6d 65 20 6f 70 65 72 61 74 69 6f 6e 3a 20 4a 75 + 73 74 20 77 61 6c 6b 20 74 68 65 20 73 74 72 69 + 6e 67 2e 20 49 6e 20 6f 72 64 65 72 0a + + ~ "~ to make Forth words easy to "decompile", it would be" + ~ " nice to also have a" + 7e 20 20 74 6f 20 6d 61 6b 65 20 46 6f 72 74 68 + 20 77 6f 72 64 73 20 65 61 73 79 20 74 6f 20 22 + 64 65 63 6f 6d 70 69 6c 65 22 2c 20 69 74 20 77 + 6f 75 6c 64 20 62 65 20 6e 69 63 65 20 74 6f 20 + 61 6c 73 6f 20 68 61 76 65 20 61 0a + + ~ "~ way to traverse backwards. We solve this by making the" + ~ " name field be" + 7e 20 20 77 61 79 20 74 6f 20 74 72 61 76 65 72 + 73 65 20 62 61 63 6b 77 61 72 64 73 2e 20 57 65 + 20 73 6f 6c 76 65 20 74 68 69 73 20 62 79 20 6d + 61 6b 69 6e 67 20 74 68 65 20 6e 61 6d 65 20 66 + 69 65 6c 64 20 62 65 0a + + ~ "~ null-terminated at both ends. Fun, yeah?" + 7e 20 20 6e 75 6c 6c 2d 74 65 72 6d 69 6e 61 74 + 65 64 20 61 74 20 62 6f 74 68 20 65 6e 64 73 2e + 20 46 75 6e 2c 20 79 65 61 68 3f 0a + + ~ "~" + 7e 0a + + ~ "~" + 7e 0a + + ~ "~" + 7e 0a + + ~ "~" + 7e 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + ~ "~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 0a + + ~ "~ Quick Reference" + 7e 20 20 20 51 75 69 63 6b 20 52 65 66 65 72 65 + 6e 63 65 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + ~ "~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 0a + + ~ "~" + 7e 0a + + ~ "~ The layout of an interpreted word:" + 7e 20 20 54 68 65 20 6c 61 79 6f 75 74 20 6f 66 + 20 61 6e 20 69 6e 74 65 72 70 72 65 74 65 64 20 + 77 6f 72 64 3a 0a + + ~ "~" + 7e 0a + + ~ "~ (overall start)" + 7e 20 20 28 6f 76 65 72 61 6c 6c 20 73 74 61 72 + 74 29 0a + + ~ "~ 0x00 - 0x07 Link (to" + ~ " next-oldest word)" + 7e 20 20 20 20 20 20 20 20 20 20 20 20 20 30 78 + 30 30 20 2d 20 30 78 30 37 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 4c 69 + 6e 6b 20 28 74 6f 20 6e 65 78 74 2d 6f 6c 64 65 + 73 74 20 77 6f 72 64 29 0a + + ~ "~ 0x08 - 0x08 HM00000I Flags" + 7e 20 20 20 20 20 20 20 20 20 20 20 20 20 30 78 + 30 38 20 2d 20 30 78 30 38 20 20 48 4d 30 30 30 + 30 30 49 20 20 20 20 20 20 20 20 20 20 20 46 6c + 61 67 73 0a + + ~ "~ H -" + ~ " hidden" + 7e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 48 20 2d 20 68 69 64 64 65 6e 0a + + ~ "~ M -" + ~ " metadata" + 7e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 4d 20 2d 20 6d 65 74 61 64 61 74 61 0a + + ~ "~ I -" + ~ " immediate" + 7e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 49 20 2d 20 69 6d 6d 65 64 69 61 74 65 0a + + ~ "~ all other" + ~ " bits reserved" + 7e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 61 6c 6c 20 6f 74 68 65 72 20 62 69 74 73 + 20 72 65 73 65 72 76 65 64 0a + + ~ "~ (name start)" + 7e 20 20 28 6e 61 6d 65 20 73 74 61 72 74 29 0a + + ~ "~ 0x09 - 0x09 Null byte" + ~ " (terminates name)" + 7e 20 20 20 20 20 20 20 20 20 20 20 20 20 30 78 + 30 39 20 2d 20 30 78 30 39 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 4e 75 + 6c 6c 20 62 79 74 65 20 28 74 65 72 6d 69 6e 61 + 74 65 73 20 6e 61 6d 65 29 0a + + ~ "~ 0x0a - name-end - 1 Name, as" + ~ " UTF-8" + 7e 20 20 20 20 20 20 20 20 20 20 20 20 20 30 78 + 30 61 20 2d 20 6e 61 6d 65 2d 65 6e 64 20 2d 20 + 31 20 20 20 20 20 20 20 20 20 20 20 20 20 4e 61 + 6d 65 2c 20 61 73 20 55 54 46 2d 38 0a + + ~ "~ name-end - name-end Null byte" + ~ " (terminates name)" + 7e 20 20 20 20 20 20 20 20 20 6e 61 6d 65 2d 65 + 6e 64 20 2d 20 6e 61 6d 65 2d 65 6e 64 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 4e 75 + 6c 6c 20 62 79 74 65 20 28 74 65 72 6d 69 6e 61 + 74 65 73 20 6e 61 6d 65 29 0a + + ~ "~ (padding start)" + 7e 20 20 28 70 61 64 64 69 6e 67 20 73 74 61 72 + 74 29 0a + + ~ "~ name-end + 1 - codeword-start - 1 Zero-pad to" + ~ " 8-byte boundary" + 7e 20 20 20 20 20 6e 61 6d 65 2d 65 6e 64 20 2b + 20 31 20 2d 20 63 6f 64 65 77 6f 72 64 2d 73 74 + 61 72 74 20 2d 20 31 20 20 20 20 20 20 20 5a 65 + 72 6f 2d 70 61 64 20 74 6f 20 38 2d 62 79 74 65 + 20 62 6f 75 6e 64 61 72 79 0a + + ~ "~ (it's possible this will be zero bytes long)" + 7e 20 20 20 20 20 28 69 74 27 73 20 70 6f 73 73 + 69 62 6c 65 20 74 68 69 73 20 77 69 6c 6c 20 62 + 65 20 7a 65 72 6f 20 62 79 74 65 73 20 6c 6f 6e + 67 29 0a + + ~ "~ (codeword start)" + 7e 20 20 28 63 6f 64 65 77 6f 72 64 20 73 74 61 + 72 74 29 0a + + ~ "~ ... + 0x00 - ... + 0x08 Codeword (ie." + ~ " address of docol)" + 7e 20 20 20 20 20 20 20 2e 2e 2e 20 2b 20 30 78 + 30 30 20 2d 20 2e 2e 2e 20 2b 20 30 78 30 38 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 43 6f + 64 65 77 6f 72 64 20 28 69 65 2e 20 61 64 64 72 + 65 73 73 20 6f 66 20 64 6f 63 6f 6c 29 0a + + ~ "~ (8-byte chunks) Addresses of" + ~ " other words" + 7e 20 20 20 20 20 20 20 20 20 20 20 28 38 2d 62 + 79 74 65 20 63 68 75 6e 6b 73 29 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 41 64 + 64 72 65 73 73 65 73 20 6f 66 20 6f 74 68 65 72 + 20 77 6f 72 64 73 0a + + ~ "~ - ... (end) Address of" + ~ " "exit" word" + 7e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 2d 20 2e 2e 2e 20 28 65 6e 64 29 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 41 64 + 64 72 65 73 73 20 6f 66 20 22 65 78 69 74 22 20 + 77 6f 72 64 0a + + ~ "~" + 7e 0a + + ~ "~ The layout of a machine-code word is different only from" + ~ " the codeword on:" + 7e 20 20 54 68 65 20 6c 61 79 6f 75 74 20 6f 66 + 20 61 20 6d 61 63 68 69 6e 65 2d 63 6f 64 65 20 + 77 6f 72 64 20 69 73 20 64 69 66 66 65 72 65 6e + 74 20 6f 6e 6c 79 20 66 72 6f 6d 20 74 68 65 20 + 63 6f 64 65 77 6f 72 64 20 6f 6e 3a 0a + + ~ "~" + 7e 0a + + ~ "~ ... + 0x00 - ... + 0x08 Addresss of" + ~ " next byte" + 7e 20 20 20 20 20 20 20 2e 2e 2e 20 2b 20 30 78 + 30 30 20 2d 20 2e 2e 2e 20 2b 20 30 78 30 38 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 41 64 + 64 72 65 73 73 73 20 6f 66 20 6e 65 78 74 20 62 + 79 74 65 0a + + ~ "~ ... + 0x08 - ???? Arbitrary" + ~ " machine code" + 7e 20 20 20 20 20 20 20 2e 2e 2e 20 2b 20 30 78 + 30 38 20 2d 20 3f 3f 3f 3f 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 41 72 + 62 69 74 72 61 72 79 20 6d 61 63 68 69 6e 65 20 + 63 6f 64 65 0a + + ~ "~ - ... (end) Inlined" + ~ " implementation of next" + 7e 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 2d 20 2e 2e 2e 20 28 65 6e 64 29 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 49 6e + 6c 69 6e 65 64 20 69 6d 70 6c 65 6d 65 6e 74 61 + 74 69 6f 6e 20 6f 66 20 6e 65 78 74 0a + + ~ "~" + 7e 0a + + ~ "~ Also, words always start at 8-byte boundaries." + 7e 20 20 41 6c 73 6f 2c 20 77 6f 72 64 73 20 61 + 6c 77 61 79 73 20 73 74 61 72 74 20 61 74 20 38 + 2d 62 79 74 65 20 62 6f 75 6e 64 61 72 69 65 73 + 2e 0a + + ~ "~" + 7e 0a + + ~ "~" + 7e 0a + + ~ "~ REGISTER usage conventions:" + 7e 20 20 52 45 47 49 53 54 45 52 20 75 73 61 67 + 65 20 63 6f 6e 76 65 6e 74 69 6f 6e 73 3a 0a + + ~ "~" + 7e 0a + + ~ "~ * rsi is the "instruction pointer" for the" + ~ " "interpreter"." + 7e 20 20 2a 20 72 73 69 20 69 73 20 74 68 65 20 + 22 69 6e 73 74 72 75 63 74 69 6f 6e 20 70 6f 69 + 6e 74 65 72 22 20 66 6f 72 20 74 68 65 20 22 69 + 6e 74 65 72 70 72 65 74 65 72 22 2e 0a + + ~ "~ That is, it points to some word-pointer inside an" + ~ " array of" + 7e 20 20 20 20 20 20 54 68 61 74 20 69 73 2c 20 + 69 74 20 70 6f 69 6e 74 73 20 74 6f 20 73 6f 6d + 65 20 77 6f 72 64 2d 70 6f 69 6e 74 65 72 20 69 + 6e 73 69 64 65 20 61 6e 20 61 72 72 61 79 20 6f + 66 0a + + ~ "~ word-pointers inside the content of the word they're" + ~ " part of. It always" + 7e 20 20 20 20 77 6f 72 64 2d 70 6f 69 6e 74 65 + 72 73 20 69 6e 73 69 64 65 20 74 68 65 20 63 6f + 6e 74 65 6e 74 20 6f 66 20 74 68 65 20 77 6f 72 + 64 20 74 68 65 79 27 72 65 20 70 61 72 74 20 6f + 66 2e 20 49 74 20 61 6c 77 61 79 73 0a + + ~ "~ points to the next word that should be executed, whose" + ~ " execution hasn't" + 7e 20 20 20 20 70 6f 69 6e 74 73 20 74 6f 20 74 + 68 65 20 6e 65 78 74 20 77 6f 72 64 20 74 68 61 + 74 20 73 68 6f 75 6c 64 20 62 65 20 65 78 65 63 + 75 74 65 64 2c 20 77 68 6f 73 65 20 65 78 65 63 + 75 74 69 6f 6e 20 68 61 73 6e 27 74 0a + + ~ "~ begun yet." + 7e 20 20 20 20 62 65 67 75 6e 20 79 65 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ * rbp points to the top of the control stack" + 7e 20 20 2a 20 72 62 70 20 70 6f 69 6e 74 73 20 + 74 6f 20 74 68 65 20 74 6f 70 20 6f 66 20 74 68 + 65 20 63 6f 6e 74 72 6f 6c 20 73 74 61 63 6b 0a + + ~ "~ These are former values of rsi, to eventually be" + ~ " returned to, from" + 7e 20 20 20 20 20 20 54 68 65 73 65 20 61 72 65 + 20 66 6f 72 6d 65 72 20 76 61 6c 75 65 73 20 6f + 66 20 72 73 69 2c 20 74 6f 20 65 76 65 6e 74 75 + 61 6c 6c 79 20 62 65 20 72 65 74 75 72 6e 65 64 + 20 74 6f 2c 20 66 72 6f 6d 0a + + ~ "~ successively older callers as you look further up the" + ~ " stack. The stack" + 7e 20 20 20 20 73 75 63 63 65 73 73 69 76 65 6c + 79 20 6f 6c 64 65 72 20 63 61 6c 6c 65 72 73 20 + 61 73 20 79 6f 75 20 6c 6f 6f 6b 20 66 75 72 74 + 68 65 72 20 75 70 20 74 68 65 20 73 74 61 63 6b + 2e 20 54 68 65 20 73 74 61 63 6b 0a + + ~ "~ grows downwards in memory. Since values are kept" + ~ " separately, the only" + 7e 20 20 20 20 67 72 6f 77 73 20 64 6f 77 6e 77 + 61 72 64 73 20 69 6e 20 6d 65 6d 6f 72 79 2e 20 + 53 69 6e 63 65 20 76 61 6c 75 65 73 20 61 72 65 + 20 6b 65 70 74 20 73 65 70 61 72 61 74 65 6c 79 + 2c 20 74 68 65 20 6f 6e 6c 79 0a + + ~ "~ thing on the control stack is return addresses, one" + ~ " per layer of call." + 7e 20 20 20 20 74 68 69 6e 67 20 6f 6e 20 74 68 + 65 20 63 6f 6e 74 72 6f 6c 20 73 74 61 63 6b 20 + 69 73 20 72 65 74 75 72 6e 20 61 64 64 72 65 73 + 73 65 73 2c 20 6f 6e 65 20 70 65 72 20 6c 61 79 + 65 72 20 6f 66 20 63 61 6c 6c 2e 0a + + ~ "~" + 7e 0a + + ~ "~ * rsp points to the top of the value stack" + 7e 20 20 2a 20 72 73 70 20 70 6f 69 6e 74 73 20 + 74 6f 20 74 68 65 20 74 6f 70 20 6f 66 20 74 68 + 65 20 76 61 6c 75 65 20 73 74 61 63 6b 0a + + ~ "~ The value stack has no specific format, but it grows" + ~ " downwards in" + 7e 20 20 20 20 20 20 54 68 65 20 76 61 6c 75 65 + 20 73 74 61 63 6b 20 68 61 73 20 6e 6f 20 73 70 + 65 63 69 66 69 63 20 66 6f 72 6d 61 74 2c 20 62 + 75 74 20 69 74 20 67 72 6f 77 73 20 64 6f 77 6e + 77 61 72 64 73 20 69 6e 0a + + ~ "~ memory. In particular there's no concept of stack" + ~ " frames, because items" + 7e 20 20 20 20 6d 65 6d 6f 72 79 2e 20 49 6e 20 + 70 61 72 74 69 63 75 6c 61 72 20 74 68 65 72 65 + 27 73 20 6e 6f 20 63 6f 6e 63 65 70 74 20 6f 66 + 20 73 74 61 63 6b 20 66 72 61 6d 65 73 2c 20 62 + 65 63 61 75 73 65 20 69 74 65 6d 73 0a + + ~ "~ on the stack don't belong to any particular word; the" + ~ " value stack in" + 7e 20 20 20 20 6f 6e 20 74 68 65 20 73 74 61 63 + 6b 20 64 6f 6e 27 74 20 62 65 6c 6f 6e 67 20 74 + 6f 20 61 6e 79 20 70 61 72 74 69 63 75 6c 61 72 + 20 77 6f 72 64 3b 20 74 68 65 20 76 61 6c 75 65 + 20 73 74 61 63 6b 20 69 6e 0a + + ~ "~ Forth is in part a mechanism for passing values" + ~ " between words." + 7e 20 20 20 20 46 6f 72 74 68 20 69 73 20 69 6e + 20 70 61 72 74 20 61 20 6d 65 63 68 61 6e 69 73 + 6d 20 66 6f 72 20 70 61 73 73 69 6e 67 20 76 61 + 6c 75 65 73 20 62 65 74 77 65 65 6e 20 77 6f 72 + 64 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Additionally, immediately after beginning execution of a" + ~ " word:" + 7e 20 20 41 64 64 69 74 69 6f 6e 61 6c 6c 79 2c + 20 69 6d 6d 65 64 69 61 74 65 6c 79 20 61 66 74 + 65 72 20 62 65 67 69 6e 6e 69 6e 67 20 65 78 65 + 63 75 74 69 6f 6e 20 6f 66 20 61 20 77 6f 72 64 + 3a 0a + + ~ "~" + 7e 0a + + ~ "~ * rax points to the address of the codeword being" + ~ " executed" + 7e 20 20 2a 20 72 61 78 20 70 6f 69 6e 74 73 20 + 74 6f 20 74 68 65 20 61 64 64 72 65 73 73 20 6f + 66 20 74 68 65 20 63 6f 64 65 77 6f 72 64 20 62 + 65 69 6e 67 20 65 78 65 63 75 74 65 64 0a + + ~ "~ The value of rax is purely for the callee's benefit," + ~ " and does not need" + 7e 20 20 20 20 20 20 54 68 65 20 76 61 6c 75 65 + 20 6f 66 20 72 61 78 20 69 73 20 70 75 72 65 6c + 79 20 66 6f 72 20 74 68 65 20 63 61 6c 6c 65 65 + 27 73 20 62 65 6e 65 66 69 74 2c 20 61 6e 64 20 + 64 6f 65 73 20 6e 6f 74 20 6e 65 65 64 0a + + ~ "~ to be preserved." + 7e 20 20 20 20 74 6f 20 62 65 20 70 72 65 73 65 + 72 76 65 64 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Other registers are purely discretionary, and are not" + ~ " preserved across" + 7e 20 20 20 20 4f 74 68 65 72 20 72 65 67 69 73 + 74 65 72 73 20 61 72 65 20 70 75 72 65 6c 79 20 + 64 69 73 63 72 65 74 69 6f 6e 61 72 79 2c 20 61 + 6e 64 20 61 72 65 20 6e 6f 74 20 70 72 65 73 65 + 72 76 65 64 20 61 63 72 6f 73 73 0a + + ~ "~ calls." + 7e 20 20 63 61 6c 6c 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~" + 7e 0a + + ~ "~ FLAG usage:" + 7e 20 20 46 4c 41 47 20 75 73 61 67 65 3a 0a + + ~ "~" + 7e 0a + + ~ "~ * DF should be 0" + 7e 20 20 2a 20 44 46 20 73 68 6f 75 6c 64 20 62 + 65 20 30 0a + + ~ "~ We use lodsq extensively and that makes it increment" + ~ " rsi after using it." + 7e 20 20 20 20 57 65 20 75 73 65 20 6c 6f 64 73 + 71 20 65 78 74 65 6e 73 69 76 65 6c 79 20 61 6e + 64 20 74 68 61 74 20 6d 61 6b 65 73 20 69 74 20 + 69 6e 63 72 65 6d 65 6e 74 20 72 73 69 20 61 66 + 74 65 72 20 75 73 69 6e 67 20 69 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + ~ "~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 0a + + ~ "" + 0a + + ~ "~ The macros next, beforenext, pushcontrol, and" + ~ " popcontrol are implemented" + 7e 20 20 20 54 68 65 20 6d 61 63 72 6f 73 20 6e + 65 78 74 2c 20 62 65 66 6f 72 65 6e 65 78 74 2c + 20 70 75 73 68 63 6f 6e 74 72 6f 6c 2c 20 61 6e + 64 20 70 6f 70 63 6f 6e 74 72 6f 6c 20 61 72 65 + 20 69 6d 70 6c 65 6d 65 6e 74 65 64 0a + + ~ "~ in language/static/execution-support.e. It's a good idea" + ~ " to go read about" + 7e 20 69 6e 20 6c 61 6e 67 75 61 67 65 2f 73 74 + 61 74 69 63 2f 65 78 65 63 75 74 69 6f 6e 2d 73 + 75 70 70 6f 72 74 2e 65 2e 20 49 74 27 73 20 61 + 20 67 6f 6f 64 20 69 64 65 61 20 74 6f 20 67 6f + 20 72 65 61 64 20 61 62 6f 75 74 0a + + ~ "~ them now." + 7e 20 74 68 65 6d 20 6e 6f 77 2e 0a + + ~ "~" + 7e 0a + + ~ "~ TODO the following high-level summary should go..." + ~ " somewhere?" + 7e 20 54 4f 44 4f 20 74 68 65 20 66 6f 6c 6c 6f + 77 69 6e 67 20 68 69 67 68 2d 6c 65 76 65 6c 20 + 73 75 6d 6d 61 72 79 20 73 68 6f 75 6c 64 20 67 + 6f 2e 2e 2e 20 73 6f 6d 65 77 68 65 72 65 3f 0a + + ~ "~ When a docol word is invoked, it immediately does" + ~ " pushcontrol (see" + 7e 20 20 20 57 68 65 6e 20 61 20 64 6f 63 6f 6c + 20 77 6f 72 64 20 69 73 20 69 6e 76 6f 6b 65 64 + 2c 20 69 74 20 69 6d 6d 65 64 69 61 74 65 6c 79 + 20 64 6f 65 73 20 70 75 73 68 63 6f 6e 74 72 6f + 6c 20 28 73 65 65 0a + + ~ "~ execution-support.e) to push rsi onto the control stack," + ~ " whose top is" + 7e 20 65 78 65 63 75 74 69 6f 6e 2d 73 75 70 70 + 6f 72 74 2e 65 29 20 74 6f 20 70 75 73 68 20 72 + 73 69 20 6f 6e 74 6f 20 74 68 65 20 63 6f 6e 74 + 72 6f 6c 20 73 74 61 63 6b 2c 20 77 68 6f 73 65 + 20 74 6f 70 20 69 73 0a + + ~ "~ indicated by rbp. When an assembly word is invoked, it" + ~ " leaves rsi and rbp" + 7e 20 69 6e 64 69 63 61 74 65 64 20 62 79 20 72 + 62 70 2e 20 57 68 65 6e 20 61 6e 20 61 73 73 65 + 6d 62 6c 79 20 77 6f 72 64 20 69 73 20 69 6e 76 + 6f 6b 65 64 2c 20 69 74 20 6c 65 61 76 65 73 20 + 72 73 69 20 61 6e 64 20 72 62 70 0a + + ~ "~ alone; assembly words don't normally call other words, so" + ~ " there's no need" + 7e 20 61 6c 6f 6e 65 3b 20 61 73 73 65 6d 62 6c + 79 20 77 6f 72 64 73 20 64 6f 6e 27 74 20 6e 6f + 72 6d 61 6c 6c 79 20 63 61 6c 6c 20 6f 74 68 65 + 72 20 77 6f 72 64 73 2c 20 73 6f 20 74 68 65 72 + 65 27 73 20 6e 6f 20 6e 65 65 64 0a + + ~ "~ for them to appear on the control stack at all." + 7e 20 66 6f 72 20 74 68 65 6d 20 74 6f 20 61 70 + 70 65 61 72 20 6f 6e 20 74 68 65 20 63 6f 6e 74 + 72 6f 6c 20 73 74 61 63 6b 20 61 74 20 61 6c 6c + 2e 0a + + ~ "~" + 7e 0a + + ~ "~ When an assembly word returns, it looks for an" + ~ " execution token pointed" + 7e 20 20 20 57 68 65 6e 20 61 6e 20 61 73 73 65 + 6d 62 6c 79 20 77 6f 72 64 20 72 65 74 75 72 6e + 73 2c 20 69 74 20 6c 6f 6f 6b 73 20 66 6f 72 20 + 61 6e 20 65 78 65 63 75 74 69 6f 6e 20 74 6f 6b + 65 6e 20 70 6f 69 6e 74 65 64 0a + + ~ "~ to by rsi, increments rsi, and invokes that word as if" + ~ " calling it. This" + 7e 20 74 6f 20 62 79 20 72 73 69 2c 20 69 6e 63 + 72 65 6d 65 6e 74 73 20 72 73 69 2c 20 61 6e 64 + 20 69 6e 76 6f 6b 65 73 20 74 68 61 74 20 77 6f + 72 64 20 61 73 20 69 66 20 63 61 6c 6c 69 6e 67 + 20 69 74 2e 20 54 68 69 73 0a + + ~ "~ is the threaded calling approach to Forth execution. When" + ~ " a docol word" + 7e 20 69 73 20 74 68 65 20 74 68 72 65 61 64 65 + 64 20 63 61 6c 6c 69 6e 67 20 61 70 70 72 6f 61 + 63 68 20 74 6f 20 46 6f 72 74 68 20 65 78 65 63 + 75 74 69 6f 6e 2e 20 57 68 65 6e 20 61 20 64 6f + 63 6f 6c 20 77 6f 72 64 0a + + ~ "~ returns, it calls exit, which needs to remove itself from" + ~ " the control" + 7e 20 72 65 74 75 72 6e 73 2c 20 69 74 20 63 61 + 6c 6c 73 20 65 78 69 74 2c 20 77 68 69 63 68 20 + 6e 65 65 64 73 20 74 6f 20 72 65 6d 6f 76 65 20 + 69 74 73 65 6c 66 20 66 72 6f 6d 20 74 68 65 20 + 63 6f 6e 74 72 6f 6c 0a + + ~ "~ stack, so exit pops the top of the control stack into rsi" + ~ " to get back into" + 7e 20 73 74 61 63 6b 2c 20 73 6f 20 65 78 69 74 + 20 70 6f 70 73 20 74 68 65 20 74 6f 70 20 6f 66 + 20 74 68 65 20 63 6f 6e 74 72 6f 6c 20 73 74 61 + 63 6b 20 69 6e 74 6f 20 72 73 69 20 74 6f 20 67 + 65 74 20 62 61 63 6b 20 69 6e 74 6f 0a + + ~ "~ its caller's context, then does the same steps an" + ~ " assembly word would do." + 7e 20 69 74 73 20 63 61 6c 6c 65 72 27 73 20 63 + 6f 6e 74 65 78 74 2c 20 74 68 65 6e 20 64 6f 65 + 73 20 74 68 65 20 73 61 6d 65 20 73 74 65 70 73 + 20 61 6e 20 61 73 73 65 6d 62 6c 79 20 77 6f 72 + 64 20 77 6f 75 6c 64 20 64 6f 2e 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Constants" + 7e 20 43 6f 6e 73 74 61 6e 74 73 0a + + ~ "~ ~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 0a + + ~ "~" + 7e 0a + + ~ "~ These are used in cold-start, just below." + 7e 20 54 68 65 73 65 20 61 72 65 20 75 73 65 64 + 20 69 6e 20 63 6f 6c 64 2d 73 74 61 72 74 2c 20 + 6a 75 73 74 20 62 65 6c 6f 77 2e 0a + + ~ "" + 0a + + ~ ": log-requested-address 0x0000001000000000 ; ~ (very" + ~ " arbitrary)" + 3a 20 6c 6f 67 2d 72 65 71 75 65 73 74 65 64 2d + 61 64 64 72 65 73 73 20 30 78 30 30 30 30 30 30 + 31 30 30 30 30 30 30 30 30 30 20 20 3b 20 7e 20 + 28 76 65 72 79 20 61 72 62 69 74 72 61 72 79 29 + 0a + + ~ ": log-size 0x0000000001000000 ; ~ 16 MiB" + 3a 20 6c 6f 67 2d 73 69 7a 65 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 30 78 30 30 30 30 30 30 + 30 30 30 31 30 30 30 30 30 30 20 20 3b 20 7e 20 + 31 36 20 4d 69 42 0a + + ~ ": control-stack-size 0x10000 ; ~ 64 KiB" + 3a 20 63 6f 6e 74 72 6f 6c 2d 73 74 61 63 6b 2d + 73 69 7a 65 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 30 78 31 30 30 30 30 20 3b 20 7e 20 + 36 34 20 4b 69 42 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Routine cold-start" + 7e 20 52 6f 75 74 69 6e 65 20 63 6f 6c 64 2d 73 + 74 61 72 74 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 0a + + ~ "~" + 7e 0a + + ~ "~ This is the entry point of the whole program, the very" + ~ " first code we" + 7e 20 20 20 54 68 69 73 20 69 73 20 74 68 65 20 + 65 6e 74 72 79 20 70 6f 69 6e 74 20 6f 66 20 74 + 68 65 20 77 68 6f 6c 65 20 70 72 6f 67 72 61 6d + 2c 20 74 68 65 20 76 65 72 79 20 66 69 72 73 74 + 20 63 6f 64 65 20 77 65 0a + + ~ "~ actually execute. Linkers traditionally call this _start," + ~ " but let's live a" + 7e 20 61 63 74 75 61 6c 6c 79 20 65 78 65 63 75 + 74 65 2e 20 4c 69 6e 6b 65 72 73 20 74 72 61 64 + 69 74 69 6f 6e 61 6c 6c 79 20 63 61 6c 6c 20 74 + 68 69 73 20 5f 73 74 61 72 74 2c 20 62 75 74 20 + 6c 65 74 27 73 20 6c 69 76 65 20 61 0a + + ~ "~ little. Anyway, the ELF header points to it and exec()" + ~ " jumps to it; from the" + 7e 20 6c 69 74 74 6c 65 2e 20 41 6e 79 77 61 79 + 2c 20 74 68 65 20 45 4c 46 20 68 65 61 64 65 72 + 20 70 6f 69 6e 74 73 20 74 6f 20 69 74 20 61 6e + 64 20 65 78 65 63 28 29 20 6a 75 6d 70 73 20 74 + 6f 20 69 74 3b 20 66 72 6f 6d 20 74 68 65 0a + + ~ "~ kernel's perspective, there's no such thing as names." + ~ " Also, though this code" + 7e 20 6b 65 72 6e 65 6c 27 73 20 70 65 72 73 70 + 65 63 74 69 76 65 2c 20 74 68 65 72 65 27 73 20 + 6e 6f 20 73 75 63 68 20 74 68 69 6e 67 20 61 73 + 20 6e 61 6d 65 73 2e 20 41 6c 73 6f 2c 20 74 68 + 6f 75 67 68 20 74 68 69 73 20 63 6f 64 65 0a + + ~ "~ could be anywhere in the code part of the output, in" + ~ " order to make the" + 7e 20 63 6f 75 6c 64 20 62 65 20 61 6e 79 77 68 + 65 72 65 20 69 6e 20 74 68 65 20 63 6f 64 65 20 + 70 61 72 74 20 6f 66 20 74 68 65 20 6f 75 74 70 + 75 74 2c 20 69 6e 20 6f 72 64 65 72 20 74 6f 20 + 6d 61 6b 65 20 74 68 65 0a + + ~ "~ hexdump pretty we put it at the start." + 7e 20 68 65 78 64 75 6d 70 20 70 72 65 74 74 79 + 20 77 65 20 70 75 74 20 69 74 20 61 74 20 74 68 + 65 20 73 74 61 72 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The kernel gives us most registers zeroed, and rsp" + ~ " pointing to the" + 7e 20 20 20 54 68 65 20 6b 65 72 6e 65 6c 20 67 + 69 76 65 73 20 75 73 20 6d 6f 73 74 20 72 65 67 + 69 73 74 65 72 73 20 7a 65 72 6f 65 64 2c 20 61 + 6e 64 20 72 73 70 20 70 6f 69 6e 74 69 6e 67 20 + 74 6f 20 74 68 65 0a + + ~ "~ command-line stuff (argc, argv, envp), which is at an" + ~ " ASLR'd address with" + 7e 20 63 6f 6d 6d 61 6e 64 2d 6c 69 6e 65 20 73 + 74 75 66 66 20 28 61 72 67 63 2c 20 61 72 67 76 + 2c 20 65 6e 76 70 29 2c 20 77 68 69 63 68 20 69 + 73 20 61 74 20 61 6e 20 41 53 4c 52 27 64 20 61 + 64 64 72 65 73 73 20 77 69 74 68 0a + + ~ "~ some stack space allocated for us, despite the fact we" + ~ " didn't request any." + 7e 20 73 6f 6d 65 20 73 74 61 63 6b 20 73 70 61 + 63 65 20 61 6c 6c 6f 63 61 74 65 64 20 66 6f 72 + 20 75 73 2c 20 64 65 73 70 69 74 65 20 74 68 65 + 20 66 61 63 74 20 77 65 20 64 69 64 6e 27 74 20 + 72 65 71 75 65 73 74 20 61 6e 79 2e 0a + + ~ "~ It also gives us all the flags clear except IF, but we" + ~ " don't rely on that." + 7e 20 49 74 20 61 6c 73 6f 20 67 69 76 65 73 20 + 75 73 20 61 6c 6c 20 74 68 65 20 66 6c 61 67 73 + 20 63 6c 65 61 72 20 65 78 63 65 70 74 20 49 46 + 2c 20 62 75 74 20 77 65 20 64 6f 6e 27 74 20 72 + 65 6c 79 20 6f 6e 20 74 68 61 74 2e 0a + + ~ "~ Lastly, of course, it loads our code segment and sets the" + ~ " instruction" + 7e 20 4c 61 73 74 6c 79 2c 20 6f 66 20 63 6f 75 + 72 73 65 2c 20 69 74 20 6c 6f 61 64 73 20 6f 75 + 72 20 63 6f 64 65 20 73 65 67 6d 65 6e 74 20 61 + 6e 64 20 73 65 74 73 20 74 68 65 20 69 6e 73 74 + 72 75 63 74 69 6f 6e 0a + + ~ "~ pointer where we asked; we don't need to check what those" + ~ " addresses are," + 7e 20 70 6f 69 6e 74 65 72 20 77 68 65 72 65 20 + 77 65 20 61 73 6b 65 64 3b 20 77 65 20 64 6f 6e + 27 74 20 6e 65 65 64 20 74 6f 20 63 68 65 63 6b + 20 77 68 61 74 20 74 68 6f 73 65 20 61 64 64 72 + 65 73 73 65 73 20 61 72 65 2c 0a + + ~ "~ because they're not randomized." + 7e 20 62 65 63 61 75 73 65 20 74 68 65 79 27 72 + 65 20 6e 6f 74 20 72 61 6e 64 6f 6d 69 7a 65 64 + 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Notably, though cold-start points rbp to the control" + ~ " stack, it leaves" + 7e 20 20 20 4e 6f 74 61 62 6c 79 2c 20 74 68 6f + 75 67 68 20 63 6f 6c 64 2d 73 74 61 72 74 20 70 + 6f 69 6e 74 73 20 72 62 70 20 74 6f 20 74 68 65 + 20 63 6f 6e 74 72 6f 6c 20 73 74 61 63 6b 2c 20 + 69 74 20 6c 65 61 76 65 73 0a + + ~ "~ the control stack empty, so trying to return will pop a" + ~ " value that doesn't" + 7e 20 74 68 65 20 63 6f 6e 74 72 6f 6c 20 73 74 + 61 63 6b 20 65 6d 70 74 79 2c 20 73 6f 20 74 72 + 79 69 6e 67 20 74 6f 20 72 65 74 75 72 6e 20 77 + 69 6c 6c 20 70 6f 70 20 61 20 76 61 6c 75 65 20 + 74 68 61 74 20 64 6f 65 73 6e 27 74 0a + + ~ "~ exist, and crash. Eventually, the bottom value on the" + ~ " control stack will" + 7e 20 65 78 69 73 74 2c 20 61 6e 64 20 63 72 61 + 73 68 2e 20 45 76 65 6e 74 75 61 6c 6c 79 2c 20 + 74 68 65 20 62 6f 74 74 6f 6d 20 76 61 6c 75 65 + 20 6f 6e 20 74 68 65 20 63 6f 6e 74 72 6f 6c 20 + 73 74 61 63 6b 20 77 69 6c 6c 0a + + ~ "~ be the word "quit", which loops forever and is the" + ~ " closest thing Forth has" + 7e 20 62 65 20 74 68 65 20 77 6f 72 64 20 22 71 + 75 69 74 22 2c 20 77 68 69 63 68 20 6c 6f 6f 70 + 73 20 66 6f 72 65 76 65 72 20 61 6e 64 20 69 73 + 20 74 68 65 20 63 6c 6f 73 65 73 74 20 74 68 69 + 6e 67 20 46 6f 72 74 68 20 68 61 73 0a + + ~ "~ to a "main" word, but it's up to warm-start to make that" + ~ " happen." + 7e 20 74 6f 20 61 20 22 6d 61 69 6e 22 20 77 6f + 72 64 2c 20 62 75 74 20 69 74 27 73 20 75 70 20 + 74 6f 20 77 61 72 6d 2d 73 74 61 72 74 20 74 6f + 20 6d 61 6b 65 20 74 68 61 74 20 68 61 70 70 65 + 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Cold-start is really only responsible for one-time" + ~ " initialization." + 7e 20 20 20 43 6f 6c 64 2d 73 74 61 72 74 20 69 + 73 20 72 65 61 6c 6c 79 20 6f 6e 6c 79 20 72 65 + 73 70 6f 6e 73 69 62 6c 65 20 66 6f 72 20 6f 6e + 65 2d 74 69 6d 65 20 69 6e 69 74 69 61 6c 69 7a + 61 74 69 6f 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~" + 7e 0a + + ~ "~" + 7e 0a + + ~ "~ Registers in:" + 7e 20 52 65 67 69 73 74 65 72 73 20 69 6e 3a 0a + + ~ "~" + 7e 0a + + ~ "~ * rsp points to the logical top of the value stack" + 7e 20 2a 20 72 73 70 20 70 6f 69 6e 74 73 20 74 + 6f 20 74 68 65 20 6c 6f 67 69 63 61 6c 20 74 6f + 70 20 20 6f 66 20 74 68 65 20 76 61 6c 75 65 20 + 73 74 61 63 6b 0a + + ~ "~ The kernel sets this up for us, and we need to save" + ~ " it somewhere so" + 7e 20 20 20 20 20 54 68 65 20 6b 65 72 6e 65 6c + 20 73 65 74 73 20 74 68 69 73 20 75 70 20 66 6f + 72 20 75 73 2c 20 61 6e 64 20 77 65 20 6e 65 65 + 64 20 74 6f 20 73 61 76 65 20 69 74 20 73 6f 6d + 65 77 68 65 72 65 20 73 6f 0a + + ~ "~ Forth can use it." + 7e 20 20 20 46 6f 72 74 68 20 63 61 6e 20 75 73 + 65 20 69 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Registers out:" + 7e 20 52 65 67 69 73 74 65 72 73 20 6f 75 74 3a + 0a + + ~ "~" + 7e 0a + + ~ "~ * rsi points within "warm-start"" + 7e 20 2a 20 72 73 69 20 70 6f 69 6e 74 73 20 77 + 69 74 68 69 6e 20 22 77 61 72 6d 2d 73 74 61 72 + 74 22 0a + + ~ "~ * rsp points to the top of the value stack" + 7e 20 2a 20 72 73 70 20 70 6f 69 6e 74 73 20 74 + 6f 20 74 68 65 20 74 6f 70 20 6f 66 20 74 68 65 + 20 76 61 6c 75 65 20 73 74 61 63 6b 0a + + ~ "~ * rbp points to the top of the control stack" + 7e 20 2a 20 72 62 70 20 70 6f 69 6e 74 73 20 74 + 6f 20 74 68 65 20 74 6f 70 20 6f 66 20 74 68 65 + 20 63 6f 6e 74 72 6f 6c 20 73 74 61 63 6b 0a + + ~ "~" + 7e 0a + + ~ "~ Stack in:" + 7e 20 53 74 61 63 6b 20 69 6e 3a 0a + + ~ "~" + 7e 0a + + ~ "~ * argc, argv, envp in the usual Unix way" + 7e 20 2a 20 61 72 67 63 2c 20 61 72 67 76 2c 20 + 65 6e 76 70 20 69 6e 20 74 68 65 20 75 73 75 61 + 6c 20 55 6e 69 78 20 77 61 79 0a + + ~ "~ We ignore them, though." + 7e 20 20 20 20 20 57 65 20 69 67 6e 6f 72 65 20 + 74 68 65 6d 2c 20 74 68 6f 75 67 68 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Stack out:" + 7e 20 53 74 61 63 6b 20 6f 75 74 3a 0a + + ~ "~" + 7e 0a + + ~ "~ * The value of "log", as a pointer" + 7e 20 2a 20 54 68 65 20 76 61 6c 75 65 20 6f 66 + 20 22 6c 6f 67 22 2c 20 61 73 20 61 20 70 6f 69 + 6e 74 65 72 0a + + ~ "~ The meaning of this will be explained below." + 7e 20 20 20 20 20 54 68 65 20 6d 65 61 6e 69 6e + 67 20 6f 66 20 74 68 69 73 20 77 69 6c 6c 20 62 + 65 20 65 78 70 6c 61 69 6e 65 64 20 62 65 6c 6f + 77 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Registers within:" + 7e 20 52 65 67 69 73 74 65 72 73 20 77 69 74 68 + 69 6e 3a 0a + + ~ "~" + 7e 0a + + ~ "~ * rdi points to the base the log was allocated at, once" + ~ " it exists" + 7e 20 2a 20 72 64 69 20 70 6f 69 6e 74 73 20 74 + 6f 20 74 68 65 20 62 61 73 65 20 74 68 65 20 6c + 6f 67 20 77 61 73 20 61 6c 6c 6f 63 61 74 65 64 + 20 61 74 2c 20 6f 6e 63 65 20 69 74 20 65 78 69 + 73 74 73 0a + + ~ "~ This is the same value that "log" will hold, once we" + ~ " reach a point" + 7e 20 20 20 20 20 54 68 69 73 20 69 73 20 74 68 + 65 20 73 61 6d 65 20 76 61 6c 75 65 20 74 68 61 + 74 20 22 6c 6f 67 22 20 77 69 6c 6c 20 68 6f 6c + 64 2c 20 6f 6e 63 65 20 77 65 20 72 65 61 63 68 + 20 61 20 70 6f 69 6e 74 0a + + ~ "~ where we have variables. Of course, variables are" + ~ " stored on the log," + 7e 20 20 20 77 68 65 72 65 20 77 65 20 68 61 76 + 65 20 76 61 72 69 61 62 6c 65 73 2e 20 4f 66 20 + 63 6f 75 72 73 65 2c 20 76 61 72 69 61 62 6c 65 + 73 20 61 72 65 20 73 74 6f 72 65 64 20 6f 6e 20 + 74 68 65 20 6c 6f 67 2c 0a + + ~ "~ hence this temporary measure." + 7e 20 20 20 68 65 6e 63 65 20 74 68 69 73 20 74 + 65 6d 70 6f 72 61 72 79 20 6d 65 61 73 75 72 65 + 2e 0a + + ~ "~" + 7e 0a + + ~ "~ We also take this opportunity to define soeme memory" + ~ " layout parameters" + 7e 20 20 20 57 65 20 61 6c 73 6f 20 74 61 6b 65 + 20 74 68 69 73 20 6f 70 70 6f 72 74 75 6e 69 74 + 79 20 74 6f 20 64 65 66 69 6e 65 20 73 6f 65 6d + 65 20 6d 65 6d 6f 72 79 20 6c 61 79 6f 75 74 20 + 70 61 72 61 6d 65 74 65 72 73 0a + + ~ "~ that this routine will be responsible for doing something" + ~ " with:" + 7e 20 74 68 61 74 20 74 68 69 73 20 72 6f 75 74 + 69 6e 65 20 77 69 6c 6c 20 62 65 20 72 65 73 70 + 6f 6e 73 69 62 6c 65 20 66 6f 72 20 64 6f 69 6e + 67 20 73 6f 6d 65 74 68 69 6e 67 20 77 69 74 68 + 3a 0a + + ~ "~" + 7e 0a + + ~ "~ (output memory start, current output point" + 7e 20 28 6f 75 74 70 75 74 20 6d 65 6d 6f 72 79 + 20 73 74 61 72 74 2c 20 63 75 72 72 65 6e 74 20 + 6f 75 74 70 75 74 20 70 6f 69 6e 74 0a + + ~ "~ -- output memory start, current output point)" + 7e 20 20 2d 2d 20 6f 75 74 70 75 74 20 6d 65 6d + 6f 72 79 20 73 74 61 72 74 2c 20 63 75 72 72 65 + 6e 74 20 6f 75 74 70 75 74 20 70 6f 69 6e 74 29 + 0a + + ~ ": output-cold-start" + 3a 20 6f 75 74 70 75 74 2d 63 6f 6c 64 2d 73 74 + 61 72 74 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~" + ~ " ~ ~ ~ ~ ~ ~ ~ ~ ~" + 20 20 7e 20 3a 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 0a + + ~ " ~ : ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~" + ~ " ~ ~ ~ ~ ~ ~ ~ ~ ~ ~" + 20 20 7e 20 3a 20 20 7e 20 7e 20 7e 20 7e 20 7e + 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e + 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e + 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e + 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 0a + + ~ " ~ : ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~" + ~ " ~ ~ ~ ~ ~ ~ ~ ~ ~" + 20 20 7e 20 3a 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 0a + + ~ " ~ :" + ~ " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + ~ "~~~~~~~~~~~~~" + 20 20 7e 20 3a 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : This is the start of the cold-start routine, which" + ~ " is the first code" + 20 20 7e 20 3a 20 20 20 54 68 69 73 20 69 73 20 + 74 68 65 20 73 74 61 72 74 20 6f 66 20 74 68 65 + 20 63 6f 6c 64 2d 73 74 61 72 74 20 72 6f 75 74 + 69 6e 65 2c 20 77 68 69 63 68 20 69 73 20 74 68 + 65 20 66 69 72 73 74 20 63 6f 64 65 0a + + ~ " ~ : of any kind the executable runs. It has the" + ~ " responsibility of creating" + 20 20 7e 20 3a 20 6f 66 20 61 6e 79 20 6b 69 6e + 64 20 74 68 65 20 65 78 65 63 75 74 61 62 6c 65 + 20 72 75 6e 73 2e 20 49 74 20 68 61 73 20 74 68 + 65 20 72 65 73 70 6f 6e 73 69 62 69 6c 69 74 79 + 20 6f 66 20 63 72 65 61 74 69 6e 67 0a + + ~ " ~ : the Forth execution environment, then invoking the" + ~ " warm-start routine," + 20 20 7e 20 3a 20 74 68 65 20 46 6f 72 74 68 20 + 65 78 65 63 75 74 69 6f 6e 20 65 6e 76 69 72 6f + 6e 6d 65 6e 74 2c 20 74 68 65 6e 20 69 6e 76 6f + 6b 69 6e 67 20 74 68 65 20 77 61 72 6d 2d 73 74 + 61 72 74 20 72 6f 75 74 69 6e 65 2c 0a + + ~ " ~ : which is defined below." + 20 20 7e 20 3a 20 77 68 69 63 68 20 69 73 20 64 + 65 66 69 6e 65 64 20 62 65 6c 6f 77 2e 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : indent" + 20 20 7e 20 3a 20 69 6e 64 65 6e 74 0a + + ~ "" + 0a + + ~ " current-offset L' cold-start set-label" + 20 20 63 75 72 72 65 6e 74 2d 6f 66 66 73 65 74 + 20 4c 27 20 63 6f 6c 64 2d 73 74 61 72 74 20 73 + 65 74 2d 6c 61 62 65 6c 0a + + ~ " cld ~ clear the DF" + ~ " flag" + 20 20 63 6c 64 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 7e 20 63 6c 65 + 61 72 20 74 68 65 20 44 46 20 66 6c 61 67 0a + + ~ "" + 0a + + ~ " ~ Prepare the log." + 20 20 7e 20 20 20 50 72 65 70 61 72 65 20 74 68 + 65 20 6c 6f 67 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ We could ask for a data segment in the program" + ~ " header, but where's the" + 20 20 7e 20 20 20 57 65 20 63 6f 75 6c 64 20 61 + 73 6b 20 66 6f 72 20 61 20 64 61 74 61 20 73 65 + 67 6d 65 6e 74 20 69 6e 20 74 68 65 20 70 72 6f + 67 72 61 6d 20 68 65 61 64 65 72 2c 20 62 75 74 + 20 77 68 65 72 65 27 73 20 74 68 65 0a + + ~ " ~ fun in that? Instead, we call mmap()." + 20 20 7e 20 66 75 6e 20 69 6e 20 74 68 61 74 3f + 20 49 6e 73 74 65 61 64 2c 20 77 65 20 63 61 6c + 6c 20 6d 6d 61 70 28 29 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ If we wanted the kernel to do ASLR for us, passing" + ~ " address zero would" + 20 20 7e 20 20 20 49 66 20 77 65 20 77 61 6e 74 + 65 64 20 74 68 65 20 6b 65 72 6e 65 6c 20 74 6f + 20 64 6f 20 41 53 4c 52 20 66 6f 72 20 75 73 2c + 20 70 61 73 73 69 6e 67 20 61 64 64 72 65 73 73 + 20 7a 65 72 6f 20 77 6f 75 6c 64 0a + + ~ " ~ cause it to pick somewhere at random, but instead we" + ~ " choose our own" + 20 20 7e 20 63 61 75 73 65 20 69 74 20 74 6f 20 + 70 69 63 6b 20 73 6f 6d 65 77 68 65 72 65 20 61 + 74 20 72 61 6e 64 6f 6d 2c 20 62 75 74 20 69 6e + 73 74 65 61 64 20 77 65 20 63 68 6f 6f 73 65 20 + 6f 75 72 20 6f 77 6e 0a + + ~ " ~ location. It's still not guaranteed to be where we ask" + ~ " for, so we still" + 20 20 7e 20 6c 6f 63 61 74 69 6f 6e 2e 20 49 74 + 27 73 20 73 74 69 6c 6c 20 6e 6f 74 20 67 75 61 + 72 61 6e 74 65 65 64 20 74 6f 20 62 65 20 77 68 + 65 72 65 20 77 65 20 61 73 6b 20 66 6f 72 2c 20 + 73 6f 20 77 65 20 73 74 69 6c 6c 0a + + ~ " ~ do the work to record where it wound up. We could pass" + ~ " the "fixed" flag" + 20 20 7e 20 64 6f 20 74 68 65 20 77 6f 72 6b 20 + 74 6f 20 72 65 63 6f 72 64 20 77 68 65 72 65 20 + 69 74 20 77 6f 75 6e 64 20 75 70 2e 20 57 65 20 + 63 6f 75 6c 64 20 70 61 73 73 20 74 68 65 20 22 + 66 69 78 65 64 22 20 66 6c 61 67 0a + + ~ " ~ and the kernel would trust us, but this gives us more" + ~ " options for" + 20 20 7e 20 61 6e 64 20 74 68 65 20 6b 65 72 6e + 65 6c 20 77 6f 75 6c 64 20 74 72 75 73 74 20 75 + 73 2c 20 62 75 74 20 74 68 69 73 20 67 69 76 65 + 73 20 75 73 20 6d 6f 72 65 20 6f 70 74 69 6f 6e + 73 20 66 6f 72 0a + + ~ " ~ interoperating with other runtimes." + 20 20 7e 20 69 6e 74 65 72 6f 70 65 72 61 74 69 + 6e 67 20 77 69 74 68 20 6f 74 68 65 72 20 72 75 + 6e 74 69 6d 65 73 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " 9 :rax mov-reg64-imm64 ~ : mmap()" + 20 20 39 20 3a 72 61 78 20 6d 6f 76 2d 72 65 67 + 36 34 2d 69 6d 6d 36 34 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 7e 20 3a 20 20 20 + 6d 6d 61 70 28 29 0a + + ~ " log-requested-address :rdi mov-reg64-imm64" + 20 20 6c 6f 67 2d 72 65 71 75 65 73 74 65 64 2d + 61 64 64 72 65 73 73 20 3a 72 64 69 20 6d 6f 76 + 2d 72 65 67 36 34 2d 69 6d 6d 36 34 0a + + ~ " ~ : 0 address" + ~ " (very arbitrary)" + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 7e 20 3a 20 30 20 + 20 20 61 64 64 72 65 73 73 20 28 76 65 72 79 20 + 61 72 62 69 74 72 61 72 79 29 0a + + ~ " log-size :rsi mov-reg64-imm64 ~ : size (one" + ~ " meg)" + 20 20 6c 6f 67 2d 73 69 7a 65 20 3a 72 73 69 20 + 6d 6f 76 2d 72 65 67 36 34 2d 69 6d 6d 36 34 20 + 20 20 20 20 20 20 20 20 20 20 7e 20 3a 20 20 20 + 73 69 7a 65 20 28 6f 6e 65 20 6d 65 67 29 0a + + ~ " 0x07 :rdx mov-reg64-imm64" + 20 20 30 78 30 37 20 3a 72 64 78 20 6d 6f 76 2d + 72 65 67 36 34 2d 69 6d 6d 36 34 0a + + ~ " ~ : 0 " + ~ " protection (read+write+exec)" + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 7e 20 3a 20 30 20 + 20 20 70 72 6f 74 65 63 74 69 6f 6e 20 28 72 65 + 61 64 2b 77 72 69 74 65 2b 65 78 65 63 29 0a + + ~ " 0x22 :r10 mov-extrareg64-imm64 ~ : flags" + ~ " (private+anonymous)" + 20 20 30 78 32 32 20 3a 72 31 30 20 6d 6f 76 2d + 65 78 74 72 61 72 65 67 36 34 2d 69 6d 6d 36 34 + 20 20 20 20 20 20 20 20 20 20 7e 20 3a 20 20 20 + 66 6c 61 67 73 20 28 70 72 69 76 61 74 65 2b 61 + 6e 6f 6e 79 6d 6f 75 73 29 0a + + ~ " 0 :r8 mov-extrareg64-imm64 ~ : file" + ~ " descriptor (ignored)" + 20 20 30 20 3a 72 38 20 6d 6f 76 2d 65 78 74 72 + 61 72 65 67 36 34 2d 69 6d 6d 36 34 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 7e 20 3a 20 20 20 + 66 69 6c 65 20 64 65 73 63 72 69 70 74 6f 72 20 + 28 69 67 6e 6f 72 65 64 29 0a + + ~ " 0 :r9 mov-extrareg64-imm64 ~ : offset" + ~ " (ignored)" + 20 20 30 20 3a 72 39 20 6d 6f 76 2d 65 78 74 72 + 61 72 65 67 36 34 2d 69 6d 6d 36 34 20 20 20 20 + 20 20 20 20 20 20 20 20 20 20 7e 20 3a 20 20 20 + 6f 66 66 73 65 74 20 28 69 67 6e 6f 72 65 64 29 + 0a + + ~ " syscall" + 20 20 73 79 73 63 61 6c 6c 0a + + ~ "" + 0a + + ~ " ~ The return value of the system call is in rax, we'll" + ~ " use it in a sec." + 20 20 7e 20 20 20 54 68 65 20 72 65 74 75 72 6e + 20 76 61 6c 75 65 20 6f 66 20 74 68 65 20 73 79 + 73 74 65 6d 20 63 61 6c 6c 20 69 73 20 69 6e 20 + 72 61 78 2c 20 77 65 27 6c 6c 20 75 73 65 20 69 + 74 20 69 6e 20 61 20 73 65 63 2e 0a + + ~ " ~ We need to save this somewhere in case we ever want to" + ~ " munmap() it;" + 20 20 7e 20 57 65 20 6e 65 65 64 20 74 6f 20 73 + 61 76 65 20 74 68 69 73 20 73 6f 6d 65 77 68 65 + 72 65 20 69 6e 20 63 61 73 65 20 77 65 20 65 76 + 65 72 20 77 61 6e 74 20 74 6f 20 6d 75 6e 6d 61 + 70 28 29 20 69 74 3b 0a + + ~ " ~ there's no widely-used name for it so we have to make" + ~ " one up. S0 and r0" + 20 20 7e 20 74 68 65 72 65 27 73 20 6e 6f 20 77 + 69 64 65 6c 79 2d 75 73 65 64 20 6e 61 6d 65 20 + 66 6f 72 20 69 74 20 73 6f 20 77 65 20 68 61 76 + 65 20 74 6f 20 6d 61 6b 65 20 6f 6e 65 20 75 70 + 2e 20 53 30 20 61 6e 64 20 72 30 0a + + ~ " ~ are widely-used names for the physical tops (logical" + ~ " bottoms) of the" + 20 20 7e 20 61 72 65 20 77 69 64 65 6c 79 2d 75 + 73 65 64 20 6e 61 6d 65 73 20 66 6f 72 20 74 68 + 65 20 70 68 79 73 69 63 61 6c 20 74 6f 70 73 20 + 28 6c 6f 67 69 63 61 6c 20 62 6f 74 74 6f 6d 73 + 29 20 6f 66 20 74 68 65 0a + + ~ " ~ value and control stacks, respectively, and we will" + ~ " eventually set those" + 20 20 7e 20 76 61 6c 75 65 20 61 6e 64 20 63 6f + 6e 74 72 6f 6c 20 73 74 61 63 6b 73 2c 20 72 65 + 73 70 65 63 74 69 76 65 6c 79 2c 20 61 6e 64 20 + 77 65 20 77 69 6c 6c 20 65 76 65 6e 74 75 61 6c + 6c 79 20 73 65 74 20 74 68 6f 73 65 0a + + ~ " ~ up as well, so we should keep those names in mind. The" + ~ " control stack" + 20 20 7e 20 75 70 20 61 73 20 77 65 6c 6c 2c 20 + 73 6f 20 77 65 20 73 68 6f 75 6c 64 20 6b 65 65 + 70 20 74 68 6f 73 65 20 6e 61 6d 65 73 20 69 6e + 20 6d 69 6e 64 2e 20 54 68 65 20 63 6f 6e 74 72 + 6f 6c 20 73 74 61 63 6b 0a + + ~ " ~ lives within the log, while the value stack is its own" + ~ " segment. This" + 20 20 7e 20 6c 69 76 65 73 20 77 69 74 68 69 6e + 20 74 68 65 20 6c 6f 67 2c 20 77 68 69 6c 65 20 + 74 68 65 20 76 61 6c 75 65 20 73 74 61 63 6b 20 + 69 73 20 69 74 73 20 6f 77 6e 20 73 65 67 6d 65 + 6e 74 2e 20 54 68 69 73 0a + + ~ " ~ value, though, is the physical bottom of the segment," + ~ " meaning that it" + 20 20 7e 20 76 61 6c 75 65 2c 20 74 68 6f 75 67 + 68 2c 20 69 73 20 74 68 65 20 70 68 79 73 69 63 + 61 6c 20 62 6f 74 74 6f 6d 20 6f 66 20 74 68 65 + 20 73 65 67 6d 65 6e 74 2c 20 6d 65 61 6e 69 6e + 67 20 74 68 61 74 20 69 74 0a + + ~ " ~ stays the same even as we allocate and deallocate" + ~ " things within it. This" + 20 20 7e 20 73 74 61 79 73 20 74 68 65 20 73 61 + 6d 65 20 65 76 65 6e 20 61 73 20 77 65 20 61 6c + 6c 6f 63 61 74 65 20 61 6e 64 20 64 65 61 6c 6c + 6f 63 61 74 65 20 74 68 69 6e 67 73 20 77 69 74 + 68 69 6e 20 69 74 2e 20 54 68 69 73 0a + + ~ " ~ is unlike the two stack pointers, so we give it a name" + ~ " that doesn't" + 20 20 7e 20 69 73 20 75 6e 6c 69 6b 65 20 74 68 + 65 20 74 77 6f 20 73 74 61 63 6b 20 70 6f 69 6e + 74 65 72 73 2c 20 73 6f 20 77 65 20 67 69 76 65 + 20 69 74 20 61 20 6e 61 6d 65 20 74 68 61 74 20 + 64 6f 65 73 6e 27 74 0a + + ~ " ~ suggest similarity: "log"." + 20 20 7e 20 73 75 67 67 65 73 74 20 73 69 6d 69 + 6c 61 72 69 74 79 3a 20 22 6c 6f 67 22 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ Once Forth is fully set up, its internal variables" + ~ " will be accessed" + 20 20 7e 20 20 20 4f 6e 63 65 20 46 6f 72 74 68 + 20 69 73 20 66 75 6c 6c 79 20 73 65 74 20 75 70 + 2c 20 69 74 73 20 69 6e 74 65 72 6e 61 6c 20 76 + 61 72 69 61 62 6c 65 73 20 77 69 6c 6c 20 62 65 + 20 61 63 63 65 73 73 65 64 0a + + ~ " ~ through variable-words like any other Forth data," + ~ " including "log". To" + 20 20 7e 20 74 68 72 6f 75 67 68 20 76 61 72 69 + 61 62 6c 65 2d 77 6f 72 64 73 20 6c 69 6b 65 20 + 61 6e 79 20 6f 74 68 65 72 20 46 6f 72 74 68 20 + 64 61 74 61 2c 20 69 6e 63 6c 75 64 69 6e 67 20 + 22 6c 6f 67 22 2e 20 54 6f 0a + + ~ " ~ get to that point, though, we need to be able to hold" + ~ " onto variable data" + 20 20 7e 20 67 65 74 20 74 6f 20 74 68 61 74 20 + 70 6f 69 6e 74 2c 20 74 68 6f 75 67 68 2c 20 77 + 65 20 6e 65 65 64 20 74 6f 20 62 65 20 61 62 6c + 65 20 74 6f 20 68 6f 6c 64 20 6f 6e 74 6f 20 76 + 61 72 69 61 62 6c 65 20 64 61 74 61 0a + + ~ " ~ between now and then. In fact, if we don't have at" + ~ " least one of "log"" + 20 20 7e 20 62 65 74 77 65 65 6e 20 6e 6f 77 20 + 61 6e 64 20 74 68 65 6e 2e 20 49 6e 20 66 61 63 + 74 2c 20 69 66 20 77 65 20 64 6f 6e 27 74 20 68 + 61 76 65 20 61 74 20 6c 65 61 73 74 20 6f 6e 65 + 20 6f 66 20 22 6c 6f 67 22 0a + + ~ " ~ and "here" (its counterpart which points to the logical" + ~ " top end), all" + 20 20 7e 20 61 6e 64 20 22 68 65 72 65 22 20 28 + 69 74 73 20 63 6f 75 6e 74 65 72 70 61 72 74 20 + 77 68 69 63 68 20 70 6f 69 6e 74 73 20 74 6f 20 + 74 68 65 20 6c 6f 67 69 63 61 6c 20 74 6f 70 20 + 65 6e 64 29 2c 20 61 6c 6c 0a + + ~ " ~ our efforts to hold onto anything seem a bit doomed." + 20 20 7e 20 6f 75 72 20 65 66 66 6f 72 74 73 20 + 74 6f 20 68 6f 6c 64 20 6f 6e 74 6f 20 61 6e 79 + 74 68 69 6e 67 20 73 65 65 6d 20 61 20 62 69 74 + 20 64 6f 6f 6d 65 64 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ So, we temporarily dedicate rdi to "log" - only" + ~ " within this routine -" + 20 20 7e 20 20 20 53 6f 2c 20 77 65 20 74 65 6d + 70 6f 72 61 72 69 6c 79 20 64 65 64 69 63 61 74 + 65 20 72 64 69 20 74 6f 20 22 6c 6f 67 22 20 2d + 20 6f 6e 6c 79 20 77 69 74 68 69 6e 20 74 68 69 + 73 20 72 6f 75 74 69 6e 65 20 2d 0a + + ~ " ~ and store everything else in ways that let us find" + ~ " things by reference" + 20 20 7e 20 61 6e 64 20 73 74 6f 72 65 20 65 76 + 65 72 79 74 68 69 6e 67 20 65 6c 73 65 20 69 6e + 20 77 61 79 73 20 74 68 61 74 20 6c 65 74 20 75 + 73 20 66 69 6e 64 20 74 68 69 6e 67 73 20 62 79 + 20 72 65 66 65 72 65 6e 63 65 0a + + ~ " ~ to it. We choose rdi because it works with the indexing" + ~ " modes we care" + 20 20 7e 20 74 6f 20 69 74 2e 20 57 65 20 63 68 + 6f 6f 73 65 20 72 64 69 20 62 65 63 61 75 73 65 + 20 69 74 20 77 6f 72 6b 73 20 77 69 74 68 20 74 + 68 65 20 69 6e 64 65 78 69 6e 67 20 6d 6f 64 65 + 73 20 77 65 20 63 61 72 65 0a + + ~ " ~ about, and its name suggests its function." + 20 20 7e 20 61 62 6f 75 74 2c 20 61 6e 64 20 69 + 74 73 20 6e 61 6d 65 20 73 75 67 67 65 73 74 73 + 20 69 74 73 20 66 75 6e 63 74 69 6f 6e 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ The strategy Jonesforth uses is not applicable to us;" + ~ " Jonesforth" + 20 20 7e 20 20 20 54 68 65 20 73 74 72 61 74 65 + 67 79 20 4a 6f 6e 65 73 66 6f 72 74 68 20 75 73 + 65 73 20 69 73 20 6e 6f 74 20 61 70 70 6c 69 63 + 61 62 6c 65 20 74 6f 20 75 73 3b 20 4a 6f 6e 65 + 73 66 6f 72 74 68 0a + + ~ " ~ takes advantage of the linker to let its code segment" + ~ " refer to specific," + 20 20 7e 20 74 61 6b 65 73 20 61 64 76 61 6e 74 + 61 67 65 20 6f 66 20 74 68 65 20 6c 69 6e 6b 65 + 72 20 74 6f 20 6c 65 74 20 69 74 73 20 63 6f 64 + 65 20 73 65 67 6d 65 6e 74 20 72 65 66 65 72 20 + 74 6f 20 73 70 65 63 69 66 69 63 2c 0a + + ~ " ~ pre-allocated objects in the data segment. We are our" + ~ " own linker, and we" + 20 20 7e 20 70 72 65 2d 61 6c 6c 6f 63 61 74 65 + 64 20 6f 62 6a 65 63 74 73 20 69 6e 20 74 68 65 + 20 64 61 74 61 20 73 65 67 6d 65 6e 74 2e 20 57 + 65 20 61 72 65 20 6f 75 72 20 6f 77 6e 20 6c 69 + 6e 6b 65 72 2c 20 61 6e 64 20 77 65 0a + + ~ " ~ don't care to have a data segment. Hence, this" + ~ " approach." + 20 20 7e 20 64 6f 6e 27 74 20 63 61 72 65 20 74 + 6f 20 68 61 76 65 20 61 20 64 61 74 61 20 73 65 + 67 6d 65 6e 74 2e 20 48 65 6e 63 65 2c 20 74 68 + 69 73 20 61 70 70 72 6f 61 63 68 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ Keying things off "log" is the fundamental decision," + ~ " but to make sure" + 20 20 7e 20 20 20 4b 65 79 69 6e 67 20 74 68 69 + 6e 67 73 20 6f 66 66 20 22 6c 6f 67 22 20 69 73 + 20 74 68 65 20 66 75 6e 64 61 6d 65 6e 74 61 6c + 20 64 65 63 69 73 69 6f 6e 2c 20 62 75 74 20 74 + 6f 20 6d 61 6b 65 20 73 75 72 65 0a + + ~ " ~ our variables are accessible both during early" + ~ " bootstrapping, and later," + 20 20 7e 20 6f 75 72 20 76 61 72 69 61 62 6c 65 + 73 20 61 72 65 20 61 63 63 65 73 73 69 62 6c 65 + 20 62 6f 74 68 20 64 75 72 69 6e 67 20 65 61 72 + 6c 79 20 62 6f 6f 74 73 74 72 61 70 70 69 6e 67 + 2c 20 61 6e 64 20 6c 61 74 65 72 2c 0a + + ~ " ~ we also have to be thoughtful about data structures." + ~ " More on that in a" + 20 20 7e 20 77 65 20 61 6c 73 6f 20 68 61 76 65 + 20 74 6f 20 62 65 20 74 68 6f 75 67 68 74 66 75 + 6c 20 61 62 6f 75 74 20 64 61 74 61 20 73 74 72 + 75 63 74 75 72 65 73 2e 20 4d 6f 72 65 20 6f 6e + 20 74 68 61 74 20 69 6e 20 61 0a + + ~ " ~ moment." + 20 20 7e 20 6d 6f 6d 65 6e 74 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " :rax :rdi mov-reg64-reg64" + 20 20 3a 72 61 78 20 3a 72 64 69 20 6d 6f 76 2d + 72 65 67 36 34 2d 72 65 67 36 34 0a + + ~ "" + 0a + + ~ " ~ We also initialize rbp. We could hold off and let" + ~ " "quit" do this, but" + 20 20 7e 20 20 20 57 65 20 61 6c 73 6f 20 69 6e + 69 74 69 61 6c 69 7a 65 20 72 62 70 2e 20 57 65 + 20 63 6f 75 6c 64 20 68 6f 6c 64 20 6f 66 66 20 + 61 6e 64 20 6c 65 74 20 22 71 75 69 74 22 20 64 + 6f 20 74 68 69 73 2c 20 62 75 74 0a + + ~ " ~ doing it now is the easiest way to initialize the r0" + ~ " variable, since" + 20 20 7e 20 64 6f 69 6e 67 20 69 74 20 6e 6f 77 + 20 69 73 20 74 68 65 20 65 61 73 69 65 73 74 20 + 77 61 79 20 74 6f 20 69 6e 69 74 69 61 6c 69 7a + 65 20 74 68 65 20 72 30 20 76 61 72 69 61 62 6c + 65 2c 20 73 69 6e 63 65 0a + + ~ " ~ there's no instruction that moves a 64-bit immediate to" + ~ " memory." + 20 20 7e 20 74 68 65 72 65 27 73 20 6e 6f 20 69 + 6e 73 74 72 75 63 74 69 6f 6e 20 74 68 61 74 20 + 6d 6f 76 65 73 20 61 20 36 34 2d 62 69 74 20 69 + 6d 6d 65 64 69 61 74 65 20 74 6f 20 6d 65 6d 6f + 72 79 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ This is the moment at which we decide where the" + ~ " control stack starts!" + 20 20 7e 20 20 20 54 68 69 73 20 69 73 20 74 68 + 65 20 6d 6f 6d 65 6e 74 20 61 74 20 77 68 69 63 + 68 20 77 65 20 64 65 63 69 64 65 20 77 68 65 72 + 65 20 74 68 65 20 63 6f 6e 74 72 6f 6c 20 73 74 + 61 63 6b 20 73 74 61 72 74 73 21 0a + + ~ " ~ Fun, right? "Allocation" is just a fancy word for" + ~ " picking where we want" + 20 20 7e 20 46 75 6e 2c 20 72 69 67 68 74 3f 20 + 22 41 6c 6c 6f 63 61 74 69 6f 6e 22 20 69 73 20 + 6a 75 73 74 20 61 20 66 61 6e 63 79 20 77 6f 72 + 64 20 66 6f 72 20 70 69 63 6b 69 6e 67 20 77 68 + 65 72 65 20 77 65 20 77 61 6e 74 0a + + ~ " ~ something, then being consistent about it - like" + ~ " placing furniture in" + 20 20 7e 20 73 6f 6d 65 74 68 69 6e 67 2c 20 74 + 68 65 6e 20 62 65 69 6e 67 20 63 6f 6e 73 69 73 + 74 65 6e 74 20 61 62 6f 75 74 20 69 74 20 2d 20 + 6c 69 6b 65 20 70 6c 61 63 69 6e 67 20 66 75 72 + 6e 69 74 75 72 65 20 69 6e 0a + + ~ " ~ your home. See below for a little more thought about" + ~ " why here in" + 20 20 7e 20 79 6f 75 72 20 68 6f 6d 65 2e 20 53 + 65 65 20 62 65 6c 6f 77 20 66 6f 72 20 61 20 6c + 69 74 74 6c 65 20 6d 6f 72 65 20 74 68 6f 75 67 + 68 74 20 61 62 6f 75 74 20 77 68 79 20 68 65 72 + 65 20 69 6e 0a + + ~ " ~ particular." + 20 20 7e 20 70 61 72 74 69 63 75 6c 61 72 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " :rdi control-stack-size :rbp lea-reg64-disp32-reg64" + 20 20 3a 72 64 69 20 63 6f 6e 74 72 6f 6c 2d 73 + 74 61 63 6b 2d 73 69 7a 65 20 3a 72 62 70 20 6c + 65 61 2d 72 65 67 36 34 2d 64 69 73 70 33 32 2d + 72 65 67 36 34 0a + + ~ "" + 0a + + ~ " ~ Now we save some stuff onto the log. These are the" + ~ " locations that" + 20 20 7e 20 20 20 4e 6f 77 20 77 65 20 73 61 76 + 65 20 73 6f 6d 65 20 73 74 75 66 66 20 6f 6e 74 + 6f 20 74 68 65 20 6c 6f 67 2e 20 54 68 65 73 65 + 20 61 72 65 20 74 68 65 20 6c 6f 63 61 74 69 6f + 6e 73 20 74 68 61 74 0a + + ~ " ~ will eventually be the backing stores of the Forth" + ~ " variables, but we" + 20 20 7e 20 77 69 6c 6c 20 65 76 65 6e 74 75 61 + 6c 6c 79 20 62 65 20 74 68 65 20 62 61 63 6b 69 + 6e 67 20 73 74 6f 72 65 73 20 6f 66 20 74 68 65 + 20 46 6f 72 74 68 20 76 61 72 69 61 62 6c 65 73 + 2c 20 62 75 74 20 77 65 0a + + ~ " ~ don't create the word headers yet, since there's no" + ~ " requirement that" + 20 20 7e 20 64 6f 6e 27 74 20 63 72 65 61 74 65 + 20 74 68 65 20 77 6f 72 64 20 68 65 61 64 65 72 + 73 20 79 65 74 2c 20 73 69 6e 63 65 20 74 68 65 + 72 65 27 73 20 6e 6f 20 72 65 71 75 69 72 65 6d + 65 6e 74 20 74 68 61 74 0a + + ~ " ~ they be next to the backing stores. We'll do that" + ~ " later, once we have" + 20 20 7e 20 74 68 65 79 20 62 65 20 6e 65 78 74 + 20 74 6f 20 74 68 65 20 62 61 63 6b 69 6e 67 20 + 73 74 6f 72 65 73 2e 20 57 65 27 6c 6c 20 64 6f + 20 74 68 61 74 20 6c 61 74 65 72 2c 20 6f 6e 63 + 65 20 77 65 20 68 61 76 65 0a + + ~ " ~ word-writing infrastructure in place. For now, we just" + ~ " use their offsets" + 20 20 7e 20 77 6f 72 64 2d 77 72 69 74 69 6e 67 + 20 69 6e 66 72 61 73 74 72 75 63 74 75 72 65 20 + 69 6e 20 70 6c 61 63 65 2e 20 46 6f 72 20 6e 6f + 77 2c 20 77 65 20 6a 75 73 74 20 75 73 65 20 74 + 68 65 69 72 20 6f 66 66 73 65 74 73 0a + + ~ " ~ relative to the physical bottom of the log, which are" + ~ " fixed." + 20 20 7e 20 72 65 6c 61 74 69 76 65 20 74 6f 20 + 74 68 65 20 70 68 79 73 69 63 61 6c 20 62 6f 74 + 74 6f 6d 20 6f 66 20 74 68 65 20 6c 6f 67 2c 20 + 77 68 69 63 68 20 61 72 65 20 66 69 78 65 64 2e + 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ These will be the permanent homes of these values," + ~ " though we have" + 20 20 7e 20 20 20 54 68 65 73 65 20 77 69 6c 6c + 20 62 65 20 74 68 65 20 70 65 72 6d 61 6e 65 6e + 74 20 68 6f 6d 65 73 20 6f 66 20 74 68 65 73 65 + 20 76 61 6c 75 65 73 2c 20 74 68 6f 75 67 68 20 + 77 65 20 68 61 76 65 0a + + ~ " ~ copies of them elsewhere while we're still in this" + ~ " routine." + 20 20 7e 20 63 6f 70 69 65 73 20 6f 66 20 74 68 + 65 6d 20 65 6c 73 65 77 68 65 72 65 20 77 68 69 + 6c 65 20 77 65 27 72 65 20 73 74 69 6c 6c 20 69 + 6e 20 74 68 69 73 20 72 6f 75 74 69 6e 65 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " :rdi control-stack-size 0x00 + :rdi" + ~ " mov-reg64-disp32-reg64 ~ log" + 20 20 3a 72 64 69 20 63 6f 6e 74 72 6f 6c 2d 73 + 74 61 63 6b 2d 73 69 7a 65 20 30 78 30 30 20 2b + 20 3a 72 64 69 20 6d 6f 76 2d 72 65 67 36 34 2d + 64 69 73 70 33 32 2d 72 65 67 36 34 20 20 7e 20 + 6c 6f 67 0a + + ~ " :rsp control-stack-size 0x08 + :rdi" + ~ " mov-reg64-disp32-reg64 ~ s0" + 20 20 3a 72 73 70 20 63 6f 6e 74 72 6f 6c 2d 73 + 74 61 63 6b 2d 73 69 7a 65 20 30 78 30 38 20 2b + 20 3a 72 64 69 20 6d 6f 76 2d 72 65 67 36 34 2d + 64 69 73 70 33 32 2d 72 65 67 36 34 20 20 7e 20 + 73 30 0a + + ~ " :rbp control-stack-size 0x10 + :rdi" + ~ " mov-reg64-disp32-reg64 ~ r0" + 20 20 3a 72 62 70 20 63 6f 6e 74 72 6f 6c 2d 73 + 74 61 63 6b 2d 73 69 7a 65 20 30 78 31 30 20 2b + 20 3a 72 64 69 20 6d 6f 76 2d 72 65 67 36 34 2d + 64 69 73 70 33 32 2d 72 65 67 36 34 20 20 7e 20 + 72 30 0a + + ~ " L@' final-word-name :rax mov-reg64-imm64" + 20 20 4c 40 27 20 66 69 6e 61 6c 2d 77 6f 72 64 + 2d 6e 61 6d 65 20 3a 72 61 78 20 6d 6f 76 2d 72 + 65 67 36 34 2d 69 6d 6d 36 34 0a + + ~ " :rax control-stack-size 0x18 + :rdi" + ~ " mov-reg64-disp32-reg64 ~ latest" + 20 20 3a 72 61 78 20 63 6f 6e 74 72 6f 6c 2d 73 + 74 61 63 6b 2d 73 69 7a 65 20 30 78 31 38 20 2b + 20 3a 72 64 69 20 6d 6f 76 2d 72 65 67 36 34 2d + 64 69 73 70 33 32 2d 72 65 67 36 34 20 20 7e 20 + 6c 61 74 65 73 74 0a + + ~ " :rdi control-stack-size 0x28 + :rax" + ~ " lea-reg64-disp32-reg64" + 20 20 3a 72 64 69 20 63 6f 6e 74 72 6f 6c 2d 73 + 74 61 63 6b 2d 73 69 7a 65 20 30 78 32 38 20 2b + 20 3a 72 61 78 20 6c 65 61 2d 72 65 67 36 34 2d + 64 69 73 70 33 32 2d 72 65 67 36 34 0a + + ~ " :rax control-stack-size 0x20 + :rdi" + ~ " mov-reg64-disp32-reg64 ~ here" + 20 20 3a 72 61 78 20 63 6f 6e 74 72 6f 6c 2d 73 + 74 61 63 6b 2d 73 69 7a 65 20 30 78 32 30 20 2b + 20 3a 72 64 69 20 6d 6f 76 2d 72 65 67 36 34 2d + 64 69 73 70 33 32 2d 72 65 67 36 34 20 20 7e 20 + 68 65 72 65 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ * "log" is the physical bottom of the log" + 20 20 7e 20 2a 20 22 6c 6f 67 22 20 69 73 20 74 + 68 65 20 70 68 79 73 69 63 61 6c 20 62 6f 74 74 + 6f 6d 20 6f 66 20 74 68 65 20 6c 6f 67 0a + + ~ " ~ The log grows upwards in memory, so this is also" + ~ " the logical" + 20 20 7e 20 20 20 20 20 54 68 65 20 6c 6f 67 20 + 67 72 6f 77 73 20 75 70 77 61 72 64 73 20 69 6e + 20 6d 65 6d 6f 72 79 2c 20 73 6f 20 74 68 69 73 + 20 69 73 20 61 6c 73 6f 20 74 68 65 20 6c 6f 67 + 69 63 61 6c 0a + + ~ " ~ bottom. This comes from the address mmap() just" + ~ " returned to us." + 20 20 7e 20 20 20 62 6f 74 74 6f 6d 2e 20 54 68 + 69 73 20 63 6f 6d 65 73 20 66 72 6f 6d 20 74 68 + 65 20 61 64 64 72 65 73 73 20 6d 6d 61 70 28 29 + 20 6a 75 73 74 20 72 65 74 75 72 6e 65 64 20 74 + 6f 20 75 73 2e 0a + + ~ " ~ * "s0" is the logical bottom of the value stack" + 20 20 7e 20 2a 20 22 73 30 22 20 69 73 20 74 68 + 65 20 6c 6f 67 69 63 61 6c 20 62 6f 74 74 6f 6d + 20 6f 66 20 74 68 65 20 76 61 6c 75 65 20 73 74 + 61 63 6b 0a + + ~ " ~ The value stack grows downwards in memory, so this" + ~ " is the physical" + 20 20 7e 20 20 20 20 20 54 68 65 20 76 61 6c 75 + 65 20 73 74 61 63 6b 20 67 72 6f 77 73 20 64 6f + 77 6e 77 61 72 64 73 20 69 6e 20 6d 65 6d 6f 72 + 79 2c 20 73 6f 20 74 68 69 73 20 69 73 20 74 68 + 65 20 70 68 79 73 69 63 61 6c 0a + + ~ " ~ top of it. This comes from the stack pointer the" + ~ " kernel initialized us" + 20 20 7e 20 20 20 74 6f 70 20 6f 66 20 69 74 2e + 20 54 68 69 73 20 63 6f 6d 65 73 20 66 72 6f 6d + 20 74 68 65 20 73 74 61 63 6b 20 70 6f 69 6e 74 + 65 72 20 74 68 65 20 6b 65 72 6e 65 6c 20 69 6e + 69 74 69 61 6c 69 7a 65 64 20 75 73 0a + + ~ " ~ with." + 20 20 7e 20 20 20 77 69 74 68 2e 0a + + ~ " ~ * "r0" is the logical bottom of the control stack" + 20 20 7e 20 2a 20 22 72 30 22 20 69 73 20 74 68 + 65 20 6c 6f 67 69 63 61 6c 20 62 6f 74 74 6f 6d + 20 6f 66 20 74 68 65 20 63 6f 6e 74 72 6f 6c 20 + 73 74 61 63 6b 0a + + ~ " ~ The control stack also grows downwards, so this is" + ~ " its pysical top" + 20 20 7e 20 20 20 20 20 54 68 65 20 63 6f 6e 74 + 72 6f 6c 20 73 74 61 63 6b 20 61 6c 73 6f 20 67 + 72 6f 77 73 20 64 6f 77 6e 77 61 72 64 73 2c 20 + 73 6f 20 74 68 69 73 20 69 73 20 69 74 73 20 70 + 79 73 69 63 61 6c 20 74 6f 70 0a + + ~ " ~ as well. We allocate this dedicated space within the" + ~ " log right here," + 20 20 7e 20 20 20 61 73 20 77 65 6c 6c 2e 20 57 + 65 20 61 6c 6c 6f 63 61 74 65 20 74 68 69 73 20 + 64 65 64 69 63 61 74 65 64 20 73 70 61 63 65 20 + 77 69 74 68 69 6e 20 74 68 65 20 6c 6f 67 20 72 + 69 67 68 74 20 68 65 72 65 2c 0a + + ~ " ~ in this routine, through our choice of where to put" + ~ " things." + 20 20 7e 20 20 20 69 6e 20 74 68 69 73 20 72 6f + 75 74 69 6e 65 2c 20 74 68 72 6f 75 67 68 20 6f + 75 72 20 63 68 6f 69 63 65 20 6f 66 20 77 68 65 + 72 65 20 74 6f 20 70 75 74 20 74 68 69 6e 67 73 + 2e 0a + + ~ " ~ * "here" is the physical start of the unallocated space" + ~ " in the log" + 20 20 7e 20 2a 20 22 68 65 72 65 22 20 69 73 20 + 74 68 65 20 70 68 79 73 69 63 61 6c 20 73 74 61 + 72 74 20 6f 66 20 74 68 65 20 75 6e 61 6c 6c 6f + 63 61 74 65 64 20 73 70 61 63 65 20 69 6e 20 74 + 68 65 20 6c 6f 67 0a + + ~ " ~ We allocate log space from bottom to top, by" + ~ " incrementing this" + 20 20 7e 20 20 20 20 20 57 65 20 61 6c 6c 6f 63 + 61 74 65 20 6c 6f 67 20 73 70 61 63 65 20 66 72 + 6f 6d 20 62 6f 74 74 6f 6d 20 74 6f 20 74 6f 70 + 2c 20 62 79 20 69 6e 63 72 65 6d 65 6e 74 69 6e + 67 20 74 68 69 73 0a + + ~ " ~ value. So, it would also be accurate to say that it" + ~ " points immediately" + 20 20 7e 20 20 20 76 61 6c 75 65 2e 20 53 6f 2c + 20 69 74 20 77 6f 75 6c 64 20 61 6c 73 6f 20 62 + 65 20 61 63 63 75 72 61 74 65 20 74 6f 20 73 61 + 79 20 74 68 61 74 20 69 74 20 70 6f 69 6e 74 73 + 20 69 6d 6d 65 64 69 61 74 65 6c 79 0a + + ~ " ~ after the physical top of the allocated space. At any" + ~ " rate, the" + 20 20 7e 20 20 20 61 66 74 65 72 20 74 68 65 20 + 70 68 79 73 69 63 61 6c 20 74 6f 70 20 6f 66 20 + 74 68 65 20 61 6c 6c 6f 63 61 74 65 64 20 73 70 + 61 63 65 2e 20 41 74 20 61 6e 79 20 72 61 74 65 + 2c 20 74 68 65 0a + + ~ " ~ address it points to is the first one that hasn't" + ~ " been used yet." + 20 20 7e 20 20 20 61 64 64 72 65 73 73 20 69 74 + 20 70 6f 69 6e 74 73 20 74 6f 20 69 73 20 74 68 + 65 20 66 69 72 73 74 20 6f 6e 65 20 74 68 61 74 + 20 68 61 73 6e 27 74 20 62 65 65 6e 20 75 73 65 + 64 20 79 65 74 2e 0a + + ~ " ~ * "latest" is the address of the most-recently-defined" + ~ " word's header" + 20 20 7e 20 2a 20 22 6c 61 74 65 73 74 22 20 69 + 73 20 74 68 65 20 61 64 64 72 65 73 73 20 6f 66 + 20 74 68 65 20 6d 6f 73 74 2d 72 65 63 65 6e 74 + 6c 79 2d 64 65 66 69 6e 65 64 20 77 6f 72 64 27 + 73 20 68 65 61 64 65 72 0a + + ~ " ~ Defining new words changes this value." + 20 20 7e 20 20 20 20 20 44 65 66 69 6e 69 6e 67 + 20 6e 65 77 20 77 6f 72 64 73 20 63 68 61 6e 67 + 65 73 20 74 68 69 73 20 76 61 6c 75 65 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ s0 and r0 are mostly used when we want to initialize" + ~ " or reinitialize" + 20 20 7e 20 20 20 73 30 20 61 6e 64 20 72 30 20 + 61 72 65 20 6d 6f 73 74 6c 79 20 75 73 65 64 20 + 77 68 65 6e 20 77 65 20 77 61 6e 74 20 74 6f 20 + 69 6e 69 74 69 61 6c 69 7a 65 20 6f 72 20 72 65 + 69 6e 69 74 69 61 6c 69 7a 65 0a + + ~ " ~ their respective stacks - that is, discard all their" + ~ " contents at once." + 20 20 7e 20 74 68 65 69 72 20 72 65 73 70 65 63 + 74 69 76 65 20 73 74 61 63 6b 73 20 2d 20 74 68 + 61 74 20 69 73 2c 20 64 69 73 63 61 72 64 20 61 + 6c 6c 20 74 68 65 69 72 20 63 6f 6e 74 65 6e 74 + 73 20 61 74 20 6f 6e 63 65 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ The value of r0 is the same address these variables" + ~ " start at, so" + 20 20 7e 20 20 20 54 68 65 20 76 61 6c 75 65 20 + 6f 66 20 72 30 20 69 73 20 74 68 65 20 73 61 6d + 65 20 61 64 64 72 65 73 73 20 74 68 65 73 65 20 + 76 61 72 69 61 62 6c 65 73 20 73 74 61 72 74 20 + 61 74 2c 20 73 6f 0a + + ~ " ~ you'll want to do a close read of the implementation of" + ~ " pushcontrol" + 20 20 7e 20 79 6f 75 27 6c 6c 20 77 61 6e 74 20 + 74 6f 20 64 6f 20 61 20 63 6c 6f 73 65 20 72 65 + 61 64 20 6f 66 20 74 68 65 20 69 6d 70 6c 65 6d + 65 6e 74 61 74 69 6f 6e 20 6f 66 20 70 75 73 68 + 63 6f 6e 74 72 6f 6c 0a + + ~ " ~ and convince yourself that it only ever writes things" + ~ " just below the rbp" + 20 20 7e 20 61 6e 64 20 63 6f 6e 76 69 6e 63 65 + 20 79 6f 75 72 73 65 6c 66 20 74 68 61 74 20 69 + 74 20 6f 6e 6c 79 20 65 76 65 72 20 77 72 69 74 + 65 73 20 74 68 69 6e 67 73 20 6a 75 73 74 20 62 + 65 6c 6f 77 20 74 68 65 20 72 62 70 0a + + ~ " ~ address it receives, never right on top of it." + 20 20 7e 20 61 64 64 72 65 73 73 20 69 74 20 72 + 65 63 65 69 76 65 73 2c 20 6e 65 76 65 72 20 72 + 69 67 68 74 20 6f 6e 20 74 6f 70 20 6f 66 20 69 + 74 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ As an aside, by the way, please notice that strictly" + ~ " speaking, r0" + 20 20 7e 20 20 20 41 73 20 61 6e 20 61 73 69 64 + 65 2c 20 62 79 20 74 68 65 20 77 61 79 2c 20 70 + 6c 65 61 73 65 20 6e 6f 74 69 63 65 20 74 68 61 + 74 20 73 74 72 69 63 74 6c 79 20 73 70 65 61 6b + 69 6e 67 2c 20 72 30 0a + + ~ " ~ could be a constant... but it isn't known until" + ~ " runtime, so we might as" + 20 20 7e 20 63 6f 75 6c 64 20 62 65 20 61 20 63 + 6f 6e 73 74 61 6e 74 2e 2e 2e 20 62 75 74 20 69 + 74 20 69 73 6e 27 74 20 6b 6e 6f 77 6e 20 75 6e + 74 69 6c 20 72 75 6e 74 69 6d 65 2c 20 73 6f 20 + 77 65 20 6d 69 67 68 74 20 61 73 0a + + ~ " ~ well make it a variable. That will play nicely with any" + ~ " astonishing" + 20 20 7e 20 77 65 6c 6c 20 6d 61 6b 65 20 69 74 + 20 61 20 76 61 72 69 61 62 6c 65 2e 20 54 68 61 + 74 20 77 69 6c 6c 20 70 6c 61 79 20 6e 69 63 65 + 6c 79 20 77 69 74 68 20 61 6e 79 20 61 73 74 6f + 6e 69 73 68 69 6e 67 0a + + ~ " ~ memory shenanigans someone might wish to do in the" + ~ " future." + 20 20 7e 20 6d 65 6d 6f 72 79 20 73 68 65 6e 61 + 6e 69 67 61 6e 73 20 73 6f 6d 65 6f 6e 65 20 6d + 69 67 68 74 20 77 69 73 68 20 74 6f 20 64 6f 20 + 69 6e 20 74 68 65 20 66 75 74 75 72 65 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ Notice also that "here" points immediately after" + ~ " itself. This is just" + 20 20 7e 20 20 20 4e 6f 74 69 63 65 20 61 6c 73 + 6f 20 74 68 61 74 20 22 68 65 72 65 22 20 70 6f + 69 6e 74 73 20 69 6d 6d 65 64 69 61 74 65 6c 79 + 20 61 66 74 65 72 20 69 74 73 65 6c 66 2e 20 54 + 68 69 73 20 69 73 20 6a 75 73 74 0a + + ~ " ~ a convenience, making it the last one like that so that" + ~ " the concern is" + 20 20 7e 20 61 20 63 6f 6e 76 65 6e 69 65 6e 63 + 65 2c 20 6d 61 6b 69 6e 67 20 69 74 20 74 68 65 + 20 6c 61 73 74 20 6f 6e 65 20 6c 69 6b 65 20 74 + 68 61 74 20 73 6f 20 74 68 61 74 20 74 68 65 20 + 63 6f 6e 63 65 72 6e 20 69 73 0a + + ~ " ~ dealt with in a single place and is easy to keep" + ~ " up-to-date with code" + 20 20 7e 20 64 65 61 6c 74 20 77 69 74 68 20 69 + 6e 20 61 20 73 69 6e 67 6c 65 20 70 6c 61 63 65 + 20 61 6e 64 20 69 73 20 65 61 73 79 20 74 6f 20 + 6b 65 65 70 20 75 70 2d 74 6f 2d 64 61 74 65 20 + 77 69 74 68 20 63 6f 64 65 0a + + ~ " ~ changes." + 20 20 7e 20 63 68 61 6e 67 65 73 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ A little more detail about why we offset everything" + ~ " by" + 20 20 7e 20 20 20 41 20 6c 69 74 74 6c 65 20 6d + 6f 72 65 20 64 65 74 61 69 6c 20 61 62 6f 75 74 + 20 77 68 79 20 77 65 20 6f 66 66 73 65 74 20 65 + 76 65 72 79 74 68 69 6e 67 20 62 79 0a + + ~ " ~ control_stack_size: We're carving out some space at the" + ~ " bottom of the" + 20 20 7e 20 63 6f 6e 74 72 6f 6c 5f 73 74 61 63 + 6b 5f 73 69 7a 65 3a 20 57 65 27 72 65 20 63 61 + 72 76 69 6e 67 20 6f 75 74 20 73 6f 6d 65 20 73 + 70 61 63 65 20 61 74 20 74 68 65 20 62 6f 74 74 + 6f 6d 20 6f 66 20 74 68 65 0a + + ~ " ~ log - which grows low-to-high - to be the control stack" + ~ " - which grows" + 20 20 7e 20 6c 6f 67 20 2d 20 77 68 69 63 68 20 + 67 72 6f 77 73 20 6c 6f 77 2d 74 6f 2d 68 69 67 + 68 20 2d 20 74 6f 20 62 65 20 74 68 65 20 63 6f + 6e 74 72 6f 6c 20 73 74 61 63 6b 20 2d 20 77 68 + 69 63 68 20 67 72 6f 77 73 0a + + ~ " ~ high-to-low. So the control stack is allocated out of" + ~ " the log as a" + 20 20 7e 20 68 69 67 68 2d 74 6f 2d 6c 6f 77 2e + 20 53 6f 20 74 68 65 20 63 6f 6e 74 72 6f 6c 20 + 73 74 61 63 6b 20 69 73 20 61 6c 6c 6f 63 61 74 + 65 64 20 6f 75 74 20 6f 66 20 74 68 65 20 6c 6f + 67 20 61 73 20 61 0a + + ~ " ~ fixed-size, one-time thing, and then the variables come" + ~ " immediately" + 20 20 7e 20 66 69 78 65 64 2d 73 69 7a 65 2c 20 + 6f 6e 65 2d 74 69 6d 65 20 74 68 69 6e 67 2c 20 + 61 6e 64 20 74 68 65 6e 20 74 68 65 20 76 61 72 + 69 61 62 6c 65 73 20 63 6f 6d 65 20 69 6d 6d 65 + 64 69 61 74 65 6c 79 0a + + ~ " ~ after that. We do need to use 32-bit displacement" + ~ " indexing to access" + 20 20 7e 20 61 66 74 65 72 20 74 68 61 74 2e 20 + 57 65 20 64 6f 20 6e 65 65 64 20 74 6f 20 75 73 + 65 20 33 32 2d 62 69 74 20 64 69 73 70 6c 61 63 + 65 6d 65 6e 74 20 69 6e 64 65 78 69 6e 67 20 74 + 6f 20 61 63 63 65 73 73 0a + + ~ " ~ them this way, but that's no big deal." + 20 20 7e 20 74 68 65 6d 20 74 68 69 73 20 77 61 + 79 2c 20 62 75 74 20 74 68 61 74 27 73 20 6e 6f + 20 62 69 67 20 64 65 61 6c 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ This is perhaps questionable, they should maybe be" + ~ " separate segments" + 20 20 7e 20 20 20 54 68 69 73 20 69 73 20 70 65 + 72 68 61 70 73 20 71 75 65 73 74 69 6f 6e 61 62 + 6c 65 2c 20 74 68 65 79 20 73 68 6f 75 6c 64 20 + 6d 61 79 62 65 20 62 65 20 73 65 70 61 72 61 74 + 65 20 73 65 67 6d 65 6e 74 73 0a + + ~ " ~ created with separate calls to mmap(), but for now" + ~ " we're not worried" + 20 20 7e 20 63 72 65 61 74 65 64 20 77 69 74 68 + 20 73 65 70 61 72 61 74 65 20 63 61 6c 6c 73 20 + 74 6f 20 6d 6d 61 70 28 29 2c 20 62 75 74 20 66 + 6f 72 20 6e 6f 77 20 77 65 27 72 65 20 6e 6f 74 + 20 77 6f 72 72 69 65 64 0a + + ~ " ~ about overflow so we use the same allocation for both." + 20 20 7e 20 61 62 6f 75 74 20 6f 76 65 72 66 6c + 6f 77 20 73 6f 20 77 65 20 75 73 65 20 74 68 65 + 20 73 61 6d 65 20 61 6c 6c 6f 63 61 74 69 6f 6e + 20 66 6f 72 20 62 6f 74 68 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ We'll come back to these variables a bit later and" + ~ " generate the word" + 20 20 7e 20 20 20 57 65 27 6c 6c 20 63 6f 6d 65 + 20 62 61 63 6b 20 74 6f 20 74 68 65 73 65 20 76 + 61 72 69 61 62 6c 65 73 20 61 20 62 69 74 20 6c + 61 74 65 72 20 61 6e 64 20 67 65 6e 65 72 61 74 + 65 20 74 68 65 20 77 6f 72 64 0a + + ~ " ~ headers that point at them, but now we're almost ready" + ~ " to switch to" + 20 20 7e 20 68 65 61 64 65 72 73 20 74 68 61 74 + 20 70 6f 69 6e 74 20 61 74 20 74 68 65 6d 2c 20 + 62 75 74 20 6e 6f 77 20 77 65 27 72 65 20 61 6c + 6d 6f 73 74 20 72 65 61 64 79 20 74 6f 20 73 77 + 69 74 63 68 20 74 6f 0a + + ~ " ~ proper threaded-execution, so we finish that setup" + ~ " first..." + 20 20 7e 20 70 72 6f 70 65 72 20 74 68 72 65 61 + 64 65 64 2d 65 78 65 63 75 74 69 6f 6e 2c 20 73 + 6f 20 77 65 20 66 69 6e 69 73 68 20 74 68 61 74 + 20 73 65 74 75 70 20 66 69 72 73 74 2e 2e 2e 0a + + ~ "" + 0a + + ~ " ~ Push the value of "log" onto the value stack so that" + ~ " it can be the" + 20 20 7e 20 20 20 50 75 73 68 20 74 68 65 20 76 + 61 6c 75 65 20 6f 66 20 22 6c 6f 67 22 20 6f 6e + 74 6f 20 74 68 65 20 76 61 6c 75 65 20 73 74 61 + 63 6b 20 73 6f 20 74 68 61 74 20 69 74 20 63 61 + 6e 20 62 65 20 74 68 65 0a + + ~ " ~ breadcrumb the threaded code needs to find... the" + ~ " backing store of" + 20 20 7e 20 62 72 65 61 64 63 72 75 6d 62 20 74 + 68 65 20 74 68 72 65 61 64 65 64 20 63 6f 64 65 + 20 6e 65 65 64 73 20 74 6f 20 66 69 6e 64 2e 2e + 2e 20 74 68 65 20 62 61 63 6b 69 6e 67 20 73 74 + 6f 72 65 20 6f 66 0a + + ~ " ~ "log". Yes, self-reference can be weird like that" + ~ " sometimes. There's" + 20 20 7e 20 22 6c 6f 67 22 2e 20 59 65 73 2c 20 + 73 65 6c 66 2d 72 65 66 65 72 65 6e 63 65 20 63 + 61 6e 20 62 65 20 77 65 69 72 64 20 6c 69 6b 65 + 20 74 68 61 74 20 73 6f 6d 65 74 69 6d 65 73 2e + 20 54 68 65 72 65 27 73 0a + + ~ " ~ nothing stopping "quit" from reading rdi, it just" + ~ " violates the" + 20 20 7e 20 6e 6f 74 68 69 6e 67 20 73 74 6f 70 + 70 69 6e 67 20 22 71 75 69 74 22 20 66 72 6f 6d + 20 72 65 61 64 69 6e 67 20 72 64 69 2c 20 69 74 + 20 6a 75 73 74 20 76 69 6f 6c 61 74 65 73 20 74 + 68 65 0a + + ~ " ~ abstraction..." + 20 20 7e 20 61 62 73 74 72 61 63 74 69 6f 6e 2e + 2e 2e 0a + + ~ " :rdi push-reg64" + 20 20 3a 72 64 69 20 70 75 73 68 2d 72 65 67 36 + 34 0a + + ~ "" + 0a + + ~ " ~ We are about to set up rsi, we did rbp already, and" + ~ " rsp came to us" + 20 20 7e 20 20 20 57 65 20 61 72 65 20 61 62 6f + 75 74 20 74 6f 20 73 65 74 20 75 70 20 72 73 69 + 2c 20 77 65 20 64 69 64 20 72 62 70 20 61 6c 72 + 65 61 64 79 2c 20 61 6e 64 20 72 73 70 20 63 61 + 6d 65 20 74 6f 20 75 73 0a + + ~ " ~ already set up. That's all that "next" needs, so take" + ~ " it away!" + 20 20 7e 20 61 6c 72 65 61 64 79 20 73 65 74 20 + 75 70 2e 20 54 68 61 74 27 73 20 61 6c 6c 20 74 + 68 61 74 20 22 6e 65 78 74 22 20 6e 65 65 64 73 + 2c 20 73 6f 20 74 61 6b 65 20 69 74 20 61 77 61 + 79 21 0a + + ~ " L@' warm-start L@' origin + :rsi mov-reg64-imm64" + 20 20 4c 40 27 20 77 61 72 6d 2d 73 74 61 72 74 + 20 4c 40 27 20 6f 72 69 67 69 6e 20 2b 20 3a 72 + 73 69 20 6d 6f 76 2d 72 65 67 36 34 2d 69 6d 6d + 36 34 0a + + ~ " pack-next" + 20 20 70 61 63 6b 2d 6e 65 78 74 0a + + ~ " ~ : deindent" + 20 20 7e 20 3a 20 64 65 69 6e 64 65 6e 74 0a + + ~ " ;" + 20 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Routine warm-start" + 7e 20 52 6f 75 74 69 6e 65 20 77 61 72 6d 2d 73 + 74 61 72 74 0a + + ~ "~ ~~~~~~~~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 0a + + ~ "~" + 7e 0a + + ~ "~ This routine runs as Forth code. That is, indirect" + ~ " threaded execution has" + 7e 20 20 20 54 68 69 73 20 72 6f 75 74 69 6e 65 + 20 72 75 6e 73 20 61 73 20 46 6f 72 74 68 20 63 + 6f 64 65 2e 20 54 68 61 74 20 69 73 2c 20 69 6e + 64 69 72 65 63 74 20 74 68 72 65 61 64 65 64 20 + 65 78 65 63 75 74 69 6f 6e 20 68 61 73 0a + + ~ "~ been initialized, and the structure of this routine is an" + ~ " array of codeword" + 7e 20 62 65 65 6e 20 69 6e 69 74 69 61 6c 69 7a + 65 64 2c 20 61 6e 64 20 74 68 65 20 73 74 72 75 + 63 74 75 72 65 20 6f 66 20 74 68 69 73 20 72 6f + 75 74 69 6e 65 20 69 73 20 61 6e 20 61 72 72 61 + 79 20 6f 66 20 63 6f 64 65 77 6f 72 64 0a + + ~ "~ pointers. It was directly jumped to from cold-start." + ~ " There's nowhere to" + 7e 20 70 6f 69 6e 74 65 72 73 2e 20 49 74 20 77 + 61 73 20 64 69 72 65 63 74 6c 79 20 6a 75 6d 70 + 65 64 20 74 6f 20 66 72 6f 6d 20 63 6f 6c 64 2d + 73 74 61 72 74 2e 20 54 68 65 72 65 27 73 20 6e + 6f 77 68 65 72 65 20 74 6f 0a + + ~ "~ return to, so it needs to never return." + 7e 20 72 65 74 75 72 6e 20 74 6f 2c 20 73 6f 20 + 69 74 20 6e 65 65 64 73 20 74 6f 20 6e 65 76 65 + 72 20 72 65 74 75 72 6e 2e 0a + + ~ "~" + 7e 0a + + ~ "~ There are a few optional pieces of the warm-start" + ~ " routine, so here in the" + 7e 20 20 20 54 68 65 72 65 20 61 72 65 20 61 20 + 66 65 77 20 6f 70 74 69 6f 6e 61 6c 20 70 69 65 + 63 65 73 20 6f 66 20 74 68 65 20 77 61 72 6d 2d + 73 74 61 72 74 20 72 6f 75 74 69 6e 65 2c 20 73 + 6f 20 68 65 72 65 20 69 6e 20 74 68 65 0a + + ~ "~ compile-time code that builds it, we break the routine" + ~ " into logical pieces" + 7e 20 63 6f 6d 70 69 6c 65 2d 74 69 6d 65 20 63 + 6f 64 65 20 74 68 61 74 20 62 75 69 6c 64 73 20 + 69 74 2c 20 77 65 20 62 72 65 61 6b 20 74 68 65 + 20 72 6f 75 74 69 6e 65 20 69 6e 74 6f 20 6c 6f + 67 69 63 61 6c 20 70 69 65 63 65 73 0a + + ~ "~ which are assembled by calling the appropriate helpers" + ~ " sequentially." + 7e 20 77 68 69 63 68 20 61 72 65 20 61 73 73 65 + 6d 62 6c 65 64 20 62 79 20 63 61 6c 6c 69 6e 67 + 20 74 68 65 20 61 70 70 72 6f 70 72 69 61 74 65 + 20 68 65 6c 70 65 72 73 20 73 65 71 75 65 6e 74 + 69 61 6c 6c 79 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Outputting the warm-start routine should always begin" + ~ " by calling" + 7e 20 20 20 4f 75 74 70 75 74 74 69 6e 67 20 74 + 68 65 20 77 61 72 6d 2d 73 74 61 72 74 20 72 6f + 75 74 69 6e 65 20 73 68 6f 75 6c 64 20 61 6c 77 + 61 79 73 20 62 65 67 69 6e 20 62 79 20 63 61 6c + 6c 69 6e 67 0a + + ~ "~ output-warm-start-header." + 7e 20 6f 75 74 70 75 74 2d 77 61 72 6d 2d 73 74 + 61 72 74 2d 68 65 61 64 65 72 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (output buffer start, output point -- output buffer" + ~ " start, output point)" + 7e 20 28 6f 75 74 70 75 74 20 62 75 66 66 65 72 + 20 73 74 61 72 74 2c 20 6f 75 74 70 75 74 20 70 + 6f 69 6e 74 20 2d 2d 20 6f 75 74 70 75 74 20 62 + 75 66 66 65 72 20 73 74 61 72 74 2c 20 6f 75 74 + 70 75 74 20 70 6f 69 6e 74 29 0a + + ~ ": output-warm-start-header" + 3a 20 6f 75 74 70 75 74 2d 77 61 72 6d 2d 73 74 + 61 72 74 2d 68 65 61 64 65 72 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~" + ~ " ~ ~ ~ ~ ~ ~ ~ ~ ~" + 20 20 7e 20 3a 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 0a + + ~ " ~ : ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~" + ~ " ~ ~ ~ ~ ~ ~ ~ ~ ~ ~" + 20 20 7e 20 3a 20 20 7e 20 7e 20 7e 20 7e 20 7e + 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e + 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e + 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e + 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 0a + + ~ " ~ : ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~" + ~ " ~ ~ ~ ~ ~ ~ ~ ~ ~" + 20 20 7e 20 3a 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 0a + + ~ " ~ :" + ~ " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + ~ "~~~~~~~~~~~~~" + 20 20 7e 20 3a 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : This is the start of the warm-start routine, which" + ~ " is the first Forth" + 20 20 7e 20 3a 20 20 20 54 68 69 73 20 69 73 20 + 74 68 65 20 73 74 61 72 74 20 6f 66 20 74 68 65 + 20 77 61 72 6d 2d 73 74 61 72 74 20 72 6f 75 74 + 69 6e 65 2c 20 77 68 69 63 68 20 69 73 20 74 68 + 65 20 66 69 72 73 74 20 46 6f 72 74 68 0a + + ~ " ~ : code the executable runs, after the cold-start" + ~ " routine has created the" + 20 20 7e 20 3a 20 63 6f 64 65 20 74 68 65 20 65 + 78 65 63 75 74 61 62 6c 65 20 72 75 6e 73 2c 20 + 61 66 74 65 72 20 74 68 65 20 63 6f 6c 64 2d 73 + 74 61 72 74 20 72 6f 75 74 69 6e 65 20 68 61 73 + 20 63 72 65 61 74 65 64 20 74 68 65 0a + + ~ " ~ : Forth execution environment." + 20 20 7e 20 3a 20 46 6f 72 74 68 20 65 78 65 63 + 75 74 69 6f 6e 20 65 6e 76 69 72 6f 6e 6d 65 6e + 74 2e 0a + + ~ " ~ :" + 20 20 7e 20 3a 0a + + ~ " ~ : It does some initial setup here at the top; then" + ~ " the vast bulk of it" + 20 20 7e 20 3a 20 20 20 49 74 20 64 6f 65 73 20 + 73 6f 6d 65 20 69 6e 69 74 69 61 6c 20 73 65 74 + 75 70 20 68 65 72 65 20 61 74 20 74 68 65 20 74 + 6f 70 3b 20 74 68 65 6e 20 74 68 65 20 76 61 73 + 74 20 62 75 6c 6b 20 6f 66 20 69 74 0a + + ~ " ~ : is actually the log-load routine, directly included;" + ~ " then finally there" + 20 20 7e 20 3a 20 69 73 20 61 63 74 75 61 6c 6c + 79 20 74 68 65 20 6c 6f 67 2d 6c 6f 61 64 20 72 + 6f 75 74 69 6e 65 2c 20 64 69 72 65 63 74 6c 79 + 20 69 6e 63 6c 75 64 65 64 3b 20 74 68 65 6e 20 + 66 69 6e 61 6c 6c 79 20 74 68 65 72 65 0a + + ~ " ~ : is a small amount of finishing work done at the tail" + ~ " end of the" + 20 20 7e 20 3a 20 69 73 20 61 20 73 6d 61 6c 6c + 20 61 6d 6f 75 6e 74 20 6f 66 20 66 69 6e 69 73 + 68 69 6e 67 20 77 6f 72 6b 20 64 6f 6e 65 20 61 + 74 20 74 68 65 20 74 61 69 6c 20 65 6e 64 20 6f + 66 20 74 68 65 0a + + ~ " ~ : warm-start routine." + 20 20 7e 20 3a 20 77 61 72 6d 2d 73 74 61 72 74 + 20 72 6f 75 74 69 6e 65 2e 0a + + ~ " ~ :" + 20 20 7e 20 3a 0a + + ~ " ~ : The routine's body is interpreted Forth code," + ~ " meaning that it is an" + 20 20 7e 20 3a 20 20 20 54 68 65 20 72 6f 75 74 + 69 6e 65 27 73 20 62 6f 64 79 20 69 73 20 69 6e + 74 65 72 70 72 65 74 65 64 20 46 6f 72 74 68 20 + 63 6f 64 65 2c 20 6d 65 61 6e 69 6e 67 20 74 68 + 61 74 20 69 74 20 69 73 20 61 6e 0a + + ~ " ~ : an array of pointers to the codewords of Forth words," + ~ " occasionally" + 20 20 7e 20 3a 20 61 6e 20 61 72 72 61 79 20 6f + 66 20 70 6f 69 6e 74 65 72 73 20 74 6f 20 74 68 + 65 20 63 6f 64 65 77 6f 72 64 73 20 6f 66 20 46 + 6f 72 74 68 20 77 6f 72 64 73 2c 20 6f 63 63 61 + 73 69 6f 6e 61 6c 6c 79 0a + + ~ " ~ : interspersed with literal values." + 20 20 7e 20 3a 20 69 6e 74 65 72 73 70 65 72 73 + 65 64 20 77 69 74 68 20 6c 69 74 65 72 61 6c 20 + 76 61 6c 75 65 73 2e 0a + + ~ " ~ :" + 20 20 7e 20 3a 0a + + ~ " ~ : The codeword pointers were located by using the" + ~ " label system, which" + 20 20 7e 20 3a 20 20 20 54 68 65 20 63 6f 64 65 + 77 6f 72 64 20 70 6f 69 6e 74 65 72 73 20 77 65 + 72 65 20 6c 6f 63 61 74 65 64 20 62 79 20 75 73 + 69 6e 67 20 74 68 65 20 6c 61 62 65 6c 20 73 79 + 73 74 65 6d 2c 20 77 68 69 63 68 0a + + ~ " ~ : means the labels they reference must have been" + ~ " defined somewhere else," + 20 20 7e 20 3a 20 6d 65 61 6e 73 20 74 68 65 20 + 6c 61 62 65 6c 73 20 74 68 65 79 20 72 65 66 65 + 72 65 6e 63 65 20 6d 75 73 74 20 68 61 76 65 20 + 62 65 65 6e 20 64 65 66 69 6e 65 64 20 73 6f 6d + 65 77 68 65 72 65 20 65 6c 73 65 2c 0a + + ~ " ~ : normally by the label transform. The" + ~ " label-transformed code normally" + 20 20 7e 20 3a 20 6e 6f 72 6d 61 6c 6c 79 20 62 + 79 20 74 68 65 20 6c 61 62 65 6c 20 74 72 61 6e + 73 66 6f 72 6d 2e 20 54 68 65 20 6c 61 62 65 6c + 2d 74 72 61 6e 73 66 6f 72 6d 65 64 20 63 6f 64 + 65 20 6e 6f 72 6d 61 6c 6c 79 0a + + ~ " ~ : occurs after the warm-start routine in the" + ~ " executable, which means these" + 20 20 7e 20 3a 20 6f 63 63 75 72 73 20 61 66 74 + 65 72 20 74 68 65 20 77 61 72 6d 2d 73 74 61 72 + 74 20 72 6f 75 74 69 6e 65 20 69 6e 20 74 68 65 + 20 65 78 65 63 75 74 61 62 6c 65 2c 20 77 68 69 + 63 68 20 6d 65 61 6e 73 20 74 68 65 73 65 0a + + ~ " ~ : are forward references to words defined far below." + 20 20 7e 20 3a 20 61 72 65 20 66 6f 72 77 61 72 + 64 20 72 65 66 65 72 65 6e 63 65 73 20 74 6f 20 + 77 6f 72 64 73 20 64 65 66 69 6e 65 64 20 66 61 + 72 20 62 65 6c 6f 77 2e 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : indent" + 20 20 7e 20 3a 20 69 6e 64 65 6e 74 0a + + ~ "" + 0a + + ~ " ~ While it's not actually a requirement that codeword" + ~ " pointers be" + 20 20 7e 20 20 20 57 68 69 6c 65 20 69 74 27 73 + 20 6e 6f 74 20 61 63 74 75 61 6c 6c 79 20 61 20 + 72 65 71 75 69 72 65 6d 65 6e 74 20 74 68 61 74 + 20 63 6f 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 + 72 73 20 62 65 0a + + ~ " ~ word-aligned, it's highly likely that it helps" + ~ " performance. (Whether it" + 20 20 7e 20 77 6f 72 64 2d 61 6c 69 67 6e 65 64 + 2c 20 69 74 27 73 20 68 69 67 68 6c 79 20 6c 69 + 6b 65 6c 79 20 74 68 61 74 20 69 74 20 68 65 6c + 70 73 20 70 65 72 66 6f 72 6d 61 6e 63 65 2e 20 + 28 57 68 65 74 68 65 72 20 69 74 0a + + ~ " ~ does is up to Intel's microcode.)" + 20 20 7e 20 64 6f 65 73 20 69 73 20 75 70 20 74 + 6f 20 49 6e 74 65 6c 27 73 20 6d 69 63 72 6f 63 + 6f 64 65 2e 29 0a + + ~ " 8 packalign" + 20 20 38 20 70 61 63 6b 61 6c 69 67 6e 0a + + ~ " current-offset L!' warm-start" + 20 20 63 75 72 72 65 6e 74 2d 6f 66 66 73 65 74 + 20 4c 21 27 20 77 61 72 6d 2d 73 74 61 72 74 0a + + ~ " ~ (input string pointer, output buffer start, output" + ~ " point)" + 20 20 7e 20 28 69 6e 70 75 74 20 73 74 72 69 6e + 67 20 70 6f 69 6e 74 65 72 2c 20 6f 75 74 70 75 + 74 20 62 75 66 66 65 72 20 73 74 61 72 74 2c 20 + 6f 75 74 70 75 74 20 70 6f 69 6e 74 29 0a + + ~ "" + 0a + + ~ " ~ Before handing off to us, cold-start pushed a single" + ~ " value onto the" + 20 20 7e 20 20 20 42 65 66 6f 72 65 20 68 61 6e + 64 69 6e 67 20 6f 66 66 20 74 6f 20 75 73 2c 20 + 63 6f 6c 64 2d 73 74 61 72 74 20 70 75 73 68 65 + 64 20 61 20 73 69 6e 67 6c 65 20 76 61 6c 75 65 + 20 6f 6e 74 6f 20 74 68 65 0a + + ~ " ~ stack, a pointer to the beginning of the log. Now, we" + ~ " load our entire" + 20 20 7e 20 73 74 61 63 6b 2c 20 61 20 70 6f 69 + 6e 74 65 72 20 74 6f 20 74 68 65 20 62 65 67 69 + 6e 6e 69 6e 67 20 6f 66 20 74 68 65 20 6c 6f 67 + 2e 20 4e 6f 77 2c 20 77 65 20 6c 6f 61 64 20 6f + 75 72 20 65 6e 74 69 72 65 0a + + ~ " ~ Forth implementation onto that log, beginning with the" + ~ " minimal set of" + 20 20 7e 20 46 6f 72 74 68 20 69 6d 70 6c 65 6d + 65 6e 74 61 74 69 6f 6e 20 6f 6e 74 6f 20 74 68 + 61 74 20 6c 6f 67 2c 20 62 65 67 69 6e 6e 69 6e + 67 20 77 69 74 68 20 74 68 65 20 6d 69 6e 69 6d + 61 6c 20 73 65 74 20 6f 66 0a + + ~ " ~ words needed to define more words. We do this because" + ~ " we need variables as" + 20 20 7e 20 77 6f 72 64 73 20 6e 65 65 64 65 64 + 20 74 6f 20 64 65 66 69 6e 65 20 6d 6f 72 65 20 + 77 6f 72 64 73 2e 20 57 65 20 64 6f 20 74 68 69 + 73 20 62 65 63 61 75 73 65 20 77 65 20 6e 65 65 + 64 20 76 61 72 69 61 62 6c 65 73 20 61 73 0a + + ~ " ~ infrastructure so we can eventually have dynamic" + ~ " definitions." + 20 20 7e 20 69 6e 66 72 61 73 74 72 75 63 74 75 + 72 65 20 73 6f 20 77 65 20 63 61 6e 20 65 76 65 + 6e 74 75 61 6c 6c 79 20 68 61 76 65 20 64 79 6e + 61 6d 69 63 20 64 65 66 69 6e 69 74 69 6f 6e 73 + 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ There's something non-obvious here: words implemented" + ~ " statically as" + 20 20 7e 20 20 20 54 68 65 72 65 27 73 20 73 6f + 6d 65 74 68 69 6e 67 20 6e 6f 6e 2d 6f 62 76 69 + 6f 75 73 20 68 65 72 65 3a 20 77 6f 72 64 73 20 + 69 6d 70 6c 65 6d 65 6e 74 65 64 20 73 74 61 74 + 69 63 61 6c 6c 79 20 61 73 0a + + ~ " ~ part of the executable image can't contain things that" + ~ " vary at runtime." + 20 20 7e 20 70 61 72 74 20 6f 66 20 74 68 65 20 + 65 78 65 63 75 74 61 62 6c 65 20 69 6d 61 67 65 + 20 63 61 6e 27 74 20 63 6f 6e 74 61 69 6e 20 74 + 68 69 6e 67 73 20 74 68 61 74 20 76 61 72 79 20 + 61 74 20 72 75 6e 74 69 6d 65 2e 0a + + ~ " ~ That means that even if these words tried to implement" + ~ " some sort of" + 20 20 7e 20 54 68 61 74 20 6d 65 61 6e 73 20 74 + 68 61 74 20 65 76 65 6e 20 69 66 20 74 68 65 73 + 65 20 77 6f 72 64 73 20 74 72 69 65 64 20 74 6f + 20 69 6d 70 6c 65 6d 65 6e 74 20 73 6f 6d 65 20 + 73 6f 72 74 20 6f 66 0a + + ~ " ~ dynamic lookup, they would have no way to find the root" + ~ " of whatever" + 20 20 7e 20 64 79 6e 61 6d 69 63 20 6c 6f 6f 6b + 75 70 2c 20 74 68 65 79 20 77 6f 75 6c 64 20 68 + 61 76 65 20 6e 6f 20 77 61 79 20 74 6f 20 66 69 + 6e 64 20 74 68 65 20 72 6f 6f 74 20 6f 66 20 77 + 68 61 74 65 76 65 72 0a + + ~ " ~ dynamic data structure they use. Dynamism needs to be" + ~ " bootstrapped." + 20 20 7e 20 64 79 6e 61 6d 69 63 20 64 61 74 61 + 20 73 74 72 75 63 74 75 72 65 20 74 68 65 79 20 + 75 73 65 2e 20 44 79 6e 61 6d 69 73 6d 20 6e 65 + 65 64 73 20 74 6f 20 62 65 20 62 6f 6f 74 73 74 + 72 61 70 70 65 64 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ In a more traditional C-style program, static code" + ~ " could look up" + 20 20 7e 20 20 20 49 6e 20 61 20 6d 6f 72 65 20 + 74 72 61 64 69 74 69 6f 6e 61 6c 20 43 2d 73 74 + 79 6c 65 20 70 72 6f 67 72 61 6d 2c 20 73 74 61 + 74 69 63 20 63 6f 64 65 20 63 6f 75 6c 64 20 6c + 6f 6f 6b 20 75 70 0a + + ~ " ~ variables based on fixed addresses that are the same on" + ~ " every run." + 20 20 7e 20 76 61 72 69 61 62 6c 65 73 20 62 61 + 73 65 64 20 6f 6e 20 66 69 78 65 64 20 61 64 64 + 72 65 73 73 65 73 20 74 68 61 74 20 61 72 65 20 + 74 68 65 20 73 61 6d 65 20 6f 6e 20 65 76 65 72 + 79 20 72 75 6e 2e 0a + + ~ " ~ Failing that, we could dedicate a register to it," + ~ " though that's a" + 20 20 7e 20 46 61 69 6c 69 6e 67 20 74 68 61 74 + 2c 20 77 65 20 63 6f 75 6c 64 20 64 65 64 69 63 + 61 74 65 20 61 20 72 65 67 69 73 74 65 72 20 74 + 6f 20 69 74 2c 20 74 68 6f 75 67 68 20 74 68 61 + 74 27 73 20 61 0a + + ~ " ~ considerable expense. We chose not to do either of" + ~ " those things, because" + 20 20 7e 20 63 6f 6e 73 69 64 65 72 61 62 6c 65 + 20 65 78 70 65 6e 73 65 2e 20 57 65 20 63 68 6f + 73 65 20 6e 6f 74 20 74 6f 20 64 6f 20 65 69 74 + 68 65 72 20 6f 66 20 74 68 6f 73 65 20 74 68 69 + 6e 67 73 2c 20 62 65 63 61 75 73 65 0a + + ~ " ~ we want the versatility that comes with not being picky" + ~ " about our" + 20 20 7e 20 77 65 20 77 61 6e 74 20 74 68 65 20 + 76 65 72 73 61 74 69 6c 69 74 79 20 74 68 61 74 + 20 63 6f 6d 65 73 20 77 69 74 68 20 6e 6f 74 20 + 62 65 69 6e 67 20 70 69 63 6b 79 20 61 62 6f 75 + 74 20 6f 75 72 0a + + ~ " ~ address space: It allows us to contemplate future" + ~ " improvements such as" + 20 20 7e 20 61 64 64 72 65 73 73 20 73 70 61 63 + 65 3a 20 49 74 20 61 6c 6c 6f 77 73 20 75 73 20 + 74 6f 20 63 6f 6e 74 65 6d 70 6c 61 74 65 20 66 + 75 74 75 72 65 20 69 6d 70 72 6f 76 65 6d 65 6e + 74 73 20 73 75 63 68 20 61 73 0a + + ~ " ~ ASLR, or embedding into other processes that impose" + ~ " their own addressing" + 20 20 7e 20 41 53 4c 52 2c 20 6f 72 20 65 6d 62 + 65 64 64 69 6e 67 20 69 6e 74 6f 20 6f 74 68 65 + 72 20 70 72 6f 63 65 73 73 65 73 20 74 68 61 74 + 20 69 6d 70 6f 73 65 20 74 68 65 69 72 20 6f 77 + 6e 20 61 64 64 72 65 73 73 69 6e 67 0a + + ~ " ~ constraints, or even coexisting with multiple versions" + ~ " of ourselves." + 20 20 7e 20 63 6f 6e 73 74 72 61 69 6e 74 73 2c + 20 6f 72 20 65 76 65 6e 20 63 6f 65 78 69 73 74 + 69 6e 67 20 77 69 74 68 20 6d 75 6c 74 69 70 6c + 65 20 76 65 72 73 69 6f 6e 73 20 6f 66 20 6f 75 + 72 73 65 6c 76 65 73 2e 0a + + ~ " ~ That choice does mean we have the hard version of this" + ~ " bootstrapping" + 20 20 7e 20 54 68 61 74 20 63 68 6f 69 63 65 20 + 64 6f 65 73 20 6d 65 61 6e 20 77 65 20 68 61 76 + 65 20 74 68 65 20 68 61 72 64 20 76 65 72 73 69 + 6f 6e 20 6f 66 20 74 68 69 73 20 62 6f 6f 74 73 + 74 72 61 70 70 69 6e 67 0a + + ~ " ~ problem, and copying ourselves to the log is how we" + ~ " solve it." + 20 20 7e 20 70 72 6f 62 6c 65 6d 2c 20 61 6e 64 + 20 63 6f 70 79 69 6e 67 20 6f 75 72 73 65 6c 76 + 65 73 20 74 6f 20 74 68 65 20 6c 6f 67 20 69 73 + 20 68 6f 77 20 77 65 20 73 6f 6c 76 65 20 69 74 + 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ We do have the log address right now, though that" + ~ " won't last. In case" + 20 20 7e 20 20 20 57 65 20 64 6f 20 68 61 76 65 + 20 74 68 65 20 6c 6f 67 20 61 64 64 72 65 73 73 + 20 72 69 67 68 74 20 6e 6f 77 2c 20 74 68 6f 75 + 67 68 20 74 68 61 74 20 77 6f 6e 27 74 20 6c 61 + 73 74 2e 20 49 6e 20 63 61 73 65 0a + + ~ " ~ it's unclear why not: keeping it on the stack would" + ~ " require all future" + 20 20 7e 20 69 74 27 73 20 75 6e 63 6c 65 61 72 + 20 77 68 79 20 6e 6f 74 3a 20 6b 65 65 70 69 6e + 67 20 69 74 20 6f 6e 20 74 68 65 20 73 74 61 63 + 6b 20 77 6f 75 6c 64 20 72 65 71 75 69 72 65 20 + 61 6c 6c 20 66 75 74 75 72 65 0a + + ~ " ~ references to walk the stack, and somehow know when" + ~ " they've reached the" + 20 20 7e 20 72 65 66 65 72 65 6e 63 65 73 20 74 + 6f 20 77 61 6c 6b 20 74 68 65 20 73 74 61 63 6b + 2c 20 61 6e 64 20 73 6f 6d 65 68 6f 77 20 6b 6e + 6f 77 20 77 68 65 6e 20 74 68 65 79 27 76 65 20 + 72 65 61 63 68 65 64 20 74 68 65 0a + + ~ " ~ bottom. The stack is a good place to keep things with" + ~ " clearly delimited" + 20 20 7e 20 62 6f 74 74 6f 6d 2e 20 54 68 65 20 + 73 74 61 63 6b 20 69 73 20 61 20 67 6f 6f 64 20 + 70 6c 61 63 65 20 74 6f 20 6b 65 65 70 20 74 68 + 69 6e 67 73 20 77 69 74 68 20 63 6c 65 61 72 6c + 79 20 64 65 6c 69 6d 69 74 65 64 0a + + ~ " ~ lifetimes and visibility, but when we want something to" + ~ " live for our" + 20 20 7e 20 6c 69 66 65 74 69 6d 65 73 20 61 6e + 64 20 76 69 73 69 62 69 6c 69 74 79 2c 20 62 75 + 74 20 77 68 65 6e 20 77 65 20 77 61 6e 74 20 73 + 6f 6d 65 74 68 69 6e 67 20 74 6f 20 6c 69 76 65 + 20 66 6f 72 20 6f 75 72 0a + + ~ " ~ entire program and be easy to find from any code within" + ~ " it, we need to" + 20 20 7e 20 65 6e 74 69 72 65 20 70 72 6f 67 72 + 61 6d 20 61 6e 64 20 62 65 20 65 61 73 79 20 74 + 6f 20 66 69 6e 64 20 66 72 6f 6d 20 61 6e 79 20 + 63 6f 64 65 20 77 69 74 68 69 6e 20 69 74 2c 20 + 77 65 20 6e 65 65 64 20 74 6f 0a + + ~ " ~ do something else. Anyway, since we have the address," + ~ " we can use it for" + 20 20 7e 20 64 6f 20 73 6f 6d 65 74 68 69 6e 67 + 20 65 6c 73 65 2e 20 41 6e 79 77 61 79 2c 20 73 + 69 6e 63 65 20 77 65 20 68 61 76 65 20 74 68 65 + 20 61 64 64 72 65 73 73 2c 20 77 65 20 63 61 6e + 20 75 73 65 20 69 74 20 66 6f 72 0a + + ~ " ~ the next little bit of setup. We have a bunch of helper" + ~ " words, from" + 20 20 7e 20 74 68 65 20 6e 65 78 74 20 6c 69 74 + 74 6c 65 20 62 69 74 20 6f 66 20 73 65 74 75 70 + 2e 20 57 65 20 68 61 76 65 20 61 20 62 75 6e 63 + 68 20 6f 66 20 68 65 6c 70 65 72 20 77 6f 72 64 + 73 2c 20 66 72 6f 6d 0a + + ~ " ~ language/static/log-load.e, which make this easier." + 20 20 7e 20 6c 61 6e 67 75 61 67 65 2f 73 74 61 + 74 69 63 2f 6c 6f 67 2d 6c 6f 61 64 2e 65 2c 20 + 77 68 69 63 68 20 6d 61 6b 65 20 74 68 69 73 20 + 65 61 73 69 65 72 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ The first few words we define are our variables," + ~ " which hardcode the" + 20 20 7e 20 20 20 54 68 65 20 66 69 72 73 74 20 + 66 65 77 20 77 6f 72 64 73 20 77 65 20 64 65 66 + 69 6e 65 20 61 72 65 20 6f 75 72 20 76 61 72 69 + 61 62 6c 65 73 2c 20 77 68 69 63 68 20 68 61 72 + 64 63 6f 64 65 20 74 68 65 0a + + ~ " ~ addresses they will return - but since we're doing this" + ~ " at runtime," + 20 20 7e 20 61 64 64 72 65 73 73 65 73 20 74 68 + 65 79 20 77 69 6c 6c 20 72 65 74 75 72 6e 20 2d + 20 62 75 74 20 73 69 6e 63 65 20 77 65 27 72 65 + 20 64 6f 69 6e 67 20 74 68 69 73 20 61 74 20 72 + 75 6e 74 69 6d 65 2c 0a + + ~ " ~ "hardcoding" can reflect where our log is. This is the" + ~ " fundamental" + 20 20 7e 20 22 68 61 72 64 63 6f 64 69 6e 67 22 + 20 63 61 6e 20 72 65 66 6c 65 63 74 20 77 68 65 + 72 65 20 6f 75 72 20 6c 6f 67 20 69 73 2e 20 54 + 68 69 73 20 69 73 20 74 68 65 20 66 75 6e 64 61 + 6d 65 6e 74 61 6c 0a + + ~ " ~ trick that makes the log usable." + 20 20 7e 20 74 72 69 63 6b 20 74 68 61 74 20 6d + 61 6b 65 73 20 74 68 65 20 6c 6f 67 20 75 73 61 + 62 6c 65 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ One more thing to notice: We already allocated the" + ~ " backing stores of" + 20 20 7e 20 20 20 4f 6e 65 20 6d 6f 72 65 20 74 + 68 69 6e 67 20 74 6f 20 6e 6f 74 69 63 65 3a 20 + 57 65 20 61 6c 72 65 61 64 79 20 61 6c 6c 6f 63 + 61 74 65 64 20 74 68 65 20 62 61 63 6b 69 6e 67 + 20 73 74 6f 72 65 73 20 6f 66 0a + + ~ " ~ these variables, and populated their initial values, in" + ~ " cold-start. The" + 20 20 7e 20 74 68 65 73 65 20 76 61 72 69 61 62 + 6c 65 73 2c 20 61 6e 64 20 70 6f 70 75 6c 61 74 + 65 64 20 74 68 65 69 72 20 69 6e 69 74 69 61 6c + 20 76 61 6c 75 65 73 2c 20 69 6e 20 63 6f 6c 64 + 2d 73 74 61 72 74 2e 20 54 68 65 0a + + ~ " ~ words we're defining return those same addresses for" + ~ " the same backing" + 20 20 7e 20 77 6f 72 64 73 20 77 65 27 72 65 20 + 64 65 66 69 6e 69 6e 67 20 72 65 74 75 72 6e 20 + 74 68 6f 73 65 20 73 61 6d 65 20 61 64 64 72 65 + 73 73 65 73 20 66 6f 72 20 74 68 65 20 73 61 6d + 65 20 62 61 63 6b 69 6e 67 0a + + ~ " ~ stores. So, we have continuity: Stuff defined in terms" + ~ " of the" + 20 20 7e 20 73 74 6f 72 65 73 2e 20 53 6f 2c 20 + 77 65 20 68 61 76 65 20 63 6f 6e 74 69 6e 75 69 + 74 79 3a 20 53 74 75 66 66 20 64 65 66 69 6e 65 + 64 20 69 6e 20 74 65 72 6d 73 20 6f 66 20 74 68 + 65 0a + + ~ " ~ variable-words we're defining now will interoperate" + ~ " with the stuff that" + 20 20 7e 20 76 61 72 69 61 62 6c 65 2d 77 6f 72 + 64 73 20 77 65 27 72 65 20 64 65 66 69 6e 69 6e + 67 20 6e 6f 77 20 77 69 6c 6c 20 69 6e 74 65 72 + 6f 70 65 72 61 74 65 20 77 69 74 68 20 74 68 65 + 20 73 74 75 66 66 20 74 68 61 74 0a + + ~ " ~ we define using the log-load helpers, which includes" + ~ " those very words." + 20 20 7e 20 77 65 20 64 65 66 69 6e 65 20 75 73 + 69 6e 67 20 74 68 65 20 6c 6f 67 2d 6c 6f 61 64 + 20 68 65 6c 70 65 72 73 2c 20 77 68 69 63 68 20 + 69 6e 63 6c 75 64 65 73 20 74 68 6f 73 65 20 76 + 65 72 79 20 77 6f 72 64 73 2e 0a + + ~ " ~ Both the log-load code and the later code are dealing" + ~ " with the same data" + 20 20 7e 20 42 6f 74 68 20 74 68 65 20 6c 6f 67 + 2d 6c 6f 61 64 20 63 6f 64 65 20 61 6e 64 20 74 + 68 65 20 6c 61 74 65 72 20 63 6f 64 65 20 61 72 + 65 20 64 65 61 6c 69 6e 67 20 77 69 74 68 20 74 + 68 65 20 73 61 6d 65 20 64 61 74 61 0a + + ~ " ~ structures, they're just using a different technique to" + ~ " find them." + 20 20 7e 20 73 74 72 75 63 74 75 72 65 73 2c 20 + 74 68 65 79 27 72 65 20 6a 75 73 74 20 75 73 69 + 6e 67 20 61 20 64 69 66 66 65 72 65 6e 74 20 74 + 65 63 68 6e 69 71 75 65 20 74 6f 20 66 69 6e 64 + 20 74 68 65 6d 2e 0a + + ~ " ~" + 20 20 7e 0a + + ~ " ~ This is the only hardcoding we need to do; by" + ~ " building on top of it," + 20 20 7e 20 20 20 54 68 69 73 20 69 73 20 74 68 + 65 20 6f 6e 6c 79 20 68 61 72 64 63 6f 64 69 6e + 67 20 77 65 20 6e 65 65 64 20 74 6f 20 64 6f 3b + 20 62 79 20 62 75 69 6c 64 69 6e 67 20 6f 6e 20 + 74 6f 70 20 6f 66 20 69 74 2c 0a + + ~ " ~ we will soon reach a point where the rest of the system" + ~ " can be defined" + 20 20 7e 20 77 65 20 77 69 6c 6c 20 73 6f 6f 6e + 20 72 65 61 63 68 20 61 20 70 6f 69 6e 74 20 77 + 68 65 72 65 20 74 68 65 20 72 65 73 74 20 6f 66 + 20 74 68 65 20 73 79 73 74 65 6d 20 63 61 6e 20 + 62 65 20 64 65 66 69 6e 65 64 0a + + ~ " ~ within itself." + 20 20 7e 20 77 69 74 68 69 6e 20 69 74 73 65 6c + 66 2e 0a + + ~ "" + 0a + + ~ " L@' log-load-log offset-to-target-address-space pack64" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 6c + 6f 67 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 + 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 + 65 20 70 61 63 6b 36 34 0a + + ~ " ~ : -8 log-load-log #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 6c 6f 67 20 23 2d 2d 20 28 63 6f 64 65 77 + 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " L@' litstring offset-to-target-address-space pack64" + 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e 67 20 + 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 65 74 + 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 20 70 + 61 63 6b 36 34 0a + + ~ " ~ : -8 litstring #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 69 74 73 74 72 69 + 6e 67 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 + 20 70 6f 69 6e 74 65 72 29 0a + + ~ " s" log" packstring 8 packalign" + 20 20 73 22 20 6c 6f 67 22 20 70 61 63 6b 73 74 + 72 69 6e 67 20 38 20 70 61 63 6b 61 6c 69 67 6e + 0a + + ~ " L@' log-load-variable offset-to-target-address-space" + ~ " pack64" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 76 + 61 72 69 61 62 6c 65 20 6f 66 66 73 65 74 2d 74 + 6f 2d 74 61 72 67 65 74 2d 61 64 64 72 65 73 73 + 2d 73 70 61 63 65 20 70 61 63 6b 36 34 0a + + ~ " ~ : -8 log-load-variable #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 76 61 72 69 61 62 6c 65 20 23 2d 2d 20 28 + 63 6f 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 + 29 0a + + ~ "" + 0a + + ~ " L@' log-load-s0 offset-to-target-address-space pack64" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 73 + 30 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 70 61 63 6b 36 34 0a + + ~ " ~ : -8 log-load-s0 #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 73 30 20 23 2d 2d 20 28 63 6f 64 65 77 6f + 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " L@' litstring offset-to-target-address-space pack64" + 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e 67 20 + 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 65 74 + 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 20 70 + 61 63 6b 36 34 0a + + ~ " ~ : -8 litstring #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 69 74 73 74 72 69 + 6e 67 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 + 20 70 6f 69 6e 74 65 72 29 0a + + ~ " s" s0" packstring 8 packalign" + 20 20 73 22 20 73 30 22 20 70 61 63 6b 73 74 72 + 69 6e 67 20 38 20 70 61 63 6b 61 6c 69 67 6e 0a + + ~ " L@' log-load-variable offset-to-target-address-space" + ~ " pack64" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 76 + 61 72 69 61 62 6c 65 20 6f 66 66 73 65 74 2d 74 + 6f 2d 74 61 72 67 65 74 2d 61 64 64 72 65 73 73 + 2d 73 70 61 63 65 20 70 61 63 6b 36 34 0a + + ~ " ~ : -8 log-load-variable #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 76 61 72 69 61 62 6c 65 20 23 2d 2d 20 28 + 63 6f 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 + 29 0a + + ~ "" + 0a + + ~ " L@' log-load-r0 offset-to-target-address-space pack64" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 72 + 30 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 70 61 63 6b 36 34 0a + + ~ " ~ : -8 log-load-r0 #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 72 30 20 23 2d 2d 20 28 63 6f 64 65 77 6f + 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " L@' litstring offset-to-target-address-space pack64" + 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e 67 20 + 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 65 74 + 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 20 70 + 61 63 6b 36 34 0a + + ~ " ~ : -8 litstring #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 69 74 73 74 72 69 + 6e 67 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 + 20 70 6f 69 6e 74 65 72 29 0a + + ~ " s" r0" packstring 8 packalign" + 20 20 73 22 20 72 30 22 20 70 61 63 6b 73 74 72 + 69 6e 67 20 38 20 70 61 63 6b 61 6c 69 67 6e 0a + + ~ " L@' log-load-variable offset-to-target-address-space" + ~ " pack64" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 76 + 61 72 69 61 62 6c 65 20 6f 66 66 73 65 74 2d 74 + 6f 2d 74 61 72 67 65 74 2d 61 64 64 72 65 73 73 + 2d 73 70 61 63 65 20 70 61 63 6b 36 34 0a + + ~ " ~ : -8 log-load-variable #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 76 61 72 69 61 62 6c 65 20 23 2d 2d 20 28 + 63 6f 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 + 29 0a + + ~ "" + 0a + + ~ " L@' log-load-latest offset-to-target-address-space" + ~ " pack64" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 6c + 61 74 65 73 74 20 6f 66 66 73 65 74 2d 74 6f 2d + 74 61 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 + 70 61 63 65 20 70 61 63 6b 36 34 0a + + ~ " ~ : -8 log-load-latest #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 6c 61 74 65 73 74 20 23 2d 2d 20 28 63 6f + 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " L@' litstring offset-to-target-address-space pack64" + 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e 67 20 + 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 65 74 + 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 20 70 + 61 63 6b 36 34 0a + + ~ " ~ : -8 litstring #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 69 74 73 74 72 69 + 6e 67 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 + 20 70 6f 69 6e 74 65 72 29 0a + + ~ " s" latest" packstring 8 packalign" + 20 20 73 22 20 6c 61 74 65 73 74 22 20 70 61 63 + 6b 73 74 72 69 6e 67 20 38 20 70 61 63 6b 61 6c + 69 67 6e 0a + + ~ " L@' log-load-variable offset-to-target-address-space" + ~ " pack64" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 76 + 61 72 69 61 62 6c 65 20 6f 66 66 73 65 74 2d 74 + 6f 2d 74 61 72 67 65 74 2d 61 64 64 72 65 73 73 + 2d 73 70 61 63 65 20 70 61 63 6b 36 34 0a + + ~ " ~ : -8 log-load-variable #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 76 61 72 69 61 62 6c 65 20 23 2d 2d 20 28 + 63 6f 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 + 29 0a + + ~ "" + 0a + + ~ " L@' log-load-here offset-to-target-address-space pack64" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 68 + 65 72 65 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 70 61 63 6b 36 34 0a + + ~ " ~ : -8 log-load-here #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 68 65 72 65 20 23 2d 2d 20 28 63 6f 64 65 + 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " L@' litstring offset-to-target-address-space pack64" + 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e 67 20 + 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 65 74 + 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 20 70 + 61 63 6b 36 34 0a + + ~ " ~ : -8 litstring #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 69 74 73 74 72 69 + 6e 67 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 + 20 70 6f 69 6e 74 65 72 29 0a + + ~ " s" here" packstring 8 packalign" + 20 20 73 22 20 68 65 72 65 22 20 70 61 63 6b 73 + 74 72 69 6e 67 20 38 20 70 61 63 6b 61 6c 69 67 + 6e 0a + + ~ " L@' log-load-variable offset-to-target-address-space" + ~ " pack64" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 76 + 61 72 69 61 62 6c 65 20 6f 66 66 73 65 74 2d 74 + 6f 2d 74 61 72 67 65 74 2d 61 64 64 72 65 73 73 + 2d 73 70 61 63 65 20 70 61 63 6b 36 34 0a + + ~ " ~ : -8 log-load-variable #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 76 61 72 69 61 62 6c 65 20 23 2d 2d 20 28 + 63 6f 64 65 77 6f 72 64 20 70 6f 69 6e 74 65 72 + 29 0a + + ~ "" + 0a + + ~ " ~ Having done that, nothing else needs to be defined in" + ~ " an unusual way, so" + 20 20 7e 20 20 20 48 61 76 69 6e 67 20 64 6f 6e + 65 20 74 68 61 74 2c 20 6e 6f 74 68 69 6e 67 20 + 65 6c 73 65 20 6e 65 65 64 73 20 74 6f 20 62 65 + 20 64 65 66 69 6e 65 64 20 69 6e 20 61 6e 20 75 + 6e 75 73 75 61 6c 20 77 61 79 2c 20 73 6f 0a + + ~ " ~ at this point the warm-start routine can go ahead and" + ~ " dispatch to the" + 20 20 7e 20 61 74 20 74 68 69 73 20 70 6f 69 6e + 74 20 74 68 65 20 77 61 72 6d 2d 73 74 61 72 74 + 20 72 6f 75 74 69 6e 65 20 63 61 6e 20 67 6f 20 + 61 68 65 61 64 20 61 6e 64 20 64 69 73 70 61 74 + 63 68 20 74 6f 20 74 68 65 0a + + ~ " ~ log-load transform, and do the rest of the code through" + ~ " that. However, to" + 20 20 7e 20 6c 6f 67 2d 6c 6f 61 64 20 74 72 61 + 6e 73 66 6f 72 6d 2c 20 61 6e 64 20 64 6f 20 74 + 68 65 20 72 65 73 74 20 6f 66 20 74 68 65 20 63 + 6f 64 65 20 74 68 72 6f 75 67 68 20 74 68 61 74 + 2e 20 48 6f 77 65 76 65 72 2c 20 74 6f 0a + + ~ " ~ allow customization, we here in output-warm-start will" + ~ " let our caller take" + 20 20 7e 20 61 6c 6c 6f 77 20 63 75 73 74 6f 6d + 69 7a 61 74 69 6f 6e 2c 20 77 65 20 68 65 72 65 + 20 69 6e 20 6f 75 74 70 75 74 2d 77 61 72 6d 2d + 73 74 61 72 74 20 77 69 6c 6c 20 6c 65 74 20 6f + 75 72 20 63 61 6c 6c 65 72 20 74 61 6b 65 0a + + ~ " ~ responsibility for making sure that happens." + 20 20 7e 20 72 65 73 70 6f 6e 73 69 62 69 6c 69 + 74 79 20 66 6f 72 20 6d 61 6b 69 6e 67 20 73 75 + 72 65 20 74 68 61 74 20 68 61 70 70 65 6e 73 2e + 0a + + ~ " ;" + 20 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This helper doesn't have any actual compile-time" + ~ " responsibilities, it" + 7e 20 20 20 54 68 69 73 20 68 65 6c 70 65 72 20 + 64 6f 65 73 6e 27 74 20 68 61 76 65 20 61 6e 79 + 20 61 63 74 75 61 6c 20 63 6f 6d 70 69 6c 65 2d + 74 69 6d 65 20 72 65 73 70 6f 6e 73 69 62 69 6c + 69 74 69 65 73 2c 20 69 74 0a + + ~ "~ exists solely for the sake of the magic comments." + 7e 20 65 78 69 73 74 73 20 73 6f 6c 65 6c 79 20 + 66 6f 72 20 74 68 65 20 73 61 6b 65 20 6f 66 20 + 74 68 65 20 6d 61 67 69 63 20 63 6f 6d 6d 65 6e + 74 73 2e 0a + + ~ "~" + 7e 0a + + ~ "~ We could have it be responsible for calling" + ~ " log-load-transform, but" + 7e 20 20 20 57 65 20 63 6f 75 6c 64 20 68 61 76 + 65 20 69 74 20 62 65 20 72 65 73 70 6f 6e 73 69 + 62 6c 65 20 66 6f 72 20 63 61 6c 6c 69 6e 67 20 + 6c 6f 67 2d 6c 6f 61 64 2d 74 72 61 6e 73 66 6f + 72 6d 2c 20 62 75 74 0a + + ~ "~ honestly it's nicer letting the caller be responsible for" + ~ " that, since the" + 7e 20 68 6f 6e 65 73 74 6c 79 20 69 74 27 73 20 + 6e 69 63 65 72 20 6c 65 74 74 69 6e 67 20 74 68 + 65 20 63 61 6c 6c 65 72 20 62 65 20 72 65 73 70 + 6f 6e 73 69 62 6c 65 20 66 6f 72 20 74 68 61 74 + 2c 20 73 69 6e 63 65 20 74 68 65 0a + + ~ "~ caller is also responsible for calling label-transform." + 7e 20 63 61 6c 6c 65 72 20 69 73 20 61 6c 73 6f + 20 72 65 73 70 6f 6e 73 69 62 6c 65 20 66 6f 72 + 20 63 61 6c 6c 69 6e 67 20 6c 61 62 65 6c 2d 74 + 72 61 6e 73 66 6f 72 6d 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (output buffer start, output point -- output buffer" + ~ " start, output point)" + 7e 20 28 6f 75 74 70 75 74 20 62 75 66 66 65 72 + 20 73 74 61 72 74 2c 20 6f 75 74 70 75 74 20 70 + 6f 69 6e 74 20 2d 2d 20 6f 75 74 70 75 74 20 62 + 75 66 66 65 72 20 73 74 61 72 74 2c 20 6f 75 74 + 70 75 74 20 70 6f 69 6e 74 29 0a + + ~ ": output-warm-start-post-log-load-transform" + 3a 20 6f 75 74 70 75 74 2d 77 61 72 6d 2d 73 74 + 61 72 74 2d 70 6f 73 74 2d 6c 6f 67 2d 6c 6f 61 + 64 2d 74 72 61 6e 73 66 6f 72 6d 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : We're now done with the log-load routine; the next" + ~ " little bit of code" + 20 20 7e 20 3a 20 20 20 57 65 27 72 65 20 6e 6f + 77 20 64 6f 6e 65 20 77 69 74 68 20 74 68 65 20 + 6c 6f 67 2d 6c 6f 61 64 20 72 6f 75 74 69 6e 65 + 3b 20 74 68 65 20 6e 65 78 74 20 6c 69 74 74 6c + 65 20 62 69 74 20 6f 66 20 63 6f 64 65 0a + + ~ " ~ : here is the final bit of the warm-start routine." + 20 20 7e 20 3a 20 68 65 72 65 20 69 73 20 74 68 + 65 20 66 69 6e 61 6c 20 62 69 74 20 6f 66 20 74 + 68 65 20 77 61 72 6d 2d 73 74 61 72 74 20 72 6f + 75 74 69 6e 65 2e 0a + + ~ " ;" + 20 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ After the log-load routine finishes, everything we need" + ~ " has been added to" + 7e 20 20 20 41 66 74 65 72 20 74 68 65 20 6c 6f + 67 2d 6c 6f 61 64 20 72 6f 75 74 69 6e 65 20 66 + 69 6e 69 73 68 65 73 2c 20 65 76 65 72 79 74 68 + 69 6e 67 20 77 65 20 6e 65 65 64 20 68 61 73 20 + 62 65 65 6e 20 61 64 64 65 64 20 74 6f 0a + + ~ "~ the log and we're almost ready to jump into dynamic code" + ~ " running from the" + 7e 20 74 68 65 20 6c 6f 67 20 61 6e 64 20 77 65 + 27 72 65 20 61 6c 6d 6f 73 74 20 72 65 61 64 79 + 20 74 6f 20 6a 75 6d 70 20 69 6e 74 6f 20 64 79 + 6e 61 6d 69 63 20 63 6f 64 65 20 72 75 6e 6e 69 + 6e 67 20 66 72 6f 6d 20 74 68 65 0a + + ~ "~ log. That code still needs main-input-buffer to be set up" + ~ " in some way. The" + 7e 20 6c 6f 67 2e 20 54 68 61 74 20 63 6f 64 65 + 20 73 74 69 6c 6c 20 6e 65 65 64 73 20 6d 61 69 + 6e 2d 69 6e 70 75 74 2d 62 75 66 66 65 72 20 74 + 6f 20 62 65 20 73 65 74 20 75 70 20 69 6e 20 73 + 6f 6d 65 20 77 61 79 2e 20 54 68 65 0a + + ~ "~ simplest approach is to attach it directly to standard" + ~ " input. This helper" + 7e 20 73 69 6d 70 6c 65 73 74 20 61 70 70 72 6f + 61 63 68 20 69 73 20 74 6f 20 61 74 74 61 63 68 + 20 69 74 20 64 69 72 65 63 74 6c 79 20 74 6f 20 + 73 74 61 6e 64 61 72 64 20 69 6e 70 75 74 2e 20 + 54 68 69 73 20 68 65 6c 70 65 72 0a + + ~ "~ outputs a snippet that does that, structured to be used" + ~ " as part of the" + 7e 20 6f 75 74 70 75 74 73 20 61 20 73 6e 69 70 + 70 65 74 20 74 68 61 74 20 64 6f 65 73 20 74 68 + 61 74 2c 20 73 74 72 75 63 74 75 72 65 64 20 74 + 6f 20 62 65 20 75 73 65 64 20 61 73 20 70 61 72 + 74 20 6f 66 20 74 68 65 0a + + ~ "~ warm-start routine." + 7e 20 77 61 72 6d 2d 73 74 61 72 74 20 72 6f 75 + 74 69 6e 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Executables that don't call" + ~ " output-warm-start-attach-stdin will need to" + 7e 20 20 20 45 78 65 63 75 74 61 62 6c 65 73 20 + 74 68 61 74 20 64 6f 6e 27 74 20 63 61 6c 6c 20 + 6f 75 74 70 75 74 2d 77 61 72 6d 2d 73 74 61 72 + 74 2d 61 74 74 61 63 68 2d 73 74 64 69 6e 20 77 + 69 6c 6c 20 6e 65 65 64 20 74 6f 0a + + ~ "~ instead call output-warm-start-attach-boot-source." + ~ " Exactly one of these must" + 7e 20 69 6e 73 74 65 61 64 20 63 61 6c 6c 20 6f + 75 74 70 75 74 2d 77 61 72 6d 2d 73 74 61 72 74 + 2d 61 74 74 61 63 68 2d 62 6f 6f 74 2d 73 6f 75 + 72 63 65 2e 20 45 78 61 63 74 6c 79 20 6f 6e 65 + 20 6f 66 20 74 68 65 73 65 20 6d 75 73 74 0a + + ~ "~ be used." + 7e 20 62 65 20 75 73 65 64 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (output buffer start, output point -- output buffer" + ~ " start, output point)" + 7e 20 28 6f 75 74 70 75 74 20 62 75 66 66 65 72 + 20 73 74 61 72 74 2c 20 6f 75 74 70 75 74 20 70 + 6f 69 6e 74 20 2d 2d 20 6f 75 74 70 75 74 20 62 + 75 66 66 65 72 20 73 74 61 72 74 2c 20 6f 75 74 + 70 75 74 20 70 6f 69 6e 74 29 0a + + ~ ": output-warm-start-attach-stdin" + 3a 20 6f 75 74 70 75 74 2d 77 61 72 6d 2d 73 74 + 61 72 74 2d 61 74 74 61 63 68 2d 73 74 64 69 6e + 0a + + ~ " L@' litstring offset-to-target-address-space pack64" + 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e 67 20 + 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 65 74 + 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 20 70 + 61 63 6b 36 34 0a + + ~ " ~ : -8 litstring #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 69 74 73 74 72 69 + 6e 67 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 + 20 70 6f 69 6e 74 65 72 29 0a + + ~ " s" relink-main-input-buffer-to-stdin" packstring 8" + ~ " packalign" + 20 20 73 22 20 72 65 6c 69 6e 6b 2d 6d 61 69 6e + 2d 69 6e 70 75 74 2d 62 75 66 66 65 72 2d 74 6f + 2d 73 74 64 69 6e 22 20 70 61 63 6b 73 74 72 69 + 6e 67 20 38 20 70 61 63 6b 61 6c 69 67 6e 0a + + ~ " L@' log-load-find-execution-token" + ~ " offset-to-target-address-space pack64" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 66 + 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f + 6b 65 6e 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 70 61 63 6b 36 34 0a + + ~ " ~ : -8 log-load-find-execution-token #-- (codeword" + ~ " pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 66 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e + 2d 74 6f 6b 65 6e 20 23 2d 2d 20 28 63 6f 64 65 + 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " L@' execute offset-to-target-address-space pack64" + 20 20 4c 40 27 20 65 78 65 63 75 74 65 20 6f 66 + 66 73 65 74 2d 74 6f 2d 74 61 72 67 65 74 2d 61 + 64 64 72 65 73 73 2d 73 70 61 63 65 20 70 61 63 + 6b 36 34 0a + + ~ " ~ : -8 execute #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 65 78 65 63 75 74 65 + 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 70 + 6f 69 6e 74 65 72 29 0a + + ~ " ;" + 20 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ After the log-load routine finishes, everything we need" + ~ " has been added to" + 7e 20 20 20 41 66 74 65 72 20 74 68 65 20 6c 6f + 67 2d 6c 6f 61 64 20 72 6f 75 74 69 6e 65 20 66 + 69 6e 69 73 68 65 73 2c 20 65 76 65 72 79 74 68 + 69 6e 67 20 77 65 20 6e 65 65 64 20 68 61 73 20 + 62 65 65 6e 20 61 64 64 65 64 20 74 6f 0a + + ~ "~ the log and we're almost ready to jump into dynamic code" + ~ " running from the" + 7e 20 74 68 65 20 6c 6f 67 20 61 6e 64 20 77 65 + 27 72 65 20 61 6c 6d 6f 73 74 20 72 65 61 64 79 + 20 74 6f 20 6a 75 6d 70 20 69 6e 74 6f 20 64 79 + 6e 61 6d 69 63 20 63 6f 64 65 20 72 75 6e 6e 69 + 6e 67 20 66 72 6f 6d 20 74 68 65 0a + + ~ "~ log. It's inconvenient for code under the log-load" + ~ " transform to interact" + 7e 20 6c 6f 67 2e 20 49 74 27 73 20 69 6e 63 6f + 6e 76 65 6e 69 65 6e 74 20 66 6f 72 20 63 6f 64 + 65 20 75 6e 64 65 72 20 74 68 65 20 6c 6f 67 2d + 6c 6f 61 64 20 74 72 61 6e 73 66 6f 72 6d 20 74 + 6f 20 69 6e 74 65 72 61 63 74 0a + + ~ "~ with the label system, so if we want to point" + ~ " main-input-buffer at a string," + 7e 20 77 69 74 68 20 74 68 65 20 6c 61 62 65 6c + 20 73 79 73 74 65 6d 2c 20 73 6f 20 69 66 20 77 + 65 20 77 61 6e 74 20 74 6f 20 70 6f 69 6e 74 20 + 6d 61 69 6e 2d 69 6e 70 75 74 2d 62 75 66 66 65 + 72 20 61 74 20 61 20 73 74 72 69 6e 67 2c 0a + + ~ "~ that's the place to do it." + 7e 20 74 68 61 74 27 73 20 74 68 65 20 70 6c 61 + 63 65 20 74 6f 20 64 6f 20 69 74 2e 0a + + ~ "~" + 7e 0a + + ~ "~ That's optional functionality, which any given" + ~ " executable may or may not" + 7e 20 20 20 54 68 61 74 27 73 20 6f 70 74 69 6f + 6e 61 6c 20 66 75 6e 63 74 69 6f 6e 61 6c 69 74 + 79 2c 20 77 68 69 63 68 20 61 6e 79 20 67 69 76 + 65 6e 20 65 78 65 63 75 74 61 62 6c 65 20 6d 61 + 79 20 6f 72 20 6d 61 79 20 6e 6f 74 0a + + ~ "~ want to use, so it's here in this helper. If your" + ~ " executable is built with" + 7e 20 77 61 6e 74 20 74 6f 20 75 73 65 2c 20 73 + 6f 20 69 74 27 73 20 68 65 72 65 20 69 6e 20 74 + 68 69 73 20 68 65 6c 70 65 72 2e 20 49 66 20 79 + 6f 75 72 20 65 78 65 63 75 74 61 62 6c 65 20 69 + 73 20 62 75 69 6c 74 20 77 69 74 68 0a + + ~ "~ a call to output-warm-start-attach-boot-source, it must" + ~ " also at some point" + 7e 20 61 20 63 61 6c 6c 20 74 6f 20 6f 75 74 70 + 75 74 2d 77 61 72 6d 2d 73 74 61 72 74 2d 61 74 + 74 61 63 68 2d 62 6f 6f 74 2d 73 6f 75 72 63 65 + 2c 20 69 74 20 6d 75 73 74 20 61 6c 73 6f 20 61 + 74 20 73 6f 6d 65 20 70 6f 69 6e 74 0a + + ~ "~ include a call to output-boot-source." + 7e 20 69 6e 63 6c 75 64 65 20 61 20 63 61 6c 6c + 20 74 6f 20 6f 75 74 70 75 74 2d 62 6f 6f 74 2d + 73 6f 75 72 63 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (output buffer start, output point, input string pointer" + 7e 20 28 6f 75 74 70 75 74 20 62 75 66 66 65 72 + 20 73 74 61 72 74 2c 20 6f 75 74 70 75 74 20 70 + 6f 69 6e 74 2c 20 69 6e 70 75 74 20 73 74 72 69 + 6e 67 20 70 6f 69 6e 74 65 72 0a + + ~ "~ -- output buffer start, output point)" + 7e 20 20 2d 2d 20 6f 75 74 70 75 74 20 62 75 66 + 66 65 72 20 73 74 61 72 74 2c 20 6f 75 74 70 75 + 74 20 70 6f 69 6e 74 29 0a + + ~ ": output-warm-start-attach-boot-source" + 3a 20 6f 75 74 70 75 74 2d 77 61 72 6d 2d 73 74 + 61 72 74 2d 61 74 74 61 63 68 2d 62 6f 6f 74 2d + 73 6f 75 72 63 65 0a + + ~ " L@' litstring offset-to-target-address-space pack64" + 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e 67 20 + 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 65 74 + 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 20 70 + 61 63 6b 36 34 0a + + ~ " ~ : -8 litstring #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 69 74 73 74 72 69 + 6e 67 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 + 20 70 6f 69 6e 74 65 72 29 0a + + ~ " s" main-input-buffer" packstring 8 packalign" + 20 20 73 22 20 6d 61 69 6e 2d 69 6e 70 75 74 2d + 62 75 66 66 65 72 22 20 70 61 63 6b 73 74 72 69 + 6e 67 20 38 20 70 61 63 6b 61 6c 69 67 6e 0a + + ~ " L@' log-load-find-execution-token" + ~ " offset-to-target-address-space pack64" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 66 + 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f + 6b 65 6e 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 70 61 63 6b 36 34 0a + + ~ " ~ : -8 log-load-find-execution-token #-- (codeword" + ~ " pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 66 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e + 2d 74 6f 6b 65 6e 20 23 2d 2d 20 28 63 6f 64 65 + 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " L@' execute offset-to-target-address-space pack64" + 20 20 4c 40 27 20 65 78 65 63 75 74 65 20 6f 66 + 66 73 65 74 2d 74 6f 2d 74 61 72 67 65 74 2d 61 + 64 64 72 65 73 73 2d 73 70 61 63 65 20 70 61 63 + 6b 36 34 0a + + ~ " ~ : -8 execute #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 65 78 65 63 75 74 65 + 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 70 + 6f 69 6e 74 65 72 29 0a + + ~ " L@' lit offset-to-target-address-space pack64" + 20 20 4c 40 27 20 6c 69 74 20 6f 66 66 73 65 74 + 2d 74 6f 2d 74 61 72 67 65 74 2d 61 64 64 72 65 + 73 73 2d 73 70 61 63 65 20 70 61 63 6b 36 34 0a + + ~ " ~ : -8 lit #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 69 74 20 23 2d 2d + 20 28 63 6f 64 65 77 6f 72 64 20 70 6f 69 6e 74 + 65 72 29 0a + + ~ " L@' boot-source offset-to-target-address-space pack64" + 20 20 4c 40 27 20 62 6f 6f 74 2d 73 6f 75 72 63 + 65 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 + 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 + 20 70 61 63 6b 36 34 0a + + ~ " ~ : -8 boot-source #-- (data pointer)" + 20 20 7e 20 3a 20 2d 38 20 62 6f 6f 74 2d 73 6f + 75 72 63 65 20 23 2d 2d 20 28 64 61 74 61 20 70 + 6f 69 6e 74 65 72 29 0a + + ~ " L@' 3roll offset-to-target-address-space pack64" + 20 20 4c 40 27 20 33 72 6f 6c 6c 20 6f 66 66 73 + 65 74 2d 74 6f 2d 74 61 72 67 65 74 2d 61 64 64 + 72 65 73 73 2d 73 70 61 63 65 20 70 61 63 6b 36 + 34 0a + + ~ " ~ : -8 3roll #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 33 72 6f 6c 6c 20 23 + 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 70 6f 69 + 6e 74 65 72 29 0a + + ~ " L@' litstring offset-to-target-address-space pack64" + 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e 67 20 + 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 65 74 + 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 20 70 + 61 63 6b 36 34 0a + + ~ " ~ : -8 litstring #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 69 74 73 74 72 69 + 6e 67 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 + 20 70 6f 69 6e 74 65 72 29 0a + + ~ " s" attach-string-to-input-buffer" packstring 8 packalign" + 20 20 73 22 20 61 74 74 61 63 68 2d 73 74 72 69 + 6e 67 2d 74 6f 2d 69 6e 70 75 74 2d 62 75 66 66 + 65 72 22 20 70 61 63 6b 73 74 72 69 6e 67 20 38 + 20 70 61 63 6b 61 6c 69 67 6e 0a + + ~ " L@' log-load-find-execution-token" + ~ " offset-to-target-address-space pack64" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 66 + 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f + 6b 65 6e 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 70 61 63 6b 36 34 0a + + ~ " ~ : -8 log-load-find-execution-token #-- (codeword" + ~ " pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 66 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e + 2d 74 6f 6b 65 6e 20 23 2d 2d 20 28 63 6f 64 65 + 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " L@' swap offset-to-target-address-space pack64" + 20 20 4c 40 27 20 73 77 61 70 20 6f 66 66 73 65 + 74 2d 74 6f 2d 74 61 72 67 65 74 2d 61 64 64 72 + 65 73 73 2d 73 70 61 63 65 20 70 61 63 6b 36 34 + 0a + + ~ " ~ : -8 swap #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 73 77 61 70 20 23 2d + 2d 20 28 63 6f 64 65 77 6f 72 64 20 70 6f 69 6e + 74 65 72 29 0a + + ~ " L@' lit offset-to-target-address-space pack64" + 20 20 4c 40 27 20 6c 69 74 20 6f 66 66 73 65 74 + 2d 74 6f 2d 74 61 72 67 65 74 2d 61 64 64 72 65 + 73 73 2d 73 70 61 63 65 20 70 61 63 6b 36 34 0a + + ~ " ~ : -8 lit #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 69 74 20 23 2d 2d + 20 28 63 6f 64 65 77 6f 72 64 20 70 6f 69 6e 74 + 65 72 29 0a + + ~ " 4 ~ : provide-hex" + 20 20 34 20 7e 20 3a 20 70 72 6f 76 69 64 65 2d + 68 65 78 0a + + ~ " pack64" + 20 20 70 61 63 6b 36 34 0a + + ~ " ~ : -8 # #-- (integer literal)" + 20 20 7e 20 3a 20 2d 38 20 23 20 23 2d 2d 20 28 + 69 6e 74 65 67 65 72 20 6c 69 74 65 72 61 6c 29 + 0a + + ~ " L@' unroll offset-to-target-address-space pack64" + 20 20 4c 40 27 20 75 6e 72 6f 6c 6c 20 6f 66 66 + 73 65 74 2d 74 6f 2d 74 61 72 67 65 74 2d 61 64 + 64 72 65 73 73 2d 73 70 61 63 65 20 70 61 63 6b + 36 34 0a + + ~ " ~ : -8 unroll #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 75 6e 72 6f 6c 6c 20 + 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 70 6f + 69 6e 74 65 72 29 0a + + ~ " L@' execute offset-to-target-address-space pack64" + 20 20 4c 40 27 20 65 78 65 63 75 74 65 20 6f 66 + 66 73 65 74 2d 74 6f 2d 74 61 72 67 65 74 2d 61 + 64 64 72 65 73 73 2d 73 70 61 63 65 20 70 61 63 + 6b 36 34 0a + + ~ " ~ : -8 execute #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 65 78 65 63 75 74 65 + 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 70 + 6f 69 6e 74 65 72 29 0a + + ~ " ;" + 20 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Once the log-load routine has been run and" + ~ " main-input-buffer has been" + 7e 20 20 20 4f 6e 63 65 20 74 68 65 20 6c 6f 67 + 2d 6c 6f 61 64 20 72 6f 75 74 69 6e 65 20 68 61 + 73 20 62 65 65 6e 20 72 75 6e 20 61 6e 64 20 6d + 61 69 6e 2d 69 6e 70 75 74 2d 62 75 66 66 65 72 + 20 68 61 73 20 62 65 65 6e 0a + + ~ "~ prepared, the next layer is built. This helper outputs" + ~ " the final little bit" + 7e 20 70 72 65 70 61 72 65 64 2c 20 74 68 65 20 + 6e 65 78 74 20 6c 61 79 65 72 20 69 73 20 62 75 + 69 6c 74 2e 20 54 68 69 73 20 68 65 6c 70 65 72 + 20 6f 75 74 70 75 74 73 20 74 68 65 20 66 69 6e + 61 6c 20 6c 69 74 74 6c 65 20 62 69 74 0a + + ~ "~ of the warm-start routine, which moves on to that layer." + 7e 20 6f 66 20 74 68 65 20 77 61 72 6d 2d 73 74 + 61 72 74 20 72 6f 75 74 69 6e 65 2c 20 77 68 69 + 63 68 20 6d 6f 76 65 73 20 6f 6e 20 74 6f 20 74 + 68 61 74 20 6c 61 79 65 72 2e 0a + + ~ "~" + 7e 0a + + ~ "~ Outputting the warm-start routine should always end by" + ~ " calling" + 7e 20 20 20 4f 75 74 70 75 74 74 69 6e 67 20 74 + 68 65 20 77 61 72 6d 2d 73 74 61 72 74 20 72 6f + 75 74 69 6e 65 20 73 68 6f 75 6c 64 20 61 6c 77 + 61 79 73 20 65 6e 64 20 62 79 20 63 61 6c 6c 69 + 6e 67 0a + + ~ "~ output-warm-start-footer." + 7e 20 6f 75 74 70 75 74 2d 77 61 72 6d 2d 73 74 + 61 72 74 2d 66 6f 6f 74 65 72 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (output buffer start, output point -- output buffer" + ~ " start, output point)" + 7e 20 28 6f 75 74 70 75 74 20 62 75 66 66 65 72 + 20 73 74 61 72 74 2c 20 6f 75 74 70 75 74 20 70 + 6f 69 6e 74 20 2d 2d 20 6f 75 74 70 75 74 20 62 + 75 66 66 65 72 20 73 74 61 72 74 2c 20 6f 75 74 + 70 75 74 20 70 6f 69 6e 74 29 0a + + ~ ": output-warm-start-footer" + 3a 20 6f 75 74 70 75 74 2d 77 61 72 6d 2d 73 74 + 61 72 74 2d 66 6f 6f 74 65 72 0a + + ~ " L@' litstring offset-to-target-address-space pack64" + 20 20 4c 40 27 20 6c 69 74 73 74 72 69 6e 67 20 + 6f 66 66 73 65 74 2d 74 6f 2d 74 61 72 67 65 74 + 2d 61 64 64 72 65 73 73 2d 73 70 61 63 65 20 70 + 61 63 6b 36 34 0a + + ~ " ~ : -8 litstring #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 69 74 73 74 72 69 + 6e 67 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 + 20 70 6f 69 6e 74 65 72 29 0a + + ~ " s" quit" packstring 8 packalign" + 20 20 73 22 20 71 75 69 74 22 20 70 61 63 6b 73 + 74 72 69 6e 67 20 38 20 70 61 63 6b 61 6c 69 67 + 6e 0a + + ~ " L@' log-load-find-execution-token" + ~ " offset-to-target-address-space pack64" + 20 20 4c 40 27 20 6c 6f 67 2d 6c 6f 61 64 2d 66 + 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e 2d 74 6f + 6b 65 6e 20 6f 66 66 73 65 74 2d 74 6f 2d 74 61 + 72 67 65 74 2d 61 64 64 72 65 73 73 2d 73 70 61 + 63 65 20 70 61 63 6b 36 34 0a + + ~ " ~ : -8 log-load-find-execution-token #-- (codeword" + ~ " pointer)" + 20 20 7e 20 3a 20 2d 38 20 6c 6f 67 2d 6c 6f 61 + 64 2d 66 69 6e 64 2d 65 78 65 63 75 74 69 6f 6e + 2d 74 6f 6b 65 6e 20 23 2d 2d 20 28 63 6f 64 65 + 77 6f 72 64 20 70 6f 69 6e 74 65 72 29 0a + + ~ " L@' swap offset-to-target-address-space pack64" + 20 20 4c 40 27 20 73 77 61 70 20 6f 66 66 73 65 + 74 2d 74 6f 2d 74 61 72 67 65 74 2d 61 64 64 72 + 65 73 73 2d 73 70 61 63 65 20 70 61 63 6b 36 34 + 0a + + ~ " ~ : -8 swap #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 73 77 61 70 20 23 2d + 2d 20 28 63 6f 64 65 77 6f 72 64 20 70 6f 69 6e + 74 65 72 29 0a + + ~ " ~ : Get rid of that heap pointer on the stack, we're" + ~ " finally done with it!" + 20 20 7e 20 3a 20 47 65 74 20 72 69 64 20 6f 66 + 20 74 68 61 74 20 68 65 61 70 20 70 6f 69 6e 74 + 65 72 20 6f 6e 20 74 68 65 20 73 74 61 63 6b 2c + 20 77 65 27 72 65 20 66 69 6e 61 6c 6c 79 20 64 + 6f 6e 65 20 77 69 74 68 20 69 74 21 0a + + ~ " L@' drop offset-to-target-address-space pack64" + 20 20 4c 40 27 20 64 72 6f 70 20 6f 66 66 73 65 + 74 2d 74 6f 2d 74 61 72 67 65 74 2d 61 64 64 72 + 65 73 73 2d 73 70 61 63 65 20 70 61 63 6b 36 34 + 0a + + ~ " ~ : -8 drop #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 64 72 6f 70 20 23 2d + 2d 20 28 63 6f 64 65 77 6f 72 64 20 70 6f 69 6e + 74 65 72 29 0a + + ~ " L@' execute offset-to-target-address-space pack64" + 20 20 4c 40 27 20 65 78 65 63 75 74 65 20 6f 66 + 66 73 65 74 2d 74 6f 2d 74 61 72 67 65 74 2d 61 + 64 64 72 65 73 73 2d 73 70 61 63 65 20 70 61 63 + 6b 36 34 0a + + ~ " ~ : -8 execute #-- (codeword pointer)" + 20 20 7e 20 3a 20 2d 38 20 65 78 65 63 75 74 65 + 20 23 2d 2d 20 28 63 6f 64 65 77 6f 72 64 20 70 + 6f 69 6e 74 65 72 29 0a + + ~ " ~ : deindent" + 20 20 7e 20 3a 20 64 65 69 6e 64 65 6e 74 0a + + ~ " ;" + 20 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ This helper generates a single word entry named" + ~ " "boot-source", flagged as" + 7e 20 20 20 54 68 69 73 20 68 65 6c 70 65 72 20 + 67 65 6e 65 72 61 74 65 73 20 61 20 73 69 6e 67 + 6c 65 20 77 6f 72 64 20 65 6e 74 72 79 20 6e 61 + 6d 65 64 20 22 62 6f 6f 74 2d 73 6f 75 72 63 65 + 22 2c 20 66 6c 61 67 67 65 64 20 61 73 0a + + ~ "~ hidden, and outputs a string as its contents. This string" + ~ " is meant to be" + 7e 20 68 69 64 64 65 6e 2c 20 61 6e 64 20 6f 75 + 74 70 75 74 73 20 61 20 73 74 72 69 6e 67 20 61 + 73 20 69 74 73 20 63 6f 6e 74 65 6e 74 73 2e 20 + 54 68 69 73 20 73 74 72 69 6e 67 20 69 73 20 6d + 65 61 6e 74 20 74 6f 20 62 65 0a + + ~ "~ used by the code generated by" + ~ " output-warm-start-attach-boot-source, and will" + 7e 20 75 73 65 64 20 62 79 20 74 68 65 20 63 6f + 64 65 20 67 65 6e 65 72 61 74 65 64 20 62 79 20 + 6f 75 74 70 75 74 2d 77 61 72 6d 2d 73 74 61 72 + 74 2d 61 74 74 61 63 68 2d 62 6f 6f 74 2d 73 6f + 75 72 63 65 2c 20 61 6e 64 20 77 69 6c 6c 0a + + ~ "~ have no significant effects otherwise." + 7e 20 68 61 76 65 20 6e 6f 20 73 69 67 6e 69 66 + 69 63 61 6e 74 20 65 66 66 65 63 74 73 20 6f 74 + 68 65 72 77 69 73 65 2e 0a + + ~ "~" + 7e 0a + + ~ "~ The helper is expecting to be called at a point where" + ~ " the generated output" + 7e 20 20 20 54 68 65 20 68 65 6c 70 65 72 20 69 + 73 20 65 78 70 65 63 74 69 6e 67 20 74 6f 20 62 + 65 20 63 61 6c 6c 65 64 20 61 74 20 61 20 70 6f + 69 6e 74 20 77 68 65 72 65 20 74 68 65 20 67 65 + 6e 65 72 61 74 65 64 20 6f 75 74 70 75 74 0a + + ~ "~ already has a dictionary, and isn't in the middle of" + ~ " generating any" + 7e 20 61 6c 72 65 61 64 79 20 68 61 73 20 61 20 + 64 69 63 74 69 6f 6e 61 72 79 2c 20 61 6e 64 20 + 69 73 6e 27 74 20 69 6e 20 74 68 65 20 6d 69 64 + 64 6c 65 20 6f 66 20 67 65 6e 65 72 61 74 69 6e + 67 20 61 6e 79 0a + + ~ "~ routines. The usual place to call it is immediately after" + ~ " the label" + 7e 20 72 6f 75 74 69 6e 65 73 2e 20 54 68 65 20 + 75 73 75 61 6c 20 70 6c 61 63 65 20 74 6f 20 63 + 61 6c 6c 20 69 74 20 69 73 20 69 6d 6d 65 64 69 + 61 74 65 6c 79 20 61 66 74 65 72 20 74 68 65 20 + 6c 61 62 65 6c 0a + + ~ "~ transform." + 7e 20 74 72 61 6e 73 66 6f 72 6d 2e 0a + + ~ "~" + 7e 0a + + ~ "~ (output buffer start, output point, previous entry" + ~ " pointer," + 7e 20 28 6f 75 74 70 75 74 20 62 75 66 66 65 72 + 20 73 74 61 72 74 2c 20 6f 75 74 70 75 74 20 70 + 6f 69 6e 74 2c 20 70 72 65 76 69 6f 75 73 20 65 + 6e 74 72 79 20 70 6f 69 6e 74 65 72 2c 0a + + ~ "~ input string pointer -- output buffer start, output" + ~ " point)" + 7e 20 20 69 6e 70 75 74 20 73 74 72 69 6e 67 20 + 70 6f 69 6e 74 65 72 20 2d 2d 20 6f 75 74 70 75 + 74 20 62 75 66 66 65 72 20 73 74 61 72 74 2c 20 + 6f 75 74 70 75 74 20 70 6f 69 6e 74 29 0a + + ~ ": output-boot-source" + 3a 20 6f 75 74 70 75 74 2d 62 6f 6f 74 2d 73 6f + 75 72 63 65 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~" + ~ " ~ ~ ~ ~ ~ ~ ~ ~ ~" + 20 20 7e 20 3a 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 0a + + ~ " ~ : ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~" + ~ " ~ ~ ~ ~ ~ ~ ~ ~ ~ ~" + 20 20 7e 20 3a 20 20 7e 20 7e 20 7e 20 7e 20 7e + 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e + 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e + 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e + 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 0a + + ~ " ~ : ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~" + ~ " ~ ~ ~ ~ ~ ~ ~ ~ ~" + 20 20 7e 20 3a 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 + 7e 20 7e 20 7e 20 7e 20 7e 20 7e 20 7e 0a + + ~ " ~ :" + ~ " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" + ~ "~~~~~~~~~~~~~" + 20 20 7e 20 3a 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e + 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : This is the start of the boot-source, which is" + ~ " Forth code included" + 20 20 7e 20 3a 20 20 20 54 68 69 73 20 69 73 20 + 74 68 65 20 73 74 61 72 74 20 6f 66 20 74 68 65 + 20 62 6f 6f 74 2d 73 6f 75 72 63 65 2c 20 77 68 + 69 63 68 20 69 73 20 46 6f 72 74 68 20 63 6f 64 + 65 20 69 6e 63 6c 75 64 65 64 0a + + ~ " ~ : as text, and invoked by the warm-start routine. At" + ~ " the time it runs," + 20 20 7e 20 3a 20 61 73 20 74 65 78 74 2c 20 61 + 6e 64 20 69 6e 76 6f 6b 65 64 20 62 79 20 74 68 + 65 20 77 61 72 6d 2d 73 74 61 72 74 20 72 6f 75 + 74 69 6e 65 2e 20 41 74 20 74 68 65 20 74 69 6d + 65 20 69 74 20 72 75 6e 73 2c 0a + + ~ " ~ : the warm-start routine and the log-load routine have" + ~ " both completed and" + 20 20 7e 20 3a 20 74 68 65 20 77 61 72 6d 2d 73 + 74 61 72 74 20 72 6f 75 74 69 6e 65 20 61 6e 64 + 20 74 68 65 20 6c 6f 67 2d 6c 6f 61 64 20 72 6f + 75 74 69 6e 65 20 68 61 76 65 20 62 6f 74 68 20 + 63 6f 6d 70 6c 65 74 65 64 20 61 6e 64 0a + + ~ " ~ : the Forth execution environment is fully ready." + 20 20 7e 20 3a 20 74 68 65 20 46 6f 72 74 68 20 + 65 78 65 63 75 74 69 6f 6e 20 65 6e 76 69 72 6f + 6e 6d 65 6e 74 20 69 73 20 66 75 6c 6c 79 20 72 + 65 61 64 79 2e 0a + + ~ " ~ :" + 20 20 7e 20 3a 0a + + ~ " ~ : The routine is stored as a dictionary entry with" + ~ " the "hidden" flag" + 20 20 7e 20 3a 20 20 20 54 68 65 20 72 6f 75 74 + 69 6e 65 20 69 73 20 73 74 6f 72 65 64 20 61 73 + 20 61 20 64 69 63 74 69 6f 6e 61 72 79 20 65 6e + 74 72 79 20 77 69 74 68 20 74 68 65 20 22 68 69 + 64 64 65 6e 22 20 66 6c 61 67 0a + + ~ " ~ : set. It has a regular entry header up to, but not" + ~ " including, the" + 20 20 7e 20 3a 20 73 65 74 2e 20 49 74 20 68 61 + 73 20 61 20 72 65 67 75 6c 61 72 20 65 6e 74 72 + 79 20 68 65 61 64 65 72 20 75 70 20 74 6f 2c 20 + 62 75 74 20 6e 6f 74 20 69 6e 63 6c 75 64 69 6e + 67 2c 20 74 68 65 0a + + ~ " ~ ; codeword. Then it has text, with a null terminator" + ~ " and alignment" + 20 20 7e 20 3b 20 63 6f 64 65 77 6f 72 64 2e 20 + 54 68 65 6e 20 69 74 20 68 61 73 20 74 65 78 74 + 2c 20 77 69 74 68 20 61 20 6e 75 6c 6c 20 74 65 + 72 6d 69 6e 61 74 6f 72 20 61 6e 64 20 61 6c 69 + 67 6e 6d 65 6e 74 0a + + ~ " ~ : padding at the end." + 20 20 7e 20 3a 20 70 61 64 64 69 6e 67 20 61 74 + 20 74 68 65 20 65 6e 64 2e 0a + + ~ " ~ :" + 20 20 7e 20 3a 0a + + ~ " ~ : Making this readable in the hex dump is no small" + ~ " task, but has been" + 20 20 7e 20 3a 20 20 20 4d 61 6b 69 6e 67 20 74 + 68 69 73 20 72 65 61 64 61 62 6c 65 20 69 6e 20 + 74 68 65 20 68 65 78 20 64 75 6d 70 20 69 73 20 + 6e 6f 20 73 6d 61 6c 6c 20 74 61 73 6b 2c 20 62 + 75 74 20 68 61 73 20 62 65 65 6e 0a + + ~ " ~ : valiantly attempted." + 20 20 7e 20 3a 20 76 61 6c 69 61 6e 74 6c 79 20 + 61 74 74 65 6d 70 74 65 64 2e 0a + + ~ " ~ : blank-line" + 20 20 7e 20 3a 20 62 6c 61 6e 6b 2d 6c 69 6e 65 + 0a + + ~ " ~ : indent" + 20 20 7e 20 3a 20 69 6e 64 65 6e 74 0a + + ~ " 3unroll pack64 ~ : 8 #-- (previous entry pointer)" + 20 20 33 75 6e 72 6f 6c 6c 20 70 61 63 6b 36 34 + 20 7e 20 3a 20 38 20 23 2d 2d 20 28 70 72 65 76 + 69 6f 75 73 20 65 6e 74 72 79 20 70 6f 69 6e 74 + 65 72 29 0a + + ~ " ~ : 1 #-- (entry flags)" + 20 20 7e 20 3a 20 31 20 23 2d 2d 20 28 65 6e 74 + 72 79 20 66 6c 61 67 73 29 0a + + ~ " 0x80 pack8" + 20 20 30 78 38 30 20 70 61 63 6b 38 0a + + ~ " ~ : 2 bidirectional-null-terminated entry name" + 20 20 7e 20 3a 20 32 20 62 69 64 69 72 65 63 74 + 69 6f 6e 61 6c 2d 6e 75 6c 6c 2d 74 65 72 6d 69 + 6e 61 74 65 64 20 65 6e 74 72 79 20 6e 61 6d 65 + 0a + + ~ " 0 pack8" + 20 20 30 20 70 61 63 6b 38 0a + + ~ " ~ (output buffer start, input string pointer, output" + ~ " point)" + 20 20 7e 20 28 6f 75 74 70 75 74 20 62 75 66 66 + 65 72 20 73 74 61 72 74 2c 20 69 6e 70 75 74 20 + 73 74 72 69 6e 67 20 70 6f 69 6e 74 65 72 2c 20 + 6f 75 74 70 75 74 20 70 6f 69 6e 74 29 0a + + ~ "" + 0a + + ~ " s" boot-source"" + 20 20 73 22 20 62 6f 6f 74 2d 73 6f 75 72 63 65 + 22 0a + + ~ " ~ We do a spurious stringlen just so the magic comments" + ~ " can see the" + 20 20 7e 20 20 20 57 65 20 64 6f 20 61 20 73 70 + 75 72 69 6f 75 73 20 73 74 72 69 6e 67 6c 65 6e + 20 6a 75 73 74 20 73 6f 20 74 68 65 20 6d 61 67 + 69 63 20 63 6f 6d 6d 65 6e 74 73 20 63 61 6e 20 + 73 65 65 20 74 68 65 0a + + ~ " ~ string's length and use it for an appropriate" + ~ " adjustment." + 20 20 7e 20 73 74 72 69 6e 67 27 73 20 6c 65 6e + 67 74 68 20 61 6e 64 20 75 73 65 20 69 74 20 66 + 6f 72 20 61 6e 20 61 70 70 72 6f 70 72 69 61 74 + 65 20 61 64 6a 75 73 74 6d 65 6e 74 2e 0a + + ~ " dup stringlen" + 20 20 64 75 70 20 73 74 72 69 6e 67 6c 65 6e 0a + + ~ " ~ : provide-data" + 20 20 7e 20 3a 20 70 72 6f 76 69 64 65 2d 64 61 + 74 61 0a + + ~ " ~ : data-adjust-length" + 20 20 7e 20 3a 20 64 61 74 61 2d 61 64 6a 75 73 + 74 2d 6c 65 6e 67 74 68 0a + + ~ " drop" + 20 20 64 72 6f 70 0a + + ~ " ~ : 2 suppress" + 20 20 7e 20 3a 20 32 20 73 75 70 70 72 65 73 73 + 0a + + ~ " packstring" + 20 20 70 61 63 6b 73 74 72 69 6e 67 0a + + ~ " 8 packalign" + 20 20 38 20 70 61 63 6b 61 6c 69 67 6e 0a + + ~ " ~ : fresh-line" + 20 20 7e 20 3a 20 66 72 65 73 68 2d 6c 69 6e 65 + 0a + + ~ " ~ (output buffer start, input string pointer, output" + ~ " point)" + 20 20 7e 20 28 6f 75 74 70 75 74 20 62 75 66 66 + 65 72 20 73 74 61 72 74 2c 20 69 6e 70 75 74 20 + 73 74 72 69 6e 67 20 70 6f 69 6e 74 65 72 2c 20 + 6f 75 74 70 75 74 20 70 6f 69 6e 74 29 0a + + ~ "" + 0a + + ~ " dup 3 pick - L!' boot-source" + 20 20 64 75 70 20 33 20 70 69 63 6b 20 2d 20 4c + 21 27 20 62 6f 6f 74 2d 73 6f 75 72 63 65 0a + + ~ "" + 0a + + ~ " swap packstring 8 packalign" + 20 20 73 77 61 70 20 70 61 63 6b 73 74 72 69 6e + 67 20 38 20 70 61 63 6b 61 6c 69 67 6e 0a + + ~ " ~ : deindent" + 20 20 7e 20 3a 20 64 65 69 6e 64 65 6e 74 0a + + ~ " ;" + 20 20 3b 0a + + ~ "" + 0a + + ~ "" + 0a + + ~ "~ Where next?" + 7e 20 57 68 65 72 65 20 6e 65 78 74 3f 0a + + ~ "~ ~~~~~~~~~~~" + 7e 20 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 7e 0a + + ~ "~" + 7e 0a + + ~ "~ The definitions of "docol" and "exit" are very tightly" + ~ " bound up with the" + 7e 20 20 20 54 68 65 20 64 65 66 69 6e 69 74 69 + 6f 6e 73 20 6f 66 20 22 64 6f 63 6f 6c 22 20 61 + 6e 64 20 22 65 78 69 74 22 20 61 72 65 20 76 65 + 72 79 20 74 69 67 68 74 6c 79 20 62 6f 75 6e 64 + 20 75 70 20 77 69 74 68 20 74 68 65 0a + + ~ "~ execution model. They're defined and explained in" + ~ " language/static/core.e," + 7e 20 65 78 65 63 75 74 69 6f 6e 20 6d 6f 64 65 + 6c 2e 20 54 68 65 79 27 72 65 20 64 65 66 69 6e + 65 64 20 61 6e 64 20 65 78 70 6c 61 69 6e 65 64 + 20 69 6e 20 6c 61 6e 67 75 61 67 65 2f 73 74 61 + 74 69 63 2f 63 6f 72 65 2e 65 2c 0a + + ~ "~ because they need to be part of the build process in two" + ~ " different ways," + 7e 20 62 65 63 61 75 73 65 20 74 68 65 79 20 6e + 65 65 64 20 74 6f 20 62 65 20 70 61 72 74 20 6f + 66 20 74 68 65 20 62 75 69 6c 64 20 70 72 6f 63 + 65 73 73 20 69 6e 20 74 77 6f 20 64 69 66 66 65 + 72 65 6e 74 20 77 61 79 73 2c 0a + + ~ "~ like the other core functionality." + 7e 20 6c 69 6b 65 20 74 68 65 20 6f 74 68 65 72 + 20 63 6f 72 65 20 66 75 6e 63 74 69 6f 6e 61 6c + 69 74 79 2e 0a + + ~ "" + 0a + + ~ "~ This file should be included in executables that use" + ~ " boot-source, as the" + 7e 20 20 20 54 68 69 73 20 66 69 6c 65 20 73 68 + 6f 75 6c 64 20 62 65 20 69 6e 63 6c 75 64 65 64 + 20 69 6e 20 65 78 65 63 75 74 61 62 6c 65 73 20 + 74 68 61 74 20 75 73 65 20 62 6f 6f 74 2d 73 6f + 75 72 63 65 2c 20 61 73 20 74 68 65 0a + + ~ "~ last thing in the boot-source. It has the responsibility" + ~ " of switching from" + 7e 20 6c 61 73 74 20 74 68 69 6e 67 20 69 6e 20 + 74 68 65 20 62 6f 6f 74 2d 73 6f 75 72 63 65 2e + 20 49 74 20 68 61 73 20 74 68 65 20 72 65 73 70 + 6f 6e 73 69 62 69 6c 69 74 79 20 6f 66 20 73 77 + 69 74 63 68 69 6e 67 20 66 72 6f 6d 0a + + ~ "~ processing boot-source into the regular interaction" + ~ " mode." + 7e 20 70 72 6f 63 65 73 73 69 6e 67 20 62 6f 6f + 74 2d 73 6f 75 72 63 65 20 69 6e 74 6f 20 74 68 + 65 20 72 65 67 75 6c 61 72 20 69 6e 74 65 72 61 + 63 74 69 6f 6e 20 6d 6f 64 65 2e 0a + + ~ "" + 0a + + ~ "relink-main-input-buffer-to-stdin" 72 65 6c 69 6e 6b 2d 6d 61 69 6e 2d 69 6e 70 75 74 2d 62 75 66 66 65 72 2d 74 6f 2d 73 74 64 69 - 6e 00 + 6e 0a + + ~ "" + 0a + + ~ "" + 00 + + ~ This is the end of the long string literal. We now return you to the + ~ normal hex-dump stuff. + 00 00 00 00 00 00 ~ (alignment padding) -~ label total-size at offset 0x00000000000564e0 is here. +~ label total-size at offset 0x00000000000a9e08 is here. ~ This is the end of the hex dump. Thanks for reading! diff --git a/hex.e b/hex.e index cc4e0ce..feec78d 100644 --- a/hex.e +++ b/hex.e @@ -1,9 +1,5 @@ ~ cat hex.e | ./evoke > hex && chmod 755 hex -s" compilation/labels.e" include -s" compilation/elf.e" include -s" compilation/transform.e" include - ~ (buffer start, output point, label offset ~ -- buffer start, output point) : jmp-rel-imm8-from-here diff --git a/inscribe-evoke.e b/inscribe-evoke.e index 9bb7ddc..e5dc420 100644 --- a/inscribe-evoke.e +++ b/inscribe-evoke.e @@ -1,9 +1,5 @@ ~ cat inscribe-evoke.e | ./evoke > evoke.hex -s" compilation/labels.e" include -s" compilation/elf.e" include -s" compilation/transform.e" include - : prepare here @ dup s" language/static/core.e" pack-file-contents @@ -27,7 +23,7 @@ s" compilation/transform.e" include s" evoke-source" variable 1024 1024 4 * * allocate s" evoke-binary" variable - 1024 1024 4 * * allocate s" evoke-metadata" variable ; + 1024 1024 8 * * allocate s" evoke-metadata" variable ; prepare evoke-metadata evoke-binary dup evoke-source hex-transform diff --git a/inscribe-hex.e b/inscribe-hex.e index 8dd6df8..519fb16 100644 --- a/inscribe-hex.e +++ b/inscribe-hex.e @@ -1,9 +1,5 @@ ~ cat inscribe-hex.e | ./evoke > hex.hex -s" compilation/labels.e" include -s" compilation/elf.e" include -s" compilation/transform.e" include - : prepare here @ dup s" language/static/core.e" pack-file-contents diff --git a/language/boot-source-footer.e b/language/boot-source-footer.e new file mode 100644 index 0000000..97a8c5b --- /dev/null +++ b/language/boot-source-footer.e @@ -0,0 +1,6 @@ +~ This file should be included in executables that use boot-source, as the +~ last thing in the boot-source. It has the responsibility of switching from +~ processing boot-source into the regular interaction mode. + +relink-main-input-buffer-to-stdin + |