kerravon <> writes:
> On Friday, October 26, 2012 10:35:09 PM UTC+11, Ben Bacarisse wrote:
>> kerravon <> writes:
>>
>>
>>
>> > On Friday, October 26, 2012 8:29:49 AM UTC+11, Eric Sosman wrote:
>>
>> >> On 10/25/2012 5:11 PM, kerravon wrote:
>>
>> >>
>>
>> >> > The C89 Committee considered proposals to add the character constant '\e' to represent the
>> >> > ASCII ESC ('\033') character. This proposal was based upon the use of ESC as the initial
>> >> > character of most control sequences in common terminal driving disciplines such as ANSI
>> >> > X3.64. However, this usage has no obvious counterpart in other popular character codes such as
>> >> > EBCDIC.
>>
>> >> > That's where they wrote it - in the ANSI rationale.
>>
>> >> Yes, I know about the Rationale: I quoted this exact same
>> >> passage in a reply to you a couple days ago. But where does
>> >> this say "there is no escape in EBCDIC?"
>>
>> > They didn't use those exact words, but that is what
>> > is implied.
>>
>> Maybe, in the heat of your determination that something is very wrong
>> here, you just misread the paragraph?
>
> I don't think so. I've read it multiple times and I'm
> a native English speaker, and it implies to me that
> they're looking for an escape character in EBCDIC that
> would do the equivalent of the ASCII version.
Right. We are both reading the rationale the same way now. This is not
the same as "there is no escape in EBCDIC".
>> It says that it is "this usage"
>> not "this character" that has not obvious counterpart in EBCDIC.
>>
>> Now that may be wrong, but it is certainly consistent with what little I
>> remember about how IBM terminal equipment was driven. Maybe there is a
>> document you can point to that shows EBCDIC ESC (or, indeed, some other
>> character) being used as a control sequence prefix?
>
> 1. I don't think it should be necessary for equipment
> marketted by IBM to actually *use* the clearly-defined
> control character. The actual *use* of \e is determined
> by some coincidental marketing factors such as:
>
> A. Is EBCDIC used on mainframes or PCs?
> B. Are character-mode terminals efficient use of scarce
> mainframe cycles?
>
> 2. Here's what a mainframe expert said:
>
> If you look at BTAM, TCAM, or VTAM, you'll note that
> many terminal types use escape. In particular, the standard
> full-screen TPUT begins with hex 02,27,ccw,wcc,orders/text...
> where the 27 is an escape!
>
> 3. Here's what the IBM manual says:
>
> http://publibz.boulder.ibm.com/cgi-b...04072754&CASE=
>
> 1. If the first character in your message is an escape control
> character (X'27'), the two characters following it are treated as
> a command code and as a write control character by the 3270. Note
> that the command code should always be for a remote 3270. If
> necessary, TPUT will convert the code to that for a local 3270.
> If the first character is not an escape character, a default write
> command and a write control character are added to the beginning
> of the message. Any attachment-dependent characters required for
> correct transmission of the data stream are provided by the access
> method.
That seems a little too specific to be classed as a similar usage, but I
don't have the knowledge to evaluate it properly. If (and I think it's
a big if) this usage is almost universal among EBCDIC display devices
then I'd agree that the committee could have treated the two escapes as
having similar usage.
>> I don't see why this is such a big issue. Porting a display editor from
>> one environment to another is going to involve a considerable amount
>> re-writing. Having to define the value of ESC is going to be the most
>> trivial part of it, is it not?
>
> If micro-emacs cannot be written portably, for some
> yet-to-be-explained technical reason, then my Plan
> B is to write a replacement for micro-emacs that can
> theoretically be ported, even if I need to change/
> invent new hardware and change every operating system
> to cope with my use of the C language.
That's a very odd statement. My notion of portable software is software
that does not require new hardware and re-written operating systems to
run. In what sense would your editor be portable if I could not run it
without installing your changed OS and your newly invented hardware?
> I note that the MSDOS "edlin" program appears to be
> the sort of thing that is portable. So why not an
> editor that is better that edlin? Why is edlin the
> limit?
It isn't any kind of limit. For one thing edlin is not universally
portable -- I doubt it would have been possible to get anything even
remotely similar to run on the IBM RAX system that I first used.
Portability is a relative property not an absolute one. How portable do
you want your software to be[1] and to what systems? Once you have that
pinned down you can investigate the lowest common denominator of those
systems to see what you have to work with.
As Keith has pointed out, C alone does not give you enough to get very
far at all. Just getting un-buffered input requires more that C
provides, and controlling all the different terminal hardware out there
is well nigh impossible.
[1] By "how portable do you want your software to be" I mean, for
example, do you want exactly the same source to build and run on all
your targets, or will you accept some small effort of conversion? Will
you accept different build systems provided the source is unchanged?
and so on.
--
Ben.