Coverage Report

Created: 2023-05-28 06:42

/src/netcdf-c/libsrc4/nc4dispatch.c
Line
Count
Source
1
/* Copyright 2005-2018 University Corporation for Atmospheric
2
   Research/Unidata. */
3
/**
4
 * @file
5
 * @internal This header file contains libsrc4 dispatch
6
 * initialization, user-defined format, and logging prototypes and
7
 * macros.
8
 *
9
 * @author Dennis Heimbigner, Ed Hartnett
10
 */
11
12
#include "config.h"
13
#include <stdlib.h>
14
#include "netcdf.h"
15
#include "nc4internal.h"
16
#include "nc4dispatch.h"
17
#include "nc.h"
18
19
/* If user-defined formats are in use, we need to declare their
20
 * dispatch tables. */
21
#ifdef USE_UDF0
22
extern NC_Dispatch UDF0_DISPATCH;
23
#endif /* USE_UDF0 */
24
#ifdef USE_UDF1
25
extern NC_Dispatch UDF1_DISPATCH;
26
#endif /* USE_UDF1 */
27
28
#ifdef USE_NETCDF4
29
/* Pointers to dispatch tables for user-defined formats. */
30
extern NC_Dispatch *UDF0_dispatch_table;
31
extern NC_Dispatch *UDF1_dispatch_table;
32
#endif /* USE_NETCDF4 */
33
34
35
36
/**
37
 * @internal Initialize netCDF-4. If user-defined format(s) have been
38
 * specified in configure, load their dispatch table(s).
39
 *
40
 * @return ::NC_NOERR No error.
41
 * @author Dennis Heimbigner
42
 */
43
int
44
NC4_initialize(void)
45
1
{
46
1
    int ret = NC_NOERR;
47
48
#ifdef USE_UDF0
49
    /* If user-defined format 0 was specified during configure, set up
50
     * it's dispatch table. */
51
    if ((ret = nc_def_user_format(NC_UDF0, UDF0_DISPATCH_FUNC, NULL)))
52
        return ret;
53
#endif /* USE_UDF0 */
54
55
#ifdef USE_UDF1
56
    /* If user-defined format 0 was specified during configure, set up
57
     * it's dispatch table. */
58
    if ((ret = nc_def_user_format(NC_UDF1F, &UDF1_DISPATCH_FUNC, NULL)))
59
        return ret;
60
#endif /* USE_UDF0 */
61
62
#ifdef LOGGING
63
    if(getenv(NCLOGLEVELENV) != NULL) {
64
        char* slevel = getenv(NCLOGLEVELENV);
65
        long level = atol(slevel);
66
        if(level >= 0)
67
            nc_set_log_level((int)level);
68
    }
69
#endif
70
1
    return ret;
71
1
}
72
73
/**
74
 * @internal Finalize netCDF-4.
75
 *
76
 * @return ::NC_NOERR No error.
77
 * @author Dennis Heimbigner
78
 */
79
int
80
NC4_finalize(void)
81
1
{
82
1
    return NC_NOERR;
83
1
}