Re: Re: A problem of character (Fortran)

Ron Hudson <[email protected]> Thu, 3 Jun 2010 16:53:48 -0700
Newsgroups gmane.comp.emulators.turnkey-mvs
Message-ID <[email protected]>
The four spaces between the characters is not bad - it makes the whole 8x8
look more square.


if I wanted to display the names of the devices (and their status)

Device 1 is the Warp Drive  'WDA'..

       LOGICAL*1 DEVNAME(3)

       IF (DEVICE .NE. 1) GOTO next device
       DEVNAME(1) = 230
       DEVNAME(2) = 196
       DEVNAME(3) = 193
       GOTO end
dev2 IF (DEVICE .NE. 2)....

WRITE ...  (DEVNAME(IC), IC=1,3)....

FORMAT ( ... 3A1...)

Would that work? looks a lot like yours.

devices are:
1 WDA  warp drive
2 IDA    impulse drive
3 LRS   long range sensors
4 SRS  short range sensors
5 PHO  photon torp.
6 PHA  phasers
7 DMG damage control
8 SHL   shields



On Thu, Jun 3, 2010 at 4:30 PM, Kevin Leonard <kl_j76-/[email protected]> wrote:

>
>
> > Um, but isn't that going to print with a lot of spaces (or
> > junk)? I'd go for setting the value in the high byte, and then
> > using A1
>
> That's what you have to do with FORTRAN IV. Manipulating
> character data wasn't exactly its strong point. I would
> end up using LOGICAL*1 variables as character, so as not
> to waste storage, something like:
>
> LOGICAL*1 C092 /'*'/
> LOGICAL*1 C096 /'-'/
> LOGICAL*1 C123 /'#'/
> LOGICAL*1 C078 /'+'/
> LOGICAL*1 C075 /'.'/
> LOGICAL*1 SRS(8)
>
> DO 2 J=1,8
> SRS(J) = C075
> IF (J .EQ. 1) SRS(J) = C092
> IF (J .EQ. 2) SRS(J) = C096
> IF (J .EQ. 3) SRS(J) = C123
> IF (J .EQ. 4) SRS(J) = C078
>
> 2 CONTINUE
> WRITE (6,900) (SRS(J), J=1,8)
> 900 FORMAT (' ', 8A1)
> STOP
> END
>
> which produces:
>
> *-#+....
>
> If you go that way, every character value needs to
> be predeclared in a DATA-type statement, because
> there's no way to assign a character value dynamically.
>
> --
> Kevin
>
>  
>