NCEPLIBS-bufr  11.6.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> | Date | Programmer | Comments |
35 C> | -----|------------|----------|
36 C> | 2015-03-02 | J. Ator | Original author |
37 C>
38  SUBROUTINE exitbufr
39 
40  USE modv_ifopbf
41  USE moda_stbfr
42  USE moda_s01cm
43 
44  COMMON /tablef/ cdmf
45 
46  CHARACTER*1 cdmf
47 
48 C-----------------------------------------------------------------------
49 C-----------------------------------------------------------------------
50 
51 C Close any logical units that are open to the library.
52 
53  DO jj = 1, nfiles
54  IF ( iolun(jj) .NE. 0 ) CALL closbf( abs(iolun(jj)) )
55  END DO
56 
57 C Deallocate all allocated memory.
58 
59  CALL ardllocf
60 
61  IF ( cdmf .EQ. 'Y' ) CALL dlloctbf
62 
63 C Reset the library.
64 
65  ns01v = 0
66  ifopbf = 0
67 
68  RETURN
69  END
subroutine closbf(LUNIT)
This subroutine closes the connection between logical unit LUNIT and the BUFRLIB software.
Definition: closbf.f:34
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:20
subroutine exitbufr
This subroutine frees all dynamically-allocated memory, closes all logical units that are open within...
Definition: exitbufr.f:38
subroutine ardllocf
This subroutine frees any memory that was dynamically allocated during a previous call to subroutine ...
Definition: ardllocf.f:16