2 * Copyright (c) 2000 Daniel Capo Sobral
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * Additional FICL words designed for FreeBSD's loader
35 #include <sys/types.h>
46 #include "bootstrap.h"
51 #include <uuid/uuid.h>
57 * FreeBSD's loader interaction words and extras
59 * setenv ( value n name n' -- )
60 * setenv? ( value n name n' flag -- )
61 * getenv ( addr n -- addr' n' | -1 )
62 * unsetenv ( addr n -- )
63 * copyin ( addr addr' len -- )
64 * copyout ( addr addr' len -- )
65 * findfile ( name len type len' -- addr )
66 * ccall ( [[...[p10] p9] ... p1] n addr -- result )
67 * uuid-from-string ( addr n -- addr' )
68 * uuid-to-string ( addr' -- addr n | -1 )
73 ficlSetenv(ficlVm
*pVM
)
79 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 4, 0);
81 names
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
82 namep
= (char *)ficlStackPopPointer(ficlVmGetDataStack(pVM
));
83 values
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
84 valuep
= (char *)ficlStackPopPointer(ficlVmGetDataStack(pVM
));
86 name
= (char *)ficlMalloc(names
+1);
88 ficlVmThrowError(pVM
, "Error: out of memory");
89 strncpy(name
, namep
, names
);
91 value
= (char *)ficlMalloc(values
+1);
93 ficlVmThrowError(pVM
, "Error: out of memory");
94 strncpy(value
, valuep
, values
);
97 setenv(name
, value
, 1);
103 ficlSetenvq(ficlVm
*pVM
)
106 char *namep
, *valuep
;
107 int names
, values
, overwrite
;
109 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 5, 0);
111 overwrite
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
112 names
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
113 namep
= (char *)ficlStackPopPointer(ficlVmGetDataStack(pVM
));
114 values
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
115 valuep
= (char *)ficlStackPopPointer(ficlVmGetDataStack(pVM
));
117 name
= (char *)ficlMalloc(names
+1);
119 ficlVmThrowError(pVM
, "Error: out of memory");
120 strncpy(name
, namep
, names
);
122 value
= (char *)ficlMalloc(values
+1);
124 ficlVmThrowError(pVM
, "Error: out of memory");
125 strncpy(value
, valuep
, values
);
126 value
[values
] = '\0';
128 setenv(name
, value
, overwrite
);
134 ficlGetenv(ficlVm
*pVM
)
140 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 2, 2);
142 names
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
143 namep
= (char *)ficlStackPopPointer(ficlVmGetDataStack(pVM
));
145 name
= (char *)ficlMalloc(names
+1);
147 ficlVmThrowError(pVM
, "Error: out of memory");
148 strncpy(name
, namep
, names
);
151 value
= getenv(name
);
155 ficlStackPushPointer(ficlVmGetDataStack(pVM
), value
);
156 ficlStackPushInteger(ficlVmGetDataStack(pVM
), strlen(value
));
158 ficlStackPushInteger(ficlVmGetDataStack(pVM
), -1);
162 ficlUnsetenv(ficlVm
*pVM
)
168 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 2, 0);
170 names
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
171 namep
= (char *)ficlStackPopPointer(ficlVmGetDataStack(pVM
));
173 name
= (char *)ficlMalloc(names
+1);
175 ficlVmThrowError(pVM
, "Error: out of memory");
176 strncpy(name
, namep
, names
);
184 ficlCopyin(ficlVm
*pVM
)
192 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 3, 0);
195 len
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
196 dest
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
197 src
= ficlStackPopPointer(ficlVmGetDataStack(pVM
));
198 archsw
.arch_copyin(src
, dest
, len
);
200 (void) ficlStackPopInteger(ficlVmGetDataStack(pVM
));
201 (void) ficlStackPopInteger(ficlVmGetDataStack(pVM
));
202 (void) ficlStackPopPointer(ficlVmGetDataStack(pVM
));
207 ficlCopyout(ficlVm
*pVM
)
215 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 3, 0);
218 len
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
219 dest
= ficlStackPopPointer(ficlVmGetDataStack(pVM
));
220 src
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
221 archsw
.arch_copyout(src
, dest
, len
);
223 (void) ficlStackPopInteger(ficlVmGetDataStack(pVM
));
224 (void) ficlStackPopPointer(ficlVmGetDataStack(pVM
));
225 (void) ficlStackPopInteger(ficlVmGetDataStack(pVM
));
230 ficlFindfile(ficlVm
*pVM
)
237 struct preloaded_file
*fp
;
239 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 4, 1);
242 types
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
243 typep
= (char *)ficlStackPopPointer(ficlVmGetDataStack(pVM
));
244 names
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
245 namep
= (char *)ficlStackPopPointer(ficlVmGetDataStack(pVM
));
247 name
= (char *)ficlMalloc(names
+1);
249 ficlVmThrowError(pVM
, "Error: out of memory");
250 strncpy(name
, namep
, names
);
252 type
= (char *)ficlMalloc(types
+1);
254 ficlVmThrowError(pVM
, "Error: out of memory");
255 strncpy(type
, typep
, types
);
258 fp
= file_findfile(name
, type
);
260 (void) ficlStackPopInteger(ficlVmGetDataStack(pVM
));
261 (void) ficlStackPopPointer(ficlVmGetDataStack(pVM
));
262 (void) ficlStackPopInteger(ficlVmGetDataStack(pVM
));
263 (void) ficlStackPopPointer(ficlVmGetDataStack(pVM
));
267 ficlStackPushPointer(ficlVmGetDataStack(pVM
), fp
);
271 ficlCcall(ficlVm
*pVM
)
273 int (*func
)(int, ...);
277 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 2, 0);
279 func
= (int (*)(int, ...))ficlStackPopPointer(ficlVmGetDataStack(pVM
));
280 nparam
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
282 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), nparam
, 1);
284 for (i
= 0; i
< nparam
; i
++)
285 p
[i
] = ficlStackPopInteger(ficlVmGetDataStack(pVM
));
287 result
= func(p
[0], p
[1], p
[2], p
[3], p
[4], p
[5], p
[6], p
[7], p
[8],
290 ficlStackPushInteger(ficlVmGetDataStack(pVM
), result
);
294 ficlUuidFromString(ficlVm
*pVM
)
306 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 2, 0);
308 uuid_size
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
309 uuid_ptr
= ficlStackPopPointer(ficlVmGetDataStack(pVM
));
311 uuid
= ficlMalloc(uuid_size
+ 1);
313 ficlVmThrowError(pVM
, "Error: out of memory");
314 (void) memcpy(uuid
, uuid_ptr
, uuid_size
);
315 uuid
[uuid_size
] = '\0';
317 u
= ficlMalloc(sizeof (*u
));
319 uuid_from_string(uuid
, u
, &status
);
321 if (status
!= uuid_s_ok
) {
326 status
= uuid_parse(uuid
, *u
);
333 ficlStackPushPointer(ficlVmGetDataStack(pVM
), u
);
337 ficlUuidToString(ficlVm
*pVM
)
345 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 1, 0);
347 u
= ficlStackPopPointer(ficlVmGetDataStack(pVM
));
349 uuid_to_string(u
, &uuid
, &status
);
350 if (status
== uuid_s_ok
) {
351 ficlStackPushPointer(ficlVmGetDataStack(pVM
), uuid
);
352 ficlStackPushInteger(ficlVmGetDataStack(pVM
), strlen(uuid
));
355 uuid
= ficlMalloc(UUID_PRINTABLE_STRING_LENGTH
);
357 uuid_unparse(*u
, uuid
);
358 ficlStackPushPointer(ficlVmGetDataStack(pVM
), uuid
);
359 ficlStackPushInteger(ficlVmGetDataStack(pVM
), strlen(uuid
));
362 ficlStackPushInteger(ficlVmGetDataStack(pVM
), -1);
366 * f i c l E x e c F D
367 * reads in text from file fd and passes it to ficlExec()
368 * returns FICL_VM_STATUS_OUT_OF_TEXT on success or the ficlExec() error
373 ficlExecFD(ficlVm
*pVM
, int fd
)
376 int nLine
= 0, rval
= FICL_VM_STATUS_OUT_OF_TEXT
;
382 pVM
->sourceId
.i
= fd
+1; /* in loader we can get 0, there is no stdin */
384 /* feed each line to ficlExec */
389 while ((status
= read(fd
, &ch
, 1)) > 0 && ch
!= '\n')
400 FICL_STRING_SET_POINTER(s
, cp
);
401 FICL_STRING_SET_LENGTH(s
, i
);
403 rval
= ficlVmExecuteString(pVM
, s
);
404 if (rval
!= FICL_VM_STATUS_QUIT
&&
405 rval
!= FICL_VM_STATUS_USER_EXIT
&&
406 rval
!= FICL_VM_STATUS_OUT_OF_TEXT
) {
408 (void) ficlVmEvaluate(pVM
, "");
415 * Pass an empty line with SOURCE-ID == -1 to flush
416 * any pending REFILLs (as required by FILE wordset)
418 (void) ficlVmEvaluate(pVM
, "");
420 if (rval
== FICL_VM_STATUS_USER_EXIT
)
421 ficlVmThrow(pVM
, FICL_VM_STATUS_USER_EXIT
);
426 static void displayCellNoPad(ficlVm
*pVM
)
429 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 1, 0);
431 c
= ficlStackPop(ficlVmGetDataStack(pVM
));
432 ficlLtoa((c
).i
, pVM
->pad
, pVM
->base
);
433 ficlVmTextOut(pVM
, pVM
->pad
);
437 * isdir? - Return whether an fd corresponds to a directory.
439 * isdir? ( fd -- bool )
442 isdirQuestion(ficlVm
*pVM
)
448 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 1, 1);
450 fd
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
455 if (fstat(fd
, &sb
) < 0)
457 if (!S_ISDIR(sb
.st_mode
))
461 ficlStackPushInteger(ficlVmGetDataStack(pVM
), flag
);
465 * fopen - open a file and return new fd on stack.
467 * fopen ( ptr count mode -- fd )
469 extern char *get_dev(const char *);
480 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 3, 1);
482 mode
= ficlStackPopInteger(ficlVmGetDataStack(pVM
)); /* get mode */
483 count
= ficlStackPopInteger(ficlVmGetDataStack(pVM
)); /* get count */
484 ptr
= ficlStackPopPointer(ficlVmGetDataStack(pVM
)); /* get ptr */
486 if ((count
< 0) || (ptr
== NULL
)) {
487 ficlStackPushInteger(ficlVmGetDataStack(pVM
), -1);
491 /* ensure that the string is null terminated */
492 name
= (char *)malloc(count
+1);
493 bcopy(ptr
, name
, count
);
502 fd
= open(name
, mode
);
504 ficlStackPushInteger(ficlVmGetDataStack(pVM
), fd
);
508 * fclose - close a file who's fd is on stack.
516 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 1, 0);
518 fd
= ficlStackPopInteger(ficlVmGetDataStack(pVM
)); /* get fd */
524 * fread - read file contents
525 * fread ( fd buf nbytes -- nread )
533 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 3, 1);
535 len
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
536 buf
= ficlStackPopPointer(ficlVmGetDataStack(pVM
)); /* get buffer */
537 fd
= ficlStackPopInteger(ficlVmGetDataStack(pVM
)); /* get fd */
538 if (len
> 0 && buf
&& fd
!= -1)
539 ficlStackPushInteger(ficlVmGetDataStack(pVM
),
542 ficlStackPushInteger(ficlVmGetDataStack(pVM
), -1);
546 * fopendir - open directory
548 * fopendir ( addr len -- ptr TRUE | FALSE )
550 static void pfopendir(ficlVm
*pVM
)
561 ficlInteger flag
= FICL_FALSE
;
563 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 2, 1);
565 count
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
566 ptr
= ficlStackPopPointer(ficlVmGetDataStack(pVM
)); /* get ptr */
568 if ((count
< 0) || (ptr
== NULL
)) {
569 ficlStackPushInteger(ficlVmGetDataStack(pVM
), -1);
572 /* ensure that the string is null terminated */
573 name
= (char *)malloc(count
+1);
574 bcopy(ptr
, name
, count
);
581 fd
= open(name
, O_RDONLY
);
586 if (fstat(fd
, &sb
) < 0)
588 if (!S_ISDIR(sb
.st_mode
))
591 ficlStackPushInteger(ficlVmGetDataStack(pVM
), fd
);
592 ficlStackPushInteger(ficlVmGetDataStack(pVM
), flag
);
599 ficlStackPushInteger(ficlVmGetDataStack(pVM
), flag
);
605 ficlStackPushInteger(ficlVmGetDataStack(pVM
), flag
);
610 ficlStackPushPointer(ficlVmGetDataStack(pVM
), dir
);
611 ficlStackPushInteger(ficlVmGetDataStack(pVM
), flag
);
616 * freaddir - read directory contents
617 * freaddir ( fd -- ptr len TRUE | FALSE )
620 pfreaddir(ficlVm
*pVM
)
623 static DIR *dir
= NULL
;
627 struct dirent
*d
= NULL
;
629 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 1, 3);
631 * libstand readdir does not always return . nor .. so filter
632 * them out to have consistent behaviour.
635 dir
= ficlStackPopPointer(ficlVmGetDataStack(pVM
));
639 if (d
!= NULL
&& strcmp(d
->d_name
, ".") == 0)
641 if (d
!= NULL
&& strcmp(d
->d_name
, "..") == 0)
646 fd
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
650 if (d
!= NULL
&& strcmp(d
->d_name
, ".") == 0)
652 if (d
!= NULL
&& strcmp(d
->d_name
, "..") == 0)
658 ficlStackPushPointer(ficlVmGetDataStack(pVM
), d
->d_name
);
659 ficlStackPushInteger(ficlVmGetDataStack(pVM
),
661 ficlStackPushInteger(ficlVmGetDataStack(pVM
), FICL_TRUE
);
663 ficlStackPushInteger(ficlVmGetDataStack(pVM
), FICL_FALSE
);
668 * fclosedir - close a dir on stack.
670 * fclosedir ( fd -- )
673 pfclosedir(ficlVm
*pVM
)
681 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 1, 0);
684 dir
= ficlStackPopPointer(ficlVmGetDataStack(pVM
)); /* get dir */
688 fd
= ficlStackPopInteger(ficlVmGetDataStack(pVM
)); /* get fd */
695 * fload - interpret file contents
699 static void pfload(ficlVm
*pVM
)
703 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 1, 0);
705 fd
= ficlStackPopInteger(ficlVmGetDataStack(pVM
)); /* get fd */
711 * fwrite - write file contents
713 * fwrite ( fd buf nbytes -- nwritten )
721 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 3, 1);
723 len
= ficlStackPopInteger(ficlVmGetDataStack(pVM
)); /* bytes to read */
724 buf
= ficlStackPopPointer(ficlVmGetDataStack(pVM
)); /* get buffer */
725 fd
= ficlStackPopInteger(ficlVmGetDataStack(pVM
)); /* get fd */
726 if (len
> 0 && buf
&& fd
!= -1)
727 ficlStackPushInteger(ficlVmGetDataStack(pVM
),
728 write(fd
, buf
, len
));
730 ficlStackPushInteger(ficlVmGetDataStack(pVM
), -1);
734 * fseek - seek to a new position in a file
736 * fseek ( fd ofs whence -- pos )
743 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 3, 1);
745 whence
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
746 pos
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
747 fd
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
748 ficlStackPushInteger(ficlVmGetDataStack(pVM
), lseek(fd
, pos
, whence
));
752 * key - get a character from stdin
759 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 0, 1);
761 ficlStackPushInteger(ficlVmGetDataStack(pVM
), getchar());
765 * key? - check for a character from stdin (FACILITY)
769 keyQuestion(ficlVm
*pVM
)
777 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 0, 1);
780 tcgetattr(STDIN_FILENO
, &oldt
);
782 newt
.c_lflag
&= ~(ICANON
| ECHO
);
784 newt
.c_cc
[VTIME
] = 0;
785 tcsetattr(STDIN_FILENO
, TCSANOW
, &newt
);
787 tcsetattr(STDIN_FILENO
, TCSANOW
, &oldt
);
790 (void) ungetc(ch
, stdin
);
792 ficlStackPushInteger(ficlVmGetDataStack(pVM
),
793 ch
!= -1? FICL_TRUE
: FICL_FALSE
);
795 ficlStackPushInteger(ficlVmGetDataStack(pVM
),
796 ischar()? FICL_TRUE
: FICL_FALSE
);
801 * seconds - gives number of seconds since beginning of time
803 * beginning of time is defined as:
805 * BTX - number of seconds since midnight
806 * FreeBSD - number of seconds since Jan 1 1970
811 pseconds(ficlVm
*pVM
)
813 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 0, 1);
815 ficlStackPushUnsigned(ficlVmGetDataStack(pVM
),
816 (ficlUnsigned
) time(NULL
));
820 * ms - wait at least that many milliseconds (FACILITY)
826 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 1, 0);
829 usleep(ficlStackPopUnsigned(ficlVmGetDataStack(pVM
)) * 1000);
831 delay(ficlStackPopUnsigned(ficlVmGetDataStack(pVM
)) * 1000);
836 * fkey - get a character from a file
837 * fkey ( file -- char )
845 FICL_STACK_CHECK(ficlVmGetDataStack(pVM
), 1, 1);
847 fd
= ficlStackPopInteger(ficlVmGetDataStack(pVM
));
848 i
= read(fd
, &ch
, 1);
849 ficlStackPushInteger(ficlVmGetDataStack(pVM
), i
> 0 ? ch
: -1);
853 * Retrieves free space remaining on the dictionary
856 freeHeap(ficlVm
*pVM
)
858 ficlStackPushInteger(ficlVmGetDataStack(pVM
),
859 ficlDictionaryCellsAvailable(ficlVmGetDictionary(pVM
)));
863 * f i c l C o m p i l e P l a t f o r m
864 * Build FreeBSD platform extensions into the system dictionary
867 ficlSystemCompilePlatform(ficlSystem
*pSys
)
869 ficlDictionary
*dp
= ficlSystemGetDictionary(pSys
);
870 ficlDictionary
*env
= ficlSystemGetEnvironment(pSys
);
872 ficlCompileFcn
**fnpp
;
875 FICL_SYSTEM_ASSERT(pSys
, dp
);
876 FICL_SYSTEM_ASSERT(pSys
, env
);
878 ficlDictionarySetPrimitive(dp
, ".#", displayCellNoPad
,
880 ficlDictionarySetPrimitive(dp
, "isdir?", isdirQuestion
,
882 ficlDictionarySetPrimitive(dp
, "fopen", pfopen
, FICL_WORD_DEFAULT
);
883 ficlDictionarySetPrimitive(dp
, "fclose", pfclose
, FICL_WORD_DEFAULT
);
884 ficlDictionarySetPrimitive(dp
, "fread", pfread
, FICL_WORD_DEFAULT
);
885 ficlDictionarySetPrimitive(dp
, "fopendir", pfopendir
,
887 ficlDictionarySetPrimitive(dp
, "freaddir", pfreaddir
,
889 ficlDictionarySetPrimitive(dp
, "fclosedir", pfclosedir
,
891 ficlDictionarySetPrimitive(dp
, "fload", pfload
, FICL_WORD_DEFAULT
);
892 ficlDictionarySetPrimitive(dp
, "fkey", fkey
, FICL_WORD_DEFAULT
);
893 ficlDictionarySetPrimitive(dp
, "fseek", pfseek
, FICL_WORD_DEFAULT
);
894 ficlDictionarySetPrimitive(dp
, "fwrite", pfwrite
, FICL_WORD_DEFAULT
);
895 ficlDictionarySetPrimitive(dp
, "key", key
, FICL_WORD_DEFAULT
);
896 ficlDictionarySetPrimitive(dp
, "key?", keyQuestion
, FICL_WORD_DEFAULT
);
897 ficlDictionarySetPrimitive(dp
, "ms", ms
, FICL_WORD_DEFAULT
);
898 ficlDictionarySetPrimitive(dp
, "seconds", pseconds
, FICL_WORD_DEFAULT
);
899 ficlDictionarySetPrimitive(dp
, "heap?", freeHeap
, FICL_WORD_DEFAULT
);
901 ficlDictionarySetPrimitive(dp
, "setenv", ficlSetenv
, FICL_WORD_DEFAULT
);
902 ficlDictionarySetPrimitive(dp
, "setenv?", ficlSetenvq
,
904 ficlDictionarySetPrimitive(dp
, "getenv", ficlGetenv
, FICL_WORD_DEFAULT
);
905 ficlDictionarySetPrimitive(dp
, "unsetenv", ficlUnsetenv
,
907 ficlDictionarySetPrimitive(dp
, "copyin", ficlCopyin
, FICL_WORD_DEFAULT
);
908 ficlDictionarySetPrimitive(dp
, "copyout", ficlCopyout
,
910 ficlDictionarySetPrimitive(dp
, "findfile", ficlFindfile
,
912 ficlDictionarySetPrimitive(dp
, "ccall", ficlCcall
, FICL_WORD_DEFAULT
);
913 ficlDictionarySetPrimitive(dp
, "uuid-from-string", ficlUuidFromString
,
915 ficlDictionarySetPrimitive(dp
, "uuid-to-string", ficlUuidToString
,
918 /* Register words from linker set. */
919 SET_FOREACH(fnpp
, Xficl_compile_set
)
923 #if defined(__i386__) || defined(__amd64__)
924 ficlDictionarySetConstant(env
, "arch-i386", FICL_TRUE
);
925 ficlDictionarySetConstant(env
, "arch-sparc", FICL_FALSE
);