Skip to contentSkip to conversation

vcsa and big endian

DISCUSSION Samuel Thibault 2 participants 4 messages Dec 9, 2007 – Dec 15, 2007

lore
Share & tools
lore
#0 lore raw

Hello,

On big endian machines, /dev/vcsa stores text/attribute bytes in big endian order, while it stores them in little endian order on little endian machines. Is that expected?

Samuel

#1 lore raw
Quoted 3 lines · Samuel Thibault, le Sun 09 Dec 2007 23:43:49 +0100, a écrit :

On big endian machines, /dev/vcsa stores text/attribute bytes in big endian order, while it stores them in little endian order on little endian machines. Is that expected?

It looks like ggi considers this as normal. In any case, the vcsa manual page should probably be made more clear ("but including attributes" -> "but using unsigned shorts that include attributes" for instance).

Samuel

#2 lore raw
Quoted 9 lines · Samuel Thibault, le Sun 09 Dec 2007 23:50:39 +0100, a écrit :
Quoted 3 lines · Samuel Thibault, le Sun 09 Dec 2007 23:43:49 +0100, a écrit :

On big endian machines, /dev/vcsa stores text/attribute bytes in big endian order, while it stores them in little endian order on little endian machines. Is that expected?

It looks like ggi considers this as normal. In any case, the vcsa manual page should probably be made more clear ("but including attributes" -> "but using unsigned shorts that include attributes" for instance).

And the code example should be fixed too:

	   char ch, attrib;

           (void) read(fd, &ch, 1);
           (void) read(fd, &attrib, 1);

should rather be

	   unsigned short s;
	   unsigned char ch, attrib;

	   ...

           (void) read(fd, &s, 2);
	   ch = s & 0xff;
	   attrib = (s >> 8);

The manual page should also mention that when a 512 chars font is loaded, the 9th bit is in the attrib value, and its position can be fetched through the VT_GETHIFONTMASK ioctl.

Samuel

#3 lore raw
In reply to Samuel Thibault
Quoted 9 lines · Samuel Thibault
Quoted 3 lines · Samuel Thibault, le Sun 09 Dec 2007 23:43:49 +0100, a écrit :

On big endian machines, /dev/vcsa stores text/attribute bytes in big endian order, while it stores them in little endian order on little endian machines. Is that expected?

It looks like ggi considers this as normal. In any case, the vcsa manual page should probably be made more clear ("but including attributes" -> "but using unsigned shorts that include attributes" for instance).

I'd say you need stronger warning than that, "warning, vcsa is in host byte endianity" or something.

Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html