Article View: comp.sys.amiga.tech
Article #6758Re: Follow the true Way -- A PLEA!! for good program design.
From: Gregory Kritsch
Date: Tue, 17 Nov 2020 21:21
Date: Tue, 17 Nov 2020 21:21
66 lines
3829 bytes
3829 bytes
psop@watcsc.waterloo.edu (Paul Sop) writes:
>I want everyone, from now on, everywhere, who owns an amiga, to, when
>they write AREXX programs (note! I didn't say 'Scripts'), include the
>following **EXTREMELY IMPORTANT** line:
>call close 'STDIN';call open 'STDIN','*','R'
>NOTE the '*'. If more amiga programs used this method of reading input,
>life would be considerably better, easier, and all round more fun.
>Why? You query? Well...
>To illustrate what happens when you LEAVE the magic line out of an AREXX
>program, consider the following itty bitty AREXX program:
>/* a wonderful illustration of what happens when you leave it out.rexx */
>Run rx >con:0/0/640/400/Window Out.Rexx
Let's try something creative now. "Rx <t:inputfile out". Now, instead
of reading from the file I want standard input to be read from, your
"fix" has redirected things back to the console, where I didn't want to
have to type in the 32 pages of data for my rexx program to process.
>Will ** FIX ** this. Now you'll be able to RUN programs in windows
>and be able to get output from them, AND send input TO them!
>That means, you can RUN programs, but still enter a few parameters before
>they leave and run in the background. You can now pipe output to console
>windows, AND TYPE INTO THEM TOO! And as soon as the program exits, it's
>window is automatically closed. Wonderful stuff.
No, it won't really fix the problem. The problem here is with a user
not being intelligent enough to use a command line properly. When you
"run" a program, it becomes a "background" process. One of the parts of
the definition of "background" is that it has no interactive input
stream associated with it, and therefore should not attempt to read it's
standard input file.
The proper fix involves calling IsInteractive() on stdin. If its not
interactive, or it doesn't exist, then the program should not try to use
it, or should then create its own (or open "*", if "*" exists).
What you do is almost as silly as creating an icon for DIR and expecting
it to work.
>from an AREXX program, the effect would be similar to running it, in that
>you wouldn't be able to interact with the directory command (a major
>pitfall!). If the DIR command opened it's file channel as '*' for input,
Actually, thats a bug (sort-of) in ARexx, not a problem with the DIR
command. It should be possible for ARexx to set up external commands to
"borrow" its interactive input stream. Unfortunately, its not exactly
well documented or easy to do with AmigaDOS.
> Simulating psychedelic milieus with flashing lights and hallucinogenics:
>.............................................................................
>z s w a m p . f i d o n e t . o r g ! l i l l i p u t ! u n i x 4 ! p s o p 4
> - O R - p s o p @ w a t c s c . w a t e r l o o . e d u
>.............................................................................
> Mail me if you're mean.
--
Gregory Kritsch | University of Waterloo
Fido: 1:221/208.11110 [1:163/109.30] | 1A Computer Engineering
OCUG: ggk@tirith.ocug.on.ca |----------------------------
UUCP: ggk@tirith.UUCP | The University doesn't get
...!watmath!xenitec!tirith!ggk | a chance to censor me!
Technical Details
Message-ID:
<ggk.658876897@tirith.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!maytag!xenitec!tirith!ggkReferences:
<1990Nov17.080652.28036@watcsc.waterloo.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!watserv1!maytag!xenitec!tirith!ggk From: ggk@tirith.UUCP (Gregory Kritsch) Message-ID: <ggk.658876897@tirith.UUCP> Date: 17 Nov 20 21:21:36 Newsgroups: comp.sys.amiga.tech Subject: Re: Follow the true Way -- A PLEA!! for good program design. Keywords: AREXX , * In-Reply-To: psop@watcsc.waterloo.edu (Paul Sop) References: <1990Nov17.080652.28036@watcsc.waterloo.edu>