13 INTEGER,
PARAMETER ::
fddim = 9999
16 INTEGER,
DIMENSION(FDDIM),
SAVE::
fd =
fddim*0
20 INTEGER,
DIMENSION(20),
SAVE::
baopts = 0
46 integer function baciol(mode, start, size, no, nactual, &
47 fdes, fname, datary)
bind(C)
48 use,
intrinsic :: iso_c_binding
49 integer(c_int),
value,
intent(in) :: mode
50 integer(c_long),
value,
intent(in) :: start
51 integer(c_int),
value,
intent(in) :: size
52 integer(c_long),
value,
intent(in) :: no
53 integer(c_long),
intent(inout) :: nactual
54 integer(c_int),
intent(inout) :: fdes
55 character(kind=C_char),
intent(in) :: fname(*)
56 character(kind=C_char),
intent(in) :: datary(*)
82 IF (nopt .GE. 1 .AND. nopt .LE. 20)
baopts(nopt) = vopt
95 use iso_c_binding,
only: c_null_char
97 INTEGER,
intent(in) :: LU
98 CHARACTER,
intent(in) :: CFN*(*)
99 INTEGER,
intent(out) :: IRET
100 integer(kind=8) IB, NB, KA
103 IF (lu .LT. 001 .OR. lu .GT.
fddim)
THEN
109 trim(cfn)//c_null_char, a)
122 use iso_c_binding,
only: c_null_char
124 INTEGER,
intent(in) :: LU
125 CHARACTER,
intent(in) :: CFN*(*)
126 INTEGER,
intent(out) :: IRET
127 integer(kind=8) IB, NB, KA
130 IF (lu .LT. 001 .OR. lu .GT.
fddim)
THEN
136 trim(cfn)//c_null_char, a)
149 use iso_c_binding,
only: c_null_char
151 INTEGER,
intent(in) :: LU
152 CHARACTER,
intent(in) :: CFN*(*)
153 INTEGER,
intent(out) :: IRET
154 integer(kind=8) IB, NB, KA
157 IF (lu .LT. 001 .OR. lu .GT.
fddim)
THEN
163 trim(cfn)//c_null_char, a)
176 use iso_c_binding,
only: c_null_char
178 INTEGER,
intent(in) :: LU
179 CHARACTER,
intent(in) :: CFN*(*)
180 INTEGER,
intent(out) :: IRET
181 integer(kind=8) IB, NB, KA
184 IF (lu .LT. 001 .OR. lu .GT.
fddim)
THEN
190 trim(cfn)//c_null_char, a)
203 use iso_c_binding,
only: c_null_char
205 INTEGER,
intent(in) :: LU
206 CHARACTER,
intent(in) :: CFN*(*)
207 INTEGER,
intent(out) :: IRET
208 integer(kind=8) IB,JB,NB,KA
211 IF (lu .LT. 001 .OR. lu .GT.
fddim)
THEN
217 trim(cfn)//c_null_char, a)
229 INTEGER,
intent(in) :: LU
230 INTEGER,
intent(out) :: IRET
231 integer(kind=8) IB, NB, KA
234 IF (lu .LT. 001 .OR. lu .GT.
fddim)
THEN
240 IF (iret .EQ. 0)
fd(lu) = 0
274 INTEGER,
INTENT(IN) :: LU, IB, NB
275 INTEGER,
INTENT(OUT) :: KA
276 CHARACTER,
INTENT(OUT) :: A(NB)
277 INTEGER(KIND=8) :: LONG_IB, LONG_NB, LONG_KA
280 print *,
'WRONG: in BAREAD read data size NB < 0, STOP! '//&
281 'Consider using BAREADL and long integer'
287 CALL bareadl(lu, long_ib, long_nb, long_ka, a)
324 INTEGER,
intent(in) :: LU
325 INTEGER(kind=8),
intent(in) :: IB,NB
326 INTEGER(kind=8),
intent(out) :: KA
327 CHARACTER,
intent(out) :: A(NB)
328 integer(kind=8),
PARAMETER :: NY=4096, my=4
329 INTEGER(KIND=8) NS(MY), NN(MY)
330 INTEGER(kind=8) LONG_0, KY, I, K, IY, JY, LUX
334 SAVE jy, ns, nn, y, lux
336 IF (lu .LT. 001 .OR. lu .GT.
fddim)
THEN
340 IF (
fd(lu) .LE. 0)
THEN
344 IF (ib .LT. 0 .AND.
baopts(1) .EQ. 1)
THEN
356 IF (
baopts(1) .NE. 1)
THEN
369 IF (lux .NE. lu)
THEN
375 iy = mod(jy + i - 1, my) + 1
376 ky = ib + ka - ns(iy)
377 IF (ka .LT. nb .AND. ky .GE. long_0 .AND. ky .LT. nn(iy))
THEN
378 k = min(nb - ka, nn(iy) - ky)
379 a(ka + 1:ka + k) = y(ky + 1:ky + k, iy)
391 fd(lux), char(0), y(1, jy))
392 IF (nn(jy).GT.0)
THEN
393 k = min(nb-ka, nn(jy))
394 a(ka+1:ka+k) = y(1:k, jy)
399 DO WHILE(nn(jy).EQ.ny.AND.ka.LT.nb)
401 ns(jy) = ns(jy)+nn(jy)
403 fd(lux), char(0), y(1, jy))
404 IF (nn(jy).GT.0)
THEN
405 k = min(nb-ka, nn(jy))
406 a(ka+1:ka+k) = y(1:k, jy)
428 INTEGER,
INTENT(IN) :: LU, IB, NB
429 INTEGER,
INTENT(OUT) :: KA
430 CHARACTER,
INTENT(IN) :: A(NB)
431 INTEGER(KIND = 8) :: LONG_IB, LONG_NB, LONG_KA
434 print *,
'WRONG: in BAWRITE read data size NB <0, STOP! '//&
435 'Consider using BAWRITEL and long integer'
442 CALL bawritel(lu, long_ib, long_nb, long_ka, a)
459 INTEGER,
intent(in) :: LU
460 INTEGER(kind = 8),
intent(in) :: IB, NB
461 INTEGER(kind = 8),
intent(out):: KA
462 CHARACTER,
intent(in) :: A(NB)
463 INTEGER(kind = 8) :: LONG_0
466 IF (lu .LT. 001 .OR. lu .GT.
fddim)
THEN
470 IF (
fd(lu) .LE. 0)
THEN
512 INTEGER,
intent(in) :: LU
513 INTEGER,
intent(in) :: NB
514 CHARACTER,
intent(in) :: A(NB)
515 INTEGER(kind = 8) :: LONG_NB
518 print *,
'WRONG: NB: the number of bytes to write <0, STOP!'
522 CALL wrytel(lu, long_nb, a)
544 INTEGER,
intent(in) :: LU
545 INTEGER(kind = 8),
intent(in) :: NB
546 CHARACTER,
INTENT(in) :: A(NB)
547 INTEGER(kind = 8) :: LONG_0, KA
550 IF (lu .LT. 001 .OR. lu .GT.
fddim)
THEN
554 IF (
fd(lu) .LE. 0)
THEN
subroutine baopen(LU, CFN, IRET)
Open a byte-addressable file.
subroutine wrytel(LU, NB, A)
Write a given number of bytes to an unblocked file.
subroutine baseto(NOPT, VOPT)
Set options for byte-addressable I/O.
subroutine bawritel(LU, IB, NB, KA, A)
This subrouytine writes a given number of bytes to an unblocked file, skipping a given number of byte...
subroutine baread(LU, IB, NB, KA, A)
This subroutine calls bareadl() to read a given number of bytes from an unblocked file,...
subroutine baopenwt(LU, CFN, IRET)
Open a byte-addressable file for write only with truncation.
subroutine bareadl(LU, IB, NB, KA, A)
This subrouytine is using updated baciol() I/O package to read a given number of bytes from an unbloc...
subroutine wryte(LU, NB, A)
This subroutine is calling wrytel() to write a given number of bytes to an unblocked file.
subroutine baopenwa(LU, CFN, IRET)
Open a byte-addressable file for write only with append.
subroutine baopenw(LU, CFN, IRET)
Open a byte-addressable file for write only.
subroutine baclose(LU, IRET)
Close a byte-addressable file.
subroutine bawrite(LU, IB, NB, KA, A)
This program is calling bawritel() to write a given number of bytes to an unblocked file,...
subroutine baopenr(LU, CFN, IRET)
Open a byte-addressable file for read only.
Contains subroutines to read/write binary files.
integer, parameter bacio_openwt
Open for write only with truncation.
integer, parameter bacio_openwa
Open for write only with append.
integer, parameter bacio_read
Read from the file.
integer, parameter bacio_write
Write to the file.
integer, parameter bacio_openr
Open file for read only.
integer, dimension(fddim), save fd
Array IDs of currently open files.
integer, parameter bacio_close
Close file.
integer, parameter fddim
Maximum number of open files in bacio library.
integer, parameter bacio_noseek
Start I/O from previous spot.
integer, parameter bacio_openw
Open file for write only.
integer, parameter bacio_openrw
Open file for read or write.
integer, dimension(20), save baopts
Array of option settings.