[net.info-terms] need termcap/cm help - tvi955

david@varian.UUCP (David Brown) (08/29/85)

We just received some TeleVideo 955 terminals -- this a new model -- cheap
(~$400) and loaded with features -- 80/132 columns, embedded or non-embedded
attributes, programmable function keys, 14" screen in green or amber, etc.
So far we're happy with them, but I've run into a problem in creating a
termcap for them.

What I've done so far (for those with similar terminals):
	I used the tvi950 termcap and removed vb (visual bell), is (init
	string), vs, ve (vi start and end sequence) because I didn't like
	what they did.   I also deleted ug and sg (underline and standout
	mode glitch count) and added xs because I want to use no-space
	attributes.

The problem:
	cursor motion (cm)!
	For columns 1 through 80, the cursor motion is the same as for other
	TeleVideo terminals (and many other terminals as well) -- 
		cm = \E=%+\040%+\040
		(ESC = r c,  where row and column are added to space to
		make them printable).

	BUT .. for columns 81 through 132, the sequence is:
		ESC = r ~ c
		and the value of c is calculated by subtracting 80 from
		the column number and then adding space.

This is the first time I've seen a cursor motion sequence like this, and I
can't find anyway to specify something like this.  Does anyone have any
ideas?  Or is this something that termcap can't handle without modifications
(adding new definitions to termcap and adding new code to termlib/tgoto)?

The closest thing to what I need is the %> specification to cm, but I
don't think it does exactly what I need (I might be able to modify a
value if it's greater than some constant, but how does it know when to
output the tilde?).


-- 
	David Brown	 (415) 945-2199
	Varian Instruments 2700 Mitchell Dr.  Walnut Creek, Ca. 94598
	{zehntel,dual,amd,fortune,rtech}!varian!david

gwyn@brl-tgr.ARPA (Doug Gwyn <gwyn>) (09/02/85)

> 	For columns 1 through 80, the cursor motion is the same as for other
> 	TeleVideo terminals (and many other terminals as well) -- 
> 		cm = \E=%+\040%+\040
> 		(ESC = r c,  where row and column are added to space to
> 		make them printable).
> 
> 	BUT .. for columns 81 through 132, the sequence is:
> 		ESC = r ~ c
> 		and the value of c is calculated by subtracting 80 from
> 		the column number and then adding space.
> 
> This is the first time I've seen a cursor motion sequence like this, and I
> can't find anyway to specify something like this.  Does anyone have any
> ideas?  Or is this something that termcap can't handle without modifications
> (adding new definitions to termcap and adding new code to termlib/tgoto)?

Nope, termcap is incapable of handling this.  Use terminfo,
or restrict your use of the TVI 955 to 80 columns.

hansen@pegasus.UUCP (Tony L. Hansen) (09/11/85)

< We just received some TeleVideo 955 terminals -- this a new model -- cheap
< ...
< The problem:
< 	cursor motion (cm)!
< 	For columns 1 through 80, the cursor motion is the same as for other
< 	TeleVideo terminals (and many other terminals as well) -- 
< 		cm = \E=%+\040%+\040
< ...
< 	BUT .. for columns 81 through 132, the sequence is:
< 		ESC = r ~ c
< 		and the value of c is calculated by subtracting 80 from
< 		the column number and then adding space.

Such a sequence cannot be done with termcap as it currently exists. Your best
bet is, if you can't switch to terminfo, to run the terminal exclusively in
80 column mode and forget 132 column mode.

It is exactly for reasons such as this that the stack architecture used by
terminfo was introduced. With termcap, everytime a new addressing scheme
came out which didn't match a previous scheme, new code had to be written
for libtermlib.a and the world relinked with the new library. With terminfo,
the format is encoded entirely within the string and instantiated at runtime.

Hence, to program the above sequence in terminfo:

    cup=\E=%p1%' '%+%c%p2%?%{80}%>%t%p2~%{48}%-%c%e%p2%' '%+%c%;,

If you're not familiar with what this means, a breakdown follows.

					Tony Hansen
					ihnp4!pegasus!hansen

    cup=\E=%p1%' '%+%c%p2%?%{80}%>%t%p2~%{48}%-%c%e%p2%' '%+%c%;,
	^  ^  ^   ^ ^ ^  ^ ^    ^ ^ ^  ^^    ^ ^ ^ ^  ^   ^ ^ ^
	1  2  3   4 5 6  7 8    9 a b  cd    e f g h  i   j k l

    1) output ESC =
    2) push the first parameter, the row, onto the stack
    3) push a space onto the stack
    4) add the row and space
    5) output the sum as a character
    6) push the second parameter, the column, onto the stack
    7) if
    8)     push 80 onto the stack
    9)     compare: row > 80?
    a) then
    b)     push the column back onto the stack
    c)     output '~'
    d)     push 48 onto the stack (80 - 040)
    e)     subtract (col - 80 + 040)
    f)     output the difference as a character
    g) else
    h)     push the column back onto the stack
    i)     push a space onto the stack
    j)     add the column and the space
    k)     output the sum as a character
    l) fi