X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=adoc%2Fp_literal_string.adoc;h=1d9ffdb50d5ef343ce1bab5ecb0a51b7466e71d4;hb=8e9e9a2c52a654a354a83c9d80662fa34fab677d;hp=218f443e7bab945ce1bedf8550502cb890129a04;hpb=656f37efbd89db1b1088281047a9633cf74e92ec;p=rrq%2Frrqforth.git diff --git a/adoc/p_literal_string.adoc b/adoc/p_literal_string.adoc index 218f443..1d9ffdb 100644 --- a/adoc/p_literal_string.adoc +++ b/adoc/p_literal_string.adoc @@ -1,23 +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 <> 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 <> but for a block literal. + +Note that the inlined byte count includes the terminating NUL byte. ==== -.Word: LIT -[caption='Definition concept {counter:exec}: '] ----- -: LIT R> DUP @ 2DUP + 8 + >R SWAP 8 + SWAP ; ----- +.Definition concept for LIT-STRING +**** +: LIT-STRING R@ DUP @ 8 + R@ @ 2DUP + R> + >R 1 - ; +**** ==== - -