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 * ------------------------------------------------------------------------
7 * Module name: yfvinit.c
8 * Abstract: Initialize the vocabulary.
58 # include "facility.h"
61 # include "facilite.h"
79 # include "exceptio.h"
85 static struct raw_voc iv[] = {
112 # include "searche.h"
124 # include "localse.h"
127 # include "facility.h"
130 # include "facilite.h"
148 # include "exceptio.h"
151 # include "excepte.h"
159 /* init_vocabulary: loads words into the real dictionary from the table
160 * builded by including all the header files after the declaration of
161 * DECLARE_WORDS. See the header files such as "core.h" and the macro
162 * file "macro.h" for the implementation of this.
163 * This function returns the dictionary pointer after loading.
165 void init_vocabulary(Char **dp) {
169 while (iv[i].name) { /* Last name is a NULL (see table above) */
170 name = *dp; /* "name" is a ptr to the name */
171 **dp = strlen(iv[i].name); /* first copy length... */
172 strcpy(*dp + 1, iv[i].name); /* ...and then the actual name */
173 *dp = (Char *) WORD_PTR(*dp); /* advance "dp" */
174 w = (struct word_def *) *dp; /* here begins the structure */
175 w->name = name; /* adjust pointer... */
176 w->class = iv[i].class; /* ...and the class of the word */
177 ins_word(w); /* Finally adjust the link field... */
178 mark_word(w); /* ...accordingly with the hash function
179 and make the word visible */
180 *dp += sizeof(struct word_def); /* advance "dp" */
181 switch (iv[i].class & A_WORD) { /* The last field must be adjusted here */
183 w->func[0] = iv[i].func;
186 w->func[0] = (pfp) iv[i].func;