NetCDF  4.9.2
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 #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 
43 int
44 NC4_initialize(void)
45 {
46  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  return ret;
71 }
72 
79 int
80 NC4_finalize(void)
81 {
82  return NC_NOERR;
83 }
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:125
Main header file for the C API.
#define NC_UDF0
User-defined format 0.
Definition: netcdf.h:137
#define NC_NOERR
No Error.
Definition: netcdf.h:368