1 /****************************************************************************** 2 * 3 * NSSDC/CDF Header file for CDF library. 4 * 5 * Version 3.7e, 18-Nov-97, Hughes STX. 6 * 7 * Modification history: 8 * 9 * V1.0 22-Jan-91, R Kulkarni Original version (for CDF V2.0). 10 * J Love 11 * 12 * V2.0 3-Jun-91, J Love Renamed (was cdf_internal.h). Modified for 13 * CDF V2.1, namely the moving of constant macros 14 * to "cdf.h" for the INTERNAL interface and the 15 * single/multi-file option. Renamed some symbols 16 * for clarity. 17 * V2.1 24-Jun-91, J Love Fixed for SGi port. 18 * V2.2 8-Aug-91, J Love Added 'Eof' (feof). Added some miscellaneous 19 * macro definitions. Renamed (was cdflib.h). 20 * Added support for Cray/UNICOS. Added 'Exit' 21 * and 'ExitBAD'. Added VIO_FOR_STREAM. 22 * Functions in VIO were renamed to avoid 23 * collisions on SGi/IRIX. 24 * V3.0 21-Apr-92, J Love IBM PC & HP-UX port. CDF V2.2. 25 * V3.1 21-Sep-92, J Love CDF V2.3 (shareable/NeXT/zVar). 26 * V3.2 24-Jan-94, J Love CDF V2.4. 27 * V3.2a 8-Feb-94, J Love DEC Alpha/OpenVMS port. 28 * V3.3 15-Dec-94, J Love CDF V2.5. 29 * V3.4 9-Jan-95, J Love Encode/decode changes. More cache-residency. 30 * V3.5 19-Jan-95, J Love IRIX 6.0 (64-bit). 31 * V3.5a 15-Mar-95, J Love Solaris 2.3 IDL i/f. Fixed `recNum' argument 32 * of `LastAllocatedRecord'. 33 * V3.6 28-Mar-95, J Love POSIX. 34 * V3.6a 18-Apr-95, J Love More POSIX. 35 * V3.6b 8-May-95, J Love Virtual memory under Microsoft C 7.00. 36 * V3.6c 13-Jun-95, J Love Linux. 37 * V3.6d 7-Sep-95, J Love Moved `ASSIGNnotNULL' to `cdfdist.h'. 38 * CDFexport-related changes. More virtual 39 * memory (Microsoft C 7.00). 40 * V3.7 5-Sep-96, J Love CDF V2.6. 41 * V3.7a 20-Nov-96, J Love Removed definitions of BIG/LITTLE_ENDIAN which 42 * were no longer used and caused a redefinition 43 * on Linux systems. 44 * V3.7b 21-Feb-97, J Love Removed RICE. 45 * V3.7c 8-Mar-97, J Love Windows NT for MS Visual C/C++ on an IBM PC. 46 * V3.7d 2-Sep-97, J Love Made magic number variables `uInt32'. 47 * V3.7e 18-Nov-97, J Love More Windows NT. 48 * V3.7f 25-May-98, M Liu Add 3 new fields in VarStruct data structure 49 * Add one more parameter in HyperReadDim and 50 * HyperWriteDim proto function. 51 * V3.8 04-May-01, M Liu Add Cygwin port. 52 * V3.9 08-Apr-04, M Liu Add CURr/zVarOffset fields to the CDF 53 * structure. 54 * V3.10 11-Jul-05, M Liu Added MingW port for PC. 55 * V3.11 30-Jan-06, M Liu Added FreeBSD port. 56 * V3.20 25-Apr-07, D Berger Changed nCACHE_BUFFER_BYTEs from 512 to 10240. 57 * V3.21 04-May-07, D Berger Added option to define Fif_ENTRYPOINT based on 58 * predefined constants. 59 * V3.22 18-Jun-07, D Berger Added structures in support of metadata 60 * READONLY performance enhancement. 61 * V3.23 10-Jan-09, M Liu Added maximum sizes for internal records. 62 * V3.24 28-Apr-09, M Liu Added "__PPC__" for Linux on PPC. 63 * 64 ******************************************************************************/ 65 66 #if !defined(CDFLIBh_INCLUDEd__) 67 # define CDFLIBh_INCLUDEd__ 68 69 /***************************************************************************** 70 * Include files. 71 *****************************************************************************/ 72 73 #if !defined(FORJNI) /* It is defined to compiler as -D "FORJNI" */ 74 # define LIBCDF_SOURCE_ 75 #endif 76 #include "cdfdist.h" 77 78 /***************************************************************************** 79 * V1.x magic number. 80 * This is what a V1 magic number looks like when the bytes are flipped. 81 * The bytes will be flipped on a VAX because the longword was assumed to be 82 * in network order and then flipped to VAX order. The bytes will be flipped 83 * on a Sun, SGi, NeXT, HP, IBM RS, etc. because the longword was assumed to 84 * already be in network order (the same as those machines) but the byte order 85 * in memory is reversed from that of a VAX (where all V1 CDFs were created). 86 *****************************************************************************/ 87 88 #define V1magicNUMBER_flip 0x0F000000 89 90 /***************************************************************************** 91 * V2.x magic numbers. 92 *****************************************************************************/ 93 94 #define V2magicNUMBER_1pre 0x0000FFFF /* Written at offset 0x00000000 95 of pre-V2.6 CDFs. */ 96 #define V2magicNUMBER_1 0xCDF26002 /* Written at offset 0x00000000 97 of V2.6 CDFs. */ 98 #define V3magicNUMBER_1 0xCDF30001 /* Written at offset 0x00000000 99 of V3.0 CDFs. */ 100 #define V2magicNUMBER_2u 0x0000FFFF /* Written at offset 0x00000004 101 of uncompressed V2.6 CDFs (as 102 well as all pre-V2.6 CDFs). */ 103 #define V3magicNUMBER_2u 0x0000FFFF /* Written at offset 0x00000004 104 of uncompressed V3.0 CDFs. */ 105 #define V2magicNUMBER_2c 0xCCCC0001 /* Written at offset 0x00000004 106 of compressed V2.6 CDFs. */ 107 #define V3magicNUMBER_2c 0xCCCC0001 /* Written at offset 0x00000004 108 of compressed V3.0 CDFs. */ 109 #define VALIDid_MAGIC_NUMBER 0x12345678 /* Placed in `CDF' structure 110 (CDFid). Used to check that 111 a valid CDF has been selected 112 by an application. */ 113 #define KILLEDid_MAGIC_NUMBER 0x24682468 /* Placed in `CDF' structure 114 (CDFid) before freeing the 115 structure. This is done in 116 case an application tries to 117 select the CDF again (which 118 might cause some sort of 119 memory violation anyway). */ 120 #define ABORTEDid_MAGIC_NUMBER 0x13571357 /* Placed in `CDF' structure 121 (CDFid) when access to that 122 CDF has been aborted. */ 123 124 /***************************************************************************** 125 * Virtual memory (Microsoft C 7.00). 126 *****************************************************************************/ 127 128 #if defined(MICROSOFTC_700) && INCLUDEvMEMORY 129 typedef _vmhnd_t MemHandle; 130 # if defined(CDFLIB) 131 Logical useVmem = DEFAULT_USEvMEM; 132 long vMemSize = DEFAULT_vMEMSIZE; 133 uInt vMemMask = DEFAULT_vMEMMASK; 134 # else 135 extern Logical useVmem; 136 extern long vMemSize; 137 extern uInt vMemMask; 138 # endif 139 #endif 140 141 /***************************************************************************** 142 * Miscellaneous constants. 143 *****************************************************************************/ 144 145 #define INT32_ZERO ((Int32) 0) 146 #define INT32_ONE ((Int32) 1) 147 148 #define NO_BLOCK (-1) 149 #define NO_OFFSET 0xFFFFFFFF 150 #define NO_OFFSET64 -1 151 #define ZERO_OFFSET 0x00000000 152 #define ZERO_OFFSET64 0 153 154 #define ALLrecordsATonce 1 155 #define ONErecordATaTIME 2 156 #define ONEvalueATaTIME 3 157 158 #define EXT_LEN 3 /* Length of file extensions that are 159 created by the CDF library. This 160 is limited by the 8.3 convention of 161 MS-DOS. */ 162 #define MAX_TMP 99999 163 164 #define READ_ONLY 1 165 #define READ_WRITE 2 166 167 #define NUMcacheUNKNOWN 4 /* The number of cache buffers to use 168 for the "working" dotCDF file when 169 the CDF's format is unknown. This 170 is set large enough to prevent any 171 paging while reading the CDF's 172 format (among other things). */ 173 174 /***************************************************************************** 175 * Variable types. 176 *****************************************************************************/ 177 178 #define STANDARD_ 1 179 #define SPARSE_RECORDS_ 2 180 #define COMPRESSED_ 3 181 #define SPARSE_COMPRESSED_RECORDS_ 4 182 #define SPARSE_ARRAYS_ 5 183 #define SPARSE_RECORDS_AND_ARRAYS_ 6 184 #define IN_MULTI_ 7 185 186 #define SPARSErecords(Var) \ 187 (Var->vType == SPARSE_RECORDS_ || \ 188 Var->vType == SPARSE_COMPRESSED_RECORDS_ || \ 189 Var->vType == SPARSE_RECORDS_AND_ARRAYS_) 190 191 #define SPARSEarrays(Var) \ 192 (Var->vType == SPARSE_ARRAYS_ || Var->vType == SPARSE_RECORDS_AND_ARRAYS_) 193 194 #define COMPRESSED(Var) \ 195 (Var->vType == COMPRESSED_ || Var->vType == SPARSE_COMPRESSED_RECORDS_) 196 197 /***************************************************************************** 198 * Reserved values. 199 *****************************************************************************/ 200 201 #define RESERVED_ATTROFFSET (-1) /* Indicates that an attribute 202 hasn't been selected yet. */ 203 #define RESERVED_ENTRYNUM (-1L) /* Indicates that a g/r/zEntry 204 number hasn't been selected 205 yet. */ 206 #define RESERVED_ENTRYOFFSET (-1) /* Indicates that the current 207 g/r/zEntry does not exist.*/ 208 #define RESERVED_ATTROFFSET64 (-1) 209 #define RESERVED_ENTRYOFFSET64 (-1) 210 #define DUMMY_ATTROFFSET (-2) /* Used for CurAttrOffset in 211 READONLYon mode */ 212 #define DUMMY_ENTRYOFFSET (-2) /* Used for CurEntryOffset in 213 READONLYon mode */ 214 #define RESERVED_VARNUM (-1L) /* Indicates that a variable 215 hasn't been selected yet. */ 216 217 /****************************************************************************** 218 * NETWORKbyteORDERcpu. 219 * network (big-endian)..........Sun, SGi, IBM-RS, HP, NeXT, Macintosh, 220 * PowerPC 221 * non-network (little-endian)...VAX (VMS, POSIX Shell), DECstation, 222 * IBM-PC (MS-DOS, Linux, Solaris, Macos X), 223 * DEC Alpha (OSF/1, OpenVMS, POSIX Shell), 224 ******************************************************************************/ 225 226 #if defined(sun) || defined(MIPSEB) || defined(IBMRS) || defined(HP) || \ 227 defined(NeXT) || defined(mac) || defined(PPC) || defined(macosXppc) || \ 228 defined(__PPC__) || defined(__ppc64__) 229 # define NETWORKbyteORDERcpu 230 #endif 231 232 /****************************************************************************** 233 * XDRishENCODINGcpu. 234 * xdr...........Sun, SGi, IBM-RS, HP, NeXT, Macintosh, PowerPC 235 * non-xdr.......VAX (VMS, POSIX Shell), DECstation, IBM-PC (MS-DOS, Linux 236 * Solaris, Macos X), DEC Alpha (OSF/1, OpenVMS, POSIX Shell). 237 ******************************************************************************/ 238 239 #if defined(sun) || defined(MIPSEB) || defined(IBMRS) || defined(HP) || \ 240 defined(NeXT) || defined(mac) || defined(PPC) || defined(macosXppc) || \ 241 defined(__PPC__) || defined(__ppc64__) 242 # define XDRishENCODINGcpu 243 #endif 244 245 /****************************************************************************** 246 * Constants for `seeking'. 247 ******************************************************************************/ 248 249 #define vSEEK_SET 0 250 #define vSEEK_CUR 1 251 #define vSEEK_END 2 252 253 /***************************************************************************** 254 * CDF V2.0+ constants. 255 *****************************************************************************/ 256 257 #define FIRST_IR_OFFSET ((Int32) 0x00000008) 258 #define V2_MAGIC_OFFSET_1 ((Int32) 0x00000000) 259 #define V2_MAGIC_OFFSET_2 ((Int32) 0x00000004) 260 #define V2_CDR_OFFSET ((Int32) 0x00000008) 261 #define V2_CCR_OFFSET ((Int32) 0x00000008) 262 263 /***************************************************************************** 264 * CDF V3.0+ constants. 265 *****************************************************************************/ 266 267 #define V3_MAGIC_OFFSET_1 ((Int32) 0x00000000) 268 #define V3_MAGIC_OFFSET_2 ((Int32) 0x00000004) 269 270 #define MAGIC_NUMBERS_SIZE 8 271 #define VDR_WASTED_SIZE 128 272 #define VARs_INCREMENT 20 273 274 #define VSTREAM_MAGIC_NUMBER 0x12345678 /* Used to verify that a VFILE 275 structure has been passed 276 to a function. */ 277 278 #define DEFAULT_nCACHE_BUFFERs 1 /* Default number of buffers 279 in the cache. */ 280 #if defined(win32) && (_FILE_OFFSET_BITS == 64) 281 # define nCACHE_BUFFER_BYTEs 10240 /* Size (bytes) of each cache 282 buffer. */ 283 #else 284 # define nCACHE_BUFFER_BYTEs 10240 285 #endif 286 287 #if defined(vms) 288 # define VMS_DEFAULT_nALLOCATION_BLOCKS 3 /* Allocate only 3 blocks at 289 a time (override VMS default 290 of 128 for fixed record 291 length file [or 200 when 292 file FTPed to VMS]). */ 293 #endif 294 295 #define vMAX_TRYs 5 /* Maximum number of trys on a 296 read or write operation. */ 297 298 #define MAX_EPOCH_BINARY 3.15569519999998e14 299 #define MAX_EPOCH16_1_BINARY 3.15569519999E11 300 #define MAX_EPOCH16_2_BINARY 9.99999999998E11 301 302 #define CTIME_STRING_LEN 25 303 304 #define MAX_VXR_ENTRIES 10 /* Maximum from this and 305 previous CDF releases. */ 306 #define NUM_VXR_ENTRIES 7 /* For VXRs whose entries 307 point to VVR/CVVRs. */ 308 #define NUM_VXRx_ENTRIES 3 /* For VXRs whose entries 309 point to other VXRs. */ 310 311 /***************************************************************************** 312 * CDF versions/releases/increments. 313 *****************************************************************************/ 314 315 #define VERSION_1 1 316 #define VERSION_2 2 317 318 #define RELEASE_0 0 319 #define RELEASE_1 1 320 #define RELEASE_2 2 321 #define RELEASE_3 3 322 #define RELEASE_4 4 323 #define RELEASE_5 5 324 #define RELEASE_6 6 325 326 #define INCREMENT_1 1 327 328 /***************************************************************************** 329 * File types. 330 *****************************************************************************/ 331 332 #define CDFt 1 333 #define Vt 3 334 #define Zt 4 335 336 /***************************************************************************** 337 * AbortAccess macros. 338 *****************************************************************************/ 339 340 #define UPDATE TRUE 341 #define noUPDATE FALSE 342 #define DELETE TRUE 343 #define noDELETE FALSE 344 345 /***************************************************************************** 346 * Compression. 347 *****************************************************************************/ 348 349 #define EMPTY TRUE 350 #define notEMPTY FALSE 351 352 /***************************************************************************** 353 * Macros for FORTRAN interface(s). 354 *****************************************************************************/ 355 356 #if defined(vms) || defined(MPW_C) 357 # define Fif_DESCR 358 #endif 359 360 #if (defined(unix) && !defined(Mach)) || defined(SALFORDC) || \ 361 defined(posixSHELL) || defined(_MSC_VER) 362 # define Fif_GHOSTLEN 363 #endif 364 365 #if (defined(dos) && !defined(SALFORDC)) || defined(Mach) 366 # define Fif_NOLEN 367 #endif 368 369 #if defined(double_underscore) 370 # define Fif_ENTRYPOINT(ep__,ep_,ep,EP) ep__ 371 #elif defined(single_underscore) 372 # define Fif_ENTRYPOINT(ep__,ep_,ep,EP) ep_ 373 #elif defined(no_underscore) 374 # define Fif_ENTRYPOINT(ep__,ep_,ep,EP) ep 375 #elif defined(unix) && !defined(AIX) && !defined(Mach) && !defined(hpux) || \ 376 defined(__MINGW32__) 377 # if (defined(linux) && !defined(__ICC)) || defined(__CYGWIN__) || \ 378 defined(sun) || defined(__MINGW32__) 379 # define Fif_ENTRYPOINT(ep__,ep_,ep,EP) ep__ 380 # else 381 # define Fif_ENTRYPOINT(ep__,ep_,ep,EP) ep_ 382 # endif 383 #else 384 # if defined(SALFORDC) 385 # define Fif_ENTRYPOINT(ep__,ep_,ep,EP) EP 386 # else 387 # define Fif_ENTRYPOINT(ep__,ep_,ep,EP) ep 388 # endif 389 #endif 390 391 #if defined(Fif_GHOSTLEN) 392 # if defined(SALFORDC) 393 typedef int *Fif_GHOSTTYPE; 394 # define Fif_GHOSTFETCH(ap) *(va_arg(ap,int *)) 395 # define Fif_GHOSTUSE(l) *l 396 # else 397 typedef int Fif_GHOSTTYPE; 398 # define Fif_GHOSTFETCH(ap) va_arg(ap,int) 399 # define Fif_GHOSTUSE(l) l 400 # endif 401 # define Fif_GHOSTARG(v) ,v 402 # define Fif_GHOSTDEF(v) Fif_GHOSTTYPE v; 403 #else 404 # define Fif_GHOSTARG(v) \ 405 406 # define Fif_GHOSTDEF(v) \ 407 408 #endif 409 410 #if defined(MPW_C) 411 # define Fif_PREFIXa pascal 412 #else 413 # define Fif_PREFIXa \ 414 415 #endif 416 417 #if defined(MICROSOFTC) 418 # if defined(MICROSOFTC_600) 419 # define Fif_PREFIXb _cdecl 420 # endif 421 # if defined(MICROSOFTC_700) 422 # define Fif_PREFIXb __cdecl 423 # endif 424 #else 425 # define Fif_PREFIXb \ 426 427 #endif 428 429 /****************************************************************************** 430 * Integer orders. 431 ******************************************************************************/ 432 433 #define LITTLEendianORDER 1 434 #define BIGendianORDER 2 435 436 /****************************************************************************** 437 * Assumed attribute scopes. 438 ******************************************************************************/ 439 440 #define GLOBALscopeASSUMED 3L 441 #define VARIABLEscopeASSUMED 4L 442 443 /****************************************************************************** 444 * Floating-point types. 445 ******************************************************************************/ 446 447 #define FP_1 1 448 #define FP_2 2 449 #define FP_3 3 450 #define FP_4 4 451 452 /****************************************************************************** 453 * Floating-point structures. 454 ******************************************************************************/ 455 456 #if defined(FP1cpu) 457 struct fp1struct4 { 458 uInt s : 1, e1 : 7, e0 : 1, m2 : 7, m1 : 8, m0 : 8; 459 }; 460 struct fp2struct4 { 461 uInt m0 : 8, m1 : 8, e0 : 1, m2 : 7, s : 1, e1 : 7; 462 }; 463 struct fp34struct4 { 464 uInt e0 : 1, m2 : 7, s : 1, e1 : 7, m0 : 8, m1 : 8; 465 }; 466 struct fp1struct8 { 467 uInt s : 1, e1 : 7, e0 : 4, m6 : 4, m5 : 8, 468 m4 : 8, m3 : 8, m2 : 8, m1 : 8, m0 : 8; 469 }; 470 struct fp2struct8 { 471 uInt m0 : 8, m1 : 8, m2 : 8, m3 : 8, m4 : 8, 472 m5 : 8, e0 : 4, m6 : 4, s : 1, e1 : 7; 473 }; 474 struct fp3struct8 { 475 uInt e0 : 1, m6 : 7, s : 1, e1 : 7, m4 : 8, 476 m5 : 8, m2 : 8, m3 : 8, m0 : 8, m1 : 8; 477 }; 478 struct fp4struct8 { 479 uInt e0 : 4, m6 : 4, s : 1, e1 : 7, m4 : 8, 480 m5 : 8, m2 : 8, m3 : 8, m0 : 8, m1 : 8; 481 }; 482 #endif 483 484 #if defined(FP2cpu) 485 struct fp1struct4 { 486 uInt e1 : 7, s : 1, m2 : 7, e0 : 1, m1 : 8, m0 : 8; 487 }; 488 struct fp2struct4 { 489 uInt m0 : 8, m1 : 8, m2 : 7, e0 : 1, e1 : 7, s : 1; 490 }; 491 struct fp34struct4 { 492 uInt m2 : 7, e0 : 1, e1 : 7, s : 1, m0 : 8, m1 : 8; 493 }; 494 struct fp1struct8 { 495 uInt e1 : 7, s : 1, m6 : 4, e0 : 4, m5 : 8, 496 m4 : 8, m3 : 8, m2 : 8, m1 : 8, m0 : 8; 497 }; 498 struct fp2struct8 { 499 uInt m0 : 8, m1 : 8, m2 : 8, m3 : 8, m4 : 8, 500 m5 : 8, m6 : 4, e0 : 4, e1 : 7, s : 1; 501 }; 502 struct fp3struct8 { 503 uInt m6 : 7, e0 : 1, e1 : 7, s : 1, m4 : 8, 504 m5 : 8, m2 : 8, m3 : 8, m0 : 8, m1 : 8; 505 }; 506 struct fp4struct8 { 507 uInt m6 : 4, e0 : 4, e1 : 7, s : 1, m4 : 8, 508 m5 : 8, m2 : 8, m3 : 8, m0 : 8, m1 : 8; 509 }; 510 #endif 511 512 #if defined(FP3cpu) 513 struct fp1struct4 { 514 uInt e1 : 7, s : 1, m2 : 7, e0 : 1, m1 : 8, m0 : 8; 515 }; 516 struct fp2struct4 { 517 uInt m0 : 8, m1 : 8, m2 : 7, e0 : 1, e1 : 7, s : 1; 518 }; 519 struct fp34struct4 { 520 uInt m2 : 7, e0 : 1, e1 : 7, s : 1, m0 : 8, m1 : 8; 521 }; 522 struct fp1struct8 { 523 uInt e1 : 7, s : 1, m6 : 4, e0 : 4, m5 : 8, 524 m4 : 8, m3 : 8, m2 : 8, m1 : 8, m0 : 8; 525 }; 526 struct fp2struct8 { 527 uInt m0 : 8, m1 : 8, m2 : 8, m3 : 8, m4 : 8, 528 m5 : 8, m6 : 4, e0 : 4, e1 : 7, s : 1; 529 }; 530 struct fp3struct8 { 531 uInt m6 : 7, e0 : 1, e1 : 7, s : 1, m4 : 8, 532 m5 : 8, m2 : 8, m3 : 8, m0 : 8, m1 : 8; 533 }; 534 struct fp4struct8 { 535 uInt m6 : 4, e0 : 4, e1 : 7, s : 1, m4 : 8, 536 m5 : 8, m2 : 8, m3 : 8, m0 : 8, m1 : 8; 537 }; 538 #endif 539 540 #if defined(FP4cpu) 541 struct fp1struct4 { 542 uInt e1 : 7, s : 1, m2 : 7, e0 : 1, m1 : 8, m0 : 8; 543 }; 544 struct fp2struct4 { 545 uInt m0 : 8, m1 : 8, m2 : 7, e0 : 1, e1 : 7, s : 1; 546 }; 547 struct fp34struct4 { 548 uInt m2 : 7, e0 : 1, e1 : 7, s : 1, m0 : 8, m1 : 8; 549 }; 550 struct fp1struct8 { 551 uInt e1 : 7, s : 1, m6 : 4, e0 : 4, m5 : 8, 552 m4 : 8, m3 : 8, m2 : 8, m1 : 8, m0 : 8; 553 }; 554 struct fp2struct8 { 555 uInt m0 : 8, m1 : 8, m2 : 8, m3 : 8, m4 : 8, 556 m5 : 8, m6 : 4, e0 : 4, e1 : 7, s : 1; 557 }; 558 struct fp3struct8 { 559 uInt m6 : 7, e0 : 1, e1 : 7, s : 1, m4 : 8, 560 m5 : 8, m2 : 8, m3 : 8, m0 : 8, m1 : 8; 561 }; 562 struct fp4struct8 { 563 uInt m6 : 4, e0 : 4, e1 : 7, s : 1, m4 : 8, 564 m5 : 8, m2 : 8, m3 : 8, m0 : 8, m1 : 8; 565 }; 566 #endif 567 568 /****************************************************************************** 569 * REVERSE2b. 570 ******************************************************************************/ 571 572 #define REVERSE2b(buf) { \ 573 Byte *_buf_ = (Byte *) (buf), _temp_; \ 574 _temp_ = _buf_[0]; \ 575 _buf_[0] = _buf_[1]; \ 576 _buf_[1] = _temp_; \ 577 } 578 579 /****************************************************************************** 580 * REVERSE4b. 581 ******************************************************************************/ 582 583 #define REVERSE4b(buf) { \ 584 Byte *_buf_ = (Byte *) (buf), _temp_; \ 585 _temp_ = _buf_[0]; \ 586 _buf_[0] = _buf_[3]; \ 587 _buf_[3] = _temp_; \ 588 _temp_ = _buf_[1]; \ 589 _buf_[1] = _buf_[2]; \ 590 _buf_[2] = _temp_; \ 591 } 592 593 /****************************************************************************** 594 * REVERSE8b. 595 ******************************************************************************/ 596 597 #define REVERSE8b(buf) { \ 598 Byte *_buf_ = (Byte *) (buf), _temp_; \ 599 _temp_ = _buf_[0]; \ 600 _buf_[0] = _buf_[7]; \ 601 _buf_[7] = _temp_; \ 602 _temp_ = _buf_[1]; \ 603 _buf_[1] = _buf_[6]; \ 604 _buf_[6] = _temp_; \ 605 _temp_ = _buf_[2]; \ 606 _buf_[2] = _buf_[5]; \ 607 _buf_[5] = _temp_; \ 608 _temp_ = _buf_[3]; \ 609 _buf_[3] = _buf_[4]; \ 610 _buf_[4] = _temp_; \ 611 } 612 613 /****************************************************************************** 614 * REVERSE2bIO. 615 ******************************************************************************/ 616 617 #define REVERSE2bIO(iPtr,oPtr) \ 618 ((Byte *) (oPtr))[0] = ((Byte *) (iPtr))[1]; \ 619 ((Byte *) (oPtr))[1] = ((Byte *) (iPtr))[0]; 620 621 /****************************************************************************** 622 * REVERSE4bIO. 623 ******************************************************************************/ 624 625 #define REVERSE4bIO(iPtr,oPtr) \ 626 ((Byte *) (oPtr))[0] = ((Byte *) (iPtr))[3]; \ 627 ((Byte *) (oPtr))[1] = ((Byte *) (iPtr))[2]; \ 628 ((Byte *) (oPtr))[2] = ((Byte *) (iPtr))[1]; \ 629 ((Byte *) (oPtr))[3] = ((Byte *) (iPtr))[0]; 630 631 /****************************************************************************** 632 * REVERSE8bIO. 633 ******************************************************************************/ 634 635 #define REVERSE8bIO(iPtr,oPtr) \ 636 ((Byte *) (oPtr))[0] = ((Byte *) (iPtr))[7]; \ 637 ((Byte *) (oPtr))[1] = ((Byte *) (iPtr))[6]; \ 638 ((Byte *) (oPtr))[2] = ((Byte *) (iPtr))[5]; \ 639 ((Byte *) (oPtr))[3] = ((Byte *) (iPtr))[4]; \ 640 ((Byte *) (oPtr))[4] = ((Byte *) (iPtr))[3]; \ 641 ((Byte *) (oPtr))[5] = ((Byte *) (iPtr))[2]; \ 642 ((Byte *) (oPtr))[6] = ((Byte *) (iPtr))[1]; \ 643 ((Byte *) (oPtr))[7] = ((Byte *) (iPtr))[0]; 644 645 /****************************************************************************** 646 * LoadCVVRx/LoadVVRx. 647 ******************************************************************************/ 648 649 #define LoadCVVRx(cvvr,recordsize,csize) \ 650 cvvr.RecordSize = (Int32) (recordsize); \ 651 cvvr.RecordType = CVVR_; \ 652 cvvr.rfuA = (Int32) 0; \ 653 cvvr.cSize = (Int32) (csize); 654 655 #define LoadVVRx(vvr,recordsize) \ 656 vvr.RecordSize = (Int32) (recordsize); \ 657 vvr.RecordType = VVR_; 658 659 /****************************************************************************** 660 * LoadAllocCVVR/LoadAllocVVR. 661 ******************************************************************************/ 662 663 #define LoadAllocCVVR(alloc,firstrec,lastrec,csize,xsize) \ 664 alloc.first = (Int32) (firstrec); \ 665 alloc.last = (Int32) (lastrec); \ 666 alloc.type = (int) CVVR_; \ 667 alloc.cvvr.cSize = (Int32) (csize); \ 668 alloc.cvvr.xSize = (Int32) (xsize); 669 670 #define LoadAllocVVR(alloc,firstrec,lastrec,newvvr) \ 671 alloc.first = (Int32) (firstrec); \ 672 alloc.last = (Int32) (lastrec); \ 673 alloc.type = (int) VVR_; \ 674 alloc.vvr.newX = (Logical) (newvvr); 675 676 /****************************************************************************** 677 * GLOBALscope/VARIABLEscope/DEFINITEscope. 678 ******************************************************************************/ 679 680 #define GLOBALscope(scope) \ 681 (scope == GLOBAL_SCOPE || scope == GLOBALscopeASSUMED) 682 683 #define VARIABLEscope(scope) \ 684 (scope == VARIABLE_SCOPE || scope == VARIABLEscopeASSUMED) 685 686 #define DEFINITEscope(scope) \ 687 (BOO(scope == GLOBALscopeASSUMED, \ 688 GLOBAL_SCOPE,BOO(scope == VARIABLEscopeASSUMED,VARIABLE_SCOPE,scope))) 689 690 /****************************************************************************** 691 * FLOAT8dataType. 692 * Macro to check for a double-precision floating-point data type. 693 ******************************************************************************/ 694 695 #define FLOAT8dataType(dataType) \ 696 (dataType == CDF_REAL8 || dataType == CDF_DOUBLE || dataType == CDF_EPOCH) 697 698 /****************************************************************************** 699 * FLOAT16dataType. 700 * Macro to check for a (sudo) 16-byte (2 8-byte) floating-point data type. 701 ******************************************************************************/ 702 703 #define FLOAT16dataType(dataType) \ 704 (dataType == CDF_EPOCH16) 705 706 /****************************************************************************** 707 * Operating system dependent definitions. 708 ******************************************************************************/ 709 710 #if defined(vms) || defined(dos) || defined(mac) || defined(win32) || \ 711 defined(__CYGWIN__) || defined(__MINGW32__) 712 # define READ_ONLY_a_mode "rb" 713 # define READ_PLUS_a_mode "r+b" 714 # define WRITE_PLUS_a_mode "w+b" 715 #else 716 # define READ_ONLY_a_mode "r" 717 # define READ_PLUS_a_mode "r+" 718 # define WRITE_PLUS_a_mode "w+" 719 #endif 720 721 #if defined(win32) 722 #define READ_ONLY_a_mode_windows_LFS _O_RDONLY | _O_BINARY 723 #define READ_PLUS_a_mode_windows_LFS _O_RDWR | _O_BINARY 724 #define WRITE_PLUS_a_mode_windows_LFS _O_RDWR | _O_CREAT | _O_TRUNC | _O_BINARY 725 #define PMODE _S_IWRITE 726 #endif 727 728 /****************************************************************************** 729 * Miscellaneous macros. 730 ******************************************************************************/ 731 732 #define SEEKv(fp,offset,origin) (V_seek(fp,offset,origin) == 0) 733 #define READv(buffer,size,number,fp) (V_read(buffer,size,number,fp) == number) 734 #define WRITEv(buffer,size,number,fp) (V_write(buffer,size,number,fp)==number) 735 #define CACHEv(fp,nBuffers) (V_setcache(fp,nBuffers) == 0) 736 #define CLEARv(fp) (V_clear(fp) == 0) 737 #define DELETEv(fp,vStats) (V_delete(fp,vStats) == 0) 738 #define CLOSEv(fp,CDF,vStats) (V_close(fp,CDF,vStats) == 0) 739 #define FLUSHv(fp) (V_flush(fp) == 0) 740 741 #define MEMMOVE(dst,src,nBytes) if (dst != src) memmove (dst, src, nBytes); 742 743 #define DECODE(function,buffer,numElems) \ 744 BOO(function == NULL,CDF_OK,function(buffer,numElems)) 745 746 /****************************************************************************** 747 * CURRENTattrSELECTED. 748 ******************************************************************************/ 749 750 #define CURRENTattrSELECTED(CDF) (CDF->CURattrOffset != RESERVED_ATTROFFSET) 751 #define CURRENTattrSELECTED64(CDF) (CDF->CURattrOffset64 != RESERVED_ATTROFFSET64) 752 753 /****************************************************************************** 754 * CURRENTvarSELECTED. 755 ******************************************************************************/ 756 757 #define CURRENTvarSELECTED(CDF,zOp) \ 758 BOO(zModeON(CDF), \ 759 CDF->CURzVarNum != RESERVED_VARNUM, \ 760 BOO(zOp,CDF->CURzVarNum,CDF->CURrVarNum) != RESERVED_VARNUM) 761 762 /****************************************************************************** 763 * BADzOP. 764 * Check if an operation is legal while in zMode. 765 ******************************************************************************/ 766 767 #define BADzOP(CDF,rVar) (zModeON(CDF) && rVar) 768 769 /****************************************************************************** 770 * EXISTSisBAD. 771 ******************************************************************************/ 772 773 #define EXISTSisBAD(alloc) BOO((alloc)->type == VVR_,(alloc)->vvr.newX,TRUE) 774 775 /****************************************************************************** 776 * Allocation structures. 777 ******************************************************************************/ 778 779 struct AllocStruct { 780 Int32 first; /* First record to allocate. */ 781 Int32 last; /* Last record to allocate. */ 782 int type; /* Type of record(s): VVR_ or CVVR_. */ 783 struct { 784 Logical newX; /* TRUE: Don't append to an existing VVR (even if 785 possible). CDF_INTERNAL_ERROR if any of 786 the records already exist. */ 787 } vvr; 788 struct { 789 Int32 cSize; /* Size of CVVR compressed data. */ 790 Int32 xSize; /* Size of CVVR extra space. */ 791 } cvvr; 792 struct { 793 OFF_T cSize; /* Size of CVVR compressed data. */ 794 OFF_T xSize; /* Size of CVVR extra space. */ 795 } cvvr64; 796 }; 797 798 /****************************************************************************** 799 * vFILE/vCACHE structures. 800 ******************************************************************************/ 801 802 typedef struct vCACHEstruct { 803 long blockN; /* File block number in this cache buffer. */ 804 struct vCACHEstruct *next; 805 /* Index of next cache buffer (on linked list). */ 806 struct vCACHEstruct *prev; 807 /* Index of previous cache buffer (on linked list). */ 808 Logical modified; /* TRUE if this file block has been modified. */ 809 void *ptr; /* Pointer to cache buffer or virtual memory handle 810 (if Microsoft C 7.00). */ 811 } vCACHE; 812 813 typedef struct vFILEstruct { 814 uInt32 magic_number; /* Magic number for VFILE structure. */ 815 FILE *fp; /* File pointer. Initially set to NULL if a scratch 816 file (because the scratch file hasn't been created 817 yet). If not a scratch file, set to the file 818 pointer of the created/opened file. */ 819 char *path; /* If a scratch file, initially set to the scratch 820 directory or a NUL-string if the current directory 821 is to be used. This is set to the pathname of the 822 file if this is not a scratch file or if a scratch 823 file for which the file has been created (because a 824 block had to be paged out). */ 825 char scratchExt[EXT_LEN+1]; 826 /* Extension for this scratch file. */ 827 Logical scratch; /* Set TRUE if a scratch file. */ 828 Logical error; /* TRUE if the error indicator is set. No further 829 access to the file is allowed. */ 830 Logical eof; /* TRUE if the EOF indicator is set (after a read is 831 attempted at the EOF). */ 832 vCACHE *cacheHead; /* Head of linked list of cache structures. */ 833 vCACHE *cacheTail; /* Tail of linked list of cache structures. */ 834 int maxBuffers; /* Maximum number of cache buffers to be used. */ 835 int nBuffers; /* Actual number of cache buffers being used. */ 836 long nV_reads; /* Number of calls to `V_read'. */ 837 long nV_writes; /* Number of calls to `V_write'. */ 838 long nBlockReads; /* Number of file blocks which have been read. */ 839 long nBlockWrites; /* Number of file blocks which have been written. */ 840 long nPageIns; /* Number of blocks paged in from the file. */ 841 long nPageOuts; /* Number of blocks paged out to the file. */ 842 long length; /* Length in bytes of the file. This includes what is 843 in the cache but not necessarily what is physically 844 in the file yet) using 32-bit offset. */ 845 OFF_T length64; /* Length in bytes of the file. This includes what is 846 in the cache but not necessarily what is physically 847 in the file yet) using 64-bit offset. */ 848 long phyLength; /* Physical length of the file in bytes (ignoring what 849 might be in the cache) using 32-bit offset. */ 850 OFF_T phyLength64; /* Physical length of the file in bytes (ignoring what 851 might be in the cache) using 64-bit offset. */ 852 long offset; /* Read/write position (byte offset) in file 853 using 32-bit offset. */ 854 OFF_T offset64; /* Read/write position (byte offset) in file 855 using 64-bit offset. */ 856 int fh; /* File handler. Used for Windows in lower-level 857 file i/o in LFS. */ 858 struct GDRstruct *GDR; 859 /* GDR data used in READONLYon mode */ 860 struct GDRstruct64 *GDR64; 861 /* GDR64 data used in READONLYon mode */ 862 struct ADRstruct **ADRList; 863 /* List of ADRs used in READONLYon mode. Indexed by 864 attribute number. */ 865 struct ADRstruct64 **ADRList64; 866 /* List of ADR64s used in READONLYon mode. Indexed by 867 attribute number. */ 868 int CurADRIndex; /* Index into ADRList/ADRList64 of currently selected 869 attribute. Valid only in READONLYon mode. */ 870 int CurAEDRIndex; /* Index into AEDRList/AEDRList64 of currently selected 871 attribute entry. Valid only in READONLYon mode. */ 872 Logical CURzEntrySel; /* If the CurAEDRIndex refers to a zENRTY or a 873 grENTRY. Valid only in READONLYon mode. */ 874 } vFILE; 875 876 /****************************************************************************** 877 * CDR flag bit positions (bit 0 is Least Significant Bit). 878 ******************************************************************************/ 879 880 #define CDR_MAJORITY_BIT 0 /* majority: set = row major, 881 clear = column major */ 882 #define CDR_FORMAT_BIT 1 /* format: set = single file, 883 clear = multi file */ 884 #define CDR_CHECKSUM_BIT 2 /* Check sum bit. */ 885 #define CDR_CHECKSUM_MD5_BIT 3 /* Check sum bit for MD5 method. */ 886 #define CDR_CHECKSUM_OTHER_BIT 4 /* Check sum bit for another method. */ 887 888 /****************************************************************************** 889 * VDR flag bit positions (bit 0 is Least Significant Bit). These apply to 890 * both rVDRs and zVDRs. Note that the compression and sparse arrays bits 891 * cannot both be set. 892 ******************************************************************************/ 893 894 #define VDR_RECVARY_BIT 0 /* Record variance... 895 set = VARY, 896 clear = NOVARY. */ 897 #define VDR_PADVALUE_BIT 1 /* Pad value... 898 set = specified, 899 clear = not specified. */ 900 #define VDR_COMPRESSION_BIT 2 /* Variable compression... 901 set = compressed, CPR offset 902 in CPRorSPRoffset field. 903 clear = uncompressed. */ 904 #define VDR_SPARSEARRAYS_BIT 3 /* Sparse arrays... 905 set = sparse, SPR offset 906 in CPRorSPRoffset field. 907 clear = unsparse. */ 908 909 /****************************************************************************** 910 * Internal record types. 911 ******************************************************************************/ 912 913 #define UIR_ ((Int32) (-1)) /* Unused Internal Record. */ 914 #define CDR_ ((Int32) 1) /* CDF Descriptor Record. */ 915 #define GDR_ ((Int32) 2) /* Global Descriptor Record. */ 916 #define rVDR_ ((Int32) 3) /* rVariable Descriptor Record. */ 917 #define ADR_ ((Int32) 4) /* Attribute Descriptor Record. */ 918 #define AgrEDR_ ((Int32) 5) /* Attribute g/rEntry Descriptor Record. */ 919 #define VXR_ ((Int32) 6) /* Variable indeX Record. */ 920 #define VVR_ ((Int32) 7) /* Variable Values Record. */ 921 #define zVDR_ ((Int32) 8) /* zVariable Descriptor Record. */ 922 #define AzEDR_ ((Int32) 9) /* Attribute zEntry Descriptor Record. */ 923 #define CCR_ ((Int32) 10) /* Compressed CDF Record. */ 924 #define CPR_ ((Int32) 11) /* Compression Parameters Record. */ 925 #define SPR_ ((Int32) 12) /* Sparseness Parameters Record. */ 926 #define CVVR_ ((Int32) 13) /* Compressed Variable Values Record. */ 927 928 /****************************************************************************** 929 * Base record sizes (bytes). 930 ******************************************************************************/ 931 932 #define UUIR_BASE_SIZE 8 933 #define UIR_BASE_SIZE 16 934 #define CDR_BASE_SIZE 48 935 #define GDR_BASE_SIZE 60 936 #define zVDR_BASE_SIZE (68 + CDF_VAR_NAME_LEN) 937 #define rVDR_BASE_SIZE (64 + CDF_VAR_NAME_LEN) 938 #define VXR_BASE_SIZE (20 + (12 * NUM_VXR_ENTRIES)) 939 #define VXRx_BASE_SIZE (20 + (12 * NUM_VXRx_ENTRIES)) 940 #define VVR_BASE_SIZE 8 941 #define ADR_BASE_SIZE (52 + CDF_ATTR_NAME_LEN) 942 #define AEDR_BASE_SIZE 48 943 #define CCR_BASE_SIZE 20 944 #define CPR_BASE_SIZE 20 945 #define SPR_BASE_SIZE 20 946 #define CVVR_BASE_SIZE 16 947 948 /****************************************************************************** 949 * Max record sizes (bytes). 950 ******************************************************************************/ 951 952 #define CDR_MAX_SIZE (48 + CDF_COPYRIGHT_LEN) 953 #define GDR_MAX_SIZE (60 + 4 * CDF_MAX_DIMS) 954 #define zVDR_MAX_SIZE (68 + CDF_VAR_NAME_LEN + 8 * CDF_MAX_DIMS) 955 #define rVDR_MAX_SIZE (64 + CDF_VAR_NAME_LEN + 4 * CDF_MAX_DIMS) 956 #define VXR_MAX_SIZE (20 + (16 * MAX_VXR_ENTRIES)) 957 #define VXRx_MAX_SIZE (20 + (16 * MAX_VXRx_ENTRIES)) 958 #define ADR_MAX_SIZE (52 + CDF_ATTR_NAME_LEN) 959 #define AEDR_MAX_SIZE 48 960 #define CPR_MAX_SIZE 28 961 #define SPR_MAX_SIZE 28 962 963 /****************************************************************************** 964 * CCR structure/fields/offsets - Compressed CDF Record. 965 ******************************************************************************/ 966 967 struct CCRstruct { 968 Int32 RecordSize; /* Size of record (bytes) */ 969 Int32 RecordType; /* Type of record (ie. CCR) */ 970 Int32 CPRoffset; /* File offset to CPR (bytes). */ 971 Int32 uSize; /* Size of uncompressed CDF's IRs (bytes). This byte 972 count does NOT include the magic numbers. */ 973 Int32 rfuA; /* Reserved for future use. Set to zero. */ 974 }; 975 976 #define CCR_NULL (-1) 977 #define CCR_RECORD 0 978 #define CCR_RECORDSIZE 1 979 #define CCR_RECORDTYPE 2 980 #define CCR_CPROFFSET 3 981 #define CCR_USIZE 4 982 #define CCR_RFUa 5 983 984 #define CCR_RECORDSIZE_OFFSET 0 985 #define CCR_RECORDTYPE_OFFSET 4 986 #define CCR_CPROFFSET_OFFSET 8 987 #define CCR_USIZE_OFFSET 12 988 #define CCR_RFUa_OFFSET 16 989 990 /****************************************************************************** 991 * CDR structure/fields/offsets - CDF Descriptor Record. 992 ******************************************************************************/ 993 994 struct CDRstruct { 995 Int32 RecordSize; /* Size of record (bytes) */ 996 Int32 RecordType; /* Type of record (ie. CDR) */ 997 Int32 GDRoffset; /* File offset to GDR (bytes) */ 998 Int32 Version; /* CDF Version Number */ 999 Int32 Release; /* CDF Release Number */ 1000 Int32 Encoding; /* Encoding of CDF File */ 1001 Int32 Flags; /* Flags (see bit definitions). */ 1002 Int32 rfuA; /* reserved for future use (value = 0) */ 1003 Int32 rfuB; /* reserved for future use (value = 0) */ 1004 Int32 Increment; /* CDF Increment Number (Vversion.release.increment), 1005 always 0 for V2.0 CDFs */ 1006 Int32 rfuD; /* reserved for future use (value = -1) */ 1007 Int32 rfuE; /* reserved for future use (value = -1) */ 1008 }; 1009 1010 #define CDR_NULL (-1) 1011 #define CDR_RECORD 0 1012 #define CDR_RECORDSIZE 1 1013 #define CDR_RECORDTYPE 2 1014 #define CDR_GDROFFSET 3 1015 #define CDR_VERSION 4 1016 #define CDR_RELEASE 5 1017 #define CDR_ENCODING 6 1018 #define CDR_FLAGS 7 1019 #define CDR_INCREMENT 8 1020 #define CDR_COPYRIGHT 9 1021 1022 #define CDR_RECORDSIZE_OFFSET 0 1023 #define CDR_RECORDTYPE_OFFSET 4 1024 #define CDR_GDROFFSET_OFFSET 8 1025 #define CDR_VERSION_OFFSET 12 1026 #define CDR_RELEASE_OFFSET 16 1027 #define CDR_ENCODING_OFFSET 20 1028 #define CDR_FLAGS_OFFSET 24 1029 #define CDR_RFUa_OFFSET 28 1030 #define CDR_RFUb_OFFSET 32 1031 #define CDR_INCREMENT_OFFSET 36 1032 #define CDR_RFUd_OFFSET 40 1033 #define CDR_RFUe_OFFSET 44 1034 #define CDR_COPYRIGHT_OFFSET 48 1035 1036 /****************************************************************************** 1037 * GDR structure/fields/offsets - Global Descriptor Record. 1038 * 1039 * Note(s): 1040 * The Eof field was not maintained for V2.0 CDFs (it will contain a random 1041 * value). When a V2.0 CDF is modified, the end-of-file will be determined and 1042 * this field will be updated. 1043 * Even though CDF_MAX_DIMS elements are allocated for the `rDimSizes' 1044 * array, only those sizes which actually exist are written to the CDF file. 1045 * 1046 ******************************************************************************/ 1047 1048 struct GDRstruct { 1049 Int32 RecordSize; /* Size of current record (bytes) */ 1050 Int32 RecordType; /* Type of record (ie. GDR) */ 1051 Int32 rVDRhead; /* File offset to first rVDR (bytes) */ 1052 Int32 zVDRhead; /* CDF V2.0, value is undefined (random). 1053 CDF V2.1, value = 0. 1054 CDF V2.2, File offset to first zVDR (bytes). */ 1055 Int32 ADRhead; /* File offset to first ADR (bytes) */ 1056 Int32 eof; /* If V2.0 CDF, value is undefined. 1057 If V2.1+ CDF, end-of-file (byte offset). */ 1058 Int32 NrVars; /* Number of rVariables */ 1059 Int32 NumAttr; /* Number of Attributes */ 1060 Int32 rMaxRec; /* Maximum rVariable record number written to. */ 1061 Int32 rNumDims; /* Number of CDF dimensions (for rVariables). */ 1062 Int32 NzVars; /* Number of zVariables. */ 1063 Int32 UIRhead; /* File offset to first UIR (bytes). */ 1064 Int32 rfuC; /* reserved for future use (value = 0) */ 1065 Int32 rfuD; /* reserved for future use (value = -1) */ 1066 Int32 rfuE; /* reserved for future use (value = -1) */ 1067 Int32 rDimSizes[CDF_MAX_DIMS]; 1068 /* Size of each dimension (for rVariables). */ 1069 }; 1070 1071 #define GDR_NULL (-1) 1072 #define GDR_RECORD 0 1073 #define GDR_RECORDSIZE 1 1074 #define GDR_RECORDTYPE 2 1075 #define GDR_rVDRHEAD 3 1076 #define GDR_zVDRHEAD 4 1077 #define GDR_ADRHEAD 5 1078 #define GDR_EOF 6 1079 #define GDR_NrVARS 7 1080 #define GDR_NUMATTR 8 1081 #define GDR_rMAXREC 9 1082 #define GDR_rNUMDIMS 10 1083 #define GDR_NzVARS 11 1084 #define GDR_UIRHEAD 12 1085 #define GDR_rDIMSIZES 13 1086 1087 #define GDR_RECORDSIZE_OFFSET 0 1088 #define GDR_RECORDTYPE_OFFSET 4 1089 #define GDR_rVDRHEAD_OFFSET 8 1090 #define GDR_zVDRHEAD_OFFSET 12 1091 #define GDR_ADRHEAD_OFFSET 16 1092 #define GDR_EOF_OFFSET 20 1093 #define GDR_NrVARS_OFFSET 24 1094 #define GDR_NUMATTR_OFFSET 28 1095 #define GDR_rMAXREC_OFFSET 32 1096 #define GDR_rNUMDIMS_OFFSET 36 1097 #define GDR_NzVARS_OFFSET 40 1098 #define GDR_UIRHEAD_OFFSET 44 1099 #define GDR_RFUc_OFFSET 48 1100 #define GDR_RFUd_OFFSET 52 1101 #define GDR_RFUe_OFFSET 56 1102 #define GDR_rDIMSIZES_OFFSET 60 1103 1104 /****************************************************************************** 1105 * rVDR/zVDR structure/fields/offsets - r/zVariable Descriptor Record. 1106 ******************************************************************************/ 1107 1108 struct VDRstruct { 1109 Int32 RecordSize; /* Size of current record (bytes) */ 1110 Int32 RecordType; /* Type of record (eg. rVDR/zVDR) */ 1111 Int32 VDRnext; /* File offset to next rVDR/zVDR (bytes). Note in 1112 V2.0 CDFs this field was not set properly for the 1113 last variable (rVariable). */ 1114 Int32 DataType; /* Data type of variable */ 1115 Int32 MaxRec; /* Maximum record number for variable */ 1116 Int32 VXRhead; /* File offset to first VXR (bytes). Value will be 1117 0 if MULTI_FILE format */ 1118 Int32 VXRtail; /* File offset to last VXR (bytes). Value will be 0 1119 if MULTI_FILE format */ 1120 Int32 Flags; /* Flags (see bit definitions). */ 1121 Int32 sRecords; /* Type of sparse records. NO_SPARSERECORDS, 1122 PAD_SPARSERECORDS, or PREV_SPARSERECORDS. */ 1123 Int32 rfuB; /* reserved for future use (value = 0) */ 1124 Int32 rfuC; /* reserved for future use (value = -1) */ 1125 Int32 rfuF; /* reserved for future use (value = -1) */ 1126 Int32 NumElems; /* Number of elements of DataType (should be 1 if not 1127 CDF_CHAR or CDF_UCHAR) */ 1128 Int32 Num; /* Variable number */ 1129 Int32 CPRorSPRoffset; /* CPR/SPR offset depending on bits set in `Flags'. 1130 If neither compression nor sparse arrays, set to 1131 0xFFFFFFFF. */ 1132 Int32 blockingFactor; /* If uncompressed/unsparse: 1133 Number of records to extend when new allocations 1134 are necessary (if 0, use default). For multi-file 1135 CDFs, extensions are always one record at a time. 1136 For NRV variables this value is N/A (only one 1137 record is ever written). 1138 If compressed/sparse: 1139 Number of (or maximum) records per block... */ 1140 char Name[CDF_VAR_NAME_LEN+1]; 1141 /* Variable name */ 1142 Int32 zNumDims; /* Number of dimensions for zVariable. N/A if an 1143 rVariable. */ 1144 Int32 zDimSizes[CDF_MAX_DIMS]; 1145 /* Dimension sizes for zVariable. N/A if an 1146 rVariable. */ 1147 Int32 DimVarys[CDF_MAX_DIMS]; 1148 /* Dimension variances. */ 1149 /* Optional... PadValue with the given DataType. */ 1150 }; 1151 1152 #define VDR_NULL (-1) 1153 #define VDR_RECORD 0 1154 #define VDR_RECORDSIZE 1 1155 #define VDR_RECORDTYPE 2 1156 #define VDR_VDRNEXT 3 1157 #define VDR_DATATYPE 4 1158 #define VDR_MAXREC 5 1159 #define VDR_VXRHEAD 6 1160 #define VDR_VXRTAIL 7 1161 #define VDR_FLAGS 8 1162 #define VDR_sRECORDS 9 1163 #define VDR_NUMELEMS 10 1164 #define VDR_NUM 11 1165 #define VDR_CPRorSPR 12 1166 #define VDR_BLOCKING 13 1167 #define VDR_NAME 14 1168 #define VDR_zNUMDIMS 15 1169 #define VDR_zDIMSIZES 16 1170 #define VDR_DIMVARYS 17 1171 #define VDR_PADVALUE 18 1172 1173 #define VDR_RECORDSIZE_OFFSET 0 1174 #define VDR_RECORDTYPE_OFFSET 4 1175 #define VDR_VDRNEXT_OFFSET 8 1176 #define VDR_DATATYPE_OFFSET 12 1177 #define VDR_MAXREC_OFFSET 16 1178 #define VDR_VXRHEAD_OFFSET 20 1179 #define VDR_VXRTAIL_OFFSET 24 1180 #define VDR_FLAGS_OFFSET 28 1181 #define VDR_sRECORDS_OFFSET 32 1182 #define VDR_RFUb_OFFSET 36 1183 #define VDR_RFUc_OFFSET 40 1184 #define VDR_RFUf_OFFSET 44 1185 #define VDR_NUMELEMS_OFFSET 48 1186 #define VDR_NUM_OFFSET 52 1187 #define VDR_CPRorSPR_OFFSET 56 1188 #define VDR_BLOCKING_OFFSET 60 1189 #define VDR_NAME_OFFSET 64 1190 1191 #define rVDR_DIMVARYS_OFFSET 128 1192 #define rVDR_PADVALUE_OFFSETb 128 /* Offset base (more will be added). */ 1193 1194 #define zVDR_zNUMDIMS_OFFSET 128 1195 #define zVDR_zDIMSIZES_OFFSET 132 1196 #define zVDR_DIMVARYS_OFFSETb 132 /* Offset base (more will be added). */ 1197 #define zVDR_PADVALUE_OFFSETb 132 /* Offset base (more will be added). */ 1198 1199 #define VDR_WASTED_OFFSET 48 1200 1201 /****************************************************************************** 1202 * VXR structure/fields/offsets - Variable Index Record. 1203 ******************************************************************************/ 1204 1205 struct VXRstruct { 1206 Int32 RecordSize; /* Size of current record (bytes) */ 1207 Int32 RecordType; /* Type of record (ie. VXR) */ 1208 Int32 VXRnext; /* File offset to next VXR (bytes) */ 1209 Int32 Nentries; /* Number of index entries (entries not being used 1210 contain -1 in each field) */ 1211 Int32 NusedEntries; /* Number of index entries actually used */ 1212 Int32 First[MAX_VXR_ENTRIES]; 1213 /* First record number in VVR */ 1214 Int32 Last[MAX_VXR_ENTRIES]; 1215 /* Last record number in VVR */ 1216 Int32 Offset[MAX_VXR_ENTRIES]; 1217 /* File offset to VXR/VVR (bytes) */ 1218 }; 1219 1220 #define VXR_NULL (-1) 1221 #define VXR_RECORD 0 1222 #define VXR_RECORDSIZE 1 1223 #define VXR_RECORDTYPE 2 1224 #define VXR_VXRNEXT 3 1225 #define VXR_NENTRIES 4 1226 #define VXR_NUSEDENTRIES 5 1227 #define VXR_FIRSTREC 6 1228 #define VXR_LASTREC 7 1229 #define VXR_OFFSET 8 1230 1231 #define VXR_RECORDSIZE_OFFSET 0 1232 #define VXR_RECORDTYPE_OFFSET 4 1233 #define VXR_VXRNEXT_OFFSET 8 1234 #define VXR_NENTRIES_OFFSET 12 1235 #define VXR_NUSEDENTRIES_OFFSET 16 1236 #define VXR_FIRSTREC_OFFSET 20 1237 1238 /****************************************************************************** 1239 * VVR structure/fields/offsets - Variable Values Record. 1240 ******************************************************************************/ 1241 1242 struct VVRstruct { 1243 Int32 RecordSize; /* Size of current record (bytes). */ 1244 Int32 RecordType; /* Type of record (ie. VVR). */ 1245 /* Bytes... */ 1246 }; 1247 1248 #define VVR_NULL (-1) 1249 #define VVR_RECORDx 0 1250 #define VVR_RECORDSIZE 1 1251 #define VVR_RECORDTYPE 2 1252 1253 #define VVR_RECORDSIZE_OFFSET 0 1254 #define VVR_RECORDTYPE_OFFSET 4 1255 1256 /****************************************************************************** 1257 * ADR structure/fields/offsets - Attribute Descriptor Record. 1258 ******************************************************************************/ 1259 1260 struct ADRstruct { 1261 Int32 RecordSize; /* Size of current record (bytes). */ 1262 Int32 RecordType; /* Type of record (ie. ADR). */ 1263 Int32 ADRnext; /* File offset to next ADR (bytes). Note that in 1264 V2.0 CDFs this field was not set properly for the 1265 last attribute. */ 1266 Int32 AgrEDRhead; /* File offset to first AgrEDR (bytes). */ 1267 Int32 Scope; /* Variable or global. */ 1268 Int32 Num; /* Attribute id number. */ 1269 Int32 NgrEntries; /* Number of attribute gEntries/rEntries. */ 1270 Int32 MAXgrEntry; /* Maximum attribute gEntry/rEntry number. */ 1271 Int32 rfuA; /* reserved for future use (value = 0). */ 1272 Int32 AzEDRhead; /* File offset to first AzEDR (bytes). */ 1273 Int32 NzEntries; /* Number of attribute zEntries. */ 1274 Int32 MAXzEntry; /* Maximum attribute zEntry number. */ 1275 Int32 rfuE; /* Reserved for future use (value = -1). */ 1276 char Name[CDF_ATTR_NAME_LEN+1]; 1277 /* Attribute name. */ 1278 struct AEDRstructExt **grAEDRList; 1279 /* List of grENTRYs related to an attribute. The list 1280 is an array 0-MAXgrEntry, indexed by the entry 1281 number. When there is no entry for the attribute, 1282 the corresponding list item is NULL */ 1283 struct AEDRstructExt **zAEDRList; 1284 /* List of zENTRYs related to an attribute. The list 1285 is an array 0-MAXgrEntry, indexed by the entry 1286 number. When there is no entry for the attribute, 1287 the corresponding list item is NULL */ 1288 }; 1289 1290 #define ADR_NULL (-1) 1291 #define ADR_RECORD 0 1292 #define ADR_RECORDSIZE 1 1293 #define ADR_RECORDTYPE 2 1294 #define ADR_ADRNEXT 3 1295 #define ADR_AgrEDRHEAD 4 1296 #define ADR_SCOPE 5 1297 #define ADR_NUM 6 1298 #define ADR_NgrENTRIES 7 1299 #define ADR_MAXgrENTRY 8 1300 #define ADR_AzEDRHEAD 9 1301 #define ADR_NzENTRIES 10 1302 #define ADR_MAXzENTRY 11 1303 #define ADR_NAME 12 1304 1305 #define ADR_RECORDSIZE_OFFSET 0 1306 #define ADR_RECORDTYPE_OFFSET 4 1307 #define ADR_ADRNEXT_OFFSET 8 1308 #define ADR_AgrEDRHEAD_OFFSET 12 1309 #define ADR_SCOPE_OFFSET 16 1310 #define ADR_NUM_OFFSET 20 1311 #define ADR_NgrENTRIES_OFFSET 24 1312 #define ADR_MAXgrENTRY_OFFSET 28 1313 #define ADR_RFUa_OFFSET 32 1314 #define ADR_AzEDRHEAD_OFFSET 36 1315 #define ADR_NzENTRIES_OFFSET 40 1316 #define ADR_MAXzENTRY_OFFSET 44 1317 #define ADR_RFUe_OFFSET 48 1318 #define ADR_NAME_OFFSET 52 1319 1320 /****************************************************************************** 1321 * AgrEDR/AzEDR structure/fields/offsets - Attribute g/r/zEntry Descriptor 1322 * Record. 1323 ******************************************************************************/ 1324 1325 struct AEDRstruct { 1326 Int32 RecordSize; /* Size of current record (bytes) */ 1327 Int32 RecordType; /* Type of record (ie. AgrEDR/AzEDR) */ 1328 Int32 AEDRnext; /* File offset to next AgrEDR/AzEDR. Note that in 1329 V2.0 CDFs this field was not set properly for the 1330 last entry (rEntry). */ 1331 Int32 AttrNum; /* Attribute Number */ 1332 Int32 DataType; /* Entry Data Type */ 1333 Int32 Num; /* Entry number (rVariable/zVariable number or 1334 arbitrary global `entry' [gEntry] number) */ 1335 Int32 NumElems; /* Number of elements of DataType */ 1336 Int32 rfuA; /* reserved for future use (value = 0) */ 1337 Int32 rfuB; /* reserved for future use (value = 0) */ 1338 Int32 rfuC; /* reserved for future use (value = 0) */ 1339 Int32 rfuD; /* reserved for future use (value = -1) */ 1340 Int32 rfuE; /* reserved for future use (value = -1) */ 1341 }; 1342 1343 /***************************************************************************** 1344 * AEDRstructExt - structure that extends AEDRstruct to hold value data in 1345 * support of the READONLY metadata enhancement. 1346 ****************************************************************************/ 1347 1348 struct AEDRstructExt { 1349 struct AEDRstruct AEDR; 1350 /* The basic AEDR data. */ 1351 int ValueSize; /* The size in bytes of the value data. */ 1352 void *Value; /* The value data. */ 1353 }; 1354 1355 #define AEDR_NULL (-1) 1356 #define AEDR_RECORD 0 1357 #define AEDR_RECORDSIZE 1 1358 #define AEDR_RECORDTYPE 2 1359 #define AEDR_AEDRNEXT 3 1360 #define AEDR_ATTRNUM 4 1361 #define AEDR_DATATYPE 5 1362 #define AEDR_NUM 6 1363 #define AEDR_NUMELEMS 7 1364 #define AEDR_VALUE 8 1365 1366 #define AEDR_RECORDSIZE_OFFSET 0 1367 #define AEDR_RECORDTYPE_OFFSET 4 1368 #define AEDR_AEDRNEXT_OFFSET 8 1369 #define AEDR_ATTRNUM_OFFSET 12 1370 #define AEDR_DATATYPE_OFFSET 16 1371 #define AEDR_NUM_OFFSET 20 1372 #define AEDR_NUMELEMS_OFFSET 24 1373 #define AEDR_RFUa_OFFSET 28 1374 #define AEDR_RFUb_OFFSET 32 1375 #define AEDR_RFUc_OFFSET 36 1376 #define AEDR_RFUd_OFFSET 40 1377 #define AEDR_RFUe_OFFSET 44 1378 #define AEDR_VALUE_OFFSET 48 1379 1380 /****************************************************************************** 1381 * CPR structure/fields/offsets - Compression Parameters Record. 1382 ******************************************************************************/ 1383 1384 struct CPRstruct { 1385 Int32 RecordSize; /* Size of record (bytes) */ 1386 Int32 RecordType; /* Type of record (ie. CPR) */ 1387 Int32 cType; /* Type of compression. */ 1388 Int32 rfuA; /* Reserved for future use. Set to zero. */ 1389 Int32 pCount; /* Parameter count. */ 1390 Int32 cParms[CDF_MAX_PARMS]; 1391 /* Parameters. */ 1392 }; 1393 1394 #define CPR_NULL (-1) 1395 #define CPR_RECORD 0 1396 #define CPR_RECORDSIZE 1 1397 #define CPR_RECORDTYPE 2 1398 #define CPR_CTYPE 3 1399 #define CPR_RFUa 4 1400 #define CPR_PCOUNT 5 1401 #define CPR_CPARM1 6 1402 #define CPR_CPARM2 7 1403 #define CPR_CPARM3 8 1404 #define CPR_CPARM4 9 1405 #define CPR_CPARM5 10 1406 1407 #define CPR_RECORDSIZE_OFFSET 0 1408 #define CPR_RECORDTYPE_OFFSET 4 1409 #define CPR_CTYPE_OFFSET 8 1410 #define CPR_RFUa_OFFSET 12 1411 #define CPR_PCOUNT_OFFSET 16 1412 #define CPR_CPARM1_OFFSET 20 1413 #define CPR_CPARM2_OFFSET 24 1414 #define CPR_CPARM3_OFFSET 28 1415 #define CPR_CPARM4_OFFSET 32 1416 #define CPR_CPARM5_OFFSET 36 1417 1418 /****************************************************************************** 1419 * SPR structure/fields/offsets - Sparseness Parameters Record. 1420 ******************************************************************************/ 1421 1422 struct SPRstruct { 1423 Int32 RecordSize; /* Size of record (bytes) */ 1424 Int32 RecordType; /* Type of record (ie. CPR) */ 1425 Int32 sArraysType; /* Type of array sparseness. */ 1426 Int32 rfuA; /* Reserved for future use. Set to zero. */ 1427 Int32 pCount; /* Parameter count. */ 1428 Int32 sArraysParms[CDF_MAX_PARMS]; 1429 /* Parameters. */ 1430 }; 1431 1432 #define SPR_NULL (-1) 1433 #define SPR_RECORD 0 1434 #define SPR_RECORDSIZE 1 1435 #define SPR_RECORDTYPE 2 1436 #define SPR_STYPE 3 1437 #define SPR_RFUa 4 1438 #define SPR_PCOUNT 5 1439 #define SPR_SPARM1 6 1440 #define SPR_SPARM2 7 1441 #define SPR_SPARM3 8 1442 #define SPR_SPARM4 9 1443 #define SPR_SPARM5 10 1444 1445 #define SPR_RECORDSIZE_OFFSET 0 1446 #define SPR_RECORDTYPE_OFFSET 4 1447 #define SPR_STYPE_OFFSET 8 1448 #define SPR_RFUa_OFFSET 12 1449 #define SPR_PCOUNT_OFFSET 16 1450 #define SPR_SPARM1_OFFSET 20 1451 #define SPR_SPARM2_OFFSET 24 1452 #define SPR_SPARM3_OFFSET 28 1453 #define SPR_SPARM4_OFFSET 32 1454 #define SPR_SPARM5_OFFSET 36 1455 1456 /****************************************************************************** 1457 * CVVR structure/fields/offsets - Compressed Variable Values Record. 1458 ******************************************************************************/ 1459 1460 struct CVVRstruct { 1461 Int32 RecordSize; /* Size of record (bytes) */ 1462 Int32 RecordType; /* Type of record (ie. CVVR) */ 1463 Int32 rfuA; /* Reserved for future use. Set to zero (0). */ 1464 Int32 cSize; /* Size in bytes of compressed data. */ 1465 /* Bytes... */ 1466 /* Extra... */ 1467 }; 1468 1469 #define CVVR_NULL (-1) 1470 #define CVVR_RECORDx 0 1471 #define CVVR_RECORDSIZE 1 1472 #define CVVR_RECORDTYPE 2 1473 #define CVVR_RFUa 3 1474 #define CVVR_CSIZE 4 1475 1476 #define CVVR_RECORDSIZE_OFFSET 0 1477 #define CVVR_RECORDTYPE_OFFSET 4 1478 #define CVVR_RFUa_OFFSET 8 1479 #define CVVR_CSIZE_OFFSET 12 1480 1481 /****************************************************************************** 1482 * UIR structure/fields/offsets - Unused Internal Record. 1483 ******************************************************************************/ 1484 1485 struct UIRstruct { 1486 Int32 RecordSize; /* Size of current record (bytes). */ 1487 Int32 RecordType; /* Type of record (ie. UIR). */ 1488 Int32 NextUIR; /* File offset of next UIR (bytes). */ 1489 Int32 PrevUIR; /* File offset of previous UIR (bytes). */ 1490 }; 1491 1492 #define UIR_NULL (-1) 1493 #define UIR_RECORD 0 1494 #define UIR_RECORDSIZE 1 1495 #define UIR_RECORDTYPE 2 1496 #define UIR_NEXTUIR 3 1497 #define UIR_PREVUIR 4 1498 1499 #define UIR_RECORDSIZE_OFFSET 0 1500 #define UIR_RECORDTYPE_OFFSET 4 1501 #define UIR_NEXTUIR_OFFSET 8 1502 #define UIR_PREVUIR_OFFSET 12 1503 1504 /****************************************************************************** 1505 * Structure for variable record/dimension states for read/write operations. 1506 ******************************************************************************/ 1507 1508 struct rdSTRUCT { 1509 Int32 recNumber; /* Current record number. */ 1510 Int32 recCount; /* Current record count. */ 1511 Int32 recInterval; /* Current record interval. */ 1512 Int32 dimIndices[CDF_MAX_DIMS]; /* Current dimension indices. */ 1513 Int32 dimCounts[CDF_MAX_DIMS]; /* Current dimension counts. */ 1514 Int32 dimIntervals[CDF_MAX_DIMS]; /* Current dimension intervals. */ 1515 }; 1516 1517 /****************************************************************************** 1518 * Structures for rVariable/zVariable related data. 1519 ******************************************************************************/ 1520 1521 struct VarStageStruct { 1522 Int32 areaOffset; /* Offset in staging file of area for this 1523 variable using 32-bit offset. */ 1524 OFF_T areaOffset64; /* Offset in staging file of area for this 1525 variable using 64-bit offset. */ 1526 Int32 firstRec; /* Number of first record in staging area. */ 1527 Int32 lastRec; /* Number of last record in staging area. */ 1528 Int32 dotOffset; /* Associated VVR/CVVR offset in dotCDF file 1529 using 32-bit offset. 1530 NO_OFFSET if no VVR/CVVR yet. */ 1531 OFF_T dotOffset64; /* Associated VVR/CVVR offset in dotCDF file 1532 using 64-bit offset. 1533 NO_OFFSET if no VVR/CVVR yet. */ 1534 Logical modified; /* TRUE if record(s) in staging area have been 1535 modified. */ 1536 }; 1537 1538 struct VarStruct { 1539 Int32 VDRoffset; /* Byte offset of rVDR/zVDR using 32-bit 1540 offset. */ 1541 OFF_T VDRoffset64; /* Byte offset of rVDR/zVDR using 62-bit 1542 offset. */ 1543 Int32 varN; /* The variable's number. */ 1544 vFILE *fp; /* For a multi-file CDF, this is NULL when 1545 the variable file is closed. For a 1546 single-file CDF, this is always NULL. */ 1547 int varCacheSize; /* Number of cache buffers for the variable 1548 file (if a multi-file CDF). */ 1549 uLong accessed_at; /* Pseudo-clock time of last access. */ 1550 CDFstatus (*DecodeFunction) PROTOARGs((void *buffer, Int32 numElems)); 1551 /* Function which converts values read from 1552 the CDF to the desired decoding. */ 1553 CDFstatus (*EncodeFunction) PROTOARGs((void *buffer, Int32 numElems)); 1554 /* Function which converts values being written 1555 to the CDF to the desired encoding. */ 1556 /**************************************************************************** 1557 * The following values are calculated based on the current zMode. For 1558 * rVariables they may differ from the values in the VDR. For zVariables 1559 * they will be the same as the values in the VDR but are maintained here 1560 * for consistency. 1561 ****************************************************************************/ 1562 Int32 numDims; /* Number of dimensions, based on zMode. */ 1563 Int32 dimSizes[CDF_MAX_DIMS]; /* Dimension sizes, based on zMode. */ 1564 Int32 recVary; /* Record variance, based on zMode (doesn't 1565 differ but done for consistency). */ 1566 Int32 dimVarys[CDF_MAX_DIMS]; /* Dimension variances, based on zMode. */ 1567 /**************************************************************************** 1568 * The following values are maintained in memory for efficiency. 1569 ****************************************************************************/ 1570 Int32 NvalueElems; /* Number of elements per value. */ 1571 Int32 NelemBytes; /* Number of bytes per element. */ 1572 Int32 NvalueBytes; /* Number of bytes per value. */ 1573 Int32 NphyRecValues; /* Number of physical values per record. */ 1574 Int32 NvirtRecValues; /* Number of virtual values per record. */ 1575 Int32 NphyRecElems; /* Number of physical elements per record. */ 1576 Int32 NvirtRecElems; /* Number of virtual elements per record. */ 1577 Int32 NphyRecBytes; /* Number of physical bytes per record. */ 1578 Int32 NvirtRecBytes; /* Number of virtual bytes per record. */ 1579 Int32 nPhyDimValues[CDF_MAX_DIMS]; 1580 /* Number of physical values `below' each 1581 occurance of a dimension. */ 1582 Int32 maxRec; /* Maximum record number. */ 1583 /**************************************************************************** 1584 * The following values maintain the current positioning. 1585 ****************************************************************************/ 1586 Int32 seqValueOffset; /* Used for sequential access using 32-bit 1587 offset. The current 1588 value offset (not the byte offset). */ 1589 OFF_T seqValueOffset64; /* Used for sequential access using 64-bit 1590 offset. The current 1591 value offset (not the byte offset). */ 1592 struct rdSTRUCT zRD; /* Current record/dimension states. These are 1593 always used for zVariables. For rVariables, 1594 these are only used while in zMode. When 1595 not in zMode, the current record/dimension 1596 states in the `CDF' structure are used (and 1597 are the same for all rVariables). */ 1598 /**************************************************************************** 1599 * The following are dependent on the type of variable. 1600 ****************************************************************************/ 1601 Logical zVar; /* TRUE if a zVariable, FALSE if an 1602 rVariable. Independent of zMode. */ 1603 int vType; /* Type of variable: 1604 STANDARD_, SPARSE_RECORDS, COMPRESSED_, 1605 SPARSE_COMPRESSED_RECORDS, SPARSE_ARRAYS, 1606 or SPARSE_RECORDS_AND_ARRAYS. */ 1607 Int32 blockingFactor; /* Standard (in single-file CDF): 1608 Number of records by which to extend a 1609 variable when necessary. 1610 Compressed: 1611 Number of records per block (except for 1612 the last block which may be smaller). 1613 Sparse compressed records: 1614 Maximum number of records per block. 1615 Sparse records: 1616 Number of records in staging area. 1617 Sparse records and arrays: 1618 Sparse arrays: 1619 In multi-file CDF: 1620 N/A. */ 1621 Int32 maxAllocated; /* Maximum record number allocated. */ 1622 Int32 maxWritten; /* Maximum record number written/padded. */ 1623 Int32 cType; /* Compression type. */ 1624 Int32 cParms[CDF_MAX_PARMS]; /* Compression parameters. */ 1625 struct VarStageStruct stage; /* Staging control. */ 1626 Logical prevIfMissing; /* TRUE: return previous records' value if a 1627 record is missing (sRecords.PREV). 1628 FALSE: return pad value if a record is 1629 missing (sRecords.PAD or sRecords.NO). */ 1630 int reservePct; /* Reserve percentage for compressed variables. 1631 0 No reserve percentage (the 1632 default). 1633 1..100 Allocate (as a minimum) n% of 1634 the uncompressed size. 1635 101... Allocate an addition (n-100)% 1636 of space beyond the original 1637 compressed size. */ 1638 Int32 firstRecInVVR; /* First data record in the most recently 1639 accessed VVR. */ 1640 Int32 lastRecInVVR; /* Last data record in the most recently 1641 accessed VVR. */ 1642 Int32 offsetOfVVR; /* Offset of the most recently accessed VVR 1643 from the cdf using 32-bit offset. */ 1644 OFF_T offsetOfVVR64; /* Offset of the most recently accessed VVR 1645 from the cdf using 64-bit offset. */ 1646 }; 1647 1648 /****************************************************************************** 1649 * Structures for CDF related data. 1650 ******************************************************************************/ 1651 1652 struct CDFstageStruct { 1653 vFILE *fp; /* Staging scratch file pointer. */ 1654 Int32 mark; /* New allocations (for a variable) 1655 are at this offset using 32-bit. */ 1656 OFF_T mark64; /* New allocations (for a variable) 1657 are at this offset using 64-bit. */ 1658 int cacheSize; /* Number of cache buffers for the 1659 staging scratch file. */ 1660 }; 1661 1662 struct CDFstruct { 1663 uInt32 magic; /* Magic number stored in CDF 1664 structure in memory. Used to 1665 check that a valid `CDFid' was 1666 specified. */ 1667 Logical largeFile; /* TRUE: if based on 64-bit offset, 1668 FALSE: older 32-bit offset. */ 1669 vFILE *fp; /* Working file pointer. Set to either 1670 `dotFp' (if not a compressed CDF) 1671 or `uDotFp' (if a compressed CDF).*/ 1672 vFILE *dotFp; /* File pointer to dotCDF file (for a 1673 uncompressed CDF). . */ 1674 vFILE *uDotFp; /* File pointer to uncompressed dotCDF 1675 file (for a compressed CDF). */ 1676 vFILE *compressFp; /* Compression scratch file pointer. 1677 If NULL, the compression scratch 1678 file has not been created yet. */ 1679 Int32 CDRoffset; /* Byte offset of CDR using 32-bit 1680 offset. N/A if a Version 1 1681 CDF. */ 1682 OFF_T CDRoffset64; /* Byte offset of CDR using 64-bit 1683 offset. N/A if a Version 1 1684 CDF. */ 1685 Int32 GDRoffset; /* Byte offset of GDR using 32-bit. 1686 N/A if a Version 1 CDF. */ 1687 OFF_T GDRoffset64; /* Byte offset of GDR using 64-bit. 1688 N/A if a Version 1 CDF. */ 1689 char *CDFname; /* CDF name as specified by caller. */ 1690 char *scratchDir; /* Directory to be used for scratch 1691 files. */ 1692 Int32 decoding; /* Decoding (encoding) for attribute 1693 entry and variable values read from 1694 a CDF. */ 1695 Logical readOnly; /* TRUE: read-only access, 1696 FALSE: read-write access. Applicable 1697 to opening existing files. */ 1698 int zMode; /* zMODEoff: no zMode, 1699 zMODEon1: keep NOVARY variances 1700 (rVariables --> zGroup), 1701 zMODEon2: remove dimensions with 1702 NOVARY variance. */ 1703 Logical negToPosFp0; /* TRUE: convert -0.0 to 0.0, 1704 FALSE: don't convert. */ 1705 int status; /* READ_ONLY, or READ_WRITE. */ 1706 int workingCacheSize; /* Number of cache buffers for the 1707 "working" dotCDF file. */ 1708 int compressCacheSize; /* Number of cache buffers for the 1709 compression scratch file. */ 1710 uLong pseudo_clock; /* Tick count used to determine which 1711 variable was least recently used. */ 1712 Logical singleFile; /* TRUE if a single-file CDF. */ 1713 Logical rowMajor; /* TRUE if a row major CDF. */ 1714 Int32 encoding; /* Encoding of CDF. */ 1715 Int32 rNumDims; /* Number of rVariable dimensions. */ 1716 Int32 rDimSizes[CDF_MAX_DIMS]; /* rVariable dimension sizes. */ 1717 Int32 rMaxRec; /* Maximum record number of all the 1718 rVariables. */ 1719 Int32 NrVars; /* Number of rVariables. */ 1720 Int32 NzVars; /* Number of zVariables. */ 1721 int MAXrVars; /* Current size of `rVars' array. */ 1722 int MAXzVars; /* Current size of `zVars' array. */ 1723 struct VarStruct **rVars; /* Pointer to array of pointers to 1724 rVariable data structures. */ 1725 struct VarStruct **zVars; /* Pointer to array of pointers to 1726 zVariable data structures. */ 1727 Int32 CURrVarNum; /* Current rVariable number (when not 1728 in zMode). */ 1729 Int32 CURrVarOffset; /* Current selected rVariable offset 1730 using 32-bit offset.*/ 1731 OFF_T CURrVarOffset64; /* Current selected rVariable offset 1732 using 64-bit offset.*/ 1733 Int32 CURzVarNum; /* Current zVariable number (used when 1734 zMode is on or off). */ 1735 Int32 CURzVarOffset; /* Current selected zVariable offset 1736 using 32-bit offset.*/ 1737 OFF_T CURzVarOffset64; /* Current selected zVariable offset 1738 using 64-bit offset.*/ 1739 Int32 CURattrOffset; /* Offset of current attribute's ADR 1740 using 32-bit offset. 1741 Set to RESERVED_ATTROFFSET if an 1742 attribute is not selected. */ 1743 OFF_T CURattrOffset64; /* Offset of current attribute's ADR 1744 using 64-bit offset. 1745 Set to RESERVED_ATTROFFSET if an 1746 attribute is not selected. */ 1747 Int32 CURgrEntryNum; /* Currently selected gEntry/rEntry 1748 number (a corresponding gEntry/ 1749 rEntry in the current attribute 1750 does not have to exist yet). When 1751 in zMode, this is used only for 1752 the gEntry number. Set to 1753 RESERVED_ENTRYNUM when a 1754 gEntry/rEntry is not selected. */ 1755 Int32 CURzEntryNum; /* Currently selected zEntry number (a 1756 corresponding zEntry in the current 1757 attribute does not have to exist 1758 yet). This is used when zMode is 1759 on or off. When zMode is on, could 1760 actually point to an AgrEDR. Set to 1761 RESERVED_ENTRYNUM when a zEntry is 1762 not selected. */ 1763 Int32 CURgrEntryOffset; /* Offset of current AgrEDR using 32-bit 1764 offset. Not set 1765 to RESERVED_ENTRYOFFSET when an 1766 attribute and gEntry/rEntry have 1767 been selected and the entry actually 1768 exists. */ 1769 OFF_T CURgrEntryOffset64; /* Offset of current AgrEDR using 64-bit 1770 offset. Not set 1771 to RESERVED_ENTRYOFFSET when an 1772 attribute and gEntry/rEntry have 1773 been selected and the entry actually 1774 exists. */ 1775 Int32 CURzEntryOffset; /* Offset of current AzEDR using 32-bit 1776 offset. Not set 1777 to RESERVED_ENTRYOFFSET when an 1778 attribute and zEntry have been 1779 selected and the entry actually 1780 exists. If zMode is on, could point 1781 to an AgrEDR. */ 1782 OFF_T CURzEntryOffset64; /* Offset of current AzEDR using 64-bit 1783 offset. Not set 1784 to RESERVED_ENTRYOFFSET when an 1785 attribute and zEntry have been 1786 selected and the entry actually 1787 exists. If zMode is on, could point 1788 to an AgrEDR. */ 1789 struct rdSTRUCT rRD; /* Current record/dimension states for 1790 the rVariables (they are the same 1791 for all rVariables). */ 1792 struct CDFstageStruct stage; /* Staging control. */ 1793 Logical no_append; /* TRUE if pathnames should not have 1794 extensions or version numbers 1795 appended. */ 1796 Logical upper_case_ext; /* TRUE if uppercase file extensions.*/ 1797 Logical version_numbers; /* TRUE if a ";1" is appended to all 1798 pathnames. */ 1799 Logical fakeEPOCH; /* TRUE if a CDF prior to CDF V2.1.1 1800 for which the data type CDF_EPOCH 1801 should be substituted for the actual 1802 data type in some cases involving 1803 the rVariable "EPOCH". */ 1804 Logical wastedSpace; /* TRUE if a CDF prior to CDF V2.5 in 1805 which there is 128 bytes of wasted 1806 space in each VDR and 1689 bytes of 1807 wasted space in the CDR. */ 1808 Logical badEOF; /* TRUE if a CDF prior to CDF V2.1 in 1809 which case the EOF of the GDR was 1810 not used (ie. contains garbage). */ 1811 Logical badTerminatingOffsets; /* TRUE if a CDF prior to CDF V2.1 in 1812 which the terminating offsets of the 1813 ADR and rVDR linked lists are bad.*/ 1814 Logical assumedScopes; /* TRUE if a CDF prior to CDF V2.5 in 1815 which there are assumed attribute 1816 scopes. */ 1817 vSTATS dotCDFvStats; /* Vstream statistics for the dotCDF 1818 file (compressed or uncompressed).*/ 1819 vSTATS uDotCDFvStats; /* Vstream statistics for the 1820 uncompressed dotCDF file (of a 1821 compressed CDF). */ 1822 long checksum; /* Indicator for check sum. */ 1823 Int32 eof; /* End-of-file (EOF) position in the 1824 dotCDF file (total # of bytes used 1825 in the dotCDF file.) for non-LFS*/ 1826 OFF_T eof64; /* End-of-file (EOF) position in the 1827 dotCDF file (total # of bytes used 1828 in the dotCDF file.) for LFS*/ 1829 }; 1830 1831 /****************************************************************************** 1832 * Structure for `string' related data (used by FORTRAN interfaces). 1833 ******************************************************************************/ 1834 1835 struct STRINGstruct { 1836 char *string; 1837 struct STRINGstruct *next; 1838 }; 1839 1840 /****************************************************************************** 1841 * Structure for `varargs' related data. 1842 ******************************************************************************/ 1843 1844 struct VAstruct { 1845 va_list ap; 1846 long fnc; 1847 long item; 1848 }; 1849 1850 /****************************************************************************** 1851 * Structure for `current' data. 1852 ******************************************************************************/ 1853 1854 struct CurStruct { 1855 struct CDFstruct *cdf; 1856 CDFstatus status; 1857 }; 1858 1859 /****************************************************************************** 1860 * SelectCDF. 1861 ******************************************************************************/ 1862 1863 #define SelectCDF(cur_,cdf_) \ 1864 if (cur_ == NULL) \ 1865 return NO_CDF_SELECTED; \ 1866 else \ 1867 if (cur_->magic == ABORTEDid_MAGIC_NUMBER) \ 1868 return NO_MORE_ACCESS; \ 1869 else \ 1870 cdf_ = cur_; 1871 1872 /****************************************************************************** 1873 * SINGLEfileBITset. 1874 ******************************************************************************/ 1875 1876 #define SINGLEfileBITset(flags) (BITSET(flags,CDR_FORMAT_BIT)) 1877 1878 /****************************************************************************** 1879 * ROWmajorBITset. 1880 ******************************************************************************/ 1881 1882 #define ROWmajorBITset(flags) (BITSET(flags,CDR_MAJORITY_BIT)) 1883 1884 /****************************************************************************** 1885 * CHECKsumBITset. 1886 ******************************************************************************/ 1887 1888 #define CHECKsumBITset(flags) (BITSET(flags,CDR_CHECKSUM_BIT)) 1889 1890 /****************************************************************************** 1891 * zModeON/zModeOFF. 1892 ******************************************************************************/ 1893 1894 #define zModeON(CDF) (CDF->zMode == zMODEon1 || CDF->zMode == zMODEon2) 1895 #define zModeOFF(CDF) (CDF->zMode == zMODEoff) 1896 1897 /****************************************************************************** 1898 * Checks for set bits in VDR flags. 1899 ******************************************************************************/ 1900 1901 #define PADvalueBITset(flags) (BITSET(flags,VDR_PADVALUE_BIT)) 1902 #define RECvaryBITset(flags) (BITSET(flags,VDR_RECVARY_BIT)) 1903 #define SPARSEarraysBITset(flags) (BITSET(flags,VDR_SPARSEARRAYS_BIT)) 1904 #define VARcompressionBITset(flags) (BITSET(flags,VDR_COMPRESSION_BIT)) 1905 1906 /****************************************************************************** 1907 * Used to check for large file (64-bit) offset. 1908 ******************************************************************************/ 1909 1910 #define isLFS(CDF) (CDF->largeFile) 1911 1912 /****************************************************************************** 1913 * Function prototypes. 1914 ******************************************************************************/ 1915 1916 STATICforIDL struct VarStruct *VarStructPtr PROTOARGs(( 1917 struct CDFstruct *CDF, Logical zOp, long varN 1918 )); 1919 STATICforIDL void DefaultPadValue PROTOARGs(( 1920 Int32 dataType, Int32 numElems, void *padValue 1921 )); 1922 STATICforIDL CDFstatus DefaultPadBuffer PROTOARGs(( 1923 struct CDFstruct *CDF, struct VarStruct *Var, Int32 nValues, void *buffer 1924 )); 1925 STATICforIDL CDFstatus PadBuffer PROTOARGs(( 1926 struct CDFstruct *CDF, struct VarStruct *Var, Int32 nValues, void *buffer 1927 )); 1928 STATICforIDL CDFstatus WasteIR PROTOARGs(( 1929 struct CDFstruct *CDF, Int32 offset, Int32 size 1930 )); 1931 STATICforIDL Int32 IndicesValueOffset PROTOARGs(( 1932 Int32 numDims, Int32 *indices, Int32 *dimVarys, Int32 *nPhyDimValues 1933 )); 1934 STATICforIDL void ValueOffsetIndices PROTOARGs(( 1935 Int32 offset, Logical rowMajor, Int32 numDims, Int32 *dimVarys, 1936 Int32 *nPhyDimValues, Int32 *indices 1937 )); 1938 STATICforIDL CDFstatus RecordByteOffset PROTOARGs(( 1939 struct CDFstruct *CDF, struct VarStruct *Var, Int32 phyRecN, Int32 *offset 1940 )); 1941 STATICforIDL CDFstatus ConfigureNEWzMode PROTOARGs((struct CDFstruct *CDF)); 1942 STATICforIDL void InitCURobjectsStates PROTOARGs((struct CDFstruct *CDF)); 1943 STATICforIDL void ResetReadOnlyState PROTOARGs((struct CDFstruct *CDF)); 1944 STATICforIDL Int32 HostEncoding PROTOARGs((void)); 1945 STATICforIDL Int32 HostDecoding PROTOARGs((void)); 1946 STATICforIDL int IntegerOrder PROTOARGs((Int32 ed)); 1947 STATICforIDL int FpType PROTOARGs((Int32 ed)); 1948 STATICforIDL Logical EquivDataTypes PROTOARGs(( 1949 Int32 dataType1, Int32 dataType2 1950 )); 1951 STATICforIDL void FreeCDFid PROTOARGs(( 1952 struct CDFstruct *CDF, Logical aborting 1953 )); 1954 STATICforIDL CDFstatus CloseLRUvar PROTOARGs((struct CDFstruct *CDF)); 1955 STATICforIDL CDFstatus VarAccess PROTOARGs(( 1956 struct CDFstruct *CDF, struct VarStruct *Var 1957 )); 1958 STATICforIDL CDFstatus AllocateRecords VARPROTOARGs(( 1959 struct CDFstruct *CDF, struct VarStruct *Var, struct AllocStruct alloc 1960 )); 1961 STATICforIDL CDFstatus PadUnRecords PROTOARGs(( 1962 struct CDFstruct *CDF, struct VarStruct *Var, Int32 firstRec, Int32 lastRec 1963 )); 1964 STATICforIDL CDFstatus CloseVarFiles PROTOARGs((struct CDFstruct *CDF)); 1965 STATICforIDL Logical WriteAccess PROTOARGs(( 1966 struct CDFstruct *CDF, Logical forDelete, CDFstatus *pStatus 1967 )); 1968 STATICforIDL CDFstatus WriteVarElems PROTOARGs(( 1969 struct VarStruct *Var, vFILE *fp, Int32 offset, Int32 numElems, void *buffer 1970 )); 1971 STATICforIDL CDFstatus WriteBuffer PROTOARGs(( 1972 struct CDFstruct *CDF, vFILE *fp, Int32 dataType, Int32 numElems, 1973 void *buffer 1974 )); 1975 STATICforIDL CDFstatus HyperRead PROTOARGs(( 1976 struct CDFstruct *CDF, struct VarStruct *Var, struct rdSTRUCT *rd, 1977 void *buffer 1978 )); 1979 STATICforIDL CDFstatus HyperReadDim PROTOARGs(( 1980 Int32 numDims, Int32 *dimSizes, Int32 *dimVarys, Int32 *indices, 1981 Int32 *counts, Int32 *intervals, Int32 *nHypDimValues, Int32 *nPhyDimValues, 1982 Logical *fullPhyDim, int firstDim, int dimIncr, Int32 recNum, Int32 offset, 1983 void *buffer, void *phyBuffer, struct CDFstruct *CDF, struct VarStruct *Var 1984 )); 1985 STATICforIDL CDFstatus HyperWrite PROTOARGs(( 1986 struct CDFstruct *CDF, struct VarStruct *Var, struct rdSTRUCT *rd, 1987 void *buffer 1988 )); 1989 STATICforIDL CDFstatus HyperWriteDim PROTOARGs(( 1990 Int32 numDims, Int32 *dimSizes, Int32 *dimVarys, Int32 *indices, 1991 Int32 *counts, Int32 *intervals, Int32 *nHypDimValues, Int32 *nPhyDimValues, 1992 Logical *fullPhyDim, int firstDim, int dimIncr, Int32 recNum, Int32 offset, 1993 void *buffer, void *phyBuffer, struct CDFstruct *CDF, struct VarStruct *Var 1994 )); 1995 STATICforIDL CDFstatus CDFcre PROTOARGs(( 1996 struct VAstruct *Va, struct CurStruct *Cur 1997 )); 1998 STATICforIDL CDFstatus CDFope PROTOARGs(( 1999 struct VAstruct *Va, struct CurStruct *Cur 2000 )); 2001 STATICforIDL CDFstatus CDFdel PROTOARGs(( 2002 struct VAstruct *Va, struct CurStruct *Cur 2003 )); 2004 STATICforIDL CDFstatus CDFclo PROTOARGs(( 2005 struct VAstruct *Va, struct CurStruct *Cur 2006 )); 2007 STATICforIDL CDFstatus CDFget PROTOARGs(( 2008 struct VAstruct *Va, struct CurStruct *Cur 2009 )); 2010 STATICforIDL CDFstatus CDFput1 PROTOARGs(( 2011 struct VAstruct *Va, struct CurStruct *Cur 2012 )); 2013 STATICforIDL CDFstatus CDFput2 PROTOARGs(( 2014 struct VAstruct *Va, struct CurStruct *Cur 2015 )); 2016 STATICforIDL CDFstatus CDFsel PROTOARGs(( 2017 struct VAstruct *Va, struct CurStruct *Cur 2018 )); 2019 STATICforIDL CDFstatus CDFcon PROTOARGs(( 2020 struct VAstruct *Va, struct CurStruct *Cur 2021 )); 2022 STATICforIDL CDFstatus CDFsav PROTOARGs(( 2023 struct VAstruct *Va, struct CurStruct *Cur 2024 )); 2025 STATICforIDL void CDFcopyRight PROTOARGs((char *copyRight)); 2026 STATICforIDL CDFstatus CDFstatusText PROTOARGs(( 2027 CDFstatus status, char *textPtr 2028 )); 2029 STATICforIDL CDFstatus Read_V1_header PROTOARGs((struct CDFstruct *CDF)); 2030 STATICforIDL CDFstatus Read_V2_header PROTOARGs((struct CDFstruct *CDF)); 2031 STATICforIDL CDFstatus Write_V2_header PROTOARGs((struct CDFstruct *CDF)); 2032 STATICforIDL char *NULterminate PROTOARGs(( 2033 char *string, size_t length, struct STRINGstruct **ssh 2034 )); 2035 STATICforIDL void FreeStrings PROTOARGs((struct STRINGstruct *ssh)); 2036 STATICforIDL Logical ValidVarName PROTOARGs((char *name)); 2037 STATICforIDL Logical ValidAttrName PROTOARGs((char *name)); 2038 STATICforIDL Logical ValidDataType PROTOARGs((Int32 dataType)); 2039 STATICforIDL Logical ValidAttrScope PROTOARGs((Int32 scope)); 2040 STATICforIDL Logical ValidEncoding PROTOARGs(( 2041 Int32 encoding, Int32 *actualEncoding 2042 )); 2043 STATICforIDL Logical ValidDecoding PROTOARGs((Int32 decoding)); 2044 STATICforIDL CDFstatus ValidateCompression PROTOARGs(( 2045 long cType, long *cParms 2046 )); 2047 STATICforIDL CDFstatus ConversionFunction PROTOARGs(( 2048 Int32 dataType, Int32 encoding, Int32 decoding, Logical negToPosFp0, 2049 CDFstatus (**function) PROTOARGs((void *buffer, Int32 numElems)) 2050 )); 2051 STATICforIDL CDFstatus FP1toFP34single PROTOARGs(( 2052 void *buffer, Int32 numElems 2053 )); 2054 STATICforIDL CDFstatus FP2toFP34single PROTOARGs(( 2055 void *buffer, Int32 numElems 2056 )); 2057 STATICforIDL CDFstatus FP34toFP1single PROTOARGs(( 2058 void *buffer, Int32 numElems 2059 )); 2060 STATICforIDL CDFstatus FP34toFP2single PROTOARGs(( 2061 void *buffer, Int32 numElems 2062 )); 2063 STATICforIDL CDFstatus FP1toFP2singleNEGtoPOS PROTOARGs(( 2064 void *buffer, Int32 numElems 2065 )); 2066 STATICforIDL CDFstatus FP1toFP34singleNEGtoPOS PROTOARGs(( 2067 void *buffer, Int32 numElems 2068 )); 2069 STATICforIDL CDFstatus FP2toFP1singleNEGtoPOS PROTOARGs(( 2070 void *buffer, Int32 numElems 2071 )); 2072 STATICforIDL CDFstatus FP2toFP34singleNEGtoPOS PROTOARGs(( 2073 void *buffer, Int32 numElems 2074 )); 2075 STATICforIDL CDFstatus FP34toFP1singleNEGtoPOS PROTOARGs(( 2076 void *buffer, Int32 numElems 2077 )); 2078 STATICforIDL CDFstatus FP34toFP2singleNEGtoPOS PROTOARGs(( 2079 void *buffer, Int32 numElems 2080 )); 2081 STATICforIDL CDFstatus FP1toFP3double PROTOARGs(( 2082 void *buffer, Int32 numElems 2083 )); 2084 STATICforIDL CDFstatus FP1toFP4double PROTOARGs(( 2085 void *buffer, Int32 numElems 2086 )); 2087 STATICforIDL CDFstatus FP2toFP3double PROTOARGs(( 2088 void *buffer, Int32 numElems 2089 )); 2090 STATICforIDL CDFstatus FP2toFP4double PROTOARGs(( 2091 void *buffer, Int32 numElems 2092 )); 2093 STATICforIDL CDFstatus FP3toFP1double PROTOARGs(( 2094 void *buffer, Int32 numElems 2095 )); 2096 STATICforIDL CDFstatus FP3toFP2double PROTOARGs(( 2097 void *buffer, Int32 numElems 2098 )); 2099 STATICforIDL CDFstatus FP3toFP4double PROTOARGs(( 2100 void *buffer, Int32 numElems 2101 )); 2102 STATICforIDL CDFstatus FP4toFP1double PROTOARGs(( 2103 void *buffer, Int32 numElems 2104 )); 2105 STATICforIDL CDFstatus FP4toFP2double PROTOARGs(( 2106 void *buffer, Int32 numElems 2107 )); 2108 STATICforIDL CDFstatus FP4toFP3double PROTOARGs(( 2109 void *buffer, Int32 numElems 2110 )); 2111 STATICforIDL CDFstatus FP1toFP2doubleNEGtoPOS PROTOARGs(( 2112 void *buffer, Int32 numElems 2113 )); 2114 STATICforIDL CDFstatus FP1toFP3doubleNEGtoPOS PROTOARGs(( 2115 void *buffer, Int32 numElems 2116 )); 2117 STATICforIDL CDFstatus FP1toFP4doubleNEGtoPOS PROTOARGs(( 2118 void *buffer, Int32 numElems 2119 )); 2120 STATICforIDL CDFstatus FP2toFP1doubleNEGtoPOS PROTOARGs(( 2121 void *buffer, Int32 numElems 2122 )); 2123 STATICforIDL CDFstatus FP2toFP3doubleNEGtoPOS PROTOARGs(( 2124 void *buffer, Int32 numElems 2125 )); 2126 STATICforIDL CDFstatus FP2toFP4doubleNEGtoPOS PROTOARGs(( 2127 void *buffer, Int32 numElems 2128 )); 2129 STATICforIDL CDFstatus FP3toFP1doubleNEGtoPOS PROTOARGs(( 2130 void *buffer, Int32 numElems 2131 )); 2132 STATICforIDL CDFstatus FP3toFP2doubleNEGtoPOS PROTOARGs(( 2133 void *buffer, Int32 numElems 2134 )); 2135 STATICforIDL CDFstatus FP3toFP4doubleNEGtoPOS PROTOARGs(( 2136 void *buffer, Int32 numElems 2137 )); 2138 STATICforIDL CDFstatus FP4toFP1doubleNEGtoPOS PROTOARGs(( 2139 void *buffer, Int32 numElems 2140 )); 2141 STATICforIDL CDFstatus FP4toFP2doubleNEGtoPOS PROTOARGs(( 2142 void *buffer, Int32 numElems 2143 )); 2144 STATICforIDL CDFstatus FP4toFP3doubleNEGtoPOS PROTOARGs(( 2145 void *buffer, Int32 numElems 2146 )); 2147 STATICforIDL CDFstatus FP1singleNEGtoPOS PROTOARGs(( 2148 void *buffer, Int32 numElems 2149 )); 2150 STATICforIDL CDFstatus FP2singleNEGtoPOS PROTOARGs(( 2151 void *buffer, Int32 numElems 2152 )); 2153 STATICforIDL CDFstatus FP34singleNEGtoPOS PROTOARGs(( 2154 void *buffer, Int32 numElems 2155 )); 2156 STATICforIDL CDFstatus FP1doubleNEGtoPOS PROTOARGs(( 2157 void *buffer, Int32 numElems 2158 )); 2159 STATICforIDL CDFstatus FP2doubleNEGtoPOS PROTOARGs(( 2160 void *buffer, Int32 numElems 2161 )); 2162 STATICforIDL CDFstatus FP3doubleNEGtoPOS PROTOARGs(( 2163 void *buffer, Int32 numElems 2164 )); 2165 STATICforIDL CDFstatus FP4doubleNEGtoPOS PROTOARGs(( 2166 void *buffer, Int32 numElems 2167 )); 2168 STATICforIDL CDFstatus FP3doubleLIMIT PROTOARGs(( 2169 void *buffer, Int32 numElems 2170 )); 2171 STATICforIDL CDFstatus Reverse2 PROTOARGs((void *buffer, Int32 numElems)); 2172 STATICforIDL CDFstatus Reverse4 PROTOARGs((void *buffer, Int32 numElems)); 2173 STATICforIDL CDFstatus Reverse8 PROTOARGs((void *buffer, Int32 numElems)); 2174 STATICforIDL CDFstatus Reverse16 PROTOARGs((void *buffer, Int32 numElems)); 2175 #if defined(Fif_DESCR) 2176 STATICforIDL Logical isDESCR PROTOARGs((void *ptr, char **aptr, size_t *len)); 2177 STATICforIDL char *DESCRtoREF PROTOARGs((void *ptr)); 2178 STATICforIDL char *DESCRtoREFnul PROTOARGs(( 2179 void *ptr, size_t maxREFlen, struct STRINGstruct **ssh 2180 )); 2181 #endif 2182 #if defined(Fif_NOLEN) 2183 STATICforIDL char *FindEndNUL PROTOARGs(( 2184 char *ptr, size_t maxREFlen, struct STRINGstruct **ssh 2185 )); 2186 #endif 2187 STATICforIDL void SetBit32 PROTOARGs((Int32 *value, int bit)); 2188 STATICforIDL void ClearBit32 PROTOARGs((Int32 *value, int bit)); 2189 STATICforIDL void CtoFORTstring PROTOARGs(( 2190 char *Cstring, void *FORTstring, int length 2191 )); 2192 STATICforIDL void NulPad PROTOARGs((char *string, int length)); 2193 STATICforIDL CDFstatus UpdateMaxRec PROTOARGs(( 2194 struct CDFstruct *CDF, struct VarStruct *Var, Int32 phyRecNum 2195 )); 2196 STATICforIDL CDFstatus FindCDF PROTOARGs(( 2197 char *path, Logical *append, Logical *upper, Logical *version 2198 )); 2199 STATICforIDL void BuildFilePath PROTOARGs(( 2200 int fileType, char *pathBase, Logical noAppend, Logical upperCase, 2201 Logical versionNumber, Int32 varN, char pathX[DU_MAX_PATH_LEN+1] 2202 )); 2203 STATICforIDL CDFstatus LocateCurrentVar PROTOARGs(( 2204 struct CDFstruct *CDF, Logical zOp, Int32 *offset, Logical *zVar, 2205 struct VarStruct **Var 2206 )); 2207 STATICforIDL Logical CurrentVarMode PROTOARGs(( 2208 struct CDFstruct *CDF, Logical zOp 2209 )); 2210 STATICforIDL CDFstatus InitCurrentVar PROTOARGs(( 2211 struct CDFstruct *CDF, Logical zVar, struct VarStruct **Var 2212 )); 2213 STATICforIDL CDFstatus InitVar PROTOARGs(( 2214 struct CDFstruct *CDF, Int32 varN, Logical zVar, struct VarStruct **Var 2215 )); 2216 STATICforIDL CDFstatus InitVar2 PROTOARGs(( 2217 struct CDFstruct *CDF, struct VarStruct *Var 2218 )); 2219 STATICforIDL CDFstatus VarIdentity PROTOARGs(( 2220 struct CDFstruct *CDF, Int32 varN, Logical zOp, Int32 *varNt, Logical *zVar, 2221 struct VarStruct **Var 2222 )); 2223 STATICforIDL CDFstatus OpenVar PROTOARGs(( 2224 struct CDFstruct *CDF, struct VarStruct *Var 2225 )); 2226 STATICforIDL CDFstatus FindAttrByName PROTOARGs(( 2227 struct CDFstruct *CDF, char *searchName, Int32 *offset 2228 )); 2229 STATICforIDL CDFstatus FindAttrByNumber PROTOARGs(( 2230 struct CDFstruct *CDF, Int32 searchNum, Int32 *offset 2231 )); 2232 STATICforIDL CDFstatus FindEntryByNumber PROTOARGs(( 2233 struct CDFstruct *CDF, Int32 ADRoffset, Logical zEntry, Int32 entryN, 2234 Int32 *offset 2235 )); 2236 STATICforIDL CDFstatus FindVarByName PROTOARGs(( 2237 struct CDFstruct *CDF, char *searchName, Int32 *offset, Logical *zVar, 2238 struct VarStruct **Var 2239 )); 2240 STATICforIDL CDFstatus FindVarByNumber PROTOARGs(( 2241 struct CDFstruct *CDF, Int32 searchNum, Logical zVar, Int32 *offset 2242 )); 2243 STATICforIDL CDFstatus FindLastAttr PROTOARGs(( 2244 struct CDFstruct *CDF, Int32 *lastOffset 2245 )); 2246 STATICforIDL CDFstatus FindLastEntry PROTOARGs(( 2247 struct CDFstruct *CDF, Int32 ADRoffset, Logical zEntry, Int32 *lastOffset 2248 )); 2249 STATICforIDL CDFstatus FindPrevEntry PROTOARGs(( 2250 struct CDFstruct *CDF, Int32 ADRoffset, Int32 searchOffset, Logical zEntry, 2251 Int32 *prevOffset 2252 )); 2253 STATICforIDL CDFstatus CheckEntryOp PROTOARGs(( 2254 struct CDFstruct *CDF, int entryType 2255 )); 2256 STATICforIDL CDFstatus SetCURgrEntry PROTOARGs(( 2257 struct CDFstruct *CDF, Logical useCurrent, Int32 entryNum 2258 )); 2259 STATICforIDL CDFstatus SetCURzEntry PROTOARGs(( 2260 struct CDFstruct *CDF, Logical useCurrent, Int32 entryNum 2261 )); 2262 STATICforIDL CDFstatus CalcDimParms PROTOARGs(( 2263 struct CDFstruct *CDF, Int32 offset, Logical zVar, Int32 *numDimsP, 2264 Int32 dimSizesP[], Int32 dimVarysP[] 2265 )); 2266 STATICforIDL Int32 SeqValueByteOffset PROTOARGs(( 2267 struct CDFstruct *CDF, struct VarStruct *Var 2268 )); 2269 STATICforIDL void NULterminateMAX PROTOARGs((char *string, size_t maxLen)); 2270 STATICforIDL CDFstatus AllocateIR PROTOARGs(( 2271 struct CDFstruct *CDF, Int32 size, Int32 *offset 2272 )); 2273 STATICforIDL CDFstatus ResizeIR PROTOARGs(( 2274 struct CDFstruct *CDF, Int32 curOffset, Int32 newSize, Int32 *newOffset, 2275 Logical move, Logical *success 2276 )); 2277 STATICforIDL CDFstatus RemoveUIRs PROTOARGs(( 2278 struct CDFstruct *CDF, Int32 sOffset, Int32 eOffset 2279 )); 2280 STATICforIDL CDFstatus LastRecord PROTOARGs(( 2281 struct CDFstruct *CDF, Int32 offset, Logical zVar, Int32 *recNum 2282 )); 2283 STATICforIDL CDFstatus VerifyNoRecordsWritten PROTOARGs(( 2284 struct CDFstruct *CDF, Logical *no 2285 )); 2286 STATICforIDL CDFstatus VerifyNoPadsSpecified PROTOARGs(( 2287 struct CDFstruct *CDF, Logical *no 2288 )); 2289 STATICforIDL CDFstatus VerifyNoEntriesWritten PROTOARGs(( 2290 struct CDFstruct *CDF, Logical *no 2291 )); 2292 STATICforIDL Logical Read32s PROTOARGs((vFILE *fp, Int32 *buffer, int count)); 2293 STATICforIDL CDFstatus ReadIrSize PROTOARGs(( 2294 vFILE *fp, Int32 offset, Int32 *irSize 2295 )); 2296 STATICforIDL CDFstatus ReadCDR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2297 STATICforIDL CDFstatus ReadGDR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2298 STATICforIDL CDFstatus ReadADR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2299 STATICforIDL CDFstatus ReadADRList PROTOARGs((vFILE *fp)); 2300 STATICforIDL CDFstatus ReadAEDRList PROTOARGs(( 2301 vFILE *fp, struct AEDRstructExt ***AEDRList, Int32 AEDRHead, 2302 Int32 NumEntries, Int32 MaxEntry 2303 )); 2304 STATICforIDL CDFstatus ReadAEDR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2305 STATICforIDL CDFstatus ReadVDR VARPROTOARGs(( 2306 struct CDFstruct *CDF, vFILE *fp, Int32 offset, Logical zVar, ... 2307 )); 2308 STATICforIDL CDFstatus ReadVVR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2309 STATICforIDL CDFstatus ReadCCR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2310 STATICforIDL CDFstatus ReadCPR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2311 STATICforIDL CDFstatus ReadSPR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2312 STATICforIDL CDFstatus ReadCVVR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2313 STATICforIDL CDFstatus ReadUIR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2314 STATICforIDL Logical Write32 PROTOARGs((vFILE *fp, Int32 *value)); 2315 STATICforIDL Logical Write32s PROTOARGs((vFILE *fp, Int32 *buffer, int count)); 2316 STATICforIDL CDFstatus WriteIrSize PROTOARGs(( 2317 vFILE *fp, Int32 offset, Int32 *irSize 2318 )); 2319 STATICforIDL CDFstatus WriteIrType PROTOARGs(( 2320 vFILE *fp, Int32 offset, Int32 *irType 2321 )); 2322 STATICforIDL CDFstatus WriteCDR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2323 STATICforIDL CDFstatus WriteGDR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2324 STATICforIDL CDFstatus WriteADR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2325 STATICforIDL CDFstatus WriteAEDR VARPROTOARGs(( 2326 struct CDFstruct *CDF, vFILE *fp, Int32 offset, ... 2327 )); 2328 STATICforIDL CDFstatus WriteVDR VARPROTOARGs(( 2329 struct CDFstruct *CDF, vFILE *fp, Int32 offset, Logical zVar, ... 2330 )); 2331 STATICforIDL CDFstatus WriteVXR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2332 STATICforIDL CDFstatus WriteVVR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2333 STATICforIDL CDFstatus WriteCCR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2334 STATICforIDL CDFstatus WriteCPR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2335 STATICforIDL CDFstatus WriteSPR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2336 STATICforIDL CDFstatus WriteCVVR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2337 STATICforIDL CDFstatus WriteUIR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2338 STATICforIDL CDFstatus ShortenCDR PROTOARGs((struct CDFstruct *CDF)); 2339 STATICforIDL CDFstatus ShortenVDRs PROTOARGs((struct CDFstruct *CDF)); 2340 STATICforIDL CDFstatus CorrectEPOCH PROTOARGs((struct CDFstruct *CDF)); 2341 STATICforIDL CDFstatus CorrectScopes PROTOARGs((struct CDFstruct *CDF)); 2342 STATICforIDL CDFstatus CorrectBlockingFactors PROTOARGs(( 2343 struct CDFstruct *CDF 2344 )); 2345 STATICforIDL CDFstatus CorrectV20offsets PROTOARGs((struct CDFstruct *CDF)); 2346 STATICforIDL CDFstatus CorrectV20eof PROTOARGs((struct CDFstruct *CDF)); 2347 STATICforIDL Logical DeleteFile PROTOARGs((char *path)); 2348 STATICforIDL void KillAbortedCDF PROTOARGs(( 2349 struct CDFstruct *CDF, struct CurStruct *Cur 2350 )); 2351 STATICforIDL void AbortAccess PROTOARGs(( 2352 struct CDFstruct *CDF, Logical updateCDF, Logical deleteCDF 2353 )); 2354 STATICforIDL CDFstatus DeleteCDFfiles PROTOARGs((struct CDFstruct *CDF)); 2355 STATICforIDL CDFstatus DeleteEntry PROTOARGs(( 2356 struct CDFstruct *CDF, Int32 aOffset, Int32 eOffset 2357 )); 2358 STATICforIDL void StripTrailingBlanks PROTOARGs((char *string)); 2359 STATICforIDL CDFstatus DecompressCDF PROTOARGs((vFILE *dotFp, vFILE *uDotFp)); 2360 STATICforIDL CDFstatus WriteCompressedCDF PROTOARGs(( 2361 struct CDFstruct *CDF, struct CPRstruct *CPR, Logical empty 2362 )); 2363 STATICforIDL CDFstatus CopyCDF PROTOARGs((vFILE *srcFp, vFILE *destFp)); 2364 STATICforIDL CDFstatus CompressRLE0 PROTOARGs(( 2365 vFILE *srcFp, Int32 srcOffset, Int32 srcSize, CDFstatus srcError, 2366 vFILE *destFp, Int32 destOffset, Int32 *destSize, CDFstatus destError 2367 )); 2368 STATICforIDL CDFstatus DecompressRLE0 PROTOARGs(( 2369 vFILE *srcFp, Int32 srcOffset, Int32 srcSize, CDFstatus srcError, 2370 vFILE *destFp, Int32 destOffset, CDFstatus destError 2371 )); 2372 STATICforIDL CDFstatus CompressHUFF0 PROTOARGs(( 2373 vFILE *input, Int32 iOffset, Int32 iSize, CDFstatus iError, 2374 vFILE *oFp, Int32 oOffset, Int32 *oSize, CDFstatus oError 2375 )); 2376 STATICforIDL CDFstatus DecompressHUFF0 PROTOARGs(( 2377 vFILE *iFp, Int32 iOffset, CDFstatus iError, 2378 vFILE *output, Int32 oOffset, CDFstatus oError 2379 )); 2380 STATICforIDL CDFstatus CompressAHUFF0 PROTOARGs(( 2381 vFILE *input, Int32 iOffset, Int32 iSize, CDFstatus iError, 2382 vFILE *oFp, Int32 oOffset, Int32 *oSize, CDFstatus oError 2383 )); 2384 STATICforIDL CDFstatus DecompressAHUFF0 PROTOARGs(( 2385 vFILE *iFp, Int32 iOffset, CDFstatus iError, 2386 vFILE *output, Int32 oOffset, CDFstatus oError 2387 )); 2388 STATICforIDL CDFstatus CompressGZIP PROTOARGs(( 2389 vFILE *srcFp, Int32 srcOffset, Int32 srcSize, CDFstatus srcError, 2390 vFILE *destFp, Int32 destOffset, Int32 *destSize, CDFstatus destError, 2391 Int32 level 2392 )); 2393 STATICforIDL CDFstatus DecompressGZIP PROTOARGs(( 2394 vFILE *srcFp, Int32 srcOffset, CDFstatus srcError, vFILE *destFp, 2395 Int32 destOffset, CDFstatus destError 2396 )); 2397 STATICforIDL CDFstatus WriteVarValues PROTOARGs(( 2398 struct CDFstruct *CDF, struct VarStruct *Var, Int32 recNum, Int32 offset, 2399 Int32 nValues, void *buffer 2400 )); 2401 STATICforIDL CDFstatus SearchForRecord PROTOARGs(( 2402 struct CDFstruct *CDF, Int32 VDRoffset, Logical zVar, Int32 recNum, 2403 Int32 *firstRec, Int32 *lastRec, Int32 *offset, Logical *found 2404 )); 2405 STATICforIDL CDFstatus IndexingStatistics PROTOARGs(( 2406 struct CDFstruct *CDF, Int32 VDRoffset, Logical zVar, Int32 *nVXRsP, 2407 Int32 *nEntriesP, Int32 *nAllocP, Int32 *nRecordsP, Int32 *nLevelsP 2408 )); 2409 STATICforIDL CDFstatus BuildPadBuffer PROTOARGs(( 2410 struct CDFstruct *CDF, struct VarStruct *Var, Int32 nRecords, int *how, 2411 void **buffer, Logical encode 2412 )); 2413 STATICforIDL CDFstatus WritePadValues PROTOARGs(( 2414 struct VarStruct *Var, vFILE *fp, Int32 offset, Int32 nRecords, int how, 2415 void *buffer 2416 )); 2417 STATICforIDL CDFstatus ReadVarElems PROTOARGs(( 2418 struct VarStruct *Var, vFILE *fp, Int32 offset, Int32 numElems, void *buffer 2419 )); 2420 STATICforIDL CDFstatus ReadVarValues PROTOARGs(( 2421 struct CDFstruct *CDF, struct VarStruct *Var, Int32 recNum, Int32 offset, 2422 Int32 nValues, void *buffer 2423 )); 2424 STATICforIDL CDFstatus PrevRecord PROTOARGs(( 2425 struct CDFstruct *CDF, Int32 VDRoffset, Logical zVar, Int32 baseRec, 2426 Int32 *prevRec, Logical *found 2427 )); 2428 STATICforIDL CDFstatus NextRecord PROTOARGs(( 2429 struct CDFstruct *CDF, Int32 VDRoffset, Logical zVar, Int32 baseRec, 2430 Int32 *nextRec, Logical *found 2431 )); 2432 STATICforIDL CDFstatus VariableType PROTOARGs(( 2433 struct CDFstruct *CDF, Int32 vdrOffset, Logical zVar, int *vType 2434 )); 2435 STATICforIDL CDFstatus InitVarStage PROTOARGs(( 2436 struct CDFstruct *CDF, struct VarStruct *Var, Int32 nBytes 2437 )); 2438 STATICforIDL CDFstatus CopyBytes PROTOARGs(( 2439 vFILE *iFp, Int32 iStart, CDFstatus iError, Int32 nBytes, vFILE *oFp, 2440 Int32 oStart, CDFstatus oError 2441 )); 2442 STATICforIDL CDFstatus ModIndexOffset PROTOARGs(( 2443 struct CDFstruct *CDF, struct VarStruct *Var, Int32 firstRec, Int32 lastRec, 2444 Int32 newOffset 2445 )); 2446 STATICforIDL CDFstatus InitScratch PROTOARGs(( 2447 char *scratchDir, vFILE **scratchFpH, int cacheSize 2448 )); 2449 STATICforIDL CDFstatus CalcBF PROTOARGs(( 2450 struct CDFstruct *CDF, struct VarStruct *Var 2451 )); 2452 STATICforIDL CDFstatus CalcCompressionPct PROTOARGs(( 2453 struct CDFstruct *CDF, Int32 vdrOffset, Logical zVar, long *cPct 2454 )); 2455 STATICforIDL CDFstatus CalcPhyRecBytes PROTOARGs(( 2456 struct CDFstruct *CDF, Int32 vdrOffset, Logical zVar, Int32 *nPhyRecBytes 2457 )); 2458 STATICforIDL void CalcNumDimValues PROTOARGs(( 2459 struct CDFstruct *CDF, struct VarStruct *Var 2460 )); 2461 STATICforIDL void CalcRecValues PROTOARGs((struct VarStruct *Var)); 2462 STATICforIDL CDFstatus UpdateConversions PROTOARGs((struct CDFstruct *CDF)); 2463 STATICforIDL CDFstatus UpdateNEWzMode PROTOARGs((struct CDFstruct *CDF)); 2464 STATICforIDL void InitNewVXR PROTOARGs(( 2465 struct VXRstruct *VXR, Int32 firstRec, Int32 lastRec, Int32 offset 2466 )); 2467 STATICforIDL CDFstatus UpdateVXRtailInVDR PROTOARGs(( 2468 struct CDFstruct *CDF, struct VarStruct *Var 2469 )); 2470 STATICforIDL CDFstatus Compress PROTOARGs(( 2471 vFILE *iFp, Int32 iOffset, Int32 iSize, CDFstatus iError, Int32 cType, 2472 Int32 cParms[], vFILE *oFp, Int32 oOffset, Int32 *oSize, CDFstatus oError 2473 )); 2474 STATICforIDL CDFstatus Decompress PROTOARGs(( 2475 vFILE *iFp, Int32 iOffset, Int32 iSize, CDFstatus iError, Int32 cType, 2476 Int32 cParms[], vFILE *oFp, Int32 oOffset, CDFstatus oError 2477 )); 2478 STATICforIDL CDFstatus DecompressToStage PROTOARGs(( 2479 struct CDFstruct *CDF, struct VarStruct *Var, Int32 offset, Int32 uSize 2480 )); 2481 STATICforIDL CDFstatus FlushStage PROTOARGs(( 2482 struct CDFstruct *CDF, struct VarStruct *Var 2483 )); 2484 STATICforIDL char *ScratchDirectory PROTOARGs((struct CDFstruct *CDF)); 2485 STATICforIDL void AddTOvStats PROTOARGs((vSTATS *vStatsSum, vSTATS *vStats)); 2486 2487 VISIBLE_PREFIX Logical StrStrIgCaseX PROTOARGs((char *string1, char *string2)); 2488 #if defined(__cplusplus) 2489 extern "C" { 2490 #endif 2491 VISIBLE_PREFIX Logical ValidCDFname PROTOARGs((char *name)); 2492 #if !defined(__CFM68K__) || defined(__USING_STATIC_LIBS__) || !defined(CFM68KDLL) 2493 VISIBLE_PREFIX CDFstatus UpdateDotCDF PROTOARGs((struct CDFstruct *CDF)); 2494 #endif 2495 VISIBLE_PREFIX vFILE *V_open PROTOARGs((char *file_spec, char *a_mode)); 2496 VISIBLE_PREFIX vFILE *V_scratch PROTOARGs((char *directory, char *extension)); 2497 VISIBLE_PREFIX int V_setcache PROTOARGs((vFILE *vfp, int nCacheBuffers)); 2498 VISIBLE_PREFIX int V_seek PROTOARGs((vFILE *vfp, long offset, int direction)); 2499 VISIBLE_PREFIX long V_tell PROTOARGs((vFILE *vfp)); 2500 VISIBLE_PREFIX int V_eof PROTOARGs((vFILE *vfp)); 2501 VISIBLE_PREFIX int V_error PROTOARGs((vFILE *vfp)); 2502 VISIBLE_PREFIX size_t V_read PROTOARGs(( 2503 void *buffer, size_t item_size, size_t n_items, vFILE *vfp 2504 )); 2505 VISIBLE_PREFIX size_t V_write PROTOARGs(( 2506 void *buffer, size_t item_size, size_t n_items, vFILE *vfp 2507 )); 2508 VISIBLE_PREFIX int V_getc PROTOARGs((vFILE *fp)); 2509 VISIBLE_PREFIX int V_putc PROTOARGs((int value, vFILE *fp)); 2510 VISIBLE_PREFIX Logical FlushCache PROTOARGs((vFILE *vFp, vCACHE *firstCache)); 2511 #if !defined(__CFM68K__) || defined(__USING_STATIC_LIBS__) || !defined(CFM68KDLL) 2512 VISIBLE_PREFIX int V_flush PROTOARGs((vFILE *vfp)); 2513 #endif 2514 VISIBLE_PREFIX int V_clear PROTOARGs((vFILE *vfp)); 2515 VISIBLE_PREFIX int V_close PROTOARGs(( 2516 vFILE *vfp, struct CDFstruct *CDF, vSTATS *vStats 2517 )); 2518 VISIBLE_PREFIX int V_delete PROTOARGs((vFILE *vFp, vSTATS *vStats)); 2519 VISIBLE_PREFIX CDFstatus ReadVXR VARPROTOARGs((vFILE *fp, Int32 offset, ...)); 2520 VISIBLE_PREFIX CDFstatus ReadIrType PROTOARGs(( 2521 vFILE *fp, Int32 offset, Int32 *irType 2522 )); 2523 VISIBLE_PREFIX Logical Read32 PROTOARGs((vFILE *fp, Int32 *value)); 2524 VISIBLE_PREFIX CDFstatus ConvertBuffer PROTOARGs(( 2525 Int32 srcEncoding, Int32 dstEncoding, Logical negToPosFp0, Int32 dataType, 2526 Int32 numElems, void *srcbuffer, void *dstBuffer 2527 )); 2528 VISIBLE_PREFIX Logical PriorTo PROTOARGs(( 2529 char *spec, Int32 version, Int32 release, Int32 increment 2530 )); 2531 VISIBLE_PREFIX CDFstatus ValidateCDF PROTOARGs(( 2532 struct CDFstruct *CDF, vFILE *vFp, Int32 offset, Int32 fileSize, Logical debug 2533 )); 2534 2535 #if defined(MSVC67) 2536 VISIBLE_PREFIX long _ftol PROTOARGs((double dblSource)); 2537 VISIBLE_PREFIX long _ftol2 PROTOARGs((double dblSource)); 2538 #endif 2539 #if defined(__cplusplus) 2540 } 2541 #endif 2542 2543 #if defined(DEBUG) 2544 STATICforIDL void DisplayVs PROTOARGs(( 2545 char *toWhere, char *label, vSTATS *vStats 2546 )); 2547 #endif 2548 2549 #if defined(MICROSOFTC_700) && INCLUDEvMEMORY 2550 STATICforIDL MemHandle AllocateVMemory PROTOARGs((size_t nBytes)); 2551 STATICforIDL void *LoadVMemory PROTOARGs(( 2552 MemHandle handle, Logical writeFlag 2553 )); 2554 STATICforIDL int FreeVMemory PROTOARGs((MemHandle handle)); 2555 #endif 2556 2557 /*****************************************************************************/ 2558 2559 #endif 2560