9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] fgetrune() ?
  2003-11-07 16:59 [9fans] fgetrune() ? Alberto Cortés
@ 2003-11-07 16:00 ` Russ Cox
  2003-11-07 17:33   ` Alberto Cortés
  0 siblings, 1 reply; 3+ messages in thread
From: Russ Cox @ 2003-11-07 16:00 UTC (permalink / raw)
  To: 9fans

> I was looking for some function like fgetc(2), but i want it to work on
> runes. Reading "man fgetc" i saw:
>
> BUGS
>  Stdio does not handle UTF or runes; use Bio instead.
>
> In bio(2) i found "Bgetrune(2)", but it does not do what i want, since
> "Bgetrune(2)" does not give you the rune *as* it is typed or pasted from
> mouse.
>
> So, what i am thinking wrong?

Rio (the window system) doesn't send any of the typed
characters until your press enter.  This means that,
for example, you can edit the line using the mouse
if you make an early mistake that takes a while to
notice.

If you really want to get characters as they are typed,
you need to put the console in raw mode, by writing
"rawon" to /dev/consctl and then keeping the file
descriptor for /dev/consctl open.

I believe that then Bgetrune will give you runes
as they come in.  However, you will be in charge
of echoing them to standard output.

Russ


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

* [9fans] fgetrune() ?
@ 2003-11-07 16:59 Alberto Cortés
  2003-11-07 16:00 ` Russ Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Alberto Cortés @ 2003-11-07 16:59 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 751 bytes --]

First of all, i am new to Plan9.

I was looking for some function like fgetc(2), but i want it to work on
runes. Reading "man fgetc" i saw:

BUGS
 Stdio does not handle UTF or runes; use Bio instead.

In bio(2) i found "Bgetrune(2)", but it does not do what i want, since
"Bgetrune(2)" does not give you the rune *as* it is typed or pasted from
mouse. 

So, what i am thinking wrong?


-- 
Alberto Cortés Martín     | Ing. en Telecomunicación
email: alcortes@coitt.es  | Universidad Carlos III
Jabber: alcortes43        | Madrid
ICQ#: 101088159           | Spain
MSN: fly you fools!       |
url: http://montoya.aig.uc3m.es/~acortes/index.html

gpg public key fingerprint:
 3399 329C 032C 5FCD A8D5  C7B8 DEC0 DF69 9EB7 C5A5


[-- Attachment #2: Type: application/pgp-signature, Size: 240 bytes --]

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

* Re: [9fans] fgetrune() ?
  2003-11-07 16:00 ` Russ Cox
@ 2003-11-07 17:33   ` Alberto Cortés
  0 siblings, 0 replies; 3+ messages in thread
From: Alberto Cortés @ 2003-11-07 17:33 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 1145 bytes --]

Some time ago, Russ said:

> Rio (the window system) doesn't send any of the typed
> characters until your press enter.  This means that,
> for example, you can edit the line using the mouse
> if you make an early mistake that takes a while to
> notice.

umm, now i understand. I was trying to get the design idea behind that
behaviour, i was sure that there where a very good reason for the lack
of fgetrune :)

> If you really want to get characters as they are typed,
> you need to put the console in raw mode, by writing
> "rawon" to /dev/consctl and then keeping the file
> descriptor for /dev/consctl open.
> 
> I believe that then Bgetrune will give you runes
> as they come in.  However, you will be in charge
> of echoing them to standard output.

thanks a lot.

-- 
Alberto Cortés Martín     | Ing. en Telecomunicación
email: alcortes@coitt.es  | Universidad Carlos III
Jabber: alcortes43        | Madrid
ICQ#: 101088159           | Spain
MSN: fly you fools!       |
url: http://montoya.aig.uc3m.es/~acortes/index.html

gpg public key fingerprint:
 3399 329C 032C 5FCD A8D5  C7B8 DEC0 DF69 9EB7 C5A5


[-- Attachment #2: Type: application/pgp-signature, Size: 240 bytes --]

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

end of thread, other threads:[~2003-11-07 17:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-07 16:59 [9fans] fgetrune() ? Alberto Cortés
2003-11-07 16:00 ` Russ Cox
2003-11-07 17:33   ` Alberto Cortés

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).