X-Git-Url: https://git.rrq.au/?a=blobdiff_plain;f=adoc%2Fp_literal_string.adoc;h=1d9ffdb50d5ef343ce1bab5ecb0a51b7466e71d4;hb=661f002edaa942af5603d469ea28d9240c9542e2;hp=ba94b0f3f7abadf97db4013aaba77123e5909f6a;hpb=9b8fcf87eaed58b6dfabcf885f8eef5484643de6;p=rrq%2Frrqforth.git diff --git a/adoc/p_literal_string.adoc b/adoc/p_literal_string.adoc index ba94b0f..1d9ffdb 100644 --- a/adoc/p_literal_string.adoc +++ b/adoc/p_literal_string.adoc @@ -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 <> 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. ==== -.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 - ; **** ==== -