NetCDF  4.9.3
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 
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 extern int nc_plugin_path_initialize(void);
29 extern int nc_plugin_path_finalize(void);
30 
38 int
39 NC4_initialize(void)
40 {
41  int ret = NC_NOERR;
42 
43 #ifdef USE_UDF0
44  /* If user-defined format 0 was specified during configure, set up
45  * it's dispatch table. */
46  if ((ret = nc_def_user_format(NC_UDF0, UDF0_DISPATCH_FUNC, NULL)))
47  return ret;
48 #endif /* USE_UDF0 */
49 
50 #ifdef USE_UDF1
51  /* If user-defined format 0 was specified during configure, set up
52  * it's dispatch table. */
53  if ((ret = nc_def_user_format(NC_UDF1F, &UDF1_DISPATCH_FUNC, NULL)))
54  return ret;
55 #endif /* USE_UDF0 */
56 
57 #ifdef LOGGING
58  if(getenv(NCLOGLEVELENV) != NULL) {
59  char* slevel = getenv(NCLOGLEVELENV);
60  long level = atol(slevel);
61 #ifdef USE_NETCDF4
62  if(level >= 0)
63  nc_set_log_level((int)level);
64  }
65 #endif
66 #endif
67 
68 #if defined(USE_HDF5) || defined(NETCDF_ENABLE_NCZARR)
69  nc_plugin_path_initialize();
70 #endif
71 
72  NC_initialize_reserved();
73  return ret;
74 }
75 
82 int
83 NC4_finalize(void)
84 {
85 #if defined(USE_HDF5) || defined(NETCDF_ENABLE_NCZARR)
86  nc_plugin_path_finalize();
87 #endif
88  return NC_NOERR;
89 }
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:123
Main header file for the C API.
#define NC_UDF0
User-defined format 0.
Definition: netcdf.h:146
#define NC_NOERR
No Error.
Definition: netcdf.h:378