forth scripting

James Cameron quozl at laptop.org
Mon Jul 23 02:03:03 EDT 2012


The methods I've used to check for non-empty directory are:

1.  try assuming the directory is empty and if an exception occurs
handle it, using catch,

2.  try assuming the directory is non-empty and if an exception occurs
handle it, using catch,

3.  write a file counter, using the filesystem search infrastructure,
something like $tar-add-pattern in save-power-logs.fth in
http://dev.laptop.org/git/users/quozl/save-power-logs.git/

4.  use collect( from the stringio package to redirect output to a
string and check the string for overall length or number of lines,
e.g.

ok collect( " u:\*.zd" $dir )collect ( adr len ) nip .

The word words can display all the defined words in use in the current
vocabulary, but this won't show you words in other vocabularies, such
as device instances or tools.  show-devs can show you the the device
names, and then dev can bring their vocabularies into currency.

-- 
James Cameron
http://quozl.linux.org.au/



More information about the Devel mailing list