1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 * Copyright by The HDF Group. * 3 * Copyright by the Board of Trustees of the University of Illinois. * 4 * All rights reserved. * 5 * * 6 * This file is part of HDF. The full HDF copyright notice, including * 7 * terms governing use, modification, and redistribution, is contained in * 8 * the COPYING file, which can be found at the root of the source code * 9 * distribution tree, or in https://support.hdfgroup.org/ftp/HDF/releases/. * 10 * If you do not have access to either file, you may request a copy from * 11 * help@hdfgroup.org. * 12 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 13 14 /* $Id$ */ 15 16 /*+ hlimits.h 17 *** This file contains all hard coded limits for the library 18 *** and reserved vdata/vgroup names and classes. 19 *** Also pre-defined attribute names are contained in thie file. 20 + */ 21 22 #ifndef _HLIMITS_H 23 #define _HLIMITS_H 24 25 #if defined _WIN32 26 #define HDsetvbuf(F,S,M,Z) (((Z)>1)?setvbuf(F,S,M,Z):setvbuf(F,S,M,2)) 27 #else 28 #define HDsetvbuf(F,S,M,Z) setvbuf(F,S,M,Z) 29 #endif 30 /************************************************************************** 31 * Generally useful macro definitions 32 * (These are copied from hdfi.h and shoudl remain included in both files 33 * because hlimits.h is included from netcdf.h which is used in some 34 * netCDF utilities which don't need or want the rest of the HDF header 35 * files. -QAK - 2/17/99 ) 36 **************************************************************************/ 37 #ifndef MIN 38 #define MIN(a,b) (((a)<(b)) ? (a) : (b)) 39 #endif 40 #ifndef MAX 41 #define MAX(a,b) (((a)>(b)) ? (a) : (b)) 42 #endif 43 44 /* ------------------------- General Constants hdf.h --------------------- */ 45 /* tbuf used as a temporary buffer for small jobs. The size is 46 preferably > 512 but MUST be > ~256. It is advised that if an 47 arbitrarily large buffer (> 100 bytes) is require, dynamic space be 48 used. tbuf lives in the hfile.c */ 49 50 #ifndef TBUF_SZ 51 # define TBUF_SZ 1024 52 #endif 53 54 /* File name max length (old annotations) */ 55 #define DF_MAXFNLEN 256 56 57 /* 58 * some max lengths for the Vset interface 59 * 60 * Except for FIELDNAMELENMAX, change these as you please, they 61 * affect memory only, not the file. 62 * 63 */ 64 65 #define FIELDNAMELENMAX 128 /* fieldname : 128 chars max */ 66 #define VSFIELDMAX 256 /* max no of fields per vdata */ 67 #define VSNAMELENMAX 64 /* vdata name : 64 chars max */ 68 #define VGNAMELENMAX 64 /* vgroup name : 64 chars max */ 69 /* Note: VGNAMELENMAX has been removed from library, test, and tools 70 except in mfgr.c and Fortran interface, in favor of dynamic allocation. 71 BMR- 1/28/2010 */ 72 73 /* 74 * default max no of objects in a vgroup 75 * VGroup will grow dynamically if needed 76 */ 77 #define MAXNVELT 64 78 79 /* 80 * Defaults for linked block operations with Vsets 81 */ 82 #define VDEFAULTBLKSIZE 4096 83 #define VDEFAULTNBLKS 32 84 85 /* Max order of a field in a Vdata */ 86 #define MAX_ORDER 65535 87 #define MAX_FIELD_SIZE 65535 88 89 90 /* ------------------------- Constants for hfile.c --------------------- */ 91 /* Maximum number of files (number of slots for file records) */ 92 #ifndef MAX_FILE 93 # define MAX_FILE 32 94 #endif /* MAX_FILE */ 95 96 /* Maximum length of external filename(s) (used in hextelt.c) */ 97 #ifndef MAX_PATH_LEN 98 #define MAX_PATH_LEN 1024 99 #endif /* MAX_PATH_LEN */ 100 101 /* ndds (number of dd's in a block) default, 102 so user need not specify */ 103 #ifndef DEF_NDDS 104 # define DEF_NDDS 16 105 #endif /* DEF_NDDS */ 106 107 /* ndds minimum, to prevent excessive overhead of very small dd-blocks */ 108 #ifndef MIN_NDDS 109 # define MIN_NDDS 4 110 #endif /* MIN_NDDS */ 111 112 /* largest number that will fit into 16-bit word ref variable */ 113 #define MAX_REF ((uint16)65535) 114 115 /* length of block and number of blocks for converting 'appendable' data */ 116 /* elements into linked blocks (will eventually be replaced by the newer */ 117 /* variable-length blocks */ 118 #define HDF_APPENDABLE_BLOCK_LEN 4096 119 #define HDF_APPENDABLE_BLOCK_NUM 16 120 121 /* hashing information */ 122 #define HASH_MASK 0xff 123 #define HASH_BLOCK_SIZE 100 124 125 /* ------------------------- Constants for Vxx interface --------------------- */ 126 127 /* 128 * Private conversion buffer stuff 129 * VDATA_BUFFER_MAX is the largest buffer that can be allocated for 130 * writing (haven't implemented reading yet). 131 * Vtbuf is the buffer 132 * Vtbufsize is the buffer size in bytes at any given time. 133 * Vtbuf is increased in size as need be 134 * BUG: the final Vtbuf never gets freed 135 */ 136 #define VDATA_BUFFER_MAX 1000000 137 138 /* --------------------- Constants for DFSDxx interface --------------------- */ 139 140 #define DFS_MAXLEN 255 /* Max length of label/unit/format strings */ 141 #define DFSD_MAXFILL_LEN 16 /* Current max length for fill_value space */ 142 143 /* ----------------- Constants for COMPRESSION interface --------------------- */ 144 145 /* Set the following macro to the value the highest compression scheme is */ 146 #define COMP_MAX_COMP 12 147 #define COMP_HEADER_LENGTH 14 148 149 /* ----------------- Constants for DGROUP interface --------------------- */ 150 #define MAX_GROUPS 8 151 152 /* ----------------- Constants for HERROR interface --------------------- */ 153 #define FUNC_NAME_LEN 32 154 155 /* error_stack is the error stack. error_top is the stack top pointer, 156 and points tothe next available slot on the stack */ 157 #ifndef ERR_STACK_SZ 158 # define ERR_STACK_SZ 10 159 #endif 160 161 /* max size of a stored error description */ 162 #ifndef ERR_STRING_SIZE 163 # define ERR_STRING_SIZE 512 164 #endif 165 166 /* ----------------- Constants for NETCDF interface(netcdf.h) ---------------- */ 167 /* 168 * This can be as large as the maximum number of stdio streams 169 * you can have open on your system. 170 */ 171 #define H4_MAX_NC_OPEN MAX_FILE 172 173 /* 174 * These maximums are enforced by the interface, to facilitate writing 175 * applications and utilities. However, nothing is statically allocated to 176 * these sizes internally. 177 */ 178 #define H4_MAX_NC_DIMS 5000 /* max dimensions per file */ 179 #define H4_MAX_NC_ATTRS 3000 /* max global or per variable attributes */ 180 #define H4_MAX_NC_VARS 5000 /* max variables per file */ 181 /* This macro changed the behavior of the SDcreate function in HDF4r1.3 182 * SDcreate started to fail if SDS name length was greater than 64, instead of truncating 183 * it to 64 characters and creating a dataset. Switched back to the old definition. 184 * EP 5/5/2000 185 #define H4_MAX_NC_NAME MIN(256,MIN(VSNAMELENMAX,VGNAMELENMAX)) */ 186 187 #define H4_MAX_NC_NAME 256 /* max length of a name */ 188 #define H4_MAX_NC_CLASS 128 /* max length of a class name - added this 189 because 128 was used commonly in SD for class name, and this will help 190 changing the class name variable declaration much easier - BMR 4/1/02*/ 191 #define H4_MAX_VAR_DIMS 32 /* max per variable dimensions */ 192 193 /* These definitions here are for backward/forward compatibiliy since major 194 constants were modified with H4 prefix to avoid conflicts with the 195 real NetCDF-3 library - EIP 9/5/07 */ 196 197 #ifdef H4_HAVE_NETCDF 198 #define MAX_NC_OPEN H4_MAX_NC_OPEN 199 #define MAX_NC_DIMS H4_MAX_NC_DIMS 200 #define MAX_NC_VARS H4_MAX_NC_VARS 201 #define MAX_NC_NAME H4_MAX_NC_NAME 202 #define MAX_NC_CLASS H4_MAX_NC_CLASS 203 #define MAX_VAR_DIMS H4_MAX_VAR_DIMS 204 #endif 205 206 /* ----------------- Constants for MFGR interface --------------------- */ 207 #define H4_MAX_GR_NAME 256 /* max length of a name */ 208 209 #endif /* _HLIMITS_H */ 210 211 /* ----------- Reserved classes and names for vdatas/vgroups -----*/ 212 213 /* The names of the Vgroups created by the GR interface, from mfgr.h */ 214 #define GR_NAME "RIG0.0" /* name of the Vgroup containing all the images */ 215 #define RI_NAME "RI0.0" /* name of a Vgroup containing information a 216 bout one image */ 217 #define RIGATTRNAME "RIATTR0.0N" /* name of a Vdata containing an 218 attribute */ 219 #define RIGATTRCLASS "RIATTR0.0C" /* class of a Vdata containing an 220 attribute */ 221 /* Vdata and Vgroup attributes use the same class as that of SD attr, 222 * _HDF_ATTRIBUTE "Attr0.0" 8/1/96 */ 223 224 /* classes of the Vdatas/Vgroups created by the SD interface, 225 from local_nc.h */ 226 #define _HDF_ATTRIBUTE "Attr0.0" 227 /* class of a Vdata containing SD interface attribute */ 228 #define _HDF_VARIABLE "Var0.0" 229 /* class of a Vgroup representing an SD NDG */ 230 #define _HDF_SDSVAR "SDSVar" 231 /* class of a Vdata indicating its group is an SDS variable */ 232 /* - only after hdf4r2 */ 233 #define _HDF_CRDVAR "CoordVar" 234 /* name of a Vdata indicating its group is a coordinate variable */ 235 /* - only after hdf4r2 */ 236 #define _HDF_DIMENSION "Dim0.0" 237 /* class of a Vgroup representing an SD dimension */ 238 #define _HDF_UDIMENSION "UDim0.0" 239 /* class of a Vgroup representing an SD UNLIMITED dimension*/ 240 #define DIM_VALS "DimVal0.0" 241 /* class of a Vdata containing an SD dimension size and fake values */ 242 #define DIM_VALS01 "DimVal0.1" 243 /* class of a Vdata containing an SD dimension size */ 244 #define _HDF_CDF "CDF0.0" 245 /* DATA is defined in DTM. Change DATA to DATA0 246 #define DATA "Data0.0" */ 247 #define DATA0 "Data0.0" 248 #define ATTR_FIELD_NAME "VALUES" 249 250 /* The following vdata class name is reserved by the Chunking interface. 251 originally defined in 'hchunks.h'. The full class name 252 currently is "_HDF_CHK_TBL_0". -GV 9/25/97 253 254 Made the vdata class name available to other interfaces since it is needed 255 during hmap project. -BMR 11/11/2010 */ 256 #define _HDF_CHK_TBL_CLASS "_HDF_CHK_TBL_" /* 13 bytes */ 257 #define _HDF_CHK_TBL_CLASS_VER 0 /* zero version number for class */ 258 259 /* 260 #define NUM_INTERNAL_VGS 6 261 char *INTERNAL_HDF_VGS[] = {_HDF_VARIABLE, _HDF_DIMENSION, _HDF_UDIMENSION, 262 _HDF_CDF, GR_NAME, RI_NAME}; 263 264 #define NUM_INTERNAL_VDS 8 265 char *INTERNAL_HDF_VDS[] = {DIM_VALS, DIM_VALS01, _HDF_ATTRIBUTE, _HDF_SDSVAR, 266 _HDF_CRDVAR, "_HDF_CHK_TBL_", RIGATTRNAME, RIGATTRCLASS}; 267 268 */ 269 /* ------------ pre-defined attribute names ---------------- */ 270 /* For MFGR interface */ 271 #define FILL_ATTR "FillValue" 272 /* name of an attribute containing the fill value */ 273 274 /* For SD interface */ 275 #define _FillValue "_FillValue" 276 /* name of an attribute to set fill value for an SDS */ 277 #define _HDF_LongName "long_name" /* data/dimension label string */ 278 #define _HDF_Units "units" /* data/dimension unit string */ 279 #define _HDF_Format "format" /* data/dimension format string */ 280 #define _HDF_CoordSys "coordsys" /* data coordsys string */ 281 #define _HDF_ValidRange "valid_range" /* valid range of data values */ 282 #define _HDF_ScaleFactor "scale_factor" /* data calibration factor */ 283 #define _HDF_ScaleFactorErr "scale_factor_err" /* data calibration factor error */ 284 #define _HDF_AddOffset "add_offset" /* calibration offset */ 285 #define _HDF_AddOffsetErr "add_offset_err" /* calibration offset error */ 286 #define _HDF_CalibratedNt "calibrated_nt" /* data type of uncalibrated data */ 287 #define _HDF_ValidMax "valid_max" 288 #define _HDF_ValidMin "valid_min" 289 #define _HDF_Remarks "remarks" /* annotation, by DFAN */ 290 #define _HDF_AnnoLabel "anno_label" /* annotation label, by DFAN */ 291