[Coco] Fwd: Re: Redirection.
William H. Carlin, Jr.
whcarlinjr at gmail.com
Thu Apr 2 23:12:24 EDT 2020
Charlie,
I found a Basic09 procedure on the VCCEmuDisk.vhd from the Color Computer Archive that demonstrates how to use redirection in Basic09. I'm not exactly sure what it unpacking. Perhaps someone else on the list can enlighten us.
https://colorcomputerarchive.com/files/Virtual%20Hard%20Drives/NitrOS-9%20L2%20V3.3.0/VCCEMUDisk.zip
The file is in the /dd/SOURCES/BASIC directory
Here is the relevant portion.
PROCEDURE unpack
...
DIM:key:BYTE
DIM in,out,eout:INTEGER
...
in=0
out=1
eout=2
...
GET #in,key
The procedure set the variable "in" to 0 or stdin, "out" to 1 or stdout, and "eout" to 2 or stderr. Then using the GET command, a byte is pulled from stdin and stored in the variable "key".
To push that same byte stored in the variable "key" to stdout you would use the PUT command.
PUT #out,key
Once packed, the procedure can be called like any other os9 program that utilizes input/output redirection.
pack <filein >fileout
or
list filein ! pack >fileout
This is assuming you have the pipe system modules loaded in os9.
---
William Carlin, Jr.
-----Original Message-----
From: Coco [mailto:coco-bounces at maltedmedia.com] On Behalf Of coco at jechar.ca
Sent: April 2, 2020 16:37
To: Coco List <coco at maltedmedia.com>
Subject: [Coco] Fwd: Re: Redirection.
OK I have tried not working so could you send me
three things.
1. A program "A" that produces the output.
2. A program "B" that takes program "A"'s output and
processes it in some way to produce the final output.
3. A OS9 script that illustrates how to use these programs
together.
Don't care about the details whatever is easy.
Just need to see an example to understand the
principals.
Charlie
-------- Original Message --------
Subject: Re: [Coco] Redirection.
Date: 2020-04-02 14:56
From: Dave Philipsen <dave at davebiz.com>
To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Reply-To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
Nothing special has to be done. It just works.
As long as your programs use STDIN and STDOUT which are the paths to/from the keyboard and terminal display, they will work with redirected input/output.
> On Apr 2, 2020, at 11:26 AM, coco at jechar.ca wrote:
>
>
> In os9 one should be able to pipe the output of one process into
> another does anyone have an example of how this works for basic09 or
> can it only be done in another language.
>
> What I want is a program that can accept the text output by another
> program just as if it were typed into a INPUT text$ statement by a
> user.
>
> So two questions:
>
> 1. How to design test1.b09 so that you could redirect
> another os9 program such as dir to act as it's input.
>
> 2. Does anything special have to be done so that a program
> test2.b09 can redirect it's output to act as the input for
> test1.b09 at the command line.
>
> Do you have any sample code that shows how I could set this up.
>
> Charlie.
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> https://pairlist5.pair.net/mailman/listinfo/coco
--
Coco mailing list
Coco at maltedmedia.com
https://pairlist5.pair.net/mailman/listinfo/coco
More information about the Coco
mailing list