Re: Fortran write(print) problem
- From: Ron Shepard <ron-shepard@xxxxxxxxxxxxxxxxxx>
- Date: Sun, 28 Aug 2005 09:43:02 -0500
In article <des045$5m5$1@xxxxxxxxxxxxxxxxxxxx>,
Thomas Koenig <Thomas.Koenig@xxxxxxxxx> wrote:
> Brooks Moses <bmoses-nospam@xxxxxxxxxxxxxxxxxx> wrote:
> >Richard E Maine wrote:
> >> Although I agree (and have regularly said) that the general rule is that
> >> * formatting is for when you don't care about the details, this
> >> particular case is not even a matter where the compiler might or might
> >> not do what you want. In this case, the standard actually *REQUIRES*
> >> the compiler to do what you don't want (even if some compilers have been
> >> known to violate the standard). The reasons for that are historical.
>
> >If you don't mind the telling, I'd like to hear the historical reasons.
>
> The first character in a printed line was interpreted as a (hardware)
> carriage control character. ' ' meant a new line, '1' a new page,
> '+' overprinting, and possibly a few others that I've forgotten.
>
> The 'asa' utility on Unix systems is usually used to convert this to
> something more Unixish.
The other one that I remember was "0" for double spacing.
The American Standards Association (ASA) was formed in 1928 and
published standards for, among other things, electrical wiring
standards, photographic standards, and standards for bolts and
fasteners. As computing and information technology became more
popular over the following decades, it also published standards
related to that. One of those was the printer control convention
mentioned above. In 1968, ASA was renamed the American National
Standards Institute (ANSI), and it approved the 7-bit American
Standard Code for Information Interchange (ASCII) character set in
1968. There were many other computer character sets at that time,
including 8-bit EBCDIC and the 6-bit character sets used by Univac
and CDC. Early adopters of the ASCII character set included DEC,
which stored five 7-bit ASCII characters in each 36-bit word. Other
computer systems stored each 7-bit character in an 8-bit byte, which
also introduced compatibility problems over what exactly that extra
bit was supposed to do; some systems used it for parity checking,
others always set the extra bit either on or off, others used the
extra bit to extend the character set to 256 characters, and some
systems tried to do several of these in different contexts on the
same computer.
Fortran was originally designed to be consistent with the standard
ASA conventions for printed files and to be independent of the
underlying character set representation. That meant that list
directed formatting was required to begin each line with a space
(just in case it were to be printed on an ASA printer). This is
also why many fortran programs routinely insert spaces at the
beginning of even lines printed with explicit formats (e.g. formats
begin with 1x, or 1H , or ' ', or otherwise ensure that there will
be a blank space at the beginning). Unix and C were developed after
1969, so they broke with standards compliance and used the idea of
embedded control characters using the ASCII character set. Over
time, that convention (with some ambiguity about exactly how lines
are terminated, CR, CR+LF, or LF) replaced the ASA format first as
the de facto standard, and later as the actual standard (e.g. for
FTP file transfers and other contexts).
Mostly for compatibility reasons, i.e. historical reasons, modern
fortran standards have continued to require the space at the
beginning of each line in list directed output.
$.02 -Ron Shepard
.
- Follow-Ups:
- Re: Fortran write(print) problem
- From: glen herrmannsfeldt
- Re: Fortran write(print) problem
- References:
- Fortran write(print) problem
- From: Wang Jun
- Re: Fortran write(print) problem
- From: Brooks Moses
- Re: Fortran write(print) problem
- From: Richard E Maine
- Re: Fortran write(print) problem
- From: Brooks Moses
- Re: Fortran write(print) problem
- From: Thomas Koenig
- Fortran write(print) problem
- Prev by Date: Re: NLEQ1 and open source Fortran
- Next by Date: Re: Fortran write(print) problem
- Previous by thread: Re: Fortran write(print) problem
- Next by thread: Re: Fortran write(print) problem
- Index(es):
Relevant Pages
|