|
|
Up |
|
|
  |
Author: Krishna MyneniKrishna Myneni Date: Nov 14, 2007 19:17
This problem came up in a game program. Given a set of words that output text, I
want versions of the words that perform the same computations, but do not output
anything to the console. Below is given a kForth-specific solution to the
problem, using the words >FILE and CONSOLE (which allow output redirection, and
were included in LMI Forth). An existing word can be made quiet by declaring
be-quiet wordname
I wonder if there is a "common" solution to this problem, at least on unix-like
systems.
Incidentally, the game is the older chess program, tscp. There is a
text-graphics version, called tscp-tgfx.4th, on the kForth Programming Examples
Page. See also chessboard.4th, which uses mini-oof. The colors are probably not
the best for contrast, and this version hasn't been very well tested. I also did
not use the solution below, yet.
Krishna
|
| Show full article (1.46Kb) |
|
| | 27 Comments |
|
  |
Author: winston19842005winston19842005 Date: Nov 14, 2007 19:42
On 11/14/07 10:17 PM, in article 8TO_i.7164$A71.4303@ bignews9.bellsouth.net,
"Krishna Myneni" bellsouth.net> wrote:
>
> This problem came up in a game program. Given a set of words that output text,
> I
> want versions of the words that perform the same computations, but do not
> output
> anything to the console. Below...
|
| Show full article (1.09Kb) |
|
| | no comments |
|
  |
Author: Krishna MyneniKrishna Myneni Date: Nov 14, 2007 21:28
winston19842005 wrote:
>
>
> On 11/14/07 10:17 PM, in article 8TO_i.7164$A71.4303@ bignews9.bellsouth.net,
> "Krishna Myneni" bellsouth.net> wrote:
>
>> This problem came up in a game program. Given a set of words that output text,
>> I want versions of the words that perform the same computations, but do not
>> output anything to the console. ...
>>
>>
> In the olden days, didn't we just re-vector emit?
>
Assuming that all console output words are built upon EMIT, wouldn't
re-vectoring EMIT turn off output from all words, rather than just those we have
told to be quiet. Of course one could still use the same form of the solution
that I have described, in which the output redirection is replaced by
re-vectoring EMIT and restoring the original vector after the normal word has
executed.
|
| Show full article (0.92Kb) |
| no comments |
|
  |
Author: Stephen PelcStephen Pelc Date: Nov 15, 2007 02:46
On Wed, 14 Nov 2007 23:28:33 -0600, Krishna Myneni
bellsouth.net> wrote:
>Is re-vectoring of a CORE word possible to do in a common way, on ANS-type Forth
>systems?
The downside of revectoring or DEFERring KEY EMIT and friends
is that you have at least five USER variables if you have
multiple tasks. A more practical proposition is to have USER
variables (say) IP-DEV and OP-DEV which contain the address
of the I/O device table for input and output.
The device table can be very simple or expanded to handle
functions such as AT-XY and friends. The minimal set
is probably KEY KEY? EMIT TYPE and CR. This is enough
for most embedded apps, but the VFX vector array for
hosted systems has over 20 items, and the vector is
itself indirected through the table.
Making words "quiet" is then just a matter of defining
a dev_null or bitbucket device.
|
| Show full article (1.30Kb) |
| no comments |
|
  |
Author: Jean-François MichaudJean-François Michaud Date: Nov 15, 2007 07:24
On Nov 14, 7:17 pm, Krishna Myneni bellsouth.net>
wrote:
> This problem came up in a game program. Given a set of words that output text, I
> want versions of the words that perform the same computations, but do not output
> anything to the console. Below is given a kForth-specific solution to the
> problem, using the words >FILE and CONSOLE (which allow output redirection, and
> were included in LMI Forth). An existing word can be made quiet by declaring
>
> be-quiet wordname
>
> I wonder if there is a "common" solution to this problem, at least on unix-like
> systems.
>
> Incidentally, the game is the older chess program, tscp. There is a
> text-graphics version, called tscp-tgfx.4th, on the kForth Programming Examples
> Page. See also chessboard.4th, which uses mini-oof. The colors are probably not
> the best for contrast, and this version hasn't been very well tested. I also did
> not use the solution below, yet.
>
> Krishna ...
|
| Show full article (1.83Kb) |
| no comments |
|
  |
