![]() |
||
| Home | SwiftForth Archive | SwiftX Archive | |

I have an external DOS program which performs some computations I
would like to use in a Forth-based system. I have used the following
approach occasionally in the past with other Forth systems and other
DOS programs.
1. The Forth system creates a script file (inscript.txt), requesting
the computation exactly as if the input was from the keyboard
on the command line.
2. In Swiftforth the external program is then executed using the
>SHELL command:
s" myprog < inscript.txt > outfile.txt" >shell
3. The external program executes taking inscript.txt as input and
sends its output to outfile.txt. The Forth system then processes
the output file.
It is simple to have two programs communicate in this way by using
disk files. In a given session with the Forth system it may only be
necessary to use this interface a few times - so the delays caused by
disk read/write and booting up the external program are acceptable.
A current external program provides a problem. When it boots up,
there is a lengthy delay while it loads a library of data and
supplemental routines. I could boot it up in advance. But then there
seems to way to have Swiftforth contact it. If I have Swiftforth boot it
up, and stay running then it is looking for input from the keyboard and
Swiftforth cannot provide it.
Are there any ways within Swiftforth to do something like what the
>SHELL command does in the way of redirection, but to a program
already running?
There is no way to rewrite these programs or get in to their internals.
Any interaction with them must assume that they normally take input
from the keyboard and produce output to the monitor (unless these are
redirected by the operating system).
John Wavrik
Dept of Math
UCSD
jjwavrik_at_ucsd.edu
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and bug
reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Tue Jun 01 2004 - 12:14:04 PDT
This archive was generated by hypermail 2.2.0 : Wed Jan 07 2009 - 03:04:12 PST