comp.lang.ada
 help / color / mirror / Atom feed
* Re: Examine my code!
       [not found] ` <3355E2D9.243@aonix.com>
@ 1997-04-17  0:00   ` Dale Stanbrough
  1997-04-17  0:00   ` No! Gautier
  1 sibling, 0 replies; 9+ messages in thread
From: Dale Stanbrough @ 1997-04-17  0:00 UTC (permalink / raw)



Robert Dewar writes:

"A somewhat cryptic post :-)
 
 Dale Stanbrough: >No!
 Dale"


:-) Ah, the toubles you have when you use good tools :-) My threaded 
newsreader quite ably showed this as a followup to a post entitled
"Examine my code!". Ah well, no more subject line jokes i suppose!

Dale :-)




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: No!
       [not found] ` <3355E2D9.243@aonix.com>
  1997-04-17  0:00   ` Examine my code! Dale Stanbrough
@ 1997-04-17  0:00   ` Gautier
  1997-04-17  0:00     ` No! Oliver Kellogg
  1 sibling, 1 reply; 9+ messages in thread
From: Gautier @ 1997-04-17  0:00 UTC (permalink / raw)



> Yes!

Me too.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: No!
  1997-04-17  0:00   ` No! Gautier
@ 1997-04-17  0:00     ` Oliver Kellogg
  0 siblings, 0 replies; 9+ messages in thread
From: Oliver Kellogg @ 1997-04-17  0:00 UTC (permalink / raw)



<segmentation fault, core dumped>




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Examine my code!
       [not found] <01bc49c1$c8c990a0$c47d8ea1@AaBbCcDd>
       [not found] ` <3355E2D9.243@aonix.com>
@ 1997-04-20  0:00 ` Nick Roberts
  1997-04-23  0:00   ` Centaury
  1997-04-24  0:00   ` Keith Thompson
  1997-04-29  0:00 ` Examine my code! Odo Wolbers
  2 siblings, 2 replies; 9+ messages in thread
From: Nick Roberts @ 1997-04-20  0:00 UTC (permalink / raw)





The answer is to use 

   Get_Line(Command);

instead of just

   get(command)

Reason why: things getting stuck in the buffer.

Nick.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Examine my code!
  1997-04-20  0:00 ` Examine my code! Nick Roberts
@ 1997-04-23  0:00   ` Centaury
  1997-04-24  0:00   ` Keith Thompson
  1 sibling, 0 replies; 9+ messages in thread
From: Centaury @ 1997-04-23  0:00 UTC (permalink / raw)



You can't get_line a variable, can you?
-- 
Please mail replies to :
utopian@pl.jaring.my






^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Examine my code!
  1997-04-20  0:00 ` Examine my code! Nick Roberts
  1997-04-23  0:00   ` Centaury
@ 1997-04-24  0:00   ` Keith Thompson
  1997-04-26  0:00     ` Text input on a console Nick Roberts
  1 sibling, 1 reply; 9+ messages in thread
From: Keith Thompson @ 1997-04-24  0:00 UTC (permalink / raw)



In <01bc4d85$4c127b40$f4f582c1@xhv46.dial.pipex.com> "Nick Roberts" <Nick.Roberts@dial.pipex.com> writes:
> The answer is to use 
> 
>    Get_Line(Command);
> 
> instead of just
> 
>    get(command)
> 
> Reason why: things getting stuck in the buffer.

That's the problem, but it's not the solution.

In the previously posted program, Command is an object of an enumeration
type.  There is no Get_Line procedure for enumeration types (though it
wouldn't be difficult to write one).

Take a look at the original program and consider exactly what happens
if the statement Get(Command) raises an exception.

The solution, of course, is left as an exercise for the student.

(I welcome e-mail feedback from educators on whether this is the right
level of response for this kind of question.)

-- 
Keith Thompson (The_Other_Keith) kst@sd.aonix.com <http://www.aonix.com> <*>
TeleSo^H^H^H^H^H^H Alsy^H^H^H^H Thomson Softw^H^H^H^H^H^H^H^H^H^H^H^H^H Aonix
5040 Shoreham Place, San Diego, CA, USA, 92122-5989
"Humor is such a subjective thing." -- Cartagia




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Text input on a console
  1997-04-24  0:00   ` Keith Thompson
@ 1997-04-26  0:00     ` Nick Roberts
  1997-04-27  0:00       ` Jerry van Dijk
  0 siblings, 1 reply; 9+ messages in thread
From: Nick Roberts @ 1997-04-26  0:00 UTC (permalink / raw)





