|
| 1 | +#ifndef zfconf |
| 2 | +#define zfconf |
| 3 | + |
| 4 | +/* Set to 1 to add tracing support for debugging and inspection. Requires the |
| 5 | + * zf_host_trace() function to be implemented. Adds about one kB to .text and |
| 6 | + * .rodata, dramatically reduces speed, but is very useful. Make sure to enable |
| 7 | + * tracing at run time when calling zf_init() or by setting the 'trace' user |
| 8 | + * variable to 1 */ |
| 9 | + |
| 10 | +#define ZF_ENABLE_TRACE 0 |
| 11 | + |
| 12 | +/* Set to 1 to add boundary checks to stack operations. Increases .text size |
| 13 | + * by approx 100 bytes */ |
| 14 | + |
| 15 | +#define ZF_ENABLE_BOUNDARY_CHECKS 1 |
| 16 | + |
| 17 | +/* Set to 1 to enable bootstrapping of the forth dictionary by adding the |
| 18 | + * primitives and user veriables. On small embedded systems you may choose to |
| 19 | + * leave this out and start by loading a cross-compiled dictionary instead. |
| 20 | + * Enabling adds a few hundred bytes to the .text and .rodata segments */ |
| 21 | + |
| 22 | +#define ZF_ENABLE_BOOTSTRAP 1 |
| 23 | + |
| 24 | +/* Set to 1 to enable typed access to memory. This allows memory read and write |
| 25 | + * of signed and unsigned memory of 8, 16 and 32 bits width, as well as the |
| 26 | + * zf_cell type. This adds a few hundred bytes of .text. Check the memaccess.zf |
| 27 | + * file for examples how to use these operations */ |
| 28 | + |
| 29 | +#define ZF_ENABLE_TYPED_MEM_ACCESS 1 |
| 30 | + |
| 31 | +/* Type to use for the basic cell, data stack and return stack. Choose a signed |
| 32 | + * integer type that suits your needs, or 'float' or 'double' if you need |
| 33 | + * floating point numbers */ |
| 34 | + |
| 35 | +typedef float zf_cell; |
| 36 | +#define ZF_CELL_FMT "%.14g" |
| 37 | +#define ZF_SCAN_FMT "%f" |
| 38 | + |
| 39 | +/* zf_int use for bitops, some arch int type width is less than register width, |
| 40 | + it will cause sign fill, so we need manual specify it */ |
| 41 | +typedef int zf_int; |
| 42 | + |
| 43 | +/* True is defined as the bitwise complement of false. */ |
| 44 | +#define ZF_FALSE ((zf_cell)0) |
| 45 | +#define ZF_TRUE ((zf_cell) ~(zf_int)ZF_FALSE) |
| 46 | + |
| 47 | +/* The type to use for pointers and addresses. 'unsigned int' is usually a good |
| 48 | + * choice for best performance and smallest code size */ |
| 49 | + |
| 50 | +typedef unsigned int zf_addr; |
| 51 | +#define ZF_ADDR_FMT "%04x" |
| 52 | + |
| 53 | +/* Memory region sizes: dictionary size is given in bytes, stack sizes are |
| 54 | + * number of elements of type zf_cell */ |
| 55 | + |
| 56 | +#define ZF_DICT_SIZE 4096 |
| 57 | +#define ZF_DSTACK_SIZE 32 |
| 58 | +#define ZF_RSTACK_SIZE 32 |
| 59 | + |
| 60 | +#endif |
0 commit comments