From: ucsbcsl!lemon.ucsb.edu@ucbvax.Berkeley.EDU (Maxwell Lee)
Subject: question about the fate of input stream after DATA_ERROR
Date: 7 Feb 93 00:28:00 GMT [thread overview]
Message-ID: <7600@ucsbcsl.ucsb.edu> (raw)
Hi, I have some ADA code which produces a strange result I can't understand
why. I'm wondering if someone out there in ADA-land can help me.
I have the following code:
type OPCODE is (I, S, Q, X);
CODE: OPCODE;
-------------------------------------------------
(in my main program)
with TEXT_IO; use TEXT_IO;
with INTEGER_IO; use INTEGER_IO;
package OPCODE_IO is new ENUMERATION_IO(OPCODE); use OPCODE_IO;
--------------------------------------------------
I simply want to perform a GET(CODE);
from standard-input.
When I enter an "i", "s", "q", "x", "I", "S", "Q", or "X" the command
works fine.
When I enter a number, say "1", a DATA_ERROR is raised, but the "1" is
left in the input stream (input buffer).
When I enter a character that's not an OPCODE, say an "m", a DATA_ERROR is
raised, but the "m" is removed from the input stream (input buffer) !!!
I understand why both a "1" or an "m" will produce DATA_ERROR, but
I don't understand why "1" will be left in the input stream, but "m"
will be removed from the input stream. I assumed that in both cases
it would be left in the input stream. Can someone help me?
Thank you.
**********************************************************************
"Mongo don't know .... Mongo only pawn in game of life."
(From the movie "Blazing Saddles")
maxwell@cs.ucsb.edu
**********************************************************************
next reply other threads:[~1993-02-07 0:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1993-02-07 0:28 Maxwell Lee [this message]
-- strict thread matches above, loose matches on Subject: below --
1993-02-08 18:23 question about the fate of input stream after DATA_ERROR Mark A Biggar
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox