Shi
|
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <tuple>
#include <type_traits>
#include <functional>
Go to the source code of this file.
Classes | |
struct | Shi_init |
Init struct. More... | |
struct | Word |
Word. More... | |
struct | shi::remove_cvref< T > |
struct | shi::is_reference_wrapper< T > |
struct | shi::is_reference_wrapper< std::reference_wrapper< U > > |
struct | shi::Init |
Init struct. More... | |
struct | shi::Word |
Word. More... | |
Namespaces | |
namespace | shi |
namespace | shi::literals |
Typedefs | |
typedef void(* | void_fp) () |
template<typename T > | |
using | shi::remove_cvref_t = typename remove_cvref<T>::type |
Functions | |
void | shi_evaluate_asm (char const *str, size_t len) |
void | shi_variable_asm (char const *name, size_t len) |
void | shi_clear_asm () |
void_fp | shi_tick_asm (char const *str, size_t len) |
static void | shi_push_number (int32_t t) |
static void | shi_push_double (int64_t t) |
static void | shi_push_struct (void *t, size_t n) |
static int32_t | shi_pop_number () |
static int64_t | shi_pop_double () |
static void | shi_pop_struct (void *t, size_t n) |
static int32_t | shi_top_number (size_t offset) |
static int64_t | shi_top_double (size_t offset) |
static void | shi_top_struct (void **t, size_t offset) |
static size_t | shi_depth () |
static size_t | shi_size () |
void | shi_init_asm (Shi_init *) |
static void | shi_init (Shi_init s) |
static void | shi_evaluate (char const *str) |
static void | shi_evaluate_len (char const *str, size_t len) |
static void | shi_variable (void *adr, char const *str) |
static void | shi_variable_len (void *adr, char const *str, size_t len) |
static void | shi_clear () |
Clear stack. | |
static Word | shi_tick (char const *str) |
static Word | shi_tick_len (char const *str, size_t len) |
static void | shi_word (Word w) |
size_t | shi::depth () |
size_t | shi::size () |
template<typename T > | |
void | shi::push (T &&t) |
template<typename... Ts> | |
void | shi::push (Ts &&... ts) |
template<typename T = int32_t> | |
T | shi::pop () |
template<typename... Ts, typename = std::enable_if_t<(sizeof...(Ts) > 1)>> | |
std::tuple< Ts... > | shi::pop () |
template<typename T = int32_t> | |
decltype(auto) | shi::top (size_t offset=0) |
void | shi::shi_init_asm (Init &) |
void | shi::init (Init s) |
void | shi::evaluate (char const *str) |
void | shi::evaluate (char const *str, size_t len) |
template<typename T > | |
void | shi::variable (T adr, char const *str) |
template<typename T > | |
void | shi::variable (T adr, char const *str, size_t len) |
void | shi::clear () |
Clear stack. | |
void_fp | shi::tick (char const *str) |
void_fp | shi::tick (char const *str, size_t len) |
void | shi::literals::operator""_s (char const *str, size_t len) |
auto | shi::literals::operator""_v (char const *str, size_t len) |
template<typename T , T... Cs> | |
Word | shi::literals::operator""_w () |
Variables | |
uint32_t | shi_context |
template<typename T > | |
constexpr bool | shi::is_reference_wrapper_v {is_reference_wrapper<T>::value} |
Shi
#define SHI_ENABLE_ABS 1 |
#define SHI_ENABLE_ACTION_OF 1 |
#define SHI_ENABLE_AGAIN 1 |
#define SHI_ENABLE_ALIGN 1 |
#define SHI_ENABLE_ALIGNED 1 |
#define SHI_ENABLE_ALLOT 1 |
#define SHI_ENABLE_AND 1 |
#define SHI_ENABLE_BASE 1 |
#define SHI_ENABLE_BEGIN 1 |
#define SHI_ENABLE_BRACKET_LEFT 1 |
#define SHI_ENABLE_BRACKET_RIGHT 1 |
#define SHI_ENABLE_BRACKET_TICK 1 |
#define SHI_ENABLE_BUFFER_COLON 1 |
#define SHI_ENABLE_C_COMMA 1 |
#define SHI_ENABLE_C_FETCH 1 |
#define SHI_ENABLE_C_STORE 1 |
#define SHI_ENABLE_CASE 1 |
#define SHI_ENABLE_CELL_PLUS 1 |
#define SHI_ENABLE_CELLS 1 |
#define SHI_ENABLE_CHAR_PLUS 1 |
#define SHI_ENABLE_CHARS 1 |
#define SHI_ENABLE_COLON 1 |
#define SHI_ENABLE_COMMA 1 |
#define SHI_ENABLE_COMPILE_COMMA 1 |
#define SHI_ENABLE_CONSTANT 1 |
#define SHI_ENABLE_CREATE 1 |
#define SHI_ENABLE_DECIMAL 1 |
#define SHI_ENABLE_DEPTH 1 |
#define SHI_ENABLE_DIV 1 |
#define SHI_ENABLE_DIV_MOD 1 |
#define SHI_ENABLE_DO 1 |
#define SHI_ENABLE_DOES 1 |
#define SHI_ENABLE_DROP 1 |
#define SHI_ENABLE_DUP 1 |
#define SHI_ENABLE_ELSE 1 |
#define SHI_ENABLE_ENDCASE 1 |
#define SHI_ENABLE_ENDOF 1 |
#define SHI_ENABLE_EQUAL 1 |
#define SHI_ENABLE_ERASE 1 |
#define SHI_ENABLE_EXECUTE 1 |
#define SHI_ENABLE_EXIT 1 |
#define SHI_ENABLE_FALSE 1 |
#define SHI_ENABLE_FETCH 1 |
#define SHI_ENABLE_FILL 1 |
#define SHI_ENABLE_FIND 1 |
#define SHI_ENABLE_FM_DIV_MOD 1 |
#define SHI_ENABLE_H_FETCH 1 |
#define SHI_ENABLE_H_STORE 1 |
#define SHI_ENABLE_HERE 1 |
#define SHI_ENABLE_HEX 1 |
#define SHI_ENABLE_I 1 |
#define SHI_ENABLE_IF 1 |
#define SHI_ENABLE_IMMEDIATE 1 |
#define SHI_ENABLE_INLINE 1 |
#define SHI_ENABLE_INVERT 1 |
#define SHI_ENABLE_J 1 |
#define SHI_ENABLE_LEAVE 1 |
#define SHI_ENABLE_LESS 1 |
#define SHI_ENABLE_LITERAL 1 |
#define SHI_ENABLE_LOOP 1 |
#define SHI_ENABLE_LSHIFT 1 |
#define SHI_ENABLE_M_TIMES 1 |
#define SHI_ENABLE_MAX 1 |
#define SHI_ENABLE_MIN 1 |
#define SHI_ENABLE_MINUS 1 |
#define SHI_ENABLE_MOD 1 |
#define SHI_ENABLE_MORE 1 |
#define SHI_ENABLE_MOVE 1 |
#define SHI_ENABLE_NE 1 |
#define SHI_ENABLE_NEGATE 1 |
#define SHI_ENABLE_NIP 1 |
#define SHI_ENABLE_NUMBER_PREFIX 1 |
Enables the prefixes $, # and % for numbers.
#define SHI_ENABLE_OF 1 |
#define SHI_ENABLE_ONE_MINUS 1 |
#define SHI_ENABLE_ONE_PLUS 1 |
#define SHI_ENABLE_OR 1 |
#define SHI_ENABLE_OVER 1 |
#define SHI_ENABLE_PARSE_NAME 1 |
#define SHI_ENABLE_PICK 1 |
#define SHI_ENABLE_PLUS 1 |
#define SHI_ENABLE_PLUS_LOOP 1 |
#define SHI_ENABLE_PLUS_STORE 1 |
#define SHI_ENABLE_POSTPONE 1 |
#define SHI_ENABLE_PRINT 1 |
Enables printing messages for errors.
#define SHI_ENABLE_Q_DO 1 |
#define SHI_ENABLE_Q_DUP 1 |
#define SHI_ENABLE_R_FETCH 1 |
#define SHI_ENABLE_R_FROM 1 |
#define SHI_ENABLE_RECURSE 1 |
#define SHI_ENABLE_REDEFINITION 0 |
Enables redefining words.
#define SHI_ENABLE_REPEAT 1 |
#define SHI_ENABLE_ROLL 1 |
#define SHI_ENABLE_ROT 1 |
#define SHI_ENABLE_RSHIFT 1 |
#define SHI_ENABLE_S_TO_D 1 |
#define SHI_ENABLE_SEMI 1 |
#define SHI_ENABLE_SIGN 1 |
#define SHI_ENABLE_SM_DIV_REM 1 |
#define SHI_ENABLE_SOURCE 1 |
#define SHI_ENABLE_STATE 1 |
#define SHI_ENABLE_STORE 1 |
#define SHI_ENABLE_SWAP 1 |
#define SHI_ENABLE_THEN 1 |
#define SHI_ENABLE_TICK 1 |
#define SHI_ENABLE_TIMES 1 |
#define SHI_ENABLE_TIMES_DIV 1 |
#define SHI_ENABLE_TIMES_DIV_MOD 1 |
#define SHI_ENABLE_TO_BODY 1 |
#define SHI_ENABLE_TO_DATA 1 |
#define SHI_ENABLE_TO_DATA_Q 1 |
#define SHI_ENABLE_TO_IN 1 |
#define SHI_ENABLE_TO_R 1 |
#define SHI_ENABLE_TO_TEXT 1 |
#define SHI_ENABLE_TO_TEXT_Q 1 |
#define SHI_ENABLE_TRUE 1 |
#define SHI_ENABLE_TUCK 1 |
#define SHI_ENABLE_TWO_DIV 1 |
#define SHI_ENABLE_TWO_DROP 1 |
#define SHI_ENABLE_TWO_DUP 1 |
#define SHI_ENABLE_TWO_FETCH 1 |
#define SHI_ENABLE_TWO_OVER 1 |
#define SHI_ENABLE_TWO_R_FETCH 1 |
#define SHI_ENABLE_TWO_R_FROM 1 |
#define SHI_ENABLE_TWO_STORE 1 |
#define SHI_ENABLE_TWO_SWAP 1 |
#define SHI_ENABLE_TWO_TIMES 1 |
#define SHI_ENABLE_TWO_TO_R 1 |
#define SHI_ENABLE_U_LESS 1 |
#define SHI_ENABLE_U_MORE 1 |
#define SHI_ENABLE_UM_DIV_MOD 1 |
#define SHI_ENABLE_UM_TIMES 1 |
#define SHI_ENABLE_UNLOOP 1 |
#define SHI_ENABLE_UNTIL 1 |
#define SHI_ENABLE_UNUSED 1 |
#define SHI_ENABLE_VALUE 1 |
#define SHI_ENABLE_VARIABLE 1 |
#define SHI_ENABLE_WHILE 1 |
#define SHI_ENABLE_WITHIN 1 |
#define SHI_ENABLE_XOR 1 |
#define SHI_ENABLE_ZERO_EQUAL 1 |
#define SHI_ENABLE_ZERO_LESS 1 |
#define SHI_ENABLE_ZERO_MORE 1 |
#define SHI_ENABLE_ZERO_NE 1 |
#define SHI_ERASED_WORD 0xFFFFFFFF |
Most flash types are 0xFF erased.
#define SHI_STACK_SIZE 256 |
Data-stack size (must be a multiple of 4 bytes)
typedef void(* void_fp) () |
|
inlinestatic |
Clear stack.
void shi_clear_asm | ( | ) |
|
inlinestatic |
Returns the number of elements on the stack
|
inlinestatic |
Evaluate
str | Pointer to the null-terminated byte string |
void shi_evaluate_asm | ( | char const * | str, |
size_t | len ) |
|
inlinestatic |
Evaluate
str | Pointer to the null-terminated byte string |
len | Length of the null-terminated string |
|
inlinestatic |
Initialize
s | Init struct |
void shi_init_asm | ( | Shi_init * | ) |
|
inlinestatic |
Remove double-cell number from the top of the stack
|
inlinestatic |
Remove number from the top of the stack
|
inlinestatic |
Remove user-defined type from the top of the stack
t | Pointer to user-defined type |
n | Size of user-defined type |
|
inlinestatic |
Add double-cell number to the top of the stack
t | Double-cell number to push |
|
inlinestatic |
Add number to the top of the stack
t | Number to push |
|
inlinestatic |
Add user-defined type to the top of the stack
t | Pointer to user-defined type |
n | Size of user-defined type |
|
inlinestatic |
Returns the number of elements on the stack
|
inlinestatic |
Tick
str | Pointer to the null-terminated byte string |
void_fp shi_tick_asm | ( | char const * | str, |
size_t | len ) |
|
inlinestatic |
Tick
str | Pointer to the null-terminated byte string |
len | Length of the null-terminated string |
|
inlinestatic |
Get double-cell number from the stack
offset | Offset in cells |
|
inlinestatic |
Get number from the stack
offset | Offset in cells |
|
inlinestatic |
Get user-defined type from the stack
t | Pointer to user-defined type |
offset | Offset in cells |
|
inlinestatic |
Create reference to C variable
adr | Address of variable |
str | Pointer to the null-terminated byte string |
void shi_variable_asm | ( | char const * | name, |
size_t | len ) |
|
inlinestatic |
Create reference to C variable
adr | Address of variable |
str | Pointer to the null-terminated byte string |
len | Length of the null-terminated string |
|
extern |