Data stack: ( -- chars* n )
From 04f2de0478f8924fecee363057c208434f32a119 Mon Sep 17 00:00:00 2001
From: Ralph Ronnquist
MAIN-ARGS @@ -868,6 +869,7 @@ asciidoc.install(); STDIN STREAM STREAM-NCHARS +STR>TEMP STRLEN STRNCMP STRNCPY @@ -875,6 +877,8 @@ asciidoc.install(); SYSTEM
TELL .TEMP +TEMP +TEMPSPACE TERMINATE0 TFA>CFA TFA>DFA @@ -2542,25 +2546,43 @@ _______________________________________________________
Data stack: ( -- chars* n )
"S"" is a function word that pushes the [n:char] pointer for a string -inlined subsequently to it in the containing definition. This is -similar to LIT but for a string literal.
"LIT-STRING" is a function word that pushes the char* and length n of +a subsequent inline string, then advances execution to continue after +the string. This is similar to LIT but for a block literal.
Note that the inlined byte count includes the terminating NUL byte.
Data stack: ( -- ) Input stream: " chars"
+"S"" is an immediate function word that compiles the subseqent +characters up to terminating double-quote into the current definition, +preceded by a LIT-STRING cell, and the count of +bytes scanned. The inline text includes a terminating NUL character +which also is included in the inlined count.
Note that "S"" uses " for reading the string.
Data stack: ( -- )
";" (semi-colon) is a function word that ends a new forth definition -by means of adding an EXIT
";" (semi-colon) is an immediate function word that ends a new forth +definition by means of adding an EXIT cell, then changing +<<p_state,STATE> to interpreting.
"STR>TEMP" is a function word that copies a given string plus a +terminating NUL character into a TEMPSPACE snippet, +all preceded by a length cell. It returns a pointer for to the text in +the snippet and its length, excluding the NUL character at end and the +length cell before tie text.
length: 8 bytes
+returned char*: n bytes
+ nul: 1 byte
+"TEMP" is a function word that "allocates" a TEMPSPACE +area of given size and returns its base address. The allocation is +temporary and only valid until there is a later allocation that +overruns this area.
Allocations are done in succession until the requested size overruns +the TEMPSPACE. If so, the allocation pointer is reset +and the space is allocated from start again. This is all intended for +small and short-lived data areas.
Data stack: ( -- a )
+"TEMPSPACE" is a variable word that holds three cells the for managing +"temporary memory":
+the size of the temporary memory space (default 104857600 bytes) +
++the base address for whole temporary memory area +
++the amount currently used +
+This memory is intended to be used by requesting snippets of memory in +a cyclic fashion via TEMP without concern about it possibly +overlapping a prior request.