1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-09 13:33:26 +00:00

Add Structure Declaration

This commit is contained in:
David Schmenk 2014-11-25 11:07:51 -08:00
parent dc2c7f1b4e
commit 78dbaecb3f

View File

@ -87,6 +87,23 @@ const bufflen = 2048
These constants can be used in expressions just like a variable name.
#### Structure Declarations
There is a shortcut for defining constant offsets into structures:
```
struc s_entry
word id
byte[32] name
word next_entry
end
```
is equivalent to:
```
const s_entry = 36 // size of the structure
const id = 0 // offset to id element
const name = 2 // offset to name element
const next_entry = 34 // offset to next_entry element
```
#### Predefined Functions
Sometimes a function needs to be referenced before it is defined. The `predef` declaration reserves the label for a function. The `import` declaration block also uses the `predef` declaration to reserve an external function. Outside of an `import` block, `predef` will only predefine a function that must be declared later in the source file, otherwise an error will occur.