NCEPLIBS-bufr  12.0.0
tabent.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Store an entry for a Table B or D mnemonic within the internal jump/link table.
3 C>
4 C> @author Woollen @date 1994-01-06
5 
6 C> This subroutine builds and stores an entry for a Table B or
7 c> Table D mnemonic within the internal jump/link table.
8 C>
9 C> @param[in] LUN - integer: I/O stream index into internal memory arrays.
10 C> @param[in] NEMO - character*8: Table B or D mnemonic to store in jump/link table.
11 C> @param[in] TAB - character*1: internal BUFR table array ('B' or 'D') in which NEMO is defined.
12 C> @param[in] ITAB - integer: positional index of NEMO within TAB.
13 C> @param[in] IREP - integer: positional index within common /reptab/ arrays,
14 C> for use when NEMO is replicated:
15 C> - 0, if NEMO is not replicated.
16 C> @param[in] IKNT - integer: number of replications, for use when NEMO is
17 C> replicated using F=1 regular (i.e., non-delayed) replication:
18 C> - 0, if NEMO is not replicated using F=1 regular (i.e., non-delayed) replication
19 C> @param[in] JUM0 - integer: index value to be stored for NEMO within internal jump/link table array jmpb(*).
20 C>
21 C> @author Woollen @date 1994-01-06
22  SUBROUTINE tabent(LUN,NEMO,TAB,ITAB,IREP,IKNT,JUM0)
23 
24  USE modv_mxnrv
25 
26  USE moda_tables
27  USE moda_nrv203
28 
29 C Note that the values within the COMMON /REPTAB/ arrays were
30 C initialized within subroutine BFRINI.
31 
32  COMMON /reptab/ idnr(5,2),typs(5,2),reps(5,2),lens(5)
33 
34  COMMON /tabccc/ icdw,icsc,icrv,incw
35 
36  CHARACTER*128 BORT_STR
37  CHARACTER*24 UNIT
38  CHARACTER*10 RTAG
39  CHARACTER*8 NEMO
40  CHARACTER*3 TYPS,TYPT
41  CHARACTER*1 REPS,TAB
42 
43 C-----------------------------------------------------------------------
44 C-----------------------------------------------------------------------
45 
46 C MAKE A JUMP/LINK TABLE ENTRY FOR A REPLICATOR
47 C ---------------------------------------------
48 
49  IF(irep.NE.0) THEN
50  rtag = reps(irep,1)//nemo
51  DO i=1,10
52  IF(rtag(i:i).EQ.' ') THEN
53  rtag(i:i) = reps(irep,2)
54  CALL inctab(rtag,typs(irep,1),node)
55  jump(node) = node+1
56  jmpb(node) = jum0
57  link(node) = 0
58  ibt(node) = lens(irep)
59  irf(node) = 0
60  isc(node) = 0
61  IF(irep.EQ.1) irf(node) = iknt
62  jum0 = node
63  GOTO 1
64  ENDIF
65  ENDDO
66  GOTO 900
67  ENDIF
68 
69 C MAKE AN JUMP/LINK ENTRY FOR AN ELEMENT OR A SEQUENCE
70 C ----------------------------------------------------
71 
72 1 IF(tab.EQ.'B') THEN
73 
74  CALL nemtbb(lun,itab,unit,iscl,iref,ibit)
75  IF(unit(1:5).EQ.'CCITT') THEN
76  typt = 'CHR'
77  ELSE
78  typt = 'NUM'
79  ENDIF
80  CALL inctab(nemo,typt,node)
81  jump(node) = 0
82  jmpb(node) = jum0
83  link(node) = 0
84  ibt(node) = ibit
85  irf(node) = iref
86  isc(node) = iscl
87  IF(unit(1:4).EQ.'CODE') THEN
88  typt = 'COD'
89  ELSEIF(unit(1:4).EQ.'FLAG') THEN
90  typt = 'FLG'
91  ENDIF
92 
93  IF( (typt.EQ.'NUM') .AND. (ibtnrv.NE.0) ) THEN
94 
95 C This node contains a new (redefined) reference value.
96 
97  IF(nnrv+1.GT.mxnrv) GOTO 902
98  nnrv = nnrv+1
99  tagnrv(nnrv) = nemo
100  inodnrv(nnrv) = node
101  isnrv(nnrv) = node+1
102  ibt(node) = ibtnrv
103  IF(ipfnrv.EQ.0) ipfnrv = nnrv
104  ELSEIF( (typt.EQ.'NUM') .AND. (nemo(1:3).NE.'204') ) THEN
105  ibt(node) = ibt(node) + icdw
106  isc(node) = isc(node) + icsc
107  irf(node) = irf(node) * icrv
108  ELSEIF( (typt.EQ.'CHR') .AND. (incw.GT.0) ) THEN
109  ibt(node) = incw * 8
110  ENDIF
111 
112  ELSEIF(tab.EQ.'D') THEN
113 
114  IF(irep.EQ.0) THEN
115  typt = 'SEQ'
116  ELSE
117  typt = typs(irep,2)
118  ENDIF
119  CALL inctab(nemo,typt,node)
120  jump(node) = node+1
121  jmpb(node) = jum0
122  link(node) = 0
123  ibt(node) = 0
124  irf(node) = 0
125  isc(node) = 0
126 
127  ELSE
128 
129  GOTO 901
130 
131  ENDIF
132 
133 C EXITS
134 C -----
135 
136  RETURN
137 900 WRITE(bort_str,'("BUFRLIB: TABENT - REPLICATOR ERROR FOR INPUT '//
138  . 'MNEMONIC ",A,", RTAG IS ",A)') nemo,rtag
139  CALL bort(bort_str)
140 901 WRITE(bort_str,'("BUFRLIB: TABENT - UNDEFINED TAG (",A,") FOR '//
141  . 'INPUT MNEMONIC ",A)') tab,nemo
142  CALL bort(bort_str)
143 902 CALL bort('BUFRLIB: TABENT - MXNRV OVERFLOW')
144  END
subroutine bort(STR)
Log one error message and abort application program.
Definition: bort.f:18
subroutine inctab(ATAG, ATYP, NODE)
This subroutine returns the next available positional index for writing into the internal jump/link t...
Definition: inctab.f:21
This module contains array and variable declarations for use with any 2-03-YYY (change reference valu...
character *8, dimension(:), allocatable tagnrv
Table B mnemonic to which the corresponding new reference value in nrv applies.
integer, dimension(:), allocatable isnrv
Start of entry range in jump/link table, within which the corresponding new reference value in nrv wi...
integer nnrv
Number of entries in the jump/link table which contain new reference values (up to a maximum of MXNRV...
integer ipfnrv
A number between 1 and nnrv, denoting the first entry within the module arrays which applies to the c...
integer, dimension(:), allocatable inodnrv
Entries within jump/link table which contain new reference values.
integer ibtnrv
Number of bits in Section 4 occupied by each new reference value for the current 2-03-YYY operator in...
This module contains array and variable declarations used to store the internal jump/link table.
integer, dimension(:), allocatable irf
Reference values corresponding to tag and typ:
integer, dimension(:), allocatable isc
Scale factors corresponding to tag and typ:
integer, dimension(:), allocatable ibt
Bit widths corresponding to tag and typ:
integer, dimension(:), allocatable jmpb
Jump backward indices corresponding to tag and typ:
integer, dimension(:), allocatable jump
Jump forward indices corresponding to tag and typ:
integer, dimension(:), allocatable link
Link indices corresponding to tag, typ and jmpb:
This module declares and initializes the MXNRV variable.
integer mxnrv
Maximum number of entries in the internal jump/link table that can contain new reference values.
subroutine nemtbb(LUN, ITAB, UNIT, ISCL, IREF, IBIT)
Get information about a Table B descriptor.
Definition: nemtbb.f:22
subroutine tabent(LUN, NEMO, TAB, ITAB, IREP, IKNT, JUM0)
This subroutine builds and stores an entry for a Table B or Table D mnemonic within the internal jump...
Definition: tabent.f:23