NCEPLIBS-bufr  12.1.0
strings.F90 File Reference

Process mnemonic strings. More...

Go to the source code of this file.

Functions/Subroutines

subroutine parstr (str, tags, mtag, ntag, sep, limit80)
 Parse a string containing one or more substrings into an array of substrings. More...
 
subroutine parusr (str, lun, i1, io)
 Initiate the process to parse out mnemonics from a user-specified character string, then separate them into store and condition nodes. More...
 
subroutine parutg (lun, io, utg, nod, kon, val)
 Parse a mnemonic from a character string. More...
 
subroutine strcln
 Reset the internal mnemonic string cache. More...
 
subroutine string (str, lun, i1, io)
 Check whether a string is in the internal mnemonic string cache. More...
 

Detailed Description

Process mnemonic strings.

Author
Woollen
Date
1994-01-06

Definition in file strings.F90.

Function/Subroutine Documentation

◆ parstr()

subroutine parstr ( character*(*), intent(in)  str,
character*(*), dimension(mtag), intent(out)  tags,
integer, intent(in)  mtag,
integer, intent(out)  ntag,
character, intent(in)  sep,
logical, intent(in)  limit80 
)

Parse a string containing one or more substrings into an array of substrings.

The separator for the substrings is specified during input, and multiple adjacent occurrences of this character will be treated as a single occurrence when the string is actually parsed.

Parameters
str- String
tags- Array of substrings
mtag- Dimensioned size of tags within calling program; used by the subroutine to make sure it doesn't overflow the tags array
ntag- Number of substrings returned in tags
sep- Separator character for substrings
limit80- .true. if an abort should occur when str is longer than 80 characters
Author
J. Ator
Date
2007-01-19

Definition at line 472 of file strings.F90.

References bort2().

Referenced by fdebufr_c(), fstag(), getcfmng(), getntbe(), gettbh(), parusr(), readlc(), seqsdx(), sntbbe(), sntbde(), sntbfe(), ufbseq(), ufbtab(), ufbtam(), and writlc().

◆ parusr()

subroutine parusr ( character*(*), intent(in)  str,
integer, intent(in)  lun,
integer, intent(in)  i1,
integer, intent(in)  io 
)

Initiate the process to parse out mnemonics from a user-specified character string, then separate them into store and condition nodes.

Information about the string mnemonics is stored in arrays in common block /usrstr/. Condition nodes are sorted in the order expected in the internal jump/link tables and several checks are performed on them.

Parameters
str- String of blank-separated mnemonics
lun- File ID
i1- A number greater than or equal to the number of blank-separated mnemonics in str
iO- Status indicator for BUFR file associated with lun:
  • 0 = Input file
  • 1 = Output file
Author
Woollen
Date
1994-01-06

Definition at line 148 of file strings.F90.

References bort2(), parstr(), and parutg().

Referenced by string().

◆ parutg()

subroutine parutg ( integer, intent(in)  lun,
integer, intent(in)  io,
character*(*), intent(in)  utg,
integer, intent(out)  nod,
integer, intent(out)  kon,
real, intent(out)  val 
)

Parse a mnemonic from a character string.

Parse a user-specified tag (mnemonic) utg that represents a value either being decoded from a BUFR file (if it is being read) or encoded into a BUFR file (if it is being written). This subroutine first checks to see if the tag contains a condition character ('=', '!', '<', '>', '^' or '#'). If it does not, nothing happens at this point. If it does, then the type of condition character is noted and the tag is stripped of all characters at and beyond the condition character. In either event, the resultant tag is checked against those in the internal jump/ link subset table (in module moda_tables). If found, the node associated with the tag is returned (and it is either a "condition" node or a "store" node depending of the presence or absence of a condition character in utg). Otherwise the node is returned as zero. If the tag represents a condition node, then the condition value (numeric characters beyond the condition character in the user-specified tag input here) is returned.

As an example of condition character usage, consider the following example of a call to ufbint():

real*8 usr(4,50)
....
....
call ufbint(lunin,usr,4,50,iret,'PRLC<50000 TMDB WDIR WSPD')
recursive subroutine ufbint(lunin, usr, i1, i2, iret, str)
Read or write one or more data values from or to a data subset.

Assuming that lunin points to a BUFR file open for input (reading), then the usr array now contains iret levels of data (up to a maximum of 50) where the value of PRLC is/was less than 50000, along with the corresponding values for TMDB, WDIR and WSPD at those levels.

As another example, consider the following example of a call to readlc() for a long character string:

character*200 lchr
....
....
call readlc(lunin,lchr,'NUMID#3')

Assuming that lunin points to a BUFR file open for input (reading), then the lchr string now contains the value corresponding to the third occurrence of NUMID within the current subset.

Valid condition codes include:

  • '<' - less than
  • '>' - greater than
  • '=' - equal to
  • '!' - not equal to
  • '#' - ordinal identifier for a particular occurrence of a long character string
Parameters
lun- File ID
io- Status indicator for BUFR file associated with lun:
  • 0 = Input file
  • 1 = Output file
utg- User-supplied tag representing a value to be encoded/decoded to/from BUFR file
nod- Positional index in internal jump/link subset table for utg:
  • 0 = utg not found in table
kon- Indicator for type of condition character found in UTG:
  • 0 = No condition character found (nod is a store node)
  • 1 = Character '=' found (nod is a condition node)
  • 2 = Character '!' found (nod is a condition node)
  • 3 = Character '<' found (nod is a condition node)
  • 4 = Character '>' found (nod is a condition node)
  • 5 = Character '^' found (nod is a condition node; specifically, a "bump" node)
  • 6 = Character '#' found (nod is a condition node)
val- Condition value associated with condition character found in utg:
  • 0 = utg does not have a condition character
Author
Woollen
Date
1994-01-06

Definition at line 348 of file strings.F90.

References bort(), bort2(), moda_msgcwd::inode, moda_tables::isc, strnum(), moda_tables::tag, and moda_tables::typ.

Referenced by parusr(), readlc(), and writlc().

◆ strcln()

subroutine strcln

Reset the internal mnemonic string cache.

The string cache is a performance-enhancing feature which saves processing time when the same mnemonics are encountered repeatedly.

Author
J. Woollen
Date
1994-01-06

Definition at line 115 of file strings.F90.

Referenced by makestab().

◆ string()

subroutine string ( character*(*), intent(in)  str,
integer, intent(in)  lun,
integer, intent(in)  i1,
integer, intent(in)  io 
)

Check whether a string is in the internal mnemonic string cache.

Check to see if a user-specified character string is already in the internal cache (arrays in common blocks /stcach/ and /stords/). If not, then call subroutine parusr() to perform the task of separating and checking the individual mnemonics so that they can then be added to the cache.

The mnemonic string cache is a performance enhancing device which saves time when the same mnemonic strings are repeatedly encountered within an application program.

Parameters
str- String of blank-separated mnemonics
lun- File ID
i1- A number greater than or equal to the number of blank-separated mnemonics in str
io- Status indicator for BUFR file associated with lun:
  • 0 = Input file
  • 1 = Output file
Author
Woollen
Date
1994-01-06

Definition at line 24 of file strings.F90.

References bort2(), moda_msgcwd::inode, and parusr().

Referenced by ufbevn(), ufbget(), ufbin3(), ufbint(), ufbovr(), ufbrep(), ufbstp(), ufbtab(), and ufbtam().