NCEPLIBS-bufr  12.0.1
iupm.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Decode an integer value from a character string.
3 C>
4 C> @author J. Woollen @date 1994-01-06
5 
6 C> Decode an integer value from a character string.
7 C>
8 C> This function decodes an integer value from within a
9 C> specified number of bits of a character string, starting
10 C> with the first bit of the first byte of the string.
11 C>
12 C> This function is the logical inverse of subroutine ipkm().
13 C>
14 C> @param[in] CBAY - character*(*): String.
15 C> @param[in] NBITS - integer: Number of bits from CBAY to be decoded.
16 C> @returns iupm - integer: Decoded value.
17 C>
18 C> @author J. Woollen @date 1994-01-06
19  RECURSIVE FUNCTION iupm(CBAY,NBITS) RESULT(IRET)
20 
21  USE modv_im8b
22 
23  COMMON /hrdwrd/ nbytw,nbitw,iord(8)
24 
25  CHARACTER*128 bort_str
26  CHARACTER*8 cbay
27  CHARACTER*8 cint
28  dimension int(2)
29  equivalence(cint,int)
30 
31 C----------------------------------------------------------------------
32 C----------------------------------------------------------------------
33 
34 C Check for I8 integers.
35 
36  IF(im8b) THEN
37  im8b=.false.
38 
39  CALL x84(nbits,my_nbits,1)
40  iret = iupm(cbay,my_nbits)
41 
42  im8b=.true.
43  RETURN
44  ENDIF
45 
46  iret = 0
47  IF(nbits.GT.nbitw) GOTO 900
48  cint = cbay
49  int(1) = irev(int(1))
50  iret = ishft(int(1),nbits-nbitw)
51 
52 C EXITS
53 C -----
54 
55  RETURN
56 900 WRITE(bort_str,'("BUFRLIB: IUPM - NUMBER OF BITS BEING UNPACKED'//
57  . ', NBITS (",I4,"), IS > THE INTEGER WORD LENGTH ON THIS '//
58  . 'MACHINE, NBITW (",I3,")")') nbits,nbitw
59  CALL bort(bort_str)
60  END
subroutine bort(STR)
Log one error message and abort application program.
Definition: bort.f:18
function irev(N)
This function will, when the local machine is "little-endian" (i.e., when it uses a right to left sch...
Definition: irev.F:33
recursive function iupm(CBAY, NBITS)
Decode an integer value from a character string.
Definition: iupm.f:20
This module declares and initializes the IM8B variable.
logical, public im8b
Status indicator to keep track of whether all future calls to BUFRLIB subroutines and functions from ...
subroutine x84(IIN8, IOUT4, NVAL)
Encode one or more 8-byte integer values as 4-byte integer values.
Definition: x84.F:19