Skip to content

Commit 8ad2e60

Browse files
committed
doc: adding Lua preprocessor functions
1 parent 1cf88ed commit 8ad2e60

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

learn-silice/Documentation.md

+14
Original file line numberDiff line numberDiff line change
@@ -2346,6 +2346,20 @@ declaration, and between the `{` and `}` of the unit block.
23462346
However there should not be any top level if-then-else enclosing and repeating
23472347
these parentheses and braces.
23482348
2349+
## Preprocessor additional functions
2350+
2351+
In addition to the standard Lua functions, the following functions are
2352+
available to the preprocessor:
2353+
- `print(<string>)` prints the string in the console when reached by the preprocessor.
2354+
- `error(<string>)` prints the string and exits immediately.
2355+
- `clog2(<number>)` returns the ceil of the log2 of the input number.
2356+
- `lshift(<number>,<number>)` returns the first input number left shifted by the second number (note: Lua now also supports `<<`).
2357+
- `rshift(<number>)` returns the first input number right shifted by the second number (note: Lua now also supports `>>`).
2358+
- `widthof(<identifier>)` returns the bit width of the given variable.
2359+
- `signed(<identifier>)` returns whether the given variable is signed.
2360+
- `findFile(<string>)` searches for a file in all known paths and returns the
2361+
absolute path if found, the unmodified file name otherwise.
2362+
23492363
## Preprocessor image and palette functions
23502364
23512365
The pre-processor has a number of function to facilitate the inclusion

0 commit comments

Comments
 (0)