Merge remote-tracking branch 'origin/release-v4.6.1'
[WRF.git] / var / external / bufr / msgfull.f
blob4748fe4c3b8a336e5ffda0eea6d2ffd3fd38038e
1 LOGICAL FUNCTION MSGFULL(MSIZ,ITOADD,MXSIZ)
3 C$$$ SUBPROGRAM DOCUMENTATION BLOCK
5 C SUBPROGRAM: MSGFULL
6 C PRGMMR: J. ATOR ORG: NP12 DATE: 2009-03-23
8 C ABSTRACT: THIS LOGICAL FUNCTION DETERMINES WHETHER THE CURRENT SUBSET
9 C (OF LENGTH ITOADD BYTES) WILL FIT WITHIN THE CURRENT BUFR MESSAGE.
10 C A FINITE AMOUNT OF "WIGGLE ROOM" IS ALLOWED FOR AS SHOWN BELOW.
12 C PROGRAM HISTORY LOG:
13 C 2009-03-23 J. ATOR -- ORIGINAL AUTHOR
15 C USAGE: MSGFULL (MSIZ,ITOADD,MXSIZ)
16 C INPUT ARGUMENT LIST:
17 C MSIZ - INTEGER: SIZE OF CURRENT MESSAGE (IN BYTES)
18 C ITOADD - INTEGER: SIZE OF SUBSET TO BE ADDED (IN BYTES)
19 C MXSIZ - INTEGER: MAXIMUM SIZE OF A BUFR MESSAGE
21 C OUTPUT ARGUMENT LIST:
22 C MSGFULL - LOGICAL: FALSE IF SUBSET WILL FIT; TRUE OTHERWISE
24 C REMARKS:
25 C THIS ROUTINE CALLS: None
26 C THIS ROUTINE IS CALLED BY: CPYUPD MSGUPD WRCMPS WRDXTB
27 C Normally not called by any application
28 C programs.
30 C ATTRIBUTES:
31 C LANGUAGE: FORTRAN 77
32 C MACHINE: PORTABLE TO ALL PLATFORMS
34 C$$$
36 INCLUDE 'bufrlib.prm'
38 COMMON /MSGSTD/ CSMF
39 COMMON /TNKRCP/ ITRYR,ITRMO,ITRDY,ITRHR,ITRMI,CTRT
41 CHARACTER*1 CSMF
42 CHARACTER*1 CTRT
44 C----------------------------------------------------------------------
45 C----------------------------------------------------------------------
47 C Allow for at least 11 additional bytes of "wiggle room" in the
48 C message, because subroutine MSGWRT may do any or all of the
49 C following:
50 C 3 bytes may be added by a call to subroutine CNVED4
51 C + 1 byte (at most) of padding may be added to Section 4
52 C + 7 bytes (at most) of padding may be added up to the next
53 C word boundary after Section 5
54 C ----
55 C 11
57 IWGBYT = 11
59 C But subroutine MSGWRT may also do any of all of the following:
61 C 6 bytes may be added by a call to subroutine ATRCPT
63 IF(CTRT.EQ.'Y') IWGBYT = IWGBYT + 6
65 C (MAXNC*2) bytes (at most) may be added by a call to
66 C subroutine STNDRD
68 IF(CSMF.EQ.'Y') IWGBYT = IWGBYT + (MAXNC*2)
70 C Determine whether the subset will fit.
72 IF ( ( MSIZ + ITOADD + IWGBYT ) .GT. MXSIZ ) THEN
73 MSGFULL = .TRUE.
74 ELSE
75 MSGFULL = .FALSE.
76 ENDIF
78 RETURN
79 END