9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Implementing cooked mode
@ 2006-12-21  0:54 Joel Salomon
  2006-12-21  1:08 ` Russ Cox
  2006-12-21  2:27 ` [9fans] " Joel Salomon
  0 siblings, 2 replies; 8+ messages in thread
From: Joel Salomon @ 2006-12-21  0:54 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

If a program has the console in raw mode, can it erase characters or
words that it has echoed to the screen?

Context is a homework assignment to implement cooked mode in user
space.  The code in /sys/src/cmd/rio/wind.c looks to be a start, but I
don't see how to remove characters from the screen.  I suppose I could
use string() in libdraw and draw the string graphically rather than
echoing.  Rio's wind.c and acme's text.c both handle the various
control characters, but they aren't pretending to write to the
console.

Nemo's book has a similar assignment, so it seems to be doable; I just
haven't found how in the manual.

Failing that, are there printable glyphs shown if control characters
are write()n to the console?

--Joel


^ permalink raw reply	[flat|nested] 8+ messages in thread
* Re: [9fans] Implementing cooked mode
@ 2006-12-21  1:37 erik quanstrom
  2007-02-15 17:44 ` Harri Haataja
  0 siblings, 1 reply; 8+ messages in thread
From: erik quanstrom @ 2006-12-21  1:37 UTC (permalink / raw)
  To: joelcsalomon, 9fans

russ is right.  raw mode on the console is really raw.  control
characters are printed out.  if you've got a pc, you'll see ibm-432
characters.

plan 9 has a different attitude about the console than linux.
one can't interrupt a program running at a console.  the console
is there for bringing a machine up.  nobody wants to work at the
console.

rio really does implement raw mode in userspace.  just because it's
doing things with string() -- "graphically" -- instead of opening up /dev/x
and using write(2) on that device doesn't make it less of a raw
interface in userspace.  in fact, string(2) is using write on /dev/draw
under the covers.

compare pc/cga.c with what rio does with the screen.  the main
difference is that the byte value is written to a memory location
in cga.c whereas rio needs to write a raster image to a block of
memory.  logically, it's a similar operation. ...

just because you're not bit-banging the 8042 and moving bytes
into the cga window, doesn't mean it's not in "raw" mode. ;-)

- erik

On Wed Dec 20 19:55:34 EST 2006, joelcsalomon@gmail.com wrote:
> If a program has the console in raw mode, can it erase characters or
> words that it has echoed to the screen?
> 
> Context is a homework assignment to implement cooked mode in user
> space.  The code in /sys/src/cmd/rio/wind.c looks to be a start, but I
> don't see how to remove characters from the screen.  I suppose I could
> use string() in libdraw and draw the string graphically rather than
> echoing.  Rio's wind.c and acme's text.c both handle the various
> control characters, but they aren't pretending to write to the
> console.
> 
> Nemo's book has a similar assignment, so it seems to be doable; I just
> haven't found how in the manual.
> 
> Failing that, are there printable glyphs shown if control characters
> are write()n to the console?
> 
> --Joel



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

end of thread, other threads:[~2007-02-15 17:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-21  0:54 [9fans] Implementing cooked mode Joel Salomon
2006-12-21  1:08 ` Russ Cox
2006-12-21  1:47   ` Russ Cox
2006-12-21 12:50     ` Brantley Coile
2006-12-21  2:27 ` [9fans] " Joel Salomon
2006-12-21  4:01   ` Russ Cox
2006-12-21  1:37 [9fans] " erik quanstrom
2007-02-15 17:44 ` Harri Haataja

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).