Keith Thompson <kst@sd.aonix.com> wrote in article
<E961o5.AuL@thomsoft.com>...
> In <01bc4d85$4c127b40$f4f582c1@xhv46.dial.pipex.com> "Nick Roberts"
<Nick.Roberts@dial.pipex.com> writes:
> > The answer is to use 
> > 
> >    Get_Line(Command);
> > 
> > instead of just
> > 
> >    get(command)
> > 
> > Reason why: things getting stuck in the buffer.
> 
> That's the problem, but it's not the solution.
> 
> In the previously posted program, Command is an object of an enumeration
> type.  There is no Get_Line procedure for enumeration types (though it
> wouldn't be difficult to write one).


I blunder again. Sorry (the little yellow tablets strike again).

However, this does raise another point, of more general interest. The
behaviour of a program when inputting text from a console is relatively
undefined in Ada (as in most languages). It may be impracticable to try to
formally define things more closely (i.e. in the RM), but it may be
sensible to informally define things a little bit more than the RM,
somehow.

When GET is used to read a string, or other type, from the console, should
the program wait for a carriage-return ('cooked' or 'buffered' mode) or
just get the characters directly ('raw' mode)? Should special characters
(like backspace, control-D, control-Z, ESC, etc.) be automatically
supported? Should there be some agreed parameters in the FORM parameter to
specify this sort of thing? (And, in which case, what do we do about
STANDARD_INPUT?)

Comments welcome.

Nick.





^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Text input on a console
  1997-04-26  0:00     ` Text input on a console Nick Roberts
@ 1997-04-27  0:00       ` Jerry van Dijk
  0 siblings, 0 replies; 9+ messages in thread
From: Jerry van Dijk @ 1997-04-27  0:00 UTC (permalink / raw)



In article <01bc524d$a0fe21a0$28f982c1@xhv46.dial.pipex.com> Nick.Roberts@dial.pipex.com writes:

>However, this does raise another point, of more general interest. The
>behaviour of a program when inputting text from a console is relatively
>undefined in Ada (as in most languages). It may be impracticable to try to
>formally define things more closely (i.e. in the RM), but it may be
>sensible to informally define things a little bit more than the RM,
>somehow.

"Define informally" ?

Although I sympathize with the idea, how would one go about this ?

>When GET is used to read a string, or other type, from the console, should
>the program wait for a carriage-return ('cooked' or 'buffered' mode) or
>just get the characters directly ('raw' mode)?

Like Get vs Get_Immediate ?

The problem is of course how to go about it in a portable way as this is
purely OS dependend.

>Should special characters
>(like backspace, control-D, control-Z, ESC, etc.) be automatically
>supported?

As these are part of Latin-1 that shouldn't be much of a problem, but
how about Ctrl-Home or Gold-F1 ? Or are you talking about the Line Editing
features of the OS ?

> Should there be some agreed parameters in the FORM parameter to
>specify this sort of thing? (And, in which case, what do we do about
>STANDARD_INPUT?)

One solution might be the way C compilers for DOS solved it: using a special
Console I/O (conio) package. This could be in a special Annex, applicable
only to platforms that support terminal based or interactive I/O.

Since the IS Annex comes close to this, I wonder if such a package
(which would do wonders for the portability of console apps) has been
considered.

A good candidate would be a binding to termios, if it were supported
on all platforms (GNAT doesn't, it even can't agree on the implementation
of Get_Immediate between different ports...)

>Comments welcome.

You asked for it :-)

--

-- Jerry van Dijk       | Leiden, Holland
-- Business Consultant  | Team Ada
-- Ordina Finance       | jdijk@acm.org




^ permalink raw reply	[flat|nested] 9+ messages in thread

* Examine my code!
       [not found] <01bc49c1$c8c990a0$c47d8ea1@AaBbCcDd>
       [not found] ` <3355E2D9.243@aonix.com>
  1997-04-20  0:00 ` Examine my code! Nick Roberts
@ 1997-04-29  0:00 ` Odo Wolbers
  2 siblings, 0 replies; 9+ messages in thread
From: Odo Wolbers @ 1997-04-29  0:00 UTC (permalink / raw)



> SkipLine;
> 
> in this expression to throw away the Inputline like this:
> 
> exception
>      when data_error=>
>           put("Invalid command! Type help.");
>           newline;
>              SkipLine;
> end;  

Oops, where are the underscores?

I meant

Skip_Line;

and

New_Line;

ciao
Odo




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~1997-04-29  0:00 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <01bc49c1$c8c990a0$c47d8ea1@AaBbCcDd>
     [not found] ` <3355E2D9.243@aonix.com>
1997-04-17  0:00   ` Examine my code! Dale Stanbrough
1997-04-17  0:00   ` No! Gautier
1997-04-17  0:00     ` No! Oliver Kellogg
1997-04-20  0:00 ` Examine my code! Nick Roberts
1997-04-23  0:00   ` Centaury
1997-04-24  0:00   ` Keith Thompson
1997-04-26  0:00     ` Text input on a console Nick Roberts
1997-04-27  0:00       ` Jerry van Dijk
1997-04-29  0:00 ` Examine my code! Odo Wolbers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox