[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fortran




Yes, Paul is correct, I should have been more 
specific.  It's terminal input that seems to
cause problems.

I also assumed the original poster did not
want to edit the FORTRAN, as was my case.


Regards,

-bob



In article <3711EC13.7EF73D55@sandia.gov>,
> 
> I have been using an IDL / Fortran interface for over 10 years and had
> no problem with file I/O.
> I agree that using terminal I/O is to be avoided.  If you have a big
> Fortran library for file I/O, use it with no problems.  For terminal
> input, I have no suggestions other than returning to IDL.  For terminal
> output the IDL routine  IDL_Message can be easily linked to your
> Fortran.   A sample program which has
> been used with Sun, HP, SGI, DEC, MAC and WIN  is below.
> 
> Paul Mix, lpmix@sandia.gov
> 
> *deck idl_write
>       subroutine idl_write(INPUT, FLAG)
> cDEC$ ALIAS IDL_Message, '_IDL_Message'
> cDEC$ ATTRIBUTES C :: IDL_Message
> c
> c     This routine writes a string to an IDL display
> c
> c     If flag is zero, no leading characters will be printed.
> c       If flag is not zero, then the value of the IDL system variable
> c          !MSG_PREFIX will be printed. (Default value = '% ')
> c
>       CHARACTER *(*) INPUT
>       CHARACTER *1 CHAR
>       INTEGER FLAG
>       INTEGER I, LEN, DONE
>       INTEGER MAXLEN
>       PARAMETER (MAXLEN=512)
>       CHARACTER*(MAXLEN) TEMP
> C   Some Fortran compilers require external definitions for IDL routines
> 
>       EXTERNAL IDL_Message !$pragma C(IDL_Message)
> C     check the length and set the last character to a char(0)
>       I = LEN(INPUT)
>       DONE = 0
>       DO WHILE (I .GT. 0 .AND. DONE .EQ. 0)
>         IF (ICHAR(INPUT(I:I)) .GE. 33 .AND.
>      &    ICHAR(INPUT(I:I)) .LE. 126) THEN
>           DONE = 1
>         ELSE
>           I = I-1
>         ENDIF
>       ENDDO
> 
>       IF (I .GT. 0) THEN
>         IF (I .GE. MAXLEN) I = MAXLEN-1
>         TEMP = INPUT(1:I)//CHAR(0)
>       ELSE
>         TEMP = ' '//CHAR(0)
>       ENDIF
>       IF (FLAG .EQ. 0) THEN
>         CALL IDL_Message(%VAL(-1), %VAL(262144), %REF(TEMP))
>       ELSE
>         CALL IDL_Message(%VAL(-1), %VAL(0), %REF(TEMP))
>       ENDIF
> c **********************************************************************
> 
>       RETURN
>       END
> 
> 

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Robert S. Mallozzi                                       256-544-0887
                                                      Mail Code ES 84
Work: http://www.batse.msfc.nasa.gov/    Marshall Space Flight Center 
Play: http://cspar.uah.edu/~mallozzir/           Huntsville, AL 35812
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~