Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Jun 1998 21:07:40 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        vovik@ntu-kpi.kiev.ua (Vladimir A. Jakovenko)
Cc:        tlambert@primenet.com, freebsd-hackers@FreeBSD.ORG
Subject:   Re: getty issue file
Message-ID:  <199806162107.OAA23150@usr08.primenet.com>
In-Reply-To: <19980616224451.65299@NTU-KPI.Kiev.UA> from "Vladimir A. Jakovenko" at Jun 16, 98 10:44:51 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> > The point is that getline() will fail is there is more than 512 bytes
> > before the EOL (LF).
> > 
> 
> I'll see, sorry for my mistake :-(
> 
> In previous posting you said:
> 
> * This means you needs to ensure the terminal is in the base state before
> * doing the newline.  This is relatively easy to do, and won't damage the
> * ability to download the sixel based character sets.
> 
> so if I still need to load sixel fonts in getty, I have to add code to
> check if terminal in a base state, do newline, and send next data
> portion < 512, check base state, do newline, send data, etc ....
> 
> Can you point me how I can check is a terminal in the base state?

OK.  Terminals are finite state automatons.  They default to their
base state when powered on.  As you progress through an escape
sequence, they leave the base state for other states, and when
the sequence is completed, they return to the base state.  Consider
a simple parser for ANSI 3.64 escape sequences:

	state = 0;	/* set initial automaton state to base state*/

	for(;;) {
	    c = input_char();
	    switch( state) {
	    case 0:		/* base state*/
		switch( c) {
		case '\x1b':	/* escape*/
		    state = 1;
		    break;
		case '\b':	/* backspace*/
		    cursor( CD_LEFT,  1);
		    break;
		...
		default:
		    display_char( c);
		    break;
		}
		break;
	    case 1:		/* processing an escape sequence*/
		switch( c) {
		case '\x1b':	/* escape escape -- return to base state*/
		    state = 0;
		    break;
		case '[':	/* CSI*/
		   ...
	}
	...

As you can see, "base state" just means "not in the middle of a sequence".

For sixels, you send sequences of (from the comp.emulators.misc FAQ):


	<DCS Pfn ; Pcn ; Pec ; Pcmw ; Pw ; Pt ; Pcmh ; Pcss ; {
	 Dscs Sxbp1 ; Sxbp2 ; ... ; Sxbpn ST>

	fn : font number               0 or 1
	cn : starting character (position of first character sent
	     in character set)         0..95
	ec : erase control             0..2
	cmw: character matrix width    0..6
	w  : font width                0..2
	t  : text or full-cell         0..2
	cmh: character matrix height   0..12
	css: character set size        0..1
	Dscs:define character set name <"space"../ "space"../ F>
	Sxbpn: sixel bit patterns
	       <sixel ; sixel ; .. ; sixel / sixel ; ... >

So you get around the 512 byte limit by breaking up the sequence into
multiple sequences, with interspersed linefeeds for "getline", using the
"fn" and "cn" to download runs of characters.

This means you send:

	DCS ..... ST LF
	DCS ..... ST LF
	DCS ..... ST LF
	DCS ..... ST LF

Instead of:

	DCS ...................................................... ST


Note also that the pcvt console for FreeBSD supports sixel character
sets as well... it may be a way for you to unify all your character
set processing.


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806162107.OAA23150>