misc/kforth: rst fixups

This commit is contained in:
Kyle Isom 2018-02-27 14:18:17 -08:00
parent 63e9a0a333
commit 3b284b7c08
1 changed files with 6 additions and 0 deletions

View File

@ -60,20 +60,24 @@ design an abstract class for a Word and implement the first concrete class,
virtual ~Word() {}; virtual ~Word() {};
The *eval* method takes a ``System`` structure and executes some function. The *eval* method takes a ``System`` structure and executes some function.
::
virtual bool eval(System *) = 0; virtual bool eval(System *) = 0;
The dictionary is a linked list, so next is used to traverse the list. The dictionary is a linked list, so next is used to traverse the list.
::
virtual Word *next(void) = 0; virtual Word *next(void) = 0;
The ``match`` method is used to determine whether this is the word being The ``match`` method is used to determine whether this is the word being
referred to. referred to.
::
virtual bool match(struct Token *) = 0; virtual bool match(struct Token *) = 0;
Finally, ``getname`` will fill in a ``char[MAX_TOKEN_SIZE]`` buffer with the Finally, ``getname`` will fill in a ``char[MAX_TOKEN_SIZE]`` buffer with the
word's name. word's name.
::
virtual void getname(char *, size_t *) = 0; virtual void getname(char *, size_t *) = 0;
}; };
@ -175,6 +179,7 @@ operating on these anyways. I guess it's best to start with the lookup function
first so that when I started adding builtins later it'll be easy to just first so that when I started adding builtins later it'll be easy to just
recompile and use them. recompile and use them.
:: ::
LOOKUP LOOKUP
lookup(struct Token *token, System *sys) lookup(struct Token *token, System *sys)
{ {
@ -361,6 +366,7 @@ though:
} }
The XOR by 0x20 is just a neat trick for inverting the case of a letter. The XOR by 0x20 is just a neat trick for inverting the case of a letter.
::
if ((a[i] ^ 0x20) == b[i]) { if ((a[i] ^ 0x20) == b[i]) {
continue; continue;