NCEPLIBS-bufr  11.5.0
 All Data Structures Files Functions Variables Pages
exitbufr.f
Go to the documentation of this file.
1 C> @file
2 C> @brief Reset the BUFRLIB software for potential dynamic
3 C> reallocation of memory.
4 
5 C> This subroutine frees all dynamically-allocated memory,
6 C> closes all logical units that are open within the
7 C> BUFRLIB software, and resets the library to all of its
8 C> default settings as though it had never been called.
9 C>
10 C> @author J. Ator
11 C> @date 2015-03-02
12 C>
13 C> @remarks
14 C> - Calling this subroutine allows an application program to
15 C> potentially resize arrays and reallocate memory all over again
16 C> with a new subsequent series of calls to subroutines isetprm()
17 C> and openbf(). However, if and when this subroutine is called,
18 C> there is no longer any internal memory available within the
19 C> BUFRLIB software, and the remainder of the library becomes
20 C> essentially unusable within the application program, unless
21 C> and until subroutine openbf() is called once again to
22 C> dynamically allocate new array space. This may be a useful
23 C> capability for application programs that are finished with
24 C> using the BUFRLIB software and wish to move on to other
25 C> unrelated tasks without continuing to tie up all of the
26 C> allocated memory space within the library. Otherwise, and
27 C> unless there's a need to change parameter sizes following the
28 C> first call to subroutine openbf(), then there's no need to ever
29 C> call this subroutine within an application program, since all
30 C> allocated memory will automatically get freed anyway by the
31 C> operating system once the application program terminates.
32 C>
33 C> <b>Program history log:</b>
34 C> - 2015-03-02 J. Ator -- Original author
35 C>
36  SUBROUTINE exitbufr
37 
38  USE modv_ifopbf
39  USE moda_stbfr
40  USE moda_s01cm
41 
42  COMMON /tablef/ cdmf
43 
44  CHARACTER*1 cdmf
45 
46 C-----------------------------------------------------------------------
47 C-----------------------------------------------------------------------
48 
49 C Close any logical units that are open to the library.
50 
51  DO jj = 1, nfiles
52  IF ( iolun(jj) .NE. 0 ) CALL closbf( abs(iolun(jj)) )
53  END DO
54 
55 C Deallocate all allocated memory.
56 
57  CALL ardllocf
58 
59  IF ( cdmf .EQ. 'Y' ) CALL dlloctbf
60 
61 C Reset the library.
62 
63  ns01v = 0
64  ifopbf = 0
65 
66  RETURN
67  END
subroutine closbf(LUNIT)
This subroutine closes the connection between logical unit LUNIT and the BUFRLIB software.
Definition: closbf.F:36
This module declares and initializes the IFOPBF variable.
Definition: modv_IFOPBF.f90:9
void dlloctbf(void)
This subroutine frees any memory that was dynamically allocated during a previous call to subroutine ...
Definition: dlloctbf.c:18
subroutine exitbufr
This subroutine frees all dynamically-allocated memory, closes all logical units that are open within...
Definition: exitbufr.f:36
subroutine ardllocf
This subroutine frees any memory that was dynamically allocated during a previous call to subroutine ...
Definition: ardllocf.F:14