00001
00002 c
00003 c Copyright (c) 1986,1987,1988,1989,1990,1991,1992,1993,
00004 c by Steve McMillan, Drexel University, Philadelphia, PA.
00005 c
00006 c All rights reserved.
00007 c
00008 c Redistribution and use in source and binary forms are permitted
00009 c provided that the above copyright notice and this paragraph are
00010 c duplicated in all such forms and that any documentation,
00011 c advertising materials, and other materials related to such
00012 c distribution and use acknowledge that the software was developed
00013 c by the author named above.
00014 c
00015 c THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
00016 c IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
00017 c WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00018 c
00019
00020 subroutine getline(inunit,line,nl,iprompt,nhist)
00021 save
00022 c
00023 character*(*)line
00024 character*80 scratch,format
00025 c
00026 character*80 device
00027 common/plot device/device,aspect,idev
00028 common /x input/ interact
00029 c
00030 character*20 version
00031 common /mcd version/ nversion,version
00032 c
00033 integer eof
00034 c
00035 eof = 0
00036 c
00037 12 if (inunit.eq.5.and.iprompt.eq.1) then
00038 write(scratch(1:6),'(i6)')nhist+1
00039 do 10012 i=1,6
00040 if (scratch(i:i).gt.' ')go to 10112
00041 10012 continue
00042 c
00043 10112 nfmt = 24-i+nversion
00044 format(1:nfmt) = '(''mcdraw-'
00045 &
00046 write(6,fmt=format(1:nfmt))
00047 end if
00048 c
00049 n_xopen = num_win(17)
00050 c
00051 c If n_xopen = 0, there aren't any X-windows to get input from, so
00052 c just default to standard FORTRAN input. Note that we can get
00053 c input from X even if another device is current.
00054 c
00055
00056 if (inunit.ne.5.or.n_xopen.le.0.or.interact.eq.0) then
00057 c
00058 call readin(inunit,line,nl,*20)
00059 c
00060 else
00061 c
00062 c Get input via X, keeping screen up to date.
00063 c
00064 call myflush(6)
00065 line = '\0'
00066 c
00067 call win_read_line(line)
00068 c
00069 do 15 nl=len(line),1,-1
00070 if (line(nl:nl).gt.' ') go to 16
00071 15 continue
00072 nl = 0
00073 16 continue
00074 end if
00075 c
00076 c The entire line is line(1:nl).
00077 c Comments start with a '#', all other lines must end in a blank.
00078 c
00079 if (nl.le.0.or.line(1:1).eq.'#') go to 12
00080 c
00081 nl=nl+1
00082 line(nl:nl)=' '
00083 return
00084 c
00085 20 if (inunit.ne.5) then
00086 close(inunit)
00087 inunit = 5
00088 else
00089 c
00090 c For now, an interactive ^D will terminate the program.
00091 c
00092 if (eof.ge.0) then
00093 line = 'q'
00094 nl = 1
00095 return
00096 end if
00097 eof = eof + 1
00098 end if
00099 go to 12
00100 c
00101 end