{"id":54,"date":"2014-04-20T18:12:37","date_gmt":"2014-04-20T22:12:37","guid":{"rendered":"\/?page_id=54"},"modified":"2014-04-20T19:20:15","modified_gmt":"2014-04-20T23:20:15","slug":"configurable-features","status":"publish","type":"page","link":"\/efci\/documentation\/configurable-features\/","title":{"rendered":"Configurable Features"},"content":{"rendered":"

In order to accommodate the needs of various embedded systems certain features of the Embeddable Forth Command Interpreter are configurable at compile time. The idea is to not burden a system with features it does not use. In fact it might be highly undesirable to have features that are not absolutely necessary e.g. if the software is used in such a product that requires extensive validation for safety or other regulation purposes. In general features that are not used just should not be there at all.<\/p>\n

Other features such as the maximum size of the dictionary and stack space are highly usage dependent.<\/p>\n

Compile-time Configuration<\/h2>\n

Compile time configuration is done by editing the C header file forth_features.h before compiling the system.<\/p>\n

\r\n\/\/ The size of the terminal buffer.\r\n#define TIB_SIZE 256\r\n\r\n\/\/ The size of the Forth Dictionary in CELLs.\r\n\/\/ Because of the execution model it should be\r\n\/\/ less than 64K cells (256 KB on a 32bit system).\r\n#define FORTH_DICTIONARY_SIZE 4096\r\n\r\n\/\/ The number of user defined per execution thread variables\r\n\/\/ (known as USER variables in Forth parlance).\r\n\/\/ #undef this to disable USER variables altogether.\r\n#define FORTH_USER_VARIABLES 256\r\n\r\n\/\/ #undef this if you don't want file access words.\r\n#define FORTH_INCLUDE_FILE_ACCESS_WORDS 1\r\n\r\n\/\/ #undef this if you don't want memory allocation words.\r\n#define FORTH_INCLUDE_MEMORY_ALLOCATION_WORDS 1\r\n\r\n\/\/ Some macros to allocate the C style (0 terminated) strings\r\n\/\/ for file names.\r\n#if defined(FORTH_INCLUDE_FILE_ACCESS_WORDS)\r\n#       define FORTH_FILE_INPUT_BUFFER_LENGTH 256\r\n#       define FORTH_ALLOCATE_CNAME(PTR, LEN) (strndup)((PTR), (LEN))\r\n#       define FORTH_FREE_CNAME(X) free((X))\r\n#endif\r\n\r\n\/\/ #define this if you don't want the Forth compiler (interpreter only).\r\n#undef FORTH_DISABLE_COMPILER\r\n\r\n\/\/ #undef this if you don't want the word MS.\r\n#define FORTH_INCLUDE_MS 1\r\n\/\/ #undef this if you don't want the word TIME&DATE\r\n#define FORTH_INCLUDE_TIME_DATE 1\r\n\r\n\/\/ #undef this to disable stack underflow\/overflow checking.\r\n#define FORTH_STACK_CHECK_ENABLED\r\n\r\n\/\/ #define this to disable ALL double number and mixed arithmetic,\r\n\/\/ no D+ -es, M+ -es or *\/-s, not even #.\r\n#undef FORTH_NO_DOUBLES\r\n\r\n\/\/ #undef this if you do not want to allow C-style hex numbers\r\n\/\/ that start with 0x\r\n#define FORTH_ALLOW_0X_HEX 1\r\n\r\n\/\/ If the application requires extra fields in the run time context\r\n\/\/ #define this to list them.\r\n\/\/ See the telnet implementation in the ZedBoard example for an example.\r\n#undef FORTH_APPLICATION_DEFINED_CONTEXT_FIELDS\r\n<\/pre>\n

Run-time Configurable fields in the Context<\/h2>\n

The Run time context passed to the function forth()<\/strong> has several per thread fields that need to be properly initialized. A full list can be obtained from the source file forth.h<\/em>. The most noteworthy fields that need to be initialized by the application are the following:<\/p>\n