NetCDF 4.10.0
Loading...
Searching...
No Matches
nc4dispatch.c
Go to the documentation of this file.
1/* Copyright 2005-2018 University Corporation for Atmospheric
2 Research/Unidata. */
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#include "ncudfplugins.h"
19
20/* If user-defined formats are in use, we need to declare their
21 * dispatch tables. */
22#ifdef USE_UDF0
23extern NC_Dispatch UDF0_DISPATCH;
24#endif /* USE_UDF0 */
25#ifdef USE_UDF1
26extern NC_Dispatch UDF1_DISPATCH;
27#endif /* USE_UDF1 */
28
29extern int nc_plugin_path_initialize(void);
30extern int nc_plugin_path_finalize(void);
31
39int
40NC4_initialize(void)
41{
42 int ret = NC_NOERR;
43
44#ifdef USE_UDF0
45 /* If user-defined format 0 was specified during configure, set up
46 * it's dispatch table. */
47 if ((ret = nc_def_user_format(NC_UDF0, UDF0_DISPATCH_FUNC, NULL)))
48 return ret;
49#endif /* USE_UDF0 */
50
51#ifdef USE_UDF1
52 /* If user-defined format 0 was specified during configure, set up
53 * it's dispatch table. */
54 if ((ret = nc_def_user_format(NC_UDF1F, &UDF1_DISPATCH_FUNC, NULL)))
55 return ret;
56#endif /* USE_UDF0 */
57
58#ifdef LOGGING
59 if(getenv(NCLOGLEVELENV) != NULL) {
60 char* slevel = getenv(NCLOGLEVELENV);
61 long level = atol(slevel);
62#ifdef USE_NETCDF4
63 if(level >= 0) {
64 nc_set_log_level((int)level);
65 }
66 }
67#endif
68#endif
69
70#if defined(USE_HDF5) || defined(NETCDF_ENABLE_NCZARR)
71 nc_plugin_path_initialize();
72#endif
73
74 /* Load UDF plugins from RC file configuration */
75 if ((ret = NC_udf_load_plugins()))
76 return ret;
77
78 NC_initialize_reserved();
79 return ret;
80}
81
88int
89NC4_finalize(void)
90{
91#if defined(USE_HDF5) || defined(NETCDF_ENABLE_NCZARR)
92 nc_plugin_path_finalize();
93#endif
94 return NC_NOERR;
95}
EXTERNL int nc_def_user_format(int mode_flag, NC_Dispatch *dispatch_table, char *magic_number)
Add handling of user-defined format.
Definition dfile.c:166
Main header file for the C API.
#define NC_UDF0
User-defined format 0 (bit 6).
Definition netcdf.h:152
struct NC_Dispatch NC_Dispatch
Register a user-defined format.
Definition netcdf.h:652
#define NC_NOERR
No Error.
Definition netcdf.h:417