char* name = (char*)onward_aspop();
/* Copy the name to a more permanent location */
size_t str_size = strlen(name) + 1;
- size_t new_size = str_size + (sizeof(value_t) - (str_size % sizeof(value_t)));
+ size_t new_size = (str_size % sizeof(value_t))
+ ? ((str_size + (sizeof(value_t) - 1)) & ~sizeof(value_t))
+ : str_size;
name = memcpy((void*)here, name, str_size);
here += new_size;
/* Start populating the word definition */
CELLSZ + \ Add offset to get to the flags field
dup @ \ Fetch the current value
F_IMMEDIATE | ! \ Set the immediate bit
-; immediate
+; immediate \ Use the immediate word to make the immediate word immediate :D
: [compile] immediate
word find ,
' lit , , \ Compile the top item on the stack as a literal
;
+: allot here @ dup rot + here swap ! ;
+
+: cells CELLSZ * ;
+
+: variable
+ 1 cells allot
+ word create
+ [compile] literal
+ 0 ,
+;
+
: const word create [compile] literal 0 , ;
: dump word find dumpw ;
\ Comment Words
\ -----------------------------------------------------------------------------
: # [compile] \ ;
+
: #! [compile] \ ;
: ( immediate