From: Louis Krupp on
On 5/10/2010 11:31 PM, Uno wrote:
> Tobias Burnus wrote:
>
>> If I use the gfortran compiler, it shows the following errors:
>>
>>
>> CDsstr_unix.f:1558.29:
>>
>> If(Iprint.EQ.1)Print='PRNT'
>> 1
>> Error: Can't convert CHARACTER(1) to REAL(4) at (1)
>> CDsstr_unix.f:1985.19:
>>
>> facx= float(wavef-wavei)/60.0
>> 1
>> Error: 'a' argument of 'float' intrinsic at (1) must be INTEGER
>>
>>
>>
>> The first one is a non-standard use of Hollerith constants; I think the
>> quickest way to get it compiling it to use:
>>
>> If(Iprint.EQ.1) Print = transfer('PRNT',print)
>
> I can't imagine the circumstance when a person would have to work around
> a hollerith constant. If I read the wiki correctly, it would have been
> deprecated by the time f77 rolled along:
>
> http://en.wikipedia.org/wiki/Hollerith_constant
>
> Apparently, Hollerith is the guy who came up with punchcards:
>
> http://en.wikipedia.org/wiki/Herman_Hollerith

That's partly because 'PRNT' is not actually a Hollerith constant; it's
a character string constant. But the conversion problem is very, very
real. So to speak. Trust me.

(I would convert a four-byte string to a four-byte integer instead of a
four-byte real. But that's just me.)

Louis

From: glen herrmannsfeldt on
Uno <merrilljensen(a)q.com> wrote:
> Tobias Burnus wrote:

>> If I use the gfortran compiler, it shows the following errors:

>> If(Iprint.EQ.1)Print='PRNT'
>> 1
>> Error: Can't convert CHARACTER(1) to REAL(4) at (1)
(snip)

> I can't imagine the circumstance when a person would have to
> work around a hollerith constant. If I read the wiki correctly,
> it would have been deprecated by the time f77 rolled along:

It was depracated before being added to the standard.

Fortran 66 allows Hollerith constants (in the nH form) in
very limited places. A popular extension, including at
least IBM Fortran IV, uses the apostrophe form for both
Hollerith constants and a replacement for the H format
descriptor, but still restricts where they can be used.

I believe it was DEC (at least that is where I first saw
it done) that allowed their use as shown.

WATFIV had CHARACTER variables and constants back to about 1973,
but that would require the assignment to a CHARACTER variable.

-- glen
From: Uno on
Louis Krupp wrote:
> On 5/10/2010 11:31 PM, Uno wrote:
>> Tobias Burnus wrote:
>>
>>> If I use the gfortran compiler, it shows the following errors:
>>>
>>>
>>> CDsstr_unix.f:1558.29:
>>>
>>> If(Iprint.EQ.1)Print='PRNT'
>>> 1
>>> Error: Can't convert CHARACTER(1) to REAL(4) at (1)
>>> CDsstr_unix.f:1985.19:
>>>
>>> facx= float(wavef-wavei)/60.0
>>> 1
>>> Error: 'a' argument of 'float' intrinsic at (1) must be INTEGER
>>>
>>>
>>>
>>> The first one is a non-standard use of Hollerith constants; I think the
>>> quickest way to get it compiling it to use:
>>>
>>> If(Iprint.EQ.1) Print = transfer('PRNT',print)
>>
>> I can't imagine the circumstance when a person would have to work around
>> a hollerith constant. If I read the wiki correctly, it would have been
>> deprecated by the time f77 rolled along:
>>
>> http://en.wikipedia.org/wiki/Hollerith_constant
>>
>> Apparently, Hollerith is the guy who came up with punchcards:
>>
>> http://en.wikipedia.org/wiki/Herman_Hollerith
>
> That's partly because 'PRNT' is not actually a Hollerith constant; it's
> a character string constant. But the conversion problem is very, very
> real. So to speak. Trust me.
>
> (I would convert a four-byte string to a four-byte integer instead of a
> four-byte real. But that's just me.)

What can you possibly mean, Louis? That there's fortran worth compiling
when we didn't have a character data type? I rather doubt it.
--
Uno
From: glen herrmannsfeldt on
Uno <merrilljensen(a)q.com> wrote:
(snip, someone wrote)

>> (I would convert a four-byte string to a four-byte integer instead of a
>> four-byte real. But that's just me.)

> What can you possibly mean, Louis? That there's fortran worth compiling
> when we didn't have a character data type? I rather doubt it.

I wrote many character processing programs in the Fortran days
before CHARACTER. It isn't that hard to do, though I do agree
that in many cases it is easier with CHARACTER.

One that was done a few times in the Fortran 66 days was a
preprocessor for Fortran. RATFOR and MORTRAN as two examples.
I don't know RATFOR so well, but MORTRAN was written as a macro
processor, such that the actual Fortran program is fairly small,
with most of the complication done in macros.

-- glen
From: Uno on
glen herrmannsfeldt wrote:
> Uno <merrilljensen(a)q.com> wrote:
> (snip, someone wrote)
>
>>> (I would convert a four-byte string to a four-byte integer instead of a
>>> four-byte real. But that's just me.)
>
>> What can you possibly mean, Louis? That there's fortran worth compiling
>> when we didn't have a character data type? I rather doubt it.
>
> I wrote many character processing programs in the Fortran days
> before CHARACTER. It isn't that hard to do, though I do agree
> that in many cases it is easier with CHARACTER.
>
> One that was done a few times in the Fortran 66 days was a
> preprocessor for Fortran. RATFOR and MORTRAN as two examples.
> I don't know RATFOR so well, but MORTRAN was written as a macro
> processor, such that the actual Fortran program is fairly small,
> with most of the complication done in macros.

Do you ever link to a library that has hollerith constants?

It sounds like computer science archaelogy to me.
--
Uno