Commit Graph

15 Commits

Author SHA1 Message Date
Marcel Moolenaar
d6c0f33b57 Fix the freaddir implementation for the stand-alone interpreter.
Bug pointed out by: Jan Beich <jbeich@tormail.org>
2013-08-09 19:10:56 +00:00
Marcel Moolenaar
04ae0d7cc5 Fix the build of the testmain target. This target compiles a Forth
interpreter that can be run on the system and as such cannot be
compiled against libbstand. On the one hand this means we need to
include the usual headers for system interfaces that we use and
on the the other hand we can only use standard system interfaces.

While here, define local variables only when needed to make this
WARNS=2 clean on amd64.

PR:		172542
Obtained from:	peterj@
Pointed out by: Jan Beich <jbeich@tormail.org>
2013-08-01 18:06:58 +00:00
Marcel Moolenaar
68fd965f98 Add 2 builtin words for working with directories:
isdir?		( fd -- bool )
	freaddir	( fd -- ptr len TRUE | FALSE )

The 'isdir?' word returns `true' if the file descriptor is for a
directory and `false' otherwise.

The 'freaddir' word reads the next directory entry and if successful,
returns its name and 'true'. Otherwise 'false' is returned.

These words give the loader the ability to scan directories and read
files contained in them for 'rc.d'-like flexibility in handling which
modules to load and/or which tunables to set.

Obtained from:	Juniper Networks, Inc.
2013-07-10 21:37:50 +00:00
John Baldwin
906d6c0eb1 Remove Alpha bits for ficl. 2006-05-12 04:07:42 +00:00
Scott Long
a63e88df60 Instead of just not defining a bunch of words when TESTMAIN is set, provide
stubs that at least handle the stack correctly.  This makes it much easier to
experiment with loader scripts from userland.
2004-11-30 11:35:30 +00:00
Peter Grehan
b42c229790 Define 'arch-powerpc' 2003-12-10 09:09:38 +00:00
Yoshihiro Takahashi
c2098cc1ad Set arch-pc98 env to true for pc98. 2003-06-08 03:11:16 +00:00
Scott Long
7effdac07a Fix for stand-alone compiling
Reviewed by:	mini
2002-08-21 09:28:00 +00:00
Daniel C. Sobral
be88b71603 Upgrade to FICL version 3.02. Anything wrong is my fault, everything right is
due Jon Mini.

PR:		36308
Submitted by:	Jon Mini <mini@haikugeek.com>
MFC after:	4 weeks
2002-04-09 17:45:28 +00:00
John Baldwin
0889b9be41 - Add 'fwrite' and 'fseek' words for writing to and seeking on files.
- Change the 'fopen' keyword to accept a mode parameter.  Note that this
  will break existing 4th scripts that use fopen.  Thus, the loader
  version has been bumped and loader.4th has been changed to check for a
  sufficient version on i386 and alpha.  Be sure that you either do a full
  world build or install or full build and install of sys/boot after this
  since loader.old won't work with the new 4th files and vice versa.

PR:		kern/32389
Submitted by:	Jonathan Mini <mini@haikugeek.com>
Sponsored by:	ClickArray, Inc.
2001-12-11 00:49:34 +00:00
Doug Rabson
350ee9804b Add definition for arch-ia64. 2001-09-04 08:51:15 +00:00
Daniel C. Sobral
49acc8fe50 Bring in ficl 2.05.
This version has a step debugger, which now completely replaces the
old trace feature. Also, we moved all of the FreeBSD-specific MI
code to loader.c, reducing the diff between this and the official
FICL distribution.
2001-04-29 02:36:36 +00:00
Doug Rabson
4eedebf31f Only build PnP parts if the platform supports PnP. 2000-09-10 12:15:30 +00:00
Daniel C. Sobral
f5da975f8f Add the infrastructure necessary to handle PnP from a Forth script.
Also, export the file_findfile() function. Again, this is taken from
work in progress but frozen for the time being. Since it works, I'd
rather commit and remove any uglyness later than hide it on my tree.
2000-09-08 17:03:53 +00:00
Daniel C. Sobral
f0b972df2f Add setenv, getenv, setenv?, unsetenv, copyin and copyout to FICL. 2000-06-07 22:07:01 +00:00