Go to the documentation of this file.
13 INTEGER,
PARAMETER ::
fddim = 9999
16 INTEGER,
DIMENSION(FDDIM),
SAVE::
fd =
fddim*0
20 INTEGER,
DIMENSION(20),
SAVE::
baopts = 0
46 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(*)
78 SUBROUTINE baseto(NOPT, VOPT)
83 IF (nopt .GE. 1 .AND. nopt .LE. 20)
baopts(nopt) = vopt
107 SUBROUTINE baopen(LU, CFN, IRET)
109 use iso_c_binding,
only: c_null_char
111 INTEGER,
intent(in) :: LU
112 CHARACTER,
intent(in) :: CFN*(*)
113 INTEGER,
intent(out) :: IRET
114 integer(kind=8) IB, NB, KA
117 IF (lu .LT. 001 .OR. lu .GT.
fddim)
THEN
125 trim(cfn)//c_null_char, a)
149 SUBROUTINE baopenr(LU, CFN, IRET)
151 use iso_c_binding,
only: c_null_char
153 INTEGER,
intent(in) :: LU
154 CHARACTER,
intent(in) :: CFN*(*)
155 INTEGER,
intent(out) :: IRET
156 integer(kind=8) IB, NB, KA
159 IF (lu .LT. 001 .OR. lu .GT.
fddim)
THEN
167 trim(cfn)//c_null_char, a)
191 SUBROUTINE baopenw(LU, CFN, IRET)
193 use iso_c_binding,
only: c_null_char
195 INTEGER,
intent(in) :: LU
196 CHARACTER,
intent(in) :: CFN*(*)
197 INTEGER,
intent(out) :: IRET
198 integer(kind=8) IB, NB, KA
201 IF (lu .LT. 001 .OR. lu .GT.
fddim)
THEN
209 trim(cfn)//c_null_char, a)
235 use iso_c_binding,
only: c_null_char
237 INTEGER,
intent(in) :: LU
238 CHARACTER,
intent(in) :: CFN*(*)
239 INTEGER,
intent(out) :: IRET
240 integer(kind=8) IB, NB, KA
243 IF (lu .LT. 001 .OR. lu .GT.
fddim)
THEN
251 trim(cfn)//c_null_char, a)
277 use iso_c_binding,
only: c_null_char
279 INTEGER,
intent(in) :: LU
280 CHARACTER,
intent(in) :: CFN*(*)
281 INTEGER,
intent(out) :: IRET
282 integer(kind=8) IB,NB,KA
285 IF (lu .LT. 001 .OR. lu .GT.
fddim)
THEN
293 trim(cfn)//c_null_char, a)
318 INTEGER,
intent(in) :: LU
319 INTEGER,
intent(out) :: IRET
320 integer(kind=8) IB, NB, KA
323 IF (lu .LT. 001 .OR. lu .GT.
fddim)
THEN
331 IF (iret .EQ. 0)
fd(lu) = 0
357 SUBROUTINE baread(LU, IB, NB, KA, A)
359 INTEGER,
INTENT(IN) :: LU, IB, NB
360 INTEGER,
INTENT(OUT) :: KA
361 CHARACTER,
INTENT(OUT) :: A(NB)
362 INTEGER(KIND=8) :: LONG_IB, LONG_NB, LONG_KA
365 print *,
'WRONG: in BAREAD read data size NB < 0, STOP! '//&
366 'Consider using BAREADL and long integer'
372 CALL bareadl(lu, long_ib, long_nb, long_ka, a)
400 SUBROUTINE bareadl(LU, IB, NB, KA, A)
403 INTEGER,
intent(in) :: LU
404 INTEGER(kind=8),
intent(in) :: IB,NB
405 INTEGER(kind=8),
intent(out) :: KA
406 CHARACTER,
intent(out) :: A(NB)
407 integer(kind=8),
PARAMETER :: NY=4096, my=4
408 INTEGER(KIND=8) NS(MY), NN(MY)
409 INTEGER(kind=8) LONG_0, KY, I, K, IY, JY, LUX
413 SAVE jy, ns, nn, y, lux
415 IF (lu .LT. 001 .OR. lu .GT.
fddim)
THEN
419 IF (
fd(lu) .LE. 0)
THEN
423 IF (ib .LT. 0 .AND.
baopts(1) .EQ. 1)
THEN
435 IF (
baopts(1) .NE. 1)
THEN
448 IF (lux .NE. lu)
THEN
454 iy = mod(jy + i - 1, my) + 1
455 ky = ib + ka - ns(iy)
456 IF (ka .LT. nb .AND. ky .GE. long_0 .AND. ky .LT. nn(iy))
THEN
457 k = min(nb - ka, nn(iy) - ky)
458 a(ka + 1:ka + k) = y(ky + 1:ky + k, iy)
470 fd(lux), char(0), y(1, jy))
471 IF (nn(jy).GT.0)
THEN
472 k = min(nb-ka, nn(jy))
473 a(ka+1:ka+k) = y(1:k, jy)
478 DO WHILE(nn(jy).EQ.ny.AND.ka.LT.nb)
480 ns(jy) = ns(jy)+nn(jy)
482 fd(lux), char(0), y(1, jy))
483 IF (nn(jy).GT.0)
THEN
484 k = min(nb-ka, nn(jy))
485 a(ka+1:ka+k) = y(1:k, jy)
505 SUBROUTINE bawrite(LU, IB, NB, KA, A)
507 INTEGER,
INTENT(IN) :: LU, IB, NB
508 INTEGER,
INTENT(OUT) :: KA
509 CHARACTER,
INTENT(IN) :: A(NB)
510 INTEGER(KIND = 8) :: LONG_IB, LONG_NB, LONG_KA
513 print *,
'WRONG: in BAWRITE read data size NB <0, STOP! '//&
514 'Consider using BAWRITEL and long integer'
521 CALL bawritel(lu, long_ib, long_nb, long_ka, a)
536 SUBROUTINE bawritel(LU, IB, NB, KA, A)
539 INTEGER,
intent(in) :: LU
540 INTEGER(kind = 8),
intent(in) :: IB, NB
541 INTEGER(kind = 8),
intent(out):: KA
542 CHARACTER,
intent(in) :: A(NB)
543 INTEGER(kind = 8) :: LONG_0
546 IF (lu .LT. 001 .OR. lu .GT.
fddim)
THEN
550 IF (
fd(lu) .LE. 0)
THEN
581 SUBROUTINE wryte(LU, NB, A)
585 INTEGER,
intent(in) :: LU
586 INTEGER,
intent(in) :: NB
587 CHARACTER,
intent(in) :: A(NB)
588 INTEGER(kind = 8) :: LONG_NB
591 print *,
'WRONG: NB: the number of bytes to write <0, STOP!'
595 CALL wrytel(lu, long_nb, a)
607 SUBROUTINE wrytel(LU, NB, A)
610 INTEGER,
intent(in) :: LU
611 INTEGER(kind = 8),
intent(in) :: NB
612 CHARACTER,
INTENT(in) :: A(NB)
613 INTEGER(kind = 8) :: LONG_0, KA
616 IF (lu .LT. 001 .OR. lu .GT.
fddim)
THEN
620 IF (
fd(lu) .LE. 0)
THEN
integer, parameter bacio_write
Write to the file.
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 baopen(LU, CFN, IRET)
Open a byte-addressable file.
subroutine baseto(NOPT, VOPT)
Set options for byte-addressable I/O.
integer, dimension(fddim), save fd
Array IDs of currently open files.
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,...
integer, parameter bacio_openwt
Open for write only with truncation.
subroutine baopenwt(LU, CFN, IRET)
Open a byte-addressable file for write only with truncation.
integer, parameter bacio_noseek
Start I/O from previous spot.
integer, parameter bacio_read
Read from the file.
integer, parameter bacio_openw
Open file for write only.
integer, parameter bacio_openrw
Open file for read or write.
Contains subroutines to read/write binary files.
subroutine wrytel(LU, NB, A)
Write a given number of bytes to an unblocked file.
subroutine baopenw(LU, CFN, IRET)
Open a byte-addressable file for write only.
subroutine baopenwa(LU, CFN, IRET)
Open a byte-addressable file for write only with append.
subroutine baopenr(LU, CFN, IRET)
Open a byte-addressable file for read only.
integer, parameter bacio_openwa
Open for write only with append.
integer, parameter bacio_openr
Open file for read only.
subroutine wryte(LU, NB, A)
This subroutine is calling wrytel() to write a given number of bytes to an unblocked file.
subroutine baread(LU, IB, NB, KA, A)
This subroutine calls bareadl() to read a given number of bytes from an unblocked file,...
integer, parameter bacio_close
Close file.
integer, parameter fddim
Maximum number of open files in bacio library.
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...
integer, dimension(20), save baopts
Array of option settings.