26 use modv_vars,
only: mxs
32 character*(*),
intent(in) :: str
33 character*128 bort_str1, bort_str2
36 integer,
intent(in) :: lun, i1, io
37 integer,
parameter :: jcons = 52
38 integer mstr, nstr, lstr, lux, icon, jcon, iord, iorx, nxt, ind, j, n
44 common /stcach/ mstr, nstr, lstr, lux(mxs,2), usr(mxs), icon(jcons,mxs)
45 common /usrstr/ jcon(jcons)
46 common /stords/ iord(mxs), iorx(mxs)
52 write(bort_str1,
'("BUFRLIB: STRING - INPUT STRING (",A,") HAS")') str
53 write(bort_str2,
'(18X,"LENGTH (",I4,"), > LIMIT OF 80 CHAR.")') len(str)
54 call bort2(bort_str1,bort_str2)
61 if(lux(iord(n),2)==ind)
then
67 if(ust==usr(iorx(n)))
then
73 jcon(j) = icon(j,iorx(n))
78 if (.not.incache)
then
83 lstr = max(mod(lstr+1,mstr+1),1)
84 nstr = min(nstr+1,mstr)
89 icon(j,lstr) = jcon(j)
101 write(bort_str1,
'("BUFRLIB: STRING - INPUT STRING (",A,")")') str
102 write(bort_str2,
'(18X,"HAS",I5," STORE NODES (MNEMONICS) - THE LIMIT (THIRD INPUT ARGUMENT) IS",I5)') jcon(1), i1
103 call bort2(bort_str1,bort_str2)
117 use modv_vars,
only: mxs
121 integer mstr, nstr, lstr, luns, icon
125 common /stcach/ mstr, nstr, lstr, luns(mxs,2), usrs(mxs), icon(52,mxs)
150 use modv_vars,
only: iac
154 integer,
intent(in) :: lun, i1, io
155 integer,
parameter :: maxusr = 30, maxnod = 20, maxcon = 10
156 integer nnod, ncon, nods, nodc, ivls, kons, i, j, n, ntot, nod, kon, irpc, lstjpb
158 character*(*),
intent(in) :: str
159 character*128 bort_str1, bort_str2
161 character*20 utg(maxusr)
167 common /usrstr/ nnod, ncon, nods(maxnod), nodc(maxcon), ivls(maxcon), kons(maxcon)
171 write(bort_str1,
'("BUFRLIB: PARUSR - INPUT STRING (",A,") HAS ")') str
172 write(bort_str2,
'(18X,"LENGTH (",I4,"), > LIMIT OF 80 CHAR.")') len(str)
173 call bort2(bort_str1,bort_str2)
181 call parstr(ust,utg,maxusr,ntot,
' ',.true.)
185 call parutg(lun,io,utg(n),nod,kon,val)
190 write(bort_str1,
'("BUFRLIB: PARUSR - THE NUMBER OF CONDITION NODES IN INPUT STRING")')
191 write(bort_str2,
'(18X,A,") EXCEEDS THE MAXIMUM (",I3,")")') str,maxcon
192 call bort2(bort_str1,bort_str2)
196 ivls(ncon) = nint(val)
201 write(bort_str1,
'("BUFRLIB: PARUSR - THE NUMBER OF STORE NODES IN INPUT STRING")')
202 write(bort_str2,
'(18X,A,") EXCEEDS THE MAXIMUM (",I3,")")') str,maxnod
203 call bort2(bort_str1,bort_str2)
213 if(nodc(i)>nodc(j))
then
233 write(bort_str1,
'("BUFRLIB: PARUSR - BUMP NODE (^ IN INPUT STRING ",A)') str
234 write(bort_str2,
'(18X,"IS SPECIFIED FOR A BUFR FILE OPEN FOR INPUT, THE BUFR FILE MUST BE OPEN FOR OUTPUT")')
235 call bort2(bort_str1,bort_str2)
238 write(bort_str1,
'("BUFRLIB: PARUSR - INPUT STRING (",A,") CONTAINS")') str
239 write(bort_str2,
'(18X,"CONDITIONAL NODES IN ADDITION TO BUMP NODE - THE BUMP MUST BE ON THE INNER NODE")')
240 call bort2(bort_str1,bort_str2)
248 if(.not.bump .and. nnod==0)
then
249 write(bort_str1,
'("BUFRLIB: PARUSR - INPUT STRING (",A,") HAS")') str
250 write(bort_str2,
'(18X,"NO STORE NODES")')
251 call bort2(bort_str1,bort_str2)
254 write(bort_str1,
'("BUFRLIB: PARUSR - INPUT STRING (",A,")")') str
255 write(bort_str2,
'(18X,"HAS",I5," STORE NODES (MNEMONICS) - THE LIMIT {THIRD (INPUT) ARGUMENT} IS",I5)') nnod,i1
256 call bort2(bort_str1,bort_str2)
262 if(irpc<0) irpc = lstjpb(nods(i),lun,
'RPC')
263 if(irpc/=lstjpb(nods(i),lun,
'RPC').and.iac==0)
then
264 write(bort_str1,
'("BUFRLIB: PARUSR - INPUT STRING (",A,") CONTAINS")') str
265 write(bort_str2,
'(18X,"STORE NODES (MNEMONICS) THAT ARE IN MORE THAN ONE REPLICATION GROUP")')
266 call bort2(bort_str1,bort_str2)
348 subroutine parutg(lun,io,utg,nod,kon,val)
355 integer,
intent(in) :: lun, io
356 integer,
intent(out) :: nod, kon
357 integer,
parameter :: nchk = 8, ncond = 6
358 integer,
parameter :: iok(nchk) = (/-1, -1, -1, -1, -1, 0, 0, 0/)
359 integer ltg, icv, inod, i, j, num, ier
361 character*(*),
intent(in) :: utg
362 character*128 bort_str1, bort_str2
365 character*3,
parameter :: btyp(nchk) = (/
'SUB',
'SEQ',
'REP',
'RPC',
'RPS',
'DRB',
'DRP',
'DRS'/)
366 character,
parameter :: cond(ncond) = (/
'=',
'!',
'<',
'>',
'^',
'#'/)
368 real,
intent(out) :: val
371 logical,
parameter :: picky = .false.
378 ltg = min(20,len(utg))
384 if((utg(1:1)==
'<').and.(index(utg(3:),
'>')/=0))
then
388 if(utg(i:i)==
' ')
exit
390 if(utg(i:i)==cond(j))
then
403 do nod=inod,
isc(inod)
404 if(atag==
tag(nod))
then
409 if(
typ(nod-1)/=
'DRP' .and.
typ(nod-1)/=
'DRS')
then
410 write(bort_str1,
'("BUFRLIB: PARUTG - BUMP NODE (MNEMONIC ",A,")'// &
411 ' MUST REFER TO A DELAYED REPLICATION SEQUENCE, HERE TYPE IS ",A)') atag,
typ(nod-1)
418 if(atyp==btyp(i) .and. io>iok(i))
then
419 write(bort_str1,
'("BUFRLIB: PARUTG - ILLEGAL NODE TYPE: ",A," FOR MNEMONIC ",A)') atyp,atag
426 call strnum(utg(icv:ltg),num,ier)
428 write(bort_str1,
'("BUFRLIB: PARUTG - CONDITION VALUE IN MNEMONIC ",A," CONTAINS NON-NUMERIC CHARACTERS")') utg
446 if(kon==0 .and. (io==0 .or. atag==
'NUL' .or. .not.picky))
then
449 write(bort_str1,
'("BUFRLIB: PARUTG - TRYING TO WRITE A MNEMONIC'// &
450 ' (",A,") WHICH DOES NOT EXIST IN SUBSET TABLE")') atag
451 write(bort_str2,
'(18X,"(UPON INPUT, IT CONTAINED THE CONDITION CHARACTER ",A,")")') utg(icv-1:icv-1)
452 call bort2(bort_str1,bort_str2)
472 subroutine parstr(str,tags,mtag,ntag,sep,limit80)
476 integer,
intent(in) :: mtag
477 integer,
intent(out) :: ntag
478 integer i, lstr, ltag, nchr
480 character*(*),
intent(in) :: str
481 character*(*),
intent(out) :: tags(mtag)
482 character,
intent(in) :: sep
483 character*128 bort_str1, bort_str2
485 logical,
intent(in) :: limit80
490 if( limit80 .and. (lstr>80) )
then
491 write(bort_str1,
'("BUFRLIB: PARSTR - INPUT STRING (",A,") HAS ")') str
492 write(bort_str2,
'(18X,"LENGTH (",I4,"), > LIMIT OF 80 CHAR.")') lstr
493 call bort2(bort_str1,bort_str2)
500 if( .not.substr .and. (str(i:i)/=sep) )
then
503 write(bort_str1,
'("BUFRLIB: PARSTR - INPUT STRING (",A,") CONTAINS",I4)') str,ntag
504 write(bort_str2,
'(18X,"SUBSTRINGS, EXCEEDING THE LIMIT {",I4," - THIRD (INPUT) ARGUMENT}")') mtag
505 call bort2(bort_str1,bort_str2)
509 if( substr .and. (str(i:i)==sep) ) nchr = 0
510 substr = str(i:i)/=sep
514 write(bort_str1,
'("BUFRLIB: PARSTR - INPUT STRING (",A,") ")') str
515 write(bort_str2,
'(18X,"CONTAINS A PARSED SUBSTRING WITH LENGTH EXCEEDING THE MAXIMUM OF",I4," CHARACTERS")') ltag
516 call bort2(bort_str1,bort_str2)
518 tags(ntag)(nchr:nchr) = str(i:i)
subroutine bort(str)
Log an error message, then abort the application program.
subroutine bort2(str1, str2)
Log two error messages, then abort the application program.
recursive subroutine strnum(str, num, iret)
Decode an integer from a character string.
Declare arrays used to store information about the current BUFR message that is in the process of bei...
integer, dimension(:), allocatable inode
Table A mnemonic for type of BUFR message.
Declare arrays and variables used to store the internal jump/link table.
integer, dimension(:), allocatable isc
Scale factors corresponding to tag and typ:
character *3, dimension(:), allocatable typ
Type indicators corresponding to tag:
character *10, dimension(:), allocatable tag
Mnemonics in the jump/link table.
subroutine strcln
Reset the internal mnemonic string cache.
subroutine parstr(str, tags, mtag, ntag, sep, limit80)
Parse a string containing one or more substrings into an array of substrings.
subroutine parutg(lun, io, utg, nod, kon, val)
Parse a mnemonic from a character string.
subroutine string(str, lun, i1, io)
Check whether a string is in the internal mnemonic string cache.
subroutine parusr(str, lun, i1, io)
Initiate the process to parse out mnemonics from a user-specified character string,...