make strncmp direction safe
[rrq/rrqforth.git] / adoc / p_create.adoc
index dc6926a9cd441240e65fe13284e89d3611649644..5fdfe27d3caa6536bededd5473358779baf49ec0 100644 (file)
@@ -1,19 +1,21 @@
+// compile.asm:        WORD p_create,'CREATE',fasm
+
 anchor:p_create[]
 
-Word: CREATE
-------------
+=== Word: CREATE
 
-----
-compile.asm:   WORD p_create,'CREATE',fasm
-----
 
+....
 Data stack: ( char* n -- tfa )
+....
 
 "CREATE" is a function word that allocates a "word header" with the
 indicated [n:char*] print name, and returns the "TFA" (Token Field
 Address) of the word. The header memory layout is as follows:
 
 ====
+.rrqforth word structure
+[caption='Layout {counter:layout}: ']
 ----
 struct WORD
 TFA  8 link ; tfa of previous word
@@ -41,11 +43,9 @@ its DFA when executed. This is changed to "doforth" for RRQFORTH
 function words initiated by ":" (aka "COLON") or changed to "dovalue"
 for RRQFORTH constants created by "CONSTANT".
 
-See "<<p_execute,EXECUTE>>" about range of +doer+ assignments and
-their meanings.
-
-.Execution semantics expressed in RRQFORTH
 ====
+.Definition concept for CREATE
+****
 HERE @ R> ( save tfa on RS )
   R@ CURRENT-WORD @ DUP @ , ! ( link in a new word )
   DUP 49 + R@ + ,             ( pCFA )
@@ -53,15 +53,22 @@ HERE @ R> ( save tfa on RS )
   DUP , ( length )
   HERE @ ROT ROT MEMCPY 0 C,  ( pname + NUL )
   R@ ,                        ( pTFA )
-  0                         ( OFF )
+  0 ,                         ( OFF )
   doVARIABLE                  ( CFA, default semantics )
+****
 ====
 
-.Usage example
 ====
-\ A possible definition of the word CONSTANT
-: CONSTANT
-  READ-WORD CREATE TFA>DFA doVALUE OVER 8 - ! !
-;
+.a possible definition of CONSTANT
+[caption='Usage example {counter:example}: ']
+----
+: CONSTANT READ-WORD CREATE TFA>DFA doVALUE OVER 8 - ! ! ;
+----
 ====
 
+See also <<p_put,!>>, <<p_plus,+>>, <<p_comma>>, <<p_get,@>>,
+<<p_Ccomma>>, <<p_current_word,CURRENT-WORD>>, <<p_dup,DUP>>,
+<<p_here,HERE>>, <<p_herememcpy,HERE>>, <<p_Rget,R@>>, <<p_rot,ROT>>,
+and <<p_dovariable,doVARIABLE>>,
+as well as <<p_execute,EXECUTE>>
+about the range of "doer" assignments and their meanings.