1 /* yForth? - Written by Luca Padovani (C) 1996/97
2 * ------------------------------------------------------------------------
3 * This software is FreeWare as long as it comes with this header in each
4 * source file, anyway you can use it or any part of it whatever
5 * you want. It comes without any warranty, so use it at your own risk.
6 * ------------------------------------------------------------------------
15 /**************************************************************************/
16 /* VARIABLES **************************************************************/
17 /**************************************************************************/
19 struct vocabulary *list[WORD_LISTS];
20 Cell top; /* indice primo vocabolario sulla pila */
21 struct vocabulary *voc; /* ptr al vocabolario usato per le definzioni */
22 struct vocabulary *forth_wid;
24 /**************************************************************************/
25 /* WORDS ******************************************************************/
26 /**************************************************************************/
32 void _forth_wordlist() {
33 *--sp = (Cell) forth_wid;
42 for (i = 0; i <= top; i++) *--sp = (Cell) list[i];
46 void _search_wordlist() {
47 register struct vocabulary *wid = (struct vocabulary *) *sp++;
48 register Cell len = *sp++;
49 register Char *addr = (Char *) *sp;
50 register struct word_def *xt = search_wordlist(addr, len, wid);
51 set_find_stack(addr, xt);
56 voc = (struct vocabulary *) *sp++;
60 register Cell n = *sp++;
62 for (i = 0; i < n; i++)
63 if (i < WORD_LISTS) list[i] = (struct vocabulary *) *sp++;
69 register struct vocabulary *v;
72 v = (struct vocabulary *) _dp;
73 _dp += sizeof(struct vocabulary);
74 for (i = 0; i < VOC_HASH; i++) v->voc[i] = NULL;
79 /**************************************************************************/
80 /* AUXILIARY FUNCTIONS ****************************************************/
81 /**************************************************************************/
83 void save_vocabulary(struct voc_marker *vm) {
85 for (i = 0; i < WORD_LISTS; i++) {
86 vm->list[i] = list[i];
87 if (list[i]) vm->v_list[i] = *list[i];
95 void load_vocabulary(struct voc_marker *vm) {
97 for (i = 0; i < WORD_LISTS; i++) {
98 list[i] = vm->list[i];
99 if (list[i]) *list[i] = vm->v_list[i];