NCEPLIBS-bufr 11.7.1
tabent.f
Go to the documentation of this file.
1C> @file
2C> @author WOOLLEN @date 1994-01-06
3
4C> THIS SUBROUTINE BUILDS AND STORES AN ENTRY FOR A TABLE B OR
5C> TABLE D MNEMONIC (NEMO) WITHIN THE INTERNAL JUMP/LINK TABLE.
6C>
7C> PROGRAM HISTORY LOG:
8C> 1994-01-06 J. WOOLLEN -- ORIGINAL AUTHOR
9C> 1998-07-08 J. WOOLLEN -- REPLACED CALL TO CRAY LIBRARY ROUTINE
10C> "ABORT" WITH CALL TO NEW INTERNAL BUFRLIB
11C> ROUTINE "BORT"; CORRECTED SOME MINOR ERRORS
12C> 2003-11-04 J. ATOR -- ADDED DOCUMENTATION
13C> 2003-11-04 S. BENDER -- ADDED REMARKS/BUFRLIB ROUTINE
14C> INTERDEPENDENCIES
15C> 2003-11-04 D. KEYSER -- MAXJL (MAXIMUM NUMBER OF JUMP/LINK ENTRIES)
16C> INCREASED FROM 15000 TO 16000 (WAS IN
17C> VERIFICATION VERSION); UNIFIED/PORTABLE FOR
18C> WRF; ADDED HISTORY DOCUMENTATION; OUTPUTS
19C> MORE COMPLETE DIAGNOSTIC INFO WHEN ROUTINE
20C> TERMINATES ABNORMALLY
21C> 2005-11-29 J. ATOR -- ADDED SUPPORT FOR 207 AND 208 OPERATORS
22C> 2010-03-19 J. ATOR -- ADDED SUPPORT FOR 204 OPERATOR
23C> 2012-03-02 J. ATOR -- ADDED SUPPORT FOR 203 OPERATOR
24C> 2014-12-10 J. ATOR -- USE MODULES INSTEAD OF COMMON BLOCKS
25C>
26C> USAGE: CALL TABENT (LUN, NEMO, TAB, ITAB, IREP, IKNT, JUM0)
27C> INPUT ARGUMENT LIST:
28C> LUN - INTEGER: I/O STREAM INDEX INTO INTERNAL MEMORY ARRAYS
29C> NEMO - CHARACTER*8: TABLE B OR D MNEMONIC TO STORE IN JUMP/
30C> LINK TABLE
31C> TAB - CHARACTER*1: INTERNAL BUFR TABLE ARRAY ('B' OR 'D') IN
32C> WHICH NEMO IS DEFINED
33C> ITAB - INTEGER: POSITIONAL INDEX OF NEMO WITHIN TAB
34C> IREP - INTEGER: POSITIONAL INDEX WITHIN COMMON /REPTAB/
35C> ARRAYS, FOR USE WHEN NEMO IS REPLICATED:
36C> 0 = NEMO is not replicated
37C> IKNT - INTEGER: NUMBER OF REPLICATIONS, FOR USE WHEN NEMO IS
38C> REPLICATED USING F=1 REGULAR (I.E., NON-DELAYED)
39C> REPLICATION:
40C> 0 = NEMO is not replicated using F=1 regular
41C> (i.e., non-delayed) replication
42C> JUM0 - INTEGER: INDEX VALUE TO BE STORED FOR NEMO WITHIN
43C> INTERNAL JUMP/LINK TABLE ARRAY JMPB(*)
44C>
45C> REMARKS:
46C> THIS ROUTINE CALLS: BORT INCTAB NEMTBB
47C> THIS ROUTINE IS CALLED BY: TABSUB
48C> Normally not called by any application
49C> programs.
50C>
51 SUBROUTINE tabent(LUN,NEMO,TAB,ITAB,IREP,IKNT,JUM0)
52
53 USE modv_mxnrv
54
55 USE moda_tables
56 USE moda_nrv203
57
58C Note that the values within the COMMON /REPTAB/ arrays were
59C initialized within subroutine BFRINI.
60
61 COMMON /reptab/ idnr(5,2),typs(5,2),reps(5,2),lens(5)
62
63 COMMON /tabccc/ icdw,icsc,icrv,incw
64
65 CHARACTER*128 BORT_STR
66 CHARACTER*24 UNIT
67 CHARACTER*10 RTAG
68 CHARACTER*8 NEMO
69 CHARACTER*3 TYPS,TYPT
70 CHARACTER*1 REPS,TAB
71
72C-----------------------------------------------------------------------
73C-----------------------------------------------------------------------
74
75C MAKE A JUMP/LINK TABLE ENTRY FOR A REPLICATOR
76C ---------------------------------------------
77
78 IF(irep.NE.0) THEN
79 rtag = reps(irep,1)//nemo
80 DO i=1,10
81 IF(rtag(i:i).EQ.' ') THEN
82 rtag(i:i) = reps(irep,2)
83 CALL inctab(rtag,typs(irep,1),node)
84 jump(node) = node+1
85 jmpb(node) = jum0
86 link(node) = 0
87 ibt(node) = lens(irep)
88 irf(node) = 0
89 isc(node) = 0
90 IF(irep.EQ.1) irf(node) = iknt
91 jum0 = node
92 GOTO 1
93 ENDIF
94 ENDDO
95 GOTO 900
96 ENDIF
97
98C MAKE AN JUMP/LINK ENTRY FOR AN ELEMENT OR A SEQUENCE
99C ----------------------------------------------------
100
1011 IF(tab.EQ.'B') THEN
102
103 CALL nemtbb(lun,itab,unit,iscl,iref,ibit)
104 IF(unit(1:5).EQ.'CCITT') THEN
105 typt = 'CHR'
106 ELSE
107 typt = 'NUM'
108 ENDIF
109 CALL inctab(nemo,typt,node)
110 jump(node) = 0
111 jmpb(node) = jum0
112 link(node) = 0
113 ibt(node) = ibit
114 irf(node) = iref
115 isc(node) = iscl
116 IF(unit(1:4).EQ.'CODE') THEN
117 typt = 'COD'
118 ELSEIF(unit(1:4).EQ.'FLAG') THEN
119 typt = 'FLG'
120 ENDIF
121
122 IF( (typt.EQ.'NUM') .AND. (ibtnrv.NE.0) ) THEN
123
124C This node contains a new (redefined) reference value.
125
126 IF(nnrv+1.GT.mxnrv) GOTO 902
127 nnrv = nnrv+1
128 tagnrv(nnrv) = nemo
129 inodnrv(nnrv) = node
130 isnrv(nnrv) = node+1
131 ibt(node) = ibtnrv
132 IF(ipfnrv.EQ.0) ipfnrv = nnrv
133 ELSEIF( (typt.EQ.'NUM') .AND. (nemo(1:3).NE.'204') ) THEN
134 ibt(node) = ibt(node) + icdw
135 isc(node) = isc(node) + icsc
136 irf(node) = irf(node) * icrv
137 ELSEIF( (typt.EQ.'CHR') .AND. (incw.GT.0) ) THEN
138 ibt(node) = incw * 8
139 ENDIF
140
141 ELSEIF(tab.EQ.'D') THEN
142
143 IF(irep.EQ.0) THEN
144 typt = 'SEQ'
145 ELSE
146 typt = typs(irep,2)
147 ENDIF
148 CALL inctab(nemo,typt,node)
149 jump(node) = node+1
150 jmpb(node) = jum0
151 link(node) = 0
152 ibt(node) = 0
153 irf(node) = 0
154 isc(node) = 0
155
156 ELSE
157
158 GOTO 901
159
160 ENDIF
161
162C EXITS
163C -----
164
165 RETURN
166900 WRITE(bort_str,'("BUFRLIB: TABENT - REPLICATOR ERROR FOR INPUT '//
167 . 'MNEMONIC ",A,", RTAG IS ",A)') nemo,rtag
168 CALL bort(bort_str)
169901 WRITE(bort_str,'("BUFRLIB: TABENT - UNDEFINED TAG (",A,") FOR '//
170 . 'INPUT MNEMONIC ",A)') tab,nemo
171 CALL bort(bort_str)
172902 CALL bort('BUFRLIB: TABENT - MXNRV OVERFLOW')
173 END
subroutine bort(STR)
This subroutine calls subroutine errwrt() to log an error message, then calls subroutine bort_exit() ...
Definition: bort.f:23
subroutine inctab(ATAG, ATYP, NODE)
THIS SUBROUTINE RETURNS THE NEXT AVAILABLE POSITIONAL INDEX FOR WRITING INTO THE INTERNAL JUMP/LINK T...
Definition: inctab.f:44
This module contains array and variable declarations for use with any 2-03-YYY (change reference valu...
Definition: moda_nrv203.F:15
integer nnrv
Number of entries in the jump/link table which contain new reference values (up to a maximum of MXNRV...
Definition: moda_nrv203.F:56
integer ipfnrv
A number between 1 and nnrv, denoting the first entry within the module arrays which applies to the c...
Definition: moda_nrv203.F:58
integer ibtnrv
Number of bits in Section 4 occupied by each new reference value for the current 2-03-YYY operator in...
Definition: moda_nrv203.F:57
integer, dimension(:), allocatable isnrv
Start of entry range in jump/link table, within which the corresponding new reference value in nrv wi...
Definition: moda_nrv203.F:62
integer, dimension(:), allocatable inodnrv
Entries within jump/link table which contain new reference values.
Definition: moda_nrv203.F:60
character *8, dimension(:), allocatable tagnrv
Table B mnemonic to which the corresponding new reference value in nrv applies.
Definition: moda_nrv203.F:59
This module contains array and variable declarations used to store the internal jump/link table.
Definition: moda_tables.F:13
integer, dimension(:), allocatable link
Link indices corresponding to tag, typ and jmpb:
Definition: moda_tables.F:136
integer, dimension(:), allocatable isc
Scale factors corresponding to tag and typ:
Definition: moda_tables.F:140
integer, dimension(:), allocatable jump
Jump forward indices corresponding to tag and typ:
Definition: moda_tables.F:135
integer, dimension(:), allocatable ibt
Bit widths corresponding to tag and typ:
Definition: moda_tables.F:138
integer, dimension(:), allocatable irf
Reference values corresponding to tag and typ:
Definition: moda_tables.F:139
integer, dimension(:), allocatable jmpb
Jump backward indices corresponding to tag and typ:
Definition: moda_tables.F:137
This module declares and initializes the MXNRV variable.
Definition: modv_MXNRV.f:13
integer mxnrv
Maximum number of entries in the internal jump/link table that can contain new reference values.
Definition: modv_MXNRV.f:19
subroutine nemtbb(LUN, ITAB, UNIT, ISCL, IREF, IBIT)
This subroutine returns information about a Table B descriptor from the internal DX BUFR tables.
Definition: nemtbb.f:32
subroutine tabent(LUN, NEMO, TAB, ITAB, IREP, IKNT, JUM0)
THIS SUBROUTINE BUILDS AND STORES AN ENTRY FOR A TABLE B OR TABLE D MNEMONIC (NEMO) WITHIN THE INTERN...
Definition: tabent.f:52