[comp.sys.atari.st] break

jdb9608@ultb.isc.rit.edu (J.D. Beutel) (05/05/90)

Does anybody know how break (i.e., ^C) works on the ST?
Is it something in TOS?  (I wouldn't think so since I don't
remember hearing about it, and I know some programs don't break.)
Is it done in each language?  For instance, does _main() in
Sozobon C scan stdin for ^C and _exit() if it sees it?
(I wouldn't think so since then everything would have to
worry about it.)

I'm asking because I'm toying with the idea of a vi-type
Korn shell based on RTX.  I like gu:lam but I don't like microEmacs,
and I miss multi-tasking and job control.  So, thinking about
device drivers, SIGSTOP, and the like, I really should understand ^C.
I suppose I could just have the cli slip in an isr to monitor
whatever tty-type input devices, and grap any ^Z that comes along,
but there'll probably be complications if I don't understand 
what else is going on.

Or, does Dave Beckmyer's (sp?) shell have vi-like command line editing,
and job control?  I haven't seen it, and from what I heard it's a C shell,
but if it does have those other features I'd hate to re-invent the wheel.
I've seen the RTX docs and have the highest respect for RTX's design
(it reminds me of the kernel my OS Lab team did).

-- 
--
J. David Beutel  11011011  jdb9608@cs.rit.edu      "I am, therefore I am."
Looking for co-op Sept..Feb in NN, OS, VR, or AI.

hyc@math.lsa.umich.edu (Howard Chu) (05/06/90)

In article <3060@ultb.isc.rit.edu> jdb9608@ultb.isc.rit.edu (J.D. Beutel) writes:
>
>Does anybody know how break (i.e., ^C) works on the ST?
>Is it something in TOS?  (I wouldn't think so since I don't
>remember hearing about it, and I know some programs don't break.)
>Is it done in each language?  For instance, does _main() in
>Sozobon C scan stdin for ^C and _exit() if it sees it?
>(I wouldn't think so since then everything would have to
>worry about it.)
>
Ctrl-C doesn't generate any special interrupt. The behavior of Ctrl-C
resides in the GEMDOS Cconin and Cconout routines. Thus, you can only
use Ctrl-C to terminate a program while it is reading or writing the
console.

>I'm asking because I'm toying with the idea of a vi-type
>Korn shell based on RTX.  I like gu:lam but I don't like microEmacs,
>and I miss multi-tasking and job control.  So, thinking about
>device drivers, SIGSTOP, and the like, I really should understand ^C.
>I suppose I could just have the cli slip in an isr to monitor
>whatever tty-type input devices, and grap any ^Z that comes along,
>but there'll probably be complications if I don't understand 
>what else is going on.
>
That sounds like the only way to do it.

>Or, does Dave Beckmyer's (sp?) shell have vi-like command line editing,
>and job control?  I haven't seen it, and from what I heard it's a C shell,
>but if it does have those other features I'd hate to re-invent the wheel.
>I've seen the RTX docs and have the highest respect for RTX's design
>(it reminds me of the kernel my OS Lab team did).

The manual for MT C Shell says there is full screen command-line editing.
It sounds pretty good. I haven't seen it yet, because the disk I received
was bad. The description of the built-in commands reads just like the BSD
C-Shell man page; most of the features are there. Unfortunately, unlike
the BSD shell, looping constructs are only usable in scripts. (So much for
aliases & such that do foreach and while loops...)

Meanwhile... Ctrl-C and Ctrl-Z are handled by the tty driver in Unix.
The MT C Shell manual makes no mention of using any special tty driver
with RTX. Wish I could run it right now and find out... (The disk is in
the mail?  }-)
--
  -- Howard Chu @ University of Michigan
  ... the glass is always greener on the side ...

roeder@sbsvax.cs.uni-sb.de (Edgar Roeder) (05/07/90)

In article <3060@ultb.isc.rit.edu>, jdb9608@ultb.isc.rit.edu (J.D. Beutel) writes:
> 
> Does anybody know how break (i.e., ^C) works on the ST?
> Is it something in TOS?  (I wouldn't think so since I don't
> remember hearing about it, and I know some programs don't break.)

Yes it is done by TOS. But only the GEMDOS functions Cconin/Cconrs/Cconout and
Cconws use it. If a program uses BIOS for terminal-i/o, it has to do the ^C
trapping itself.

> and I miss multi-tasking and job control.  So, thinking about
> device drivers, SIGSTOP, and the like, I really should understand ^C.

Have you seen the demo of Master? This shell has job-control (but no multi-
tasking). Jobs are created by system("-i") from C-Code, by 'if exec "-i"' in
a batchfile or you can start your program as 'program args |' and then input
'!-i<Return>' at the prompt after any full screen of output. Stopped jobs may
be restarted by '%<job-id>' in any order.

> I suppose I could just have the cli slip in an isr to monitor
> whatever tty-type input devices, and grap any ^Z that comes along,
> but there'll probably be complications if I don't understand 
> what else is going on.

The catch-program posted to comp.binaries.atari.st does it just this way. You
can install it in your auto-folder (catch.mmx has to be renamed to catch.prg)
and let it catch any ^C/^Z/^\-keypress at any time (even if your program is in
an endless loop). If ^C is pressed, you are asked wether you want to break or
continue. If ^Z is pressed, an eventually installed shell (at _shell_p) is
called interactively. See catch.doc for more uses of this program.
If you want to know more about ^C-trapping, you can also look up the
documentation for etv_term (the terminate-vector of GEMDOS).

> J. David Beutel  11011011  jdb9608@cs.rit.edu      "I am, therefore I am."

Hope this helps!

	- Edgar
-- 

Mail:  Edgar R\"oder			E-Mail: roeder@cs.uni-sb.de
       Liesbet-Dill-Stra\ss e 3
D-6602 Dudweiler                               -o-   -o-
       W-Germany                                   ^
Phone: 06897/74643                     	       	 '---'