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 subroutine readall(lunit,string,i1,i2,x,n,nhead,nmax, 00020 1 iprompt,*) 00021 save 00022 c 00023 c Read the array x from the specified logical unit, without worrying 00024 c about columns of data. 00025 c 00026 character*(*) string 00027 character*400 line 00028 character*50 list(100) 00029 dimension x(1) 00030 character*1 dummy 00031 c 00032 if (i1.le.i2) then 00033 nin = 0 00034 call readiq(string(i1:i2),1, 00035 & nin,idum,idum,idum,*10) 00036 nin = min(nin,nmax) 00037 else 00038 nin = 0 00039 end if 00040 c 00041 c Skip a header, if necessary. 00042 c 00043 10 rewind lunit 00044 do 20 i=1,nhead 00045 20 read(lunit,'(a)')dummy 00046 c 00047 if (nin.gt.0) then 00048 read(lunit,*,err=999,end=999)(x(i),i=1,min(nmax,nin)) 00049 if (nin.gt.nmax.and.iprompt.ne.0) write(6,'(a)') 00050 1 'Maximum number of points reached.' 00051 n = nin 00052 else 00053 c 00054 c Note: specifying no number reads data the "smart but slow" way. 00055 c 00056 n = 0 00057 30 read(lunit,'(a)',err=50,end=50)line 00058 call gettokens(line,list,nlist) 00059 do i=1,nlist 00060 read(list(i),*,err=50,end=50)xx 00061 if (n.ge.nmax) then 00062 if (iprompt.ne.0) write(6,'(a)') 00063 1 'Maximum number of points reached.' 00064 go to 50 00065 end if 00066 n = n + 1 00067 x(n) = xx 00068 end do 00069 go to 30 00070 end if 00071 c 00072 50 if (iprompt.ne.0) write(6,*)n,' points read' 00073 return 00074 c 00075 999 if (iprompt.ne.0) write(6,*)'Error reading input file' 00076 return 1 00077 end