M
Malcolm McLean
How widely supported are the escape ... m colour codes for text?
How widely supported are the escape ... m colour codes for text?
Malcolm McLean said:How widely supported are the escape ... m colour codes for text?
How widely supported are the escape ... m colour codes for text?
Then situation is that an embedded system running embedded Linux is spitting out ASCII text to a console which runs under Windows. I'm writing both the embedded side code to get the text, and the Windows side code to communicate with the device and read it. So the question is where to strip the escape sequences out. There's no option other than to hard-code them because I can't control the embedded side programs that are producing the output stream.There are enough exceptions that hard-coding those sequences can't be
explained as anything other than the programmer not knowing about termcap
or terminfo.
On a related note, even \r (carriage return), \b (backspace) and \a (bell)
aren't universally supported. And even where \r and \b are supported,
their behaviour differs between video and hardcopy terminals.
On a related note, even \r (carriage return), \b (backspace) and \a (bell)
aren't universally supported. ...
James Kuyper said:On 03/01/2013 07:29 AM, Nobody wrote:
If it's a conforming implementation of C, those characters must be
supported: "In the basic execution character set, there shall be control
characters representing alert, backspace, carriage return, and new
line." (5.2.1p3). If it's not a conforming implementation, there's no
limit to how far it's failure to conform can go, so there's not much
point in talking about it here. The associated semantics are covered by
5.2.2p2:
Then situation is that an embedded system running embedded Linux is
spitting out ASCII text to a console which runs under Windows. I'm
writing both the embedded side code to get the text, and the Windows
side code to communicate with the device and read it. So the question is
where to strip the escape sequences out. There's no option other than to
hard-code them because I can't control the embedded side programs that
are producing the output stream.
On 03/01/2013 07:29 AM, Nobody wrote: ...
If it's a conforming implementation of C, those characters must be
supported:
That only requires that the implementation map those sequences to the
appropriate codes in the platform's "native" encoding (e.g. 13, 8 and 7
respectively for ASCII, 13, 22 and 47 for EBCDIC).
The behaviour of terminals is outside the scope of the C standard.
That only requires that the implementation map those sequences to the
appropriate codes in the platform's "native" encoding (e.g. 13, 8 and 7
respectively for ASCII, 13, 22 and 47 for EBCDIC).
The behaviour of terminals is outside the scope of the C standard.
There are enough exceptions that hard-coding those sequences can't be
explained as anything other than the programmer not knowing about
termcap or terminfo.
Any Unix system will have either or both of those libraries.
The Windows console doesn't support escape sequences.
Then situation is that an embedded system running embedded Linux is
spitting out ASCII text to a console which runs under Windows. I'm
writing both the embedded side code to get the text, and the Windows
side code to communicate with the device and read it. So the
question is where to strip the escape sequences out.
Then situation is that an embedded system running embedded Linux is spitting out ASCII text to a console which runs under Windows. I'm writing both the embedded side code to get the text, and the Windows side code to communicate with the device and read it. So the question is where to strip the escape sequences out. There's no option other than to hard-code them because I can't control the embedded side programs that are producing the output stream.
The embedded side runs embedded Linux. Initially my console just supported passing comand line arguments to the shell, to be executed via popen().On Mar 1, 2:13 pm, Malcolm McLean <[email protected]>
my instinct would be to leave the embedded side to do its own thing
and process the data into something escape free on the host (is it
always going to be windows?) side.
I tend to hate implementation detail from the edges of the system
leaking into the core application. I've seen highly compressed radio
protocol values stored in server side RdBs and no one being able to
see a problem (until the bit representation on the air interface
changed...)
Although the 'alternate' interpretation of LF as NL was often an issueThe corresponding ASCII characters are reasonably well defined.
And HT, although the tab stops were manually set and often wrong.There is an EBCDIC backspace, so that should also work.
EBCDIC has CR, LF, and NL. I am not sure which one is used for '\n'
for EBCDIC C systems. I don't know of EBCDIC systems with a bell.
(There is a BEL control character, but I don't know what it does
on any system.)
The IBM 2741, the non-ASCII terminal most commonly used with IBM
mainframes, isn't EBCDIC. (It has its own character set based on
the position of the characters on the selectric type ball.)
As I remember, and as wikipedial says, there is no character
carriage return or bell character. There is BS, LF, and NL.
Although the 'alternate' interpretation of LF as NL was often an issue
-- quite a few terminals needed a switch/jumper/etc. for it.
And HT, although the tab stops were manually set and often wrong.
But I think 327X/328Xs were are at least as common as 2741's. And in
practice all EBCDIC, although theoretically there were ASCII models to
match S/360's not-really-usable PSW.ASCII bit.
327X displays use specialized meanings of DC1-4 ESC and I think one or
two other controls. 328X printers could just use 327X-style buffers,
or 'stream' data with IIRC FF CR LF NL but not BS VT. IDRC HT.
[...]glen herrmannsfeldt said:But even so, it was not for the usual ASCII-7 (seven bit ASCII that we
all know), but a proposed but never used ASCII-8. ASCII-8 is not just
ASCII-7 with additional characters, but half of the characters
(I haven't looked at a table recently) were moved up. ASCII mode changes
the zones generated by UNPK, and the signs generated by decimal
instructions. All sign values are allowed as input to decimal
instructions, independent of the bit. Rather than use the mode bit, it
is usual to just change them after they are generated.
It might be that if ASCII-8 was standardized at the right time, that
IBM would have converted all of OS/360 over. That is, before there was
any installed base outside IBM. There are comments in the source for
the PL/I (F) compiler and library, in each source file, indicating that
it is either independent of the source character set, or if converted
to a different character set, will assembler in that character set.
But even so, it was not for the usual ASCII-7 (seven bit ASCII that we
all know), but a proposed but never used ASCII-8. ASCII-8 is not just
ASCII-7 with additional characters, but half of the characters
(I haven't looked at a table recently) were moved up. ASCII mode changes
the zones generated by UNPK, and the signs generated by decimal
instructions. All sign values are allowed as input to decimal
instructions, independent of the bit. Rather than use the mode bit, it
is usual to just change them after they are generated.
It might be that if ASCII-8 was standardized at the right time, that
IBM would have converted all of OS/360 over. That is, before there was
any installed base outside IBM. There are comments in the source for
the PL/I (F) compiler and library, in each source file, indicating that
it is either independent of the source character set, or if converted
to a different character set, will assembler in that character set. [...]
Interesting. Do you have a reference for this proposed ASCII-8?
It turns out to be difficult to Google; most of the references I've
found incorrectly refer to things like Latin-1 or Windows-1252 as
"8-bit ASCII".
If ASCII-8 had caught on, with some common characters requiring 8
bits, I wonder if UTF-8 would have been possible.
Yes. AFAIK, no non-IBM ever did, but it's always possible there was
something obscure.
You can see IBM's ASCII assignments on page 141 of:
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.