diff -urN cdf31-dist.orig/CHANGES.txt cdf31-dist/CHANGES.txt --- cdf31-dist.orig/CHANGES.txt Wed Feb 1 22:29:34 2006 +++ cdf31-dist/CHANGES.txt Wed Oct 18 16:49:12 2006 @@ -73,3 +73,10 @@ expected to be there. 30-Jan-06 Add FreeBSD port for PCs. 1-Feb-06 Added Intel C++ and Fortran compilers for Linux port on PCs. + 22-Jun-06 Added support for HPUX and AIX for both 32 and 64-bit mode. + Allow Mac OS X to build code for PPC and x386. +V3.1.1 12-Oct-06 Modified to allow upper/lower case CDF name for Windows. + Changed Epoch to make 9999-12-31 23:59:999 as encoded date + for the filled value of -1.0E31. For Epoch16, a pair of + -1.0E31 filled values is encoded as + 9999-12-31 23:59:999:999:999:999. diff -urN cdf31-dist.orig/Help.all cdf31-dist/Help.all --- cdf31-dist.orig/Help.all Fri Feb 24 17:52:01 2006 +++ cdf31-dist/Help.all Wed Oct 18 15:41:33 2006 @@ -72,23 +72,29 @@ as part of the `make' command where is the location of this C compiler. - ENV=gnu For a Sun machine + ENV=gnu For a Sun machine or PC (32/64-bit) building 32-bit mode Compile using Gnu C (gcc). This is for building 32-bit mode programs but using the 64-bit (off_t) offset, instead of 32-bit (size_t). - ENV=gnu64 For a Sun machine + ENV=gnu64 For a Sun machine or PC (64-bit) building 64-mode This is similar to above ENV by using the Gnu C (gcc). But, it is for building 64-bit mode programs. Make sure that the gcc compiler supports the 64-bit. - ENV=x86 For a 32-bit x86 PC. - This is similar to the above ENV=sparc setup. - - ENV=x64 For a 64-bit PCs (AMD Opteron-based or Intel - EM64T-based systems) - This is similar to above ENV=sparc64 setup. + ENV=x86 For a 32-bit x386 or AMD 64-bit PC. + Compile using the System V flavored SPARC + C compiler (/opt/SUNWspro/bin/cc), include + files, and system libraries. This + is for building 32-bit mode programs. + + ENV=x64 For a 64-bit PC (AMD Opteron-based or Intel + EM64T-based or Itanium systems). + Compile using the System V flavored SPARC + C compiler (/opt/SUNWspro/bin/cc), include + files, and system libraries. This + is for building 64-bit mode programs. OS=osf For OSF on a DEC Alpha. The possible environments are... @@ -112,12 +118,16 @@ (cc) in the 64-bit mode. ENV=gnu Compile using Gnu C (gcc). - OS=mach For Mach on a Mac OS X Server. The possible + OS=macosx For Mac OS X on a Power PC or i386 PC. The possible environments are... - - ENV=macosx Compile using the Apple-modified Gnu C + + ENV=ppc Compile using the Apple-modified Gnu C + compiler (cc) with 64-bit (off_t) offset, + instead of 32-bit (long). This is for PPC. + + ENV=i386 Compile using the Apple-modified Gnu C compiler (cc) with 64-bit (off_t) offset, - instead of 32-bit (long). + instead of 32-bit (long). This is for i386 PC. OS=linux For Linux on an IBM PC (Intel 32/64 or AMD64), a Mac Power PC or a Dual Alpha. The possible environments are... @@ -146,6 +156,31 @@ as part of the `make' command when FORTRAN=yes is also specified. + + OS=hpux For HP-UX on an HP-9000 or IA-64. The possible environments + are... + + ENV=opt Compile using the C compiler "sold as an + optional separate product" (see the `man' + page for `cc'). This is for 32-bit mode. + ENV=opt64 Compile using the C compiler "sold as an + optional separate product" (see the `man' + page for `cc'). This is for 64-bit mode. + ENV=gnu Compile using Gnu C (gcc). This is for 32-bit mode. + ENV=gnu64 Compile using Gnu C (gcc). This is for 64-bit mode. + + The Curses-based toolkit programs rely on `ncurses' being + available. It's currently set to off. + + OS=aix For AIX on an IBM RS-6000/pSeries/Power5. The possible + environments are... + + ENV=ibm Compile using the IBM-supplied VisualAge C compiler + (cc). This is for 32-mode. + ENV=ibm64 Compile using the IBM-supplied VisualAge C compiler + (cc). This is for 64-mode. + ENV=gnu Compile using Gnu C (gcc). This is for 32-mode. + ENV=gnu64 Compile using Gnu C (gcc). This is for 64-mode. OS=cygwin For Cygwin on a PC. The possible environments are... diff -urN cdf31-dist.orig/Help.all.new cdf31-dist/Help.all.new --- cdf31-dist.orig/Help.all.new Fri Dec 2 22:06:43 2005 +++ cdf31-dist/Help.all.new Thu Jan 1 01:00:00 1970 @@ -1,258 +0,0 @@ -Introduction ------------- - -`make all' is used to compile/link the CDF distribution. Several `make' -variables are used to configure the distribution for your particular operating -system and environment. They are specified on the command line as part of the -`make' command. The "Examples" section below illustrates how to specify `make' -variables. If your operating system and/or environment is not supported, -please contact CDFsupport (cdfsupport@listserv.gsfc.nasa.gov). -We will either add the support or tell you how to patch the `make' file in the -top-level directory of the CDF distribution. If your operating system and -environment is supported but you still have problems, refer to the section -"Possible Problems" below. If that doesn't help simply contact CDFsupport with -a description of the problem (eg. operating system, environment, log of error -messages, etc.). - -Make Variables --------------- - - The supported `make' variables consist of the following... - - OS REQUIRED. The operating system being used. - ENV REQUIRED. The environment begin used (eg. C compiler). - SHARED Optional. Should the shareable CDF library be built? - CURSES Optional. Should Curses-based toolkit programs be built? - FORTRAN Optional. Should the Fortran interface be tested? - - A detailed description of each variable follows... - - OS= - ENV= - These variables are REQUIRED and specify the operating system you are - using and the environment in which to build the CDF distribution. These - variables are always specified as a pair. In the following list each - supported operating system is shown along with the possible environments - for that operation system... - - OS=solaris For SOLARIS on a Sun (SOLARIS 2.x == SunOS 5.x) or a PC. The - possible environments are... (Note: 64-bit mode programs - always use 64-bit (off_t) offset while it is optional for - 32-bit mode programs.) - - ENV=sparc For a Sun machine - Compile using the System V flavored SPARC - C compiler (/usr/lang/bin/cc), include - files, and system libraries. This C - compiler may also be referred to as the - ANSI C (SunOS/SVR4) compiler. This is - for building 32-bit mode programs but using - 64-bit (off_t) offset, instead of 32-bit (size_t). - - On some SOLARIS systems this C compiler - may be named differently (for example, - `/opt/SUNWspro/bin/cc'). If so, also specify... - - CC_solaris_sparc= - - as part of the `make' command where - is the location of this C compiler (or just - `cc' if this C compiler is in your path). - - ENV=sparc64 For a Sun machine - This is similar to the above ENV by using System - V flavored SPARC C compiler (/opt/SUNWspro/bin/cc), - include files, and system libraries. But, this - is for building 64-bit mode programs. - - As the aforementioned ENV=sparc, specify - - CC_solaris_sparc64= - - as part of the `make' command where - is the location of this C compiler. - - ENV=gnu For a Sun machine - Compile using Gnu C (gcc). - This is for building 32-bit mode programs - but using the 64-bit (off_t) offset, instead - of 32-bit (size_t). - - ENV=gnu64 For a Sun machine - This is similar to above ENV by using the Gnu C (gcc). - But, it is for building 64-bit mode programs. Make - sure that the gcc compiler supports the 64-bit. - - ENV=x86 For a 32-bit x86 PC. - This is similar to the above ENV=sparc setup. - - ENV=x64 For a 64-bit PCs (AMD Opteron-based or Intel - EM64T-based systems) - This is similar to above ENV=sparc64 setup. - - OS=osf For OSF on a DEC Alpha. The possible environments - are... - - ENV=dec Compile using the DEC OSF C compiler (cc). - This is for building Tru64 programs and - using the 64-bit (off_t) offset, instead - of 32-bit (size_t). - - ENV=gnu Compile using Gnu C (gcc). - This is for building Tru64 programs and - using the 64-bit (off_t) offset, instead - of 32-bit (size_t). - - OS=irix6 For IRIX 6.x on an SGi. The possible environments - are... - - ENV=sgin32 Compile using the SGi-supplied C compiler - (cc) in the new high performance 32-bit ABI mode. - ENV=sgi64 Compile using the SGi-supplied C compiler - (cc) in the 64-bit mode. - ENV=gnu Compile using Gnu C (gcc). - - OS=mach For Mach on a Mac OS X Server. The possible - environments are... - - ENV=macosx Compile using the Apple-modified Gnu C - compiler (cc) with 64-bit (off_t) offset, - instead of 32-bit (long). - - OS=linux For Linux on an IBM PC (Intel 32/64 or AMD64), a Mac Power PC - or a Dual Alpha. The possible environments are... - - ENV=gnu Compile using Gnu C (gcc). - This is for building the programs using the - 64-bit (off_t) offset, instead of 32-bit (long). - It will build 64-bit code on 64-bit machines, or - 32-bit ocde on 32-bit machines. - - ENV=gnu32 Compile using Gnu C (gcc). - This is for building the programs using the - 64-bit (off_t) offset, instead of 32-bit (long). - It is used to build 32-bit code on 64-bit machines. - - OS=cygwin For Cygwin on a PC. The possible environments are... - - ENV=gnu Compile using Gnu C (gcc). This is the C - compiler for Cygwin systems. The Curses-based - toolkit programs rely on `ncurses' being available. - - OS=mingw For MinGW on a PC. The possible environments are... - - ENV=gnu Compile using Gnu C (gcc). This is the C - compiler for MinGW systems. - - SHARED=yes|no - This variable defaults to `yes' on those operating systems that - support shareable libraries (in a reasonable way). The operating - systems that do not support shareable libraries are Ultrix (DECstation), - IRIX 3.x and 4.x (SGi), Mach (NeXT or MacOS X server) and HP-UX (HP) - if the "standard" C compiler is used. Specifying `no' prevents the - creation and testing of the shareable CDF library. - - CURSES=yes|no - This variable defaults to `yes' on those operating system/environment - combinations which support System V flavored Curses. Specifying `no' - prevents the compilation/linking of the toolkit programs which - depend on the Curses full-screen management package. - - FORTRAN=yes|no - This variable defaults to `no' if not specified. Specifying `yes' - causes the compilation/linking of test programs for the Fortran - interfaces. You must of course have a Fortran compiler installed - on your system if you specify `yes'. Note that the Fortran interfaces - will always be present in the CDF library. - -Examples --------- - - For example, to build the CDF distribution on a Sun running SunOS 4.1 using - the System V C compiler environment use the command... - - make OS=sunos ENV=sysV all - - Note that `all' is at the end of each command line after any `make' - variables. - -Possible Problems ------------------ - - Non-System V Curses. - If you get compiler errors when trying to build the Curses-based toolkit - programs (CDFedit, CDFlist, and CDFwalk), it will most likely be because - you are using Berkeley rather than System V Curses. If System V Curses - is not available, then specify `CURSES=no' (causing CDFedit, CDFlist, and - CDFwalk to not be built). - - Undefined symbols when using Gnu C. - When linking the Fortran test programs to a CDF library built with Gnu C - you may get undefined symbols. - - C compiler not found. - This can occur if the C compiler being used is not installed in the - expected location. This is usually only a problem on those systems - which support multiple C compilers (eg. SunOS/SOLARIS). If you know - the location of the C compiler also enter... - - CC__= - - as part of the `make' command where is the operating system, - is the environment, and is the location of the C compiler. - Note that could simply be specified as `cc' if the C - compiler being used is in your path. - - Shareable libraries. - For those operating systems supporting shareable libraries, a - shareable CDF library may be built. On most of these systems a - C compiler option is required specifying position-independent-code - (PIC) which is necessary in a shareable library. Unfortunately, PIC - is not always supported as expected by a C compiler. If compile-time - or run-time errors occur, you may have to try using a different PIC - option or no PIC option at all (because in some cases, believe it or - not, PIC is the default and specifying the PIC option causes problems). - The following list of operating systems and environments show the PIC - options which will be used and the possible alternative PIC options - you may have to try. - - O.S. Environment(s) Default PIC Alternative PICs - ------------------------------------------------------------ - sunos bsd,bsd5,sysV -pic - sunos gnu,gnu5 -fpic (no PIC) - solaris bsd,bsd5 -pic (no PIC) - solaris sparc,sysV -K pic (no PIC),-pic - solaris gnu,gnu5 -fpic (no PIC) - hpux opt +z (no PIC) - hpux posix +z (no PIC) - hpux gnu -fpic (no PIC) - aix ibm (no PIC) - aix gnu -fpic (no PIC) - osf dec (no PIC) - osf gnu -fpic (no PIC) - irix5 sgi -KPIC - irix5 gnu -fpic - irix6 sgi32,sgi64 -KPIC - irix6 gnu -fpic - linux gnu -fPIC (no PIC) - - To specify a PIC option other than the default, add a `make' variable - definition to the `make all' command of the form... - - "PIC__=" - - where is the operating system, is the environment, and - is the alternative PIC option (which can be absent if no - PIC option is desired). Note that the double-quote marks are generally - required if the `make' variable definition contains spacing. For - example, to change the PIC option to `-pic' for Solaris using the - SPARC C environment use... - - "PIC_solaris_sparc=-pic" - - For no PIC option use... - - "PIC_solaris_sparc=" - - If your operating system/environment is not listed in the above table, - then the shareable CDF library is not supported. diff -urN cdf31-dist.orig/Makefile cdf31-dist/Makefile --- cdf31-dist.orig/Makefile Wed Feb 1 22:23:42 2006 +++ cdf31-dist/Makefile Mon Nov 13 22:59:25 2006 @@ -12,6 +12,7 @@ # V1.2 11-Jul-05, M Liu Added MinGW port for PC. # V1.3 30-Jan-06, M Liu Added FreeBSD for PC. # V1.4 1-Feb-06, M Liu Added Intel C port for linux. +# V1.5 19-Jun-06, M Liu Added AIX and HP-UX ports. #------------------------------------------------------------------------------ # # Notes: @@ -68,7 +69,6 @@ FOPTIONS_solaris=-w FOPTIONSld_solaris= SHAREDEXT_solaris=so -LDOPTIONSlibcdf_solaris=-G AROPTIONS_solaris=rc RANLIB_solaris=no FC_solaris=g77 @@ -77,6 +77,7 @@ CURSES_solaris_sparc=yes CC_solaris_sparc=/opt/SUNWspro/bin/cc LD_solaris_sparc=ld +LDOPTIONS_solaris_sparc=-G PIC_solaris_sparc=-Kpic COPTIONS_solaris_sparc=-DSOLARIS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE COPTIONSld_solaris_sparc= @@ -89,6 +90,7 @@ CURSES_solaris_sparc64=yes CC_solaris_sparc64=/opt/SUNWspro/bin/cc LD_solaris_sparc64=ld +LDOPTIONS_solaris_sparc64=-G PIC_solaris_sparc64=-Kpic COPTIONS_solaris_sparc64=-xarch=v9a -DSOLARIS -DSOLARIS64 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE COPTIONSld_solaris_sparc64=-xarch=v9a @@ -100,7 +102,8 @@ CURSES_solaris_gnu=yes CC_solaris_gnu=gcc -LD_solaris_gnu=ld +LD_solaris_gnu=gcc +LDOPTIONS_solaris_gnu=-shared PIC_solaris_gnu=-fpic COPTIONS_solaris_gnu=-DSOLARIS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE COPTIONSld_solaris_gnu= @@ -112,7 +115,8 @@ CURSES_solaris_gnu64=yes CC_solaris_gnu64=gcc -LD_solaris_gnu64=ld +LD_solaris_gnu64=gcc +LDOPTIONS_solaris_gnu64=-shared -m64 PIC_solaris_gnu64=-fpic COPTIONS_solaris_gnu64=-DSOLARIS -DSOLARIS64 -m64 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE COPTIONSld_solaris_gnu64=-m64 @@ -123,9 +127,10 @@ SYSLIBSshr_solaris_gnu64= CURSES_solaris_x86=yes -CC_solaris_x86=gcc +CC_solaris_x86=cc LD_solaris_x86=ld -PIC_solaris_x86=-fpic +LDOPTIONS_solaris_x86=-G +PIC_solaris_x86=-Kpic COPTIONS_solaris_x86=-DSOLARIS -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE COPTIONSld_solaris_x86= FOPTIONS_solaris_x86= @@ -135,42 +140,69 @@ SYSLIBSshr_solaris_x86= CURSES_solaris_x64=yes -CC_solaris_x64=gcc -LD_solaris_x64=ld -PIC_solaris_x64=-fpic -COPTIONS_solaris_x64=-DSOLARIS -DSOLARIS64 -m64 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -COPTIONSld_solaris_x64=-m64 -FOPTIONS_solaris_x64=-m64 -FOPTIONSld_solaris_x64=-m64 +CC_solaris_x64=cc +LD_solaris_x64=ld -64 +LDOPTIONS_solaris_x64=-G +PIC_solaris_x64=-Kpic +COPTIONS_solaris_x64=-DSOLARIS -DSOLARIS64 -xarch=amd64 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE +COPTIONSld_solaris_x64=-xarch=amd64 +FOPTIONS_solaris_x64=-xarch=amd64 +FOPTIONSld_solaris_x64=-xarch=amd64 CURSESLIB_solaris_x64=-lcurses SYSLIBSexe_solaris_x64=-lm SYSLIBSshr_solaris_x64= #------------------------------------------------------------------------------ -# Macros for Mach. +# Macros for MacosX. #------------------------------------------------------------------------------ -SHARED_mach=yes -FOPTIONS_mach= -FOPTIONSld_mach= -SHAREDEXT_mach=dylib -LDOPTIONSlibcdf_mach=-dynamic -AROPTIONS_mach=rc -RANLIB_mach=yes -FC_mach=g95 -EXEEXT_mach= - -CURSES_mach_macosx=yes -CC_mach_macosx=cc -LD_mach_macosx=libtool -PIC_mach_macosx= -COPTIONS_mach_macosx=-D__ppc__ -D__MACH__ -D__APPLE__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -COPTIONSld_mach_macosx= -FOPTIONS_mach_macosx=-w -FOPTIONSld_mach_macosx= -CURSESLIB_mach_macosx=-lcurses -SYSLIBSexe_mach_macosx=-lm -lc -lgcc -SYSLIBSshr_mach_macosx=-lm -lc -lgcc +SHARED_macosx=yes +FOPTIONS_macosx= +FOPTIONSld_macosx= +SHAREDEXT_macosx=dylib +AROPTIONS_macosx=rc +RANLIB_macosx=yes +FC_macosx=g95 +EXEEXT_macosx= + +CURSES_macosx_ppc=yes +CC_macosx_ppc=gcc +LD_macosx_ppc=libtool -syslibroot /Developer/SDKs/MacOSX10.4u.sdk -arch_only ppc +LDOPTIONS_macosx_ppc=-dynamic +PIC_macosx_ppc= +COPTIONS_macosx_ppc=-isysroot/Developer/SDKs/MacOSX10.4u.sdk -arch ppc -D__ppc__ -D__MACH__ -D__APPLE__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE +COPTIONSld_macosx_ppc=-arch ppc -isysroot/Developer/SDKs/MacOSX10.4u.sdk +FOPTIONS_macosx_ppc=-w +FOPTIONSld_macosx_ppc= +CURSESLIB_macosx_ppc=-lcurses +SYSLIBSexe_macosx_ppc=-L/Developer/SDKs/MacOSX10.4u.sdk -L/usr/lib/gcc/powerpc-apple-darwin8/4.0.1 -lm -lc -lgcc -lSystemStubs +SYSLIBSshr_macosx_ppc=-L/Developer/SDKs/MacOSX10.4u.sdk -L/usr/lib/gcc/powerpc-apple-darwin8/4.0.1 -lm -lc -lgcc -lSystemStubs + +CURSES_macosx_ppc64=yes +CC_macosx_ppc64=gcc +LD_macosx_ppc64=libtool -syslibroot /Developer/SDKs/MacOSX10.4u.sdk -arch_only ppc64 +LDOPTIONS_macosx_ppc64=-dynamic +PIC_macosx_ppc64= +COPTIONS_macosx_ppc64=-isysroot/Developer/SDKs/MacOSX10.4u.sdk -arch ppc64 -m64 -DMACOSX64 -D__ppc__ -D__MACH__ -D__APPLE__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE +COPTIONSld_macosx_ppc64=-arch ppc64 -isysroot/Developer/SDKs/MacOSX10.4u.sdk +FOPTIONS_macosx_ppc64=-w +FOPTIONSld_macosx_ppc64= +CURSESLIB_macosx_ppc64=-lcurses +SYSLIBSexe_macosx_ppc64=-L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib -L/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/ppc64 -lm -lc -gcc +SYSLIBSshr_macosx_ppc64=-L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib -L/usr/lib/gcc/powerpc-apple-darwin8/4.0.1/ppc64 -lm -lc -gcc + +CURSES_macosx_i386=yes +CC_macosx_i386=gcc +LD_macosx_i386=libtool -syslibroot /Developer/SDKs/MacOSX10.4u.sdk -arch_only i386 +LDOPTIONS_macosx_i386=-dynamic +PIC_macosx_i386= +COPTIONS_macosx_i386=-isysroot/Developer/SDKs/MacOSX10.4u.sdk -arch i386 -Di386 -D__MACH__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE +COPTIONSld_macosx_i386=-arch i386 -isysroot/Developer/SDKs/MacOSX10.4u.sdk +FOPTIONS_macosx_i386=-w +FOPTIONSld_macosx_i386= +CURSESLIB_macosx_i386=-lcurses +SYSLIBSexe_macosx_i386=-L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib -L/usr/lib/gcc/i686-apple-darwin8/4.0.1 -lm -lc -lgcc +SYSLIBSshr_macosx_i386=-L/Developer/SDKs/MacOSX10.4u.sdk/usr/lib -L/usr/lib/gcc/i686-apple-darwin8/4.0.1 -lm -lc -lgcc #------------------------------------------------------------------------------ # Macros for OSF (Digital UNIX). @@ -180,7 +212,6 @@ FOPTIONS_osf=-warn declarations -warn nounused FOPTIONSld_osf= SHAREDEXT_osf=so -LDOPTIONSlibcdf_osf=-shared -expect_unresolved '*' AROPTIONS_osf=rc RANLIB_osf=yes FC_osf=f77 @@ -189,6 +220,7 @@ CURSES_osf_dec=yes CC_osf_dec=cc LD_osf_dec=ld +LDOPTIONS_osf_dec=-shared -expect_unresolved '*' PIC_osf_dec= COPTIONS_osf_dec=-std1 -Dunix -ieee_with_inexact -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE COPTIONSld_osf_dec= @@ -200,7 +232,8 @@ CURSES_osf_gnu=yes CC_osf_gnu=gcc -LD_osf_gnu=ld +LD_osf_gnu=gcc +LDOPTIONS_osf_gnu=-shared -expect_unresolved '*' PIC_osf_gnu=-fpic COPTIONS_osf_gnu=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE COPTIONSld_osf_gnu= @@ -215,11 +248,9 @@ #------------------------------------------------------------------------------ SHARED_irix6=yes -IDL_irix6=yes FOPTIONS_irix6=-u FOPTIONSld_irix6= SHAREDEXT_irix6=so -LDOPTIONSlibcdf_irix6=-shared AROPTIONS_irix6=rc RANLIB_irix6=no FC_irix6=f77 @@ -227,6 +258,7 @@ CURSES_irix6_sgin32=yes CC_irix6_sgin32=cc LD_irix6_sgin32=ld +LDOPTIONS_irix6_sgi32=-shared PIC_irix6_sgin32=-KPIC COPTIONS_irix6_sgin32=-n32 -woffall -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE COPTIONSld_irix6_sgin32=-n32 -L/usr/lib32 @@ -239,6 +271,7 @@ CURSES_irix6_sgi64=yes CC_irix6_sgi64=cc LD_irix6_sgi64=ld +LDOPTIONS_irix6_sgi64=-shared PIC_irix6_sgi64=-KPIC COPTIONS_irix6_sgi64=-64 -woffall -DIRIX64bit -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE COPTIONSld_irix6_sgi64=-64 -DIRIX64bit -L/usr/lib64 @@ -250,7 +283,8 @@ CURSES_irix6_gnu=yes CC_irix6_gnu=gcc -LD_irix6_gnu=ld +LD_irix6_gnu=gcc +LDOPTIONS_irix6_gnu=-shared PIC_irix6_gnu=-fpic COPTIONS_irix6_gnu=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE COPTIONSld_irix6_gnu= @@ -268,7 +302,6 @@ FOPTIONS_linux=-w FOPTIONSld_linux= SHAREDEXT_linux=so -LDOPTIONSlibcdf_linux=-shared AROPTIONS_linux=rc RANLIB_linux=yes FC_linux=f77 @@ -276,7 +309,8 @@ CURSES_linux_gnu=yes CC_linux_gnu=gcc -LD_linux_gnu=ld +LD_linux_gnu=gcc +LDOPTIONS_linux_gnu=-shared PIC_linux_gnu=-fPIC COPTIONS_linux_gnu=-I/usr/include/ncurses -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DMALLOC_CHECK_=0 COPTIONSld_linux_gnu= @@ -288,12 +322,13 @@ CURSES_linux_gnu32=yes CC_linux_gnu32=gcc -LD_linux_gnu32=gcc -m32 +LD_linux_gnu32=gcc +LDOPTIONS_linux_gnu32=-shared -m32 PIC_linux_gnu32=-fPIC COPTIONS_linux_gnu32=-m32 -I/usr/include/ncurses -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DMALLOC_CHECK_=0 COPTIONSld_linux_gnu32=-m32 FOPTIONS_linux_gnu32=-m32 -FOPTIONSld_linux_gnu32=-m2 +FOPTIONSld_linux_gnu32=-m32 CURSESLIB_linux_gnu32=-lncurses SYSLIBSexe_linux_gnu32=-lm -lc SYSLIBSshr_linux_gnu32=-lm -lc @@ -301,6 +336,7 @@ CURSES_linux_intel=yes CC_linux_intel=icc LD_linux_intel=ld +LDOPTIONS_linux_intel=-shared PIC_linux_intel=-fPIC COPTIONS_linux_intel=-I/usr/include/ncurses -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DMALLOC_CHECK_=0 COPTIONSld_linux_intel= @@ -311,15 +347,170 @@ SYSLIBSshr_linux_intel=-lm -lc #------------------------------------------------------------------------------ +# Macros for AIX. +#------------------------------------------------------------------------------ + +SHARED_aix=yes +FOPTIONS_aix=-u -qcharlen=256 +FOPTIONSld_aix=-L../lib +SHAREDEXT_aix=o +AROPTIONS_aix=rc +AROPTIONS_aix64=-r -c -X 64 +RANLIB_aix=yes +FC_aix=xlf + +CURSES_aix_ibm=yes +CC_aix_ibm=cc +LD_aix_ibm=ld +LDOPTIONS_aix_ibm=-bnoentry -bM:SRE -bE:libcdf.exp +PIC_aix_ibm= +COPTIONS_aix_ibm=-DIBMRS -DAIX -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE +COPTIONSld_aix_ibm=-L../lib +FOPTIONS_aix_ibm= +FOPTIONSld_aix_ibm=-L../lib +CURSESLIB_aix_ibm=-lcurses +SYSLIBSexe_aix_ibm=-lm -lc +SYSLIBSshr_aix_ibm=-lm -lc + +CURSES_aix_ibm64=yes +CC_aix_ibm64=cc +LD_aix_ibm64=ld +LDOPTIONS_aix_ibm64=-b64 -bnoentry -bM:SRE -bE:libcdf.exp +PIC_aix_ibm64= +COPTIONS_aix_ibm64=-q64 -DIBMRS -DAIX -DAIX64 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE +COPTIONSld_aix_ibm64=-q64 -L../lib +FOPTIONS_aix_ibm64= +FOPTIONSld_aix_ibm64=-L../lib +CURSESLIB_aix_ibm64=-lcurses +SYSLIBSexe_aix_ibm64=-lm -lc +SYSLIBSshr_aix_ibm64=-lm -lc + +CURSES_aix_gnu=yes +CC_aix_gnu=gcc +LD_aix_gnu=gcc +LDOPTIONS_aix_gnu=-shared +PIC_aix_gnu=-fpic +COPTIONS_aix_gnu=-DIBMRS -DAIX -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE +COPTIONSld_aix_gnu=-L../lib +FOPTIONS_aix_gnu= +FOPTIONSld_aix_gnu=-L../lib +CURSESLIB_aix_gnu=-lcurses +SYSLIBSexe_aix_gnu=-lm -lc +SYSLIBSshr_aix_gnu=-lm -lc + +CURSES_aix_gnu64=yes +CC_aix_gnu64=gcc +LD_aix_gnu64=gcc +LDOPTIONS_aix_gnu64=-shared -maix64 +PIC_aix_gnu64=-fpic +COPTIONS_aix_gnu64=-maix64 -DIBMRS -DAIX -DAIX64 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE +COPTIONSld_aix_gnu64=-maix64 -L../lib +FOPTIONS_aix_gnu64= +FOPTIONSld_aix_gnu64=-L../lib +CURSESLIB_aix_gnu64=-lcurses +SYSLIBSexe_aix_gnu64=-lm -lc +SYSLIBSshr_aix_gnu64=-lm -lc + +#------------------------------------------------------------------------------ +# Macros for HP-UX. +# -DD64 for 64-bit mode (--LP64__ turned on) +# none for 32-bit +#------------------------------------------------------------------------------ + +SHARED_hpux=yes +FOPTIONS_hpux=-u +FOPTIONSld_hpux= +SHAREDEXT_hpux=sl +AROPTIONS_hpux=rc +RANLIB_hpux=no +FC_hpux=f77 + +CURSES_hpux_std=yes +CC_hpux_std=cc +LD_hpux_std=ld +LDOPTIONS_hpux_std=-b +PIC_hpux_std= +COPTIONS_hpux_std=-DHP -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE +COPTIONSld_hpux_std= +FOPTIONS_hpux_std= +FOPTIONSld_hpux_std= +CURSESLIB_hpux_std=-lcurses +SYSLIBSexe_hpux_std=-lm -lc +SYSLIBSshr_hpux_std= + +CURSES_hpux_opt=no +CC_hpux_opt=cc +LD_hpux_opt=ld +LDOPTIONS_hpux_opt=-b +PIC_hpux_opt=+z +COPTIONS_hpux_opt=-w -DHP -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE +COPTIONSld_hpux_opt= +FOPTIONS_hpux_opt= +FOPTIONSld_hpux_opt= +CURSESLIB_hpux_opt=-lcurses +SYSLIBSexe_hpux_opt=-lm -lc +SYSLIBSshr_hpux_opt= + +CURSES_hpux_opt64=no +CC_hpux_opt64=cc +LD_hpux_opt64=ld +LDOPTIONS_hpux_opt64=-b +PIC_hpux_opt64=+z +COPTIONS_hpux_opt64=-w -DHP -DHP64 +DD64 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE +COPTIONSld_hpux_opt64=+DD64 +FOPTIONS_hpux_opt64= +FOPTIONSld_hpux_opt64= +CURSESLIB_hpux_opt64=-lcurses +SYSLIBSexe_hpux_opt64=-lm -lc +SYSLIBSshr_hpux_opt64= + +CURSES_hpux_posix=yes +CC_hpux_posix=c89 +LD_hpux_posix=ld +LDOPTIONS_hpux_posix=-b +PIC_hpux_posix=+z +COPTIONS_hpux_posix=-DHPUXposix -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE +COPTIONSld_hpux_posix= +FOPTIONS_hpux_posix= +FOPTIONSld_hpux_posix= +CURSESLIB_hpux_posix=-lcurses +SYSLIBSexe_hpux_posix=-lm -lc +SYSLIBSshr_hpux_posix= + +CURSES_hpux_gnu=no +CC_hpux_gnu=gcc +LD_hpux_gnu=gcc +LDOPTIONS_hpux_gnu=-shared +PIC_hpux_gnu=-fpic +COPTIONS_hpux_gnu=-DHP -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE +COPTIONSld_hpux_gnu= +FOPTIONS_hpux_gnu= +FOPTIONSld_hpux_gnu= +CURSESLIB_hpux_gnu=-lcurses +SYSLIBSexe_hpux_gnu=-lm -lc +SYSLIBSshr_hpux_gnu= + +CURSES_hpux_gnu64=no +CC_hpux_gnu64=gcc +LD_hpux_gnu64=gcc +LDOPTIONS_hpux_gnu64=-shared -mlp64 +PIC_hpux_gnu64=-fpic +COPTIONS_hpux_gnu64=-DHP -DHP64 -mlp64 -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE +COPTIONSld_hpux_gnu64=-mlp64 +FOPTIONS_hpux_gnu64= +FOPTIONSld_hpux_gnu64= +CURSESLIB_hpux_gnu64=-lcurses +SYSLIBSexe_hpux_gnu64=-lm -lc +SYSLIBSshr_hpux_gnu64= + +#------------------------------------------------------------------------------ # Macros for Cygwin. #------------------------------------------------------------------------------ SHARED_cygwin=no -IDL_cygwin=no FOPTIONS_cygwin=-w FOPTIONSld_cygwin= SHAREDEXT_cygwin=dll -LDOPTIONSlibcdf_cygwin=-shared AROPTIONS_cygwin=rc RANLIB_cygwin=yes FC_cygwin=g77 @@ -327,7 +518,8 @@ CURSES_cygwin_gnu=yes CC_cygwin_gnu=gcc -LD_cygwin_gnu=ld +LD_cygwin_gnu=gcc +LDOPTIONS_cygwin_gnu=-shared PIC_cygwin_gnu= COPTIONS_cygwin_gnu=-I/usr/include/ncurses -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE COPTIONSld_cygwin_gnu= @@ -342,11 +534,9 @@ #------------------------------------------------------------------------------ SHARED_mingw=no -IDL_mingw=no FOPTIONS_mingw=-w FOPTIONSld_mingw= SHAREDEXT_mingw=dll -LDOPTIONSlibcdf_mingw=-shared AROPTIONS_mingw=rc RANLIB_mingw=yes FC_mingw=g77 @@ -354,7 +544,8 @@ CURSES_mingw_gnu=no CC_mingw_gnu=gcc -LD_mingw_gnu=ld +LD_mingw_gnu=gcc +LDOPTIONS_mingw_gnu=-shared PIC_mingw_gnu= COPTIONS_mingw_gnu=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE COPTIONSld_mingw_gnu= @@ -365,49 +556,21 @@ SYSLIBSshr_mingw_gnu= #------------------------------------------------------------------------------ -# Macros for HP-UX. -#------------------------------------------------------------------------------ - -FOPTIONS_hpux=-u -FOPTIONSld_hpux= -SHAREDEXT_hpux=sl -LDOPTIONSlibcdf_hpux=-b -AROPTIONS_hpux=rc -RANLIB_hpux=no -FC_hpux=f77 - -SHARED_hpux_gnu=yes -IDL_hpux_gnu=yes -CURSES_hpux_gnu=yes -CC_hpux_gnu=gcc -LD_hpux_gnu=ld -PIC_hpux_gnu=-fpic -COPTIONS_hpux_gnu=-DHP -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -COPTIONSld_hpux_gnu= -FOPTIONS_hpux_gnu= -FOPTIONSld_hpux_gnu= -CURSESLIB_hpux_gnu=-lcurses -SYSLIBSexe_hpux_gnu=-lm -lc -SYSLIBSshr_hpux_gnu= - -#------------------------------------------------------------------------------ # Macros for FreeBSD. #------------------------------------------------------------------------------ SHARED_freebsd=yes -IDL_freebsd=no FOPTIONS_freebsd=-w FOPTIONSld_freebsd= SHAREDEXT_freebsd=so -LDOPTIONSlibcdf_freebsd=-shared -LDOPTIONSidl_freebsd=-shared AROPTIONS_freebsd=rc RANLIB_freebsd=yes FC_freebsd=f77 CURSES_freebsd_gnu=yes -CC_freebsd_gnu=cc -LD_freebsd_gnu=ld +CC_freebsd_gnu=gcc +LD_freebsd_gnu=gcc +LDOPTIONS_freebsd_gnu=-shared PIC_freebsd_gnu=-fPIC COPTIONS_freebsd_gnu=-D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -DMALLOC_CHECK_=0 COPTIONSld_freebsd_gnu= @@ -448,12 +611,16 @@ all.solaris.sparc64: note1.noCC all.build all.solaris.gnu: all.build all.solaris.gnu64: all.build +all.solaris.x86: all.build +all.solaris.x64: all.build all.osf.dec: all.build all.osf.gnu: all.build all.cygwin.gnu: all.build all.mingw.gnu: all.build all.freebsd.gnu: all.build -all.mach.macosx: all.build +all.macosx.ppc: all.build +all.macosx.ppc64: all.build +all.macosx.i386: all.build all.build: @cd $(LIBsrcDIR); $(MAKE) \ @@ -464,7 +631,7 @@ "COPTIONS=$(COPTIONS_$(OS)_$(ENV))" \ "SYSLIBS=$(SYSLIBSshr_$(OS)_$(ENV))" \ "SHAREDEXT=$(SHAREDEXT_$(OS))" \ -"LDOPTIONS=$(LDOPTIONSlibcdf_$(OS))" \ +"LDOPTIONS=$(LDOPTIONS_$(OS)_$(ENV))" \ "AROPTIONS=$(AROPTIONS_$(OS))" \ "RANLIB=$(RANLIB_$(OS))" \ all @@ -627,13 +794,13 @@ cp $(LIBsrcDIR)/libcdf.o $(INSTALLDIR)/lib copy.lib.a: - @echo cp $(LIBsrcDIR)/libcdf.a $(INSTALLDIR)/lib - cp $(LIBsrcDIR)/libcdf.a $(INSTALLDIR)/lib - @if [ -f $(LIBsrcDIR)/.ranlib.yes ] ; then \ - $(MAKE) "TARGET=$(INSTALLDIR)/lib/libcdf.a" ranlib.file ; \ - else \ - $(NULL) ; \ - fi + @echo cp -p $(LIBsrcDIR)/libcdf.a $(INSTALLDIR)/lib + cp -p $(LIBsrcDIR)/libcdf.a $(INSTALLDIR)/lib +# @if [ -f $(LIBsrcDIR)/.ranlib.yes ] ; then \ +# $(MAKE) "TARGET=$(INSTALLDIR)/lib/libcdf.a" ranlib.file ; \ +# else \ +# $(NULL) ; \ +# fi copy.tools: @if [ -f $(TOOLSsrcDIR)/cdfedit.exe ] ; then \ @@ -892,12 +1059,12 @@ "COPTIONS=$(COPTIONS_ultrix_risc)" \ "SYSLIBS=$(SYSLIBSshr_ultrix_risc)" \ "SHAREDEXT=$(SHAREDEXT_ultrix)" \ -"LDOPTIONS=$(LDOPTIONSlibcdf_ultrix)" \ +"LDOPTIONS=$(LDOPTIONS_ultrix_risc)" \ "AROPTIONS=$(AROPTIONS_ultrix)" \ "RANLIB=$(RANLIB_ultrix)" \ all @cd $(TOOLSsrcDIR); $(MAKE) \ -"CURSES=$(CURSES)" \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ "CCx=$(CC_ultrix_risc)" \ "COPTIONS=$(COPTIONS_ultrix_risc)" \ "COPTIONSld=$(COPTIONSld_ultrix_risc)" \ @@ -925,12 +1092,12 @@ "COPTIONS=$(COPTIONS_ultrix_gnu)" \ "SYSLIBS=$(SYSLIBSshr_ultrix_gnu)" \ "SHAREDEXT=$(SHAREDEXT_ultrix)" \ -"LDOPTIONS=$(LDOPTIONSlibcdf_ultrix)" \ +"LDOPTIONS=$(LDOPTIONS_ultrix_gnu)" \ "AROPTIONS=$(AROPTIONS_ultrix)" \ "RANLIB=$(RANLIB_ultrix)" \ all @cd $(TOOLSsrcDIR); $(MAKE) \ -"CURSES=$(CURSES)" \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ "CCx=$(CC_ultrix_gnu)" \ "COPTIONS=$(COPTIONS_ultrix_gnu)" \ "COPTIONSld=$(COPTIONSld_ultrix_gnu)" \ @@ -955,6 +1122,9 @@ #------------------------------------------------------------------------------ all.hpux.gnu: all.hpux.gnu.build +all.hpux.opt: all.hpux.opt.build +all.hpux.gnu64: all.hpux.gnu64.build +all.hpux.opt64: all.hpux.opt64.build all.hpux.std.build: @cd $(LIBsrcDIR); $(MAKE) \ @@ -965,12 +1135,12 @@ "COPTIONS=$(COPTIONS_hpux_std)" \ "SYSLIBS=$(SYSLIBSshr_hpux_std)" \ "SHAREDEXT=$(SHAREDEXT_hpux)" \ -"LDOPTIONS=$(LDOPTIONSlibcdf_hpux)" \ +"LDOPTIONS=$(LDOPTIONS_hpux_std)" \ "AROPTIONS=$(AROPTIONS_hpux)" \ "RANLIB=$(RANLIB_hpux)" \ all @cd $(TOOLSsrcDIR); $(MAKE) \ -"CURSES=$(CURSES)" \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ "CCx=$(CC_hpux_std)" \ "COPTIONS=$(COPTIONS_hpux_std)" \ "COPTIONSld=$(COPTIONSld_hpux_std)" \ @@ -998,12 +1168,12 @@ "COPTIONS=$(COPTIONS_hpux_opt)" \ "SYSLIBS=$(SYSLIBSshr_hpux_opt)" \ "SHAREDEXT=$(SHAREDEXT_hpux)" \ -"LDOPTIONS=$(LDOPTIONSlibcdf_hpux)" \ +"LDOPTIONS=$(LDOPTIONS_hpux_opt)" \ "AROPTIONS=$(AROPTIONS_hpux)" \ "RANLIB=$(RANLIB_hpux)" \ all @cd $(TOOLSsrcDIR); $(MAKE) \ -"CURSES=$(CURSES)" \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ "CCx=$(CC_hpux_opt)" \ "COPTIONS=$(COPTIONS_hpux_opt)" \ "COPTIONSld=$(COPTIONSld_hpux_opt)" \ @@ -1022,6 +1192,39 @@ "SYSLIBS=$(SYSLIBSexe_hpux_opt)" \ "SHAREDEXT=$(SHAREDEXT_hpux)" \ all +all.hpux.opt64.build: + @cd $(LIBsrcDIR); $(MAKE) \ +"SHARED=$(SHARED)" \ +"PIC=$(PIC_hpux_opt64)" \ +"CCx=$(CC_hpux_opt64)" \ +"LDx=$(LD_hpux_opt64)" \ +"COPTIONS=$(COPTIONS_hpux_opt64)" \ +"SYSLIBS=$(SYSLIBSshr_hpux_opt64)" \ +"SHAREDEXT=$(SHAREDEXT_hpux)" \ +"LDOPTIONS=$(LDOPTIONS_hpux_opt64)" \ +"AROPTIONS=$(AROPTIONS_hpux)" \ +"RANLIB=$(RANLIB_hpux)" \ +all + @cd $(TOOLSsrcDIR); $(MAKE) \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ +"CCx=$(CC_hpux_opt64)" \ +"COPTIONS=$(COPTIONS_hpux_opt64)" \ +"COPTIONSld=$(COPTIONSld_hpux_opt64)" \ +"SYSLIBS=$(SYSLIBSexe_hpux_opt64)" \ +"CURSESLIB=$(CURSESLIB_hpux_opt64)" \ +all + @cd $(TESTSsrcDIR); $(MAKE) \ +"FORTRAN=$(FORTRAN)" \ +"FCx=$(FC_hpux)" \ +"CCx=$(CC_hpux_opt64)" \ +"SHARED=$(SHARED)" \ +"FOPTIONS=$(FOPTIONS_hpux)" \ +"FOPTIONSld=$(FOPTIONSld_hpux)" \ +"COPTIONS=$(COPTIONS_hpux_opt64)" \ +"COPTIONSld=$(COPTIONSld_hpux_opt64)" \ +"SYSLIBS=$(SYSLIBSexe_hpux_opt64)" \ +"SHAREDEXT=$(SHAREDEXT_hpux)" \ +all all.hpux.posix.build: @cd $(LIBsrcDIR); $(MAKE) \ "SHARED=$(SHARED)" \ @@ -1031,12 +1234,12 @@ "COPTIONS=$(COPTIONS_hpux_posix)" \ "SYSLIBS=$(SYSLIBSshr_hpux_posix)" \ "SHAREDEXT=$(SHAREDEXT_hpux)" \ -"LDOPTIONS=$(LDOPTIONSlibcdf_hpux)" \ +"LDOPTIONS=$(LDOPTIONS_hpux_posix)" \ "AROPTIONS=$(AROPTIONS_hpux)" \ "RANLIB=$(RANLIB_hpux)" \ all @cd $(TOOLSsrcDIR); $(MAKE) \ -"CURSES=$(CURSES)" \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ "CCx=$(CC_hpux_posix)" \ "COPTIONS=$(COPTIONS_hpux_posix)" \ "COPTIONSld=$(COPTIONSld_hpux_posix)" \ @@ -1064,12 +1267,12 @@ "COPTIONS=$(COPTIONS_hpux_gnu)" \ "SYSLIBS=$(SYSLIBSshr_hpux_gnu)" \ "SHAREDEXT=$(SHAREDEXT_hpux)" \ -"LDOPTIONS=$(LDOPTIONSlibcdf_hpux)" \ +"LDOPTIONS=$(LDOPTIONS_hpux_gnu)" \ "AROPTIONS=$(AROPTIONS_hpux)" \ "RANLIB=$(RANLIB_hpux)" \ all @cd $(TOOLSsrcDIR); $(MAKE) \ -"CURSES=$(CURSES)" \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ "CCx=$(CC_hpux_gnu)" \ "COPTIONS=$(COPTIONS_hpux_gnu)" \ "COPTIONSld=$(COPTIONSld_hpux_gnu)" \ @@ -1088,6 +1291,39 @@ "SYSLIBS=$(SYSLIBSexe_hpux_gnu)" \ "SHAREDEXT=$(SHAREDEXT_hpux)" \ all +all.hpux.gnu64.build: + @cd $(LIBsrcDIR); $(MAKE) \ +"SHARED=$(SHARED)" \ +"PIC=$(PIC_hpux_gnu64)" \ +"CCx=$(CC_hpux_gnu64)" \ +"LDx=$(LD_hpux_gnu64)" \ +"COPTIONS=$(COPTIONS_hpux_gnu64)" \ +"SYSLIBS=$(SYSLIBSshr_hpux_gnu64)" \ +"SHAREDEXT=$(SHAREDEXT_hpux)" \ +"LDOPTIONS=$(LDOPTIONS_hpux_gnu64)" \ +"AROPTIONS=$(AROPTIONS_hpux)" \ +"RANLIB=$(RANLIB_hpux)" \ +all + @cd $(TOOLSsrcDIR); $(MAKE) \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ +"CCx=$(CC_hpux_gnu64)" \ +"COPTIONS=$(COPTIONS_hpux_gnu64)" \ +"COPTIONSld=$(COPTIONSld_hpux_gnu64)" \ +"SYSLIBS=$(SYSLIBSexe_hpux_gnu64)" \ +"CURSESLIB=$(CURSESLIB_hpux_gnu64)" \ +all + @cd $(TESTSsrcDIR); $(MAKE) \ +"FORTRAN=$(FORTRAN)" \ +"FCx=$(FC_hpux)" \ +"CCx=$(CC_hpux_gnu64)" \ +"SHARED=$(SHARED)" \ +"FOPTIONS=$(FOPTIONS_hpux)" \ +"FOPTIONSld=$(FOPTIONSld_hpux)" \ +"COPTIONS=$(COPTIONS_hpux_gnu64)" \ +"COPTIONSld=$(COPTIONSld_hpux_gnu64)" \ +"SYSLIBS=$(SYSLIBSexe_hpux_gnu64)" \ +"SHAREDEXT=$(SHAREDEXT_hpux)" \ +all #------------------------------------------------------------------------------ # IRIX 6.x. #------------------------------------------------------------------------------ @@ -1105,12 +1341,12 @@ "COPTIONS=$(COPTIONS_irix6_sgin32)" \ "SYSLIBS=$(SYSLIBSshr_irix6_sgin32)" \ "SHAREDEXT=$(SHAREDEXT_irix6)" \ -"LDOPTIONS=$(LDOPTIONSlibcdf_irix6) -n32" \ +"LDOPTIONS=$(LDOPTIONS_irix6_sgin32) -n32" \ "AROPTIONS=$(AROPTIONS_irix6)" \ "RANLIB=$(RANLIB_irix6)" \ all @cd $(TOOLSsrcDIR); $(MAKE) \ -"CURSES=$(CURSES)" \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ "CCx=$(CC_irix6_sgin32)" \ "COPTIONS=$(COPTIONS_irix6_sgin32)" \ "COPTIONSld=$(COPTIONSld_irix6_sgin32)" \ @@ -1139,12 +1375,12 @@ "COPTIONS=$(COPTIONS_irix6_sgi64)" \ "SYSLIBS=$(SYSLIBSshr_irix6_sgi64)" \ "SHAREDEXT=$(SHAREDEXT_irix6)" \ -"LDOPTIONS=$(LDOPTIONSlibcdf_irix6) -64" \ +"LDOPTIONS=$(LDOPTIONS_irix6_sgin64) -64" \ "AROPTIONS=$(AROPTIONS_irix6)" \ "RANLIB=$(RANLIB_irix6)" \ all @cd $(TOOLSsrcDIR); $(MAKE) \ -"CURSES=$(CURSES)" \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ "CCx=$(CC_irix6_sgi64)" \ "COPTIONS=$(COPTIONS_irix6_sgi64)" \ "COPTIONSld=$(COPTIONSld_irix6_sgi64)" \ @@ -1172,12 +1408,12 @@ "COPTIONS=$(COPTIONS_irix6_gnu)" \ "SYSLIBS=$(SYSLIBSshr_irix6_gnu)" \ "SHAREDEXT=$(SHAREDEXT_irix6)" \ -"LDOPTIONS=$(LDOPTIONSlibcdf_irix6) -n32" \ +"LDOPTIONS=$(LDOPTIONS_irix6_gnu) -n32" \ "AROPTIONS=$(AROPTIONS_irix6)" \ "RANLIB=$(RANLIB_irix6)" \ all @cd $(TOOLSsrcDIR); $(MAKE) \ -"CURSES=$(CURSES)" \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ "CCx=$(CC_irix6_gnu)" \ "COPTIONS=$(COPTIONS_irix6_gnu)" \ "COPTIONSld=$(COPTIONSld_irix6_gnu)" \ @@ -1201,8 +1437,10 @@ # AIX. #------------------------------------------------------------------------------ -all.aix.ibm: note1.1st all.aix.ibm.build -all.aix.gnu: note1.1st all.aix.gnu.build +all.aix.ibm: all.aix.ibm.build +all.aix.gnu: all.aix.gnu.build +all.aix.ibm64: all.aix.ibm64.build +all.aix.gnu64: all.aix.gnu64.build all.aix.ibm.build: @cd $(LIBsrcDIR); $(MAKE) \ @@ -1213,12 +1451,12 @@ "COPTIONS=$(COPTIONS_aix_ibm)" \ "SYSLIBS=$(SYSLIBSshr_aix_ibm)" \ "SHAREDEXT=$(SHAREDEXT_aix)" \ -"LDOPTIONS=$(LDOPTIONSlibcdf_aix)" \ +"LDOPTIONS=$(LDOPTIONS_aix_ibm)" \ "AROPTIONS=$(AROPTIONS_aix)" \ "RANLIB=$(RANLIB_aix)" \ all @cd $(TOOLSsrcDIR); $(MAKE) \ -"CURSES=$(CURSES)" \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ "CCx=$(CC_aix_ibm)" \ "COPTIONS=$(COPTIONS_aix_ibm)" \ "COPTIONSld=$(COPTIONSld_aix_ibm)" \ @@ -1246,12 +1484,12 @@ "COPTIONS=$(COPTIONS_aix_gnu)" \ "SYSLIBS=$(SYSLIBSshr_aix_gnu)" \ "SHAREDEXT=$(SHAREDEXT_aix)" \ -"LDOPTIONS=$(LDOPTIONSlibcdf_aix)" \ +"LDOPTIONS=$(LDOPTIONS_aix_gnu)" \ "AROPTIONS=$(AROPTIONS_aix)" \ "RANLIB=$(RANLIB_aix)" \ all @cd $(TOOLSsrcDIR); $(MAKE) \ -"CURSES=$(CURSES)" \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ "CCx=$(CC_aix_gnu)" \ "COPTIONS=$(COPTIONS_aix_gnu)" \ "COPTIONSld=$(COPTIONSld_aix_gnu)" \ @@ -1270,6 +1508,72 @@ "SYSLIBS=$(SYSLIBSexe_aix_gnu)" \ "SHAREDEXT=$(SHAREDEXT_aix)" \ all +all.aix.ibm64.build: + @cd $(LIBsrcDIR); $(MAKE) \ +"SHARED=$(SHARED)" \ +"PIC=$(PIC_aix_ibm64)" \ +"CCx=$(CC_aix_ibm64)" \ +"LDx=$(LD_aix_ibm64)" \ +"COPTIONS=$(COPTIONS_aix_ibm64)" \ +"SYSLIBS=$(SYSLIBSshr_aix_ibm64)" \ +"SHAREDEXT=$(SHAREDEXT_aix)" \ +"LDOPTIONS=$(LDOPTIONS_aix_ibm64)" \ +"AROPTIONS=$(AROPTIONS_aix64)" \ +"RANLIB=$(RANLIB_aix)" \ +all + @cd $(TOOLSsrcDIR); $(MAKE) \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ +"CCx=$(CC_aix_ibm64)" \ +"COPTIONS=$(COPTIONS_aix_ibm64)" \ +"COPTIONSld=$(COPTIONSld_aix_ibm64)" \ +"SYSLIBS=$(SYSLIBSexe_aix_ibm64)" \ +"CURSESLIB=$(CURSESLIB_aix_ibm64)" \ +all + @cd $(TESTSsrcDIR); $(MAKE) \ +"FORTRAN=$(FORTRAN)" \ +"FCx=$(FC_aix)" \ +"CCx=$(CC_aix_ibm64)" \ +"SHARED=$(SHARED)" \ +"FOPTIONS=$(FOPTIONS_aix)" \ +"FOPTIONSld=$(FOPTIONSld_aix)" \ +"COPTIONS=$(COPTIONS_aix_ibm64)" \ +"COPTIONSld=$(COPTIONSld_aix_ibm64)" \ +"SYSLIBS=$(SYSLIBSexe_aix_ibm64)" \ +"SHAREDEXT=$(SHAREDEXT_aix)" \ +all +all.aix.gnu64.build: + @cd $(LIBsrcDIR); $(MAKE) \ +"SHARED=$(SHARED)" \ +"PIC=$(PIC_aix_gnu64)" \ +"CCx=$(CC_aix_gnu64)" \ +"LDx=$(LD_aix_gnu64)" \ +"COPTIONS=$(COPTIONS_aix_gnu64)" \ +"SYSLIBS=$(SYSLIBSshr_aix_gnu64)" \ +"SHAREDEXT=$(SHAREDEXT_aix)" \ +"LDOPTIONS=$(LDOPTIONS_aix_gnu64)" \ +"AROPTIONS=$(AROPTIONS_aix64)" \ +"RANLIB=$(RANLIB_aix)" \ +all + @cd $(TOOLSsrcDIR); $(MAKE) \ +"CURSES=$(AND.$(CURSES).$(CURSES_$(OS)_$(ENV)))" \ +"CCx=$(CC_aix_gnu64)" \ +"COPTIONS=$(COPTIONS_aix_gnu64)" \ +"COPTIONSld=$(COPTIONSld_aix_gnu64)" \ +"SYSLIBS=$(SYSLIBSexe_aix_gnu64)" \ +"CURSESLIB=$(CURSESLIB_aix_gnu64)" \ +all + @cd $(TESTSsrcDIR); $(MAKE) \ +"FORTRAN=$(FORTRAN)" \ +"FCx=$(FC_aix)" \ +"CCx=$(CC_aix_gnu64)" \ +"SHARED=$(SHARED)" \ +"FOPTIONS=$(FOPTIONS_aix)" \ +"FOPTIONSld=$(FOPTIONSld_aix)" \ +"COPTIONS=$(COPTIONS_aix_gnu64)" \ +"COPTIONSld=$(COPTIONSld_aix_gnu64)" \ +"SYSLIBS=$(SYSLIBSexe_aix_gnu64)" \ +"SHAREDEXT=$(SHAREDEXT_aix)" \ +all #------------------------------------------------------------------------------ # Mach. @@ -1277,7 +1581,7 @@ all.mach.next: note1.1st all.mach.next.build all.mach.macosx: all.mach.macosx.build -all.mach.gnu: note1.1st note1.1st all.mach.gnu.build +all.mach.gnu: note1.1st all.mach.gnu.build all.mach.next.build: @cd $(LIBsrcDIR); $(MAKE) \ @@ -1288,7 +1592,7 @@ "COPTIONS=$(COPTIONS_mach_next)" \ "SYSLIBS=$(SYSLIBSshr_mach_next)" \ "SHAREDEXT=$(SHAREDEXT_mach)" \ -"LDOPTIONS=$(LDOPTIONSlibcdf_mach)" \ +"LDOPTIONS=$(LDOPTIONS_mach_next)" \ "AROPTIONS=$(AROPTIONS_mach)" \ "RANLIB=$(RANLIB_mach)" \ all @@ -1321,7 +1625,7 @@ "COPTIONS=$(COPTIONS_mach_macosx)" \ "SYSLIBS=$(SYSLIBSshr_mach_macosx)" \ "SHAREDEXT=$(SHAREDEXT_mach)" \ -"LDOPTIONS=$(LDOPTIONSlibcdf_mach)" \ +"LDOPTIONS=$(LDOPTIONS_mach_macosx)" \ "AROPTIONS=$(AROPTIONS_mach)" \ "RANLIB=$(RANLIB_mach)" \ all @@ -1355,7 +1659,7 @@ "COPTIONS=$(COPTIONS_mach_gnu)" \ "SYSLIBS=$(SYSLIBSshr_mach_gnu)" \ "SHAREDEXT=$(SHAREDEXT_mach)" \ -"LDOPTIONS=$(LDOPTIONSlibcdf_mach)" \ +"LDOPTIONS=$(LDOPTIONS_mach_gnu)" \ "AROPTIONS=$(AROPTIONS_mach)" \ "RANLIB=$(RANLIB_mach)" \ all @@ -1395,7 +1699,7 @@ "COPTIONS=$(COPTIONS_qnx_ccwat)" \ "SYSLIBS=$(SYSLIBSshr_qnx_ccwat)" \ "SHAREDEXT=$(SHAREDEXT_qnx)" \ -"LDOPTIONS=$(LDOPTIONSlibcdf_qnx)" \ +"LDOPTIONS=$(LDOPTIONS_qnx_ccwat)" \ "AROPTIONS=$(AROPTIONS_qnx)" \ "RANLIB=$(RANLIB_qnx)" \ all @@ -1483,7 +1787,7 @@ @echo FOPTIONS=$(FOPTIONS_$(OS)) @echo FOPTIONSld=$(FOPTIONSld_$(OS)) @echo SHAREDEXT=$(SHAREDEXT_$(OS)) - @echo LDOPTIONSlibcdf=$(LDOPTIONSlibcdf_$(OS)) + @echo LDOPTIONSlibcdf=$(LDOPTIONS_$(OS)_$(ENV)) @echo RANLIB=$(RANLIB_$(OS)) @echo FCx=$(FC_$(OS)) @echo CCx=$(CC_$(OS)_$(ENV)) diff -urN cdf31-dist.orig/README.install_java_APIs cdf31-dist/README.install_java_APIs --- cdf31-dist.orig/README.install_java_APIs Thu Jan 26 21:59:59 2006 +++ cdf31-dist/README.install_java_APIs Tue Oct 17 15:38:01 2006 @@ -120,14 +120,27 @@ (Refer Apple's "Mac OS X GM Release Notes: Java" for more information.) - cc -bundle \ - -I/System/Library/Frameworks/JavaVM.framework/Headers \ - -I${CDF_BASE}/include \ - -framework JavaVM \ - -o ../lib/libcdfNativeLibrary.jnilib \ - ${CDF_BASE}/lib/libcdf.a \ - cdfNativeLibrary.c + Power PC + -------- + gcc -isysroot/Developer/SDKs/MacOSX10.4u.sdk -arch ppc + -D__MACH__ -D__APPLE__ -D_FILE_OFFSET_BITS=64 + -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE + -bundle -I/System/Library/Frameworks/JavaVM.framework/Headers + -I../../src/include -I. + -framework JavaVM + -o ../lib/libcdfNativeLibrary.jnilib + ../../lib/libcdf.dylib cdfNativeLibrary.c + Intel Mac + --------- + gcc -isysroot/Developer/SDKs/MacOSX10.4u.sdk -arch i386 -Di386 + -D__MACH__ -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE + -D_LARGEFILE_SOURCE + -bundle -I/System/Library/Frameworks/JavaVM.framework/Headers + -I../../src/include -I. + -framework JavaVM + -o ../lib/libcdfNativeLibrary.jnilib + ../../lib/libcdf.dylib cdfNativeLibrary.c NOTE: The include path is slightly different depending upon which JDK version and operating system you use. Binary files cdf31-dist.orig/samples/example2.o and cdf31-dist/samples/example2.o differ diff -urN cdf31-dist.orig/src/definitions/definitions.B.old cdf31-dist/src/definitions/definitions.B.old --- cdf31-dist.orig/src/definitions/definitions.B.old Fri Mar 24 19:10:12 2006 +++ cdf31-dist/src/definitions/definitions.B.old Thu Jan 1 01:00:00 1970 @@ -1,42 +0,0 @@ -#------------------------------------------------------------------------------ -# -# NSSDC/CDF Definitions for using CDF. -# Bourne shell. -# -# Version 1.2, 19-Mar-96, Hughes STX. -# -# Modification History: -# -# V1.0 14-Jun-95, J Love Original version. -# V1.1 18-Jul-95, J Love Added CDFexport. -# V1.2 19-Mar-96, J Love CDF V2.6. -# -#----------------------------------------------------------------------------- -# Before using this script file, change the definition of CDF_BASE for where -# CDF was installed on your machine (ie. the directory containing the `bin', -# `lib', and `include' directories). All CDF users can then use the command -# -# $ . /bin/definitions.B -# -# to setup the necessary enviroment variables (where is the full -# directory path leading to where CDF was installed). -# -# Aliases are not available with the Bourne shell. The toolkit programs must -# be invoked by specifying the actual name of the executable. The executables -# are found in ${CDF_BIN} (after the installation step of building the CDF -# distribution). For example, to execute CDFedit the following would be used: -# -# $ ${CDF_BIN}/cdfedit -# -# Note that `{CDF_BIN}' could also also be added to a user's path allowing -# the toolkit programs to be executed simply by specifying their names. -#----------------------------------------------------------------------------- - -export CDF_BASE; CDF_BASE= - -export CDF_INC; CDF_INC=$CDF_BASE/include -export CDF_LIB; CDF_LIB=$CDF_BASE/lib -export CDF_BIN; CDF_BIN=$CDF_BASE/bin -export CDF_HELP; CDF_HELP=$CDF_BASE/lib/cdf/help - -# export IDL_STARTUP; IDL_STARTUP=$CDF_BIN/idlstart.pro diff -urN cdf31-dist.orig/src/help/cdf2skt.olh cdf31-dist/src/help/cdf2skt.olh --- cdf31-dist.orig/src/help/cdf2skt.olh Mon Aug 15 17:26:44 2005 +++ cdf31-dist/src/help/cdf2skt.olh Fri Jun 30 21:15:53 2006 @@ -135,21 +135,24 @@ [/NONRV | /NRVTABLE | /VALUES=] [/CACHE=()] [/[NO]FORMAT] [/[NO]SCREEN] [/[NO]LOG] [/[NO]PAGE] [/[NO]STATISTICS] - [/REPORT=()] [/ZMODE=] + [/REPORT=()] [/ZMODE=] [/ABOUT] + #endos #ifos unix Usage: % skeletontable [-skeleton ] [-[no]neg2posfp0] [-nonrv | -nrvtable | -values ] [-cache ""] [-[no]format] [-[no]screen] [-[no]log] [-[no]page] [-[no]statistics] - [-report ""] [-zmode ] + [-report ""] [-zmode ] [-about] + #endos #ifos dos Usage: > skeletontable [-skeleton ] [-[no]neg2posfp0] [-nonrv | -nrvtable | -values ] [-cache ""] [-[no]format] [-[no]screen] [-[no]log] [-[no]page] [-[no]statistics] - [-report ""] [-zmode ] + [-report ""] [-zmode ] [-about] + #endos Purpose: SkeletonTable produces a skeleton table from a CDF. A @@ -327,6 +330,14 @@ If the skeleton table is being displayed on the terminal screen, specifies whether or not the output is displayed one page (screen) at a time. + +#ifos vms + /ABOUT +#else + -about +#endos + Shows the library version that was used to create this tool + program. #ifos vms Example(s): $ SKELETONTABLE/NOLOG FGGE3B diff -urN cdf31-dist.orig/src/help/cdfcmp.olh cdf31-dist/src/help/cdfcmp.olh --- cdf31-dist.orig/src/help/cdfcmp.olh Mon Aug 15 17:26:44 2005 +++ cdf31-dist/src/help/cdfcmp.olh Fri Jun 30 21:11:56 2006 @@ -136,7 +136,7 @@ [/[NO]ATTR] [/[NO]VAR] [/[NO]LOG] [/[NO]PAGE] [/REPORT=()] [/ZMODES=(,)] [/[NO]LOCATION] [/CACHE=()] [/[NO]VALUE] - [/[NO]STATISTICS] [/[NO]NEG2POSFP0] + [/[NO]STATISTICS] [/[NO]NEG2POSFP0] [/ABOUT] [/TOLERANCE=(,)] #endos @@ -145,7 +145,7 @@ [-[no]attr] [-[no]var] [-[no]log] [-[no]page] [-zmodes ","] [-report ""] [-[no]location] [-cache ""] [-[no]value] - [-[no]statistics] [-[no]neg2posfp0] + [-[no]statistics] [-[no]neg2posfp0] [-about] [-tolerance ","] #endos @@ -154,7 +154,7 @@ [-[no]attr] [-[no]var] [-[no]log] [-[no]page] [-zmodes ","] [-report ""] [-[no]location] [-cache ""] [-[no]value] - [-[no]statistics] [-[no]neg2posfp0] + [-[no]statistics] [-[no]neg2posfp0] [-about] [-tolerance ","] #endos @@ -368,6 +368,14 @@ #endos Specifies whether or not caching statistics are displayed at the end of each comparison. + +#ifos vms + /ABOUT +#else + -about +#endos + Shows the library version that was used to create this tool + program. #ifos vms Example(s): $ CDFCOMPARE GISS_WETL GISS_WETLX diff -urN cdf31-dist.orig/src/help/cdfcvt.olh cdf31-dist/src/help/cdfcvt.olh --- cdf31-dist.orig/src/help/cdfcvt.olh Fri Mar 24 23:36:58 2006 +++ cdf31-dist/src/help/cdfcvt.olh Fri Jun 30 21:14:41 2006 @@ -241,7 +241,7 @@ #ifos vms Usage: $ CDFCONVERT [/SKELETON=] [/[NO]LOG] [/[NO]PERCENT] [/REPORT=()] [/[NO]PAGE] - [/CACHE=()] [/[NO]STATISTICS] + [/CACHE=()] [/[NO]STATISTICS] [/ABOUT] [/ZMODE=] [/[NO]NEG2POSFP0] @@ -253,7 +253,7 @@ #ifos unix Usage: % cdfconvert [-skeleton ] [-[no]log] [-[no]percent] [-report ""] [-[no]page] - [-cache ""] [-[no]statistics] + [-cache ""] [-[no]statistics] [-about] [-zmode ] [-[no]neg2posfp0] @@ -265,7 +265,7 @@ #ifos dos Usage: > cdfconvert [-skeleton ] [-[no]log] [-[no]percent] [-report ""] [-[no]page] - [-cache ""] [-[no]statistics] + [-cache ""] [-[no]statistics] [-about] [-zmode ] [-[no]neg2posfp0] @@ -571,6 +571,14 @@ set. If this option is on, make sure that the source file is not over 2G file size limit, either compressed or uncompressed. + +#ifos vms + /ABOUT +#else + -about +#endos + Shows the library version that was used to create this tool + program. #ifos vms Example(s): $ CDFCONVERT CDF$SMPL:TPLATE0 TEMPLATE0X/ENCODING=IBMPC diff -urN cdf31-dist.orig/src/help/cdfdump.olh cdf31-dist/src/help/cdfdump.olh --- cdf31-dist.orig/src/help/cdfdump.olh Mon Aug 15 17:26:44 2005 +++ cdf31-dist/src/help/cdfdump.olh Fri Aug 25 14:59:07 2006 @@ -76,14 +76,17 @@ #else #ifos vms Usage: $ CDFDUMP [/OUTPUT=] [/BRIEF | /FULL] [/[NO]PAGE] - [/[NO]SIZES] [/[NO]SUMMARY] [/[NO]INDEXING] + [/[NO]SIZES] [/[NO]SUMMARY] [/[NO]INDEXING] [/ABOUT] + #endos #ifos unix Usage: % cdfdump [-output ] [-brief | -full] [-[no]page] - [-[no]sizes] [-[no]summary] [-[no]indexing] + [-[no]sizes] [-[no]summary] [-[no]indexing] [-about] + #endos #ifos dos Usage: > cdfdump [-output ] [-brief | -full] [-[no]page] - [-[no]sizes] [-[no]summary] [-[no]indexing] + [-[no]sizes] [-[no]summary] [-[no]indexing] [-about] + #endos #endos diff -urN cdf31-dist.orig/src/help/cdfedit.olh cdf31-dist/src/help/cdfedit.olh --- cdf31-dist.orig/src/help/cdfedit.olh Mon Aug 15 17:26:44 2005 +++ cdf31-dist/src/help/cdfedit.olh Fri Jun 30 21:10:50 2006 @@ -137,19 +137,22 @@ Usage: $ CDFEDIT [/[NO]BROWSE] [/ZMODE=] [/[NO]NEG2POSFP0] [/[NO]FORMAT] [/[NO]PROMPT] [/REPORT=()] [/[NO]GWITHENTRIES] [/[NO]VWITHENTRIES] - [/CACHE=()] [/[NO]STATISTICS] + [/CACHE=()] [/[NO]STATISTICS] [/ABOUT] + #endos #ifos unix Usage: % cdfedit [-[no]browse] [-zmode ] [-[no]neg2posfp0] [-[no]format] [-[no]prompt] [-report ""] [-[no]gwithentries] [-[no]vwithentries] - [-cache ""] [-[no]statistics] + [-cache ""] [-[no]statistics] [-about] + #endos #ifos dos Usage: > cdfedit [-[no]browse] [-zmode ] [-[no]neg2posfp0] [-[no]format] [-[no]prompt] [-report ""] [-[no]gwithentries] [-[no]vwithentries] - [-cache ""] [-[no]statistics] + [-cache ""] [-[no]statistics] [-about] + #endos Purpose: CDFedit allows full screen browsing/editing of a CDF. @@ -280,6 +283,14 @@ Specifies whether or not rEntries/zEntries are displayed with the vAttributes or on separate menus (with one menu per vAttribute). + +#ifos vms + /ABOUT +#else + -about +#endos + Shows the library version that was used to create this tool + program. #ifos vms Example(s): $ CDFEDIT [.SAMPLES] diff -urN cdf31-dist.orig/src/help/cdfinq.olh cdf31-dist/src/help/cdfinq.olh --- cdf31-dist.orig/src/help/cdfinq.olh Mon Aug 15 17:26:44 2005 +++ cdf31-dist/src/help/cdfinq.olh Fri Jun 30 21:17:49 2006 @@ -46,13 +46,13 @@ #endos #else #ifos vms -Usage: $ CDFINQUIRE /ID [/[NO]PAGE] +Usage: $ CDFINQUIRE /ID [/[NO]PAGE] [/ABOUT] #endos #ifos unix -Usage: % cdfinquire -id [-[no]page] +Usage: % cdfinquire -id [-[no]page] [-about] #endos #ifos dos -Usage: > cdfinquire -id [-[no]page] +Usage: > cdfinquire -id [-[no]page] [-about] #endos Purpose: CDFinquire displays the version of the CDF distribution being @@ -76,6 +76,14 @@ #endos Specifies whether or not the output is displayed a page at a time. + +#ifos vms + /ABOUT +#else + -about +#endos + Shows the library version that was used to create this tool + program. #ifos vms Example(s): $ CDFINQUIRE/ID/PAGE diff -urN cdf31-dist.orig/src/help/cdfmerge.olh cdf31-dist/src/help/cdfmerge.olh --- cdf31-dist.orig/src/help/cdfmerge.olh Thu Jan 1 01:00:00 1970 +++ cdf31-dist/src/help/cdfmerge.olh Thu Sep 7 21:44:21 2006 @@ -0,0 +1,205 @@ +#------------------------------------------------------------------------------ +# +# NSSDC/CDF CDFmerge online help. +# +# Version 1.0, 25-Jul-06, Raytheon +# +# Modification history: +# +# V1.0 25-Jul-06, M Liu Original version. +# +#------------------------------------------------------------------------------ +#ifos mac win +CDFmerge merges the data contents from two or more CDFs. +The parameters/qualifiers dialog box displayed when CDFmerge is `executed' +contains the following controls. + +Edit fields for... + + CDF1: The pathname of the CDFs to be merged. At the end of + CDF2: this field a button labeled "Select" is present. When + .... selected, a standard input file dialog is displayed + from which the CDF may be selected. + + Output: The pathname of the output CDF to which the merged data + will be written. At the end of this field a button + labeled "Select" is present. When selected, a standard + output file dialog is displayed in which the output + file pathname may be specified. If an extension is not + specified in this pathname, `.cdf.' is appended + automatically. + + Prefix: The prefix, along with a file count, is added to each + attribute and variable name so any data entity in the + merged file can be easily identified where it is from. + If the prefix is not specified, only the file count is + added. + +Buttons for... + + Enter Causes CDFmerge to merge CDFs based on the + parameters/qualifiers specified. + + Help Causes this online help to be displayed. + +#ifos mac + Quit Causes CDFmerge to terminate. (CDFs are not + merged.) This button is only present the + first time the parameters/qualifiers dialog + box is displayed. + +#endos + Cancel Causes the parameters/qualifiers dialog box to + be closed. (A CDF is not analyzed.) +#ifos mac + This button is only present after the first time the + parameters/qualifiers dialog box is displayed. +#endos +#else +#ifos vms +Usage: $ CDFMERGE [ [/NOPREFIX] | [PREFIXES=...] ] + [/[NO]LOG] [/[NO]DATAONLY] [/ABOUT] + < .. > | +#endos +#ifos unix +Usage: % cdfmerge [ [-noprefix] | [-prefixes ...] ] + [-[no]log] [-[no]dataonly] [-about] + < .. > | <-file file> +#endos +#ifos dos +Usage: > cdfmerge [ [-noprefix] | [-prefixes ...] ] + [-[no]log] [-[no]dataonly] [-about] + < .. > | <-file file> +#endos + +Purpose: CDFmerge merges two or more CDFs. The CDF files to be merged + can be entered in the command line with at least three file + names, the last one being the output name. Alternatively, a + text file containing the path names for the source files and + the output file, one file name per line and the last entry in + the list as the output file, can be used to run the data merge. + +Parameter(s): + + ..... + The pathnames of the source CDFs to be merged (do not + enter an extension). At least two is required. + + + The pathname of the output CDF that has data from all + source CDFs. This is the last one in the parameter list. + Any rVariables in the source files will be converted to + zVariables. The first source file dictates how the merged + file is to be created: its majority (row/column), encoding, + format (single/multiple) and compression are to be used + for the output file. + +#ifos vms + /FILE=() +#else + -file "" +#endos + Specifies the file that contains the names of the source CDFs + and the output, merged file. This option provides an + alternative way of entering a long list of files at the + command line. Each entry in this file has one text item, + representing one CDF file name. All, but the last one, + entries in the file are the names of the source CDFs. The + last entry is designated as the output for the merged CDF + file. Variables in a source CDF when merging into the output + file are, by default, prefixed with "file" and a number, + representing its sequence number. The default prefix + can be replaced by user provided values, one value for each + file. To specify the prefix, it's presented as the second, + an optional, item in each entry for the source CDFs. A blank + is required to separate the file name and prefix. This file + should contain at least three entries, two for the input and + one for the output. + +#ifos vms +Qualifier(s): /PREFIXES=(...) +#else +Qualifier(s): -prefixes "..." +#endos + Specifies whether the user provided prefixes are used to be + added to the name of each variable in the merged file. + If this option is specified, prefixes, separated by a ",", + should match to the number of source CDFs, one prefix is + required for each corresponding source CDF file. The prefix + is limited to a length of 20 characters long. User defined + prefix followed by a underscore (_) is added at the beginning + of each variable name in the merged file. + If the option is not specified, variables from a source file + are prefixed with "file", followed by a number that + represents the file number in the source CDF file list and + a underscore when they are merged into the output file. + If this option is used, the following + "noprefix" should not specified. If the "file" parameter is + used and it has prefixes, then this option is ignored. + +#ifos vms + /NOPREFIX +#else + -noprefix +#endos + Specifies whether no prefix should be added to the name of + each variable in the merged file. If this option is + specified, variable names form each source CDF are used + for the merged file. It is assumed that there should be + no duplicate names in the source CDFs. If there is a + duplication, the merge process will abort. This option + can not be used with previous "prefixes" option. + +#ifos vms + /[NO]DATAONLY +#else + -[no]dataonly +#endos + Specifies whether or not variable data of same variable name + from the source CDFs is merged into one. This option mainly + deals with source CDFs that are a group of files that are + similar in data contents, e.g., having a portion of different + time-sequence data, and have no sparse-records. If this + option is selected, then the merged file will not have a + separate variable for each variable in the source CDFs. + Variables with same names from the source CDFs will have be + combined into one, keeping the same name without prefix in + the merged file. The merged file will have the meta-data, + i.e., global and variable attributes, from the that of the + first source CDF. The variable data of the same name are + combined in the same sequence as the source CDFs are + presented. Arrange the source files in a proper sequence if + they are sequence-sensitive. The default is nodataonly. + +#ifos vms + /[NO]LOG +#else + -[no]log +#endos + Specifies whether or not messages are displayed indicating + the progress of CDF merging. The default is nolog. + +#ifos vms + /ABOUT +#else + -about +#endos + Shows the library version that was used to create this tool + program. + +#ifos vms +Example(s): $ CDFMERGE/LOG TEST1 TEST2 OUTTEST + $ CDFMERGE/PREFIX=ID1,ID2,ID3 CDFF1 CDFF2 CDFF3 MERGEDFILE + $ CDFMERGE/LOG /FILE=FILELIST /DATAONLY +#endos +#ifos unix +Example(s): % cdfmerge -log test1 test2 outtest + % cdfmerge -prefix ID1,ID2,ID3 cdff1 cdff2 cdff3 mergedFile + % cdfmerge -log -file filelist -dataonly +#endos +#ifos dos +Example(s): > cdfmerge -log test1 test2 outtest + > cdfmerge -prefix ID1,ID2,ID3 cdff1 cdff2 cdff3 mergedFile + > cdfmerge -log -file filelist -dataonly +#endos +#endos diff -urN cdf31-dist.orig/src/help/cdfmergej.olh cdf31-dist/src/help/cdfmergej.olh --- cdf31-dist.orig/src/help/cdfmergej.olh Thu Jan 1 01:00:00 1970 +++ cdf31-dist/src/help/cdfmergej.olh Thu Sep 7 21:44:21 2006 @@ -0,0 +1,51 @@ +#------------------------------------------------------------------------------ +# +# NSSDC/CDF CDFmerge online help. +# +# Version 1.0, 25-Jul-06, Raytheon. +# +# Modification history: +# +# V1.0 25-Jul-06, M Liu Original version. +# +#------------------------------------------------------------------------------ + +CDFmerge is a utility program used to merge the data contents of two or more +CDFs. The parameters/qualifiers dialog box displayed when CDFmerge is +`executed' contains the following controls. + +Edit fields for... + + CDF1: The file names of the CDFs to be merged. At the end of + CDF2: this field a button labeled "Select" is present. When + selected, a standard input file dialog is displayed + from which the CDF may be selected. If both are entered, + it is assumed that two (2) CDFs are to be merged. If, + only one (CDF1) is entered, it is assumed that the file + contains the names of the source CDFs and the merged file. + The Output field is then ignored. + + Output: The file name of the output file to which the merged data + is to be written. At the end of this field a button labeled + "Select" is present. + + Prefix: The prefix, along with the file count, to add to the name of + each attribute and variable. + +Check boxes for... + + About: Display the library version that is used to creat the + tool. + +Buttons for... + + Enter Causes CDFmerge to merge a CDF based on the + parameters/qualifiers specified. + + Help Causes this online help to be displayed. + + Quit Causes CDFmerge to terminate. (A CDF merge is not + performed.) This button is only present the + first time the parameters/qualifiers dialog box + is displayed. + diff -urN cdf31-dist.orig/src/help/cdfstats.olh cdf31-dist/src/help/cdfstats.olh --- cdf31-dist.orig/src/help/cdfstats.olh Mon Aug 15 17:26:44 2005 +++ cdf31-dist/src/help/cdfstats.olh Fri Jun 30 21:19:10 2006 @@ -145,21 +145,24 @@ [/[NO]FORMAT] [/[NO]PAGE] [/[NO]UPDATE_VALIDS] [/[NO]UPDATE_SCALES] [/[NO]UPDATE_MONOTONIC] [/ZMODE=] [/[NO]NEG2POSFP0] [/[NO]STATISTICS] - [/CACHE=()] [/REPORT=()] + [/CACHE=()] [/REPORT=()] [/ABOUT] + #endos #ifos unix Usage: % cdfstats [-[no]range] [-[no]fill] [-output ] [-[no]format] [-[no]page] [-[no]update_valids] [-[no]update_scales] [-[no]update_monotonic] [-zmode ] [-[no]neg2posfp0] [-[no]statistics] - [-cache ""] [-report ""] + [-cache ""] [-report ""] [-about] + #endos #ifos dos Usage: > cdfstats [-[no]range] [-[no]fill] [-output ] [-[no]format] [-[no]page] [-[no]update_valids] [-[no]update_scales] [-[no]update_monotonic] [-zmode ] [-[no]neg2posfp0] [-[no]statistics] - [-cache ""] [-report ""] + [-cache ""] [-report ""] [-about] + #endos Purpose: CDFstats displays statistics about the variables in a CDF. @@ -317,6 +320,14 @@ compatibility with older CDF releases (eg. `200,100s'). Note that not all of the file types must be specified. Those not specified will receive a default cache size. + +#ifos vms + /ABOUT +#else + -about +#endos + Shows the library version that was used to create this tool + program. #ifos vms Example(s): $ CDFSTATS/NORANGE/NOFILL/REPORT=(ERRORS) GISS_SOIL diff -urN cdf31-dist.orig/src/help/cdfxp.ilh cdf31-dist/src/help/cdfxp.ilh --- cdf31-dist.orig/src/help/cdfxp.ilh Wed Nov 23 16:09:14 2005 +++ cdf31-dist/src/help/cdfxp.ilh Fri Jun 30 21:13:38 2006 @@ -1435,21 +1435,24 @@ [/CDF=] [/TEXT=] [/SETTINGS=] [/INITIAL=()] [/ZMODE=] [/CACHE=()] [/REPORT=()] - [/[NO]NEG2POSFP0] [/[NO]STATISTICS] [] + [/[NO]NEG2POSFP0] [/[NO]STATISTICS] [/ABOUT] + [] #endos #ifos unix Usage: % cdfexport [-[no]simple] [-batch ] [-[no]prompt] [-cdf ] [-text ] [-settings ] [-initial ""] [-zmode ] [-cache ""] [-report ""] - [-[no]neg2posfp0] [-[no]statistics] [] + [-[no]neg2posfp0] [-[no]statistics] [-about] + [] #endos #ifos dos Usage: > cdfexport [-[no]simple] [-batch ] [-[no]prompt] [-cdf ] [-text ] [-settings ] [-initial ""] [-zmode ] [-cache ""] [-report ""] - [-[no]neg2posfp0] [-[no]statistics] [] + [-[no]neg2posfp0] [-[no]statistics] [-about] + [] #endos Purpose: CDFexport allows the contents of a CDF to be exported to a @@ -1806,6 +1809,14 @@ #endos Whether or not caching statistics are displayed when a CDF (input or output) is closed. + +#ifos vms + /ABOUT +#else + -about +#endos + Shows the library version that was used to create this tool + program. #ifos vms Example(s): $ CDFEXPORT [.SAMPLES] diff -urN cdf31-dist.orig/src/help/skt2cdf.olh cdf31-dist/src/help/skt2cdf.olh --- cdf31-dist.orig/src/help/skt2cdf.olh Mon Aug 15 17:26:44 2005 +++ cdf31-dist/src/help/skt2cdf.olh Fri Jun 30 21:16:48 2006 @@ -118,19 +118,19 @@ Usage: $ SKELETONCDF [/CDF=] [/[NO]DELETE] [/[NO]NEG2POSFP0] [/REPORT=()] [/[NO]LOG] [/[NO]STATISTICS] [/CACHE=()] [/[NO]FILLVAL] [/ZMODE=] - + [/ABOUT] #endos #ifos unix Usage: % skeletoncdf [-cdf ] [-[no]delete] [-[no]neg2posfp0] [-report ""] [-[no]log] [-[no]statistics] [-cache ""] [-[no]fillval] [-zmode ] - + [-about] #endos #ifos dos Usage: > skeletoncdf [-cdf ] [-[no]delete] [-[no]neg2posfp0] [-report ""] [-[no]log] [-[no]statistics] [-cache ""] [-[no]fillval] [-zmode ] - + [-about] #endos Purpose: SkeletonCDF produces a CDF from a skeleton table. @@ -243,6 +243,14 @@ a comma-separated list of zero or more of the following symbols: `errors', `warnings', or `informationals'. Note that these symbols can be truncated (eg. `e', `w', and `i'). + +#ifos vms + /ABOUT +#else + -about +#endos + Shows the library version that was used to create this tool + program. #ifos vms Example(s): $ SKELETONCDF/NOLOG/DELETE SSCLIMATE diff -urN cdf31-dist.orig/src/include/cdf.h cdf31-dist/src/include/cdf.h --- cdf31-dist.orig/src/include/cdf.h Thu Feb 2 17:12:33 2006 +++ cdf31-dist/src/include/cdf.h Thu Nov 9 20:04:12 2006 @@ -587,6 +587,11 @@ #define CDFinquireAttrzEntry(id,attrNum,entryNum,dataType,numElems) \ CDFinquireAttrEntry(id,3,attrNum,entryNum,dataType,numElems) +#define CDFinquireAttr1Info(id,attrNum,attrName,attrScope,maxEntry) \ +CDFinquireAttrInfo(id,0,attrNum,attrName,attrScope,maxEntry) +#define CDFinquireAttr2Info(id,attrNum,attrName,attrScope,maxEntry) \ +CDFinquireAttrInfo(id,1,attrNum,attrName,attrScope,maxEntry) + #define CDFattrPut(id,attrNum,entryNum,dataType,numElems,value) \ CDFputAttrEntry(id,0,attrNum,entryNum,dataType,numElems,value) #define CDFputAttrgEntry(id,attrNum,entryNum,dataType,numElems,value) \ @@ -1444,7 +1449,7 @@ #define CDFsetCompression(id,cType, cParms) \ CDFlib (SELECT_, CDF_, id, \ - SET_, CDF_COMPRESSION_, cType, cParms, \ + PUT_, CDF_COMPRESSION_, cType, cParms, \ NULL_) #define CDFsetEncoding(id,encoding) \ @@ -1709,6 +1714,10 @@ CDFid id, int grzEntry, long attrNum, long entryNum, long *dataType, long *numElems )); +VISIBLE_PREFIX CDFstatus CDFinquireAttrInfo PROTOARGs(( + CDFid id, int zEntry, long attrNum, char *attrName, long *attrScope, + long *maxEntry +)); VISIBLE_PREFIX CDFstatus CDFputAttrEntry PROTOARGs(( CDFid id, int grzEntry, long attrNum, long entryNum, long dataType, long numElems, void *value @@ -1759,10 +1768,11 @@ )); VISIBLE_PREFIX int CDFgetFileBackward PROTOARGs(( )); -VISIBLE_PREFIX int CDFcheckFileBackwardisSet PROTOARGs(( -)); -VISIBLE_PREFIX int CDFgetFileBackwardEnvVar PROTOARGs(( +VISIBLE_PREFIX void CDFsetFileBackwardFlag PROTOARGs(( + int flag )); +VISIBLE_PREFIX int CDFgetFileBackwardFlag PROTOARGs(()); +VISIBLE_PREFIX int CDFgetFileBackwardEnvVar PROTOARGs(()); #if !defined(__CFM68K__) || defined(__USING_STATIC_LIBS__) || !defined(CFM68KDLL) VISIBLE_PREFIX void EPOCHbreakdown PROTOARGs(( double epoch, long *year, long *month, long *day, long *hour, long *minute, diff -urN cdf31-dist.orig/src/include/cdfdist.h cdf31-dist/src/include/cdfdist.h --- cdf31-dist.orig/src/include/cdfdist.h Tue Feb 7 21:34:11 2006 +++ cdf31-dist/src/include/cdfdist.h Fri Sep 15 21:50:26 2006 @@ -40,6 +40,8 @@ * V2.10 08-Apr-04, M Liu Added a new function for data type CDF_EPOCH16. * V2.11 11-Jul-05, M Liu Added MingW port for PC. * V2.12 30-Jan-06, M Liu Added FreeBSD port. +* V2.13 09-Jun-06, M Liu Added HP-UX and AIX for LFS. +* V2.14 09-Jul-06, M Liu Added MacOSX on i386 PC. * ******************************************************************************/ @@ -54,8 +56,8 @@ # define IBMPC # define win32 # if !defined MSVC67 -# if (_MSC_VER >= 1300) && (WINVER < 0x0500) -/* VC7 or later, building with pre-VC7 runtime libraries */ +# if (_MSC_VER == 1300) +/* VC7, building with pre-VC7 runtime libraries */ # define MSVC67 # endif # endif @@ -90,7 +92,7 @@ # define Mach #endif -#if defined(__ppc__) || defined(__APPLE__) +#if defined(__ppc__) || (defined(__APPLE__) && !defined(i386)) # define POWERPC # define unix # if defined(__MACH__) /* Mac OS X cc (gcc) */ @@ -201,11 +203,26 @@ # define _HPUX_SOURCE #endif +#if defined(HP) +# if !defined(unix) +# define unix +# endif +# if !defined(hpux) +# define hpux +# endif +#endif + #if defined(__MINGW32__) # undef win32 # define unix #endif +#if defined(__MACH__) && defined(i386) +# define unix +# define IBMPC +# define i386mac +#endif + /****************************************************************************** * Determine variable argument list type - `stdarg' or `varargs'. Currently, * only SunOS/bsd doesn't have `stdarg.h' (but SunOS/gnu and all Solaris do). @@ -372,10 +389,12 @@ typedef unsigned long uLong; #if defined(alphaosf) || defined(IRIX64bit) || defined(SOLARIS64) || \ - defined(__amd64) || defined(__x86_64__) || defined(__ia64__) + defined(__amd64) || defined(__x86_64__) || defined(__ia64__) || \ + defined(AIX64) || defined(HP64) || defined(MACOSX64) /*************************************************************************** * `long' is 64 bits on a DEC Alpha/OSF1, an SGi/IRIX 6.x using the `-64' * option (64-bit objects) and a Solaris sparcv9, AMD64 and EM64T/IA64. + * They are also 64-bits on AIX and HP-UX if 64-bit mode is on. * `int' is 32 bits in these cases. ***************************************************************************/ typedef int Int32; @@ -421,6 +440,9 @@ #define FSEEK fseek #define FTELL ftell +#if defined(STAT) +# undef STAT +#endif #define STAT stat #define FOPEN fopen #define FWRITE fwrite @@ -440,7 +462,7 @@ # define FCLOSE64 _close # define FLUSH64 _commit # else -# if defined(__MINGW32__) +# if defined(__MINGW32__) || defined(AIX) typedef off64_t OFF_T; # else typedef off_t OFF_T; @@ -459,7 +481,7 @@ # endif # if defined(macosX) || defined(__osf__) || defined(__CYGWIN__) || \ defined(vms) || defined(sgi) || defined(__MINGW32__) || \ - defined(__FreeBSD__) + defined(__FreeBSD__) || defined(i386mac) # define FOPEN64 fopen # else # define FOPEN64 fopen64 diff -urN cdf31-dist.orig/src/include/cdfdvf.inc cdf31-dist/src/include/cdfdvf.inc --- cdf31-dist.orig/src/include/cdfdvf.inc Mon Nov 28 16:43:57 2005 +++ cdf31-dist/src/include/cdfdvf.inc Tue Nov 7 19:39:14 2006 @@ -212,7 +212,7 @@ INTERFACE SUBROUTINE CDF_INQUIRE_CDF !DEC$ ATTRIBUTES C, REFERENCE, VARYING :: CDF_INQUIRE_CDF - !DEC$ ALIAS:'_cdf_inquire_cdf' :: CDF_INQUIRE_CDF + !DEC$ ATTRIBUTES ALIAS:'_cdf_inquire_cdf' :: CDF_INQUIRE_CDF END SUBROUTINE CDF_INQUIRE_CDF END INTERFACE @@ -373,15 +373,15 @@ INTERFACE INTEGER*4 FUNCTION CDF_GET_FILEBACKWARD !DEC$ ATTRIBUTES C, REFERENCE, VARYING :: CDF_GET_FILEBACKWARD - !DEC$ ALIAS CDF_GET_FILEBACKWARD,'_cdf_get_filebackward + !DEC$ ATTRIBUTES ALIAS:'_cdf_get_filebackward':: CDF_GET_FILEBACKWARD END FUNCTION CDF_GET_FILEBACKWARD END INTERFACE INTERFACE SUBROUTINE CDF_SET_FILEBACKWARD !DEC$ ATTRIBUTES C, REFERENCE, VARYING :: CDF_SET_FILEBACKWARD - !DEC$ ALIAS CDF_SET_FILEBACKWARD,'_cdf_set_filebackward' - END FUNCTION CDF_SET_FILEBACKWARD + !DEC$ ATTRIBUTES ALIAS:'_cdf_set_filebackward':: CDF_SET_FILEBACKWARD + END SUBROUTINE CDF_SET_FILEBACKWARD END INTERFACE INTERFACE diff -urN cdf31-dist.orig/src/include/cdfdvf2.inc cdf31-dist/src/include/cdfdvf2.inc --- cdf31-dist.orig/src/include/cdfdvf2.inc Wed Nov 16 17:08:45 2005 +++ cdf31-dist/src/include/cdfdvf2.inc Tue Nov 7 19:33:14 2006 @@ -455,13 +455,6 @@ END INTERFACE INTERFACE - SUBROUTINE CDF_GET_ZVARS_RECORDDATA - !DEC$ ATTRIBUTES C, REFERENCE,VARYING::CDF_GET_ZVARS_RECORDDATA - !DEC$ ALIAS CDF_GET_ZVARS_RECORDDATA,'_cdf_get_zvars_recorddata' - END SUBROUTINE CDF_GET_ZVARS_RECORDDATA - END INTERFACE - - INTERFACE SUBROUTINE CDF_GET_ZVAR_RECORDDATA !DEC$ ATTRIBUTES C, REFERENCE,VARYING::CDF_GET_ZVAR_RECORDDATA !DEC$ ALIAS CDF_GET_ZVAR_RECORDDATA,'_cdf_get_zvar_recorddata' diff -urN cdf31-dist.orig/src/include/cdfdvf3.inc cdf31-dist/src/include/cdfdvf3.inc --- cdf31-dist.orig/src/include/cdfdvf3.inc Wed Nov 16 17:11:44 2005 +++ cdf31-dist/src/include/cdfdvf3.inc Tue Nov 7 19:40:08 2006 @@ -272,11 +272,3 @@ END SUBROUTINE CDF_PUT_ZVAR_RECORDDATA END INTERFACE - INTERFACE - SUBROUTINE CDF_PUT_ZVARS_RECORDDATA - !DEC$ ATTRIBUTES C, REFERENCE, VARYING ::CDF_PUT_ZVARS_RECORDDATA - !DEC$ ALIAS CDF_PUT_ZVARS_RECORDDATA, '_cdf_put_zvars_recorddata' - END SUBROUTINE CDF_PUT_ZVARS_RECORDDATA - END INTERFACE - - diff -urN cdf31-dist.orig/src/include/cdfedit.h cdf31-dist/src/include/cdfedit.h --- cdf31-dist.orig/src/include/cdfedit.h Wed Sep 14 20:20:33 2005 +++ cdf31-dist/src/include/cdfedit.h Tue Jun 27 18:48:55 2006 @@ -343,6 +343,7 @@ void ProblemWindow PROTOARGs((char *message, Logical center)); void MessageWindow VARPROTOARGs((char **lineS, ...)); Logical ConfirmWindow PROTOARGs((int, int, char *, char *, Logical, int)); +Logical ConfirmWindow2 PROTOARGs((int, int, char *, char *, Logical, int)); void InitializeScreen PROTOARGs((void)); void CleanupScreen PROTOARGs((void)); Logical EnterIW PROTOARGs((struct ItemWindowStruct *IW, int helpId)); diff -urN cdf31-dist.orig/src/include/cdflib.h cdf31-dist/src/include/cdflib.h --- cdf31-dist.orig/src/include/cdflib.h Tue Feb 7 17:11:46 2006 +++ cdf31-dist/src/include/cdflib.h Tue Oct 3 22:13:39 2006 @@ -281,7 +281,10 @@ #define vMAX_TRYs 5 /* Maximum number of trys on a read or write operation. */ -#define MAX_EPOCH_BINARY 3.15569519999999e14 +#define MAX_EPOCH_BINARY 3.15569519999998e14 +#define MAX_EPOCH16_1_BINARY 3.15569519999E11 +#define MAX_EPOCH16_2_BINARY 9.99999999998E11 + #define CTIME_STRING_LEN 25 #define MAX_VXR_ENTRIES 10 /* Maximum from this and diff -urN cdf31-dist.orig/src/include/cdfmerge.h cdf31-dist/src/include/cdfmerge.h --- cdf31-dist.orig/src/include/cdfmerge.h Thu Jan 1 01:00:00 1970 +++ cdf31-dist/src/include/cdfmerge.h Thu Sep 7 21:45:23 2006 @@ -0,0 +1,53 @@ +/****************************************************************************** +* +* NSSDC/CDF Header file for CDFmerge. +* +* Version 1.0, 23-Jul-06, Raytheon. +* +* Modification history: +* +* V1.0 23-Jul-06, J Liu Original version. +* +******************************************************************************/ + +#if !defined(CDFMERGEh_INCLUDEd__) +#define CDFMERGEh_INCLUDEd__ + +/****************************************************************************** +* Include files. +******************************************************************************/ + +#include "cdftools.h" + +/****************************************************************************** +* Parameter/qualifier constants. +******************************************************************************/ +#define PREFIXMAXLEN 20 + +#define PREFIXESqual 0 +#define NOPREFIXqual 1 +#define ABOUTqual 2 +#define LOGqual 3 +#define NOLOGqual 4 +#define FILEqual 5 +#define DATAONLYqual 6 +#define NODATAONLYqual 7 + +/****************************************************************************** +* Global variables. +******************************************************************************/ +static char **prefixes = NULL; + +/****************************************************************************** +* Function Prototypes. +******************************************************************************/ + +Logical MergeCDFs (int, char *[]); +void ModifyName (char *, int, char **, int, char *); +void ParseStringForVariables (int, char *[], int, int, char *[], + char *, char *, Logical *); +void QuitCDF (char *, CDFstatus, char *); + +/*****************************************************************************/ + +#endif diff -urN cdf31-dist.orig/src/include/cdfrev.h cdf31-dist/src/include/cdfrev.h --- cdf31-dist.orig/src/include/cdfrev.h Fri Jan 13 15:50:05 2006 +++ cdf31-dist/src/include/cdfrev.h Tue Oct 17 16:41:00 2006 @@ -14,6 +14,7 @@ * 08-Apr-04, M Liu Change Version to V2.7.2 * V3.0 22-Jun-04, M Liu Change Version to V3.0.0 * V3.1 19-May-05, M Liu Change Version to V3.1.0 +* 16-Oct-06, M Liu Change Version to V3.1.1 * ******************************************************************************/ @@ -22,7 +23,7 @@ #define CDF_LIBRARY_VERSION (long) 3 #define CDF_LIBRARY_RELEASE (long) 1 -#define CDF_LIBRARY_INCREMENT (long) 0 +#define CDF_LIBRARY_INCREMENT (long) 1 #define CDF_LIBRARY_subINCREMENT ' ' #endif diff -urN cdf31-dist.orig/src/include/cdftools.h cdf31-dist/src/include/cdftools.h --- cdf31-dist.orig/src/include/cdftools.h Fri Feb 3 16:19:28 2006 +++ cdf31-dist/src/include/cdftools.h Thu Aug 3 20:52:07 2006 @@ -233,37 +233,37 @@ * Hyper groups. ******************************************************************************/ -#define HYPER_READ(id,zVar,hyper,buffer) \ +#define HYPER_READ(id,zVar,hyperX,buffer) \ CDFlib (SELECT_, CDF_, id, \ BOO(zVar,zVAR_RECNUMBER_, \ - rVARs_RECNUMBER_), hyper.recNumber, \ + rVARs_RECNUMBER_), hyperX.recNumber, \ BOO(zVar,zVAR_RECCOUNT_, \ - rVARs_RECCOUNT_), hyper.recCount, \ + rVARs_RECCOUNT_), hyperX.recCount, \ BOO(zVar,zVAR_RECINTERVAL_, \ - rVARs_RECINTERVAL_), hyper.recInterval, \ + rVARs_RECINTERVAL_), hyperX.recInterval, \ BOO(zVar,zVAR_DIMINDICES_, \ - rVARs_DIMINDICES_), hyper.dimIndices, \ + rVARs_DIMINDICES_), hyperX.dimIndices, \ BOO(zVar,zVAR_DIMCOUNTS_, \ - rVARs_DIMCOUNTS_), hyper.dimCounts, \ + rVARs_DIMCOUNTS_), hyperX.dimCounts, \ BOO(zVar,zVAR_DIMINTERVALS_, \ - rVARs_DIMINTERVALS_), hyper.dimIntervals, \ + rVARs_DIMINTERVALS_), hyperX.dimIntervals, \ GET_, BOO(zVar,zVAR_HYPERDATA_,rVAR_HYPERDATA_), buffer, \ NULL_) -#define HYPER_WRITE(id,zVar,hyper,buffer) \ +#define HYPER_WRITE(id,zVar,hyperX,buffer) \ CDFlib (SELECT_, CDF_, id, \ BOO(zVar,zVAR_RECNUMBER_, \ - rVARs_RECNUMBER_), hyper.recNumber, \ + rVARs_RECNUMBER_), hyperX.recNumber, \ BOO(zVar,zVAR_RECCOUNT_, \ - rVARs_RECCOUNT_), hyper.recCount, \ + rVARs_RECCOUNT_), hyperX.recCount, \ BOO(zVar,zVAR_RECINTERVAL_, \ - rVARs_RECINTERVAL_), hyper.recInterval, \ + rVARs_RECINTERVAL_), hyperX.recInterval, \ BOO(zVar,zVAR_DIMINDICES_, \ - rVARs_DIMINDICES_), hyper.dimIndices, \ + rVARs_DIMINDICES_), hyperX.dimIndices, \ BOO(zVar,zVAR_DIMCOUNTS_, \ - rVARs_DIMCOUNTS_), hyper.dimCounts, \ + rVARs_DIMCOUNTS_), hyperX.dimCounts, \ BOO(zVar,zVAR_DIMINTERVALS_, \ - rVARs_DIMINTERVALS_), hyper.dimIntervals, \ + rVARs_DIMINTERVALS_), hyperX.dimIntervals, \ PUT_, BOO(zVar,zVAR_HYPERDATA_,rVAR_HYPERDATA_), buffer, \ NULL_) @@ -774,17 +774,17 @@ void (*fatalFnc) PROTOARGs((char *msg)) )); void InitHyperParms PROTOARGs(( - struct HyperStruct *hyper, struct GroupStruct *groups, long numDims, + struct HyperStruct *hyperX, struct GroupStruct *groups, long numDims, long *nHypers, long *nValues )); void IncrHyperParms PROTOARGs(( - struct HyperStruct *hyper, struct GroupStruct *groups, long numDims, + struct HyperStruct *hyperX, struct GroupStruct *groups, long numDims, Logical rowMajor, long *nValues )); Logical HyperFullRecord PROTOARGs((struct GroupStruct *groups, long numDims)); long HypersPerRecord PROTOARGs((struct GroupStruct *groups, long numDims)); Logical HyperStartOfRecord PROTOARGs(( - struct HyperStruct *hyper, long numDims + struct HyperStruct *hyperX, long numDims )); void WriteOutPct PROTOARGs((int pct)); Logical SwitchMajority PROTOARGs(( diff -urN cdf31-dist.orig/src/include/windoz.h cdf31-dist/src/include/windoz.h --- cdf31-dist.orig/src/include/windoz.h Mon Aug 15 17:26:44 2005 +++ cdf31-dist/src/include/windoz.h Tue Jun 13 16:23:34 2006 @@ -182,17 +182,50 @@ # undef ACS_PLUS # endif # if defined(problemACS) -# define ACS_VLINE '|' -# define ACS_HLINE '-' -# define ACS_TTEE '+' -# define ACS_BTEE '+' -# define ACS_LTEE '+' -# define ACS_RTEE '+' -# define ACS_ULCORNER '+' -# define ACS_URCORNER '+' -# define ACS_LLCORNER '+' -# define ACS_LRCORNER '+' -# define ACS_PLUS '+' +# if defined(ACS_VLINE) +# undef ACS_VLINE +# endif +# define ACS_VLINE '|' +# if defined(ACS_HLINE) +# undef ACS_HLINE +# endif +# define ACS_HLINE '-' +# if defined(ACS_TTEE) +# undef ACS_TTEE +# endif +# define ACS_TTEE '+' +# if defined(ACS_BTEE) +# undef ACS_BTEE +# endif +# define ACS_BTEE '+' +# if defined(ACS_LTEE) +# undef ACS_LTEE +# endif +# define ACS_LTEE '+' +# if defined(ACS_RTEE) +# undef ACS_RTEE +# endif +# define ACS_RTEE '+' +# if defined(ACS_ULCORNER) +# undef ACS_ULCORNER +# endif +# define ACS_ULCORNER '+' +# if defined(ACS_URCORNER) +# undef ACS_URCORNER +# endif +# define ACS_URCORNER '+' +# if defined(ACS_LLCORNER) +# undef ACS_LLCORNER +# endif +# define ACS_LLCORNER '+' +# if defined(ACS_LRCORNER) +# undef ACS_LRCORNER +# endif +# define ACS_LRCORNER '+' +# if defined(ACS_PLUS) +# undef ACS_PLUS +# endif +# define ACS_PLUS '+' # undef problemACS # endif # if defined(dos) diff -urN cdf31-dist.orig/src/lib/Makefile cdf31-dist/src/lib/Makefile --- cdf31-dist.orig/src/lib/Makefile Thu Jan 26 21:53:31 2006 +++ cdf31-dist/src/lib/Makefile Thu Aug 24 15:46:23 2006 @@ -95,22 +95,17 @@ libcdf.so \ libcdf.dylib \ libcdf.sl: $(OBJs) - @if [ $(MACos) = `uname` ] ; then \ - if [ `uname -r | cut -f1 -d.` = 8 ]; then \ - echo $(LD) -arch_only ppc $(LDFLAGS) -o $@ $(OBJs) $(SYSLIBS) -lSystemStubs; \ - $(LD) -arch_only ppc $(LDFLAGS) -o $@ $(OBJs) $(SYSLIBS) -lSystemStubs; \ - else \ - echo $(LD) $(LDFLAGS) -o $@ $(OBJs) $(SYSLIBS); \ - $(LD) $(LDFLAGS) -o $@ $(OBJs) $(SYSLIBS); \ - fi \ - else \ + @if [ -f $@ ] ; then rm $@ ; else $(NULL) ; fi + if [ $(MACos) = `uname` ] ; then \ echo $(LD) $(LDFLAGS) -o $@ $(OBJs) $(SYSLIBS); \ $(LD) $(LDFLAGS) -o $@ $(OBJs) $(SYSLIBS); \ - fi - + else \ + echo $(LD) $(LDFLAGS) -o $@ $(OBJs); \ + $(LD) $(LDFLAGS) -o $@ $(OBJs); \ + fi libcdf.o: $(OBJs) - @echo $(CC) $(LDFLAGS) -o $@ $(OBJs) $(SYSLIBS) - $(CC) $(LDFLAGS) -o $@ $(OBJs) $(SYSLIBS) + @echo $(LD) $(LDFLAGS) -o $@ $(OBJs) $(SYSLIBS) + $(LD) $(LDFLAGS) -o $@ $(OBJs) $(SYSLIBS) .c.o: @echo $(CC) $(CFLAGS) -c $< diff -urN cdf31-dist.orig/src/lib/cdfcre.c cdf31-dist/src/lib/cdfcre.c --- cdf31-dist.orig/src/lib/cdfcre.c Fri Jan 20 17:25:22 2006 +++ cdf31-dist/src/lib/cdfcre.c Mon Oct 16 16:02:10 2006 @@ -20,6 +20,8 @@ * V1.5b 11-Sep-97, J Love Magic numbers are now uInt32. * V1.5c 20-Oct-97, J Love Properly cast the uInt32 magic numbers. * V1.6 8-Apr-04, M Liu Save the currently created variable's offset. +* V1.7 13-Oct-06, M Liu Changed to allow upper and lower case CDF +* name to be used on win32. * ******************************************************************************/ @@ -86,7 +88,7 @@ #if STRIP_TRAILING_BLANKS_FROM_CDFPATH StripTrailingBlanks (CDFnameT); #endif -#if defined(vms) || defined(dos) || defined(win32) +#if defined(vms) || defined(dos) MakeUpperString (CDFnameT); #endif RemoveCDFFileExtension(CDFnameT, CDFnameTx); diff -urN cdf31-dist.orig/src/lib/cdfcre64.c cdf31-dist/src/lib/cdfcre64.c --- cdf31-dist.orig/src/lib/cdfcre64.c Fri Jan 20 17:59:47 2006 +++ cdf31-dist/src/lib/cdfcre64.c Mon Oct 16 16:02:32 2006 @@ -21,6 +21,8 @@ * V1.5c 20-Oct-97, J Love Properly cast the uInt32 magic numbers. * V1.6 8-Apr-04, M Liu Save the currently created variable's offset. * V2.0 29-Jun-04, M Liu Added LFS (Large File Support > 2G). +* V2.1 13-Oct-06, M Liu Changed to allow upper and lower case CDF +* name to be used on win32. * ******************************************************************************/ @@ -53,7 +55,7 @@ struct GDRstruct64 GDR; vFILE *dotFp; int dimN; -#if defined(vms) || defined(dos) || defined(win32) +#if defined(vms) || defined(dos) Logical upper_case_ext = TRUE; #else /* Unix, POSIX, & Macintosh */ Logical upper_case_ext = FALSE; diff -urN cdf31-dist.orig/src/lib/cdfcsi.c cdf31-dist/src/lib/cdfcsi.c --- cdf31-dist.orig/src/lib/cdfcsi.c Tue Jan 17 16:45:09 2006 +++ cdf31-dist/src/lib/cdfcsi.c Mon Oct 16 18:39:07 2006 @@ -29,6 +29,9 @@ #include "cdflib.h" +static int backward = 0; +static int setFileBackwardFlag = 0; + /****************************************************************************** * CDFcreateCDF. ******************************************************************************/ @@ -137,8 +140,8 @@ if (!GLOBALscope(scope) && (grzEntry == 1)) return ILLEGAL_FOR_SCOPE; if (!sX(CDFlib(SELECT_, BOO((grzEntry == 3),zENTRY_, - (GLOBALscope(scope),gENTRY_, - rENTRY_)), entryNum, + (BOO(GLOBALscope(scope),gENTRY_, + rENTRY_))), entryNum, GET_, BOO((grzEntry == 3),zENTRY_DATATYPE_, (BOO(GLOBALscope(scope),gENTRY_DATATYPE_, rENTRY_DATATYPE_))), dataType, @@ -178,7 +181,7 @@ if (!sX(CDFlib(SELECT_, BOO((grzEntry == 3),zENTRY_, (BOO(GLOBALscope(scope),gENTRY_, - rENTRY_))), entryNum, + rENTRY_))), entryNum, PUT_, BOO((grzEntry == 3),zENTRY_DATA_, (BOO(GLOBALscope(scope),gENTRY_DATA_, rENTRY_DATA_))), dataType, numElems, value, @@ -213,7 +216,7 @@ if (!sX(CDFlib(SELECT_, BOO((grzEntry == 3),zENTRY_, (BOO(GLOBALscope(scope),gENTRY_, - rENTRY_))), entryNum, + rENTRY_))), entryNum, GET_, BOO((grzEntry == 3),zENTRY_DATA_, (BOO(GLOBALscope(scope),gENTRY_DATA_, rENTRY_DATA_))), value, @@ -245,7 +248,7 @@ if (!sX(CDFlib(SELECT_, BOO((grzEntry == 3),zENTRY_, (BOO(GLOBALscope(scope),gENTRY_, - rENTRY_))), entryNum, + rENTRY_))), entryNum, DELETE_, BOO((grzEntry == 3),zENTRY_, (BOO(GLOBALscope(scope),gENTRY_, rENTRY_))), NULL_), &pStatus)) return pStatus; @@ -279,7 +282,7 @@ if (!sX(CDFlib(SELECT_, BOO((grzEntry == 3),zENTRY_, (BOO(GLOBALscope(scope),gENTRY_, - rENTRY_))), entryNum, + rENTRY_))), entryNum, PUT_, BOO((grzEntry == 3),zENTRY_DATASPEC_, (BOO(GLOBALscope(scope),gENTRY_DATASPEC_, rENTRY_DATASPEC_))), @@ -685,5 +688,107 @@ cdf_FreeMemory (buffer, NULL); return CDF_OK; +} + +/****************************************************************************** +* CDFinquireAttrInfo. +* Can't implement with macro because the attribute's scope determines which +* item(s) to use. +******************************************************************************/ + +VISIBLE_PREFIX CDFstatus CDFinquireAttrInfo (id, zEntry, attrNum, attrName, + scope, maxEntry) +CDFid id; /* In -- CDF id. */ +int zEntry; /* In -- Flag for zEntry. */ +long attrNum; /* In -- Attribute number. */ +char *attrName; /* Out -- Attribute name. */ +long *scope; /* Out -- Attribute scope. */ +long *maxEntry; /* Out -- Maximum g/r/zEntry number used. */ +{ + CDFstatus pStatus = CDF_OK; + if (!sX(CDFlib(SELECT_, CDF_, id, + ATTR_, attrNum, + GET_, ATTR_SCOPE_, scope, + NULL_), &pStatus)) return pStatus; + if (GLOBALscope(*scope) && (zEntry == 1)) return ILLEGAL_FOR_SCOPE; + if (!sX(CDFlib(GET_, ATTR_NAME_, attrName, + BOO((zEntry == 1),ATTR_MAXzENTRY_, + (BOO(GLOBALscope(*scope),ATTR_MAXgENTRY_, + ATTR_MAXrENTRY_))), maxEntry, + NULL_), &pStatus)) return pStatus; + return pStatus; +} + +/****************************************************************************** +* CDFsetFileBackward. This function has precedence over the environment +* variable in determining whether a backward file is to be created. +******************************************************************************/ + +VISIBLE_PREFIX void CDFsetFileBackward (flag) +int flag; +{ + if (flag != 0) backward = 1; + else backward = 0; + /* + * Set setFileBackward flag. So, if the environment variable is also + * set, we can ignore that as calling CDFsetFileBackward function has + * precedence over the environment variable approach. + */ + setFileBackwardFlag = 1; +} + +/****************************************************************************** +* CDFsetFileBackward2. This function is called if the environment variable +* is set to create the backward file. However, if CDFsetFileBackward +* function has been called and as it has precedence over the environment +* variable, calling this function will have no effect at all. +******************************************************************************/ + +VISIBLE_PREFIX void CDFsetFileBackward2 (flag) +int flag; +{ + if (setFileBackwardFlag == 0) { /* True if CDFsetFileBackward is not */ + /* called. */ + if (flag != 0) backward = 1; + else backward = 0; + } +} + +/****************************************************************************** +* CDFgetFileBackward. +* Acquires the backward flag defined from CDFsetFileBackward function or +* the environment variable. +******************************************************************************/ + +VISIBLE_PREFIX int CDFgetFileBackward () +{ + return backward; +} + +/****************************************************************************** +* CDFsetFileBackwardFlag. (Holding for backward version -- should not use.) +******************************************************************************/ + +VISIBLE_PREFIX void CDFsetFileBackwardFlag (flag) +int flag; +{ +/* + long version; + CDFstatus status; + status = CDFlib (GET_, LIB_VERSION_, &version, + NULL_); + if (version == 3) backward = flag; +*/ + backward = flag; +} + +/****************************************************************************** +* CDFgetFileBackwardFlag. (Holding for backward version -- should not use.) +******************************************************************************/ + +VISIBLE_PREFIX int CDFgetFileBackwardFlag () +{ + if (backward == 0) return 0; + else return 1; } diff -urN cdf31-dist.orig/src/lib/cdffsi.c cdf31-dist/src/lib/cdffsi.c --- cdf31-dist.orig/src/lib/cdffsi.c Thu Feb 2 17:07:28 2006 +++ cdf31-dist/src/lib/cdffsi.c Wed Sep 6 19:51:07 2006 @@ -2989,7 +2989,7 @@ Int32 Fif_PREFIXb Fif_ENTRYPOINT(cdf_get_filebackward__,cdf_get_filebackward_, - cdf_get_filebackward, cdf_GET_fileBACKWARD) + cdf_get_filebackward, CDF_GET_FILEBACKWARD) () { diff -urN cdf31-dist.orig/src/lib/cdfmisc1.c cdf31-dist/src/lib/cdfmisc1.c --- cdf31-dist.orig/src/lib/cdfmisc1.c Thu Feb 2 16:58:45 2006 +++ cdf31-dist/src/lib/cdfmisc1.c Mon Oct 16 16:03:02 2006 @@ -27,6 +27,8 @@ * Windows NT. * V1.3e 18-Nov-97, J Love Even more Windows NT. * V2.0 08/Apr-04, M liu Replaced VSTREAM.STATS with VSTREAM_STATS. +* V2.1 13-Oct-06, M Liu Changed to allow upper and lower case CDF +* name to be used on win32. * ******************************************************************************/ @@ -744,6 +746,27 @@ return CDF_OK; } +#if defined(dos) || defined(win32) + strcpyX (pathT, path, DU_MAX_PATH_LEN); + MakeUpperString (pathT); + strcatX (pathT, ".CDF", DU_MAX_PATH_LEN); + if (IsReg(pathT)) { + *no_append = FALSE; + *upper = TRUE; + *version = FALSE; + return CDF_OK; + } + + strcpyX (pathT, path, DU_MAX_PATH_LEN); + MakeUpperString (pathT); + if (IsReg(pathT)) { + *no_append = TRUE; + *upper = TRUE; + *version = FALSE; + return CDF_OK; + } +#endif + if (IsReg(path)) { *no_append = TRUE; *upper = FALSE; @@ -1687,10 +1710,10 @@ for (i = 0; i < 4; i++) { char aName[8+1]; switch (i) { - case 0: strcpy (aName, "VALIDMIN"); break; - case 1: strcpy (aName, "VALIDMAX"); break; - case 2: strcpy (aName, "SCALEMIN"); break; - case 3: strcpy (aName, "SCALEMAX"); break; + case 0: strcpyX (aName, "VALIDMIN", 0); break; + case 1: strcpyX (aName, "VALIDMAX", 0); break; + case 2: strcpyX (aName, "SCALEMIN", 0); break; + case 3: strcpyX (aName, "SCALEMAX", 0); break; } tStatus = FindAttrByName (CDF,aName,&aOffset); switch (tStatus) { diff -urN cdf31-dist.orig/src/lib/cdfmisc3_64.c cdf31-dist/src/lib/cdfmisc3_64.c --- cdf31-dist.orig/src/lib/cdfmisc3_64.c Tue Jan 24 22:32:16 2006 +++ cdf31-dist/src/lib/cdfmisc3_64.c Mon Oct 16 18:28:35 2006 @@ -73,9 +73,6 @@ char *string, char *chkstring )); -static int backward = 0; -static int setFileBackwardFlag = 0; - /****************************************************************************** * DecompressCDF64. ******************************************************************************/ @@ -626,7 +623,11 @@ elemCount = numElems; for (;;) { OFF_T xBytes = (OFF_T) elemCount * Var->NelemBytes; - if (xBytes < (((OFF_T) 1L) << 31) - 1) { +#if defined(win32) + if (xBytes < (OFF_T) ((1i64 << 31) - 1)) { +#else + if (xBytes < (OFF_T) ((1LL << 31) - 1)) { +#endif size_t nBytes = (size_t) (elemCount * Var->NelemBytes); void *tBuffer = cdf_AllocateMemory (nBytes, NULL); if (tBuffer != NULL) { @@ -1163,7 +1164,11 @@ ****************************************************************************/ nValues = nRecords * Var->NphyRecValues; xBytes = (OFF_T) nValues * Var->NvalueBytes; - if (xBytes < (((OFF_T) 1L) << 31) - 1) { +#if defined(win32) + if (xBytes < (OFF_T) ((1i64 << 31) - 1)) { +#else + if (xBytes < (OFF_T) ((1LL << 31) - 1)) { +#endif nBytes = nValues * Var->NvalueBytes; #if LIMITof64K if (nBytes < 65536L) { @@ -2728,69 +2733,6 @@ FCLOSE64 (fp); if (CDFfullName != NULL) strcpyX (CDFfullName, CDFpathX, DU_MAX_PATH_LEN); return pStatus; -} - -/****************************************************************************** -* CDFsetFileBackward. This function has precedence over the environment -* variable in determining whether a backward file is to be created. -******************************************************************************/ - -VISIBLE_PREFIX void CDFsetFileBackward (flag) -int flag; -{ - if (flag != 0) backward = 1; - else backward = 0; - /* - * Set setFileBackward flag. So, if the environment variable is detected - * to create backward files (and thus calling CDFsetFileBackward2 - * function), we can ignore it as calling this CDFsetFileBackward - * function has precedence over the environment variable approach. - */ - setFileBackwardFlag = 1; -} - -/****************************************************************************** -* CDFsetFileBackward2. This function is called if the environment variable -* is set to create the backward file. However, if CDFsetFileBackward -* function has been called and as it has precedence -* over the environment variable, calling this function will have no effect at -* all. -******************************************************************************/ - -VISIBLE_PREFIX void CDFsetFileBackward2 (flag) -int flag; -{ - /* This function is called if the environment variable is set. - * However, if setFileBackwardFlag flag is already set by calling - * CDFsetFileBackward function, this function call is then ignored as - * CDFsetFileBackward has a precedence over the environment variable. - */ - if (setFileBackwardFlag == 0) { - if (flag != 0) backward = 1; - else backward = 0; - } -} - -/****************************************************************************** -* CDFgetFileBackward. -* Acquires the backward flag defined from CDFsetFileBackward function or -* the environment variable. -******************************************************************************/ - -VISIBLE_PREFIX int CDFgetFileBackward () -{ - return backward; -} - -/****************************************************************************** -* CDFcheckFileBackwardisSet. -* Checks whether the file backward flag has been set by CDFsetFileBackward -* function. -******************************************************************************/ - -VISIBLE_PREFIX int CDFcheckFileBackwardisSet () -{ - return setFileBackwardFlag; } /****************************************************************************** diff -urN cdf31-dist.orig/src/lib/cdfope.c cdf31-dist/src/lib/cdfope.c --- cdf31-dist.orig/src/lib/cdfope.c Fri Jan 20 17:27:23 2006 +++ cdf31-dist/src/lib/cdfope.c Mon Oct 16 16:03:20 2006 @@ -19,6 +19,8 @@ * V1.4a 21-Feb-97, J Love Removed RICE. * V1.5 21-Jun-04, M Liu Modified the error message for NOT_A_CDF. * V2.0 29-Jun-04, M Liu Added support for LFS (Large File System >2G). +* V2.1 13-Oct-06, M Liu Changed to allow upper and lower case CDF +* name to be used on win32. * ******************************************************************************/ @@ -65,7 +67,7 @@ #if STRIP_TRAILING_BLANKS_FROM_CDFPATH StripTrailingBlanks (CDFnameT); #endif -#if defined(vms) || defined(dos) || defined(win32) +#if defined(vms) || defined(dos) MakeUpperString (CDFnameT); #endif RemoveCDFFileExtension(CDFnameT, CDFnameTx); diff -urN cdf31-dist.orig/src/lib/cdfput1.c cdf31-dist/src/lib/cdfput1.c --- cdf31-dist.orig/src/lib/cdfput1.c Fri Nov 4 17:02:03 2005 +++ cdf31-dist/src/lib/cdfput1.c Tue Nov 21 20:09:18 2006 @@ -21,6 +21,9 @@ * V2.0 08-Apr-04, M Liu Removed calls to LocateCurrentVar function as * its offset becomes available when it is * selected/created. +* V2.1 16-Nov-05, M Liu Changed code for data spec modification. -99 +* is passed as a special indicator for the +* number of elements as it can't be change. * ******************************************************************************/ @@ -120,9 +123,9 @@ CDF->rVars[(int)CDF->CURrVarNum]); if (!ValidDataType(newDataType)) return BAD_DATA_TYPE; - if (newNumElems < 1) return BAD_NUM_ELEMS; + if (newNumElems != -99 && newNumElems < 1) return BAD_NUM_ELEMS; if (!STRINGdataType(newDataType)) { - if (newNumElems != 1) return BAD_NUM_ELEMS; + if (newNumElems != -99 && newNumElems != 1) return BAD_NUM_ELEMS; } if (!sX(ReadVDR(CDF,CDF->fp,offset,zVar, VDR_FLAGS,&flags, @@ -137,7 +140,8 @@ * If the data specifications are not equivalent, check if any records have * been written or allocated or if a pad value has been specified. **************************************************************************/ - if (!EquivDataTypes(newDataType,dataType) || (newNumElems != numElems)) { + if (!EquivDataTypes(newDataType,dataType) || + (newNumElems != -99 && newNumElems != numElems)) { if (maxRec > NO_RECORD) return CANNOT_CHANGE; if (!sX(LastRecord(CDF,offset,zVar,&maxAllocated),&pStatus)) { AbortAccess (CDF, UPDATE, noDELETE); @@ -147,6 +151,7 @@ if (PADvalueBITset(flags)) return CANNOT_CHANGE; } if (!WriteAccess(CDF,FALSE,&pStatus)) return pStatus; + if (newNumElems == -99) newNumElems = numElems; /************************************************************************** * Update the VDR with the new data specification. **************************************************************************/ diff -urN cdf31-dist.orig/src/lib/cdfput2.c cdf31-dist/src/lib/cdfput2.c --- cdf31-dist.orig/src/lib/cdfput2.c Mon Aug 15 17:26:44 2005 +++ cdf31-dist/src/lib/cdfput2.c Mon Oct 16 19:07:10 2006 @@ -18,6 +18,9 @@ * V2.0 08-Apr-04, M Liu Removed calls to LocateCurrentVar function as * its offset becomes available when it is * selected/created. +* V2.1 16-Nov-05, M Liu Changed code for data spec modification. -99 +* is passed as a special indicator for the +* number of elements as it can't be change. * ******************************************************************************/ @@ -715,7 +718,7 @@ CDF->CURgrEntryNum, CDF->CURzEntryNum) == RESERVED_ENTRYNUM) return NO_ENTRY_SELECTED; if (!ValidDataType(newDataType)) return BAD_DATA_TYPE; - if (newNumElems < 1) return BAD_NUM_ELEMS; + if (newNumElems != -99 && newNumElems < 1) return BAD_NUM_ELEMS; if (!sX(CheckEntryOp(CDF,entryType),&pStatus)) return pStatus; eOffset = E3(entryType,CDF->CURgrEntryOffset, CDF->CURgrEntryOffset, @@ -730,7 +733,8 @@ return pStatus; } if ((!EquivDataTypes(newDataType,oldDataType)) || - newNumElems != oldNumElems) return CANNOT_CHANGE; + (newNumElems != -99 && newNumElems != oldNumElems)) + return CANNOT_CHANGE; if (!sX(WriteAEDR(CDF,CDF->fp,eOffset, AEDR_DATATYPE,&newDataType, AEDR_NULL),&pStatus)) { diff -urN cdf31-dist.orig/src/lib/cdfwrite64.c cdf31-dist/src/lib/cdfwrite64.c --- cdf31-dist.orig/src/lib/cdfwrite64.c Wed Aug 31 15:37:05 2005 +++ cdf31-dist/src/lib/cdfwrite64.c Wed Nov 22 15:17:16 2006 @@ -643,7 +643,8 @@ if (!sX(ReadVDR64(CDF,fp,offset,zVar, VDR_zNUMDIMS,&nDims, VDR_NULL),&pStatus)) return pStatus; - tOffset = offset + zVDR_DIMVARYS_OFFSETb + (nDims * sizeof(Int32)); + tOffset = offset + (OFF_T) (zVDR_DIMVARYS_OFFSETb64 + + (nDims * sizeof(Int32))); } else { OFF_T GDRoffset; @@ -671,8 +672,9 @@ if (!sX(ReadVDR64(CDF,fp,offset,zVar, VDR_zNUMDIMS,&zNumDims, VDR_NULL),&pStatus)) return pStatus; - tOffset = offset + zVDR_PADVALUE_OFFSETb + - (zNumDims * sizeof(Int32)) + (zNumDims * sizeof(Int32)); + tOffset = offset + (OFF_T) (zVDR_PADVALUE_OFFSETb64 + + (zNumDims * sizeof(Int32)) + + (zNumDims * sizeof(Int32))); } else { Int32 rNumDims; OFF_T GDRoffset; @@ -682,7 +684,8 @@ if (!sX(ReadGDR64(fp,GDRoffset, GDR_rNUMDIMS,&rNumDims, GDR_NULL),&pStatus)) return pStatus; - tOffset = offset + rVDR_PADVALUE_OFFSETb + (rNumDims*sizeof(Int32)); + tOffset = offset + (OFF_T) (rVDR_PADVALUE_OFFSETb64 + + (rNumDims*sizeof(Int32))); } if (!SEEKv64(fp,tOffset,vSEEK_SET)) return CWE; if (!sX(WriteBuffer64(CDF,fp,dataType, diff -urN cdf31-dist.orig/src/lib/epochu.c cdf31-dist/src/lib/epochu.c --- cdf31-dist.orig/src/lib/epochu.c Mon Aug 15 17:26:44 2005 +++ cdf31-dist/src/lib/epochu.c Tue Dec 5 19:58:48 2006 @@ -66,10 +66,10 @@ static Logical AppendPart PROTOARGs(( char *encoded, char *ePart, int width, Logical leading0 )); -static void encodeEPOCH16x2 PROTOARGs(( +void encodeEPOCH16x2 PROTOARGs(( double epoch, char *encoded )); -static void encodeEPOCH16x3 PROTOARGs(( +void encodeEPOCH16x3 PROTOARGs(( double epoch[], char *encoded )); @@ -151,8 +151,14 @@ if (usec < 0 || usec > 999) return ILLEGAL_EPOCH_VALUE; if (nsec < 0 || nsec > 999) return ILLEGAL_EPOCH_VALUE; if (psec < 0 || psec > 999) return ILLEGAL_EPOCH_VALUE; + if (year == 9999 && month == 12 && day == 31 && hour == 23 && minute == 59 && + second == 59 && msec == 999 && usec == 999 && nsec == 999 && psec == 999) { + epoch[0] = -1.0E31; + epoch[1] = -1.0E31; + return 0.0; + } epoch[0] = mmm / (double) 1000.0; - epoch[1] = msec * pow(10.0, 9) + usec * pow(10.0, 6) + nsec * pow(10.0, 3) + + epoch[1] = msec * pow(10.0, 9.0) + usec * pow(10.0, 6.0) + nsec * pow(10.0, 3.0) + psec; return (double) 0.0; } @@ -213,34 +219,31 @@ char temp[EPOCH16_1_STRING_LEN+1]; double fraction; int i; long year, month, day, hour, minute, second, fractionL1, fractionL2; double mmm; + + if (!strcmp (inString, "99991231.999999999999999")) { + epoch[0] = -1.0E31; + epoch[1] = -1.0E31; + return 0.0; + } + strcpyX (temp, inString, EPOCH16_1_STRING_LEN); for (i = strlen(temp); i < EPOCH16_1_STRING_LEN; i++) temp[i] = '0'; temp[i] = NUL; if (sscanf(temp,"%4ld%2ld%2ld.%7ld%8ld", &year, &month, &day, &fractionL1, &fractionL2) != 5) return ILLEGAL_EPOCH_VALUE; - fraction = ((double) fractionL1 * pow(10.0, 8) + (double) fractionL2) * - pow(10.0, -15); + fraction = ((double) fractionL1 * pow(10.0, 8.0) + (double) fractionL2) * + pow(10.0, -15.0); hour = (long) (fraction * 24.0); fraction -= (double) (hour / 24.0); minute = (long) (fraction * 1440.0); fraction -= (double) (minute / 1440.0); second = (long) (fraction * 86400.0); fraction -= (double) (second / 86400.0); - /* - mmm = fraction * (double) 86400.0; - msec = (long) (mmm * 1000.0); - mmm -= (double) (msec / 1000.0); - usec = (long) (mmm * 1000.0); - mmm -= (double) (usec / 1000.0); - nsec = (long) (mmm * 1000.0); - mmm -= (double) (nsec / 1000.0); - psec = (long) (mmm * 1000.0); - */ mmm = computeEPOCH (year, month, day, hour, minute, second, 0L); if (mmm == ILLEGAL_EPOCH_VALUE) return ILLEGAL_EPOCH_VALUE; epoch[0] = mmm / (double) 1000.0; - epoch[1] = fraction * 86400.0 * pow(10.0, 12); + epoch[1] = fraction * 86400.0 * pow(10.0, 12.0); return (double) 0.0; } @@ -345,11 +348,18 @@ != 10) { return ILLEGAL_EPOCH_VALUE; } + if (year == 9999 && month == 12 && day == 31 && hour == 23 && minute == 59 && + second == 59 && msec == 999 && usec == 999 && nsec == 999 && psec == 999) { + epoch[0] = -1.0E31; + epoch[1] = -1.0E31; + return (double) 0.0; + } + mmm = computeEPOCH (year, month, day, hour, minute, second, 0L); if (mmm == ILLEGAL_EPOCH_VALUE) return ILLEGAL_EPOCH_VALUE; epoch[0] = mmm / (double) 1000.0; - epoch[1] = (double) psec + (double) nsec * pow(10.0, 3) + - (double) usec * pow(10.0, 6) + (double) msec * pow(10.0, 9); + epoch[1] = (double) psec + (double) nsec * pow(10.0, 3.0) + + (double) usec * pow(10.0, 6.0) + (double) msec * pow(10.0, 9.0); return (double) 0.0; } @@ -368,6 +378,11 @@ double epoch; char epString[EPOCH_STRING_LEN+1]; { + if (epoch == -1.0E31) { + strcpyX(epString, "31-Dec-9999 23:59:59.999", 0); + return; + } + encodeEPOCHx (epoch, "-- ::.", epString); return; @@ -391,6 +406,12 @@ char epString[EPOCH16_STRING_LEN+1]; { char tmp[EPOCH1_STRING_LEN+1]; + + if (epoch[0] == -1.0E31 && epoch[1] == -1.0E31) { + strcpyX(epString, "31-Dec-9999 23:59:59.999.999.999.999", 0); + return; + } + encodeEPOCHx (epoch[0]*1000.0, "-- ::.", epString); @@ -415,6 +436,11 @@ double epoch; char epString[EPOCH1_STRING_LEN+1]; { + if (epoch == -1.0E31) { + strcpyX(epString, "99991231.9999999", 0); + return; + } + encodeEPOCHx (epoch, ".", epString); return; @@ -438,7 +464,13 @@ double epoch[2]; char epString[EPOCH16_1_STRING_LEN+1]; { - char tmp[EPOCH1_STRING_LEN+1]; + char tmp[EPOCH16_1_STRING_LEN+1]; + + if (epoch[0] == -1.0E31 && epoch[1] == -1.0E31) { + strcpyX(epString, "99991231.999999999999999", 0); + return; + } + encodeEPOCHx (epoch[0]*1000.0, ".", epString); encodeEPOCH16x3 (epoch, tmp); @@ -462,6 +494,11 @@ double epoch; char epString[EPOCH2_STRING_LEN+1]; { + if (epoch == -1.0E31) { + strcpyX(epString, "99991231235959", 0); + return; + } + encodeEPOCHx (epoch, "", epString); return; @@ -483,6 +520,11 @@ double epoch[2]; char epString[EPOCH16_2_STRING_LEN+1]; { + if (epoch[0] == -1.0E31 && epoch[1] == -1.0E31) { + strcpyX(epString, "99991231235959", 0); + return; + } + encodeEPOCHx (epoch[0]*1000.0, "", epString); return; @@ -503,6 +545,11 @@ double epoch; char epString[EPOCH3_STRING_LEN+1]; { + if (epoch == -1.0E31) { + strcpyX(epString, "9999-12-31T23:59:59.999Z", 0); + return; + } + encodeEPOCHx (epoch, "--T::.Z", epString); return; @@ -525,6 +572,12 @@ char epString[EPOCH16_3_STRING_LEN+1]; { char tmp[EPOCH16_3_STRING_LEN+1]; + + if (epoch[0] == -1.0E31 && epoch[1] == -1.0E31) { + strcpyX(epString, "9999-12-31T23:59:59.999.999.999.999Z", 0); + return; + } + encodeEPOCHx (epoch[0]*1000.0, "--T::.", tmp); @@ -1018,7 +1071,7 @@ return TRUE; } -static void encodeEPOCH16x2 (epoch, encoded) +void encodeEPOCH16x2 (epoch, encoded) double epoch; char *encoded; { @@ -1035,24 +1088,28 @@ return; } -static void encodeEPOCH16x3 (epoch, encoded) +void encodeEPOCH16x3 (epoch, encoded) double epoch[2]; char *encoded; { - char tmp[16+1]; + char tmp[17+1]; long year, month, day, hour, minute, second, msec, usec, nsec, psec; - double mmm1, mmm2; + double mmm1, mmm2, mmm3; EPOCH16breakdown (epoch, &year, &month, &day, &hour, &minute, &second, &msec, &usec, &nsec, &psec); mmm1 = ((double) hour * 3600.0 + (double) minute * 60.0 + (double) second) / 86400.0; - mmm2 = ((double) msec * pow(10.0, 9) + (double) usec * pow(10.0, 6) + - (double) nsec * pow(10.0, 3) + (double) psec) / - (86400.0 * pow(10.0, 12)); - mmm1 = mmm1 + mmm2; - sprintf(tmp, "%.15f", mmm1); + mmm2 = ((double) msec * pow(10.0, 9.0) + (double) usec * pow(10.0, 6.0) + + (double) nsec * pow(10.0, 3.0) + (double) psec) / + (86400.0 * pow(10.0, 12.0)); + mmm3 = mmm1 + mmm2; + if (mmm3 >= 1.0) { + if (mmm1 > 0.0 || mmm2 > 1.0E9) + strcpyX (tmp, "0.999999999999999", 0); + } else + sprintf(tmp, "%.15f", mmm3); strcpyX (encoded, tmp+2, 15); - encoded[16] = NUL; +/* encoded[16] = NUL; */ return; } @@ -1067,6 +1124,13 @@ long year, month, day, hour, minute, second, msec; { long daysSince0AD, msecInDay; + + /**************************************************************************** + * Mark 9999-12-31 23:59:59:999 as an invalid date. + ****************************************************************************/ + if (year == 9999 && month == 12 && day == 31 && hour == 23 && + minute == 59 && second == 59 && msec == 999) return -1.0*pow(10.0, 31.0); + /**************************************************************************** * Calculate the days since 0 A.D (1-Jan-0000). If a value of zero is passed * in for `month', assume that `day' is the day-of-year (DOY) with January 1st @@ -1118,6 +1182,18 @@ double epoch[2]; { long daysSince0AD; + + /**************************************************************************** + * Mark 9999-12-31 23:59:59:999:999:999:999 as an invalid date. + ****************************************************************************/ + if (year == 9999 && month == 12 && day == 31 && hour == 23 && + minute == 59 && second == 59 && msec == 999 && usec == 999 && + nsec == 999 && psec == 999) { + epoch[0] = -1.0E31; + epoch[1] = -1.0E31; + return 0.0; + } + /**************************************************************************** * Calculate the days since 0 A.D (1-Jan-0000). If a value of zero is passed * in for `month', assume that `day' is the day-of-year (DOY) with January 1st @@ -1151,8 +1227,8 @@ ****************************************************************************/ epoch[0] = 86400.0 * (double) daysSince0AD + 3600.0 * (double) hour + 60.0 * (double) minute + (double) second; - epoch[1] = (double) psec + (double) nsec * pow(10.0, 3) + - (double) usec * pow(10.0, 6) + (double) msec * pow(10.0, 9); + epoch[1] = (double) psec + (double) nsec * pow(10.0, 3.0) + + (double) usec * pow(10.0, 6.0) + (double) msec * pow(10.0, 9.0); return (double) 0.0; } @@ -1169,6 +1245,17 @@ long jd,i,j,k,l,n; double msec_AD, second_AD, minute_AD, hour_AD, day_AD; + if (epoch == -1.0E31) { + *year = 9999; + *month = 12; + *day = 31; + *hour = 23; + *minute = 59; + *second = 59; + *msec = 999; + return; + } + if (NegativeZeroReal8(&epoch)) { *year = 0; *month = 0; @@ -1229,6 +1316,20 @@ double second_AD, minute_AD, hour_AD, day_AD; double psec_SC, nsec_SC, usec_SC; + if (epoch[0] == -1.0E31 && epoch[1] == -1.0E31) { + *year = 9999; + *month = 12; + *day = 31; + *hour = 23; + *minute = 59; + *second = 59; + *msec = 999; + *usec = 999; + *nsec = 999; + *psec = 999; + return; + } + if (NegativeZeroReal8(&epoch[0])) { *year = 0; *month = 0; @@ -1245,7 +1346,12 @@ } if (epoch[0] < 0.0) epoch[0] = -epoch[0]; - epoch[0] = MINIMUM ((double)MAX_EPOCH_BINARY, epoch[0]); + if (epoch[1] < 0.0) epoch[1] = -epoch[1]; + epoch[0] = MINIMUM ((double)MAX_EPOCH16_1_BINARY, epoch[0]); + if (epoch[0] == MAX_EPOCH16_1_BINARY) + epoch[1] = MINIMUM ((double)MAX_EPOCH16_2_BINARY, epoch[1]); + else + epoch[1] = MINIMUM ((double)MAX_EPOCH16_2_BINARY+1.0, epoch[1]); second_AD = epoch[0]; minute_AD = second_AD / 60.0; @@ -1272,9 +1378,6 @@ *minute = (long) fmod (minute_AD, (double) 60.0); *second = (long) fmod (second_AD, (double) 60.0); - if (epoch[1] < 0.0) epoch[1] = -epoch[1]; - epoch[1] = MINIMUM ((double)MAX_EPOCH_BINARY, epoch[1]); - psec_SC = epoch[1]; *psec = (long) fmod(epoch[1], (double) 1000.0); nsec_SC = psec_SC / 1000.0; diff -urN cdf31-dist.orig/src/lib/libcdf.exp cdf31-dist/src/lib/libcdf.exp --- cdf31-dist.orig/src/lib/libcdf.exp Tue Aug 16 17:57:59 2005 +++ cdf31-dist/src/lib/libcdf.exp Mon Jun 12 22:53:16 2006 @@ -1,97 +1,247 @@ -CDFlib +cdf_attr_create +cdf_attr_entry_inquire +cdf_attr_get +cdf_attr_inquire CDFattrInquire -CDFattrEntryInquire -CDFattrGet -CDFattrPut -CDFvarNum -CDFattrNum -cdf_lib +cdf_attr_num +cdf_attr_put +cdf_attr_rename +cdf_close +cdf_close_cdf +cdf_close_zvar +cdf_confirm_attr_existence +cdf_confirm_gentry_existence +cdf_confirm_rentry_existence +cdf_confirm_zentry_existence +cdf_confirm_zvar_existence +cdf_confirm_zvar_padvalue_exist cdf_create -cdf_open +cdf_create_attr +cdf_create_cdf +CDFcreateCDF +cdf_create_zvar +cdf_delete +cdf_delete_attr +CDFdeleteAttrEntry +cdf_delete_attr_gentry +cdf_delete_attr_rentry +cdf_delete_attr_zentry +cdf_delete_cdf +cdf_delete_zvar +cdf_delete_zvar_recs +cdf_doc cdf_error +CDFgetAttrEntry +CDFgetAttrEntryDataType +CDFgetAttrEntryNumElements +cdf_get_attr_gentry +cdf_get_attr_gentry_datatype +cdf_get_attr_gentry_numelems +CDFgetAttrMaxEntry +cdf_get_attr_max_gentry +cdf_get_attr_max_rentry +cdf_get_attr_max_zentry +cdf_get_attr_name +cdf_get_attr_num +CDFgetAttrNum +cdf_get_attr_num_gentries +cdf_get_attr_num_rentries +cdf_get_attr_num_zentries +cdf_get_attr_rentry +cdf_get_attr_rentry_datatype +cdf_get_attr_rentry_numelems +cdf_get_attr_scope +cdf_get_attr_zentry +cdf_get_attr_zentry_datatype +cdf_get_attr_zentry_numelems +cdf_get_cachesize +cdf_get_compress_cachesize +cdf_get_compression +cdf_get_compression_info +cdf_get_copyright +cdf_get_datatype_size +cdf_get_decoding +cdf_get_encoding +cdf_get_filebackward +cdf_get_format +cdf_get_lib_copyright +cdf_get_lib_version +cdf_get_majority +cdf_get_name +cdf_get_negtoposfp0_mode +CDFgetNumAttrEntries +cdf_get_num_attrs +cdf_get_num_gattrs +cdf_get_num_rvars +cdf_get_num_vattrs +cdf_get_num_zvars +cdf_get_readonly_mode +cdf_getrvarsrecorddata +cdf_get_stage_cachesize +cdf_get_status_text +cdf_get_var_num +CDFgetVarNum +CDFgetVarRecordData +cdf_get_vars_maxwrittenrecnums +CDFgetVarsRecordDatabyNames +cdf_get_version +cdf_get_zmode +cdf_get_zvar_allocrecs +cdf_get_zvar_blockingfactor +cdf_get_zvar_cachesize +cdf_get_zvar_compression +cdf_get_zvar_data +cdf_get_zvar_datatype +cdf_get_zvar_dimsizes +cdf_get_zvar_dimvariances +cdf_get_zvar_maxallocrecnum +cdf_get_zvar_maxwrittenrecnum +cdf_get_zvar_name +cdf_get_zvar_numdims +cdf_get_zvar_numelems +cdf_get_zvar_numrecs_written +cdf_get_zvar_padvalue +cdf_get_zvar_recorddata +cdf_get_zvar_recvariance +cdf_get_zvar_reservepercent +cdf_get_zvar_seqdata +cdf_get_zvar_seqpos +cdf_get_zvars_maxwrittenrecnum +cdf_get_zvar_sparserecords +cdf_getzvarsrecorddata +cdf_get_zvars_recorddata +cdf_hyper_get_zvar_data +cdf_hyper_put_zvar_data cdf_inquire -cdf_doc -cdf_delete -cdf_close +cdf_inquire_attr +CDFinquireAttr +CDFinquireAttrEntry +cdf_inquire_attr_gentry +cdf_inquire_attr_rentry +cdf_inquire_attr_zentry +cdf_inquire_cdf +cdf_inquire_zvar +cdf_lib +CDFlib +cdf_lib_10 +cdf_lib_11 +cdf_lib_12 +cdf_lib_13 +cdf_lib_14 +cdf_lib_15 +cdf_lib_16 +cdf_lib_17 +cdf_lib_18 +cdf_lib_19 +cdf_lib_20 +cdf_lib_21 +cdf_lib_22 +cdf_lib_23 +cdf_lib_24 +cdf_lib_25 +cdf_lib_4 +cdf_lib_5 +cdf_lib_6 +cdf_lib_7 +cdf_lib_8 +cdf_lib_9 +cdf_open +cdf_open_cdf +CDFputAttrEntry +cdf_put_attr_gentry +cdf_put_attr_rentry +cdf_put_attr_zentry +cdf_putrvarsrecorddata +CDFputVarRecordData +CDFputVarsRecordDatabyNames +cdf_put_zvar_data +cdf_put_zvar_recorddata +cdf_put_zvar_seqdata +cdf_putzvarsrecorddata +cdf_put_zvars_recorddata +cdf_rename_attr +cdf_rename_zvar +CDFsetAttrEntryDataSpec +cdf_set_attr_gentry_dataspec +cdf_set_attr_rentry_dataspec +cdf_set_attr_scope +cdf_set_attr_zentry_dataspec +cdf_set_cachesize +cdf_set_compress_cachesize +cdf_set_compression +cdf_set_decoding +cdf_set_encoding +cdf_set_filebackward +cdf_set_format +cdf_set_majority +cdf_set_negtoposfp0_mode +cdf_set_readonly_mode +cdf_set_stage_cachesize +cdf_set_zmode +cdf_set_zvar_allocblockrecs +cdf_set_zvar_allocrecs +cdf_set_zvar_blockingfactor +cdf_set_zvar_cachesize +cdf_set_zvar_compression +cdf_set_zvar_dataspec +cdf_set_zvar_dimvariances +cdf_set_zvar_initialrecs +cdf_set_zvar_padvalue +cdf_set_zvar_recvariance +cdf_set_zvar_reservepercent +cdf_set_zvars_cachesize +cdf_set_zvar_seqpos +cdf_set_zvar_sparserecords +cdf_var_close cdf_var_create -cdf_var_num -cdf_var_inquire -cdf_var_rename cdf_var_get -cdf_var_put cdf_var_hyper_get cdf_var_hyper_put -cdf_var_close -cdf_attr_create -cdf_attr_num -cdf_attr_inquire -cdf_attr_rename -cdf_attr_entry_inquire -cdf_attr_get -cdf_attr_put -EPOCHbreakdown -computeEPOCH -parseEPOCH -parseEPOCH1 -parseEPOCH2 -parseEPOCH3 -encodeEPOCH -encodeEPOCH1 -encodeEPOCH2 -encodeEPOCH3 -encodeEPOCHx -epoch_breakdown +cdf_var_inquire +cdf_var_num +cdf_var_put +cdf_var_rename compute_epoch -parse_epoch -parse_epoch1 -parse_epoch2 -parse_epoch3 +computeEPOCH +compute_epoch16 +computeEPOCH16 encode_epoch +encodeEPOCH encode_epoch1 -encode_epoch2 -encode_epoch3 -encode_epochx -EPOCH16breakdown -computeEPOCH16 -parseEPOCH16 -parseEPOCH16_1 -parseEPOCH16_2 -parseEPOCH16_3 +encodeEPOCH1 +encode_epoch16 encodeEPOCH16 +encode_epoch16_1 encodeEPOCH16_1 +encode_epoch16_2 encodeEPOCH16_2 +encode_epoch16_3 encodeEPOCH16_3 +encode_epoch16_x encodeEPOCH16_x +encode_epoch2 +encodeEPOCH2 +encode_epoch3 +encodeEPOCH3 +encode_epochx +encodeEPOCHx epoch16_breakdown -compute_epoch16 +EPOCH16breakdown +epoch_breakdown +EPOCHbreakdown +parse_epoch +parseEPOCH +parse_epoch1 +parseEPOCH1 parse_epoch16 +parseEPOCH16 parse_epoch16_1 +parseEPOCH16_1 parse_epoch16_2 +parseEPOCH16_2 parse_epoch16_3 -encode_epoch16 -encode_epoch16_1 -encode_epoch16_2 -encode_epoch16_3 -encode_epoch16_x -cdf_lib_4 -cdf_lib_5 -cdf_lib_6 -cdf_lib_7 -cdf_lib_8 -cdf_lib_9 -cdf_lib_10 -cdf_lib_11 -cdf_lib_12 -cdf_lib_13 -cdf_lib_14 -cdf_lib_15 -cdf_lib_16 -cdf_lib_17 -cdf_lib_18 -cdf_lib_19 -cdf_lib_20 -cdf_lib_21 -cdf_lib_22 -cdf_lib_23 -cdf_lib_24 -cdf_lib_25 +parseEPOCH16_3 +parse_epoch2 +parseEPOCH2 +parse_epoch3 +parseEPOCH3 diff -urN cdf31-dist.orig/src/lib/vstream64.c cdf31-dist/src/lib/vstream64.c --- cdf31-dist.orig/src/lib/vstream64.c Mon Aug 15 17:26:44 2005 +++ cdf31-dist/src/lib/vstream64.c Wed Apr 19 16:05:07 2006 @@ -981,39 +981,39 @@ * created. ****************************************************************************/ if (strstr(a_mode,"r+") || strchr(a_mode,'a')) { - long eof; size_t EOFoffsetInBlock; - if (FSEEK(fp,0,vSEEK_END) == EOF) { - FCLOSE (fp); + OFF_T eof, EOFoffsetInBlock; + if (FSEEK64(fp,0,vSEEK_END) == EOF) { + FCLOSE64 (fp); return NULL; } - eof = FTELL (fp); + eof = FTELL64 (fp); if (eof == EOF) { - FCLOSE (fp); + FCLOSE64 (fp); return NULL; } EOFoffsetInBlock = eof % 512; if (EOFoffsetInBlock != 0) { - long offsetToLastBlock; char buffer[512]; size_t numitems; int i; - offsetToLastBlock = 512 * (eof / 512); - if (FSEEK(fp,offsetToLastBlock,vSEEK_SET) == EOF) { - FCLOSE (fp); + OFF_T offsetToLastBlock; char buffer[512]; int i; + offsetToLastBlock = (OFF_T) 512 * (eof / 512); + if (FSEEK64(fp,offsetToLastBlock,vSEEK_SET) == EOF) { + FCLOSE64 (fp); return NULL; } for (i = 0; i < 512; i++) buffer[i] = 0; - if (FREAD(buffer,EOFoffsetInBlock,1,fp) != 1) { - FCLOSE (fp); + if (FREAD64(buffer,EOFoffsetInBlock,1,fp) != 1) { + FCLOSE64 (fp); return NULL; } - if (FSEEK(fp,offsetToLastBlock,vSEEK_SET) == EOF) { - FCLOSE (fp); + if (FSEEK64(fp,offsetToLastBlock,vSEEK_SET) == EOF) { + FCLOSE64 (fp); return NULL; } - if (FWRITE(buffer,512,1,fp) != 1) { - FCLOSE (fp); + if (FWRITE64(buffer,512,1,fp) != 1) { + FCLOSE64 (fp); return NULL; } - if (FCLOSE(fp) == EOF) { - FCLOSE (fp); + if (FCLOSE64(fp) == EOF) { + FCLOSE64 (fp); return NULL; } fp = OpenFile (file_spec, a_mode); diff -urN cdf31-dist.orig/src/tests/qst2fdf.f cdf31-dist/src/tests/qst2fdf.f --- cdf31-dist.orig/src/tests/qst2fdf.f Thu Jan 1 01:00:00 1970 +++ cdf31-dist/src/tests/qst2fdf.f Wed Nov 8 17:36:31 2006 @@ -0,0 +1,611 @@ + PROGRAM QST2F + +C----------------------------------------------------------------------- +C +C NSSDC/CDF Quick Start Test Program (FORTRAN interface). +C +C Version 1.11, 10-Sep-96, Hughes STX. +C +C Modification history: +C +C V1.0 24-Jan-91, J Love Original version (for CDF V2.0). +C V1.1 11-Jan-91, J Love Fixed problem with "max_rec" from +C CDF_INQUIRE and added CDF_INQUIRE +C call after CDF_CREATE. +C V1.2 7-Mar-91, J Love Modified output display. +C V1.3 27-May-91, J Love Changed for CDF V2.1 enhancements. +C V1.4 25-Jun-91, J Love Renamed CDF for portability. +C V1.5 16-Jul-91, J Love Declaration of CDF_var_num and +C CDF_attr_num now in 'cdf.inc'. +C V1.6 26-Sep-91, J Love Modified for IBM-RS6000 port. +C V1.7 20-May-92, J Love CDF V2.2. +C V1.8 9-Aug-93, J Love CDF V2.4. +C V1.8a 22-Feb-94, J Love Limited lines to 72 columns or less. +C V1.9 22-Jun-94, J Love Renamed CDF to `TEST'. +C V1.10 20-Dec-94, J Love CDF V2.5. +C V1.11 10-Sep-96, J Love CDF V2.6. +C V1.12 27-May-05, J Liu CDF V3.1. +C +C----------------------------------------------------------------------- + INCLUDE 'CDFDF.INC' + INCLUDE 'CDFDVF.INC' + INCLUDE 'CDFDVF2.INC' + INCLUDE 'CDFDVF3.INC' + + INTEGER*4 N_DIMS + PARAMETER (N_DIMS = 2) + + INTEGER*4 DIM_1_SIZE + PARAMETER (DIM_1_SIZE = 2) + INTEGER*4 DIM_2_SIZE + PARAMETER (DIM_2_SIZE = 3) + + INTEGER*4 CDF_ID + INTEGER*4 STATUS + INTEGER*4 ENCODING + INTEGER*4 MAJORITY + INTEGER*4 NUM_DIMS + INTEGER*4 DIM_SIZES(N_DIMS) + INTEGER*4 VAR_DATA_TYPE + INTEGER*4 VAR_DATA_TYPE_OUT + INTEGER*4 VAR_NUM_ELEMENTS + INTEGER*4 VAR_NUM_ELEMENTS_OUT + INTEGER*4 VAR_NUM_OUT + INTEGER*4 VAR_VALUES(DIM_1_SIZE,DIM_2_SIZE) + INTEGER*4 INDICES(N_DIMS) + INTEGER*4 REC_NUM + INTEGER*4 VAR_VALUE_OUT + INTEGER*4 REC_START + INTEGER*4 REC_COUNT + INTEGER*4 REC_INTERVAL + INTEGER*4 COUNTS(N_DIMS) + INTEGER*4 INTERVALS(N_DIMS) + INTEGER*4 VAR_BUFFER_OUT(DIM_1_SIZE,DIM_2_SIZE) + INTEGER*4 ATTR_NUM_OUT + INTEGER*4 ENTRY_NUM + INTEGER*4 NUM_ENTRIES_OUT + INTEGER*4 ATTRSCOPE + INTEGER*4 ATTRSCOPE_OUT + INTEGER*4 ENTRY_DATA_TYPE + INTEGER*4 ENTRY_DATA_TYPE_OUT + INTEGER*4 ENTRY_NUM_ELEMENTS + INTEGER*4 ENTRY_NUM_ELEMENTS_OUT + INTEGER*4 ENTRY_VALUE + INTEGER*4 ENTRY_VALUE_OUT + INTEGER*4 ENCODING_OUT + INTEGER*4 MAJORITY_OUT + INTEGER*4 NUM_DIMS_OUT + INTEGER*4 DIM_SIZES_OUT(N_DIMS) + INTEGER*4 MAX_REC_OUT + INTEGER*4 NUM_VARS_OUT + INTEGER*4 NUM_ATTRS_OUT + INTEGER*4 RELEASE + INTEGER*4 VERSION + INTEGER*4 START + INTEGER*4 I + INTEGER*4 LAST_CHAR +C ! last character in "copyright" +C ! (before padding blanks begin) + + INTEGER*4 X1, X2, X + + INTEGER*4 VAR_REC_VARIANCE + INTEGER*4 VAR_REC_VARIANCE_OUT + INTEGER*4 VAR_DIM_VARIANCES(N_DIMS) + INTEGER*4 VAR_DIM_VARIANCES_OUT(N_DIMS) + + CHARACTER VARNAME*(CDF_VAR_NAME_LEN) + CHARACTER NEW_VARNAME*(CDF_VAR_NAME_LEN) + CHARACTER VARNAME_OUT*(CDF_VAR_NAME_LEN) + CHARACTER ATTRNAME*(CDF_ATTR_NAME_LEN) + CHARACTER NEW_ATTRNAME*(CDF_ATTR_NAME_LEN) + CHARACTER ATTRNAME_OUT*(CDF_ATTR_NAME_LEN) + CHARACTER COPYRIGHT_TEXT*(CDF_COPYRIGHT_LEN) + CHARACTER ERRORTEXT*(CDF_STATUSTEXT_LEN) + CHARACTER CDFNAME*(CDF_PATHNAME_LEN) + + CHARACTER LF*1 + + INTEGER*4 YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, MSEC + INTEGER*4 YEAR_OUT, MONTH_OUT, DAY_OUT, + . HOUR_OUT, MINUTE_OUT, SECOND_OUT, MSEC_OUT + REAL*8 EPOCH, EPOCH_OUT + CHARACTER EPSTRING*(EPOCH_STRING_LEN), + . EPSTRING1*(EPOCH1_STRING_LEN), + . EPSTRING2*(EPOCH2_STRING_LEN), + . EPSTRING3*(EPOCH3_STRING_LEN) + CHARACTER EPSTRING_TRUE*(EPOCH_STRING_LEN), + . EPSTRING1_TRUE*(EPOCH1_STRING_LEN), + . EPSTRING2_TRUE*(EPOCH2_STRING_LEN), + . EPSTRING3_TRUE*(EPOCH3_STRING_LEN) + + DATA ENCODING/NETWORK_ENCODING/ + DATA MAJORITY/COL_MAJOR/ + DATA NUM_DIMS/N_DIMS/ + DATA DIM_SIZES/DIM_1_SIZE,DIM_2_SIZE/ + DATA VAR_DATA_TYPE/CDF_INT4/ + DATA VAR_NUM_ELEMENTS/1/ + DATA VAR_REC_VARIANCE/VARY/ + DATA VAR_DIM_VARIANCES/N_DIMS * VARY/ + DATA REC_NUM/1/ + DATA VAR_VALUES/1,2,3,4,5,6/ + DATA REC_START/1/ + DATA REC_COUNT/1/ + DATA REC_INTERVAL/1/ + DATA COUNTS/DIM_1_SIZE,DIM_2_SIZE/ + DATA INTERVALS/N_DIMS * 1/ + DATA ENTRY_NUM/1/ + DATA ATTRSCOPE/GLOBAL_SCOPE/ + DATA ENTRY_DATA_TYPE/CDF_INT4/ + DATA ENTRY_NUM_ELEMENTS/1/ + DATA ENTRY_VALUE/1/ + + DATA CDFNAME(1:4)/'TEST'/ + DATA VARNAME(1:4)/'VAR1'/ + DATA NEW_VARNAME(1:4)/'VAR2'/ + DATA ATTRNAME(1:5)/'ATTR1'/ + DATA NEW_ATTRNAME(1:5)/'ATTR2'/ + + DATA YEAR/1994/, MONTH/10/, DAY/13/, + . HOUR/12/, MINUTE/0/, SECOND/0/, MSEC/0/ + DATA EPSTRING_TRUE/'13-Oct-1994 12:00:00.000'/, + . EPSTRING1_TRUE/'19941013.5000000'/, + . EPSTRING2_TRUE/'19941013120000'/, + . EPSTRING3_TRUE/'1994-10-13T12:00:00.000Z'/ + +C----------------------------------------------------------------------- +C NUL-terminate character strings. +C----------------------------------------------------------------------- + + CDFNAME(5:5) = CHAR(0) + VARNAME(5:5) = CHAR(0) + NEW_VARNAME(5:5) = CHAR(0) + ATTRNAME(6:6) = CHAR(0) + NEW_ATTRNAME(6:6) = CHAR(0) + +C----------------------------------------------------------------------- +C Display test title. +C----------------------------------------------------------------------- + + WRITE (6,100) + 100 FORMAT (' ','Testing Standard/FORTRAN interface...') + +C----------------------------------------------------------------------- +C Create CDF. +C----------------------------------------------------------------------- + + CALL CDF_CREATE (CDFNAME, NUM_DIMS, DIM_SIZES, ENCODING, + . MAJORITY, CDF_ID, STATUS) + + IF (STATUS .LT. CDF_OK) THEN + IF (STATUS .EQ. CDF_EXISTS) THEN + CALL CDF_OPEN (CDFNAME, CDF_ID, STATUS) + IF (STATUS .LT. CDF_OK) + . CALL QUIT_CDF (STATUS, '1.0') + + CALL CDF_DELETE (CDF_ID, STATUS) + IF (STATUS .LT. CDF_OK) + . CALL QUIT_CDF (STATUS, '1.1') + + CALL CDF_CREATE (CDFNAME, NUM_DIMS, DIM_SIZES, + . ENCODING, MAJORITY, CDF_ID, + . STATUS) + IF (STATUS .LT. CDF_OK) + . CALL QUIT_CDF (STATUS, '1.2') + ELSE + CALL QUIT_CDF (STATUS, '1.3') + END IF + END IF + +C----------------------------------------------------------------------- +C Create variable. +C----------------------------------------------------------------------- + CALL CDF_VAR_CREATE (CDF_ID, VARNAME, VAR_DATA_TYPE, + . VAR_NUM_ELEMENTS, VAR_REC_VARIANCE, + . VAR_DIM_VARIANCES, VAR_NUM_OUT, + . STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '2.0') + +C----------------------------------------------------------------------- +C Close CDF. +C----------------------------------------------------------------------- + + CALL CDF_CLOSE (CDF_ID, STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '3.0') + +C----------------------------------------------------------------------- +C Reopen CDF. +C----------------------------------------------------------------------- + + CALL CDF_OPEN (CDFNAME, CDF_ID, STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '4.0') + +C----------------------------------------------------------------------- +C Delete CDF. +C----------------------------------------------------------------------- + + CALL CDF_DELETE (CDF_ID, STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '5.0') + +C----------------------------------------------------------------------- +C Create CDF again (previous delete will allow this). +C----------------------------------------------------------------------- + + CALL CDF_CREATE (CDFNAME, NUM_DIMS, DIM_SIZES, ENCODING, + . MAJORITY, CDF_ID, STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '6.0') + +C----------------------------------------------------------------------- +C Inquire CDF (added for V1.1). +C----------------------------------------------------------------------- + + CALL CDF_INQUIRE (CDF_ID, NUM_DIMS_OUT, DIM_SIZES_OUT, + . ENCODING_OUT, MAJORITY_OUT, + . MAX_REC_OUT, NUM_VARS_OUT, + . NUM_ATTRS_OUT, STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '6a.0') + + IF (NUM_DIMS_OUT .NE. NUM_DIMS) + . CALL QUIT_CDF (STATUS, '6a.1') + + DO X = 1, N_DIMS + IF (DIM_SIZES_OUT(X) .NE. DIM_SIZES(X)) + . CALL QUIT_CDF (STATUS, '6a.2') + END DO + + IF (ENCODING_OUT .NE. ENCODING) + . CALL QUIT_CDF (STATUS, '6a.3') + IF (MAJORITY_OUT .NE. MAJORITY) + . CALL QUIT_CDF (STATUS, '6a.4') + IF (MAX_REC_OUT .NE. 0) CALL QUIT_CDF (STATUS, '6a.5') + IF (NUM_VARS_OUT .NE. 0) CALL QUIT_CDF (STATUS, '6a.6') + IF (NUM_ATTRS_OUT .NE. 0) CALL QUIT_CDF (STATUS, '6a.7') + +C----------------------------------------------------------------------- +C Create variable. +C----------------------------------------------------------------------- + + CALL CDF_VAR_CREATE (CDF_ID, VARNAME, VAR_DATA_TYPE, + . VAR_NUM_ELEMENTS, VAR_REC_VARIANCE, + . VAR_DIM_VARIANCES, VAR_NUM_OUT, + . STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '7.0') + +C----------------------------------------------------------------------- +C PUT to variable. +C----------------------------------------------------------------------- + + DO X1 = 1, DIM_1_SIZE + DO X2 = 1, DIM_2_SIZE + INDICES(1) = X1 + INDICES(2) = X2 + CALL CDF_VAR_PUT (CDF_ID, CDF_VAR_NUM(CDF_ID,VARNAME), + . REC_NUM, INDICES, VAR_VALUES(X1,X2), + . STATUS) + IF (STATUS .LT. CDF_OK) + . CALL QUIT_CDF (STATUS, '8.0') + END DO + END DO + +C----------------------------------------------------------------------- +C GET from the variable. +C----------------------------------------------------------------------- + + DO X1 = 1, DIM_1_SIZE + DO X2 = 1, DIM_2_SIZE + INDICES(1) = X1 + INDICES(2) = X2 + CALL CDF_VAR_GET (CDF_ID, CDF_VAR_NUM(CDF_ID,VARNAME), + . REC_NUM, INDICES, VAR_VALUE_OUT, + . STATUS) + IF (STATUS .LT. CDF_OK) + . CALL QUIT_CDF (STATUS, '9.0') + + IF (VAR_VALUE_OUT .NE. VAR_VALUES(X1,X2)) + . CALL QUIT_CDF (STATUS, '9.1') + END DO + END DO + +C----------------------------------------------------------------------- +C HyperPUT to the variable. +C----------------------------------------------------------------------- + + DO X1 = 1, DIM_1_SIZE + DO X2 = 1, DIM_2_SIZE + VAR_VALUES(X1,X2) = -VAR_VALUES(X1,X2) + END DO + END DO + + INDICES(1) = 1 + INDICES(2) = 1 + + CALL CDF_VAR_HYPER_PUT (CDF_ID, + . CDF_VAR_NUM(CDF_ID,VARNAME), + . REC_START, REC_COUNT, REC_INTERVAL, + . INDICES, COUNTS, INTERVALS, + . VAR_VALUES, STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '10.0') + +C----------------------------------------------------------------------- +C HyperGET from variable. +C----------------------------------------------------------------------- + + CALL CDF_VAR_HYPER_GET (CDF_ID, + . CDF_VAR_NUM(CDF_ID,VARNAME), + . REC_START, REC_COUNT, REC_INTERVAL, + . INDICES, COUNTS, INTERVALS, + . VAR_BUFFER_OUT, STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '11.0') + + DO X1 = 1, DIM_1_SIZE + DO X2 = 1, DIM_2_SIZE + IF (VAR_BUFFER_OUT(X1,X2) .NE. VAR_VALUES(X1,X2)) + . CALL QUIT_CDF (STATUS, '11.1') + END DO + END DO + +C----------------------------------------------------------------------- +C Create attribute. +C----------------------------------------------------------------------- + + CALL CDF_ATTR_CREATE (CDF_ID, ATTRNAME, ATTRSCOPE, + . ATTR_NUM_OUT, STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '12.0') + +C----------------------------------------------------------------------- +C PUT to attribute. +C----------------------------------------------------------------------- + + CALL CDF_ATTR_PUT (CDF_ID, CDF_ATTR_NUM(CDF_ID,ATTRNAME), + . ENTRY_NUM, ENTRY_DATA_TYPE, + . ENTRY_NUM_ELEMENTS, ENTRY_VALUE, + . STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '13.0') + +C----------------------------------------------------------------------- +C GET from attribute. +C----------------------------------------------------------------------- + + CALL CDF_ATTR_GET (CDF_ID, CDF_ATTR_NUM(CDF_ID,ATTRNAME), + . ENTRY_NUM, ENTRY_VALUE_OUT, + . STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '14.0') + + IF (ENTRY_VALUE_OUT .NE. ENTRY_VALUE) + . CALL QUIT_CDF (STATUS, '14.1') + +C----------------------------------------------------------------------- +C Get CDF documentation. +C----------------------------------------------------------------------- + + CALL CDF_DOC (CDF_ID, VERSION, RELEASE, + . COPYRIGHT_TEXT, STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '15.0') + +C WRITE (6,101) VERSION, RELEASE +C 101 FORMAT (' ','CDF V',I1,'.',I1) +C ! V1.2 + LAST_CHAR = CDF_COPYRIGHT_LEN + DO WHILE (COPYRIGHT_TEXT(LAST_CHAR:LAST_CHAR) .EQ. ' ') + LAST_CHAR = LAST_CHAR - 1 + END DO + + LF = CHAR(10) + + START = 1 + DO I = 1, LAST_CHAR + IF (COPYRIGHT_TEXT(I:I) .EQ. LF) THEN +C WRITE (6,301) COPYRIGHT_TEXT(START:I-1) +C 301 FORMAT (' ',A) + START = I + 1 + END IF + END DO + +C----------------------------------------------------------------------- +C Inquire CDF. +C----------------------------------------------------------------------- + + CALL CDF_INQUIRE (CDF_ID, NUM_DIMS_OUT, DIM_SIZES_OUT, + . ENCODING_OUT, MAJORITY_OUT, + . MAX_REC_OUT, NUM_VARS_OUT, + . NUM_ATTRS_OUT, STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '16.0') + + IF (NUM_DIMS_OUT .NE. NUM_DIMS) + . CALL QUIT_CDF (STATUS, '16.1') + + DO X = 1, N_DIMS + IF (DIM_SIZES_OUT(X) .NE. DIM_SIZES(X)) + . CALL QUIT_CDF (STATUS, '16.2') + END DO + + IF (ENCODING_OUT .NE. ENCODING) + . CALL QUIT_CDF (STATUS, '16.3') + IF (MAJORITY_OUT .NE. MAJORITY) + . CALL QUIT_CDF (STATUS, '16.4') + IF (MAX_REC_OUT .NE. 1) CALL QUIT_CDF (STATUS, '16.5') +C ! V1.1 + IF (NUM_VARS_OUT .NE. 1) CALL QUIT_CDF (STATUS, '16.6') + IF (NUM_ATTRS_OUT .NE. 1) CALL QUIT_CDF (STATUS, '16.7') + +C----------------------------------------------------------------------- +C Rename variable. +C----------------------------------------------------------------------- + + CALL CDF_VAR_RENAME (CDF_ID, CDF_VAR_NUM(CDF_ID,VARNAME), + . NEW_VARNAME, STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '17.0') + +C----------------------------------------------------------------------- +C Inquire variable. +C----------------------------------------------------------------------- + + CALL CDF_VAR_INQUIRE (CDF_ID, + . CDF_VAR_NUM(CDF_ID,NEW_VARNAME), + . VARNAME_OUT, VAR_DATA_TYPE_OUT, + . VAR_NUM_ELEMENTS_OUT, + . VAR_REC_VARIANCE_OUT, + . VAR_DIM_VARIANCES_OUT, STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '18.0') + + IF (VARNAME_OUT .NE. NEW_VARNAME(1:4)) + . CALL QUIT_CDF (STATUS, '18.1') + IF (VAR_DATA_TYPE_OUT .NE. VAR_DATA_TYPE) + . CALL QUIT_CDF (STATUS, '18.2') + IF (VAR_NUM_ELEMENTS_OUT .NE. VAR_NUM_ELEMENTS) + . CALL QUIT_CDF (STATUS, '18.3') + IF (VAR_REC_VARIANCE_OUT .NE. VAR_REC_VARIANCE) + . CALL QUIT_CDF (STATUS, '18.4') + + DO X = 1, N_DIMS + IF (VAR_DIM_VARIANCES_OUT(X) .NE. VAR_DIM_VARIANCES(X)) + . CALL QUIT_CDF (STATUS, '18.5') + END DO + +C----------------------------------------------------------------------- +C Close variable. +C----------------------------------------------------------------------- + + CALL CDF_VAR_CLOSE (CDF_ID, + . CDF_VAR_NUM(CDF_ID,NEW_VARNAME), + . STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '19.0') + +C----------------------------------------------------------------------- +C Rename attribute. +C----------------------------------------------------------------------- + + CALL CDF_ATTR_RENAME (CDF_ID, + . CDF_ATTR_NUM(CDF_ID,ATTRNAME), + . NEW_ATTRNAME, STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '20.0') + +C----------------------------------------------------------------------- +C Inquire attribute. +C----------------------------------------------------------------------- + + CALL CDF_ATTR_INQUIRE (CDF_ID, + . CDF_ATTR_NUM(CDF_ID,NEW_ATTRNAME), + . ATTRNAME_OUT, ATTRSCOPE_OUT, + . NUM_ENTRIES_OUT, STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '22.0') + + IF (ATTRNAME_OUT .NE. NEW_ATTRNAME(1:5)) + . CALL QUIT_CDF (STATUS, '22.1') + IF (ATTRSCOPE_OUT .NE. ATTRSCOPE) + . CALL QUIT_CDF (STATUS, '22.2') + IF (NUM_ENTRIES_OUT .NE. 1) + . CALL QUIT_CDF (STATUS, '22.3') + +C----------------------------------------------------------------------- +C Inquire attribute entry. +C----------------------------------------------------------------------- + + CALL CDF_ATTR_ENTRY_INQUIRE (CDF_ID, + . CDF_ATTR_NUM(CDF_ID,NEW_ATTRNAME), + . ENTRY_NUM, + . ENTRY_DATA_TYPE_OUT, + . ENTRY_NUM_ELEMENTS_OUT, + . STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '23.0') + + IF (ENTRY_DATA_TYPE_OUT .NE. ENTRY_DATA_TYPE) + . CALL QUIT_CDF (STATUS, '23.1') + IF (ENTRY_NUM_ELEMENTS_OUT .NE. ENTRY_NUM_ELEMENTS) + . CALL QUIT_CDF (STATUS, '23.2') + +C----------------------------------------------------------------------- +C Get error text. +C----------------------------------------------------------------------- + + CALL CDF_ERROR (CDF_OK, ERRORTEXT, STATUS) + + LAST_CHAR = CDF_ERRTEXT_LEN + DO WHILE (ERRORTEXT(LAST_CHAR:LAST_CHAR) .EQ. ' ') + LAST_CHAR = LAST_CHAR - 1 + END DO + +C WRITE (6,103) ERRORTEXT(1:LAST_CHAR) +C 103 FORMAT (/,' ',A,/) + +C----------------------------------------------------------------------- +C Close CDF. +C----------------------------------------------------------------------- + + CALL CDF_CLOSE (CDF_ID, STATUS) + IF (STATUS .LT. CDF_OK) CALL QUIT_CDF (STATUS, '24.0') + +C----------------------------------------------------------------------- +C Test EPOCH routines. +C----------------------------------------------------------------------- + + CALL COMPUTE_EPOCH (YEAR, MONTH, DAY, HOUR, MINUTE, SECOND, + . MSEC, EPOCH) + + CALL ENCODE_EPOCH (EPOCH, EPSTRING) + IF (EPSTRING .NE. EPSTRING_TRUE) CALL QUIT_EPOCH ('30.0') + + CALL PARSE_EPOCH (EPSTRING, EPOCH_OUT) + IF (EPOCH_OUT .NE. EPOCH) CALL QUIT_EPOCH ('30.1') + + CALL ENCODE_EPOCH1 (EPOCH, EPSTRING1) + IF (EPSTRING1 .NE. EPSTRING1_TRUE) CALL QUIT_EPOCH ('30.2') + + CALL PARSE_EPOCH1 (EPSTRING1, EPOCH_OUT) + IF (EPOCH_OUT .NE. EPOCH) CALL QUIT_EPOCH ('30.3') + + CALL ENCODE_EPOCH2 (EPOCH, EPSTRING2) + IF (EPSTRING2 .NE. EPSTRING2_TRUE) CALL QUIT_EPOCH ('30.4') + + CALL PARSE_EPOCH2 (EPSTRING2, EPOCH_OUT) + IF (EPOCH_OUT .NE. EPOCH) CALL QUIT_EPOCH ('30.5') + + CALL ENCODE_EPOCH3 (EPOCH, EPSTRING3) + IF (EPSTRING3 .NE. EPSTRING3_TRUE) CALL QUIT_EPOCH ('30.6') + + CALL PARSE_EPOCH3 (EPSTRING3, EPOCH_OUT) + IF (EPOCH_OUT .NE. EPOCH) CALL QUIT_EPOCH ('30.7') + + CALL EPOCH_BREAKDOWN (EPOCH, YEAR_OUT, MONTH_OUT, DAY_OUT, + . HOUR_OUT, MINUTE_OUT, SECOND_OUT, + . MSEC_OUT) + IF (YEAR_OUT .NE. YEAR) CALL QUIT_EPOCH ('32.1') + IF (MONTH_OUT .NE. MONTH) CALL QUIT_EPOCH ('32.2') + IF (DAY_OUT .NE. DAY) CALL QUIT_EPOCH ('32.3') + IF (HOUR_OUT .NE. HOUR) CALL QUIT_EPOCH ('32.4') + IF (MINUTE_OUT .NE. MINUTE) CALL QUIT_EPOCH ('32.5') + IF (SECOND_OUT .NE. SECOND) CALL QUIT_EPOCH ('32.6') + IF (MSEC_OUT .NE. MSEC) CALL QUIT_EPOCH ('32.7') + +C----------------------------------------------------------------------- + + END + +C----------------------------------------------------------------------- +C QUIT_CDF. Abort test early due to CDF error. +C----------------------------------------------------------------------- + + SUBROUTINE QUIT_CDF (STATUS, WHERE) + INTEGER*4 STATUS + CHARACTER WHERE*(*) + WRITE (6,401) WHERE + 401 FORMAT (' ', 'Aborting at ', A, '...') + IF (STATUS .LT. 0) THEN + WRITE (6,501) STATUS + 501 FORMAT (' ', 'CDF status code: ', I5) + ENDIF + WRITE (6,404) + 404 FORMAT (' ','...test aborted') + STOP + END + +C----------------------------------------------------------------------- +C QUIT_EPOCH. Abort test early due to EPOCH error. +C----------------------------------------------------------------------- + + SUBROUTINE QUIT_EPOCH (WHERE) + CHARACTER WHERE*(*) + WRITE (6,402) WHERE + 402 FORMAT (' ', 'Aborting at ', A, '...test aborted') + STOP + END diff -urN cdf31-dist.orig/src/tests/qst2icEPOCH16.c cdf31-dist/src/tests/qst2icEPOCH16.c --- cdf31-dist.orig/src/tests/qst2icEPOCH16.c Mon Aug 15 17:26:44 2005 +++ cdf31-dist/src/tests/qst2icEPOCH16.c Wed Oct 4 18:09:48 2006 @@ -81,8 +81,8 @@ msec=100, usec=200, nsec=300, psec=400; static long yearOut, monthOut, dayOut, hourOut, minuteOut, secondOut, msecOut, usecOut, nsecOut, psecOut; -static double epoch[2], epochOut[2], mmm; -static double epochHyper[4][2], epochHyperOut[4][2]; +static double epoch16[2], epoch16Save[2], epoch16Out[2], mmm; +static double epoch16Hyper[4][2], epoch16HyperOut[4][2]; static long yearHyper[4], monthHyper[4], dayHyper[4], hourHyper[4], minuteHyper[4], secondHyper[4], msecHyper[4], usecHyper[4], nsecHyper[4], psecHyper[4]; @@ -146,17 +146,47 @@ if (status < CDF_OK) QuitCDF ("8.0z", status); mmm = computeEPOCH16 (year, month, day, hour, minute, second, msec, usec, - nsec,psec, epoch); -if (mmm == ILLEGAL_EPOCH_VALUE) printf("***** error 1\n"); -encodeEPOCH16_x (epoch, "-- ::.", + nsec,psec, epoch16); +if (mmm == ILLEGAL_EPOCH_VALUE) printf("***** error 0\n"); + +epoch16Save[0] = epoch16[0]; +epoch16Save[1] = epoch16[1]; + +encodeEPOCH16_x (epoch16, "-- ::.", encodeText); printf("encodeEPOCH16_x: %s\n",encodeText); -encodeEPOCH16_x (epoch, +encodeEPOCH16_x (epoch16, "-- ::.:::", encodeText); printf("encodeEPOCH16_x: %s\n",encodeText); +encodeEPOCH16_1 (epoch16, encodeText); +printf("1. encodeEPOCH16_1: %s\n",encodeText); +mmm = parseEPOCH16_1 (encodeText, epoch16); +if (mmm == ILLEGAL_EPOCH_VALUE) printf("***** error 1\n"); +encodeEPOCH16_1 (epoch16, encodeText); +printf("2. parseEPOCH16_1: %s\n",encodeText); - status = CDFlib (PUT_, zVAR_DATA_, epoch, +epoch16[0] = epoch16Save[0]; +epoch16[1] = epoch16Save[1]; +encodeEPOCH16_2 (epoch16, encodeText); +printf("3. encodeEPOCH16_2: %s\n",encodeText); +mmm = parseEPOCH16_2 (encodeText, epoch16); +if (mmm == ILLEGAL_EPOCH_VALUE) printf("***** error 2\n"); +encodeEPOCH16_2 (epoch16, encodeText); +printf("4. parseEPOCH16_2: %s\n",encodeText); + +epoch16[0] = epoch16Save[0]; +epoch16[1] = epoch16Save[1]; +encodeEPOCH16_3 (epoch16, encodeText); +printf("5. encodeEPOCH16_3: %s\n",encodeText); +mmm = parseEPOCH16_3 (encodeText, epoch16); +if (mmm == ILLEGAL_EPOCH_VALUE) printf("***** error 3\n"); +encodeEPOCH16_3 (epoch16, encodeText); +printf("6. parseEPOCH16_3: %s\n",encodeText); + +epoch16[0] = epoch16Save[0]; +epoch16[1] = epoch16Save[1]; + status = CDFlib (PUT_, zVAR_DATA_, epoch16, NULL_); if (status < CDF_OK) QuitCDF ("8.1z", status); @@ -164,11 +194,11 @@ * GET from the variables. ******************************************************************************/ - status = CDFlib (GET_, zVAR_DATA_, epochOut, + status = CDFlib (GET_, zVAR_DATA_, epoch16Out, NULL_); if (status < CDF_OK) QuitCDF ("9.1z", status); - EPOCH16breakdown (epoch, &yearOut, &monthOut, &dayOut, &hourOut, + EPOCH16breakdown (epoch16, &yearOut, &monthOut, &dayOut, &hourOut, &minuteOut, &secondOut, &msecOut, &usecOut,&nsecOut, &psecOut); if (year != yearOut) QuitCDF("9.2a", status); @@ -206,10 +236,10 @@ mmm = computeEPOCH16 (yearHyper[x0], monthHyper[x0], dayHyper[x0], hourHyper[x0], minuteHyper[x0], secondHyper[x0], msecHyper[x0], usecHyper[x0], nsecHyper[x0], - psecHyper[x0], epoch); + psecHyper[x0], epoch16); if (mmm == ILLEGAL_EPOCH_VALUE) printf("***** error 2\n"); - epochHyper[x0][0] = epoch[0]; - epochHyper[x0][1] = epoch[1]; + epoch16Hyper[x0][0] = epoch16[0]; + epoch16Hyper[x0][1] = epoch16[1]; } status = CDFlib (SELECT_, zVAR_RECNUMBER_, 1L, @@ -218,7 +248,7 @@ zVAR_DIMINDICES_, zIndicesA, zVAR_DIMCOUNTS_, zCounts, zVAR_DIMINTERVALS_, zIntervals, - PUT_, zVAR_HYPERDATA_, epochHyper, + PUT_, zVAR_HYPERDATA_, epoch16Hyper, NULL_); if (status < CDF_OK) QuitCDF ("10.0z", status); @@ -226,7 +256,7 @@ * HyperGET from variables. ******************************************************************************/ -status = CDFlib (GET_, zVAR_HYPERDATA_, epochHyperOut, +status = CDFlib (GET_, zVAR_HYPERDATA_, epoch16HyperOut, NULL_); if (status < CDF_OK) QuitCDF ("11.0z", status); @@ -238,10 +268,10 @@ NULL_); if (status < CDF_OK) QuitCDF ("8.0z", status); - status = CDFlib (GET_, zVAR_DATA_, epochOut, + status = CDFlib (GET_, zVAR_DATA_, epoch16Out, NULL_); */ - EPOCH16breakdown (epochHyperOut[x0], &yearOut, &monthOut, &dayOut, &hourOut, + EPOCH16breakdown (epoch16HyperOut[x0], &yearOut, &monthOut, &dayOut, &hourOut, &minuteOut, &secondOut, &msecOut, &usecOut, &nsecOut, &psecOut); yearHyperOut[x0] = yearOut; diff -urN cdf31-dist.orig/src/tools/cdf2skt.c cdf31-dist/src/tools/cdf2skt.c --- cdf31-dist.orig/src/tools/cdf2skt.c Tue Jan 24 20:03:57 2006 +++ cdf31-dist/src/tools/cdf2skt.c Mon Oct 16 16:03:53 2006 @@ -21,6 +21,8 @@ * V1.4 26-Aug-96, J Love CDF V2.6. * V1.4a 24-Feb-97, J Love Removed RICE. Fixed `values' qualifier. * V1.4b 18-Nov-97, J Love Windows NT/Visual C++. +* V1.5 13-Oct-06, M Liu Changed to allow upper and lower case CDF +* name to be used on win32. * ******************************************************************************/ @@ -137,7 +139,7 @@ if (qop->qualEntered[SKTqual]) strcpyX (SKTpath, qop->qualOpt[SKTqual], DU_MAX_PATH_LEN); else { - if (EndsWithIgCase(CDFname, ".cdf")) + if (EndsWithIgCase(CDFname, ".cdf") != 0) RemoveCDFFileExtension (CDFname, SKTpath); else strcpyX (SKTpath, CDFname, DU_MAX_PATH_LEN); @@ -170,13 +172,13 @@ } if (qop->qualEntered[VALUESqual]) { size_t len = strlen(qop->qualOpt[VALUESqual]); - if (!strcmpIgCase(qop->qualOpt[VALUESqual],"none")) + if (strcmpIgCase(qop->qualOpt[VALUESqual],"none") != 0) varValues = NOvalues; - else if (!strcmpIgCase(qop->qualOpt[VALUESqual],"nrv")) + else if (strcmpIgCase(qop->qualOpt[VALUESqual],"nrv") != 0) varValues = NRVvalues; - else if (!strcmpIgCase(qop->qualOpt[VALUESqual],"rv")) + else if (strcmpIgCase(qop->qualOpt[VALUESqual],"rv") != 0) varValues = RVvalues; - else if (!strcmpIgCase(qop->qualOpt[VALUESqual],"all")) + else if (strcmpIgCase(qop->qualOpt[VALUESqual],"all") != 0) varValues = ALLvalues; else { varValues = NAMEDvalues; diff -urN cdf31-dist.orig/src/tools/cdfcmp.c cdf31-dist/src/tools/cdfcmp.c --- cdf31-dist.orig/src/tools/cdfcmp.c Tue Jan 24 16:29:43 2006 +++ cdf31-dist/src/tools/cdfcmp.c Thu Nov 2 23:12:29 2006 @@ -37,6 +37,8 @@ * V2.8 26-Jan-02, M Liu Correct dimension sizes for zVariables. * V2.9 17-Jun-02, M Liu Added tolerance option for float/double values * comparison. +* V2.10 13-Oct-06, M Liu Changed to allow upper and lower case CDF +* name to be used on win32. * ******************************************************************************/ @@ -106,8 +108,8 @@ Logical displayValue; long workingCache, stageCache, compressCache; Logical floatSet = FALSE, doubleSet = FALSE; -float floatTolerance; -double doubleTolerance; +float floatTolerance = (float) 0.0; +double doubleTolerance = (double) 0.0; /****************************************************************************** * Main. @@ -1387,7 +1389,10 @@ if (!StatusHandlerCmp("CDF2",status)) return FALSE; if (memcmp(entryValue1,entryValue2,(size_t)Nbytes) != 0) { - if ((entryDataType1 == CDF_CHAR || entryDataType1 == CDF_UCHAR) || + if ((entryDataType1 == CDF_CHAR || entryDataType1 == CDF_UCHAR || + entryDataType1 == CDF_INT1 || entryDataType1 == CDF_INT2 || + entryDataType1 == CDF_INT4 || entryDataType1 == CDF_UINT1 || + entryDataType1 == CDF_UINT2 || entryDataType1 == CDF_UINT4) || (!floatSet && (entryDataType1 == CDF_FLOAT || entryDataType1 == CDF_REAL4)) || (!doubleSet && (entryDataType1 == CDF_REAL8 || @@ -1847,7 +1852,10 @@ if (status2 != NO_PADVALUE_SPECIFIED) { if (!StatusHandlerCmp("CDF2",status2)) return FALSE; if (memcmp(padValue1,padValue2,(size_t)NvalueBytes) != 0) { - if ((varDataType1 == CDF_CHAR || varDataType1 == CDF_UCHAR) || + if ((varDataType1 == CDF_CHAR || varDataType1 == CDF_UCHAR || + varDataType1 == CDF_INT1 || varDataType1 == CDF_INT2 || + varDataType1 == CDF_INT4 || varDataType1 == CDF_UINT1 || + varDataType1 == CDF_UINT2 || varDataType1 == CDF_UINT4) || (!floatSet && (varDataType1 == CDF_FLOAT || varDataType1 == CDF_REAL4)) || (!doubleSet && (varDataType1 == CDF_REAL8 || @@ -1959,7 +1967,10 @@ valueN < nValues; valueN++, value1 += (size_t)NvalueBytes, value2 += (size_t)NvalueBytes) { if (memcmp(value1,value2,(size_t)NvalueBytes)) { - if ((varDataType1 == CDF_CHAR || varDataType1 == CDF_UCHAR) || + if ((varDataType1 == CDF_CHAR || varDataType1 == CDF_UCHAR || + varDataType1 == CDF_INT1 || varDataType1 == CDF_INT2 || + varDataType1 == CDF_INT4 || varDataType1 == CDF_UINT1 || + varDataType1 == CDF_UINT2 || varDataType1 == CDF_UINT4) || (!floatSet && (varDataType1 == CDF_FLOAT || varDataType1 == CDF_REAL4)) || (!doubleSet && (varDataType1 == CDF_REAL8 || @@ -2041,7 +2052,10 @@ valueN < nValues; valueN++, value1 += (size_t)NvalueBytes, value2 += (size_t)NvalueBytes) { if (memcmp(value1,value2,(size_t)NvalueBytes)) { - if ((varDataType1 == CDF_CHAR || varDataType1 == CDF_UCHAR) || + if ((varDataType1 == CDF_CHAR || varDataType1 == CDF_UCHAR || + varDataType1 == CDF_INT1 || varDataType1 == CDF_INT2 || + varDataType1 == CDF_INT4 || varDataType1 == CDF_UINT1 || + varDataType1 == CDF_UINT2 || varDataType1 == CDF_UINT4) || (!floatSet && (varDataType1 == CDF_FLOAT || varDataType1 == CDF_REAL4)) || (!doubleSet && (varDataType1 == CDF_REAL8 || @@ -2113,7 +2127,10 @@ NULL_); if (!StatusHandlerCmp("CDF2",status2)) return FALSE; if (memcmp(value1,value2,(size_t)NvalueBytes)) { - if ((varDataType1 == CDF_CHAR || varDataType1 == CDF_UCHAR) || + if ((varDataType1 == CDF_CHAR || varDataType1 == CDF_UCHAR || + varDataType1 == CDF_INT1 || varDataType1 == CDF_INT2 || + varDataType1 == CDF_INT4 || varDataType1 == CDF_UINT1 || + varDataType1 == CDF_UINT2 || varDataType1 == CDF_UINT4) || (!floatSet && (varDataType1 == CDF_FLOAT || varDataType1 == CDF_REAL4)) || (!doubleSet && (varDataType1 == CDF_REAL8 || @@ -2439,8 +2456,8 @@ for (i = 0; i <= Ncommas; i++) { if (*ptr == 'f' || *ptr == 'F') { ptr = ptr + 2; - if (!strncmpIgCase(ptr, "default", 7) || - !strncmpIgCase(ptr, "def", 3)) { + if ((strncmpIgCase(ptr, "default", 7) != 0) || + (strncmpIgCase(ptr, "def", 3) != 0)) { *floatSet = TRUE; *floatValueAddr = (float) DEFAULT_FLOAT_TOLERANCE; } else { @@ -2451,8 +2468,8 @@ } } else if (*ptr == 'd' || *ptr == 'D') { ptr = ptr + 2; - if (!strncmpIgCase(ptr, "default", 7) || - !strncmpIgCase(ptr, "def", 3)) { + if ((strncmpIgCase(ptr, "default", 7) != 0) || + (strncmpIgCase(ptr, "def", 3) != 0)) { *doubleSet = TRUE; *doubleValueAddr = (double) DEFAULT_DOUBLE_TOLERANCE; } else { diff -urN cdf31-dist.orig/src/tools/cdfcvt.c cdf31-dist/src/tools/cdfcvt.c --- cdf31-dist.orig/src/tools/cdfcvt.c Tue Feb 21 16:00:40 2006 +++ cdf31-dist/src/tools/cdfcvt.c Mon Oct 16 16:06:53 2006 @@ -24,6 +24,8 @@ * V2.5c 14-Dec-97, J Love Added ALPHAVMSi encoding. * V2.6 17-Apr-01, M Liu Added checking for variable names entered in * the compression option +* V2.7 13-Oct-06, M Liu Changed to allow upper and lower case CDF +* name to be used on win32. * ******************************************************************************/ #include "cdfcvt.h" @@ -498,8 +500,13 @@ &cSize, &uSize, NULL_); if (!StatusHandlerCvt("SRC",status)) return FALSE; - if ((cSize >= (((OFF_T) 1L) << 31) - 1) || - (uSize >= (((OFF_T) 1L) << 31) - 1)) { +#if defined(win32) + if ((cSize >= (OFF_T) ((1i64 << 31) - 1)) || + (uSize >= (OFF_T) ((1i64 << 31) - 1))) { +#else + if ((cSize >= (OFF_T) ((1LL << 31) - 1)) || + (uSize >= (OFF_T) ((1LL << 31) - 1))) { +#endif WriteOut (stdout, "Soruce file size: "); #if !defined(win32) sprintf (text, "cSize(%lld) uSize(%lld)", cSize, uSize); @@ -1233,7 +1240,7 @@ p2 = strchr (p1, ':'); if (p2 == NULL) { BADs(S) } *p2 = NUL; - if (!strcmpIgCase(p1,"vars")) { + if (strcmpIgCase(p1,"vars") != 0) { p1 = p2 + 1; if (!ParseSparsenessToken(&p1,&p2,&(S->VARs.sRecordsType),&done)) { BADs(S) @@ -1242,7 +1249,7 @@ p1 = p2 + 1; continue; } - if (!strcmpIgCase(p1,"var")) { + if (strcmpIgCase(p1,"var") != 0) { nBytes = sizeof(struct sRecordsVarStruct); Var = (struct sRecordsVarStruct *) cdf_AllocateMemory (nBytes, FatalError); Var->name = NULL; @@ -1293,15 +1300,15 @@ **p2 = NUL; } sToken = *p1; - if (!strcmpIgCase(sToken,"sRecords.PAD")) { + if (strcmpIgCase(sToken,"sRecords.PAD") != 0) { *sRecordsType = PAD_SPARSERECORDS; return TRUE; } - if (!strcmpIgCase(sToken,"sRecords.PREV")) { + if (strcmpIgCase(sToken,"sRecords.PREV") != 0) { *sRecordsType = PREV_SPARSERECORDS; return TRUE; } - if (!strcmpIgCase(sToken,"sRecords.NO")) { + if (strcmpIgCase(sToken,"sRecords.NO") != 0) { *sRecordsType = NO_SPARSERECORDS; return TRUE; } @@ -1353,7 +1360,7 @@ p2 = strchr (p1, ':'); if (p2 == NULL) { BADc(C) } *p2 = NUL; - if (!strcmpIgCase(p1,"cdf")) { + if (strcmpIgCase(p1,"cdf") != 0) { p1 = p2 + 1; if (!ParseCompressionTokenAndBF(&p1,&p2, &(C->CDF.cType), @@ -1363,7 +1370,7 @@ p1 = p2 + 1; continue; } - if (!strcmpIgCase(p1,"vars")) { + if (strcmpIgCase(p1,"vars") != 0) { p1 = p2 + 1; if (!ParseCompressionTokenAndBF(&p1,&p2, &(C->VARs.cType), @@ -1375,7 +1382,7 @@ p1 = p2 + 1; continue; } - if (!strcmpIgCase(p1,"var")) { + if (strcmpIgCase(p1,"var") != 0) { nBytes = sizeof(struct cVarStruct); Var = (struct cVarStruct *) cdf_AllocateMemory (nBytes, FatalError); Var->name = NULL; @@ -1440,28 +1447,28 @@ count = sscanf (p+1, "%ld:%ld", &v1, &v2); if (count < 1) return FALSE; } - if (!strcmpIgCase(cToken,"none")) { + if (strcmpIgCase(cToken,"none") != 0) { if (count > 0) return FALSE; *cType = NO_COMPRESSION; ASSIGNnotNULL (bf, 0) ASSIGNnotNULL (reserve, 0) return TRUE; } - if (!strcmpIgCase(cToken,"rle.0")) { + if (strcmpIgCase(cToken,"rle.0") != 0) { *cType = RLE_COMPRESSION; cParms[0] = RLE_OF_ZEROs; ASSIGNnotNULL (bf, BOO(count > 0,v1,0)) ASSIGNnotNULL (reserve, BOO(count > 1,v2,0)) return TRUE; } - if (!strcmpIgCase(cToken,"huff.0")) { + if (strcmpIgCase(cToken,"huff.0") != 0) { *cType = HUFF_COMPRESSION; cParms[0] = OPTIMAL_ENCODING_TREES; ASSIGNnotNULL (bf, BOO(count > 0,v1,0)) ASSIGNnotNULL (reserve, BOO(count > 1,v2,0)) return TRUE; } - if (!strcmpIgCase(cToken,"ahuff.0")) { + if (strcmpIgCase(cToken,"ahuff.0") != 0) { *cType = AHUFF_COMPRESSION; cParms[0] = OPTIMAL_ENCODING_TREES; ASSIGNnotNULL (bf, BOO(count > 0,v1,0)) @@ -1471,7 +1478,7 @@ for (level = 1; level <= 9; level++) { char gzipToken[MAX_GZIP_TOKEN_LEN+1]; sprintf (gzipToken, "gzip.%d", level); - if (!strcmpIgCase(cToken,gzipToken)) { + if (strcmpIgCase(cToken,gzipToken) != 0) { *cType = GZIP_COMPRESSION; cParms[0] = level; ASSIGNnotNULL (bf, BOO(count > 0,v1,0)) @@ -1480,7 +1487,7 @@ } } /* - if (!strcmpIgCase(cToken,"zlib.0")) { + if (strcmpIgCase(cToken,"zlib.0") != 0) { *cType = ZLIB_COMPRESSION; cParms[0] = ZLIB_OF_ZEROs; ASSIGNnotNULL (bf, BOO(count > 0,v1,0)) diff -urN cdf31-dist.orig/src/tools/cdfdump.c cdf31-dist/src/tools/cdfdump.c --- cdf31-dist.orig/src/tools/cdfdump.c Thu Feb 9 17:15:20 2006 +++ cdf31-dist/src/tools/cdfdump.c Fri Aug 25 16:39:13 2006 @@ -70,7 +70,6 @@ long usedBytes, wastedBytes; long fileSize = -1; OFF_T fileSize64 = -1; -Logical noMore = FALSE; OFF_T usedBytes64, wastedBytes64; FILE *OUTfp; Logical EOFok; /* When TRUE, an EOF is expected. */ @@ -382,7 +381,7 @@ if (!SeekTo(CDFfp,offset,vSEEK_SET)) return; for (;;) { EOFok = TRUE; - if (offset == fileSize || noMore) return; + if (offset == fileSize) return; if (!Read4(CDFfp,&recordSize)) return; EOFok = FALSE; if (recordSize <= 0) { @@ -404,7 +403,7 @@ case VXR_: strcpyX (text, "VXR", MAX_SCREENLINE_LEN); break; case VVR_: strcpyX (text, "VVR", MAX_SCREENLINE_LEN); break; case CVVR_: strcpyX (text, "CVVR", MAX_SCREENLINE_LEN); break; - case CPR_: strcpyX (text, "CPR", MAX_SCREENLINE_LEN); noMore = TRUE; break; + case CPR_: strcpyX (text, "CPR", MAX_SCREENLINE_LEN); break; case SPR_: strcpyX (text, "SPR", MAX_SCREENLINE_LEN); break; case UIR_: strcpyX (text, "UIR", MAX_SCREENLINE_LEN); break; default: { @@ -467,7 +466,7 @@ case VXR_: strcpyX (text, "VXR", MAX_SCREENLINE_LEN); break; case VVR_: strcpyX (text, "VVR", MAX_SCREENLINE_LEN); break; case CVVR_: strcpyX (text, "CVVR", MAX_SCREENLINE_LEN); break; - case CPR_: strcpyX (text, "CPR", MAX_SCREENLINE_LEN); noMore = TRUE; break; + case CPR_: strcpyX (text, "CPR", MAX_SCREENLINE_LEN); break; case SPR_: strcpyX (text, "SPR", MAX_SCREENLINE_LEN); break; case UIR_: strcpyX (text, "UIR", MAX_SCREENLINE_LEN); break; default: { @@ -535,7 +534,7 @@ *************************************************************************/ offset = V_tell (CDFfp); EOFok = TRUE; - if (offset == fileSize || noMore) return; + if (offset == fileSize) return; if (!Read4(CDFfp,&recordSize)) return; EOFok = FALSE; if (recordSize <= 0) { @@ -567,7 +566,7 @@ case VXR_: strcatX (text, "(VXR)\n", MAX_SCREENLINE_LEN); break; case VVR_: strcatX (text, "(VVR)\n", MAX_SCREENLINE_LEN); break; case CVVR_: strcatX (text, "(CVVR)\n", MAX_SCREENLINE_LEN); break; - case CPR_: strcatX (text, "(CPR)\n", MAX_SCREENLINE_LEN); noMore = TRUE; break; + case CPR_: strcatX (text, "(CPR)\n", MAX_SCREENLINE_LEN); break; case SPR_: strcatX (text, "(SPR)\n", MAX_SCREENLINE_LEN); break; case UIR_: strcatX (text, "(UIR)\n", MAX_SCREENLINE_LEN); break; default: { @@ -1130,7 +1129,6 @@ offset = offset + recordSize; if (!SeekTo(CDFfp,offset,vSEEK_SET)) return; usedBytes += recordSize; - noMore = TRUE; break; } /********************************************************************** @@ -1266,7 +1264,7 @@ *************************************************************************/ offset = V_tell64 (CDFfp); EOFok = TRUE; - if (noMore || offset == fileSize64) return; + if (offset == fileSize64) return; if (!Read8(CDFfp,&recordSize)) return; EOFok = FALSE; if (recordSize <= (OFF_T) 0) { @@ -1310,11 +1308,11 @@ case VXR_: strcatX (text, "(VXR)\n", MAX_SCREENLINE_LEN); break; case VVR_: strcatX (text, "(VVR)\n", MAX_SCREENLINE_LEN); break; case CVVR_: strcatX (text, "(CVVR)\n", MAX_SCREENLINE_LEN); break; - case CPR_: strcatX (text, "(CPR)\n", MAX_SCREENLINE_LEN); noMore = TRUE; break; + case CPR_: strcatX (text, "(CPR)\n", MAX_SCREENLINE_LEN); break; case SPR_: strcatX (text, "(SPR)\n", MAX_SCREENLINE_LEN); break; case UIR_: strcatX (text, "(UIR)\n", MAX_SCREENLINE_LEN); break; default: { - if (offset == fileSize64 || noMore) + if (offset == fileSize64) sprintf (text, "EOF encountered.\n"); else { sprintf (text, "Illegal record type detected (%ld) (@ %s)\n", @@ -1875,7 +1873,6 @@ offset = offset + recordSize; if (!SeekTo64(CDFfp,offset,vSEEK_SET)) return; usedBytes64 += recordSize; - noMore = TRUE; break; } /********************************************************************** diff -urN cdf31-dist.orig/src/tools/cdfedit.c cdf31-dist/src/tools/cdfedit.c --- cdf31-dist.orig/src/tools/cdfedit.c Mon Nov 28 16:38:24 2005 +++ cdf31-dist/src/tools/cdfedit.c Mon Oct 16 16:05:03 2006 @@ -22,6 +22,8 @@ * V1.3a 21-Feb-97, J Love Removed RICE. * V1.4b 16-Nov-97, J Love Windows NT/Visual C++. * V1.5 11-Jul-05, M Liu Added MingW port for PC. +* V1.6 13-Oct-06, M Liu Changed to allow upper and lower case CDF +* name to be used on win32. * ******************************************************************************/ @@ -632,7 +634,7 @@ CDFfullName, delim); helpID = CREATECDFV23helpID; } - if (ConfirmWindow(3,78,question,NULL,TRUE,helpID)) { + if (ConfirmWindow2(3,78,question,NULL,TRUE,helpID)) { if (!CreateCDF(CDFdir,CDFname,zMode, useFormat,negToPosFp0, workingCache, stageCache, diff -urN cdf31-dist.orig/src/tools/cdfedit3.c cdf31-dist/src/tools/cdfedit3.c --- cdf31-dist.orig/src/tools/cdfedit3.c Tue Nov 22 22:33:11 2005 +++ cdf31-dist/src/tools/cdfedit3.c Thu Jun 22 23:04:09 2006 @@ -183,6 +183,62 @@ static char label[] = " Confirmation "; static char *header[] = { NULL, NULL }; AOSs1 (trailer, "Select: ________ Exit: ________ Help: ________") + static char *items[] = { + "", + " ", + "" + }; + static int iLineNs[] = { 1, 1 }; + static int iCols[] = { 18, 53 }; + static int iLens[] = { 5, 4 }; + static int exitChars[] = { ENTERkey_FSI, EXITkey_FSI, HELPkey_FSI, NUL }; + static struct ItemWindowStruct IWt = { + 0, 0, 0, label, 0, header, 3, items, 2, iLineNs, iCols, iLens, 3, + 1, trailer, exitChars, REFRESHkey_FSI, FALSE + }; + Logical answer; + EncodeKeyDefinitions (1, trailer, ENTERkey_FSI, EXITkey_FSI, + HELPkey_FSI); + IWt.hLines[0] = question1; + IWt.NhLines = 1; + if (question2 != NULL) { + header[1] = question2; + IWt.NhLines = 2; + } + IWt.ULrow = rowN; + IWt.ULcol = (SCREEN_WIDTH - width) / 2; + IWt.nColsTotal = width; + ItemWindow (NEWiw, &IWt, BOO(yesInitial,0,1)); + if (EnterIW(&IWt,helpId)) + switch (IWt.itemN) { + case 0: + answer = TRUE; + break; + case 1: + answer = FALSE; + break; + } + else + answer = FALSE; + ItemWindow (DELETEiw, &IWt); + return answer; +} + +/****************************************************************************** +* ConfirmWindow2. +******************************************************************************/ + +Logical ConfirmWindow2 (rowN, width, question1, question2, yesInitial, helpId) +int rowN; +int width; +char *question1; +char *question2; /* If NULL, a one line question. */ +Logical yesInitial; /* If TRUE, is initial current item. */ +int helpId; +{ + static char label[] = " Confirmation "; + static char *header[] = { NULL, NULL }; + AOSs1 (trailer, "Select: ________ Exit: ________ Help: ________") static char *items1[] = { "", " ", diff -urN cdf31-dist.orig/src/tools/cdfmerge.c cdf31-dist/src/tools/cdfmerge.c --- cdf31-dist.orig/src/tools/cdfmerge.c Thu Jan 1 01:00:00 1970 +++ cdf31-dist/src/tools/cdfmerge.c Thu Sep 7 21:44:56 2006 @@ -0,0 +1,1099 @@ +/****************************************************************************** +* +* NSSDC/CDF AddAttributes - Add variable attributes. +* +* Version 1.0, 9-Jul-06, Raytheon. +* +* Modification history: +* +* V1.0 09-Jul-06, M Liu Original version. +* +******************************************************************************/ + +#include "cdfmerge.h" +static CDFid id, ido; + +/****************************************************************************** +* Main. +******************************************************************************/ + +MAIN { + Logical success = TRUE; + strcpyX (pgmName, "CDFmerge", MAX_PROGRAM_NAME_LEN); + success = MergeCDFs (argc, argv); + return BOO(success,EXIT_SUCCESS_,EXIT_FAILURE_); +} + +/****************************************************************************** +* MergeCDFs. +******************************************************************************/ + +Logical MergeCDFs (argC, argV) +int argC; +char *argV[]; +{ + +CDFstatus status, status1; +long numDims, dimSizes[CDF_MAX_DIMS], dimVarys[CDF_MAX_DIMS]; +long majority, encoding, format, + numzVars, numAttrs, numgAttrs, numvAttrs, numgEntries, + numzEntries, major, reservePct; +long varNum, attrNum, dataType, numElems, scope, recVary, dataTypeX, numElemsX, + dataTypeY, numElemsY; +long cType, cParms[CDF_MAX_DIMS], cPct; +long maxRec, varMaxRec, sp, bf, maxAllocRec, fromRec, toRec, fromRec2, toRec2, + nRecords, hyperStep; +long nValuesPerRec, maxGentry = 0; +char **CDFpaths, **varNames; +char outputCDF[CDF_PATHNAME_LEN+1], fileList[CDF_PATHNAME_LEN+1], + line[CDF_PATHNAME_LEN+1], sourceCDF[CDF_PATHNAME_LEN+1]; +char varName[CDF_VAR_NAME_LEN256+1], attrName[CDF_ATTR_NAME_LEN256+1]; +char newVarName[CDF_VAR_NAME_LEN256+1], newAttrName[CDF_ATTR_NAME_LEN256+1], + newVarName2[CDF_VAR_NAME_LEN256+1]; +char prefix[1025], entryValue[257], *addGlobalAttr = "FileSource", *newValue; +void *value; +size_t nBytes; +Logical mLog, pad, dataOnly, usePrefix = TRUE, changed; +Logical srcRowMajor, switchMajority; +int i, ii, j, k, ir, icount, numCDFs, ix, iy, dimN, recNum; +int numOpt, numTokens = 0, count; +Logical qopError = FALSE; +QOP *qop; +static char *validQuals[] = { + "prefixes", "noprefix", "about", "log", "nolog", "file", "dataonly", + "nodataonly", NULL +}; +static int optRequired[] = { + TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, 0 +}; +Byte **handles[2], *buffer1, *buffer2; +size_t nValueBytes[2]; +long nHypers, nValues, hyperN; +struct GroupStruct groups; +struct HyperStruct hyper; +Logical ifound; +int spgAttrs = 0, sp1vAttrs = 25, sp2vAttrs = 9; +char *specialgAttrs[1]; +/* +static char *special1vAttrs[] = {"FIELDNAM", "VALIDMIN", "VALIDMAX", "SCALEMIN", + "SCALEMAX", "LABLAXIS", "UNITS", "FORMAT", + "MONOTON", "VAR_TYPE", "DICT_KEY", "FILLVAL", + "LABL_PTR_", "UNIT_PTR", "FORM_PTR", "DEPEND_", + "CATDESC", "DELTA_PLUS_VAR", + "DELTA_MINUS_VAR", "AVG_TYPE", + "DISPLAY_TYPE", "VAR_NOTES", + "SCAL_PTR", "DERIVN", "V_PARENT"}; +*/ +static char *special2vAttrs[] = { + "LABL_PTR_", "FORM_PTR", "UNIT_PTR", "DEPEND_", + "SCAL_PTR", "DERIVN", "V_PARENT", "COMPONENT_", + "OFFSET_" +}; +static char *dspType = "DISPLAY_TYPE"; +FILE *srcFp; + +/****************************************************************************** +* Parse qualifiers/options/parameters (QOP). +******************************************************************************/ + +switch (argC) { + case 1: + PageOLH ("cdfmerge.olh", argV[0]); + return TRUE; + case 2: + if (strcmp(argV[1],"-java") == 0) { + PageOLH ("cdfcvtj.olh", argV[0]); + return TRUE; + } + default: + qop = Qop (argC, argV, validQuals, optRequired); + if (qop == NULL) return FALSE; + /************************************************************************ + * Check for `about' qualifier. + ************************************************************************/ + if (qop->qualEntered[ABOUTqual]) { + DisplayIdentification (pgmName); + cdf_FreeMemory (qop, FatalError); + return TRUE; + } + /************************************************************************ + * Check for `file' qualifier. + ************************************************************************/ + if (qop->qualEntered[FILEqual]) { + strcpyX (fileList, qop->qualOpt[FILEqual], CDF_PATHNAME_LEN); +#if defined(__CYGWIN__) || defined(__MINGW32__) + srcFp = fopen (fileList, "rt"); +#else + srcFp = fopen (fileList, "r"); +#endif + if (srcFp == NULL) { + DisplayError ("Unable to open the source file."); + qopError = TRUE; + return TRUE; + } + numCDFs = 0; + while ( fgets(line,DU_MAX_PATH_LEN,srcFp) != NULL) { + numCDFs++; + if (numCDFs == 1) + numOpt = sscanf(line, "%s %s",sourceCDF, outputCDF); + } + if (numCDFs < 3) { + DisplayError ("Less than 3 files specified in the input file."); + qopError = TRUE; + fclose (srcFp); + return TRUE; + } + rewind (srcFp); + numCDFs--; + CDFpaths = (char **) cdf_AllocateMemory (sizeof(char *) * numCDFs, + FatalError); + if (numOpt == 2) { + numTokens = numCDFs; + } + prefixes = (char **) cdf_AllocateMemory (sizeof(char *) * numCDFs, + FatalError); + + for (i = 0; i < numCDFs; i++) { + CDFpaths[i] = (char *) cdf_AllocateMemory (DU_MAX_PATH_LEN+1, + FatalError); + prefixes[i] = (char *) cdf_AllocateMemory (PREFIXMAXLEN+1, + FatalError); + fgets (line, DU_MAX_PATH_LEN, srcFp); + if (sscanf(line, "%s %s", CDFpaths[i], prefixes[i]) != numOpt) { + DisplayError ("Missing prefix in some entries in the input file."); + qopError = TRUE; + fclose (srcFp); + for (j = 0; j <= i; j++) { + if (prefixes[j] != NULL) cdf_FreeMemory (prefixes[j], + FatalError); + if (CDFpaths[j] != NULL) cdf_FreeMemory (CDFpaths[j], + FatalError); + } + if (prefixes != NULL) cdf_FreeMemory (prefixes, FatalError); + if (CDFpaths != NULL) cdf_FreeMemory (CDFpaths, FatalError); + return TRUE; + } + } + fgets (line, DU_MAX_PATH_LEN, srcFp); + strcpyX (outputCDF, line, strlen(line) - 1); + fclose (srcFp); + if (numOpt == 1) { + for (i = 0; i < numCDFs; i++) + if (prefixes[i] != NULL) cdf_FreeMemory (prefixes[i], + FatalError); + if (prefixes != NULL) cdf_FreeMemory (prefixes, FatalError); + } + } else + MakeNUL (fileList); + /************************************************************************** + * Get CDF pathnames if `file' qualifier is not entered. + **************************************************************************/ + if (NULstring(fileList)) { + if (qop->Nparms < 3) { + DisplayError ("Missing parameter(s)... Need at least 3 files (2 inputs 1 output)."); + qopError = TRUE; + return TRUE; + } + else { + numCDFs = qop->Nparms - 1; + CDFpaths = (char **) cdf_AllocateMemory (sizeof(char *) * numCDFs, + FatalError); + for (i = 0; i < numCDFs; i++) { + CDFpaths[i] = (char *) cdf_AllocateMemory (DU_MAX_PATH_LEN+1, + FatalError); + strcpyX (CDFpaths[i], qop->parms[i], DU_MAX_PATH_LEN); + } + strcpyX (outputCDF, qop->parms[qop->Nparms-1], DU_MAX_PATH_LEN); + } + } + /************************************************************************** + * Check which prefix values should be used was specified. Only check + * if there is no "file" qualifier entered or no prefixes specified in + * that file. + **************************************************************************/ + if (NULstring(fileList) || numTokens == 0) { + count = 0; + if (qop->qualEntered[NOPREFIXqual]) count++; + if (qop->qualEntered[PREFIXESqual]) count++; + switch (count) { + case 0: + usePrefix = TRUE; + MakeNUL (prefix); + break; + case 1: + if (qop->qualEntered[NOPREFIXqual]) { + usePrefix = FALSE; + MakeNUL (prefix); + break; + } + if (qop->qualEntered[PREFIXESqual]) { + usePrefix = TRUE; + strcpyX (prefix, qop->qualOpt[PREFIXESqual], 1024); + numTokens = GetNumTokens ((int) ',', prefix); + if (numTokens != numCDFs) { + DisplayError ("Numbers of prefixes and source CDFs do not match."); + qopError = TRUE; + return TRUE; + } else { + prefixes = (char **) cdf_AllocateMemory (sizeof(char *) * numTokens, + FatalError); + for (i = 0; i < numTokens; i++) + prefixes[i] = (char *) cdf_AllocateMemory (DU_MAX_PATH_LEN+1, + FatalError); + ParseStringForTokens ((int) ',', prefix, prefixes); + } + break; + } + default: + DisplayError ("Specify only one prefix option."); + qopError = TRUE; + } + } + /************************************************************************ + * Check for `log' qualifier. + ************************************************************************/ + qopError = qopError | !TFqualifier (qop,&mLog,LOGqual,NOLOGqual, + DEFAULTlogMERGE,"log"); + /************************************************************************ + * Check for `dataonly' qualifier. + ************************************************************************/ + qopError = qopError | !TFqualifier (qop,&dataOnly,DATAONLYqual, + NODATAONLYqual, + DEFAULTdataonlyMERGE,"dataonly"); + /************************************************************************ + * Free QOP memory and check for an error. + ************************************************************************/ + cdf_FreeMemory (qop, FatalError); + if (qopError) { + return FALSE; + } + break; + } + + /*************************************************************************** + * Display converting message. + ***************************************************************************/ + printf ("Merging \""); + for (icount = 0; icount < numCDFs; icount++) { + if (icount != 0) printf (" \""); + printf (CDFpaths[icount]); + if (!EndsWithIgCase(CDFpaths[icount], ".cdf")) + printf (".cdf\" \n"); + else + printf ("\" \n"); + } + printf (" to \""); + printf (outputCDF); + if (!EndsWithIgCase(outputCDF, ".cdf")) + printf (".cdf"); + printf ("\"\n"); + + /***********************************/ + /* Loop through the source CDFs. */ + /***********************************/ + + for (icount = 0; icount < numCDFs; icount++) { + + status = CDFlib (OPEN_, CDF_, CDFpaths[icount], &id, + SELECT_, CDF_zMODE_, zMODEon2, + GET_, CDF_MAJORITY_, &major, + CDF_ENCODING_, &encoding, + CDF_FORMAT_, &format, + CDF_NUMzVARS_, &numzVars, + CDF_NUMATTRS_, &numAttrs, + CDF_NUMgATTRS_, &numgAttrs, + CDF_NUMvATTRS_, &numvAttrs, + CDF_COMPRESSION_, &cType, cParms, &cPct, + + NULL_); + if (status < CDF_OK) QuitCDF ("1.0", status, CDFpaths[icount]); + + /***************************************/ + /* Create the output CDF. */ + /***************************************/ + + if (icount == 0) { + majority = major; + dimSizes[0] = 0L; + status = CDFlib (CREATE_, CDF_, outputCDF, 0L, dimSizes, &ido, + PUT_, CDF_MAJORITY_, majority, + CDF_ENCODING_, encoding, + CDF_FORMAT_, format, + CDF_COMPRESSION_, cType, cParms, + NULL_); + if (status < CDF_OK) QuitCDF ("2.0", status, outputCDF); + + if (mLog) printf (" Merged file created...\n"); + + /**************************************/ + /* Add the "FileName" attribute. */ + /**************************************/ + + status = CDFlib (SELECT_, CDF_, ido, + CREATE_, ATTR_, addGlobalAttr, GLOBAL_SCOPE, &attrNum, + NULL_); + if (status < CDF_OK) QuitCDF ("3.0", status, addGlobalAttr); + + } + + /********************************************/ + /* Load the Global Attributes. */ + /********************************************/ + + if (numgAttrs > 0) { + + if (icount == 0 || (icount != 0 && !dataOnly)) { + + if (mLog) printf (" Adding global attributes (%ld) from file: %d...\n", + numgAttrs, (icount+1)); + j = 0; + for (i = 0; i < (int) numAttrs; i++) { + status = CDFlib (SELECT_, CDF_, id, + ATTR_, (long) i, + GET_, ATTR_SCOPE_, &scope, + NULL_); + if (status < CDF_OK) QuitCDF ("4.0", status, NULL); + + if (scope != GLOBAL_SCOPE) continue; + + status = CDFlib (GET_, ATTR_NAME_, attrName, + ATTR_NUMgENTRIES_, &numgEntries, + NULL_); + if (status < CDF_OK) QuitCDF ("5.0", status, attrName); + + if (dataOnly) + strcpyX (newAttrName, attrName, 0); + else { + /*****************************************************/ + /* Check for special attributes. Its */ + /* ISTP-standard name can't be changed. */ + /*****************************************************/ + ifound = FALSE; + if (usePrefix) { + for (j = 0; j < spgAttrs; j++) { + if (strcmpIgCase(attrName, specialgAttrs[j]) != 0) + ifound = TRUE; + } + } + if (usePrefix && !ifound) + ModifyName (attrName, numTokens, prefixes, icount, + newAttrName); + else + strcpyX (newAttrName, attrName, 0); + } + + status = CDFlib (SELECT_, CDF_, ido, + CREATE_, ATTR_, newAttrName, scope, &attrNum, + NULL_); + if (!usePrefix && status == ATTR_EXISTS) { + status = CDFlib (SELECT_, CDF_, ido, + ATTR_NAME_, newAttrName, + GET_, ATTR_MAXgENTRY_, &maxGentry, + NULL_); + if (status < CDF_OK) QuitCDF ("6.0", status, newAttrName); + maxGentry++; + } else if (status < CDF_OK) + QuitCDF ("6.5", status, newAttrName); + + j = k = 0; + if (numgEntries > 0) { + do { + status = CDFlib (SELECT_, CDF_, id, + ATTR_, (long) i, + gENTRY_, (long) j, + GET_, gENTRY_DATATYPE_, &dataTypeX, + gENTRY_NUMELEMS_, &numElemsX, + NULL_); + if (status < CDF_OK) { + j++; + continue; + } else { + nBytes = (size_t) (CDFelemSize(dataTypeX) * numElemsX); + value = cdf_AllocateMemory ((size_t) nBytes, FatalError); + status = CDFlib (SELECT_, CDF_, id, + ATTR_, (long) i, + gENTRY_, (long) j, + GET_, gENTRY_DATA_, value, + NULL_); + if (status < CDF_OK) QuitCDF ("7.0", status, NULL); + + status = CDFlib (SELECT_, CDF_, ido, + ATTR_NAME_, newAttrName, + gENTRY_, (long) (j+maxGentry), + PUT_, gENTRY_DATA_, dataTypeX, numElemsX, value, + NULL_); + if (status < CDF_OK) QuitCDF ("8.0", status, newAttrName); + k++; + j++; + cdf_FreeMemory (value, FatalError); + } + } while (k < (int) numgEntries); + } + } + if (mLog) printf (" Global attributes from source file: %d added...\n", + (icount+1)); + } + } + + if (numTokens > 0) + sprintf (entryValue, "%s: ", prefixes[icount]); + else + sprintf (entryValue, "File%d: ", (icount+1)); + strcatX (entryValue, CDFpaths[icount], 0); + if (!EndsWithIgCase (entryValue, ".cdf")) + strcatX (entryValue, ".cdf", 0); + + status = CDFlib (SELECT_, CDF_, ido, + ATTR_NAME_, addGlobalAttr, + gENTRY_, (long) icount, + PUT_, gENTRY_DATA_, CDF_CHAR, + (long) strlen (entryValue), entryValue, + NULL_); + if (status < CDF_OK) QuitCDF ("9.0", status, addGlobalAttr); + + /*******************************************************/ + /* Load the variables (all are zVariables). */ + /*******************************************************/ + + if (numzVars > 0) { + + if (mLog) printf (" Adding zVariables (%ld) from file: %d...\n", + numzVars, (icount+1)); + + varNames = (char **) cdf_AllocateMemory (sizeof(char *) * + (int) numzVars, FatalError); + for (i = 0; i < numzVars; i++) { + status = CDFlib (SELECT_, CDF_, id, + zVAR_, (long) i, + GET_, zVAR_NAME_, varName, + zVAR_DATATYPE_, &dataType, + zVAR_NUMELEMS_, &numElems, + zVAR_NUMDIMS_, &numDims, + zVAR_DIMSIZES_, dimSizes, + zVAR_DIMVARYS_, dimVarys, + zVAR_RECVARY_, &recVary, + zVAR_COMPRESSION_, &cType, cParms, &cPct, + zVAR_BLOCKINGFACTOR_, &bf, + zVAR_SPARSERECORDS_, &sp, + NULL_); + if (status < CDF_OK) QuitCDF ("10.0", status, varName); + + varNames[i] = (char *) cdf_AllocateMemory (strlen(varName)+1, + FatalError); + strcpyX (varNames[i], varName, strlen(varName)); + + if (cType != NO_COMPRESSION) { + status = CDFlib (CONFIRM_, zVAR_RESERVEPERCENT_, &reservePct, + NULL_); + if (status < CDF_OK) QuitCDF ("11.0", status, NULL); + } + + nBytes = (size_t) (CDFelemSize(dataType) * numElems); + value = cdf_AllocateMemory ((size_t) nBytes, FatalError); + status = CDFlib (GET_, zVAR_PADVALUE_, value, + NULL_); + if (status != NO_PADVALUE_SPECIFIED) + pad = TRUE; + else + pad = FALSE; + + if (usePrefix && !dataOnly) + ModifyName (varName, numTokens, prefixes, icount, newVarName); + else + strcpyX (newVarName, varName, 0); + + status = CDFlib (SELECT_, CDF_, ido, + CREATE_, zVAR_, newVarName, dataType, numElems, numDims, + dimSizes, recVary, dimVarys, &varNum, + PUT_, zVAR_COMPRESSION_, cType, cParms, + zVAR_BLOCKINGFACTOR_, bf, + zVAR_SPARSERECORDS_, sp, + NULL_); + + if (!dataOnly) { + if (status < CDF_OK) QuitCDF ("12.0", status, newVarName); + } else + if (status != CDF_OK && status != VAR_EXISTS) + QuitCDF ("12.5", status, newVarName); + + if (status == CDF_OK && cType != NO_COMPRESSION) { + status1 = CDFlib (SELECT_, zVAR_RESERVEPERCENT_, reservePct, + NULL_); + if (status1 < CDF_OK) QuitCDF ("13.0", status, newVarName); + } + + if (status == CDF_OK && pad) { + status1 = CDFlib (PUT_, zVAR_PADVALUE_, value, + NULL_); + if (status1 < CDF_OK) QuitCDF ("14.0", status, newVarName); + } + cdf_FreeMemory (value, FatalError); + } + if (mLog) printf (" Variables from source file: %d added...\n", + (icount+1)); + } + + /*********************************************/ + /* Load the Variable Attributes. */ + /*********************************************/ + + if (numvAttrs > 0) { + + if (mLog) printf (" Adding variable attributes (%ld) from source file: %d...\n", + numvAttrs, (icount+1)); + + for (i = 0; i < (int) numAttrs; i++) { + status = CDFlib (SELECT_, CDF_, id, + ATTR_, (long) i, + GET_, ATTR_SCOPE_, &scope, + NULL_); + if (status < CDF_OK) QuitCDF ("15.0", status, NULL); + + if (scope == GLOBAL_SCOPE) continue; + + status = CDFlib (GET_, ATTR_NAME_, attrName, + ATTR_NUMzENTRIES_, &numzEntries, + NULL_); + if (status < CDF_OK) QuitCDF ("16.0", status, attrName); + + status = CDFlib (SELECT_, CDF_, ido, + CREATE_, ATTR_, attrName, scope, &attrNum, + NULL_); + if (status < CDF_OK) { + if (status == ATTR_EXISTS) { + status = CDFlib (SELECT_, CDF_, ido, + GET_, ATTR_NUMBER_, attrName, &attrNum, + NULL_); + if (status < CDF_OK) QuitCDF ("17.0", status, attrName); + } else + QuitCDF ("17.5", status, attrName); + } + + j = k = 0; + if (numzEntries > 0) { + do { + status = CDFlib (SELECT_, CDF_, id, + ATTR_, (long) i, + zENTRY_, (long) j, + GET_, zENTRY_DATATYPE_, &dataTypeX, + zENTRY_NUMELEMS_, &numElemsX, + NULL_); + if (status < CDF_OK) { + j++; + continue; + } else { + nBytes = (size_t) (CDFelemSize(dataTypeX) * (numElemsX+1)); + value = cdf_AllocateMemory ((size_t) nBytes, FatalError); + status = CDFlib (SELECT_, CDF_, id, + GET_, zENTRY_DATA_, value, + SELECT_, zVAR_, (long) j, + GET_, zVAR_NAME_, varName, + NULL_); + if (status < CDF_OK) QuitCDF ("18.0", status, NULL); + + if (STRINGdataType(dataTypeX)) + *(((char *)value)+numElemsX) = NUL; + if (usePrefix && !dataOnly) + ModifyName (varName, numTokens, prefixes, icount, newVarName); + else + strcpyX (newVarName, varName, 0); + + status = CDFlib (SELECT_, CDF_, ido, + ATTR_NAME_, attrName, + zENTRY_NAME_, newVarName, + GET_, zENTRY_DATATYPE_, &dataTypeY, + zENTRY_NUMELEMS_, &numElemsY, + NULL_); + /**************************************************************** + * If already exists, it's an error for noprefix condition. + * Otherwise, write it. + ****************************************************************/ + if (status == CDF_OK) { + if (!usePrefix) { + cdf_FreeMemory (value, FatalError); + QuitCDF ("18.5", VAR_EXISTS, newVarName); + } + } else if (status < CDF_OK) { + /************************************************************** + * Check for special attributes that have the entry data of a + * variable name. For this case, the entry needs to be changed + * to reflect the prefixed variable name in the merged file. + **************************************************************/ + if (usePrefix && !dataOnly) { + if (strcmpIgCase(attrName, dspType) != 0) { + changed = FALSE; + newValue = (char *) cdf_AllocateMemory (strlen(value)+150, + FatalError); + /********************************************************** + * Parse the entry for DISPLAY_TYPE for variable name(s). + * Have to change it as it will have a prefix. + **********************************************************/ + ParseStringForVariables (numTokens, prefixes, icount, + (int) numzVars, varNames, + value, newValue, &changed); + if (changed) + status = CDFlib (SELECT_, CDF_, ido, + ATTR_NAME_, attrName, + zENTRY_NAME_, newVarName, + PUT_, zENTRY_DATA_, dataTypeX, + (long) strlen(newValue), + newValue, + NULL_); + else + status = CDFlib (SELECT_, CDF_, ido, + ATTR_NAME_, attrName, + zENTRY_NAME_, newVarName, + PUT_, zENTRY_DATA_, dataTypeX, numElemsX, + value, + NULL_); + if (status < CDF_OK) QuitCDF ("19.0", status, newVarName); + cdf_FreeMemory (newValue, FatalError); + } else { + ifound = FALSE; + for (ii = 0; ii < sp2vAttrs; ii++) { + if (strcmpIgCase(attrName, special2vAttrs[ii]) != 0) { + ifound = TRUE; + break; + } + } + if (ifound) { + *(((char *)value)+numElemsX) = NUL; + ModifyName ((char *)value, numTokens, prefixes, icount, + newVarName2); + numElemsX = (long) strlen (newVarName2); + } + status = CDFlib (SELECT_, CDF_, ido, + ATTR_NAME_, attrName, + zENTRY_NAME_, newVarName, + PUT_, zENTRY_DATA_, dataTypeX, numElemsX, + BOO(ifound,newVarName2,value), + NULL_); + if (status < CDF_OK) QuitCDF ("19.5", status, newVarName); + } + } else { + status = CDFlib (SELECT_, CDF_, ido, + ATTR_NAME_, attrName, + zENTRY_NAME_, newVarName, + PUT_, zENTRY_DATA_, dataTypeX, numElemsX, + value, + NULL_); + if (status < CDF_OK) QuitCDF ("19.7", status, newVarName); + } + } + k++; + j++; + cdf_FreeMemory (value, FatalError); + } + } while (k < numzEntries); + } + } + + if (mLog) printf (" Variable attributes from source file: %d added...\n", + (icount+1)); + } + + if (numzVars > 0) + for (i = 0; i < (int) numzVars; i++) + cdf_FreeMemory (varNames[i], FatalError); + + cdf_FreeMemory (varNames, FatalError); + + status = CDFlib (SELECT_, CDF_, id, + CLOSE_, CDF_, + NULL_); + if (status < CDF_OK) QuitCDF ("20.0", status, NULL); + + } + + /****************************************/ + /* Load the Variable data. */ + /****************************************/ + + for (icount = 0; icount < numCDFs; icount++) { + + if (mLog) printf (" Adding variable data from source file: %d...\n", + (icount+1)); + + status = CDFlib (OPEN_, CDF_, CDFpaths[icount], &id, + SELECT_, CDF_zMODE_, zMODEon2, + GET_, CDF_MAJORITY_, &major, + CDF_NUMzVARS_, &numzVars, + NULL_); + if (status < CDF_OK) QuitCDF ("21.0", status, CDFpaths[icount]); + + srcRowMajor = ROWmajor(major); + + for (ir = 0; ir < (int) numzVars; ir++) { + + status = CDFlib (SELECT_, CDF_, id, + zVAR_, (long) ir, + GET_, zVAR_NAME_, varName, + zVAR_RECVARY_, &recVary, + zVAR_DATATYPE_, &dataType, + zVAR_NUMELEMS_, &numElems, + zVAR_NUMDIMS_, &numDims, + zVAR_DIMSIZES_, dimSizes, + zVAR_MAXREC_, &maxRec, + zVAR_COMPRESSION_, &cType, cParms, &cPct, + NULL_); + if (status < CDF_OK) QuitCDF ("22.0", status, varName); + + if (maxRec == NO_RECORD) continue; + + /************************************************************************ + * Read/write values using hyper groups... + ************************************************************************/ + for (dimN = 0, nValuesPerRec = 1; dimN < numDims; dimN++) { + if (dimVarys[dimN]) + nValuesPerRec *= dimSizes[dimN]; + else + dimSizes[dimN] = 1; + } + + if (usePrefix && !dataOnly) + ModifyName (varName, numTokens, prefixes, icount, newVarName); + else + strcpyX (newVarName, varName, 0); + + status = CDFlib (SELECT_, CDF_, ido, + GET_, zVAR_NUMBER_, newVarName, &varNum, + NULL_); + if (status < CDF_OK) QuitCDF ("23.0", status, newVarName); + + status = CDFlib (SELECT_, CDF_, ido, + zVAR_, varNum, + GET_, zVAR_MAXREC_, &varMaxRec, + NULL_); + if (status < CDF_OK) QuitCDF ("23.5", status, newVarName); + + if (icount == 0) + varMaxRec = 0; + else + varMaxRec++; + + nBytes = (size_t) (CDFelemSize(dataType) * numElems); + handles[0] = &buffer1; + handles[1] = &buffer2; + nValueBytes[0] = (size_t) nBytes; + nValueBytes[1] = (size_t) nBytes; + switchMajority = (numDims > 1 && majority != major); + + if (icount != 0 && dataOnly && !recVary) continue; + + for (recNum = 0; recNum <= (int) maxRec; recNum = toRec + 1) { + /********************************************************************** + * Determine the next allocated record. + **********************************************************************/ + status = CDFlib (SELECT_, CDF_, id, + zVAR_, (long) ir, + GET_, zVAR_ALLOCATEDFROM_, (long) recNum, &fromRec, + NULL_); + if (status < CDF_OK) QuitCDF ("24.0", status, newVarName); + /********************************************************************** + * Determine the last allocated record (before the next unallocated one). + * Do not let this exceed the maximum record written to the variable. + **********************************************************************/ + status = CDFlib (SELECT_, CDF_, id, + zVAR_, (long) ir, + GET_, zVAR_ALLOCATEDTO_, fromRec, &toRec, + NULL_); + if (status < CDF_OK) QuitCDF ("25.0", status, newVarName); + toRec = MINIMUM(toRec,maxRec); + + fromRec2 = fromRec + varMaxRec; + toRec2 = toRec + varMaxRec; + + /********************************************************************** + * Allocate the records unless the variable is compressed or has sparse + * arrays. + **********************************************************************/ + if (cType == NO_COMPRESSION) { + status = CDFlib (SELECT_, CDF_, ido, + zVAR_, varNum, + PUT_, zVAR_ALLOCATEBLOCK_, fromRec, toRec, + NULL_); + if (status < CDF_OK) QuitCDF ("26.0", status, newVarName); + } + /********************************************************************** + * Calculate the number of records in this group. + **********************************************************************/ + nRecords = toRec - fromRec + 1; + /********************************************************************** + * If the majority is being switched... + **********************************************************************/ + if (switchMajority) { + AllocateBuffers (nRecords, numDims, dimSizes, &groups, 0, 2, handles, + nValueBytes, srcRowMajor, 5, FatalError); + if (HyperFullRecord(&groups,numDims)) { + long nBytesPerRecord = nValuesPerRec * nBytes, recX; + InitHyperParms (&hyper, &groups, numDims, &nHypers, &nValues); + hyper.recNumber = fromRec; + for (hyperN = 0; hyperN < nHypers; hyperN++) { + status = CDFlib (SELECT_, CDF_, id, + zVAR_, (long) ir, + NULL_); + if (status < CDF_OK) QuitCDF ("27.0", status, newVarName); + status = HYPER_READ (id, TRUE, hyper, buffer1); + if (status < CDF_OK) QuitCDF ("28.0", status, newVarName); + hyperStep = hyper.recNumber; + for (recX = 0; recX < hyper.recCount; recX++) { + size_t offset = (size_t) (recX * nBytesPerRecord); + if (srcRowMajor) + ROWtoCOL (buffer1 + offset, buffer2 + offset, numDims, + dimSizes, nBytes); + else + COLtoROW (buffer1 + offset, buffer2 + offset, numDims, + dimSizes, nBytes); + } + status = CDFlib (SELECT_, CDF_, ido, + zVAR_, varNum, + NULL_); + if (status < CDF_OK) QuitCDF ("29.0", status, newVarName); + hyper.recNumber = fromRec2; + status = HYPER_WRITE (ido, TRUE, hyper, buffer2); + if (status < CDF_OK) QuitCDF ("30.0", status, newVarName); + hyper.recNumber = hyperStep; + fromRec2 += hyper.recCount; + IncrHyperParms (&hyper, &groups, numDims, srcRowMajor, &nValues); + } + cdf_FreeMemory (buffer1, FatalError); + cdf_FreeMemory (buffer2, FatalError); + } else { + cdf_FreeMemory (buffer2, FatalError); + InitHyperParms (&hyper, &groups, numDims, &nHypers, &nValues); + hyper.recNumber = fromRec; + for (hyperN = 0; hyperN < nHypers; hyperN++) { + long indices[CDF_MAX_DIMS]; Byte *value = buffer1; long valueN; + status = CDFlib (SELECT_, CDF_, ido, + zVAR_, (long) ir, + NULL_); + if (status < CDF_OK) QuitCDF ("31.0", status, newVarName); + + status = HYPER_READ (id, TRUE, hyper, buffer1); + if (status < CDF_OK) QuitCDF ("32.0", status, newVarName); + hyperStep = hyper.recNumber; + hyper.recNumber = fromRec2; + status = CDFlib (SELECT_, CDF_, ido, + zVAR_, varNum, + zVAR_RECNUMBER_, hyper.recNumber, + NULL_); + if (status < CDF_OK) QuitCDF ("33.0", status, newVarName); + for (dimN = 0; dimN < numDims; dimN++) + indices[dimN] = hyper.dimIndices[dimN]; + for (valueN = 0; valueN < nValues; valueN++) { + status = CDFlib (SELECT_, zVAR_DIMINDICES_, indices, + PUT_, zVAR_DATA_, value, + NULL_); + if (status < CDF_OK) QuitCDF ("34.0", status, newVarName); + if (srcRowMajor) + INCRindicesROW (numDims, dimSizes, indices); + else + INCRindicesCOL (numDims, dimSizes, indices); + value += (size_t) nBytes; + } + hyper.recNumber = hyperStep; + fromRec2 += hyper.recCount; + IncrHyperParms (&hyper, &groups, numDims, srcRowMajor, &nValues); + } + cdf_FreeMemory (buffer1, FatalError); + } + } else { + AllocateBuffers (nRecords, numDims, dimSizes, &groups, 0, 1, handles, + nValueBytes, srcRowMajor, 5, FatalError); + InitHyperParms (&hyper, &groups, numDims, &nHypers, &nValues); + hyper.recNumber = fromRec; + for (hyperN = 0; hyperN < nHypers; hyperN++) { + status = CDFlib (SELECT_, CDF_, id, + zVAR_, (long) ir, + NULL_); + if (status < CDF_OK) QuitCDF ("35.0", status, newVarName); + status = HYPER_READ (id, TRUE, hyper, buffer1); + if (status < CDF_OK) QuitCDF ("36.0", status, newVarName); + hyperStep = hyper.recNumber; + status = CDFlib (SELECT_, CDF_, ido, + zVAR_, varNum, + NULL_); + if (status < CDF_OK) QuitCDF ("37.0", status, newVarName); + hyper.recNumber = fromRec2; + status = HYPER_WRITE (ido, TRUE, hyper, buffer1); + if (status < CDF_OK) QuitCDF ("38.0", status, newVarName); + hyper.recNumber = hyperStep; + fromRec2 += hyper.recCount; + IncrHyperParms (&hyper, &groups, numDims, srcRowMajor, &nValues); + } + cdf_FreeMemory (buffer1, FatalError); + } /* switchmajority */ + + } /* recNum */ + + } /* zVars */ + + status = CDFlib (SELECT_, CDF_, id, + CLOSE_, CDF_, + NULL_); + if (status < CDF_OK) QuitCDF ("39.0", status, NULL); + + if (mLog) printf (" Variable data from source file: %d added...\n", + (icount+1)); + + } /* files */ + + for (i = 0; i < numCDFs; i++) { + if (CDFpaths[i] != NULL) cdf_FreeMemory (CDFpaths[i], FatalError); + } + if (CDFpaths != NULL) cdf_FreeMemory (CDFpaths, FatalError); + + if (numTokens != 0) { + for (i = 0; i < numCDFs; i++) + if (prefixes[i] != NULL) cdf_FreeMemory (prefixes[i], FatalError); + cdf_FreeMemory (prefixes, FatalError); + } + + status = CDFlib (SELECT_, CDF_, ido, + CLOSE_, CDF_, + NULL_); + if (status < CDF_OK) QuitCDF ("40.0", status, NULL); + + if (mLog) printf (" Done!\n"); + + exit(1); + +} + +/****************************************************************************** +* ModifyName. +******************************************************************************/ + +void ModifyName (inName, numTokens, prefixes, index, outName) +char *inName; +int numTokens; +char *prefixes[]; +int index; +char *outName; +{ + char temp[CDF_VAR_NAME_LEN256+1]; + MakeNUL (temp); + if (numTokens != 0) + sprintf (temp, "%s_", prefixes[index]); + else + sprintf (temp, "file%d_", (index+1)); + sprintf (EofS(temp), "%s", inName); + strcpyX (outName, temp, 0); +} + +/****************************************************************************** +* ParseStringForVariables. +******************************************************************************/ + +void ParseStringForVariables (numTokens, prefixes, index, numVars, varNames, + string1, newValue, changed) +int numTokens; +char *prefixes[]; +int index; +int numVars; +char *varNames[]; +char *string1; +char *newValue; +Logical *changed; +{ + int i; + char *ptr1, *ptr2, terminator; + char *tmp, *tmp2, *outName; + Logical first, found; + + *changed = FALSE; + /**************************************************************************** + * Check that the entered string is not a NUL string, that there are + * some possible tokens to match, etc. + ****************************************************************************/ + if (NULstring(string1)) { + return; /* Obviously, no character were found. */ + } + /**************************************************************************** + * Scan the entered string of tokens searching for matches with the token. + * First determine the starting character position and the * ending delimiter. + ****************************************************************************/ + terminator = NUL; + ptr1 = string1; + first = TRUE; + for (;;) { + /************************************************************************* + * Find beginning of the next token in list (skipping past any leading + * blanks). If the end of the list is reached instead, then there are + * no more tokens. + *************************************************************************/ + ptr2 = strstr (ptr1, "="); + if (ptr2 == NULL) break; + if (first) { + first = FALSE; + strcpyX (newValue, ptr1, (ptr2-ptr1+1)); + } else + strcpyX (EofS(newValue), ptr1, (ptr2-ptr1+1)); + ptr1 = ptr2; + /************************************************************************* + * Assume ',', '(', ' ' or end of line is the terminator for the field + * value. + *************************************************************************/ + while (*ptr1 != ',' && *ptr1 != '(' && *ptr1 != ' ' && *ptr1 != terminator) + ptr1++; + tmp = (char *) cdf_AllocateMemory (ptr1-ptr2, FatalError); + strcpyX (tmp, ptr2+1, (ptr1-ptr2-1)); + found = FALSE; + for (i = 0; i < numVars; i++) { + if (!strcmp(tmp, varNames[i])) { + found = TRUE; + break; + } + } + if (found) { + outName = (char *) cdf_AllocateMemory (strlen(tmp)+50, FatalError); + ModifyName (tmp, numTokens, prefixes, index, outName); + strcpyX (EofS(newValue), outName, strlen(outName)); + cdf_FreeMemory (outName, FatalError); + *changed = TRUE; + } else + strcpyX (EofS(newValue), tmp, strlen(tmp)); + cdf_FreeMemory (tmp, FatalError); + if (*ptr1 == terminator) break; + } + if (*ptr1 != terminator) { + if (first) + strcpyX (newValue, ptr1, strlen(ptr1)); + else + strcpyX (EofS(newValue), ptr1, strlen(ptr1)); + } +} + +/****************************************************************************** +* QuitCDF. +******************************************************************************/ + +void QuitCDF (where, status, msg) +char *where; +CDFstatus status; +char *msg; +{ + char text[CDF_STATUSTEXT_LEN+1]; + printf ("Aborting at %s...\n", where); + if (status < CDF_OK) { + CDFlib (SELECT_, CDF_STATUS_, status, + GET_, STATUS_TEXT_, text, + NULL_); + printf ("%s ", text); + if (msg != NULL) printf ("(%s)\n", msg); + else printf("\n"); + } + if (id != 0) + CDFlib (SELECT_, CDF_, id, + CLOSE_, CDF_, + NULL_); + if (ido != 0) + CDFlib (SELECT_, CDF_, ido, + CLOSE_, CDF_, + NULL_); + + printf ("\n"); + exit (EXIT_FAILURE_); +} + + diff -urN cdf31-dist.orig/src/tools/cdfxp.c cdf31-dist/src/tools/cdfxp.c --- cdf31-dist.orig/src/tools/cdfxp.c Thu Jan 26 18:21:10 2006 +++ cdf31-dist/src/tools/cdfxp.c Thu Nov 9 16:02:51 2006 @@ -18,6 +18,8 @@ * on-screen width. * V1.2d 16-Nov-97, J Love Windows NT/Visual C++. * V1.2e 14-Dec-97, J Love Added ALPHAVMSi encoding. +* V1.3 13-Oct-06, M Liu Changed to allow upper and lower case CDF +* name to be used on win32. * ******************************************************************************/ @@ -3290,7 +3292,7 @@ * First try for an exact match. ****************************************************************************/ for (i = 0; validOptions[i] != NULL; i++) { - if (!strcmpIgCase(option,validOptions[i])) return i; + if (strcmpIgCase(option,validOptions[i]) != 0) return i; } /**************************************************************************** * Check if the option matches the first part of one of the valid options @@ -3298,11 +3300,10 @@ * cannot be any of the other valid options (ie. ambiguous). ****************************************************************************/ for (i = 0; validOptions[i] != NULL; i++) { - if (!strncmpIgCasePattern(option,validOptions[i],strlen(option))) { + if (strncmpIgCasePattern(option,validOptions[i],strlen(option)) == 0) { for (j = i + 1; validOptions[j] != NULL; j++) { - if (!strncmpIgCasePattern(option,validOptions[j],strlen(option))) { + if (strncmpIgCasePattern(option,validOptions[j],strlen(option)) == 0) return AMBIGUOUSopt; - } } return i; } @@ -4247,9 +4248,11 @@ break; case CDF_REAL4: case CDF_FLOAT: + width = 16; /* Was 12. */ + break; case CDF_REAL8: case CDF_DOUBLE: - width = 12; + width = 20; /* Was 12. */ break; case CDF_EPOCH: /* Format (C/Fortran) style. */ width = 12; diff -urN cdf31-dist.orig/src/tools/cdfxp2.c cdf31-dist/src/tools/cdfxp2.c --- cdf31-dist.orig/src/tools/cdfxp2.c Mon Aug 15 17:26:44 2005 +++ cdf31-dist/src/tools/cdfxp2.c Fri Aug 25 14:50:57 2006 @@ -1520,7 +1520,8 @@ * Free memory used. ****************************************************************************/ for (Item = scalarHead; Item != NULL; Item = Item->nextScalar) { - cdf_FreeMemory (Item->Var->buffer, FatalError); + if (Item->Var->buffer != NULL) + cdf_FreeMemory (Item->Var->buffer, FatalError); } /**************************************************************************** * Check/set the new first/last records. diff -urN cdf31-dist.orig/src/tools/myscan.c cdf31-dist/src/tools/myscan.c --- cdf31-dist.orig/src/tools/myscan.c Mon Feb 6 23:18:45 2006 +++ cdf31-dist/src/tools/myscan.c Thu Jan 1 01:00:00 1970 @@ -1,1824 +0,0 @@ -/****************************************************************************** -* -* NSSDC/CDF CDFdump - dump all records found in dotCDF file. -* -* Version 2.6b, 21-Nov-97, Hughes STX. -* -* Modification history: -* -* V1.0 29-May-91, J Love Original version. -* V1.1 25-Jun-91, J Love Moved increment. Display fill value. Display -* extend records. CDF_EPOCH added as a data -* type. Added QOP. Added PageInst. -* V1.2 26-Jul-91, J Love Added SEEK_CUR. Added XDR decoding. -* Use 'Exit'/'ExitBAD'. -* V1.3 7-Oct-91, J Love Modified for IBM-PC port (and IBM-RS6000). -* V2.0 21-Apr-92, J Love IBM PC port/CDF V2.2. -* V2.1 29-Sep-92, J Love CDF V2.3 (shareable/NeXT/zVar). -* V2.2 22-Oct-92, J Love Newline after pad values. -* V2.3 24-Jan-94, J Love CDF V2.4. -* V2.3a 8-Feb-94, J Love DEC Alpha/OpenVMS port. -* V2.4 21-Dec-94, J Love CDF V2.5. -* V2.4a 13-Jan-95, J Love Uppercase file extensions. -* V2.4b 26-Jan-95, J Love Display meaning of `flags'. -* V2.4c 22-Mar-95, J Love Check for all NULs following copyright. -* V2.4d 6-Apr-95, J Love POSIX. -* V2.5 25-May-95, J Love EPOCH styles. Fixed `all NULs' message. -* V2.5a 19-Sep-95, J Love CHECKforABORTso. -* V2.5b 28-Sep-95, J Love Macintosh dialog filtering. Outline default -* button. -* V2.6 3-Oct-96, J Love CDF V2.6. -* V2.6a 3-Sep-97, J Love Fixed ScanCDF. -* V2.6b 21-Nov-97, J Love Windows NT/Visual C++. -* V3.0 7-Jan-05, M Liu CDF V3.0. Also, remove the data read if the -* it does not require a full dump. -* -* Note: This program may not work properly if the CDF file doesn't have the -* CDR, GDR record in sequence at the top of the file. Since it reads -* data sequentially from the beginning, information from GDR is needed -* for VDR (at least for rVDR). If a VDR is read ahead of GDR, problems -* will occur. Use cdfconvert to convert/re-organize the original CDF if -* there is a read problem. -******************************************************************************/ - -#include "cdfdump.h" - -/****************************************************************************** -* Increased stack size for Borland C on IBM PC. -******************************************************************************/ - -#if defined(BORLANDC) -extern unsigned _stklen = BORLANDC_STACK_SIZE; -#endif - -/****************************************************************************** -* Global variables & macro constants. -******************************************************************************/ - -long CCRcount, CDRcount, GDRcount, ADRcount, AgrEDRcount, AzEDRcount, - rVDRcount, zVDRcount, VXRcount, VVRcount, CPRcount, SPRcount, - CVVRcount, UIRcount; -long CCRbytes, CDRbytes, GDRbytes, ADRbytes, AgrEDRbytes, AzEDRbytes, - rVDRbytes, zVDRbytes, VXRbytes, VVRbytes, CPRbytes, SPRbytes, - CVVRbytes, UIRbytes; -OFF_T CCRbytes64, CDRbytes64, GDRbytes64, ADRbytes64, AgrEDRbytes64, - AzEDRbytes64, rVDRbytes64, zVDRbytes64, VXRbytes64, VVRbytes64, - CPRbytes64, SPRbytes64, CVVRbytes64, UIRbytes64; -long usedBytes, wastedBytes; -OFF_T usedBytes64, wastedBytes64; -FILE *OUTfp; -Logical EOFok; /* When TRUE, an EOF is expected. */ -long radix; /* 10 (decimal) or 16 (hexadecimal). */ -Logical isLFS; - -/****************************************************************************** -* Local function prototypes. -******************************************************************************/ - -static void DisplaySummary PROTOARGs((void)); -static void DisplaySummary64 PROTOARGs((void)); -static void CheckSizes PROTOARGs(( - vFILE *CDFfp, long startingOffset -)); -static void CheckSizes64 PROTOARGs(( - vFILE *CDFfp, OFF_T startingOffset -)); -static void ScanCDF PROTOARGs(( - vFILE *CDFfp, Logical showIndexing, long level, long startingOffset -)); -static void ScanCDF64 PROTOARGs(( - vFILE *CDFfp, Logical showIndexing, long level, OFF_T startingOffset -)); -static void DumpVXR PROTOARGs(( - vFILE *CDFfp, Int32 vxrOffset, int indent -)); -static void DumpVXR64 PROTOARGs(( - vFILE *CDFfp, OFF_T vxrOffset, int indent -)); -static char *FileOffset PROTOARGs((Int32 offset)); -static char *FileOffset64 PROTOARGs((OFF_T offset)); -static char *Hex32 PROTOARGs((Int32 value)); -static char *Deci64 PROTOARGs((OFF_T value)); -static char *Hex64 PROTOARGs((OFF_T value)); -static char *Deci32 PROTOARGs((Int32 value)); -static Logical SeekTo PROTOARGs((vFILE *fp, long offset, int how)); -static Logical SeekTo64 PROTOARGs((vFILE *fp, OFF_T offset, int how)); -static Logical Read4 PROTOARGs((vFILE *fp, Int32 *value)); -static Logical Read4_64 PROTOARGs((vFILE *fp, Int32 *value)); -static Logical Read4s PROTOARGs((vFILE *fp, Int32 *values, int count)); -static Logical Read4s_64 PROTOARGs((vFILE *fp, Int32 *values, int count)); -static Logical Read8 PROTOARGs((vFILE *fp, OFF_T *value)); -static Logical Read8s PROTOARGs((vFILE *fp, OFF_T *values, int count)); -static Logical ReadBytes PROTOARGs((vFILE *fp, void *bytes, Int32 count)); -static Logical ReadBytes64 PROTOARGs((vFILE *fp, void *bytes, Int32 count)); -static void DisplayReadFailure PROTOARGs((vFILE *fp)); - - /**************************************************************************** - * Initialize global variables. - ****************************************************************************/ - EOFok = FALSE; - usedBytes = 0; usedBytes64 = 0; - wastedBytes = 0; wastedBytes64 = 0; - CCRbytes = 0; CCRbytes64 = 0; - CDRbytes = 0; CDRbytes64 = 0; - GDRbytes = 0; CDRbytes64 = 0; - ADRbytes = 0; ADRbytes64 = 0; - AgrEDRbytes = 0; AgrEDRbytes64 = 0; - AzEDRbytes = 0; AzEDRbytes64 = 0; - rVDRbytes = 0; rVDRbytes64 = 0; - zVDRbytes = 0; zVDRbytes64 = 0; - VXRbytes = 0; VXRbytes64 = 0; - VVRbytes = 0; VVRbytes64 = 0; - CVVRbytes = 0; CVVRbytes64 = 0; - CPRbytes = 0; CPRbytes64 = 0; - SPRbytes = 0; SPRbytes64 = 0; - UIRbytes = 0; UIRbytes64 = 0; - /**************************************************************************** - * Check record sizes (if requested). - ****************************************************************************/ - if (!isLFS) - if (checkSizes) CheckSizes (CDFfp, startingOffset); - else - if (checkSizes) CheckSizes64 (CDFfp, startingOffset64); - /**************************************************************************** - * Scan internal records. - ****************************************************************************/ - if (!isLFS) - ScanCDF (CDFfp, showIndexing, level, startingOffset); - else - ScanCDF64 (CDFfp, showIndexing, level, startingOffset64); - - /**************************************************************************** - * Display summary. - ****************************************************************************/ - if (showSummary) { - if (!isLFS) DisplaySummary (); - else DisplaySummary64 (); - } - if (!isLFS) V_close (CDFfp, NULL); - else V_close64 (CDFfp, NULL); - if (OUTfp != stdout) fclose (OUTfp); - return TRUE; -} - -/****************************************************************************** -* ScanCDF. -******************************************************************************/ - -static void ScanCDF (CDFfp, showIndexing, level, startingOffset) -vFILE *CDFfp; -Logical showIndexing; -long level; -long startingOffset; -{ - Int32 recordSize, recordType, encoding, nBytes, rNumDims; - long offset; int dimN; - Logical VDRwastedSpace; - long fileSize; - Int32 int32; char text[MAX_SCREENLINE_LEN+1]; - /**************************************************************************** - * Dump magic number(s). - ****************************************************************************/ - WriteOut (OUTfp, "\nScanning records...\n\n"); - if (startingOffset == NO_OFFSET) { - if (!SeekTo(CDFfp,0,vSEEK_SET)) return; - if (!Read4(CDFfp,&int32)) return; - if (!Read4(CDFfp,&int32)) return; - usedBytes += 8; - } - else { - if (!SeekTo(CDFfp,startingOffset,vSEEK_SET)) return; - } - /**************************************************************************** - * Read and dump records until EOF (or illegal record) reached. - ****************************************************************************/ - for (;;) { - /************************************************************************* - * Read record size. - *************************************************************************/ - offset = V_tell (CDFfp); - EOFok = TRUE; - if (!Read4(CDFfp,&recordSize)) return; - EOFok = FALSE; - if (recordSize <= 0) { - sprintf (text, "\nIllegal record size detected (%ld) (@%s)\n", - (long) recordSize, FileOffset(offset)); - WriteOut (OUTfp, text); - return; - } - /************************************************************************* - * Read record type. - *************************************************************************/ - if (!Read4(CDFfp,&recordType)) return; - /************************************************************************* - * Based on the record type... - *************************************************************************/ - switch (recordType) { - /********************************************************************** - * Compressed CDF Record (CCR). - **********************************************************************/ - case CCR_: { - offset = offset + recordSize; - if (!SeekTo(CDFfp,offset,vSEEK_SET)) return; - usedBytes += recordSize; - break; - } - /********************************************************************** - * CDF Descriptor Record (CDR). - **********************************************************************/ - case CDR_: { - offset = offset + recordSize; - if (!SeekTo(CDFfp,offset,vSEEK_SET)) return; - usedBytes += recordSize; - break; - } - /********************************************************************** - * Global Descriptor Record (GDR). - **********************************************************************/ - case GDR_: { - offset = offset + recordSize; - if (!SeekTo(CDFfp,offset,vSEEK_SET)) return; - usedBytes += recordSize; - break; - } - /********************************************************************** - * Attribute Descriptor Record (ADR). - **********************************************************************/ - case ADR_: { - offset = offset + recordSize; - if (!SeekTo(CDFfp,offset,vSEEK_SET)) return; - usedBytes += recordSize; - break; - } - /********************************************************************** - * Attribute Entry Descriptor Record (AgrEDR or AzEDR). - **********************************************************************/ - case AgrEDR_: - case AzEDR_: { - offset = offset + recordSize; - if (!SeekTo(CDFfp,offset,vSEEK_SET)) return; - usedBytes += recordSize; - break; - } - /********************************************************************** - * Variable Descriptor Record (rVDR or zVDR). - **********************************************************************/ - case rVDR_: - case zVDR_: { - offset = offset + recordSize; - if (!SeekTo(CDFfp,offset,vSEEK_SET)) return; - usedBytes += recordSize; - break; - } - /********************************************************************** - * Variable indeX Record (VXR). - **********************************************************************/ - case VXR_: { - offset = offset + recordSize; - if (!SeekTo(CDFfp,offset,vSEEK_SET)) return; - usedBytes += recordSize; - break; - } - /********************************************************************** - * Variable Values Record (VVR). - **********************************************************************/ - case VVR_: { - offset = offset + recordSize; - if (!SeekTo(CDFfp,offset,vSEEK_SET)) return; - usedBytes += recordSize; - break; - } - /********************************************************************** - * Compressed Variable Values Record (CVVR). - **********************************************************************/ - case CVVR_: { - offset = offset + recordSize; - if (!SeekTo(CDFfp,offset,vSEEK_SET)) return; - usedBytes += recordSize; - break; - } - /********************************************************************** - * Compression Parameters Record (CPR). - **********************************************************************/ - case CPR_: { - offset = offset + recordSize; - if (!SeekTo(CDFfp,offset,vSEEK_SET)) return; - usedBytes += recordSize; - break; - } - /********************************************************************** - * Sparseness Parameters Record (SPR). - **********************************************************************/ - case SPR_: { - offset = offset + recordSize; - if (!SeekTo(CDFfp,offset,vSEEK_SET)) return; - usedBytes += recordSize; - break; - } - /********************************************************************** - * Unused internal record - **********************************************************************/ - case UIR_: { - offset = offset + recordSize; - if (!SeekTo(CDFfp,offset,vSEEK_SET)) return; - wastedBytes += recordSize; - break; - } - /********************************************************************** - * Illegal record type. - **********************************************************************/ - default: { - if (fileSize == offset) - sprintf (text, "EOF encountered.\n"); - else - sprintf (text, "Illegal record type detected (%ld)\n", - (long) recordType); - WriteOut (OUTfp, text); - return; - } - } - CHECKforABORTso - } -} - -/****************************************************************************** -* ScanCDF64. -******************************************************************************/ - -static void ScanCDF64 (CDFfp, showIndexing, level, startingOffset) -vFILE *CDFfp; -Logical showIndexing; -long level; -OFF_T startingOffset; -{ - Int32 recordType, encoding, rNumDims; - int dimN; - Logical VDRwastedSpace; - Int32 int32; char text[MAX_SCREENLINE_LEN+1]; - OFF_T int64; - OFF_T recordSize, nBytes, offset, fileSize; - /**************************************************************************** - * Dump magic number(s). - ****************************************************************************/ - WriteOut (OUTfp, "\nScanning records...\n\n"); - if (startingOffset == (OFF_T)NO_OFFSET64) { - if (!SeekTo64(CDFfp,(OFF_T)0,vSEEK_SET)) return; - if (!Read4_64(CDFfp,&int32)) return; - if (!Read4_64(CDFfp,&int32)) return; - usedBytes64 += 8; - } - else { - if (!SeekTo64(CDFfp,startingOffset,vSEEK_SET)) return; - } - /**************************************************************************** - * Read and dump records until EOF (or illegal record) reached. - ****************************************************************************/ - for (;;) { - /************************************************************************* - * Read record size. - *************************************************************************/ - offset = V_tell64 (CDFfp); - EOFok = TRUE; - if (!Read8(CDFfp,&recordSize)) return; - EOFok = FALSE; - if (recordSize <= (OFF_T) 0) { -#if !defined(win32) - sprintf (text, "\nIllegal record size detected (%lld) (@%s)\n", - recordSize, FileOffset64(offset)); -#else - sprintf (text, "\nIllegal record size detected (%I64d) (@%s)\n", - recordSize, FileOffset64(offset)); -#endif - WriteOut (OUTfp, text); - sprintf (text, " (May have reached the end of the valid data.)\n"); - WriteOut (OUTfp, text); - return; - } - /************************************************************************* - * Read record type. - *************************************************************************/ - if (!Read4_64(CDFfp,&recordType)) return; - /************************************************************************* - * Based on the record type... - *************************************************************************/ - switch (recordType) { - /********************************************************************** - * Compressed CDF Record (CCR). - **********************************************************************/ - case CCR_: { - usedBytes64 += recordSize; - offset = offset + recordSize; - if (!SeekTo64(CDFfp,offset,vSEEK_SET)) return; - break; - } - /********************************************************************** - * CDF Descriptor Record (CDR). - **********************************************************************/ - case CDR_: { - offset = offset + recordSize; - if (!SeekTo64(CDFfp,offset,vSEEK_SET)) return; - usedBytes64 += recordSize; - break; - } - /********************************************************************** - * Global Descriptor Record (GDR). - **********************************************************************/ - case GDR_: { - offset = offset + recordSize; - if (!SeekTo64(CDFfp,offset,vSEEK_SET)) return; - usedBytes64 += recordSize; - break; - } - /********************************************************************** - * Attribute Descriptor Record (ADR). - **********************************************************************/ - case ADR_: { - char attrName[CDF_ATTR_NAME_LEN256+1]; - ADRcount++; - ADRbytes64 += recordSize; - if (MOST(level)) { - char delim; - if (!Read8(CDFfp,&int64)) return; - sprintf (text, "ADRnext: %s\n", FileOffset64(int64)); - WriteOut (OUTfp, text); - if (!Read8(CDFfp,&int64)) return; - sprintf (text, "AgrEDRhead: %s\n", FileOffset64(int64)); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "Scope: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "Num: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "NumRentries: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "MaxRentry: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "rfuA: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read8(CDFfp,&int64)) return; - sprintf (text, "AzEDRhead: %s\n", FileOffset64(int64)); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "NumZentries: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "MaxZentry: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "rfuE: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!ReadBytes64(CDFfp,attrName,(Int32)CDF_ATTR_NAME_LEN256)) return; - attrName[CDF_ATTR_NAME_LEN256] = NUL; - delim = PickDelimiter (attrName, strlen(attrName)); - sprintf (text, "Name: %c%s%c\n", delim, attrName, delim); - WriteOut (OUTfp, text); - } - offset = offset + recordSize; - if (!SeekTo64(CDFfp,offset,vSEEK_SET)) return; - usedBytes64 += recordSize; - break; - } - /********************************************************************** - * Attribute Entry Descriptor Record (AgrEDR or AzEDR). - **********************************************************************/ - case AgrEDR_: - case AzEDR_: { - Logical zEntry = (recordType == AzEDR_); - Int32 dataType, numElems; void *valuePtr; - if (zEntry) { - AzEDRcount++; - AzEDRbytes64 += recordSize; - } - else { - AgrEDRcount++; - AgrEDRbytes64 += recordSize; - } - if (MOST(level)) { - if (!Read8(CDFfp,&int64)) return; - sprintf (text, "A%sEDRnext: %s\n", - BOO(zEntry,"z","gr"), FileOffset64(int64)); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "AttrNum: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&dataType)) return; - sprintf (text, "DataType: %ld (%s)\n", - (long) dataType, DataTypeToken(dataType)); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "Num: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&numElems)) return; - sprintf (text, "NumElems: %ld\n", (long) numElems); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "rfuA: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "rfuB: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "rfuC: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "rfuD: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "rfuE: %ld\n", (long) int32); - WriteOut (OUTfp, text); - nBytes = CDFelemSize((long)dataType) * numElems; - valuePtr = cdf_AllocateMemory ((size_t) nBytes, FatalError); - if (!ReadBytes64(CDFfp,valuePtr,(Int32)nBytes)) { - cdf_FreeMemory (valuePtr, FatalError); - return; - } - ConvertBuffer ((long) encoding, HOST_DECODING, NEGtoPOSfp0off, - (long) dataType, (long) numElems, valuePtr, - valuePtr); - strcpyX (text, "Value: ", MAX_SCREENLINE_LEN); - EncodeValuesFormat ((long) dataType, (long) numElems, valuePtr, - EofS(text), NULL, 0, - MAX_SCREENLINE_LEN - strlen(text), - EPOCH0_STYLE); - strcatX (text, "\n", MAX_SCREENLINE_LEN); - WriteOut (OUTfp, text); - cdf_FreeMemory (valuePtr, FatalError); - } - offset = offset + recordSize; - if (!SeekTo64(CDFfp,offset,vSEEK_SET)) return; - usedBytes64 += recordSize; - break; - } - /********************************************************************** - * Variable Descriptor Record (rVDR or zVDR). - **********************************************************************/ - case rVDR_: - case zVDR_: { - Logical zVar = (recordType == zVDR_); - Int32 dataType, varFlags, numElems, numDims; - char varName[CDF_VAR_NAME_LEN256+1]; void *padValue; - if (zVar) { - zVDRcount++; - zVDRbytes64 += recordSize; - } - else { - rVDRcount++; - rVDRbytes64 += recordSize; - } - if (MOST(level)) { - char delim; - if (!Read8(CDFfp,&int64)) return; - sprintf (text, "%sVDRnext: %s\n", BOO(zVar,"z","r"), - FileOffset64(int64)); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&dataType)) return; - sprintf (text, "DataType: %ld (%s)\n", - (long) dataType, DataTypeToken(dataType)); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "MaxRec: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read8(CDFfp,&int64)) return; - sprintf (text, "VXRhead: %s\n", FileOffset64(int64)); - WriteOut (OUTfp, text); - if (showIndexing && int32 != ZERO_OFFSET) { - long savedOffset = V_tell (CDFfp); - WriteOut (OUTfp, "\n"); - DumpVXR (CDFfp, int32, 5); - WriteOut (OUTfp, "\n"); - if (!SeekTo(CDFfp,savedOffset,vSEEK_SET)) return; - } - if (!Read8(CDFfp,&int64)) return; - sprintf (text, "VXRtail: %s\n", FileOffset64(int64)); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&varFlags)) return; - sprintf (text, "Flags: 0x%lX (", (long) varFlags); - sprintf (EofS(text), "%sVARY,", - BOO(RECvaryBITset(varFlags),"","NO")); - sprintf (EofS(text), "%sPadValue,", - BOO(PADvalueBITset(varFlags),"","No")); - sprintf (EofS(text), "%sSparseArrays,", - BOO(SPARSEarraysBITset(varFlags),"","No")); - sprintf (EofS(text), "%sCompression)\n", - BOO(VARcompressionBITset(varFlags),"","No")); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "sRecords: %ld (%s)\n", (long) int32, - BOO(int32==0, "No-Sparse Record", - BOO(int32==1, "sRecords.PAD", - "sRecords.PREV"))); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "rfuB: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "rfuC: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "rfuF: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (VDRwastedSpace) { - Byte wastedSpace[VDR_WASTED_SIZE64]; - if (!ReadBytes64(CDFfp,wastedSpace,(Int32)VDR_WASTED_SIZE64)) return; - WriteOut (OUTfp, "Skipping over wasted space...\n"); - } - if (!Read4_64(CDFfp,&numElems)) return; - sprintf (text, "NumElems: %ld\n", (long) numElems); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "Num: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read8(CDFfp,&int64)) return; - sprintf (text, "CPRorSPRoffset: %s\n", FileOffset64(int64)); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "BlockingFactor: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!ReadBytes64(CDFfp,varName,(Int32)CDF_VAR_NAME_LEN256)) return; - varName[CDF_VAR_NAME_LEN256] = NUL; - delim = PickDelimiter (varName, strlen(varName)); - sprintf (text, "Name: %c%s%c\n", delim, varName, delim); - WriteOut (OUTfp, text); - if (zVar) { - if (!Read4_64(CDFfp,&numDims)) return; - sprintf (text, "zNumDims: %ld\n", (long) numDims); - WriteOut (OUTfp, text); - for (dimN = 0; dimN < numDims; dimN++) { - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, " zDimSizes[%d]: %ld\n", dimN, (long) int32); - WriteOut (OUTfp, text); - } - } - else - numDims = rNumDims; - for (dimN = 0; dimN < numDims; dimN++) { - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, " DimVarys[%d]: %ld (%s)\n", dimN, (long) int32, - BOO(int32==0, "F", "T")); - WriteOut (OUTfp, text); - } - if (BITSET(varFlags,VDR_PADVALUE_BIT)) { - int i; - nBytes = CDFelemSize((long)dataType) * numElems; - padValue = cdf_AllocateMemory ((size_t) nBytes, FatalError); - if (!ReadBytes64(CDFfp,padValue,(Int32)nBytes)) { - cdf_FreeMemory (padValue, FatalError); - return; - } - strcpyX (text, "PadValue: ", MAX_SCREENLINE_LEN); - strcatX (text, " (0x", MAX_SCREENLINE_LEN); - for (i = (int) (nBytes - 1); i >= 0; i--) { - sprintf (EofS(text), "%02X", (int) ((Byte *)padValue)[i]); - } - strcatX (text, ") ", MAX_SCREENLINE_LEN); - ConvertBuffer ((long) encoding, HOST_DECODING, NEGtoPOSfp0off, - (long) dataType, (long) numElems, padValue, - padValue); - EncodeValuesFormat ((long) dataType, (long) numElems, - padValue, EofS(text), NULL, 0, - MAX_SCREENLINE_LEN - strlen(text), - EPOCH0_STYLE); - strcatX (text, "\n", MAX_SCREENLINE_LEN); - WriteOut (OUTfp, text); - cdf_FreeMemory (padValue, FatalError); - } - } - offset = offset + recordSize; - if (!SeekTo64(CDFfp,offset,vSEEK_SET)) return; - usedBytes64 += recordSize; - break; - } - /********************************************************************** - * Variable indeX Record (VXR). - **********************************************************************/ - case VXR_: { - Int32 nEntries, firstRec[MAX_VXR_ENTRIES]; int entryN; - Int32 lastRec[MAX_VXR_ENTRIES]; OFF_T VVRoffset[MAX_VXR_ENTRIES]; - VXRcount++; - VXRbytes64 += recordSize; - if (MOST(level)) { - if (!Read8(CDFfp,&int64)) return; - sprintf (text, "VXRnext: %s\n", FileOffset64(int64)); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&nEntries)) return; - sprintf (text, "Nentries: %ld\n", (long) nEntries); - WriteOut (OUTfp, text); - if (nEntries > MAX_VXR_ENTRIES) { - WriteOut (OUTfp, "MAX_VXR_ENTRIES exceeded."); - nEntries = MAX_VXR_ENTRIES; - } - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "NusedEntries: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read4s_64(CDFfp,firstRec,(int)nEntries)) return; - if (!Read4s_64(CDFfp,lastRec,(int)nEntries)) return; - if (!Read8s(CDFfp,VVRoffset,(int)nEntries)) return; - WriteOut (OUTfp, "\n Entry FirstRec LastRec Offset\n"); - for (entryN = 0; entryN < nEntries; entryN++) { - sprintf (text, " %2d %7ld %7ld %s\n", entryN, - (long) firstRec[entryN], (long) lastRec[entryN], - FileOffset64(VVRoffset[entryN])); - WriteOut (OUTfp, text); - } - } - offset = offset + recordSize; - if (!SeekTo64(CDFfp,offset,vSEEK_SET)) return; - usedBytes64 += recordSize; - break; - } - /********************************************************************** - * Variable Values Record (VVR). - **********************************************************************/ - case VVR_: { - uByte value; Int32 j; - VVRcount++; - VVRbytes64 += recordSize; - nBytes = recordSize - VVR_BASE_SIZE64; - if (FULL(level)) { - for (j = 0; j < nBytes; j++) { - if (j % BYTESperLINE == 0) WriteOut (OUTfp, "\n "); - if (!ReadBytes64(CDFfp,&value,(Int32)1)) return; - sprintf (text, "%02X", (uInt) value); - WriteOut (OUTfp, text); - } - WriteOut (OUTfp, "\n"); - } - offset = offset + recordSize; - if (!SeekTo64(CDFfp,offset,vSEEK_SET)) return; - usedBytes64 += recordSize; - break; - } - /********************************************************************** - * Compressed Variable Values Record (CVVR). - **********************************************************************/ - case CVVR_: { - uByte value; Int32 j; - CVVRcount++; - CVVRbytes64 += recordSize; - if (MOST(level)) { - if (!Read8(CDFfp,&int64)) return; - sprintf (text, "CPRoffset: %s\n", FileOffset64(int64)); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "cSize: %ld\n", (long) int32); - WriteOut (OUTfp, text); - nBytes = recordSize - CVVR_BASE_SIZE64; - if (FULL(level)) { - OFF_T tmp = nBytes; - j = 0; - while (tmp > 0) { - if (j % BYTESperLINE == 0) WriteOut (OUTfp, "\n "); - if (!ReadBytes64(CDFfp,&value,(Int32)1)) return; - sprintf (text, "%02X", (uInt) value); - WriteOut (OUTfp, text); - tmp--; - j++; - } - } - WriteOut (OUTfp, "\n"); - } - offset = offset + recordSize; - if (!SeekTo64(CDFfp,offset,vSEEK_SET)) return; - usedBytes64 += recordSize; - break; - } - /********************************************************************** - * Compression Parameters Record (CPR). - **********************************************************************/ - case CPR_: { - Int32 pCount; int parmN; - CPRcount++; - CPRbytes64 += recordSize; - if (MOST(level)) { - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "cType: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "rfuA: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&pCount)) return; - sprintf (text, "pCount: %ld\n", (long) pCount); - WriteOut (OUTfp, text); - if (pCount > CDF_MAX_PARMS) { - WriteOut (OUTfp, "\nCDF_MAX_PARMS exceeded.\n"); - pCount = CDF_MAX_PARMS; - } - for (parmN = 0; parmN < pCount; parmN++) { - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, " cParms[%d]: %ld\n", parmN, (long) int32); - WriteOut (OUTfp, text); - } - } - offset = offset + recordSize; - if (!SeekTo64(CDFfp,offset,vSEEK_SET)) return; - usedBytes64 += recordSize; - break; - } - /********************************************************************** - * Sparseness Parameters Record (SPR). - **********************************************************************/ - case SPR_: { - Int32 pCount; int parmN; - SPRcount++; - SPRbytes64 += recordSize; - if (MOST(level)) { - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "sArraysType: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, "rfuA: %ld\n", (long) int32); - WriteOut (OUTfp, text); - if (!Read4_64(CDFfp,&pCount)) return; - sprintf (text, "pCount: %ld\n", (long) pCount); - WriteOut (OUTfp, text); - if (pCount > CDF_MAX_PARMS) { - WriteOut (OUTfp, "\nCDF_MAX_PARMS exceeded.\n"); - pCount = CDF_MAX_PARMS; - } - for (parmN = 0; parmN < pCount; parmN++) { - if (!Read4_64(CDFfp,&int32)) return; - sprintf (text, " sArraysParms[%d]: %ld\n", - parmN, (long) int32); - WriteOut (OUTfp, text); - } - } - offset = offset + recordSize; - if (!SeekTo64(CDFfp,offset,vSEEK_SET)) return; - usedBytes64 += recordSize; - break; - } - /********************************************************************** - * Unused internal record - **********************************************************************/ - case UIR_: { - UIRcount++; - UIRbytes64 += recordSize; - if (28 <= recordSize) { /* Assumed a post-beta V2.5 CDF. */ - if (MOST(level)) { - if (!Read8(CDFfp,&int64)) return; - sprintf (text, "Next: %s\n", FileOffset64(int64)); - WriteOut (OUTfp, text); - if (!Read8(CDFfp,&int64)) return; - sprintf (text, "Prev: %s\n", FileOffset64(int64)); - WriteOut (OUTfp, text); - } - nBytes = recordSize - 28; - if (nBytes > 0) { - Byte byte; - OFF_T tmp = nBytes; - while (tmp > 0) { - if (!ReadBytes64(CDFfp,&byte,(Int32)1)) return; - tmp--; - } - } - } - offset = offset + recordSize; - if (!SeekTo64(CDFfp,offset,vSEEK_SET)) return; - wastedBytes64 += recordSize; - break; - } - /********************************************************************** - * Illegal record type. - **********************************************************************/ - default: { - if (fileSize == offset) - sprintf (text, "EOF encountered.\n"); - else { - sprintf (text, "Illegal record type detected (%ld) (@ %s)\n", - (long) recordType, FileOffset64(offset)); - WriteOut (OUTfp, text); - sprintf (text, - " (May have reached the end of the valid data.)\n"); - } - WriteOut (OUTfp, text); - return; - } - } - CHECKforABORTso - } -} - -/****************************************************************************** -* DisplaySummary. -******************************************************************************/ - -static void DisplaySummary () { - char text[132+1]; int width1, width2; long largestBytes; - long IRcount = CCRcount + CDRcount + GDRcount + ADRcount + AgrEDRcount + - AzEDRcount + rVDRcount + zVDRcount + VXRcount + VVRcount + - CVVRcount + CPRcount + SPRcount + UIRcount; - long totalBytes = usedBytes + wastedBytes; - double pctUsed = 100.0 * (((double) usedBytes) / ((double) totalBytes)); - double pctWasted = 100.0 * (((double) wastedBytes) / ((double) totalBytes)); - double pctCCR = 100.0 * (((double) CCRbytes) / ((double) totalBytes)); - double pctCDR = 100.0 * (((double) CDRbytes) / ((double) totalBytes)); - double pctGDR = 100.0 * (((double) GDRbytes) / ((double) totalBytes)); - double pctADR = 100.0 * (((double) ADRbytes) / ((double) totalBytes)); - double pctAgrEDR = 100.0 * (((double) AgrEDRbytes) / ((double) totalBytes)); - double pctAzEDR = 100.0 * (((double) AzEDRbytes) / ((double) totalBytes)); - double pct_rVDR = 100.0 * (((double) rVDRbytes) / ((double) totalBytes)); - double pct_zVDR = 100.0 * (((double) zVDRbytes) / ((double) totalBytes)); - double pctVXR = 100.0 * (((double) VXRbytes) / ((double) totalBytes)); - double pctVVR = 100.0 * (((double) VVRbytes) / ((double) totalBytes)); - double pctCVVR = 100.0 * (((double) CVVRbytes) / ((double) totalBytes)); - double pctCPR = 100.0 * (((double) CPRbytes) / ((double) totalBytes)); - double pctSPR = 100.0 * (((double) SPRbytes) / ((double) totalBytes)); - double pctUIR = 100.0 * (((double) UIRbytes) / ((double) totalBytes)); - width1 = LongWidth (totalBytes); - largestBytes = 0; - largestBytes = MAXIMUM(largestBytes,CCRbytes); - largestBytes = MAXIMUM(largestBytes,CDRbytes); - largestBytes = MAXIMUM(largestBytes,GDRbytes); - largestBytes = MAXIMUM(largestBytes,ADRbytes); - largestBytes = MAXIMUM(largestBytes,AgrEDRbytes); - largestBytes = MAXIMUM(largestBytes,AzEDRbytes); - largestBytes = MAXIMUM(largestBytes,rVDRbytes); - largestBytes = MAXIMUM(largestBytes,zVDRbytes); - largestBytes = MAXIMUM(largestBytes,VXRbytes); - largestBytes = MAXIMUM(largestBytes,VVRbytes); - largestBytes = MAXIMUM(largestBytes,CVVRbytes); - largestBytes = MAXIMUM(largestBytes,CPRbytes); - largestBytes = MAXIMUM(largestBytes,SPRbytes); - largestBytes = MAXIMUM(largestBytes,UIRbytes); - width2 = LongWidth (largestBytes); - WriteOut (OUTfp, "\n\nSummary..."); - sprintf (text, "\n\n Total bytes: %*ld", width1, totalBytes); -#if defined(vms) - sprintf (EofS(text), " ,%ld blocks\n", (long) (((totalBytes-1)/512)+1)); -#else - strcatX (text, "\n", 132); -#endif - WriteOut (OUTfp, text); - sprintf (text, " Used bytes: %*ld, %7.3f%%\n", - width1, usedBytes, pctUsed); - WriteOut (OUTfp, text); - sprintf (text, " Unused bytes: %*ld, %7.3f%%\n\n", - width1, wastedBytes, pctWasted); - WriteOut (OUTfp, text); - sprintf (text, " IR count: %*ld\n\n", - width1, IRcount); - WriteOut (OUTfp, text); - sprintf (text, " CCR count: %*ld, %*ld bytes, %6.3f%%\n", - width1, CCRcount, width2, CCRbytes, pctCCR); - WriteOut (OUTfp, text); - sprintf (text, " CDR count: %*ld, %*ld bytes, %6.3f%%\n", - width1, CDRcount, width2, CDRbytes, pctCDR); - WriteOut (OUTfp, text); - sprintf (text, " GDR count: %*ld, %*ld bytes, %6.3f%%\n", - width1, GDRcount, width2, GDRbytes, pctGDR); - WriteOut (OUTfp, text); - sprintf (text, " ADR count: %*ld, %*ld bytes, %6.3f%%\n", - width1, ADRcount, width2, ADRbytes, pctADR); - WriteOut (OUTfp, text); - sprintf (text, " AgrEDR count: %*ld, %*ld bytes, %6.3f%%\n", - width1, AgrEDRcount, width2, AgrEDRbytes, pctAgrEDR); - WriteOut (OUTfp, text); - sprintf (text, " AzEDR count: %*ld, %*ld bytes, %6.3f%%\n", - width1, AzEDRcount, width2, AzEDRbytes, pctAzEDR); - WriteOut (OUTfp, text); - sprintf (text, " rVDR count: %*ld, %*ld bytes, %6.3f%%\n", - width1, rVDRcount, width2, rVDRbytes, pct_rVDR); - WriteOut (OUTfp, text); - sprintf (text, " zVDR count: %*ld, %*ld bytes, %6.3f%%\n", - width1, zVDRcount, width2, zVDRbytes, pct_zVDR); - WriteOut (OUTfp, text); - sprintf (text, " VXR count: %*ld, %*ld bytes, %6.3f%%\n", - width1, VXRcount, width2, VXRbytes, pctVXR); - WriteOut (OUTfp, text); - sprintf (text, " VVR count: %*ld, %*ld bytes, %6.3f%%\n", - width1, VVRcount, width2, VVRbytes, pctVVR); - WriteOut (OUTfp, text); - sprintf (text, " CVVR count: %*ld, %*ld bytes, %6.3f%%\n", - width1, CVVRcount, width2, CVVRbytes, pctCVVR); - WriteOut (OUTfp, text); - sprintf (text, " CPR count: %*ld, %*ld bytes, %6.3f%%\n", - width1, CPRcount, width2, CPRbytes, pctCPR); - WriteOut (OUTfp, text); - sprintf (text, " SPR count: %*ld, %*ld bytes, %6.3f%%\n", - width1, SPRcount, width2, SPRbytes, pctSPR); - WriteOut (OUTfp, text); - sprintf (text, " UIR count: %*ld, %*ld bytes, %6.3f%%\n\n\n", - width1, UIRcount, width2, UIRbytes, pctUIR); - WriteOut (OUTfp, text); - return; -} - -/****************************************************************************** -* DisplaySummary64. -******************************************************************************/ - -static void DisplaySummary64 () { - char text[132+1]; int width1, width2; OFF_T largestBytes; - long IRcount = CCRcount + CDRcount + GDRcount + ADRcount + AgrEDRcount + - AzEDRcount + rVDRcount + zVDRcount + VXRcount + VVRcount + - CVVRcount + CPRcount + SPRcount + UIRcount; - OFF_T totalBytes64 = usedBytes64 + wastedBytes64; - double pctUsed = 100.0 * (((double) usedBytes64) / ((double) totalBytes64)); - double pctWasted = 100.0 * (((double) wastedBytes64) / ((double) totalBytes64)); - double pctCCR = 100.0 * (((double) CCRbytes64) / ((double) totalBytes64)); - double pctCDR = 100.0 * (((double) CDRbytes64) / ((double) totalBytes64)); - double pctGDR = 100.0 * (((double) GDRbytes64) / ((double) totalBytes64)); - double pctADR = 100.0 * (((double) ADRbytes64) / ((double) totalBytes64)); - double pctAgrEDR = 100.0 * (((double) AgrEDRbytes64) / ((double) totalBytes64)); - double pctAzEDR = 100.0 * (((double) AzEDRbytes64) / ((double) totalBytes64)); - double pct_rVDR = 100.0 * (((double) rVDRbytes64) / ((double) totalBytes64)); - double pct_zVDR = 100.0 * (((double) zVDRbytes64) / ((double) totalBytes64)); - double pctVXR = 100.0 * (((double) VXRbytes64) / ((double) totalBytes64)); - double pctVVR = 100.0 * (((double) VVRbytes64) / ((double) totalBytes64)); - double pctCVVR = 100.0 * (((double) CVVRbytes64) / ((double) totalBytes64)); - double pctCPR = 100.0 * (((double) CPRbytes64) / ((double) totalBytes64)); - double pctSPR = 100.0 * (((double) SPRbytes64) / ((double) totalBytes64)); - double pctUIR = 100.0 * (((double) UIRbytes64) / ((double) totalBytes64)); - width1 = Long64Width (totalBytes64); - largestBytes = 0; - largestBytes = MAXIMUM(largestBytes,CCRbytes64); - largestBytes = MAXIMUM(largestBytes,CDRbytes64); - largestBytes = MAXIMUM(largestBytes,GDRbytes64); - largestBytes = MAXIMUM(largestBytes,ADRbytes64); - largestBytes = MAXIMUM(largestBytes,AgrEDRbytes64); - largestBytes = MAXIMUM(largestBytes,AzEDRbytes64); - largestBytes = MAXIMUM(largestBytes,rVDRbytes64); - largestBytes = MAXIMUM(largestBytes,zVDRbytes64); - largestBytes = MAXIMUM(largestBytes,VXRbytes64); - largestBytes = MAXIMUM(largestBytes,VVRbytes64); - largestBytes = MAXIMUM(largestBytes,CVVRbytes64); - largestBytes = MAXIMUM(largestBytes,CPRbytes64); - largestBytes = MAXIMUM(largestBytes,SPRbytes64); - largestBytes = MAXIMUM(largestBytes,UIRbytes64); - width2 = Long64Width (largestBytes); - WriteOut (OUTfp, "\n\nSummary..."); -#if !defined(win32) - sprintf (text, "\n\n Total bytes: %*lld", width1, totalBytes64); -#else - sprintf (text, "\n\n Total bytes: %*I64d", width1, totalBytes64); -#endif -#if defined(vms) - sprintf (EofS(text), " ,%ld blocks\n", (long) (((totalBytes64-1)/512)+1)); -#else - strcatX (text, "\n", 132); -#endif - WriteOut (OUTfp, text); -#if !defined(win32) - sprintf (text, " Used bytes: %*lld, %7.3f%%\n", - width1, usedBytes64, pctUsed); -#else - sprintf (text, " Used bytes: %*I64d, %7.3f%%\n", - width1, usedBytes64, pctUsed); -#endif - WriteOut (OUTfp, text); -#if !defined(win32) - sprintf (text, " Unused bytes: %*lld, %7.3f%%\n\n", - width1, wastedBytes64, pctWasted); -#else - sprintf (text, " Unused bytes: %*I64d, %7.3f%%\n\n", - width1, wastedBytes64, pctWasted); -#endif - WriteOut (OUTfp, text); - sprintf (text, " IR count: %*ld\n\n", - width1, IRcount); - WriteOut (OUTfp, text); -#if !defined(win32) - sprintf (text, " CCR count: %*ld, %*lld bytes, %6.3f%%\n", - width1, CCRcount, width2, CCRbytes64, pctCCR); -#else - sprintf (text, " CCR count: %*ld, %*I64d bytes, %6.3f%%\n", - width1, CCRcount, width2, CCRbytes64, pctCCR); -#endif - WriteOut (OUTfp, text); -#if !defined(win32) - sprintf (text, " CDR count: %*ld, %*lld bytes, %6.3f%%\n", - width1, CDRcount, width2, CDRbytes64, pctCDR); -#else - sprintf (text, " CDR count: %*ld, %*I64d bytes, %6.3f%%\n", - width1, CDRcount, width2, CDRbytes64, pctCDR); -#endif - WriteOut (OUTfp, text); -#if !defined(win32) - sprintf (text, " GDR count: %*ld, %*lld bytes, %6.3f%%\n", - width1, GDRcount, width2, GDRbytes64, pctGDR); -#else - sprintf (text, " GDR count: %*ld, %*I64d bytes, %6.3f%%\n", - width1, GDRcount, width2, GDRbytes64, pctGDR); -#endif - WriteOut (OUTfp, text); -#if !defined(win32) - sprintf (text, " ADR count: %*ld, %*lld bytes, %6.3f%%\n", - width1, ADRcount, width2, ADRbytes64, pctADR); -#else - sprintf (text, " ADR count: %*ld, %*I64d bytes, %6.3f%%\n", - width1, ADRcount, width2, ADRbytes64, pctADR); -#endif - WriteOut (OUTfp, text); -#if !defined(win32) - sprintf (text, " AgrEDR count: %*ld, %*lld bytes, %6.3f%%\n", - width1, AgrEDRcount, width2, AgrEDRbytes64, pctAgrEDR); -#else - sprintf (text, " AgrEDR count: %*ld, %*I64d bytes, %6.3f%%\n", - width1, AgrEDRcount, width2, AgrEDRbytes64, pctAgrEDR); -#endif - WriteOut (OUTfp, text); -#if !defined(win32) - sprintf (text, " AzEDR count: %*ld, %*lld bytes, %6.3f%%\n", - width1, AzEDRcount, width2, AzEDRbytes64, pctAzEDR); -#else - sprintf (text, " AzEDR count: %*ld, %*I64d bytes, %6.3f%%\n", - width1, AzEDRcount, width2, AzEDRbytes64, pctAzEDR); -#endif - WriteOut (OUTfp, text); -#if !defined(win32) - sprintf (text, " rVDR count: %*ld, %*lld bytes, %6.3f%%\n", - width1, rVDRcount, width2, rVDRbytes64, pct_rVDR); -#else - sprintf (text, " rVDR count: %*ld, %*I64d bytes, %6.3f%%\n", - width1, rVDRcount, width2, rVDRbytes64, pct_rVDR); -#endif - WriteOut (OUTfp, text); -#if !defined(win32) - sprintf (text, " zVDR count: %*ld, %*lld bytes, %6.3f%%\n", - width1, zVDRcount, width2, zVDRbytes64, pct_zVDR); -#else - sprintf (text, " zVDR count: %*ld, %*I64d bytes, %6.3f%%\n", - width1, zVDRcount, width2, zVDRbytes64, pct_zVDR); -#endif - WriteOut (OUTfp, text); -#if !defined(win32) - sprintf (text, " VXR count: %*ld, %*lld bytes, %6.3f%%\n", - width1, VXRcount, width2, VXRbytes64, pctVXR); -#else - sprintf (text, " VXR count: %*ld, %*I64d bytes, %6.3f%%\n", - width1, VXRcount, width2, VXRbytes64, pctVXR); -#endif - WriteOut (OUTfp, text); -#if !defined(win32) - sprintf (text, " VVR count: %*ld, %*lld bytes, %6.3f%%\n", - width1, VVRcount, width2, VVRbytes64, pctVVR); -#else - sprintf (text, " VVR count: %*ld, %*I64d bytes, %6.3f%%\n", - width1, VVRcount, width2, VVRbytes64, pctVVR); -#endif - WriteOut (OUTfp, text); -#if !defined(win32) - sprintf (text, " CVVR count: %*ld, %*lld bytes, %6.3f%%\n", - width1, CVVRcount, width2, CVVRbytes64, pctCVVR); -#else - sprintf (text, " CVVR count: %*ld, %*I64d bytes, %6.3f%%\n", - width1, CVVRcount, width2, CVVRbytes64, pctCVVR); -#endif - WriteOut (OUTfp, text); -#if !defined(win32) - sprintf (text, " CPR count: %*ld, %*lld bytes, %6.3f%%\n", - width1, CPRcount, width2, CPRbytes64, pctCPR); -#else - sprintf (text, " CPR count: %*ld, %*I64d bytes, %6.3f%%\n", - width1, CPRcount, width2, CPRbytes64, pctCPR); -#endif - WriteOut (OUTfp, text); -#if !defined(win32) - sprintf (text, " SPR count: %*ld, %*lld bytes, %6.3f%%\n", - width1, SPRcount, width2, SPRbytes64, pctSPR); -#else - sprintf (text, " SPR count: %*ld, %*I64d bytes, %6.3f%%\n", - width1, SPRcount, width2, SPRbytes64, pctSPR); -#endif - WriteOut (OUTfp, text); -#if !defined(win32) - sprintf (text, " UIR count: %*ld, %*lld bytes, %6.3f%%\n\n\n", - width1, UIRcount, width2, UIRbytes64, pctUIR); -#else - sprintf (text, " UIR count: %*ld, %*I64d bytes, %6.3f%%\n\n\n", - width1, UIRcount, width2, UIRbytes64, pctUIR); -#endif - WriteOut (OUTfp, text); - return; -} - -/****************************************************************************** -* DumpVXR. -******************************************************************************/ - -static void DumpVXR (CDFfp, vxrOffset, indent) -vFILE *CDFfp; -Int32 vxrOffset; -int indent; -{ - char text[MAX_SCREENLINE_LEN+1]; - struct VXRstruct VXR; int entryN; - Int32 irType; - ReadVXR (CDFfp, vxrOffset, - VXR_RECORD, &VXR, - VXR_NULL); - CpyNcharacters (text, indent, ' '); - sprintf (EofS(text), "VXR @ %s (%d/%d)\n", - FileOffset(vxrOffset), VXR.NusedEntries, VXR.Nentries); - WriteOut (OUTfp, text); - for (entryN = 0; entryN < VXR.Nentries; entryN++) { - CpyNcharacters (text, indent, ' '); - if (VXR.First[entryN] == NO_RECORD) - strcatX (text, "-------- ", MAX_SCREENLINE_LEN); - else - sprintf (EofS(text), "%08ld ", (long) VXR.First[entryN]); - if (VXR.Last[entryN] == NO_RECORD) - strcatX (text, "-------- ", MAX_SCREENLINE_LEN); - else - sprintf (EofS(text), "%08ld ", (long) VXR.Last[entryN]); - if (VXR.Offset[entryN] == NO_OFFSET) - strcatX (text, "----------", MAX_SCREENLINE_LEN); - else - strcatX (text, FileOffset(VXR.Offset[entryN]), MAX_SCREENLINE_LEN); - strcatX (text, "\n", MAX_SCREENLINE_LEN); - WriteOut (OUTfp, text); - if (VXR.Offset[entryN] != NO_OFFSET) { - ReadIrType (CDFfp, VXR.Offset[entryN], &irType); - switch (irType) { - case VVR_: - case CVVR_: - break; - case VXR_: - DumpVXR (CDFfp, VXR.Offset[entryN], indent + 5); - break; - default: - break; - } - } - } - if (VXR.VXRnext != ZERO_OFFSET) DumpVXR (CDFfp, VXR.VXRnext, indent); - return; -} - -/****************************************************************************** -* DumpVXR64. -******************************************************************************/ - -static void DumpVXR64 (CDFfp, vxrOffset, indent) -vFILE *CDFfp; -OFF_T vxrOffset; -int indent; -{ - char text[MAX_SCREENLINE_LEN+1]; - struct VXRstruct64 VXR; int entryN; - Int32 irType; - ReadVXR64 (CDFfp, vxrOffset, - VXR_RECORD, &VXR, - VXR_NULL); - CpyNcharacters (text, indent, ' '); - sprintf (EofS(text), "VXR @ %s (%d/%d)\n", - FileOffset64(vxrOffset), VXR.NusedEntries, VXR.Nentries); - WriteOut (OUTfp, text); - for (entryN = 0; entryN < VXR.Nentries; entryN++) { - CpyNcharacters (text, indent, ' '); - if (VXR.First[entryN] == NO_RECORD) - strcatX (text, "-------- ", MAX_SCREENLINE_LEN); - else - sprintf (EofS(text), "%08ld ", (long) VXR.First[entryN]); - if (VXR.Last[entryN] == NO_RECORD) - strcatX (text, "-------- ", MAX_SCREENLINE_LEN); - else - sprintf (EofS(text), "%08ld ", (long) VXR.Last[entryN]); - if (VXR.Offset[entryN] == (OFF_T)NO_OFFSET64) - strcatX (text, "----------", MAX_SCREENLINE_LEN); - else - strcatX (text, FileOffset64(VXR.Offset[entryN]), MAX_SCREENLINE_LEN); - strcatX (text, "\n", MAX_SCREENLINE_LEN); - WriteOut (OUTfp, text); - if (VXR.Offset[entryN] != (OFF_T)NO_OFFSET64) { - ReadIrType64 (CDFfp, VXR.Offset[entryN], &irType); - switch (irType) { - case VVR_: - case CVVR_: - break; - case VXR_: - DumpVXR64 (CDFfp, VXR.Offset[entryN], indent + 5); - break; - default: - break; - } - } - } - if (VXR.VXRnext != ZERO_OFFSET64) DumpVXR64 (CDFfp, VXR.VXRnext, indent); - return; -} - -/****************************************************************************** -* FileOffset. -******************************************************************************/ - -static char *FileOffset (offset) -Int32 offset; -{ - switch (radix) { - case 10: return Deci32(offset); - case 16: return Hex32(offset); - default: return "?"; - } -} - -/****************************************************************************** -* FileOffset64. -******************************************************************************/ - -static char *FileOffset64 (offset) -OFF_T offset; -{ - switch (radix) { - case 10: return Deci64(offset); - case 16: return Hex64(offset); - default: return "?"; - } -} - -/****************************************************************************** -* Deci32. -******************************************************************************/ - -static char *Deci32 (value) -Int32 value; -{ - static char text[3][10+1]; - static int which = -1; - which = (which + 1) % 3; - sprintf (text[which], "%010ld", (long) value); - return text[which]; -} - -/****************************************************************************** -* Deci64. -******************************************************************************/ - -static char *Deci64 (value) -OFF_T value; -{ - static char text[3][20+1]; - static int which = -1; - which = (which + 1) % 3; -#if !defined(win32) - sprintf (text[which], "%020lld", (OFF_T) value); -#else - sprintf (text[which], "%020I64d", (OFF_T) value); -#endif - return text[which]; -} - -/****************************************************************************** -* Hex64. -******************************************************************************/ - -static char *Hex64 (value) -OFF_T value; -{ - static char text[3][20+1]; - static int which = -1; - which = (which + 1) % 3; - sprintf (text[which], Int64hexFORMAT, value); - return text[which]; -} - -/****************************************************************************** -* Hex32. -******************************************************************************/ - -static char *Hex32 (value) -Int32 value; -{ - static char text[3][10+1]; - static int which = -1; - which = (which + 1) % 3; - sprintf (text[which], Int32hexFORMAT, value); - return text[which]; -} - -/****************************************************************************** -* Hex32_64. -******************************************************************************/ - -static char *Hex32_64 (value) -Int32 value; -{ - static char text[3][10+1]; - static int which = -1; - which = (which + 1) % 3; - sprintf (text[which], Int32hexFORMAT, value); - return text[which]; -} - -/****************************************************************************** -* SeekTo. -******************************************************************************/ - -static Logical SeekTo (fp, offset, how) -vFILE *fp; -long offset; -int how; -{ - if (!SEEKv(fp,offset,how)) { - WriteOut (OUTfp, "\nSeek error.\n"); - return FALSE; - } - return TRUE; -} - -/****************************************************************************** -* SeekTo64. -******************************************************************************/ - -static Logical SeekTo64 (fp, offset, how) -vFILE *fp; -OFF_T offset; -int how; -{ - if (!SEEKv64(fp,offset,how)) { - WriteOut (OUTfp, "\nSeek error.\n"); - return FALSE; - } - return TRUE; -} - -/****************************************************************************** -* Read4. -******************************************************************************/ - -static Logical Read4 (fp, value) -vFILE *fp; -Int32 *value; -{ - if (!Read32(fp,value)) { - DisplayReadFailure (fp); - return FALSE; - } - return TRUE; -} - -/****************************************************************************** -* Read4_64. -******************************************************************************/ - -static Logical Read4_64 (fp, value) -vFILE *fp; -Int32 *value; -{ - if (!Read32_64(fp,value)) { - DisplayReadFailure (fp); - return FALSE; - } - return TRUE; -} - -/****************************************************************************** -* Read8. -******************************************************************************/ - -static Logical Read8 (fp, value) -vFILE *fp; -OFF_T *value; -{ - if (!Read64_64(fp,value)) { - DisplayReadFailure (fp); - return FALSE; - } - return TRUE; -} - -/****************************************************************************** -* Read4s. -******************************************************************************/ - -static Logical Read4s (fp, values, count) -vFILE *fp; -Int32 *values; -int count; -{ - int i; - for (i = 0; i < count; i++) { - if (!Read32(fp,&values[i])) return FALSE; - } - return TRUE; -} - -/****************************************************************************** -* Read4s_64. -******************************************************************************/ - -static Logical Read4s_64 (fp, values, count) -vFILE *fp; -Int32 *values; -int count; -{ - int i; - for (i = 0; i < count; i++) { - if (!Read32_64(fp,&values[i])) return FALSE; - } - return TRUE; -} - -/****************************************************************************** -* Read8s. -******************************************************************************/ - -static Logical Read8s (fp, values, count) -vFILE *fp; -OFF_T *values; -int count; -{ - int i; - for (i = 0; i < count; i++) { - if (!Read64_64(fp,&values[i])) return FALSE; - } - return TRUE; -} - -/****************************************************************************** -* ReadBytes. -******************************************************************************/ - -static Logical ReadBytes (fp, bytes, count) -vFILE *fp; -void *bytes; -Int32 count; -{ - if (!READv(bytes,(size_t)1,(size_t)count,fp)) { - DisplayReadFailure (fp); - return FALSE; - } - return TRUE; -} - -/****************************************************************************** -* ReadBytes64. -******************************************************************************/ - -static Logical ReadBytes64 (fp, bytes, count) -vFILE *fp; -void *bytes; -Int32 count; -{ - if (!READv64(bytes,(size_t)1,(size_t)count,fp)) { - DisplayReadFailure (fp); - return FALSE; - } - return TRUE; -} - -/****************************************************************************** -* DisplayReadFailure. -******************************************************************************/ - -static void DisplayReadFailure (fp) -vFILE *fp; -{ - if (V_error(fp)) { - WriteOut (OUTfp, "\nRead failed - error from file system.\n"); - return; - } - if (V_eof(fp)) { - WriteOut (OUTfp, BOO(EOFok,"\nEOF encountered.\n", - "\nUnexpected EOF encountered.\n")); - return; - } - WriteOut (OUTfp, "\nUnknown read error - contact CDFsupport.\n"); - return; -} - -/****************************************************************************** -* DumpQOPs. -* Returns TRUE if execution should continue. -******************************************************************************/ - -#if defined(mac) -Logical DumpQOPs (argC, argV) -int *argC; -char **argV[]; -{ - DialogPtr dialogP; - DialogRecord dRecord; - WindowPtr behind = (WindowPtr) -1; - ControlHandle controlHs[MAXIMUMin+1]; - Rect iRect; -#ifdef __MWERKS__ - ModalFilterUPP FilterDialogQOPsoUPP; - FileFilterUPP FilterForCDFsUPP; - UserItemUPP OutlineDefaultButtonUPP; -#endif - short itemN, iType; - static Logical first = TRUE; - char cancelTitle[] = "Cancel"; - static int dumpLevel = DEFAULTlevelDUMP; - static Logical pageOutput = DEFAULTpageCVT; - static Logical checkSizes = DEFAULTsizesDUMP; - static Logical showSummary = DEFAULTsummaryDUMP; - static Logical showIndexing = DEFAULTindexingDUMP; - static Str255 CDFtext = "\p"; - static Str255 outText = "\p"; - /**************************************************************************** - * Create the dialog and get the control handles. - ****************************************************************************/ - dialogP = GetNewDialog (QOPri, &dRecord, behind); - for (itemN = 1; itemN <= MAXIMUMin; itemN++) { - GetDItem (dialogP, itemN, &iType, (Handle *) &controlHs[itemN], &iRect); - } - /**************************************************************************** - * Set the control values. - ****************************************************************************/ - SetIText ((Handle) controlHs[CDFTEXTin], CDFtext); - SetIText ((Handle) controlHs[OUTTEXTin], outText); - switch (dumpLevel) { - case BRIEF_: SetCtlValue (controlHs[BRIEFin], 1); break; - case MOST_: SetCtlValue (controlHs[MOSTin], 1); break; - case FULL_: SetCtlValue (controlHs[FULLin], 1); break; - } - if (pageOutput) SetCtlValue (controlHs[PAGEin], 1); - if (checkSizes) SetCtlValue (controlHs[SIZESin], 1); - if (showSummary) SetCtlValue (controlHs[SUMMARYin], 1); - if (showIndexing) SetCtlValue (controlHs[INDEXINGin], 1); -#ifndef __MWERKS__ - SetDItem (dialogP, (short) ODBin, (short) userItem, - (Handle) OutlineDefaultButton, &iRect); -#else - OutlineDefaultButtonUPP = NewUserItemProc (OutlineDefaultButton); - SetDItem (dialogP, (short) ODBin, (short) userItem, - (Handle) OutlineDefaultButtonUPP, &iRect); -#endif - /**************************************************************************** - * Change the "Quit" button to a "Cancel" button after the first time. - ****************************************************************************/ - if (first) - first = FALSE; - else - SetCTitle (controlHs[CANCELin], CtoPstr(cancelTitle)); - /**************************************************************************** - * Display the dialog and wait for user actions. - ****************************************************************************/ - ShowWindow ((WindowPtr) dialogP); - SetCursor (ARROW_CURSOR); -#ifdef __MWERKS__ - FilterDialogQOPsoUPP = NewModalFilterProc (FilterDialogQOPso); -#endif - - for (;;) { -#ifndef __MWERKS__ - ModalDialog (FilterDialogQOPso, &itemN); -#else - ModalDialog (FilterDialogQOPsoUPP, &itemN); -#endif - switch (itemN) { - /************************************************************************ - * Ok. - ************************************************************************/ - case OKin: { - int n; - /********************************************************************** - * Get the value of each control. - **********************************************************************/ - GetIText ((Handle) controlHs[CDFTEXTin], CDFtext); - GetIText ((Handle) controlHs[OUTTEXTin], outText); - if (GetCtlValue(controlHs[BRIEFin])) dumpLevel = BRIEF_; - if (GetCtlValue(controlHs[MOSTin])) dumpLevel = MOST_; - if (GetCtlValue(controlHs[FULLin])) dumpLevel = FULL_; - pageOutput = GetCtlValue (controlHs[PAGEin]); - checkSizes = GetCtlValue (controlHs[SIZESin]); - showSummary = GetCtlValue (controlHs[SUMMARYin]); - showIndexing = GetCtlValue (controlHs[INDEXINGin]); - /********************************************************************** - * Build argc/argv. - **********************************************************************/ - *argC = 6 + BOO(NULpString(CDFtext),0,1) + - BOO(NULpString(outText),0,2); - *argV = (char **) cdf_AllocateMemory (*argC * sizeof(char *), - FatalError); - n = 0; - MAKEstrARGv (argV, n, pgmName) - if (!NULpString(CDFtext)) { - PtoCstr (CDFtext); - MAKEstrARGv (argV, n, (char *) CDFtext) - CtoPstr ((char *) CDFtext); - } - switch (dumpLevel) { - case BRIEF_: - MAKEstrARGv (argV, n, "-brief") - break; - case MOST_: - MAKEstrARGv (argV, n, "-most") - break; - case FULL_: - MAKEstrARGv (argV, n, "-full") - break; - } - MAKEbooARGv (argV, n, pageOutput, "-page", "-nopage") - MAKEbooARGv (argV, n, checkSizes, "-sizes", "-nosizes") - MAKEbooARGv (argV, n, showSummary, "-summary", "-nosummary") - MAKEbooARGv (argV, n, showIndexing, "-indexing", "-noindexing") - if (!NULpString(outText)) { - MAKEstrARGv (argV, n, "-output") - PtoCstr (outText); - MAKEstrARGv (argV, n, (char *) outText) - CtoPstr ((char *) outText); - } - /********************************************************************** - * Close the dialog and return. - **********************************************************************/ -#ifdef __MWERKS__ - DisposeRoutineDescriptor (FilterDialogQOPsoUPP); - DisposeRoutineDescriptor (OutlineDefaultButtonUPP); -#endif - CloseDialog (dialogP); - return TRUE; - } - /************************************************************************ - * Help. - ************************************************************************/ - case HELPin: { - int n; - *argC = 1; - *argV = (char **) cdf_AllocateMemory (*argC * sizeof(char *), - FatalError); - n = 0; - MAKEstrARGv (argV, n, pgmName) -#ifdef __MWERKS__ - DisposeRoutineDescriptor (FilterDialogQOPsoUPP); - DisposeRoutineDescriptor (OutlineDefaultButtonUPP); -#endif - CloseDialog (dialogP); - return TRUE; - } - /************************************************************************ - * Cancel. - ************************************************************************/ - case CANCELin: -#ifdef __MWERKS__ - DisposeRoutineDescriptor (FilterDialogQOPsoUPP); - DisposeRoutineDescriptor (OutlineDefaultButtonUPP); -#endif - CloseDialog (dialogP); - return FALSE; - /************************************************************************ - * Select CDF specification. - ************************************************************************/ - case CDFSELECTin: { - StandardFileReply CDFreply; - char CDFpath[DU_MAX_PATH_LEN+1]; -#ifndef __MWERKS__ - StandardGetFile (FilterForCDFs, -1, NULL, &CDFreply); -#else - FilterForCDFsUPP = NewFileFilterProc((ProcPtr) FilterForCDFs); - StandardGetFile (FilterForCDFsUPP, -1, NULL, &CDFreply); - DisposeRoutineDescriptor (FilterForCDFsUPP); -#endif - if (CDFreply.sfGood && !CDFreply.sfIsFolder && !CDFreply.sfIsVolume) { - BuildMacPath (&CDFreply.sfFile, CDFpath, TRUE); - CDFtext[0] = strlen (CDFpath); - strcpyX ((char *) &CDFtext[1], CDFpath, 255); - SetIText ((Handle) controlHs[CDFTEXTin], CDFtext); - } - break; - } - /************************************************************************ - * Select output file specification. - * The cursor is set because `StandardPutFile' leaves the cursor as - * an iBeam (instead of returning it to what it was). - ************************************************************************/ - case OUTSELECTin: { - StandardFileReply outReply; - char outPath[DU_MAX_PATH_LEN+1], prompt[] = "Enter output file:"; - StandardPutFile (CtoPstr(prompt), CtoPstr(""), &outReply); - if (outReply.sfGood && !outReply.sfIsFolder && !outReply.sfIsVolume) { - BuildMacPath (&outReply.sfFile, outPath, TRUE); - outText[0] = strlen (outPath); - strcpyX ((char *) &outText[1], outPath, 255); - SetIText ((Handle) controlHs[OUTTEXTin], outText); - } - SetCursor (&(qd.arrow)); - break; - } - /************************************************************************ - * Check boxes. - ************************************************************************/ - case SIZESin: - case PAGEin: - case SUMMARYin: - case INDEXINGin: - SetCtlValue (controlHs[itemN], BOO(GetCtlValue(controlHs[itemN]),0,1)); - break; - /************************************************************************ - * Radio buttons. - ************************************************************************/ - case BRIEFin: - SetCtlValue (controlHs[BRIEFin], 1); - SetCtlValue (controlHs[MOSTin], 0); - SetCtlValue (controlHs[FULLin], 0); - break; - case MOSTin: - SetCtlValue (controlHs[BRIEFin], 0); - SetCtlValue (controlHs[MOSTin], 1); - SetCtlValue (controlHs[FULLin], 0); - break; - case FULLin: - SetCtlValue (controlHs[BRIEFin], 0); - SetCtlValue (controlHs[MOSTin], 0); - SetCtlValue (controlHs[FULLin], 1); - break; - } - } -} -#endif diff -urN cdf31-dist.orig/src/tools/toolbox1.c cdf31-dist/src/tools/toolbox1.c --- cdf31-dist.orig/src/tools/toolbox1.c Fri Jan 20 16:13:10 2006 +++ cdf31-dist/src/tools/toolbox1.c Thu Nov 9 16:03:06 2006 @@ -37,6 +37,8 @@ * V1.5d 23-Nov-97, J Love More Windows NT. * V1.6 10-May-01, M Liu New port for Cygwin * V1.7 11-Jul-05, M Liu Added MingW port for PC. +* V1.7 13-Oct-06, M Liu Changed to allow upper and lower case CDF +* name to be used on win32. * ******************************************************************************/ @@ -3296,7 +3298,7 @@ #else strcatX (mask, "\"", MAX_REPORTMASK_LEN); #endif -#if defined(vms) +#if defined(vms) || defined(dos) MakeUpperString (mask); #endif return mask; @@ -3341,9 +3343,9 @@ { int match, beyond; size_t targetL = strlen(target); for (match = 0; strings[match] != NULL; match++) { - if (!strncmpIgCasePattern(target,strings[match],targetL)) { + if (strncmpIgCasePattern(target,strings[match],targetL) == 0) { for (beyond = match + 1; strings[beyond] != NULL; beyond++) { - if (!strncmpIgCasePattern(target,strings[beyond],targetL)) + if (strncmpIgCasePattern(target,strings[beyond],targetL) == 0) return MATCHES; } return match; diff -urN cdf31-dist.orig/src/tools/toolbox3.c cdf31-dist/src/tools/toolbox3.c --- cdf31-dist.orig/src/tools/toolbox3.c Tue Jan 24 16:49:44 2006 +++ cdf31-dist/src/tools/toolbox3.c Tue Nov 21 21:59:56 2006 @@ -32,6 +32,8 @@ * V1.7 05-May-04, M Liu Changed function AllocateBuffers when the * record count is 1 or more. * V1.8 11-Jul-05, M Liu Added MingW port for PC. +* V1.9 13-Oct-06, M Liu Changed to allow upper and lower case CDF +* name to be used on win32. * ******************************************************************************/ @@ -1805,8 +1807,8 @@ long WhichFormat (token) char *token; { - if (!strncmpIgCase(token,"SINGLE",6)) return SINGLE_FILE; - if (!strncmpIgCase(token,"MULTI",5)) return MULTI_FILE; + if (strncmpIgCase(token,"SINGLE",6) != 0) return SINGLE_FILE; + if (strncmpIgCase(token,"MULTI",5) != 0) return MULTI_FILE; return -1; } @@ -1817,9 +1819,9 @@ long WhichMajority (token) char *token; { - if (!strncmpIgCase(token,"ROW",3)) return ROW_MAJOR; - if (!strncmpIgCase(token,"COL",3) || - !strncmp(token,"COLUMN",6)) return COLUMN_MAJOR; + if (strncmpIgCase(token,"ROW",3) != 0) return ROW_MAJOR; + if ((strncmpIgCase(token,"COL",3) != 0) || + (strncmpIgCase(token,"COLUMN",6) != 0)) return COLUMN_MAJOR; return -1; } @@ -1830,9 +1832,9 @@ long WhichRecSparseness (token) char *token; { - if (!strncmpIgCase(token,"None",4)) return NO_SPARSERECORDS; - if (!strncmpIgCase(token,"sRecords.PAD",12)) return PAD_SPARSERECORDS; - if (!strncmpIgCase(token,"sRecords.PREV",13)) return PREV_SPARSERECORDS; + if (strncmpIgCase(token,"None",4) != 0) return NO_SPARSERECORDS; + if (strncmpIgCase(token,"sRecords.PAD",12) != 0) return PAD_SPARSERECORDS; + if (strncmpIgCase(token,"sRecords.PREV",13) != 0) return PREV_SPARSERECORDS; return -1; } @@ -1847,11 +1849,11 @@ { *compression = -1; cParms[0] = 0; - if (!strncmpIgCase(token,"None",4)) *compression = NO_COMPRESSION; - if (!strncmpIgCase(token,"RLE",3)) *compression = RLE_COMPRESSION; - if (!strncmpIgCase(token,"HUFF",4)) *compression = HUFF_COMPRESSION; - if (!strncmpIgCase(token,"AHUFF",5)) *compression = AHUFF_COMPRESSION; - if (!strncmpIgCase(token,"GZIP",4)) { + if (strncmpIgCase(token,"None",4) != 0) *compression = NO_COMPRESSION; + if (strncmpIgCase(token,"RLE",3) != 0) *compression = RLE_COMPRESSION; + if (strncmpIgCase(token,"HUFF",4) != 0) *compression = HUFF_COMPRESSION; + if (strncmpIgCase(token,"AHUFF",5) != 0) *compression = AHUFF_COMPRESSION; + if (strncmpIgCase(token,"GZIP",4) != 0) { int clevel; if (sscanf(token,"GZIP.%1d",&clevel) == 1) if (INCLUSIVE(1,clevel,9)) { @@ -1859,7 +1861,7 @@ cParms[0] = (long) clevel; } } -/* if (!strncmpIgCase(token,"ZLIB",4)) *compression = ZLIB_COMPRESSION; */ +/* if (strncmpIgCase(token,"ZLIB",4) != 0) *compression = ZLIB_COMPRESSION; */ return (long) *compression; } @@ -1871,23 +1873,23 @@ long WhichEncoding (token) char *token; { - if (!strncmpIgCase(token,"HOST",4)) return HOST_ENCODING; - if (!strncmpIgCase(token,"NETWORK",6)) return NETWORK_ENCODING; - if (!strncmpIgCase(token,"VAX",3)) return VAX_ENCODING; - if (!strncmpIgCase(token,"SUN",3)) return SUN_ENCODING; - if (!strncmpIgCase(token,"SGi",3) || - !strncmpIgCase(token,"MIPSEB",6)) return SGi_ENCODING; - if (!strncmpIgCase(token,"DECSTATION",10) || - !strncmpIgCase(token,"MIPSEL",6)) return DECSTATION_ENCODING; - if (!strncmpIgCase(token,"IBMRS",5)) return IBMRS_ENCODING; - if (!strncmpIgCase(token,"IBMPC",5)) return IBMPC_ENCODING; - if (!strncmpIgCase(token,"HP",2)) return HP_ENCODING; - if (!strncmpIgCase(token,"NeXT",4)) return NeXT_ENCODING; - if (!strncmpIgCase(token,"ALPHAOSF1",9)) return ALPHAOSF1_ENCODING; - if (!strncmpIgCase(token,"ALPHAVMSd",9)) return ALPHAVMSd_ENCODING; - if (!strncmpIgCase(token,"ALPHAVMSg",9)) return ALPHAVMSg_ENCODING; - if (!strncmpIgCase(token,"ALPHAVMSi",9)) return ALPHAVMSi_ENCODING; - if (!strncmpIgCase(token,"MAC",3)) return MAC_ENCODING; + if (strncmpIgCase(token,"HOST",4) != 0) return HOST_ENCODING; + if (strncmpIgCase(token,"NETWORK",6) != 0) return NETWORK_ENCODING; + if (strncmpIgCase(token,"VAX",3) != 0) return VAX_ENCODING; + if (strncmpIgCase(token,"SUN",3) != 0) return SUN_ENCODING; + if ((strncmpIgCase(token,"SGi",3) != 0) || + (strncmpIgCase(token,"MIPSEB",6) != 0)) return SGi_ENCODING; + if ((strncmpIgCase(token,"DECSTATION",10) != 0) || + (strncmpIgCase(token,"MIPSEL",6) != 0)) return DECSTATION_ENCODING; + if (strncmpIgCase(token,"IBMRS",5) != 0) return IBMRS_ENCODING; + if (strncmpIgCase(token,"IBMPC",5) != 0) return IBMPC_ENCODING; + if (strncmpIgCase(token,"HP",2) != 0) return HP_ENCODING; + if (strncmpIgCase(token,"NeXT",4) != 0) return NeXT_ENCODING; + if (strncmpIgCase(token,"ALPHAOSF1",9) != 0) return ALPHAOSF1_ENCODING; + if (strncmpIgCase(token,"ALPHAVMSd",9) != 0) return ALPHAVMSd_ENCODING; + if (strncmpIgCase(token,"ALPHAVMSg",9) != 0) return ALPHAVMSg_ENCODING; + if (strncmpIgCase(token,"ALPHAVMSi",9) != 0) return ALPHAVMSi_ENCODING; + if (strncmpIgCase(token,"MAC",3) != 0) return MAC_ENCODING; return -1; } @@ -1898,36 +1900,36 @@ long WhichDataType (token) char *token; { - if (!strncmpIgCase(token,"BYTE",4)) return CDF_BYTE; - if (!strncmpIgCase(token,"INT1",4)) return CDF_INT1; - if (!strncmpIgCase(token,"UINT1",5)) return CDF_UINT1; - if (!strncmpIgCase(token,"INT2",4)) return CDF_INT2; - if (!strncmpIgCase(token,"UINT2",5)) return CDF_UINT2; - if (!strncmpIgCase(token,"INT4",4)) return CDF_INT4; - if (!strncmpIgCase(token,"UINT4",5)) return CDF_UINT4; - if (!strncmpIgCase(token,"REAL4",5)) return CDF_REAL4; - if (!strncmpIgCase(token,"FLOAT",5)) return CDF_FLOAT; - if (!strncmpIgCase(token,"REAL8",5)) return CDF_REAL8; - if (!strncmpIgCase(token,"DOUBLE",6)) return CDF_DOUBLE; - if (!strncmpIgCase(token,"CHAR",4)) return CDF_CHAR; - if (!strncmpIgCase(token,"UCHAR",5)) return CDF_UCHAR; - if (!strncmpIgCase(token,"EPOCH",5)) return CDF_EPOCH; - if (!strncmpIgCase(token,"EPOCH16",7)) return CDF_EPOCH16; - if (!strncmpIgCase(token,"CDF_BYTE",8)) return CDF_BYTE; - if (!strncmpIgCase(token,"CDF_INT1",8)) return CDF_INT1; - if (!strncmpIgCase(token,"CDF_UINT1",9)) return CDF_UINT1; - if (!strncmpIgCase(token,"CDF_INT2",8)) return CDF_INT2; - if (!strncmpIgCase(token,"CDF_UINT2",9)) return CDF_UINT2; - if (!strncmpIgCase(token,"CDF_INT4",8)) return CDF_INT4; - if (!strncmpIgCase(token,"CDF_UINT4",9)) return CDF_UINT4; - if (!strncmpIgCase(token,"CDF_REAL4",9)) return CDF_REAL4; - if (!strncmpIgCase(token,"CDF_FLOAT",9)) return CDF_FLOAT; - if (!strncmpIgCase(token,"CDF_REAL8",9)) return CDF_REAL8; - if (!strncmpIgCase(token,"CDF_DOUBLE",10)) return CDF_DOUBLE; - if (!strncmpIgCase(token,"CDF_CHAR",8)) return CDF_CHAR; - if (!strncmpIgCase(token,"CDF_UCHAR",9)) return CDF_UCHAR; - if (!strncmpIgCase(token,"CDF_EPOCH",9)) return CDF_EPOCH; - if (!strncmpIgCase(token,"CDF_EPOCH16",11)) return CDF_EPOCH16; + if (strncmpIgCase(token,"BYTE",4) != 0) return CDF_BYTE; + if (strncmpIgCase(token,"INT1",4) != 0) return CDF_INT1; + if (strncmpIgCase(token,"UINT1",5) != 0) return CDF_UINT1; + if (strncmpIgCase(token,"INT2",4) != 0) return CDF_INT2; + if (strncmpIgCase(token,"UINT2",5) != 0) return CDF_UINT2; + if (strncmpIgCase(token,"INT4",4) != 0) return CDF_INT4; + if (strncmpIgCase(token,"UINT4",5) != 0) return CDF_UINT4; + if (strncmpIgCase(token,"REAL4",5) != 0) return CDF_REAL4; + if (strncmpIgCase(token,"FLOAT",5) != 0) return CDF_FLOAT; + if (strncmpIgCase(token,"REAL8",5) != 0) return CDF_REAL8; + if (strncmpIgCase(token,"DOUBLE",6) != 0) return CDF_DOUBLE; + if (strncmpIgCase(token,"CHAR",4) != 0) return CDF_CHAR; + if (strncmpIgCase(token,"UCHAR",5) != 0) return CDF_UCHAR; + if (strncmpIgCase(token,"EPOCH",5) != 0) return CDF_EPOCH; + if (strncmpIgCase(token,"EPOCH16",7) != 0) return CDF_EPOCH16; + if (strncmpIgCase(token,"CDF_BYTE",8) != 0) return CDF_BYTE; + if (strncmpIgCase(token,"CDF_INT1",8) != 0) return CDF_INT1; + if (strncmpIgCase(token,"CDF_UINT1",9) != 0) return CDF_UINT1; + if (strncmpIgCase(token,"CDF_INT2",8) != 0) return CDF_INT2; + if (strncmpIgCase(token,"CDF_UINT2",9) != 0) return CDF_UINT2; + if (strncmpIgCase(token,"CDF_INT4",8) != 0) return CDF_INT4; + if (strncmpIgCase(token,"CDF_UINT4",9) != 0) return CDF_UINT4; + if (strncmpIgCase(token,"CDF_REAL4",9) != 0) return CDF_REAL4; + if (strncmpIgCase(token,"CDF_FLOAT",9) != 0) return CDF_FLOAT; + if (strncmpIgCase(token,"CDF_REAL8",9) != 0) return CDF_REAL8; + if (strncmpIgCase(token,"CDF_DOUBLE",10) != 0) return CDF_DOUBLE; + if (strncmpIgCase(token,"CDF_CHAR",8) != 0) return CDF_CHAR; + if (strncmpIgCase(token,"CDF_UCHAR",9) != 0) return CDF_UCHAR; + if (strncmpIgCase(token,"CDF_EPOCH",9) != 0) return CDF_EPOCH; + if (strncmpIgCase(token,"CDF_EPOCH16",11) != 0) return CDF_EPOCH16; return -1; } @@ -2221,6 +2223,8 @@ /****************************************************************************** * strcmpIgCase. +* It returns 1 if compared strings are identical with the same length +* 0 if compared (sub)strings are not same ******************************************************************************/ int strcmpIgCase (string1, string2) @@ -2229,21 +2233,20 @@ { int string1L = strlen(string1); int string2L = strlen(string2); - int maxL = MAXIMUM(string1L,string2L); int i; - for (i = 0; i < maxL; i++) { - if (i > string1L || i > string2L) break; - if (MakeLower(string1[i]) != MakeLower(string2[i])) { - return ((int) (string1[i] - string2[i])); - } + if (string1L != string2L) return 0; + for (i = 0; i < string1L; i++) { + if (MakeLower(string1[i]) != MakeLower(string2[i])) + return 0; } - if (string1L > string2L) return 1; - else if (string1L < string2L) return -1; - return 0; + return 1; } /****************************************************************************** * strncmpIgCase... Assuming count is the length from one of passed strings. +* It compares characters upto the passed count. +* It returns 1 if compared strings are identical with same length +* 0 if compared (sub)strings are not same ******************************************************************************/ int strncmpIgCase (string1, string2, count) @@ -2257,18 +2260,19 @@ maxL = MAXIMUM(string1L,string2L); maxL = MINIMUM(maxL,(int)count); for (i = 0; i < maxL; i++) { - if (i > string1L || i > string2L) break; + if (i == string1L || i == string2L) break; if (MakeLower(string1[i]) != MakeLower(string2[i])) { - return ((int) (string1[i] - string2[i])); + return 0; } } - if (string1L > string2L) return 1; - else if (string1L < string2L) return -1; - return 0; + if (string1L == string2L) return 1; + else return 0; } /****************************************************************************** * strncmpIgCasePattern. +* It returns 0 if compared strings are the same for the specified length +* 1 if compared (sub)strings do not have the same pattern ******************************************************************************/ int strncmpIgCasePattern (string1, string2, count) @@ -2869,6 +2873,10 @@ *((double *) toPtr) = (double) *((double *) fromPtr); *(((double *) toPtr) + 1) = (double) *(((double *) fromPtr) + 1); break; + case CDF_EPOCH16: + *((double *) toPtr) = (double) *((double *) fromPtr); + *(((double *) toPtr) + 1) = (double) *(((double *) fromPtr) + 1); + break; case CDF_CHAR: case CDF_UCHAR: { int i, j, len; @@ -3315,7 +3323,7 @@ int Long64Width (value) OFF_T value; { -#if !defined(win32) & !defined(__osf__) +#if !defined(win32) && !defined(__osf__) if (value < (OFF_T) -999999999999999999LL) return 20; if (value < (OFF_T) -99999999999999999LL) return 19; if (value < (OFF_T) -9999999999999999LL) return 18; diff -urN cdf31-dist.orig/src/tools/toolbox4.cpp cdf31-dist/src/tools/toolbox4.cpp --- cdf31-dist.orig/src/tools/toolbox4.cpp Thu Jan 1 01:00:00 1970 +++ cdf31-dist/src/tools/toolbox4.cpp Tue May 23 17:07:43 2006 @@ -0,0 +1,142 @@ +/****************************************************************************** +* +* NSSDC/CDF Toolbox of routines for CDF Toolkit (Win32). +* +* Version 1.0, 13-Nov-97, Hughes STX. +* +* Modification history: +* +* V1.0 13-Nov-97, J Love Original version. +* +******************************************************************************/ + +#define TOOLBOX4 +#include "cdftools.h" + +#include "stdafx.h" + +#if defined(SO) +#include "CDFxyzDoc.h" +extern CCDFxyzDoc *pTheDoc; +#endif + +#if defined(FSI) +#include "CDFfsiDoc.h" +extern CCDFfsiDoc *pTheDoc; +#endif + +/****************************************************************************** +* CheckForAbortSOwin32. +******************************************************************************/ + +#if defined(SO) +void CheckForAbortSOwin32 () { + for (;;) { + MSG msg; + if (!PeekMessage(&msg,NULL,0,0,PM_REMOVE)) break; + DispatchMessage (&msg); + } + return; +} +#endif + +/****************************************************************************** +* WriteOutWin32. +******************************************************************************/ + +#if defined(SO) +void WriteOutWin32 (char *text) { + pTheDoc->AddText (text); + CheckForAbortSOwin32 (); + return; +} +#endif + +/****************************************************************************** +* TransferTextAttrs. +******************************************************************************/ + +#if defined(FSI) +void TransferTextAttrs (char *text, char *attrs) { + pTheDoc->XferTextAttrs (text, attrs); + return; +} +#endif + +/****************************************************************************** +* SetCursorPosition. +******************************************************************************/ + +#if defined(FSI) +void SetCursorPosition (int row, int col) { + pTheDoc->CursorPos (row, col); + return; +} +#endif + +/****************************************************************************** +* WinMessageDialog. +******************************************************************************/ + +void WinMessageDialog (char *severity, char *msg) { + CString text(severity); + text += "\n"; + text += msg; + AfxMessageBox (text, MB_OK); + return; +} + +/****************************************************************************** +* DebugMessage. +******************************************************************************/ + +void DebugMessage (char *text) { + AfxMessageBox (text, MB_OK); + return; +} + +/****************************************************************************** +* BuildArgcArgv. +******************************************************************************/ + +#if 0 +void BuildArgcArgv (char *name, const char *qop, int *argC, char ***argV) { + const char *ptr1; const char *ptr2; int len; + *argC = 1; + *argV = (char **) malloc (*argC * sizeof(char *)); + (*argV)[*argC-1] = (char *) malloc (strlen(name) + 1); + strcpy ((*argV)[*argC-1], name); + ptr1 = qop; + for (;;) { + ptr1 += strspn (ptr1, " "); + if (*ptr1 == NUL) break; + switch (*ptr1) { + case '"': + case '\'': + ptr2 = strchr(ptr1+1,*ptr1); + if (ptr2 == NULL) return; /* Error */ + (*argC)++; + (*argV) = (char **) realloc (*argV, *argC * sizeof(char *)); + len = (ptr2 - 1) - (ptr1 + 1) + 1; + (*argV)[*argC-1] = (char *) malloc (len + 1); + strncpy ((*argV)[*argC-1], ptr1 + 1, len); + (*argV)[*argC-1][len] = NUL; + ptr1 = ptr2 + 1; + break; + default: + ptr2 = strchr(ptr1,' '); + if (ptr2 == NULL) ptr2 = ptr1 + strlen(ptr1); + (*argC)++; + (*argV) = (char **) realloc (*argV, *argC * sizeof(char *)); + len = (ptr2 - 1) - ptr1 + 1; + (*argV)[*argC-1] = (char *) malloc (len + 1); + strncpy ((*argV)[*argC-1], ptr1, len); + (*argV)[*argC-1][len] = NUL; + ptr1 = ptr2; + break; + } + } + return; +} +#endif +