X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=adoc%2Fp_literal_string.adoc;h=1d9ffdb50d5ef343ce1bab5ecb0a51b7466e71d4;hb=39427aee877cab09feea798b146e06dc7bfc25cc;hp=5eaaec5345809a36b6df3c5c9aa0ee0b64e3e57c;hpb=b7da3f7bbd1cb10241163abdb950472e539e796d;p=rrq%2Frrqforth.git diff --git a/adoc/p_literal_string.adoc b/adoc/p_literal_string.adoc index 5eaaec5..1d9ffdb 100644 --- a/adoc/p_literal_string.adoc +++ b/adoc/p_literal_string.adoc @@ -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 <> 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 - ; +**** +====