[comp.lang.fortran] {upper|lower}case

quan@sol.surv.utas.edu.au (Stephen Quan) (12/19/90)

dprpjf@inetg1.Arco.Com (Paul Fowler) writes:
>quan@sol.surv.utas.edu.au (Stephen Quan) writes:
>> You beauty!  This helps a great deal!  For instance, I've replaced 26
>> IF statements in my uppercase to lowercase conversion routine by one!
>                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> - Don't tell me there is an instrinic to do *that* already!
>> 

>If you did have an intrinsic to do case conversion, you could count on it not 
>being part of the ANSI/ISO Fortran77 standard - because lowercase letters
>are not part of the standard character set!  (Of course, if you were
>using C, you could use tolower(), but let's not start up THAT war again...)

I had a lousy, pain in the neck, search forever kind of bug which simply
turned out to be I was opening files with the letters in wrong cases.
ie. OPEN (11,FILE="XYZ") needed to be changed to OPEN (11,FILE="xyz").

The UNIX platform doesn't support standard Fortran very much does it?!
I suppose that Fortran was meant for systems where filenames were case
insensitive.

Stephen Quan,
University of Tasmania.

tholen@uhccux.uhcc.Hawaii.Edu (David Tholen) (12/19/90)

> If you did have an intrinsic to do case conversion, you could count on it not 
> being part of the ANSI/ISO Fortran77 standard - because lowercase letters
> are not part of the standard character set!  (Of course, if you were
> using C, you could use tolower(), but let's not start up THAT war again...)
 
Although it is true that only the 26 uppercase letters are in the so-called
FORTRAN character set, it is also true that comment lines "may contain any
character capable of representation in the processor in columns 2 through
72", and that character strings (constants and variables) "may consist of
any characters capable of representation in the processor".  Thus it is
perfectly standard to have an intrinsic function that operates on strings
that contain lowercase letters, assuming that lowercase letters can be
represented by the processor.  In fact, the LEN intrinsic function can
operate on strings containing lowercase letters, so there is no reason why
an uppercasing or lowercasing function could not be part of the ANSI standard.
I've written both uppercasing and lowercasing functions for my own library,
so I don't need to resort to C's tolower; it's easily accomplished in
standard conforming FORTRAN, though an intrinsic should be faster.

khb@chiba.Eng.Sun.COM (Keith Bierman fpgroup) (12/20/90)

In article <quan.661588125@sol> quan@sol.surv.utas.edu.au (Stephen Quan) writes:

...
   I had a lousy, pain in the neck, search forever kind of bug which simply
   turned out to be I was opening files with the letters in wrong cases.
   ie. OPEN (11,FILE="XYZ") needed to be changed to OPEN (11,FILE="xyz").

   The UNIX platform doesn't support standard Fortran very much does it?!

If the compiler and runtimes never allowed lower case, linkage to the
host OS (unix) would be so broken that few would be happy.

>   turned out to be I was opening files with the letters in wrong cases.

Upper case characters are perfectly allowed in Unix file names .... by
wrong do you mean that you were trying to read a file which had been
created outside of f77, with lowercase characters? If so, how is this
f77's fault ????

There are perfectly valid gripes about Unix, but this would not seem
to be one of them.

   I suppose that Fortran was meant for systems where filenames were case
   insensitive.

As pointed out by others, x3.9-1978 only _requires_ characters of a
single case. It permits others, and any OS which has them better have
appropriate language support .... as a quality of implementation issue.
--
----------------------------------------------------------------
Keith H. Bierman    kbierman@Eng.Sun.COM | khb@chiba.Eng.Sun.COM
SMI 2550 Garcia 12-33			 | (415 336 2648)   
    Mountain View, CA 94043