Arduino-FVM
Byte Token Threaded Forth Virtual Machine (FVM) for Arduino
FVM.h File Reference
#include <Arduino.h>
Include dependency graph for FVM.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  FVM
 
struct  FVM::task_t
 
struct  FVM::Task< PARAMETER_STACK_MAX, RETURN_STACK_MAX >
 
struct  FVM::obj_t
 
struct  FVM::var_t
 
struct  FVM::const_t
 
struct  FVM::func_t
 

Macros

#define FVM_OP(code)   FVM::OP_ ## code
 
#define FVM_LIT(n)
 
#define FVM_CLIT(n)
 
#define FVM_CALL(fn)   FVM::code_t(-fn-1)
 
#define FVM_CREATE(id, var, does, data)
 
#define FVM_VARIABLE(id, var, data)
 
#define FVM_CONSTANT(id, var, name, val)
 
#define FVM_COLON(id, var, name)
 
#define FVM_FUNCTION(id, var, fn, env)
 
#define FVM_SYMBOL(id, var, name)
 

Typedefs

typedef const char * str_P
 

Detailed Description

Version
1.1

License

Copyright (C) 2016-2017, Mikael Patel

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Definition in file FVM.h.

Macro Definition Documentation

#define FVM_CALL (   fn)    FVM::code_t(-fn-1)

Compile call to given function in function table.

Parameters
[in]fnfunction index in table.

Definition at line 675 of file FVM.h.

#define FVM_CLIT (   n)
Value:
int8_t code_t
Definition: FVM.h:248
Inline literal signed character constant.
Definition: FVM.h:43

Compile literal number (-128..127) or character (0..255).

Parameters
[in]nnumber.

Definition at line 667 of file FVM.h.

#define FVM_COLON (   id,
  var,
  name 
)
Value:
const int var = id; \
const char var ## _PSTR[] PROGMEM = name; \
const FVM::code_t var ## _CODE[] PROGMEM = {
int8_t code_t
Definition: FVM.h:248

Create a colon definition in program memory.

Parameters
[in]ididentity index.
[in]varvariable name.
[in]namedictionary string.

Definition at line 728 of file FVM.h.

#define FVM_CONSTANT (   id,
  var,
  name,
  val 
)
Value:
const int var = id; \
const char var ## _PSTR[] PROGMEM = name; \
const FVM::const_t var ## _CONST PROGMEM = { \
FVM_OP(CONST), \
val \
}
#define FVM_OP(code)
Definition: FVM.h:652

Create a constant value in program memory.

Parameters
[in]ididentity index.
[in]varvariable name.
[in]namedictionary string.
[in]valvalue of constant.

Definition at line 714 of file FVM.h.

#define FVM_CREATE (   id,
  var,
  does,
  data 
)
Value:
const int var = id; \
const char var ## _PSTR[] PROGMEM = #data; \
const FVM::obj_t var ## _VAR PROGMEM = { \
FVM_CALL(does), \
FVM_OP(NOOP), \
}
#define FVM_CALL(fn)
Definition: FVM.h:675
uint8_t data[DATA_MAX]
Definition: Compiler.ino:256
#define FVM_OP(code)
Definition: FVM.h:652
int32_t cell_t
Definition: FVM.h:235

Create a named reference to a created object in program memory.

Parameters
[in]ididentity index.
[in]varvariable name.
[in]doesobject handler (function).
[in]datastorage.

Definition at line 684 of file FVM.h.

#define FVM_FUNCTION (   id,
  var,
  fn,
  env 
)
Value:
const int var = id; \
const char var ## _PSTR[] PROGMEM = #fn; \
const FVM::func_t var ## _FUNC PROGMEM = { \
FVM_OP(FUNC), \
fn, \
(FVM::cell_t*) &env \
}
#define FVM_OP(code)
Definition: FVM.h:652
int32_t cell_t
Definition: FVM.h:235

Create an extension function handler in program memory.

Parameters
[in]ididentity index.
[in]varvariable name.
[in]fnname of function.
[in]envenvironment.

Definition at line 740 of file FVM.h.

#define FVM_LIT (   n)
Value:
FVM::code_t((n) >> 8)
int8_t code_t
Definition: FVM.h:248
Inline literal constant.
Definition: FVM.h:42

Compile literal number (little endian).

Parameters
[in]nnumber.

Definition at line 658 of file FVM.h.

#define FVM_OP (   code)    FVM::OP_ ## code

Compile virtual machine instruction.

Parameters
[in]codeoperation code.

Definition at line 652 of file FVM.h.

#define FVM_SYMBOL (   id,
  var,
  name 
)
Value:
const int var = id + FVM::KERNEL_MAX; \
const char var ## _PSTR[] PROGMEM = name

Create a name table symbol in program memory.

Parameters
[in]ididentity index.
[in]varvariable name.
[in]namedictionary string.

Definition at line 755 of file FVM.h.

#define FVM_VARIABLE (   id,
  var,
  data 
)
Value:
const int var = id; \
const char var ## _PSTR[] PROGMEM = #data; \
const FVM::var_t var ## _VAR PROGMEM = { \
FVM_OP(CONST), \
}
uint8_t data[DATA_MAX]
Definition: Compiler.ino:256
#define FVM_OP(code)
Definition: FVM.h:652
int32_t cell_t
Definition: FVM.h:235

Create a named reference to a variable in program memory.

Parameters
[in]ididentity index.
[in]varvariable name.
[in]datastorage.

Definition at line 699 of file FVM.h.

Typedef Documentation

typedef const char* str_P

String in program memory.

Definition at line 32 of file FVM.h.