better documentation
[rrq/rrqforth.git] / adoc / p_literal_string.adoc
index 5eaaec5345809a36b6df3c5c9aa0ee0b64e3e57c..1d9ffdb50d5ef343ce1bab5ecb0a51b7466e71d4 100644 (file)
@@ -1,15 +1,22 @@
-Word: S"
-----------
+//compile.asm: WORD p_literal_string,'LIT-STRING',fasm
 
 anchor:p_literal_string[]
-----
-compile.asm:   WORD p_literal_string,'S"',fasm ;; " (fool emacs)
-----
 
-"S"" is a function word for, in compaling mode, creating a string
-literal whose pname ( char* n ) gets pushed in interpreting mode.
+=== Word: LIT-STRING
 
-Similar to "LIT", "S"" will insert the string into the containing
-definition, and use it from there.
+....
+Data stack: ( -- chars* n )
+....
 
+"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 <<p_lit,LIT>> but for a block literal.
 
+Note that the inlined byte count includes the terminating NUL byte.
+
+====
+.Definition concept for LIT-STRING
+****
+: LIT-STRING  R@ DUP @ 8 +  R@ @  2DUP + R> + >R  1 - ;
+****
+====