Integrated Development Environment
Maybe it is little far fetched to call it an integrated programming environment, but with a small extension ciforth cooperates nicely with the operating system under which it runs. After all Forth is an interpreter. So we can interpret command's intended for Windows or Linux and pass them on. An essential role is played by the word SYSTEM :
S" do something" SYSTEM
gives the same effect as when
do something
was typed on the command line. This word SYSTEM is not standard, but almost, and it is available on any reasonable Forth system. Typing
S" DIR *.frt" SYSTEM
is a bit long in the tooth. But we can make DIR a Forth word, such that
DIR *.frt
work from within Forth. Because there is a bunch of this kind of words, this is a job for a defining word. The word OS-IMPORT work as follows
\ Import Linux commands, but use DOS names. S" ls" OS-IMPORT DIR S" cp" OS-IMPORT COPY ...
OS-IMPORT makes a new word, getting the name such as "COPY" from the input stream, and remembers the string passed to it, in the example S" cp" . During execution the new word reads the remainder of the line, concatenates it with the string, and passed it to SYSTEM . Normally the string and the name will be the same:
S" DIR" OS-IMPORT DIR