Author: Jerry AvinsJerry Avins Date: Nov 15, 2007 09:50
Krishna Myneni wrote:
> winston19842005 wrote:
>>
>> On 11/14/07 10:17 PM, in article 8TO_i.7164$A71.4303@ bignews9.bellsouth.net,
>> "Krishna Myneni" bellsouth.net> wrote:
>>
>>> This problem came up in a game program. Given a set of words that output text,
>>> I want versions of the words that perform the same computations, but do not
>>> output anything to the console. ...
>>>
>>>
>> In the olden days, didn't we just re-vector emit?
>>
>
> Assuming that all console output words are built upon EMIT, wouldn't
> re-vectoring EMIT turn off output from all words, rather than just those we have
> told to be quiet. Of course one could still use the same form of the solution
> that I have described, in which the output redirection is replaced by
> re-vectoring EMIT and restoring the original vector after the normal word has
> executed. ...
|
| Show full article (1.46Kb) |
| no comments |
|
  |
Author: Mikael NordmanMikael Nordman Date: Nov 15, 2007 11:09
Krishna Myneni wrote:
> This problem came up in a game program. Given a set of words that output text, I
> want versions of the words that perform the same computations, but do not output
> anything to the console. Below is given a kForth-specific solution to the
> problem, using the words >FILE and CONSOLE (which allow output redirection, and
> were included in LMI Forth). An existing word can be made quiet by declaring
>
> be-quiet wordname
>
> I wonder if there is a "common" solution to this problem, at least on unix-like
> systems.
>
> Incidentally, the game is the older chess program, tscp. There is a
> text-graphics version, called tscp-tgfx.4th, on the kForth Programming Examples
> Page. See also chessboard.4th, which uses mini-oof. The colors are probably not
> the best for contrast, and this version hasn't been very well tested. I also did
> not use the solution below, yet.
>
> Krishna
> ...
|
| Show full article (2.22Kb) |
| no comments |
|
  |
Author: Elizabeth D RatherElizabeth D Rather Date: Nov 15, 2007 12:02
Krishna Myneni wrote:
> This problem came up in a game program. Given a set of words that output text, I
> want versions of the words that perform the same computations, but do not output
> anything to the console. Below is given a kForth-specific solution to the
> problem, using the words >FILE and CONSOLE (which allow output redirection, and
> were included in LMI Forth). An existing word can be made quiet by declaring
>
> be-quiet wordname
>
> I wonder if there is a "common" solution to this problem, at least on unix-like
> systems.
...
Surely the most straightforward solution is simply to factor out the
computations into words that do no output and then (if you desire output
in some circumstances) use them in higher-level words that do output.
No redirection needed.
Cheers,
Elizabeth
|
| Show full article (1.19Kb) |
| no comments |
|
  |
Author: Jerry AvinsJerry Avins Date: Nov 15, 2007 14:08
Elizabeth D Rather wrote:
...
> Surely the most straightforward solution is simply to factor out the
> computations into words that do no output and then (if you desire output
> in some circumstances) use them in higher-level words that do output. No
> redirection needed.
I'm sure there's way to factor ' DUP . ' out of a word so ' . ' can
come later, but I don't see a simple one.
Jerry
--
Engineering is the art of making what you want from things you can get.
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
|
| |
| no comments |
|
  |
|
|
  |
Author: Krishna MyneniKrishna Myneni Date: Nov 15, 2007 15:46
Elizabeth D Rather wrote:
> Krishna Myneni wrote:
>> This problem came up in a game program. Given a set of words that
>> output text, I
>> want versions of the words that perform the same computations, but do
>> not output
>> anything to the console. Below is given a kForth-specific solution to the
>> problem, using the words >FILE and CONSOLE (which allow output
>> redirection, and
>> were included in LMI Forth). An existing word can be made quiet by
>> declaring
>>
>> be-quiet wordname
>>
>> I wonder if there is a "common" solution to this problem, at least on
>> unix-like
>> systems.
>
> ...
> ...
|
| Show full article (1.29Kb) |
| no comments |
|
RELATED THREADS |
  |
|
|
|
|
|