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 * ------------------------------------------------------------------------
8 * Abstract: Words defined for this particular implementation of
9 forth. Do not expect to find these words in other
22 /**************************************************************************/
23 /* WORDS DEFINITION *******************************************************/
24 /**************************************************************************/
26 /* ( --- ) print current version of yForth? */
27 void _yforth_version() {
31 /* ( c-addr u --- ) save a snapshot of the current dictionary and vocabulary
35 FILE *f = fopen(get_file_name(), "wb");
36 struct image_header hd;
39 memset(&hd, 0, sizeof(struct image_header));
40 strcpy(hd.header, "yForth? Image File\n");
44 hd.dspace_size = dspace_size;
45 hd.pattern = VERSION_PATTERN;
46 if (fwrite(&hd, sizeof(struct image_header), 1, f) < 1) _error = E_NOFILE;
49 if (fwrite(&vm, sizeof(struct voc_marker), 1, f) < 1) _error = E_NOFILE;
51 if (fwrite(dp0, sizeof(Cell), dspace_size, f) < dspace_size)
56 } else _error = E_NOFILE;
59 /* ( c-addr u --- n ) execute command pointeb by c-addr via "system", n is
60 * the result of operation as described in the C library manual
63 register UCell len = *sp++;
64 register Char *name = (Char *) *sp;
65 extern Char s_tmp_buffer[];
66 memcpy(s_tmp_buffer, name, len);
67 s_tmp_buffer[len] = '\0';
68 *sp = system(s_tmp_buffer);