better documentation
[rrq/rrqforth.git] / adoc / p_literal_string.adoc
index ba94b0f3f7abadf97db4013aaba77123e5909f6a..1d9ffdb50d5ef343ce1bab5ecb0a51b7466e71d4 100644 (file)
@@ -1,21 +1,22 @@
-//compile.asm: WORD p_literal_string,'S"',fasm ;; " (fool emacs)
+//compile.asm: WORD p_literal_string,'LIT-STRING',fasm
 
 anchor:p_literal_string[]
 
-=== Word: S"
+=== Word: LIT-STRING
 
 ....
 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 <<p_lit,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 <<p_lit,LIT>> but for a block literal.
+
+Note that the inlined byte count includes the terminating NUL byte.
 
 ====
-.Definition concept for LIT
+.Definition concept for LIT-STRING
 ****
-: LIT R> DUP @ 2DUP + 8 + >R SWAP 8 + SWAP ;
+: LIT-STRING  R@ DUP @ 8 +  R@ @  2DUP + R> + >R  1 - ;
 ****
 ====
-