diff options
| author | Jordan K. Hubbard <jkh@FreeBSD.org> | 1998-11-06 23:20:32 +0000 |
|---|---|---|
| committer | Jordan K. Hubbard <jkh@FreeBSD.org> | 1998-11-06 23:20:32 +0000 |
| commit | f476d38a01cefa6d61881b5cd8067c0831beb75c (patch) | |
| tree | c85ca70a1164ab4cf4ccce04e2f8b3365366a2a0 /sys/boot | |
| parent | d8acd8dc5cb2a0ce54609c9c1d94cff16792902a (diff) | |
Notes
Diffstat (limited to 'sys/boot')
| -rw-r--r-- | sys/boot/ficl/softwords/softcore.fr | 2 | ||||
| -rw-r--r-- | sys/boot/ficl/words.c | 48 |
2 files changed, 9 insertions, 41 deletions
diff --git a/sys/boot/ficl/softwords/softcore.fr b/sys/boot/ficl/softwords/softcore.fr index ad3d55be8139..4f38ee01d92e 100644 --- a/sys/boot/ficl/softwords/softcore.fr +++ b/sys/boot/ficl/softwords/softcore.fr @@ -122,7 +122,7 @@ wordlist constant hidden : hide hidden dup >search ficl-set-current ; \ init - hook for extra startup behavior -: init ( -- ) fexists "/boot/boot.4th" if fload "/boot/boot.4th" then ; +: init ( -- ) s" /boot/boot.4th" fexists if s" /boot/boot.4th" fload then ; \ ** E N D S O F T C O R E . F R diff --git a/sys/boot/ficl/words.c b/sys/boot/ficl/words.c index 35e43485d728..886b429739bc 100644 --- a/sys/boot/ficl/words.c +++ b/sys/boot/ficl/words.c @@ -4025,37 +4025,20 @@ static void forget(FICL_VM *pVM) * * grabbed out of testmain.c example and frobbed to fit. * - * Usage: - * fload test.ficl + * fload ( addr count -- ) */ #define nLINEBUF 256 static void fload(FICL_VM *pVM) { - char *p, cp[nLINEBUF]; FICL_STRING *pFilename; + char cp[nLINEBUF]; int i, fd, nLine = 0; char ch; CELL id; - FICL_DICT *dp = ficlGetDict(); - - if (pVM->state == COMPILE) - { - dictAppendCell(dp, LVALUEtoCELL(pStringLit)); - dp->here = PTRtoCELL vmGetString(pVM, (FICL_STRING *)dp->here, '\"'); - dictAlign(dp); - return; - } - - pFilename = (FICL_STRING *)dp->here; - vmGetString(pVM, pFilename, '\"'); - if (pFilename->count <= 1) - { - vmTextOut(pVM, "fload: no filename specified", 1); - return; - } - p = (*pFilename->text == '\"') ? pFilename->text + 1 : pFilename->text; - fd = open(p, O_RDONLY); + pFilename->count = stackPopINT32(pVM->pStack); + pFilename->text = stackPopPtr(pVM->pStack); + fd = open(pFilename->text, O_RDONLY); if (fd == -1) { vmTextOut(pVM, "fload: Unable to open file: ", 0); @@ -4105,25 +4088,10 @@ static void fexists(FICL_VM *pVM) char *p; FICL_STRING *pFilename; int fd; - FICL_DICT *dp = ficlGetDict(); - - if (pVM->state == COMPILE) - { - dictAppendCell(dp, LVALUEtoCELL(pStringLit)); - dp->here = PTRtoCELL vmGetString(pVM, (FICL_STRING *)dp->here, '\"'); - dictAlign(dp); - return; - } - pFilename = (FICL_STRING *)dp->here; - vmGetString(pVM, pFilename, '\"'); - if (pFilename->count <= 1) - { - vmTextOut(pVM, "fexists: no filename specified", 1); - return; - } - p = (*pFilename->text == '\"') ? pFilename->text + 1 : pFilename->text; - fd = open(p, O_RDONLY); + pFilename->count = stackPopINT32(pVM->pStack); + pFilename->text = stackPopPtr(pVM->pStack); + fd = open(pFilename->text, O_RDONLY); if (fd > 0) { stackPushINT32(pVM->pStack, TRUE); close(fd); |
